@whetstone-research/doppler-sdk 1.0.25 → 1.0.27
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/README.md +20 -8
- package/dist/{chunk-BESE77DM.js → chunk-RVDRWCJN.js} +3 -3
- package/dist/{chunk-BESE77DM.js.map → chunk-RVDRWCJN.js.map} +1 -1
- package/dist/{chunk-Y6TJIH33.cjs → chunk-U6B52TBT.cjs} +13 -4
- package/dist/chunk-U6B52TBT.cjs.map +1 -0
- package/dist/{chunk-ZUJKBFXW.js → chunk-WD5VOZGI.js} +8 -5
- package/dist/chunk-WD5VOZGI.js.map +1 -0
- package/dist/{chunk-KJ6W44WF.cjs → chunk-XTL2GBZ4.cjs} +36 -36
- package/dist/{chunk-KJ6W44WF.cjs.map → chunk-XTL2GBZ4.cjs.map} +1 -1
- package/dist/evm/index.cjs +252 -68
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +46 -6
- package/dist/evm/index.d.ts +46 -6
- package/dist/evm/index.js +251 -69
- package/dist/evm/index.js.map +1 -1
- package/dist/{pda-A4PIAS5Y.cjs → pda-H6VMGONM.cjs} +17 -17
- package/dist/pda-H6VMGONM.cjs.map +1 -0
- package/dist/{pda-JVAD45XJ.js → pda-UJLXCO6I.js} +3 -3
- package/dist/pda-UJLXCO6I.js.map +1 -0
- package/dist/solana/index.cjs +1250 -825
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +444 -279
- package/dist/solana/index.d.ts +444 -279
- package/dist/solana/index.js +917 -493
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/react/index.cjs +45 -45
- package/dist/solana/react/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-Y6TJIH33.cjs.map +0 -1
- package/dist/chunk-ZUJKBFXW.js.map +0 -1
- package/dist/pda-A4PIAS5Y.cjs.map +0 -1
- package/dist/pda-JVAD45XJ.js.map +0 -1
package/dist/solana/index.cjs
CHANGED
|
@@ -1,344 +1,345 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkXTL2GBZ4_cjs = require('../chunk-XTL2GBZ4.cjs');
|
|
4
|
+
var chunkU6B52TBT_cjs = require('../chunk-U6B52TBT.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');
|
|
8
8
|
var sha3_js = require('@noble/hashes/sha3.js');
|
|
9
|
+
var token = require('@solana-program/token');
|
|
9
10
|
var addressLookupTable = require('@solana-program/address-lookup-table');
|
|
10
11
|
|
|
11
12
|
// src/solana/cpmm/index.ts
|
|
12
13
|
var cpmm_exports = {};
|
|
13
14
|
chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
14
|
-
ACCOUNT_DISCRIMINATORS: () =>
|
|
15
|
-
ACCOUNT_VERSION: () =>
|
|
16
|
-
ADD_LIQUIDITY_DISCRIMINATOR: () =>
|
|
17
|
-
BPS_DENOM: () =>
|
|
18
|
-
CLOSE_POSITION_DISCRIMINATOR: () =>
|
|
19
|
-
COLLECT_FEES_DISCRIMINATOR: () =>
|
|
20
|
-
COLLECT_PROTOCOL_FEES_DISCRIMINATOR: () =>
|
|
15
|
+
ACCOUNT_DISCRIMINATORS: () => chunkU6B52TBT_cjs.ACCOUNT_DISCRIMINATORS,
|
|
16
|
+
ACCOUNT_VERSION: () => chunkU6B52TBT_cjs.ACCOUNT_VERSION,
|
|
17
|
+
ADD_LIQUIDITY_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.ADD_LIQUIDITY_DISCRIMINATOR,
|
|
18
|
+
BPS_DENOM: () => chunkU6B52TBT_cjs.BPS_DENOM,
|
|
19
|
+
CLOSE_POSITION_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.CLOSE_POSITION_DISCRIMINATOR,
|
|
20
|
+
COLLECT_FEES_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.COLLECT_FEES_DISCRIMINATOR,
|
|
21
|
+
COLLECT_PROTOCOL_FEES_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.COLLECT_PROTOCOL_FEES_DISCRIMINATOR,
|
|
21
22
|
CPMM_ERROR_MESSAGES: () => CPMM_ERROR_MESSAGES,
|
|
22
|
-
CPMM_PROGRAM_ID: () =>
|
|
23
|
-
CREATE_POSITION_DISCRIMINATOR: () =>
|
|
23
|
+
CPMM_PROGRAM_ID: () => chunkU6B52TBT_cjs.CPMM_PROGRAM_ID,
|
|
24
|
+
CREATE_POSITION_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.CREATE_POSITION_DISCRIMINATOR,
|
|
24
25
|
CpmmError: () => CpmmError,
|
|
25
26
|
CpmmErrorCode: () => CpmmErrorCode,
|
|
26
|
-
HF_AFTER_ADD_LIQ: () =>
|
|
27
|
-
HF_AFTER_REMOVE_LIQ: () =>
|
|
28
|
-
HF_AFTER_SWAP: () =>
|
|
29
|
-
HF_BEFORE_ADD_LIQ: () =>
|
|
30
|
-
HF_BEFORE_REMOVE_LIQ: () =>
|
|
31
|
-
HF_BEFORE_SWAP: () =>
|
|
32
|
-
HF_FORWARD_READONLY_SIGNERS: () =>
|
|
33
|
-
HF_REQUIRE_ORACLE: () =>
|
|
34
|
-
HOOK_NO_CHANGE: () =>
|
|
35
|
-
INITIALIZE_CONFIG_DISCRIMINATOR: () =>
|
|
36
|
-
INITIALIZE_ORACLE_DISCRIMINATOR: () =>
|
|
37
|
-
INITIALIZE_POOL_DISCRIMINATOR: () =>
|
|
38
|
-
INSTRUCTION_DISCRIMINATORS: () =>
|
|
27
|
+
HF_AFTER_ADD_LIQ: () => chunkU6B52TBT_cjs.HF_AFTER_ADD_LIQ,
|
|
28
|
+
HF_AFTER_REMOVE_LIQ: () => chunkU6B52TBT_cjs.HF_AFTER_REMOVE_LIQ,
|
|
29
|
+
HF_AFTER_SWAP: () => chunkU6B52TBT_cjs.HF_AFTER_SWAP,
|
|
30
|
+
HF_BEFORE_ADD_LIQ: () => chunkU6B52TBT_cjs.HF_BEFORE_ADD_LIQ,
|
|
31
|
+
HF_BEFORE_REMOVE_LIQ: () => chunkU6B52TBT_cjs.HF_BEFORE_REMOVE_LIQ,
|
|
32
|
+
HF_BEFORE_SWAP: () => chunkU6B52TBT_cjs.HF_BEFORE_SWAP,
|
|
33
|
+
HF_FORWARD_READONLY_SIGNERS: () => chunkU6B52TBT_cjs.HF_FORWARD_READONLY_SIGNERS,
|
|
34
|
+
HF_REQUIRE_ORACLE: () => chunkU6B52TBT_cjs.HF_REQUIRE_ORACLE,
|
|
35
|
+
HOOK_NO_CHANGE: () => chunkU6B52TBT_cjs.HOOK_NO_CHANGE,
|
|
36
|
+
INITIALIZE_CONFIG_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.INITIALIZE_CONFIG_DISCRIMINATOR,
|
|
37
|
+
INITIALIZE_ORACLE_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.INITIALIZE_ORACLE_DISCRIMINATOR,
|
|
38
|
+
INITIALIZE_POOL_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.INITIALIZE_POOL_DISCRIMINATOR,
|
|
39
|
+
INSTRUCTION_DISCRIMINATORS: () => chunkU6B52TBT_cjs.INSTRUCTION_DISCRIMINATORS,
|
|
39
40
|
MAX_FEE_AMOUNT: () => MAX_FEE_AMOUNT,
|
|
40
|
-
MAX_HOOK_ALLOWLIST: () =>
|
|
41
|
-
MAX_ORACLE_OBSERVATIONS: () =>
|
|
42
|
-
ORACLE_CONSULT_DISCRIMINATOR: () =>
|
|
43
|
-
ORACLE_UPDATE_DISCRIMINATOR: () =>
|
|
44
|
-
PAUSE_DISCRIMINATOR: () =>
|
|
45
|
-
PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR: () =>
|
|
46
|
-
Q64_ONE: () =>
|
|
47
|
-
REDEEM_PROTOCOL_SHARES_DISCRIMINATOR: () =>
|
|
48
|
-
REMOVE_LIQUIDITY_DISCRIMINATOR: () =>
|
|
49
|
-
SEED_AUTHORITY: () =>
|
|
50
|
-
SEED_CONFIG: () =>
|
|
51
|
-
SEED_ORACLE: () =>
|
|
52
|
-
SEED_POOL: () =>
|
|
53
|
-
SEED_POSITION: () =>
|
|
54
|
-
SEED_PROTOCOL_FEE_OWNER: () =>
|
|
55
|
-
SET_FEES_DISCRIMINATOR: () =>
|
|
56
|
-
SET_HOOK_DISCRIMINATOR: () =>
|
|
57
|
-
SWAP_EXACT_IN_DISCRIMINATOR: () =>
|
|
58
|
-
TOKEN_METADATA_PROGRAM_ID: () =>
|
|
59
|
-
TRANSFER_ADMIN_DISCRIMINATOR: () =>
|
|
60
|
-
UNPAUSE_DISCRIMINATOR: () =>
|
|
61
|
-
UPDATE_CONFIG_DISCRIMINATOR: () =>
|
|
62
|
-
WITHDRAW_VAULT_EXCESS_DISCRIMINATOR: () =>
|
|
63
|
-
addLiquidityArgsCodec: () =>
|
|
64
|
-
ammConfigDataCodec: () =>
|
|
65
|
-
areMintsOrdered: () =>
|
|
66
|
-
calculateAccruedFees: () =>
|
|
67
|
-
calculateTwap: () =>
|
|
68
|
-
calculateTwapNumber: () =>
|
|
69
|
-
ceilDiv: () =>
|
|
70
|
-
collectFeesArgsCodec: () =>
|
|
71
|
-
collectProtocolFeesArgsCodec: () =>
|
|
72
|
-
comparePoolAndOraclePrices: () =>
|
|
73
|
-
computePrice0Q64: () =>
|
|
74
|
-
computePrice1Q64: () =>
|
|
75
|
-
consultTwap: () =>
|
|
76
|
-
createAddLiquidityInstruction: () =>
|
|
77
|
-
createClosePositionInstruction: () =>
|
|
78
|
-
createCollectFeesInstruction: () =>
|
|
79
|
-
createCollectProtocolFeesInstruction: () =>
|
|
80
|
-
createCreatePositionInstruction: () =>
|
|
81
|
-
createInitializeConfigInstruction: () =>
|
|
82
|
-
createInitializeOracleInstruction: () =>
|
|
83
|
-
createInitializePoolInstruction: () =>
|
|
84
|
-
createOracleConsultInstruction: () =>
|
|
85
|
-
createOracleUpdateInstruction: () =>
|
|
86
|
-
createPauseInstruction: () =>
|
|
87
|
-
createPositionArgsCodec: () =>
|
|
88
|
-
createRemoveLiquidityInstruction: () =>
|
|
89
|
-
createSetFeesInstruction: () =>
|
|
90
|
-
createSetHookInstruction: () =>
|
|
91
|
-
createSwapExactInInstruction: () =>
|
|
41
|
+
MAX_HOOK_ALLOWLIST: () => chunkU6B52TBT_cjs.MAX_HOOK_ALLOWLIST,
|
|
42
|
+
MAX_ORACLE_OBSERVATIONS: () => chunkU6B52TBT_cjs.MAX_ORACLE_OBSERVATIONS,
|
|
43
|
+
ORACLE_CONSULT_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.ORACLE_CONSULT_DISCRIMINATOR,
|
|
44
|
+
ORACLE_UPDATE_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.ORACLE_UPDATE_DISCRIMINATOR,
|
|
45
|
+
PAUSE_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.PAUSE_DISCRIMINATOR,
|
|
46
|
+
PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR,
|
|
47
|
+
Q64_ONE: () => chunkU6B52TBT_cjs.Q64_ONE,
|
|
48
|
+
REDEEM_PROTOCOL_SHARES_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.REDEEM_PROTOCOL_SHARES_DISCRIMINATOR,
|
|
49
|
+
REMOVE_LIQUIDITY_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.REMOVE_LIQUIDITY_DISCRIMINATOR,
|
|
50
|
+
SEED_AUTHORITY: () => chunkU6B52TBT_cjs.SEED_AUTHORITY,
|
|
51
|
+
SEED_CONFIG: () => chunkU6B52TBT_cjs.SEED_CONFIG,
|
|
52
|
+
SEED_ORACLE: () => chunkU6B52TBT_cjs.SEED_ORACLE,
|
|
53
|
+
SEED_POOL: () => chunkU6B52TBT_cjs.SEED_POOL,
|
|
54
|
+
SEED_POSITION: () => chunkU6B52TBT_cjs.SEED_POSITION,
|
|
55
|
+
SEED_PROTOCOL_FEE_OWNER: () => chunkU6B52TBT_cjs.SEED_PROTOCOL_FEE_OWNER,
|
|
56
|
+
SET_FEES_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.SET_FEES_DISCRIMINATOR,
|
|
57
|
+
SET_HOOK_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.SET_HOOK_DISCRIMINATOR,
|
|
58
|
+
SWAP_EXACT_IN_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.SWAP_EXACT_IN_DISCRIMINATOR,
|
|
59
|
+
TOKEN_METADATA_PROGRAM_ID: () => chunkU6B52TBT_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
60
|
+
TRANSFER_ADMIN_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.TRANSFER_ADMIN_DISCRIMINATOR,
|
|
61
|
+
UNPAUSE_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.UNPAUSE_DISCRIMINATOR,
|
|
62
|
+
UPDATE_CONFIG_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.UPDATE_CONFIG_DISCRIMINATOR,
|
|
63
|
+
WITHDRAW_VAULT_EXCESS_DISCRIMINATOR: () => chunkXTL2GBZ4_cjs.WITHDRAW_VAULT_EXCESS_DISCRIMINATOR,
|
|
64
|
+
addLiquidityArgsCodec: () => chunkXTL2GBZ4_cjs.addLiquidityArgsCodec,
|
|
65
|
+
ammConfigDataCodec: () => chunkXTL2GBZ4_cjs.ammConfigDataCodec,
|
|
66
|
+
areMintsOrdered: () => chunkU6B52TBT_cjs.areMintsOrdered,
|
|
67
|
+
calculateAccruedFees: () => chunkXTL2GBZ4_cjs.calculateAccruedFees,
|
|
68
|
+
calculateTwap: () => chunkXTL2GBZ4_cjs.calculateTwap,
|
|
69
|
+
calculateTwapNumber: () => chunkXTL2GBZ4_cjs.calculateTwapNumber,
|
|
70
|
+
ceilDiv: () => chunkXTL2GBZ4_cjs.ceilDiv,
|
|
71
|
+
collectFeesArgsCodec: () => chunkXTL2GBZ4_cjs.collectFeesArgsCodec,
|
|
72
|
+
collectProtocolFeesArgsCodec: () => chunkXTL2GBZ4_cjs.collectProtocolFeesArgsCodec,
|
|
73
|
+
comparePoolAndOraclePrices: () => chunkXTL2GBZ4_cjs.comparePoolAndOraclePrices,
|
|
74
|
+
computePrice0Q64: () => chunkXTL2GBZ4_cjs.computePrice0Q64,
|
|
75
|
+
computePrice1Q64: () => chunkXTL2GBZ4_cjs.computePrice1Q64,
|
|
76
|
+
consultTwap: () => chunkXTL2GBZ4_cjs.consultTwap,
|
|
77
|
+
createAddLiquidityInstruction: () => chunkXTL2GBZ4_cjs.getAddLiquidityInstruction,
|
|
78
|
+
createClosePositionInstruction: () => chunkXTL2GBZ4_cjs.getClosePositionInstruction,
|
|
79
|
+
createCollectFeesInstruction: () => chunkXTL2GBZ4_cjs.getCollectFeesInstruction,
|
|
80
|
+
createCollectProtocolFeesInstruction: () => chunkXTL2GBZ4_cjs.getCollectProtocolFeesInstruction,
|
|
81
|
+
createCreatePositionInstruction: () => chunkXTL2GBZ4_cjs.getCreatePositionInstruction,
|
|
82
|
+
createInitializeConfigInstruction: () => chunkXTL2GBZ4_cjs.getInitializeConfigInstruction,
|
|
83
|
+
createInitializeOracleInstruction: () => chunkXTL2GBZ4_cjs.getInitializeOracleInstruction,
|
|
84
|
+
createInitializePoolInstruction: () => chunkXTL2GBZ4_cjs.getInitializePoolInstruction,
|
|
85
|
+
createOracleConsultInstruction: () => chunkXTL2GBZ4_cjs.getOracleConsultInstruction,
|
|
86
|
+
createOracleUpdateInstruction: () => chunkXTL2GBZ4_cjs.getOracleUpdateInstruction,
|
|
87
|
+
createPauseInstruction: () => chunkXTL2GBZ4_cjs.getPauseInstruction,
|
|
88
|
+
createPositionArgsCodec: () => chunkXTL2GBZ4_cjs.createPositionArgsCodec,
|
|
89
|
+
createRemoveLiquidityInstruction: () => chunkXTL2GBZ4_cjs.getRemoveLiquidityInstruction,
|
|
90
|
+
createSetFeesInstruction: () => chunkXTL2GBZ4_cjs.getSetFeesInstruction,
|
|
91
|
+
createSetHookInstruction: () => chunkXTL2GBZ4_cjs.getSetHookInstruction,
|
|
92
|
+
createSwapExactInInstruction: () => chunkXTL2GBZ4_cjs.getSwapExactInInstruction,
|
|
92
93
|
createSwapInstruction: () => createSwapInstruction,
|
|
93
|
-
createTransferAdminInstruction: () =>
|
|
94
|
-
createUnpauseInstruction: () =>
|
|
95
|
-
createWithdrawVaultExcessInstruction: () =>
|
|
94
|
+
createTransferAdminInstruction: () => chunkXTL2GBZ4_cjs.getTransferAdminInstruction,
|
|
95
|
+
createUnpauseInstruction: () => chunkXTL2GBZ4_cjs.getUnpauseInstruction,
|
|
96
|
+
createWithdrawVaultExcessInstruction: () => chunkXTL2GBZ4_cjs.getWithdrawVaultExcessInstruction,
|
|
96
97
|
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
|
-
encodeRemoveLiquidityArgs: () =>
|
|
111
|
-
encodeSetFeesArgs: () =>
|
|
112
|
-
encodeSetHookArgs: () =>
|
|
113
|
-
encodeSwapExactInArgs: () =>
|
|
114
|
-
encodeTransferAdminArgs: () =>
|
|
115
|
-
fetchAllPools: () =>
|
|
98
|
+
decodeAmmConfig: () => chunkXTL2GBZ4_cjs.decodeAmmConfig,
|
|
99
|
+
decodeOracleState: () => chunkXTL2GBZ4_cjs.decodeOracleState,
|
|
100
|
+
decodePool: () => chunkXTL2GBZ4_cjs.decodePool,
|
|
101
|
+
decodePosition: () => chunkXTL2GBZ4_cjs.decodePosition,
|
|
102
|
+
encodeAddLiquidityArgs: () => chunkXTL2GBZ4_cjs.encodeAddLiquidityArgs,
|
|
103
|
+
encodeCollectFeesArgs: () => chunkXTL2GBZ4_cjs.encodeCollectFeesArgs,
|
|
104
|
+
encodeCollectProtocolFeesArgs: () => chunkXTL2GBZ4_cjs.encodeCollectProtocolFeesArgs,
|
|
105
|
+
encodeCreatePositionArgs: () => chunkXTL2GBZ4_cjs.encodeCreatePositionArgs,
|
|
106
|
+
encodeInitializeConfigArgs: () => chunkXTL2GBZ4_cjs.encodeInitializeConfigArgs,
|
|
107
|
+
encodeInitializeOracleArgs: () => chunkXTL2GBZ4_cjs.encodeInitializeOracleArgs,
|
|
108
|
+
encodeInitializePoolArgs: () => chunkXTL2GBZ4_cjs.encodeInitializePoolArgs,
|
|
109
|
+
encodeInstructionData: () => chunkXTL2GBZ4_cjs.encodeInstructionData,
|
|
110
|
+
encodeOracleConsultArgs: () => chunkXTL2GBZ4_cjs.encodeOracleConsultArgs,
|
|
111
|
+
encodeRemoveLiquidityArgs: () => chunkXTL2GBZ4_cjs.encodeRemoveLiquidityArgs,
|
|
112
|
+
encodeSetFeesArgs: () => chunkXTL2GBZ4_cjs.encodeSetFeesArgs,
|
|
113
|
+
encodeSetHookArgs: () => chunkXTL2GBZ4_cjs.encodeSetHookArgs,
|
|
114
|
+
encodeSwapExactInArgs: () => chunkXTL2GBZ4_cjs.encodeSwapExactInArgs,
|
|
115
|
+
encodeTransferAdminArgs: () => chunkXTL2GBZ4_cjs.encodeTransferAdminArgs,
|
|
116
|
+
fetchAllPools: () => chunkXTL2GBZ4_cjs.fetchAllPools,
|
|
116
117
|
fetchConfig: () => fetchConfig,
|
|
117
118
|
fetchConfigWithAddress: () => fetchConfigWithAddress,
|
|
118
|
-
fetchOracle: () =>
|
|
119
|
-
fetchOraclesBatch: () =>
|
|
120
|
-
fetchPool: () =>
|
|
121
|
-
fetchPoolPositions: () =>
|
|
122
|
-
fetchPoolsBatch: () =>
|
|
123
|
-
fetchPosition: () =>
|
|
124
|
-
fetchPositionByParams: () =>
|
|
125
|
-
fetchPositionsBatch: () =>
|
|
126
|
-
fetchUserPositions: () =>
|
|
127
|
-
filterActivePositions: () =>
|
|
128
|
-
filterPoolsByMint: () =>
|
|
129
|
-
getAddLiquidityDiscriminatorBytes: () =>
|
|
130
|
-
getAddLiquidityInstruction: () =>
|
|
131
|
-
getAddLiquidityInstructionAsync: () =>
|
|
132
|
-
getAddLiquidityInstructionDataCodec: () =>
|
|
133
|
-
getAddLiquidityInstructionDataDecoder: () =>
|
|
134
|
-
getAddLiquidityInstructionDataEncoder: () =>
|
|
135
|
-
getAddLiquidityQuote: () =>
|
|
136
|
-
getClosePositionDiscriminatorBytes: () =>
|
|
137
|
-
getClosePositionInstruction: () =>
|
|
138
|
-
getClosePositionInstructionDataCodec: () =>
|
|
139
|
-
getClosePositionInstructionDataDecoder: () =>
|
|
140
|
-
getClosePositionInstructionDataEncoder: () =>
|
|
141
|
-
getCollectFeesDiscriminatorBytes: () =>
|
|
142
|
-
getCollectFeesInstruction: () =>
|
|
143
|
-
getCollectFeesInstructionAsync: () =>
|
|
144
|
-
getCollectFeesInstructionDataCodec: () =>
|
|
145
|
-
getCollectFeesInstructionDataDecoder: () =>
|
|
146
|
-
getCollectFeesInstructionDataEncoder: () =>
|
|
147
|
-
getCollectProtocolFeesDiscriminatorBytes: () =>
|
|
148
|
-
getCollectProtocolFeesInstruction: () =>
|
|
149
|
-
getCollectProtocolFeesInstructionAsync: () =>
|
|
150
|
-
getCollectProtocolFeesInstructionDataCodec: () =>
|
|
151
|
-
getCollectProtocolFeesInstructionDataDecoder: () =>
|
|
152
|
-
getCollectProtocolFeesInstructionDataEncoder: () =>
|
|
153
|
-
getConfigAddress: () =>
|
|
154
|
-
getCreatePositionDiscriminatorBytes: () =>
|
|
155
|
-
getCreatePositionInstruction: () =>
|
|
156
|
-
getCreatePositionInstructionAsync: () =>
|
|
157
|
-
getCreatePositionInstructionDataCodec: () =>
|
|
158
|
-
getCreatePositionInstructionDataDecoder: () =>
|
|
159
|
-
getCreatePositionInstructionDataEncoder: () =>
|
|
119
|
+
fetchOracle: () => chunkXTL2GBZ4_cjs.fetchOracle,
|
|
120
|
+
fetchOraclesBatch: () => chunkXTL2GBZ4_cjs.fetchOraclesBatch,
|
|
121
|
+
fetchPool: () => chunkXTL2GBZ4_cjs.fetchPool,
|
|
122
|
+
fetchPoolPositions: () => chunkXTL2GBZ4_cjs.fetchPoolPositions,
|
|
123
|
+
fetchPoolsBatch: () => chunkXTL2GBZ4_cjs.fetchPoolsBatch,
|
|
124
|
+
fetchPosition: () => chunkXTL2GBZ4_cjs.fetchPosition,
|
|
125
|
+
fetchPositionByParams: () => chunkXTL2GBZ4_cjs.fetchPositionByParams,
|
|
126
|
+
fetchPositionsBatch: () => chunkXTL2GBZ4_cjs.fetchPositionsBatch,
|
|
127
|
+
fetchUserPositions: () => chunkXTL2GBZ4_cjs.fetchUserPositions,
|
|
128
|
+
filterActivePositions: () => chunkXTL2GBZ4_cjs.filterActivePositions,
|
|
129
|
+
filterPoolsByMint: () => chunkXTL2GBZ4_cjs.filterPoolsByMint,
|
|
130
|
+
getAddLiquidityDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getAddLiquidityDiscriminatorBytes,
|
|
131
|
+
getAddLiquidityInstruction: () => chunkXTL2GBZ4_cjs.getAddLiquidityInstruction,
|
|
132
|
+
getAddLiquidityInstructionAsync: () => chunkXTL2GBZ4_cjs.getAddLiquidityInstructionAsync,
|
|
133
|
+
getAddLiquidityInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getAddLiquidityInstructionDataCodec,
|
|
134
|
+
getAddLiquidityInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getAddLiquidityInstructionDataDecoder,
|
|
135
|
+
getAddLiquidityInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getAddLiquidityInstructionDataEncoder,
|
|
136
|
+
getAddLiquidityQuote: () => chunkXTL2GBZ4_cjs.getAddLiquidityQuote,
|
|
137
|
+
getClosePositionDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getClosePositionDiscriminatorBytes,
|
|
138
|
+
getClosePositionInstruction: () => chunkXTL2GBZ4_cjs.getClosePositionInstruction,
|
|
139
|
+
getClosePositionInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getClosePositionInstructionDataCodec,
|
|
140
|
+
getClosePositionInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getClosePositionInstructionDataDecoder,
|
|
141
|
+
getClosePositionInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getClosePositionInstructionDataEncoder,
|
|
142
|
+
getCollectFeesDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getCollectFeesDiscriminatorBytes,
|
|
143
|
+
getCollectFeesInstruction: () => chunkXTL2GBZ4_cjs.getCollectFeesInstruction,
|
|
144
|
+
getCollectFeesInstructionAsync: () => chunkXTL2GBZ4_cjs.getCollectFeesInstructionAsync,
|
|
145
|
+
getCollectFeesInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getCollectFeesInstructionDataCodec,
|
|
146
|
+
getCollectFeesInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getCollectFeesInstructionDataDecoder,
|
|
147
|
+
getCollectFeesInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getCollectFeesInstructionDataEncoder,
|
|
148
|
+
getCollectProtocolFeesDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getCollectProtocolFeesDiscriminatorBytes,
|
|
149
|
+
getCollectProtocolFeesInstruction: () => chunkXTL2GBZ4_cjs.getCollectProtocolFeesInstruction,
|
|
150
|
+
getCollectProtocolFeesInstructionAsync: () => chunkXTL2GBZ4_cjs.getCollectProtocolFeesInstructionAsync,
|
|
151
|
+
getCollectProtocolFeesInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getCollectProtocolFeesInstructionDataCodec,
|
|
152
|
+
getCollectProtocolFeesInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getCollectProtocolFeesInstructionDataDecoder,
|
|
153
|
+
getCollectProtocolFeesInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getCollectProtocolFeesInstructionDataEncoder,
|
|
154
|
+
getConfigAddress: () => chunkU6B52TBT_cjs.getConfigAddress,
|
|
155
|
+
getCreatePositionDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getCreatePositionDiscriminatorBytes,
|
|
156
|
+
getCreatePositionInstruction: () => chunkXTL2GBZ4_cjs.getCreatePositionInstruction,
|
|
157
|
+
getCreatePositionInstructionAsync: () => chunkXTL2GBZ4_cjs.getCreatePositionInstructionAsync,
|
|
158
|
+
getCreatePositionInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getCreatePositionInstructionDataCodec,
|
|
159
|
+
getCreatePositionInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getCreatePositionInstructionDataDecoder,
|
|
160
|
+
getCreatePositionInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getCreatePositionInstructionDataEncoder,
|
|
160
161
|
getErrorMessage: () => getErrorMessage,
|
|
161
|
-
getInitializeConfigDiscriminatorBytes: () =>
|
|
162
|
-
getInitializeConfigInstruction: () =>
|
|
163
|
-
getInitializeConfigInstructionAsync: () =>
|
|
164
|
-
getInitializeConfigInstructionDataCodec: () =>
|
|
165
|
-
getInitializeConfigInstructionDataDecoder: () =>
|
|
166
|
-
getInitializeConfigInstructionDataEncoder: () =>
|
|
167
|
-
getInitializeOracleDiscriminatorBytes: () =>
|
|
168
|
-
getInitializeOracleInstruction: () =>
|
|
169
|
-
getInitializeOracleInstructionAsync: () =>
|
|
170
|
-
getInitializeOracleInstructionDataCodec: () =>
|
|
171
|
-
getInitializeOracleInstructionDataDecoder: () =>
|
|
172
|
-
getInitializeOracleInstructionDataEncoder: () =>
|
|
173
|
-
getInitializePoolDiscriminatorBytes: () =>
|
|
174
|
-
getInitializePoolInstruction: () =>
|
|
175
|
-
getInitializePoolInstructionAsync: () =>
|
|
176
|
-
getInitializePoolInstructionDataCodec: () =>
|
|
177
|
-
getInitializePoolInstructionDataDecoder: () =>
|
|
178
|
-
getInitializePoolInstructionDataEncoder: () =>
|
|
179
|
-
getK: () =>
|
|
180
|
-
getLiquidityAddresses: () =>
|
|
162
|
+
getInitializeConfigDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getInitializeConfigDiscriminatorBytes,
|
|
163
|
+
getInitializeConfigInstruction: () => chunkXTL2GBZ4_cjs.getInitializeConfigInstruction,
|
|
164
|
+
getInitializeConfigInstructionAsync: () => chunkXTL2GBZ4_cjs.getInitializeConfigInstructionAsync,
|
|
165
|
+
getInitializeConfigInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getInitializeConfigInstructionDataCodec,
|
|
166
|
+
getInitializeConfigInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getInitializeConfigInstructionDataDecoder,
|
|
167
|
+
getInitializeConfigInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getInitializeConfigInstructionDataEncoder,
|
|
168
|
+
getInitializeOracleDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getInitializeOracleDiscriminatorBytes,
|
|
169
|
+
getInitializeOracleInstruction: () => chunkXTL2GBZ4_cjs.getInitializeOracleInstruction,
|
|
170
|
+
getInitializeOracleInstructionAsync: () => chunkXTL2GBZ4_cjs.getInitializeOracleInstructionAsync,
|
|
171
|
+
getInitializeOracleInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getInitializeOracleInstructionDataCodec,
|
|
172
|
+
getInitializeOracleInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getInitializeOracleInstructionDataDecoder,
|
|
173
|
+
getInitializeOracleInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getInitializeOracleInstructionDataEncoder,
|
|
174
|
+
getInitializePoolDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getInitializePoolDiscriminatorBytes,
|
|
175
|
+
getInitializePoolInstruction: () => chunkXTL2GBZ4_cjs.getInitializePoolInstruction,
|
|
176
|
+
getInitializePoolInstructionAsync: () => chunkXTL2GBZ4_cjs.getInitializePoolInstructionAsync,
|
|
177
|
+
getInitializePoolInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getInitializePoolInstructionDataCodec,
|
|
178
|
+
getInitializePoolInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getInitializePoolInstructionDataDecoder,
|
|
179
|
+
getInitializePoolInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getInitializePoolInstructionDataEncoder,
|
|
180
|
+
getK: () => chunkXTL2GBZ4_cjs.getK,
|
|
181
|
+
getLiquidityAddresses: () => chunkU6B52TBT_cjs.getLiquidityAddresses,
|
|
181
182
|
getMetadataAddress: () => getMetadataAddress,
|
|
182
|
-
getOracleAddress: () =>
|
|
183
|
-
getOracleAddressFromPool: () =>
|
|
184
|
-
getOracleAge: () =>
|
|
185
|
-
getOracleBufferStats: () =>
|
|
186
|
-
getOracleConsultDiscriminatorBytes: () =>
|
|
187
|
-
getOracleConsultInstruction: () =>
|
|
188
|
-
getOracleConsultInstructionAsync: () =>
|
|
189
|
-
getOracleConsultInstructionDataCodec: () =>
|
|
190
|
-
getOracleConsultInstructionDataDecoder: () =>
|
|
191
|
-
getOracleConsultInstructionDataEncoder: () =>
|
|
192
|
-
getOracleDeviation: () =>
|
|
193
|
-
getOracleForPool: () =>
|
|
194
|
-
getOracleSpotPrices: () =>
|
|
195
|
-
getOracleUpdateDiscriminatorBytes: () =>
|
|
196
|
-
getOracleUpdateInstruction: () =>
|
|
197
|
-
getOracleUpdateInstructionAsync: () =>
|
|
198
|
-
getOracleUpdateInstructionDataCodec: () =>
|
|
199
|
-
getOracleUpdateInstructionDataDecoder: () =>
|
|
200
|
-
getOracleUpdateInstructionDataEncoder: () =>
|
|
201
|
-
getPauseDiscriminatorBytes: () =>
|
|
202
|
-
getPauseInstruction: () =>
|
|
203
|
-
getPauseInstructionDataCodec: () =>
|
|
204
|
-
getPauseInstructionDataDecoder: () =>
|
|
205
|
-
getPauseInstructionDataEncoder: () =>
|
|
206
|
-
getPendingFees: () =>
|
|
207
|
-
getPoolAddress: () =>
|
|
208
|
-
getPoolAddressFromMints: () =>
|
|
209
|
-
getPoolAuthorityAddress: () =>
|
|
210
|
-
getPoolByMints: () =>
|
|
211
|
-
getPoolInitAddresses: () =>
|
|
212
|
-
getPoolVault0Address: () =>
|
|
213
|
-
getPoolVault1Address: () =>
|
|
214
|
-
getPositionAddress: () =>
|
|
215
|
-
getPositionAddressFromParams: () =>
|
|
216
|
-
getPositionValue: () =>
|
|
217
|
-
getPreviewSwapExactInDiscriminatorBytes: () =>
|
|
218
|
-
getPreviewSwapExactInInstruction: () =>
|
|
219
|
-
getPreviewSwapExactInInstructionDataCodec: () =>
|
|
220
|
-
getPreviewSwapExactInInstructionDataDecoder: () =>
|
|
221
|
-
getPreviewSwapExactInInstructionDataEncoder: () =>
|
|
222
|
-
getProtocolFeeOwnerAddress: () =>
|
|
223
|
-
getProtocolFeePositionAddress: () =>
|
|
224
|
-
getRedeemProtocolSharesDiscriminatorBytes: () =>
|
|
225
|
-
getRedeemProtocolSharesInstruction: () =>
|
|
226
|
-
getRedeemProtocolSharesInstructionAsync: () =>
|
|
227
|
-
getRedeemProtocolSharesInstructionDataCodec: () =>
|
|
228
|
-
getRedeemProtocolSharesInstructionDataDecoder: () =>
|
|
229
|
-
getRedeemProtocolSharesInstructionDataEncoder: () =>
|
|
230
|
-
getRemoveLiquidityDiscriminatorBytes: () =>
|
|
231
|
-
getRemoveLiquidityInstruction: () =>
|
|
232
|
-
getRemoveLiquidityInstructionAsync: () =>
|
|
233
|
-
getRemoveLiquidityInstructionDataCodec: () =>
|
|
234
|
-
getRemoveLiquidityInstructionDataDecoder: () =>
|
|
235
|
-
getRemoveLiquidityInstructionDataEncoder: () =>
|
|
236
|
-
getRemoveLiquidityQuote: () =>
|
|
237
|
-
getSetFeesDiscriminatorBytes: () =>
|
|
238
|
-
getSetFeesInstruction: () =>
|
|
239
|
-
getSetFeesInstructionDataCodec: () =>
|
|
240
|
-
getSetFeesInstructionDataDecoder: () =>
|
|
241
|
-
getSetFeesInstructionDataEncoder: () =>
|
|
242
|
-
getSetHookDiscriminatorBytes: () =>
|
|
243
|
-
getSetHookInstruction: () =>
|
|
244
|
-
getSetHookInstructionDataCodec: () =>
|
|
245
|
-
getSetHookInstructionDataDecoder: () =>
|
|
246
|
-
getSetHookInstructionDataEncoder: () =>
|
|
247
|
-
getSpotPrice0: () =>
|
|
248
|
-
getSpotPrice1: () =>
|
|
249
|
-
getSwapAddresses: () =>
|
|
250
|
-
getSwapExactInDiscriminatorBytes: () =>
|
|
251
|
-
getSwapExactInInstruction: () =>
|
|
252
|
-
getSwapExactInInstructionAsync: () =>
|
|
253
|
-
getSwapExactInInstructionDataCodec: () =>
|
|
254
|
-
getSwapExactInInstructionDataDecoder: () =>
|
|
255
|
-
getSwapExactInInstructionDataEncoder: () =>
|
|
256
|
-
getSwapQuote: () =>
|
|
257
|
-
getSwapQuoteExactOut: () =>
|
|
258
|
-
getTransferAdminDiscriminatorBytes: () =>
|
|
259
|
-
getTransferAdminInstruction: () =>
|
|
260
|
-
getTransferAdminInstructionDataCodec: () =>
|
|
261
|
-
getTransferAdminInstructionDataDecoder: () =>
|
|
262
|
-
getTransferAdminInstructionDataEncoder: () =>
|
|
263
|
-
getTvl: () =>
|
|
264
|
-
getUnpauseDiscriminatorBytes: () =>
|
|
265
|
-
getUnpauseInstruction: () =>
|
|
266
|
-
getUnpauseInstructionDataCodec: () =>
|
|
267
|
-
getUnpauseInstructionDataDecoder: () =>
|
|
268
|
-
getUnpauseInstructionDataEncoder: () =>
|
|
269
|
-
getUpdateConfigDiscriminatorBytes: () =>
|
|
270
|
-
getUpdateConfigInstruction: () =>
|
|
271
|
-
getUpdateConfigInstructionDataCodec: () =>
|
|
272
|
-
getUpdateConfigInstructionDataDecoder: () =>
|
|
273
|
-
getUpdateConfigInstructionDataEncoder: () =>
|
|
274
|
-
getWithdrawVaultExcessDiscriminatorBytes: () =>
|
|
275
|
-
getWithdrawVaultExcessInstruction: () =>
|
|
276
|
-
getWithdrawVaultExcessInstructionAsync: () =>
|
|
277
|
-
getWithdrawVaultExcessInstructionDataCodec: () =>
|
|
278
|
-
getWithdrawVaultExcessInstructionDataDecoder: () =>
|
|
279
|
-
getWithdrawVaultExcessInstructionDataEncoder: () =>
|
|
280
|
-
initializeConfigArgsCodec: () =>
|
|
281
|
-
initializeOracleArgsCodec: () =>
|
|
282
|
-
initializePoolArgsCodec: () =>
|
|
183
|
+
getOracleAddress: () => chunkU6B52TBT_cjs.getOracleAddress,
|
|
184
|
+
getOracleAddressFromPool: () => chunkXTL2GBZ4_cjs.getOracleAddressFromPool,
|
|
185
|
+
getOracleAge: () => chunkXTL2GBZ4_cjs.getOracleAge,
|
|
186
|
+
getOracleBufferStats: () => chunkXTL2GBZ4_cjs.getOracleBufferStats,
|
|
187
|
+
getOracleConsultDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getOracleConsultDiscriminatorBytes,
|
|
188
|
+
getOracleConsultInstruction: () => chunkXTL2GBZ4_cjs.getOracleConsultInstruction,
|
|
189
|
+
getOracleConsultInstructionAsync: () => chunkXTL2GBZ4_cjs.getOracleConsultInstructionAsync,
|
|
190
|
+
getOracleConsultInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getOracleConsultInstructionDataCodec,
|
|
191
|
+
getOracleConsultInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getOracleConsultInstructionDataDecoder,
|
|
192
|
+
getOracleConsultInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getOracleConsultInstructionDataEncoder,
|
|
193
|
+
getOracleDeviation: () => chunkXTL2GBZ4_cjs.getOracleDeviation,
|
|
194
|
+
getOracleForPool: () => chunkXTL2GBZ4_cjs.getOracleForPool,
|
|
195
|
+
getOracleSpotPrices: () => chunkXTL2GBZ4_cjs.getOracleSpotPrices,
|
|
196
|
+
getOracleUpdateDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getOracleUpdateDiscriminatorBytes,
|
|
197
|
+
getOracleUpdateInstruction: () => chunkXTL2GBZ4_cjs.getOracleUpdateInstruction,
|
|
198
|
+
getOracleUpdateInstructionAsync: () => chunkXTL2GBZ4_cjs.getOracleUpdateInstructionAsync,
|
|
199
|
+
getOracleUpdateInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getOracleUpdateInstructionDataCodec,
|
|
200
|
+
getOracleUpdateInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getOracleUpdateInstructionDataDecoder,
|
|
201
|
+
getOracleUpdateInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getOracleUpdateInstructionDataEncoder,
|
|
202
|
+
getPauseDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getPauseDiscriminatorBytes,
|
|
203
|
+
getPauseInstruction: () => chunkXTL2GBZ4_cjs.getPauseInstruction,
|
|
204
|
+
getPauseInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getPauseInstructionDataCodec,
|
|
205
|
+
getPauseInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getPauseInstructionDataDecoder,
|
|
206
|
+
getPauseInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getPauseInstructionDataEncoder,
|
|
207
|
+
getPendingFees: () => chunkXTL2GBZ4_cjs.getPendingFees,
|
|
208
|
+
getPoolAddress: () => chunkU6B52TBT_cjs.getPoolAddress,
|
|
209
|
+
getPoolAddressFromMints: () => chunkXTL2GBZ4_cjs.getPoolAddressFromMints,
|
|
210
|
+
getPoolAuthorityAddress: () => chunkU6B52TBT_cjs.getPoolAuthorityAddress,
|
|
211
|
+
getPoolByMints: () => chunkXTL2GBZ4_cjs.getPoolByMints,
|
|
212
|
+
getPoolInitAddresses: () => chunkU6B52TBT_cjs.getPoolInitAddresses,
|
|
213
|
+
getPoolVault0Address: () => chunkU6B52TBT_cjs.getPoolVault0Address,
|
|
214
|
+
getPoolVault1Address: () => chunkU6B52TBT_cjs.getPoolVault1Address,
|
|
215
|
+
getPositionAddress: () => chunkU6B52TBT_cjs.getPositionAddress,
|
|
216
|
+
getPositionAddressFromParams: () => chunkXTL2GBZ4_cjs.getPositionAddressFromParams,
|
|
217
|
+
getPositionValue: () => chunkXTL2GBZ4_cjs.getPositionValue,
|
|
218
|
+
getPreviewSwapExactInDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getPreviewSwapExactInDiscriminatorBytes,
|
|
219
|
+
getPreviewSwapExactInInstruction: () => chunkXTL2GBZ4_cjs.getPreviewSwapExactInInstruction,
|
|
220
|
+
getPreviewSwapExactInInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getPreviewSwapExactInInstructionDataCodec,
|
|
221
|
+
getPreviewSwapExactInInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getPreviewSwapExactInInstructionDataDecoder,
|
|
222
|
+
getPreviewSwapExactInInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getPreviewSwapExactInInstructionDataEncoder,
|
|
223
|
+
getProtocolFeeOwnerAddress: () => chunkU6B52TBT_cjs.getProtocolFeeOwnerAddress,
|
|
224
|
+
getProtocolFeePositionAddress: () => chunkU6B52TBT_cjs.getProtocolFeePositionAddress,
|
|
225
|
+
getRedeemProtocolSharesDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getRedeemProtocolSharesDiscriminatorBytes,
|
|
226
|
+
getRedeemProtocolSharesInstruction: () => chunkXTL2GBZ4_cjs.getRedeemProtocolSharesInstruction,
|
|
227
|
+
getRedeemProtocolSharesInstructionAsync: () => chunkXTL2GBZ4_cjs.getRedeemProtocolSharesInstructionAsync,
|
|
228
|
+
getRedeemProtocolSharesInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getRedeemProtocolSharesInstructionDataCodec,
|
|
229
|
+
getRedeemProtocolSharesInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getRedeemProtocolSharesInstructionDataDecoder,
|
|
230
|
+
getRedeemProtocolSharesInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getRedeemProtocolSharesInstructionDataEncoder,
|
|
231
|
+
getRemoveLiquidityDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getRemoveLiquidityDiscriminatorBytes,
|
|
232
|
+
getRemoveLiquidityInstruction: () => chunkXTL2GBZ4_cjs.getRemoveLiquidityInstruction,
|
|
233
|
+
getRemoveLiquidityInstructionAsync: () => chunkXTL2GBZ4_cjs.getRemoveLiquidityInstructionAsync,
|
|
234
|
+
getRemoveLiquidityInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getRemoveLiquidityInstructionDataCodec,
|
|
235
|
+
getRemoveLiquidityInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getRemoveLiquidityInstructionDataDecoder,
|
|
236
|
+
getRemoveLiquidityInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getRemoveLiquidityInstructionDataEncoder,
|
|
237
|
+
getRemoveLiquidityQuote: () => chunkXTL2GBZ4_cjs.getRemoveLiquidityQuote,
|
|
238
|
+
getSetFeesDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getSetFeesDiscriminatorBytes,
|
|
239
|
+
getSetFeesInstruction: () => chunkXTL2GBZ4_cjs.getSetFeesInstruction,
|
|
240
|
+
getSetFeesInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getSetFeesInstructionDataCodec,
|
|
241
|
+
getSetFeesInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getSetFeesInstructionDataDecoder,
|
|
242
|
+
getSetFeesInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getSetFeesInstructionDataEncoder,
|
|
243
|
+
getSetHookDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getSetHookDiscriminatorBytes,
|
|
244
|
+
getSetHookInstruction: () => chunkXTL2GBZ4_cjs.getSetHookInstruction,
|
|
245
|
+
getSetHookInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getSetHookInstructionDataCodec,
|
|
246
|
+
getSetHookInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getSetHookInstructionDataDecoder,
|
|
247
|
+
getSetHookInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getSetHookInstructionDataEncoder,
|
|
248
|
+
getSpotPrice0: () => chunkXTL2GBZ4_cjs.getSpotPrice0,
|
|
249
|
+
getSpotPrice1: () => chunkXTL2GBZ4_cjs.getSpotPrice1,
|
|
250
|
+
getSwapAddresses: () => chunkU6B52TBT_cjs.getSwapAddresses,
|
|
251
|
+
getSwapExactInDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getSwapExactInDiscriminatorBytes,
|
|
252
|
+
getSwapExactInInstruction: () => chunkXTL2GBZ4_cjs.getSwapExactInInstruction,
|
|
253
|
+
getSwapExactInInstructionAsync: () => chunkXTL2GBZ4_cjs.getSwapExactInInstructionAsync,
|
|
254
|
+
getSwapExactInInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getSwapExactInInstructionDataCodec,
|
|
255
|
+
getSwapExactInInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getSwapExactInInstructionDataDecoder,
|
|
256
|
+
getSwapExactInInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getSwapExactInInstructionDataEncoder,
|
|
257
|
+
getSwapQuote: () => chunkXTL2GBZ4_cjs.getSwapQuote,
|
|
258
|
+
getSwapQuoteExactOut: () => chunkXTL2GBZ4_cjs.getSwapQuoteExactOut,
|
|
259
|
+
getTransferAdminDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getTransferAdminDiscriminatorBytes,
|
|
260
|
+
getTransferAdminInstruction: () => chunkXTL2GBZ4_cjs.getTransferAdminInstruction,
|
|
261
|
+
getTransferAdminInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getTransferAdminInstructionDataCodec,
|
|
262
|
+
getTransferAdminInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getTransferAdminInstructionDataDecoder,
|
|
263
|
+
getTransferAdminInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getTransferAdminInstructionDataEncoder,
|
|
264
|
+
getTvl: () => chunkXTL2GBZ4_cjs.getTvl,
|
|
265
|
+
getUnpauseDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getUnpauseDiscriminatorBytes,
|
|
266
|
+
getUnpauseInstruction: () => chunkXTL2GBZ4_cjs.getUnpauseInstruction,
|
|
267
|
+
getUnpauseInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getUnpauseInstructionDataCodec,
|
|
268
|
+
getUnpauseInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getUnpauseInstructionDataDecoder,
|
|
269
|
+
getUnpauseInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getUnpauseInstructionDataEncoder,
|
|
270
|
+
getUpdateConfigDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getUpdateConfigDiscriminatorBytes,
|
|
271
|
+
getUpdateConfigInstruction: () => chunkXTL2GBZ4_cjs.getUpdateConfigInstruction,
|
|
272
|
+
getUpdateConfigInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getUpdateConfigInstructionDataCodec,
|
|
273
|
+
getUpdateConfigInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getUpdateConfigInstructionDataDecoder,
|
|
274
|
+
getUpdateConfigInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getUpdateConfigInstructionDataEncoder,
|
|
275
|
+
getWithdrawVaultExcessDiscriminatorBytes: () => chunkXTL2GBZ4_cjs.getWithdrawVaultExcessDiscriminatorBytes,
|
|
276
|
+
getWithdrawVaultExcessInstruction: () => chunkXTL2GBZ4_cjs.getWithdrawVaultExcessInstruction,
|
|
277
|
+
getWithdrawVaultExcessInstructionAsync: () => chunkXTL2GBZ4_cjs.getWithdrawVaultExcessInstructionAsync,
|
|
278
|
+
getWithdrawVaultExcessInstructionDataCodec: () => chunkXTL2GBZ4_cjs.getWithdrawVaultExcessInstructionDataCodec,
|
|
279
|
+
getWithdrawVaultExcessInstructionDataDecoder: () => chunkXTL2GBZ4_cjs.getWithdrawVaultExcessInstructionDataDecoder,
|
|
280
|
+
getWithdrawVaultExcessInstructionDataEncoder: () => chunkXTL2GBZ4_cjs.getWithdrawVaultExcessInstructionDataEncoder,
|
|
281
|
+
initializeConfigArgsCodec: () => chunkXTL2GBZ4_cjs.initializeConfigArgsCodec,
|
|
282
|
+
initializeOracleArgsCodec: () => chunkXTL2GBZ4_cjs.initializeOracleArgsCodec,
|
|
283
|
+
initializePoolArgsCodec: () => chunkXTL2GBZ4_cjs.initializePoolArgsCodec,
|
|
283
284
|
isCpmmError: () => isCpmmError,
|
|
284
|
-
isOracleStale: () =>
|
|
285
|
-
isqrt: () =>
|
|
285
|
+
isOracleStale: () => chunkXTL2GBZ4_cjs.isOracleStale,
|
|
286
|
+
isqrt: () => chunkXTL2GBZ4_cjs.isqrt,
|
|
286
287
|
marketCapToCurveParams: () => marketCapToCurveParams,
|
|
287
288
|
marketCapToSingleCurveParams: () => marketCapToSingleCurveParams,
|
|
288
289
|
marketCapToTokenPrice: () => marketCapToTokenPrice,
|
|
289
|
-
maxBigInt: () =>
|
|
290
|
-
minBigInt: () =>
|
|
291
|
-
numberToQ64: () =>
|
|
292
|
-
observationCodec: () =>
|
|
293
|
-
oracleConsultArgsCodec: () =>
|
|
294
|
-
oracleStateDataCodec: () =>
|
|
295
|
-
parseAddLiquidityInstruction: () =>
|
|
296
|
-
parseClosePositionInstruction: () =>
|
|
297
|
-
parseCollectFeesInstruction: () =>
|
|
298
|
-
parseCollectProtocolFeesInstruction: () =>
|
|
299
|
-
parseCreatePositionInstruction: () =>
|
|
290
|
+
maxBigInt: () => chunkXTL2GBZ4_cjs.maxBigInt,
|
|
291
|
+
minBigInt: () => chunkXTL2GBZ4_cjs.minBigInt,
|
|
292
|
+
numberToQ64: () => chunkXTL2GBZ4_cjs.numberToQ64,
|
|
293
|
+
observationCodec: () => chunkXTL2GBZ4_cjs.observationCodec,
|
|
294
|
+
oracleConsultArgsCodec: () => chunkXTL2GBZ4_cjs.oracleConsultArgsCodec,
|
|
295
|
+
oracleStateDataCodec: () => chunkXTL2GBZ4_cjs.oracleStateDataCodec,
|
|
296
|
+
parseAddLiquidityInstruction: () => chunkXTL2GBZ4_cjs.parseAddLiquidityInstruction,
|
|
297
|
+
parseClosePositionInstruction: () => chunkXTL2GBZ4_cjs.parseClosePositionInstruction,
|
|
298
|
+
parseCollectFeesInstruction: () => chunkXTL2GBZ4_cjs.parseCollectFeesInstruction,
|
|
299
|
+
parseCollectProtocolFeesInstruction: () => chunkXTL2GBZ4_cjs.parseCollectProtocolFeesInstruction,
|
|
300
|
+
parseCreatePositionInstruction: () => chunkXTL2GBZ4_cjs.parseCreatePositionInstruction,
|
|
300
301
|
parseErrorFromLogs: () => parseErrorFromLogs,
|
|
301
|
-
parseInitializeConfigInstruction: () =>
|
|
302
|
-
parseInitializeOracleInstruction: () =>
|
|
303
|
-
parseInitializePoolInstruction: () =>
|
|
304
|
-
parseOracleConsultInstruction: () =>
|
|
305
|
-
parseOracleUpdateInstruction: () =>
|
|
306
|
-
parsePauseInstruction: () =>
|
|
307
|
-
parsePreviewSwapExactInInstruction: () =>
|
|
308
|
-
parseRedeemProtocolSharesInstruction: () =>
|
|
309
|
-
parseRemoveLiquidityInstruction: () =>
|
|
310
|
-
parseSetFeesInstruction: () =>
|
|
311
|
-
parseSetHookInstruction: () =>
|
|
312
|
-
parseSwapExactInInstruction: () =>
|
|
313
|
-
parseTransferAdminInstruction: () =>
|
|
314
|
-
parseUnpauseInstruction: () =>
|
|
315
|
-
parseUpdateConfigInstruction: () =>
|
|
316
|
-
parseWithdrawVaultExcessInstruction: () =>
|
|
317
|
-
poolDataCodec: () =>
|
|
318
|
-
poolExists: () =>
|
|
319
|
-
positionDataCodec: () =>
|
|
320
|
-
q64Div: () =>
|
|
321
|
-
q64Mul: () =>
|
|
322
|
-
q64ToNumber: () =>
|
|
323
|
-
ratioToNumber: () =>
|
|
324
|
-
removeLiquidityArgsCodec: () =>
|
|
325
|
-
setFeesArgsCodec: () =>
|
|
326
|
-
setHookArgsCodec: () =>
|
|
327
|
-
sortMints: () =>
|
|
328
|
-
sortPoolsByReserves: () =>
|
|
329
|
-
sortPositionsByShares: () =>
|
|
330
|
-
swapExactInArgsCodec: () =>
|
|
331
|
-
transferAdminArgsCodec: () =>
|
|
302
|
+
parseInitializeConfigInstruction: () => chunkXTL2GBZ4_cjs.parseInitializeConfigInstruction,
|
|
303
|
+
parseInitializeOracleInstruction: () => chunkXTL2GBZ4_cjs.parseInitializeOracleInstruction,
|
|
304
|
+
parseInitializePoolInstruction: () => chunkXTL2GBZ4_cjs.parseInitializePoolInstruction,
|
|
305
|
+
parseOracleConsultInstruction: () => chunkXTL2GBZ4_cjs.parseOracleConsultInstruction,
|
|
306
|
+
parseOracleUpdateInstruction: () => chunkXTL2GBZ4_cjs.parseOracleUpdateInstruction,
|
|
307
|
+
parsePauseInstruction: () => chunkXTL2GBZ4_cjs.parsePauseInstruction,
|
|
308
|
+
parsePreviewSwapExactInInstruction: () => chunkXTL2GBZ4_cjs.parsePreviewSwapExactInInstruction,
|
|
309
|
+
parseRedeemProtocolSharesInstruction: () => chunkXTL2GBZ4_cjs.parseRedeemProtocolSharesInstruction,
|
|
310
|
+
parseRemoveLiquidityInstruction: () => chunkXTL2GBZ4_cjs.parseRemoveLiquidityInstruction,
|
|
311
|
+
parseSetFeesInstruction: () => chunkXTL2GBZ4_cjs.parseSetFeesInstruction,
|
|
312
|
+
parseSetHookInstruction: () => chunkXTL2GBZ4_cjs.parseSetHookInstruction,
|
|
313
|
+
parseSwapExactInInstruction: () => chunkXTL2GBZ4_cjs.parseSwapExactInInstruction,
|
|
314
|
+
parseTransferAdminInstruction: () => chunkXTL2GBZ4_cjs.parseTransferAdminInstruction,
|
|
315
|
+
parseUnpauseInstruction: () => chunkXTL2GBZ4_cjs.parseUnpauseInstruction,
|
|
316
|
+
parseUpdateConfigInstruction: () => chunkXTL2GBZ4_cjs.parseUpdateConfigInstruction,
|
|
317
|
+
parseWithdrawVaultExcessInstruction: () => chunkXTL2GBZ4_cjs.parseWithdrawVaultExcessInstruction,
|
|
318
|
+
poolDataCodec: () => chunkXTL2GBZ4_cjs.poolDataCodec,
|
|
319
|
+
poolExists: () => chunkXTL2GBZ4_cjs.poolExists,
|
|
320
|
+
positionDataCodec: () => chunkXTL2GBZ4_cjs.positionDataCodec,
|
|
321
|
+
q64Div: () => chunkXTL2GBZ4_cjs.q64Div,
|
|
322
|
+
q64Mul: () => chunkXTL2GBZ4_cjs.q64Mul,
|
|
323
|
+
q64ToNumber: () => chunkXTL2GBZ4_cjs.q64ToNumber,
|
|
324
|
+
ratioToNumber: () => chunkXTL2GBZ4_cjs.ratioToNumber,
|
|
325
|
+
removeLiquidityArgsCodec: () => chunkXTL2GBZ4_cjs.removeLiquidityArgsCodec,
|
|
326
|
+
setFeesArgsCodec: () => chunkXTL2GBZ4_cjs.setFeesArgsCodec,
|
|
327
|
+
setHookArgsCodec: () => chunkXTL2GBZ4_cjs.setHookArgsCodec,
|
|
328
|
+
sortMints: () => chunkU6B52TBT_cjs.sortMints,
|
|
329
|
+
sortPoolsByReserves: () => chunkXTL2GBZ4_cjs.sortPoolsByReserves,
|
|
330
|
+
sortPositionsByShares: () => chunkXTL2GBZ4_cjs.sortPositionsByShares,
|
|
331
|
+
swapExactInArgsCodec: () => chunkXTL2GBZ4_cjs.swapExactInArgsCodec,
|
|
332
|
+
transferAdminArgsCodec: () => chunkXTL2GBZ4_cjs.transferAdminArgsCodec,
|
|
332
333
|
validateMarketCapParameters: () => validateMarketCapParameters
|
|
333
334
|
});
|
|
334
335
|
var addressCodec = kit.getAddressCodec();
|
|
335
336
|
var textEncoder = new TextEncoder();
|
|
336
337
|
async function getMetadataAddress(mint) {
|
|
337
338
|
return kit.getProgramDerivedAddress({
|
|
338
|
-
programAddress:
|
|
339
|
+
programAddress: chunkU6B52TBT_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
339
340
|
seeds: [
|
|
340
341
|
textEncoder.encode("metadata"),
|
|
341
|
-
addressCodec.encode(
|
|
342
|
+
addressCodec.encode(chunkU6B52TBT_cjs.TOKEN_METADATA_PROGRAM_ID),
|
|
342
343
|
addressCodec.encode(mint)
|
|
343
344
|
]
|
|
344
345
|
});
|
|
@@ -667,12 +668,12 @@ function createSwapInstruction(params) {
|
|
|
667
668
|
token0Program,
|
|
668
669
|
token1Program,
|
|
669
670
|
tokenProgram,
|
|
670
|
-
programId =
|
|
671
|
+
programId = chunkXTL2GBZ4_cjs.CPMM_PROGRAM_ADDRESS
|
|
671
672
|
} = params;
|
|
672
673
|
const trader = typeof user === "string" ? kit.createNoopSigner(user) : user;
|
|
673
674
|
const [vaultIn, vaultOut] = tradeDirection === 0 ? [vault0, vault1] : [vault1, vault0];
|
|
674
675
|
const [userIn, userOut] = tradeDirection === 0 ? [userToken0, userToken1] : [userToken1, userToken0];
|
|
675
|
-
const instruction =
|
|
676
|
+
const instruction = chunkXTL2GBZ4_cjs.getSwapExactInInstruction(
|
|
676
677
|
{
|
|
677
678
|
config,
|
|
678
679
|
pool,
|
|
@@ -684,8 +685,8 @@ function createSwapInstruction(params) {
|
|
|
684
685
|
userIn,
|
|
685
686
|
userOut,
|
|
686
687
|
trader,
|
|
687
|
-
token0Program: token0Program ?? tokenProgram ??
|
|
688
|
-
token1Program: token1Program ?? tokenProgram ??
|
|
688
|
+
token0Program: token0Program ?? tokenProgram ?? chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
689
|
+
token1Program: token1Program ?? tokenProgram ?? chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
689
690
|
oracle,
|
|
690
691
|
amountIn,
|
|
691
692
|
minAmountOut,
|
|
@@ -713,8 +714,8 @@ function base64ToBytes(base64) {
|
|
|
713
714
|
}
|
|
714
715
|
return bytes;
|
|
715
716
|
}
|
|
716
|
-
async function fetchConfig(rpc, programId =
|
|
717
|
-
const [configAddress] = await
|
|
717
|
+
async function fetchConfig(rpc, programId = chunkU6B52TBT_cjs.CPMM_PROGRAM_ID, commitment) {
|
|
718
|
+
const [configAddress] = await chunkU6B52TBT_cjs.getConfigAddress(programId);
|
|
718
719
|
const response = await rpc.getAccountInfo(configAddress, {
|
|
719
720
|
encoding: "base64",
|
|
720
721
|
commitment
|
|
@@ -722,10 +723,10 @@ async function fetchConfig(rpc, programId = chunkY6TJIH33_cjs.CPMM_PROGRAM_ID, c
|
|
|
722
723
|
if (!response.value) {
|
|
723
724
|
return null;
|
|
724
725
|
}
|
|
725
|
-
return
|
|
726
|
+
return chunkXTL2GBZ4_cjs.decodeAmmConfig(base64ToBytes(response.value.data[0]));
|
|
726
727
|
}
|
|
727
|
-
async function fetchConfigWithAddress(rpc, programId =
|
|
728
|
-
const [configAddress] = await
|
|
728
|
+
async function fetchConfigWithAddress(rpc, programId = chunkU6B52TBT_cjs.CPMM_PROGRAM_ID, commitment) {
|
|
729
|
+
const [configAddress] = await chunkU6B52TBT_cjs.getConfigAddress(programId);
|
|
729
730
|
const account = await fetchConfig(rpc, programId, commitment);
|
|
730
731
|
if (!account) {
|
|
731
732
|
return null;
|
|
@@ -748,6 +749,7 @@ chunkQ7SFCCGT_cjs.__export(cosignerHook_exports, {
|
|
|
748
749
|
COSIGNER_HOOK_PROGRAM_ID: () => COSIGNER_HOOK_PROGRAM_ID,
|
|
749
750
|
CosignerHookAccount: () => CosignerHookAccount,
|
|
750
751
|
CosignerHookInstruction: () => CosignerHookInstruction,
|
|
752
|
+
DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID: () => DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID,
|
|
751
753
|
GATE_EXPIRY_DISABLED: () => GATE_EXPIRY_DISABLED,
|
|
752
754
|
GATE_EXPIRY_HEADER_LEN: () => GATE_EXPIRY_HEADER_LEN,
|
|
753
755
|
GATE_EXPIRY_PAYLOAD_LEN: () => GATE_EXPIRY_PAYLOAD_LEN,
|
|
@@ -784,6 +786,7 @@ chunkQ7SFCCGT_cjs.__export(cosignerHook_exports, {
|
|
|
784
786
|
getCosignerGateStatus: () => getCosignerGateStatus,
|
|
785
787
|
getCosignerHookConfigAddress: () => getCosignerHookConfigAddress,
|
|
786
788
|
getCosignerHookErrorMessage: () => getCosignerHookErrorMessage,
|
|
789
|
+
getCosignerHookRemainingAccounts: () => getCosignerHookRemainingAccounts,
|
|
787
790
|
getInitializeConfigArgsCodec: () => getInitializeConfigArgsCodec,
|
|
788
791
|
getInitializeConfigArgsDecoder: () => getInitializeConfigArgsDecoder,
|
|
789
792
|
getInitializeConfigArgsEncoder: () => getInitializeConfigArgsEncoder,
|
|
@@ -867,13 +870,13 @@ function decodeCosignerConfig(encodedAccount) {
|
|
|
867
870
|
getCosignerConfigDecoder()
|
|
868
871
|
);
|
|
869
872
|
}
|
|
870
|
-
async function fetchCosignerConfig(rpc,
|
|
871
|
-
const maybeAccount = await fetchMaybeCosignerConfig(rpc,
|
|
873
|
+
async function fetchCosignerConfig(rpc, address4, config) {
|
|
874
|
+
const maybeAccount = await fetchMaybeCosignerConfig(rpc, address4, config);
|
|
872
875
|
kit.assertAccountExists(maybeAccount);
|
|
873
876
|
return maybeAccount;
|
|
874
877
|
}
|
|
875
|
-
async function fetchMaybeCosignerConfig(rpc,
|
|
876
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
878
|
+
async function fetchMaybeCosignerConfig(rpc, address4, config) {
|
|
879
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address4, config);
|
|
877
880
|
return decodeCosignerConfig(maybeAccount);
|
|
878
881
|
}
|
|
879
882
|
async function fetchAllCosignerConfig(rpc, addresses, config) {
|
|
@@ -1654,9 +1657,10 @@ function getSetAuthorityArgsCodec() {
|
|
|
1654
1657
|
getSetAuthorityArgsDecoder()
|
|
1655
1658
|
);
|
|
1656
1659
|
}
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
+
var DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID = kit.address(
|
|
1661
|
+
"5iWYdN9SEDeF3FTjKB48XYyCFAcVDuYHsz31Z4Wmq7Ch"
|
|
1662
|
+
);
|
|
1663
|
+
var COSIGNER_HOOK_PROGRAM_ID = DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID;
|
|
1660
1664
|
var SEED_COSIGNER_HOOK_CONFIG = "cosigner_hook_config";
|
|
1661
1665
|
var MAX_COSIGNERS = 32;
|
|
1662
1666
|
var GATE_EXPIRY_DISABLED = 0;
|
|
@@ -1665,6 +1669,215 @@ var GATE_EXPIRY_SLOT = 2;
|
|
|
1665
1669
|
var GATE_EXPIRY_PAYLOAD_VERSION = 1;
|
|
1666
1670
|
var GATE_EXPIRY_HEADER_LEN = 10;
|
|
1667
1671
|
var GATE_EXPIRY_PAYLOAD_LEN = 42;
|
|
1672
|
+
var INITIALIZER_PROGRAM_ID = kit.address(
|
|
1673
|
+
"4h3Dqyo5qmteJoMxXt3tdtfXELDB6pdRTPU9mWruiKp1"
|
|
1674
|
+
);
|
|
1675
|
+
var BPF_LOADER_UPGRADEABLE_PROGRAM_ID = kit.address(
|
|
1676
|
+
"BPFLoaderUpgradeab1e11111111111111111111111"
|
|
1677
|
+
);
|
|
1678
|
+
var CPMM_HOOK_PROGRAM_ID = kit.address(
|
|
1679
|
+
"2vJ1c62knEwZbxp3XdHB4RSmCfz55pA6tRkCho63gW7u"
|
|
1680
|
+
);
|
|
1681
|
+
var PREDICTION_HOOK_PROGRAM_ID = kit.address(
|
|
1682
|
+
"7QcQDANJVC17Jgc6KjjeagSkm2zAphgHVPK5agJzyihB"
|
|
1683
|
+
);
|
|
1684
|
+
var SEED_CONFIG2 = "config";
|
|
1685
|
+
var SEED_LAUNCH = "launch";
|
|
1686
|
+
var SEED_LAUNCH_AUTHORITY = "launch_authority";
|
|
1687
|
+
var SEED_LAUNCH_FEE_STATE = "launch_fee_state";
|
|
1688
|
+
var EMPTY_REMAINING_ACCOUNTS_HASH = new Uint8Array([
|
|
1689
|
+
232,
|
|
1690
|
+
231,
|
|
1691
|
+
118,
|
|
1692
|
+
38,
|
|
1693
|
+
88,
|
|
1694
|
+
111,
|
|
1695
|
+
115,
|
|
1696
|
+
185,
|
|
1697
|
+
85,
|
|
1698
|
+
54,
|
|
1699
|
+
76,
|
|
1700
|
+
123,
|
|
1701
|
+
75,
|
|
1702
|
+
191,
|
|
1703
|
+
11,
|
|
1704
|
+
183,
|
|
1705
|
+
247,
|
|
1706
|
+
104,
|
|
1707
|
+
94,
|
|
1708
|
+
189,
|
|
1709
|
+
64,
|
|
1710
|
+
232,
|
|
1711
|
+
82,
|
|
1712
|
+
177,
|
|
1713
|
+
100,
|
|
1714
|
+
99,
|
|
1715
|
+
58,
|
|
1716
|
+
74,
|
|
1717
|
+
203,
|
|
1718
|
+
211,
|
|
1719
|
+
36,
|
|
1720
|
+
76
|
|
1721
|
+
]);
|
|
1722
|
+
var MAX_MIGRATOR_ALLOWLIST = 32;
|
|
1723
|
+
var MAX_HOOK_ALLOWLIST2 = 32;
|
|
1724
|
+
var MAX_PAYLOAD = 256;
|
|
1725
|
+
var PHASE_TRADING = 0;
|
|
1726
|
+
var PHASE_MIGRATED = 1;
|
|
1727
|
+
var PHASE_ABORTED = 2;
|
|
1728
|
+
var TRADE_DIRECTION_BUY = 0;
|
|
1729
|
+
var TRADE_DIRECTION_SELL = 1;
|
|
1730
|
+
var CURVE_KIND_XYK = 0;
|
|
1731
|
+
var CURVE_PARAMS_FORMAT_XYK_V0 = 0;
|
|
1732
|
+
var HF_BEFORE_SWAP2 = 1 << 0;
|
|
1733
|
+
var HF_AFTER_SWAP2 = 1 << 1;
|
|
1734
|
+
var HF_BEFORE_CREATE = 1 << 2;
|
|
1735
|
+
var HF_AFTER_CREATE = 1 << 3;
|
|
1736
|
+
var HF_BEFORE_MIGRATE = 1 << 4;
|
|
1737
|
+
var HF_AFTER_MIGRATE = 1 << 5;
|
|
1738
|
+
var HF_FORWARD_READONLY_SIGNERS2 = 1 << 6;
|
|
1739
|
+
var HOOK_NO_CHANGE2 = 65535;
|
|
1740
|
+
var INITIALIZER_INSTRUCTION_DISCRIMINATORS = {
|
|
1741
|
+
// SHA256("global:initialize_config")[0:8]
|
|
1742
|
+
initializeConfig: new Uint8Array([
|
|
1743
|
+
208,
|
|
1744
|
+
127,
|
|
1745
|
+
21,
|
|
1746
|
+
1,
|
|
1747
|
+
194,
|
|
1748
|
+
190,
|
|
1749
|
+
196,
|
|
1750
|
+
70
|
|
1751
|
+
]),
|
|
1752
|
+
// SHA256("global:set_migrator_allowlist")[0:8]
|
|
1753
|
+
setMigratorAllowlist: new Uint8Array([
|
|
1754
|
+
209,
|
|
1755
|
+
90,
|
|
1756
|
+
181,
|
|
1757
|
+
104,
|
|
1758
|
+
99,
|
|
1759
|
+
108,
|
|
1760
|
+
233,
|
|
1761
|
+
168
|
|
1762
|
+
]),
|
|
1763
|
+
// SHA256("global:set_hook_allowlist")[0:8]
|
|
1764
|
+
setHookAllowlist: new Uint8Array([
|
|
1765
|
+
232,
|
|
1766
|
+
28,
|
|
1767
|
+
40,
|
|
1768
|
+
143,
|
|
1769
|
+
121,
|
|
1770
|
+
182,
|
|
1771
|
+
77,
|
|
1772
|
+
103
|
|
1773
|
+
]),
|
|
1774
|
+
// SHA256("global:initialize_launch")[0:8]
|
|
1775
|
+
initializeLaunch: new Uint8Array([
|
|
1776
|
+
90,
|
|
1777
|
+
201,
|
|
1778
|
+
220,
|
|
1779
|
+
142,
|
|
1780
|
+
112,
|
|
1781
|
+
253,
|
|
1782
|
+
100,
|
|
1783
|
+
13
|
|
1784
|
+
]),
|
|
1785
|
+
// SHA256("global:curve_swap_exact_in")[0:8]
|
|
1786
|
+
curveSwapExactIn: new Uint8Array([
|
|
1787
|
+
196,
|
|
1788
|
+
247,
|
|
1789
|
+
195,
|
|
1790
|
+
126,
|
|
1791
|
+
227,
|
|
1792
|
+
27,
|
|
1793
|
+
166,
|
|
1794
|
+
93
|
|
1795
|
+
]),
|
|
1796
|
+
// SHA256("global:migrate_launch")[0:8]
|
|
1797
|
+
migrateLaunch: new Uint8Array([
|
|
1798
|
+
19,
|
|
1799
|
+
199,
|
|
1800
|
+
119,
|
|
1801
|
+
103,
|
|
1802
|
+
13,
|
|
1803
|
+
30,
|
|
1804
|
+
12,
|
|
1805
|
+
205
|
|
1806
|
+
]),
|
|
1807
|
+
// SHA256("global:preview_swap_exact_in")[0:8]
|
|
1808
|
+
previewSwapExactIn: new Uint8Array([
|
|
1809
|
+
50,
|
|
1810
|
+
130,
|
|
1811
|
+
31,
|
|
1812
|
+
69,
|
|
1813
|
+
147,
|
|
1814
|
+
58,
|
|
1815
|
+
222,
|
|
1816
|
+
178
|
|
1817
|
+
]),
|
|
1818
|
+
// SHA256("global:preview_migration")[0:8]
|
|
1819
|
+
previewMigration: new Uint8Array([
|
|
1820
|
+
216,
|
|
1821
|
+
180,
|
|
1822
|
+
209,
|
|
1823
|
+
112,
|
|
1824
|
+
62,
|
|
1825
|
+
16,
|
|
1826
|
+
15,
|
|
1827
|
+
63
|
|
1828
|
+
])
|
|
1829
|
+
};
|
|
1830
|
+
var INITIALIZER_ACCOUNT_DISCRIMINATORS = {
|
|
1831
|
+
// SHA256("account:InitConfig")[0:8]
|
|
1832
|
+
InitConfig: new Uint8Array([97, 166, 35, 7, 20, 2, 164, 126]),
|
|
1833
|
+
// SHA256("account:Launch")[0:8]
|
|
1834
|
+
Launch: new Uint8Array([144, 51, 51, 163, 206, 85, 213, 38]),
|
|
1835
|
+
// SHA256("account:LaunchFeeState")[0:8]
|
|
1836
|
+
LaunchFeeState: new Uint8Array([
|
|
1837
|
+
1,
|
|
1838
|
+
106,
|
|
1839
|
+
55,
|
|
1840
|
+
241,
|
|
1841
|
+
179,
|
|
1842
|
+
18,
|
|
1843
|
+
230,
|
|
1844
|
+
232
|
|
1845
|
+
])
|
|
1846
|
+
};
|
|
1847
|
+
|
|
1848
|
+
// src/solana/initializer/helpers.ts
|
|
1849
|
+
function computeRemainingAccountsHash(addresses) {
|
|
1850
|
+
const addressEncoder = kit.getAddressEncoder();
|
|
1851
|
+
const buf = new Uint8Array(4 + addresses.length * 32);
|
|
1852
|
+
new DataView(buf.buffer).setUint32(0, addresses.length, true);
|
|
1853
|
+
for (let i = 0; i < addresses.length; i++) {
|
|
1854
|
+
buf.set(addressEncoder.encode(addresses[i]), 4 + i * 32);
|
|
1855
|
+
}
|
|
1856
|
+
return sha3_js.keccak_256(buf);
|
|
1857
|
+
}
|
|
1858
|
+
function getCurveSwapFeeAmount(amountIn, swapFeeBps) {
|
|
1859
|
+
if (amountIn < 0n) {
|
|
1860
|
+
throw new Error("amountIn must be non-negative");
|
|
1861
|
+
}
|
|
1862
|
+
if (!Number.isInteger(swapFeeBps) || swapFeeBps < 0 || swapFeeBps > Number(chunkU6B52TBT_cjs.BPS_DENOM)) {
|
|
1863
|
+
throw new Error("swapFeeBps must be an integer from 0 to 10000");
|
|
1864
|
+
}
|
|
1865
|
+
return chunkXTL2GBZ4_cjs.ceilDiv(amountIn * BigInt(swapFeeBps), chunkU6B52TBT_cjs.BPS_DENOM);
|
|
1866
|
+
}
|
|
1867
|
+
function phaseLabel(phase) {
|
|
1868
|
+
switch (phase) {
|
|
1869
|
+
case PHASE_TRADING:
|
|
1870
|
+
return "TRADING";
|
|
1871
|
+
case PHASE_MIGRATED:
|
|
1872
|
+
return "MIGRATED";
|
|
1873
|
+
case PHASE_ABORTED:
|
|
1874
|
+
return "ABORTED";
|
|
1875
|
+
default:
|
|
1876
|
+
return String(phase);
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
// src/solana/cosignerHook/gate.ts
|
|
1668
1881
|
var MAX_U64 = (1n << 64n) - 1n;
|
|
1669
1882
|
function toBigInt(value) {
|
|
1670
1883
|
return typeof value === "bigint" ? value : BigInt(value);
|
|
@@ -1785,6 +1998,22 @@ function getCosignerGateStatus(hookPayload, clock = {}) {
|
|
|
1785
1998
|
function isCosignerGateEnforced(hookPayload, clock = {}) {
|
|
1786
1999
|
return getCosignerGateStatus(hookPayload, clock).gateEnforced;
|
|
1787
2000
|
}
|
|
2001
|
+
function getCosignerHookRemainingAccounts({
|
|
2002
|
+
namespace,
|
|
2003
|
+
cosigner
|
|
2004
|
+
}) {
|
|
2005
|
+
const unsignedHookRemainingAccounts = [
|
|
2006
|
+
namespace,
|
|
2007
|
+
cosigner.address
|
|
2008
|
+
];
|
|
2009
|
+
return {
|
|
2010
|
+
signedHookRemainingAccounts: [namespace, cosigner],
|
|
2011
|
+
unsignedHookRemainingAccounts,
|
|
2012
|
+
hookRemainingAccountsHash: computeRemainingAccountsHash(
|
|
2013
|
+
unsignedHookRemainingAccounts
|
|
2014
|
+
)
|
|
2015
|
+
};
|
|
2016
|
+
}
|
|
1788
2017
|
var textEncoder2 = new TextEncoder();
|
|
1789
2018
|
async function getCosignerHookConfigAddress(programId = COSIGNER_HOOK_PROGRAM_ID) {
|
|
1790
2019
|
return kit.getProgramDerivedAddress({
|
|
@@ -1835,6 +2064,7 @@ chunkQ7SFCCGT_cjs.__export(initializer_exports, {
|
|
|
1835
2064
|
createCurveSwapExactInInstruction: () => createCurveSwapExactInInstruction,
|
|
1836
2065
|
createInitializeConfigInstruction: () => createInitializeConfigInstruction,
|
|
1837
2066
|
createInitializeLaunchInstruction: () => createInitializeLaunchInstruction,
|
|
2067
|
+
createLaunchId: () => createLaunchId,
|
|
1838
2068
|
createMigrateLaunchInstruction: () => createMigrateLaunchInstruction,
|
|
1839
2069
|
createPreviewMigrationInstruction: () => createPreviewMigrationInstruction,
|
|
1840
2070
|
createPreviewSwapExactInInstruction: () => createPreviewSwapExactInInstruction,
|
|
@@ -1842,12 +2072,14 @@ chunkQ7SFCCGT_cjs.__export(initializer_exports, {
|
|
|
1842
2072
|
createSetMigratorAllowlistInstruction: () => createSetMigratorAllowlistInstruction,
|
|
1843
2073
|
decodePreviewMigrationResult: () => decodePreviewMigrationResult,
|
|
1844
2074
|
decodePreviewSwapExactInResult: () => decodePreviewSwapExactInResult,
|
|
2075
|
+
deriveCreateLaunchAddresses: () => deriveCreateLaunchAddresses,
|
|
1845
2076
|
encodeU64LE: () => encodeU64LE,
|
|
1846
2077
|
fetchAllLaunches: () => fetchAllLaunches,
|
|
1847
2078
|
fetchLaunch: () => fetchLaunch2,
|
|
1848
2079
|
fetchLaunchesByAuthority: () => fetchLaunchesByAuthority,
|
|
1849
2080
|
getClaimFeesInstructionAsync: () => getClaimFeesInstructionAsync,
|
|
1850
2081
|
getConfigAddress: () => getConfigAddress2,
|
|
2082
|
+
getCurveSwapFeeAmount: () => getCurveSwapFeeAmount,
|
|
1851
2083
|
getHarvestMigratedFeesInstructionAsync: () => getHarvestMigratedFeesInstructionAsync,
|
|
1852
2084
|
getInitConfigCodec: () => getInitConfigCodec,
|
|
1853
2085
|
getInitConfigDecoder: () => getInitConfigDecoder,
|
|
@@ -1874,185 +2106,11 @@ chunkQ7SFCCGT_cjs.__export(initializer_exports, {
|
|
|
1874
2106
|
getTokenMetadataAddress: () => getTokenMetadataAddress,
|
|
1875
2107
|
launchExists: () => launchExists,
|
|
1876
2108
|
launchIdFromU64: () => launchIdFromU64,
|
|
2109
|
+
launchTokenPrograms: () => launchTokenPrograms,
|
|
1877
2110
|
measureTransactionMessageSize: () => measureTransactionMessageSize,
|
|
1878
2111
|
measureTransactionMessageSizeWithLookupTable: () => measureTransactionMessageSizeWithLookupTable,
|
|
1879
2112
|
phaseLabel: () => phaseLabel
|
|
1880
2113
|
});
|
|
1881
|
-
var INITIALIZER_PROGRAM_ID = kit.address(
|
|
1882
|
-
"4h3Dqyo5qmteJoMxXt3tdtfXELDB6pdRTPU9mWruiKp1"
|
|
1883
|
-
);
|
|
1884
|
-
var BPF_LOADER_UPGRADEABLE_PROGRAM_ID = kit.address(
|
|
1885
|
-
"BPFLoaderUpgradeab1e11111111111111111111111"
|
|
1886
|
-
);
|
|
1887
|
-
var CPMM_HOOK_PROGRAM_ID = kit.address(
|
|
1888
|
-
"2vJ1c62knEwZbxp3XdHB4RSmCfz55pA6tRkCho63gW7u"
|
|
1889
|
-
);
|
|
1890
|
-
var PREDICTION_HOOK_PROGRAM_ID = kit.address(
|
|
1891
|
-
"7QcQDANJVC17Jgc6KjjeagSkm2zAphgHVPK5agJzyihB"
|
|
1892
|
-
);
|
|
1893
|
-
var SEED_CONFIG2 = "config";
|
|
1894
|
-
var SEED_LAUNCH = "launch";
|
|
1895
|
-
var SEED_LAUNCH_AUTHORITY = "launch_authority";
|
|
1896
|
-
var SEED_LAUNCH_FEE_STATE = "launch_fee_state";
|
|
1897
|
-
var EMPTY_REMAINING_ACCOUNTS_HASH = new Uint8Array([
|
|
1898
|
-
232,
|
|
1899
|
-
231,
|
|
1900
|
-
118,
|
|
1901
|
-
38,
|
|
1902
|
-
88,
|
|
1903
|
-
111,
|
|
1904
|
-
115,
|
|
1905
|
-
185,
|
|
1906
|
-
85,
|
|
1907
|
-
54,
|
|
1908
|
-
76,
|
|
1909
|
-
123,
|
|
1910
|
-
75,
|
|
1911
|
-
191,
|
|
1912
|
-
11,
|
|
1913
|
-
183,
|
|
1914
|
-
247,
|
|
1915
|
-
104,
|
|
1916
|
-
94,
|
|
1917
|
-
189,
|
|
1918
|
-
64,
|
|
1919
|
-
232,
|
|
1920
|
-
82,
|
|
1921
|
-
177,
|
|
1922
|
-
100,
|
|
1923
|
-
99,
|
|
1924
|
-
58,
|
|
1925
|
-
74,
|
|
1926
|
-
203,
|
|
1927
|
-
211,
|
|
1928
|
-
36,
|
|
1929
|
-
76
|
|
1930
|
-
]);
|
|
1931
|
-
var MAX_MIGRATOR_ALLOWLIST = 32;
|
|
1932
|
-
var MAX_HOOK_ALLOWLIST2 = 32;
|
|
1933
|
-
var MAX_PAYLOAD = 256;
|
|
1934
|
-
var PHASE_TRADING = 0;
|
|
1935
|
-
var PHASE_MIGRATED = 1;
|
|
1936
|
-
var PHASE_ABORTED = 2;
|
|
1937
|
-
var TRADE_DIRECTION_BUY = 0;
|
|
1938
|
-
var TRADE_DIRECTION_SELL = 1;
|
|
1939
|
-
var CURVE_KIND_XYK = 0;
|
|
1940
|
-
var CURVE_PARAMS_FORMAT_XYK_V0 = 0;
|
|
1941
|
-
var HF_BEFORE_SWAP2 = 1 << 0;
|
|
1942
|
-
var HF_AFTER_SWAP2 = 1 << 1;
|
|
1943
|
-
var HF_BEFORE_CREATE = 1 << 2;
|
|
1944
|
-
var HF_AFTER_CREATE = 1 << 3;
|
|
1945
|
-
var HF_BEFORE_MIGRATE = 1 << 4;
|
|
1946
|
-
var HF_AFTER_MIGRATE = 1 << 5;
|
|
1947
|
-
var HF_FORWARD_READONLY_SIGNERS2 = 1 << 6;
|
|
1948
|
-
var HOOK_NO_CHANGE2 = 65535;
|
|
1949
|
-
var INITIALIZER_INSTRUCTION_DISCRIMINATORS = {
|
|
1950
|
-
// SHA256("global:initialize_config")[0:8]
|
|
1951
|
-
initializeConfig: new Uint8Array([
|
|
1952
|
-
208,
|
|
1953
|
-
127,
|
|
1954
|
-
21,
|
|
1955
|
-
1,
|
|
1956
|
-
194,
|
|
1957
|
-
190,
|
|
1958
|
-
196,
|
|
1959
|
-
70
|
|
1960
|
-
]),
|
|
1961
|
-
// SHA256("global:set_migrator_allowlist")[0:8]
|
|
1962
|
-
setMigratorAllowlist: new Uint8Array([
|
|
1963
|
-
209,
|
|
1964
|
-
90,
|
|
1965
|
-
181,
|
|
1966
|
-
104,
|
|
1967
|
-
99,
|
|
1968
|
-
108,
|
|
1969
|
-
233,
|
|
1970
|
-
168
|
|
1971
|
-
]),
|
|
1972
|
-
// SHA256("global:set_hook_allowlist")[0:8]
|
|
1973
|
-
setHookAllowlist: new Uint8Array([
|
|
1974
|
-
232,
|
|
1975
|
-
28,
|
|
1976
|
-
40,
|
|
1977
|
-
143,
|
|
1978
|
-
121,
|
|
1979
|
-
182,
|
|
1980
|
-
77,
|
|
1981
|
-
103
|
|
1982
|
-
]),
|
|
1983
|
-
// SHA256("global:initialize_launch")[0:8]
|
|
1984
|
-
initializeLaunch: new Uint8Array([
|
|
1985
|
-
90,
|
|
1986
|
-
201,
|
|
1987
|
-
220,
|
|
1988
|
-
142,
|
|
1989
|
-
112,
|
|
1990
|
-
253,
|
|
1991
|
-
100,
|
|
1992
|
-
13
|
|
1993
|
-
]),
|
|
1994
|
-
// SHA256("global:curve_swap_exact_in")[0:8]
|
|
1995
|
-
curveSwapExactIn: new Uint8Array([
|
|
1996
|
-
196,
|
|
1997
|
-
247,
|
|
1998
|
-
195,
|
|
1999
|
-
126,
|
|
2000
|
-
227,
|
|
2001
|
-
27,
|
|
2002
|
-
166,
|
|
2003
|
-
93
|
|
2004
|
-
]),
|
|
2005
|
-
// SHA256("global:migrate_launch")[0:8]
|
|
2006
|
-
migrateLaunch: new Uint8Array([
|
|
2007
|
-
19,
|
|
2008
|
-
199,
|
|
2009
|
-
119,
|
|
2010
|
-
103,
|
|
2011
|
-
13,
|
|
2012
|
-
30,
|
|
2013
|
-
12,
|
|
2014
|
-
205
|
|
2015
|
-
]),
|
|
2016
|
-
// SHA256("global:preview_swap_exact_in")[0:8]
|
|
2017
|
-
previewSwapExactIn: new Uint8Array([
|
|
2018
|
-
50,
|
|
2019
|
-
130,
|
|
2020
|
-
31,
|
|
2021
|
-
69,
|
|
2022
|
-
147,
|
|
2023
|
-
58,
|
|
2024
|
-
222,
|
|
2025
|
-
178
|
|
2026
|
-
]),
|
|
2027
|
-
// SHA256("global:preview_migration")[0:8]
|
|
2028
|
-
previewMigration: new Uint8Array([
|
|
2029
|
-
216,
|
|
2030
|
-
180,
|
|
2031
|
-
209,
|
|
2032
|
-
112,
|
|
2033
|
-
62,
|
|
2034
|
-
16,
|
|
2035
|
-
15,
|
|
2036
|
-
63
|
|
2037
|
-
])
|
|
2038
|
-
};
|
|
2039
|
-
var INITIALIZER_ACCOUNT_DISCRIMINATORS = {
|
|
2040
|
-
// SHA256("account:InitConfig")[0:8]
|
|
2041
|
-
InitConfig: new Uint8Array([97, 166, 35, 7, 20, 2, 164, 126]),
|
|
2042
|
-
// SHA256("account:Launch")[0:8]
|
|
2043
|
-
Launch: new Uint8Array([144, 51, 51, 163, 206, 85, 213, 38]),
|
|
2044
|
-
// SHA256("account:LaunchFeeState")[0:8]
|
|
2045
|
-
LaunchFeeState: new Uint8Array([
|
|
2046
|
-
1,
|
|
2047
|
-
106,
|
|
2048
|
-
55,
|
|
2049
|
-
241,
|
|
2050
|
-
179,
|
|
2051
|
-
18,
|
|
2052
|
-
230,
|
|
2053
|
-
232
|
|
2054
|
-
])
|
|
2055
|
-
};
|
|
2056
2114
|
var INIT_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
2057
2115
|
97,
|
|
2058
2116
|
166,
|
|
@@ -3099,7 +3157,7 @@ function createInitializeConfigInstruction(accounts, args, programId = INITIALIZ
|
|
|
3099
3157
|
admin,
|
|
3100
3158
|
config,
|
|
3101
3159
|
programData,
|
|
3102
|
-
systemProgram =
|
|
3160
|
+
systemProgram = chunkU6B52TBT_cjs.SYSTEM_PROGRAM_ADDRESS
|
|
3103
3161
|
} = accounts;
|
|
3104
3162
|
const keys = [
|
|
3105
3163
|
createSignerAccountMeta(admin, kit.AccountRole.WRITABLE_SIGNER),
|
|
@@ -3152,27 +3210,6 @@ function createSetHookAllowlistInstruction(accounts, allowlist, programId = INIT
|
|
|
3152
3210
|
);
|
|
3153
3211
|
return { programAddress: programId, accounts: keys, data };
|
|
3154
3212
|
}
|
|
3155
|
-
function computeRemainingAccountsHash(addresses) {
|
|
3156
|
-
const addressEncoder = kit.getAddressEncoder();
|
|
3157
|
-
const buf = new Uint8Array(4 + addresses.length * 32);
|
|
3158
|
-
new DataView(buf.buffer).setUint32(0, addresses.length, true);
|
|
3159
|
-
for (let i = 0; i < addresses.length; i++) {
|
|
3160
|
-
buf.set(addressEncoder.encode(addresses[i]), 4 + i * 32);
|
|
3161
|
-
}
|
|
3162
|
-
return sha3_js.keccak_256(buf);
|
|
3163
|
-
}
|
|
3164
|
-
function phaseLabel(phase) {
|
|
3165
|
-
switch (phase) {
|
|
3166
|
-
case PHASE_TRADING:
|
|
3167
|
-
return "TRADING";
|
|
3168
|
-
case PHASE_MIGRATED:
|
|
3169
|
-
return "MIGRATED";
|
|
3170
|
-
case PHASE_ABORTED:
|
|
3171
|
-
return "ABORTED";
|
|
3172
|
-
default:
|
|
3173
|
-
return String(phase);
|
|
3174
|
-
}
|
|
3175
|
-
}
|
|
3176
3213
|
var CPMM_MIGRATOR_PROGRAM_ID = kit.address(
|
|
3177
3214
|
"7WMUTNC41eMCo6eGH5Sy2xbgE3AycvLbFPo95AU9CSUd"
|
|
3178
3215
|
);
|
|
@@ -3270,13 +3307,13 @@ function decodeClaimReceipt(encodedAccount) {
|
|
|
3270
3307
|
getClaimReceiptDecoder()
|
|
3271
3308
|
);
|
|
3272
3309
|
}
|
|
3273
|
-
async function fetchClaimReceipt(rpc,
|
|
3274
|
-
const maybeAccount = await fetchMaybeClaimReceipt(rpc,
|
|
3310
|
+
async function fetchClaimReceipt(rpc, address4, config) {
|
|
3311
|
+
const maybeAccount = await fetchMaybeClaimReceipt(rpc, address4, config);
|
|
3275
3312
|
kit.assertAccountExists(maybeAccount);
|
|
3276
3313
|
return maybeAccount;
|
|
3277
3314
|
}
|
|
3278
|
-
async function fetchMaybeClaimReceipt(rpc,
|
|
3279
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3315
|
+
async function fetchMaybeClaimReceipt(rpc, address4, config) {
|
|
3316
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address4, config);
|
|
3280
3317
|
return decodeClaimReceipt(maybeAccount);
|
|
3281
3318
|
}
|
|
3282
3319
|
async function fetchAllClaimReceipt(rpc, addresses, config) {
|
|
@@ -3340,13 +3377,13 @@ function decodeEntry(encodedAccount) {
|
|
|
3340
3377
|
getEntryDecoder()
|
|
3341
3378
|
);
|
|
3342
3379
|
}
|
|
3343
|
-
async function fetchEntry(rpc,
|
|
3344
|
-
const maybeAccount = await fetchMaybeEntry(rpc,
|
|
3380
|
+
async function fetchEntry(rpc, address4, config) {
|
|
3381
|
+
const maybeAccount = await fetchMaybeEntry(rpc, address4, config);
|
|
3345
3382
|
kit.assertAccountExists(maybeAccount);
|
|
3346
3383
|
return maybeAccount;
|
|
3347
3384
|
}
|
|
3348
|
-
async function fetchMaybeEntry(rpc,
|
|
3349
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3385
|
+
async function fetchMaybeEntry(rpc, address4, config) {
|
|
3386
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address4, config);
|
|
3350
3387
|
return decodeEntry(maybeAccount);
|
|
3351
3388
|
}
|
|
3352
3389
|
async function fetchAllEntry(rpc, addresses, config) {
|
|
@@ -3408,13 +3445,13 @@ function decodeEntryByMint(encodedAccount) {
|
|
|
3408
3445
|
getEntryByMintDecoder()
|
|
3409
3446
|
);
|
|
3410
3447
|
}
|
|
3411
|
-
async function fetchEntryByMint(rpc,
|
|
3412
|
-
const maybeAccount = await fetchMaybeEntryByMint(rpc,
|
|
3448
|
+
async function fetchEntryByMint(rpc, address4, config) {
|
|
3449
|
+
const maybeAccount = await fetchMaybeEntryByMint(rpc, address4, config);
|
|
3413
3450
|
kit.assertAccountExists(maybeAccount);
|
|
3414
3451
|
return maybeAccount;
|
|
3415
3452
|
}
|
|
3416
|
-
async function fetchMaybeEntryByMint(rpc,
|
|
3417
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3453
|
+
async function fetchMaybeEntryByMint(rpc, address4, config) {
|
|
3454
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address4, config);
|
|
3418
3455
|
return decodeEntryByMint(maybeAccount);
|
|
3419
3456
|
}
|
|
3420
3457
|
async function fetchAllEntryByMint(rpc, addresses, config) {
|
|
@@ -3486,13 +3523,13 @@ function decodeInitConfig(encodedAccount) {
|
|
|
3486
3523
|
getInitConfigDecoder2()
|
|
3487
3524
|
);
|
|
3488
3525
|
}
|
|
3489
|
-
async function fetchInitConfig(rpc,
|
|
3490
|
-
const maybeAccount = await fetchMaybeInitConfig(rpc,
|
|
3526
|
+
async function fetchInitConfig(rpc, address4, config) {
|
|
3527
|
+
const maybeAccount = await fetchMaybeInitConfig(rpc, address4, config);
|
|
3491
3528
|
kit.assertAccountExists(maybeAccount);
|
|
3492
3529
|
return maybeAccount;
|
|
3493
3530
|
}
|
|
3494
|
-
async function fetchMaybeInitConfig(rpc,
|
|
3495
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3531
|
+
async function fetchMaybeInitConfig(rpc, address4, config) {
|
|
3532
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address4, config);
|
|
3496
3533
|
return decodeInitConfig(maybeAccount);
|
|
3497
3534
|
}
|
|
3498
3535
|
async function fetchAllInitConfig(rpc, addresses, config) {
|
|
@@ -3792,13 +3829,13 @@ function decodeLaunch(encodedAccount) {
|
|
|
3792
3829
|
getLaunchDecoder2()
|
|
3793
3830
|
);
|
|
3794
3831
|
}
|
|
3795
|
-
async function fetchLaunch(rpc,
|
|
3796
|
-
const maybeAccount = await fetchMaybeLaunch(rpc,
|
|
3832
|
+
async function fetchLaunch(rpc, address4, config) {
|
|
3833
|
+
const maybeAccount = await fetchMaybeLaunch(rpc, address4, config);
|
|
3797
3834
|
kit.assertAccountExists(maybeAccount);
|
|
3798
3835
|
return maybeAccount;
|
|
3799
3836
|
}
|
|
3800
|
-
async function fetchMaybeLaunch(rpc,
|
|
3801
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3837
|
+
async function fetchMaybeLaunch(rpc, address4, config) {
|
|
3838
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address4, config);
|
|
3802
3839
|
return decodeLaunch(maybeAccount);
|
|
3803
3840
|
}
|
|
3804
3841
|
async function fetchAllLaunch(rpc, addresses, config) {
|
|
@@ -3872,13 +3909,13 @@ function decodeMarket(encodedAccount) {
|
|
|
3872
3909
|
getMarketDecoder()
|
|
3873
3910
|
);
|
|
3874
3911
|
}
|
|
3875
|
-
async function fetchMarket(rpc,
|
|
3876
|
-
const maybeAccount = await fetchMaybeMarket(rpc,
|
|
3912
|
+
async function fetchMarket(rpc, address4, config) {
|
|
3913
|
+
const maybeAccount = await fetchMaybeMarket(rpc, address4, config);
|
|
3877
3914
|
kit.assertAccountExists(maybeAccount);
|
|
3878
3915
|
return maybeAccount;
|
|
3879
3916
|
}
|
|
3880
|
-
async function fetchMaybeMarket(rpc,
|
|
3881
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3917
|
+
async function fetchMaybeMarket(rpc, address4, config) {
|
|
3918
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address4, config);
|
|
3882
3919
|
return decodeMarket(maybeAccount);
|
|
3883
3920
|
}
|
|
3884
3921
|
async function fetchAllMarket(rpc, addresses, config) {
|
|
@@ -3944,13 +3981,13 @@ function decodeOracleState2(encodedAccount) {
|
|
|
3944
3981
|
getOracleStateDecoder()
|
|
3945
3982
|
);
|
|
3946
3983
|
}
|
|
3947
|
-
async function fetchOracleState(rpc,
|
|
3948
|
-
const maybeAccount = await fetchMaybeOracleState(rpc,
|
|
3984
|
+
async function fetchOracleState(rpc, address4, config) {
|
|
3985
|
+
const maybeAccount = await fetchMaybeOracleState(rpc, address4, config);
|
|
3949
3986
|
kit.assertAccountExists(maybeAccount);
|
|
3950
3987
|
return maybeAccount;
|
|
3951
3988
|
}
|
|
3952
|
-
async function fetchMaybeOracleState(rpc,
|
|
3953
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3989
|
+
async function fetchMaybeOracleState(rpc, address4, config) {
|
|
3990
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address4, config);
|
|
3954
3991
|
return decodeOracleState2(maybeAccount);
|
|
3955
3992
|
}
|
|
3956
3993
|
async function fetchAllOracleState(rpc, addresses, config) {
|
|
@@ -5246,10 +5283,10 @@ function createAccountMeta(value, role) {
|
|
|
5246
5283
|
async function getTokenMetadataAddress(mint) {
|
|
5247
5284
|
const encoder = kit.getAddressEncoder();
|
|
5248
5285
|
const [metadataAddress] = await kit.getProgramDerivedAddress({
|
|
5249
|
-
programAddress:
|
|
5286
|
+
programAddress: chunkU6B52TBT_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
5250
5287
|
seeds: [
|
|
5251
5288
|
new TextEncoder().encode("metadata"),
|
|
5252
|
-
encoder.encode(
|
|
5289
|
+
encoder.encode(chunkU6B52TBT_cjs.TOKEN_METADATA_PROGRAM_ID),
|
|
5253
5290
|
encoder.encode(mint)
|
|
5254
5291
|
]
|
|
5255
5292
|
});
|
|
@@ -5280,17 +5317,18 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5280
5317
|
authority,
|
|
5281
5318
|
hookProgram,
|
|
5282
5319
|
migratorProgram,
|
|
5283
|
-
baseTokenProgram =
|
|
5284
|
-
quoteTokenProgram =
|
|
5285
|
-
systemProgram =
|
|
5320
|
+
baseTokenProgram = chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5321
|
+
quoteTokenProgram = chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5322
|
+
systemProgram = chunkU6B52TBT_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
5286
5323
|
rent,
|
|
5287
5324
|
metadataAccount,
|
|
5288
|
-
metadataProgram =
|
|
5325
|
+
metadataProgram = chunkU6B52TBT_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
5289
5326
|
hookCreateRemainingAccounts = []
|
|
5290
5327
|
} = accounts;
|
|
5291
5328
|
const withMetadata = Boolean(
|
|
5292
5329
|
args.metadataName && args.metadataName.length > 0
|
|
5293
5330
|
);
|
|
5331
|
+
const withToken2022Metadata = withMetadata && baseTokenProgram === chunkU6B52TBT_cjs.TOKEN_2022_PROGRAM_ADDRESS;
|
|
5294
5332
|
if (withMetadata && !metadataAccount) {
|
|
5295
5333
|
throw new Error(
|
|
5296
5334
|
"metadataName is set but metadataAccount was not provided. Derive it with await initializer.getTokenMetadataAddress(baseMintAddress)."
|
|
@@ -5350,6 +5388,12 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5350
5388
|
const data = new Uint8Array(
|
|
5351
5389
|
getInitializeLaunchInstructionDataEncoder().encode(encoderArgs)
|
|
5352
5390
|
);
|
|
5391
|
+
if (withToken2022Metadata) {
|
|
5392
|
+
keys.push({
|
|
5393
|
+
address: chunkU6B52TBT_cjs.SYSVAR_INSTRUCTIONS_ADDRESS,
|
|
5394
|
+
role: kit.AccountRole.READONLY
|
|
5395
|
+
});
|
|
5396
|
+
}
|
|
5353
5397
|
keys.push(
|
|
5354
5398
|
...hookCreateRemainingAccounts.map(
|
|
5355
5399
|
(account) => createAccountMeta(
|
|
@@ -5429,10 +5473,10 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
5429
5473
|
baseMint,
|
|
5430
5474
|
quoteMint,
|
|
5431
5475
|
user,
|
|
5432
|
-
hookProgram =
|
|
5476
|
+
hookProgram = chunkU6B52TBT_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
5433
5477
|
launchFeeState,
|
|
5434
|
-
baseTokenProgram =
|
|
5435
|
-
quoteTokenProgram =
|
|
5478
|
+
baseTokenProgram = chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5479
|
+
quoteTokenProgram = chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5436
5480
|
remainingAccounts = []
|
|
5437
5481
|
} = accounts;
|
|
5438
5482
|
const keys = [
|
|
@@ -5480,9 +5524,9 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
5480
5524
|
launchFeeState,
|
|
5481
5525
|
migratorProgram,
|
|
5482
5526
|
payer,
|
|
5483
|
-
baseTokenProgram =
|
|
5484
|
-
quoteTokenProgram =
|
|
5485
|
-
systemProgram =
|
|
5527
|
+
baseTokenProgram = chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5528
|
+
quoteTokenProgram = chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5529
|
+
systemProgram = chunkU6B52TBT_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
5486
5530
|
rent
|
|
5487
5531
|
} = accounts;
|
|
5488
5532
|
const keys = [
|
|
@@ -5501,7 +5545,7 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
5501
5545
|
{ address: systemProgram, role: kit.AccountRole.READONLY },
|
|
5502
5546
|
{ address: rent, role: kit.AccountRole.READONLY }
|
|
5503
5547
|
];
|
|
5504
|
-
const data =
|
|
5548
|
+
const data = chunkXTL2GBZ4_cjs.encodeInstructionData(
|
|
5505
5549
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS.migrateLaunch
|
|
5506
5550
|
);
|
|
5507
5551
|
return { programAddress: programId, accounts: keys, data };
|
|
@@ -5567,7 +5611,7 @@ function createPreviewMigrationInstruction(accounts, programId = INITIALIZER_PRO
|
|
|
5567
5611
|
{ address: baseVault, role: kit.AccountRole.READONLY },
|
|
5568
5612
|
{ address: quoteVault, role: kit.AccountRole.READONLY }
|
|
5569
5613
|
];
|
|
5570
|
-
const data =
|
|
5614
|
+
const data = chunkXTL2GBZ4_cjs.encodeInstructionData(
|
|
5571
5615
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS.previewMigration
|
|
5572
5616
|
);
|
|
5573
5617
|
return { programAddress: programId, accounts: keys, data };
|
|
@@ -5575,254 +5619,47 @@ function createPreviewMigrationInstruction(accounts, programId = INITIALIZER_PRO
|
|
|
5575
5619
|
function decodePreviewMigrationResult(data) {
|
|
5576
5620
|
return previewMigrationResultCodec.decode(data);
|
|
5577
5621
|
}
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5622
|
+
|
|
5623
|
+
// src/solana/migrators/cpmmMigrator/index.ts
|
|
5624
|
+
var cpmmMigrator_exports = {};
|
|
5625
|
+
chunkQ7SFCCGT_cjs.__export(cpmmMigrator_exports, {
|
|
5626
|
+
CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS: () => CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS,
|
|
5627
|
+
CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS: () => CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS,
|
|
5628
|
+
CPMM_MIGRATOR_PROGRAM_ID: () => CPMM_MIGRATOR_PROGRAM_ID,
|
|
5629
|
+
MAX_RECIPIENTS: () => MAX_RECIPIENTS,
|
|
5630
|
+
SEED_MIGRATION_AUTHORITY: () => SEED_MIGRATION_AUTHORITY,
|
|
5631
|
+
SEED_STATE: () => SEED_STATE,
|
|
5632
|
+
buildCpmmMigrationRemainingAccounts: () => buildCpmmMigrationRemainingAccounts,
|
|
5633
|
+
buildCpmmMigrationRemainingAccountsHash: () => buildCpmmMigrationRemainingAccountsHash,
|
|
5634
|
+
encodeMigratePayload: () => encodeMigratePayload,
|
|
5635
|
+
encodeRegisterLaunchPayload: () => encodeRegisterLaunchPayload,
|
|
5636
|
+
fetchCpmmMigratorState: () => fetchCpmmMigratorState,
|
|
5637
|
+
getCpmmMigrationAuthorityAddress: () => getCpmmMigrationAuthorityAddress,
|
|
5638
|
+
getCpmmMigratorStateAddress: () => getCpmmMigratorStateAddress,
|
|
5639
|
+
getCpmmMigratorStateCodec: () => getCpmmMigratorStateCodec,
|
|
5640
|
+
getCpmmMigratorStateDecoder: () => getCpmmMigratorStateDecoder,
|
|
5641
|
+
getCpmmMigratorStateEncoder: () => getCpmmMigratorStateEncoder,
|
|
5642
|
+
getMigrateArgsCodec: () => getMigrateArgsCodec,
|
|
5643
|
+
getMigrateArgsDecoder: () => getMigrateArgsDecoder,
|
|
5644
|
+
getMigrateArgsEncoder: () => getMigrateArgsEncoder,
|
|
5645
|
+
getRecipientCodec: () => getRecipientCodec,
|
|
5646
|
+
getRecipientDecoder: () => getRecipientDecoder,
|
|
5647
|
+
getRecipientEncoder: () => getRecipientEncoder,
|
|
5648
|
+
getRegisterLaunchArgsCodec: () => getRegisterLaunchArgsCodec,
|
|
5649
|
+
getRegisterLaunchArgsDecoder: () => getRegisterLaunchArgsDecoder,
|
|
5650
|
+
getRegisterLaunchArgsEncoder: () => getRegisterLaunchArgsEncoder
|
|
5651
|
+
});
|
|
5652
|
+
function getMigrateArgsEncoder() {
|
|
5653
|
+
return kit.getStructEncoder([
|
|
5654
|
+
["baseForDistribution", kit.getU64Encoder()],
|
|
5655
|
+
["baseForLiquidity", kit.getU64Encoder()]
|
|
5656
|
+
]);
|
|
5594
5657
|
}
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
addressesPerExtendInstruction = DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND
|
|
5601
|
-
}) {
|
|
5602
|
-
if (addressesPerExtendInstruction <= 0) {
|
|
5603
|
-
throw new Error("addressesPerExtendInstruction must be greater than zero");
|
|
5604
|
-
}
|
|
5605
|
-
const dedupedAddresses = [...new Set(addresses)];
|
|
5606
|
-
const lookupTablePda = await addressLookupTable.findAddressLookupTablePda({
|
|
5607
|
-
authority: authority.address,
|
|
5608
|
-
recentSlot
|
|
5609
|
-
});
|
|
5610
|
-
const [lookupTableAddress] = lookupTablePda;
|
|
5611
|
-
const createInstruction = addressLookupTable.getCreateLookupTableInstruction({
|
|
5612
|
-
address: lookupTablePda,
|
|
5613
|
-
authority: authority.address,
|
|
5614
|
-
payer,
|
|
5615
|
-
recentSlot
|
|
5616
|
-
});
|
|
5617
|
-
const extendInstructions = [];
|
|
5618
|
-
for (let start = 0; start < dedupedAddresses.length; start += addressesPerExtendInstruction) {
|
|
5619
|
-
extendInstructions.push(
|
|
5620
|
-
addressLookupTable.getExtendLookupTableInstruction({
|
|
5621
|
-
address: lookupTableAddress,
|
|
5622
|
-
authority,
|
|
5623
|
-
payer,
|
|
5624
|
-
addresses: dedupedAddresses.slice(
|
|
5625
|
-
start,
|
|
5626
|
-
start + addressesPerExtendInstruction
|
|
5627
|
-
)
|
|
5628
|
-
})
|
|
5629
|
-
);
|
|
5630
|
-
}
|
|
5631
|
-
return {
|
|
5632
|
-
lookupTableAddress,
|
|
5633
|
-
createInstruction,
|
|
5634
|
-
extendInstructions,
|
|
5635
|
-
addresses: dedupedAddresses
|
|
5636
|
-
};
|
|
5637
|
-
}
|
|
5638
|
-
function compressTransactionMessageWithLookupTable(transactionMessage, {
|
|
5639
|
-
lookupTableAddress,
|
|
5640
|
-
addresses
|
|
5641
|
-
}) {
|
|
5642
|
-
return kit.compressTransactionMessageUsingAddressLookupTables(
|
|
5643
|
-
transactionMessage,
|
|
5644
|
-
{
|
|
5645
|
-
[lookupTableAddress]: [...addresses]
|
|
5646
|
-
}
|
|
5647
|
-
);
|
|
5648
|
-
}
|
|
5649
|
-
var SOLANA_TRANSACTION_SIZE_LIMIT = 1232;
|
|
5650
|
-
function measureTransactionMessageSize(transactionMessage) {
|
|
5651
|
-
const size = kit.getTransactionMessageSize(transactionMessage);
|
|
5652
|
-
const overBy = Math.max(0, size - SOLANA_TRANSACTION_SIZE_LIMIT);
|
|
5653
|
-
return {
|
|
5654
|
-
size,
|
|
5655
|
-
limit: SOLANA_TRANSACTION_SIZE_LIMIT,
|
|
5656
|
-
overBy,
|
|
5657
|
-
fits: overBy === 0
|
|
5658
|
-
};
|
|
5659
|
-
}
|
|
5660
|
-
function measureTransactionMessageSizeWithLookupTable(transactionMessage, lookupTable) {
|
|
5661
|
-
return measureTransactionMessageSize(
|
|
5662
|
-
compressTransactionMessageWithLookupTable(transactionMessage, lookupTable)
|
|
5663
|
-
);
|
|
5664
|
-
}
|
|
5665
|
-
function assertTransactionMessageFits(transactionMessage, { label = "Transaction", metadataBytes } = {}) {
|
|
5666
|
-
const report = measureTransactionMessageSize(transactionMessage);
|
|
5667
|
-
if (report.fits) {
|
|
5668
|
-
return report;
|
|
5669
|
-
}
|
|
5670
|
-
const metadataHint = metadataBytes && metadataBytes > 0 ? ` Metadata contributes ${metadataBytes} instruction-data bytes; address lookup tables do not compress metadata strings.` : "";
|
|
5671
|
-
throw new Error(
|
|
5672
|
-
`${label} is ${report.size} bytes, exceeding Solana's ${report.limit}-byte transaction limit by ${report.overBy} bytes.${metadataHint}`
|
|
5673
|
-
);
|
|
5674
|
-
}
|
|
5675
|
-
function assertTransactionMessageFitsWithLookupTable(transactionMessage, lookupTable, options = {}) {
|
|
5676
|
-
const compressedMessage = compressTransactionMessageWithLookupTable(
|
|
5677
|
-
transactionMessage,
|
|
5678
|
-
lookupTable
|
|
5679
|
-
);
|
|
5680
|
-
return assertTransactionMessageFits(compressedMessage, options);
|
|
5681
|
-
}
|
|
5682
|
-
var addressCodec5 = kit.getAddressCodec();
|
|
5683
|
-
function bytesToBase64(bytes) {
|
|
5684
|
-
let binary = "";
|
|
5685
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
5686
|
-
binary += String.fromCharCode(bytes[i]);
|
|
5687
|
-
}
|
|
5688
|
-
return btoa(binary);
|
|
5689
|
-
}
|
|
5690
|
-
function base64ToBytes2(base64) {
|
|
5691
|
-
const binary = atob(base64);
|
|
5692
|
-
const bytes = new Uint8Array(binary.length);
|
|
5693
|
-
for (let i = 0; i < binary.length; i++) {
|
|
5694
|
-
bytes[i] = binary.charCodeAt(i);
|
|
5695
|
-
}
|
|
5696
|
-
return bytes;
|
|
5697
|
-
}
|
|
5698
|
-
async function fetchLaunch2(rpc, address3, config) {
|
|
5699
|
-
const response = await rpc.getAccountInfo(address3, {
|
|
5700
|
-
encoding: "base64",
|
|
5701
|
-
commitment: config?.commitment
|
|
5702
|
-
}).send();
|
|
5703
|
-
if (!response.value) {
|
|
5704
|
-
return null;
|
|
5705
|
-
}
|
|
5706
|
-
return getLaunchDecoder().decode(base64ToBytes2(response.value.data[0]));
|
|
5707
|
-
}
|
|
5708
|
-
async function fetchAllLaunches(rpc, config) {
|
|
5709
|
-
const programId = config?.programId ?? INITIALIZER_PROGRAM_ID;
|
|
5710
|
-
const discriminatorFilter = {
|
|
5711
|
-
memcmp: {
|
|
5712
|
-
offset: 0n,
|
|
5713
|
-
bytes: bytesToBase64(
|
|
5714
|
-
INITIALIZER_ACCOUNT_DISCRIMINATORS.Launch
|
|
5715
|
-
),
|
|
5716
|
-
encoding: "base64"
|
|
5717
|
-
}
|
|
5718
|
-
};
|
|
5719
|
-
const response = await rpc.getProgramAccounts(programId, {
|
|
5720
|
-
encoding: "base64",
|
|
5721
|
-
commitment: config?.commitment,
|
|
5722
|
-
filters: [discriminatorFilter]
|
|
5723
|
-
}).send();
|
|
5724
|
-
const accounts = Array.isArray(response) ? response : response.value;
|
|
5725
|
-
const launches = [];
|
|
5726
|
-
const decoder = getLaunchDecoder();
|
|
5727
|
-
for (const account of accounts) {
|
|
5728
|
-
try {
|
|
5729
|
-
const launch = decoder.decode(base64ToBytes2(account.account.data[0]));
|
|
5730
|
-
launches.push({ address: account.pubkey, account: launch });
|
|
5731
|
-
} catch {
|
|
5732
|
-
console.warn(`Failed to decode launch account: ${account.pubkey}`);
|
|
5733
|
-
}
|
|
5734
|
-
}
|
|
5735
|
-
return launches;
|
|
5736
|
-
}
|
|
5737
|
-
async function fetchLaunchesByAuthority(rpc, authority, config) {
|
|
5738
|
-
const programId = config?.programId ?? INITIALIZER_PROGRAM_ID;
|
|
5739
|
-
const discriminatorFilter = {
|
|
5740
|
-
memcmp: {
|
|
5741
|
-
offset: 0n,
|
|
5742
|
-
bytes: bytesToBase64(
|
|
5743
|
-
INITIALIZER_ACCOUNT_DISCRIMINATORS.Launch
|
|
5744
|
-
),
|
|
5745
|
-
encoding: "base64"
|
|
5746
|
-
}
|
|
5747
|
-
};
|
|
5748
|
-
const authorityFilter = {
|
|
5749
|
-
memcmp: {
|
|
5750
|
-
offset: 8n,
|
|
5751
|
-
bytes: bytesToBase64(
|
|
5752
|
-
addressCodec5.encode(authority)
|
|
5753
|
-
),
|
|
5754
|
-
encoding: "base64"
|
|
5755
|
-
}
|
|
5756
|
-
};
|
|
5757
|
-
const response = await rpc.getProgramAccounts(programId, {
|
|
5758
|
-
encoding: "base64",
|
|
5759
|
-
commitment: config?.commitment,
|
|
5760
|
-
filters: [discriminatorFilter, authorityFilter]
|
|
5761
|
-
}).send();
|
|
5762
|
-
const accounts = Array.isArray(response) ? response : response.value;
|
|
5763
|
-
const launches = [];
|
|
5764
|
-
const decoder = getLaunchDecoder();
|
|
5765
|
-
for (const account of accounts) {
|
|
5766
|
-
try {
|
|
5767
|
-
const launch = decoder.decode(base64ToBytes2(account.account.data[0]));
|
|
5768
|
-
launches.push({ address: account.pubkey, account: launch });
|
|
5769
|
-
} catch {
|
|
5770
|
-
console.warn(`Failed to decode launch account: ${account.pubkey}`);
|
|
5771
|
-
}
|
|
5772
|
-
}
|
|
5773
|
-
return launches;
|
|
5774
|
-
}
|
|
5775
|
-
async function launchExists(rpc, namespace, launchId, config) {
|
|
5776
|
-
const programId = config?.programId ?? INITIALIZER_PROGRAM_ID;
|
|
5777
|
-
const [launchAddress] = await getLaunchAddress(
|
|
5778
|
-
namespace,
|
|
5779
|
-
launchId,
|
|
5780
|
-
programId
|
|
5781
|
-
);
|
|
5782
|
-
const launch = await fetchLaunch2(rpc, launchAddress, config);
|
|
5783
|
-
return launch !== null;
|
|
5784
|
-
}
|
|
5785
|
-
|
|
5786
|
-
// src/solana/migrators/cpmmMigrator/index.ts
|
|
5787
|
-
var cpmmMigrator_exports = {};
|
|
5788
|
-
chunkQ7SFCCGT_cjs.__export(cpmmMigrator_exports, {
|
|
5789
|
-
CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS: () => CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS,
|
|
5790
|
-
CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS: () => CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS,
|
|
5791
|
-
CPMM_MIGRATOR_PROGRAM_ID: () => CPMM_MIGRATOR_PROGRAM_ID,
|
|
5792
|
-
MAX_RECIPIENTS: () => MAX_RECIPIENTS,
|
|
5793
|
-
SEED_MIGRATION_AUTHORITY: () => SEED_MIGRATION_AUTHORITY,
|
|
5794
|
-
SEED_STATE: () => SEED_STATE,
|
|
5795
|
-
buildCpmmMigrationRemainingAccounts: () => buildCpmmMigrationRemainingAccounts,
|
|
5796
|
-
buildCpmmMigrationRemainingAccountsHash: () => buildCpmmMigrationRemainingAccountsHash,
|
|
5797
|
-
encodeMigratePayload: () => encodeMigratePayload,
|
|
5798
|
-
encodeRegisterLaunchPayload: () => encodeRegisterLaunchPayload,
|
|
5799
|
-
fetchCpmmMigratorState: () => fetchCpmmMigratorState,
|
|
5800
|
-
getCpmmMigrationAuthorityAddress: () => getCpmmMigrationAuthorityAddress,
|
|
5801
|
-
getCpmmMigratorStateAddress: () => getCpmmMigratorStateAddress,
|
|
5802
|
-
getCpmmMigratorStateCodec: () => getCpmmMigratorStateCodec,
|
|
5803
|
-
getCpmmMigratorStateDecoder: () => getCpmmMigratorStateDecoder,
|
|
5804
|
-
getCpmmMigratorStateEncoder: () => getCpmmMigratorStateEncoder,
|
|
5805
|
-
getMigrateArgsCodec: () => getMigrateArgsCodec,
|
|
5806
|
-
getMigrateArgsDecoder: () => getMigrateArgsDecoder,
|
|
5807
|
-
getMigrateArgsEncoder: () => getMigrateArgsEncoder,
|
|
5808
|
-
getRecipientCodec: () => getRecipientCodec,
|
|
5809
|
-
getRecipientDecoder: () => getRecipientDecoder,
|
|
5810
|
-
getRecipientEncoder: () => getRecipientEncoder,
|
|
5811
|
-
getRegisterLaunchArgsCodec: () => getRegisterLaunchArgsCodec,
|
|
5812
|
-
getRegisterLaunchArgsDecoder: () => getRegisterLaunchArgsDecoder,
|
|
5813
|
-
getRegisterLaunchArgsEncoder: () => getRegisterLaunchArgsEncoder
|
|
5814
|
-
});
|
|
5815
|
-
function getMigrateArgsEncoder() {
|
|
5816
|
-
return kit.getStructEncoder([
|
|
5817
|
-
["baseForDistribution", kit.getU64Encoder()],
|
|
5818
|
-
["baseForLiquidity", kit.getU64Encoder()]
|
|
5819
|
-
]);
|
|
5820
|
-
}
|
|
5821
|
-
function getMigrateArgsDecoder() {
|
|
5822
|
-
return kit.getStructDecoder([
|
|
5823
|
-
["baseForDistribution", kit.getU64Decoder()],
|
|
5824
|
-
["baseForLiquidity", kit.getU64Decoder()]
|
|
5825
|
-
]);
|
|
5658
|
+
function getMigrateArgsDecoder() {
|
|
5659
|
+
return kit.getStructDecoder([
|
|
5660
|
+
["baseForDistribution", kit.getU64Decoder()],
|
|
5661
|
+
["baseForLiquidity", kit.getU64Decoder()]
|
|
5662
|
+
]);
|
|
5826
5663
|
}
|
|
5827
5664
|
function getMigrateArgsCodec() {
|
|
5828
5665
|
return kit.combineCodec(getMigrateArgsEncoder(), getMigrateArgsDecoder());
|
|
@@ -5950,7 +5787,7 @@ function getCpmmMigratorStateCodec() {
|
|
|
5950
5787
|
if (process.env.NODE_ENV !== "production") ;
|
|
5951
5788
|
|
|
5952
5789
|
// src/solana/migrators/cpmmMigrator/client.ts
|
|
5953
|
-
function
|
|
5790
|
+
function base64ToBytes2(base64) {
|
|
5954
5791
|
const binary = atob(base64);
|
|
5955
5792
|
const bytes = new Uint8Array(binary.length);
|
|
5956
5793
|
for (let i = 0; i < binary.length; i++) {
|
|
@@ -5958,11 +5795,11 @@ function base64ToBytes3(base64) {
|
|
|
5958
5795
|
}
|
|
5959
5796
|
return bytes;
|
|
5960
5797
|
}
|
|
5961
|
-
async function fetchCpmmMigratorState(rpc,
|
|
5962
|
-
const response = await rpc.getAccountInfo(
|
|
5798
|
+
async function fetchCpmmMigratorState(rpc, address4) {
|
|
5799
|
+
const response = await rpc.getAccountInfo(address4, { encoding: "base64" }).send();
|
|
5963
5800
|
if (!response.value) return null;
|
|
5964
5801
|
return getCpmmMigratorStateDecoder().decode(
|
|
5965
|
-
|
|
5802
|
+
base64ToBytes2(response.value.data[0])
|
|
5966
5803
|
);
|
|
5967
5804
|
}
|
|
5968
5805
|
async function buildCpmmMigrationRemainingAccounts({
|
|
@@ -5973,7 +5810,7 @@ async function buildCpmmMigrationRemainingAccounts({
|
|
|
5973
5810
|
adminBaseAta,
|
|
5974
5811
|
adminQuoteAta,
|
|
5975
5812
|
recipientAtas,
|
|
5976
|
-
cpmmProgram =
|
|
5813
|
+
cpmmProgram = chunkU6B52TBT_cjs.CPMM_PROGRAM_ID,
|
|
5977
5814
|
cpmmMigratorProgram = CPMM_MIGRATOR_PROGRAM_ID
|
|
5978
5815
|
}) {
|
|
5979
5816
|
const [cpmmMigrationState] = await getCpmmMigratorStateAddress(
|
|
@@ -5981,9 +5818,9 @@ async function buildCpmmMigrationRemainingAccounts({
|
|
|
5981
5818
|
cpmmMigratorProgram
|
|
5982
5819
|
);
|
|
5983
5820
|
const [migrationAuthority] = await getCpmmMigrationAuthorityAddress(cpmmMigratorProgram);
|
|
5984
|
-
const poolInit = await
|
|
5821
|
+
const poolInit = await chunkU6B52TBT_cjs.getPoolInitAddresses(baseMint, quoteMint, cpmmProgram);
|
|
5985
5822
|
const pool = poolInit.pool[0];
|
|
5986
|
-
const [launchLpPosition] = await
|
|
5823
|
+
const [launchLpPosition] = await chunkU6B52TBT_cjs.getPositionAddress(
|
|
5987
5824
|
pool,
|
|
5988
5825
|
launchAuthority,
|
|
5989
5826
|
0n,
|
|
@@ -6022,13 +5859,16 @@ async function buildCpmmMigrationRemainingAccounts({
|
|
|
6022
5859
|
{ address: migrationAuthority, role: kit.AccountRole.READONLY },
|
|
6023
5860
|
{ address: adminBaseAta, role: kit.AccountRole.WRITABLE },
|
|
6024
5861
|
{ address: adminQuoteAta, role: kit.AccountRole.WRITABLE },
|
|
6025
|
-
...recipientAtas.map((
|
|
6026
|
-
address:
|
|
5862
|
+
...recipientAtas.map((address4) => ({
|
|
5863
|
+
address: address4,
|
|
6027
5864
|
role: kit.AccountRole.WRITABLE
|
|
6028
5865
|
}))
|
|
6029
5866
|
],
|
|
6030
5867
|
cpmmMigrationState,
|
|
6031
5868
|
cpmmConfig: poolInit.config[0],
|
|
5869
|
+
adminBaseAta,
|
|
5870
|
+
adminQuoteAta,
|
|
5871
|
+
recipientAtas,
|
|
6032
5872
|
pool,
|
|
6033
5873
|
poolAuthority: poolInit.authority[0],
|
|
6034
5874
|
poolVault0: poolInit.vault0[0],
|
|
@@ -6059,6 +5899,590 @@ function encodeMigratePayload(args) {
|
|
|
6059
5899
|
]);
|
|
6060
5900
|
}
|
|
6061
5901
|
|
|
5902
|
+
// src/solana/initializer/createLaunch.ts
|
|
5903
|
+
var DEFAULT_CPMM_MIGRATION_FEE_SPLIT_BPS = 1e4;
|
|
5904
|
+
var launchIdCounter = 0n;
|
|
5905
|
+
var launchTokenPrograms = {
|
|
5906
|
+
splToken() {
|
|
5907
|
+
return {
|
|
5908
|
+
baseTokenProgram: chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5909
|
+
quoteTokenProgram: chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS
|
|
5910
|
+
};
|
|
5911
|
+
},
|
|
5912
|
+
token2022Base() {
|
|
5913
|
+
return {
|
|
5914
|
+
baseTokenProgram: chunkU6B52TBT_cjs.TOKEN_2022_PROGRAM_ADDRESS,
|
|
5915
|
+
quoteTokenProgram: chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS
|
|
5916
|
+
};
|
|
5917
|
+
}
|
|
5918
|
+
};
|
|
5919
|
+
function createLaunchId() {
|
|
5920
|
+
const bytes = new Uint8Array(32);
|
|
5921
|
+
const view = new DataView(bytes.buffer);
|
|
5922
|
+
view.setBigUint64(0, BigInt(Date.now()), true);
|
|
5923
|
+
view.setBigUint64(8, launchIdCounter, true);
|
|
5924
|
+
launchIdCounter += 1n;
|
|
5925
|
+
bytes.set([68, 79, 80, 76], 28);
|
|
5926
|
+
return bytes;
|
|
5927
|
+
}
|
|
5928
|
+
function isTransactionSigner9(value) {
|
|
5929
|
+
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
5930
|
+
}
|
|
5931
|
+
function getAccountAddress(account) {
|
|
5932
|
+
if (typeof account === "string") {
|
|
5933
|
+
return account;
|
|
5934
|
+
}
|
|
5935
|
+
return account.address;
|
|
5936
|
+
}
|
|
5937
|
+
function getSignerAddress(value) {
|
|
5938
|
+
return isTransactionSigner9(value) ? value.address : value;
|
|
5939
|
+
}
|
|
5940
|
+
function getRemainingAccountMeta(account) {
|
|
5941
|
+
if (typeof account === "string") {
|
|
5942
|
+
return { address: account, role: kit.AccountRole.READONLY };
|
|
5943
|
+
}
|
|
5944
|
+
if (isTransactionSigner9(account)) {
|
|
5945
|
+
return {
|
|
5946
|
+
address: account.address,
|
|
5947
|
+
role: kit.AccountRole.READONLY_SIGNER,
|
|
5948
|
+
signer: account
|
|
5949
|
+
};
|
|
5950
|
+
}
|
|
5951
|
+
return account;
|
|
5952
|
+
}
|
|
5953
|
+
function hasMetadata(metadata) {
|
|
5954
|
+
return Boolean(metadata?.metadataName);
|
|
5955
|
+
}
|
|
5956
|
+
function getInitializerProgramId(input) {
|
|
5957
|
+
return input.programId ?? input.deployment?.initializerProgram ?? INITIALIZER_PROGRAM_ID;
|
|
5958
|
+
}
|
|
5959
|
+
function getInitializerConfig(input) {
|
|
5960
|
+
return input.config ?? input.deployment?.initializerConfig;
|
|
5961
|
+
}
|
|
5962
|
+
function hashRemainingAccounts(accounts) {
|
|
5963
|
+
if (!accounts) {
|
|
5964
|
+
return void 0;
|
|
5965
|
+
}
|
|
5966
|
+
return computeRemainingAccountsHash(accounts.map(getAccountAddress));
|
|
5967
|
+
}
|
|
5968
|
+
function isCustomMigrationConfig(migration) {
|
|
5969
|
+
return migration.kind === "custom";
|
|
5970
|
+
}
|
|
5971
|
+
function getCreateLaunchHookMode(input) {
|
|
5972
|
+
if (input.hook !== void 0 && input.hook !== null) {
|
|
5973
|
+
return input.hook;
|
|
5974
|
+
}
|
|
5975
|
+
return input.cosigner ? "cosigner" : "cpmm";
|
|
5976
|
+
}
|
|
5977
|
+
async function getCreateLaunchHookContext(input) {
|
|
5978
|
+
const mode = getCreateLaunchHookMode(input);
|
|
5979
|
+
if (mode !== "cosigner") {
|
|
5980
|
+
return { mode };
|
|
5981
|
+
}
|
|
5982
|
+
const [cosignerConfig] = await getCosignerHookConfigAddress(
|
|
5983
|
+
input.deployment?.cosignerHookProgram ?? DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID
|
|
5984
|
+
);
|
|
5985
|
+
return { mode, cosignerConfig };
|
|
5986
|
+
}
|
|
5987
|
+
function getCosignerHookRemainingAccounts2({
|
|
5988
|
+
namespace,
|
|
5989
|
+
cosigner,
|
|
5990
|
+
cosignerConfig
|
|
5991
|
+
}) {
|
|
5992
|
+
const accounts = namespace === cosignerConfig ? [cosignerConfig] : [namespace, cosignerConfig];
|
|
5993
|
+
accounts.push(cosigner);
|
|
5994
|
+
return accounts;
|
|
5995
|
+
}
|
|
5996
|
+
function resolveCosignerHookPayload(input) {
|
|
5997
|
+
if (input.cosignGateExpiresAt === void 0 || input.cosignGateExpiresAt === null) {
|
|
5998
|
+
return new Uint8Array();
|
|
5999
|
+
}
|
|
6000
|
+
if (!input.cosigner) {
|
|
6001
|
+
throw new Error("cosigner is required when cosignGateExpiresAt is set");
|
|
6002
|
+
}
|
|
6003
|
+
return encodeCosignerGateExpiryPayload({
|
|
6004
|
+
mode: GATE_EXPIRY_UNIX_TIMESTAMP,
|
|
6005
|
+
value: input.cosignGateExpiresAt,
|
|
6006
|
+
cosigner: getSignerAddress(input.cosigner)
|
|
6007
|
+
});
|
|
6008
|
+
}
|
|
6009
|
+
function resolveCreateLaunchHook({
|
|
6010
|
+
input,
|
|
6011
|
+
namespace,
|
|
6012
|
+
hookContext
|
|
6013
|
+
}) {
|
|
6014
|
+
if (hookContext.mode === false) {
|
|
6015
|
+
return {
|
|
6016
|
+
flags: 0,
|
|
6017
|
+
remainingAccountsHash: EMPTY_REMAINING_ACCOUNTS_HASH
|
|
6018
|
+
};
|
|
6019
|
+
}
|
|
6020
|
+
if (hookContext.mode === "cosigner") {
|
|
6021
|
+
if (!input.cosigner) {
|
|
6022
|
+
throw new Error('cosigner is required when hook is "cosigner"');
|
|
6023
|
+
}
|
|
6024
|
+
if (!hookContext.cosignerConfig) {
|
|
6025
|
+
throw new Error("cosigner hook config could not be derived");
|
|
6026
|
+
}
|
|
6027
|
+
const remainingAccounts = getCosignerHookRemainingAccounts2({
|
|
6028
|
+
namespace,
|
|
6029
|
+
cosigner: input.cosigner,
|
|
6030
|
+
cosignerConfig: hookContext.cosignerConfig
|
|
6031
|
+
});
|
|
6032
|
+
return {
|
|
6033
|
+
program: input.deployment?.cosignerHookProgram ?? DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID,
|
|
6034
|
+
flags: HF_BEFORE_SWAP2 | HF_FORWARD_READONLY_SIGNERS2,
|
|
6035
|
+
payload: resolveCosignerHookPayload(input),
|
|
6036
|
+
remainingAccounts,
|
|
6037
|
+
remainingAccountsHash: hashRemainingAccounts(remainingAccounts) ?? EMPTY_REMAINING_ACCOUNTS_HASH
|
|
6038
|
+
};
|
|
6039
|
+
}
|
|
6040
|
+
return {
|
|
6041
|
+
program: input.deployment?.cpmmHookProgram ?? CPMM_HOOK_PROGRAM_ID,
|
|
6042
|
+
flags: HF_BEFORE_SWAP2,
|
|
6043
|
+
payload: new Uint8Array(),
|
|
6044
|
+
remainingAccountsHash: EMPTY_REMAINING_ACCOUNTS_HASH
|
|
6045
|
+
};
|
|
6046
|
+
}
|
|
6047
|
+
async function getAssociatedTokenAddress({
|
|
6048
|
+
owner,
|
|
6049
|
+
mint,
|
|
6050
|
+
tokenProgram
|
|
6051
|
+
}) {
|
|
6052
|
+
const [ata] = await token.findAssociatedTokenPda({
|
|
6053
|
+
owner,
|
|
6054
|
+
mint,
|
|
6055
|
+
tokenProgram
|
|
6056
|
+
});
|
|
6057
|
+
return ata;
|
|
6058
|
+
}
|
|
6059
|
+
async function resolveCreateLaunchMigration({
|
|
6060
|
+
addresses,
|
|
6061
|
+
input,
|
|
6062
|
+
tokenPrograms
|
|
6063
|
+
}) {
|
|
6064
|
+
const migration = input.migration === void 0 ? true : input.migration;
|
|
6065
|
+
if (migration === false || migration === null) {
|
|
6066
|
+
return null;
|
|
6067
|
+
}
|
|
6068
|
+
const cpmmMigratorProgram = input.deployment?.cpmmMigratorProgram ?? CPMM_MIGRATOR_PROGRAM_ID;
|
|
6069
|
+
if (migration !== true && isCustomMigrationConfig(migration)) {
|
|
6070
|
+
if (!migration.program) {
|
|
6071
|
+
throw new Error("custom launch migration requires a migrator program");
|
|
6072
|
+
}
|
|
6073
|
+
return migration;
|
|
6074
|
+
}
|
|
6075
|
+
const cpmmMigration = migration === true ? {} : migration;
|
|
6076
|
+
const admin = cpmmMigration.admin ?? getSignerAddress(input.payer);
|
|
6077
|
+
const baseMint = getSignerAddress(input.launchAccounts.baseMint);
|
|
6078
|
+
const adminBaseAta = cpmmMigration.adminBaseAta ?? await getAssociatedTokenAddress({
|
|
6079
|
+
owner: admin,
|
|
6080
|
+
mint: baseMint,
|
|
6081
|
+
tokenProgram: tokenPrograms.baseTokenProgram
|
|
6082
|
+
});
|
|
6083
|
+
const adminQuoteAta = cpmmMigration.adminQuoteAta ?? await getAssociatedTokenAddress({
|
|
6084
|
+
owner: admin,
|
|
6085
|
+
mint: input.launchAccounts.quoteMint,
|
|
6086
|
+
tokenProgram: tokenPrograms.quoteTokenProgram
|
|
6087
|
+
});
|
|
6088
|
+
const recipients = [...cpmmMigration.recipients ?? []];
|
|
6089
|
+
const recipientAtas = cpmmMigration.recipientAtas ?? await Promise.all(
|
|
6090
|
+
recipients.map(
|
|
6091
|
+
({ wallet }) => getAssociatedTokenAddress({
|
|
6092
|
+
owner: wallet,
|
|
6093
|
+
mint: baseMint,
|
|
6094
|
+
tokenProgram: tokenPrograms.baseTokenProgram
|
|
6095
|
+
})
|
|
6096
|
+
)
|
|
6097
|
+
);
|
|
6098
|
+
const migrationAccounts = await buildCpmmMigrationRemainingAccounts({
|
|
6099
|
+
launch: addresses.launch,
|
|
6100
|
+
baseMint,
|
|
6101
|
+
quoteMint: input.launchAccounts.quoteMint,
|
|
6102
|
+
launchAuthority: addresses.launchAuthority,
|
|
6103
|
+
adminBaseAta,
|
|
6104
|
+
adminQuoteAta,
|
|
6105
|
+
recipientAtas: [...recipientAtas],
|
|
6106
|
+
cpmmProgram: cpmmMigration.cpmmProgram ?? input.deployment?.cpmmProgram,
|
|
6107
|
+
cpmmMigratorProgram: cpmmMigration.program ?? cpmmMigratorProgram
|
|
6108
|
+
});
|
|
6109
|
+
const initPayload = encodeRegisterLaunchPayload({
|
|
6110
|
+
cpmmConfig: migrationAccounts.cpmmConfig,
|
|
6111
|
+
initialSwapFeeBps: cpmmMigration.initialSwapFeeBps ?? input.curve.swapFeeBps,
|
|
6112
|
+
initialFeeSplitBps: cpmmMigration.initialFeeSplitBps ?? DEFAULT_CPMM_MIGRATION_FEE_SPLIT_BPS,
|
|
6113
|
+
recipients,
|
|
6114
|
+
minRaiseQuote: cpmmMigration.minRaiseQuote ?? 0n,
|
|
6115
|
+
minMigrationPriceQ64Opt: cpmmMigration.minMigrationPriceQ64Opt ?? null,
|
|
6116
|
+
migratedPoolHookConfig: cpmmMigration.migratedPoolHookConfig ?? null
|
|
6117
|
+
});
|
|
6118
|
+
const migratePayload = encodeMigratePayload({
|
|
6119
|
+
baseForDistribution: cpmmMigration.baseForDistribution ?? input.supply.baseForDistribution,
|
|
6120
|
+
baseForLiquidity: cpmmMigration.baseForLiquidity ?? input.supply.baseForLiquidity
|
|
6121
|
+
});
|
|
6122
|
+
return {
|
|
6123
|
+
program: cpmmMigration.program ?? cpmmMigratorProgram,
|
|
6124
|
+
initPayload,
|
|
6125
|
+
migratePayload,
|
|
6126
|
+
cpmmConfig: migrationAccounts.cpmmConfig,
|
|
6127
|
+
remainingAccounts: migrationAccounts.addresses,
|
|
6128
|
+
remainingAccountsHash: migrationAccounts.hash,
|
|
6129
|
+
cpmmMigration: migrationAccounts
|
|
6130
|
+
};
|
|
6131
|
+
}
|
|
6132
|
+
async function deriveCreateLaunchAddresses(input) {
|
|
6133
|
+
const programId = input.programId ?? input.deployment?.initializerProgram ?? INITIALIZER_PROGRAM_ID;
|
|
6134
|
+
const config = input.config ?? input.deployment?.initializerConfig ?? (await getConfigAddress2(programId))[0];
|
|
6135
|
+
const [launch] = await getLaunchAddress(
|
|
6136
|
+
input.namespace,
|
|
6137
|
+
input.launchId,
|
|
6138
|
+
programId
|
|
6139
|
+
);
|
|
6140
|
+
const [launchAuthority] = await getLaunchAuthorityAddress(launch, programId);
|
|
6141
|
+
const [launchFeeState] = await getLaunchFeeStateAddress(launch, programId);
|
|
6142
|
+
const metadataAccount = hasMetadata(input.metadata) ? input.metadataAccount ?? await getTokenMetadataAddress(getSignerAddress(input.baseMint)) : input.metadataAccount;
|
|
6143
|
+
return {
|
|
6144
|
+
config,
|
|
6145
|
+
launch,
|
|
6146
|
+
launchAuthority,
|
|
6147
|
+
launchFeeState,
|
|
6148
|
+
metadataAccount
|
|
6149
|
+
};
|
|
6150
|
+
}
|
|
6151
|
+
async function getMigrationInitRemainingAccountsHash({
|
|
6152
|
+
launch,
|
|
6153
|
+
migration
|
|
6154
|
+
}) {
|
|
6155
|
+
if (!migration) {
|
|
6156
|
+
return EMPTY_REMAINING_ACCOUNTS_HASH;
|
|
6157
|
+
}
|
|
6158
|
+
if (migration.initRemainingAccountsHash) {
|
|
6159
|
+
return migration.initRemainingAccountsHash;
|
|
6160
|
+
}
|
|
6161
|
+
const initHash = hashRemainingAccounts(migration.initRemainingAccounts);
|
|
6162
|
+
if (initHash) {
|
|
6163
|
+
return initHash;
|
|
6164
|
+
}
|
|
6165
|
+
if (migration.cpmmConfig) {
|
|
6166
|
+
const migratorProgram = migration.program ?? CPMM_MIGRATOR_PROGRAM_ID;
|
|
6167
|
+
const [cpmmMigrationState] = await getCpmmMigratorStateAddress(
|
|
6168
|
+
launch,
|
|
6169
|
+
migratorProgram
|
|
6170
|
+
);
|
|
6171
|
+
return computeRemainingAccountsHash([
|
|
6172
|
+
cpmmMigrationState,
|
|
6173
|
+
migration.cpmmConfig
|
|
6174
|
+
]);
|
|
6175
|
+
}
|
|
6176
|
+
return EMPTY_REMAINING_ACCOUNTS_HASH;
|
|
6177
|
+
}
|
|
6178
|
+
async function createLaunch(input) {
|
|
6179
|
+
const programId = getInitializerProgramId(input);
|
|
6180
|
+
const launchId = input.launchId ?? createLaunchId();
|
|
6181
|
+
const hookContext = await getCreateLaunchHookContext(input);
|
|
6182
|
+
const namespace = input.namespace ?? hookContext.cosignerConfig ?? getSignerAddress(input.payer);
|
|
6183
|
+
const tokenPrograms = {
|
|
6184
|
+
...launchTokenPrograms.splToken(),
|
|
6185
|
+
...input.tokenPrograms
|
|
6186
|
+
};
|
|
6187
|
+
const addresses = input.addresses ?? await deriveCreateLaunchAddresses({
|
|
6188
|
+
deployment: input.deployment,
|
|
6189
|
+
programId,
|
|
6190
|
+
config: getInitializerConfig(input),
|
|
6191
|
+
namespace,
|
|
6192
|
+
launchId,
|
|
6193
|
+
baseMint: input.launchAccounts.baseMint,
|
|
6194
|
+
metadata: input.metadata
|
|
6195
|
+
});
|
|
6196
|
+
const migration = await resolveCreateLaunchMigration({
|
|
6197
|
+
addresses,
|
|
6198
|
+
input,
|
|
6199
|
+
tokenPrograms
|
|
6200
|
+
});
|
|
6201
|
+
const hook = resolveCreateLaunchHook({
|
|
6202
|
+
input,
|
|
6203
|
+
namespace,
|
|
6204
|
+
hookContext
|
|
6205
|
+
});
|
|
6206
|
+
const migratorInitRemainingAccountsHash = await getMigrationInitRemainingAccountsHash({
|
|
6207
|
+
launch: addresses.launch,
|
|
6208
|
+
migration
|
|
6209
|
+
});
|
|
6210
|
+
const migratorRemainingAccountsHash = migration?.remainingAccountsHash ?? hashRemainingAccounts(migration?.remainingAccounts) ?? EMPTY_REMAINING_ACCOUNTS_HASH;
|
|
6211
|
+
const instruction = await createInitializeLaunchInstruction(
|
|
6212
|
+
{
|
|
6213
|
+
config: addresses.config,
|
|
6214
|
+
launch: addresses.launch,
|
|
6215
|
+
launchAuthority: addresses.launchAuthority,
|
|
6216
|
+
baseMint: input.launchAccounts.baseMint,
|
|
6217
|
+
quoteMint: input.launchAccounts.quoteMint,
|
|
6218
|
+
baseVault: input.launchAccounts.baseVault,
|
|
6219
|
+
quoteVault: input.launchAccounts.quoteVault,
|
|
6220
|
+
launchFeeState: addresses.launchFeeState,
|
|
6221
|
+
payer: input.payer,
|
|
6222
|
+
authority: input.authority,
|
|
6223
|
+
hookProgram: hook.program,
|
|
6224
|
+
migratorProgram: migration?.program,
|
|
6225
|
+
cpmmConfig: migration?.cpmmConfig,
|
|
6226
|
+
baseTokenProgram: tokenPrograms.baseTokenProgram,
|
|
6227
|
+
quoteTokenProgram: tokenPrograms.quoteTokenProgram,
|
|
6228
|
+
systemProgram: input.systemProgram ?? chunkU6B52TBT_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
6229
|
+
rent: input.rent ?? chunkU6B52TBT_cjs.SYSVAR_RENT_ADDRESS,
|
|
6230
|
+
metadataAccount: addresses.metadataAccount,
|
|
6231
|
+
metadataProgram: input.metadataProgram ?? chunkU6B52TBT_cjs.TOKEN_METADATA_PROGRAM_ID
|
|
6232
|
+
},
|
|
6233
|
+
{
|
|
6234
|
+
namespace,
|
|
6235
|
+
launchId,
|
|
6236
|
+
baseDecimals: input.supply.baseDecimals,
|
|
6237
|
+
baseTotalSupply: input.supply.baseTotalSupply,
|
|
6238
|
+
baseForDistribution: input.supply.baseForDistribution,
|
|
6239
|
+
baseForLiquidity: input.supply.baseForLiquidity,
|
|
6240
|
+
curveVirtualBase: input.curve.curveVirtualBase,
|
|
6241
|
+
curveVirtualQuote: input.curve.curveVirtualQuote,
|
|
6242
|
+
swapFeeBps: input.curve.swapFeeBps,
|
|
6243
|
+
curveKind: CURVE_KIND_XYK,
|
|
6244
|
+
curveParams: new Uint8Array([CURVE_PARAMS_FORMAT_XYK_V0]),
|
|
6245
|
+
allowBuy: input.allowBuy ?? true,
|
|
6246
|
+
allowSell: input.allowSell ?? true,
|
|
6247
|
+
hookFlags: hook.flags,
|
|
6248
|
+
hookPayload: hook.payload ?? new Uint8Array(),
|
|
6249
|
+
migratorInitPayload: migration?.initPayload ?? new Uint8Array(),
|
|
6250
|
+
migratorMigratePayload: migration?.migratePayload ?? new Uint8Array(),
|
|
6251
|
+
hookRemainingAccountsHash: hook.remainingAccountsHash,
|
|
6252
|
+
migratorInitRemainingAccountsHash,
|
|
6253
|
+
migratorRemainingAccountsHash,
|
|
6254
|
+
feeBeneficiaries: input.feeBeneficiaries ?? [],
|
|
6255
|
+
metadataName: input.metadata?.metadataName ?? "",
|
|
6256
|
+
metadataSymbol: input.metadata?.metadataSymbol ?? "",
|
|
6257
|
+
metadataUri: input.metadata?.metadataUri ?? ""
|
|
6258
|
+
},
|
|
6259
|
+
programId
|
|
6260
|
+
);
|
|
6261
|
+
const preparedInstruction = migration?.initRemainingAccounts ? {
|
|
6262
|
+
...instruction,
|
|
6263
|
+
accounts: [
|
|
6264
|
+
...instruction.accounts ?? [],
|
|
6265
|
+
...(migration?.initRemainingAccounts ?? []).map(
|
|
6266
|
+
getRemainingAccountMeta
|
|
6267
|
+
)
|
|
6268
|
+
]
|
|
6269
|
+
} : instruction;
|
|
6270
|
+
return {
|
|
6271
|
+
namespace,
|
|
6272
|
+
launchId,
|
|
6273
|
+
addresses,
|
|
6274
|
+
instruction: preparedInstruction,
|
|
6275
|
+
cpmmMigration: migration?.cpmmMigration
|
|
6276
|
+
};
|
|
6277
|
+
}
|
|
6278
|
+
var DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND = 20;
|
|
6279
|
+
function getInstructionLookupTableAddresses(instructions) {
|
|
6280
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6281
|
+
const addresses = [];
|
|
6282
|
+
for (const instruction of Array.isArray(instructions) ? instructions : [instructions]) {
|
|
6283
|
+
for (const account of instruction.accounts ?? []) {
|
|
6284
|
+
if ("signer" in account || account.role === kit.AccountRole.READONLY_SIGNER || account.role === kit.AccountRole.WRITABLE_SIGNER) {
|
|
6285
|
+
continue;
|
|
6286
|
+
}
|
|
6287
|
+
if (!seen.has(account.address)) {
|
|
6288
|
+
seen.add(account.address);
|
|
6289
|
+
addresses.push(account.address);
|
|
6290
|
+
}
|
|
6291
|
+
}
|
|
6292
|
+
}
|
|
6293
|
+
return addresses;
|
|
6294
|
+
}
|
|
6295
|
+
async function buildAddressLookupTableSetupInstructions({
|
|
6296
|
+
authority,
|
|
6297
|
+
payer,
|
|
6298
|
+
recentSlot,
|
|
6299
|
+
addresses,
|
|
6300
|
+
addressesPerExtendInstruction = DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND
|
|
6301
|
+
}) {
|
|
6302
|
+
if (addressesPerExtendInstruction <= 0) {
|
|
6303
|
+
throw new Error("addressesPerExtendInstruction must be greater than zero");
|
|
6304
|
+
}
|
|
6305
|
+
const dedupedAddresses = [...new Set(addresses)];
|
|
6306
|
+
const lookupTablePda = await addressLookupTable.findAddressLookupTablePda({
|
|
6307
|
+
authority: authority.address,
|
|
6308
|
+
recentSlot
|
|
6309
|
+
});
|
|
6310
|
+
const [lookupTableAddress] = lookupTablePda;
|
|
6311
|
+
const createInstruction = addressLookupTable.getCreateLookupTableInstruction({
|
|
6312
|
+
address: lookupTablePda,
|
|
6313
|
+
authority: authority.address,
|
|
6314
|
+
payer,
|
|
6315
|
+
recentSlot
|
|
6316
|
+
});
|
|
6317
|
+
const extendInstructions = [];
|
|
6318
|
+
for (let start = 0; start < dedupedAddresses.length; start += addressesPerExtendInstruction) {
|
|
6319
|
+
extendInstructions.push(
|
|
6320
|
+
addressLookupTable.getExtendLookupTableInstruction({
|
|
6321
|
+
address: lookupTableAddress,
|
|
6322
|
+
authority,
|
|
6323
|
+
payer,
|
|
6324
|
+
addresses: dedupedAddresses.slice(
|
|
6325
|
+
start,
|
|
6326
|
+
start + addressesPerExtendInstruction
|
|
6327
|
+
)
|
|
6328
|
+
})
|
|
6329
|
+
);
|
|
6330
|
+
}
|
|
6331
|
+
return {
|
|
6332
|
+
lookupTableAddress,
|
|
6333
|
+
createInstruction,
|
|
6334
|
+
extendInstructions,
|
|
6335
|
+
addresses: dedupedAddresses
|
|
6336
|
+
};
|
|
6337
|
+
}
|
|
6338
|
+
function compressTransactionMessageWithLookupTable(transactionMessage, {
|
|
6339
|
+
lookupTableAddress,
|
|
6340
|
+
addresses
|
|
6341
|
+
}) {
|
|
6342
|
+
return kit.compressTransactionMessageUsingAddressLookupTables(
|
|
6343
|
+
transactionMessage,
|
|
6344
|
+
{
|
|
6345
|
+
[lookupTableAddress]: [...addresses]
|
|
6346
|
+
}
|
|
6347
|
+
);
|
|
6348
|
+
}
|
|
6349
|
+
var SOLANA_TRANSACTION_SIZE_LIMIT = 1232;
|
|
6350
|
+
function measureTransactionMessageSize(transactionMessage) {
|
|
6351
|
+
const size = kit.getTransactionMessageSize(transactionMessage);
|
|
6352
|
+
const overBy = Math.max(0, size - SOLANA_TRANSACTION_SIZE_LIMIT);
|
|
6353
|
+
return {
|
|
6354
|
+
size,
|
|
6355
|
+
limit: SOLANA_TRANSACTION_SIZE_LIMIT,
|
|
6356
|
+
overBy,
|
|
6357
|
+
fits: overBy === 0
|
|
6358
|
+
};
|
|
6359
|
+
}
|
|
6360
|
+
function measureTransactionMessageSizeWithLookupTable(transactionMessage, lookupTable) {
|
|
6361
|
+
return measureTransactionMessageSize(
|
|
6362
|
+
compressTransactionMessageWithLookupTable(transactionMessage, lookupTable)
|
|
6363
|
+
);
|
|
6364
|
+
}
|
|
6365
|
+
function assertTransactionMessageFits(transactionMessage, { label = "Transaction", metadataBytes } = {}) {
|
|
6366
|
+
const report = measureTransactionMessageSize(transactionMessage);
|
|
6367
|
+
if (report.fits) {
|
|
6368
|
+
return report;
|
|
6369
|
+
}
|
|
6370
|
+
const metadataHint = metadataBytes && metadataBytes > 0 ? ` Metadata contributes ${metadataBytes} instruction-data bytes; address lookup tables do not compress metadata strings.` : "";
|
|
6371
|
+
throw new Error(
|
|
6372
|
+
`${label} is ${report.size} bytes, exceeding Solana's ${report.limit}-byte transaction limit by ${report.overBy} bytes.${metadataHint}`
|
|
6373
|
+
);
|
|
6374
|
+
}
|
|
6375
|
+
function assertTransactionMessageFitsWithLookupTable(transactionMessage, lookupTable, options = {}) {
|
|
6376
|
+
const compressedMessage = compressTransactionMessageWithLookupTable(
|
|
6377
|
+
transactionMessage,
|
|
6378
|
+
lookupTable
|
|
6379
|
+
);
|
|
6380
|
+
return assertTransactionMessageFits(compressedMessage, options);
|
|
6381
|
+
}
|
|
6382
|
+
var addressCodec5 = kit.getAddressCodec();
|
|
6383
|
+
function bytesToBase64(bytes) {
|
|
6384
|
+
let binary = "";
|
|
6385
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
6386
|
+
binary += String.fromCharCode(bytes[i]);
|
|
6387
|
+
}
|
|
6388
|
+
return btoa(binary);
|
|
6389
|
+
}
|
|
6390
|
+
function base64ToBytes3(base64) {
|
|
6391
|
+
const binary = atob(base64);
|
|
6392
|
+
const bytes = new Uint8Array(binary.length);
|
|
6393
|
+
for (let i = 0; i < binary.length; i++) {
|
|
6394
|
+
bytes[i] = binary.charCodeAt(i);
|
|
6395
|
+
}
|
|
6396
|
+
return bytes;
|
|
6397
|
+
}
|
|
6398
|
+
async function fetchLaunch2(rpc, address4, config) {
|
|
6399
|
+
const response = await rpc.getAccountInfo(address4, {
|
|
6400
|
+
encoding: "base64",
|
|
6401
|
+
commitment: config?.commitment
|
|
6402
|
+
}).send();
|
|
6403
|
+
if (!response.value) {
|
|
6404
|
+
return null;
|
|
6405
|
+
}
|
|
6406
|
+
return getLaunchDecoder().decode(base64ToBytes3(response.value.data[0]));
|
|
6407
|
+
}
|
|
6408
|
+
async function fetchAllLaunches(rpc, config) {
|
|
6409
|
+
const programId = config?.programId ?? INITIALIZER_PROGRAM_ID;
|
|
6410
|
+
const discriminatorFilter = {
|
|
6411
|
+
memcmp: {
|
|
6412
|
+
offset: 0n,
|
|
6413
|
+
bytes: bytesToBase64(
|
|
6414
|
+
INITIALIZER_ACCOUNT_DISCRIMINATORS.Launch
|
|
6415
|
+
),
|
|
6416
|
+
encoding: "base64"
|
|
6417
|
+
}
|
|
6418
|
+
};
|
|
6419
|
+
const response = await rpc.getProgramAccounts(programId, {
|
|
6420
|
+
encoding: "base64",
|
|
6421
|
+
commitment: config?.commitment,
|
|
6422
|
+
filters: [discriminatorFilter]
|
|
6423
|
+
}).send();
|
|
6424
|
+
const accounts = Array.isArray(response) ? response : response.value;
|
|
6425
|
+
const launches = [];
|
|
6426
|
+
const decoder = getLaunchDecoder();
|
|
6427
|
+
for (const account of accounts) {
|
|
6428
|
+
try {
|
|
6429
|
+
const launch = decoder.decode(base64ToBytes3(account.account.data[0]));
|
|
6430
|
+
launches.push({ address: account.pubkey, account: launch });
|
|
6431
|
+
} catch {
|
|
6432
|
+
console.warn(`Failed to decode launch account: ${account.pubkey}`);
|
|
6433
|
+
}
|
|
6434
|
+
}
|
|
6435
|
+
return launches;
|
|
6436
|
+
}
|
|
6437
|
+
async function fetchLaunchesByAuthority(rpc, authority, config) {
|
|
6438
|
+
const programId = config?.programId ?? INITIALIZER_PROGRAM_ID;
|
|
6439
|
+
const discriminatorFilter = {
|
|
6440
|
+
memcmp: {
|
|
6441
|
+
offset: 0n,
|
|
6442
|
+
bytes: bytesToBase64(
|
|
6443
|
+
INITIALIZER_ACCOUNT_DISCRIMINATORS.Launch
|
|
6444
|
+
),
|
|
6445
|
+
encoding: "base64"
|
|
6446
|
+
}
|
|
6447
|
+
};
|
|
6448
|
+
const authorityFilter = {
|
|
6449
|
+
memcmp: {
|
|
6450
|
+
offset: 8n,
|
|
6451
|
+
bytes: bytesToBase64(
|
|
6452
|
+
addressCodec5.encode(authority)
|
|
6453
|
+
),
|
|
6454
|
+
encoding: "base64"
|
|
6455
|
+
}
|
|
6456
|
+
};
|
|
6457
|
+
const response = await rpc.getProgramAccounts(programId, {
|
|
6458
|
+
encoding: "base64",
|
|
6459
|
+
commitment: config?.commitment,
|
|
6460
|
+
filters: [discriminatorFilter, authorityFilter]
|
|
6461
|
+
}).send();
|
|
6462
|
+
const accounts = Array.isArray(response) ? response : response.value;
|
|
6463
|
+
const launches = [];
|
|
6464
|
+
const decoder = getLaunchDecoder();
|
|
6465
|
+
for (const account of accounts) {
|
|
6466
|
+
try {
|
|
6467
|
+
const launch = decoder.decode(base64ToBytes3(account.account.data[0]));
|
|
6468
|
+
launches.push({ address: account.pubkey, account: launch });
|
|
6469
|
+
} catch {
|
|
6470
|
+
console.warn(`Failed to decode launch account: ${account.pubkey}`);
|
|
6471
|
+
}
|
|
6472
|
+
}
|
|
6473
|
+
return launches;
|
|
6474
|
+
}
|
|
6475
|
+
async function launchExists(rpc, namespace, launchId, config) {
|
|
6476
|
+
const programId = config?.programId ?? INITIALIZER_PROGRAM_ID;
|
|
6477
|
+
const [launchAddress] = await getLaunchAddress(
|
|
6478
|
+
namespace,
|
|
6479
|
+
launchId,
|
|
6480
|
+
programId
|
|
6481
|
+
);
|
|
6482
|
+
const launch = await fetchLaunch2(rpc, launchAddress, config);
|
|
6483
|
+
return launch !== null;
|
|
6484
|
+
}
|
|
6485
|
+
|
|
6062
6486
|
// src/solana/migrators/predictionMigrator/index.ts
|
|
6063
6487
|
var predictionMigrator_exports = {};
|
|
6064
6488
|
chunkQ7SFCCGT_cjs.__export(predictionMigrator_exports, {
|
|
@@ -6379,13 +6803,13 @@ function decodeOracleState3(encodedAccount) {
|
|
|
6379
6803
|
getOracleStateDecoder2()
|
|
6380
6804
|
);
|
|
6381
6805
|
}
|
|
6382
|
-
async function fetchOracleState2(rpc,
|
|
6383
|
-
const maybeAccount = await fetchMaybeOracleState2(rpc,
|
|
6806
|
+
async function fetchOracleState2(rpc, address4, config) {
|
|
6807
|
+
const maybeAccount = await fetchMaybeOracleState2(rpc, address4, config);
|
|
6384
6808
|
kit.assertAccountExists(maybeAccount);
|
|
6385
6809
|
return maybeAccount;
|
|
6386
6810
|
}
|
|
6387
|
-
async function fetchMaybeOracleState2(rpc,
|
|
6388
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
6811
|
+
async function fetchMaybeOracleState2(rpc, address4, config) {
|
|
6812
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address4, config);
|
|
6389
6813
|
return decodeOracleState3(maybeAccount);
|
|
6390
6814
|
}
|
|
6391
6815
|
async function fetchAllOracleState2(rpc, addresses, config) {
|
|
@@ -6730,14 +7154,14 @@ async function getOracleStateAddress(oracleAuthority, nonce) {
|
|
|
6730
7154
|
|
|
6731
7155
|
// src/solana/deployment.ts
|
|
6732
7156
|
var DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = {
|
|
6733
|
-
cpmmProgram:
|
|
7157
|
+
cpmmProgram: chunkU6B52TBT_cjs.CPMM_PROGRAM_ID,
|
|
6734
7158
|
initializerProgram: INITIALIZER_PROGRAM_ID,
|
|
6735
7159
|
cpmmMigratorProgram: CPMM_MIGRATOR_PROGRAM_ID,
|
|
6736
7160
|
cpmmHookProgram: CPMM_HOOK_PROGRAM_ID,
|
|
6737
|
-
cosignerHookProgram:
|
|
7161
|
+
cosignerHookProgram: DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID
|
|
6738
7162
|
};
|
|
6739
7163
|
async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES) {
|
|
6740
|
-
const [cpmmConfig] = await
|
|
7164
|
+
const [cpmmConfig] = await chunkU6B52TBT_cjs.getConfigAddress(programs.cpmmProgram);
|
|
6741
7165
|
const [initializerConfig] = await getConfigAddress2(
|
|
6742
7166
|
programs.initializerProgram
|
|
6743
7167
|
);
|
|
@@ -6752,6 +7176,7 @@ exports.DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = DOPPLER_SOLANA_DEVNET_PROGRAM_
|
|
|
6752
7176
|
exports.cosignerHook = cosignerHook_exports;
|
|
6753
7177
|
exports.cpmm = cpmm_exports;
|
|
6754
7178
|
exports.cpmmMigrator = cpmmMigrator_exports;
|
|
7179
|
+
exports.createLaunch = createLaunch;
|
|
6755
7180
|
exports.deriveSolanaCpmmDeployment = deriveSolanaCpmmDeployment;
|
|
6756
7181
|
exports.initializer = initializer_exports;
|
|
6757
7182
|
exports.predictionMigrator = predictionMigrator_exports;
|