@stabbleorg/mclmm-sdk 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/idl/stabble_clmm.json +123 -1166
- package/lib/generated/errors/ammV3.d.ts +1 -1
- package/lib/generated/errors/ammV3.d.ts.map +1 -1
- package/lib/generated/instructions/closeProtocolPosition.d.ts +1 -1
- package/lib/generated/instructions/createAmmConfig.d.ts +1 -1
- package/lib/generated/instructions/createOperationAccount.d.ts +1 -1
- package/lib/generated/instructions/index.d.ts +0 -5
- package/lib/generated/instructions/index.d.ts.map +1 -1
- package/lib/generated/instructions/transferRewardOwner.d.ts +1 -1
- package/lib/generated/instructions/updateAmmConfig.d.ts +3 -3
- package/lib/generated/instructions/updateAmmConfig.d.ts.map +1 -1
- package/lib/generated/instructions/updateOperationAccount.d.ts +1 -1
- package/lib/generated/instructions/updatePoolStatus.d.ts +1 -1
- package/lib/generated/programs/ammV3.d.ts +13 -28
- package/lib/generated/programs/ammV3.d.ts.map +1 -1
- package/lib/generated/types/createPersonalPositionEvent.d.ts +8 -0
- package/lib/generated/types/createPersonalPositionEvent.d.ts.map +1 -1
- package/lib/generated/types/poolCreatedEvent.d.ts +4 -0
- package/lib/generated/types/poolCreatedEvent.d.ts.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +524 -1661
- package/lib/index.mjs +604 -1812
- package/lib/position-manager.d.ts +3 -2
- package/lib/position-manager.d.ts.map +1 -1
- package/package.json +2 -1
package/lib/index.mjs
CHANGED
|
@@ -65,14 +65,10 @@ __export(generated_exports, {
|
|
|
65
65
|
CREATE_OPERATION_ACCOUNT_DISCRIMINATOR: () => CREATE_OPERATION_ACCOUNT_DISCRIMINATOR,
|
|
66
66
|
CREATE_POOL_DISCRIMINATOR: () => CREATE_POOL_DISCRIMINATOR,
|
|
67
67
|
CREATE_SUPPORT_MINT_ASSOCIATED_DISCRIMINATOR: () => CREATE_SUPPORT_MINT_ASSOCIATED_DISCRIMINATOR,
|
|
68
|
-
DECREASE_LIQUIDITY_DISCRIMINATOR: () => DECREASE_LIQUIDITY_DISCRIMINATOR,
|
|
69
68
|
DECREASE_LIQUIDITY_V2_DISCRIMINATOR: () => DECREASE_LIQUIDITY_V2_DISCRIMINATOR,
|
|
70
|
-
INCREASE_LIQUIDITY_DISCRIMINATOR: () => INCREASE_LIQUIDITY_DISCRIMINATOR,
|
|
71
69
|
INCREASE_LIQUIDITY_V2_DISCRIMINATOR: () => INCREASE_LIQUIDITY_V2_DISCRIMINATOR,
|
|
72
70
|
INITIALIZE_REWARD_DISCRIMINATOR: () => INITIALIZE_REWARD_DISCRIMINATOR,
|
|
73
71
|
OBSERVATION_STATE_DISCRIMINATOR: () => OBSERVATION_STATE_DISCRIMINATOR,
|
|
74
|
-
OPEN_POSITION_DISCRIMINATOR: () => OPEN_POSITION_DISCRIMINATOR,
|
|
75
|
-
OPEN_POSITION_V2_DISCRIMINATOR: () => OPEN_POSITION_V2_DISCRIMINATOR,
|
|
76
72
|
OPEN_POSITION_WITH_TOKEN22_NFT_DISCRIMINATOR: () => OPEN_POSITION_WITH_TOKEN22_NFT_DISCRIMINATOR,
|
|
77
73
|
OPERATION_STATE_DISCRIMINATOR: () => OPERATION_STATE_DISCRIMINATOR,
|
|
78
74
|
PERSONAL_POSITION_STATE_DISCRIMINATOR: () => PERSONAL_POSITION_STATE_DISCRIMINATOR,
|
|
@@ -80,7 +76,6 @@ __export(generated_exports, {
|
|
|
80
76
|
PROTOCOL_POSITION_STATE_DISCRIMINATOR: () => PROTOCOL_POSITION_STATE_DISCRIMINATOR,
|
|
81
77
|
SET_REWARD_PARAMS_DISCRIMINATOR: () => SET_REWARD_PARAMS_DISCRIMINATOR,
|
|
82
78
|
SUPPORT_MINT_ASSOCIATED_DISCRIMINATOR: () => SUPPORT_MINT_ASSOCIATED_DISCRIMINATOR,
|
|
83
|
-
SWAP_DISCRIMINATOR: () => SWAP_DISCRIMINATOR,
|
|
84
79
|
SWAP_ROUTER_BASE_IN_DISCRIMINATOR: () => SWAP_ROUTER_BASE_IN_DISCRIMINATOR,
|
|
85
80
|
SWAP_V2_DISCRIMINATOR: () => SWAP_V2_DISCRIMINATOR,
|
|
86
81
|
TICK_ARRAY_BITMAP_EXTENSION_DISCRIMINATOR: () => TICK_ARRAY_BITMAP_EXTENSION_DISCRIMINATOR,
|
|
@@ -203,27 +198,17 @@ __export(generated_exports, {
|
|
|
203
198
|
getCreateSupportMintAssociatedInstructionDataCodec: () => getCreateSupportMintAssociatedInstructionDataCodec,
|
|
204
199
|
getCreateSupportMintAssociatedInstructionDataDecoder: () => getCreateSupportMintAssociatedInstructionDataDecoder,
|
|
205
200
|
getCreateSupportMintAssociatedInstructionDataEncoder: () => getCreateSupportMintAssociatedInstructionDataEncoder,
|
|
206
|
-
getDecreaseLiquidityDiscriminatorBytes: () => getDecreaseLiquidityDiscriminatorBytes,
|
|
207
201
|
getDecreaseLiquidityEventCodec: () => getDecreaseLiquidityEventCodec,
|
|
208
202
|
getDecreaseLiquidityEventDecoder: () => getDecreaseLiquidityEventDecoder,
|
|
209
203
|
getDecreaseLiquidityEventEncoder: () => getDecreaseLiquidityEventEncoder,
|
|
210
|
-
getDecreaseLiquidityInstruction: () => getDecreaseLiquidityInstruction,
|
|
211
|
-
getDecreaseLiquidityInstructionDataCodec: () => getDecreaseLiquidityInstructionDataCodec,
|
|
212
|
-
getDecreaseLiquidityInstructionDataDecoder: () => getDecreaseLiquidityInstructionDataDecoder,
|
|
213
|
-
getDecreaseLiquidityInstructionDataEncoder: () => getDecreaseLiquidityInstructionDataEncoder,
|
|
214
204
|
getDecreaseLiquidityV2DiscriminatorBytes: () => getDecreaseLiquidityV2DiscriminatorBytes,
|
|
215
205
|
getDecreaseLiquidityV2Instruction: () => getDecreaseLiquidityV2Instruction,
|
|
216
206
|
getDecreaseLiquidityV2InstructionDataCodec: () => getDecreaseLiquidityV2InstructionDataCodec,
|
|
217
207
|
getDecreaseLiquidityV2InstructionDataDecoder: () => getDecreaseLiquidityV2InstructionDataDecoder,
|
|
218
208
|
getDecreaseLiquidityV2InstructionDataEncoder: () => getDecreaseLiquidityV2InstructionDataEncoder,
|
|
219
|
-
getIncreaseLiquidityDiscriminatorBytes: () => getIncreaseLiquidityDiscriminatorBytes,
|
|
220
209
|
getIncreaseLiquidityEventCodec: () => getIncreaseLiquidityEventCodec,
|
|
221
210
|
getIncreaseLiquidityEventDecoder: () => getIncreaseLiquidityEventDecoder,
|
|
222
211
|
getIncreaseLiquidityEventEncoder: () => getIncreaseLiquidityEventEncoder,
|
|
223
|
-
getIncreaseLiquidityInstruction: () => getIncreaseLiquidityInstruction,
|
|
224
|
-
getIncreaseLiquidityInstructionDataCodec: () => getIncreaseLiquidityInstructionDataCodec,
|
|
225
|
-
getIncreaseLiquidityInstructionDataDecoder: () => getIncreaseLiquidityInstructionDataDecoder,
|
|
226
|
-
getIncreaseLiquidityInstructionDataEncoder: () => getIncreaseLiquidityInstructionDataEncoder,
|
|
227
212
|
getIncreaseLiquidityV2DiscriminatorBytes: () => getIncreaseLiquidityV2DiscriminatorBytes,
|
|
228
213
|
getIncreaseLiquidityV2Instruction: () => getIncreaseLiquidityV2Instruction,
|
|
229
214
|
getIncreaseLiquidityV2InstructionDataCodec: () => getIncreaseLiquidityV2InstructionDataCodec,
|
|
@@ -249,18 +234,6 @@ __export(generated_exports, {
|
|
|
249
234
|
getObservationStateDiscriminatorBytes: () => getObservationStateDiscriminatorBytes,
|
|
250
235
|
getObservationStateEncoder: () => getObservationStateEncoder,
|
|
251
236
|
getObservationStateSize: () => getObservationStateSize,
|
|
252
|
-
getOpenPositionDiscriminatorBytes: () => getOpenPositionDiscriminatorBytes,
|
|
253
|
-
getOpenPositionInstruction: () => getOpenPositionInstruction,
|
|
254
|
-
getOpenPositionInstructionAsync: () => getOpenPositionInstructionAsync,
|
|
255
|
-
getOpenPositionInstructionDataCodec: () => getOpenPositionInstructionDataCodec,
|
|
256
|
-
getOpenPositionInstructionDataDecoder: () => getOpenPositionInstructionDataDecoder,
|
|
257
|
-
getOpenPositionInstructionDataEncoder: () => getOpenPositionInstructionDataEncoder,
|
|
258
|
-
getOpenPositionV2DiscriminatorBytes: () => getOpenPositionV2DiscriminatorBytes,
|
|
259
|
-
getOpenPositionV2Instruction: () => getOpenPositionV2Instruction,
|
|
260
|
-
getOpenPositionV2InstructionAsync: () => getOpenPositionV2InstructionAsync,
|
|
261
|
-
getOpenPositionV2InstructionDataCodec: () => getOpenPositionV2InstructionDataCodec,
|
|
262
|
-
getOpenPositionV2InstructionDataDecoder: () => getOpenPositionV2InstructionDataDecoder,
|
|
263
|
-
getOpenPositionV2InstructionDataEncoder: () => getOpenPositionV2InstructionDataEncoder,
|
|
264
237
|
getOpenPositionWithToken22NftDiscriminatorBytes: () => getOpenPositionWithToken22NftDiscriminatorBytes,
|
|
265
238
|
getOpenPositionWithToken22NftInstruction: () => getOpenPositionWithToken22NftInstruction,
|
|
266
239
|
getOpenPositionWithToken22NftInstructionAsync: () => getOpenPositionWithToken22NftInstructionAsync,
|
|
@@ -307,14 +280,9 @@ __export(generated_exports, {
|
|
|
307
280
|
getSupportMintAssociatedDiscriminatorBytes: () => getSupportMintAssociatedDiscriminatorBytes,
|
|
308
281
|
getSupportMintAssociatedEncoder: () => getSupportMintAssociatedEncoder,
|
|
309
282
|
getSupportMintAssociatedSize: () => getSupportMintAssociatedSize,
|
|
310
|
-
getSwapDiscriminatorBytes: () => getSwapDiscriminatorBytes,
|
|
311
283
|
getSwapEventCodec: () => getSwapEventCodec,
|
|
312
284
|
getSwapEventDecoder: () => getSwapEventDecoder,
|
|
313
285
|
getSwapEventEncoder: () => getSwapEventEncoder,
|
|
314
|
-
getSwapInstruction: () => getSwapInstruction,
|
|
315
|
-
getSwapInstructionDataCodec: () => getSwapInstructionDataCodec,
|
|
316
|
-
getSwapInstructionDataDecoder: () => getSwapInstructionDataDecoder,
|
|
317
|
-
getSwapInstructionDataEncoder: () => getSwapInstructionDataEncoder,
|
|
318
286
|
getSwapRouterBaseInDiscriminatorBytes: () => getSwapRouterBaseInDiscriminatorBytes,
|
|
319
287
|
getSwapRouterBaseInInstruction: () => getSwapRouterBaseInInstruction,
|
|
320
288
|
getSwapRouterBaseInInstructionDataCodec: () => getSwapRouterBaseInInstructionDataCodec,
|
|
@@ -379,16 +347,11 @@ __export(generated_exports, {
|
|
|
379
347
|
parseCreateOperationAccountInstruction: () => parseCreateOperationAccountInstruction,
|
|
380
348
|
parseCreatePoolInstruction: () => parseCreatePoolInstruction,
|
|
381
349
|
parseCreateSupportMintAssociatedInstruction: () => parseCreateSupportMintAssociatedInstruction,
|
|
382
|
-
parseDecreaseLiquidityInstruction: () => parseDecreaseLiquidityInstruction,
|
|
383
350
|
parseDecreaseLiquidityV2Instruction: () => parseDecreaseLiquidityV2Instruction,
|
|
384
|
-
parseIncreaseLiquidityInstruction: () => parseIncreaseLiquidityInstruction,
|
|
385
351
|
parseIncreaseLiquidityV2Instruction: () => parseIncreaseLiquidityV2Instruction,
|
|
386
352
|
parseInitializeRewardInstruction: () => parseInitializeRewardInstruction,
|
|
387
|
-
parseOpenPositionInstruction: () => parseOpenPositionInstruction,
|
|
388
|
-
parseOpenPositionV2Instruction: () => parseOpenPositionV2Instruction,
|
|
389
353
|
parseOpenPositionWithToken22NftInstruction: () => parseOpenPositionWithToken22NftInstruction,
|
|
390
354
|
parseSetRewardParamsInstruction: () => parseSetRewardParamsInstruction,
|
|
391
|
-
parseSwapInstruction: () => parseSwapInstruction,
|
|
392
355
|
parseSwapRouterBaseInInstruction: () => parseSwapRouterBaseInInstruction,
|
|
393
356
|
parseSwapV2Instruction: () => parseSwapV2Instruction,
|
|
394
357
|
parseTransferRewardOwnerInstruction: () => parseTransferRewardOwnerInstruction,
|
|
@@ -481,13 +444,13 @@ function decodeAmmConfig(encodedAccount) {
|
|
|
481
444
|
getAmmConfigDecoder()
|
|
482
445
|
);
|
|
483
446
|
}
|
|
484
|
-
async function fetchAmmConfig(rpc,
|
|
485
|
-
const maybeAccount = await fetchMaybeAmmConfig(rpc,
|
|
447
|
+
async function fetchAmmConfig(rpc, address5, config) {
|
|
448
|
+
const maybeAccount = await fetchMaybeAmmConfig(rpc, address5, config);
|
|
486
449
|
assertAccountExists(maybeAccount);
|
|
487
450
|
return maybeAccount;
|
|
488
451
|
}
|
|
489
|
-
async function fetchMaybeAmmConfig(rpc,
|
|
490
|
-
const maybeAccount = await fetchEncodedAccount(rpc,
|
|
452
|
+
async function fetchMaybeAmmConfig(rpc, address5, config) {
|
|
453
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address5, config);
|
|
491
454
|
return decodeAmmConfig(maybeAccount);
|
|
492
455
|
}
|
|
493
456
|
async function fetchAllAmmConfig(rpc, addresses, config) {
|
|
@@ -658,6 +621,8 @@ import {
|
|
|
658
621
|
function getCreatePersonalPositionEventEncoder() {
|
|
659
622
|
return getStructEncoder5([
|
|
660
623
|
["poolState", getAddressEncoder5()],
|
|
624
|
+
["personalPosition", getAddressEncoder5()],
|
|
625
|
+
["nftMint", getAddressEncoder5()],
|
|
661
626
|
["minter", getAddressEncoder5()],
|
|
662
627
|
["nftOwner", getAddressEncoder5()],
|
|
663
628
|
["tickLowerIndex", getI32Encoder()],
|
|
@@ -672,6 +637,8 @@ function getCreatePersonalPositionEventEncoder() {
|
|
|
672
637
|
function getCreatePersonalPositionEventDecoder() {
|
|
673
638
|
return getStructDecoder5([
|
|
674
639
|
["poolState", getAddressDecoder5()],
|
|
640
|
+
["personalPosition", getAddressDecoder5()],
|
|
641
|
+
["nftMint", getAddressDecoder5()],
|
|
675
642
|
["minter", getAddressDecoder5()],
|
|
676
643
|
["nftOwner", getAddressDecoder5()],
|
|
677
644
|
["tickLowerIndex", getI32Decoder()],
|
|
@@ -915,7 +882,8 @@ function getPoolCreatedEventEncoder() {
|
|
|
915
882
|
["sqrtPriceX64", getU128Encoder6()],
|
|
916
883
|
["tick", getI32Encoder4()],
|
|
917
884
|
["tokenVault0", getAddressEncoder9()],
|
|
918
|
-
["tokenVault1", getAddressEncoder9()]
|
|
885
|
+
["tokenVault1", getAddressEncoder9()],
|
|
886
|
+
["ammConfig", getAddressEncoder9()]
|
|
919
887
|
]);
|
|
920
888
|
}
|
|
921
889
|
function getPoolCreatedEventDecoder() {
|
|
@@ -927,7 +895,8 @@ function getPoolCreatedEventDecoder() {
|
|
|
927
895
|
["sqrtPriceX64", getU128Decoder6()],
|
|
928
896
|
["tick", getI32Decoder4()],
|
|
929
897
|
["tokenVault0", getAddressDecoder9()],
|
|
930
|
-
["tokenVault1", getAddressDecoder9()]
|
|
898
|
+
["tokenVault1", getAddressDecoder9()],
|
|
899
|
+
["ammConfig", getAddressDecoder9()]
|
|
931
900
|
]);
|
|
932
901
|
}
|
|
933
902
|
function getPoolCreatedEventCodec() {
|
|
@@ -1188,13 +1157,13 @@ function decodeObservationState(encodedAccount) {
|
|
|
1188
1157
|
getObservationStateDecoder()
|
|
1189
1158
|
);
|
|
1190
1159
|
}
|
|
1191
|
-
async function fetchObservationState(rpc,
|
|
1192
|
-
const maybeAccount = await fetchMaybeObservationState(rpc,
|
|
1160
|
+
async function fetchObservationState(rpc, address5, config) {
|
|
1161
|
+
const maybeAccount = await fetchMaybeObservationState(rpc, address5, config);
|
|
1193
1162
|
assertAccountExists2(maybeAccount);
|
|
1194
1163
|
return maybeAccount;
|
|
1195
1164
|
}
|
|
1196
|
-
async function fetchMaybeObservationState(rpc,
|
|
1197
|
-
const maybeAccount = await fetchEncodedAccount2(rpc,
|
|
1165
|
+
async function fetchMaybeObservationState(rpc, address5, config) {
|
|
1166
|
+
const maybeAccount = await fetchEncodedAccount2(rpc, address5, config);
|
|
1198
1167
|
return decodeObservationState(maybeAccount);
|
|
1199
1168
|
}
|
|
1200
1169
|
async function fetchAllObservationState(rpc, addresses, config) {
|
|
@@ -1281,13 +1250,13 @@ function decodeOperationState(encodedAccount) {
|
|
|
1281
1250
|
getOperationStateDecoder()
|
|
1282
1251
|
);
|
|
1283
1252
|
}
|
|
1284
|
-
async function fetchOperationState(rpc,
|
|
1285
|
-
const maybeAccount = await fetchMaybeOperationState(rpc,
|
|
1253
|
+
async function fetchOperationState(rpc, address5, config) {
|
|
1254
|
+
const maybeAccount = await fetchMaybeOperationState(rpc, address5, config);
|
|
1286
1255
|
assertAccountExists3(maybeAccount);
|
|
1287
1256
|
return maybeAccount;
|
|
1288
1257
|
}
|
|
1289
|
-
async function fetchMaybeOperationState(rpc,
|
|
1290
|
-
const maybeAccount = await fetchEncodedAccount3(rpc,
|
|
1258
|
+
async function fetchMaybeOperationState(rpc, address5, config) {
|
|
1259
|
+
const maybeAccount = await fetchEncodedAccount3(rpc, address5, config);
|
|
1291
1260
|
return decodeOperationState(maybeAccount);
|
|
1292
1261
|
}
|
|
1293
1262
|
async function fetchAllOperationState(rpc, addresses, config) {
|
|
@@ -1410,17 +1379,17 @@ function decodePersonalPositionState(encodedAccount) {
|
|
|
1410
1379
|
getPersonalPositionStateDecoder()
|
|
1411
1380
|
);
|
|
1412
1381
|
}
|
|
1413
|
-
async function fetchPersonalPositionState(rpc,
|
|
1382
|
+
async function fetchPersonalPositionState(rpc, address5, config) {
|
|
1414
1383
|
const maybeAccount = await fetchMaybePersonalPositionState(
|
|
1415
1384
|
rpc,
|
|
1416
|
-
|
|
1385
|
+
address5,
|
|
1417
1386
|
config
|
|
1418
1387
|
);
|
|
1419
1388
|
assertAccountExists4(maybeAccount);
|
|
1420
1389
|
return maybeAccount;
|
|
1421
1390
|
}
|
|
1422
|
-
async function fetchMaybePersonalPositionState(rpc,
|
|
1423
|
-
const maybeAccount = await fetchEncodedAccount4(rpc,
|
|
1391
|
+
async function fetchMaybePersonalPositionState(rpc, address5, config) {
|
|
1392
|
+
const maybeAccount = await fetchEncodedAccount4(rpc, address5, config);
|
|
1424
1393
|
return decodePersonalPositionState(maybeAccount);
|
|
1425
1394
|
}
|
|
1426
1395
|
async function fetchAllPersonalPositionState(rpc, addresses, config) {
|
|
@@ -1583,13 +1552,13 @@ function decodePoolState(encodedAccount) {
|
|
|
1583
1552
|
getPoolStateDecoder()
|
|
1584
1553
|
);
|
|
1585
1554
|
}
|
|
1586
|
-
async function fetchPoolState(rpc,
|
|
1587
|
-
const maybeAccount = await fetchMaybePoolState(rpc,
|
|
1555
|
+
async function fetchPoolState(rpc, address5, config) {
|
|
1556
|
+
const maybeAccount = await fetchMaybePoolState(rpc, address5, config);
|
|
1588
1557
|
assertAccountExists5(maybeAccount);
|
|
1589
1558
|
return maybeAccount;
|
|
1590
1559
|
}
|
|
1591
|
-
async function fetchMaybePoolState(rpc,
|
|
1592
|
-
const maybeAccount = await fetchEncodedAccount5(rpc,
|
|
1560
|
+
async function fetchMaybePoolState(rpc, address5, config) {
|
|
1561
|
+
const maybeAccount = await fetchEncodedAccount5(rpc, address5, config);
|
|
1593
1562
|
return decodePoolState(maybeAccount);
|
|
1594
1563
|
}
|
|
1595
1564
|
async function fetchAllPoolState(rpc, addresses, config) {
|
|
@@ -1700,17 +1669,17 @@ function decodeProtocolPositionState(encodedAccount) {
|
|
|
1700
1669
|
getProtocolPositionStateDecoder()
|
|
1701
1670
|
);
|
|
1702
1671
|
}
|
|
1703
|
-
async function fetchProtocolPositionState(rpc,
|
|
1672
|
+
async function fetchProtocolPositionState(rpc, address5, config) {
|
|
1704
1673
|
const maybeAccount = await fetchMaybeProtocolPositionState(
|
|
1705
1674
|
rpc,
|
|
1706
|
-
|
|
1675
|
+
address5,
|
|
1707
1676
|
config
|
|
1708
1677
|
);
|
|
1709
1678
|
assertAccountExists6(maybeAccount);
|
|
1710
1679
|
return maybeAccount;
|
|
1711
1680
|
}
|
|
1712
|
-
async function fetchMaybeProtocolPositionState(rpc,
|
|
1713
|
-
const maybeAccount = await fetchEncodedAccount6(rpc,
|
|
1681
|
+
async function fetchMaybeProtocolPositionState(rpc, address5, config) {
|
|
1682
|
+
const maybeAccount = await fetchEncodedAccount6(rpc, address5, config);
|
|
1714
1683
|
return decodeProtocolPositionState(maybeAccount);
|
|
1715
1684
|
}
|
|
1716
1685
|
async function fetchAllProtocolPositionState(rpc, addresses, config) {
|
|
@@ -1805,17 +1774,17 @@ function decodeSupportMintAssociated(encodedAccount) {
|
|
|
1805
1774
|
getSupportMintAssociatedDecoder()
|
|
1806
1775
|
);
|
|
1807
1776
|
}
|
|
1808
|
-
async function fetchSupportMintAssociated(rpc,
|
|
1777
|
+
async function fetchSupportMintAssociated(rpc, address5, config) {
|
|
1809
1778
|
const maybeAccount = await fetchMaybeSupportMintAssociated(
|
|
1810
1779
|
rpc,
|
|
1811
|
-
|
|
1780
|
+
address5,
|
|
1812
1781
|
config
|
|
1813
1782
|
);
|
|
1814
1783
|
assertAccountExists7(maybeAccount);
|
|
1815
1784
|
return maybeAccount;
|
|
1816
1785
|
}
|
|
1817
|
-
async function fetchMaybeSupportMintAssociated(rpc,
|
|
1818
|
-
const maybeAccount = await fetchEncodedAccount7(rpc,
|
|
1786
|
+
async function fetchMaybeSupportMintAssociated(rpc, address5, config) {
|
|
1787
|
+
const maybeAccount = await fetchEncodedAccount7(rpc, address5, config);
|
|
1819
1788
|
return decodeSupportMintAssociated(maybeAccount);
|
|
1820
1789
|
}
|
|
1821
1790
|
async function fetchAllSupportMintAssociated(rpc, addresses, config) {
|
|
@@ -1928,17 +1897,17 @@ function decodeTickArrayBitmapExtension(encodedAccount) {
|
|
|
1928
1897
|
getTickArrayBitmapExtensionDecoder()
|
|
1929
1898
|
);
|
|
1930
1899
|
}
|
|
1931
|
-
async function fetchTickArrayBitmapExtension(rpc,
|
|
1900
|
+
async function fetchTickArrayBitmapExtension(rpc, address5, config) {
|
|
1932
1901
|
const maybeAccount = await fetchMaybeTickArrayBitmapExtension(
|
|
1933
1902
|
rpc,
|
|
1934
|
-
|
|
1903
|
+
address5,
|
|
1935
1904
|
config
|
|
1936
1905
|
);
|
|
1937
1906
|
assertAccountExists8(maybeAccount);
|
|
1938
1907
|
return maybeAccount;
|
|
1939
1908
|
}
|
|
1940
|
-
async function fetchMaybeTickArrayBitmapExtension(rpc,
|
|
1941
|
-
const maybeAccount = await fetchEncodedAccount8(rpc,
|
|
1909
|
+
async function fetchMaybeTickArrayBitmapExtension(rpc, address5, config) {
|
|
1910
|
+
const maybeAccount = await fetchEncodedAccount8(rpc, address5, config);
|
|
1942
1911
|
return decodeTickArrayBitmapExtension(maybeAccount);
|
|
1943
1912
|
}
|
|
1944
1913
|
async function fetchAllTickArrayBitmapExtension(rpc, addresses, config) {
|
|
@@ -2035,13 +2004,13 @@ function decodeTickArrayState(encodedAccount) {
|
|
|
2035
2004
|
getTickArrayStateDecoder()
|
|
2036
2005
|
);
|
|
2037
2006
|
}
|
|
2038
|
-
async function fetchTickArrayState(rpc,
|
|
2039
|
-
const maybeAccount = await fetchMaybeTickArrayState(rpc,
|
|
2007
|
+
async function fetchTickArrayState(rpc, address5, config) {
|
|
2008
|
+
const maybeAccount = await fetchMaybeTickArrayState(rpc, address5, config);
|
|
2040
2009
|
assertAccountExists9(maybeAccount);
|
|
2041
2010
|
return maybeAccount;
|
|
2042
2011
|
}
|
|
2043
|
-
async function fetchMaybeTickArrayState(rpc,
|
|
2044
|
-
const maybeAccount = await fetchEncodedAccount9(rpc,
|
|
2012
|
+
async function fetchMaybeTickArrayState(rpc, address5, config) {
|
|
2013
|
+
const maybeAccount = await fetchEncodedAccount9(rpc, address5, config);
|
|
2045
2014
|
return decodeTickArrayState(maybeAccount);
|
|
2046
2015
|
}
|
|
2047
2016
|
async function fetchAllTickArrayState(rpc, addresses, config) {
|
|
@@ -2184,23 +2153,18 @@ var AmmV3Instruction = /* @__PURE__ */ ((AmmV3Instruction2) => {
|
|
|
2184
2153
|
AmmV3Instruction2[AmmV3Instruction2["CreateOperationAccount"] = 6] = "CreateOperationAccount";
|
|
2185
2154
|
AmmV3Instruction2[AmmV3Instruction2["CreatePool"] = 7] = "CreatePool";
|
|
2186
2155
|
AmmV3Instruction2[AmmV3Instruction2["CreateSupportMintAssociated"] = 8] = "CreateSupportMintAssociated";
|
|
2187
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
2188
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
2189
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
2190
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
2191
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
2192
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
2193
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
2194
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
2195
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
2196
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
2197
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
2198
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
2199
|
-
AmmV3Instruction2[AmmV3Instruction2["TransferRewardOwner"] = 21] = "TransferRewardOwner";
|
|
2200
|
-
AmmV3Instruction2[AmmV3Instruction2["UpdateAmmConfig"] = 22] = "UpdateAmmConfig";
|
|
2201
|
-
AmmV3Instruction2[AmmV3Instruction2["UpdateOperationAccount"] = 23] = "UpdateOperationAccount";
|
|
2202
|
-
AmmV3Instruction2[AmmV3Instruction2["UpdatePoolStatus"] = 24] = "UpdatePoolStatus";
|
|
2203
|
-
AmmV3Instruction2[AmmV3Instruction2["UpdateRewardInfos"] = 25] = "UpdateRewardInfos";
|
|
2156
|
+
AmmV3Instruction2[AmmV3Instruction2["DecreaseLiquidityV2"] = 9] = "DecreaseLiquidityV2";
|
|
2157
|
+
AmmV3Instruction2[AmmV3Instruction2["IncreaseLiquidityV2"] = 10] = "IncreaseLiquidityV2";
|
|
2158
|
+
AmmV3Instruction2[AmmV3Instruction2["InitializeReward"] = 11] = "InitializeReward";
|
|
2159
|
+
AmmV3Instruction2[AmmV3Instruction2["OpenPositionWithToken22Nft"] = 12] = "OpenPositionWithToken22Nft";
|
|
2160
|
+
AmmV3Instruction2[AmmV3Instruction2["SetRewardParams"] = 13] = "SetRewardParams";
|
|
2161
|
+
AmmV3Instruction2[AmmV3Instruction2["SwapRouterBaseIn"] = 14] = "SwapRouterBaseIn";
|
|
2162
|
+
AmmV3Instruction2[AmmV3Instruction2["SwapV2"] = 15] = "SwapV2";
|
|
2163
|
+
AmmV3Instruction2[AmmV3Instruction2["TransferRewardOwner"] = 16] = "TransferRewardOwner";
|
|
2164
|
+
AmmV3Instruction2[AmmV3Instruction2["UpdateAmmConfig"] = 17] = "UpdateAmmConfig";
|
|
2165
|
+
AmmV3Instruction2[AmmV3Instruction2["UpdateOperationAccount"] = 18] = "UpdateOperationAccount";
|
|
2166
|
+
AmmV3Instruction2[AmmV3Instruction2["UpdatePoolStatus"] = 19] = "UpdatePoolStatus";
|
|
2167
|
+
AmmV3Instruction2[AmmV3Instruction2["UpdateRewardInfos"] = 20] = "UpdateRewardInfos";
|
|
2204
2168
|
return AmmV3Instruction2;
|
|
2205
2169
|
})(AmmV3Instruction || {});
|
|
2206
2170
|
function identifyAmmV3Instruction(instruction) {
|
|
@@ -2286,15 +2250,6 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2286
2250
|
)) {
|
|
2287
2251
|
return 8 /* CreateSupportMintAssociated */;
|
|
2288
2252
|
}
|
|
2289
|
-
if (containsBytes(
|
|
2290
|
-
data,
|
|
2291
|
-
fixEncoderSize10(getBytesEncoder10(), 8).encode(
|
|
2292
|
-
new Uint8Array([160, 38, 208, 111, 104, 91, 44, 1])
|
|
2293
|
-
),
|
|
2294
|
-
0
|
|
2295
|
-
)) {
|
|
2296
|
-
return 9 /* DecreaseLiquidity */;
|
|
2297
|
-
}
|
|
2298
2253
|
if (containsBytes(
|
|
2299
2254
|
data,
|
|
2300
2255
|
fixEncoderSize10(getBytesEncoder10(), 8).encode(
|
|
@@ -2302,16 +2257,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2302
2257
|
),
|
|
2303
2258
|
0
|
|
2304
2259
|
)) {
|
|
2305
|
-
return
|
|
2306
|
-
}
|
|
2307
|
-
if (containsBytes(
|
|
2308
|
-
data,
|
|
2309
|
-
fixEncoderSize10(getBytesEncoder10(), 8).encode(
|
|
2310
|
-
new Uint8Array([46, 156, 243, 118, 13, 205, 251, 178])
|
|
2311
|
-
),
|
|
2312
|
-
0
|
|
2313
|
-
)) {
|
|
2314
|
-
return 11 /* IncreaseLiquidity */;
|
|
2260
|
+
return 9 /* DecreaseLiquidityV2 */;
|
|
2315
2261
|
}
|
|
2316
2262
|
if (containsBytes(
|
|
2317
2263
|
data,
|
|
@@ -2320,7 +2266,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2320
2266
|
),
|
|
2321
2267
|
0
|
|
2322
2268
|
)) {
|
|
2323
|
-
return
|
|
2269
|
+
return 10 /* IncreaseLiquidityV2 */;
|
|
2324
2270
|
}
|
|
2325
2271
|
if (containsBytes(
|
|
2326
2272
|
data,
|
|
@@ -2329,25 +2275,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2329
2275
|
),
|
|
2330
2276
|
0
|
|
2331
2277
|
)) {
|
|
2332
|
-
return
|
|
2333
|
-
}
|
|
2334
|
-
if (containsBytes(
|
|
2335
|
-
data,
|
|
2336
|
-
fixEncoderSize10(getBytesEncoder10(), 8).encode(
|
|
2337
|
-
new Uint8Array([135, 128, 47, 77, 15, 152, 240, 49])
|
|
2338
|
-
),
|
|
2339
|
-
0
|
|
2340
|
-
)) {
|
|
2341
|
-
return 14 /* OpenPosition */;
|
|
2342
|
-
}
|
|
2343
|
-
if (containsBytes(
|
|
2344
|
-
data,
|
|
2345
|
-
fixEncoderSize10(getBytesEncoder10(), 8).encode(
|
|
2346
|
-
new Uint8Array([77, 184, 74, 214, 112, 86, 241, 199])
|
|
2347
|
-
),
|
|
2348
|
-
0
|
|
2349
|
-
)) {
|
|
2350
|
-
return 15 /* OpenPositionV2 */;
|
|
2278
|
+
return 11 /* InitializeReward */;
|
|
2351
2279
|
}
|
|
2352
2280
|
if (containsBytes(
|
|
2353
2281
|
data,
|
|
@@ -2356,7 +2284,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2356
2284
|
),
|
|
2357
2285
|
0
|
|
2358
2286
|
)) {
|
|
2359
|
-
return
|
|
2287
|
+
return 12 /* OpenPositionWithToken22Nft */;
|
|
2360
2288
|
}
|
|
2361
2289
|
if (containsBytes(
|
|
2362
2290
|
data,
|
|
@@ -2365,16 +2293,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2365
2293
|
),
|
|
2366
2294
|
0
|
|
2367
2295
|
)) {
|
|
2368
|
-
return
|
|
2369
|
-
}
|
|
2370
|
-
if (containsBytes(
|
|
2371
|
-
data,
|
|
2372
|
-
fixEncoderSize10(getBytesEncoder10(), 8).encode(
|
|
2373
|
-
new Uint8Array([248, 198, 158, 145, 225, 117, 135, 200])
|
|
2374
|
-
),
|
|
2375
|
-
0
|
|
2376
|
-
)) {
|
|
2377
|
-
return 18 /* Swap */;
|
|
2296
|
+
return 13 /* SetRewardParams */;
|
|
2378
2297
|
}
|
|
2379
2298
|
if (containsBytes(
|
|
2380
2299
|
data,
|
|
@@ -2383,7 +2302,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2383
2302
|
),
|
|
2384
2303
|
0
|
|
2385
2304
|
)) {
|
|
2386
|
-
return
|
|
2305
|
+
return 14 /* SwapRouterBaseIn */;
|
|
2387
2306
|
}
|
|
2388
2307
|
if (containsBytes(
|
|
2389
2308
|
data,
|
|
@@ -2392,7 +2311,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2392
2311
|
),
|
|
2393
2312
|
0
|
|
2394
2313
|
)) {
|
|
2395
|
-
return
|
|
2314
|
+
return 15 /* SwapV2 */;
|
|
2396
2315
|
}
|
|
2397
2316
|
if (containsBytes(
|
|
2398
2317
|
data,
|
|
@@ -2401,7 +2320,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2401
2320
|
),
|
|
2402
2321
|
0
|
|
2403
2322
|
)) {
|
|
2404
|
-
return
|
|
2323
|
+
return 16 /* TransferRewardOwner */;
|
|
2405
2324
|
}
|
|
2406
2325
|
if (containsBytes(
|
|
2407
2326
|
data,
|
|
@@ -2410,7 +2329,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2410
2329
|
),
|
|
2411
2330
|
0
|
|
2412
2331
|
)) {
|
|
2413
|
-
return
|
|
2332
|
+
return 17 /* UpdateAmmConfig */;
|
|
2414
2333
|
}
|
|
2415
2334
|
if (containsBytes(
|
|
2416
2335
|
data,
|
|
@@ -2419,7 +2338,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2419
2338
|
),
|
|
2420
2339
|
0
|
|
2421
2340
|
)) {
|
|
2422
|
-
return
|
|
2341
|
+
return 18 /* UpdateOperationAccount */;
|
|
2423
2342
|
}
|
|
2424
2343
|
if (containsBytes(
|
|
2425
2344
|
data,
|
|
@@ -2428,7 +2347,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2428
2347
|
),
|
|
2429
2348
|
0
|
|
2430
2349
|
)) {
|
|
2431
|
-
return
|
|
2350
|
+
return 19 /* UpdatePoolStatus */;
|
|
2432
2351
|
}
|
|
2433
2352
|
if (containsBytes(
|
|
2434
2353
|
data,
|
|
@@ -2437,7 +2356,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2437
2356
|
),
|
|
2438
2357
|
0
|
|
2439
2358
|
)) {
|
|
2440
|
-
return
|
|
2359
|
+
return 20 /* UpdateRewardInfos */;
|
|
2441
2360
|
}
|
|
2442
2361
|
throw new Error(
|
|
2443
2362
|
"The provided instruction could not be identified as a ammV3 instruction."
|
|
@@ -2511,7 +2430,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
2511
2430
|
[AMM_V3_ERROR__INVALID_TICK_ARRAY]: `Invalid tick array account`,
|
|
2512
2431
|
[AMM_V3_ERROR__INVALID_TICK_ARRAY_BOUNDARY]: `Invalid tick array boundary`,
|
|
2513
2432
|
[AMM_V3_ERROR__INVALID_TICK_INDEX]: `Tick out of range`,
|
|
2514
|
-
[AMM_V3_ERROR__INVALID_UPDATE_CONFIG_FLAG]: `invalid update
|
|
2433
|
+
[AMM_V3_ERROR__INVALID_UPDATE_CONFIG_FLAG]: `invalid update clmm config flag`,
|
|
2515
2434
|
[AMM_V3_ERROR__LIQUIDITY_ADD_VALUE_ERR]: `Liquidity add delta L must be greater, or equal to before`,
|
|
2516
2435
|
[AMM_V3_ERROR__LIQUIDITY_INSUFFICIENT]: `Liquidity insufficient`,
|
|
2517
2436
|
[AMM_V3_ERROR__LIQUIDITY_SUB_VALUE_ERR]: `Liquidity sub delta L must be smaller than before`,
|
|
@@ -2816,7 +2735,7 @@ function getCloseProtocolPositionInstruction(input, config) {
|
|
|
2816
2735
|
};
|
|
2817
2736
|
const accounts = originalAccounts;
|
|
2818
2737
|
if (!accounts.admin.value) {
|
|
2819
|
-
accounts.admin.value = "
|
|
2738
|
+
accounts.admin.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
2820
2739
|
}
|
|
2821
2740
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2822
2741
|
return Object.freeze({
|
|
@@ -3318,7 +3237,7 @@ async function getCreateAmmConfigInstructionAsync(input, config) {
|
|
|
3318
3237
|
const accounts = originalAccounts;
|
|
3319
3238
|
const args = { ...input };
|
|
3320
3239
|
if (!accounts.owner.value) {
|
|
3321
|
-
accounts.owner.value = "
|
|
3240
|
+
accounts.owner.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
3322
3241
|
}
|
|
3323
3242
|
if (!accounts.ammConfig.value) {
|
|
3324
3243
|
accounts.ammConfig.value = await getProgramDerivedAddress2({
|
|
@@ -3357,7 +3276,7 @@ function getCreateAmmConfigInstruction(input, config) {
|
|
|
3357
3276
|
const accounts = originalAccounts;
|
|
3358
3277
|
const args = { ...input };
|
|
3359
3278
|
if (!accounts.owner.value) {
|
|
3360
|
-
accounts.owner.value = "
|
|
3279
|
+
accounts.owner.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
3361
3280
|
}
|
|
3362
3281
|
if (!accounts.systemProgram.value) {
|
|
3363
3282
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
@@ -3452,7 +3371,7 @@ async function getCreateOperationAccountInstructionAsync(input, config) {
|
|
|
3452
3371
|
};
|
|
3453
3372
|
const accounts = originalAccounts;
|
|
3454
3373
|
if (!accounts.owner.value) {
|
|
3455
|
-
accounts.owner.value = "
|
|
3374
|
+
accounts.owner.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
3456
3375
|
}
|
|
3457
3376
|
if (!accounts.operationState.value) {
|
|
3458
3377
|
accounts.operationState.value = await getProgramDerivedAddress3({
|
|
@@ -3487,7 +3406,7 @@ function getCreateOperationAccountInstruction(input, config) {
|
|
|
3487
3406
|
};
|
|
3488
3407
|
const accounts = originalAccounts;
|
|
3489
3408
|
if (!accounts.owner.value) {
|
|
3490
|
-
accounts.owner.value = "
|
|
3409
|
+
accounts.owner.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
3491
3410
|
}
|
|
3492
3411
|
if (!accounts.systemProgram.value) {
|
|
3493
3412
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
@@ -3952,7 +3871,7 @@ function parseCreateSupportMintAssociatedInstruction(instruction) {
|
|
|
3952
3871
|
};
|
|
3953
3872
|
}
|
|
3954
3873
|
|
|
3955
|
-
// src/generated/instructions/
|
|
3874
|
+
// src/generated/instructions/decreaseLiquidityV2.ts
|
|
3956
3875
|
import {
|
|
3957
3876
|
combineCodec as combineCodec34,
|
|
3958
3877
|
fixDecoderSize as fixDecoderSize19,
|
|
@@ -3967,22 +3886,22 @@ import {
|
|
|
3967
3886
|
getU64Encoder as getU64Encoder22,
|
|
3968
3887
|
transformEncoder as transformEncoder19
|
|
3969
3888
|
} from "@solana/kit";
|
|
3970
|
-
var
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3889
|
+
var DECREASE_LIQUIDITY_V2_DISCRIMINATOR = new Uint8Array([
|
|
3890
|
+
58,
|
|
3891
|
+
127,
|
|
3892
|
+
188,
|
|
3893
|
+
62,
|
|
3894
|
+
79,
|
|
3895
|
+
82,
|
|
3896
|
+
196,
|
|
3897
|
+
96
|
|
3979
3898
|
]);
|
|
3980
|
-
function
|
|
3899
|
+
function getDecreaseLiquidityV2DiscriminatorBytes() {
|
|
3981
3900
|
return fixEncoderSize20(getBytesEncoder20(), 8).encode(
|
|
3982
|
-
|
|
3901
|
+
DECREASE_LIQUIDITY_V2_DISCRIMINATOR
|
|
3983
3902
|
);
|
|
3984
3903
|
}
|
|
3985
|
-
function
|
|
3904
|
+
function getDecreaseLiquidityV2InstructionDataEncoder() {
|
|
3986
3905
|
return transformEncoder19(
|
|
3987
3906
|
getStructEncoder34([
|
|
3988
3907
|
["discriminator", fixEncoderSize20(getBytesEncoder20(), 8)],
|
|
@@ -3990,10 +3909,13 @@ function getDecreaseLiquidityInstructionDataEncoder() {
|
|
|
3990
3909
|
["amount0Min", getU64Encoder22()],
|
|
3991
3910
|
["amount1Min", getU64Encoder22()]
|
|
3992
3911
|
]),
|
|
3993
|
-
(value) => ({
|
|
3912
|
+
(value) => ({
|
|
3913
|
+
...value,
|
|
3914
|
+
discriminator: DECREASE_LIQUIDITY_V2_DISCRIMINATOR
|
|
3915
|
+
})
|
|
3994
3916
|
);
|
|
3995
3917
|
}
|
|
3996
|
-
function
|
|
3918
|
+
function getDecreaseLiquidityV2InstructionDataDecoder() {
|
|
3997
3919
|
return getStructDecoder34([
|
|
3998
3920
|
["discriminator", fixDecoderSize19(getBytesDecoder19(), 8)],
|
|
3999
3921
|
["liquidity", getU128Decoder16()],
|
|
@@ -4001,13 +3923,13 @@ function getDecreaseLiquidityInstructionDataDecoder() {
|
|
|
4001
3923
|
["amount1Min", getU64Decoder22()]
|
|
4002
3924
|
]);
|
|
4003
3925
|
}
|
|
4004
|
-
function
|
|
3926
|
+
function getDecreaseLiquidityV2InstructionDataCodec() {
|
|
4005
3927
|
return combineCodec34(
|
|
4006
|
-
|
|
4007
|
-
|
|
3928
|
+
getDecreaseLiquidityV2InstructionDataEncoder(),
|
|
3929
|
+
getDecreaseLiquidityV2InstructionDataDecoder()
|
|
4008
3930
|
);
|
|
4009
3931
|
}
|
|
4010
|
-
function
|
|
3932
|
+
function getDecreaseLiquidityV2Instruction(input, config) {
|
|
4011
3933
|
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
4012
3934
|
const originalAccounts = {
|
|
4013
3935
|
nftOwner: { value: input.nftOwner ?? null, isWritable: false },
|
|
@@ -4033,13 +3955,26 @@ function getDecreaseLiquidityInstruction(input, config) {
|
|
|
4033
3955
|
value: input.recipientTokenAccount1 ?? null,
|
|
4034
3956
|
isWritable: true
|
|
4035
3957
|
},
|
|
4036
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }
|
|
3958
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
3959
|
+
tokenProgram2022: {
|
|
3960
|
+
value: input.tokenProgram2022 ?? null,
|
|
3961
|
+
isWritable: false
|
|
3962
|
+
},
|
|
3963
|
+
memoProgram: { value: input.memoProgram ?? null, isWritable: false },
|
|
3964
|
+
vault0Mint: { value: input.vault0Mint ?? null, isWritable: false },
|
|
3965
|
+
vault1Mint: { value: input.vault1Mint ?? null, isWritable: false }
|
|
4037
3966
|
};
|
|
4038
3967
|
const accounts = originalAccounts;
|
|
4039
3968
|
const args = { ...input };
|
|
4040
3969
|
if (!accounts.tokenProgram.value) {
|
|
4041
3970
|
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
4042
3971
|
}
|
|
3972
|
+
if (!accounts.tokenProgram2022.value) {
|
|
3973
|
+
accounts.tokenProgram2022.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
3974
|
+
}
|
|
3975
|
+
if (!accounts.memoProgram.value) {
|
|
3976
|
+
accounts.memoProgram.value = "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";
|
|
3977
|
+
}
|
|
4043
3978
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4044
3979
|
return Object.freeze({
|
|
4045
3980
|
accounts: [
|
|
@@ -4054,16 +3989,20 @@ function getDecreaseLiquidityInstruction(input, config) {
|
|
|
4054
3989
|
getAccountMeta(accounts.tickArrayUpper),
|
|
4055
3990
|
getAccountMeta(accounts.recipientTokenAccount0),
|
|
4056
3991
|
getAccountMeta(accounts.recipientTokenAccount1),
|
|
4057
|
-
getAccountMeta(accounts.tokenProgram)
|
|
3992
|
+
getAccountMeta(accounts.tokenProgram),
|
|
3993
|
+
getAccountMeta(accounts.tokenProgram2022),
|
|
3994
|
+
getAccountMeta(accounts.memoProgram),
|
|
3995
|
+
getAccountMeta(accounts.vault0Mint),
|
|
3996
|
+
getAccountMeta(accounts.vault1Mint)
|
|
4058
3997
|
],
|
|
4059
|
-
data:
|
|
3998
|
+
data: getDecreaseLiquidityV2InstructionDataEncoder().encode(
|
|
4060
3999
|
args
|
|
4061
4000
|
),
|
|
4062
4001
|
programAddress
|
|
4063
4002
|
});
|
|
4064
4003
|
}
|
|
4065
|
-
function
|
|
4066
|
-
if (instruction.accounts.length <
|
|
4004
|
+
function parseDecreaseLiquidityV2Instruction(instruction) {
|
|
4005
|
+
if (instruction.accounts.length < 16) {
|
|
4067
4006
|
throw new Error("Not enough accounts");
|
|
4068
4007
|
}
|
|
4069
4008
|
let accountIndex = 0;
|
|
@@ -4086,19 +4025,29 @@ function parseDecreaseLiquidityInstruction(instruction) {
|
|
|
4086
4025
|
tickArrayUpper: getNextAccount(),
|
|
4087
4026
|
recipientTokenAccount0: getNextAccount(),
|
|
4088
4027
|
recipientTokenAccount1: getNextAccount(),
|
|
4089
|
-
tokenProgram: getNextAccount()
|
|
4028
|
+
tokenProgram: getNextAccount(),
|
|
4029
|
+
tokenProgram2022: getNextAccount(),
|
|
4030
|
+
memoProgram: getNextAccount(),
|
|
4031
|
+
vault0Mint: getNextAccount(),
|
|
4032
|
+
vault1Mint: getNextAccount()
|
|
4090
4033
|
},
|
|
4091
|
-
data:
|
|
4034
|
+
data: getDecreaseLiquidityV2InstructionDataDecoder().decode(
|
|
4035
|
+
instruction.data
|
|
4036
|
+
)
|
|
4092
4037
|
};
|
|
4093
4038
|
}
|
|
4094
4039
|
|
|
4095
|
-
// src/generated/instructions/
|
|
4040
|
+
// src/generated/instructions/increaseLiquidityV2.ts
|
|
4096
4041
|
import {
|
|
4097
4042
|
combineCodec as combineCodec35,
|
|
4098
4043
|
fixDecoderSize as fixDecoderSize20,
|
|
4099
4044
|
fixEncoderSize as fixEncoderSize21,
|
|
4045
|
+
getBooleanDecoder as getBooleanDecoder3,
|
|
4046
|
+
getBooleanEncoder as getBooleanEncoder3,
|
|
4100
4047
|
getBytesDecoder as getBytesDecoder20,
|
|
4101
4048
|
getBytesEncoder as getBytesEncoder21,
|
|
4049
|
+
getOptionDecoder,
|
|
4050
|
+
getOptionEncoder,
|
|
4102
4051
|
getStructDecoder as getStructDecoder35,
|
|
4103
4052
|
getStructEncoder as getStructEncoder35,
|
|
4104
4053
|
getU128Decoder as getU128Decoder17,
|
|
@@ -4107,81 +4056,76 @@ import {
|
|
|
4107
4056
|
getU64Encoder as getU64Encoder23,
|
|
4108
4057
|
transformEncoder as transformEncoder20
|
|
4109
4058
|
} from "@solana/kit";
|
|
4110
|
-
var
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4059
|
+
var INCREASE_LIQUIDITY_V2_DISCRIMINATOR = new Uint8Array([
|
|
4060
|
+
133,
|
|
4061
|
+
29,
|
|
4062
|
+
89,
|
|
4063
|
+
223,
|
|
4064
|
+
69,
|
|
4065
|
+
238,
|
|
4066
|
+
176,
|
|
4067
|
+
10
|
|
4119
4068
|
]);
|
|
4120
|
-
function
|
|
4069
|
+
function getIncreaseLiquidityV2DiscriminatorBytes() {
|
|
4121
4070
|
return fixEncoderSize21(getBytesEncoder21(), 8).encode(
|
|
4122
|
-
|
|
4071
|
+
INCREASE_LIQUIDITY_V2_DISCRIMINATOR
|
|
4123
4072
|
);
|
|
4124
4073
|
}
|
|
4125
|
-
function
|
|
4074
|
+
function getIncreaseLiquidityV2InstructionDataEncoder() {
|
|
4126
4075
|
return transformEncoder20(
|
|
4127
4076
|
getStructEncoder35([
|
|
4128
4077
|
["discriminator", fixEncoderSize21(getBytesEncoder21(), 8)],
|
|
4129
4078
|
["liquidity", getU128Encoder17()],
|
|
4130
|
-
["
|
|
4131
|
-
["
|
|
4079
|
+
["amount0Max", getU64Encoder23()],
|
|
4080
|
+
["amount1Max", getU64Encoder23()],
|
|
4081
|
+
["baseFlag", getOptionEncoder(getBooleanEncoder3())]
|
|
4132
4082
|
]),
|
|
4133
4083
|
(value) => ({
|
|
4134
4084
|
...value,
|
|
4135
|
-
discriminator:
|
|
4085
|
+
discriminator: INCREASE_LIQUIDITY_V2_DISCRIMINATOR
|
|
4136
4086
|
})
|
|
4137
4087
|
);
|
|
4138
4088
|
}
|
|
4139
|
-
function
|
|
4089
|
+
function getIncreaseLiquidityV2InstructionDataDecoder() {
|
|
4140
4090
|
return getStructDecoder35([
|
|
4141
4091
|
["discriminator", fixDecoderSize20(getBytesDecoder20(), 8)],
|
|
4142
4092
|
["liquidity", getU128Decoder17()],
|
|
4143
|
-
["
|
|
4144
|
-
["
|
|
4093
|
+
["amount0Max", getU64Decoder23()],
|
|
4094
|
+
["amount1Max", getU64Decoder23()],
|
|
4095
|
+
["baseFlag", getOptionDecoder(getBooleanDecoder3())]
|
|
4145
4096
|
]);
|
|
4146
4097
|
}
|
|
4147
|
-
function
|
|
4098
|
+
function getIncreaseLiquidityV2InstructionDataCodec() {
|
|
4148
4099
|
return combineCodec35(
|
|
4149
|
-
|
|
4150
|
-
|
|
4100
|
+
getIncreaseLiquidityV2InstructionDataEncoder(),
|
|
4101
|
+
getIncreaseLiquidityV2InstructionDataDecoder()
|
|
4151
4102
|
);
|
|
4152
4103
|
}
|
|
4153
|
-
function
|
|
4104
|
+
function getIncreaseLiquidityV2Instruction(input, config) {
|
|
4154
4105
|
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
4155
4106
|
const originalAccounts = {
|
|
4156
4107
|
nftOwner: { value: input.nftOwner ?? null, isWritable: false },
|
|
4157
4108
|
nftAccount: { value: input.nftAccount ?? null, isWritable: false },
|
|
4158
|
-
personalPosition: {
|
|
4159
|
-
value: input.personalPosition ?? null,
|
|
4160
|
-
isWritable: true
|
|
4161
|
-
},
|
|
4162
4109
|
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
4163
4110
|
protocolPosition: {
|
|
4164
4111
|
value: input.protocolPosition ?? null,
|
|
4165
4112
|
isWritable: false
|
|
4166
4113
|
},
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
tickArrayLower: { value: input.tickArrayLower ?? null, isWritable: true },
|
|
4170
|
-
tickArrayUpper: { value: input.tickArrayUpper ?? null, isWritable: true },
|
|
4171
|
-
recipientTokenAccount0: {
|
|
4172
|
-
value: input.recipientTokenAccount0 ?? null,
|
|
4173
|
-
isWritable: true
|
|
4174
|
-
},
|
|
4175
|
-
recipientTokenAccount1: {
|
|
4176
|
-
value: input.recipientTokenAccount1 ?? null,
|
|
4114
|
+
personalPosition: {
|
|
4115
|
+
value: input.personalPosition ?? null,
|
|
4177
4116
|
isWritable: true
|
|
4178
4117
|
},
|
|
4118
|
+
tickArrayLower: { value: input.tickArrayLower ?? null, isWritable: true },
|
|
4119
|
+
tickArrayUpper: { value: input.tickArrayUpper ?? null, isWritable: true },
|
|
4120
|
+
tokenAccount0: { value: input.tokenAccount0 ?? null, isWritable: true },
|
|
4121
|
+
tokenAccount1: { value: input.tokenAccount1 ?? null, isWritable: true },
|
|
4122
|
+
tokenVault0: { value: input.tokenVault0 ?? null, isWritable: true },
|
|
4123
|
+
tokenVault1: { value: input.tokenVault1 ?? null, isWritable: true },
|
|
4179
4124
|
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
4180
4125
|
tokenProgram2022: {
|
|
4181
4126
|
value: input.tokenProgram2022 ?? null,
|
|
4182
4127
|
isWritable: false
|
|
4183
4128
|
},
|
|
4184
|
-
memoProgram: { value: input.memoProgram ?? null, isWritable: false },
|
|
4185
4129
|
vault0Mint: { value: input.vault0Mint ?? null, isWritable: false },
|
|
4186
4130
|
vault1Mint: { value: input.vault1Mint ?? null, isWritable: false }
|
|
4187
4131
|
};
|
|
@@ -4193,37 +4137,33 @@ function getDecreaseLiquidityV2Instruction(input, config) {
|
|
|
4193
4137
|
if (!accounts.tokenProgram2022.value) {
|
|
4194
4138
|
accounts.tokenProgram2022.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
4195
4139
|
}
|
|
4196
|
-
if (!accounts.memoProgram.value) {
|
|
4197
|
-
accounts.memoProgram.value = "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";
|
|
4198
|
-
}
|
|
4199
4140
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4200
4141
|
return Object.freeze({
|
|
4201
4142
|
accounts: [
|
|
4202
4143
|
getAccountMeta(accounts.nftOwner),
|
|
4203
4144
|
getAccountMeta(accounts.nftAccount),
|
|
4204
|
-
getAccountMeta(accounts.personalPosition),
|
|
4205
4145
|
getAccountMeta(accounts.poolState),
|
|
4206
4146
|
getAccountMeta(accounts.protocolPosition),
|
|
4207
|
-
getAccountMeta(accounts.
|
|
4208
|
-
getAccountMeta(accounts.tokenVault1),
|
|
4147
|
+
getAccountMeta(accounts.personalPosition),
|
|
4209
4148
|
getAccountMeta(accounts.tickArrayLower),
|
|
4210
4149
|
getAccountMeta(accounts.tickArrayUpper),
|
|
4211
|
-
getAccountMeta(accounts.
|
|
4212
|
-
getAccountMeta(accounts.
|
|
4150
|
+
getAccountMeta(accounts.tokenAccount0),
|
|
4151
|
+
getAccountMeta(accounts.tokenAccount1),
|
|
4152
|
+
getAccountMeta(accounts.tokenVault0),
|
|
4153
|
+
getAccountMeta(accounts.tokenVault1),
|
|
4213
4154
|
getAccountMeta(accounts.tokenProgram),
|
|
4214
4155
|
getAccountMeta(accounts.tokenProgram2022),
|
|
4215
|
-
getAccountMeta(accounts.memoProgram),
|
|
4216
4156
|
getAccountMeta(accounts.vault0Mint),
|
|
4217
4157
|
getAccountMeta(accounts.vault1Mint)
|
|
4218
4158
|
],
|
|
4219
|
-
data:
|
|
4159
|
+
data: getIncreaseLiquidityV2InstructionDataEncoder().encode(
|
|
4220
4160
|
args
|
|
4221
4161
|
),
|
|
4222
4162
|
programAddress
|
|
4223
4163
|
});
|
|
4224
4164
|
}
|
|
4225
|
-
function
|
|
4226
|
-
if (instruction.accounts.length <
|
|
4165
|
+
function parseIncreaseLiquidityV2Instruction(instruction) {
|
|
4166
|
+
if (instruction.accounts.length < 15) {
|
|
4227
4167
|
throw new Error("Not enough accounts");
|
|
4228
4168
|
}
|
|
4229
4169
|
let accountIndex = 0;
|
|
@@ -4237,34 +4177,35 @@ function parseDecreaseLiquidityV2Instruction(instruction) {
|
|
|
4237
4177
|
accounts: {
|
|
4238
4178
|
nftOwner: getNextAccount(),
|
|
4239
4179
|
nftAccount: getNextAccount(),
|
|
4240
|
-
personalPosition: getNextAccount(),
|
|
4241
4180
|
poolState: getNextAccount(),
|
|
4242
4181
|
protocolPosition: getNextAccount(),
|
|
4243
|
-
|
|
4244
|
-
tokenVault1: getNextAccount(),
|
|
4182
|
+
personalPosition: getNextAccount(),
|
|
4245
4183
|
tickArrayLower: getNextAccount(),
|
|
4246
4184
|
tickArrayUpper: getNextAccount(),
|
|
4247
|
-
|
|
4248
|
-
|
|
4185
|
+
tokenAccount0: getNextAccount(),
|
|
4186
|
+
tokenAccount1: getNextAccount(),
|
|
4187
|
+
tokenVault0: getNextAccount(),
|
|
4188
|
+
tokenVault1: getNextAccount(),
|
|
4249
4189
|
tokenProgram: getNextAccount(),
|
|
4250
4190
|
tokenProgram2022: getNextAccount(),
|
|
4251
|
-
memoProgram: getNextAccount(),
|
|
4252
4191
|
vault0Mint: getNextAccount(),
|
|
4253
4192
|
vault1Mint: getNextAccount()
|
|
4254
4193
|
},
|
|
4255
|
-
data:
|
|
4194
|
+
data: getIncreaseLiquidityV2InstructionDataDecoder().decode(
|
|
4256
4195
|
instruction.data
|
|
4257
4196
|
)
|
|
4258
4197
|
};
|
|
4259
4198
|
}
|
|
4260
4199
|
|
|
4261
|
-
// src/generated/instructions/
|
|
4200
|
+
// src/generated/instructions/initializeReward.ts
|
|
4262
4201
|
import {
|
|
4263
4202
|
combineCodec as combineCodec36,
|
|
4264
4203
|
fixDecoderSize as fixDecoderSize21,
|
|
4265
4204
|
fixEncoderSize as fixEncoderSize22,
|
|
4205
|
+
getAddressEncoder as getAddressEncoder23,
|
|
4266
4206
|
getBytesDecoder as getBytesDecoder21,
|
|
4267
4207
|
getBytesEncoder as getBytesEncoder22,
|
|
4208
|
+
getProgramDerivedAddress as getProgramDerivedAddress6,
|
|
4268
4209
|
getStructDecoder as getStructDecoder36,
|
|
4269
4210
|
getStructEncoder as getStructEncoder36,
|
|
4270
4211
|
getU128Decoder as getU128Decoder18,
|
|
@@ -4273,1245 +4214,198 @@ import {
|
|
|
4273
4214
|
getU64Encoder as getU64Encoder24,
|
|
4274
4215
|
transformEncoder as transformEncoder21
|
|
4275
4216
|
} from "@solana/kit";
|
|
4276
|
-
var
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4217
|
+
var INITIALIZE_REWARD_DISCRIMINATOR = new Uint8Array([
|
|
4218
|
+
95,
|
|
4219
|
+
135,
|
|
4220
|
+
192,
|
|
4221
|
+
196,
|
|
4222
|
+
242,
|
|
4223
|
+
129,
|
|
4224
|
+
230,
|
|
4225
|
+
68
|
|
4285
4226
|
]);
|
|
4286
|
-
function
|
|
4227
|
+
function getInitializeRewardDiscriminatorBytes() {
|
|
4287
4228
|
return fixEncoderSize22(getBytesEncoder22(), 8).encode(
|
|
4288
|
-
|
|
4229
|
+
INITIALIZE_REWARD_DISCRIMINATOR
|
|
4289
4230
|
);
|
|
4290
4231
|
}
|
|
4291
|
-
function
|
|
4232
|
+
function getInitializeRewardInstructionDataEncoder() {
|
|
4292
4233
|
return transformEncoder21(
|
|
4293
4234
|
getStructEncoder36([
|
|
4294
4235
|
["discriminator", fixEncoderSize22(getBytesEncoder22(), 8)],
|
|
4295
|
-
["
|
|
4296
|
-
["
|
|
4297
|
-
["
|
|
4236
|
+
["openTime", getU64Encoder24()],
|
|
4237
|
+
["endTime", getU64Encoder24()],
|
|
4238
|
+
["emissionsPerSecondX64", getU128Encoder18()]
|
|
4298
4239
|
]),
|
|
4299
|
-
(value) => ({ ...value, discriminator:
|
|
4240
|
+
(value) => ({ ...value, discriminator: INITIALIZE_REWARD_DISCRIMINATOR })
|
|
4300
4241
|
);
|
|
4301
4242
|
}
|
|
4302
|
-
function
|
|
4243
|
+
function getInitializeRewardInstructionDataDecoder() {
|
|
4303
4244
|
return getStructDecoder36([
|
|
4304
4245
|
["discriminator", fixDecoderSize21(getBytesDecoder21(), 8)],
|
|
4305
|
-
["
|
|
4306
|
-
["
|
|
4307
|
-
["
|
|
4246
|
+
["openTime", getU64Decoder24()],
|
|
4247
|
+
["endTime", getU64Decoder24()],
|
|
4248
|
+
["emissionsPerSecondX64", getU128Decoder18()]
|
|
4308
4249
|
]);
|
|
4309
4250
|
}
|
|
4310
|
-
function
|
|
4251
|
+
function getInitializeRewardInstructionDataCodec() {
|
|
4311
4252
|
return combineCodec36(
|
|
4312
|
-
|
|
4313
|
-
|
|
4253
|
+
getInitializeRewardInstructionDataEncoder(),
|
|
4254
|
+
getInitializeRewardInstructionDataDecoder()
|
|
4314
4255
|
);
|
|
4315
4256
|
}
|
|
4316
|
-
function
|
|
4257
|
+
async function getInitializeRewardInstructionAsync(input, config) {
|
|
4317
4258
|
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
4318
4259
|
const originalAccounts = {
|
|
4319
|
-
|
|
4320
|
-
|
|
4260
|
+
rewardFunder: { value: input.rewardFunder ?? null, isWritable: true },
|
|
4261
|
+
funderTokenAccount: {
|
|
4262
|
+
value: input.funderTokenAccount ?? null,
|
|
4263
|
+
isWritable: true
|
|
4264
|
+
},
|
|
4265
|
+
ammConfig: { value: input.ammConfig ?? null, isWritable: false },
|
|
4321
4266
|
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
4322
|
-
|
|
4323
|
-
|
|
4267
|
+
operationState: { value: input.operationState ?? null, isWritable: false },
|
|
4268
|
+
rewardTokenMint: {
|
|
4269
|
+
value: input.rewardTokenMint ?? null,
|
|
4324
4270
|
isWritable: false
|
|
4325
4271
|
},
|
|
4326
|
-
|
|
4327
|
-
value: input.
|
|
4272
|
+
rewardTokenVault: {
|
|
4273
|
+
value: input.rewardTokenVault ?? null,
|
|
4328
4274
|
isWritable: true
|
|
4329
4275
|
},
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }
|
|
4276
|
+
rewardTokenProgram: {
|
|
4277
|
+
value: input.rewardTokenProgram ?? null,
|
|
4278
|
+
isWritable: false
|
|
4279
|
+
},
|
|
4280
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
4281
|
+
rent: { value: input.rent ?? null, isWritable: false }
|
|
4337
4282
|
};
|
|
4338
4283
|
const accounts = originalAccounts;
|
|
4339
4284
|
const args = { ...input };
|
|
4340
|
-
if (!accounts.
|
|
4341
|
-
accounts.
|
|
4342
|
-
}
|
|
4343
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4344
|
-
return Object.freeze({
|
|
4345
|
-
accounts: [
|
|
4346
|
-
getAccountMeta(accounts.nftOwner),
|
|
4347
|
-
getAccountMeta(accounts.nftAccount),
|
|
4348
|
-
getAccountMeta(accounts.poolState),
|
|
4349
|
-
getAccountMeta(accounts.protocolPosition),
|
|
4350
|
-
getAccountMeta(accounts.personalPosition),
|
|
4351
|
-
getAccountMeta(accounts.tickArrayLower),
|
|
4352
|
-
getAccountMeta(accounts.tickArrayUpper),
|
|
4353
|
-
getAccountMeta(accounts.tokenAccount0),
|
|
4354
|
-
getAccountMeta(accounts.tokenAccount1),
|
|
4355
|
-
getAccountMeta(accounts.tokenVault0),
|
|
4356
|
-
getAccountMeta(accounts.tokenVault1),
|
|
4357
|
-
getAccountMeta(accounts.tokenProgram)
|
|
4358
|
-
],
|
|
4359
|
-
data: getIncreaseLiquidityInstructionDataEncoder().encode(
|
|
4360
|
-
args
|
|
4361
|
-
),
|
|
4362
|
-
programAddress
|
|
4363
|
-
});
|
|
4364
|
-
}
|
|
4365
|
-
function parseIncreaseLiquidityInstruction(instruction) {
|
|
4366
|
-
if (instruction.accounts.length < 12) {
|
|
4367
|
-
throw new Error("Not enough accounts");
|
|
4368
|
-
}
|
|
4369
|
-
let accountIndex = 0;
|
|
4370
|
-
const getNextAccount = () => {
|
|
4371
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
4372
|
-
accountIndex += 1;
|
|
4373
|
-
return accountMeta;
|
|
4374
|
-
};
|
|
4375
|
-
return {
|
|
4376
|
-
programAddress: instruction.programAddress,
|
|
4377
|
-
accounts: {
|
|
4378
|
-
nftOwner: getNextAccount(),
|
|
4379
|
-
nftAccount: getNextAccount(),
|
|
4380
|
-
poolState: getNextAccount(),
|
|
4381
|
-
protocolPosition: getNextAccount(),
|
|
4382
|
-
personalPosition: getNextAccount(),
|
|
4383
|
-
tickArrayLower: getNextAccount(),
|
|
4384
|
-
tickArrayUpper: getNextAccount(),
|
|
4385
|
-
tokenAccount0: getNextAccount(),
|
|
4386
|
-
tokenAccount1: getNextAccount(),
|
|
4387
|
-
tokenVault0: getNextAccount(),
|
|
4388
|
-
tokenVault1: getNextAccount(),
|
|
4389
|
-
tokenProgram: getNextAccount()
|
|
4390
|
-
},
|
|
4391
|
-
data: getIncreaseLiquidityInstructionDataDecoder().decode(instruction.data)
|
|
4392
|
-
};
|
|
4393
|
-
}
|
|
4394
|
-
|
|
4395
|
-
// src/generated/instructions/increaseLiquidityV2.ts
|
|
4396
|
-
import {
|
|
4397
|
-
combineCodec as combineCodec37,
|
|
4398
|
-
fixDecoderSize as fixDecoderSize22,
|
|
4399
|
-
fixEncoderSize as fixEncoderSize23,
|
|
4400
|
-
getBooleanDecoder as getBooleanDecoder3,
|
|
4401
|
-
getBooleanEncoder as getBooleanEncoder3,
|
|
4402
|
-
getBytesDecoder as getBytesDecoder22,
|
|
4403
|
-
getBytesEncoder as getBytesEncoder23,
|
|
4404
|
-
getOptionDecoder,
|
|
4405
|
-
getOptionEncoder,
|
|
4406
|
-
getStructDecoder as getStructDecoder37,
|
|
4407
|
-
getStructEncoder as getStructEncoder37,
|
|
4408
|
-
getU128Decoder as getU128Decoder19,
|
|
4409
|
-
getU128Encoder as getU128Encoder19,
|
|
4410
|
-
getU64Decoder as getU64Decoder25,
|
|
4411
|
-
getU64Encoder as getU64Encoder25,
|
|
4412
|
-
transformEncoder as transformEncoder22
|
|
4413
|
-
} from "@solana/kit";
|
|
4414
|
-
var INCREASE_LIQUIDITY_V2_DISCRIMINATOR = new Uint8Array([
|
|
4415
|
-
133,
|
|
4416
|
-
29,
|
|
4417
|
-
89,
|
|
4418
|
-
223,
|
|
4419
|
-
69,
|
|
4420
|
-
238,
|
|
4421
|
-
176,
|
|
4422
|
-
10
|
|
4423
|
-
]);
|
|
4424
|
-
function getIncreaseLiquidityV2DiscriminatorBytes() {
|
|
4425
|
-
return fixEncoderSize23(getBytesEncoder23(), 8).encode(
|
|
4426
|
-
INCREASE_LIQUIDITY_V2_DISCRIMINATOR
|
|
4427
|
-
);
|
|
4428
|
-
}
|
|
4429
|
-
function getIncreaseLiquidityV2InstructionDataEncoder() {
|
|
4430
|
-
return transformEncoder22(
|
|
4431
|
-
getStructEncoder37([
|
|
4432
|
-
["discriminator", fixEncoderSize23(getBytesEncoder23(), 8)],
|
|
4433
|
-
["liquidity", getU128Encoder19()],
|
|
4434
|
-
["amount0Max", getU64Encoder25()],
|
|
4435
|
-
["amount1Max", getU64Encoder25()],
|
|
4436
|
-
["baseFlag", getOptionEncoder(getBooleanEncoder3())]
|
|
4437
|
-
]),
|
|
4438
|
-
(value) => ({
|
|
4439
|
-
...value,
|
|
4440
|
-
discriminator: INCREASE_LIQUIDITY_V2_DISCRIMINATOR
|
|
4441
|
-
})
|
|
4442
|
-
);
|
|
4443
|
-
}
|
|
4444
|
-
function getIncreaseLiquidityV2InstructionDataDecoder() {
|
|
4445
|
-
return getStructDecoder37([
|
|
4446
|
-
["discriminator", fixDecoderSize22(getBytesDecoder22(), 8)],
|
|
4447
|
-
["liquidity", getU128Decoder19()],
|
|
4448
|
-
["amount0Max", getU64Decoder25()],
|
|
4449
|
-
["amount1Max", getU64Decoder25()],
|
|
4450
|
-
["baseFlag", getOptionDecoder(getBooleanDecoder3())]
|
|
4451
|
-
]);
|
|
4452
|
-
}
|
|
4453
|
-
function getIncreaseLiquidityV2InstructionDataCodec() {
|
|
4454
|
-
return combineCodec37(
|
|
4455
|
-
getIncreaseLiquidityV2InstructionDataEncoder(),
|
|
4456
|
-
getIncreaseLiquidityV2InstructionDataDecoder()
|
|
4457
|
-
);
|
|
4458
|
-
}
|
|
4459
|
-
function getIncreaseLiquidityV2Instruction(input, config) {
|
|
4460
|
-
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
4461
|
-
const originalAccounts = {
|
|
4462
|
-
nftOwner: { value: input.nftOwner ?? null, isWritable: false },
|
|
4463
|
-
nftAccount: { value: input.nftAccount ?? null, isWritable: false },
|
|
4464
|
-
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
4465
|
-
protocolPosition: {
|
|
4466
|
-
value: input.protocolPosition ?? null,
|
|
4467
|
-
isWritable: false
|
|
4468
|
-
},
|
|
4469
|
-
personalPosition: {
|
|
4470
|
-
value: input.personalPosition ?? null,
|
|
4471
|
-
isWritable: true
|
|
4472
|
-
},
|
|
4473
|
-
tickArrayLower: { value: input.tickArrayLower ?? null, isWritable: true },
|
|
4474
|
-
tickArrayUpper: { value: input.tickArrayUpper ?? null, isWritable: true },
|
|
4475
|
-
tokenAccount0: { value: input.tokenAccount0 ?? null, isWritable: true },
|
|
4476
|
-
tokenAccount1: { value: input.tokenAccount1 ?? null, isWritable: true },
|
|
4477
|
-
tokenVault0: { value: input.tokenVault0 ?? null, isWritable: true },
|
|
4478
|
-
tokenVault1: { value: input.tokenVault1 ?? null, isWritable: true },
|
|
4479
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
4480
|
-
tokenProgram2022: {
|
|
4481
|
-
value: input.tokenProgram2022 ?? null,
|
|
4482
|
-
isWritable: false
|
|
4483
|
-
},
|
|
4484
|
-
vault0Mint: { value: input.vault0Mint ?? null, isWritable: false },
|
|
4485
|
-
vault1Mint: { value: input.vault1Mint ?? null, isWritable: false }
|
|
4486
|
-
};
|
|
4487
|
-
const accounts = originalAccounts;
|
|
4488
|
-
const args = { ...input };
|
|
4489
|
-
if (!accounts.tokenProgram.value) {
|
|
4490
|
-
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
4491
|
-
}
|
|
4492
|
-
if (!accounts.tokenProgram2022.value) {
|
|
4493
|
-
accounts.tokenProgram2022.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
4494
|
-
}
|
|
4495
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4496
|
-
return Object.freeze({
|
|
4497
|
-
accounts: [
|
|
4498
|
-
getAccountMeta(accounts.nftOwner),
|
|
4499
|
-
getAccountMeta(accounts.nftAccount),
|
|
4500
|
-
getAccountMeta(accounts.poolState),
|
|
4501
|
-
getAccountMeta(accounts.protocolPosition),
|
|
4502
|
-
getAccountMeta(accounts.personalPosition),
|
|
4503
|
-
getAccountMeta(accounts.tickArrayLower),
|
|
4504
|
-
getAccountMeta(accounts.tickArrayUpper),
|
|
4505
|
-
getAccountMeta(accounts.tokenAccount0),
|
|
4506
|
-
getAccountMeta(accounts.tokenAccount1),
|
|
4507
|
-
getAccountMeta(accounts.tokenVault0),
|
|
4508
|
-
getAccountMeta(accounts.tokenVault1),
|
|
4509
|
-
getAccountMeta(accounts.tokenProgram),
|
|
4510
|
-
getAccountMeta(accounts.tokenProgram2022),
|
|
4511
|
-
getAccountMeta(accounts.vault0Mint),
|
|
4512
|
-
getAccountMeta(accounts.vault1Mint)
|
|
4513
|
-
],
|
|
4514
|
-
data: getIncreaseLiquidityV2InstructionDataEncoder().encode(
|
|
4515
|
-
args
|
|
4516
|
-
),
|
|
4517
|
-
programAddress
|
|
4518
|
-
});
|
|
4519
|
-
}
|
|
4520
|
-
function parseIncreaseLiquidityV2Instruction(instruction) {
|
|
4521
|
-
if (instruction.accounts.length < 15) {
|
|
4522
|
-
throw new Error("Not enough accounts");
|
|
4523
|
-
}
|
|
4524
|
-
let accountIndex = 0;
|
|
4525
|
-
const getNextAccount = () => {
|
|
4526
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
4527
|
-
accountIndex += 1;
|
|
4528
|
-
return accountMeta;
|
|
4529
|
-
};
|
|
4530
|
-
return {
|
|
4531
|
-
programAddress: instruction.programAddress,
|
|
4532
|
-
accounts: {
|
|
4533
|
-
nftOwner: getNextAccount(),
|
|
4534
|
-
nftAccount: getNextAccount(),
|
|
4535
|
-
poolState: getNextAccount(),
|
|
4536
|
-
protocolPosition: getNextAccount(),
|
|
4537
|
-
personalPosition: getNextAccount(),
|
|
4538
|
-
tickArrayLower: getNextAccount(),
|
|
4539
|
-
tickArrayUpper: getNextAccount(),
|
|
4540
|
-
tokenAccount0: getNextAccount(),
|
|
4541
|
-
tokenAccount1: getNextAccount(),
|
|
4542
|
-
tokenVault0: getNextAccount(),
|
|
4543
|
-
tokenVault1: getNextAccount(),
|
|
4544
|
-
tokenProgram: getNextAccount(),
|
|
4545
|
-
tokenProgram2022: getNextAccount(),
|
|
4546
|
-
vault0Mint: getNextAccount(),
|
|
4547
|
-
vault1Mint: getNextAccount()
|
|
4548
|
-
},
|
|
4549
|
-
data: getIncreaseLiquidityV2InstructionDataDecoder().decode(
|
|
4550
|
-
instruction.data
|
|
4551
|
-
)
|
|
4552
|
-
};
|
|
4553
|
-
}
|
|
4554
|
-
|
|
4555
|
-
// src/generated/instructions/initializeReward.ts
|
|
4556
|
-
import {
|
|
4557
|
-
combineCodec as combineCodec38,
|
|
4558
|
-
fixDecoderSize as fixDecoderSize23,
|
|
4559
|
-
fixEncoderSize as fixEncoderSize24,
|
|
4560
|
-
getAddressEncoder as getAddressEncoder23,
|
|
4561
|
-
getBytesDecoder as getBytesDecoder23,
|
|
4562
|
-
getBytesEncoder as getBytesEncoder24,
|
|
4563
|
-
getProgramDerivedAddress as getProgramDerivedAddress6,
|
|
4564
|
-
getStructDecoder as getStructDecoder38,
|
|
4565
|
-
getStructEncoder as getStructEncoder38,
|
|
4566
|
-
getU128Decoder as getU128Decoder20,
|
|
4567
|
-
getU128Encoder as getU128Encoder20,
|
|
4568
|
-
getU64Decoder as getU64Decoder26,
|
|
4569
|
-
getU64Encoder as getU64Encoder26,
|
|
4570
|
-
transformEncoder as transformEncoder23
|
|
4571
|
-
} from "@solana/kit";
|
|
4572
|
-
var INITIALIZE_REWARD_DISCRIMINATOR = new Uint8Array([
|
|
4573
|
-
95,
|
|
4574
|
-
135,
|
|
4575
|
-
192,
|
|
4576
|
-
196,
|
|
4577
|
-
242,
|
|
4578
|
-
129,
|
|
4579
|
-
230,
|
|
4580
|
-
68
|
|
4581
|
-
]);
|
|
4582
|
-
function getInitializeRewardDiscriminatorBytes() {
|
|
4583
|
-
return fixEncoderSize24(getBytesEncoder24(), 8).encode(
|
|
4584
|
-
INITIALIZE_REWARD_DISCRIMINATOR
|
|
4585
|
-
);
|
|
4586
|
-
}
|
|
4587
|
-
function getInitializeRewardInstructionDataEncoder() {
|
|
4588
|
-
return transformEncoder23(
|
|
4589
|
-
getStructEncoder38([
|
|
4590
|
-
["discriminator", fixEncoderSize24(getBytesEncoder24(), 8)],
|
|
4591
|
-
["openTime", getU64Encoder26()],
|
|
4592
|
-
["endTime", getU64Encoder26()],
|
|
4593
|
-
["emissionsPerSecondX64", getU128Encoder20()]
|
|
4594
|
-
]),
|
|
4595
|
-
(value) => ({ ...value, discriminator: INITIALIZE_REWARD_DISCRIMINATOR })
|
|
4596
|
-
);
|
|
4597
|
-
}
|
|
4598
|
-
function getInitializeRewardInstructionDataDecoder() {
|
|
4599
|
-
return getStructDecoder38([
|
|
4600
|
-
["discriminator", fixDecoderSize23(getBytesDecoder23(), 8)],
|
|
4601
|
-
["openTime", getU64Decoder26()],
|
|
4602
|
-
["endTime", getU64Decoder26()],
|
|
4603
|
-
["emissionsPerSecondX64", getU128Decoder20()]
|
|
4604
|
-
]);
|
|
4605
|
-
}
|
|
4606
|
-
function getInitializeRewardInstructionDataCodec() {
|
|
4607
|
-
return combineCodec38(
|
|
4608
|
-
getInitializeRewardInstructionDataEncoder(),
|
|
4609
|
-
getInitializeRewardInstructionDataDecoder()
|
|
4610
|
-
);
|
|
4611
|
-
}
|
|
4612
|
-
async function getInitializeRewardInstructionAsync(input, config) {
|
|
4613
|
-
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
4614
|
-
const originalAccounts = {
|
|
4615
|
-
rewardFunder: { value: input.rewardFunder ?? null, isWritable: true },
|
|
4616
|
-
funderTokenAccount: {
|
|
4617
|
-
value: input.funderTokenAccount ?? null,
|
|
4618
|
-
isWritable: true
|
|
4619
|
-
},
|
|
4620
|
-
ammConfig: { value: input.ammConfig ?? null, isWritable: false },
|
|
4621
|
-
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
4622
|
-
operationState: { value: input.operationState ?? null, isWritable: false },
|
|
4623
|
-
rewardTokenMint: {
|
|
4624
|
-
value: input.rewardTokenMint ?? null,
|
|
4625
|
-
isWritable: false
|
|
4626
|
-
},
|
|
4627
|
-
rewardTokenVault: {
|
|
4628
|
-
value: input.rewardTokenVault ?? null,
|
|
4629
|
-
isWritable: true
|
|
4630
|
-
},
|
|
4631
|
-
rewardTokenProgram: {
|
|
4632
|
-
value: input.rewardTokenProgram ?? null,
|
|
4633
|
-
isWritable: false
|
|
4634
|
-
},
|
|
4635
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
4636
|
-
rent: { value: input.rent ?? null, isWritable: false }
|
|
4637
|
-
};
|
|
4638
|
-
const accounts = originalAccounts;
|
|
4639
|
-
const args = { ...input };
|
|
4640
|
-
if (!accounts.operationState.value) {
|
|
4641
|
-
accounts.operationState.value = await getProgramDerivedAddress6({
|
|
4642
|
-
programAddress,
|
|
4643
|
-
seeds: [
|
|
4644
|
-
getBytesEncoder24().encode(
|
|
4645
|
-
new Uint8Array([111, 112, 101, 114, 97, 116, 105, 111, 110])
|
|
4646
|
-
)
|
|
4647
|
-
]
|
|
4648
|
-
});
|
|
4649
|
-
}
|
|
4650
|
-
if (!accounts.rewardTokenVault.value) {
|
|
4651
|
-
accounts.rewardTokenVault.value = await getProgramDerivedAddress6({
|
|
4652
|
-
programAddress,
|
|
4653
|
-
seeds: [
|
|
4654
|
-
getBytesEncoder24().encode(
|
|
4655
|
-
new Uint8Array([
|
|
4656
|
-
112,
|
|
4657
|
-
111,
|
|
4658
|
-
111,
|
|
4659
|
-
108,
|
|
4660
|
-
95,
|
|
4661
|
-
114,
|
|
4662
|
-
101,
|
|
4663
|
-
119,
|
|
4664
|
-
97,
|
|
4665
|
-
114,
|
|
4666
|
-
100,
|
|
4667
|
-
95,
|
|
4668
|
-
118,
|
|
4669
|
-
97,
|
|
4670
|
-
117,
|
|
4671
|
-
108,
|
|
4672
|
-
116
|
|
4673
|
-
])
|
|
4674
|
-
),
|
|
4675
|
-
getAddressEncoder23().encode(expectAddress(accounts.poolState.value)),
|
|
4676
|
-
getAddressEncoder23().encode(
|
|
4677
|
-
expectAddress(accounts.rewardTokenMint.value)
|
|
4678
|
-
)
|
|
4679
|
-
]
|
|
4680
|
-
});
|
|
4681
|
-
}
|
|
4682
|
-
if (!accounts.systemProgram.value) {
|
|
4683
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
4684
|
-
}
|
|
4685
|
-
if (!accounts.rent.value) {
|
|
4686
|
-
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
4687
|
-
}
|
|
4688
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4689
|
-
return Object.freeze({
|
|
4690
|
-
accounts: [
|
|
4691
|
-
getAccountMeta(accounts.rewardFunder),
|
|
4692
|
-
getAccountMeta(accounts.funderTokenAccount),
|
|
4693
|
-
getAccountMeta(accounts.ammConfig),
|
|
4694
|
-
getAccountMeta(accounts.poolState),
|
|
4695
|
-
getAccountMeta(accounts.operationState),
|
|
4696
|
-
getAccountMeta(accounts.rewardTokenMint),
|
|
4697
|
-
getAccountMeta(accounts.rewardTokenVault),
|
|
4698
|
-
getAccountMeta(accounts.rewardTokenProgram),
|
|
4699
|
-
getAccountMeta(accounts.systemProgram),
|
|
4700
|
-
getAccountMeta(accounts.rent)
|
|
4701
|
-
],
|
|
4702
|
-
data: getInitializeRewardInstructionDataEncoder().encode(
|
|
4703
|
-
args
|
|
4704
|
-
),
|
|
4705
|
-
programAddress
|
|
4706
|
-
});
|
|
4707
|
-
}
|
|
4708
|
-
function getInitializeRewardInstruction(input, config) {
|
|
4709
|
-
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
4710
|
-
const originalAccounts = {
|
|
4711
|
-
rewardFunder: { value: input.rewardFunder ?? null, isWritable: true },
|
|
4712
|
-
funderTokenAccount: {
|
|
4713
|
-
value: input.funderTokenAccount ?? null,
|
|
4714
|
-
isWritable: true
|
|
4715
|
-
},
|
|
4716
|
-
ammConfig: { value: input.ammConfig ?? null, isWritable: false },
|
|
4717
|
-
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
4718
|
-
operationState: { value: input.operationState ?? null, isWritable: false },
|
|
4719
|
-
rewardTokenMint: {
|
|
4720
|
-
value: input.rewardTokenMint ?? null,
|
|
4721
|
-
isWritable: false
|
|
4722
|
-
},
|
|
4723
|
-
rewardTokenVault: {
|
|
4724
|
-
value: input.rewardTokenVault ?? null,
|
|
4725
|
-
isWritable: true
|
|
4726
|
-
},
|
|
4727
|
-
rewardTokenProgram: {
|
|
4728
|
-
value: input.rewardTokenProgram ?? null,
|
|
4729
|
-
isWritable: false
|
|
4730
|
-
},
|
|
4731
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
4732
|
-
rent: { value: input.rent ?? null, isWritable: false }
|
|
4733
|
-
};
|
|
4734
|
-
const accounts = originalAccounts;
|
|
4735
|
-
const args = { ...input };
|
|
4736
|
-
if (!accounts.systemProgram.value) {
|
|
4737
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
4738
|
-
}
|
|
4739
|
-
if (!accounts.rent.value) {
|
|
4740
|
-
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
4741
|
-
}
|
|
4742
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4743
|
-
return Object.freeze({
|
|
4744
|
-
accounts: [
|
|
4745
|
-
getAccountMeta(accounts.rewardFunder),
|
|
4746
|
-
getAccountMeta(accounts.funderTokenAccount),
|
|
4747
|
-
getAccountMeta(accounts.ammConfig),
|
|
4748
|
-
getAccountMeta(accounts.poolState),
|
|
4749
|
-
getAccountMeta(accounts.operationState),
|
|
4750
|
-
getAccountMeta(accounts.rewardTokenMint),
|
|
4751
|
-
getAccountMeta(accounts.rewardTokenVault),
|
|
4752
|
-
getAccountMeta(accounts.rewardTokenProgram),
|
|
4753
|
-
getAccountMeta(accounts.systemProgram),
|
|
4754
|
-
getAccountMeta(accounts.rent)
|
|
4755
|
-
],
|
|
4756
|
-
data: getInitializeRewardInstructionDataEncoder().encode(
|
|
4757
|
-
args
|
|
4758
|
-
),
|
|
4759
|
-
programAddress
|
|
4760
|
-
});
|
|
4761
|
-
}
|
|
4762
|
-
function parseInitializeRewardInstruction(instruction) {
|
|
4763
|
-
if (instruction.accounts.length < 10) {
|
|
4764
|
-
throw new Error("Not enough accounts");
|
|
4765
|
-
}
|
|
4766
|
-
let accountIndex = 0;
|
|
4767
|
-
const getNextAccount = () => {
|
|
4768
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
4769
|
-
accountIndex += 1;
|
|
4770
|
-
return accountMeta;
|
|
4771
|
-
};
|
|
4772
|
-
return {
|
|
4773
|
-
programAddress: instruction.programAddress,
|
|
4774
|
-
accounts: {
|
|
4775
|
-
rewardFunder: getNextAccount(),
|
|
4776
|
-
funderTokenAccount: getNextAccount(),
|
|
4777
|
-
ammConfig: getNextAccount(),
|
|
4778
|
-
poolState: getNextAccount(),
|
|
4779
|
-
operationState: getNextAccount(),
|
|
4780
|
-
rewardTokenMint: getNextAccount(),
|
|
4781
|
-
rewardTokenVault: getNextAccount(),
|
|
4782
|
-
rewardTokenProgram: getNextAccount(),
|
|
4783
|
-
systemProgram: getNextAccount(),
|
|
4784
|
-
rent: getNextAccount()
|
|
4785
|
-
},
|
|
4786
|
-
data: getInitializeRewardInstructionDataDecoder().decode(instruction.data)
|
|
4787
|
-
};
|
|
4788
|
-
}
|
|
4789
|
-
|
|
4790
|
-
// src/generated/instructions/openPosition.ts
|
|
4791
|
-
import {
|
|
4792
|
-
combineCodec as combineCodec39,
|
|
4793
|
-
fixDecoderSize as fixDecoderSize24,
|
|
4794
|
-
fixEncoderSize as fixEncoderSize25,
|
|
4795
|
-
getAddressEncoder as getAddressEncoder24,
|
|
4796
|
-
getBytesDecoder as getBytesDecoder24,
|
|
4797
|
-
getBytesEncoder as getBytesEncoder25,
|
|
4798
|
-
getI32Decoder as getI32Decoder11,
|
|
4799
|
-
getI32Encoder as getI32Encoder11,
|
|
4800
|
-
getProgramDerivedAddress as getProgramDerivedAddress7,
|
|
4801
|
-
getStructDecoder as getStructDecoder39,
|
|
4802
|
-
getStructEncoder as getStructEncoder39,
|
|
4803
|
-
getU128Decoder as getU128Decoder21,
|
|
4804
|
-
getU128Encoder as getU128Encoder21,
|
|
4805
|
-
getU64Decoder as getU64Decoder27,
|
|
4806
|
-
getU64Encoder as getU64Encoder27,
|
|
4807
|
-
transformEncoder as transformEncoder24
|
|
4808
|
-
} from "@solana/kit";
|
|
4809
|
-
var OPEN_POSITION_DISCRIMINATOR = new Uint8Array([
|
|
4810
|
-
135,
|
|
4811
|
-
128,
|
|
4812
|
-
47,
|
|
4813
|
-
77,
|
|
4814
|
-
15,
|
|
4815
|
-
152,
|
|
4816
|
-
240,
|
|
4817
|
-
49
|
|
4818
|
-
]);
|
|
4819
|
-
function getOpenPositionDiscriminatorBytes() {
|
|
4820
|
-
return fixEncoderSize25(getBytesEncoder25(), 8).encode(
|
|
4821
|
-
OPEN_POSITION_DISCRIMINATOR
|
|
4822
|
-
);
|
|
4823
|
-
}
|
|
4824
|
-
function getOpenPositionInstructionDataEncoder() {
|
|
4825
|
-
return transformEncoder24(
|
|
4826
|
-
getStructEncoder39([
|
|
4827
|
-
["discriminator", fixEncoderSize25(getBytesEncoder25(), 8)],
|
|
4828
|
-
["tickLowerIndex", getI32Encoder11()],
|
|
4829
|
-
["tickUpperIndex", getI32Encoder11()],
|
|
4830
|
-
["tickArrayLowerStartIndex", getI32Encoder11()],
|
|
4831
|
-
["tickArrayUpperStartIndex", getI32Encoder11()],
|
|
4832
|
-
["liquidity", getU128Encoder21()],
|
|
4833
|
-
["amount0Max", getU64Encoder27()],
|
|
4834
|
-
["amount1Max", getU64Encoder27()]
|
|
4835
|
-
]),
|
|
4836
|
-
(value) => ({ ...value, discriminator: OPEN_POSITION_DISCRIMINATOR })
|
|
4837
|
-
);
|
|
4838
|
-
}
|
|
4839
|
-
function getOpenPositionInstructionDataDecoder() {
|
|
4840
|
-
return getStructDecoder39([
|
|
4841
|
-
["discriminator", fixDecoderSize24(getBytesDecoder24(), 8)],
|
|
4842
|
-
["tickLowerIndex", getI32Decoder11()],
|
|
4843
|
-
["tickUpperIndex", getI32Decoder11()],
|
|
4844
|
-
["tickArrayLowerStartIndex", getI32Decoder11()],
|
|
4845
|
-
["tickArrayUpperStartIndex", getI32Decoder11()],
|
|
4846
|
-
["liquidity", getU128Decoder21()],
|
|
4847
|
-
["amount0Max", getU64Decoder27()],
|
|
4848
|
-
["amount1Max", getU64Decoder27()]
|
|
4849
|
-
]);
|
|
4850
|
-
}
|
|
4851
|
-
function getOpenPositionInstructionDataCodec() {
|
|
4852
|
-
return combineCodec39(
|
|
4853
|
-
getOpenPositionInstructionDataEncoder(),
|
|
4854
|
-
getOpenPositionInstructionDataDecoder()
|
|
4855
|
-
);
|
|
4856
|
-
}
|
|
4857
|
-
async function getOpenPositionInstructionAsync(input, config) {
|
|
4858
|
-
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
4859
|
-
const originalAccounts = {
|
|
4860
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
4861
|
-
positionNftOwner: {
|
|
4862
|
-
value: input.positionNftOwner ?? null,
|
|
4863
|
-
isWritable: false
|
|
4864
|
-
},
|
|
4865
|
-
positionNftMint: { value: input.positionNftMint ?? null, isWritable: true },
|
|
4866
|
-
positionNftAccount: {
|
|
4867
|
-
value: input.positionNftAccount ?? null,
|
|
4868
|
-
isWritable: true
|
|
4869
|
-
},
|
|
4870
|
-
metadataAccount: { value: input.metadataAccount ?? null, isWritable: true },
|
|
4871
|
-
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
4872
|
-
protocolPosition: {
|
|
4873
|
-
value: input.protocolPosition ?? null,
|
|
4874
|
-
isWritable: false
|
|
4875
|
-
},
|
|
4876
|
-
tickArrayLower: { value: input.tickArrayLower ?? null, isWritable: true },
|
|
4877
|
-
tickArrayUpper: { value: input.tickArrayUpper ?? null, isWritable: true },
|
|
4878
|
-
personalPosition: {
|
|
4879
|
-
value: input.personalPosition ?? null,
|
|
4880
|
-
isWritable: true
|
|
4881
|
-
},
|
|
4882
|
-
tokenAccount0: { value: input.tokenAccount0 ?? null, isWritable: true },
|
|
4883
|
-
tokenAccount1: { value: input.tokenAccount1 ?? null, isWritable: true },
|
|
4884
|
-
tokenVault0: { value: input.tokenVault0 ?? null, isWritable: true },
|
|
4885
|
-
tokenVault1: { value: input.tokenVault1 ?? null, isWritable: true },
|
|
4886
|
-
rent: { value: input.rent ?? null, isWritable: false },
|
|
4887
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
4888
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
4889
|
-
associatedTokenProgram: {
|
|
4890
|
-
value: input.associatedTokenProgram ?? null,
|
|
4891
|
-
isWritable: false
|
|
4892
|
-
},
|
|
4893
|
-
metadataProgram: {
|
|
4894
|
-
value: input.metadataProgram ?? null,
|
|
4895
|
-
isWritable: false
|
|
4896
|
-
}
|
|
4897
|
-
};
|
|
4898
|
-
const accounts = originalAccounts;
|
|
4899
|
-
const args = { ...input };
|
|
4900
|
-
if (!accounts.positionNftAccount.value) {
|
|
4901
|
-
accounts.positionNftAccount.value = await getProgramDerivedAddress7({
|
|
4902
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
4903
|
-
seeds: [
|
|
4904
|
-
getAddressEncoder24().encode(
|
|
4905
|
-
expectAddress(accounts.positionNftOwner.value)
|
|
4906
|
-
),
|
|
4907
|
-
getBytesEncoder25().encode(
|
|
4908
|
-
new Uint8Array([
|
|
4909
|
-
6,
|
|
4910
|
-
221,
|
|
4911
|
-
246,
|
|
4912
|
-
225,
|
|
4913
|
-
215,
|
|
4914
|
-
101,
|
|
4915
|
-
161,
|
|
4916
|
-
147,
|
|
4917
|
-
217,
|
|
4918
|
-
203,
|
|
4919
|
-
225,
|
|
4920
|
-
70,
|
|
4921
|
-
206,
|
|
4922
|
-
235,
|
|
4923
|
-
121,
|
|
4924
|
-
172,
|
|
4925
|
-
28,
|
|
4926
|
-
180,
|
|
4927
|
-
133,
|
|
4928
|
-
237,
|
|
4929
|
-
95,
|
|
4930
|
-
91,
|
|
4931
|
-
55,
|
|
4932
|
-
145,
|
|
4933
|
-
58,
|
|
4934
|
-
140,
|
|
4935
|
-
245,
|
|
4936
|
-
133,
|
|
4937
|
-
126,
|
|
4938
|
-
255,
|
|
4939
|
-
0,
|
|
4940
|
-
169
|
|
4941
|
-
])
|
|
4942
|
-
),
|
|
4943
|
-
getAddressEncoder24().encode(
|
|
4944
|
-
expectAddress(accounts.positionNftMint.value)
|
|
4945
|
-
)
|
|
4946
|
-
]
|
|
4947
|
-
});
|
|
4948
|
-
}
|
|
4949
|
-
if (!accounts.tickArrayLower.value) {
|
|
4950
|
-
accounts.tickArrayLower.value = await getProgramDerivedAddress7({
|
|
4951
|
-
programAddress,
|
|
4952
|
-
seeds: [
|
|
4953
|
-
getBytesEncoder25().encode(
|
|
4954
|
-
new Uint8Array([116, 105, 99, 107, 95, 97, 114, 114, 97, 121])
|
|
4955
|
-
),
|
|
4956
|
-
getAddressEncoder24().encode(expectAddress(accounts.poolState.value)),
|
|
4957
|
-
getI32Encoder11().encode(expectSome(args.tickArrayLowerStartIndex))
|
|
4958
|
-
]
|
|
4959
|
-
});
|
|
4960
|
-
}
|
|
4961
|
-
if (!accounts.tickArrayUpper.value) {
|
|
4962
|
-
accounts.tickArrayUpper.value = await getProgramDerivedAddress7({
|
|
4963
|
-
programAddress,
|
|
4964
|
-
seeds: [
|
|
4965
|
-
getBytesEncoder25().encode(
|
|
4966
|
-
new Uint8Array([116, 105, 99, 107, 95, 97, 114, 114, 97, 121])
|
|
4967
|
-
),
|
|
4968
|
-
getAddressEncoder24().encode(expectAddress(accounts.poolState.value)),
|
|
4969
|
-
getI32Encoder11().encode(expectSome(args.tickArrayUpperStartIndex))
|
|
4970
|
-
]
|
|
4971
|
-
});
|
|
4972
|
-
}
|
|
4973
|
-
if (!accounts.personalPosition.value) {
|
|
4974
|
-
accounts.personalPosition.value = await getProgramDerivedAddress7({
|
|
4975
|
-
programAddress,
|
|
4976
|
-
seeds: [
|
|
4977
|
-
getBytesEncoder25().encode(
|
|
4978
|
-
new Uint8Array([112, 111, 115, 105, 116, 105, 111, 110])
|
|
4979
|
-
),
|
|
4980
|
-
getAddressEncoder24().encode(
|
|
4981
|
-
expectAddress(accounts.positionNftMint.value)
|
|
4982
|
-
)
|
|
4983
|
-
]
|
|
4984
|
-
});
|
|
4985
|
-
}
|
|
4986
|
-
if (!accounts.rent.value) {
|
|
4987
|
-
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
4988
|
-
}
|
|
4989
|
-
if (!accounts.systemProgram.value) {
|
|
4990
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
4991
|
-
}
|
|
4992
|
-
if (!accounts.tokenProgram.value) {
|
|
4993
|
-
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
4994
|
-
}
|
|
4995
|
-
if (!accounts.associatedTokenProgram.value) {
|
|
4996
|
-
accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
4997
|
-
}
|
|
4998
|
-
if (!accounts.metadataProgram.value) {
|
|
4999
|
-
accounts.metadataProgram.value = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
|
|
5000
|
-
}
|
|
5001
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5002
|
-
return Object.freeze({
|
|
5003
|
-
accounts: [
|
|
5004
|
-
getAccountMeta(accounts.payer),
|
|
5005
|
-
getAccountMeta(accounts.positionNftOwner),
|
|
5006
|
-
getAccountMeta(accounts.positionNftMint),
|
|
5007
|
-
getAccountMeta(accounts.positionNftAccount),
|
|
5008
|
-
getAccountMeta(accounts.metadataAccount),
|
|
5009
|
-
getAccountMeta(accounts.poolState),
|
|
5010
|
-
getAccountMeta(accounts.protocolPosition),
|
|
5011
|
-
getAccountMeta(accounts.tickArrayLower),
|
|
5012
|
-
getAccountMeta(accounts.tickArrayUpper),
|
|
5013
|
-
getAccountMeta(accounts.personalPosition),
|
|
5014
|
-
getAccountMeta(accounts.tokenAccount0),
|
|
5015
|
-
getAccountMeta(accounts.tokenAccount1),
|
|
5016
|
-
getAccountMeta(accounts.tokenVault0),
|
|
5017
|
-
getAccountMeta(accounts.tokenVault1),
|
|
5018
|
-
getAccountMeta(accounts.rent),
|
|
5019
|
-
getAccountMeta(accounts.systemProgram),
|
|
5020
|
-
getAccountMeta(accounts.tokenProgram),
|
|
5021
|
-
getAccountMeta(accounts.associatedTokenProgram),
|
|
5022
|
-
getAccountMeta(accounts.metadataProgram)
|
|
5023
|
-
],
|
|
5024
|
-
data: getOpenPositionInstructionDataEncoder().encode(
|
|
5025
|
-
args
|
|
5026
|
-
),
|
|
5027
|
-
programAddress
|
|
5028
|
-
});
|
|
5029
|
-
}
|
|
5030
|
-
function getOpenPositionInstruction(input, config) {
|
|
5031
|
-
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
5032
|
-
const originalAccounts = {
|
|
5033
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
5034
|
-
positionNftOwner: {
|
|
5035
|
-
value: input.positionNftOwner ?? null,
|
|
5036
|
-
isWritable: false
|
|
5037
|
-
},
|
|
5038
|
-
positionNftMint: { value: input.positionNftMint ?? null, isWritable: true },
|
|
5039
|
-
positionNftAccount: {
|
|
5040
|
-
value: input.positionNftAccount ?? null,
|
|
5041
|
-
isWritable: true
|
|
5042
|
-
},
|
|
5043
|
-
metadataAccount: { value: input.metadataAccount ?? null, isWritable: true },
|
|
5044
|
-
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
5045
|
-
protocolPosition: {
|
|
5046
|
-
value: input.protocolPosition ?? null,
|
|
5047
|
-
isWritable: false
|
|
5048
|
-
},
|
|
5049
|
-
tickArrayLower: { value: input.tickArrayLower ?? null, isWritable: true },
|
|
5050
|
-
tickArrayUpper: { value: input.tickArrayUpper ?? null, isWritable: true },
|
|
5051
|
-
personalPosition: {
|
|
5052
|
-
value: input.personalPosition ?? null,
|
|
5053
|
-
isWritable: true
|
|
5054
|
-
},
|
|
5055
|
-
tokenAccount0: { value: input.tokenAccount0 ?? null, isWritable: true },
|
|
5056
|
-
tokenAccount1: { value: input.tokenAccount1 ?? null, isWritable: true },
|
|
5057
|
-
tokenVault0: { value: input.tokenVault0 ?? null, isWritable: true },
|
|
5058
|
-
tokenVault1: { value: input.tokenVault1 ?? null, isWritable: true },
|
|
5059
|
-
rent: { value: input.rent ?? null, isWritable: false },
|
|
5060
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
5061
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
5062
|
-
associatedTokenProgram: {
|
|
5063
|
-
value: input.associatedTokenProgram ?? null,
|
|
5064
|
-
isWritable: false
|
|
5065
|
-
},
|
|
5066
|
-
metadataProgram: {
|
|
5067
|
-
value: input.metadataProgram ?? null,
|
|
5068
|
-
isWritable: false
|
|
5069
|
-
}
|
|
5070
|
-
};
|
|
5071
|
-
const accounts = originalAccounts;
|
|
5072
|
-
const args = { ...input };
|
|
5073
|
-
if (!accounts.rent.value) {
|
|
5074
|
-
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
5075
|
-
}
|
|
5076
|
-
if (!accounts.systemProgram.value) {
|
|
5077
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
5078
|
-
}
|
|
5079
|
-
if (!accounts.tokenProgram.value) {
|
|
5080
|
-
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
5081
|
-
}
|
|
5082
|
-
if (!accounts.associatedTokenProgram.value) {
|
|
5083
|
-
accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
5084
|
-
}
|
|
5085
|
-
if (!accounts.metadataProgram.value) {
|
|
5086
|
-
accounts.metadataProgram.value = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
|
|
5087
|
-
}
|
|
5088
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5089
|
-
return Object.freeze({
|
|
5090
|
-
accounts: [
|
|
5091
|
-
getAccountMeta(accounts.payer),
|
|
5092
|
-
getAccountMeta(accounts.positionNftOwner),
|
|
5093
|
-
getAccountMeta(accounts.positionNftMint),
|
|
5094
|
-
getAccountMeta(accounts.positionNftAccount),
|
|
5095
|
-
getAccountMeta(accounts.metadataAccount),
|
|
5096
|
-
getAccountMeta(accounts.poolState),
|
|
5097
|
-
getAccountMeta(accounts.protocolPosition),
|
|
5098
|
-
getAccountMeta(accounts.tickArrayLower),
|
|
5099
|
-
getAccountMeta(accounts.tickArrayUpper),
|
|
5100
|
-
getAccountMeta(accounts.personalPosition),
|
|
5101
|
-
getAccountMeta(accounts.tokenAccount0),
|
|
5102
|
-
getAccountMeta(accounts.tokenAccount1),
|
|
5103
|
-
getAccountMeta(accounts.tokenVault0),
|
|
5104
|
-
getAccountMeta(accounts.tokenVault1),
|
|
5105
|
-
getAccountMeta(accounts.rent),
|
|
5106
|
-
getAccountMeta(accounts.systemProgram),
|
|
5107
|
-
getAccountMeta(accounts.tokenProgram),
|
|
5108
|
-
getAccountMeta(accounts.associatedTokenProgram),
|
|
5109
|
-
getAccountMeta(accounts.metadataProgram)
|
|
5110
|
-
],
|
|
5111
|
-
data: getOpenPositionInstructionDataEncoder().encode(
|
|
5112
|
-
args
|
|
5113
|
-
),
|
|
5114
|
-
programAddress
|
|
5115
|
-
});
|
|
5116
|
-
}
|
|
5117
|
-
function parseOpenPositionInstruction(instruction) {
|
|
5118
|
-
if (instruction.accounts.length < 19) {
|
|
5119
|
-
throw new Error("Not enough accounts");
|
|
5120
|
-
}
|
|
5121
|
-
let accountIndex = 0;
|
|
5122
|
-
const getNextAccount = () => {
|
|
5123
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
5124
|
-
accountIndex += 1;
|
|
5125
|
-
return accountMeta;
|
|
5126
|
-
};
|
|
5127
|
-
return {
|
|
5128
|
-
programAddress: instruction.programAddress,
|
|
5129
|
-
accounts: {
|
|
5130
|
-
payer: getNextAccount(),
|
|
5131
|
-
positionNftOwner: getNextAccount(),
|
|
5132
|
-
positionNftMint: getNextAccount(),
|
|
5133
|
-
positionNftAccount: getNextAccount(),
|
|
5134
|
-
metadataAccount: getNextAccount(),
|
|
5135
|
-
poolState: getNextAccount(),
|
|
5136
|
-
protocolPosition: getNextAccount(),
|
|
5137
|
-
tickArrayLower: getNextAccount(),
|
|
5138
|
-
tickArrayUpper: getNextAccount(),
|
|
5139
|
-
personalPosition: getNextAccount(),
|
|
5140
|
-
tokenAccount0: getNextAccount(),
|
|
5141
|
-
tokenAccount1: getNextAccount(),
|
|
5142
|
-
tokenVault0: getNextAccount(),
|
|
5143
|
-
tokenVault1: getNextAccount(),
|
|
5144
|
-
rent: getNextAccount(),
|
|
5145
|
-
systemProgram: getNextAccount(),
|
|
5146
|
-
tokenProgram: getNextAccount(),
|
|
5147
|
-
associatedTokenProgram: getNextAccount(),
|
|
5148
|
-
metadataProgram: getNextAccount()
|
|
5149
|
-
},
|
|
5150
|
-
data: getOpenPositionInstructionDataDecoder().decode(instruction.data)
|
|
5151
|
-
};
|
|
5152
|
-
}
|
|
5153
|
-
|
|
5154
|
-
// src/generated/instructions/openPositionV2.ts
|
|
5155
|
-
import {
|
|
5156
|
-
combineCodec as combineCodec40,
|
|
5157
|
-
fixDecoderSize as fixDecoderSize25,
|
|
5158
|
-
fixEncoderSize as fixEncoderSize26,
|
|
5159
|
-
getAddressEncoder as getAddressEncoder25,
|
|
5160
|
-
getBooleanDecoder as getBooleanDecoder4,
|
|
5161
|
-
getBooleanEncoder as getBooleanEncoder4,
|
|
5162
|
-
getBytesDecoder as getBytesDecoder25,
|
|
5163
|
-
getBytesEncoder as getBytesEncoder26,
|
|
5164
|
-
getI32Decoder as getI32Decoder12,
|
|
5165
|
-
getI32Encoder as getI32Encoder12,
|
|
5166
|
-
getOptionDecoder as getOptionDecoder2,
|
|
5167
|
-
getOptionEncoder as getOptionEncoder2,
|
|
5168
|
-
getProgramDerivedAddress as getProgramDerivedAddress8,
|
|
5169
|
-
getStructDecoder as getStructDecoder40,
|
|
5170
|
-
getStructEncoder as getStructEncoder40,
|
|
5171
|
-
getU128Decoder as getU128Decoder22,
|
|
5172
|
-
getU128Encoder as getU128Encoder22,
|
|
5173
|
-
getU64Decoder as getU64Decoder28,
|
|
5174
|
-
getU64Encoder as getU64Encoder28,
|
|
5175
|
-
transformEncoder as transformEncoder25
|
|
5176
|
-
} from "@solana/kit";
|
|
5177
|
-
var OPEN_POSITION_V2_DISCRIMINATOR = new Uint8Array([
|
|
5178
|
-
77,
|
|
5179
|
-
184,
|
|
5180
|
-
74,
|
|
5181
|
-
214,
|
|
5182
|
-
112,
|
|
5183
|
-
86,
|
|
5184
|
-
241,
|
|
5185
|
-
199
|
|
5186
|
-
]);
|
|
5187
|
-
function getOpenPositionV2DiscriminatorBytes() {
|
|
5188
|
-
return fixEncoderSize26(getBytesEncoder26(), 8).encode(
|
|
5189
|
-
OPEN_POSITION_V2_DISCRIMINATOR
|
|
5190
|
-
);
|
|
5191
|
-
}
|
|
5192
|
-
function getOpenPositionV2InstructionDataEncoder() {
|
|
5193
|
-
return transformEncoder25(
|
|
5194
|
-
getStructEncoder40([
|
|
5195
|
-
["discriminator", fixEncoderSize26(getBytesEncoder26(), 8)],
|
|
5196
|
-
["tickLowerIndex", getI32Encoder12()],
|
|
5197
|
-
["tickUpperIndex", getI32Encoder12()],
|
|
5198
|
-
["tickArrayLowerStartIndex", getI32Encoder12()],
|
|
5199
|
-
["tickArrayUpperStartIndex", getI32Encoder12()],
|
|
5200
|
-
["liquidity", getU128Encoder22()],
|
|
5201
|
-
["amount0Max", getU64Encoder28()],
|
|
5202
|
-
["amount1Max", getU64Encoder28()],
|
|
5203
|
-
["withMetadata", getBooleanEncoder4()],
|
|
5204
|
-
["baseFlag", getOptionEncoder2(getBooleanEncoder4())]
|
|
5205
|
-
]),
|
|
5206
|
-
(value) => ({ ...value, discriminator: OPEN_POSITION_V2_DISCRIMINATOR })
|
|
5207
|
-
);
|
|
5208
|
-
}
|
|
5209
|
-
function getOpenPositionV2InstructionDataDecoder() {
|
|
5210
|
-
return getStructDecoder40([
|
|
5211
|
-
["discriminator", fixDecoderSize25(getBytesDecoder25(), 8)],
|
|
5212
|
-
["tickLowerIndex", getI32Decoder12()],
|
|
5213
|
-
["tickUpperIndex", getI32Decoder12()],
|
|
5214
|
-
["tickArrayLowerStartIndex", getI32Decoder12()],
|
|
5215
|
-
["tickArrayUpperStartIndex", getI32Decoder12()],
|
|
5216
|
-
["liquidity", getU128Decoder22()],
|
|
5217
|
-
["amount0Max", getU64Decoder28()],
|
|
5218
|
-
["amount1Max", getU64Decoder28()],
|
|
5219
|
-
["withMetadata", getBooleanDecoder4()],
|
|
5220
|
-
["baseFlag", getOptionDecoder2(getBooleanDecoder4())]
|
|
5221
|
-
]);
|
|
5222
|
-
}
|
|
5223
|
-
function getOpenPositionV2InstructionDataCodec() {
|
|
5224
|
-
return combineCodec40(
|
|
5225
|
-
getOpenPositionV2InstructionDataEncoder(),
|
|
5226
|
-
getOpenPositionV2InstructionDataDecoder()
|
|
5227
|
-
);
|
|
5228
|
-
}
|
|
5229
|
-
async function getOpenPositionV2InstructionAsync(input, config) {
|
|
5230
|
-
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
5231
|
-
const originalAccounts = {
|
|
5232
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
5233
|
-
positionNftOwner: {
|
|
5234
|
-
value: input.positionNftOwner ?? null,
|
|
5235
|
-
isWritable: false
|
|
5236
|
-
},
|
|
5237
|
-
positionNftMint: { value: input.positionNftMint ?? null, isWritable: true },
|
|
5238
|
-
positionNftAccount: {
|
|
5239
|
-
value: input.positionNftAccount ?? null,
|
|
5240
|
-
isWritable: true
|
|
5241
|
-
},
|
|
5242
|
-
metadataAccount: { value: input.metadataAccount ?? null, isWritable: true },
|
|
5243
|
-
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
5244
|
-
protocolPosition: {
|
|
5245
|
-
value: input.protocolPosition ?? null,
|
|
5246
|
-
isWritable: false
|
|
5247
|
-
},
|
|
5248
|
-
tickArrayLower: { value: input.tickArrayLower ?? null, isWritable: true },
|
|
5249
|
-
tickArrayUpper: { value: input.tickArrayUpper ?? null, isWritable: true },
|
|
5250
|
-
personalPosition: {
|
|
5251
|
-
value: input.personalPosition ?? null,
|
|
5252
|
-
isWritable: true
|
|
5253
|
-
},
|
|
5254
|
-
tokenAccount0: { value: input.tokenAccount0 ?? null, isWritable: true },
|
|
5255
|
-
tokenAccount1: { value: input.tokenAccount1 ?? null, isWritable: true },
|
|
5256
|
-
tokenVault0: { value: input.tokenVault0 ?? null, isWritable: true },
|
|
5257
|
-
tokenVault1: { value: input.tokenVault1 ?? null, isWritable: true },
|
|
5258
|
-
rent: { value: input.rent ?? null, isWritable: false },
|
|
5259
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
5260
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
5261
|
-
associatedTokenProgram: {
|
|
5262
|
-
value: input.associatedTokenProgram ?? null,
|
|
5263
|
-
isWritable: false
|
|
5264
|
-
},
|
|
5265
|
-
metadataProgram: {
|
|
5266
|
-
value: input.metadataProgram ?? null,
|
|
5267
|
-
isWritable: false
|
|
5268
|
-
},
|
|
5269
|
-
tokenProgram2022: {
|
|
5270
|
-
value: input.tokenProgram2022 ?? null,
|
|
5271
|
-
isWritable: false
|
|
5272
|
-
},
|
|
5273
|
-
vault0Mint: { value: input.vault0Mint ?? null, isWritable: false },
|
|
5274
|
-
vault1Mint: { value: input.vault1Mint ?? null, isWritable: false }
|
|
5275
|
-
};
|
|
5276
|
-
const accounts = originalAccounts;
|
|
5277
|
-
const args = { ...input };
|
|
5278
|
-
if (!accounts.positionNftAccount.value) {
|
|
5279
|
-
accounts.positionNftAccount.value = await getProgramDerivedAddress8({
|
|
5280
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
5281
|
-
seeds: [
|
|
5282
|
-
getAddressEncoder25().encode(
|
|
5283
|
-
expectAddress(accounts.positionNftOwner.value)
|
|
5284
|
-
),
|
|
5285
|
-
getBytesEncoder26().encode(
|
|
5286
|
-
new Uint8Array([
|
|
5287
|
-
6,
|
|
5288
|
-
221,
|
|
5289
|
-
246,
|
|
5290
|
-
225,
|
|
5291
|
-
215,
|
|
5292
|
-
101,
|
|
5293
|
-
161,
|
|
5294
|
-
147,
|
|
5295
|
-
217,
|
|
5296
|
-
203,
|
|
5297
|
-
225,
|
|
5298
|
-
70,
|
|
5299
|
-
206,
|
|
5300
|
-
235,
|
|
5301
|
-
121,
|
|
5302
|
-
172,
|
|
5303
|
-
28,
|
|
5304
|
-
180,
|
|
5305
|
-
133,
|
|
5306
|
-
237,
|
|
5307
|
-
95,
|
|
5308
|
-
91,
|
|
5309
|
-
55,
|
|
5310
|
-
145,
|
|
5311
|
-
58,
|
|
5312
|
-
140,
|
|
5313
|
-
245,
|
|
5314
|
-
133,
|
|
5315
|
-
126,
|
|
5316
|
-
255,
|
|
5317
|
-
0,
|
|
5318
|
-
169
|
|
5319
|
-
])
|
|
5320
|
-
),
|
|
5321
|
-
getAddressEncoder25().encode(
|
|
5322
|
-
expectAddress(accounts.positionNftMint.value)
|
|
5323
|
-
)
|
|
5324
|
-
]
|
|
5325
|
-
});
|
|
5326
|
-
}
|
|
5327
|
-
if (!accounts.tickArrayLower.value) {
|
|
5328
|
-
accounts.tickArrayLower.value = await getProgramDerivedAddress8({
|
|
5329
|
-
programAddress,
|
|
5330
|
-
seeds: [
|
|
5331
|
-
getBytesEncoder26().encode(
|
|
5332
|
-
new Uint8Array([116, 105, 99, 107, 95, 97, 114, 114, 97, 121])
|
|
5333
|
-
),
|
|
5334
|
-
getAddressEncoder25().encode(expectAddress(accounts.poolState.value)),
|
|
5335
|
-
getI32Encoder12().encode(expectSome(args.tickArrayLowerStartIndex))
|
|
5336
|
-
]
|
|
5337
|
-
});
|
|
5338
|
-
}
|
|
5339
|
-
if (!accounts.tickArrayUpper.value) {
|
|
5340
|
-
accounts.tickArrayUpper.value = await getProgramDerivedAddress8({
|
|
4285
|
+
if (!accounts.operationState.value) {
|
|
4286
|
+
accounts.operationState.value = await getProgramDerivedAddress6({
|
|
5341
4287
|
programAddress,
|
|
5342
4288
|
seeds: [
|
|
5343
|
-
|
|
5344
|
-
new Uint8Array([
|
|
5345
|
-
)
|
|
5346
|
-
getAddressEncoder25().encode(expectAddress(accounts.poolState.value)),
|
|
5347
|
-
getI32Encoder12().encode(expectSome(args.tickArrayUpperStartIndex))
|
|
4289
|
+
getBytesEncoder22().encode(
|
|
4290
|
+
new Uint8Array([111, 112, 101, 114, 97, 116, 105, 111, 110])
|
|
4291
|
+
)
|
|
5348
4292
|
]
|
|
5349
4293
|
});
|
|
5350
4294
|
}
|
|
5351
|
-
if (!accounts.
|
|
5352
|
-
accounts.
|
|
4295
|
+
if (!accounts.rewardTokenVault.value) {
|
|
4296
|
+
accounts.rewardTokenVault.value = await getProgramDerivedAddress6({
|
|
5353
4297
|
programAddress,
|
|
5354
4298
|
seeds: [
|
|
5355
|
-
|
|
5356
|
-
new Uint8Array([
|
|
4299
|
+
getBytesEncoder22().encode(
|
|
4300
|
+
new Uint8Array([
|
|
4301
|
+
112,
|
|
4302
|
+
111,
|
|
4303
|
+
111,
|
|
4304
|
+
108,
|
|
4305
|
+
95,
|
|
4306
|
+
114,
|
|
4307
|
+
101,
|
|
4308
|
+
119,
|
|
4309
|
+
97,
|
|
4310
|
+
114,
|
|
4311
|
+
100,
|
|
4312
|
+
95,
|
|
4313
|
+
118,
|
|
4314
|
+
97,
|
|
4315
|
+
117,
|
|
4316
|
+
108,
|
|
4317
|
+
116
|
|
4318
|
+
])
|
|
5357
4319
|
),
|
|
5358
|
-
|
|
5359
|
-
|
|
4320
|
+
getAddressEncoder23().encode(expectAddress(accounts.poolState.value)),
|
|
4321
|
+
getAddressEncoder23().encode(
|
|
4322
|
+
expectAddress(accounts.rewardTokenMint.value)
|
|
5360
4323
|
)
|
|
5361
4324
|
]
|
|
5362
4325
|
});
|
|
5363
4326
|
}
|
|
5364
|
-
if (!accounts.
|
|
5365
|
-
accounts.
|
|
5366
|
-
}
|
|
5367
|
-
if (!accounts.systemProgram.value) {
|
|
5368
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
5369
|
-
}
|
|
5370
|
-
if (!accounts.tokenProgram.value) {
|
|
5371
|
-
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
5372
|
-
}
|
|
5373
|
-
if (!accounts.associatedTokenProgram.value) {
|
|
5374
|
-
accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
5375
|
-
}
|
|
5376
|
-
if (!accounts.metadataProgram.value) {
|
|
5377
|
-
accounts.metadataProgram.value = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
|
|
4327
|
+
if (!accounts.systemProgram.value) {
|
|
4328
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
5378
4329
|
}
|
|
5379
|
-
if (!accounts.
|
|
5380
|
-
accounts.
|
|
4330
|
+
if (!accounts.rent.value) {
|
|
4331
|
+
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
5381
4332
|
}
|
|
5382
4333
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5383
4334
|
return Object.freeze({
|
|
5384
4335
|
accounts: [
|
|
5385
|
-
getAccountMeta(accounts.
|
|
5386
|
-
getAccountMeta(accounts.
|
|
5387
|
-
getAccountMeta(accounts.
|
|
5388
|
-
getAccountMeta(accounts.positionNftAccount),
|
|
5389
|
-
getAccountMeta(accounts.metadataAccount),
|
|
4336
|
+
getAccountMeta(accounts.rewardFunder),
|
|
4337
|
+
getAccountMeta(accounts.funderTokenAccount),
|
|
4338
|
+
getAccountMeta(accounts.ammConfig),
|
|
5390
4339
|
getAccountMeta(accounts.poolState),
|
|
5391
|
-
getAccountMeta(accounts.
|
|
5392
|
-
getAccountMeta(accounts.
|
|
5393
|
-
getAccountMeta(accounts.
|
|
5394
|
-
getAccountMeta(accounts.
|
|
5395
|
-
getAccountMeta(accounts.tokenAccount0),
|
|
5396
|
-
getAccountMeta(accounts.tokenAccount1),
|
|
5397
|
-
getAccountMeta(accounts.tokenVault0),
|
|
5398
|
-
getAccountMeta(accounts.tokenVault1),
|
|
5399
|
-
getAccountMeta(accounts.rent),
|
|
4340
|
+
getAccountMeta(accounts.operationState),
|
|
4341
|
+
getAccountMeta(accounts.rewardTokenMint),
|
|
4342
|
+
getAccountMeta(accounts.rewardTokenVault),
|
|
4343
|
+
getAccountMeta(accounts.rewardTokenProgram),
|
|
5400
4344
|
getAccountMeta(accounts.systemProgram),
|
|
5401
|
-
getAccountMeta(accounts.
|
|
5402
|
-
getAccountMeta(accounts.associatedTokenProgram),
|
|
5403
|
-
getAccountMeta(accounts.metadataProgram),
|
|
5404
|
-
getAccountMeta(accounts.tokenProgram2022),
|
|
5405
|
-
getAccountMeta(accounts.vault0Mint),
|
|
5406
|
-
getAccountMeta(accounts.vault1Mint)
|
|
4345
|
+
getAccountMeta(accounts.rent)
|
|
5407
4346
|
],
|
|
5408
|
-
data:
|
|
4347
|
+
data: getInitializeRewardInstructionDataEncoder().encode(
|
|
5409
4348
|
args
|
|
5410
4349
|
),
|
|
5411
4350
|
programAddress
|
|
5412
4351
|
});
|
|
5413
4352
|
}
|
|
5414
|
-
function
|
|
4353
|
+
function getInitializeRewardInstruction(input, config) {
|
|
5415
4354
|
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
5416
4355
|
const originalAccounts = {
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
value: input.
|
|
5420
|
-
isWritable: false
|
|
5421
|
-
},
|
|
5422
|
-
positionNftMint: { value: input.positionNftMint ?? null, isWritable: true },
|
|
5423
|
-
positionNftAccount: {
|
|
5424
|
-
value: input.positionNftAccount ?? null,
|
|
4356
|
+
rewardFunder: { value: input.rewardFunder ?? null, isWritable: true },
|
|
4357
|
+
funderTokenAccount: {
|
|
4358
|
+
value: input.funderTokenAccount ?? null,
|
|
5425
4359
|
isWritable: true
|
|
5426
4360
|
},
|
|
5427
|
-
|
|
4361
|
+
ammConfig: { value: input.ammConfig ?? null, isWritable: false },
|
|
5428
4362
|
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
5429
|
-
|
|
5430
|
-
|
|
4363
|
+
operationState: { value: input.operationState ?? null, isWritable: false },
|
|
4364
|
+
rewardTokenMint: {
|
|
4365
|
+
value: input.rewardTokenMint ?? null,
|
|
5431
4366
|
isWritable: false
|
|
5432
4367
|
},
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
personalPosition: {
|
|
5436
|
-
value: input.personalPosition ?? null,
|
|
4368
|
+
rewardTokenVault: {
|
|
4369
|
+
value: input.rewardTokenVault ?? null,
|
|
5437
4370
|
isWritable: true
|
|
5438
4371
|
},
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
tokenVault0: { value: input.tokenVault0 ?? null, isWritable: true },
|
|
5442
|
-
tokenVault1: { value: input.tokenVault1 ?? null, isWritable: true },
|
|
5443
|
-
rent: { value: input.rent ?? null, isWritable: false },
|
|
5444
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
5445
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
5446
|
-
associatedTokenProgram: {
|
|
5447
|
-
value: input.associatedTokenProgram ?? null,
|
|
5448
|
-
isWritable: false
|
|
5449
|
-
},
|
|
5450
|
-
metadataProgram: {
|
|
5451
|
-
value: input.metadataProgram ?? null,
|
|
5452
|
-
isWritable: false
|
|
5453
|
-
},
|
|
5454
|
-
tokenProgram2022: {
|
|
5455
|
-
value: input.tokenProgram2022 ?? null,
|
|
4372
|
+
rewardTokenProgram: {
|
|
4373
|
+
value: input.rewardTokenProgram ?? null,
|
|
5456
4374
|
isWritable: false
|
|
5457
4375
|
},
|
|
5458
|
-
|
|
5459
|
-
|
|
4376
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
4377
|
+
rent: { value: input.rent ?? null, isWritable: false }
|
|
5460
4378
|
};
|
|
5461
4379
|
const accounts = originalAccounts;
|
|
5462
4380
|
const args = { ...input };
|
|
5463
|
-
if (!accounts.rent.value) {
|
|
5464
|
-
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
5465
|
-
}
|
|
5466
4381
|
if (!accounts.systemProgram.value) {
|
|
5467
4382
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
5468
4383
|
}
|
|
5469
|
-
if (!accounts.
|
|
5470
|
-
accounts.
|
|
5471
|
-
}
|
|
5472
|
-
if (!accounts.associatedTokenProgram.value) {
|
|
5473
|
-
accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
5474
|
-
}
|
|
5475
|
-
if (!accounts.metadataProgram.value) {
|
|
5476
|
-
accounts.metadataProgram.value = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
|
|
5477
|
-
}
|
|
5478
|
-
if (!accounts.tokenProgram2022.value) {
|
|
5479
|
-
accounts.tokenProgram2022.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
4384
|
+
if (!accounts.rent.value) {
|
|
4385
|
+
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
5480
4386
|
}
|
|
5481
4387
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5482
4388
|
return Object.freeze({
|
|
5483
4389
|
accounts: [
|
|
5484
|
-
getAccountMeta(accounts.
|
|
5485
|
-
getAccountMeta(accounts.
|
|
5486
|
-
getAccountMeta(accounts.
|
|
5487
|
-
getAccountMeta(accounts.positionNftAccount),
|
|
5488
|
-
getAccountMeta(accounts.metadataAccount),
|
|
4390
|
+
getAccountMeta(accounts.rewardFunder),
|
|
4391
|
+
getAccountMeta(accounts.funderTokenAccount),
|
|
4392
|
+
getAccountMeta(accounts.ammConfig),
|
|
5489
4393
|
getAccountMeta(accounts.poolState),
|
|
5490
|
-
getAccountMeta(accounts.
|
|
5491
|
-
getAccountMeta(accounts.
|
|
5492
|
-
getAccountMeta(accounts.
|
|
5493
|
-
getAccountMeta(accounts.
|
|
5494
|
-
getAccountMeta(accounts.tokenAccount0),
|
|
5495
|
-
getAccountMeta(accounts.tokenAccount1),
|
|
5496
|
-
getAccountMeta(accounts.tokenVault0),
|
|
5497
|
-
getAccountMeta(accounts.tokenVault1),
|
|
5498
|
-
getAccountMeta(accounts.rent),
|
|
4394
|
+
getAccountMeta(accounts.operationState),
|
|
4395
|
+
getAccountMeta(accounts.rewardTokenMint),
|
|
4396
|
+
getAccountMeta(accounts.rewardTokenVault),
|
|
4397
|
+
getAccountMeta(accounts.rewardTokenProgram),
|
|
5499
4398
|
getAccountMeta(accounts.systemProgram),
|
|
5500
|
-
getAccountMeta(accounts.
|
|
5501
|
-
getAccountMeta(accounts.associatedTokenProgram),
|
|
5502
|
-
getAccountMeta(accounts.metadataProgram),
|
|
5503
|
-
getAccountMeta(accounts.tokenProgram2022),
|
|
5504
|
-
getAccountMeta(accounts.vault0Mint),
|
|
5505
|
-
getAccountMeta(accounts.vault1Mint)
|
|
4399
|
+
getAccountMeta(accounts.rent)
|
|
5506
4400
|
],
|
|
5507
|
-
data:
|
|
4401
|
+
data: getInitializeRewardInstructionDataEncoder().encode(
|
|
5508
4402
|
args
|
|
5509
4403
|
),
|
|
5510
4404
|
programAddress
|
|
5511
4405
|
});
|
|
5512
4406
|
}
|
|
5513
|
-
function
|
|
5514
|
-
if (instruction.accounts.length <
|
|
4407
|
+
function parseInitializeRewardInstruction(instruction) {
|
|
4408
|
+
if (instruction.accounts.length < 10) {
|
|
5515
4409
|
throw new Error("Not enough accounts");
|
|
5516
4410
|
}
|
|
5517
4411
|
let accountIndex = 0;
|
|
@@ -5523,55 +4417,43 @@ function parseOpenPositionV2Instruction(instruction) {
|
|
|
5523
4417
|
return {
|
|
5524
4418
|
programAddress: instruction.programAddress,
|
|
5525
4419
|
accounts: {
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
positionNftAccount: getNextAccount(),
|
|
5530
|
-
metadataAccount: getNextAccount(),
|
|
4420
|
+
rewardFunder: getNextAccount(),
|
|
4421
|
+
funderTokenAccount: getNextAccount(),
|
|
4422
|
+
ammConfig: getNextAccount(),
|
|
5531
4423
|
poolState: getNextAccount(),
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
tokenAccount0: getNextAccount(),
|
|
5537
|
-
tokenAccount1: getNextAccount(),
|
|
5538
|
-
tokenVault0: getNextAccount(),
|
|
5539
|
-
tokenVault1: getNextAccount(),
|
|
5540
|
-
rent: getNextAccount(),
|
|
4424
|
+
operationState: getNextAccount(),
|
|
4425
|
+
rewardTokenMint: getNextAccount(),
|
|
4426
|
+
rewardTokenVault: getNextAccount(),
|
|
4427
|
+
rewardTokenProgram: getNextAccount(),
|
|
5541
4428
|
systemProgram: getNextAccount(),
|
|
5542
|
-
|
|
5543
|
-
associatedTokenProgram: getNextAccount(),
|
|
5544
|
-
metadataProgram: getNextAccount(),
|
|
5545
|
-
tokenProgram2022: getNextAccount(),
|
|
5546
|
-
vault0Mint: getNextAccount(),
|
|
5547
|
-
vault1Mint: getNextAccount()
|
|
4429
|
+
rent: getNextAccount()
|
|
5548
4430
|
},
|
|
5549
|
-
data:
|
|
4431
|
+
data: getInitializeRewardInstructionDataDecoder().decode(instruction.data)
|
|
5550
4432
|
};
|
|
5551
4433
|
}
|
|
5552
4434
|
|
|
5553
4435
|
// src/generated/instructions/openPositionWithToken22Nft.ts
|
|
5554
4436
|
import {
|
|
5555
|
-
combineCodec as
|
|
5556
|
-
fixDecoderSize as
|
|
5557
|
-
fixEncoderSize as
|
|
5558
|
-
getAddressEncoder as
|
|
5559
|
-
getBooleanDecoder as
|
|
5560
|
-
getBooleanEncoder as
|
|
5561
|
-
getBytesDecoder as
|
|
5562
|
-
getBytesEncoder as
|
|
5563
|
-
getI32Decoder as
|
|
5564
|
-
getI32Encoder as
|
|
5565
|
-
getOptionDecoder as
|
|
5566
|
-
getOptionEncoder as
|
|
5567
|
-
getProgramDerivedAddress as
|
|
5568
|
-
getStructDecoder as
|
|
5569
|
-
getStructEncoder as
|
|
5570
|
-
getU128Decoder as
|
|
5571
|
-
getU128Encoder as
|
|
5572
|
-
getU64Decoder as
|
|
5573
|
-
getU64Encoder as
|
|
5574
|
-
transformEncoder as
|
|
4437
|
+
combineCodec as combineCodec37,
|
|
4438
|
+
fixDecoderSize as fixDecoderSize22,
|
|
4439
|
+
fixEncoderSize as fixEncoderSize23,
|
|
4440
|
+
getAddressEncoder as getAddressEncoder24,
|
|
4441
|
+
getBooleanDecoder as getBooleanDecoder4,
|
|
4442
|
+
getBooleanEncoder as getBooleanEncoder4,
|
|
4443
|
+
getBytesDecoder as getBytesDecoder22,
|
|
4444
|
+
getBytesEncoder as getBytesEncoder23,
|
|
4445
|
+
getI32Decoder as getI32Decoder11,
|
|
4446
|
+
getI32Encoder as getI32Encoder11,
|
|
4447
|
+
getOptionDecoder as getOptionDecoder2,
|
|
4448
|
+
getOptionEncoder as getOptionEncoder2,
|
|
4449
|
+
getProgramDerivedAddress as getProgramDerivedAddress7,
|
|
4450
|
+
getStructDecoder as getStructDecoder37,
|
|
4451
|
+
getStructEncoder as getStructEncoder37,
|
|
4452
|
+
getU128Decoder as getU128Decoder19,
|
|
4453
|
+
getU128Encoder as getU128Encoder19,
|
|
4454
|
+
getU64Decoder as getU64Decoder25,
|
|
4455
|
+
getU64Encoder as getU64Encoder25,
|
|
4456
|
+
transformEncoder as transformEncoder22
|
|
5575
4457
|
} from "@solana/kit";
|
|
5576
4458
|
var OPEN_POSITION_WITH_TOKEN22_NFT_DISCRIMINATOR = new Uint8Array([
|
|
5577
4459
|
77,
|
|
@@ -5584,23 +4466,23 @@ var OPEN_POSITION_WITH_TOKEN22_NFT_DISCRIMINATOR = new Uint8Array([
|
|
|
5584
4466
|
46
|
|
5585
4467
|
]);
|
|
5586
4468
|
function getOpenPositionWithToken22NftDiscriminatorBytes() {
|
|
5587
|
-
return
|
|
4469
|
+
return fixEncoderSize23(getBytesEncoder23(), 8).encode(
|
|
5588
4470
|
OPEN_POSITION_WITH_TOKEN22_NFT_DISCRIMINATOR
|
|
5589
4471
|
);
|
|
5590
4472
|
}
|
|
5591
4473
|
function getOpenPositionWithToken22NftInstructionDataEncoder() {
|
|
5592
|
-
return
|
|
5593
|
-
|
|
5594
|
-
["discriminator",
|
|
5595
|
-
["tickLowerIndex",
|
|
5596
|
-
["tickUpperIndex",
|
|
5597
|
-
["tickArrayLowerStartIndex",
|
|
5598
|
-
["tickArrayUpperStartIndex",
|
|
5599
|
-
["liquidity",
|
|
5600
|
-
["amount0Max",
|
|
5601
|
-
["amount1Max",
|
|
5602
|
-
["withMetadata",
|
|
5603
|
-
["baseFlag",
|
|
4474
|
+
return transformEncoder22(
|
|
4475
|
+
getStructEncoder37([
|
|
4476
|
+
["discriminator", fixEncoderSize23(getBytesEncoder23(), 8)],
|
|
4477
|
+
["tickLowerIndex", getI32Encoder11()],
|
|
4478
|
+
["tickUpperIndex", getI32Encoder11()],
|
|
4479
|
+
["tickArrayLowerStartIndex", getI32Encoder11()],
|
|
4480
|
+
["tickArrayUpperStartIndex", getI32Encoder11()],
|
|
4481
|
+
["liquidity", getU128Encoder19()],
|
|
4482
|
+
["amount0Max", getU64Encoder25()],
|
|
4483
|
+
["amount1Max", getU64Encoder25()],
|
|
4484
|
+
["withMetadata", getBooleanEncoder4()],
|
|
4485
|
+
["baseFlag", getOptionEncoder2(getBooleanEncoder4())]
|
|
5604
4486
|
]),
|
|
5605
4487
|
(value) => ({
|
|
5606
4488
|
...value,
|
|
@@ -5609,21 +4491,21 @@ function getOpenPositionWithToken22NftInstructionDataEncoder() {
|
|
|
5609
4491
|
);
|
|
5610
4492
|
}
|
|
5611
4493
|
function getOpenPositionWithToken22NftInstructionDataDecoder() {
|
|
5612
|
-
return
|
|
5613
|
-
["discriminator",
|
|
5614
|
-
["tickLowerIndex",
|
|
5615
|
-
["tickUpperIndex",
|
|
5616
|
-
["tickArrayLowerStartIndex",
|
|
5617
|
-
["tickArrayUpperStartIndex",
|
|
5618
|
-
["liquidity",
|
|
5619
|
-
["amount0Max",
|
|
5620
|
-
["amount1Max",
|
|
5621
|
-
["withMetadata",
|
|
5622
|
-
["baseFlag",
|
|
4494
|
+
return getStructDecoder37([
|
|
4495
|
+
["discriminator", fixDecoderSize22(getBytesDecoder22(), 8)],
|
|
4496
|
+
["tickLowerIndex", getI32Decoder11()],
|
|
4497
|
+
["tickUpperIndex", getI32Decoder11()],
|
|
4498
|
+
["tickArrayLowerStartIndex", getI32Decoder11()],
|
|
4499
|
+
["tickArrayUpperStartIndex", getI32Decoder11()],
|
|
4500
|
+
["liquidity", getU128Decoder19()],
|
|
4501
|
+
["amount0Max", getU64Decoder25()],
|
|
4502
|
+
["amount1Max", getU64Decoder25()],
|
|
4503
|
+
["withMetadata", getBooleanDecoder4()],
|
|
4504
|
+
["baseFlag", getOptionDecoder2(getBooleanDecoder4())]
|
|
5623
4505
|
]);
|
|
5624
4506
|
}
|
|
5625
4507
|
function getOpenPositionWithToken22NftInstructionDataCodec() {
|
|
5626
|
-
return
|
|
4508
|
+
return combineCodec37(
|
|
5627
4509
|
getOpenPositionWithToken22NftInstructionDataEncoder(),
|
|
5628
4510
|
getOpenPositionWithToken22NftInstructionDataDecoder()
|
|
5629
4511
|
);
|
|
@@ -5673,37 +4555,37 @@ async function getOpenPositionWithToken22NftInstructionAsync(input, config) {
|
|
|
5673
4555
|
const accounts = originalAccounts;
|
|
5674
4556
|
const args = { ...input };
|
|
5675
4557
|
if (!accounts.tickArrayLower.value) {
|
|
5676
|
-
accounts.tickArrayLower.value = await
|
|
4558
|
+
accounts.tickArrayLower.value = await getProgramDerivedAddress7({
|
|
5677
4559
|
programAddress,
|
|
5678
4560
|
seeds: [
|
|
5679
|
-
|
|
4561
|
+
getBytesEncoder23().encode(
|
|
5680
4562
|
new Uint8Array([116, 105, 99, 107, 95, 97, 114, 114, 97, 121])
|
|
5681
4563
|
),
|
|
5682
|
-
|
|
5683
|
-
|
|
4564
|
+
getAddressEncoder24().encode(expectAddress(accounts.poolState.value)),
|
|
4565
|
+
getI32Encoder11().encode(expectSome(args.tickArrayLowerStartIndex))
|
|
5684
4566
|
]
|
|
5685
4567
|
});
|
|
5686
4568
|
}
|
|
5687
4569
|
if (!accounts.tickArrayUpper.value) {
|
|
5688
|
-
accounts.tickArrayUpper.value = await
|
|
4570
|
+
accounts.tickArrayUpper.value = await getProgramDerivedAddress7({
|
|
5689
4571
|
programAddress,
|
|
5690
4572
|
seeds: [
|
|
5691
|
-
|
|
4573
|
+
getBytesEncoder23().encode(
|
|
5692
4574
|
new Uint8Array([116, 105, 99, 107, 95, 97, 114, 114, 97, 121])
|
|
5693
4575
|
),
|
|
5694
|
-
|
|
5695
|
-
|
|
4576
|
+
getAddressEncoder24().encode(expectAddress(accounts.poolState.value)),
|
|
4577
|
+
getI32Encoder11().encode(expectSome(args.tickArrayUpperStartIndex))
|
|
5696
4578
|
]
|
|
5697
4579
|
});
|
|
5698
4580
|
}
|
|
5699
4581
|
if (!accounts.personalPosition.value) {
|
|
5700
|
-
accounts.personalPosition.value = await
|
|
4582
|
+
accounts.personalPosition.value = await getProgramDerivedAddress7({
|
|
5701
4583
|
programAddress,
|
|
5702
4584
|
seeds: [
|
|
5703
|
-
|
|
4585
|
+
getBytesEncoder23().encode(
|
|
5704
4586
|
new Uint8Array([112, 111, 115, 105, 116, 105, 111, 110])
|
|
5705
4587
|
),
|
|
5706
|
-
|
|
4588
|
+
getAddressEncoder24().encode(
|
|
5707
4589
|
expectAddress(accounts.positionNftMint.value)
|
|
5708
4590
|
)
|
|
5709
4591
|
]
|
|
@@ -5885,21 +4767,21 @@ function parseOpenPositionWithToken22NftInstruction(instruction) {
|
|
|
5885
4767
|
|
|
5886
4768
|
// src/generated/instructions/setRewardParams.ts
|
|
5887
4769
|
import {
|
|
5888
|
-
combineCodec as
|
|
5889
|
-
fixDecoderSize as
|
|
5890
|
-
fixEncoderSize as
|
|
5891
|
-
getBytesDecoder as
|
|
5892
|
-
getBytesEncoder as
|
|
5893
|
-
getProgramDerivedAddress as
|
|
5894
|
-
getStructDecoder as
|
|
5895
|
-
getStructEncoder as
|
|
5896
|
-
getU128Decoder as
|
|
5897
|
-
getU128Encoder as
|
|
5898
|
-
getU64Decoder as
|
|
5899
|
-
getU64Encoder as
|
|
4770
|
+
combineCodec as combineCodec38,
|
|
4771
|
+
fixDecoderSize as fixDecoderSize23,
|
|
4772
|
+
fixEncoderSize as fixEncoderSize24,
|
|
4773
|
+
getBytesDecoder as getBytesDecoder23,
|
|
4774
|
+
getBytesEncoder as getBytesEncoder24,
|
|
4775
|
+
getProgramDerivedAddress as getProgramDerivedAddress8,
|
|
4776
|
+
getStructDecoder as getStructDecoder38,
|
|
4777
|
+
getStructEncoder as getStructEncoder38,
|
|
4778
|
+
getU128Decoder as getU128Decoder20,
|
|
4779
|
+
getU128Encoder as getU128Encoder20,
|
|
4780
|
+
getU64Decoder as getU64Decoder26,
|
|
4781
|
+
getU64Encoder as getU64Encoder26,
|
|
5900
4782
|
getU8Decoder as getU8Decoder9,
|
|
5901
4783
|
getU8Encoder as getU8Encoder9,
|
|
5902
|
-
transformEncoder as
|
|
4784
|
+
transformEncoder as transformEncoder23
|
|
5903
4785
|
} from "@solana/kit";
|
|
5904
4786
|
var SET_REWARD_PARAMS_DISCRIMINATOR = new Uint8Array([
|
|
5905
4787
|
112,
|
|
@@ -5912,33 +4794,33 @@ var SET_REWARD_PARAMS_DISCRIMINATOR = new Uint8Array([
|
|
|
5912
4794
|
137
|
|
5913
4795
|
]);
|
|
5914
4796
|
function getSetRewardParamsDiscriminatorBytes() {
|
|
5915
|
-
return
|
|
4797
|
+
return fixEncoderSize24(getBytesEncoder24(), 8).encode(
|
|
5916
4798
|
SET_REWARD_PARAMS_DISCRIMINATOR
|
|
5917
4799
|
);
|
|
5918
4800
|
}
|
|
5919
4801
|
function getSetRewardParamsInstructionDataEncoder() {
|
|
5920
|
-
return
|
|
5921
|
-
|
|
5922
|
-
["discriminator",
|
|
4802
|
+
return transformEncoder23(
|
|
4803
|
+
getStructEncoder38([
|
|
4804
|
+
["discriminator", fixEncoderSize24(getBytesEncoder24(), 8)],
|
|
5923
4805
|
["rewardIndex", getU8Encoder9()],
|
|
5924
|
-
["emissionsPerSecondX64",
|
|
5925
|
-
["openTime",
|
|
5926
|
-
["endTime",
|
|
4806
|
+
["emissionsPerSecondX64", getU128Encoder20()],
|
|
4807
|
+
["openTime", getU64Encoder26()],
|
|
4808
|
+
["endTime", getU64Encoder26()]
|
|
5927
4809
|
]),
|
|
5928
4810
|
(value) => ({ ...value, discriminator: SET_REWARD_PARAMS_DISCRIMINATOR })
|
|
5929
4811
|
);
|
|
5930
4812
|
}
|
|
5931
4813
|
function getSetRewardParamsInstructionDataDecoder() {
|
|
5932
|
-
return
|
|
5933
|
-
["discriminator",
|
|
4814
|
+
return getStructDecoder38([
|
|
4815
|
+
["discriminator", fixDecoderSize23(getBytesDecoder23(), 8)],
|
|
5934
4816
|
["rewardIndex", getU8Decoder9()],
|
|
5935
|
-
["emissionsPerSecondX64",
|
|
5936
|
-
["openTime",
|
|
5937
|
-
["endTime",
|
|
4817
|
+
["emissionsPerSecondX64", getU128Decoder20()],
|
|
4818
|
+
["openTime", getU64Decoder26()],
|
|
4819
|
+
["endTime", getU64Decoder26()]
|
|
5938
4820
|
]);
|
|
5939
4821
|
}
|
|
5940
4822
|
function getSetRewardParamsInstructionDataCodec() {
|
|
5941
|
-
return
|
|
4823
|
+
return combineCodec38(
|
|
5942
4824
|
getSetRewardParamsInstructionDataEncoder(),
|
|
5943
4825
|
getSetRewardParamsInstructionDataDecoder()
|
|
5944
4826
|
);
|
|
@@ -5959,10 +4841,10 @@ async function getSetRewardParamsInstructionAsync(input, config) {
|
|
|
5959
4841
|
const accounts = originalAccounts;
|
|
5960
4842
|
const args = { ...input };
|
|
5961
4843
|
if (!accounts.operationState.value) {
|
|
5962
|
-
accounts.operationState.value = await
|
|
4844
|
+
accounts.operationState.value = await getProgramDerivedAddress8({
|
|
5963
4845
|
programAddress,
|
|
5964
4846
|
seeds: [
|
|
5965
|
-
|
|
4847
|
+
getBytesEncoder24().encode(
|
|
5966
4848
|
new Uint8Array([111, 112, 101, 114, 97, 116, 105, 111, 110])
|
|
5967
4849
|
)
|
|
5968
4850
|
]
|
|
@@ -6051,151 +4933,18 @@ function parseSetRewardParamsInstruction(instruction) {
|
|
|
6051
4933
|
};
|
|
6052
4934
|
}
|
|
6053
4935
|
|
|
6054
|
-
// src/generated/instructions/swap.ts
|
|
6055
|
-
import {
|
|
6056
|
-
combineCodec as combineCodec43,
|
|
6057
|
-
fixDecoderSize as fixDecoderSize28,
|
|
6058
|
-
fixEncoderSize as fixEncoderSize29,
|
|
6059
|
-
getBooleanDecoder as getBooleanDecoder6,
|
|
6060
|
-
getBooleanEncoder as getBooleanEncoder6,
|
|
6061
|
-
getBytesDecoder as getBytesDecoder28,
|
|
6062
|
-
getBytesEncoder as getBytesEncoder29,
|
|
6063
|
-
getStructDecoder as getStructDecoder43,
|
|
6064
|
-
getStructEncoder as getStructEncoder43,
|
|
6065
|
-
getU128Decoder as getU128Decoder25,
|
|
6066
|
-
getU128Encoder as getU128Encoder25,
|
|
6067
|
-
getU64Decoder as getU64Decoder31,
|
|
6068
|
-
getU64Encoder as getU64Encoder31,
|
|
6069
|
-
transformEncoder as transformEncoder28
|
|
6070
|
-
} from "@solana/kit";
|
|
6071
|
-
var SWAP_DISCRIMINATOR = new Uint8Array([
|
|
6072
|
-
248,
|
|
6073
|
-
198,
|
|
6074
|
-
158,
|
|
6075
|
-
145,
|
|
6076
|
-
225,
|
|
6077
|
-
117,
|
|
6078
|
-
135,
|
|
6079
|
-
200
|
|
6080
|
-
]);
|
|
6081
|
-
function getSwapDiscriminatorBytes() {
|
|
6082
|
-
return fixEncoderSize29(getBytesEncoder29(), 8).encode(SWAP_DISCRIMINATOR);
|
|
6083
|
-
}
|
|
6084
|
-
function getSwapInstructionDataEncoder() {
|
|
6085
|
-
return transformEncoder28(
|
|
6086
|
-
getStructEncoder43([
|
|
6087
|
-
["discriminator", fixEncoderSize29(getBytesEncoder29(), 8)],
|
|
6088
|
-
["amount", getU64Encoder31()],
|
|
6089
|
-
["otherAmountThreshold", getU64Encoder31()],
|
|
6090
|
-
["sqrtPriceLimitX64", getU128Encoder25()],
|
|
6091
|
-
["isBaseInput", getBooleanEncoder6()]
|
|
6092
|
-
]),
|
|
6093
|
-
(value) => ({ ...value, discriminator: SWAP_DISCRIMINATOR })
|
|
6094
|
-
);
|
|
6095
|
-
}
|
|
6096
|
-
function getSwapInstructionDataDecoder() {
|
|
6097
|
-
return getStructDecoder43([
|
|
6098
|
-
["discriminator", fixDecoderSize28(getBytesDecoder28(), 8)],
|
|
6099
|
-
["amount", getU64Decoder31()],
|
|
6100
|
-
["otherAmountThreshold", getU64Decoder31()],
|
|
6101
|
-
["sqrtPriceLimitX64", getU128Decoder25()],
|
|
6102
|
-
["isBaseInput", getBooleanDecoder6()]
|
|
6103
|
-
]);
|
|
6104
|
-
}
|
|
6105
|
-
function getSwapInstructionDataCodec() {
|
|
6106
|
-
return combineCodec43(
|
|
6107
|
-
getSwapInstructionDataEncoder(),
|
|
6108
|
-
getSwapInstructionDataDecoder()
|
|
6109
|
-
);
|
|
6110
|
-
}
|
|
6111
|
-
function getSwapInstruction(input, config) {
|
|
6112
|
-
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
6113
|
-
const originalAccounts = {
|
|
6114
|
-
payer: { value: input.payer ?? null, isWritable: false },
|
|
6115
|
-
ammConfig: { value: input.ammConfig ?? null, isWritable: false },
|
|
6116
|
-
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
6117
|
-
inputTokenAccount: {
|
|
6118
|
-
value: input.inputTokenAccount ?? null,
|
|
6119
|
-
isWritable: true
|
|
6120
|
-
},
|
|
6121
|
-
outputTokenAccount: {
|
|
6122
|
-
value: input.outputTokenAccount ?? null,
|
|
6123
|
-
isWritable: true
|
|
6124
|
-
},
|
|
6125
|
-
inputVault: { value: input.inputVault ?? null, isWritable: true },
|
|
6126
|
-
outputVault: { value: input.outputVault ?? null, isWritable: true },
|
|
6127
|
-
observationState: {
|
|
6128
|
-
value: input.observationState ?? null,
|
|
6129
|
-
isWritable: true
|
|
6130
|
-
},
|
|
6131
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
6132
|
-
tickArray: { value: input.tickArray ?? null, isWritable: true }
|
|
6133
|
-
};
|
|
6134
|
-
const accounts = originalAccounts;
|
|
6135
|
-
const args = { ...input };
|
|
6136
|
-
if (!accounts.tokenProgram.value) {
|
|
6137
|
-
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
6138
|
-
}
|
|
6139
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
6140
|
-
return Object.freeze({
|
|
6141
|
-
accounts: [
|
|
6142
|
-
getAccountMeta(accounts.payer),
|
|
6143
|
-
getAccountMeta(accounts.ammConfig),
|
|
6144
|
-
getAccountMeta(accounts.poolState),
|
|
6145
|
-
getAccountMeta(accounts.inputTokenAccount),
|
|
6146
|
-
getAccountMeta(accounts.outputTokenAccount),
|
|
6147
|
-
getAccountMeta(accounts.inputVault),
|
|
6148
|
-
getAccountMeta(accounts.outputVault),
|
|
6149
|
-
getAccountMeta(accounts.observationState),
|
|
6150
|
-
getAccountMeta(accounts.tokenProgram),
|
|
6151
|
-
getAccountMeta(accounts.tickArray)
|
|
6152
|
-
],
|
|
6153
|
-
data: getSwapInstructionDataEncoder().encode(
|
|
6154
|
-
args
|
|
6155
|
-
),
|
|
6156
|
-
programAddress
|
|
6157
|
-
});
|
|
6158
|
-
}
|
|
6159
|
-
function parseSwapInstruction(instruction) {
|
|
6160
|
-
if (instruction.accounts.length < 10) {
|
|
6161
|
-
throw new Error("Not enough accounts");
|
|
6162
|
-
}
|
|
6163
|
-
let accountIndex = 0;
|
|
6164
|
-
const getNextAccount = () => {
|
|
6165
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
6166
|
-
accountIndex += 1;
|
|
6167
|
-
return accountMeta;
|
|
6168
|
-
};
|
|
6169
|
-
return {
|
|
6170
|
-
programAddress: instruction.programAddress,
|
|
6171
|
-
accounts: {
|
|
6172
|
-
payer: getNextAccount(),
|
|
6173
|
-
ammConfig: getNextAccount(),
|
|
6174
|
-
poolState: getNextAccount(),
|
|
6175
|
-
inputTokenAccount: getNextAccount(),
|
|
6176
|
-
outputTokenAccount: getNextAccount(),
|
|
6177
|
-
inputVault: getNextAccount(),
|
|
6178
|
-
outputVault: getNextAccount(),
|
|
6179
|
-
observationState: getNextAccount(),
|
|
6180
|
-
tokenProgram: getNextAccount(),
|
|
6181
|
-
tickArray: getNextAccount()
|
|
6182
|
-
},
|
|
6183
|
-
data: getSwapInstructionDataDecoder().decode(instruction.data)
|
|
6184
|
-
};
|
|
6185
|
-
}
|
|
6186
|
-
|
|
6187
4936
|
// src/generated/instructions/swapRouterBaseIn.ts
|
|
6188
4937
|
import {
|
|
6189
|
-
combineCodec as
|
|
6190
|
-
fixDecoderSize as
|
|
6191
|
-
fixEncoderSize as
|
|
6192
|
-
getBytesDecoder as
|
|
6193
|
-
getBytesEncoder as
|
|
6194
|
-
getStructDecoder as
|
|
6195
|
-
getStructEncoder as
|
|
6196
|
-
getU64Decoder as
|
|
6197
|
-
getU64Encoder as
|
|
6198
|
-
transformEncoder as
|
|
4938
|
+
combineCodec as combineCodec39,
|
|
4939
|
+
fixDecoderSize as fixDecoderSize24,
|
|
4940
|
+
fixEncoderSize as fixEncoderSize25,
|
|
4941
|
+
getBytesDecoder as getBytesDecoder24,
|
|
4942
|
+
getBytesEncoder as getBytesEncoder25,
|
|
4943
|
+
getStructDecoder as getStructDecoder39,
|
|
4944
|
+
getStructEncoder as getStructEncoder39,
|
|
4945
|
+
getU64Decoder as getU64Decoder27,
|
|
4946
|
+
getU64Encoder as getU64Encoder27,
|
|
4947
|
+
transformEncoder as transformEncoder24
|
|
6199
4948
|
} from "@solana/kit";
|
|
6200
4949
|
var SWAP_ROUTER_BASE_IN_DISCRIMINATOR = new Uint8Array([
|
|
6201
4950
|
69,
|
|
@@ -6208,29 +4957,29 @@ var SWAP_ROUTER_BASE_IN_DISCRIMINATOR = new Uint8Array([
|
|
|
6208
4957
|
196
|
|
6209
4958
|
]);
|
|
6210
4959
|
function getSwapRouterBaseInDiscriminatorBytes() {
|
|
6211
|
-
return
|
|
4960
|
+
return fixEncoderSize25(getBytesEncoder25(), 8).encode(
|
|
6212
4961
|
SWAP_ROUTER_BASE_IN_DISCRIMINATOR
|
|
6213
4962
|
);
|
|
6214
4963
|
}
|
|
6215
4964
|
function getSwapRouterBaseInInstructionDataEncoder() {
|
|
6216
|
-
return
|
|
6217
|
-
|
|
6218
|
-
["discriminator",
|
|
6219
|
-
["amountIn",
|
|
6220
|
-
["amountOutMinimum",
|
|
4965
|
+
return transformEncoder24(
|
|
4966
|
+
getStructEncoder39([
|
|
4967
|
+
["discriminator", fixEncoderSize25(getBytesEncoder25(), 8)],
|
|
4968
|
+
["amountIn", getU64Encoder27()],
|
|
4969
|
+
["amountOutMinimum", getU64Encoder27()]
|
|
6221
4970
|
]),
|
|
6222
4971
|
(value) => ({ ...value, discriminator: SWAP_ROUTER_BASE_IN_DISCRIMINATOR })
|
|
6223
4972
|
);
|
|
6224
4973
|
}
|
|
6225
4974
|
function getSwapRouterBaseInInstructionDataDecoder() {
|
|
6226
|
-
return
|
|
6227
|
-
["discriminator",
|
|
6228
|
-
["amountIn",
|
|
6229
|
-
["amountOutMinimum",
|
|
4975
|
+
return getStructDecoder39([
|
|
4976
|
+
["discriminator", fixDecoderSize24(getBytesDecoder24(), 8)],
|
|
4977
|
+
["amountIn", getU64Decoder27()],
|
|
4978
|
+
["amountOutMinimum", getU64Decoder27()]
|
|
6230
4979
|
]);
|
|
6231
4980
|
}
|
|
6232
4981
|
function getSwapRouterBaseInInstructionDataCodec() {
|
|
6233
|
-
return
|
|
4982
|
+
return combineCodec39(
|
|
6234
4983
|
getSwapRouterBaseInInstructionDataEncoder(),
|
|
6235
4984
|
getSwapRouterBaseInInstructionDataDecoder()
|
|
6236
4985
|
);
|
|
@@ -6304,20 +5053,20 @@ function parseSwapRouterBaseInInstruction(instruction) {
|
|
|
6304
5053
|
|
|
6305
5054
|
// src/generated/instructions/swapV2.ts
|
|
6306
5055
|
import {
|
|
6307
|
-
combineCodec as
|
|
6308
|
-
fixDecoderSize as
|
|
6309
|
-
fixEncoderSize as
|
|
6310
|
-
getBooleanDecoder as
|
|
6311
|
-
getBooleanEncoder as
|
|
6312
|
-
getBytesDecoder as
|
|
6313
|
-
getBytesEncoder as
|
|
6314
|
-
getStructDecoder as
|
|
6315
|
-
getStructEncoder as
|
|
6316
|
-
getU128Decoder as
|
|
6317
|
-
getU128Encoder as
|
|
6318
|
-
getU64Decoder as
|
|
6319
|
-
getU64Encoder as
|
|
6320
|
-
transformEncoder as
|
|
5056
|
+
combineCodec as combineCodec40,
|
|
5057
|
+
fixDecoderSize as fixDecoderSize25,
|
|
5058
|
+
fixEncoderSize as fixEncoderSize26,
|
|
5059
|
+
getBooleanDecoder as getBooleanDecoder5,
|
|
5060
|
+
getBooleanEncoder as getBooleanEncoder5,
|
|
5061
|
+
getBytesDecoder as getBytesDecoder25,
|
|
5062
|
+
getBytesEncoder as getBytesEncoder26,
|
|
5063
|
+
getStructDecoder as getStructDecoder40,
|
|
5064
|
+
getStructEncoder as getStructEncoder40,
|
|
5065
|
+
getU128Decoder as getU128Decoder21,
|
|
5066
|
+
getU128Encoder as getU128Encoder21,
|
|
5067
|
+
getU64Decoder as getU64Decoder28,
|
|
5068
|
+
getU64Encoder as getU64Encoder28,
|
|
5069
|
+
transformEncoder as transformEncoder25
|
|
6321
5070
|
} from "@solana/kit";
|
|
6322
5071
|
var SWAP_V2_DISCRIMINATOR = new Uint8Array([
|
|
6323
5072
|
43,
|
|
@@ -6330,31 +5079,31 @@ var SWAP_V2_DISCRIMINATOR = new Uint8Array([
|
|
|
6330
5079
|
98
|
|
6331
5080
|
]);
|
|
6332
5081
|
function getSwapV2DiscriminatorBytes() {
|
|
6333
|
-
return
|
|
5082
|
+
return fixEncoderSize26(getBytesEncoder26(), 8).encode(SWAP_V2_DISCRIMINATOR);
|
|
6334
5083
|
}
|
|
6335
5084
|
function getSwapV2InstructionDataEncoder() {
|
|
6336
|
-
return
|
|
6337
|
-
|
|
6338
|
-
["discriminator",
|
|
6339
|
-
["amount",
|
|
6340
|
-
["otherAmountThreshold",
|
|
6341
|
-
["sqrtPriceLimitX64",
|
|
6342
|
-
["isBaseInput",
|
|
5085
|
+
return transformEncoder25(
|
|
5086
|
+
getStructEncoder40([
|
|
5087
|
+
["discriminator", fixEncoderSize26(getBytesEncoder26(), 8)],
|
|
5088
|
+
["amount", getU64Encoder28()],
|
|
5089
|
+
["otherAmountThreshold", getU64Encoder28()],
|
|
5090
|
+
["sqrtPriceLimitX64", getU128Encoder21()],
|
|
5091
|
+
["isBaseInput", getBooleanEncoder5()]
|
|
6343
5092
|
]),
|
|
6344
5093
|
(value) => ({ ...value, discriminator: SWAP_V2_DISCRIMINATOR })
|
|
6345
5094
|
);
|
|
6346
5095
|
}
|
|
6347
5096
|
function getSwapV2InstructionDataDecoder() {
|
|
6348
|
-
return
|
|
6349
|
-
["discriminator",
|
|
6350
|
-
["amount",
|
|
6351
|
-
["otherAmountThreshold",
|
|
6352
|
-
["sqrtPriceLimitX64",
|
|
6353
|
-
["isBaseInput",
|
|
5097
|
+
return getStructDecoder40([
|
|
5098
|
+
["discriminator", fixDecoderSize25(getBytesDecoder25(), 8)],
|
|
5099
|
+
["amount", getU64Decoder28()],
|
|
5100
|
+
["otherAmountThreshold", getU64Decoder28()],
|
|
5101
|
+
["sqrtPriceLimitX64", getU128Decoder21()],
|
|
5102
|
+
["isBaseInput", getBooleanDecoder5()]
|
|
6354
5103
|
]);
|
|
6355
5104
|
}
|
|
6356
5105
|
function getSwapV2InstructionDataCodec() {
|
|
6357
|
-
return
|
|
5106
|
+
return combineCodec40(
|
|
6358
5107
|
getSwapV2InstructionDataEncoder(),
|
|
6359
5108
|
getSwapV2InstructionDataDecoder()
|
|
6360
5109
|
);
|
|
@@ -6458,16 +5207,16 @@ function parseSwapV2Instruction(instruction) {
|
|
|
6458
5207
|
|
|
6459
5208
|
// src/generated/instructions/transferRewardOwner.ts
|
|
6460
5209
|
import {
|
|
6461
|
-
combineCodec as
|
|
6462
|
-
fixDecoderSize as
|
|
6463
|
-
fixEncoderSize as
|
|
5210
|
+
combineCodec as combineCodec41,
|
|
5211
|
+
fixDecoderSize as fixDecoderSize26,
|
|
5212
|
+
fixEncoderSize as fixEncoderSize27,
|
|
6464
5213
|
getAddressDecoder as getAddressDecoder20,
|
|
6465
|
-
getAddressEncoder as
|
|
6466
|
-
getBytesDecoder as
|
|
6467
|
-
getBytesEncoder as
|
|
6468
|
-
getStructDecoder as
|
|
6469
|
-
getStructEncoder as
|
|
6470
|
-
transformEncoder as
|
|
5214
|
+
getAddressEncoder as getAddressEncoder25,
|
|
5215
|
+
getBytesDecoder as getBytesDecoder26,
|
|
5216
|
+
getBytesEncoder as getBytesEncoder27,
|
|
5217
|
+
getStructDecoder as getStructDecoder41,
|
|
5218
|
+
getStructEncoder as getStructEncoder41,
|
|
5219
|
+
transformEncoder as transformEncoder26
|
|
6471
5220
|
} from "@solana/kit";
|
|
6472
5221
|
var TRANSFER_REWARD_OWNER_DISCRIMINATOR = new Uint8Array([
|
|
6473
5222
|
7,
|
|
@@ -6480,15 +5229,15 @@ var TRANSFER_REWARD_OWNER_DISCRIMINATOR = new Uint8Array([
|
|
|
6480
5229
|
121
|
|
6481
5230
|
]);
|
|
6482
5231
|
function getTransferRewardOwnerDiscriminatorBytes() {
|
|
6483
|
-
return
|
|
5232
|
+
return fixEncoderSize27(getBytesEncoder27(), 8).encode(
|
|
6484
5233
|
TRANSFER_REWARD_OWNER_DISCRIMINATOR
|
|
6485
5234
|
);
|
|
6486
5235
|
}
|
|
6487
5236
|
function getTransferRewardOwnerInstructionDataEncoder() {
|
|
6488
|
-
return
|
|
6489
|
-
|
|
6490
|
-
["discriminator",
|
|
6491
|
-
["newOwner",
|
|
5237
|
+
return transformEncoder26(
|
|
5238
|
+
getStructEncoder41([
|
|
5239
|
+
["discriminator", fixEncoderSize27(getBytesEncoder27(), 8)],
|
|
5240
|
+
["newOwner", getAddressEncoder25()]
|
|
6492
5241
|
]),
|
|
6493
5242
|
(value) => ({
|
|
6494
5243
|
...value,
|
|
@@ -6497,13 +5246,13 @@ function getTransferRewardOwnerInstructionDataEncoder() {
|
|
|
6497
5246
|
);
|
|
6498
5247
|
}
|
|
6499
5248
|
function getTransferRewardOwnerInstructionDataDecoder() {
|
|
6500
|
-
return
|
|
6501
|
-
["discriminator",
|
|
5249
|
+
return getStructDecoder41([
|
|
5250
|
+
["discriminator", fixDecoderSize26(getBytesDecoder26(), 8)],
|
|
6502
5251
|
["newOwner", getAddressDecoder20()]
|
|
6503
5252
|
]);
|
|
6504
5253
|
}
|
|
6505
5254
|
function getTransferRewardOwnerInstructionDataCodec() {
|
|
6506
|
-
return
|
|
5255
|
+
return combineCodec41(
|
|
6507
5256
|
getTransferRewardOwnerInstructionDataEncoder(),
|
|
6508
5257
|
getTransferRewardOwnerInstructionDataDecoder()
|
|
6509
5258
|
);
|
|
@@ -6517,7 +5266,7 @@ function getTransferRewardOwnerInstruction(input, config) {
|
|
|
6517
5266
|
const accounts = originalAccounts;
|
|
6518
5267
|
const args = { ...input };
|
|
6519
5268
|
if (!accounts.authority.value) {
|
|
6520
|
-
accounts.authority.value = "
|
|
5269
|
+
accounts.authority.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
6521
5270
|
}
|
|
6522
5271
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
6523
5272
|
return Object.freeze({
|
|
@@ -6552,18 +5301,18 @@ function parseTransferRewardOwnerInstruction(instruction) {
|
|
|
6552
5301
|
|
|
6553
5302
|
// src/generated/instructions/updateAmmConfig.ts
|
|
6554
5303
|
import {
|
|
6555
|
-
combineCodec as
|
|
6556
|
-
fixDecoderSize as
|
|
6557
|
-
fixEncoderSize as
|
|
6558
|
-
getBytesDecoder as
|
|
6559
|
-
getBytesEncoder as
|
|
6560
|
-
getStructDecoder as
|
|
6561
|
-
getStructEncoder as
|
|
5304
|
+
combineCodec as combineCodec42,
|
|
5305
|
+
fixDecoderSize as fixDecoderSize27,
|
|
5306
|
+
fixEncoderSize as fixEncoderSize28,
|
|
5307
|
+
getBytesDecoder as getBytesDecoder27,
|
|
5308
|
+
getBytesEncoder as getBytesEncoder28,
|
|
5309
|
+
getStructDecoder as getStructDecoder42,
|
|
5310
|
+
getStructEncoder as getStructEncoder42,
|
|
6562
5311
|
getU32Decoder as getU32Decoder6,
|
|
6563
5312
|
getU32Encoder as getU32Encoder6,
|
|
6564
5313
|
getU8Decoder as getU8Decoder10,
|
|
6565
5314
|
getU8Encoder as getU8Encoder10,
|
|
6566
|
-
transformEncoder as
|
|
5315
|
+
transformEncoder as transformEncoder27
|
|
6567
5316
|
} from "@solana/kit";
|
|
6568
5317
|
var UPDATE_AMM_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
6569
5318
|
49,
|
|
@@ -6576,14 +5325,14 @@ var UPDATE_AMM_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
|
6576
5325
|
200
|
|
6577
5326
|
]);
|
|
6578
5327
|
function getUpdateAmmConfigDiscriminatorBytes() {
|
|
6579
|
-
return
|
|
5328
|
+
return fixEncoderSize28(getBytesEncoder28(), 8).encode(
|
|
6580
5329
|
UPDATE_AMM_CONFIG_DISCRIMINATOR
|
|
6581
5330
|
);
|
|
6582
5331
|
}
|
|
6583
5332
|
function getUpdateAmmConfigInstructionDataEncoder() {
|
|
6584
|
-
return
|
|
6585
|
-
|
|
6586
|
-
["discriminator",
|
|
5333
|
+
return transformEncoder27(
|
|
5334
|
+
getStructEncoder42([
|
|
5335
|
+
["discriminator", fixEncoderSize28(getBytesEncoder28(), 8)],
|
|
6587
5336
|
["param", getU8Encoder10()],
|
|
6588
5337
|
["value", getU32Encoder6()]
|
|
6589
5338
|
]),
|
|
@@ -6591,14 +5340,14 @@ function getUpdateAmmConfigInstructionDataEncoder() {
|
|
|
6591
5340
|
);
|
|
6592
5341
|
}
|
|
6593
5342
|
function getUpdateAmmConfigInstructionDataDecoder() {
|
|
6594
|
-
return
|
|
6595
|
-
["discriminator",
|
|
5343
|
+
return getStructDecoder42([
|
|
5344
|
+
["discriminator", fixDecoderSize27(getBytesDecoder27(), 8)],
|
|
6596
5345
|
["param", getU8Decoder10()],
|
|
6597
5346
|
["value", getU32Decoder6()]
|
|
6598
5347
|
]);
|
|
6599
5348
|
}
|
|
6600
5349
|
function getUpdateAmmConfigInstructionDataCodec() {
|
|
6601
|
-
return
|
|
5350
|
+
return combineCodec42(
|
|
6602
5351
|
getUpdateAmmConfigInstructionDataEncoder(),
|
|
6603
5352
|
getUpdateAmmConfigInstructionDataDecoder()
|
|
6604
5353
|
);
|
|
@@ -6612,7 +5361,7 @@ function getUpdateAmmConfigInstruction(input, config) {
|
|
|
6612
5361
|
const accounts = originalAccounts;
|
|
6613
5362
|
const args = { ...input };
|
|
6614
5363
|
if (!accounts.owner.value) {
|
|
6615
|
-
accounts.owner.value = "
|
|
5364
|
+
accounts.owner.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
6616
5365
|
}
|
|
6617
5366
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
6618
5367
|
return Object.freeze({
|
|
@@ -6645,21 +5394,21 @@ function parseUpdateAmmConfigInstruction(instruction) {
|
|
|
6645
5394
|
|
|
6646
5395
|
// src/generated/instructions/updateOperationAccount.ts
|
|
6647
5396
|
import {
|
|
6648
|
-
combineCodec as
|
|
6649
|
-
fixDecoderSize as
|
|
6650
|
-
fixEncoderSize as
|
|
5397
|
+
combineCodec as combineCodec43,
|
|
5398
|
+
fixDecoderSize as fixDecoderSize28,
|
|
5399
|
+
fixEncoderSize as fixEncoderSize29,
|
|
6651
5400
|
getAddressDecoder as getAddressDecoder21,
|
|
6652
|
-
getAddressEncoder as
|
|
5401
|
+
getAddressEncoder as getAddressEncoder26,
|
|
6653
5402
|
getArrayDecoder as getArrayDecoder14,
|
|
6654
5403
|
getArrayEncoder as getArrayEncoder14,
|
|
6655
|
-
getBytesDecoder as
|
|
6656
|
-
getBytesEncoder as
|
|
6657
|
-
getProgramDerivedAddress as
|
|
6658
|
-
getStructDecoder as
|
|
6659
|
-
getStructEncoder as
|
|
5404
|
+
getBytesDecoder as getBytesDecoder28,
|
|
5405
|
+
getBytesEncoder as getBytesEncoder29,
|
|
5406
|
+
getProgramDerivedAddress as getProgramDerivedAddress9,
|
|
5407
|
+
getStructDecoder as getStructDecoder43,
|
|
5408
|
+
getStructEncoder as getStructEncoder43,
|
|
6660
5409
|
getU8Decoder as getU8Decoder11,
|
|
6661
5410
|
getU8Encoder as getU8Encoder11,
|
|
6662
|
-
transformEncoder as
|
|
5411
|
+
transformEncoder as transformEncoder28
|
|
6663
5412
|
} from "@solana/kit";
|
|
6664
5413
|
var UPDATE_OPERATION_ACCOUNT_DISCRIMINATOR = new Uint8Array([
|
|
6665
5414
|
127,
|
|
@@ -6672,16 +5421,16 @@ var UPDATE_OPERATION_ACCOUNT_DISCRIMINATOR = new Uint8Array([
|
|
|
6672
5421
|
7
|
|
6673
5422
|
]);
|
|
6674
5423
|
function getUpdateOperationAccountDiscriminatorBytes() {
|
|
6675
|
-
return
|
|
5424
|
+
return fixEncoderSize29(getBytesEncoder29(), 8).encode(
|
|
6676
5425
|
UPDATE_OPERATION_ACCOUNT_DISCRIMINATOR
|
|
6677
5426
|
);
|
|
6678
5427
|
}
|
|
6679
5428
|
function getUpdateOperationAccountInstructionDataEncoder() {
|
|
6680
|
-
return
|
|
6681
|
-
|
|
6682
|
-
["discriminator",
|
|
5429
|
+
return transformEncoder28(
|
|
5430
|
+
getStructEncoder43([
|
|
5431
|
+
["discriminator", fixEncoderSize29(getBytesEncoder29(), 8)],
|
|
6683
5432
|
["param", getU8Encoder11()],
|
|
6684
|
-
["keys", getArrayEncoder14(
|
|
5433
|
+
["keys", getArrayEncoder14(getAddressEncoder26())]
|
|
6685
5434
|
]),
|
|
6686
5435
|
(value) => ({
|
|
6687
5436
|
...value,
|
|
@@ -6690,14 +5439,14 @@ function getUpdateOperationAccountInstructionDataEncoder() {
|
|
|
6690
5439
|
);
|
|
6691
5440
|
}
|
|
6692
5441
|
function getUpdateOperationAccountInstructionDataDecoder() {
|
|
6693
|
-
return
|
|
6694
|
-
["discriminator",
|
|
5442
|
+
return getStructDecoder43([
|
|
5443
|
+
["discriminator", fixDecoderSize28(getBytesDecoder28(), 8)],
|
|
6695
5444
|
["param", getU8Decoder11()],
|
|
6696
5445
|
["keys", getArrayDecoder14(getAddressDecoder21())]
|
|
6697
5446
|
]);
|
|
6698
5447
|
}
|
|
6699
5448
|
function getUpdateOperationAccountInstructionDataCodec() {
|
|
6700
|
-
return
|
|
5449
|
+
return combineCodec43(
|
|
6701
5450
|
getUpdateOperationAccountInstructionDataEncoder(),
|
|
6702
5451
|
getUpdateOperationAccountInstructionDataDecoder()
|
|
6703
5452
|
);
|
|
@@ -6712,13 +5461,13 @@ async function getUpdateOperationAccountInstructionAsync(input, config) {
|
|
|
6712
5461
|
const accounts = originalAccounts;
|
|
6713
5462
|
const args = { ...input };
|
|
6714
5463
|
if (!accounts.owner.value) {
|
|
6715
|
-
accounts.owner.value = "
|
|
5464
|
+
accounts.owner.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
6716
5465
|
}
|
|
6717
5466
|
if (!accounts.operationState.value) {
|
|
6718
|
-
accounts.operationState.value = await
|
|
5467
|
+
accounts.operationState.value = await getProgramDerivedAddress9({
|
|
6719
5468
|
programAddress,
|
|
6720
5469
|
seeds: [
|
|
6721
|
-
|
|
5470
|
+
getBytesEncoder29().encode(
|
|
6722
5471
|
new Uint8Array([111, 112, 101, 114, 97, 116, 105, 111, 110])
|
|
6723
5472
|
)
|
|
6724
5473
|
]
|
|
@@ -6750,7 +5499,7 @@ function getUpdateOperationAccountInstruction(input, config) {
|
|
|
6750
5499
|
const accounts = originalAccounts;
|
|
6751
5500
|
const args = { ...input };
|
|
6752
5501
|
if (!accounts.owner.value) {
|
|
6753
|
-
accounts.owner.value = "
|
|
5502
|
+
accounts.owner.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
6754
5503
|
}
|
|
6755
5504
|
if (!accounts.systemProgram.value) {
|
|
6756
5505
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
@@ -6793,16 +5542,16 @@ function parseUpdateOperationAccountInstruction(instruction) {
|
|
|
6793
5542
|
|
|
6794
5543
|
// src/generated/instructions/updatePoolStatus.ts
|
|
6795
5544
|
import {
|
|
6796
|
-
combineCodec as
|
|
6797
|
-
fixDecoderSize as
|
|
6798
|
-
fixEncoderSize as
|
|
6799
|
-
getBytesDecoder as
|
|
6800
|
-
getBytesEncoder as
|
|
6801
|
-
getStructDecoder as
|
|
6802
|
-
getStructEncoder as
|
|
5545
|
+
combineCodec as combineCodec44,
|
|
5546
|
+
fixDecoderSize as fixDecoderSize29,
|
|
5547
|
+
fixEncoderSize as fixEncoderSize30,
|
|
5548
|
+
getBytesDecoder as getBytesDecoder29,
|
|
5549
|
+
getBytesEncoder as getBytesEncoder30,
|
|
5550
|
+
getStructDecoder as getStructDecoder44,
|
|
5551
|
+
getStructEncoder as getStructEncoder44,
|
|
6803
5552
|
getU8Decoder as getU8Decoder12,
|
|
6804
5553
|
getU8Encoder as getU8Encoder12,
|
|
6805
|
-
transformEncoder as
|
|
5554
|
+
transformEncoder as transformEncoder29
|
|
6806
5555
|
} from "@solana/kit";
|
|
6807
5556
|
var UPDATE_POOL_STATUS_DISCRIMINATOR = new Uint8Array([
|
|
6808
5557
|
130,
|
|
@@ -6815,27 +5564,27 @@ var UPDATE_POOL_STATUS_DISCRIMINATOR = new Uint8Array([
|
|
|
6815
5564
|
123
|
|
6816
5565
|
]);
|
|
6817
5566
|
function getUpdatePoolStatusDiscriminatorBytes() {
|
|
6818
|
-
return
|
|
5567
|
+
return fixEncoderSize30(getBytesEncoder30(), 8).encode(
|
|
6819
5568
|
UPDATE_POOL_STATUS_DISCRIMINATOR
|
|
6820
5569
|
);
|
|
6821
5570
|
}
|
|
6822
5571
|
function getUpdatePoolStatusInstructionDataEncoder() {
|
|
6823
|
-
return
|
|
6824
|
-
|
|
6825
|
-
["discriminator",
|
|
5572
|
+
return transformEncoder29(
|
|
5573
|
+
getStructEncoder44([
|
|
5574
|
+
["discriminator", fixEncoderSize30(getBytesEncoder30(), 8)],
|
|
6826
5575
|
["status", getU8Encoder12()]
|
|
6827
5576
|
]),
|
|
6828
5577
|
(value) => ({ ...value, discriminator: UPDATE_POOL_STATUS_DISCRIMINATOR })
|
|
6829
5578
|
);
|
|
6830
5579
|
}
|
|
6831
5580
|
function getUpdatePoolStatusInstructionDataDecoder() {
|
|
6832
|
-
return
|
|
6833
|
-
["discriminator",
|
|
5581
|
+
return getStructDecoder44([
|
|
5582
|
+
["discriminator", fixDecoderSize29(getBytesDecoder29(), 8)],
|
|
6834
5583
|
["status", getU8Decoder12()]
|
|
6835
5584
|
]);
|
|
6836
5585
|
}
|
|
6837
5586
|
function getUpdatePoolStatusInstructionDataCodec() {
|
|
6838
|
-
return
|
|
5587
|
+
return combineCodec44(
|
|
6839
5588
|
getUpdatePoolStatusInstructionDataEncoder(),
|
|
6840
5589
|
getUpdatePoolStatusInstructionDataDecoder()
|
|
6841
5590
|
);
|
|
@@ -6849,7 +5598,7 @@ function getUpdatePoolStatusInstruction(input, config) {
|
|
|
6849
5598
|
const accounts = originalAccounts;
|
|
6850
5599
|
const args = { ...input };
|
|
6851
5600
|
if (!accounts.authority.value) {
|
|
6852
|
-
accounts.authority.value = "
|
|
5601
|
+
accounts.authority.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
6853
5602
|
}
|
|
6854
5603
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
6855
5604
|
return Object.freeze({
|
|
@@ -6882,14 +5631,14 @@ function parseUpdatePoolStatusInstruction(instruction) {
|
|
|
6882
5631
|
|
|
6883
5632
|
// src/generated/instructions/updateRewardInfos.ts
|
|
6884
5633
|
import {
|
|
6885
|
-
combineCodec as
|
|
6886
|
-
fixDecoderSize as
|
|
6887
|
-
fixEncoderSize as
|
|
6888
|
-
getBytesDecoder as
|
|
6889
|
-
getBytesEncoder as
|
|
6890
|
-
getStructDecoder as
|
|
6891
|
-
getStructEncoder as
|
|
6892
|
-
transformEncoder as
|
|
5634
|
+
combineCodec as combineCodec45,
|
|
5635
|
+
fixDecoderSize as fixDecoderSize30,
|
|
5636
|
+
fixEncoderSize as fixEncoderSize31,
|
|
5637
|
+
getBytesDecoder as getBytesDecoder30,
|
|
5638
|
+
getBytesEncoder as getBytesEncoder31,
|
|
5639
|
+
getStructDecoder as getStructDecoder45,
|
|
5640
|
+
getStructEncoder as getStructEncoder45,
|
|
5641
|
+
transformEncoder as transformEncoder30
|
|
6893
5642
|
} from "@solana/kit";
|
|
6894
5643
|
var UPDATE_REWARD_INFOS_DISCRIMINATOR = new Uint8Array([
|
|
6895
5644
|
163,
|
|
@@ -6902,23 +5651,23 @@ var UPDATE_REWARD_INFOS_DISCRIMINATOR = new Uint8Array([
|
|
|
6902
5651
|
223
|
|
6903
5652
|
]);
|
|
6904
5653
|
function getUpdateRewardInfosDiscriminatorBytes() {
|
|
6905
|
-
return
|
|
5654
|
+
return fixEncoderSize31(getBytesEncoder31(), 8).encode(
|
|
6906
5655
|
UPDATE_REWARD_INFOS_DISCRIMINATOR
|
|
6907
5656
|
);
|
|
6908
5657
|
}
|
|
6909
5658
|
function getUpdateRewardInfosInstructionDataEncoder() {
|
|
6910
|
-
return
|
|
6911
|
-
|
|
5659
|
+
return transformEncoder30(
|
|
5660
|
+
getStructEncoder45([["discriminator", fixEncoderSize31(getBytesEncoder31(), 8)]]),
|
|
6912
5661
|
(value) => ({ ...value, discriminator: UPDATE_REWARD_INFOS_DISCRIMINATOR })
|
|
6913
5662
|
);
|
|
6914
5663
|
}
|
|
6915
5664
|
function getUpdateRewardInfosInstructionDataDecoder() {
|
|
6916
|
-
return
|
|
6917
|
-
["discriminator",
|
|
5665
|
+
return getStructDecoder45([
|
|
5666
|
+
["discriminator", fixDecoderSize30(getBytesDecoder30(), 8)]
|
|
6918
5667
|
]);
|
|
6919
5668
|
}
|
|
6920
5669
|
function getUpdateRewardInfosInstructionDataCodec() {
|
|
6921
|
-
return
|
|
5670
|
+
return combineCodec45(
|
|
6922
5671
|
getUpdateRewardInfosInstructionDataEncoder(),
|
|
6923
5672
|
getUpdateRewardInfosInstructionDataDecoder()
|
|
6924
5673
|
);
|
|
@@ -7526,15 +6275,15 @@ var LiquidityMath = class _LiquidityMath {
|
|
|
7526
6275
|
|
|
7527
6276
|
// src/utils/pda.ts
|
|
7528
6277
|
import {
|
|
7529
|
-
getProgramDerivedAddress as
|
|
7530
|
-
getAddressEncoder as
|
|
6278
|
+
getProgramDerivedAddress as getProgramDerivedAddress10,
|
|
6279
|
+
getAddressEncoder as getAddressEncoder27,
|
|
7531
6280
|
getU16Encoder as getU16Encoder7,
|
|
7532
6281
|
address,
|
|
7533
|
-
getI32Encoder as
|
|
6282
|
+
getI32Encoder as getI32Encoder12,
|
|
7534
6283
|
Endian
|
|
7535
6284
|
} from "@solana/kit";
|
|
7536
|
-
var addressEncoder =
|
|
7537
|
-
var i32Encoder =
|
|
6285
|
+
var addressEncoder = getAddressEncoder27();
|
|
6286
|
+
var i32Encoder = getI32Encoder12({ endian: Endian.Big });
|
|
7538
6287
|
var PdaUtils = class {
|
|
7539
6288
|
/**
|
|
7540
6289
|
* Derive pool state PDA
|
|
@@ -7544,7 +6293,7 @@ var PdaUtils = class {
|
|
|
7544
6293
|
* @returns Pool state PDA
|
|
7545
6294
|
*/
|
|
7546
6295
|
static async getPoolStatePda(ammConfig, tokenMintA, tokenMintB) {
|
|
7547
|
-
return await
|
|
6296
|
+
return await getProgramDerivedAddress10({
|
|
7548
6297
|
programAddress: STABBLE_CLMM_PROGRAM_ID,
|
|
7549
6298
|
seeds: [
|
|
7550
6299
|
PDA_SEEDS.POOL_STATE,
|
|
@@ -7560,7 +6309,7 @@ var PdaUtils = class {
|
|
|
7560
6309
|
* @returns AMM config PDA
|
|
7561
6310
|
*/
|
|
7562
6311
|
static async getAmmConfigPda(index) {
|
|
7563
|
-
return await
|
|
6312
|
+
return await getProgramDerivedAddress10({
|
|
7564
6313
|
programAddress: STABBLE_CLMM_PROGRAM_ID,
|
|
7565
6314
|
seeds: [PDA_SEEDS.AMM_CONFIG, getU16Encoder7().encode(index)]
|
|
7566
6315
|
});
|
|
@@ -7571,7 +6320,7 @@ var PdaUtils = class {
|
|
|
7571
6320
|
* @returns Position state PDA
|
|
7572
6321
|
*/
|
|
7573
6322
|
static async getPositionStatePda(nftMint) {
|
|
7574
|
-
return await
|
|
6323
|
+
return await getProgramDerivedAddress10({
|
|
7575
6324
|
programAddress: STABBLE_CLMM_PROGRAM_ID,
|
|
7576
6325
|
seeds: [PDA_SEEDS.POSITION_STATE, addressEncoder.encode(nftMint)]
|
|
7577
6326
|
});
|
|
@@ -7583,7 +6332,7 @@ var PdaUtils = class {
|
|
|
7583
6332
|
* @returns Tick array state PDA
|
|
7584
6333
|
*/
|
|
7585
6334
|
static async getTickArrayStatePda(poolState, startTickIndex) {
|
|
7586
|
-
return await
|
|
6335
|
+
return await getProgramDerivedAddress10({
|
|
7587
6336
|
programAddress: STABBLE_CLMM_PROGRAM_ID,
|
|
7588
6337
|
seeds: [
|
|
7589
6338
|
PDA_SEEDS.TICK_ARRAY_STATE,
|
|
@@ -7598,13 +6347,13 @@ var PdaUtils = class {
|
|
|
7598
6347
|
* @returns Observation state PDA
|
|
7599
6348
|
*/
|
|
7600
6349
|
static async getObservationStatePda(poolState) {
|
|
7601
|
-
return await
|
|
6350
|
+
return await getProgramDerivedAddress10({
|
|
7602
6351
|
programAddress: STABBLE_CLMM_PROGRAM_ID,
|
|
7603
6352
|
seeds: [PDA_SEEDS.OBSERVATION_STATE, addressEncoder.encode(poolState)]
|
|
7604
6353
|
});
|
|
7605
6354
|
}
|
|
7606
6355
|
static async getPoolVaultIdPda(poolAddress, vaultAddress) {
|
|
7607
|
-
return await
|
|
6356
|
+
return await getProgramDerivedAddress10({
|
|
7608
6357
|
seeds: [
|
|
7609
6358
|
PDA_SEEDS.POOL_VAULT,
|
|
7610
6359
|
addressEncoder.encode(poolAddress),
|
|
@@ -7619,7 +6368,7 @@ var PdaUtils = class {
|
|
|
7619
6368
|
* @returns Tick array bitmap extension PDA
|
|
7620
6369
|
*/
|
|
7621
6370
|
static async getTickArrayBitmapExtensionPda(poolState) {
|
|
7622
|
-
return await
|
|
6371
|
+
return await getProgramDerivedAddress10({
|
|
7623
6372
|
programAddress: STABBLE_CLMM_PROGRAM_ID,
|
|
7624
6373
|
seeds: [PDA_SEEDS.BITMAP_EXTENSION, addressEncoder.encode(poolState)]
|
|
7625
6374
|
});
|
|
@@ -7671,7 +6420,7 @@ var PdaUtils = class {
|
|
|
7671
6420
|
* @returns Protocol position state PDA
|
|
7672
6421
|
*/
|
|
7673
6422
|
static async getProtocolPositionStatePda(poolState, tickLowerIndex, tickUpperIndex) {
|
|
7674
|
-
return await
|
|
6423
|
+
return await getProgramDerivedAddress10({
|
|
7675
6424
|
programAddress: STABBLE_CLMM_PROGRAM_ID,
|
|
7676
6425
|
seeds: [
|
|
7677
6426
|
PDA_SEEDS.POSITION_STATE,
|
|
@@ -7687,14 +6436,14 @@ var PdaUtils = class {
|
|
|
7687
6436
|
* @returns Operation state PDA
|
|
7688
6437
|
*/
|
|
7689
6438
|
static async getOperationStatePda(poolState) {
|
|
7690
|
-
return await
|
|
6439
|
+
return await getProgramDerivedAddress10({
|
|
7691
6440
|
programAddress: STABBLE_CLMM_PROGRAM_ID,
|
|
7692
6441
|
seeds: [PDA_SEEDS.OPERATION, addressEncoder.encode(poolState)]
|
|
7693
6442
|
});
|
|
7694
6443
|
}
|
|
7695
6444
|
};
|
|
7696
6445
|
async function getMetadataPda(mint) {
|
|
7697
|
-
return await
|
|
6446
|
+
return await getProgramDerivedAddress10({
|
|
7698
6447
|
seeds: [
|
|
7699
6448
|
"metadata",
|
|
7700
6449
|
addressEncoder.encode(address(METADATA_PROGRAM_ID)),
|
|
@@ -8759,10 +7508,10 @@ var PoolUtils = class {
|
|
|
8759
7508
|
|
|
8760
7509
|
// src/utils/index.ts
|
|
8761
7510
|
import {
|
|
8762
|
-
getAddressEncoder as
|
|
7511
|
+
getAddressEncoder as getAddressEncoder28
|
|
8763
7512
|
} from "@solana/kit";
|
|
8764
|
-
function validateAddress(
|
|
8765
|
-
if (!
|
|
7513
|
+
function validateAddress(address5, name = "address") {
|
|
7514
|
+
if (!address5 || address5.length === 0) {
|
|
8766
7515
|
throw new ClmmError(
|
|
8767
7516
|
"POOL_NOT_FOUND" /* POOL_NOT_FOUND */,
|
|
8768
7517
|
`Invalid ${name}: address cannot be empty`
|
|
@@ -8823,21 +7572,21 @@ function basisPointsToPercentage(basisPoints) {
|
|
|
8823
7572
|
function percentageToBasisPoints(percentage) {
|
|
8824
7573
|
return Math.round(percentage * 1e4);
|
|
8825
7574
|
}
|
|
8826
|
-
function isValidSolanaAddress(
|
|
7575
|
+
function isValidSolanaAddress(address5) {
|
|
8827
7576
|
try {
|
|
8828
|
-
const decoded = Buffer.from(
|
|
7577
|
+
const decoded = Buffer.from(address5, "base64");
|
|
8829
7578
|
return decoded.length === 32;
|
|
8830
7579
|
} catch {
|
|
8831
7580
|
return false;
|
|
8832
7581
|
}
|
|
8833
7582
|
}
|
|
8834
|
-
function addresstoBytes(
|
|
8835
|
-
const encoder =
|
|
8836
|
-
return encoder.encode(
|
|
7583
|
+
function addresstoBytes(address5) {
|
|
7584
|
+
const encoder = getAddressEncoder28();
|
|
7585
|
+
return encoder.encode(address5);
|
|
8837
7586
|
}
|
|
8838
|
-
function getFakeSigner(
|
|
7587
|
+
function getFakeSigner(address5) {
|
|
8839
7588
|
return {
|
|
8840
|
-
address:
|
|
7589
|
+
address: address5,
|
|
8841
7590
|
signAndSendTransactions: async (transactions, _config) => {
|
|
8842
7591
|
return transactions.map(
|
|
8843
7592
|
() => new Uint8Array(64).fill(0)
|
|
@@ -9195,18 +7944,51 @@ var PoolManager = class {
|
|
|
9195
7944
|
// src/position-manager.ts
|
|
9196
7945
|
import {
|
|
9197
7946
|
generateKeyPairSigner,
|
|
9198
|
-
AccountRole as AccountRole2
|
|
7947
|
+
AccountRole as AccountRole2,
|
|
7948
|
+
address as address4
|
|
9199
7949
|
} from "@solana/kit";
|
|
9200
7950
|
import {
|
|
7951
|
+
getCreateAssociatedTokenInstruction,
|
|
7952
|
+
getSyncNativeInstruction,
|
|
9201
7953
|
findAssociatedTokenPda,
|
|
9202
7954
|
TOKEN_PROGRAM_ADDRESS as TOKEN_PROGRAM_ADDRESS3
|
|
9203
7955
|
} from "@solana-program/token";
|
|
9204
7956
|
import { TOKEN_2022_PROGRAM_ADDRESS as TOKEN_2022_PROGRAM_ADDRESS2 } from "@solana-program/token-2022";
|
|
9205
7957
|
import BN6 from "bn.js";
|
|
7958
|
+
|
|
7959
|
+
// ../node_modules/@solana/spl-token/lib/esm/constants.js
|
|
7960
|
+
import { PublicKey } from "@solana/web3.js";
|
|
7961
|
+
var TOKEN_PROGRAM_ID = new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
|
|
7962
|
+
var TOKEN_2022_PROGRAM_ID = new PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");
|
|
7963
|
+
var ASSOCIATED_TOKEN_PROGRAM_ID = new PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");
|
|
7964
|
+
var NATIVE_MINT = new PublicKey("So11111111111111111111111111111111111111112");
|
|
7965
|
+
var NATIVE_MINT_2022 = new PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");
|
|
7966
|
+
|
|
7967
|
+
// src/position-manager.ts
|
|
7968
|
+
import { getTransferSolInstruction } from "@solana-program/system";
|
|
9206
7969
|
var PositionManager = class {
|
|
9207
7970
|
constructor(config) {
|
|
9208
7971
|
this.config = config;
|
|
9209
7972
|
}
|
|
7973
|
+
buildWrapSolInstructions(params) {
|
|
7974
|
+
const { payer, ata, owner, amount } = params;
|
|
7975
|
+
return [
|
|
7976
|
+
getCreateAssociatedTokenInstruction({
|
|
7977
|
+
payer,
|
|
7978
|
+
ata,
|
|
7979
|
+
owner,
|
|
7980
|
+
mint: address4(NATIVE_MINT.toString()),
|
|
7981
|
+
tokenProgram: TOKEN_PROGRAM_ADDRESS3,
|
|
7982
|
+
systemProgram: SYSTEM_PROGRAM_ID
|
|
7983
|
+
}),
|
|
7984
|
+
getTransferSolInstruction({
|
|
7985
|
+
source: payer,
|
|
7986
|
+
destination: ata,
|
|
7987
|
+
amount
|
|
7988
|
+
}),
|
|
7989
|
+
getSyncNativeInstruction({ account: ata })
|
|
7990
|
+
];
|
|
7991
|
+
}
|
|
9210
7992
|
/**
|
|
9211
7993
|
* Make open position from liquidity instructions
|
|
9212
7994
|
* Use this when you know the exact liquidity amount you want to provide
|
|
@@ -9357,6 +8139,26 @@ var PositionManager = class {
|
|
|
9357
8139
|
);
|
|
9358
8140
|
const extBitmapAccount = isOverflow ? await PdaUtils.getTickArrayBitmapExtensionPda(poolAccount.address) : void 0;
|
|
9359
8141
|
const remAccounts = extBitmapAccount ? [{ address: extBitmapAccount[0], role: AccountRole2.WRITABLE }] : [];
|
|
8142
|
+
const wrapSolInstructions = [];
|
|
8143
|
+
if (poolAccount.data.tokenMint0.toString() === NATIVE_MINT.toString()) {
|
|
8144
|
+
wrapSolInstructions.push(
|
|
8145
|
+
...this.buildWrapSolInstructions({
|
|
8146
|
+
payer: ownerInfo.wallet,
|
|
8147
|
+
ata: ownerInfo.tokenAccountA,
|
|
8148
|
+
owner: ownerInfo.wallet.address,
|
|
8149
|
+
amount: baseAmount
|
|
8150
|
+
})
|
|
8151
|
+
);
|
|
8152
|
+
} else if (poolAccount.data.tokenMint1.toString() === NATIVE_MINT.toString()) {
|
|
8153
|
+
wrapSolInstructions.push(
|
|
8154
|
+
...this.buildWrapSolInstructions({
|
|
8155
|
+
payer: ownerInfo.wallet,
|
|
8156
|
+
ata: ownerInfo.tokenAccountB,
|
|
8157
|
+
owner: ownerInfo.wallet.address,
|
|
8158
|
+
amount: baseAmount
|
|
8159
|
+
})
|
|
8160
|
+
);
|
|
8161
|
+
}
|
|
9360
8162
|
const instruction = await getOpenPositionWithToken22NftInstructionAsync({
|
|
9361
8163
|
payer: ownerInfo.wallet,
|
|
9362
8164
|
positionNftOwner: ownerInfo.wallet.address,
|
|
@@ -9388,7 +8190,7 @@ var PositionManager = class {
|
|
|
9388
8190
|
accounts: [...instruction.accounts, ...remAccounts]
|
|
9389
8191
|
};
|
|
9390
8192
|
return {
|
|
9391
|
-
instructions: [ixWithRemAccounts],
|
|
8193
|
+
instructions: [...wrapSolInstructions, ixWithRemAccounts],
|
|
9392
8194
|
signers,
|
|
9393
8195
|
instructionTypes: ["OpenPositionV2"],
|
|
9394
8196
|
address: {
|
|
@@ -9701,24 +8503,19 @@ var PositionManager = class {
|
|
|
9701
8503
|
};
|
|
9702
8504
|
}
|
|
9703
8505
|
/**
|
|
9704
|
-
* Get all positions for a wallet
|
|
8506
|
+
* Get all positions for a wallet
|
|
9705
8507
|
* @param wallet - Wallet address
|
|
9706
|
-
* @returns Array of
|
|
8508
|
+
* @returns Array of positions owned by the wallet
|
|
9707
8509
|
*/
|
|
9708
8510
|
async getPositionsForWallet(wallet) {
|
|
9709
8511
|
try {
|
|
9710
|
-
const response = await this.config.rpc.getTokenAccountsByOwner(
|
|
9711
|
-
wallet,
|
|
9712
|
-
{ programId: TOKEN_PROGRAM_ADDRESS3 },
|
|
9713
|
-
{ encoding: "jsonParsed" }
|
|
9714
|
-
).send();
|
|
9715
8512
|
const response22 = await this.config.rpc.getTokenAccountsByOwner(
|
|
9716
8513
|
wallet,
|
|
9717
8514
|
{ programId: TOKEN_2022_PROGRAM_ADDRESS2 },
|
|
9718
8515
|
{ encoding: "jsonParsed" }
|
|
9719
8516
|
).send();
|
|
9720
|
-
let
|
|
9721
|
-
const nftTokenAccounts =
|
|
8517
|
+
let tokenAccounts = [...response22.value];
|
|
8518
|
+
const nftTokenAccounts = tokenAccounts.filter((account) => {
|
|
9722
8519
|
const parsedInfo = account.account.data.parsed.info;
|
|
9723
8520
|
return parsedInfo.tokenAmount.amount == "1" && parsedInfo.tokenAmount.decimals == 0;
|
|
9724
8521
|
});
|
|
@@ -10064,13 +8861,8 @@ export {
|
|
|
10064
8861
|
getClosePositionInstruction,
|
|
10065
8862
|
getCreateAmmConfigInstruction,
|
|
10066
8863
|
getCreatePoolInstruction,
|
|
10067
|
-
getDecreaseLiquidityInstruction,
|
|
10068
8864
|
getFakeSigner,
|
|
10069
|
-
getIncreaseLiquidityInstruction,
|
|
10070
8865
|
getMetadataPda,
|
|
10071
|
-
getOpenPositionInstruction,
|
|
10072
|
-
getOpenPositionV2Instruction,
|
|
10073
|
-
getSwapInstruction,
|
|
10074
8866
|
getSwapV2Instruction,
|
|
10075
8867
|
isAmmV3Error,
|
|
10076
8868
|
isValidSolanaAddress,
|