@whetstone-research/doppler-sdk 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-QGJA5CFL.js → chunk-2NFQKIOB.js} +5 -3
- package/dist/chunk-2NFQKIOB.js.map +1 -0
- package/dist/{chunk-6FRZFA5R.cjs → chunk-AT33RY6T.cjs} +6 -2
- package/dist/chunk-AT33RY6T.cjs.map +1 -0
- package/dist/{chunk-5USQGM5X.cjs → chunk-LL7TW3GU.cjs} +36 -36
- package/dist/{chunk-5USQGM5X.cjs.map → chunk-LL7TW3GU.cjs.map} +1 -1
- package/dist/{chunk-MPM2L56F.js → chunk-ZQEEGBXT.js} +3 -3
- package/dist/{chunk-MPM2L56F.js.map → chunk-ZQEEGBXT.js.map} +1 -1
- package/dist/{pda-MLEPNVY5.js → pda-FLNTBIC5.js} +3 -3
- package/dist/pda-FLNTBIC5.js.map +1 -0
- package/dist/{pda-B7RUPQNR.cjs → pda-G25AJSXG.cjs} +16 -16
- package/dist/pda-G25AJSXG.cjs.map +1 -0
- package/dist/solana/index.cjs +264 -204
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +45 -6
- package/dist/solana/index.d.ts +45 -6
- package/dist/solana/index.js +112 -52
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/react/index.cjs +47 -47
- package/dist/solana/react/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-6FRZFA5R.cjs.map +0 -1
- package/dist/chunk-QGJA5CFL.js.map +0 -1
- package/dist/pda-B7RUPQNR.cjs.map +0 -1
- package/dist/pda-MLEPNVY5.js.map +0 -1
package/dist/solana/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkLL7TW3GU_cjs = require('../chunk-LL7TW3GU.cjs');
|
|
4
|
+
var chunkAT33RY6T_cjs = require('../chunk-AT33RY6T.cjs');
|
|
5
5
|
var chunkQ7SFCCGT_cjs = require('../chunk-Q7SFCCGT.cjs');
|
|
6
6
|
var kit = require('@solana/kit');
|
|
7
7
|
var programClientCore = require('@solana/program-client-core');
|
|
@@ -10,67 +10,69 @@ var sha3_js = require('@noble/hashes/sha3.js');
|
|
|
10
10
|
// src/solana/cpmm/index.ts
|
|
11
11
|
var cpmm_exports = {};
|
|
12
12
|
chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
13
|
-
ACCOUNT_DISCRIMINATORS: () =>
|
|
14
|
-
ACCOUNT_VERSION: () =>
|
|
13
|
+
ACCOUNT_DISCRIMINATORS: () => chunkAT33RY6T_cjs.ACCOUNT_DISCRIMINATORS,
|
|
14
|
+
ACCOUNT_VERSION: () => chunkAT33RY6T_cjs.ACCOUNT_VERSION,
|
|
15
15
|
ADD_LIQUIDITY_DISCRIMINATOR: () => ADD_LIQUIDITY_DISCRIMINATOR,
|
|
16
|
-
BPS_DENOM: () =>
|
|
16
|
+
BPS_DENOM: () => chunkAT33RY6T_cjs.BPS_DENOM,
|
|
17
17
|
CLOSE_POSITION_DISCRIMINATOR: () => CLOSE_POSITION_DISCRIMINATOR,
|
|
18
18
|
COLLECT_FEES_DISCRIMINATOR: () => COLLECT_FEES_DISCRIMINATOR,
|
|
19
19
|
COLLECT_PROTOCOL_FEES_DISCRIMINATOR: () => COLLECT_PROTOCOL_FEES_DISCRIMINATOR,
|
|
20
20
|
CPMM_ERROR_MESSAGES: () => CPMM_ERROR_MESSAGES,
|
|
21
|
-
CPMM_PROGRAM_ID: () =>
|
|
21
|
+
CPMM_PROGRAM_ID: () => chunkAT33RY6T_cjs.CPMM_PROGRAM_ID,
|
|
22
22
|
CREATE_POSITION_DISCRIMINATOR: () => CREATE_POSITION_DISCRIMINATOR,
|
|
23
23
|
CpmmError: () => CpmmError,
|
|
24
24
|
CpmmErrorCode: () => CpmmErrorCode,
|
|
25
25
|
INITIALIZE_CONFIG_DISCRIMINATOR: () => INITIALIZE_CONFIG_DISCRIMINATOR,
|
|
26
26
|
INITIALIZE_ORACLE_DISCRIMINATOR: () => INITIALIZE_ORACLE_DISCRIMINATOR,
|
|
27
27
|
INITIALIZE_POOL_DISCRIMINATOR: () => INITIALIZE_POOL_DISCRIMINATOR,
|
|
28
|
-
INSTRUCTION_DISCRIMINATORS: () =>
|
|
28
|
+
INSTRUCTION_DISCRIMINATORS: () => chunkAT33RY6T_cjs.INSTRUCTION_DISCRIMINATORS,
|
|
29
29
|
MAX_FEE_AMOUNT: () => MAX_FEE_AMOUNT,
|
|
30
|
-
MAX_ORACLE_OBSERVATIONS: () =>
|
|
31
|
-
MAX_SENTINEL_ALLOWLIST: () =>
|
|
30
|
+
MAX_ORACLE_OBSERVATIONS: () => chunkAT33RY6T_cjs.MAX_ORACLE_OBSERVATIONS,
|
|
31
|
+
MAX_SENTINEL_ALLOWLIST: () => chunkAT33RY6T_cjs.MAX_SENTINEL_ALLOWLIST,
|
|
32
32
|
ORACLE_CONSULT_DISCRIMINATOR: () => ORACLE_CONSULT_DISCRIMINATOR,
|
|
33
33
|
ORACLE_UPDATE_DISCRIMINATOR: () => ORACLE_UPDATE_DISCRIMINATOR,
|
|
34
34
|
PAUSE_DISCRIMINATOR: () => PAUSE_DISCRIMINATOR,
|
|
35
35
|
PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR: () => PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR,
|
|
36
|
-
Q64_ONE: () =>
|
|
36
|
+
Q64_ONE: () => chunkAT33RY6T_cjs.Q64_ONE,
|
|
37
37
|
QUOTE_TO_NUMERAIRE_DISCRIMINATOR: () => QUOTE_TO_NUMERAIRE_DISCRIMINATOR,
|
|
38
38
|
REMOVE_LIQUIDITY_DISCRIMINATOR: () => REMOVE_LIQUIDITY_DISCRIMINATOR,
|
|
39
|
-
SEED_AUTHORITY: () =>
|
|
40
|
-
SEED_CONFIG: () =>
|
|
41
|
-
SEED_ORACLE: () =>
|
|
42
|
-
SEED_POOL: () =>
|
|
43
|
-
SEED_POSITION: () =>
|
|
44
|
-
SEED_PROTOCOL_POSITION: () =>
|
|
45
|
-
SENTINEL_NO_CHANGE: () =>
|
|
39
|
+
SEED_AUTHORITY: () => chunkAT33RY6T_cjs.SEED_AUTHORITY,
|
|
40
|
+
SEED_CONFIG: () => chunkAT33RY6T_cjs.SEED_CONFIG,
|
|
41
|
+
SEED_ORACLE: () => chunkAT33RY6T_cjs.SEED_ORACLE,
|
|
42
|
+
SEED_POOL: () => chunkAT33RY6T_cjs.SEED_POOL,
|
|
43
|
+
SEED_POSITION: () => chunkAT33RY6T_cjs.SEED_POSITION,
|
|
44
|
+
SEED_PROTOCOL_POSITION: () => chunkAT33RY6T_cjs.SEED_PROTOCOL_POSITION,
|
|
45
|
+
SENTINEL_NO_CHANGE: () => chunkAT33RY6T_cjs.SENTINEL_NO_CHANGE,
|
|
46
46
|
SET_FEES_DISCRIMINATOR: () => SET_FEES_DISCRIMINATOR,
|
|
47
47
|
SET_ROUTE_DISCRIMINATOR: () => SET_ROUTE_DISCRIMINATOR,
|
|
48
48
|
SET_SENTINEL_DISCRIMINATOR: () => SET_SENTINEL_DISCRIMINATOR,
|
|
49
|
-
SF_AFTER_ADD_LIQ: () =>
|
|
50
|
-
SF_AFTER_REMOVE_LIQ: () =>
|
|
51
|
-
SF_AFTER_SWAP: () =>
|
|
52
|
-
SF_BEFORE_ADD_LIQ: () =>
|
|
53
|
-
SF_BEFORE_REMOVE_LIQ: () =>
|
|
54
|
-
SF_BEFORE_SWAP: () =>
|
|
49
|
+
SF_AFTER_ADD_LIQ: () => chunkAT33RY6T_cjs.SF_AFTER_ADD_LIQ,
|
|
50
|
+
SF_AFTER_REMOVE_LIQ: () => chunkAT33RY6T_cjs.SF_AFTER_REMOVE_LIQ,
|
|
51
|
+
SF_AFTER_SWAP: () => chunkAT33RY6T_cjs.SF_AFTER_SWAP,
|
|
52
|
+
SF_BEFORE_ADD_LIQ: () => chunkAT33RY6T_cjs.SF_BEFORE_ADD_LIQ,
|
|
53
|
+
SF_BEFORE_REMOVE_LIQ: () => chunkAT33RY6T_cjs.SF_BEFORE_REMOVE_LIQ,
|
|
54
|
+
SF_BEFORE_SWAP: () => chunkAT33RY6T_cjs.SF_BEFORE_SWAP,
|
|
55
|
+
SF_FORWARD_READONLY_SIGNERS: () => chunkAT33RY6T_cjs.SF_FORWARD_READONLY_SIGNERS,
|
|
56
|
+
SF_REQUIRE_ORACLE: () => chunkAT33RY6T_cjs.SF_REQUIRE_ORACLE,
|
|
55
57
|
SKIM_DISCRIMINATOR: () => SKIM_DISCRIMINATOR,
|
|
56
58
|
SWAP_EXACT_IN_DISCRIMINATOR: () => SWAP_EXACT_IN_DISCRIMINATOR,
|
|
57
|
-
TOKEN_METADATA_PROGRAM_ID: () =>
|
|
59
|
+
TOKEN_METADATA_PROGRAM_ID: () => chunkAT33RY6T_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
58
60
|
TRANSFER_ADMIN_DISCRIMINATOR: () => TRANSFER_ADMIN_DISCRIMINATOR,
|
|
59
61
|
UNPAUSE_DISCRIMINATOR: () => UNPAUSE_DISCRIMINATOR,
|
|
60
62
|
UPDATE_CONFIG_DISCRIMINATOR: () => UPDATE_CONFIG_DISCRIMINATOR,
|
|
61
|
-
addLiquidityArgsCodec: () =>
|
|
62
|
-
ammConfigDataCodec: () =>
|
|
63
|
-
areMintsOrdered: () =>
|
|
64
|
-
calculateAccruedFees: () =>
|
|
65
|
-
calculateTwap: () =>
|
|
66
|
-
calculateTwapNumber: () =>
|
|
67
|
-
ceilDiv: () =>
|
|
68
|
-
collectFeesArgsCodec: () =>
|
|
69
|
-
collectProtocolFeesArgsCodec: () =>
|
|
70
|
-
comparePoolAndOraclePrices: () =>
|
|
71
|
-
computePrice0Q64: () =>
|
|
72
|
-
computePrice1Q64: () =>
|
|
73
|
-
consultTwap: () =>
|
|
63
|
+
addLiquidityArgsCodec: () => chunkLL7TW3GU_cjs.addLiquidityArgsCodec,
|
|
64
|
+
ammConfigDataCodec: () => chunkLL7TW3GU_cjs.ammConfigDataCodec,
|
|
65
|
+
areMintsOrdered: () => chunkAT33RY6T_cjs.areMintsOrdered,
|
|
66
|
+
calculateAccruedFees: () => chunkLL7TW3GU_cjs.calculateAccruedFees,
|
|
67
|
+
calculateTwap: () => chunkLL7TW3GU_cjs.calculateTwap,
|
|
68
|
+
calculateTwapNumber: () => chunkLL7TW3GU_cjs.calculateTwapNumber,
|
|
69
|
+
ceilDiv: () => chunkLL7TW3GU_cjs.ceilDiv,
|
|
70
|
+
collectFeesArgsCodec: () => chunkLL7TW3GU_cjs.collectFeesArgsCodec,
|
|
71
|
+
collectProtocolFeesArgsCodec: () => chunkLL7TW3GU_cjs.collectProtocolFeesArgsCodec,
|
|
72
|
+
comparePoolAndOraclePrices: () => chunkLL7TW3GU_cjs.comparePoolAndOraclePrices,
|
|
73
|
+
computePrice0Q64: () => chunkLL7TW3GU_cjs.computePrice0Q64,
|
|
74
|
+
computePrice1Q64: () => chunkLL7TW3GU_cjs.computePrice1Q64,
|
|
75
|
+
consultTwap: () => chunkLL7TW3GU_cjs.consultTwap,
|
|
74
76
|
createAddLiquidityInstruction: () => getAddLiquidityInstruction,
|
|
75
77
|
createClosePositionInstruction: () => getClosePositionInstruction,
|
|
76
78
|
createCollectFeesInstruction: () => getCollectFeesInstruction,
|
|
@@ -82,7 +84,7 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
82
84
|
createOracleConsultInstruction: () => getOracleConsultInstruction,
|
|
83
85
|
createOracleUpdateInstruction: () => getOracleUpdateInstruction,
|
|
84
86
|
createPauseInstruction: () => getPauseInstruction,
|
|
85
|
-
createPositionArgsCodec: () =>
|
|
87
|
+
createPositionArgsCodec: () => chunkLL7TW3GU_cjs.createPositionArgsCodec,
|
|
86
88
|
createQuoteToNumeraireInstruction: () => getQuoteToNumeraireInstruction,
|
|
87
89
|
createRemoveLiquidityInstruction: () => getRemoveLiquidityInstruction,
|
|
88
90
|
createSetFeesInstruction: () => getSetFeesInstruction,
|
|
@@ -94,47 +96,47 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
94
96
|
createTransferAdminInstruction: () => getTransferAdminInstruction,
|
|
95
97
|
createUnpauseInstruction: () => getUnpauseInstruction,
|
|
96
98
|
curveParamsToMarketCap: () => curveParamsToMarketCap,
|
|
97
|
-
decodeAmmConfig: () =>
|
|
98
|
-
decodeOracleState: () =>
|
|
99
|
-
decodePool: () =>
|
|
100
|
-
decodePosition: () =>
|
|
101
|
-
encodeAddLiquidityArgs: () =>
|
|
102
|
-
encodeCollectFeesArgs: () =>
|
|
103
|
-
encodeCollectProtocolFeesArgs: () =>
|
|
104
|
-
encodeCreatePositionArgs: () =>
|
|
105
|
-
encodeInitializeConfigArgs: () =>
|
|
106
|
-
encodeInitializeOracleArgs: () =>
|
|
107
|
-
encodeInitializePoolArgs: () =>
|
|
108
|
-
encodeInstructionData: () =>
|
|
109
|
-
encodeOracleConsultArgs: () =>
|
|
110
|
-
encodeQuoteToNumeraireArgs: () =>
|
|
111
|
-
encodeRemoveLiquidityArgs: () =>
|
|
112
|
-
encodeSetFeesArgs: () =>
|
|
113
|
-
encodeSetRouteArgs: () =>
|
|
114
|
-
encodeSetSentinelArgs: () =>
|
|
115
|
-
encodeSwapExactInArgs: () =>
|
|
116
|
-
encodeTransferAdminArgs: () =>
|
|
117
|
-
fetchAllPools: () =>
|
|
99
|
+
decodeAmmConfig: () => chunkLL7TW3GU_cjs.decodeAmmConfig,
|
|
100
|
+
decodeOracleState: () => chunkLL7TW3GU_cjs.decodeOracleState,
|
|
101
|
+
decodePool: () => chunkLL7TW3GU_cjs.decodePool,
|
|
102
|
+
decodePosition: () => chunkLL7TW3GU_cjs.decodePosition,
|
|
103
|
+
encodeAddLiquidityArgs: () => chunkLL7TW3GU_cjs.encodeAddLiquidityArgs,
|
|
104
|
+
encodeCollectFeesArgs: () => chunkLL7TW3GU_cjs.encodeCollectFeesArgs,
|
|
105
|
+
encodeCollectProtocolFeesArgs: () => chunkLL7TW3GU_cjs.encodeCollectProtocolFeesArgs,
|
|
106
|
+
encodeCreatePositionArgs: () => chunkLL7TW3GU_cjs.encodeCreatePositionArgs,
|
|
107
|
+
encodeInitializeConfigArgs: () => chunkLL7TW3GU_cjs.encodeInitializeConfigArgs,
|
|
108
|
+
encodeInitializeOracleArgs: () => chunkLL7TW3GU_cjs.encodeInitializeOracleArgs,
|
|
109
|
+
encodeInitializePoolArgs: () => chunkLL7TW3GU_cjs.encodeInitializePoolArgs,
|
|
110
|
+
encodeInstructionData: () => chunkLL7TW3GU_cjs.encodeInstructionData,
|
|
111
|
+
encodeOracleConsultArgs: () => chunkLL7TW3GU_cjs.encodeOracleConsultArgs,
|
|
112
|
+
encodeQuoteToNumeraireArgs: () => chunkLL7TW3GU_cjs.encodeQuoteToNumeraireArgs,
|
|
113
|
+
encodeRemoveLiquidityArgs: () => chunkLL7TW3GU_cjs.encodeRemoveLiquidityArgs,
|
|
114
|
+
encodeSetFeesArgs: () => chunkLL7TW3GU_cjs.encodeSetFeesArgs,
|
|
115
|
+
encodeSetRouteArgs: () => chunkLL7TW3GU_cjs.encodeSetRouteArgs,
|
|
116
|
+
encodeSetSentinelArgs: () => chunkLL7TW3GU_cjs.encodeSetSentinelArgs,
|
|
117
|
+
encodeSwapExactInArgs: () => chunkLL7TW3GU_cjs.encodeSwapExactInArgs,
|
|
118
|
+
encodeTransferAdminArgs: () => chunkLL7TW3GU_cjs.encodeTransferAdminArgs,
|
|
119
|
+
fetchAllPools: () => chunkLL7TW3GU_cjs.fetchAllPools,
|
|
118
120
|
fetchConfig: () => fetchConfig,
|
|
119
121
|
fetchConfigWithAddress: () => fetchConfigWithAddress,
|
|
120
|
-
fetchOracle: () =>
|
|
121
|
-
fetchOraclesBatch: () =>
|
|
122
|
-
fetchPool: () =>
|
|
123
|
-
fetchPoolPositions: () =>
|
|
124
|
-
fetchPoolsBatch: () =>
|
|
125
|
-
fetchPosition: () =>
|
|
126
|
-
fetchPositionByParams: () =>
|
|
127
|
-
fetchPositionsBatch: () =>
|
|
128
|
-
fetchUserPositions: () =>
|
|
129
|
-
filterActivePositions: () =>
|
|
130
|
-
filterPoolsByMint: () =>
|
|
122
|
+
fetchOracle: () => chunkLL7TW3GU_cjs.fetchOracle,
|
|
123
|
+
fetchOraclesBatch: () => chunkLL7TW3GU_cjs.fetchOraclesBatch,
|
|
124
|
+
fetchPool: () => chunkLL7TW3GU_cjs.fetchPool,
|
|
125
|
+
fetchPoolPositions: () => chunkLL7TW3GU_cjs.fetchPoolPositions,
|
|
126
|
+
fetchPoolsBatch: () => chunkLL7TW3GU_cjs.fetchPoolsBatch,
|
|
127
|
+
fetchPosition: () => chunkLL7TW3GU_cjs.fetchPosition,
|
|
128
|
+
fetchPositionByParams: () => chunkLL7TW3GU_cjs.fetchPositionByParams,
|
|
129
|
+
fetchPositionsBatch: () => chunkLL7TW3GU_cjs.fetchPositionsBatch,
|
|
130
|
+
fetchUserPositions: () => chunkLL7TW3GU_cjs.fetchUserPositions,
|
|
131
|
+
filterActivePositions: () => chunkLL7TW3GU_cjs.filterActivePositions,
|
|
132
|
+
filterPoolsByMint: () => chunkLL7TW3GU_cjs.filterPoolsByMint,
|
|
131
133
|
getAddLiquidityDiscriminatorBytes: () => getAddLiquidityDiscriminatorBytes,
|
|
132
134
|
getAddLiquidityInstruction: () => getAddLiquidityInstruction,
|
|
133
135
|
getAddLiquidityInstructionAsync: () => getAddLiquidityInstructionAsync,
|
|
134
136
|
getAddLiquidityInstructionDataCodec: () => getAddLiquidityInstructionDataCodec,
|
|
135
137
|
getAddLiquidityInstructionDataDecoder: () => getAddLiquidityInstructionDataDecoder,
|
|
136
138
|
getAddLiquidityInstructionDataEncoder: () => getAddLiquidityInstructionDataEncoder,
|
|
137
|
-
getAddLiquidityQuote: () =>
|
|
139
|
+
getAddLiquidityQuote: () => chunkLL7TW3GU_cjs.getAddLiquidityQuote,
|
|
138
140
|
getClosePositionDiscriminatorBytes: () => getClosePositionDiscriminatorBytes,
|
|
139
141
|
getClosePositionInstruction: () => getClosePositionInstruction,
|
|
140
142
|
getClosePositionInstructionDataCodec: () => getClosePositionInstructionDataCodec,
|
|
@@ -152,7 +154,7 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
152
154
|
getCollectProtocolFeesInstructionDataCodec: () => getCollectProtocolFeesInstructionDataCodec,
|
|
153
155
|
getCollectProtocolFeesInstructionDataDecoder: () => getCollectProtocolFeesInstructionDataDecoder,
|
|
154
156
|
getCollectProtocolFeesInstructionDataEncoder: () => getCollectProtocolFeesInstructionDataEncoder,
|
|
155
|
-
getConfigAddress: () =>
|
|
157
|
+
getConfigAddress: () => chunkAT33RY6T_cjs.getConfigAddress,
|
|
156
158
|
getCreatePositionDiscriminatorBytes: () => getCreatePositionDiscriminatorBytes,
|
|
157
159
|
getCreatePositionInstruction: () => getCreatePositionInstruction,
|
|
158
160
|
getCreatePositionInstructionAsync: () => getCreatePositionInstructionAsync,
|
|
@@ -178,22 +180,22 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
178
180
|
getInitializePoolInstructionDataCodec: () => getInitializePoolInstructionDataCodec,
|
|
179
181
|
getInitializePoolInstructionDataDecoder: () => getInitializePoolInstructionDataDecoder,
|
|
180
182
|
getInitializePoolInstructionDataEncoder: () => getInitializePoolInstructionDataEncoder,
|
|
181
|
-
getK: () =>
|
|
182
|
-
getLiquidityAddresses: () =>
|
|
183
|
+
getK: () => chunkLL7TW3GU_cjs.getK,
|
|
184
|
+
getLiquidityAddresses: () => chunkAT33RY6T_cjs.getLiquidityAddresses,
|
|
183
185
|
getMetadataAddress: () => getMetadataAddress,
|
|
184
|
-
getOracleAddress: () =>
|
|
185
|
-
getOracleAddressFromPool: () =>
|
|
186
|
-
getOracleAge: () =>
|
|
187
|
-
getOracleBufferStats: () =>
|
|
186
|
+
getOracleAddress: () => chunkAT33RY6T_cjs.getOracleAddress,
|
|
187
|
+
getOracleAddressFromPool: () => chunkLL7TW3GU_cjs.getOracleAddressFromPool,
|
|
188
|
+
getOracleAge: () => chunkLL7TW3GU_cjs.getOracleAge,
|
|
189
|
+
getOracleBufferStats: () => chunkLL7TW3GU_cjs.getOracleBufferStats,
|
|
188
190
|
getOracleConsultDiscriminatorBytes: () => getOracleConsultDiscriminatorBytes,
|
|
189
191
|
getOracleConsultInstruction: () => getOracleConsultInstruction,
|
|
190
192
|
getOracleConsultInstructionAsync: () => getOracleConsultInstructionAsync,
|
|
191
193
|
getOracleConsultInstructionDataCodec: () => getOracleConsultInstructionDataCodec,
|
|
192
194
|
getOracleConsultInstructionDataDecoder: () => getOracleConsultInstructionDataDecoder,
|
|
193
195
|
getOracleConsultInstructionDataEncoder: () => getOracleConsultInstructionDataEncoder,
|
|
194
|
-
getOracleDeviation: () =>
|
|
195
|
-
getOracleForPool: () =>
|
|
196
|
-
getOracleSpotPrices: () =>
|
|
196
|
+
getOracleDeviation: () => chunkLL7TW3GU_cjs.getOracleDeviation,
|
|
197
|
+
getOracleForPool: () => chunkLL7TW3GU_cjs.getOracleForPool,
|
|
198
|
+
getOracleSpotPrices: () => chunkLL7TW3GU_cjs.getOracleSpotPrices,
|
|
197
199
|
getOracleUpdateDiscriminatorBytes: () => getOracleUpdateDiscriminatorBytes,
|
|
198
200
|
getOracleUpdateInstruction: () => getOracleUpdateInstruction,
|
|
199
201
|
getOracleUpdateInstructionAsync: () => getOracleUpdateInstructionAsync,
|
|
@@ -205,23 +207,23 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
205
207
|
getPauseInstructionDataCodec: () => getPauseInstructionDataCodec,
|
|
206
208
|
getPauseInstructionDataDecoder: () => getPauseInstructionDataDecoder,
|
|
207
209
|
getPauseInstructionDataEncoder: () => getPauseInstructionDataEncoder,
|
|
208
|
-
getPendingFees: () =>
|
|
209
|
-
getPoolAddress: () =>
|
|
210
|
-
getPoolAddressFromMints: () =>
|
|
211
|
-
getPoolAuthorityAddress: () =>
|
|
212
|
-
getPoolByMints: () =>
|
|
213
|
-
getPoolInitAddresses: () =>
|
|
214
|
-
getPoolVault0Address: () =>
|
|
215
|
-
getPoolVault1Address: () =>
|
|
216
|
-
getPositionAddress: () =>
|
|
217
|
-
getPositionAddressFromParams: () =>
|
|
218
|
-
getPositionValue: () =>
|
|
210
|
+
getPendingFees: () => chunkLL7TW3GU_cjs.getPendingFees,
|
|
211
|
+
getPoolAddress: () => chunkAT33RY6T_cjs.getPoolAddress,
|
|
212
|
+
getPoolAddressFromMints: () => chunkLL7TW3GU_cjs.getPoolAddressFromMints,
|
|
213
|
+
getPoolAuthorityAddress: () => chunkAT33RY6T_cjs.getPoolAuthorityAddress,
|
|
214
|
+
getPoolByMints: () => chunkLL7TW3GU_cjs.getPoolByMints,
|
|
215
|
+
getPoolInitAddresses: () => chunkAT33RY6T_cjs.getPoolInitAddresses,
|
|
216
|
+
getPoolVault0Address: () => chunkAT33RY6T_cjs.getPoolVault0Address,
|
|
217
|
+
getPoolVault1Address: () => chunkAT33RY6T_cjs.getPoolVault1Address,
|
|
218
|
+
getPositionAddress: () => chunkAT33RY6T_cjs.getPositionAddress,
|
|
219
|
+
getPositionAddressFromParams: () => chunkLL7TW3GU_cjs.getPositionAddressFromParams,
|
|
220
|
+
getPositionValue: () => chunkLL7TW3GU_cjs.getPositionValue,
|
|
219
221
|
getPreviewSwapExactInDiscriminatorBytes: () => getPreviewSwapExactInDiscriminatorBytes,
|
|
220
222
|
getPreviewSwapExactInInstruction: () => getPreviewSwapExactInInstruction,
|
|
221
223
|
getPreviewSwapExactInInstructionDataCodec: () => getPreviewSwapExactInInstructionDataCodec,
|
|
222
224
|
getPreviewSwapExactInInstructionDataDecoder: () => getPreviewSwapExactInInstructionDataDecoder,
|
|
223
225
|
getPreviewSwapExactInInstructionDataEncoder: () => getPreviewSwapExactInInstructionDataEncoder,
|
|
224
|
-
getProtocolPositionAddress: () =>
|
|
226
|
+
getProtocolPositionAddress: () => chunkAT33RY6T_cjs.getProtocolPositionAddress,
|
|
225
227
|
getQuoteToNumeraireDiscriminatorBytes: () => getQuoteToNumeraireDiscriminatorBytes,
|
|
226
228
|
getQuoteToNumeraireInstruction: () => getQuoteToNumeraireInstruction,
|
|
227
229
|
getQuoteToNumeraireInstructionDataCodec: () => getQuoteToNumeraireInstructionDataCodec,
|
|
@@ -233,7 +235,7 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
233
235
|
getRemoveLiquidityInstructionDataCodec: () => getRemoveLiquidityInstructionDataCodec,
|
|
234
236
|
getRemoveLiquidityInstructionDataDecoder: () => getRemoveLiquidityInstructionDataDecoder,
|
|
235
237
|
getRemoveLiquidityInstructionDataEncoder: () => getRemoveLiquidityInstructionDataEncoder,
|
|
236
|
-
getRemoveLiquidityQuote: () =>
|
|
238
|
+
getRemoveLiquidityQuote: () => chunkLL7TW3GU_cjs.getRemoveLiquidityQuote,
|
|
237
239
|
getSetFeesDiscriminatorBytes: () => getSetFeesDiscriminatorBytes,
|
|
238
240
|
getSetFeesInstruction: () => getSetFeesInstruction,
|
|
239
241
|
getSetFeesInstructionDataCodec: () => getSetFeesInstructionDataCodec,
|
|
@@ -255,23 +257,23 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
255
257
|
getSkimInstructionDataCodec: () => getSkimInstructionDataCodec,
|
|
256
258
|
getSkimInstructionDataDecoder: () => getSkimInstructionDataDecoder,
|
|
257
259
|
getSkimInstructionDataEncoder: () => getSkimInstructionDataEncoder,
|
|
258
|
-
getSpotPrice0: () =>
|
|
259
|
-
getSpotPrice1: () =>
|
|
260
|
-
getSwapAddresses: () =>
|
|
260
|
+
getSpotPrice0: () => chunkLL7TW3GU_cjs.getSpotPrice0,
|
|
261
|
+
getSpotPrice1: () => chunkLL7TW3GU_cjs.getSpotPrice1,
|
|
262
|
+
getSwapAddresses: () => chunkAT33RY6T_cjs.getSwapAddresses,
|
|
261
263
|
getSwapExactInDiscriminatorBytes: () => getSwapExactInDiscriminatorBytes,
|
|
262
264
|
getSwapExactInInstruction: () => getSwapExactInInstruction,
|
|
263
265
|
getSwapExactInInstructionAsync: () => getSwapExactInInstructionAsync,
|
|
264
266
|
getSwapExactInInstructionDataCodec: () => getSwapExactInInstructionDataCodec,
|
|
265
267
|
getSwapExactInInstructionDataDecoder: () => getSwapExactInInstructionDataDecoder,
|
|
266
268
|
getSwapExactInInstructionDataEncoder: () => getSwapExactInInstructionDataEncoder,
|
|
267
|
-
getSwapQuote: () =>
|
|
268
|
-
getSwapQuoteExactOut: () =>
|
|
269
|
+
getSwapQuote: () => chunkLL7TW3GU_cjs.getSwapQuote,
|
|
270
|
+
getSwapQuoteExactOut: () => chunkLL7TW3GU_cjs.getSwapQuoteExactOut,
|
|
269
271
|
getTransferAdminDiscriminatorBytes: () => getTransferAdminDiscriminatorBytes,
|
|
270
272
|
getTransferAdminInstruction: () => getTransferAdminInstruction,
|
|
271
273
|
getTransferAdminInstructionDataCodec: () => getTransferAdminInstructionDataCodec,
|
|
272
274
|
getTransferAdminInstructionDataDecoder: () => getTransferAdminInstructionDataDecoder,
|
|
273
275
|
getTransferAdminInstructionDataEncoder: () => getTransferAdminInstructionDataEncoder,
|
|
274
|
-
getTvl: () =>
|
|
276
|
+
getTvl: () => chunkLL7TW3GU_cjs.getTvl,
|
|
275
277
|
getUnpauseDiscriminatorBytes: () => getUnpauseDiscriminatorBytes,
|
|
276
278
|
getUnpauseInstruction: () => getUnpauseInstruction,
|
|
277
279
|
getUnpauseInstructionDataCodec: () => getUnpauseInstructionDataCodec,
|
|
@@ -282,21 +284,21 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
282
284
|
getUpdateConfigInstructionDataCodec: () => getUpdateConfigInstructionDataCodec,
|
|
283
285
|
getUpdateConfigInstructionDataDecoder: () => getUpdateConfigInstructionDataDecoder,
|
|
284
286
|
getUpdateConfigInstructionDataEncoder: () => getUpdateConfigInstructionDataEncoder,
|
|
285
|
-
initializeConfigArgsCodec: () =>
|
|
286
|
-
initializeOracleArgsCodec: () =>
|
|
287
|
-
initializePoolArgsCodec: () =>
|
|
287
|
+
initializeConfigArgsCodec: () => chunkLL7TW3GU_cjs.initializeConfigArgsCodec,
|
|
288
|
+
initializeOracleArgsCodec: () => chunkLL7TW3GU_cjs.initializeOracleArgsCodec,
|
|
289
|
+
initializePoolArgsCodec: () => chunkLL7TW3GU_cjs.initializePoolArgsCodec,
|
|
288
290
|
isCpmmError: () => isCpmmError,
|
|
289
|
-
isOracleStale: () =>
|
|
290
|
-
isqrt: () =>
|
|
291
|
+
isOracleStale: () => chunkLL7TW3GU_cjs.isOracleStale,
|
|
292
|
+
isqrt: () => chunkLL7TW3GU_cjs.isqrt,
|
|
291
293
|
marketCapToCurveParams: () => marketCapToCurveParams,
|
|
292
294
|
marketCapToSingleCurveParams: () => marketCapToSingleCurveParams,
|
|
293
295
|
marketCapToTokenPrice: () => marketCapToTokenPrice,
|
|
294
|
-
maxBigInt: () =>
|
|
295
|
-
minBigInt: () =>
|
|
296
|
-
numberToQ64: () =>
|
|
297
|
-
observationCodec: () =>
|
|
298
|
-
oracleConsultArgsCodec: () =>
|
|
299
|
-
oracleStateDataCodec: () =>
|
|
296
|
+
maxBigInt: () => chunkLL7TW3GU_cjs.maxBigInt,
|
|
297
|
+
minBigInt: () => chunkLL7TW3GU_cjs.minBigInt,
|
|
298
|
+
numberToQ64: () => chunkLL7TW3GU_cjs.numberToQ64,
|
|
299
|
+
observationCodec: () => chunkLL7TW3GU_cjs.observationCodec,
|
|
300
|
+
oracleConsultArgsCodec: () => chunkLL7TW3GU_cjs.oracleConsultArgsCodec,
|
|
301
|
+
oracleStateDataCodec: () => chunkLL7TW3GU_cjs.oracleStateDataCodec,
|
|
300
302
|
parseAddLiquidityInstruction: () => parseAddLiquidityInstruction,
|
|
301
303
|
parseClosePositionInstruction: () => parseClosePositionInstruction,
|
|
302
304
|
parseCollectFeesInstruction: () => parseCollectFeesInstruction,
|
|
@@ -320,33 +322,33 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
320
322
|
parseTransferAdminInstruction: () => parseTransferAdminInstruction,
|
|
321
323
|
parseUnpauseInstruction: () => parseUnpauseInstruction,
|
|
322
324
|
parseUpdateConfigInstruction: () => parseUpdateConfigInstruction,
|
|
323
|
-
poolDataCodec: () =>
|
|
324
|
-
poolExists: () =>
|
|
325
|
-
positionDataCodec: () =>
|
|
326
|
-
q64Div: () =>
|
|
327
|
-
q64Mul: () =>
|
|
328
|
-
q64ToNumber: () =>
|
|
329
|
-
quoteToNumeraireArgsCodec: () =>
|
|
330
|
-
ratioToNumber: () =>
|
|
331
|
-
removeLiquidityArgsCodec: () =>
|
|
332
|
-
setFeesArgsCodec: () =>
|
|
333
|
-
setRouteArgsCodec: () =>
|
|
334
|
-
setSentinelArgsCodec: () =>
|
|
335
|
-
sortMints: () =>
|
|
336
|
-
sortPoolsByReserves: () =>
|
|
337
|
-
sortPositionsByShares: () =>
|
|
338
|
-
swapExactInArgsCodec: () =>
|
|
339
|
-
transferAdminArgsCodec: () =>
|
|
325
|
+
poolDataCodec: () => chunkLL7TW3GU_cjs.poolDataCodec,
|
|
326
|
+
poolExists: () => chunkLL7TW3GU_cjs.poolExists,
|
|
327
|
+
positionDataCodec: () => chunkLL7TW3GU_cjs.positionDataCodec,
|
|
328
|
+
q64Div: () => chunkLL7TW3GU_cjs.q64Div,
|
|
329
|
+
q64Mul: () => chunkLL7TW3GU_cjs.q64Mul,
|
|
330
|
+
q64ToNumber: () => chunkLL7TW3GU_cjs.q64ToNumber,
|
|
331
|
+
quoteToNumeraireArgsCodec: () => chunkLL7TW3GU_cjs.quoteToNumeraireArgsCodec,
|
|
332
|
+
ratioToNumber: () => chunkLL7TW3GU_cjs.ratioToNumber,
|
|
333
|
+
removeLiquidityArgsCodec: () => chunkLL7TW3GU_cjs.removeLiquidityArgsCodec,
|
|
334
|
+
setFeesArgsCodec: () => chunkLL7TW3GU_cjs.setFeesArgsCodec,
|
|
335
|
+
setRouteArgsCodec: () => chunkLL7TW3GU_cjs.setRouteArgsCodec,
|
|
336
|
+
setSentinelArgsCodec: () => chunkLL7TW3GU_cjs.setSentinelArgsCodec,
|
|
337
|
+
sortMints: () => chunkAT33RY6T_cjs.sortMints,
|
|
338
|
+
sortPoolsByReserves: () => chunkLL7TW3GU_cjs.sortPoolsByReserves,
|
|
339
|
+
sortPositionsByShares: () => chunkLL7TW3GU_cjs.sortPositionsByShares,
|
|
340
|
+
swapExactInArgsCodec: () => chunkLL7TW3GU_cjs.swapExactInArgsCodec,
|
|
341
|
+
transferAdminArgsCodec: () => chunkLL7TW3GU_cjs.transferAdminArgsCodec,
|
|
340
342
|
validateMarketCapParameters: () => validateMarketCapParameters
|
|
341
343
|
});
|
|
342
344
|
var addressCodec = kit.getAddressCodec();
|
|
343
345
|
var textEncoder = new TextEncoder();
|
|
344
346
|
async function getMetadataAddress(mint) {
|
|
345
347
|
return kit.getProgramDerivedAddress({
|
|
346
|
-
programAddress:
|
|
348
|
+
programAddress: chunkAT33RY6T_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
347
349
|
seeds: [
|
|
348
350
|
textEncoder.encode("metadata"),
|
|
349
|
-
addressCodec.encode(
|
|
351
|
+
addressCodec.encode(chunkAT33RY6T_cjs.TOKEN_METADATA_PROGRAM_ID),
|
|
350
352
|
addressCodec.encode(mint)
|
|
351
353
|
]
|
|
352
354
|
});
|
|
@@ -3488,6 +3490,22 @@ function parseUpdateConfigInstruction(instruction) {
|
|
|
3488
3490
|
data: getUpdateConfigInstructionDataDecoder().decode(instruction.data)
|
|
3489
3491
|
};
|
|
3490
3492
|
}
|
|
3493
|
+
function isTransactionSigner(value) {
|
|
3494
|
+
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
3495
|
+
}
|
|
3496
|
+
function toRemainingAccountMeta(account) {
|
|
3497
|
+
if (typeof account === "string") {
|
|
3498
|
+
return { address: account, role: kit.AccountRole.READONLY };
|
|
3499
|
+
}
|
|
3500
|
+
if (isTransactionSigner(account)) {
|
|
3501
|
+
return {
|
|
3502
|
+
address: account.address,
|
|
3503
|
+
role: kit.AccountRole.READONLY_SIGNER,
|
|
3504
|
+
signer: account
|
|
3505
|
+
};
|
|
3506
|
+
}
|
|
3507
|
+
return account;
|
|
3508
|
+
}
|
|
3491
3509
|
function createSwapInstruction(params) {
|
|
3492
3510
|
const {
|
|
3493
3511
|
config,
|
|
@@ -3511,6 +3529,7 @@ function createSwapInstruction(params) {
|
|
|
3511
3529
|
tokenProgram,
|
|
3512
3530
|
programId = CPMM_PROGRAM_ADDRESS
|
|
3513
3531
|
} = params;
|
|
3532
|
+
const trader = typeof user === "string" ? kit.createNoopSigner(user) : user;
|
|
3514
3533
|
const [vaultIn, vaultOut] = direction === 0 ? [vault0, vault1] : [vault1, vault0];
|
|
3515
3534
|
const [userIn, userOut] = direction === 0 ? [userToken0, userToken1] : [userToken1, userToken0];
|
|
3516
3535
|
const instruction = getSwapExactInInstruction(
|
|
@@ -3524,9 +3543,9 @@ function createSwapInstruction(params) {
|
|
|
3524
3543
|
token1Mint,
|
|
3525
3544
|
userIn,
|
|
3526
3545
|
userOut,
|
|
3527
|
-
trader
|
|
3528
|
-
token0Program: token0Program ?? tokenProgram ??
|
|
3529
|
-
token1Program: token1Program ?? tokenProgram ??
|
|
3546
|
+
trader,
|
|
3547
|
+
token0Program: token0Program ?? tokenProgram ?? chunkAT33RY6T_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
3548
|
+
token1Program: token1Program ?? tokenProgram ?? chunkAT33RY6T_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
3530
3549
|
oracle,
|
|
3531
3550
|
amountIn,
|
|
3532
3551
|
minAmountOut,
|
|
@@ -3539,10 +3558,7 @@ function createSwapInstruction(params) {
|
|
|
3539
3558
|
...instruction,
|
|
3540
3559
|
accounts: [
|
|
3541
3560
|
...instruction.accounts ?? [],
|
|
3542
|
-
...remainingAccounts.map(
|
|
3543
|
-
address: address3,
|
|
3544
|
-
role: kit.AccountRole.READONLY
|
|
3545
|
-
}))
|
|
3561
|
+
...remainingAccounts.map(toRemainingAccountMeta)
|
|
3546
3562
|
]
|
|
3547
3563
|
};
|
|
3548
3564
|
}
|
|
@@ -3557,8 +3573,8 @@ function base64ToBytes(base64) {
|
|
|
3557
3573
|
}
|
|
3558
3574
|
return bytes;
|
|
3559
3575
|
}
|
|
3560
|
-
async function fetchConfig(rpc, programId =
|
|
3561
|
-
const [configAddress] = await
|
|
3576
|
+
async function fetchConfig(rpc, programId = chunkAT33RY6T_cjs.CPMM_PROGRAM_ID, commitment) {
|
|
3577
|
+
const [configAddress] = await chunkAT33RY6T_cjs.getConfigAddress(programId);
|
|
3562
3578
|
const response = await rpc.getAccountInfo(configAddress, {
|
|
3563
3579
|
encoding: "base64",
|
|
3564
3580
|
commitment
|
|
@@ -3566,10 +3582,10 @@ async function fetchConfig(rpc, programId = chunk6FRZFA5R_cjs.CPMM_PROGRAM_ID, c
|
|
|
3566
3582
|
if (!response.value) {
|
|
3567
3583
|
return null;
|
|
3568
3584
|
}
|
|
3569
|
-
return
|
|
3585
|
+
return chunkLL7TW3GU_cjs.decodeAmmConfig(base64ToBytes(response.value.data[0]));
|
|
3570
3586
|
}
|
|
3571
|
-
async function fetchConfigWithAddress(rpc, programId =
|
|
3572
|
-
const [configAddress] = await
|
|
3587
|
+
async function fetchConfigWithAddress(rpc, programId = chunkAT33RY6T_cjs.CPMM_PROGRAM_ID, commitment) {
|
|
3588
|
+
const [configAddress] = await chunkAT33RY6T_cjs.getConfigAddress(programId);
|
|
3573
3589
|
const account = await fetchConfig(rpc, programId, commitment);
|
|
3574
3590
|
if (!account) {
|
|
3575
3591
|
return null;
|
|
@@ -3602,7 +3618,11 @@ chunkQ7SFCCGT_cjs.__export(initializer_exports, {
|
|
|
3602
3618
|
SEED_LAUNCH: () => SEED_LAUNCH,
|
|
3603
3619
|
SEED_LAUNCH_AUTHORITY: () => SEED_LAUNCH_AUTHORITY,
|
|
3604
3620
|
SENTINEL_NO_CHANGE: () => SENTINEL_NO_CHANGE2,
|
|
3621
|
+
SF_AFTER_CREATE: () => SF_AFTER_CREATE,
|
|
3622
|
+
SF_AFTER_MIGRATE: () => SF_AFTER_MIGRATE,
|
|
3605
3623
|
SF_AFTER_SWAP: () => SF_AFTER_SWAP2,
|
|
3624
|
+
SF_BEFORE_CREATE: () => SF_BEFORE_CREATE,
|
|
3625
|
+
SF_BEFORE_MIGRATE: () => SF_BEFORE_MIGRATE,
|
|
3606
3626
|
SF_BEFORE_SWAP: () => SF_BEFORE_SWAP2,
|
|
3607
3627
|
computeRemainingAccountsHash: () => computeRemainingAccountsHash,
|
|
3608
3628
|
createCurveSwapExactInInstruction: () => createCurveSwapExactInInstruction,
|
|
@@ -3704,6 +3724,10 @@ var CURVE_KIND_XYK = 0;
|
|
|
3704
3724
|
var CURVE_PARAMS_FORMAT_XYK_V0 = 0;
|
|
3705
3725
|
var SF_BEFORE_SWAP2 = 1 << 0;
|
|
3706
3726
|
var SF_AFTER_SWAP2 = 1 << 1;
|
|
3727
|
+
var SF_BEFORE_CREATE = 1 << 2;
|
|
3728
|
+
var SF_AFTER_CREATE = 1 << 3;
|
|
3729
|
+
var SF_BEFORE_MIGRATE = 1 << 4;
|
|
3730
|
+
var SF_AFTER_MIGRATE = 1 << 5;
|
|
3707
3731
|
var SENTINEL_NO_CHANGE2 = 65535;
|
|
3708
3732
|
var INITIALIZER_INSTRUCTION_DISCRIMINATORS = {
|
|
3709
3733
|
// SHA256("global:initialize_config")[0:8]
|
|
@@ -3894,6 +3918,7 @@ function getInitializeLaunchArgsEncoder() {
|
|
|
3894
3918
|
"sentinelCalldata",
|
|
3895
3919
|
kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())
|
|
3896
3920
|
],
|
|
3921
|
+
["sentinelCreateRemainingAccountsLen", kit.getU32Encoder()],
|
|
3897
3922
|
["migratorProgram", kit.getAddressEncoder()],
|
|
3898
3923
|
[
|
|
3899
3924
|
"migratorInitCalldata",
|
|
@@ -3903,6 +3928,10 @@ function getInitializeLaunchArgsEncoder() {
|
|
|
3903
3928
|
"migratorMigrateCalldata",
|
|
3904
3929
|
kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())
|
|
3905
3930
|
],
|
|
3931
|
+
[
|
|
3932
|
+
"sentinelCreateRemainingAccountsHash",
|
|
3933
|
+
kit.fixEncoderSize(kit.getBytesEncoder(), 32)
|
|
3934
|
+
],
|
|
3906
3935
|
["sentinelRemainingAccountsHash", kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
|
|
3907
3936
|
[
|
|
3908
3937
|
"migratorInitRemainingAccountsHash",
|
|
@@ -3935,6 +3964,7 @@ function getInitializeLaunchArgsDecoder() {
|
|
|
3935
3964
|
"sentinelCalldata",
|
|
3936
3965
|
kit.addDecoderSizePrefix(kit.getBytesDecoder(), kit.getU32Decoder())
|
|
3937
3966
|
],
|
|
3967
|
+
["sentinelCreateRemainingAccountsLen", kit.getU32Decoder()],
|
|
3938
3968
|
["migratorProgram", kit.getAddressDecoder()],
|
|
3939
3969
|
[
|
|
3940
3970
|
"migratorInitCalldata",
|
|
@@ -3944,6 +3974,10 @@ function getInitializeLaunchArgsDecoder() {
|
|
|
3944
3974
|
"migratorMigrateCalldata",
|
|
3945
3975
|
kit.addDecoderSizePrefix(kit.getBytesDecoder(), kit.getU32Decoder())
|
|
3946
3976
|
],
|
|
3977
|
+
[
|
|
3978
|
+
"sentinelCreateRemainingAccountsHash",
|
|
3979
|
+
kit.fixDecoderSize(kit.getBytesDecoder(), 32)
|
|
3980
|
+
],
|
|
3947
3981
|
["sentinelRemainingAccountsHash", kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
|
|
3948
3982
|
[
|
|
3949
3983
|
"migratorInitRemainingAccountsHash",
|
|
@@ -4133,6 +4167,7 @@ function getInitializeLaunchInstructionDataEncoder() {
|
|
|
4133
4167
|
"sentinelCalldata",
|
|
4134
4168
|
kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())
|
|
4135
4169
|
],
|
|
4170
|
+
["sentinelCreateRemainingAccountsLen", kit.getU32Encoder()],
|
|
4136
4171
|
["migratorProgram", kit.getAddressEncoder()],
|
|
4137
4172
|
[
|
|
4138
4173
|
"migratorInitCalldata",
|
|
@@ -4142,6 +4177,10 @@ function getInitializeLaunchInstructionDataEncoder() {
|
|
|
4142
4177
|
"migratorMigrateCalldata",
|
|
4143
4178
|
kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())
|
|
4144
4179
|
],
|
|
4180
|
+
[
|
|
4181
|
+
"sentinelCreateRemainingAccountsHash",
|
|
4182
|
+
kit.fixEncoderSize(kit.getBytesEncoder(), 32)
|
|
4183
|
+
],
|
|
4145
4184
|
["sentinelRemainingAccountsHash", kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
|
|
4146
4185
|
[
|
|
4147
4186
|
"migratorInitRemainingAccountsHash",
|
|
@@ -4273,11 +4312,11 @@ function launchIdFromU64(launchId) {
|
|
|
4273
4312
|
out.set(encodeU64LE(launchId), 0);
|
|
4274
4313
|
return out;
|
|
4275
4314
|
}
|
|
4276
|
-
function
|
|
4315
|
+
function isTransactionSigner2(value) {
|
|
4277
4316
|
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
4278
4317
|
}
|
|
4279
4318
|
function createSignerAccountMeta(value, role) {
|
|
4280
|
-
if (
|
|
4319
|
+
if (isTransactionSigner2(value)) {
|
|
4281
4320
|
return { address: value.address, role, signer: value };
|
|
4282
4321
|
}
|
|
4283
4322
|
return { address: value, role };
|
|
@@ -4287,7 +4326,7 @@ function createInitializeConfigInstruction(accounts, args, programId = INITIALIZ
|
|
|
4287
4326
|
admin,
|
|
4288
4327
|
config,
|
|
4289
4328
|
programData,
|
|
4290
|
-
systemProgram =
|
|
4329
|
+
systemProgram = chunkAT33RY6T_cjs.SYSTEM_PROGRAM_ADDRESS
|
|
4291
4330
|
} = accounts;
|
|
4292
4331
|
const keys = [
|
|
4293
4332
|
createSignerAccountMeta(admin, kit.AccountRole.WRITABLE_SIGNER),
|
|
@@ -4300,11 +4339,11 @@ function createInitializeConfigInstruction(accounts, args, programId = INITIALIZ
|
|
|
4300
4339
|
);
|
|
4301
4340
|
return { programAddress: programId, accounts: keys, data };
|
|
4302
4341
|
}
|
|
4303
|
-
function
|
|
4342
|
+
function isTransactionSigner3(value) {
|
|
4304
4343
|
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
4305
4344
|
}
|
|
4306
4345
|
function createSignerAccountMeta2(value, role) {
|
|
4307
|
-
if (
|
|
4346
|
+
if (isTransactionSigner3(value)) {
|
|
4308
4347
|
return { address: value.address, role, signer: value };
|
|
4309
4348
|
}
|
|
4310
4349
|
return { address: value, role };
|
|
@@ -4320,11 +4359,11 @@ function createSetMigratorAllowlistInstruction(accounts, allowlist, programId =
|
|
|
4320
4359
|
);
|
|
4321
4360
|
return { programAddress: programId, accounts: keys, data };
|
|
4322
4361
|
}
|
|
4323
|
-
function
|
|
4362
|
+
function isTransactionSigner4(value) {
|
|
4324
4363
|
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
4325
4364
|
}
|
|
4326
4365
|
function createSignerAccountMeta3(value, role) {
|
|
4327
|
-
if (
|
|
4366
|
+
if (isTransactionSigner4(value)) {
|
|
4328
4367
|
return { address: value.address, role, signer: value };
|
|
4329
4368
|
}
|
|
4330
4369
|
return { address: value, role };
|
|
@@ -4340,6 +4379,27 @@ function createSetSentinelAllowlistInstruction(accounts, allowlist, programId =
|
|
|
4340
4379
|
);
|
|
4341
4380
|
return { programAddress: programId, accounts: keys, data };
|
|
4342
4381
|
}
|
|
4382
|
+
function computeRemainingAccountsHash(addresses) {
|
|
4383
|
+
const addressEncoder = kit.getAddressEncoder();
|
|
4384
|
+
const buf = new Uint8Array(4 + addresses.length * 32);
|
|
4385
|
+
new DataView(buf.buffer).setUint32(0, addresses.length, true);
|
|
4386
|
+
for (let i = 0; i < addresses.length; i++) {
|
|
4387
|
+
buf.set(addressEncoder.encode(addresses[i]), 4 + i * 32);
|
|
4388
|
+
}
|
|
4389
|
+
return sha3_js.keccak_256(buf);
|
|
4390
|
+
}
|
|
4391
|
+
function phaseLabel(phase) {
|
|
4392
|
+
switch (phase) {
|
|
4393
|
+
case PHASE_TRADING:
|
|
4394
|
+
return "TRADING";
|
|
4395
|
+
case PHASE_MIGRATED:
|
|
4396
|
+
return "MIGRATED";
|
|
4397
|
+
case PHASE_ABORTED:
|
|
4398
|
+
return "ABORTED";
|
|
4399
|
+
default:
|
|
4400
|
+
return String(phase);
|
|
4401
|
+
}
|
|
4402
|
+
}
|
|
4343
4403
|
var CPMM_MIGRATOR_PROGRAM_ID = kit.address(
|
|
4344
4404
|
"7WMUTNC41eMCo6eGH5Sy2xbgE3AycvLbFPo95AU9CSUd"
|
|
4345
4405
|
);
|
|
@@ -6312,11 +6372,11 @@ async function getPredictionEntryByMintAddress(market, mint, programId = PREDICT
|
|
|
6312
6372
|
}
|
|
6313
6373
|
|
|
6314
6374
|
// src/solana/initializer/instructions/initializeLaunch.ts
|
|
6315
|
-
function
|
|
6375
|
+
function isTransactionSigner5(value) {
|
|
6316
6376
|
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
6317
6377
|
}
|
|
6318
6378
|
function createAccountMeta(value, role) {
|
|
6319
|
-
if (
|
|
6379
|
+
if (isTransactionSigner5(value)) {
|
|
6320
6380
|
return { address: value.address, role, signer: value };
|
|
6321
6381
|
}
|
|
6322
6382
|
return { address: value, role };
|
|
@@ -6324,24 +6384,25 @@ function createAccountMeta(value, role) {
|
|
|
6324
6384
|
async function getTokenMetadataAddress(mint) {
|
|
6325
6385
|
const encoder = kit.getAddressEncoder();
|
|
6326
6386
|
const [metadataAddress] = await kit.getProgramDerivedAddress({
|
|
6327
|
-
programAddress:
|
|
6387
|
+
programAddress: chunkAT33RY6T_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
6328
6388
|
seeds: [
|
|
6329
6389
|
new TextEncoder().encode("metadata"),
|
|
6330
|
-
encoder.encode(
|
|
6390
|
+
encoder.encode(chunkAT33RY6T_cjs.TOKEN_METADATA_PROGRAM_ID),
|
|
6331
6391
|
encoder.encode(mint)
|
|
6332
6392
|
]
|
|
6333
6393
|
});
|
|
6334
6394
|
return metadataAddress;
|
|
6335
6395
|
}
|
|
6336
6396
|
var ALT_INDEX = {
|
|
6337
|
-
[
|
|
6338
|
-
[
|
|
6397
|
+
[chunkAT33RY6T_cjs.TOKEN_PROGRAM_ADDRESS]: 0,
|
|
6398
|
+
[chunkAT33RY6T_cjs.SYSTEM_PROGRAM_ADDRESS]: 1,
|
|
6339
6399
|
SysvarRent111111111111111111111111111111111: 2,
|
|
6340
6400
|
[INITIALIZER_PROGRAM_ID]: 3,
|
|
6341
|
-
[
|
|
6401
|
+
[chunkAT33RY6T_cjs.TOKEN_METADATA_PROGRAM_ID]: 4,
|
|
6342
6402
|
[CPMM_MIGRATOR_PROGRAM_ID]: 5,
|
|
6343
6403
|
So11111111111111111111111111111111111111112: 6,
|
|
6344
|
-
[PREDICTION_MIGRATOR_PROGRAM_ADDRESS]: 8
|
|
6404
|
+
[PREDICTION_MIGRATOR_PROGRAM_ADDRESS]: 8,
|
|
6405
|
+
A9DojSvj32PMTTGctEcWZu9GSKuQVEhPkBXxDxmYu34o: 10
|
|
6345
6406
|
};
|
|
6346
6407
|
function validateInitializeLaunchCurveParams(args) {
|
|
6347
6408
|
if (args.curveKind !== CURVE_KIND_XYK) {
|
|
@@ -6365,13 +6426,15 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
6365
6426
|
quoteVault,
|
|
6366
6427
|
payer,
|
|
6367
6428
|
authority,
|
|
6429
|
+
sentinelProgram,
|
|
6368
6430
|
migratorProgram,
|
|
6369
|
-
baseTokenProgram =
|
|
6370
|
-
quoteTokenProgram =
|
|
6371
|
-
systemProgram =
|
|
6431
|
+
baseTokenProgram = chunkAT33RY6T_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
6432
|
+
quoteTokenProgram = chunkAT33RY6T_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
6433
|
+
systemProgram = chunkAT33RY6T_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
6372
6434
|
rent,
|
|
6373
6435
|
metadataAccount,
|
|
6374
|
-
metadataProgram =
|
|
6436
|
+
metadataProgram = chunkAT33RY6T_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
6437
|
+
sentinelCreateRemainingAccounts = [],
|
|
6375
6438
|
addressLookupTable: alt
|
|
6376
6439
|
} = accounts;
|
|
6377
6440
|
const withMetadata = Boolean(
|
|
@@ -6382,6 +6445,10 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
6382
6445
|
"metadataName is set but metadataAccount was not provided. Derive it with await initializer.getTokenMetadataAddress(baseMintAddress)."
|
|
6383
6446
|
);
|
|
6384
6447
|
}
|
|
6448
|
+
const createHooksEnabled = (args.sentinelFlags & (SF_BEFORE_CREATE | SF_AFTER_CREATE)) !== 0;
|
|
6449
|
+
const sentinelCreateRemainingAccountAddresses = sentinelCreateRemainingAccounts.map(
|
|
6450
|
+
(account) => isTransactionSigner5(account) ? account.address : account
|
|
6451
|
+
);
|
|
6385
6452
|
const altIndexMap = alt ? ALT_INDEX : {};
|
|
6386
6453
|
function staticOrLookup(addr, role) {
|
|
6387
6454
|
if (alt && altIndexMap[addr] !== void 0) {
|
|
@@ -6404,12 +6471,15 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
6404
6471
|
createAccountMeta(quoteVault, kit.AccountRole.WRITABLE_SIGNER),
|
|
6405
6472
|
createAccountMeta(payer, kit.AccountRole.WRITABLE_SIGNER)
|
|
6406
6473
|
];
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6474
|
+
keys.push(
|
|
6475
|
+
authority ? createAccountMeta(authority, kit.AccountRole.READONLY_SIGNER) : staticOrLookup(programId, kit.AccountRole.READONLY)
|
|
6476
|
+
);
|
|
6477
|
+
keys.push(
|
|
6478
|
+
sentinelProgram ? staticOrLookup(sentinelProgram, kit.AccountRole.READONLY) : staticOrLookup(programId, kit.AccountRole.READONLY)
|
|
6479
|
+
);
|
|
6480
|
+
keys.push(
|
|
6481
|
+
migratorProgram ? staticOrLookup(migratorProgram, kit.AccountRole.READONLY) : staticOrLookup(programId, kit.AccountRole.READONLY)
|
|
6482
|
+
);
|
|
6413
6483
|
keys.push(staticOrLookup(baseTokenProgram, kit.AccountRole.READONLY));
|
|
6414
6484
|
keys.push(staticOrLookup(quoteTokenProgram, kit.AccountRole.READONLY));
|
|
6415
6485
|
keys.push(staticOrLookup(systemProgram, kit.AccountRole.READONLY));
|
|
@@ -6418,18 +6488,29 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
6418
6488
|
keys.push({ address: metadataAccount, role: kit.AccountRole.WRITABLE });
|
|
6419
6489
|
keys.push(staticOrLookup(metadataProgram, kit.AccountRole.READONLY));
|
|
6420
6490
|
} else {
|
|
6421
|
-
keys.push(
|
|
6422
|
-
keys.push(
|
|
6491
|
+
keys.push(staticOrLookup(programId, kit.AccountRole.READONLY));
|
|
6492
|
+
keys.push(staticOrLookup(programId, kit.AccountRole.READONLY));
|
|
6423
6493
|
}
|
|
6424
6494
|
const encoderArgs = {
|
|
6425
6495
|
...args,
|
|
6426
6496
|
allowBuy: args.allowBuy ? 1 : 0,
|
|
6427
6497
|
allowSell: args.allowSell ? 1 : 0,
|
|
6428
|
-
|
|
6498
|
+
sentinelProgram: args.sentinelProgram ?? sentinelProgram ?? chunkAT33RY6T_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
6499
|
+
sentinelCreateRemainingAccountsLen: args.sentinelCreateRemainingAccountsLen ?? sentinelCreateRemainingAccounts.length,
|
|
6500
|
+
migratorProgram: migratorProgram ?? chunkAT33RY6T_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
6501
|
+
sentinelCreateRemainingAccountsHash: args.sentinelCreateRemainingAccountsHash ?? (createHooksEnabled ? computeRemainingAccountsHash(sentinelCreateRemainingAccountAddresses) : new Uint8Array(32))
|
|
6429
6502
|
};
|
|
6430
6503
|
const data = new Uint8Array(
|
|
6431
6504
|
getInitializeLaunchInstructionDataEncoder().encode(encoderArgs)
|
|
6432
6505
|
);
|
|
6506
|
+
keys.push(
|
|
6507
|
+
...sentinelCreateRemainingAccounts.map(
|
|
6508
|
+
(account) => createAccountMeta(
|
|
6509
|
+
account,
|
|
6510
|
+
isTransactionSigner5(account) ? kit.AccountRole.READONLY_SIGNER : kit.AccountRole.READONLY
|
|
6511
|
+
)
|
|
6512
|
+
)
|
|
6513
|
+
);
|
|
6433
6514
|
if (migratorProgram === CPMM_MIGRATOR_PROGRAM_ID) {
|
|
6434
6515
|
if (!accounts.cpmmConfig) {
|
|
6435
6516
|
throw new Error(
|
|
@@ -6443,7 +6524,7 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
6443
6524
|
if (migratorProgram === PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
6444
6525
|
const oracleState = args.namespace;
|
|
6445
6526
|
const entryId = args.launchId;
|
|
6446
|
-
const baseMintAddress =
|
|
6527
|
+
const baseMintAddress = isTransactionSigner5(baseMint) ? baseMint.address : baseMint;
|
|
6447
6528
|
const [market] = await getPredictionMarketAddress(oracleState, quoteMint);
|
|
6448
6529
|
const [potVault] = await getPredictionPotVaultAddress(market);
|
|
6449
6530
|
const [marketAuthority] = await getPredictionMarketAuthorityAddress(market);
|
|
@@ -6461,11 +6542,11 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
6461
6542
|
}
|
|
6462
6543
|
return { programAddress: programId, accounts: keys, data };
|
|
6463
6544
|
}
|
|
6464
|
-
function
|
|
6545
|
+
function isTransactionSigner6(value) {
|
|
6465
6546
|
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
6466
6547
|
}
|
|
6467
6548
|
function createAccountMeta2(value, role) {
|
|
6468
|
-
if (
|
|
6549
|
+
if (isTransactionSigner6(value)) {
|
|
6469
6550
|
return { address: value.address, role, signer: value };
|
|
6470
6551
|
}
|
|
6471
6552
|
return { address: value, role };
|
|
@@ -6482,9 +6563,9 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
6482
6563
|
baseMint,
|
|
6483
6564
|
quoteMint,
|
|
6484
6565
|
user,
|
|
6485
|
-
sentinelProgram =
|
|
6486
|
-
baseTokenProgram =
|
|
6487
|
-
quoteTokenProgram =
|
|
6566
|
+
sentinelProgram = chunkAT33RY6T_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
6567
|
+
baseTokenProgram = chunkAT33RY6T_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
6568
|
+
quoteTokenProgram = chunkAT33RY6T_cjs.TOKEN_PROGRAM_ADDRESS
|
|
6488
6569
|
} = accounts;
|
|
6489
6570
|
const keys = [
|
|
6490
6571
|
{ address: config, role: kit.AccountRole.READONLY },
|
|
@@ -6509,11 +6590,11 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
6509
6590
|
);
|
|
6510
6591
|
return { programAddress: programId, accounts: keys, data };
|
|
6511
6592
|
}
|
|
6512
|
-
function
|
|
6593
|
+
function isTransactionSigner7(value) {
|
|
6513
6594
|
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
6514
6595
|
}
|
|
6515
6596
|
function createSignerAccountMeta4(value, role) {
|
|
6516
|
-
if (
|
|
6597
|
+
if (isTransactionSigner7(value)) {
|
|
6517
6598
|
return { address: value.address, role, signer: value };
|
|
6518
6599
|
}
|
|
6519
6600
|
return { address: value, role };
|
|
@@ -6529,9 +6610,9 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
6529
6610
|
quoteVault,
|
|
6530
6611
|
migratorProgram,
|
|
6531
6612
|
payer,
|
|
6532
|
-
baseTokenProgram =
|
|
6533
|
-
quoteTokenProgram =
|
|
6534
|
-
systemProgram =
|
|
6613
|
+
baseTokenProgram = chunkAT33RY6T_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
6614
|
+
quoteTokenProgram = chunkAT33RY6T_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
6615
|
+
systemProgram = chunkAT33RY6T_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
6535
6616
|
rent
|
|
6536
6617
|
} = accounts;
|
|
6537
6618
|
const keys = [
|
|
@@ -6549,7 +6630,7 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
6549
6630
|
{ address: systemProgram, role: kit.AccountRole.READONLY },
|
|
6550
6631
|
{ address: rent, role: kit.AccountRole.READONLY }
|
|
6551
6632
|
];
|
|
6552
|
-
const data =
|
|
6633
|
+
const data = chunkLL7TW3GU_cjs.encodeInstructionData(
|
|
6553
6634
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS.migrateLaunch
|
|
6554
6635
|
);
|
|
6555
6636
|
return { programAddress: programId, accounts: keys, data };
|
|
@@ -6587,7 +6668,7 @@ function createPreviewMigrationInstruction(accounts, programId = INITIALIZER_PRO
|
|
|
6587
6668
|
{ address: baseVault, role: kit.AccountRole.READONLY },
|
|
6588
6669
|
{ address: quoteVault, role: kit.AccountRole.READONLY }
|
|
6589
6670
|
];
|
|
6590
|
-
const data =
|
|
6671
|
+
const data = chunkLL7TW3GU_cjs.encodeInstructionData(
|
|
6591
6672
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS.previewMigration
|
|
6592
6673
|
);
|
|
6593
6674
|
return { programAddress: programId, accounts: keys, data };
|
|
@@ -6595,27 +6676,6 @@ function createPreviewMigrationInstruction(accounts, programId = INITIALIZER_PRO
|
|
|
6595
6676
|
function decodePreviewMigrationResult(data) {
|
|
6596
6677
|
return previewMigrationResultCodec.decode(data);
|
|
6597
6678
|
}
|
|
6598
|
-
function computeRemainingAccountsHash(addresses) {
|
|
6599
|
-
const addressEncoder = kit.getAddressEncoder();
|
|
6600
|
-
const buf = new Uint8Array(4 + addresses.length * 32);
|
|
6601
|
-
new DataView(buf.buffer).setUint32(0, addresses.length, true);
|
|
6602
|
-
for (let i = 0; i < addresses.length; i++) {
|
|
6603
|
-
buf.set(addressEncoder.encode(addresses[i]), 4 + i * 32);
|
|
6604
|
-
}
|
|
6605
|
-
return sha3_js.keccak_256(buf);
|
|
6606
|
-
}
|
|
6607
|
-
function phaseLabel(phase) {
|
|
6608
|
-
switch (phase) {
|
|
6609
|
-
case PHASE_TRADING:
|
|
6610
|
-
return "TRADING";
|
|
6611
|
-
case PHASE_MIGRATED:
|
|
6612
|
-
return "MIGRATED";
|
|
6613
|
-
case PHASE_ABORTED:
|
|
6614
|
-
return "ABORTED";
|
|
6615
|
-
default:
|
|
6616
|
-
return String(phase);
|
|
6617
|
-
}
|
|
6618
|
-
}
|
|
6619
6679
|
var addressCodec5 = kit.getAddressCodec();
|
|
6620
6680
|
function bytesToBase64(bytes) {
|
|
6621
6681
|
let binary = "";
|