@whetstone-research/doppler-sdk 1.0.26 → 1.0.28
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 +13 -7
- package/dist/{chunk-XTL2GBZ4.cjs → chunk-4WY5GNZD.cjs} +108 -60
- package/dist/chunk-4WY5GNZD.cjs.map +1 -0
- package/dist/{chunk-RVDRWCJN.js → chunk-AYVFWD5P.js} +99 -62
- package/dist/chunk-AYVFWD5P.js.map +1 -0
- package/dist/evm/index.cjs +441 -268
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +80 -65
- package/dist/evm/index.d.ts +80 -65
- package/dist/evm/index.js +441 -270
- package/dist/evm/index.js.map +1 -1
- package/dist/solana/index.cjs +1967 -651
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +1458 -786
- package/dist/solana/index.d.ts +1458 -786
- package/dist/solana/index.js +1686 -376
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/react/index.cjs +29 -29
- package/dist/solana/react/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-RVDRWCJN.js.map +0 -1
- package/dist/chunk-XTL2GBZ4.cjs.map +0 -1
package/dist/solana/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk4WY5GNZD_cjs = require('../chunk-4WY5GNZD.cjs');
|
|
4
4
|
var chunkU6B52TBT_cjs = require('../chunk-U6B52TBT.cjs');
|
|
5
5
|
var chunkQ7SFCCGT_cjs = require('../chunk-Q7SFCCGT.cjs');
|
|
6
6
|
var kit = require('@solana/kit');
|
|
@@ -8,20 +8,21 @@ var programClientCore = require('@solana/program-client-core');
|
|
|
8
8
|
var sha3_js = require('@noble/hashes/sha3.js');
|
|
9
9
|
var token = require('@solana-program/token');
|
|
10
10
|
var addressLookupTable = require('@solana-program/address-lookup-table');
|
|
11
|
+
var system = require('@solana-program/system');
|
|
11
12
|
|
|
12
13
|
// src/solana/cpmm/index.ts
|
|
13
14
|
var cpmm_exports = {};
|
|
14
15
|
chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
15
16
|
ACCOUNT_DISCRIMINATORS: () => chunkU6B52TBT_cjs.ACCOUNT_DISCRIMINATORS,
|
|
16
17
|
ACCOUNT_VERSION: () => chunkU6B52TBT_cjs.ACCOUNT_VERSION,
|
|
17
|
-
ADD_LIQUIDITY_DISCRIMINATOR: () =>
|
|
18
|
+
ADD_LIQUIDITY_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.ADD_LIQUIDITY_DISCRIMINATOR,
|
|
18
19
|
BPS_DENOM: () => chunkU6B52TBT_cjs.BPS_DENOM,
|
|
19
|
-
CLOSE_POSITION_DISCRIMINATOR: () =>
|
|
20
|
-
COLLECT_FEES_DISCRIMINATOR: () =>
|
|
21
|
-
COLLECT_PROTOCOL_FEES_DISCRIMINATOR: () =>
|
|
20
|
+
CLOSE_POSITION_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.CLOSE_POSITION_DISCRIMINATOR,
|
|
21
|
+
COLLECT_FEES_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.COLLECT_FEES_DISCRIMINATOR,
|
|
22
|
+
COLLECT_PROTOCOL_FEES_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.COLLECT_PROTOCOL_FEES_DISCRIMINATOR,
|
|
22
23
|
CPMM_ERROR_MESSAGES: () => CPMM_ERROR_MESSAGES,
|
|
23
24
|
CPMM_PROGRAM_ID: () => chunkU6B52TBT_cjs.CPMM_PROGRAM_ID,
|
|
24
|
-
CREATE_POSITION_DISCRIMINATOR: () =>
|
|
25
|
+
CREATE_POSITION_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.CREATE_POSITION_DISCRIMINATOR,
|
|
25
26
|
CpmmError: () => CpmmError,
|
|
26
27
|
CpmmErrorCode: () => CpmmErrorCode,
|
|
27
28
|
HF_AFTER_ADD_LIQ: () => chunkU6B52TBT_cjs.HF_AFTER_ADD_LIQ,
|
|
@@ -33,304 +34,315 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
33
34
|
HF_FORWARD_READONLY_SIGNERS: () => chunkU6B52TBT_cjs.HF_FORWARD_READONLY_SIGNERS,
|
|
34
35
|
HF_REQUIRE_ORACLE: () => chunkU6B52TBT_cjs.HF_REQUIRE_ORACLE,
|
|
35
36
|
HOOK_NO_CHANGE: () => chunkU6B52TBT_cjs.HOOK_NO_CHANGE,
|
|
36
|
-
INITIALIZE_CONFIG_DISCRIMINATOR: () =>
|
|
37
|
-
INITIALIZE_ORACLE_DISCRIMINATOR: () =>
|
|
38
|
-
INITIALIZE_POOL_DISCRIMINATOR: () =>
|
|
37
|
+
INITIALIZE_CONFIG_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.INITIALIZE_CONFIG_DISCRIMINATOR,
|
|
38
|
+
INITIALIZE_ORACLE_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.INITIALIZE_ORACLE_DISCRIMINATOR,
|
|
39
|
+
INITIALIZE_POOL_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.INITIALIZE_POOL_DISCRIMINATOR,
|
|
39
40
|
INSTRUCTION_DISCRIMINATORS: () => chunkU6B52TBT_cjs.INSTRUCTION_DISCRIMINATORS,
|
|
40
41
|
MAX_FEE_AMOUNT: () => MAX_FEE_AMOUNT,
|
|
41
42
|
MAX_HOOK_ALLOWLIST: () => chunkU6B52TBT_cjs.MAX_HOOK_ALLOWLIST,
|
|
42
43
|
MAX_ORACLE_OBSERVATIONS: () => chunkU6B52TBT_cjs.MAX_ORACLE_OBSERVATIONS,
|
|
43
|
-
ORACLE_CONSULT_DISCRIMINATOR: () =>
|
|
44
|
-
ORACLE_UPDATE_DISCRIMINATOR: () =>
|
|
45
|
-
PAUSE_DISCRIMINATOR: () =>
|
|
46
|
-
PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR: () =>
|
|
44
|
+
ORACLE_CONSULT_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.ORACLE_CONSULT_DISCRIMINATOR,
|
|
45
|
+
ORACLE_UPDATE_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.ORACLE_UPDATE_DISCRIMINATOR,
|
|
46
|
+
PAUSE_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.PAUSE_DISCRIMINATOR,
|
|
47
|
+
PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR,
|
|
47
48
|
Q64_ONE: () => chunkU6B52TBT_cjs.Q64_ONE,
|
|
48
|
-
REDEEM_PROTOCOL_SHARES_DISCRIMINATOR: () =>
|
|
49
|
-
REMOVE_LIQUIDITY_DISCRIMINATOR: () =>
|
|
49
|
+
REDEEM_PROTOCOL_SHARES_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.REDEEM_PROTOCOL_SHARES_DISCRIMINATOR,
|
|
50
|
+
REMOVE_LIQUIDITY_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.REMOVE_LIQUIDITY_DISCRIMINATOR,
|
|
50
51
|
SEED_AUTHORITY: () => chunkU6B52TBT_cjs.SEED_AUTHORITY,
|
|
51
52
|
SEED_CONFIG: () => chunkU6B52TBT_cjs.SEED_CONFIG,
|
|
52
53
|
SEED_ORACLE: () => chunkU6B52TBT_cjs.SEED_ORACLE,
|
|
53
54
|
SEED_POOL: () => chunkU6B52TBT_cjs.SEED_POOL,
|
|
54
55
|
SEED_POSITION: () => chunkU6B52TBT_cjs.SEED_POSITION,
|
|
55
56
|
SEED_PROTOCOL_FEE_OWNER: () => chunkU6B52TBT_cjs.SEED_PROTOCOL_FEE_OWNER,
|
|
56
|
-
SET_FEES_DISCRIMINATOR: () =>
|
|
57
|
-
SET_HOOK_DISCRIMINATOR: () =>
|
|
58
|
-
SWAP_EXACT_IN_DISCRIMINATOR: () =>
|
|
57
|
+
SET_FEES_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.SET_FEES_DISCRIMINATOR,
|
|
58
|
+
SET_HOOK_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.SET_HOOK_DISCRIMINATOR,
|
|
59
|
+
SWAP_EXACT_IN_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.SWAP_EXACT_IN_DISCRIMINATOR,
|
|
59
60
|
TOKEN_METADATA_PROGRAM_ID: () => chunkU6B52TBT_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
60
|
-
TRANSFER_ADMIN_DISCRIMINATOR: () =>
|
|
61
|
-
UNPAUSE_DISCRIMINATOR: () =>
|
|
62
|
-
UPDATE_CONFIG_DISCRIMINATOR: () =>
|
|
63
|
-
WITHDRAW_VAULT_EXCESS_DISCRIMINATOR: () =>
|
|
64
|
-
addLiquidityArgsCodec: () =>
|
|
65
|
-
|
|
61
|
+
TRANSFER_ADMIN_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.TRANSFER_ADMIN_DISCRIMINATOR,
|
|
62
|
+
UNPAUSE_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.UNPAUSE_DISCRIMINATOR,
|
|
63
|
+
UPDATE_CONFIG_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.UPDATE_CONFIG_DISCRIMINATOR,
|
|
64
|
+
WITHDRAW_VAULT_EXCESS_DISCRIMINATOR: () => chunk4WY5GNZD_cjs.WITHDRAW_VAULT_EXCESS_DISCRIMINATOR,
|
|
65
|
+
addLiquidityArgsCodec: () => chunk4WY5GNZD_cjs.addLiquidityArgsCodec,
|
|
66
|
+
addressToBase58EncodedBytes: () => chunk4WY5GNZD_cjs.addressToBase58EncodedBytes,
|
|
67
|
+
ammConfigDataCodec: () => chunk4WY5GNZD_cjs.ammConfigDataCodec,
|
|
66
68
|
areMintsOrdered: () => chunkU6B52TBT_cjs.areMintsOrdered,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
69
|
+
base64ToBytes: () => chunk4WY5GNZD_cjs.base64ToBytes,
|
|
70
|
+
bytesToBase64: () => chunk4WY5GNZD_cjs.bytesToBase64,
|
|
71
|
+
bytesToBase64EncodedBytes: () => chunk4WY5GNZD_cjs.bytesToBase64EncodedBytes,
|
|
72
|
+
calculateAccruedFees: () => chunk4WY5GNZD_cjs.calculateAccruedFees,
|
|
73
|
+
calculateTwap: () => chunk4WY5GNZD_cjs.calculateTwap,
|
|
74
|
+
calculateTwapNumber: () => chunk4WY5GNZD_cjs.calculateTwapNumber,
|
|
75
|
+
ceilDiv: () => chunk4WY5GNZD_cjs.ceilDiv,
|
|
76
|
+
collectFeesArgsCodec: () => chunk4WY5GNZD_cjs.collectFeesArgsCodec,
|
|
77
|
+
collectProtocolFeesArgsCodec: () => chunk4WY5GNZD_cjs.collectProtocolFeesArgsCodec,
|
|
78
|
+
comparePoolAndOraclePrices: () => chunk4WY5GNZD_cjs.comparePoolAndOraclePrices,
|
|
79
|
+
computePrice0Q64: () => chunk4WY5GNZD_cjs.computePrice0Q64,
|
|
80
|
+
computePrice1Q64: () => chunk4WY5GNZD_cjs.computePrice1Q64,
|
|
81
|
+
consultTwap: () => chunk4WY5GNZD_cjs.consultTwap,
|
|
82
|
+
createAccountMeta: () => chunk4WY5GNZD_cjs.createAccountMeta,
|
|
83
|
+
createAddLiquidityInstruction: () => chunk4WY5GNZD_cjs.getAddLiquidityInstruction,
|
|
84
|
+
createClosePositionInstruction: () => chunk4WY5GNZD_cjs.getClosePositionInstruction,
|
|
85
|
+
createCollectFeesInstruction: () => chunk4WY5GNZD_cjs.getCollectFeesInstruction,
|
|
86
|
+
createCollectProtocolFeesInstruction: () => chunk4WY5GNZD_cjs.getCollectProtocolFeesInstruction,
|
|
87
|
+
createCreatePositionInstruction: () => chunk4WY5GNZD_cjs.getCreatePositionInstruction,
|
|
88
|
+
createInitializeConfigInstruction: () => chunk4WY5GNZD_cjs.getInitializeConfigInstruction,
|
|
89
|
+
createInitializeOracleInstruction: () => chunk4WY5GNZD_cjs.getInitializeOracleInstruction,
|
|
90
|
+
createInitializePoolInstruction: () => chunk4WY5GNZD_cjs.getInitializePoolInstruction,
|
|
91
|
+
createOracleConsultInstruction: () => chunk4WY5GNZD_cjs.getOracleConsultInstruction,
|
|
92
|
+
createOracleUpdateInstruction: () => chunk4WY5GNZD_cjs.getOracleUpdateInstruction,
|
|
93
|
+
createPauseInstruction: () => chunk4WY5GNZD_cjs.getPauseInstruction,
|
|
94
|
+
createPositionArgsCodec: () => chunk4WY5GNZD_cjs.createPositionArgsCodec,
|
|
95
|
+
createReadonlyRemainingAccountMeta: () => chunk4WY5GNZD_cjs.createReadonlyRemainingAccountMeta,
|
|
96
|
+
createRemoveLiquidityInstruction: () => chunk4WY5GNZD_cjs.getRemoveLiquidityInstruction,
|
|
97
|
+
createSetFeesInstruction: () => chunk4WY5GNZD_cjs.getSetFeesInstruction,
|
|
98
|
+
createSetHookInstruction: () => chunk4WY5GNZD_cjs.getSetHookInstruction,
|
|
99
|
+
createSwapExactInInstruction: () => chunk4WY5GNZD_cjs.getSwapExactInInstruction,
|
|
93
100
|
createSwapInstruction: () => createSwapInstruction,
|
|
94
|
-
createTransferAdminInstruction: () =>
|
|
95
|
-
createUnpauseInstruction: () =>
|
|
96
|
-
createWithdrawVaultExcessInstruction: () =>
|
|
101
|
+
createTransferAdminInstruction: () => chunk4WY5GNZD_cjs.getTransferAdminInstruction,
|
|
102
|
+
createUnpauseInstruction: () => chunk4WY5GNZD_cjs.getUnpauseInstruction,
|
|
103
|
+
createWithdrawVaultExcessInstruction: () => chunk4WY5GNZD_cjs.getWithdrawVaultExcessInstruction,
|
|
97
104
|
curveParamsToMarketCap: () => curveParamsToMarketCap,
|
|
98
|
-
decodeAmmConfig: () =>
|
|
99
|
-
decodeOracleState: () =>
|
|
100
|
-
decodePool: () =>
|
|
101
|
-
decodePosition: () =>
|
|
102
|
-
encodeAddLiquidityArgs: () =>
|
|
103
|
-
encodeCollectFeesArgs: () =>
|
|
104
|
-
encodeCollectProtocolFeesArgs: () =>
|
|
105
|
-
encodeCreatePositionArgs: () =>
|
|
106
|
-
encodeInitializeConfigArgs: () =>
|
|
107
|
-
encodeInitializeOracleArgs: () =>
|
|
108
|
-
encodeInitializePoolArgs: () =>
|
|
109
|
-
encodeInstructionData: () =>
|
|
110
|
-
encodeOracleConsultArgs: () =>
|
|
111
|
-
encodeRemoveLiquidityArgs: () =>
|
|
112
|
-
encodeSetFeesArgs: () =>
|
|
113
|
-
encodeSetHookArgs: () =>
|
|
114
|
-
encodeSwapExactInArgs: () =>
|
|
115
|
-
encodeTransferAdminArgs: () =>
|
|
116
|
-
fetchAllPools: () =>
|
|
105
|
+
decodeAmmConfig: () => chunk4WY5GNZD_cjs.decodeAmmConfig,
|
|
106
|
+
decodeOracleState: () => chunk4WY5GNZD_cjs.decodeOracleState,
|
|
107
|
+
decodePool: () => chunk4WY5GNZD_cjs.decodePool,
|
|
108
|
+
decodePosition: () => chunk4WY5GNZD_cjs.decodePosition,
|
|
109
|
+
encodeAddLiquidityArgs: () => chunk4WY5GNZD_cjs.encodeAddLiquidityArgs,
|
|
110
|
+
encodeCollectFeesArgs: () => chunk4WY5GNZD_cjs.encodeCollectFeesArgs,
|
|
111
|
+
encodeCollectProtocolFeesArgs: () => chunk4WY5GNZD_cjs.encodeCollectProtocolFeesArgs,
|
|
112
|
+
encodeCreatePositionArgs: () => chunk4WY5GNZD_cjs.encodeCreatePositionArgs,
|
|
113
|
+
encodeInitializeConfigArgs: () => chunk4WY5GNZD_cjs.encodeInitializeConfigArgs,
|
|
114
|
+
encodeInitializeOracleArgs: () => chunk4WY5GNZD_cjs.encodeInitializeOracleArgs,
|
|
115
|
+
encodeInitializePoolArgs: () => chunk4WY5GNZD_cjs.encodeInitializePoolArgs,
|
|
116
|
+
encodeInstructionData: () => chunk4WY5GNZD_cjs.encodeInstructionData,
|
|
117
|
+
encodeOracleConsultArgs: () => chunk4WY5GNZD_cjs.encodeOracleConsultArgs,
|
|
118
|
+
encodeRemoveLiquidityArgs: () => chunk4WY5GNZD_cjs.encodeRemoveLiquidityArgs,
|
|
119
|
+
encodeSetFeesArgs: () => chunk4WY5GNZD_cjs.encodeSetFeesArgs,
|
|
120
|
+
encodeSetHookArgs: () => chunk4WY5GNZD_cjs.encodeSetHookArgs,
|
|
121
|
+
encodeSwapExactInArgs: () => chunk4WY5GNZD_cjs.encodeSwapExactInArgs,
|
|
122
|
+
encodeTransferAdminArgs: () => chunk4WY5GNZD_cjs.encodeTransferAdminArgs,
|
|
123
|
+
fetchAllPools: () => chunk4WY5GNZD_cjs.fetchAllPools,
|
|
117
124
|
fetchConfig: () => fetchConfig,
|
|
118
125
|
fetchConfigWithAddress: () => fetchConfigWithAddress,
|
|
119
|
-
fetchOracle: () =>
|
|
120
|
-
fetchOraclesBatch: () =>
|
|
121
|
-
fetchPool: () =>
|
|
122
|
-
fetchPoolPositions: () =>
|
|
123
|
-
fetchPoolsBatch: () =>
|
|
124
|
-
fetchPosition: () =>
|
|
125
|
-
fetchPositionByParams: () =>
|
|
126
|
-
fetchPositionsBatch: () =>
|
|
127
|
-
fetchUserPositions: () =>
|
|
128
|
-
filterActivePositions: () =>
|
|
129
|
-
filterPoolsByMint: () =>
|
|
130
|
-
getAddLiquidityDiscriminatorBytes: () =>
|
|
131
|
-
getAddLiquidityInstruction: () =>
|
|
132
|
-
getAddLiquidityInstructionAsync: () =>
|
|
133
|
-
getAddLiquidityInstructionDataCodec: () =>
|
|
134
|
-
getAddLiquidityInstructionDataDecoder: () =>
|
|
135
|
-
getAddLiquidityInstructionDataEncoder: () =>
|
|
136
|
-
getAddLiquidityQuote: () =>
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
126
|
+
fetchOracle: () => chunk4WY5GNZD_cjs.fetchOracle,
|
|
127
|
+
fetchOraclesBatch: () => chunk4WY5GNZD_cjs.fetchOraclesBatch,
|
|
128
|
+
fetchPool: () => chunk4WY5GNZD_cjs.fetchPool,
|
|
129
|
+
fetchPoolPositions: () => chunk4WY5GNZD_cjs.fetchPoolPositions,
|
|
130
|
+
fetchPoolsBatch: () => chunk4WY5GNZD_cjs.fetchPoolsBatch,
|
|
131
|
+
fetchPosition: () => chunk4WY5GNZD_cjs.fetchPosition,
|
|
132
|
+
fetchPositionByParams: () => chunk4WY5GNZD_cjs.fetchPositionByParams,
|
|
133
|
+
fetchPositionsBatch: () => chunk4WY5GNZD_cjs.fetchPositionsBatch,
|
|
134
|
+
fetchUserPositions: () => chunk4WY5GNZD_cjs.fetchUserPositions,
|
|
135
|
+
filterActivePositions: () => chunk4WY5GNZD_cjs.filterActivePositions,
|
|
136
|
+
filterPoolsByMint: () => chunk4WY5GNZD_cjs.filterPoolsByMint,
|
|
137
|
+
getAddLiquidityDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getAddLiquidityDiscriminatorBytes,
|
|
138
|
+
getAddLiquidityInstruction: () => chunk4WY5GNZD_cjs.getAddLiquidityInstruction,
|
|
139
|
+
getAddLiquidityInstructionAsync: () => chunk4WY5GNZD_cjs.getAddLiquidityInstructionAsync,
|
|
140
|
+
getAddLiquidityInstructionDataCodec: () => chunk4WY5GNZD_cjs.getAddLiquidityInstructionDataCodec,
|
|
141
|
+
getAddLiquidityInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getAddLiquidityInstructionDataDecoder,
|
|
142
|
+
getAddLiquidityInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getAddLiquidityInstructionDataEncoder,
|
|
143
|
+
getAddLiquidityQuote: () => chunk4WY5GNZD_cjs.getAddLiquidityQuote,
|
|
144
|
+
getAddressFromAddressOrSigner: () => chunk4WY5GNZD_cjs.getAddressFromAddressOrSigner,
|
|
145
|
+
getAddressFromRemainingAccount: () => chunk4WY5GNZD_cjs.getAddressFromRemainingAccount,
|
|
146
|
+
getClosePositionDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getClosePositionDiscriminatorBytes,
|
|
147
|
+
getClosePositionInstruction: () => chunk4WY5GNZD_cjs.getClosePositionInstruction,
|
|
148
|
+
getClosePositionInstructionDataCodec: () => chunk4WY5GNZD_cjs.getClosePositionInstructionDataCodec,
|
|
149
|
+
getClosePositionInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getClosePositionInstructionDataDecoder,
|
|
150
|
+
getClosePositionInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getClosePositionInstructionDataEncoder,
|
|
151
|
+
getCollectFeesDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getCollectFeesDiscriminatorBytes,
|
|
152
|
+
getCollectFeesInstruction: () => chunk4WY5GNZD_cjs.getCollectFeesInstruction,
|
|
153
|
+
getCollectFeesInstructionAsync: () => chunk4WY5GNZD_cjs.getCollectFeesInstructionAsync,
|
|
154
|
+
getCollectFeesInstructionDataCodec: () => chunk4WY5GNZD_cjs.getCollectFeesInstructionDataCodec,
|
|
155
|
+
getCollectFeesInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getCollectFeesInstructionDataDecoder,
|
|
156
|
+
getCollectFeesInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getCollectFeesInstructionDataEncoder,
|
|
157
|
+
getCollectProtocolFeesDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getCollectProtocolFeesDiscriminatorBytes,
|
|
158
|
+
getCollectProtocolFeesInstruction: () => chunk4WY5GNZD_cjs.getCollectProtocolFeesInstruction,
|
|
159
|
+
getCollectProtocolFeesInstructionAsync: () => chunk4WY5GNZD_cjs.getCollectProtocolFeesInstructionAsync,
|
|
160
|
+
getCollectProtocolFeesInstructionDataCodec: () => chunk4WY5GNZD_cjs.getCollectProtocolFeesInstructionDataCodec,
|
|
161
|
+
getCollectProtocolFeesInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getCollectProtocolFeesInstructionDataDecoder,
|
|
162
|
+
getCollectProtocolFeesInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getCollectProtocolFeesInstructionDataEncoder,
|
|
154
163
|
getConfigAddress: () => chunkU6B52TBT_cjs.getConfigAddress,
|
|
155
|
-
getCreatePositionDiscriminatorBytes: () =>
|
|
156
|
-
getCreatePositionInstruction: () =>
|
|
157
|
-
getCreatePositionInstructionAsync: () =>
|
|
158
|
-
getCreatePositionInstructionDataCodec: () =>
|
|
159
|
-
getCreatePositionInstructionDataDecoder: () =>
|
|
160
|
-
getCreatePositionInstructionDataEncoder: () =>
|
|
164
|
+
getCreatePositionDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getCreatePositionDiscriminatorBytes,
|
|
165
|
+
getCreatePositionInstruction: () => chunk4WY5GNZD_cjs.getCreatePositionInstruction,
|
|
166
|
+
getCreatePositionInstructionAsync: () => chunk4WY5GNZD_cjs.getCreatePositionInstructionAsync,
|
|
167
|
+
getCreatePositionInstructionDataCodec: () => chunk4WY5GNZD_cjs.getCreatePositionInstructionDataCodec,
|
|
168
|
+
getCreatePositionInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getCreatePositionInstructionDataDecoder,
|
|
169
|
+
getCreatePositionInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getCreatePositionInstructionDataEncoder,
|
|
161
170
|
getErrorMessage: () => getErrorMessage,
|
|
162
|
-
getInitializeConfigDiscriminatorBytes: () =>
|
|
163
|
-
getInitializeConfigInstruction: () =>
|
|
164
|
-
getInitializeConfigInstructionAsync: () =>
|
|
165
|
-
getInitializeConfigInstructionDataCodec: () =>
|
|
166
|
-
getInitializeConfigInstructionDataDecoder: () =>
|
|
167
|
-
getInitializeConfigInstructionDataEncoder: () =>
|
|
168
|
-
getInitializeOracleDiscriminatorBytes: () =>
|
|
169
|
-
getInitializeOracleInstruction: () =>
|
|
170
|
-
getInitializeOracleInstructionAsync: () =>
|
|
171
|
-
getInitializeOracleInstructionDataCodec: () =>
|
|
172
|
-
getInitializeOracleInstructionDataDecoder: () =>
|
|
173
|
-
getInitializeOracleInstructionDataEncoder: () =>
|
|
174
|
-
getInitializePoolDiscriminatorBytes: () =>
|
|
175
|
-
getInitializePoolInstruction: () =>
|
|
176
|
-
getInitializePoolInstructionAsync: () =>
|
|
177
|
-
getInitializePoolInstructionDataCodec: () =>
|
|
178
|
-
getInitializePoolInstructionDataDecoder: () =>
|
|
179
|
-
getInitializePoolInstructionDataEncoder: () =>
|
|
180
|
-
getK: () =>
|
|
171
|
+
getInitializeConfigDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getInitializeConfigDiscriminatorBytes,
|
|
172
|
+
getInitializeConfigInstruction: () => chunk4WY5GNZD_cjs.getInitializeConfigInstruction,
|
|
173
|
+
getInitializeConfigInstructionAsync: () => chunk4WY5GNZD_cjs.getInitializeConfigInstructionAsync,
|
|
174
|
+
getInitializeConfigInstructionDataCodec: () => chunk4WY5GNZD_cjs.getInitializeConfigInstructionDataCodec,
|
|
175
|
+
getInitializeConfigInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getInitializeConfigInstructionDataDecoder,
|
|
176
|
+
getInitializeConfigInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getInitializeConfigInstructionDataEncoder,
|
|
177
|
+
getInitializeOracleDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getInitializeOracleDiscriminatorBytes,
|
|
178
|
+
getInitializeOracleInstruction: () => chunk4WY5GNZD_cjs.getInitializeOracleInstruction,
|
|
179
|
+
getInitializeOracleInstructionAsync: () => chunk4WY5GNZD_cjs.getInitializeOracleInstructionAsync,
|
|
180
|
+
getInitializeOracleInstructionDataCodec: () => chunk4WY5GNZD_cjs.getInitializeOracleInstructionDataCodec,
|
|
181
|
+
getInitializeOracleInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getInitializeOracleInstructionDataDecoder,
|
|
182
|
+
getInitializeOracleInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getInitializeOracleInstructionDataEncoder,
|
|
183
|
+
getInitializePoolDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getInitializePoolDiscriminatorBytes,
|
|
184
|
+
getInitializePoolInstruction: () => chunk4WY5GNZD_cjs.getInitializePoolInstruction,
|
|
185
|
+
getInitializePoolInstructionAsync: () => chunk4WY5GNZD_cjs.getInitializePoolInstructionAsync,
|
|
186
|
+
getInitializePoolInstructionDataCodec: () => chunk4WY5GNZD_cjs.getInitializePoolInstructionDataCodec,
|
|
187
|
+
getInitializePoolInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getInitializePoolInstructionDataDecoder,
|
|
188
|
+
getInitializePoolInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getInitializePoolInstructionDataEncoder,
|
|
189
|
+
getK: () => chunk4WY5GNZD_cjs.getK,
|
|
181
190
|
getLiquidityAddresses: () => chunkU6B52TBT_cjs.getLiquidityAddresses,
|
|
182
191
|
getMetadataAddress: () => getMetadataAddress,
|
|
183
192
|
getOracleAddress: () => chunkU6B52TBT_cjs.getOracleAddress,
|
|
184
|
-
getOracleAddressFromPool: () =>
|
|
185
|
-
getOracleAge: () =>
|
|
186
|
-
getOracleBufferStats: () =>
|
|
187
|
-
getOracleConsultDiscriminatorBytes: () =>
|
|
188
|
-
getOracleConsultInstruction: () =>
|
|
189
|
-
getOracleConsultInstructionAsync: () =>
|
|
190
|
-
getOracleConsultInstructionDataCodec: () =>
|
|
191
|
-
getOracleConsultInstructionDataDecoder: () =>
|
|
192
|
-
getOracleConsultInstructionDataEncoder: () =>
|
|
193
|
-
getOracleDeviation: () =>
|
|
194
|
-
getOracleForPool: () =>
|
|
195
|
-
getOracleSpotPrices: () =>
|
|
196
|
-
getOracleUpdateDiscriminatorBytes: () =>
|
|
197
|
-
getOracleUpdateInstruction: () =>
|
|
198
|
-
getOracleUpdateInstructionAsync: () =>
|
|
199
|
-
getOracleUpdateInstructionDataCodec: () =>
|
|
200
|
-
getOracleUpdateInstructionDataDecoder: () =>
|
|
201
|
-
getOracleUpdateInstructionDataEncoder: () =>
|
|
202
|
-
getPauseDiscriminatorBytes: () =>
|
|
203
|
-
getPauseInstruction: () =>
|
|
204
|
-
getPauseInstructionDataCodec: () =>
|
|
205
|
-
getPauseInstructionDataDecoder: () =>
|
|
206
|
-
getPauseInstructionDataEncoder: () =>
|
|
207
|
-
getPendingFees: () =>
|
|
193
|
+
getOracleAddressFromPool: () => chunk4WY5GNZD_cjs.getOracleAddressFromPool,
|
|
194
|
+
getOracleAge: () => chunk4WY5GNZD_cjs.getOracleAge,
|
|
195
|
+
getOracleBufferStats: () => chunk4WY5GNZD_cjs.getOracleBufferStats,
|
|
196
|
+
getOracleConsultDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getOracleConsultDiscriminatorBytes,
|
|
197
|
+
getOracleConsultInstruction: () => chunk4WY5GNZD_cjs.getOracleConsultInstruction,
|
|
198
|
+
getOracleConsultInstructionAsync: () => chunk4WY5GNZD_cjs.getOracleConsultInstructionAsync,
|
|
199
|
+
getOracleConsultInstructionDataCodec: () => chunk4WY5GNZD_cjs.getOracleConsultInstructionDataCodec,
|
|
200
|
+
getOracleConsultInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getOracleConsultInstructionDataDecoder,
|
|
201
|
+
getOracleConsultInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getOracleConsultInstructionDataEncoder,
|
|
202
|
+
getOracleDeviation: () => chunk4WY5GNZD_cjs.getOracleDeviation,
|
|
203
|
+
getOracleForPool: () => chunk4WY5GNZD_cjs.getOracleForPool,
|
|
204
|
+
getOracleSpotPrices: () => chunk4WY5GNZD_cjs.getOracleSpotPrices,
|
|
205
|
+
getOracleUpdateDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getOracleUpdateDiscriminatorBytes,
|
|
206
|
+
getOracleUpdateInstruction: () => chunk4WY5GNZD_cjs.getOracleUpdateInstruction,
|
|
207
|
+
getOracleUpdateInstructionAsync: () => chunk4WY5GNZD_cjs.getOracleUpdateInstructionAsync,
|
|
208
|
+
getOracleUpdateInstructionDataCodec: () => chunk4WY5GNZD_cjs.getOracleUpdateInstructionDataCodec,
|
|
209
|
+
getOracleUpdateInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getOracleUpdateInstructionDataDecoder,
|
|
210
|
+
getOracleUpdateInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getOracleUpdateInstructionDataEncoder,
|
|
211
|
+
getPauseDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getPauseDiscriminatorBytes,
|
|
212
|
+
getPauseInstruction: () => chunk4WY5GNZD_cjs.getPauseInstruction,
|
|
213
|
+
getPauseInstructionDataCodec: () => chunk4WY5GNZD_cjs.getPauseInstructionDataCodec,
|
|
214
|
+
getPauseInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getPauseInstructionDataDecoder,
|
|
215
|
+
getPauseInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getPauseInstructionDataEncoder,
|
|
216
|
+
getPendingFees: () => chunk4WY5GNZD_cjs.getPendingFees,
|
|
208
217
|
getPoolAddress: () => chunkU6B52TBT_cjs.getPoolAddress,
|
|
209
|
-
getPoolAddressFromMints: () =>
|
|
218
|
+
getPoolAddressFromMints: () => chunk4WY5GNZD_cjs.getPoolAddressFromMints,
|
|
210
219
|
getPoolAuthorityAddress: () => chunkU6B52TBT_cjs.getPoolAuthorityAddress,
|
|
211
|
-
getPoolByMints: () =>
|
|
220
|
+
getPoolByMints: () => chunk4WY5GNZD_cjs.getPoolByMints,
|
|
212
221
|
getPoolInitAddresses: () => chunkU6B52TBT_cjs.getPoolInitAddresses,
|
|
213
222
|
getPoolVault0Address: () => chunkU6B52TBT_cjs.getPoolVault0Address,
|
|
214
223
|
getPoolVault1Address: () => chunkU6B52TBT_cjs.getPoolVault1Address,
|
|
215
224
|
getPositionAddress: () => chunkU6B52TBT_cjs.getPositionAddress,
|
|
216
|
-
getPositionAddressFromParams: () =>
|
|
217
|
-
getPositionValue: () =>
|
|
218
|
-
getPreviewSwapExactInDiscriminatorBytes: () =>
|
|
219
|
-
getPreviewSwapExactInInstruction: () =>
|
|
220
|
-
getPreviewSwapExactInInstructionDataCodec: () =>
|
|
221
|
-
getPreviewSwapExactInInstructionDataDecoder: () =>
|
|
222
|
-
getPreviewSwapExactInInstructionDataEncoder: () =>
|
|
225
|
+
getPositionAddressFromParams: () => chunk4WY5GNZD_cjs.getPositionAddressFromParams,
|
|
226
|
+
getPositionValue: () => chunk4WY5GNZD_cjs.getPositionValue,
|
|
227
|
+
getPreviewSwapExactInDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getPreviewSwapExactInDiscriminatorBytes,
|
|
228
|
+
getPreviewSwapExactInInstruction: () => chunk4WY5GNZD_cjs.getPreviewSwapExactInInstruction,
|
|
229
|
+
getPreviewSwapExactInInstructionDataCodec: () => chunk4WY5GNZD_cjs.getPreviewSwapExactInInstructionDataCodec,
|
|
230
|
+
getPreviewSwapExactInInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getPreviewSwapExactInInstructionDataDecoder,
|
|
231
|
+
getPreviewSwapExactInInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getPreviewSwapExactInInstructionDataEncoder,
|
|
223
232
|
getProtocolFeeOwnerAddress: () => chunkU6B52TBT_cjs.getProtocolFeeOwnerAddress,
|
|
224
233
|
getProtocolFeePositionAddress: () => chunkU6B52TBT_cjs.getProtocolFeePositionAddress,
|
|
225
|
-
getRedeemProtocolSharesDiscriminatorBytes: () =>
|
|
226
|
-
getRedeemProtocolSharesInstruction: () =>
|
|
227
|
-
getRedeemProtocolSharesInstructionAsync: () =>
|
|
228
|
-
getRedeemProtocolSharesInstructionDataCodec: () =>
|
|
229
|
-
getRedeemProtocolSharesInstructionDataDecoder: () =>
|
|
230
|
-
getRedeemProtocolSharesInstructionDataEncoder: () =>
|
|
231
|
-
getRemoveLiquidityDiscriminatorBytes: () =>
|
|
232
|
-
getRemoveLiquidityInstruction: () =>
|
|
233
|
-
getRemoveLiquidityInstructionAsync: () =>
|
|
234
|
-
getRemoveLiquidityInstructionDataCodec: () =>
|
|
235
|
-
getRemoveLiquidityInstructionDataDecoder: () =>
|
|
236
|
-
getRemoveLiquidityInstructionDataEncoder: () =>
|
|
237
|
-
getRemoveLiquidityQuote: () =>
|
|
238
|
-
getSetFeesDiscriminatorBytes: () =>
|
|
239
|
-
getSetFeesInstruction: () =>
|
|
240
|
-
getSetFeesInstructionDataCodec: () =>
|
|
241
|
-
getSetFeesInstructionDataDecoder: () =>
|
|
242
|
-
getSetFeesInstructionDataEncoder: () =>
|
|
243
|
-
getSetHookDiscriminatorBytes: () =>
|
|
244
|
-
getSetHookInstruction: () =>
|
|
245
|
-
getSetHookInstructionDataCodec: () =>
|
|
246
|
-
getSetHookInstructionDataDecoder: () =>
|
|
247
|
-
getSetHookInstructionDataEncoder: () =>
|
|
248
|
-
getSpotPrice0: () =>
|
|
249
|
-
getSpotPrice1: () =>
|
|
234
|
+
getRedeemProtocolSharesDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getRedeemProtocolSharesDiscriminatorBytes,
|
|
235
|
+
getRedeemProtocolSharesInstruction: () => chunk4WY5GNZD_cjs.getRedeemProtocolSharesInstruction,
|
|
236
|
+
getRedeemProtocolSharesInstructionAsync: () => chunk4WY5GNZD_cjs.getRedeemProtocolSharesInstructionAsync,
|
|
237
|
+
getRedeemProtocolSharesInstructionDataCodec: () => chunk4WY5GNZD_cjs.getRedeemProtocolSharesInstructionDataCodec,
|
|
238
|
+
getRedeemProtocolSharesInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getRedeemProtocolSharesInstructionDataDecoder,
|
|
239
|
+
getRedeemProtocolSharesInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getRedeemProtocolSharesInstructionDataEncoder,
|
|
240
|
+
getRemoveLiquidityDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getRemoveLiquidityDiscriminatorBytes,
|
|
241
|
+
getRemoveLiquidityInstruction: () => chunk4WY5GNZD_cjs.getRemoveLiquidityInstruction,
|
|
242
|
+
getRemoveLiquidityInstructionAsync: () => chunk4WY5GNZD_cjs.getRemoveLiquidityInstructionAsync,
|
|
243
|
+
getRemoveLiquidityInstructionDataCodec: () => chunk4WY5GNZD_cjs.getRemoveLiquidityInstructionDataCodec,
|
|
244
|
+
getRemoveLiquidityInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getRemoveLiquidityInstructionDataDecoder,
|
|
245
|
+
getRemoveLiquidityInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getRemoveLiquidityInstructionDataEncoder,
|
|
246
|
+
getRemoveLiquidityQuote: () => chunk4WY5GNZD_cjs.getRemoveLiquidityQuote,
|
|
247
|
+
getSetFeesDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getSetFeesDiscriminatorBytes,
|
|
248
|
+
getSetFeesInstruction: () => chunk4WY5GNZD_cjs.getSetFeesInstruction,
|
|
249
|
+
getSetFeesInstructionDataCodec: () => chunk4WY5GNZD_cjs.getSetFeesInstructionDataCodec,
|
|
250
|
+
getSetFeesInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getSetFeesInstructionDataDecoder,
|
|
251
|
+
getSetFeesInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getSetFeesInstructionDataEncoder,
|
|
252
|
+
getSetHookDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getSetHookDiscriminatorBytes,
|
|
253
|
+
getSetHookInstruction: () => chunk4WY5GNZD_cjs.getSetHookInstruction,
|
|
254
|
+
getSetHookInstructionDataCodec: () => chunk4WY5GNZD_cjs.getSetHookInstructionDataCodec,
|
|
255
|
+
getSetHookInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getSetHookInstructionDataDecoder,
|
|
256
|
+
getSetHookInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getSetHookInstructionDataEncoder,
|
|
257
|
+
getSpotPrice0: () => chunk4WY5GNZD_cjs.getSpotPrice0,
|
|
258
|
+
getSpotPrice1: () => chunk4WY5GNZD_cjs.getSpotPrice1,
|
|
250
259
|
getSwapAddresses: () => chunkU6B52TBT_cjs.getSwapAddresses,
|
|
251
|
-
getSwapExactInDiscriminatorBytes: () =>
|
|
252
|
-
getSwapExactInInstruction: () =>
|
|
253
|
-
getSwapExactInInstructionAsync: () =>
|
|
254
|
-
getSwapExactInInstructionDataCodec: () =>
|
|
255
|
-
getSwapExactInInstructionDataDecoder: () =>
|
|
256
|
-
getSwapExactInInstructionDataEncoder: () =>
|
|
257
|
-
getSwapQuote: () =>
|
|
258
|
-
getSwapQuoteExactOut: () =>
|
|
259
|
-
getTransferAdminDiscriminatorBytes: () =>
|
|
260
|
-
getTransferAdminInstruction: () =>
|
|
261
|
-
getTransferAdminInstructionDataCodec: () =>
|
|
262
|
-
getTransferAdminInstructionDataDecoder: () =>
|
|
263
|
-
getTransferAdminInstructionDataEncoder: () =>
|
|
264
|
-
getTvl: () =>
|
|
265
|
-
getUnpauseDiscriminatorBytes: () =>
|
|
266
|
-
getUnpauseInstruction: () =>
|
|
267
|
-
getUnpauseInstructionDataCodec: () =>
|
|
268
|
-
getUnpauseInstructionDataDecoder: () =>
|
|
269
|
-
getUnpauseInstructionDataEncoder: () =>
|
|
270
|
-
getUpdateConfigDiscriminatorBytes: () =>
|
|
271
|
-
getUpdateConfigInstruction: () =>
|
|
272
|
-
getUpdateConfigInstructionDataCodec: () =>
|
|
273
|
-
getUpdateConfigInstructionDataDecoder: () =>
|
|
274
|
-
getUpdateConfigInstructionDataEncoder: () =>
|
|
275
|
-
getWithdrawVaultExcessDiscriminatorBytes: () =>
|
|
276
|
-
getWithdrawVaultExcessInstruction: () =>
|
|
277
|
-
getWithdrawVaultExcessInstructionAsync: () =>
|
|
278
|
-
getWithdrawVaultExcessInstructionDataCodec: () =>
|
|
279
|
-
getWithdrawVaultExcessInstructionDataDecoder: () =>
|
|
280
|
-
getWithdrawVaultExcessInstructionDataEncoder: () =>
|
|
281
|
-
initializeConfigArgsCodec: () =>
|
|
282
|
-
initializeOracleArgsCodec: () =>
|
|
283
|
-
initializePoolArgsCodec: () =>
|
|
260
|
+
getSwapExactInDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getSwapExactInDiscriminatorBytes,
|
|
261
|
+
getSwapExactInInstruction: () => chunk4WY5GNZD_cjs.getSwapExactInInstruction,
|
|
262
|
+
getSwapExactInInstructionAsync: () => chunk4WY5GNZD_cjs.getSwapExactInInstructionAsync,
|
|
263
|
+
getSwapExactInInstructionDataCodec: () => chunk4WY5GNZD_cjs.getSwapExactInInstructionDataCodec,
|
|
264
|
+
getSwapExactInInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getSwapExactInInstructionDataDecoder,
|
|
265
|
+
getSwapExactInInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getSwapExactInInstructionDataEncoder,
|
|
266
|
+
getSwapQuote: () => chunk4WY5GNZD_cjs.getSwapQuote,
|
|
267
|
+
getSwapQuoteExactOut: () => chunk4WY5GNZD_cjs.getSwapQuoteExactOut,
|
|
268
|
+
getTransferAdminDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getTransferAdminDiscriminatorBytes,
|
|
269
|
+
getTransferAdminInstruction: () => chunk4WY5GNZD_cjs.getTransferAdminInstruction,
|
|
270
|
+
getTransferAdminInstructionDataCodec: () => chunk4WY5GNZD_cjs.getTransferAdminInstructionDataCodec,
|
|
271
|
+
getTransferAdminInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getTransferAdminInstructionDataDecoder,
|
|
272
|
+
getTransferAdminInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getTransferAdminInstructionDataEncoder,
|
|
273
|
+
getTvl: () => chunk4WY5GNZD_cjs.getTvl,
|
|
274
|
+
getUnpauseDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getUnpauseDiscriminatorBytes,
|
|
275
|
+
getUnpauseInstruction: () => chunk4WY5GNZD_cjs.getUnpauseInstruction,
|
|
276
|
+
getUnpauseInstructionDataCodec: () => chunk4WY5GNZD_cjs.getUnpauseInstructionDataCodec,
|
|
277
|
+
getUnpauseInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getUnpauseInstructionDataDecoder,
|
|
278
|
+
getUnpauseInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getUnpauseInstructionDataEncoder,
|
|
279
|
+
getUpdateConfigDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getUpdateConfigDiscriminatorBytes,
|
|
280
|
+
getUpdateConfigInstruction: () => chunk4WY5GNZD_cjs.getUpdateConfigInstruction,
|
|
281
|
+
getUpdateConfigInstructionDataCodec: () => chunk4WY5GNZD_cjs.getUpdateConfigInstructionDataCodec,
|
|
282
|
+
getUpdateConfigInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getUpdateConfigInstructionDataDecoder,
|
|
283
|
+
getUpdateConfigInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getUpdateConfigInstructionDataEncoder,
|
|
284
|
+
getWithdrawVaultExcessDiscriminatorBytes: () => chunk4WY5GNZD_cjs.getWithdrawVaultExcessDiscriminatorBytes,
|
|
285
|
+
getWithdrawVaultExcessInstruction: () => chunk4WY5GNZD_cjs.getWithdrawVaultExcessInstruction,
|
|
286
|
+
getWithdrawVaultExcessInstructionAsync: () => chunk4WY5GNZD_cjs.getWithdrawVaultExcessInstructionAsync,
|
|
287
|
+
getWithdrawVaultExcessInstructionDataCodec: () => chunk4WY5GNZD_cjs.getWithdrawVaultExcessInstructionDataCodec,
|
|
288
|
+
getWithdrawVaultExcessInstructionDataDecoder: () => chunk4WY5GNZD_cjs.getWithdrawVaultExcessInstructionDataDecoder,
|
|
289
|
+
getWithdrawVaultExcessInstructionDataEncoder: () => chunk4WY5GNZD_cjs.getWithdrawVaultExcessInstructionDataEncoder,
|
|
290
|
+
initializeConfigArgsCodec: () => chunk4WY5GNZD_cjs.initializeConfigArgsCodec,
|
|
291
|
+
initializeOracleArgsCodec: () => chunk4WY5GNZD_cjs.initializeOracleArgsCodec,
|
|
292
|
+
initializePoolArgsCodec: () => chunk4WY5GNZD_cjs.initializePoolArgsCodec,
|
|
284
293
|
isCpmmError: () => isCpmmError,
|
|
285
|
-
isOracleStale: () =>
|
|
286
|
-
|
|
294
|
+
isOracleStale: () => chunk4WY5GNZD_cjs.isOracleStale,
|
|
295
|
+
isTransactionSigner: () => chunk4WY5GNZD_cjs.isTransactionSigner,
|
|
296
|
+
isqrt: () => chunk4WY5GNZD_cjs.isqrt,
|
|
287
297
|
marketCapToCurveParams: () => marketCapToCurveParams,
|
|
288
298
|
marketCapToSingleCurveParams: () => marketCapToSingleCurveParams,
|
|
289
299
|
marketCapToTokenPrice: () => marketCapToTokenPrice,
|
|
290
|
-
maxBigInt: () =>
|
|
291
|
-
minBigInt: () =>
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
300
|
+
maxBigInt: () => chunk4WY5GNZD_cjs.maxBigInt,
|
|
301
|
+
minBigInt: () => chunk4WY5GNZD_cjs.minBigInt,
|
|
302
|
+
normalizeProgramAccountsResponse: () => chunk4WY5GNZD_cjs.normalizeProgramAccountsResponse,
|
|
303
|
+
numberToQ64: () => chunk4WY5GNZD_cjs.numberToQ64,
|
|
304
|
+
observationCodec: () => chunk4WY5GNZD_cjs.observationCodec,
|
|
305
|
+
oracleConsultArgsCodec: () => chunk4WY5GNZD_cjs.oracleConsultArgsCodec,
|
|
306
|
+
oracleStateDataCodec: () => chunk4WY5GNZD_cjs.oracleStateDataCodec,
|
|
307
|
+
parseAddLiquidityInstruction: () => chunk4WY5GNZD_cjs.parseAddLiquidityInstruction,
|
|
308
|
+
parseClosePositionInstruction: () => chunk4WY5GNZD_cjs.parseClosePositionInstruction,
|
|
309
|
+
parseCollectFeesInstruction: () => chunk4WY5GNZD_cjs.parseCollectFeesInstruction,
|
|
310
|
+
parseCollectProtocolFeesInstruction: () => chunk4WY5GNZD_cjs.parseCollectProtocolFeesInstruction,
|
|
311
|
+
parseCreatePositionInstruction: () => chunk4WY5GNZD_cjs.parseCreatePositionInstruction,
|
|
301
312
|
parseErrorFromLogs: () => parseErrorFromLogs,
|
|
302
|
-
parseInitializeConfigInstruction: () =>
|
|
303
|
-
parseInitializeOracleInstruction: () =>
|
|
304
|
-
parseInitializePoolInstruction: () =>
|
|
305
|
-
parseOracleConsultInstruction: () =>
|
|
306
|
-
parseOracleUpdateInstruction: () =>
|
|
307
|
-
parsePauseInstruction: () =>
|
|
308
|
-
parsePreviewSwapExactInInstruction: () =>
|
|
309
|
-
parseRedeemProtocolSharesInstruction: () =>
|
|
310
|
-
parseRemoveLiquidityInstruction: () =>
|
|
311
|
-
parseSetFeesInstruction: () =>
|
|
312
|
-
parseSetHookInstruction: () =>
|
|
313
|
-
parseSwapExactInInstruction: () =>
|
|
314
|
-
parseTransferAdminInstruction: () =>
|
|
315
|
-
parseUnpauseInstruction: () =>
|
|
316
|
-
parseUpdateConfigInstruction: () =>
|
|
317
|
-
parseWithdrawVaultExcessInstruction: () =>
|
|
318
|
-
poolDataCodec: () =>
|
|
319
|
-
poolExists: () =>
|
|
320
|
-
positionDataCodec: () =>
|
|
321
|
-
q64Div: () =>
|
|
322
|
-
q64Mul: () =>
|
|
323
|
-
q64ToNumber: () =>
|
|
324
|
-
ratioToNumber: () =>
|
|
325
|
-
removeLiquidityArgsCodec: () =>
|
|
326
|
-
setFeesArgsCodec: () =>
|
|
327
|
-
setHookArgsCodec: () =>
|
|
313
|
+
parseInitializeConfigInstruction: () => chunk4WY5GNZD_cjs.parseInitializeConfigInstruction,
|
|
314
|
+
parseInitializeOracleInstruction: () => chunk4WY5GNZD_cjs.parseInitializeOracleInstruction,
|
|
315
|
+
parseInitializePoolInstruction: () => chunk4WY5GNZD_cjs.parseInitializePoolInstruction,
|
|
316
|
+
parseOracleConsultInstruction: () => chunk4WY5GNZD_cjs.parseOracleConsultInstruction,
|
|
317
|
+
parseOracleUpdateInstruction: () => chunk4WY5GNZD_cjs.parseOracleUpdateInstruction,
|
|
318
|
+
parsePauseInstruction: () => chunk4WY5GNZD_cjs.parsePauseInstruction,
|
|
319
|
+
parsePreviewSwapExactInInstruction: () => chunk4WY5GNZD_cjs.parsePreviewSwapExactInInstruction,
|
|
320
|
+
parseRedeemProtocolSharesInstruction: () => chunk4WY5GNZD_cjs.parseRedeemProtocolSharesInstruction,
|
|
321
|
+
parseRemoveLiquidityInstruction: () => chunk4WY5GNZD_cjs.parseRemoveLiquidityInstruction,
|
|
322
|
+
parseSetFeesInstruction: () => chunk4WY5GNZD_cjs.parseSetFeesInstruction,
|
|
323
|
+
parseSetHookInstruction: () => chunk4WY5GNZD_cjs.parseSetHookInstruction,
|
|
324
|
+
parseSwapExactInInstruction: () => chunk4WY5GNZD_cjs.parseSwapExactInInstruction,
|
|
325
|
+
parseTransferAdminInstruction: () => chunk4WY5GNZD_cjs.parseTransferAdminInstruction,
|
|
326
|
+
parseUnpauseInstruction: () => chunk4WY5GNZD_cjs.parseUnpauseInstruction,
|
|
327
|
+
parseUpdateConfigInstruction: () => chunk4WY5GNZD_cjs.parseUpdateConfigInstruction,
|
|
328
|
+
parseWithdrawVaultExcessInstruction: () => chunk4WY5GNZD_cjs.parseWithdrawVaultExcessInstruction,
|
|
329
|
+
poolDataCodec: () => chunk4WY5GNZD_cjs.poolDataCodec,
|
|
330
|
+
poolExists: () => chunk4WY5GNZD_cjs.poolExists,
|
|
331
|
+
positionDataCodec: () => chunk4WY5GNZD_cjs.positionDataCodec,
|
|
332
|
+
q64Div: () => chunk4WY5GNZD_cjs.q64Div,
|
|
333
|
+
q64Mul: () => chunk4WY5GNZD_cjs.q64Mul,
|
|
334
|
+
q64ToNumber: () => chunk4WY5GNZD_cjs.q64ToNumber,
|
|
335
|
+
ratioToNumber: () => chunk4WY5GNZD_cjs.ratioToNumber,
|
|
336
|
+
removeLiquidityArgsCodec: () => chunk4WY5GNZD_cjs.removeLiquidityArgsCodec,
|
|
337
|
+
setFeesArgsCodec: () => chunk4WY5GNZD_cjs.setFeesArgsCodec,
|
|
338
|
+
setHookArgsCodec: () => chunk4WY5GNZD_cjs.setHookArgsCodec,
|
|
328
339
|
sortMints: () => chunkU6B52TBT_cjs.sortMints,
|
|
329
|
-
sortPoolsByReserves: () =>
|
|
330
|
-
sortPositionsByShares: () =>
|
|
331
|
-
swapExactInArgsCodec: () =>
|
|
332
|
-
transferAdminArgsCodec: () =>
|
|
333
|
-
validateMarketCapParameters: () => validateMarketCapParameters
|
|
340
|
+
sortPoolsByReserves: () => chunk4WY5GNZD_cjs.sortPoolsByReserves,
|
|
341
|
+
sortPositionsByShares: () => chunk4WY5GNZD_cjs.sortPositionsByShares,
|
|
342
|
+
swapExactInArgsCodec: () => chunk4WY5GNZD_cjs.swapExactInArgsCodec,
|
|
343
|
+
transferAdminArgsCodec: () => chunk4WY5GNZD_cjs.transferAdminArgsCodec,
|
|
344
|
+
validateMarketCapParameters: () => validateMarketCapParameters,
|
|
345
|
+
warnAccountDecodeFailure: () => chunk4WY5GNZD_cjs.warnAccountDecodeFailure
|
|
334
346
|
});
|
|
335
347
|
var addressCodec = kit.getAddressCodec();
|
|
336
348
|
var textEncoder = new TextEncoder();
|
|
@@ -631,22 +643,6 @@ function getErrorMessage(code) {
|
|
|
631
643
|
}
|
|
632
644
|
return `Unknown error code: ${code}`;
|
|
633
645
|
}
|
|
634
|
-
function isTransactionSigner(value) {
|
|
635
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
636
|
-
}
|
|
637
|
-
function toRemainingAccountMeta(account) {
|
|
638
|
-
if (typeof account === "string") {
|
|
639
|
-
return { address: account, role: kit.AccountRole.READONLY };
|
|
640
|
-
}
|
|
641
|
-
if (isTransactionSigner(account)) {
|
|
642
|
-
return {
|
|
643
|
-
address: account.address,
|
|
644
|
-
role: kit.AccountRole.READONLY_SIGNER,
|
|
645
|
-
signer: account
|
|
646
|
-
};
|
|
647
|
-
}
|
|
648
|
-
return account;
|
|
649
|
-
}
|
|
650
646
|
function createSwapInstruction(params) {
|
|
651
647
|
const {
|
|
652
648
|
config,
|
|
@@ -668,12 +664,12 @@ function createSwapInstruction(params) {
|
|
|
668
664
|
token0Program,
|
|
669
665
|
token1Program,
|
|
670
666
|
tokenProgram,
|
|
671
|
-
programId =
|
|
667
|
+
programId = chunk4WY5GNZD_cjs.CPMM_PROGRAM_ADDRESS
|
|
672
668
|
} = params;
|
|
673
669
|
const trader = typeof user === "string" ? kit.createNoopSigner(user) : user;
|
|
674
670
|
const [vaultIn, vaultOut] = tradeDirection === 0 ? [vault0, vault1] : [vault1, vault0];
|
|
675
671
|
const [userIn, userOut] = tradeDirection === 0 ? [userToken0, userToken1] : [userToken1, userToken0];
|
|
676
|
-
const instruction =
|
|
672
|
+
const instruction = chunk4WY5GNZD_cjs.getSwapExactInInstruction(
|
|
677
673
|
{
|
|
678
674
|
config,
|
|
679
675
|
pool,
|
|
@@ -699,21 +695,13 @@ function createSwapInstruction(params) {
|
|
|
699
695
|
...instruction,
|
|
700
696
|
accounts: [
|
|
701
697
|
...instruction.accounts ?? [],
|
|
702
|
-
...remainingAccounts.map(
|
|
698
|
+
...remainingAccounts.map(chunk4WY5GNZD_cjs.createReadonlyRemainingAccountMeta)
|
|
703
699
|
]
|
|
704
700
|
};
|
|
705
701
|
}
|
|
706
702
|
var MAX_FEE_AMOUNT = BigInt("18446744073709551615");
|
|
707
703
|
|
|
708
704
|
// src/solana/client/config.ts
|
|
709
|
-
function base64ToBytes(base64) {
|
|
710
|
-
const binary = atob(base64);
|
|
711
|
-
const bytes = new Uint8Array(binary.length);
|
|
712
|
-
for (let i = 0; i < binary.length; i++) {
|
|
713
|
-
bytes[i] = binary.charCodeAt(i);
|
|
714
|
-
}
|
|
715
|
-
return bytes;
|
|
716
|
-
}
|
|
717
705
|
async function fetchConfig(rpc, programId = chunkU6B52TBT_cjs.CPMM_PROGRAM_ID, commitment) {
|
|
718
706
|
const [configAddress] = await chunkU6B52TBT_cjs.getConfigAddress(programId);
|
|
719
707
|
const response = await rpc.getAccountInfo(configAddress, {
|
|
@@ -723,7 +711,7 @@ async function fetchConfig(rpc, programId = chunkU6B52TBT_cjs.CPMM_PROGRAM_ID, c
|
|
|
723
711
|
if (!response.value) {
|
|
724
712
|
return null;
|
|
725
713
|
}
|
|
726
|
-
return
|
|
714
|
+
return chunk4WY5GNZD_cjs.decodeAmmConfig(chunk4WY5GNZD_cjs.base64ToBytes(response.value.data[0]));
|
|
727
715
|
}
|
|
728
716
|
async function fetchConfigWithAddress(rpc, programId = chunkU6B52TBT_cjs.CPMM_PROGRAM_ID, commitment) {
|
|
729
717
|
const [configAddress] = await chunkU6B52TBT_cjs.getConfigAddress(programId);
|
|
@@ -870,13 +858,13 @@ function decodeCosignerConfig(encodedAccount) {
|
|
|
870
858
|
getCosignerConfigDecoder()
|
|
871
859
|
);
|
|
872
860
|
}
|
|
873
|
-
async function fetchCosignerConfig(rpc,
|
|
874
|
-
const maybeAccount = await fetchMaybeCosignerConfig(rpc,
|
|
861
|
+
async function fetchCosignerConfig(rpc, address7, config) {
|
|
862
|
+
const maybeAccount = await fetchMaybeCosignerConfig(rpc, address7, config);
|
|
875
863
|
kit.assertAccountExists(maybeAccount);
|
|
876
864
|
return maybeAccount;
|
|
877
865
|
}
|
|
878
|
-
async function fetchMaybeCosignerConfig(rpc,
|
|
879
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
866
|
+
async function fetchMaybeCosignerConfig(rpc, address7, config) {
|
|
867
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address7, config);
|
|
880
868
|
return decodeCosignerConfig(maybeAccount);
|
|
881
869
|
}
|
|
882
870
|
async function fetchAllCosignerConfig(rpc, addresses, config) {
|
|
@@ -1862,7 +1850,7 @@ function getCurveSwapFeeAmount(amountIn, swapFeeBps) {
|
|
|
1862
1850
|
if (!Number.isInteger(swapFeeBps) || swapFeeBps < 0 || swapFeeBps > Number(chunkU6B52TBT_cjs.BPS_DENOM)) {
|
|
1863
1851
|
throw new Error("swapFeeBps must be an integer from 0 to 10000");
|
|
1864
1852
|
}
|
|
1865
|
-
return
|
|
1853
|
+
return chunk4WY5GNZD_cjs.ceilDiv(amountIn * BigInt(swapFeeBps), chunkU6B52TBT_cjs.BPS_DENOM);
|
|
1866
1854
|
}
|
|
1867
1855
|
function phaseLabel(phase) {
|
|
1868
1856
|
switch (phase) {
|
|
@@ -3143,15 +3131,6 @@ function launchIdFromU64(launchId) {
|
|
|
3143
3131
|
out.set(encodeU64LE(launchId), 0);
|
|
3144
3132
|
return out;
|
|
3145
3133
|
}
|
|
3146
|
-
function isTransactionSigner2(value) {
|
|
3147
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
3148
|
-
}
|
|
3149
|
-
function createSignerAccountMeta(value, role) {
|
|
3150
|
-
if (isTransactionSigner2(value)) {
|
|
3151
|
-
return { address: value.address, role, signer: value };
|
|
3152
|
-
}
|
|
3153
|
-
return { address: value, role };
|
|
3154
|
-
}
|
|
3155
3134
|
function createInitializeConfigInstruction(accounts, args, programId = INITIALIZER_PROGRAM_ID) {
|
|
3156
3135
|
const {
|
|
3157
3136
|
admin,
|
|
@@ -3160,7 +3139,7 @@ function createInitializeConfigInstruction(accounts, args, programId = INITIALIZ
|
|
|
3160
3139
|
systemProgram = chunkU6B52TBT_cjs.SYSTEM_PROGRAM_ADDRESS
|
|
3161
3140
|
} = accounts;
|
|
3162
3141
|
const keys = [
|
|
3163
|
-
|
|
3142
|
+
chunk4WY5GNZD_cjs.createAccountMeta(admin, kit.AccountRole.WRITABLE_SIGNER),
|
|
3164
3143
|
{ address: config, role: kit.AccountRole.WRITABLE },
|
|
3165
3144
|
{ address: programData, role: kit.AccountRole.READONLY },
|
|
3166
3145
|
{ address: systemProgram, role: kit.AccountRole.READONLY }
|
|
@@ -3170,19 +3149,10 @@ function createInitializeConfigInstruction(accounts, args, programId = INITIALIZ
|
|
|
3170
3149
|
);
|
|
3171
3150
|
return { programAddress: programId, accounts: keys, data };
|
|
3172
3151
|
}
|
|
3173
|
-
function isTransactionSigner3(value) {
|
|
3174
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
3175
|
-
}
|
|
3176
|
-
function createSignerAccountMeta2(value, role) {
|
|
3177
|
-
if (isTransactionSigner3(value)) {
|
|
3178
|
-
return { address: value.address, role, signer: value };
|
|
3179
|
-
}
|
|
3180
|
-
return { address: value, role };
|
|
3181
|
-
}
|
|
3182
3152
|
function createSetMigratorAllowlistInstruction(accounts, allowlist, programId = INITIALIZER_PROGRAM_ID) {
|
|
3183
3153
|
const { admin, config } = accounts;
|
|
3184
3154
|
const keys = [
|
|
3185
|
-
|
|
3155
|
+
chunk4WY5GNZD_cjs.createAccountMeta(admin, kit.AccountRole.WRITABLE_SIGNER),
|
|
3186
3156
|
{ address: config, role: kit.AccountRole.WRITABLE }
|
|
3187
3157
|
];
|
|
3188
3158
|
const data = new Uint8Array(
|
|
@@ -3190,19 +3160,10 @@ function createSetMigratorAllowlistInstruction(accounts, allowlist, programId =
|
|
|
3190
3160
|
);
|
|
3191
3161
|
return { programAddress: programId, accounts: keys, data };
|
|
3192
3162
|
}
|
|
3193
|
-
function isTransactionSigner4(value) {
|
|
3194
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
3195
|
-
}
|
|
3196
|
-
function createSignerAccountMeta3(value, role) {
|
|
3197
|
-
if (isTransactionSigner4(value)) {
|
|
3198
|
-
return { address: value.address, role, signer: value };
|
|
3199
|
-
}
|
|
3200
|
-
return { address: value, role };
|
|
3201
|
-
}
|
|
3202
3163
|
function createSetHookAllowlistInstruction(accounts, allowlist, programId = INITIALIZER_PROGRAM_ID) {
|
|
3203
3164
|
const { admin, config } = accounts;
|
|
3204
3165
|
const keys = [
|
|
3205
|
-
|
|
3166
|
+
chunk4WY5GNZD_cjs.createAccountMeta(admin, kit.AccountRole.WRITABLE_SIGNER),
|
|
3206
3167
|
{ address: config, role: kit.AccountRole.WRITABLE }
|
|
3207
3168
|
];
|
|
3208
3169
|
const data = new Uint8Array(
|
|
@@ -3307,13 +3268,13 @@ function decodeClaimReceipt(encodedAccount) {
|
|
|
3307
3268
|
getClaimReceiptDecoder()
|
|
3308
3269
|
);
|
|
3309
3270
|
}
|
|
3310
|
-
async function fetchClaimReceipt(rpc,
|
|
3311
|
-
const maybeAccount = await fetchMaybeClaimReceipt(rpc,
|
|
3271
|
+
async function fetchClaimReceipt(rpc, address7, config) {
|
|
3272
|
+
const maybeAccount = await fetchMaybeClaimReceipt(rpc, address7, config);
|
|
3312
3273
|
kit.assertAccountExists(maybeAccount);
|
|
3313
3274
|
return maybeAccount;
|
|
3314
3275
|
}
|
|
3315
|
-
async function fetchMaybeClaimReceipt(rpc,
|
|
3316
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3276
|
+
async function fetchMaybeClaimReceipt(rpc, address7, config) {
|
|
3277
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address7, config);
|
|
3317
3278
|
return decodeClaimReceipt(maybeAccount);
|
|
3318
3279
|
}
|
|
3319
3280
|
async function fetchAllClaimReceipt(rpc, addresses, config) {
|
|
@@ -3377,13 +3338,13 @@ function decodeEntry(encodedAccount) {
|
|
|
3377
3338
|
getEntryDecoder()
|
|
3378
3339
|
);
|
|
3379
3340
|
}
|
|
3380
|
-
async function fetchEntry(rpc,
|
|
3381
|
-
const maybeAccount = await fetchMaybeEntry(rpc,
|
|
3341
|
+
async function fetchEntry(rpc, address7, config) {
|
|
3342
|
+
const maybeAccount = await fetchMaybeEntry(rpc, address7, config);
|
|
3382
3343
|
kit.assertAccountExists(maybeAccount);
|
|
3383
3344
|
return maybeAccount;
|
|
3384
3345
|
}
|
|
3385
|
-
async function fetchMaybeEntry(rpc,
|
|
3386
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3346
|
+
async function fetchMaybeEntry(rpc, address7, config) {
|
|
3347
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address7, config);
|
|
3387
3348
|
return decodeEntry(maybeAccount);
|
|
3388
3349
|
}
|
|
3389
3350
|
async function fetchAllEntry(rpc, addresses, config) {
|
|
@@ -3445,13 +3406,13 @@ function decodeEntryByMint(encodedAccount) {
|
|
|
3445
3406
|
getEntryByMintDecoder()
|
|
3446
3407
|
);
|
|
3447
3408
|
}
|
|
3448
|
-
async function fetchEntryByMint(rpc,
|
|
3449
|
-
const maybeAccount = await fetchMaybeEntryByMint(rpc,
|
|
3409
|
+
async function fetchEntryByMint(rpc, address7, config) {
|
|
3410
|
+
const maybeAccount = await fetchMaybeEntryByMint(rpc, address7, config);
|
|
3450
3411
|
kit.assertAccountExists(maybeAccount);
|
|
3451
3412
|
return maybeAccount;
|
|
3452
3413
|
}
|
|
3453
|
-
async function fetchMaybeEntryByMint(rpc,
|
|
3454
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3414
|
+
async function fetchMaybeEntryByMint(rpc, address7, config) {
|
|
3415
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address7, config);
|
|
3455
3416
|
return decodeEntryByMint(maybeAccount);
|
|
3456
3417
|
}
|
|
3457
3418
|
async function fetchAllEntryByMint(rpc, addresses, config) {
|
|
@@ -3523,13 +3484,13 @@ function decodeInitConfig(encodedAccount) {
|
|
|
3523
3484
|
getInitConfigDecoder2()
|
|
3524
3485
|
);
|
|
3525
3486
|
}
|
|
3526
|
-
async function fetchInitConfig(rpc,
|
|
3527
|
-
const maybeAccount = await fetchMaybeInitConfig(rpc,
|
|
3487
|
+
async function fetchInitConfig(rpc, address7, config) {
|
|
3488
|
+
const maybeAccount = await fetchMaybeInitConfig(rpc, address7, config);
|
|
3528
3489
|
kit.assertAccountExists(maybeAccount);
|
|
3529
3490
|
return maybeAccount;
|
|
3530
3491
|
}
|
|
3531
|
-
async function fetchMaybeInitConfig(rpc,
|
|
3532
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3492
|
+
async function fetchMaybeInitConfig(rpc, address7, config) {
|
|
3493
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address7, config);
|
|
3533
3494
|
return decodeInitConfig(maybeAccount);
|
|
3534
3495
|
}
|
|
3535
3496
|
async function fetchAllInitConfig(rpc, addresses, config) {
|
|
@@ -3829,13 +3790,13 @@ function decodeLaunch(encodedAccount) {
|
|
|
3829
3790
|
getLaunchDecoder2()
|
|
3830
3791
|
);
|
|
3831
3792
|
}
|
|
3832
|
-
async function fetchLaunch(rpc,
|
|
3833
|
-
const maybeAccount = await fetchMaybeLaunch(rpc,
|
|
3793
|
+
async function fetchLaunch(rpc, address7, config) {
|
|
3794
|
+
const maybeAccount = await fetchMaybeLaunch(rpc, address7, config);
|
|
3834
3795
|
kit.assertAccountExists(maybeAccount);
|
|
3835
3796
|
return maybeAccount;
|
|
3836
3797
|
}
|
|
3837
|
-
async function fetchMaybeLaunch(rpc,
|
|
3838
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3798
|
+
async function fetchMaybeLaunch(rpc, address7, config) {
|
|
3799
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address7, config);
|
|
3839
3800
|
return decodeLaunch(maybeAccount);
|
|
3840
3801
|
}
|
|
3841
3802
|
async function fetchAllLaunch(rpc, addresses, config) {
|
|
@@ -3909,13 +3870,13 @@ function decodeMarket(encodedAccount) {
|
|
|
3909
3870
|
getMarketDecoder()
|
|
3910
3871
|
);
|
|
3911
3872
|
}
|
|
3912
|
-
async function fetchMarket(rpc,
|
|
3913
|
-
const maybeAccount = await fetchMaybeMarket(rpc,
|
|
3873
|
+
async function fetchMarket(rpc, address7, config) {
|
|
3874
|
+
const maybeAccount = await fetchMaybeMarket(rpc, address7, config);
|
|
3914
3875
|
kit.assertAccountExists(maybeAccount);
|
|
3915
3876
|
return maybeAccount;
|
|
3916
3877
|
}
|
|
3917
|
-
async function fetchMaybeMarket(rpc,
|
|
3918
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3878
|
+
async function fetchMaybeMarket(rpc, address7, config) {
|
|
3879
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address7, config);
|
|
3919
3880
|
return decodeMarket(maybeAccount);
|
|
3920
3881
|
}
|
|
3921
3882
|
async function fetchAllMarket(rpc, addresses, config) {
|
|
@@ -3981,13 +3942,13 @@ function decodeOracleState2(encodedAccount) {
|
|
|
3981
3942
|
getOracleStateDecoder()
|
|
3982
3943
|
);
|
|
3983
3944
|
}
|
|
3984
|
-
async function fetchOracleState(rpc,
|
|
3985
|
-
const maybeAccount = await fetchMaybeOracleState(rpc,
|
|
3945
|
+
async function fetchOracleState(rpc, address7, config) {
|
|
3946
|
+
const maybeAccount = await fetchMaybeOracleState(rpc, address7, config);
|
|
3986
3947
|
kit.assertAccountExists(maybeAccount);
|
|
3987
3948
|
return maybeAccount;
|
|
3988
3949
|
}
|
|
3989
|
-
async function fetchMaybeOracleState(rpc,
|
|
3990
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3950
|
+
async function fetchMaybeOracleState(rpc, address7, config) {
|
|
3951
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address7, config);
|
|
3991
3952
|
return decodeOracleState2(maybeAccount);
|
|
3992
3953
|
}
|
|
3993
3954
|
async function fetchAllOracleState(rpc, addresses, config) {
|
|
@@ -5271,15 +5232,6 @@ async function getPredictionEntryByMintAddress(market, mint, programId = PREDICT
|
|
|
5271
5232
|
}
|
|
5272
5233
|
|
|
5273
5234
|
// src/solana/initializer/instructions/initializeLaunch.ts
|
|
5274
|
-
function isTransactionSigner5(value) {
|
|
5275
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
5276
|
-
}
|
|
5277
|
-
function createAccountMeta(value, role) {
|
|
5278
|
-
if (isTransactionSigner5(value)) {
|
|
5279
|
-
return { address: value.address, role, signer: value };
|
|
5280
|
-
}
|
|
5281
|
-
return { address: value, role };
|
|
5282
|
-
}
|
|
5283
5235
|
async function getTokenMetadataAddress(mint) {
|
|
5284
5236
|
const encoder = kit.getAddressEncoder();
|
|
5285
5237
|
const [metadataAddress] = await kit.getProgramDerivedAddress({
|
|
@@ -5336,7 +5288,7 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5336
5288
|
}
|
|
5337
5289
|
const createHooksEnabled = (args.hookFlags & (HF_BEFORE_CREATE | HF_AFTER_CREATE)) !== 0;
|
|
5338
5290
|
const hookCreateRemainingAccountAddresses = hookCreateRemainingAccounts.map(
|
|
5339
|
-
|
|
5291
|
+
chunk4WY5GNZD_cjs.getAddressFromAddressOrSigner
|
|
5340
5292
|
);
|
|
5341
5293
|
const swapFeeBps = args.swapFeeBps ?? args.curveFeeBps;
|
|
5342
5294
|
if (swapFeeBps === void 0) {
|
|
@@ -5346,18 +5298,18 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5346
5298
|
{ address: config, role: kit.AccountRole.READONLY },
|
|
5347
5299
|
{ address: launch, role: kit.AccountRole.WRITABLE },
|
|
5348
5300
|
{ address: launchAuthority, role: kit.AccountRole.READONLY },
|
|
5349
|
-
createAccountMeta(baseMint, kit.AccountRole.WRITABLE_SIGNER),
|
|
5301
|
+
chunk4WY5GNZD_cjs.createAccountMeta(baseMint, kit.AccountRole.WRITABLE_SIGNER),
|
|
5350
5302
|
{ address: quoteMint, role: kit.AccountRole.READONLY },
|
|
5351
|
-
createAccountMeta(baseVault, kit.AccountRole.WRITABLE_SIGNER),
|
|
5352
|
-
createAccountMeta(quoteVault, kit.AccountRole.WRITABLE_SIGNER),
|
|
5303
|
+
chunk4WY5GNZD_cjs.createAccountMeta(baseVault, kit.AccountRole.WRITABLE_SIGNER),
|
|
5304
|
+
chunk4WY5GNZD_cjs.createAccountMeta(quoteVault, kit.AccountRole.WRITABLE_SIGNER),
|
|
5353
5305
|
{
|
|
5354
5306
|
address: launchFeeState ?? (await getLaunchFeeStateAddress(launch, programId))[0],
|
|
5355
5307
|
role: kit.AccountRole.WRITABLE
|
|
5356
5308
|
},
|
|
5357
|
-
createAccountMeta(payer, kit.AccountRole.WRITABLE_SIGNER)
|
|
5309
|
+
chunk4WY5GNZD_cjs.createAccountMeta(payer, kit.AccountRole.WRITABLE_SIGNER)
|
|
5358
5310
|
];
|
|
5359
5311
|
keys.push(
|
|
5360
|
-
authority ? createAccountMeta(authority, kit.AccountRole.READONLY_SIGNER) : { address: programId, role: kit.AccountRole.READONLY }
|
|
5312
|
+
authority ? chunk4WY5GNZD_cjs.createAccountMeta(authority, kit.AccountRole.READONLY_SIGNER) : { address: programId, role: kit.AccountRole.READONLY }
|
|
5361
5313
|
);
|
|
5362
5314
|
keys.push(
|
|
5363
5315
|
hookProgram ? { address: hookProgram, role: kit.AccountRole.READONLY } : { address: programId, role: kit.AccountRole.READONLY }
|
|
@@ -5396,9 +5348,9 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5396
5348
|
}
|
|
5397
5349
|
keys.push(
|
|
5398
5350
|
...hookCreateRemainingAccounts.map(
|
|
5399
|
-
(account) => createAccountMeta(
|
|
5351
|
+
(account) => chunk4WY5GNZD_cjs.createAccountMeta(
|
|
5400
5352
|
account,
|
|
5401
|
-
|
|
5353
|
+
chunk4WY5GNZD_cjs.isTransactionSigner(account) ? kit.AccountRole.READONLY_SIGNER : kit.AccountRole.READONLY
|
|
5402
5354
|
)
|
|
5403
5355
|
)
|
|
5404
5356
|
);
|
|
@@ -5422,7 +5374,7 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5422
5374
|
if (migratorProgram === PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
5423
5375
|
const oracleState = args.namespace;
|
|
5424
5376
|
const entryId = args.launchId;
|
|
5425
|
-
const baseMintAddress =
|
|
5377
|
+
const baseMintAddress = chunk4WY5GNZD_cjs.getAddressFromAddressOrSigner(baseMint);
|
|
5426
5378
|
const [market] = await getPredictionMarketAddress(oracleState, quoteMint);
|
|
5427
5379
|
const [potVault] = await getPredictionPotVaultAddress(market);
|
|
5428
5380
|
const [marketAuthority] = await getPredictionMarketAuthorityAddress(market);
|
|
@@ -5440,28 +5392,6 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5440
5392
|
}
|
|
5441
5393
|
return { programAddress: programId, accounts: keys, data };
|
|
5442
5394
|
}
|
|
5443
|
-
function isTransactionSigner6(value) {
|
|
5444
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
5445
|
-
}
|
|
5446
|
-
function createAccountMeta2(value, role) {
|
|
5447
|
-
if (isTransactionSigner6(value)) {
|
|
5448
|
-
return { address: value.address, role, signer: value };
|
|
5449
|
-
}
|
|
5450
|
-
return { address: value, role };
|
|
5451
|
-
}
|
|
5452
|
-
function createRemainingAccountMeta(value) {
|
|
5453
|
-
if (typeof value === "string") {
|
|
5454
|
-
return { address: value, role: kit.AccountRole.READONLY };
|
|
5455
|
-
}
|
|
5456
|
-
if (isTransactionSigner6(value)) {
|
|
5457
|
-
return {
|
|
5458
|
-
address: value.address,
|
|
5459
|
-
role: kit.AccountRole.READONLY_SIGNER,
|
|
5460
|
-
signer: value
|
|
5461
|
-
};
|
|
5462
|
-
}
|
|
5463
|
-
return value;
|
|
5464
|
-
}
|
|
5465
5395
|
function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZER_PROGRAM_ID) {
|
|
5466
5396
|
const {
|
|
5467
5397
|
launch,
|
|
@@ -5488,7 +5418,7 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
5488
5418
|
{ address: userQuoteAccount, role: kit.AccountRole.WRITABLE },
|
|
5489
5419
|
{ address: baseMint, role: kit.AccountRole.READONLY },
|
|
5490
5420
|
{ address: quoteMint, role: kit.AccountRole.READONLY },
|
|
5491
|
-
|
|
5421
|
+
chunk4WY5GNZD_cjs.createAccountMeta(user, kit.AccountRole.READONLY_SIGNER),
|
|
5492
5422
|
// hook_program is Optional in the on-chain struct but still occupies a fixed
|
|
5493
5423
|
// slot (token_program follows it). Always emit it — use SYSTEM_PROGRAM_ADDRESS as the
|
|
5494
5424
|
// no-op placeholder when no real hook is configured.
|
|
@@ -5496,22 +5426,13 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
5496
5426
|
{ address: launchFeeState, role: kit.AccountRole.WRITABLE },
|
|
5497
5427
|
{ address: baseTokenProgram, role: kit.AccountRole.READONLY },
|
|
5498
5428
|
{ address: quoteTokenProgram, role: kit.AccountRole.READONLY },
|
|
5499
|
-
...remainingAccounts.map(
|
|
5429
|
+
...remainingAccounts.map(chunk4WY5GNZD_cjs.createReadonlyRemainingAccountMeta)
|
|
5500
5430
|
];
|
|
5501
5431
|
const data = new Uint8Array(
|
|
5502
5432
|
getCurveSwapExactInInstructionDataEncoder().encode(args)
|
|
5503
5433
|
);
|
|
5504
5434
|
return { programAddress: programId, accounts: keys, data };
|
|
5505
5435
|
}
|
|
5506
|
-
function isTransactionSigner7(value) {
|
|
5507
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
5508
|
-
}
|
|
5509
|
-
function createSignerAccountMeta4(value, role) {
|
|
5510
|
-
if (isTransactionSigner7(value)) {
|
|
5511
|
-
return { address: value.address, role, signer: value };
|
|
5512
|
-
}
|
|
5513
|
-
return { address: value, role };
|
|
5514
|
-
}
|
|
5515
5436
|
function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRAM_ID) {
|
|
5516
5437
|
const {
|
|
5517
5438
|
config,
|
|
@@ -5539,33 +5460,17 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
5539
5460
|
{ address: quoteVault, role: kit.AccountRole.WRITABLE },
|
|
5540
5461
|
{ address: launchFeeState, role: kit.AccountRole.READONLY },
|
|
5541
5462
|
{ address: migratorProgram, role: kit.AccountRole.READONLY },
|
|
5542
|
-
|
|
5463
|
+
chunk4WY5GNZD_cjs.createAccountMeta(payer, kit.AccountRole.WRITABLE_SIGNER),
|
|
5543
5464
|
{ address: baseTokenProgram, role: kit.AccountRole.READONLY },
|
|
5544
5465
|
{ address: quoteTokenProgram, role: kit.AccountRole.READONLY },
|
|
5545
5466
|
{ address: systemProgram, role: kit.AccountRole.READONLY },
|
|
5546
5467
|
{ address: rent, role: kit.AccountRole.READONLY }
|
|
5547
5468
|
];
|
|
5548
|
-
const data =
|
|
5469
|
+
const data = chunk4WY5GNZD_cjs.encodeInstructionData(
|
|
5549
5470
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS.migrateLaunch
|
|
5550
5471
|
);
|
|
5551
5472
|
return { programAddress: programId, accounts: keys, data };
|
|
5552
5473
|
}
|
|
5553
|
-
function isTransactionSigner8(value) {
|
|
5554
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
5555
|
-
}
|
|
5556
|
-
function createRemainingAccountMeta2(value) {
|
|
5557
|
-
if (typeof value === "string") {
|
|
5558
|
-
return { address: value, role: kit.AccountRole.READONLY };
|
|
5559
|
-
}
|
|
5560
|
-
if (isTransactionSigner8(value)) {
|
|
5561
|
-
return {
|
|
5562
|
-
address: value.address,
|
|
5563
|
-
role: kit.AccountRole.READONLY_SIGNER,
|
|
5564
|
-
signer: value
|
|
5565
|
-
};
|
|
5566
|
-
}
|
|
5567
|
-
return value;
|
|
5568
|
-
}
|
|
5569
5474
|
var previewSwapExactInResultCodec = kit.getStructCodec([
|
|
5570
5475
|
["amountOut", kit.getU64Codec()],
|
|
5571
5476
|
["feePaid", kit.getU64Codec()]
|
|
@@ -5588,7 +5493,7 @@ function createPreviewSwapExactInInstruction(accounts, args, programId = INITIAL
|
|
|
5588
5493
|
const accountsList = hookProgram ? [...keys, { address: hookProgram, role: kit.AccountRole.READONLY }] : keys;
|
|
5589
5494
|
const accountsWithRemaining = [
|
|
5590
5495
|
...accountsList,
|
|
5591
|
-
...remainingAccounts.map(
|
|
5496
|
+
...remainingAccounts.map(chunk4WY5GNZD_cjs.createReadonlyRemainingAccountMeta)
|
|
5592
5497
|
];
|
|
5593
5498
|
const data = new Uint8Array(
|
|
5594
5499
|
getPreviewSwapExactInInstructionDataEncoder2().encode(args)
|
|
@@ -5611,7 +5516,7 @@ function createPreviewMigrationInstruction(accounts, programId = INITIALIZER_PRO
|
|
|
5611
5516
|
{ address: baseVault, role: kit.AccountRole.READONLY },
|
|
5612
5517
|
{ address: quoteVault, role: kit.AccountRole.READONLY }
|
|
5613
5518
|
];
|
|
5614
|
-
const data =
|
|
5519
|
+
const data = chunk4WY5GNZD_cjs.encodeInstructionData(
|
|
5615
5520
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS.previewMigration
|
|
5616
5521
|
);
|
|
5617
5522
|
return { programAddress: programId, accounts: keys, data };
|
|
@@ -5620,193 +5525,1254 @@ function decodePreviewMigrationResult(data) {
|
|
|
5620
5525
|
return previewMigrationResultCodec.decode(data);
|
|
5621
5526
|
}
|
|
5622
5527
|
|
|
5623
|
-
// src/solana/
|
|
5624
|
-
var
|
|
5625
|
-
chunkQ7SFCCGT_cjs.__export(
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5528
|
+
// src/solana/dynamicFeeHook/index.ts
|
|
5529
|
+
var dynamicFeeHook_exports = {};
|
|
5530
|
+
chunkQ7SFCCGT_cjs.__export(dynamicFeeHook_exports, {
|
|
5531
|
+
ADD_COSIGNER_DISCRIMINATOR: () => ADD_COSIGNER_DISCRIMINATOR2,
|
|
5532
|
+
COSIGNER_CONFIG_DISCRIMINATOR: () => COSIGNER_CONFIG_DISCRIMINATOR2,
|
|
5533
|
+
DEVNET_DYNAMIC_FEE_HOOK_PROGRAM_ID: () => DEVNET_DYNAMIC_FEE_HOOK_PROGRAM_ID,
|
|
5534
|
+
DYNAMIC_FEE_HOOK_ERROR__ARITHMETIC_OVERFLOW: () => DYNAMIC_FEE_HOOK_ERROR__ARITHMETIC_OVERFLOW,
|
|
5535
|
+
DYNAMIC_FEE_HOOK_ERROR__COSIGNER_ALREADY_EXISTS: () => DYNAMIC_FEE_HOOK_ERROR__COSIGNER_ALREADY_EXISTS,
|
|
5536
|
+
DYNAMIC_FEE_HOOK_ERROR__COSIGNER_LIST_FULL: () => DYNAMIC_FEE_HOOK_ERROR__COSIGNER_LIST_FULL,
|
|
5537
|
+
DYNAMIC_FEE_HOOK_ERROR__COSIGNER_NOT_FOUND: () => DYNAMIC_FEE_HOOK_ERROR__COSIGNER_NOT_FOUND,
|
|
5538
|
+
DYNAMIC_FEE_HOOK_ERROR__INVALID_AUTHORITY: () => DYNAMIC_FEE_HOOK_ERROR__INVALID_AUTHORITY,
|
|
5539
|
+
DYNAMIC_FEE_HOOK_ERROR__INVALID_CONFIG: () => DYNAMIC_FEE_HOOK_ERROR__INVALID_CONFIG,
|
|
5540
|
+
DYNAMIC_FEE_HOOK_ERROR__INVALID_COSIGNER: () => DYNAMIC_FEE_HOOK_ERROR__INVALID_COSIGNER,
|
|
5541
|
+
DYNAMIC_FEE_HOOK_ERROR__INVALID_DURATION: () => DYNAMIC_FEE_HOOK_ERROR__INVALID_DURATION,
|
|
5542
|
+
DYNAMIC_FEE_HOOK_ERROR__INVALID_FEE: () => DYNAMIC_FEE_HOOK_ERROR__INVALID_FEE,
|
|
5543
|
+
DYNAMIC_FEE_HOOK_ERROR__INVALID_INSTRUCTION_DATA: () => DYNAMIC_FEE_HOOK_ERROR__INVALID_INSTRUCTION_DATA,
|
|
5544
|
+
DYNAMIC_FEE_HOOK_ERROR__INVALID_SCHEDULE_DATA: () => DYNAMIC_FEE_HOOK_ERROR__INVALID_SCHEDULE_DATA,
|
|
5545
|
+
DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS: () => DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS,
|
|
5546
|
+
DYNAMIC_FEE_HOOK_PROGRAM_ID: () => DYNAMIC_FEE_HOOK_PROGRAM_ID,
|
|
5547
|
+
DYNAMIC_FEE_SCHEDULE_HEADER_LEN: () => DYNAMIC_FEE_SCHEDULE_HEADER_LEN,
|
|
5548
|
+
DYNAMIC_FEE_SCHEDULE_LEN: () => DYNAMIC_FEE_SCHEDULE_LEN,
|
|
5549
|
+
DYNAMIC_FEE_SCHEDULE_MAGIC: () => DYNAMIC_FEE_SCHEDULE_MAGIC,
|
|
5550
|
+
DYNAMIC_FEE_SCHEDULE_MAX_BPS: () => DYNAMIC_FEE_SCHEDULE_MAX_BPS,
|
|
5551
|
+
DYNAMIC_FEE_SCHEDULE_VERSION: () => DYNAMIC_FEE_SCHEDULE_VERSION,
|
|
5552
|
+
DynamicFeeHookAccount: () => DynamicFeeHookAccount,
|
|
5553
|
+
DynamicFeeHookInstruction: () => DynamicFeeHookInstruction,
|
|
5554
|
+
INITIALIZE_CONFIG_DISCRIMINATOR: () => INITIALIZE_CONFIG_DISCRIMINATOR4,
|
|
5555
|
+
MAX_COSIGNERS: () => MAX_COSIGNERS2,
|
|
5556
|
+
REMOVE_COSIGNER_DISCRIMINATOR: () => REMOVE_COSIGNER_DISCRIMINATOR2,
|
|
5557
|
+
SEED_DYNAMIC_FEE_HOOK_CONFIG: () => SEED_DYNAMIC_FEE_HOOK_CONFIG,
|
|
5558
|
+
SET_AUTHORITY_DISCRIMINATOR: () => SET_AUTHORITY_DISCRIMINATOR2,
|
|
5559
|
+
decodeCosignerConfig: () => decodeCosignerConfig2,
|
|
5560
|
+
dynamicFeeHookProgram: () => dynamicFeeHookProgram,
|
|
5561
|
+
encodeDynamicFeeCosignerGatePayload: () => encodeDynamicFeeCosignerGatePayload,
|
|
5562
|
+
encodeDynamicFeeHookPayload: () => encodeDynamicFeeHookPayload,
|
|
5563
|
+
encodeDynamicFeeSchedule: () => encodeDynamicFeeSchedule,
|
|
5564
|
+
fetchAllCosignerConfig: () => fetchAllCosignerConfig2,
|
|
5565
|
+
fetchAllMaybeCosignerConfig: () => fetchAllMaybeCosignerConfig2,
|
|
5566
|
+
fetchCosignerConfig: () => fetchCosignerConfig2,
|
|
5567
|
+
fetchMaybeCosignerConfig: () => fetchMaybeCosignerConfig2,
|
|
5568
|
+
getAddCosignerDiscriminatorBytes: () => getAddCosignerDiscriminatorBytes2,
|
|
5569
|
+
getAddCosignerInstruction: () => getAddCosignerInstruction2,
|
|
5570
|
+
getAddCosignerInstructionAsync: () => getAddCosignerInstructionAsync2,
|
|
5571
|
+
getAddCosignerInstructionDataCodec: () => getAddCosignerInstructionDataCodec2,
|
|
5572
|
+
getAddCosignerInstructionDataDecoder: () => getAddCosignerInstructionDataDecoder2,
|
|
5573
|
+
getAddCosignerInstructionDataEncoder: () => getAddCosignerInstructionDataEncoder2,
|
|
5574
|
+
getCosignerArgCodec: () => getCosignerArgCodec2,
|
|
5575
|
+
getCosignerArgDecoder: () => getCosignerArgDecoder2,
|
|
5576
|
+
getCosignerArgEncoder: () => getCosignerArgEncoder2,
|
|
5577
|
+
getCosignerConfigCodec: () => getCosignerConfigCodec2,
|
|
5578
|
+
getCosignerConfigDecoder: () => getCosignerConfigDecoder2,
|
|
5579
|
+
getCosignerConfigDiscriminatorBytes: () => getCosignerConfigDiscriminatorBytes2,
|
|
5580
|
+
getCosignerConfigEncoder: () => getCosignerConfigEncoder2,
|
|
5581
|
+
getCosignerConfigSize: () => getCosignerConfigSize2,
|
|
5582
|
+
getDynamicFeeHookConfigAddress: () => getDynamicFeeHookConfigAddress,
|
|
5583
|
+
getDynamicFeeHookErrorMessage: () => getDynamicFeeHookErrorMessage,
|
|
5584
|
+
getDynamicFeeHookRemainingAccountAddresses: () => getDynamicFeeHookRemainingAccountAddresses,
|
|
5585
|
+
getDynamicFeeHookRemainingAccounts: () => getDynamicFeeHookRemainingAccounts,
|
|
5586
|
+
getInitializeConfigArgsCodec: () => getInitializeConfigArgsCodec3,
|
|
5587
|
+
getInitializeConfigArgsDecoder: () => getInitializeConfigArgsDecoder3,
|
|
5588
|
+
getInitializeConfigArgsEncoder: () => getInitializeConfigArgsEncoder3,
|
|
5589
|
+
getInitializeConfigDiscriminatorBytes: () => getInitializeConfigDiscriminatorBytes3,
|
|
5590
|
+
getInitializeConfigInstruction: () => getInitializeConfigInstruction3,
|
|
5591
|
+
getInitializeConfigInstructionAsync: () => getInitializeConfigInstructionAsync4,
|
|
5592
|
+
getInitializeConfigInstructionDataCodec: () => getInitializeConfigInstructionDataCodec3,
|
|
5593
|
+
getInitializeConfigInstructionDataDecoder: () => getInitializeConfigInstructionDataDecoder3,
|
|
5594
|
+
getInitializeConfigInstructionDataEncoder: () => getInitializeConfigInstructionDataEncoder4,
|
|
5595
|
+
getRemoveCosignerDiscriminatorBytes: () => getRemoveCosignerDiscriminatorBytes2,
|
|
5596
|
+
getRemoveCosignerInstruction: () => getRemoveCosignerInstruction2,
|
|
5597
|
+
getRemoveCosignerInstructionAsync: () => getRemoveCosignerInstructionAsync2,
|
|
5598
|
+
getRemoveCosignerInstructionDataCodec: () => getRemoveCosignerInstructionDataCodec2,
|
|
5599
|
+
getRemoveCosignerInstructionDataDecoder: () => getRemoveCosignerInstructionDataDecoder2,
|
|
5600
|
+
getRemoveCosignerInstructionDataEncoder: () => getRemoveCosignerInstructionDataEncoder2,
|
|
5601
|
+
getSetAuthorityArgsCodec: () => getSetAuthorityArgsCodec2,
|
|
5602
|
+
getSetAuthorityArgsDecoder: () => getSetAuthorityArgsDecoder2,
|
|
5603
|
+
getSetAuthorityArgsEncoder: () => getSetAuthorityArgsEncoder2,
|
|
5604
|
+
getSetAuthorityDiscriminatorBytes: () => getSetAuthorityDiscriminatorBytes2,
|
|
5605
|
+
getSetAuthorityInstruction: () => getSetAuthorityInstruction2,
|
|
5606
|
+
getSetAuthorityInstructionAsync: () => getSetAuthorityInstructionAsync2,
|
|
5607
|
+
getSetAuthorityInstructionDataCodec: () => getSetAuthorityInstructionDataCodec2,
|
|
5608
|
+
getSetAuthorityInstructionDataDecoder: () => getSetAuthorityInstructionDataDecoder2,
|
|
5609
|
+
getSetAuthorityInstructionDataEncoder: () => getSetAuthorityInstructionDataEncoder2,
|
|
5610
|
+
identifyDynamicFeeHookAccount: () => identifyDynamicFeeHookAccount,
|
|
5611
|
+
identifyDynamicFeeHookInstruction: () => identifyDynamicFeeHookInstruction,
|
|
5612
|
+
isDynamicFeeHookError: () => isDynamicFeeHookError,
|
|
5613
|
+
isDynamicFeeSchedulePayload: () => isDynamicFeeSchedulePayload,
|
|
5614
|
+
parseAddCosignerInstruction: () => parseAddCosignerInstruction2,
|
|
5615
|
+
parseDynamicFeeHookInstruction: () => parseDynamicFeeHookInstruction,
|
|
5616
|
+
parseInitializeConfigInstruction: () => parseInitializeConfigInstruction4,
|
|
5617
|
+
parseRemoveCosignerInstruction: () => parseRemoveCosignerInstruction2,
|
|
5618
|
+
parseSetAuthorityInstruction: () => parseSetAuthorityInstruction2,
|
|
5619
|
+
validateDynamicFeeScheduleArgs: () => validateDynamicFeeScheduleArgs
|
|
5651
5620
|
});
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5621
|
+
var COSIGNER_CONFIG_DISCRIMINATOR2 = new Uint8Array([
|
|
5622
|
+
133,
|
|
5623
|
+
227,
|
|
5624
|
+
177,
|
|
5625
|
+
74,
|
|
5626
|
+
145,
|
|
5627
|
+
74,
|
|
5628
|
+
247,
|
|
5629
|
+
183
|
|
5630
|
+
]);
|
|
5631
|
+
function getCosignerConfigDiscriminatorBytes2() {
|
|
5632
|
+
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
5633
|
+
COSIGNER_CONFIG_DISCRIMINATOR2
|
|
5634
|
+
);
|
|
5666
5635
|
}
|
|
5667
|
-
function
|
|
5668
|
-
return kit.
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5636
|
+
function getCosignerConfigEncoder2() {
|
|
5637
|
+
return kit.transformEncoder(
|
|
5638
|
+
kit.getStructEncoder([
|
|
5639
|
+
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
5640
|
+
["adminAuthority", kit.getAddressEncoder()],
|
|
5641
|
+
["cosignerCount", kit.getU8Encoder()],
|
|
5642
|
+
["bump", kit.getU8Encoder()],
|
|
5643
|
+
["version", kit.getU8Encoder()],
|
|
5644
|
+
["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 37)],
|
|
5645
|
+
["cosigners", kit.getArrayEncoder(kit.getAddressEncoder(), { size: 32 })]
|
|
5646
|
+
]),
|
|
5647
|
+
(value) => ({ ...value, discriminator: COSIGNER_CONFIG_DISCRIMINATOR2 })
|
|
5648
|
+
);
|
|
5672
5649
|
}
|
|
5673
|
-
function
|
|
5650
|
+
function getCosignerConfigDecoder2() {
|
|
5674
5651
|
return kit.getStructDecoder([
|
|
5675
|
-
["
|
|
5676
|
-
["
|
|
5652
|
+
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
5653
|
+
["adminAuthority", kit.getAddressDecoder()],
|
|
5654
|
+
["cosignerCount", kit.getU8Decoder()],
|
|
5655
|
+
["bump", kit.getU8Decoder()],
|
|
5656
|
+
["version", kit.getU8Decoder()],
|
|
5657
|
+
["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 37)],
|
|
5658
|
+
["cosigners", kit.getArrayDecoder(kit.getAddressDecoder(), { size: 32 })]
|
|
5677
5659
|
]);
|
|
5678
5660
|
}
|
|
5679
|
-
function
|
|
5680
|
-
return kit.
|
|
5681
|
-
["wallet", kit.getAddressEncoder()],
|
|
5682
|
-
["amount", kit.getU64Encoder()]
|
|
5683
|
-
]);
|
|
5661
|
+
function getCosignerConfigCodec2() {
|
|
5662
|
+
return kit.combineCodec(getCosignerConfigEncoder2(), getCosignerConfigDecoder2());
|
|
5684
5663
|
}
|
|
5685
|
-
function
|
|
5686
|
-
return kit.
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5664
|
+
function decodeCosignerConfig2(encodedAccount) {
|
|
5665
|
+
return kit.decodeAccount(
|
|
5666
|
+
encodedAccount,
|
|
5667
|
+
getCosignerConfigDecoder2()
|
|
5668
|
+
);
|
|
5690
5669
|
}
|
|
5691
|
-
function
|
|
5692
|
-
|
|
5670
|
+
async function fetchCosignerConfig2(rpc, address7, config) {
|
|
5671
|
+
const maybeAccount = await fetchMaybeCosignerConfig2(rpc, address7, config);
|
|
5672
|
+
kit.assertAccountExists(maybeAccount);
|
|
5673
|
+
return maybeAccount;
|
|
5693
5674
|
}
|
|
5694
|
-
function
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
["initialSwapFeeBps", kit.getU16Encoder()],
|
|
5698
|
-
["initialFeeSplitBps", kit.getU16Encoder()],
|
|
5699
|
-
["recipients", kit.getArrayEncoder(getRecipientEncoder())],
|
|
5700
|
-
["minRaiseQuote", kit.getU64Encoder()],
|
|
5701
|
-
["minMigrationPriceQ64Opt", kit.getOptionEncoder(kit.getU128Encoder())],
|
|
5702
|
-
[
|
|
5703
|
-
"migratedPoolHookConfig",
|
|
5704
|
-
kit.getOptionEncoder(getMigratedPoolHookConfigEncoder())
|
|
5705
|
-
]
|
|
5706
|
-
]);
|
|
5675
|
+
async function fetchMaybeCosignerConfig2(rpc, address7, config) {
|
|
5676
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address7, config);
|
|
5677
|
+
return decodeCosignerConfig2(maybeAccount);
|
|
5707
5678
|
}
|
|
5708
|
-
function
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
[
|
|
5717
|
-
"migratedPoolHookConfig",
|
|
5718
|
-
kit.getOptionDecoder(getMigratedPoolHookConfigDecoder())
|
|
5719
|
-
]
|
|
5720
|
-
]);
|
|
5679
|
+
async function fetchAllCosignerConfig2(rpc, addresses, config) {
|
|
5680
|
+
const maybeAccounts = await fetchAllMaybeCosignerConfig2(
|
|
5681
|
+
rpc,
|
|
5682
|
+
addresses,
|
|
5683
|
+
config
|
|
5684
|
+
);
|
|
5685
|
+
kit.assertAccountsExist(maybeAccounts);
|
|
5686
|
+
return maybeAccounts;
|
|
5721
5687
|
}
|
|
5722
|
-
function
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5688
|
+
async function fetchAllMaybeCosignerConfig2(rpc, addresses, config) {
|
|
5689
|
+
const maybeAccounts = await kit.fetchEncodedAccounts(rpc, addresses, config);
|
|
5690
|
+
return maybeAccounts.map(
|
|
5691
|
+
(maybeAccount) => decodeCosignerConfig2(maybeAccount)
|
|
5726
5692
|
);
|
|
5727
5693
|
}
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5694
|
+
function getCosignerConfigSize2() {
|
|
5695
|
+
return 1104;
|
|
5696
|
+
}
|
|
5697
|
+
var ADD_COSIGNER_DISCRIMINATOR2 = new Uint8Array([
|
|
5698
|
+
17,
|
|
5699
|
+
34,
|
|
5700
|
+
183,
|
|
5701
|
+
119,
|
|
5702
|
+
202,
|
|
5733
5703
|
255,
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
248,
|
|
5737
|
-
11,
|
|
5738
|
-
176
|
|
5704
|
+
218,
|
|
5705
|
+
233
|
|
5739
5706
|
]);
|
|
5740
|
-
function
|
|
5707
|
+
function getAddCosignerDiscriminatorBytes2() {
|
|
5708
|
+
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
5709
|
+
ADD_COSIGNER_DISCRIMINATOR2
|
|
5710
|
+
);
|
|
5711
|
+
}
|
|
5712
|
+
function getAddCosignerInstructionDataEncoder2() {
|
|
5741
5713
|
return kit.transformEncoder(
|
|
5742
5714
|
kit.getStructEncoder([
|
|
5743
5715
|
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
5744
|
-
["
|
|
5745
|
-
["admin", kit.getAddressEncoder()],
|
|
5746
|
-
["cpmmConfig", kit.getAddressEncoder()],
|
|
5747
|
-
["initialSwapFeeBps", kit.getU16Encoder()],
|
|
5748
|
-
["initialFeeSplitBps", kit.getU16Encoder()],
|
|
5749
|
-
["pad0", kit.fixEncoderSize(kit.getBytesEncoder(), 4)],
|
|
5750
|
-
["migratedPoolHookProgram", kit.getAddressEncoder()],
|
|
5751
|
-
["migratedPoolHookFlags", kit.getU32Encoder()],
|
|
5752
|
-
["recipients", kit.getArrayEncoder(getRecipientEncoder(), { size: 2 })],
|
|
5753
|
-
["minRaiseQuote", kit.getU64Encoder()],
|
|
5754
|
-
["minMigrationPriceQ64Opt", kit.getOptionEncoder(kit.getU128Encoder())],
|
|
5755
|
-
["isMigrated", kit.getBooleanEncoder()],
|
|
5756
|
-
["bump", kit.getU8Encoder()],
|
|
5757
|
-
["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 14)]
|
|
5716
|
+
["cosigner", kit.getAddressEncoder()]
|
|
5758
5717
|
]),
|
|
5759
|
-
(value) => ({ ...value, discriminator:
|
|
5718
|
+
(value) => ({ ...value, discriminator: ADD_COSIGNER_DISCRIMINATOR2 })
|
|
5760
5719
|
);
|
|
5761
5720
|
}
|
|
5762
|
-
function
|
|
5721
|
+
function getAddCosignerInstructionDataDecoder2() {
|
|
5763
5722
|
return kit.getStructDecoder([
|
|
5764
5723
|
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
5765
|
-
["
|
|
5766
|
-
["admin", kit.getAddressDecoder()],
|
|
5767
|
-
["cpmmConfig", kit.getAddressDecoder()],
|
|
5768
|
-
["initialSwapFeeBps", kit.getU16Decoder()],
|
|
5769
|
-
["initialFeeSplitBps", kit.getU16Decoder()],
|
|
5770
|
-
["pad0", kit.fixDecoderSize(kit.getBytesDecoder(), 4)],
|
|
5771
|
-
["migratedPoolHookProgram", kit.getAddressDecoder()],
|
|
5772
|
-
["migratedPoolHookFlags", kit.getU32Decoder()],
|
|
5773
|
-
["recipients", kit.getArrayDecoder(getRecipientDecoder(), { size: 2 })],
|
|
5774
|
-
["minRaiseQuote", kit.getU64Decoder()],
|
|
5775
|
-
["minMigrationPriceQ64Opt", kit.getOptionDecoder(kit.getU128Decoder())],
|
|
5776
|
-
["isMigrated", kit.getBooleanDecoder()],
|
|
5777
|
-
["bump", kit.getU8Decoder()],
|
|
5778
|
-
["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 14)]
|
|
5724
|
+
["cosigner", kit.getAddressDecoder()]
|
|
5779
5725
|
]);
|
|
5780
5726
|
}
|
|
5781
|
-
function
|
|
5727
|
+
function getAddCosignerInstructionDataCodec2() {
|
|
5782
5728
|
return kit.combineCodec(
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
);
|
|
5786
|
-
}
|
|
5787
|
-
if (process.env.NODE_ENV !== "production") ;
|
|
5788
|
-
|
|
5789
|
-
// src/solana/migrators/cpmmMigrator/client.ts
|
|
5790
|
-
function base64ToBytes2(base64) {
|
|
5791
|
-
const binary = atob(base64);
|
|
5792
|
-
const bytes = new Uint8Array(binary.length);
|
|
5793
|
-
for (let i = 0; i < binary.length; i++) {
|
|
5794
|
-
bytes[i] = binary.charCodeAt(i);
|
|
5795
|
-
}
|
|
5796
|
-
return bytes;
|
|
5797
|
-
}
|
|
5798
|
-
async function fetchCpmmMigratorState(rpc, address4) {
|
|
5799
|
-
const response = await rpc.getAccountInfo(address4, { encoding: "base64" }).send();
|
|
5800
|
-
if (!response.value) return null;
|
|
5801
|
-
return getCpmmMigratorStateDecoder().decode(
|
|
5802
|
-
base64ToBytes2(response.value.data[0])
|
|
5729
|
+
getAddCosignerInstructionDataEncoder2(),
|
|
5730
|
+
getAddCosignerInstructionDataDecoder2()
|
|
5803
5731
|
);
|
|
5804
5732
|
}
|
|
5805
|
-
async function
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5733
|
+
async function getAddCosignerInstructionAsync2(input, config) {
|
|
5734
|
+
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
5735
|
+
const originalAccounts = {
|
|
5736
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
5737
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
5738
|
+
};
|
|
5739
|
+
const accounts = originalAccounts;
|
|
5740
|
+
const args = { ...input };
|
|
5741
|
+
if (!accounts.config.value) {
|
|
5742
|
+
accounts.config.value = await kit.getProgramDerivedAddress({
|
|
5743
|
+
programAddress,
|
|
5744
|
+
seeds: [
|
|
5745
|
+
kit.getBytesEncoder().encode(
|
|
5746
|
+
new Uint8Array([
|
|
5747
|
+
99,
|
|
5748
|
+
111,
|
|
5749
|
+
115,
|
|
5750
|
+
105,
|
|
5751
|
+
103,
|
|
5752
|
+
110,
|
|
5753
|
+
101,
|
|
5754
|
+
114,
|
|
5755
|
+
95,
|
|
5756
|
+
104,
|
|
5757
|
+
111,
|
|
5758
|
+
111,
|
|
5759
|
+
107,
|
|
5760
|
+
95,
|
|
5761
|
+
99,
|
|
5762
|
+
111,
|
|
5763
|
+
110,
|
|
5764
|
+
102,
|
|
5765
|
+
105,
|
|
5766
|
+
103
|
|
5767
|
+
])
|
|
5768
|
+
)
|
|
5769
|
+
]
|
|
5770
|
+
});
|
|
5771
|
+
}
|
|
5772
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
5773
|
+
return Object.freeze({
|
|
5774
|
+
accounts: [
|
|
5775
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
5776
|
+
getAccountMeta("config", accounts.config)
|
|
5777
|
+
],
|
|
5778
|
+
data: getAddCosignerInstructionDataEncoder2().encode(
|
|
5779
|
+
args
|
|
5780
|
+
),
|
|
5781
|
+
programAddress
|
|
5782
|
+
});
|
|
5783
|
+
}
|
|
5784
|
+
function getAddCosignerInstruction2(input, config) {
|
|
5785
|
+
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
5786
|
+
const originalAccounts = {
|
|
5787
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
5788
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
5789
|
+
};
|
|
5790
|
+
const accounts = originalAccounts;
|
|
5791
|
+
const args = { ...input };
|
|
5792
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
5793
|
+
return Object.freeze({
|
|
5794
|
+
accounts: [
|
|
5795
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
5796
|
+
getAccountMeta("config", accounts.config)
|
|
5797
|
+
],
|
|
5798
|
+
data: getAddCosignerInstructionDataEncoder2().encode(
|
|
5799
|
+
args
|
|
5800
|
+
),
|
|
5801
|
+
programAddress
|
|
5802
|
+
});
|
|
5803
|
+
}
|
|
5804
|
+
function parseAddCosignerInstruction2(instruction) {
|
|
5805
|
+
if (instruction.accounts.length < 2) {
|
|
5806
|
+
throw new kit.SolanaError(
|
|
5807
|
+
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
5808
|
+
{
|
|
5809
|
+
actualAccountMetas: instruction.accounts.length,
|
|
5810
|
+
expectedAccountMetas: 2
|
|
5811
|
+
}
|
|
5812
|
+
);
|
|
5813
|
+
}
|
|
5814
|
+
let accountIndex = 0;
|
|
5815
|
+
const getNextAccount = () => {
|
|
5816
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
5817
|
+
accountIndex += 1;
|
|
5818
|
+
return accountMeta;
|
|
5819
|
+
};
|
|
5820
|
+
return {
|
|
5821
|
+
programAddress: instruction.programAddress,
|
|
5822
|
+
accounts: { adminAuthority: getNextAccount(), config: getNextAccount() },
|
|
5823
|
+
data: getAddCosignerInstructionDataDecoder2().decode(instruction.data)
|
|
5824
|
+
};
|
|
5825
|
+
}
|
|
5826
|
+
var INITIALIZE_CONFIG_DISCRIMINATOR4 = new Uint8Array([
|
|
5827
|
+
208,
|
|
5828
|
+
127,
|
|
5829
|
+
21,
|
|
5830
|
+
1,
|
|
5831
|
+
194,
|
|
5832
|
+
190,
|
|
5833
|
+
196,
|
|
5834
|
+
70
|
|
5835
|
+
]);
|
|
5836
|
+
function getInitializeConfigDiscriminatorBytes3() {
|
|
5837
|
+
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
5838
|
+
INITIALIZE_CONFIG_DISCRIMINATOR4
|
|
5839
|
+
);
|
|
5840
|
+
}
|
|
5841
|
+
function getInitializeConfigInstructionDataEncoder4() {
|
|
5842
|
+
return kit.transformEncoder(
|
|
5843
|
+
kit.getStructEncoder([
|
|
5844
|
+
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
5845
|
+
["cosigners", kit.getArrayEncoder(kit.getAddressEncoder())]
|
|
5846
|
+
]),
|
|
5847
|
+
(value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR4 })
|
|
5848
|
+
);
|
|
5849
|
+
}
|
|
5850
|
+
function getInitializeConfigInstructionDataDecoder3() {
|
|
5851
|
+
return kit.getStructDecoder([
|
|
5852
|
+
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
5853
|
+
["cosigners", kit.getArrayDecoder(kit.getAddressDecoder())]
|
|
5854
|
+
]);
|
|
5855
|
+
}
|
|
5856
|
+
function getInitializeConfigInstructionDataCodec3() {
|
|
5857
|
+
return kit.combineCodec(
|
|
5858
|
+
getInitializeConfigInstructionDataEncoder4(),
|
|
5859
|
+
getInitializeConfigInstructionDataDecoder3()
|
|
5860
|
+
);
|
|
5861
|
+
}
|
|
5862
|
+
async function getInitializeConfigInstructionAsync4(input, config) {
|
|
5863
|
+
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
5864
|
+
const originalAccounts = {
|
|
5865
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
5866
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
5867
|
+
config: { value: input.config ?? null, isWritable: true },
|
|
5868
|
+
programData: { value: input.programData ?? null, isWritable: false },
|
|
5869
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
5870
|
+
};
|
|
5871
|
+
const accounts = originalAccounts;
|
|
5872
|
+
const args = { ...input };
|
|
5873
|
+
if (!accounts.config.value) {
|
|
5874
|
+
accounts.config.value = await kit.getProgramDerivedAddress({
|
|
5875
|
+
programAddress,
|
|
5876
|
+
seeds: [
|
|
5877
|
+
kit.getBytesEncoder().encode(
|
|
5878
|
+
new Uint8Array([
|
|
5879
|
+
99,
|
|
5880
|
+
111,
|
|
5881
|
+
115,
|
|
5882
|
+
105,
|
|
5883
|
+
103,
|
|
5884
|
+
110,
|
|
5885
|
+
101,
|
|
5886
|
+
114,
|
|
5887
|
+
95,
|
|
5888
|
+
104,
|
|
5889
|
+
111,
|
|
5890
|
+
111,
|
|
5891
|
+
107,
|
|
5892
|
+
95,
|
|
5893
|
+
99,
|
|
5894
|
+
111,
|
|
5895
|
+
110,
|
|
5896
|
+
102,
|
|
5897
|
+
105,
|
|
5898
|
+
103
|
|
5899
|
+
])
|
|
5900
|
+
)
|
|
5901
|
+
]
|
|
5902
|
+
});
|
|
5903
|
+
}
|
|
5904
|
+
if (!accounts.systemProgram.value) {
|
|
5905
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
5906
|
+
}
|
|
5907
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
5908
|
+
return Object.freeze({
|
|
5909
|
+
accounts: [
|
|
5910
|
+
getAccountMeta("payer", accounts.payer),
|
|
5911
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
5912
|
+
getAccountMeta("config", accounts.config),
|
|
5913
|
+
getAccountMeta("programData", accounts.programData),
|
|
5914
|
+
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
5915
|
+
],
|
|
5916
|
+
data: getInitializeConfigInstructionDataEncoder4().encode(
|
|
5917
|
+
args
|
|
5918
|
+
),
|
|
5919
|
+
programAddress
|
|
5920
|
+
});
|
|
5921
|
+
}
|
|
5922
|
+
function getInitializeConfigInstruction3(input, config) {
|
|
5923
|
+
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
5924
|
+
const originalAccounts = {
|
|
5925
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
5926
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
5927
|
+
config: { value: input.config ?? null, isWritable: true },
|
|
5928
|
+
programData: { value: input.programData ?? null, isWritable: false },
|
|
5929
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
5930
|
+
};
|
|
5931
|
+
const accounts = originalAccounts;
|
|
5932
|
+
const args = { ...input };
|
|
5933
|
+
if (!accounts.systemProgram.value) {
|
|
5934
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
5935
|
+
}
|
|
5936
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
5937
|
+
return Object.freeze({
|
|
5938
|
+
accounts: [
|
|
5939
|
+
getAccountMeta("payer", accounts.payer),
|
|
5940
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
5941
|
+
getAccountMeta("config", accounts.config),
|
|
5942
|
+
getAccountMeta("programData", accounts.programData),
|
|
5943
|
+
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
5944
|
+
],
|
|
5945
|
+
data: getInitializeConfigInstructionDataEncoder4().encode(
|
|
5946
|
+
args
|
|
5947
|
+
),
|
|
5948
|
+
programAddress
|
|
5949
|
+
});
|
|
5950
|
+
}
|
|
5951
|
+
function parseInitializeConfigInstruction4(instruction) {
|
|
5952
|
+
if (instruction.accounts.length < 5) {
|
|
5953
|
+
throw new kit.SolanaError(
|
|
5954
|
+
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
5955
|
+
{
|
|
5956
|
+
actualAccountMetas: instruction.accounts.length,
|
|
5957
|
+
expectedAccountMetas: 5
|
|
5958
|
+
}
|
|
5959
|
+
);
|
|
5960
|
+
}
|
|
5961
|
+
let accountIndex = 0;
|
|
5962
|
+
const getNextAccount = () => {
|
|
5963
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
5964
|
+
accountIndex += 1;
|
|
5965
|
+
return accountMeta;
|
|
5966
|
+
};
|
|
5967
|
+
return {
|
|
5968
|
+
programAddress: instruction.programAddress,
|
|
5969
|
+
accounts: {
|
|
5970
|
+
payer: getNextAccount(),
|
|
5971
|
+
adminAuthority: getNextAccount(),
|
|
5972
|
+
config: getNextAccount(),
|
|
5973
|
+
programData: getNextAccount(),
|
|
5974
|
+
systemProgram: getNextAccount()
|
|
5975
|
+
},
|
|
5976
|
+
data: getInitializeConfigInstructionDataDecoder3().decode(instruction.data)
|
|
5977
|
+
};
|
|
5978
|
+
}
|
|
5979
|
+
var REMOVE_COSIGNER_DISCRIMINATOR2 = new Uint8Array([
|
|
5980
|
+
174,
|
|
5981
|
+
11,
|
|
5982
|
+
171,
|
|
5983
|
+
252,
|
|
5984
|
+
179,
|
|
5985
|
+
99,
|
|
5986
|
+
220,
|
|
5987
|
+
27
|
|
5988
|
+
]);
|
|
5989
|
+
function getRemoveCosignerDiscriminatorBytes2() {
|
|
5990
|
+
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
5991
|
+
REMOVE_COSIGNER_DISCRIMINATOR2
|
|
5992
|
+
);
|
|
5993
|
+
}
|
|
5994
|
+
function getRemoveCosignerInstructionDataEncoder2() {
|
|
5995
|
+
return kit.transformEncoder(
|
|
5996
|
+
kit.getStructEncoder([
|
|
5997
|
+
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
5998
|
+
["cosigner", kit.getAddressEncoder()]
|
|
5999
|
+
]),
|
|
6000
|
+
(value) => ({ ...value, discriminator: REMOVE_COSIGNER_DISCRIMINATOR2 })
|
|
6001
|
+
);
|
|
6002
|
+
}
|
|
6003
|
+
function getRemoveCosignerInstructionDataDecoder2() {
|
|
6004
|
+
return kit.getStructDecoder([
|
|
6005
|
+
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
6006
|
+
["cosigner", kit.getAddressDecoder()]
|
|
6007
|
+
]);
|
|
6008
|
+
}
|
|
6009
|
+
function getRemoveCosignerInstructionDataCodec2() {
|
|
6010
|
+
return kit.combineCodec(
|
|
6011
|
+
getRemoveCosignerInstructionDataEncoder2(),
|
|
6012
|
+
getRemoveCosignerInstructionDataDecoder2()
|
|
6013
|
+
);
|
|
6014
|
+
}
|
|
6015
|
+
async function getRemoveCosignerInstructionAsync2(input, config) {
|
|
6016
|
+
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
6017
|
+
const originalAccounts = {
|
|
6018
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
6019
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
6020
|
+
};
|
|
6021
|
+
const accounts = originalAccounts;
|
|
6022
|
+
const args = { ...input };
|
|
6023
|
+
if (!accounts.config.value) {
|
|
6024
|
+
accounts.config.value = await kit.getProgramDerivedAddress({
|
|
6025
|
+
programAddress,
|
|
6026
|
+
seeds: [
|
|
6027
|
+
kit.getBytesEncoder().encode(
|
|
6028
|
+
new Uint8Array([
|
|
6029
|
+
99,
|
|
6030
|
+
111,
|
|
6031
|
+
115,
|
|
6032
|
+
105,
|
|
6033
|
+
103,
|
|
6034
|
+
110,
|
|
6035
|
+
101,
|
|
6036
|
+
114,
|
|
6037
|
+
95,
|
|
6038
|
+
104,
|
|
6039
|
+
111,
|
|
6040
|
+
111,
|
|
6041
|
+
107,
|
|
6042
|
+
95,
|
|
6043
|
+
99,
|
|
6044
|
+
111,
|
|
6045
|
+
110,
|
|
6046
|
+
102,
|
|
6047
|
+
105,
|
|
6048
|
+
103
|
|
6049
|
+
])
|
|
6050
|
+
)
|
|
6051
|
+
]
|
|
6052
|
+
});
|
|
6053
|
+
}
|
|
6054
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
6055
|
+
return Object.freeze({
|
|
6056
|
+
accounts: [
|
|
6057
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
6058
|
+
getAccountMeta("config", accounts.config)
|
|
6059
|
+
],
|
|
6060
|
+
data: getRemoveCosignerInstructionDataEncoder2().encode(
|
|
6061
|
+
args
|
|
6062
|
+
),
|
|
6063
|
+
programAddress
|
|
6064
|
+
});
|
|
6065
|
+
}
|
|
6066
|
+
function getRemoveCosignerInstruction2(input, config) {
|
|
6067
|
+
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
6068
|
+
const originalAccounts = {
|
|
6069
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
6070
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
6071
|
+
};
|
|
6072
|
+
const accounts = originalAccounts;
|
|
6073
|
+
const args = { ...input };
|
|
6074
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
6075
|
+
return Object.freeze({
|
|
6076
|
+
accounts: [
|
|
6077
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
6078
|
+
getAccountMeta("config", accounts.config)
|
|
6079
|
+
],
|
|
6080
|
+
data: getRemoveCosignerInstructionDataEncoder2().encode(
|
|
6081
|
+
args
|
|
6082
|
+
),
|
|
6083
|
+
programAddress
|
|
6084
|
+
});
|
|
6085
|
+
}
|
|
6086
|
+
function parseRemoveCosignerInstruction2(instruction) {
|
|
6087
|
+
if (instruction.accounts.length < 2) {
|
|
6088
|
+
throw new kit.SolanaError(
|
|
6089
|
+
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
6090
|
+
{
|
|
6091
|
+
actualAccountMetas: instruction.accounts.length,
|
|
6092
|
+
expectedAccountMetas: 2
|
|
6093
|
+
}
|
|
6094
|
+
);
|
|
6095
|
+
}
|
|
6096
|
+
let accountIndex = 0;
|
|
6097
|
+
const getNextAccount = () => {
|
|
6098
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
6099
|
+
accountIndex += 1;
|
|
6100
|
+
return accountMeta;
|
|
6101
|
+
};
|
|
6102
|
+
return {
|
|
6103
|
+
programAddress: instruction.programAddress,
|
|
6104
|
+
accounts: { adminAuthority: getNextAccount(), config: getNextAccount() },
|
|
6105
|
+
data: getRemoveCosignerInstructionDataDecoder2().decode(instruction.data)
|
|
6106
|
+
};
|
|
6107
|
+
}
|
|
6108
|
+
var SET_AUTHORITY_DISCRIMINATOR2 = new Uint8Array([
|
|
6109
|
+
133,
|
|
6110
|
+
250,
|
|
6111
|
+
37,
|
|
6112
|
+
21,
|
|
6113
|
+
110,
|
|
6114
|
+
163,
|
|
6115
|
+
26,
|
|
6116
|
+
121
|
|
6117
|
+
]);
|
|
6118
|
+
function getSetAuthorityDiscriminatorBytes2() {
|
|
6119
|
+
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
6120
|
+
SET_AUTHORITY_DISCRIMINATOR2
|
|
6121
|
+
);
|
|
6122
|
+
}
|
|
6123
|
+
function getSetAuthorityInstructionDataEncoder2() {
|
|
6124
|
+
return kit.transformEncoder(
|
|
6125
|
+
kit.getStructEncoder([
|
|
6126
|
+
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
6127
|
+
["adminAuthority", kit.getAddressEncoder()]
|
|
6128
|
+
]),
|
|
6129
|
+
(value) => ({ ...value, discriminator: SET_AUTHORITY_DISCRIMINATOR2 })
|
|
6130
|
+
);
|
|
6131
|
+
}
|
|
6132
|
+
function getSetAuthorityInstructionDataDecoder2() {
|
|
6133
|
+
return kit.getStructDecoder([
|
|
6134
|
+
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
6135
|
+
["adminAuthority", kit.getAddressDecoder()]
|
|
6136
|
+
]);
|
|
6137
|
+
}
|
|
6138
|
+
function getSetAuthorityInstructionDataCodec2() {
|
|
6139
|
+
return kit.combineCodec(
|
|
6140
|
+
getSetAuthorityInstructionDataEncoder2(),
|
|
6141
|
+
getSetAuthorityInstructionDataDecoder2()
|
|
6142
|
+
);
|
|
6143
|
+
}
|
|
6144
|
+
async function getSetAuthorityInstructionAsync2(input, config) {
|
|
6145
|
+
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
6146
|
+
const originalAccounts = {
|
|
6147
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
6148
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
6149
|
+
};
|
|
6150
|
+
const accounts = originalAccounts;
|
|
6151
|
+
const args = { ...input, adminAuthority: input.adminAuthorityArg };
|
|
6152
|
+
if (!accounts.config.value) {
|
|
6153
|
+
accounts.config.value = await kit.getProgramDerivedAddress({
|
|
6154
|
+
programAddress,
|
|
6155
|
+
seeds: [
|
|
6156
|
+
kit.getBytesEncoder().encode(
|
|
6157
|
+
new Uint8Array([
|
|
6158
|
+
99,
|
|
6159
|
+
111,
|
|
6160
|
+
115,
|
|
6161
|
+
105,
|
|
6162
|
+
103,
|
|
6163
|
+
110,
|
|
6164
|
+
101,
|
|
6165
|
+
114,
|
|
6166
|
+
95,
|
|
6167
|
+
104,
|
|
6168
|
+
111,
|
|
6169
|
+
111,
|
|
6170
|
+
107,
|
|
6171
|
+
95,
|
|
6172
|
+
99,
|
|
6173
|
+
111,
|
|
6174
|
+
110,
|
|
6175
|
+
102,
|
|
6176
|
+
105,
|
|
6177
|
+
103
|
|
6178
|
+
])
|
|
6179
|
+
)
|
|
6180
|
+
]
|
|
6181
|
+
});
|
|
6182
|
+
}
|
|
6183
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
6184
|
+
return Object.freeze({
|
|
6185
|
+
accounts: [
|
|
6186
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
6187
|
+
getAccountMeta("config", accounts.config)
|
|
6188
|
+
],
|
|
6189
|
+
data: getSetAuthorityInstructionDataEncoder2().encode(
|
|
6190
|
+
args
|
|
6191
|
+
),
|
|
6192
|
+
programAddress
|
|
6193
|
+
});
|
|
6194
|
+
}
|
|
6195
|
+
function getSetAuthorityInstruction2(input, config) {
|
|
6196
|
+
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
6197
|
+
const originalAccounts = {
|
|
6198
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
6199
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
6200
|
+
};
|
|
6201
|
+
const accounts = originalAccounts;
|
|
6202
|
+
const args = { ...input, adminAuthority: input.adminAuthorityArg };
|
|
6203
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
6204
|
+
return Object.freeze({
|
|
6205
|
+
accounts: [
|
|
6206
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
6207
|
+
getAccountMeta("config", accounts.config)
|
|
6208
|
+
],
|
|
6209
|
+
data: getSetAuthorityInstructionDataEncoder2().encode(
|
|
6210
|
+
args
|
|
6211
|
+
),
|
|
6212
|
+
programAddress
|
|
6213
|
+
});
|
|
6214
|
+
}
|
|
6215
|
+
function parseSetAuthorityInstruction2(instruction) {
|
|
6216
|
+
if (instruction.accounts.length < 2) {
|
|
6217
|
+
throw new kit.SolanaError(
|
|
6218
|
+
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
6219
|
+
{
|
|
6220
|
+
actualAccountMetas: instruction.accounts.length,
|
|
6221
|
+
expectedAccountMetas: 2
|
|
6222
|
+
}
|
|
6223
|
+
);
|
|
6224
|
+
}
|
|
6225
|
+
let accountIndex = 0;
|
|
6226
|
+
const getNextAccount = () => {
|
|
6227
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
6228
|
+
accountIndex += 1;
|
|
6229
|
+
return accountMeta;
|
|
6230
|
+
};
|
|
6231
|
+
return {
|
|
6232
|
+
programAddress: instruction.programAddress,
|
|
6233
|
+
accounts: { adminAuthority: getNextAccount(), config: getNextAccount() },
|
|
6234
|
+
data: getSetAuthorityInstructionDataDecoder2().decode(instruction.data)
|
|
6235
|
+
};
|
|
6236
|
+
}
|
|
6237
|
+
|
|
6238
|
+
// src/solana/generated/dynamicFeeHook/programs/dynamicFeeHook.ts
|
|
6239
|
+
var DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS = "HVsPNZh98TgChUXHwKrUG47SUqvGQHxUy5wZwcQLFD4i";
|
|
6240
|
+
var DynamicFeeHookAccount = /* @__PURE__ */ ((DynamicFeeHookAccount2) => {
|
|
6241
|
+
DynamicFeeHookAccount2[DynamicFeeHookAccount2["CosignerConfig"] = 0] = "CosignerConfig";
|
|
6242
|
+
return DynamicFeeHookAccount2;
|
|
6243
|
+
})(DynamicFeeHookAccount || {});
|
|
6244
|
+
function identifyDynamicFeeHookAccount(account) {
|
|
6245
|
+
const data = "data" in account ? account.data : account;
|
|
6246
|
+
if (kit.containsBytes(
|
|
6247
|
+
data,
|
|
6248
|
+
kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
6249
|
+
new Uint8Array([133, 227, 177, 74, 145, 74, 247, 183])
|
|
6250
|
+
),
|
|
6251
|
+
0
|
|
6252
|
+
)) {
|
|
6253
|
+
return 0 /* CosignerConfig */;
|
|
6254
|
+
}
|
|
6255
|
+
throw new kit.SolanaError(
|
|
6256
|
+
kit.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT,
|
|
6257
|
+
{ accountData: data, programName: "dynamicFeeHook" }
|
|
6258
|
+
);
|
|
6259
|
+
}
|
|
6260
|
+
var DynamicFeeHookInstruction = /* @__PURE__ */ ((DynamicFeeHookInstruction2) => {
|
|
6261
|
+
DynamicFeeHookInstruction2[DynamicFeeHookInstruction2["AddCosigner"] = 0] = "AddCosigner";
|
|
6262
|
+
DynamicFeeHookInstruction2[DynamicFeeHookInstruction2["InitializeConfig"] = 1] = "InitializeConfig";
|
|
6263
|
+
DynamicFeeHookInstruction2[DynamicFeeHookInstruction2["RemoveCosigner"] = 2] = "RemoveCosigner";
|
|
6264
|
+
DynamicFeeHookInstruction2[DynamicFeeHookInstruction2["SetAuthority"] = 3] = "SetAuthority";
|
|
6265
|
+
return DynamicFeeHookInstruction2;
|
|
6266
|
+
})(DynamicFeeHookInstruction || {});
|
|
6267
|
+
function identifyDynamicFeeHookInstruction(instruction) {
|
|
6268
|
+
const data = "data" in instruction ? instruction.data : instruction;
|
|
6269
|
+
if (kit.containsBytes(
|
|
6270
|
+
data,
|
|
6271
|
+
kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
6272
|
+
new Uint8Array([17, 34, 183, 119, 202, 255, 218, 233])
|
|
6273
|
+
),
|
|
6274
|
+
0
|
|
6275
|
+
)) {
|
|
6276
|
+
return 0 /* AddCosigner */;
|
|
6277
|
+
}
|
|
6278
|
+
if (kit.containsBytes(
|
|
6279
|
+
data,
|
|
6280
|
+
kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
6281
|
+
new Uint8Array([208, 127, 21, 1, 194, 190, 196, 70])
|
|
6282
|
+
),
|
|
6283
|
+
0
|
|
6284
|
+
)) {
|
|
6285
|
+
return 1 /* InitializeConfig */;
|
|
6286
|
+
}
|
|
6287
|
+
if (kit.containsBytes(
|
|
6288
|
+
data,
|
|
6289
|
+
kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
6290
|
+
new Uint8Array([174, 11, 171, 252, 179, 99, 220, 27])
|
|
6291
|
+
),
|
|
6292
|
+
0
|
|
6293
|
+
)) {
|
|
6294
|
+
return 2 /* RemoveCosigner */;
|
|
6295
|
+
}
|
|
6296
|
+
if (kit.containsBytes(
|
|
6297
|
+
data,
|
|
6298
|
+
kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
6299
|
+
new Uint8Array([133, 250, 37, 21, 110, 163, 26, 121])
|
|
6300
|
+
),
|
|
6301
|
+
0
|
|
6302
|
+
)) {
|
|
6303
|
+
return 3 /* SetAuthority */;
|
|
6304
|
+
}
|
|
6305
|
+
throw new kit.SolanaError(
|
|
6306
|
+
kit.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
|
|
6307
|
+
{ instructionData: data, programName: "dynamicFeeHook" }
|
|
6308
|
+
);
|
|
6309
|
+
}
|
|
6310
|
+
function parseDynamicFeeHookInstruction(instruction) {
|
|
6311
|
+
const instructionType = identifyDynamicFeeHookInstruction(instruction);
|
|
6312
|
+
switch (instructionType) {
|
|
6313
|
+
case 0 /* AddCosigner */: {
|
|
6314
|
+
kit.assertIsInstructionWithAccounts(instruction);
|
|
6315
|
+
return {
|
|
6316
|
+
instructionType: 0 /* AddCosigner */,
|
|
6317
|
+
...parseAddCosignerInstruction2(instruction)
|
|
6318
|
+
};
|
|
6319
|
+
}
|
|
6320
|
+
case 1 /* InitializeConfig */: {
|
|
6321
|
+
kit.assertIsInstructionWithAccounts(instruction);
|
|
6322
|
+
return {
|
|
6323
|
+
instructionType: 1 /* InitializeConfig */,
|
|
6324
|
+
...parseInitializeConfigInstruction4(instruction)
|
|
6325
|
+
};
|
|
6326
|
+
}
|
|
6327
|
+
case 2 /* RemoveCosigner */: {
|
|
6328
|
+
kit.assertIsInstructionWithAccounts(instruction);
|
|
6329
|
+
return {
|
|
6330
|
+
instructionType: 2 /* RemoveCosigner */,
|
|
6331
|
+
...parseRemoveCosignerInstruction2(instruction)
|
|
6332
|
+
};
|
|
6333
|
+
}
|
|
6334
|
+
case 3 /* SetAuthority */: {
|
|
6335
|
+
kit.assertIsInstructionWithAccounts(instruction);
|
|
6336
|
+
return {
|
|
6337
|
+
instructionType: 3 /* SetAuthority */,
|
|
6338
|
+
...parseSetAuthorityInstruction2(instruction)
|
|
6339
|
+
};
|
|
6340
|
+
}
|
|
6341
|
+
default:
|
|
6342
|
+
throw new kit.SolanaError(
|
|
6343
|
+
kit.SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
|
|
6344
|
+
{
|
|
6345
|
+
instructionType,
|
|
6346
|
+
programName: "dynamicFeeHook"
|
|
6347
|
+
}
|
|
6348
|
+
);
|
|
6349
|
+
}
|
|
6350
|
+
}
|
|
6351
|
+
function dynamicFeeHookProgram() {
|
|
6352
|
+
return (client) => {
|
|
6353
|
+
return {
|
|
6354
|
+
...client,
|
|
6355
|
+
dynamicFeeHook: {
|
|
6356
|
+
accounts: {
|
|
6357
|
+
cosignerConfig: programClientCore.addSelfFetchFunctions(
|
|
6358
|
+
client,
|
|
6359
|
+
getCosignerConfigCodec2()
|
|
6360
|
+
)
|
|
6361
|
+
},
|
|
6362
|
+
instructions: {
|
|
6363
|
+
addCosigner: (input) => programClientCore.addSelfPlanAndSendFunctions(
|
|
6364
|
+
client,
|
|
6365
|
+
getAddCosignerInstructionAsync2(input)
|
|
6366
|
+
),
|
|
6367
|
+
initializeConfig: (input) => programClientCore.addSelfPlanAndSendFunctions(
|
|
6368
|
+
client,
|
|
6369
|
+
getInitializeConfigInstructionAsync4({
|
|
6370
|
+
...input,
|
|
6371
|
+
payer: input.payer ?? client.payer
|
|
6372
|
+
})
|
|
6373
|
+
),
|
|
6374
|
+
removeCosigner: (input) => programClientCore.addSelfPlanAndSendFunctions(
|
|
6375
|
+
client,
|
|
6376
|
+
getRemoveCosignerInstructionAsync2(input)
|
|
6377
|
+
),
|
|
6378
|
+
setAuthority: (input) => programClientCore.addSelfPlanAndSendFunctions(
|
|
6379
|
+
client,
|
|
6380
|
+
getSetAuthorityInstructionAsync2(input)
|
|
6381
|
+
)
|
|
6382
|
+
}
|
|
6383
|
+
}
|
|
6384
|
+
};
|
|
6385
|
+
};
|
|
6386
|
+
}
|
|
6387
|
+
|
|
6388
|
+
// src/solana/generated/dynamicFeeHook/errors/dynamicFeeHook.ts
|
|
6389
|
+
var DYNAMIC_FEE_HOOK_ERROR__INVALID_INSTRUCTION_DATA = 6e3;
|
|
6390
|
+
var DYNAMIC_FEE_HOOK_ERROR__INVALID_SCHEDULE_DATA = 6001;
|
|
6391
|
+
var DYNAMIC_FEE_HOOK_ERROR__INVALID_FEE = 6002;
|
|
6392
|
+
var DYNAMIC_FEE_HOOK_ERROR__INVALID_DURATION = 6003;
|
|
6393
|
+
var DYNAMIC_FEE_HOOK_ERROR__ARITHMETIC_OVERFLOW = 6004;
|
|
6394
|
+
var DYNAMIC_FEE_HOOK_ERROR__INVALID_AUTHORITY = 6005;
|
|
6395
|
+
var DYNAMIC_FEE_HOOK_ERROR__INVALID_CONFIG = 6006;
|
|
6396
|
+
var DYNAMIC_FEE_HOOK_ERROR__INVALID_COSIGNER = 6007;
|
|
6397
|
+
var DYNAMIC_FEE_HOOK_ERROR__COSIGNER_ALREADY_EXISTS = 6008;
|
|
6398
|
+
var DYNAMIC_FEE_HOOK_ERROR__COSIGNER_NOT_FOUND = 6009;
|
|
6399
|
+
var DYNAMIC_FEE_HOOK_ERROR__COSIGNER_LIST_FULL = 6010;
|
|
6400
|
+
var dynamicFeeHookErrorMessages;
|
|
6401
|
+
if (process.env.NODE_ENV !== "production") {
|
|
6402
|
+
dynamicFeeHookErrorMessages = {
|
|
6403
|
+
[DYNAMIC_FEE_HOOK_ERROR__ARITHMETIC_OVERFLOW]: `Arithmetic overflow`,
|
|
6404
|
+
[DYNAMIC_FEE_HOOK_ERROR__COSIGNER_ALREADY_EXISTS]: `Cosigner already exists`,
|
|
6405
|
+
[DYNAMIC_FEE_HOOK_ERROR__COSIGNER_LIST_FULL]: `Cosigner list is full`,
|
|
6406
|
+
[DYNAMIC_FEE_HOOK_ERROR__COSIGNER_NOT_FOUND]: `Cosigner not found`,
|
|
6407
|
+
[DYNAMIC_FEE_HOOK_ERROR__INVALID_AUTHORITY]: `Invalid hook authority`,
|
|
6408
|
+
[DYNAMIC_FEE_HOOK_ERROR__INVALID_CONFIG]: `Invalid cosigner hook config`,
|
|
6409
|
+
[DYNAMIC_FEE_HOOK_ERROR__INVALID_COSIGNER]: `Invalid cosigner key`,
|
|
6410
|
+
[DYNAMIC_FEE_HOOK_ERROR__INVALID_DURATION]: `Invalid fee duration`,
|
|
6411
|
+
[DYNAMIC_FEE_HOOK_ERROR__INVALID_FEE]: `Invalid fee`,
|
|
6412
|
+
[DYNAMIC_FEE_HOOK_ERROR__INVALID_INSTRUCTION_DATA]: `Invalid instruction data`,
|
|
6413
|
+
[DYNAMIC_FEE_HOOK_ERROR__INVALID_SCHEDULE_DATA]: `Invalid schedule payload`
|
|
6414
|
+
};
|
|
6415
|
+
}
|
|
6416
|
+
function getDynamicFeeHookErrorMessage(code) {
|
|
6417
|
+
if (process.env.NODE_ENV !== "production") {
|
|
6418
|
+
return dynamicFeeHookErrorMessages[code];
|
|
6419
|
+
}
|
|
6420
|
+
return "Error message not available in production bundles.";
|
|
6421
|
+
}
|
|
6422
|
+
function isDynamicFeeHookError(error, transactionMessage, code) {
|
|
6423
|
+
return kit.isProgramError(
|
|
6424
|
+
error,
|
|
6425
|
+
transactionMessage,
|
|
6426
|
+
DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS,
|
|
6427
|
+
code
|
|
6428
|
+
);
|
|
6429
|
+
}
|
|
6430
|
+
function getCosignerArgEncoder2() {
|
|
6431
|
+
return kit.getStructEncoder([["cosigner", kit.getAddressEncoder()]]);
|
|
6432
|
+
}
|
|
6433
|
+
function getCosignerArgDecoder2() {
|
|
6434
|
+
return kit.getStructDecoder([["cosigner", kit.getAddressDecoder()]]);
|
|
6435
|
+
}
|
|
6436
|
+
function getCosignerArgCodec2() {
|
|
6437
|
+
return kit.combineCodec(getCosignerArgEncoder2(), getCosignerArgDecoder2());
|
|
6438
|
+
}
|
|
6439
|
+
function getInitializeConfigArgsEncoder3() {
|
|
6440
|
+
return kit.getStructEncoder([
|
|
6441
|
+
["cosigners", kit.getArrayEncoder(kit.getAddressEncoder())]
|
|
6442
|
+
]);
|
|
6443
|
+
}
|
|
6444
|
+
function getInitializeConfigArgsDecoder3() {
|
|
6445
|
+
return kit.getStructDecoder([
|
|
6446
|
+
["cosigners", kit.getArrayDecoder(kit.getAddressDecoder())]
|
|
6447
|
+
]);
|
|
6448
|
+
}
|
|
6449
|
+
function getInitializeConfigArgsCodec3() {
|
|
6450
|
+
return kit.combineCodec(
|
|
6451
|
+
getInitializeConfigArgsEncoder3(),
|
|
6452
|
+
getInitializeConfigArgsDecoder3()
|
|
6453
|
+
);
|
|
6454
|
+
}
|
|
6455
|
+
function getSetAuthorityArgsEncoder2() {
|
|
6456
|
+
return kit.getStructEncoder([["adminAuthority", kit.getAddressEncoder()]]);
|
|
6457
|
+
}
|
|
6458
|
+
function getSetAuthorityArgsDecoder2() {
|
|
6459
|
+
return kit.getStructDecoder([["adminAuthority", kit.getAddressDecoder()]]);
|
|
6460
|
+
}
|
|
6461
|
+
function getSetAuthorityArgsCodec2() {
|
|
6462
|
+
return kit.combineCodec(
|
|
6463
|
+
getSetAuthorityArgsEncoder2(),
|
|
6464
|
+
getSetAuthorityArgsDecoder2()
|
|
6465
|
+
);
|
|
6466
|
+
}
|
|
6467
|
+
var DEVNET_DYNAMIC_FEE_HOOK_PROGRAM_ID = kit.address(
|
|
6468
|
+
"HVsPNZh98TgChUXHwKrUG47SUqvGQHxUy5wZwcQLFD4i"
|
|
6469
|
+
);
|
|
6470
|
+
var DYNAMIC_FEE_HOOK_PROGRAM_ID = DEVNET_DYNAMIC_FEE_HOOK_PROGRAM_ID;
|
|
6471
|
+
var SEED_DYNAMIC_FEE_HOOK_CONFIG = "cosigner_hook_config";
|
|
6472
|
+
var MAX_COSIGNERS2 = 32;
|
|
6473
|
+
var DYNAMIC_FEE_SCHEDULE_MAGIC = new Uint8Array([
|
|
6474
|
+
68,
|
|
6475
|
+
70,
|
|
6476
|
+
69,
|
|
6477
|
+
69,
|
|
6478
|
+
86,
|
|
6479
|
+
49,
|
|
6480
|
+
95,
|
|
6481
|
+
95
|
|
6482
|
+
]);
|
|
6483
|
+
var DYNAMIC_FEE_SCHEDULE_VERSION = 1;
|
|
6484
|
+
var DYNAMIC_FEE_SCHEDULE_LEN = 32;
|
|
6485
|
+
var DYNAMIC_FEE_SCHEDULE_HEADER_LEN = 16;
|
|
6486
|
+
var DYNAMIC_FEE_SCHEDULE_MAX_BPS = 1e4;
|
|
6487
|
+
|
|
6488
|
+
// src/solana/dynamicFeeHook/payload.ts
|
|
6489
|
+
var MAX_I64 = (1n << 63n) - 1n;
|
|
6490
|
+
var MAX_U32 = (1n << 32n) - 1n;
|
|
6491
|
+
function toBigInt2(value) {
|
|
6492
|
+
return typeof value === "bigint" ? value : BigInt(value);
|
|
6493
|
+
}
|
|
6494
|
+
function assertU16Bps(label, value) {
|
|
6495
|
+
if (!Number.isInteger(value) || value < 0 || value > DYNAMIC_FEE_SCHEDULE_MAX_BPS) {
|
|
6496
|
+
throw new Error(`${label} must be an integer between 0 and 10000`);
|
|
6497
|
+
}
|
|
6498
|
+
}
|
|
6499
|
+
function writeI64Le(bytes, offset, value) {
|
|
6500
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
6501
|
+
view.setBigInt64(offset, value, true);
|
|
6502
|
+
}
|
|
6503
|
+
function writeU16Le(bytes, offset, value) {
|
|
6504
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
6505
|
+
view.setUint16(offset, value, true);
|
|
6506
|
+
}
|
|
6507
|
+
function writeU32Le(bytes, offset, value) {
|
|
6508
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
6509
|
+
view.setUint32(offset, Number(value), true);
|
|
6510
|
+
}
|
|
6511
|
+
function validateDynamicFeeScheduleArgs(schedule) {
|
|
6512
|
+
const startingTime = toBigInt2(schedule.startingTime);
|
|
6513
|
+
if (startingTime < 0n || startingTime > MAX_I64) {
|
|
6514
|
+
throw new Error("startingTime must be between 0 and i64::MAX");
|
|
6515
|
+
}
|
|
6516
|
+
assertU16Bps("startFeeBps", schedule.startFeeBps);
|
|
6517
|
+
assertU16Bps("endFeeBps", schedule.endFeeBps);
|
|
6518
|
+
if (schedule.endFeeBps > schedule.startFeeBps) {
|
|
6519
|
+
throw new Error("endFeeBps must be less than or equal to startFeeBps");
|
|
6520
|
+
}
|
|
6521
|
+
const durationSeconds = toBigInt2(schedule.durationSeconds);
|
|
6522
|
+
if (durationSeconds < 0n || durationSeconds > MAX_U32) {
|
|
6523
|
+
throw new Error("durationSeconds must be between 0 and u32::MAX");
|
|
6524
|
+
}
|
|
6525
|
+
if (schedule.startFeeBps > schedule.endFeeBps && durationSeconds === 0n) {
|
|
6526
|
+
throw new Error("durationSeconds must be nonzero for decaying schedules");
|
|
6527
|
+
}
|
|
6528
|
+
return { startingTime, durationSeconds };
|
|
6529
|
+
}
|
|
6530
|
+
function encodeDynamicFeeSchedule(schedule) {
|
|
6531
|
+
const { startingTime, durationSeconds } = validateDynamicFeeScheduleArgs(schedule);
|
|
6532
|
+
const payload = new Uint8Array(DYNAMIC_FEE_SCHEDULE_LEN);
|
|
6533
|
+
payload.set(DYNAMIC_FEE_SCHEDULE_MAGIC, 0);
|
|
6534
|
+
payload[8] = DYNAMIC_FEE_SCHEDULE_VERSION;
|
|
6535
|
+
writeI64Le(payload, DYNAMIC_FEE_SCHEDULE_HEADER_LEN, startingTime);
|
|
6536
|
+
writeU16Le(payload, 24, schedule.startFeeBps);
|
|
6537
|
+
writeU16Le(payload, 26, schedule.endFeeBps);
|
|
6538
|
+
writeU32Le(payload, 28, durationSeconds);
|
|
6539
|
+
return payload;
|
|
6540
|
+
}
|
|
6541
|
+
function encodeDynamicFeeHookPayload(args = {}) {
|
|
6542
|
+
const schedulePayload = args.schedule ? encodeDynamicFeeSchedule(args.schedule) : new Uint8Array();
|
|
6543
|
+
const gatePayload = args.gateExpiry ? encodeCosignerGateExpiryPayload(args.gateExpiry) : new Uint8Array();
|
|
6544
|
+
const payload = new Uint8Array(schedulePayload.length + gatePayload.length);
|
|
6545
|
+
payload.set(schedulePayload, 0);
|
|
6546
|
+
payload.set(gatePayload, schedulePayload.length);
|
|
6547
|
+
return payload;
|
|
6548
|
+
}
|
|
6549
|
+
function encodeDynamicFeeCosignerGatePayload(args) {
|
|
6550
|
+
return encodeCosignerGateExpiryPayload(args);
|
|
6551
|
+
}
|
|
6552
|
+
function getDynamicFeeHookRemainingAccounts({
|
|
6553
|
+
namespace,
|
|
6554
|
+
config,
|
|
6555
|
+
cosigner
|
|
6556
|
+
}) {
|
|
6557
|
+
const signedHookRemainingAccounts = [namespace];
|
|
6558
|
+
if (config && config !== namespace) {
|
|
6559
|
+
signedHookRemainingAccounts.push(config);
|
|
6560
|
+
}
|
|
6561
|
+
if (cosigner) {
|
|
6562
|
+
signedHookRemainingAccounts.push(cosigner);
|
|
6563
|
+
}
|
|
6564
|
+
const unsignedHookRemainingAccounts = signedHookRemainingAccounts.map(
|
|
6565
|
+
chunk4WY5GNZD_cjs.getAddressFromRemainingAccount
|
|
6566
|
+
);
|
|
6567
|
+
return {
|
|
6568
|
+
signedHookRemainingAccounts,
|
|
6569
|
+
unsignedHookRemainingAccounts,
|
|
6570
|
+
hookRemainingAccountsHash: computeRemainingAccountsHash(
|
|
6571
|
+
unsignedHookRemainingAccounts
|
|
6572
|
+
)
|
|
6573
|
+
};
|
|
6574
|
+
}
|
|
6575
|
+
function getDynamicFeeHookRemainingAccountAddresses({
|
|
6576
|
+
namespace,
|
|
6577
|
+
config,
|
|
6578
|
+
cosigner
|
|
6579
|
+
}) {
|
|
6580
|
+
return getDynamicFeeHookRemainingAccounts({
|
|
6581
|
+
namespace,
|
|
6582
|
+
config,
|
|
6583
|
+
cosigner
|
|
6584
|
+
}).unsignedHookRemainingAccounts;
|
|
6585
|
+
}
|
|
6586
|
+
function isDynamicFeeSchedulePayload(payload) {
|
|
6587
|
+
return payload.length >= DYNAMIC_FEE_SCHEDULE_LEN && DYNAMIC_FEE_SCHEDULE_MAGIC.every((byte, index) => payload[index] === byte);
|
|
6588
|
+
}
|
|
6589
|
+
var textEncoder6 = new TextEncoder();
|
|
6590
|
+
async function getDynamicFeeHookConfigAddress(programId = DYNAMIC_FEE_HOOK_PROGRAM_ID) {
|
|
6591
|
+
return kit.getProgramDerivedAddress({
|
|
6592
|
+
programAddress: programId,
|
|
6593
|
+
seeds: [textEncoder6.encode(SEED_DYNAMIC_FEE_HOOK_CONFIG)]
|
|
6594
|
+
});
|
|
6595
|
+
}
|
|
6596
|
+
|
|
6597
|
+
// src/solana/migrators/cpmmMigrator/index.ts
|
|
6598
|
+
var cpmmMigrator_exports = {};
|
|
6599
|
+
chunkQ7SFCCGT_cjs.__export(cpmmMigrator_exports, {
|
|
6600
|
+
CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS: () => CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS,
|
|
6601
|
+
CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS: () => CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS,
|
|
6602
|
+
CPMM_MIGRATOR_PROGRAM_ID: () => CPMM_MIGRATOR_PROGRAM_ID,
|
|
6603
|
+
MAX_RECIPIENTS: () => MAX_RECIPIENTS,
|
|
6604
|
+
SEED_MIGRATION_AUTHORITY: () => SEED_MIGRATION_AUTHORITY,
|
|
6605
|
+
SEED_STATE: () => SEED_STATE,
|
|
6606
|
+
buildCpmmMigrationRemainingAccounts: () => buildCpmmMigrationRemainingAccounts,
|
|
6607
|
+
buildCpmmMigrationRemainingAccountsHash: () => buildCpmmMigrationRemainingAccountsHash,
|
|
6608
|
+
encodeMigratePayload: () => encodeMigratePayload,
|
|
6609
|
+
encodeRegisterLaunchPayload: () => encodeRegisterLaunchPayload,
|
|
6610
|
+
fetchCpmmMigratorState: () => fetchCpmmMigratorState,
|
|
6611
|
+
getCpmmMigrationAuthorityAddress: () => getCpmmMigrationAuthorityAddress,
|
|
6612
|
+
getCpmmMigratorStateAddress: () => getCpmmMigratorStateAddress,
|
|
6613
|
+
getCpmmMigratorStateCodec: () => getCpmmMigratorStateCodec,
|
|
6614
|
+
getCpmmMigratorStateDecoder: () => getCpmmMigratorStateDecoder,
|
|
6615
|
+
getCpmmMigratorStateEncoder: () => getCpmmMigratorStateEncoder,
|
|
6616
|
+
getMigrateArgsCodec: () => getMigrateArgsCodec,
|
|
6617
|
+
getMigrateArgsDecoder: () => getMigrateArgsDecoder,
|
|
6618
|
+
getMigrateArgsEncoder: () => getMigrateArgsEncoder,
|
|
6619
|
+
getRecipientCodec: () => getRecipientCodec,
|
|
6620
|
+
getRecipientDecoder: () => getRecipientDecoder,
|
|
6621
|
+
getRecipientEncoder: () => getRecipientEncoder,
|
|
6622
|
+
getRegisterLaunchArgsCodec: () => getRegisterLaunchArgsCodec,
|
|
6623
|
+
getRegisterLaunchArgsDecoder: () => getRegisterLaunchArgsDecoder,
|
|
6624
|
+
getRegisterLaunchArgsEncoder: () => getRegisterLaunchArgsEncoder
|
|
6625
|
+
});
|
|
6626
|
+
function getMigrateArgsEncoder() {
|
|
6627
|
+
return kit.getStructEncoder([
|
|
6628
|
+
["baseForDistribution", kit.getU64Encoder()],
|
|
6629
|
+
["baseForLiquidity", kit.getU64Encoder()]
|
|
6630
|
+
]);
|
|
6631
|
+
}
|
|
6632
|
+
function getMigrateArgsDecoder() {
|
|
6633
|
+
return kit.getStructDecoder([
|
|
6634
|
+
["baseForDistribution", kit.getU64Decoder()],
|
|
6635
|
+
["baseForLiquidity", kit.getU64Decoder()]
|
|
6636
|
+
]);
|
|
6637
|
+
}
|
|
6638
|
+
function getMigrateArgsCodec() {
|
|
6639
|
+
return kit.combineCodec(getMigrateArgsEncoder(), getMigrateArgsDecoder());
|
|
6640
|
+
}
|
|
6641
|
+
function getMigratedPoolHookConfigEncoder() {
|
|
6642
|
+
return kit.getStructEncoder([
|
|
6643
|
+
["hookProgram", kit.getAddressEncoder()],
|
|
6644
|
+
["hookFlags", kit.getU32Encoder()]
|
|
6645
|
+
]);
|
|
6646
|
+
}
|
|
6647
|
+
function getMigratedPoolHookConfigDecoder() {
|
|
6648
|
+
return kit.getStructDecoder([
|
|
6649
|
+
["hookProgram", kit.getAddressDecoder()],
|
|
6650
|
+
["hookFlags", kit.getU32Decoder()]
|
|
6651
|
+
]);
|
|
6652
|
+
}
|
|
6653
|
+
function getRecipientEncoder() {
|
|
6654
|
+
return kit.getStructEncoder([
|
|
6655
|
+
["wallet", kit.getAddressEncoder()],
|
|
6656
|
+
["amount", kit.getU64Encoder()]
|
|
6657
|
+
]);
|
|
6658
|
+
}
|
|
6659
|
+
function getRecipientDecoder() {
|
|
6660
|
+
return kit.getStructDecoder([
|
|
6661
|
+
["wallet", kit.getAddressDecoder()],
|
|
6662
|
+
["amount", kit.getU64Decoder()]
|
|
6663
|
+
]);
|
|
6664
|
+
}
|
|
6665
|
+
function getRecipientCodec() {
|
|
6666
|
+
return kit.combineCodec(getRecipientEncoder(), getRecipientDecoder());
|
|
6667
|
+
}
|
|
6668
|
+
function getRegisterLaunchArgsEncoder() {
|
|
6669
|
+
return kit.getStructEncoder([
|
|
6670
|
+
["cpmmConfig", kit.getAddressEncoder()],
|
|
6671
|
+
["initialSwapFeeBps", kit.getU16Encoder()],
|
|
6672
|
+
["initialFeeSplitBps", kit.getU16Encoder()],
|
|
6673
|
+
["recipients", kit.getArrayEncoder(getRecipientEncoder())],
|
|
6674
|
+
["minRaiseQuote", kit.getU64Encoder()],
|
|
6675
|
+
["minMigrationPriceQ64Opt", kit.getOptionEncoder(kit.getU128Encoder())],
|
|
6676
|
+
[
|
|
6677
|
+
"migratedPoolHookConfig",
|
|
6678
|
+
kit.getOptionEncoder(getMigratedPoolHookConfigEncoder())
|
|
6679
|
+
]
|
|
6680
|
+
]);
|
|
6681
|
+
}
|
|
6682
|
+
function getRegisterLaunchArgsDecoder() {
|
|
6683
|
+
return kit.getStructDecoder([
|
|
6684
|
+
["cpmmConfig", kit.getAddressDecoder()],
|
|
6685
|
+
["initialSwapFeeBps", kit.getU16Decoder()],
|
|
6686
|
+
["initialFeeSplitBps", kit.getU16Decoder()],
|
|
6687
|
+
["recipients", kit.getArrayDecoder(getRecipientDecoder())],
|
|
6688
|
+
["minRaiseQuote", kit.getU64Decoder()],
|
|
6689
|
+
["minMigrationPriceQ64Opt", kit.getOptionDecoder(kit.getU128Decoder())],
|
|
6690
|
+
[
|
|
6691
|
+
"migratedPoolHookConfig",
|
|
6692
|
+
kit.getOptionDecoder(getMigratedPoolHookConfigDecoder())
|
|
6693
|
+
]
|
|
6694
|
+
]);
|
|
6695
|
+
}
|
|
6696
|
+
function getRegisterLaunchArgsCodec() {
|
|
6697
|
+
return kit.combineCodec(
|
|
6698
|
+
getRegisterLaunchArgsEncoder(),
|
|
6699
|
+
getRegisterLaunchArgsDecoder()
|
|
6700
|
+
);
|
|
6701
|
+
}
|
|
6702
|
+
|
|
6703
|
+
// src/solana/generated/cpmmMigrator/accounts/cpmmMigratorState.ts
|
|
6704
|
+
var CPMM_MIGRATOR_STATE_DISCRIMINATOR = new Uint8Array([
|
|
6705
|
+
169,
|
|
6706
|
+
86,
|
|
6707
|
+
255,
|
|
6708
|
+
187,
|
|
6709
|
+
37,
|
|
6710
|
+
248,
|
|
6711
|
+
11,
|
|
6712
|
+
176
|
|
6713
|
+
]);
|
|
6714
|
+
function getCpmmMigratorStateEncoder() {
|
|
6715
|
+
return kit.transformEncoder(
|
|
6716
|
+
kit.getStructEncoder([
|
|
6717
|
+
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
6718
|
+
["launch", kit.getAddressEncoder()],
|
|
6719
|
+
["admin", kit.getAddressEncoder()],
|
|
6720
|
+
["cpmmConfig", kit.getAddressEncoder()],
|
|
6721
|
+
["initialSwapFeeBps", kit.getU16Encoder()],
|
|
6722
|
+
["initialFeeSplitBps", kit.getU16Encoder()],
|
|
6723
|
+
["pad0", kit.fixEncoderSize(kit.getBytesEncoder(), 4)],
|
|
6724
|
+
["migratedPoolHookProgram", kit.getAddressEncoder()],
|
|
6725
|
+
["migratedPoolHookFlags", kit.getU32Encoder()],
|
|
6726
|
+
["recipients", kit.getArrayEncoder(getRecipientEncoder(), { size: 2 })],
|
|
6727
|
+
["minRaiseQuote", kit.getU64Encoder()],
|
|
6728
|
+
["minMigrationPriceQ64Opt", kit.getOptionEncoder(kit.getU128Encoder())],
|
|
6729
|
+
["isMigrated", kit.getBooleanEncoder()],
|
|
6730
|
+
["bump", kit.getU8Encoder()],
|
|
6731
|
+
["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 14)]
|
|
6732
|
+
]),
|
|
6733
|
+
(value) => ({ ...value, discriminator: CPMM_MIGRATOR_STATE_DISCRIMINATOR })
|
|
6734
|
+
);
|
|
6735
|
+
}
|
|
6736
|
+
function getCpmmMigratorStateDecoder() {
|
|
6737
|
+
return kit.getStructDecoder([
|
|
6738
|
+
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
6739
|
+
["launch", kit.getAddressDecoder()],
|
|
6740
|
+
["admin", kit.getAddressDecoder()],
|
|
6741
|
+
["cpmmConfig", kit.getAddressDecoder()],
|
|
6742
|
+
["initialSwapFeeBps", kit.getU16Decoder()],
|
|
6743
|
+
["initialFeeSplitBps", kit.getU16Decoder()],
|
|
6744
|
+
["pad0", kit.fixDecoderSize(kit.getBytesDecoder(), 4)],
|
|
6745
|
+
["migratedPoolHookProgram", kit.getAddressDecoder()],
|
|
6746
|
+
["migratedPoolHookFlags", kit.getU32Decoder()],
|
|
6747
|
+
["recipients", kit.getArrayDecoder(getRecipientDecoder(), { size: 2 })],
|
|
6748
|
+
["minRaiseQuote", kit.getU64Decoder()],
|
|
6749
|
+
["minMigrationPriceQ64Opt", kit.getOptionDecoder(kit.getU128Decoder())],
|
|
6750
|
+
["isMigrated", kit.getBooleanDecoder()],
|
|
6751
|
+
["bump", kit.getU8Decoder()],
|
|
6752
|
+
["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 14)]
|
|
6753
|
+
]);
|
|
6754
|
+
}
|
|
6755
|
+
function getCpmmMigratorStateCodec() {
|
|
6756
|
+
return kit.combineCodec(
|
|
6757
|
+
getCpmmMigratorStateEncoder(),
|
|
6758
|
+
getCpmmMigratorStateDecoder()
|
|
6759
|
+
);
|
|
6760
|
+
}
|
|
6761
|
+
if (process.env.NODE_ENV !== "production") ;
|
|
6762
|
+
|
|
6763
|
+
// src/solana/migrators/cpmmMigrator/client.ts
|
|
6764
|
+
async function fetchCpmmMigratorState(rpc, address7) {
|
|
6765
|
+
const response = await rpc.getAccountInfo(address7, { encoding: "base64" }).send();
|
|
6766
|
+
if (!response.value) return null;
|
|
6767
|
+
return getCpmmMigratorStateDecoder().decode(
|
|
6768
|
+
chunk4WY5GNZD_cjs.base64ToBytes(response.value.data[0])
|
|
6769
|
+
);
|
|
6770
|
+
}
|
|
6771
|
+
async function buildCpmmMigrationRemainingAccounts({
|
|
6772
|
+
launch,
|
|
6773
|
+
baseMint,
|
|
6774
|
+
quoteMint,
|
|
6775
|
+
launchAuthority,
|
|
5810
6776
|
adminBaseAta,
|
|
5811
6777
|
adminQuoteAta,
|
|
5812
6778
|
recipientAtas,
|
|
@@ -5859,8 +6825,8 @@ async function buildCpmmMigrationRemainingAccounts({
|
|
|
5859
6825
|
{ address: migrationAuthority, role: kit.AccountRole.READONLY },
|
|
5860
6826
|
{ address: adminBaseAta, role: kit.AccountRole.WRITABLE },
|
|
5861
6827
|
{ address: adminQuoteAta, role: kit.AccountRole.WRITABLE },
|
|
5862
|
-
...recipientAtas.map((
|
|
5863
|
-
address:
|
|
6828
|
+
...recipientAtas.map((address7) => ({
|
|
6829
|
+
address: address7,
|
|
5864
6830
|
role: kit.AccountRole.WRITABLE
|
|
5865
6831
|
}))
|
|
5866
6832
|
],
|
|
@@ -5925,30 +6891,8 @@ function createLaunchId() {
|
|
|
5925
6891
|
bytes.set([68, 79, 80, 76], 28);
|
|
5926
6892
|
return bytes;
|
|
5927
6893
|
}
|
|
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
6894
|
function getSignerAddress(value) {
|
|
5938
|
-
return
|
|
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;
|
|
6895
|
+
return chunk4WY5GNZD_cjs.getAddressFromAddressOrSigner(value);
|
|
5952
6896
|
}
|
|
5953
6897
|
function hasMetadata(metadata) {
|
|
5954
6898
|
return Boolean(metadata?.metadataName);
|
|
@@ -5963,7 +6907,9 @@ function hashRemainingAccounts(accounts) {
|
|
|
5963
6907
|
if (!accounts) {
|
|
5964
6908
|
return void 0;
|
|
5965
6909
|
}
|
|
5966
|
-
return computeRemainingAccountsHash(
|
|
6910
|
+
return computeRemainingAccountsHash(
|
|
6911
|
+
accounts.map(chunk4WY5GNZD_cjs.getAddressFromRemainingAccount)
|
|
6912
|
+
);
|
|
5967
6913
|
}
|
|
5968
6914
|
function isCustomMigrationConfig(migration) {
|
|
5969
6915
|
return migration.kind === "custom";
|
|
@@ -5972,13 +6918,35 @@ function getCreateLaunchHookMode(input) {
|
|
|
5972
6918
|
if (input.hook !== void 0 && input.hook !== null) {
|
|
5973
6919
|
return input.hook;
|
|
5974
6920
|
}
|
|
6921
|
+
if (input.dynamicFee) {
|
|
6922
|
+
return "dynamicFee";
|
|
6923
|
+
}
|
|
5975
6924
|
return input.cosigner ? "cosigner" : "cpmm";
|
|
5976
6925
|
}
|
|
5977
6926
|
async function getCreateLaunchHookContext(input) {
|
|
5978
6927
|
const mode = getCreateLaunchHookMode(input);
|
|
5979
|
-
if (mode !== "
|
|
6928
|
+
if (input.dynamicFee && mode !== "dynamicFee") {
|
|
6929
|
+
throw new Error(
|
|
6930
|
+
'dynamicFee requires hook to be unset or set to "dynamicFee"'
|
|
6931
|
+
);
|
|
6932
|
+
}
|
|
6933
|
+
if (mode !== "cosigner" && mode !== "dynamicFee") {
|
|
5980
6934
|
return { mode };
|
|
5981
6935
|
}
|
|
6936
|
+
if (mode === "dynamicFee") {
|
|
6937
|
+
if (!input.dynamicFee && !input.cosigner) {
|
|
6938
|
+
throw new Error(
|
|
6939
|
+
"dynamicFee hook mode requires dynamicFee or cosigner input"
|
|
6940
|
+
);
|
|
6941
|
+
}
|
|
6942
|
+
if (!input.cosigner) {
|
|
6943
|
+
return { mode };
|
|
6944
|
+
}
|
|
6945
|
+
const [dynamicFeeConfig] = await getDynamicFeeHookConfigAddress(
|
|
6946
|
+
input.deployment?.dynamicFeeHookProgram ?? DYNAMIC_FEE_HOOK_PROGRAM_ID
|
|
6947
|
+
);
|
|
6948
|
+
return { mode, dynamicFeeConfig };
|
|
6949
|
+
}
|
|
5982
6950
|
const [cosignerConfig] = await getCosignerHookConfigAddress(
|
|
5983
6951
|
input.deployment?.cosignerHookProgram ?? DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID
|
|
5984
6952
|
);
|
|
@@ -6006,6 +6974,23 @@ function resolveCosignerHookPayload(input) {
|
|
|
6006
6974
|
cosigner: getSignerAddress(input.cosigner)
|
|
6007
6975
|
});
|
|
6008
6976
|
}
|
|
6977
|
+
function resolveDynamicFeeHookPayload(input) {
|
|
6978
|
+
let gateExpiry = null;
|
|
6979
|
+
if (input.cosignGateExpiresAt !== void 0 && input.cosignGateExpiresAt !== null) {
|
|
6980
|
+
if (!input.cosigner) {
|
|
6981
|
+
throw new Error("cosigner is required when cosignGateExpiresAt is set");
|
|
6982
|
+
}
|
|
6983
|
+
gateExpiry = {
|
|
6984
|
+
mode: GATE_EXPIRY_UNIX_TIMESTAMP,
|
|
6985
|
+
value: input.cosignGateExpiresAt,
|
|
6986
|
+
cosigner: getSignerAddress(input.cosigner)
|
|
6987
|
+
};
|
|
6988
|
+
}
|
|
6989
|
+
return encodeDynamicFeeHookPayload({
|
|
6990
|
+
schedule: input.dynamicFee ?? null,
|
|
6991
|
+
gateExpiry
|
|
6992
|
+
});
|
|
6993
|
+
}
|
|
6009
6994
|
function resolveCreateLaunchHook({
|
|
6010
6995
|
input,
|
|
6011
6996
|
namespace,
|
|
@@ -6037,6 +7022,28 @@ function resolveCreateLaunchHook({
|
|
|
6037
7022
|
remainingAccountsHash: hashRemainingAccounts(remainingAccounts) ?? EMPTY_REMAINING_ACCOUNTS_HASH
|
|
6038
7023
|
};
|
|
6039
7024
|
}
|
|
7025
|
+
if (hookContext.mode === "dynamicFee") {
|
|
7026
|
+
const hasCosigner = Boolean(input.cosigner);
|
|
7027
|
+
const hasSchedule = Boolean(input.dynamicFee);
|
|
7028
|
+
if (input.cosignGateExpiresAt !== void 0 && input.cosignGateExpiresAt !== null && !input.cosigner) {
|
|
7029
|
+
throw new Error("cosigner is required when cosignGateExpiresAt is set");
|
|
7030
|
+
}
|
|
7031
|
+
if (hasCosigner && !hookContext.dynamicFeeConfig) {
|
|
7032
|
+
throw new Error("dynamic fee hook config could not be derived");
|
|
7033
|
+
}
|
|
7034
|
+
const remainingAccounts = getDynamicFeeHookRemainingAccounts({
|
|
7035
|
+
namespace,
|
|
7036
|
+
config: hookContext.dynamicFeeConfig,
|
|
7037
|
+
cosigner: input.cosigner
|
|
7038
|
+
});
|
|
7039
|
+
return {
|
|
7040
|
+
program: input.deployment?.dynamicFeeHookProgram ?? DYNAMIC_FEE_HOOK_PROGRAM_ID,
|
|
7041
|
+
flags: HF_BEFORE_SWAP2 | (hasSchedule ? HF_BEFORE_CREATE : 0) | (hasCosigner ? HF_FORWARD_READONLY_SIGNERS2 : 0),
|
|
7042
|
+
payload: resolveDynamicFeeHookPayload(input),
|
|
7043
|
+
remainingAccounts: remainingAccounts.signedHookRemainingAccounts,
|
|
7044
|
+
remainingAccountsHash: remainingAccounts.hookRemainingAccountsHash
|
|
7045
|
+
};
|
|
7046
|
+
}
|
|
6040
7047
|
return {
|
|
6041
7048
|
program: input.deployment?.cpmmHookProgram ?? CPMM_HOOK_PROGRAM_ID,
|
|
6042
7049
|
flags: HF_BEFORE_SWAP2,
|
|
@@ -6179,7 +7186,7 @@ async function createLaunch(input) {
|
|
|
6179
7186
|
const programId = getInitializerProgramId(input);
|
|
6180
7187
|
const launchId = input.launchId ?? createLaunchId();
|
|
6181
7188
|
const hookContext = await getCreateLaunchHookContext(input);
|
|
6182
|
-
const namespace = input.namespace ?? hookContext.cosignerConfig ?? getSignerAddress(input.payer);
|
|
7189
|
+
const namespace = input.namespace ?? hookContext.cosignerConfig ?? (hookContext.mode === "dynamicFee" ? chunkU6B52TBT_cjs.SYSTEM_PROGRAM_ADDRESS : void 0) ?? getSignerAddress(input.payer);
|
|
6183
7190
|
const tokenPrograms = {
|
|
6184
7191
|
...launchTokenPrograms.splToken(),
|
|
6185
7192
|
...input.tokenPrograms
|
|
@@ -6263,7 +7270,7 @@ async function createLaunch(input) {
|
|
|
6263
7270
|
accounts: [
|
|
6264
7271
|
...instruction.accounts ?? [],
|
|
6265
7272
|
...(migration?.initRemainingAccounts ?? []).map(
|
|
6266
|
-
|
|
7273
|
+
chunk4WY5GNZD_cjs.createReadonlyRemainingAccountMeta
|
|
6267
7274
|
)
|
|
6268
7275
|
]
|
|
6269
7276
|
} : instruction;
|
|
@@ -6380,37 +7387,22 @@ function assertTransactionMessageFitsWithLookupTable(transactionMessage, lookupT
|
|
|
6380
7387
|
return assertTransactionMessageFits(compressedMessage, options);
|
|
6381
7388
|
}
|
|
6382
7389
|
var addressCodec5 = kit.getAddressCodec();
|
|
6383
|
-
function
|
|
6384
|
-
|
|
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, {
|
|
7390
|
+
async function fetchLaunch2(rpc, address7, config) {
|
|
7391
|
+
const response = await rpc.getAccountInfo(address7, {
|
|
6400
7392
|
encoding: "base64",
|
|
6401
7393
|
commitment: config?.commitment
|
|
6402
7394
|
}).send();
|
|
6403
7395
|
if (!response.value) {
|
|
6404
7396
|
return null;
|
|
6405
7397
|
}
|
|
6406
|
-
return getLaunchDecoder().decode(
|
|
7398
|
+
return getLaunchDecoder().decode(chunk4WY5GNZD_cjs.base64ToBytes(response.value.data[0]));
|
|
6407
7399
|
}
|
|
6408
7400
|
async function fetchAllLaunches(rpc, config) {
|
|
6409
7401
|
const programId = config?.programId ?? INITIALIZER_PROGRAM_ID;
|
|
6410
7402
|
const discriminatorFilter = {
|
|
6411
7403
|
memcmp: {
|
|
6412
7404
|
offset: 0n,
|
|
6413
|
-
bytes:
|
|
7405
|
+
bytes: chunk4WY5GNZD_cjs.bytesToBase64EncodedBytes(
|
|
6414
7406
|
INITIALIZER_ACCOUNT_DISCRIMINATORS.Launch
|
|
6415
7407
|
),
|
|
6416
7408
|
encoding: "base64"
|
|
@@ -6421,15 +7413,15 @@ async function fetchAllLaunches(rpc, config) {
|
|
|
6421
7413
|
commitment: config?.commitment,
|
|
6422
7414
|
filters: [discriminatorFilter]
|
|
6423
7415
|
}).send();
|
|
6424
|
-
const accounts =
|
|
7416
|
+
const accounts = chunk4WY5GNZD_cjs.normalizeProgramAccountsResponse(response);
|
|
6425
7417
|
const launches = [];
|
|
6426
7418
|
const decoder = getLaunchDecoder();
|
|
6427
7419
|
for (const account of accounts) {
|
|
6428
7420
|
try {
|
|
6429
|
-
const launch = decoder.decode(
|
|
7421
|
+
const launch = decoder.decode(chunk4WY5GNZD_cjs.base64ToBytes(account.account.data[0]));
|
|
6430
7422
|
launches.push({ address: account.pubkey, account: launch });
|
|
6431
7423
|
} catch {
|
|
6432
|
-
|
|
7424
|
+
chunk4WY5GNZD_cjs.warnAccountDecodeFailure("launch", account.pubkey);
|
|
6433
7425
|
}
|
|
6434
7426
|
}
|
|
6435
7427
|
return launches;
|
|
@@ -6439,7 +7431,7 @@ async function fetchLaunchesByAuthority(rpc, authority, config) {
|
|
|
6439
7431
|
const discriminatorFilter = {
|
|
6440
7432
|
memcmp: {
|
|
6441
7433
|
offset: 0n,
|
|
6442
|
-
bytes:
|
|
7434
|
+
bytes: chunk4WY5GNZD_cjs.bytesToBase64EncodedBytes(
|
|
6443
7435
|
INITIALIZER_ACCOUNT_DISCRIMINATORS.Launch
|
|
6444
7436
|
),
|
|
6445
7437
|
encoding: "base64"
|
|
@@ -6448,9 +7440,7 @@ async function fetchLaunchesByAuthority(rpc, authority, config) {
|
|
|
6448
7440
|
const authorityFilter = {
|
|
6449
7441
|
memcmp: {
|
|
6450
7442
|
offset: 8n,
|
|
6451
|
-
bytes:
|
|
6452
|
-
addressCodec5.encode(authority)
|
|
6453
|
-
),
|
|
7443
|
+
bytes: chunk4WY5GNZD_cjs.bytesToBase64EncodedBytes(addressCodec5.encode(authority)),
|
|
6454
7444
|
encoding: "base64"
|
|
6455
7445
|
}
|
|
6456
7446
|
};
|
|
@@ -6459,15 +7449,15 @@ async function fetchLaunchesByAuthority(rpc, authority, config) {
|
|
|
6459
7449
|
commitment: config?.commitment,
|
|
6460
7450
|
filters: [discriminatorFilter, authorityFilter]
|
|
6461
7451
|
}).send();
|
|
6462
|
-
const accounts =
|
|
7452
|
+
const accounts = chunk4WY5GNZD_cjs.normalizeProgramAccountsResponse(response);
|
|
6463
7453
|
const launches = [];
|
|
6464
7454
|
const decoder = getLaunchDecoder();
|
|
6465
7455
|
for (const account of accounts) {
|
|
6466
7456
|
try {
|
|
6467
|
-
const launch = decoder.decode(
|
|
7457
|
+
const launch = decoder.decode(chunk4WY5GNZD_cjs.base64ToBytes(account.account.data[0]));
|
|
6468
7458
|
launches.push({ address: account.pubkey, account: launch });
|
|
6469
7459
|
} catch {
|
|
6470
|
-
|
|
7460
|
+
chunk4WY5GNZD_cjs.warnAccountDecodeFailure("launch", account.pubkey);
|
|
6471
7461
|
}
|
|
6472
7462
|
}
|
|
6473
7463
|
return launches;
|
|
@@ -6803,13 +7793,13 @@ function decodeOracleState3(encodedAccount) {
|
|
|
6803
7793
|
getOracleStateDecoder2()
|
|
6804
7794
|
);
|
|
6805
7795
|
}
|
|
6806
|
-
async function fetchOracleState2(rpc,
|
|
6807
|
-
const maybeAccount = await fetchMaybeOracleState2(rpc,
|
|
7796
|
+
async function fetchOracleState2(rpc, address7, config) {
|
|
7797
|
+
const maybeAccount = await fetchMaybeOracleState2(rpc, address7, config);
|
|
6808
7798
|
kit.assertAccountExists(maybeAccount);
|
|
6809
7799
|
return maybeAccount;
|
|
6810
7800
|
}
|
|
6811
|
-
async function fetchMaybeOracleState2(rpc,
|
|
6812
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
7801
|
+
async function fetchMaybeOracleState2(rpc, address7, config) {
|
|
7802
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address7, config);
|
|
6813
7803
|
return decodeOracleState3(maybeAccount);
|
|
6814
7804
|
}
|
|
6815
7805
|
async function fetchAllOracleState2(rpc, addresses, config) {
|
|
@@ -7151,6 +8141,325 @@ async function getOracleStateAddress(oracleAuthority, nonce) {
|
|
|
7151
8141
|
]
|
|
7152
8142
|
});
|
|
7153
8143
|
}
|
|
8144
|
+
var WRAPPED_SOL_MINT = kit.address("So11111111111111111111111111111111111111112");
|
|
8145
|
+
var BPS_DENOMINATOR = 10000n;
|
|
8146
|
+
function isTransactionSigner2(value) {
|
|
8147
|
+
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
8148
|
+
}
|
|
8149
|
+
function getAddress(value) {
|
|
8150
|
+
return isTransactionSigner2(value) ? value.address : value;
|
|
8151
|
+
}
|
|
8152
|
+
async function getAssociatedTokenAddress2({
|
|
8153
|
+
owner,
|
|
8154
|
+
mint,
|
|
8155
|
+
tokenProgram
|
|
8156
|
+
}) {
|
|
8157
|
+
const [ata] = await token.findAssociatedTokenPda({
|
|
8158
|
+
owner,
|
|
8159
|
+
mint,
|
|
8160
|
+
tokenProgram
|
|
8161
|
+
});
|
|
8162
|
+
return ata;
|
|
8163
|
+
}
|
|
8164
|
+
function resolveSlippageBps(slippageBps) {
|
|
8165
|
+
const resolved = slippageBps === void 0 ? 50n : BigInt(slippageBps);
|
|
8166
|
+
if (resolved < 0n || resolved > BPS_DENOMINATOR) {
|
|
8167
|
+
throw new Error("slippageBps must be between 0 and 10000");
|
|
8168
|
+
}
|
|
8169
|
+
return resolved;
|
|
8170
|
+
}
|
|
8171
|
+
function getMinAmountOut({
|
|
8172
|
+
quotedAmountOut,
|
|
8173
|
+
minAmountOut,
|
|
8174
|
+
slippageBps
|
|
8175
|
+
}) {
|
|
8176
|
+
if (minAmountOut !== void 0) {
|
|
8177
|
+
return minAmountOut;
|
|
8178
|
+
}
|
|
8179
|
+
const slippage = resolveSlippageBps(slippageBps);
|
|
8180
|
+
return quotedAmountOut * (BPS_DENOMINATOR - slippage) / BPS_DENOMINATOR;
|
|
8181
|
+
}
|
|
8182
|
+
async function curveSwapExactIn(input) {
|
|
8183
|
+
const programId = input.programId ?? input.deployment?.initializerProgram ?? INITIALIZER_PROGRAM_ID;
|
|
8184
|
+
const user = input.user ?? input.payer;
|
|
8185
|
+
const userAddress = getAddress(user);
|
|
8186
|
+
const baseTokenProgram = input.baseTokenProgram ?? chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS;
|
|
8187
|
+
const quoteTokenProgram = input.quoteTokenProgram ?? chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS;
|
|
8188
|
+
const userBaseAccount = await getAssociatedTokenAddress2({
|
|
8189
|
+
owner: userAddress,
|
|
8190
|
+
mint: input.baseMint,
|
|
8191
|
+
tokenProgram: baseTokenProgram
|
|
8192
|
+
});
|
|
8193
|
+
const userQuoteAccount = await getAssociatedTokenAddress2({
|
|
8194
|
+
owner: userAddress,
|
|
8195
|
+
mint: input.quoteMint,
|
|
8196
|
+
tokenProgram: quoteTokenProgram
|
|
8197
|
+
});
|
|
8198
|
+
const setupInstructions = [
|
|
8199
|
+
token.getCreateAssociatedTokenIdempotentInstruction({
|
|
8200
|
+
payer: input.payer,
|
|
8201
|
+
ata: userBaseAccount,
|
|
8202
|
+
owner: userAddress,
|
|
8203
|
+
mint: input.baseMint,
|
|
8204
|
+
tokenProgram: baseTokenProgram
|
|
8205
|
+
}),
|
|
8206
|
+
token.getCreateAssociatedTokenIdempotentInstruction({
|
|
8207
|
+
payer: input.payer,
|
|
8208
|
+
ata: userQuoteAccount,
|
|
8209
|
+
owner: userAddress,
|
|
8210
|
+
mint: input.quoteMint,
|
|
8211
|
+
tokenProgram: quoteTokenProgram
|
|
8212
|
+
})
|
|
8213
|
+
];
|
|
8214
|
+
const shouldWrapSol = input.wrapSol ?? (input.quoteMint === WRAPPED_SOL_MINT && input.tradeDirection === TRADE_DIRECTION_BUY);
|
|
8215
|
+
if (shouldWrapSol) {
|
|
8216
|
+
setupInstructions.push(
|
|
8217
|
+
system.getTransferSolInstruction({
|
|
8218
|
+
source: input.payer,
|
|
8219
|
+
destination: userQuoteAccount,
|
|
8220
|
+
amount: input.amountIn
|
|
8221
|
+
}),
|
|
8222
|
+
token.getSyncNativeInstruction({ account: userQuoteAccount })
|
|
8223
|
+
);
|
|
8224
|
+
}
|
|
8225
|
+
const swapAccounts = {
|
|
8226
|
+
launch: input.launch,
|
|
8227
|
+
launchAuthority: input.launchAuthority,
|
|
8228
|
+
baseVault: input.baseVault,
|
|
8229
|
+
quoteVault: input.quoteVault,
|
|
8230
|
+
launchFeeState: input.launchFeeState,
|
|
8231
|
+
userBaseAccount,
|
|
8232
|
+
userQuoteAccount,
|
|
8233
|
+
baseMint: input.baseMint,
|
|
8234
|
+
quoteMint: input.quoteMint,
|
|
8235
|
+
user,
|
|
8236
|
+
hookProgram: input.hookProgram ?? input.deployment?.cpmmHookProgram,
|
|
8237
|
+
baseTokenProgram,
|
|
8238
|
+
quoteTokenProgram,
|
|
8239
|
+
remainingAccounts: input.remainingAccounts ? [...input.remainingAccounts] : void 0
|
|
8240
|
+
};
|
|
8241
|
+
const swapInstruction = createCurveSwapExactInInstruction(
|
|
8242
|
+
swapAccounts,
|
|
8243
|
+
{
|
|
8244
|
+
amountIn: input.amountIn,
|
|
8245
|
+
minAmountOut: input.minAmountOut,
|
|
8246
|
+
tradeDirection: input.tradeDirection
|
|
8247
|
+
},
|
|
8248
|
+
programId
|
|
8249
|
+
);
|
|
8250
|
+
const userIn = input.tradeDirection === TRADE_DIRECTION_BUY ? userQuoteAccount : userBaseAccount;
|
|
8251
|
+
const userOut = input.tradeDirection === TRADE_DIRECTION_BUY ? userBaseAccount : userQuoteAccount;
|
|
8252
|
+
return {
|
|
8253
|
+
userBaseAccount,
|
|
8254
|
+
userQuoteAccount,
|
|
8255
|
+
userIn,
|
|
8256
|
+
userOut,
|
|
8257
|
+
setupInstructions,
|
|
8258
|
+
swapInstruction,
|
|
8259
|
+
instructions: [...setupInstructions, swapInstruction]
|
|
8260
|
+
};
|
|
8261
|
+
}
|
|
8262
|
+
async function swapExactIn(input) {
|
|
8263
|
+
const programId = input.programId ?? input.deployment?.cpmmProgram ?? void 0;
|
|
8264
|
+
const pool = "pool" in input ? input.pool : await chunk4WY5GNZD_cjs.getPoolByMints(input.rpc, input.mintA, input.mintB, {
|
|
8265
|
+
programId
|
|
8266
|
+
});
|
|
8267
|
+
if (!pool) {
|
|
8268
|
+
throw new Error(`No pool found for ${input.mintA} / ${input.mintB}`);
|
|
8269
|
+
}
|
|
8270
|
+
const user = input.user ?? input.payer;
|
|
8271
|
+
const userAddress = getAddress(user);
|
|
8272
|
+
const token0Program = input.token0Program ?? input.tokenProgram ?? chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS;
|
|
8273
|
+
const token1Program = input.token1Program ?? input.tokenProgram ?? chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS;
|
|
8274
|
+
const quote = chunk4WY5GNZD_cjs.getSwapQuote(
|
|
8275
|
+
pool.account,
|
|
8276
|
+
input.amountIn,
|
|
8277
|
+
input.tradeDirection
|
|
8278
|
+
);
|
|
8279
|
+
const minAmountOut = getMinAmountOut({
|
|
8280
|
+
quotedAmountOut: quote.amountOut,
|
|
8281
|
+
minAmountOut: input.minAmountOut,
|
|
8282
|
+
slippageBps: input.slippageBps
|
|
8283
|
+
});
|
|
8284
|
+
const userToken0 = await getAssociatedTokenAddress2({
|
|
8285
|
+
owner: userAddress,
|
|
8286
|
+
mint: pool.account.token0Mint,
|
|
8287
|
+
tokenProgram: token0Program
|
|
8288
|
+
});
|
|
8289
|
+
const userToken1 = await getAssociatedTokenAddress2({
|
|
8290
|
+
owner: userAddress,
|
|
8291
|
+
mint: pool.account.token1Mint,
|
|
8292
|
+
tokenProgram: token1Program
|
|
8293
|
+
});
|
|
8294
|
+
const setupInstructions = [
|
|
8295
|
+
token.getCreateAssociatedTokenIdempotentInstruction({
|
|
8296
|
+
payer: input.payer,
|
|
8297
|
+
ata: userToken0,
|
|
8298
|
+
owner: userAddress,
|
|
8299
|
+
mint: pool.account.token0Mint,
|
|
8300
|
+
tokenProgram: token0Program
|
|
8301
|
+
}),
|
|
8302
|
+
token.getCreateAssociatedTokenIdempotentInstruction({
|
|
8303
|
+
payer: input.payer,
|
|
8304
|
+
ata: userToken1,
|
|
8305
|
+
owner: userAddress,
|
|
8306
|
+
mint: pool.account.token1Mint,
|
|
8307
|
+
tokenProgram: token1Program
|
|
8308
|
+
})
|
|
8309
|
+
];
|
|
8310
|
+
const swapInstruction = createSwapInstruction({
|
|
8311
|
+
config: input.config ?? input.deployment?.cpmmConfig ?? pool.account.config,
|
|
8312
|
+
pool: pool.address,
|
|
8313
|
+
authority: pool.account.authority,
|
|
8314
|
+
vault0: pool.account.vault0,
|
|
8315
|
+
vault1: pool.account.vault1,
|
|
8316
|
+
token0Mint: pool.account.token0Mint,
|
|
8317
|
+
token1Mint: pool.account.token1Mint,
|
|
8318
|
+
userToken0,
|
|
8319
|
+
userToken1,
|
|
8320
|
+
user,
|
|
8321
|
+
amountIn: input.amountIn,
|
|
8322
|
+
minAmountOut,
|
|
8323
|
+
tradeDirection: input.tradeDirection,
|
|
8324
|
+
oracle: input.oracle,
|
|
8325
|
+
remainingAccounts: input.remainingAccounts ? [...input.remainingAccounts] : void 0,
|
|
8326
|
+
updateOracle: input.updateOracle,
|
|
8327
|
+
token0Program,
|
|
8328
|
+
token1Program,
|
|
8329
|
+
programId: programId ?? input.deployment?.cpmmProgram
|
|
8330
|
+
});
|
|
8331
|
+
const userIn = input.tradeDirection === 0 ? userToken0 : userToken1;
|
|
8332
|
+
const userOut = input.tradeDirection === 0 ? userToken1 : userToken0;
|
|
8333
|
+
return {
|
|
8334
|
+
pool,
|
|
8335
|
+
quote,
|
|
8336
|
+
minAmountOut,
|
|
8337
|
+
userToken0,
|
|
8338
|
+
userToken1,
|
|
8339
|
+
userIn,
|
|
8340
|
+
userOut,
|
|
8341
|
+
setupInstructions,
|
|
8342
|
+
swapInstruction,
|
|
8343
|
+
instructions: [...setupInstructions, swapInstruction]
|
|
8344
|
+
};
|
|
8345
|
+
}
|
|
8346
|
+
var COMPUTE_BUDGET_PROGRAM_ID = kit.address(
|
|
8347
|
+
"ComputeBudget111111111111111111111111111111"
|
|
8348
|
+
);
|
|
8349
|
+
function createSetComputeUnitLimitInstruction(units) {
|
|
8350
|
+
const data = new Uint8Array(5);
|
|
8351
|
+
data[0] = 2;
|
|
8352
|
+
new DataView(data.buffer).setUint32(1, units, true);
|
|
8353
|
+
return {
|
|
8354
|
+
programAddress: COMPUTE_BUDGET_PROGRAM_ID,
|
|
8355
|
+
accounts: [],
|
|
8356
|
+
data
|
|
8357
|
+
};
|
|
8358
|
+
}
|
|
8359
|
+
function getDefaultComputeUnitLimit(cpmmMigration) {
|
|
8360
|
+
return cpmmMigration.recipientAtas.length > 0 ? 8e5 : 4e5;
|
|
8361
|
+
}
|
|
8362
|
+
function migrateLaunch(input) {
|
|
8363
|
+
const baseTokenProgram = input.baseTokenProgram ?? chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS;
|
|
8364
|
+
const quoteTokenProgram = input.quoteTokenProgram ?? chunkU6B52TBT_cjs.TOKEN_PROGRAM_ADDRESS;
|
|
8365
|
+
const recipients = input.recipients ? [...input.recipients] : [];
|
|
8366
|
+
if (recipients.length > 0 && recipients.length !== input.cpmmMigration.recipientAtas.length) {
|
|
8367
|
+
throw new Error(
|
|
8368
|
+
"recipients length must match cpmmMigration.recipientAtas length"
|
|
8369
|
+
);
|
|
8370
|
+
}
|
|
8371
|
+
const initializerConfig = input.config ?? input.deployment?.initializerConfig;
|
|
8372
|
+
if (!initializerConfig) {
|
|
8373
|
+
throw new Error("config or deployment.initializerConfig is required");
|
|
8374
|
+
}
|
|
8375
|
+
const recipientAtaInstructions = recipients.map(
|
|
8376
|
+
(recipient, index) => token.getCreateAssociatedTokenIdempotentInstruction({
|
|
8377
|
+
payer: input.payer,
|
|
8378
|
+
ata: input.cpmmMigration.recipientAtas[index],
|
|
8379
|
+
owner: recipient.wallet,
|
|
8380
|
+
mint: input.baseMint,
|
|
8381
|
+
tokenProgram: baseTokenProgram
|
|
8382
|
+
})
|
|
8383
|
+
);
|
|
8384
|
+
const migrateLaunchInstruction = createMigrateLaunchInstruction(
|
|
8385
|
+
{
|
|
8386
|
+
config: initializerConfig,
|
|
8387
|
+
launch: input.launch,
|
|
8388
|
+
launchAuthority: input.launchAuthority,
|
|
8389
|
+
baseMint: input.baseMint,
|
|
8390
|
+
quoteMint: input.quoteMint,
|
|
8391
|
+
baseVault: input.baseVault,
|
|
8392
|
+
quoteVault: input.quoteVault,
|
|
8393
|
+
launchFeeState: input.launchFeeState,
|
|
8394
|
+
migratorProgram: input.deployment?.cpmmMigratorProgram ?? CPMM_MIGRATOR_PROGRAM_ID,
|
|
8395
|
+
payer: input.payer,
|
|
8396
|
+
baseTokenProgram,
|
|
8397
|
+
quoteTokenProgram,
|
|
8398
|
+
systemProgram: input.systemProgram ?? chunkU6B52TBT_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
8399
|
+
rent: input.rent ?? chunkU6B52TBT_cjs.SYSVAR_RENT_ADDRESS
|
|
8400
|
+
},
|
|
8401
|
+
input.programId ?? input.deployment?.initializerProgram ?? INITIALIZER_PROGRAM_ID
|
|
8402
|
+
);
|
|
8403
|
+
const migrateInstruction = {
|
|
8404
|
+
...migrateLaunchInstruction,
|
|
8405
|
+
accounts: [
|
|
8406
|
+
...migrateLaunchInstruction.accounts ?? [],
|
|
8407
|
+
...input.cpmmMigration.metas
|
|
8408
|
+
]
|
|
8409
|
+
};
|
|
8410
|
+
const computeUnitLimit = input.computeUnitLimit === void 0 ? getDefaultComputeUnitLimit(input.cpmmMigration) : input.computeUnitLimit;
|
|
8411
|
+
const computeUnitLimitInstruction = computeUnitLimit === false ? void 0 : createSetComputeUnitLimitInstruction(computeUnitLimit);
|
|
8412
|
+
const instructions = [
|
|
8413
|
+
...computeUnitLimitInstruction ? [computeUnitLimitInstruction] : [],
|
|
8414
|
+
...recipientAtaInstructions,
|
|
8415
|
+
migrateInstruction
|
|
8416
|
+
];
|
|
8417
|
+
return {
|
|
8418
|
+
recipientAtaInstructions,
|
|
8419
|
+
computeUnitLimitInstruction,
|
|
8420
|
+
migrateInstruction,
|
|
8421
|
+
instructions
|
|
8422
|
+
};
|
|
8423
|
+
}
|
|
8424
|
+
async function getMigrationQuoteProgress({
|
|
8425
|
+
rpc,
|
|
8426
|
+
quoteVault,
|
|
8427
|
+
pendingQuoteFees,
|
|
8428
|
+
commitment = "confirmed"
|
|
8429
|
+
}) {
|
|
8430
|
+
const vaultBalance = await rpc.getTokenAccountBalance(quoteVault, { commitment }).send();
|
|
8431
|
+
const quoteVaultAmount = BigInt(vaultBalance.value.amount);
|
|
8432
|
+
if (pendingQuoteFees > quoteVaultAmount) {
|
|
8433
|
+
throw new Error(
|
|
8434
|
+
"pendingQuoteFees cannot exceed the quote vault token balance"
|
|
8435
|
+
);
|
|
8436
|
+
}
|
|
8437
|
+
return {
|
|
8438
|
+
quoteVaultAmount,
|
|
8439
|
+
pendingQuoteFees,
|
|
8440
|
+
migrationQuoteAmount: quoteVaultAmount - pendingQuoteFees
|
|
8441
|
+
};
|
|
8442
|
+
}
|
|
8443
|
+
async function assertMigrationQuoteThreshold({
|
|
8444
|
+
rpc,
|
|
8445
|
+
quoteVault,
|
|
8446
|
+
pendingQuoteFees,
|
|
8447
|
+
minRaiseQuote,
|
|
8448
|
+
commitment = "confirmed"
|
|
8449
|
+
}) {
|
|
8450
|
+
const progress = await getMigrationQuoteProgress({
|
|
8451
|
+
rpc,
|
|
8452
|
+
quoteVault,
|
|
8453
|
+
pendingQuoteFees,
|
|
8454
|
+
commitment
|
|
8455
|
+
});
|
|
8456
|
+
if (progress.migrationQuoteAmount < minRaiseQuote) {
|
|
8457
|
+
throw new Error(
|
|
8458
|
+
`Quote available for migration ${progress.migrationQuoteAmount} is below minRaiseQuote ${minRaiseQuote}`
|
|
8459
|
+
);
|
|
8460
|
+
}
|
|
8461
|
+
return progress;
|
|
8462
|
+
}
|
|
7154
8463
|
|
|
7155
8464
|
// src/solana/deployment.ts
|
|
7156
8465
|
var DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = {
|
|
@@ -7158,7 +8467,8 @@ var DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = {
|
|
|
7158
8467
|
initializerProgram: INITIALIZER_PROGRAM_ID,
|
|
7159
8468
|
cpmmMigratorProgram: CPMM_MIGRATOR_PROGRAM_ID,
|
|
7160
8469
|
cpmmHookProgram: CPMM_HOOK_PROGRAM_ID,
|
|
7161
|
-
cosignerHookProgram: DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID
|
|
8470
|
+
cosignerHookProgram: DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID,
|
|
8471
|
+
dynamicFeeHookProgram: DYNAMIC_FEE_HOOK_PROGRAM_ID
|
|
7162
8472
|
};
|
|
7163
8473
|
async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES) {
|
|
7164
8474
|
const [cpmmConfig] = await chunkU6B52TBT_cjs.getConfigAddress(programs.cpmmProgram);
|
|
@@ -7173,13 +8483,19 @@ async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGR
|
|
|
7173
8483
|
}
|
|
7174
8484
|
|
|
7175
8485
|
exports.DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES;
|
|
8486
|
+
exports.assertMigrationQuoteThreshold = assertMigrationQuoteThreshold;
|
|
7176
8487
|
exports.cosignerHook = cosignerHook_exports;
|
|
7177
8488
|
exports.cpmm = cpmm_exports;
|
|
7178
8489
|
exports.cpmmMigrator = cpmmMigrator_exports;
|
|
7179
8490
|
exports.createLaunch = createLaunch;
|
|
8491
|
+
exports.curveSwapExactIn = curveSwapExactIn;
|
|
7180
8492
|
exports.deriveSolanaCpmmDeployment = deriveSolanaCpmmDeployment;
|
|
8493
|
+
exports.dynamicFeeHook = dynamicFeeHook_exports;
|
|
8494
|
+
exports.getMigrationQuoteProgress = getMigrationQuoteProgress;
|
|
7181
8495
|
exports.initializer = initializer_exports;
|
|
8496
|
+
exports.migrateLaunch = migrateLaunch;
|
|
7182
8497
|
exports.predictionMigrator = predictionMigrator_exports;
|
|
8498
|
+
exports.swapExactIn = swapExactIn;
|
|
7183
8499
|
exports.trustedOracle = trustedOracle_exports;
|
|
7184
8500
|
//# sourceMappingURL=index.cjs.map
|
|
7185
8501
|
//# sourceMappingURL=index.cjs.map
|