@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.js
CHANGED
|
@@ -94,13 +94,8 @@ __export(index_exports, {
|
|
|
94
94
|
getClosePositionInstruction: () => getClosePositionInstruction,
|
|
95
95
|
getCreateAmmConfigInstruction: () => getCreateAmmConfigInstruction,
|
|
96
96
|
getCreatePoolInstruction: () => getCreatePoolInstruction,
|
|
97
|
-
getDecreaseLiquidityInstruction: () => getDecreaseLiquidityInstruction,
|
|
98
97
|
getFakeSigner: () => getFakeSigner,
|
|
99
|
-
getIncreaseLiquidityInstruction: () => getIncreaseLiquidityInstruction,
|
|
100
98
|
getMetadataPda: () => getMetadataPda,
|
|
101
|
-
getOpenPositionInstruction: () => getOpenPositionInstruction,
|
|
102
|
-
getOpenPositionV2Instruction: () => getOpenPositionV2Instruction,
|
|
103
|
-
getSwapInstruction: () => getSwapInstruction,
|
|
104
99
|
getSwapV2Instruction: () => getSwapV2Instruction,
|
|
105
100
|
isAmmV3Error: () => isAmmV3Error,
|
|
106
101
|
isValidSolanaAddress: () => isValidSolanaAddress,
|
|
@@ -173,14 +168,10 @@ __export(generated_exports, {
|
|
|
173
168
|
CREATE_OPERATION_ACCOUNT_DISCRIMINATOR: () => CREATE_OPERATION_ACCOUNT_DISCRIMINATOR,
|
|
174
169
|
CREATE_POOL_DISCRIMINATOR: () => CREATE_POOL_DISCRIMINATOR,
|
|
175
170
|
CREATE_SUPPORT_MINT_ASSOCIATED_DISCRIMINATOR: () => CREATE_SUPPORT_MINT_ASSOCIATED_DISCRIMINATOR,
|
|
176
|
-
DECREASE_LIQUIDITY_DISCRIMINATOR: () => DECREASE_LIQUIDITY_DISCRIMINATOR,
|
|
177
171
|
DECREASE_LIQUIDITY_V2_DISCRIMINATOR: () => DECREASE_LIQUIDITY_V2_DISCRIMINATOR,
|
|
178
|
-
INCREASE_LIQUIDITY_DISCRIMINATOR: () => INCREASE_LIQUIDITY_DISCRIMINATOR,
|
|
179
172
|
INCREASE_LIQUIDITY_V2_DISCRIMINATOR: () => INCREASE_LIQUIDITY_V2_DISCRIMINATOR,
|
|
180
173
|
INITIALIZE_REWARD_DISCRIMINATOR: () => INITIALIZE_REWARD_DISCRIMINATOR,
|
|
181
174
|
OBSERVATION_STATE_DISCRIMINATOR: () => OBSERVATION_STATE_DISCRIMINATOR,
|
|
182
|
-
OPEN_POSITION_DISCRIMINATOR: () => OPEN_POSITION_DISCRIMINATOR,
|
|
183
|
-
OPEN_POSITION_V2_DISCRIMINATOR: () => OPEN_POSITION_V2_DISCRIMINATOR,
|
|
184
175
|
OPEN_POSITION_WITH_TOKEN22_NFT_DISCRIMINATOR: () => OPEN_POSITION_WITH_TOKEN22_NFT_DISCRIMINATOR,
|
|
185
176
|
OPERATION_STATE_DISCRIMINATOR: () => OPERATION_STATE_DISCRIMINATOR,
|
|
186
177
|
PERSONAL_POSITION_STATE_DISCRIMINATOR: () => PERSONAL_POSITION_STATE_DISCRIMINATOR,
|
|
@@ -188,7 +179,6 @@ __export(generated_exports, {
|
|
|
188
179
|
PROTOCOL_POSITION_STATE_DISCRIMINATOR: () => PROTOCOL_POSITION_STATE_DISCRIMINATOR,
|
|
189
180
|
SET_REWARD_PARAMS_DISCRIMINATOR: () => SET_REWARD_PARAMS_DISCRIMINATOR,
|
|
190
181
|
SUPPORT_MINT_ASSOCIATED_DISCRIMINATOR: () => SUPPORT_MINT_ASSOCIATED_DISCRIMINATOR,
|
|
191
|
-
SWAP_DISCRIMINATOR: () => SWAP_DISCRIMINATOR,
|
|
192
182
|
SWAP_ROUTER_BASE_IN_DISCRIMINATOR: () => SWAP_ROUTER_BASE_IN_DISCRIMINATOR,
|
|
193
183
|
SWAP_V2_DISCRIMINATOR: () => SWAP_V2_DISCRIMINATOR,
|
|
194
184
|
TICK_ARRAY_BITMAP_EXTENSION_DISCRIMINATOR: () => TICK_ARRAY_BITMAP_EXTENSION_DISCRIMINATOR,
|
|
@@ -311,27 +301,17 @@ __export(generated_exports, {
|
|
|
311
301
|
getCreateSupportMintAssociatedInstructionDataCodec: () => getCreateSupportMintAssociatedInstructionDataCodec,
|
|
312
302
|
getCreateSupportMintAssociatedInstructionDataDecoder: () => getCreateSupportMintAssociatedInstructionDataDecoder,
|
|
313
303
|
getCreateSupportMintAssociatedInstructionDataEncoder: () => getCreateSupportMintAssociatedInstructionDataEncoder,
|
|
314
|
-
getDecreaseLiquidityDiscriminatorBytes: () => getDecreaseLiquidityDiscriminatorBytes,
|
|
315
304
|
getDecreaseLiquidityEventCodec: () => getDecreaseLiquidityEventCodec,
|
|
316
305
|
getDecreaseLiquidityEventDecoder: () => getDecreaseLiquidityEventDecoder,
|
|
317
306
|
getDecreaseLiquidityEventEncoder: () => getDecreaseLiquidityEventEncoder,
|
|
318
|
-
getDecreaseLiquidityInstruction: () => getDecreaseLiquidityInstruction,
|
|
319
|
-
getDecreaseLiquidityInstructionDataCodec: () => getDecreaseLiquidityInstructionDataCodec,
|
|
320
|
-
getDecreaseLiquidityInstructionDataDecoder: () => getDecreaseLiquidityInstructionDataDecoder,
|
|
321
|
-
getDecreaseLiquidityInstructionDataEncoder: () => getDecreaseLiquidityInstructionDataEncoder,
|
|
322
307
|
getDecreaseLiquidityV2DiscriminatorBytes: () => getDecreaseLiquidityV2DiscriminatorBytes,
|
|
323
308
|
getDecreaseLiquidityV2Instruction: () => getDecreaseLiquidityV2Instruction,
|
|
324
309
|
getDecreaseLiquidityV2InstructionDataCodec: () => getDecreaseLiquidityV2InstructionDataCodec,
|
|
325
310
|
getDecreaseLiquidityV2InstructionDataDecoder: () => getDecreaseLiquidityV2InstructionDataDecoder,
|
|
326
311
|
getDecreaseLiquidityV2InstructionDataEncoder: () => getDecreaseLiquidityV2InstructionDataEncoder,
|
|
327
|
-
getIncreaseLiquidityDiscriminatorBytes: () => getIncreaseLiquidityDiscriminatorBytes,
|
|
328
312
|
getIncreaseLiquidityEventCodec: () => getIncreaseLiquidityEventCodec,
|
|
329
313
|
getIncreaseLiquidityEventDecoder: () => getIncreaseLiquidityEventDecoder,
|
|
330
314
|
getIncreaseLiquidityEventEncoder: () => getIncreaseLiquidityEventEncoder,
|
|
331
|
-
getIncreaseLiquidityInstruction: () => getIncreaseLiquidityInstruction,
|
|
332
|
-
getIncreaseLiquidityInstructionDataCodec: () => getIncreaseLiquidityInstructionDataCodec,
|
|
333
|
-
getIncreaseLiquidityInstructionDataDecoder: () => getIncreaseLiquidityInstructionDataDecoder,
|
|
334
|
-
getIncreaseLiquidityInstructionDataEncoder: () => getIncreaseLiquidityInstructionDataEncoder,
|
|
335
315
|
getIncreaseLiquidityV2DiscriminatorBytes: () => getIncreaseLiquidityV2DiscriminatorBytes,
|
|
336
316
|
getIncreaseLiquidityV2Instruction: () => getIncreaseLiquidityV2Instruction,
|
|
337
317
|
getIncreaseLiquidityV2InstructionDataCodec: () => getIncreaseLiquidityV2InstructionDataCodec,
|
|
@@ -357,18 +337,6 @@ __export(generated_exports, {
|
|
|
357
337
|
getObservationStateDiscriminatorBytes: () => getObservationStateDiscriminatorBytes,
|
|
358
338
|
getObservationStateEncoder: () => getObservationStateEncoder,
|
|
359
339
|
getObservationStateSize: () => getObservationStateSize,
|
|
360
|
-
getOpenPositionDiscriminatorBytes: () => getOpenPositionDiscriminatorBytes,
|
|
361
|
-
getOpenPositionInstruction: () => getOpenPositionInstruction,
|
|
362
|
-
getOpenPositionInstructionAsync: () => getOpenPositionInstructionAsync,
|
|
363
|
-
getOpenPositionInstructionDataCodec: () => getOpenPositionInstructionDataCodec,
|
|
364
|
-
getOpenPositionInstructionDataDecoder: () => getOpenPositionInstructionDataDecoder,
|
|
365
|
-
getOpenPositionInstructionDataEncoder: () => getOpenPositionInstructionDataEncoder,
|
|
366
|
-
getOpenPositionV2DiscriminatorBytes: () => getOpenPositionV2DiscriminatorBytes,
|
|
367
|
-
getOpenPositionV2Instruction: () => getOpenPositionV2Instruction,
|
|
368
|
-
getOpenPositionV2InstructionAsync: () => getOpenPositionV2InstructionAsync,
|
|
369
|
-
getOpenPositionV2InstructionDataCodec: () => getOpenPositionV2InstructionDataCodec,
|
|
370
|
-
getOpenPositionV2InstructionDataDecoder: () => getOpenPositionV2InstructionDataDecoder,
|
|
371
|
-
getOpenPositionV2InstructionDataEncoder: () => getOpenPositionV2InstructionDataEncoder,
|
|
372
340
|
getOpenPositionWithToken22NftDiscriminatorBytes: () => getOpenPositionWithToken22NftDiscriminatorBytes,
|
|
373
341
|
getOpenPositionWithToken22NftInstruction: () => getOpenPositionWithToken22NftInstruction,
|
|
374
342
|
getOpenPositionWithToken22NftInstructionAsync: () => getOpenPositionWithToken22NftInstructionAsync,
|
|
@@ -415,14 +383,9 @@ __export(generated_exports, {
|
|
|
415
383
|
getSupportMintAssociatedDiscriminatorBytes: () => getSupportMintAssociatedDiscriminatorBytes,
|
|
416
384
|
getSupportMintAssociatedEncoder: () => getSupportMintAssociatedEncoder,
|
|
417
385
|
getSupportMintAssociatedSize: () => getSupportMintAssociatedSize,
|
|
418
|
-
getSwapDiscriminatorBytes: () => getSwapDiscriminatorBytes,
|
|
419
386
|
getSwapEventCodec: () => getSwapEventCodec,
|
|
420
387
|
getSwapEventDecoder: () => getSwapEventDecoder,
|
|
421
388
|
getSwapEventEncoder: () => getSwapEventEncoder,
|
|
422
|
-
getSwapInstruction: () => getSwapInstruction,
|
|
423
|
-
getSwapInstructionDataCodec: () => getSwapInstructionDataCodec,
|
|
424
|
-
getSwapInstructionDataDecoder: () => getSwapInstructionDataDecoder,
|
|
425
|
-
getSwapInstructionDataEncoder: () => getSwapInstructionDataEncoder,
|
|
426
389
|
getSwapRouterBaseInDiscriminatorBytes: () => getSwapRouterBaseInDiscriminatorBytes,
|
|
427
390
|
getSwapRouterBaseInInstruction: () => getSwapRouterBaseInInstruction,
|
|
428
391
|
getSwapRouterBaseInInstructionDataCodec: () => getSwapRouterBaseInInstructionDataCodec,
|
|
@@ -487,16 +450,11 @@ __export(generated_exports, {
|
|
|
487
450
|
parseCreateOperationAccountInstruction: () => parseCreateOperationAccountInstruction,
|
|
488
451
|
parseCreatePoolInstruction: () => parseCreatePoolInstruction,
|
|
489
452
|
parseCreateSupportMintAssociatedInstruction: () => parseCreateSupportMintAssociatedInstruction,
|
|
490
|
-
parseDecreaseLiquidityInstruction: () => parseDecreaseLiquidityInstruction,
|
|
491
453
|
parseDecreaseLiquidityV2Instruction: () => parseDecreaseLiquidityV2Instruction,
|
|
492
|
-
parseIncreaseLiquidityInstruction: () => parseIncreaseLiquidityInstruction,
|
|
493
454
|
parseIncreaseLiquidityV2Instruction: () => parseIncreaseLiquidityV2Instruction,
|
|
494
455
|
parseInitializeRewardInstruction: () => parseInitializeRewardInstruction,
|
|
495
|
-
parseOpenPositionInstruction: () => parseOpenPositionInstruction,
|
|
496
|
-
parseOpenPositionV2Instruction: () => parseOpenPositionV2Instruction,
|
|
497
456
|
parseOpenPositionWithToken22NftInstruction: () => parseOpenPositionWithToken22NftInstruction,
|
|
498
457
|
parseSetRewardParamsInstruction: () => parseSetRewardParamsInstruction,
|
|
499
|
-
parseSwapInstruction: () => parseSwapInstruction,
|
|
500
458
|
parseSwapRouterBaseInInstruction: () => parseSwapRouterBaseInInstruction,
|
|
501
459
|
parseSwapV2Instruction: () => parseSwapV2Instruction,
|
|
502
460
|
parseTransferRewardOwnerInstruction: () => parseTransferRewardOwnerInstruction,
|
|
@@ -563,13 +521,13 @@ function decodeAmmConfig(encodedAccount) {
|
|
|
563
521
|
getAmmConfigDecoder()
|
|
564
522
|
);
|
|
565
523
|
}
|
|
566
|
-
async function fetchAmmConfig(rpc,
|
|
567
|
-
const maybeAccount = await fetchMaybeAmmConfig(rpc,
|
|
524
|
+
async function fetchAmmConfig(rpc, address5, config) {
|
|
525
|
+
const maybeAccount = await fetchMaybeAmmConfig(rpc, address5, config);
|
|
568
526
|
(0, import_kit.assertAccountExists)(maybeAccount);
|
|
569
527
|
return maybeAccount;
|
|
570
528
|
}
|
|
571
|
-
async function fetchMaybeAmmConfig(rpc,
|
|
572
|
-
const maybeAccount = await (0, import_kit.fetchEncodedAccount)(rpc,
|
|
529
|
+
async function fetchMaybeAmmConfig(rpc, address5, config) {
|
|
530
|
+
const maybeAccount = await (0, import_kit.fetchEncodedAccount)(rpc, address5, config);
|
|
573
531
|
return decodeAmmConfig(maybeAccount);
|
|
574
532
|
}
|
|
575
533
|
async function fetchAllAmmConfig(rpc, addresses, config) {
|
|
@@ -678,6 +636,8 @@ var import_kit5 = require("@solana/kit");
|
|
|
678
636
|
function getCreatePersonalPositionEventEncoder() {
|
|
679
637
|
return (0, import_kit5.getStructEncoder)([
|
|
680
638
|
["poolState", (0, import_kit5.getAddressEncoder)()],
|
|
639
|
+
["personalPosition", (0, import_kit5.getAddressEncoder)()],
|
|
640
|
+
["nftMint", (0, import_kit5.getAddressEncoder)()],
|
|
681
641
|
["minter", (0, import_kit5.getAddressEncoder)()],
|
|
682
642
|
["nftOwner", (0, import_kit5.getAddressEncoder)()],
|
|
683
643
|
["tickLowerIndex", (0, import_kit5.getI32Encoder)()],
|
|
@@ -692,6 +652,8 @@ function getCreatePersonalPositionEventEncoder() {
|
|
|
692
652
|
function getCreatePersonalPositionEventDecoder() {
|
|
693
653
|
return (0, import_kit5.getStructDecoder)([
|
|
694
654
|
["poolState", (0, import_kit5.getAddressDecoder)()],
|
|
655
|
+
["personalPosition", (0, import_kit5.getAddressDecoder)()],
|
|
656
|
+
["nftMint", (0, import_kit5.getAddressDecoder)()],
|
|
695
657
|
["minter", (0, import_kit5.getAddressDecoder)()],
|
|
696
658
|
["nftOwner", (0, import_kit5.getAddressDecoder)()],
|
|
697
659
|
["tickLowerIndex", (0, import_kit5.getI32Decoder)()],
|
|
@@ -869,7 +831,8 @@ function getPoolCreatedEventEncoder() {
|
|
|
869
831
|
["sqrtPriceX64", (0, import_kit11.getU128Encoder)()],
|
|
870
832
|
["tick", (0, import_kit11.getI32Encoder)()],
|
|
871
833
|
["tokenVault0", (0, import_kit11.getAddressEncoder)()],
|
|
872
|
-
["tokenVault1", (0, import_kit11.getAddressEncoder)()]
|
|
834
|
+
["tokenVault1", (0, import_kit11.getAddressEncoder)()],
|
|
835
|
+
["ammConfig", (0, import_kit11.getAddressEncoder)()]
|
|
873
836
|
]);
|
|
874
837
|
}
|
|
875
838
|
function getPoolCreatedEventDecoder() {
|
|
@@ -881,7 +844,8 @@ function getPoolCreatedEventDecoder() {
|
|
|
881
844
|
["sqrtPriceX64", (0, import_kit11.getU128Decoder)()],
|
|
882
845
|
["tick", (0, import_kit11.getI32Decoder)()],
|
|
883
846
|
["tokenVault0", (0, import_kit11.getAddressDecoder)()],
|
|
884
|
-
["tokenVault1", (0, import_kit11.getAddressDecoder)()]
|
|
847
|
+
["tokenVault1", (0, import_kit11.getAddressDecoder)()],
|
|
848
|
+
["ammConfig", (0, import_kit11.getAddressDecoder)()]
|
|
885
849
|
]);
|
|
886
850
|
}
|
|
887
851
|
function getPoolCreatedEventCodec() {
|
|
@@ -1086,13 +1050,13 @@ function decodeObservationState(encodedAccount) {
|
|
|
1086
1050
|
getObservationStateDecoder()
|
|
1087
1051
|
);
|
|
1088
1052
|
}
|
|
1089
|
-
async function fetchObservationState(rpc,
|
|
1090
|
-
const maybeAccount = await fetchMaybeObservationState(rpc,
|
|
1053
|
+
async function fetchObservationState(rpc, address5, config) {
|
|
1054
|
+
const maybeAccount = await fetchMaybeObservationState(rpc, address5, config);
|
|
1091
1055
|
(0, import_kit17.assertAccountExists)(maybeAccount);
|
|
1092
1056
|
return maybeAccount;
|
|
1093
1057
|
}
|
|
1094
|
-
async function fetchMaybeObservationState(rpc,
|
|
1095
|
-
const maybeAccount = await (0, import_kit17.fetchEncodedAccount)(rpc,
|
|
1058
|
+
async function fetchMaybeObservationState(rpc, address5, config) {
|
|
1059
|
+
const maybeAccount = await (0, import_kit17.fetchEncodedAccount)(rpc, address5, config);
|
|
1096
1060
|
return decodeObservationState(maybeAccount);
|
|
1097
1061
|
}
|
|
1098
1062
|
async function fetchAllObservationState(rpc, addresses, config) {
|
|
@@ -1159,13 +1123,13 @@ function decodeOperationState(encodedAccount) {
|
|
|
1159
1123
|
getOperationStateDecoder()
|
|
1160
1124
|
);
|
|
1161
1125
|
}
|
|
1162
|
-
async function fetchOperationState(rpc,
|
|
1163
|
-
const maybeAccount = await fetchMaybeOperationState(rpc,
|
|
1126
|
+
async function fetchOperationState(rpc, address5, config) {
|
|
1127
|
+
const maybeAccount = await fetchMaybeOperationState(rpc, address5, config);
|
|
1164
1128
|
(0, import_kit18.assertAccountExists)(maybeAccount);
|
|
1165
1129
|
return maybeAccount;
|
|
1166
1130
|
}
|
|
1167
|
-
async function fetchMaybeOperationState(rpc,
|
|
1168
|
-
const maybeAccount = await (0, import_kit18.fetchEncodedAccount)(rpc,
|
|
1131
|
+
async function fetchMaybeOperationState(rpc, address5, config) {
|
|
1132
|
+
const maybeAccount = await (0, import_kit18.fetchEncodedAccount)(rpc, address5, config);
|
|
1169
1133
|
return decodeOperationState(maybeAccount);
|
|
1170
1134
|
}
|
|
1171
1135
|
async function fetchAllOperationState(rpc, addresses, config) {
|
|
@@ -1264,17 +1228,17 @@ function decodePersonalPositionState(encodedAccount) {
|
|
|
1264
1228
|
getPersonalPositionStateDecoder()
|
|
1265
1229
|
);
|
|
1266
1230
|
}
|
|
1267
|
-
async function fetchPersonalPositionState(rpc,
|
|
1231
|
+
async function fetchPersonalPositionState(rpc, address5, config) {
|
|
1268
1232
|
const maybeAccount = await fetchMaybePersonalPositionState(
|
|
1269
1233
|
rpc,
|
|
1270
|
-
|
|
1234
|
+
address5,
|
|
1271
1235
|
config
|
|
1272
1236
|
);
|
|
1273
1237
|
(0, import_kit19.assertAccountExists)(maybeAccount);
|
|
1274
1238
|
return maybeAccount;
|
|
1275
1239
|
}
|
|
1276
|
-
async function fetchMaybePersonalPositionState(rpc,
|
|
1277
|
-
const maybeAccount = await (0, import_kit19.fetchEncodedAccount)(rpc,
|
|
1240
|
+
async function fetchMaybePersonalPositionState(rpc, address5, config) {
|
|
1241
|
+
const maybeAccount = await (0, import_kit19.fetchEncodedAccount)(rpc, address5, config);
|
|
1278
1242
|
return decodePersonalPositionState(maybeAccount);
|
|
1279
1243
|
}
|
|
1280
1244
|
async function fetchAllPersonalPositionState(rpc, addresses, config) {
|
|
@@ -1409,13 +1373,13 @@ function decodePoolState(encodedAccount) {
|
|
|
1409
1373
|
getPoolStateDecoder()
|
|
1410
1374
|
);
|
|
1411
1375
|
}
|
|
1412
|
-
async function fetchPoolState(rpc,
|
|
1413
|
-
const maybeAccount = await fetchMaybePoolState(rpc,
|
|
1376
|
+
async function fetchPoolState(rpc, address5, config) {
|
|
1377
|
+
const maybeAccount = await fetchMaybePoolState(rpc, address5, config);
|
|
1414
1378
|
(0, import_kit20.assertAccountExists)(maybeAccount);
|
|
1415
1379
|
return maybeAccount;
|
|
1416
1380
|
}
|
|
1417
|
-
async function fetchMaybePoolState(rpc,
|
|
1418
|
-
const maybeAccount = await (0, import_kit20.fetchEncodedAccount)(rpc,
|
|
1381
|
+
async function fetchMaybePoolState(rpc, address5, config) {
|
|
1382
|
+
const maybeAccount = await (0, import_kit20.fetchEncodedAccount)(rpc, address5, config);
|
|
1419
1383
|
return decodePoolState(maybeAccount);
|
|
1420
1384
|
}
|
|
1421
1385
|
async function fetchAllPoolState(rpc, addresses, config) {
|
|
@@ -1500,17 +1464,17 @@ function decodeProtocolPositionState(encodedAccount) {
|
|
|
1500
1464
|
getProtocolPositionStateDecoder()
|
|
1501
1465
|
);
|
|
1502
1466
|
}
|
|
1503
|
-
async function fetchProtocolPositionState(rpc,
|
|
1467
|
+
async function fetchProtocolPositionState(rpc, address5, config) {
|
|
1504
1468
|
const maybeAccount = await fetchMaybeProtocolPositionState(
|
|
1505
1469
|
rpc,
|
|
1506
|
-
|
|
1470
|
+
address5,
|
|
1507
1471
|
config
|
|
1508
1472
|
);
|
|
1509
1473
|
(0, import_kit21.assertAccountExists)(maybeAccount);
|
|
1510
1474
|
return maybeAccount;
|
|
1511
1475
|
}
|
|
1512
|
-
async function fetchMaybeProtocolPositionState(rpc,
|
|
1513
|
-
const maybeAccount = await (0, import_kit21.fetchEncodedAccount)(rpc,
|
|
1476
|
+
async function fetchMaybeProtocolPositionState(rpc, address5, config) {
|
|
1477
|
+
const maybeAccount = await (0, import_kit21.fetchEncodedAccount)(rpc, address5, config);
|
|
1514
1478
|
return decodeProtocolPositionState(maybeAccount);
|
|
1515
1479
|
}
|
|
1516
1480
|
async function fetchAllProtocolPositionState(rpc, addresses, config) {
|
|
@@ -1583,17 +1547,17 @@ function decodeSupportMintAssociated(encodedAccount) {
|
|
|
1583
1547
|
getSupportMintAssociatedDecoder()
|
|
1584
1548
|
);
|
|
1585
1549
|
}
|
|
1586
|
-
async function fetchSupportMintAssociated(rpc,
|
|
1550
|
+
async function fetchSupportMintAssociated(rpc, address5, config) {
|
|
1587
1551
|
const maybeAccount = await fetchMaybeSupportMintAssociated(
|
|
1588
1552
|
rpc,
|
|
1589
|
-
|
|
1553
|
+
address5,
|
|
1590
1554
|
config
|
|
1591
1555
|
);
|
|
1592
1556
|
(0, import_kit22.assertAccountExists)(maybeAccount);
|
|
1593
1557
|
return maybeAccount;
|
|
1594
1558
|
}
|
|
1595
|
-
async function fetchMaybeSupportMintAssociated(rpc,
|
|
1596
|
-
const maybeAccount = await (0, import_kit22.fetchEncodedAccount)(rpc,
|
|
1559
|
+
async function fetchMaybeSupportMintAssociated(rpc, address5, config) {
|
|
1560
|
+
const maybeAccount = await (0, import_kit22.fetchEncodedAccount)(rpc, address5, config);
|
|
1597
1561
|
return decodeSupportMintAssociated(maybeAccount);
|
|
1598
1562
|
}
|
|
1599
1563
|
async function fetchAllSupportMintAssociated(rpc, addresses, config) {
|
|
@@ -1686,17 +1650,17 @@ function decodeTickArrayBitmapExtension(encodedAccount) {
|
|
|
1686
1650
|
getTickArrayBitmapExtensionDecoder()
|
|
1687
1651
|
);
|
|
1688
1652
|
}
|
|
1689
|
-
async function fetchTickArrayBitmapExtension(rpc,
|
|
1653
|
+
async function fetchTickArrayBitmapExtension(rpc, address5, config) {
|
|
1690
1654
|
const maybeAccount = await fetchMaybeTickArrayBitmapExtension(
|
|
1691
1655
|
rpc,
|
|
1692
|
-
|
|
1656
|
+
address5,
|
|
1693
1657
|
config
|
|
1694
1658
|
);
|
|
1695
1659
|
(0, import_kit23.assertAccountExists)(maybeAccount);
|
|
1696
1660
|
return maybeAccount;
|
|
1697
1661
|
}
|
|
1698
|
-
async function fetchMaybeTickArrayBitmapExtension(rpc,
|
|
1699
|
-
const maybeAccount = await (0, import_kit23.fetchEncodedAccount)(rpc,
|
|
1662
|
+
async function fetchMaybeTickArrayBitmapExtension(rpc, address5, config) {
|
|
1663
|
+
const maybeAccount = await (0, import_kit23.fetchEncodedAccount)(rpc, address5, config);
|
|
1700
1664
|
return decodeTickArrayBitmapExtension(maybeAccount);
|
|
1701
1665
|
}
|
|
1702
1666
|
async function fetchAllTickArrayBitmapExtension(rpc, addresses, config) {
|
|
@@ -1769,13 +1733,13 @@ function decodeTickArrayState(encodedAccount) {
|
|
|
1769
1733
|
getTickArrayStateDecoder()
|
|
1770
1734
|
);
|
|
1771
1735
|
}
|
|
1772
|
-
async function fetchTickArrayState(rpc,
|
|
1773
|
-
const maybeAccount = await fetchMaybeTickArrayState(rpc,
|
|
1736
|
+
async function fetchTickArrayState(rpc, address5, config) {
|
|
1737
|
+
const maybeAccount = await fetchMaybeTickArrayState(rpc, address5, config);
|
|
1774
1738
|
(0, import_kit24.assertAccountExists)(maybeAccount);
|
|
1775
1739
|
return maybeAccount;
|
|
1776
1740
|
}
|
|
1777
|
-
async function fetchMaybeTickArrayState(rpc,
|
|
1778
|
-
const maybeAccount = await (0, import_kit24.fetchEncodedAccount)(rpc,
|
|
1741
|
+
async function fetchMaybeTickArrayState(rpc, address5, config) {
|
|
1742
|
+
const maybeAccount = await (0, import_kit24.fetchEncodedAccount)(rpc, address5, config);
|
|
1779
1743
|
return decodeTickArrayState(maybeAccount);
|
|
1780
1744
|
}
|
|
1781
1745
|
async function fetchAllTickArrayState(rpc, addresses, config) {
|
|
@@ -1912,23 +1876,18 @@ var AmmV3Instruction = /* @__PURE__ */ ((AmmV3Instruction2) => {
|
|
|
1912
1876
|
AmmV3Instruction2[AmmV3Instruction2["CreateOperationAccount"] = 6] = "CreateOperationAccount";
|
|
1913
1877
|
AmmV3Instruction2[AmmV3Instruction2["CreatePool"] = 7] = "CreatePool";
|
|
1914
1878
|
AmmV3Instruction2[AmmV3Instruction2["CreateSupportMintAssociated"] = 8] = "CreateSupportMintAssociated";
|
|
1915
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
1916
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
1917
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
1918
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
1919
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
1920
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
1921
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
1922
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
1923
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
1924
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
1925
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
1926
|
-
AmmV3Instruction2[AmmV3Instruction2["
|
|
1927
|
-
AmmV3Instruction2[AmmV3Instruction2["TransferRewardOwner"] = 21] = "TransferRewardOwner";
|
|
1928
|
-
AmmV3Instruction2[AmmV3Instruction2["UpdateAmmConfig"] = 22] = "UpdateAmmConfig";
|
|
1929
|
-
AmmV3Instruction2[AmmV3Instruction2["UpdateOperationAccount"] = 23] = "UpdateOperationAccount";
|
|
1930
|
-
AmmV3Instruction2[AmmV3Instruction2["UpdatePoolStatus"] = 24] = "UpdatePoolStatus";
|
|
1931
|
-
AmmV3Instruction2[AmmV3Instruction2["UpdateRewardInfos"] = 25] = "UpdateRewardInfos";
|
|
1879
|
+
AmmV3Instruction2[AmmV3Instruction2["DecreaseLiquidityV2"] = 9] = "DecreaseLiquidityV2";
|
|
1880
|
+
AmmV3Instruction2[AmmV3Instruction2["IncreaseLiquidityV2"] = 10] = "IncreaseLiquidityV2";
|
|
1881
|
+
AmmV3Instruction2[AmmV3Instruction2["InitializeReward"] = 11] = "InitializeReward";
|
|
1882
|
+
AmmV3Instruction2[AmmV3Instruction2["OpenPositionWithToken22Nft"] = 12] = "OpenPositionWithToken22Nft";
|
|
1883
|
+
AmmV3Instruction2[AmmV3Instruction2["SetRewardParams"] = 13] = "SetRewardParams";
|
|
1884
|
+
AmmV3Instruction2[AmmV3Instruction2["SwapRouterBaseIn"] = 14] = "SwapRouterBaseIn";
|
|
1885
|
+
AmmV3Instruction2[AmmV3Instruction2["SwapV2"] = 15] = "SwapV2";
|
|
1886
|
+
AmmV3Instruction2[AmmV3Instruction2["TransferRewardOwner"] = 16] = "TransferRewardOwner";
|
|
1887
|
+
AmmV3Instruction2[AmmV3Instruction2["UpdateAmmConfig"] = 17] = "UpdateAmmConfig";
|
|
1888
|
+
AmmV3Instruction2[AmmV3Instruction2["UpdateOperationAccount"] = 18] = "UpdateOperationAccount";
|
|
1889
|
+
AmmV3Instruction2[AmmV3Instruction2["UpdatePoolStatus"] = 19] = "UpdatePoolStatus";
|
|
1890
|
+
AmmV3Instruction2[AmmV3Instruction2["UpdateRewardInfos"] = 20] = "UpdateRewardInfos";
|
|
1932
1891
|
return AmmV3Instruction2;
|
|
1933
1892
|
})(AmmV3Instruction || {});
|
|
1934
1893
|
function identifyAmmV3Instruction(instruction) {
|
|
@@ -2014,15 +1973,6 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2014
1973
|
)) {
|
|
2015
1974
|
return 8 /* CreateSupportMintAssociated */;
|
|
2016
1975
|
}
|
|
2017
|
-
if ((0, import_kit25.containsBytes)(
|
|
2018
|
-
data,
|
|
2019
|
-
(0, import_kit25.fixEncoderSize)((0, import_kit25.getBytesEncoder)(), 8).encode(
|
|
2020
|
-
new Uint8Array([160, 38, 208, 111, 104, 91, 44, 1])
|
|
2021
|
-
),
|
|
2022
|
-
0
|
|
2023
|
-
)) {
|
|
2024
|
-
return 9 /* DecreaseLiquidity */;
|
|
2025
|
-
}
|
|
2026
1976
|
if ((0, import_kit25.containsBytes)(
|
|
2027
1977
|
data,
|
|
2028
1978
|
(0, import_kit25.fixEncoderSize)((0, import_kit25.getBytesEncoder)(), 8).encode(
|
|
@@ -2030,16 +1980,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2030
1980
|
),
|
|
2031
1981
|
0
|
|
2032
1982
|
)) {
|
|
2033
|
-
return
|
|
2034
|
-
}
|
|
2035
|
-
if ((0, import_kit25.containsBytes)(
|
|
2036
|
-
data,
|
|
2037
|
-
(0, import_kit25.fixEncoderSize)((0, import_kit25.getBytesEncoder)(), 8).encode(
|
|
2038
|
-
new Uint8Array([46, 156, 243, 118, 13, 205, 251, 178])
|
|
2039
|
-
),
|
|
2040
|
-
0
|
|
2041
|
-
)) {
|
|
2042
|
-
return 11 /* IncreaseLiquidity */;
|
|
1983
|
+
return 9 /* DecreaseLiquidityV2 */;
|
|
2043
1984
|
}
|
|
2044
1985
|
if ((0, import_kit25.containsBytes)(
|
|
2045
1986
|
data,
|
|
@@ -2048,7 +1989,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2048
1989
|
),
|
|
2049
1990
|
0
|
|
2050
1991
|
)) {
|
|
2051
|
-
return
|
|
1992
|
+
return 10 /* IncreaseLiquidityV2 */;
|
|
2052
1993
|
}
|
|
2053
1994
|
if ((0, import_kit25.containsBytes)(
|
|
2054
1995
|
data,
|
|
@@ -2057,25 +1998,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2057
1998
|
),
|
|
2058
1999
|
0
|
|
2059
2000
|
)) {
|
|
2060
|
-
return
|
|
2061
|
-
}
|
|
2062
|
-
if ((0, import_kit25.containsBytes)(
|
|
2063
|
-
data,
|
|
2064
|
-
(0, import_kit25.fixEncoderSize)((0, import_kit25.getBytesEncoder)(), 8).encode(
|
|
2065
|
-
new Uint8Array([135, 128, 47, 77, 15, 152, 240, 49])
|
|
2066
|
-
),
|
|
2067
|
-
0
|
|
2068
|
-
)) {
|
|
2069
|
-
return 14 /* OpenPosition */;
|
|
2070
|
-
}
|
|
2071
|
-
if ((0, import_kit25.containsBytes)(
|
|
2072
|
-
data,
|
|
2073
|
-
(0, import_kit25.fixEncoderSize)((0, import_kit25.getBytesEncoder)(), 8).encode(
|
|
2074
|
-
new Uint8Array([77, 184, 74, 214, 112, 86, 241, 199])
|
|
2075
|
-
),
|
|
2076
|
-
0
|
|
2077
|
-
)) {
|
|
2078
|
-
return 15 /* OpenPositionV2 */;
|
|
2001
|
+
return 11 /* InitializeReward */;
|
|
2079
2002
|
}
|
|
2080
2003
|
if ((0, import_kit25.containsBytes)(
|
|
2081
2004
|
data,
|
|
@@ -2084,7 +2007,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2084
2007
|
),
|
|
2085
2008
|
0
|
|
2086
2009
|
)) {
|
|
2087
|
-
return
|
|
2010
|
+
return 12 /* OpenPositionWithToken22Nft */;
|
|
2088
2011
|
}
|
|
2089
2012
|
if ((0, import_kit25.containsBytes)(
|
|
2090
2013
|
data,
|
|
@@ -2093,16 +2016,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2093
2016
|
),
|
|
2094
2017
|
0
|
|
2095
2018
|
)) {
|
|
2096
|
-
return
|
|
2097
|
-
}
|
|
2098
|
-
if ((0, import_kit25.containsBytes)(
|
|
2099
|
-
data,
|
|
2100
|
-
(0, import_kit25.fixEncoderSize)((0, import_kit25.getBytesEncoder)(), 8).encode(
|
|
2101
|
-
new Uint8Array([248, 198, 158, 145, 225, 117, 135, 200])
|
|
2102
|
-
),
|
|
2103
|
-
0
|
|
2104
|
-
)) {
|
|
2105
|
-
return 18 /* Swap */;
|
|
2019
|
+
return 13 /* SetRewardParams */;
|
|
2106
2020
|
}
|
|
2107
2021
|
if ((0, import_kit25.containsBytes)(
|
|
2108
2022
|
data,
|
|
@@ -2111,7 +2025,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2111
2025
|
),
|
|
2112
2026
|
0
|
|
2113
2027
|
)) {
|
|
2114
|
-
return
|
|
2028
|
+
return 14 /* SwapRouterBaseIn */;
|
|
2115
2029
|
}
|
|
2116
2030
|
if ((0, import_kit25.containsBytes)(
|
|
2117
2031
|
data,
|
|
@@ -2120,7 +2034,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2120
2034
|
),
|
|
2121
2035
|
0
|
|
2122
2036
|
)) {
|
|
2123
|
-
return
|
|
2037
|
+
return 15 /* SwapV2 */;
|
|
2124
2038
|
}
|
|
2125
2039
|
if ((0, import_kit25.containsBytes)(
|
|
2126
2040
|
data,
|
|
@@ -2129,7 +2043,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2129
2043
|
),
|
|
2130
2044
|
0
|
|
2131
2045
|
)) {
|
|
2132
|
-
return
|
|
2046
|
+
return 16 /* TransferRewardOwner */;
|
|
2133
2047
|
}
|
|
2134
2048
|
if ((0, import_kit25.containsBytes)(
|
|
2135
2049
|
data,
|
|
@@ -2138,7 +2052,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2138
2052
|
),
|
|
2139
2053
|
0
|
|
2140
2054
|
)) {
|
|
2141
|
-
return
|
|
2055
|
+
return 17 /* UpdateAmmConfig */;
|
|
2142
2056
|
}
|
|
2143
2057
|
if ((0, import_kit25.containsBytes)(
|
|
2144
2058
|
data,
|
|
@@ -2147,7 +2061,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2147
2061
|
),
|
|
2148
2062
|
0
|
|
2149
2063
|
)) {
|
|
2150
|
-
return
|
|
2064
|
+
return 18 /* UpdateOperationAccount */;
|
|
2151
2065
|
}
|
|
2152
2066
|
if ((0, import_kit25.containsBytes)(
|
|
2153
2067
|
data,
|
|
@@ -2156,7 +2070,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2156
2070
|
),
|
|
2157
2071
|
0
|
|
2158
2072
|
)) {
|
|
2159
|
-
return
|
|
2073
|
+
return 19 /* UpdatePoolStatus */;
|
|
2160
2074
|
}
|
|
2161
2075
|
if ((0, import_kit25.containsBytes)(
|
|
2162
2076
|
data,
|
|
@@ -2165,7 +2079,7 @@ function identifyAmmV3Instruction(instruction) {
|
|
|
2165
2079
|
),
|
|
2166
2080
|
0
|
|
2167
2081
|
)) {
|
|
2168
|
-
return
|
|
2082
|
+
return 20 /* UpdateRewardInfos */;
|
|
2169
2083
|
}
|
|
2170
2084
|
throw new Error(
|
|
2171
2085
|
"The provided instruction could not be identified as a ammV3 instruction."
|
|
@@ -2239,7 +2153,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
2239
2153
|
[AMM_V3_ERROR__INVALID_TICK_ARRAY]: `Invalid tick array account`,
|
|
2240
2154
|
[AMM_V3_ERROR__INVALID_TICK_ARRAY_BOUNDARY]: `Invalid tick array boundary`,
|
|
2241
2155
|
[AMM_V3_ERROR__INVALID_TICK_INDEX]: `Tick out of range`,
|
|
2242
|
-
[AMM_V3_ERROR__INVALID_UPDATE_CONFIG_FLAG]: `invalid update
|
|
2156
|
+
[AMM_V3_ERROR__INVALID_UPDATE_CONFIG_FLAG]: `invalid update clmm config flag`,
|
|
2243
2157
|
[AMM_V3_ERROR__LIQUIDITY_ADD_VALUE_ERR]: `Liquidity add delta L must be greater, or equal to before`,
|
|
2244
2158
|
[AMM_V3_ERROR__LIQUIDITY_INSUFFICIENT]: `Liquidity insufficient`,
|
|
2245
2159
|
[AMM_V3_ERROR__LIQUIDITY_SUB_VALUE_ERR]: `Liquidity sub delta L must be smaller than before`,
|
|
@@ -2519,7 +2433,7 @@ function getCloseProtocolPositionInstruction(input, config) {
|
|
|
2519
2433
|
};
|
|
2520
2434
|
const accounts = originalAccounts;
|
|
2521
2435
|
if (!accounts.admin.value) {
|
|
2522
|
-
accounts.admin.value = "
|
|
2436
|
+
accounts.admin.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
2523
2437
|
}
|
|
2524
2438
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2525
2439
|
return Object.freeze({
|
|
@@ -2974,7 +2888,7 @@ async function getCreateAmmConfigInstructionAsync(input, config) {
|
|
|
2974
2888
|
const accounts = originalAccounts;
|
|
2975
2889
|
const args = { ...input };
|
|
2976
2890
|
if (!accounts.owner.value) {
|
|
2977
|
-
accounts.owner.value = "
|
|
2891
|
+
accounts.owner.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
2978
2892
|
}
|
|
2979
2893
|
if (!accounts.ammConfig.value) {
|
|
2980
2894
|
accounts.ammConfig.value = await (0, import_kit33.getProgramDerivedAddress)({
|
|
@@ -3013,7 +2927,7 @@ function getCreateAmmConfigInstruction(input, config) {
|
|
|
3013
2927
|
const accounts = originalAccounts;
|
|
3014
2928
|
const args = { ...input };
|
|
3015
2929
|
if (!accounts.owner.value) {
|
|
3016
|
-
accounts.owner.value = "
|
|
2930
|
+
accounts.owner.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
3017
2931
|
}
|
|
3018
2932
|
if (!accounts.systemProgram.value) {
|
|
3019
2933
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
@@ -3098,7 +3012,7 @@ async function getCreateOperationAccountInstructionAsync(input, config) {
|
|
|
3098
3012
|
};
|
|
3099
3013
|
const accounts = originalAccounts;
|
|
3100
3014
|
if (!accounts.owner.value) {
|
|
3101
|
-
accounts.owner.value = "
|
|
3015
|
+
accounts.owner.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
3102
3016
|
}
|
|
3103
3017
|
if (!accounts.operationState.value) {
|
|
3104
3018
|
accounts.operationState.value = await (0, import_kit34.getProgramDerivedAddress)({
|
|
@@ -3133,7 +3047,7 @@ function getCreateOperationAccountInstruction(input, config) {
|
|
|
3133
3047
|
};
|
|
3134
3048
|
const accounts = originalAccounts;
|
|
3135
3049
|
if (!accounts.owner.value) {
|
|
3136
|
-
accounts.owner.value = "
|
|
3050
|
+
accounts.owner.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
3137
3051
|
}
|
|
3138
3052
|
if (!accounts.systemProgram.value) {
|
|
3139
3053
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
@@ -3572,24 +3486,24 @@ function parseCreateSupportMintAssociatedInstruction(instruction) {
|
|
|
3572
3486
|
};
|
|
3573
3487
|
}
|
|
3574
3488
|
|
|
3575
|
-
// src/generated/instructions/
|
|
3489
|
+
// src/generated/instructions/decreaseLiquidityV2.ts
|
|
3576
3490
|
var import_kit37 = require("@solana/kit");
|
|
3577
|
-
var
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3491
|
+
var DECREASE_LIQUIDITY_V2_DISCRIMINATOR = new Uint8Array([
|
|
3492
|
+
58,
|
|
3493
|
+
127,
|
|
3494
|
+
188,
|
|
3495
|
+
62,
|
|
3496
|
+
79,
|
|
3497
|
+
82,
|
|
3498
|
+
196,
|
|
3499
|
+
96
|
|
3586
3500
|
]);
|
|
3587
|
-
function
|
|
3501
|
+
function getDecreaseLiquidityV2DiscriminatorBytes() {
|
|
3588
3502
|
return (0, import_kit37.fixEncoderSize)((0, import_kit37.getBytesEncoder)(), 8).encode(
|
|
3589
|
-
|
|
3503
|
+
DECREASE_LIQUIDITY_V2_DISCRIMINATOR
|
|
3590
3504
|
);
|
|
3591
3505
|
}
|
|
3592
|
-
function
|
|
3506
|
+
function getDecreaseLiquidityV2InstructionDataEncoder() {
|
|
3593
3507
|
return (0, import_kit37.transformEncoder)(
|
|
3594
3508
|
(0, import_kit37.getStructEncoder)([
|
|
3595
3509
|
["discriminator", (0, import_kit37.fixEncoderSize)((0, import_kit37.getBytesEncoder)(), 8)],
|
|
@@ -3597,10 +3511,13 @@ function getDecreaseLiquidityInstructionDataEncoder() {
|
|
|
3597
3511
|
["amount0Min", (0, import_kit37.getU64Encoder)()],
|
|
3598
3512
|
["amount1Min", (0, import_kit37.getU64Encoder)()]
|
|
3599
3513
|
]),
|
|
3600
|
-
(value) => ({
|
|
3514
|
+
(value) => ({
|
|
3515
|
+
...value,
|
|
3516
|
+
discriminator: DECREASE_LIQUIDITY_V2_DISCRIMINATOR
|
|
3517
|
+
})
|
|
3601
3518
|
);
|
|
3602
3519
|
}
|
|
3603
|
-
function
|
|
3520
|
+
function getDecreaseLiquidityV2InstructionDataDecoder() {
|
|
3604
3521
|
return (0, import_kit37.getStructDecoder)([
|
|
3605
3522
|
["discriminator", (0, import_kit37.fixDecoderSize)((0, import_kit37.getBytesDecoder)(), 8)],
|
|
3606
3523
|
["liquidity", (0, import_kit37.getU128Decoder)()],
|
|
@@ -3608,13 +3525,13 @@ function getDecreaseLiquidityInstructionDataDecoder() {
|
|
|
3608
3525
|
["amount1Min", (0, import_kit37.getU64Decoder)()]
|
|
3609
3526
|
]);
|
|
3610
3527
|
}
|
|
3611
|
-
function
|
|
3528
|
+
function getDecreaseLiquidityV2InstructionDataCodec() {
|
|
3612
3529
|
return (0, import_kit37.combineCodec)(
|
|
3613
|
-
|
|
3614
|
-
|
|
3530
|
+
getDecreaseLiquidityV2InstructionDataEncoder(),
|
|
3531
|
+
getDecreaseLiquidityV2InstructionDataDecoder()
|
|
3615
3532
|
);
|
|
3616
3533
|
}
|
|
3617
|
-
function
|
|
3534
|
+
function getDecreaseLiquidityV2Instruction(input, config) {
|
|
3618
3535
|
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
3619
3536
|
const originalAccounts = {
|
|
3620
3537
|
nftOwner: { value: input.nftOwner ?? null, isWritable: false },
|
|
@@ -3640,13 +3557,26 @@ function getDecreaseLiquidityInstruction(input, config) {
|
|
|
3640
3557
|
value: input.recipientTokenAccount1 ?? null,
|
|
3641
3558
|
isWritable: true
|
|
3642
3559
|
},
|
|
3643
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }
|
|
3560
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
3561
|
+
tokenProgram2022: {
|
|
3562
|
+
value: input.tokenProgram2022 ?? null,
|
|
3563
|
+
isWritable: false
|
|
3564
|
+
},
|
|
3565
|
+
memoProgram: { value: input.memoProgram ?? null, isWritable: false },
|
|
3566
|
+
vault0Mint: { value: input.vault0Mint ?? null, isWritable: false },
|
|
3567
|
+
vault1Mint: { value: input.vault1Mint ?? null, isWritable: false }
|
|
3644
3568
|
};
|
|
3645
3569
|
const accounts = originalAccounts;
|
|
3646
3570
|
const args = { ...input };
|
|
3647
3571
|
if (!accounts.tokenProgram.value) {
|
|
3648
3572
|
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
3649
3573
|
}
|
|
3574
|
+
if (!accounts.tokenProgram2022.value) {
|
|
3575
|
+
accounts.tokenProgram2022.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
3576
|
+
}
|
|
3577
|
+
if (!accounts.memoProgram.value) {
|
|
3578
|
+
accounts.memoProgram.value = "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";
|
|
3579
|
+
}
|
|
3650
3580
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
3651
3581
|
return Object.freeze({
|
|
3652
3582
|
accounts: [
|
|
@@ -3661,16 +3591,20 @@ function getDecreaseLiquidityInstruction(input, config) {
|
|
|
3661
3591
|
getAccountMeta(accounts.tickArrayUpper),
|
|
3662
3592
|
getAccountMeta(accounts.recipientTokenAccount0),
|
|
3663
3593
|
getAccountMeta(accounts.recipientTokenAccount1),
|
|
3664
|
-
getAccountMeta(accounts.tokenProgram)
|
|
3594
|
+
getAccountMeta(accounts.tokenProgram),
|
|
3595
|
+
getAccountMeta(accounts.tokenProgram2022),
|
|
3596
|
+
getAccountMeta(accounts.memoProgram),
|
|
3597
|
+
getAccountMeta(accounts.vault0Mint),
|
|
3598
|
+
getAccountMeta(accounts.vault1Mint)
|
|
3665
3599
|
],
|
|
3666
|
-
data:
|
|
3600
|
+
data: getDecreaseLiquidityV2InstructionDataEncoder().encode(
|
|
3667
3601
|
args
|
|
3668
3602
|
),
|
|
3669
3603
|
programAddress
|
|
3670
3604
|
});
|
|
3671
3605
|
}
|
|
3672
|
-
function
|
|
3673
|
-
if (instruction.accounts.length <
|
|
3606
|
+
function parseDecreaseLiquidityV2Instruction(instruction) {
|
|
3607
|
+
if (instruction.accounts.length < 16) {
|
|
3674
3608
|
throw new Error("Not enough accounts");
|
|
3675
3609
|
}
|
|
3676
3610
|
let accountIndex = 0;
|
|
@@ -3693,89 +3627,90 @@ function parseDecreaseLiquidityInstruction(instruction) {
|
|
|
3693
3627
|
tickArrayUpper: getNextAccount(),
|
|
3694
3628
|
recipientTokenAccount0: getNextAccount(),
|
|
3695
3629
|
recipientTokenAccount1: getNextAccount(),
|
|
3696
|
-
tokenProgram: getNextAccount()
|
|
3630
|
+
tokenProgram: getNextAccount(),
|
|
3631
|
+
tokenProgram2022: getNextAccount(),
|
|
3632
|
+
memoProgram: getNextAccount(),
|
|
3633
|
+
vault0Mint: getNextAccount(),
|
|
3634
|
+
vault1Mint: getNextAccount()
|
|
3697
3635
|
},
|
|
3698
|
-
data:
|
|
3636
|
+
data: getDecreaseLiquidityV2InstructionDataDecoder().decode(
|
|
3637
|
+
instruction.data
|
|
3638
|
+
)
|
|
3699
3639
|
};
|
|
3700
3640
|
}
|
|
3701
3641
|
|
|
3702
|
-
// src/generated/instructions/
|
|
3642
|
+
// src/generated/instructions/increaseLiquidityV2.ts
|
|
3703
3643
|
var import_kit38 = require("@solana/kit");
|
|
3704
|
-
var
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3644
|
+
var INCREASE_LIQUIDITY_V2_DISCRIMINATOR = new Uint8Array([
|
|
3645
|
+
133,
|
|
3646
|
+
29,
|
|
3647
|
+
89,
|
|
3648
|
+
223,
|
|
3649
|
+
69,
|
|
3650
|
+
238,
|
|
3651
|
+
176,
|
|
3652
|
+
10
|
|
3713
3653
|
]);
|
|
3714
|
-
function
|
|
3654
|
+
function getIncreaseLiquidityV2DiscriminatorBytes() {
|
|
3715
3655
|
return (0, import_kit38.fixEncoderSize)((0, import_kit38.getBytesEncoder)(), 8).encode(
|
|
3716
|
-
|
|
3656
|
+
INCREASE_LIQUIDITY_V2_DISCRIMINATOR
|
|
3717
3657
|
);
|
|
3718
3658
|
}
|
|
3719
|
-
function
|
|
3659
|
+
function getIncreaseLiquidityV2InstructionDataEncoder() {
|
|
3720
3660
|
return (0, import_kit38.transformEncoder)(
|
|
3721
3661
|
(0, import_kit38.getStructEncoder)([
|
|
3722
3662
|
["discriminator", (0, import_kit38.fixEncoderSize)((0, import_kit38.getBytesEncoder)(), 8)],
|
|
3723
3663
|
["liquidity", (0, import_kit38.getU128Encoder)()],
|
|
3724
|
-
["
|
|
3725
|
-
["
|
|
3664
|
+
["amount0Max", (0, import_kit38.getU64Encoder)()],
|
|
3665
|
+
["amount1Max", (0, import_kit38.getU64Encoder)()],
|
|
3666
|
+
["baseFlag", (0, import_kit38.getOptionEncoder)((0, import_kit38.getBooleanEncoder)())]
|
|
3726
3667
|
]),
|
|
3727
3668
|
(value) => ({
|
|
3728
3669
|
...value,
|
|
3729
|
-
discriminator:
|
|
3670
|
+
discriminator: INCREASE_LIQUIDITY_V2_DISCRIMINATOR
|
|
3730
3671
|
})
|
|
3731
3672
|
);
|
|
3732
3673
|
}
|
|
3733
|
-
function
|
|
3674
|
+
function getIncreaseLiquidityV2InstructionDataDecoder() {
|
|
3734
3675
|
return (0, import_kit38.getStructDecoder)([
|
|
3735
3676
|
["discriminator", (0, import_kit38.fixDecoderSize)((0, import_kit38.getBytesDecoder)(), 8)],
|
|
3736
3677
|
["liquidity", (0, import_kit38.getU128Decoder)()],
|
|
3737
|
-
["
|
|
3738
|
-
["
|
|
3678
|
+
["amount0Max", (0, import_kit38.getU64Decoder)()],
|
|
3679
|
+
["amount1Max", (0, import_kit38.getU64Decoder)()],
|
|
3680
|
+
["baseFlag", (0, import_kit38.getOptionDecoder)((0, import_kit38.getBooleanDecoder)())]
|
|
3739
3681
|
]);
|
|
3740
3682
|
}
|
|
3741
|
-
function
|
|
3683
|
+
function getIncreaseLiquidityV2InstructionDataCodec() {
|
|
3742
3684
|
return (0, import_kit38.combineCodec)(
|
|
3743
|
-
|
|
3744
|
-
|
|
3685
|
+
getIncreaseLiquidityV2InstructionDataEncoder(),
|
|
3686
|
+
getIncreaseLiquidityV2InstructionDataDecoder()
|
|
3745
3687
|
);
|
|
3746
3688
|
}
|
|
3747
|
-
function
|
|
3689
|
+
function getIncreaseLiquidityV2Instruction(input, config) {
|
|
3748
3690
|
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
3749
3691
|
const originalAccounts = {
|
|
3750
3692
|
nftOwner: { value: input.nftOwner ?? null, isWritable: false },
|
|
3751
3693
|
nftAccount: { value: input.nftAccount ?? null, isWritable: false },
|
|
3752
|
-
personalPosition: {
|
|
3753
|
-
value: input.personalPosition ?? null,
|
|
3754
|
-
isWritable: true
|
|
3755
|
-
},
|
|
3756
3694
|
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
3757
3695
|
protocolPosition: {
|
|
3758
3696
|
value: input.protocolPosition ?? null,
|
|
3759
3697
|
isWritable: false
|
|
3760
3698
|
},
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
tickArrayLower: { value: input.tickArrayLower ?? null, isWritable: true },
|
|
3764
|
-
tickArrayUpper: { value: input.tickArrayUpper ?? null, isWritable: true },
|
|
3765
|
-
recipientTokenAccount0: {
|
|
3766
|
-
value: input.recipientTokenAccount0 ?? null,
|
|
3767
|
-
isWritable: true
|
|
3768
|
-
},
|
|
3769
|
-
recipientTokenAccount1: {
|
|
3770
|
-
value: input.recipientTokenAccount1 ?? null,
|
|
3699
|
+
personalPosition: {
|
|
3700
|
+
value: input.personalPosition ?? null,
|
|
3771
3701
|
isWritable: true
|
|
3772
3702
|
},
|
|
3703
|
+
tickArrayLower: { value: input.tickArrayLower ?? null, isWritable: true },
|
|
3704
|
+
tickArrayUpper: { value: input.tickArrayUpper ?? null, isWritable: true },
|
|
3705
|
+
tokenAccount0: { value: input.tokenAccount0 ?? null, isWritable: true },
|
|
3706
|
+
tokenAccount1: { value: input.tokenAccount1 ?? null, isWritable: true },
|
|
3707
|
+
tokenVault0: { value: input.tokenVault0 ?? null, isWritable: true },
|
|
3708
|
+
tokenVault1: { value: input.tokenVault1 ?? null, isWritable: true },
|
|
3773
3709
|
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
3774
3710
|
tokenProgram2022: {
|
|
3775
3711
|
value: input.tokenProgram2022 ?? null,
|
|
3776
3712
|
isWritable: false
|
|
3777
3713
|
},
|
|
3778
|
-
memoProgram: { value: input.memoProgram ?? null, isWritable: false },
|
|
3779
3714
|
vault0Mint: { value: input.vault0Mint ?? null, isWritable: false },
|
|
3780
3715
|
vault1Mint: { value: input.vault1Mint ?? null, isWritable: false }
|
|
3781
3716
|
};
|
|
@@ -3787,37 +3722,33 @@ function getDecreaseLiquidityV2Instruction(input, config) {
|
|
|
3787
3722
|
if (!accounts.tokenProgram2022.value) {
|
|
3788
3723
|
accounts.tokenProgram2022.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
3789
3724
|
}
|
|
3790
|
-
if (!accounts.memoProgram.value) {
|
|
3791
|
-
accounts.memoProgram.value = "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";
|
|
3792
|
-
}
|
|
3793
3725
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
3794
3726
|
return Object.freeze({
|
|
3795
3727
|
accounts: [
|
|
3796
3728
|
getAccountMeta(accounts.nftOwner),
|
|
3797
3729
|
getAccountMeta(accounts.nftAccount),
|
|
3798
|
-
getAccountMeta(accounts.personalPosition),
|
|
3799
3730
|
getAccountMeta(accounts.poolState),
|
|
3800
3731
|
getAccountMeta(accounts.protocolPosition),
|
|
3801
|
-
getAccountMeta(accounts.
|
|
3802
|
-
getAccountMeta(accounts.tokenVault1),
|
|
3732
|
+
getAccountMeta(accounts.personalPosition),
|
|
3803
3733
|
getAccountMeta(accounts.tickArrayLower),
|
|
3804
3734
|
getAccountMeta(accounts.tickArrayUpper),
|
|
3805
|
-
getAccountMeta(accounts.
|
|
3806
|
-
getAccountMeta(accounts.
|
|
3735
|
+
getAccountMeta(accounts.tokenAccount0),
|
|
3736
|
+
getAccountMeta(accounts.tokenAccount1),
|
|
3737
|
+
getAccountMeta(accounts.tokenVault0),
|
|
3738
|
+
getAccountMeta(accounts.tokenVault1),
|
|
3807
3739
|
getAccountMeta(accounts.tokenProgram),
|
|
3808
3740
|
getAccountMeta(accounts.tokenProgram2022),
|
|
3809
|
-
getAccountMeta(accounts.memoProgram),
|
|
3810
3741
|
getAccountMeta(accounts.vault0Mint),
|
|
3811
3742
|
getAccountMeta(accounts.vault1Mint)
|
|
3812
3743
|
],
|
|
3813
|
-
data:
|
|
3744
|
+
data: getIncreaseLiquidityV2InstructionDataEncoder().encode(
|
|
3814
3745
|
args
|
|
3815
3746
|
),
|
|
3816
3747
|
programAddress
|
|
3817
3748
|
});
|
|
3818
3749
|
}
|
|
3819
|
-
function
|
|
3820
|
-
if (instruction.accounts.length <
|
|
3750
|
+
function parseIncreaseLiquidityV2Instruction(instruction) {
|
|
3751
|
+
if (instruction.accounts.length < 15) {
|
|
3821
3752
|
throw new Error("Not enough accounts");
|
|
3822
3753
|
}
|
|
3823
3754
|
let accountIndex = 0;
|
|
@@ -3831,1198 +3762,220 @@ function parseDecreaseLiquidityV2Instruction(instruction) {
|
|
|
3831
3762
|
accounts: {
|
|
3832
3763
|
nftOwner: getNextAccount(),
|
|
3833
3764
|
nftAccount: getNextAccount(),
|
|
3834
|
-
personalPosition: getNextAccount(),
|
|
3835
3765
|
poolState: getNextAccount(),
|
|
3836
3766
|
protocolPosition: getNextAccount(),
|
|
3837
|
-
|
|
3838
|
-
tokenVault1: getNextAccount(),
|
|
3767
|
+
personalPosition: getNextAccount(),
|
|
3839
3768
|
tickArrayLower: getNextAccount(),
|
|
3840
3769
|
tickArrayUpper: getNextAccount(),
|
|
3841
|
-
|
|
3842
|
-
|
|
3770
|
+
tokenAccount0: getNextAccount(),
|
|
3771
|
+
tokenAccount1: getNextAccount(),
|
|
3772
|
+
tokenVault0: getNextAccount(),
|
|
3773
|
+
tokenVault1: getNextAccount(),
|
|
3843
3774
|
tokenProgram: getNextAccount(),
|
|
3844
3775
|
tokenProgram2022: getNextAccount(),
|
|
3845
|
-
memoProgram: getNextAccount(),
|
|
3846
3776
|
vault0Mint: getNextAccount(),
|
|
3847
3777
|
vault1Mint: getNextAccount()
|
|
3848
3778
|
},
|
|
3849
|
-
data:
|
|
3779
|
+
data: getIncreaseLiquidityV2InstructionDataDecoder().decode(
|
|
3850
3780
|
instruction.data
|
|
3851
3781
|
)
|
|
3852
3782
|
};
|
|
3853
3783
|
}
|
|
3854
3784
|
|
|
3855
|
-
// src/generated/instructions/
|
|
3785
|
+
// src/generated/instructions/initializeReward.ts
|
|
3856
3786
|
var import_kit39 = require("@solana/kit");
|
|
3857
|
-
var
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3787
|
+
var INITIALIZE_REWARD_DISCRIMINATOR = new Uint8Array([
|
|
3788
|
+
95,
|
|
3789
|
+
135,
|
|
3790
|
+
192,
|
|
3791
|
+
196,
|
|
3792
|
+
242,
|
|
3793
|
+
129,
|
|
3794
|
+
230,
|
|
3795
|
+
68
|
|
3866
3796
|
]);
|
|
3867
|
-
function
|
|
3797
|
+
function getInitializeRewardDiscriminatorBytes() {
|
|
3868
3798
|
return (0, import_kit39.fixEncoderSize)((0, import_kit39.getBytesEncoder)(), 8).encode(
|
|
3869
|
-
|
|
3799
|
+
INITIALIZE_REWARD_DISCRIMINATOR
|
|
3870
3800
|
);
|
|
3871
3801
|
}
|
|
3872
|
-
function
|
|
3802
|
+
function getInitializeRewardInstructionDataEncoder() {
|
|
3873
3803
|
return (0, import_kit39.transformEncoder)(
|
|
3874
3804
|
(0, import_kit39.getStructEncoder)([
|
|
3875
3805
|
["discriminator", (0, import_kit39.fixEncoderSize)((0, import_kit39.getBytesEncoder)(), 8)],
|
|
3876
|
-
["
|
|
3877
|
-
["
|
|
3878
|
-
["
|
|
3806
|
+
["openTime", (0, import_kit39.getU64Encoder)()],
|
|
3807
|
+
["endTime", (0, import_kit39.getU64Encoder)()],
|
|
3808
|
+
["emissionsPerSecondX64", (0, import_kit39.getU128Encoder)()]
|
|
3879
3809
|
]),
|
|
3880
|
-
(value) => ({ ...value, discriminator:
|
|
3810
|
+
(value) => ({ ...value, discriminator: INITIALIZE_REWARD_DISCRIMINATOR })
|
|
3881
3811
|
);
|
|
3882
3812
|
}
|
|
3883
|
-
function
|
|
3813
|
+
function getInitializeRewardInstructionDataDecoder() {
|
|
3884
3814
|
return (0, import_kit39.getStructDecoder)([
|
|
3885
3815
|
["discriminator", (0, import_kit39.fixDecoderSize)((0, import_kit39.getBytesDecoder)(), 8)],
|
|
3886
|
-
["
|
|
3887
|
-
["
|
|
3888
|
-
["
|
|
3816
|
+
["openTime", (0, import_kit39.getU64Decoder)()],
|
|
3817
|
+
["endTime", (0, import_kit39.getU64Decoder)()],
|
|
3818
|
+
["emissionsPerSecondX64", (0, import_kit39.getU128Decoder)()]
|
|
3889
3819
|
]);
|
|
3890
3820
|
}
|
|
3891
|
-
function
|
|
3821
|
+
function getInitializeRewardInstructionDataCodec() {
|
|
3892
3822
|
return (0, import_kit39.combineCodec)(
|
|
3893
|
-
|
|
3894
|
-
|
|
3823
|
+
getInitializeRewardInstructionDataEncoder(),
|
|
3824
|
+
getInitializeRewardInstructionDataDecoder()
|
|
3895
3825
|
);
|
|
3896
3826
|
}
|
|
3897
|
-
function
|
|
3827
|
+
async function getInitializeRewardInstructionAsync(input, config) {
|
|
3898
3828
|
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
3899
3829
|
const originalAccounts = {
|
|
3900
|
-
|
|
3901
|
-
|
|
3830
|
+
rewardFunder: { value: input.rewardFunder ?? null, isWritable: true },
|
|
3831
|
+
funderTokenAccount: {
|
|
3832
|
+
value: input.funderTokenAccount ?? null,
|
|
3833
|
+
isWritable: true
|
|
3834
|
+
},
|
|
3835
|
+
ammConfig: { value: input.ammConfig ?? null, isWritable: false },
|
|
3902
3836
|
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
3903
|
-
|
|
3904
|
-
|
|
3837
|
+
operationState: { value: input.operationState ?? null, isWritable: false },
|
|
3838
|
+
rewardTokenMint: {
|
|
3839
|
+
value: input.rewardTokenMint ?? null,
|
|
3905
3840
|
isWritable: false
|
|
3906
3841
|
},
|
|
3907
|
-
|
|
3908
|
-
value: input.
|
|
3842
|
+
rewardTokenVault: {
|
|
3843
|
+
value: input.rewardTokenVault ?? null,
|
|
3909
3844
|
isWritable: true
|
|
3910
3845
|
},
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }
|
|
3846
|
+
rewardTokenProgram: {
|
|
3847
|
+
value: input.rewardTokenProgram ?? null,
|
|
3848
|
+
isWritable: false
|
|
3849
|
+
},
|
|
3850
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
3851
|
+
rent: { value: input.rent ?? null, isWritable: false }
|
|
3918
3852
|
};
|
|
3919
3853
|
const accounts = originalAccounts;
|
|
3920
3854
|
const args = { ...input };
|
|
3921
|
-
if (!accounts.
|
|
3922
|
-
accounts.
|
|
3855
|
+
if (!accounts.operationState.value) {
|
|
3856
|
+
accounts.operationState.value = await (0, import_kit39.getProgramDerivedAddress)({
|
|
3857
|
+
programAddress,
|
|
3858
|
+
seeds: [
|
|
3859
|
+
(0, import_kit39.getBytesEncoder)().encode(
|
|
3860
|
+
new Uint8Array([111, 112, 101, 114, 97, 116, 105, 111, 110])
|
|
3861
|
+
)
|
|
3862
|
+
]
|
|
3863
|
+
});
|
|
3923
3864
|
}
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
getAccountMeta(accounts.nftOwner),
|
|
3928
|
-
getAccountMeta(accounts.nftAccount),
|
|
3929
|
-
getAccountMeta(accounts.poolState),
|
|
3930
|
-
getAccountMeta(accounts.protocolPosition),
|
|
3931
|
-
getAccountMeta(accounts.personalPosition),
|
|
3932
|
-
getAccountMeta(accounts.tickArrayLower),
|
|
3933
|
-
getAccountMeta(accounts.tickArrayUpper),
|
|
3934
|
-
getAccountMeta(accounts.tokenAccount0),
|
|
3935
|
-
getAccountMeta(accounts.tokenAccount1),
|
|
3936
|
-
getAccountMeta(accounts.tokenVault0),
|
|
3937
|
-
getAccountMeta(accounts.tokenVault1),
|
|
3938
|
-
getAccountMeta(accounts.tokenProgram)
|
|
3939
|
-
],
|
|
3940
|
-
data: getIncreaseLiquidityInstructionDataEncoder().encode(
|
|
3941
|
-
args
|
|
3942
|
-
),
|
|
3943
|
-
programAddress
|
|
3944
|
-
});
|
|
3945
|
-
}
|
|
3946
|
-
function parseIncreaseLiquidityInstruction(instruction) {
|
|
3947
|
-
if (instruction.accounts.length < 12) {
|
|
3948
|
-
throw new Error("Not enough accounts");
|
|
3949
|
-
}
|
|
3950
|
-
let accountIndex = 0;
|
|
3951
|
-
const getNextAccount = () => {
|
|
3952
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
3953
|
-
accountIndex += 1;
|
|
3954
|
-
return accountMeta;
|
|
3955
|
-
};
|
|
3956
|
-
return {
|
|
3957
|
-
programAddress: instruction.programAddress,
|
|
3958
|
-
accounts: {
|
|
3959
|
-
nftOwner: getNextAccount(),
|
|
3960
|
-
nftAccount: getNextAccount(),
|
|
3961
|
-
poolState: getNextAccount(),
|
|
3962
|
-
protocolPosition: getNextAccount(),
|
|
3963
|
-
personalPosition: getNextAccount(),
|
|
3964
|
-
tickArrayLower: getNextAccount(),
|
|
3965
|
-
tickArrayUpper: getNextAccount(),
|
|
3966
|
-
tokenAccount0: getNextAccount(),
|
|
3967
|
-
tokenAccount1: getNextAccount(),
|
|
3968
|
-
tokenVault0: getNextAccount(),
|
|
3969
|
-
tokenVault1: getNextAccount(),
|
|
3970
|
-
tokenProgram: getNextAccount()
|
|
3971
|
-
},
|
|
3972
|
-
data: getIncreaseLiquidityInstructionDataDecoder().decode(instruction.data)
|
|
3973
|
-
};
|
|
3974
|
-
}
|
|
3975
|
-
|
|
3976
|
-
// src/generated/instructions/increaseLiquidityV2.ts
|
|
3977
|
-
var import_kit40 = require("@solana/kit");
|
|
3978
|
-
var INCREASE_LIQUIDITY_V2_DISCRIMINATOR = new Uint8Array([
|
|
3979
|
-
133,
|
|
3980
|
-
29,
|
|
3981
|
-
89,
|
|
3982
|
-
223,
|
|
3983
|
-
69,
|
|
3984
|
-
238,
|
|
3985
|
-
176,
|
|
3986
|
-
10
|
|
3987
|
-
]);
|
|
3988
|
-
function getIncreaseLiquidityV2DiscriminatorBytes() {
|
|
3989
|
-
return (0, import_kit40.fixEncoderSize)((0, import_kit40.getBytesEncoder)(), 8).encode(
|
|
3990
|
-
INCREASE_LIQUIDITY_V2_DISCRIMINATOR
|
|
3991
|
-
);
|
|
3992
|
-
}
|
|
3993
|
-
function getIncreaseLiquidityV2InstructionDataEncoder() {
|
|
3994
|
-
return (0, import_kit40.transformEncoder)(
|
|
3995
|
-
(0, import_kit40.getStructEncoder)([
|
|
3996
|
-
["discriminator", (0, import_kit40.fixEncoderSize)((0, import_kit40.getBytesEncoder)(), 8)],
|
|
3997
|
-
["liquidity", (0, import_kit40.getU128Encoder)()],
|
|
3998
|
-
["amount0Max", (0, import_kit40.getU64Encoder)()],
|
|
3999
|
-
["amount1Max", (0, import_kit40.getU64Encoder)()],
|
|
4000
|
-
["baseFlag", (0, import_kit40.getOptionEncoder)((0, import_kit40.getBooleanEncoder)())]
|
|
4001
|
-
]),
|
|
4002
|
-
(value) => ({
|
|
4003
|
-
...value,
|
|
4004
|
-
discriminator: INCREASE_LIQUIDITY_V2_DISCRIMINATOR
|
|
4005
|
-
})
|
|
4006
|
-
);
|
|
4007
|
-
}
|
|
4008
|
-
function getIncreaseLiquidityV2InstructionDataDecoder() {
|
|
4009
|
-
return (0, import_kit40.getStructDecoder)([
|
|
4010
|
-
["discriminator", (0, import_kit40.fixDecoderSize)((0, import_kit40.getBytesDecoder)(), 8)],
|
|
4011
|
-
["liquidity", (0, import_kit40.getU128Decoder)()],
|
|
4012
|
-
["amount0Max", (0, import_kit40.getU64Decoder)()],
|
|
4013
|
-
["amount1Max", (0, import_kit40.getU64Decoder)()],
|
|
4014
|
-
["baseFlag", (0, import_kit40.getOptionDecoder)((0, import_kit40.getBooleanDecoder)())]
|
|
4015
|
-
]);
|
|
4016
|
-
}
|
|
4017
|
-
function getIncreaseLiquidityV2InstructionDataCodec() {
|
|
4018
|
-
return (0, import_kit40.combineCodec)(
|
|
4019
|
-
getIncreaseLiquidityV2InstructionDataEncoder(),
|
|
4020
|
-
getIncreaseLiquidityV2InstructionDataDecoder()
|
|
4021
|
-
);
|
|
4022
|
-
}
|
|
4023
|
-
function getIncreaseLiquidityV2Instruction(input, config) {
|
|
4024
|
-
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
4025
|
-
const originalAccounts = {
|
|
4026
|
-
nftOwner: { value: input.nftOwner ?? null, isWritable: false },
|
|
4027
|
-
nftAccount: { value: input.nftAccount ?? null, isWritable: false },
|
|
4028
|
-
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
4029
|
-
protocolPosition: {
|
|
4030
|
-
value: input.protocolPosition ?? null,
|
|
4031
|
-
isWritable: false
|
|
4032
|
-
},
|
|
4033
|
-
personalPosition: {
|
|
4034
|
-
value: input.personalPosition ?? null,
|
|
4035
|
-
isWritable: true
|
|
4036
|
-
},
|
|
4037
|
-
tickArrayLower: { value: input.tickArrayLower ?? null, isWritable: true },
|
|
4038
|
-
tickArrayUpper: { value: input.tickArrayUpper ?? null, isWritable: true },
|
|
4039
|
-
tokenAccount0: { value: input.tokenAccount0 ?? null, isWritable: true },
|
|
4040
|
-
tokenAccount1: { value: input.tokenAccount1 ?? null, isWritable: true },
|
|
4041
|
-
tokenVault0: { value: input.tokenVault0 ?? null, isWritable: true },
|
|
4042
|
-
tokenVault1: { value: input.tokenVault1 ?? null, isWritable: true },
|
|
4043
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
4044
|
-
tokenProgram2022: {
|
|
4045
|
-
value: input.tokenProgram2022 ?? null,
|
|
4046
|
-
isWritable: false
|
|
4047
|
-
},
|
|
4048
|
-
vault0Mint: { value: input.vault0Mint ?? null, isWritable: false },
|
|
4049
|
-
vault1Mint: { value: input.vault1Mint ?? null, isWritable: false }
|
|
4050
|
-
};
|
|
4051
|
-
const accounts = originalAccounts;
|
|
4052
|
-
const args = { ...input };
|
|
4053
|
-
if (!accounts.tokenProgram.value) {
|
|
4054
|
-
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
4055
|
-
}
|
|
4056
|
-
if (!accounts.tokenProgram2022.value) {
|
|
4057
|
-
accounts.tokenProgram2022.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
4058
|
-
}
|
|
4059
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4060
|
-
return Object.freeze({
|
|
4061
|
-
accounts: [
|
|
4062
|
-
getAccountMeta(accounts.nftOwner),
|
|
4063
|
-
getAccountMeta(accounts.nftAccount),
|
|
4064
|
-
getAccountMeta(accounts.poolState),
|
|
4065
|
-
getAccountMeta(accounts.protocolPosition),
|
|
4066
|
-
getAccountMeta(accounts.personalPosition),
|
|
4067
|
-
getAccountMeta(accounts.tickArrayLower),
|
|
4068
|
-
getAccountMeta(accounts.tickArrayUpper),
|
|
4069
|
-
getAccountMeta(accounts.tokenAccount0),
|
|
4070
|
-
getAccountMeta(accounts.tokenAccount1),
|
|
4071
|
-
getAccountMeta(accounts.tokenVault0),
|
|
4072
|
-
getAccountMeta(accounts.tokenVault1),
|
|
4073
|
-
getAccountMeta(accounts.tokenProgram),
|
|
4074
|
-
getAccountMeta(accounts.tokenProgram2022),
|
|
4075
|
-
getAccountMeta(accounts.vault0Mint),
|
|
4076
|
-
getAccountMeta(accounts.vault1Mint)
|
|
4077
|
-
],
|
|
4078
|
-
data: getIncreaseLiquidityV2InstructionDataEncoder().encode(
|
|
4079
|
-
args
|
|
4080
|
-
),
|
|
4081
|
-
programAddress
|
|
4082
|
-
});
|
|
4083
|
-
}
|
|
4084
|
-
function parseIncreaseLiquidityV2Instruction(instruction) {
|
|
4085
|
-
if (instruction.accounts.length < 15) {
|
|
4086
|
-
throw new Error("Not enough accounts");
|
|
4087
|
-
}
|
|
4088
|
-
let accountIndex = 0;
|
|
4089
|
-
const getNextAccount = () => {
|
|
4090
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
4091
|
-
accountIndex += 1;
|
|
4092
|
-
return accountMeta;
|
|
4093
|
-
};
|
|
4094
|
-
return {
|
|
4095
|
-
programAddress: instruction.programAddress,
|
|
4096
|
-
accounts: {
|
|
4097
|
-
nftOwner: getNextAccount(),
|
|
4098
|
-
nftAccount: getNextAccount(),
|
|
4099
|
-
poolState: getNextAccount(),
|
|
4100
|
-
protocolPosition: getNextAccount(),
|
|
4101
|
-
personalPosition: getNextAccount(),
|
|
4102
|
-
tickArrayLower: getNextAccount(),
|
|
4103
|
-
tickArrayUpper: getNextAccount(),
|
|
4104
|
-
tokenAccount0: getNextAccount(),
|
|
4105
|
-
tokenAccount1: getNextAccount(),
|
|
4106
|
-
tokenVault0: getNextAccount(),
|
|
4107
|
-
tokenVault1: getNextAccount(),
|
|
4108
|
-
tokenProgram: getNextAccount(),
|
|
4109
|
-
tokenProgram2022: getNextAccount(),
|
|
4110
|
-
vault0Mint: getNextAccount(),
|
|
4111
|
-
vault1Mint: getNextAccount()
|
|
4112
|
-
},
|
|
4113
|
-
data: getIncreaseLiquidityV2InstructionDataDecoder().decode(
|
|
4114
|
-
instruction.data
|
|
4115
|
-
)
|
|
4116
|
-
};
|
|
4117
|
-
}
|
|
4118
|
-
|
|
4119
|
-
// src/generated/instructions/initializeReward.ts
|
|
4120
|
-
var import_kit41 = require("@solana/kit");
|
|
4121
|
-
var INITIALIZE_REWARD_DISCRIMINATOR = new Uint8Array([
|
|
4122
|
-
95,
|
|
4123
|
-
135,
|
|
4124
|
-
192,
|
|
4125
|
-
196,
|
|
4126
|
-
242,
|
|
4127
|
-
129,
|
|
4128
|
-
230,
|
|
4129
|
-
68
|
|
4130
|
-
]);
|
|
4131
|
-
function getInitializeRewardDiscriminatorBytes() {
|
|
4132
|
-
return (0, import_kit41.fixEncoderSize)((0, import_kit41.getBytesEncoder)(), 8).encode(
|
|
4133
|
-
INITIALIZE_REWARD_DISCRIMINATOR
|
|
4134
|
-
);
|
|
4135
|
-
}
|
|
4136
|
-
function getInitializeRewardInstructionDataEncoder() {
|
|
4137
|
-
return (0, import_kit41.transformEncoder)(
|
|
4138
|
-
(0, import_kit41.getStructEncoder)([
|
|
4139
|
-
["discriminator", (0, import_kit41.fixEncoderSize)((0, import_kit41.getBytesEncoder)(), 8)],
|
|
4140
|
-
["openTime", (0, import_kit41.getU64Encoder)()],
|
|
4141
|
-
["endTime", (0, import_kit41.getU64Encoder)()],
|
|
4142
|
-
["emissionsPerSecondX64", (0, import_kit41.getU128Encoder)()]
|
|
4143
|
-
]),
|
|
4144
|
-
(value) => ({ ...value, discriminator: INITIALIZE_REWARD_DISCRIMINATOR })
|
|
4145
|
-
);
|
|
4146
|
-
}
|
|
4147
|
-
function getInitializeRewardInstructionDataDecoder() {
|
|
4148
|
-
return (0, import_kit41.getStructDecoder)([
|
|
4149
|
-
["discriminator", (0, import_kit41.fixDecoderSize)((0, import_kit41.getBytesDecoder)(), 8)],
|
|
4150
|
-
["openTime", (0, import_kit41.getU64Decoder)()],
|
|
4151
|
-
["endTime", (0, import_kit41.getU64Decoder)()],
|
|
4152
|
-
["emissionsPerSecondX64", (0, import_kit41.getU128Decoder)()]
|
|
4153
|
-
]);
|
|
4154
|
-
}
|
|
4155
|
-
function getInitializeRewardInstructionDataCodec() {
|
|
4156
|
-
return (0, import_kit41.combineCodec)(
|
|
4157
|
-
getInitializeRewardInstructionDataEncoder(),
|
|
4158
|
-
getInitializeRewardInstructionDataDecoder()
|
|
4159
|
-
);
|
|
4160
|
-
}
|
|
4161
|
-
async function getInitializeRewardInstructionAsync(input, config) {
|
|
4162
|
-
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
4163
|
-
const originalAccounts = {
|
|
4164
|
-
rewardFunder: { value: input.rewardFunder ?? null, isWritable: true },
|
|
4165
|
-
funderTokenAccount: {
|
|
4166
|
-
value: input.funderTokenAccount ?? null,
|
|
4167
|
-
isWritable: true
|
|
4168
|
-
},
|
|
4169
|
-
ammConfig: { value: input.ammConfig ?? null, isWritable: false },
|
|
4170
|
-
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
4171
|
-
operationState: { value: input.operationState ?? null, isWritable: false },
|
|
4172
|
-
rewardTokenMint: {
|
|
4173
|
-
value: input.rewardTokenMint ?? null,
|
|
4174
|
-
isWritable: false
|
|
4175
|
-
},
|
|
4176
|
-
rewardTokenVault: {
|
|
4177
|
-
value: input.rewardTokenVault ?? null,
|
|
4178
|
-
isWritable: true
|
|
4179
|
-
},
|
|
4180
|
-
rewardTokenProgram: {
|
|
4181
|
-
value: input.rewardTokenProgram ?? null,
|
|
4182
|
-
isWritable: false
|
|
4183
|
-
},
|
|
4184
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
4185
|
-
rent: { value: input.rent ?? null, isWritable: false }
|
|
4186
|
-
};
|
|
4187
|
-
const accounts = originalAccounts;
|
|
4188
|
-
const args = { ...input };
|
|
4189
|
-
if (!accounts.operationState.value) {
|
|
4190
|
-
accounts.operationState.value = await (0, import_kit41.getProgramDerivedAddress)({
|
|
4191
|
-
programAddress,
|
|
4192
|
-
seeds: [
|
|
4193
|
-
(0, import_kit41.getBytesEncoder)().encode(
|
|
4194
|
-
new Uint8Array([111, 112, 101, 114, 97, 116, 105, 111, 110])
|
|
4195
|
-
)
|
|
4196
|
-
]
|
|
4197
|
-
});
|
|
4198
|
-
}
|
|
4199
|
-
if (!accounts.rewardTokenVault.value) {
|
|
4200
|
-
accounts.rewardTokenVault.value = await (0, import_kit41.getProgramDerivedAddress)({
|
|
4201
|
-
programAddress,
|
|
4202
|
-
seeds: [
|
|
4203
|
-
(0, import_kit41.getBytesEncoder)().encode(
|
|
4204
|
-
new Uint8Array([
|
|
4205
|
-
112,
|
|
4206
|
-
111,
|
|
4207
|
-
111,
|
|
4208
|
-
108,
|
|
4209
|
-
95,
|
|
4210
|
-
114,
|
|
4211
|
-
101,
|
|
4212
|
-
119,
|
|
4213
|
-
97,
|
|
4214
|
-
114,
|
|
4215
|
-
100,
|
|
4216
|
-
95,
|
|
4217
|
-
118,
|
|
4218
|
-
97,
|
|
4219
|
-
117,
|
|
4220
|
-
108,
|
|
4221
|
-
116
|
|
4222
|
-
])
|
|
4223
|
-
),
|
|
4224
|
-
(0, import_kit41.getAddressEncoder)().encode(expectAddress(accounts.poolState.value)),
|
|
4225
|
-
(0, import_kit41.getAddressEncoder)().encode(
|
|
4226
|
-
expectAddress(accounts.rewardTokenMint.value)
|
|
4227
|
-
)
|
|
4228
|
-
]
|
|
4229
|
-
});
|
|
4230
|
-
}
|
|
4231
|
-
if (!accounts.systemProgram.value) {
|
|
4232
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
4233
|
-
}
|
|
4234
|
-
if (!accounts.rent.value) {
|
|
4235
|
-
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
4236
|
-
}
|
|
4237
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4238
|
-
return Object.freeze({
|
|
4239
|
-
accounts: [
|
|
4240
|
-
getAccountMeta(accounts.rewardFunder),
|
|
4241
|
-
getAccountMeta(accounts.funderTokenAccount),
|
|
4242
|
-
getAccountMeta(accounts.ammConfig),
|
|
4243
|
-
getAccountMeta(accounts.poolState),
|
|
4244
|
-
getAccountMeta(accounts.operationState),
|
|
4245
|
-
getAccountMeta(accounts.rewardTokenMint),
|
|
4246
|
-
getAccountMeta(accounts.rewardTokenVault),
|
|
4247
|
-
getAccountMeta(accounts.rewardTokenProgram),
|
|
4248
|
-
getAccountMeta(accounts.systemProgram),
|
|
4249
|
-
getAccountMeta(accounts.rent)
|
|
4250
|
-
],
|
|
4251
|
-
data: getInitializeRewardInstructionDataEncoder().encode(
|
|
4252
|
-
args
|
|
4253
|
-
),
|
|
4254
|
-
programAddress
|
|
4255
|
-
});
|
|
4256
|
-
}
|
|
4257
|
-
function getInitializeRewardInstruction(input, config) {
|
|
4258
|
-
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
4259
|
-
const originalAccounts = {
|
|
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 },
|
|
4266
|
-
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
4267
|
-
operationState: { value: input.operationState ?? null, isWritable: false },
|
|
4268
|
-
rewardTokenMint: {
|
|
4269
|
-
value: input.rewardTokenMint ?? null,
|
|
4270
|
-
isWritable: false
|
|
4271
|
-
},
|
|
4272
|
-
rewardTokenVault: {
|
|
4273
|
-
value: input.rewardTokenVault ?? null,
|
|
4274
|
-
isWritable: true
|
|
4275
|
-
},
|
|
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 }
|
|
4282
|
-
};
|
|
4283
|
-
const accounts = originalAccounts;
|
|
4284
|
-
const args = { ...input };
|
|
4285
|
-
if (!accounts.systemProgram.value) {
|
|
4286
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
4287
|
-
}
|
|
4288
|
-
if (!accounts.rent.value) {
|
|
4289
|
-
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
4290
|
-
}
|
|
4291
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4292
|
-
return Object.freeze({
|
|
4293
|
-
accounts: [
|
|
4294
|
-
getAccountMeta(accounts.rewardFunder),
|
|
4295
|
-
getAccountMeta(accounts.funderTokenAccount),
|
|
4296
|
-
getAccountMeta(accounts.ammConfig),
|
|
4297
|
-
getAccountMeta(accounts.poolState),
|
|
4298
|
-
getAccountMeta(accounts.operationState),
|
|
4299
|
-
getAccountMeta(accounts.rewardTokenMint),
|
|
4300
|
-
getAccountMeta(accounts.rewardTokenVault),
|
|
4301
|
-
getAccountMeta(accounts.rewardTokenProgram),
|
|
4302
|
-
getAccountMeta(accounts.systemProgram),
|
|
4303
|
-
getAccountMeta(accounts.rent)
|
|
4304
|
-
],
|
|
4305
|
-
data: getInitializeRewardInstructionDataEncoder().encode(
|
|
4306
|
-
args
|
|
4307
|
-
),
|
|
4308
|
-
programAddress
|
|
4309
|
-
});
|
|
4310
|
-
}
|
|
4311
|
-
function parseInitializeRewardInstruction(instruction) {
|
|
4312
|
-
if (instruction.accounts.length < 10) {
|
|
4313
|
-
throw new Error("Not enough accounts");
|
|
4314
|
-
}
|
|
4315
|
-
let accountIndex = 0;
|
|
4316
|
-
const getNextAccount = () => {
|
|
4317
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
4318
|
-
accountIndex += 1;
|
|
4319
|
-
return accountMeta;
|
|
4320
|
-
};
|
|
4321
|
-
return {
|
|
4322
|
-
programAddress: instruction.programAddress,
|
|
4323
|
-
accounts: {
|
|
4324
|
-
rewardFunder: getNextAccount(),
|
|
4325
|
-
funderTokenAccount: getNextAccount(),
|
|
4326
|
-
ammConfig: getNextAccount(),
|
|
4327
|
-
poolState: getNextAccount(),
|
|
4328
|
-
operationState: getNextAccount(),
|
|
4329
|
-
rewardTokenMint: getNextAccount(),
|
|
4330
|
-
rewardTokenVault: getNextAccount(),
|
|
4331
|
-
rewardTokenProgram: getNextAccount(),
|
|
4332
|
-
systemProgram: getNextAccount(),
|
|
4333
|
-
rent: getNextAccount()
|
|
4334
|
-
},
|
|
4335
|
-
data: getInitializeRewardInstructionDataDecoder().decode(instruction.data)
|
|
4336
|
-
};
|
|
4337
|
-
}
|
|
4338
|
-
|
|
4339
|
-
// src/generated/instructions/openPosition.ts
|
|
4340
|
-
var import_kit42 = require("@solana/kit");
|
|
4341
|
-
var OPEN_POSITION_DISCRIMINATOR = new Uint8Array([
|
|
4342
|
-
135,
|
|
4343
|
-
128,
|
|
4344
|
-
47,
|
|
4345
|
-
77,
|
|
4346
|
-
15,
|
|
4347
|
-
152,
|
|
4348
|
-
240,
|
|
4349
|
-
49
|
|
4350
|
-
]);
|
|
4351
|
-
function getOpenPositionDiscriminatorBytes() {
|
|
4352
|
-
return (0, import_kit42.fixEncoderSize)((0, import_kit42.getBytesEncoder)(), 8).encode(
|
|
4353
|
-
OPEN_POSITION_DISCRIMINATOR
|
|
4354
|
-
);
|
|
4355
|
-
}
|
|
4356
|
-
function getOpenPositionInstructionDataEncoder() {
|
|
4357
|
-
return (0, import_kit42.transformEncoder)(
|
|
4358
|
-
(0, import_kit42.getStructEncoder)([
|
|
4359
|
-
["discriminator", (0, import_kit42.fixEncoderSize)((0, import_kit42.getBytesEncoder)(), 8)],
|
|
4360
|
-
["tickLowerIndex", (0, import_kit42.getI32Encoder)()],
|
|
4361
|
-
["tickUpperIndex", (0, import_kit42.getI32Encoder)()],
|
|
4362
|
-
["tickArrayLowerStartIndex", (0, import_kit42.getI32Encoder)()],
|
|
4363
|
-
["tickArrayUpperStartIndex", (0, import_kit42.getI32Encoder)()],
|
|
4364
|
-
["liquidity", (0, import_kit42.getU128Encoder)()],
|
|
4365
|
-
["amount0Max", (0, import_kit42.getU64Encoder)()],
|
|
4366
|
-
["amount1Max", (0, import_kit42.getU64Encoder)()]
|
|
4367
|
-
]),
|
|
4368
|
-
(value) => ({ ...value, discriminator: OPEN_POSITION_DISCRIMINATOR })
|
|
4369
|
-
);
|
|
4370
|
-
}
|
|
4371
|
-
function getOpenPositionInstructionDataDecoder() {
|
|
4372
|
-
return (0, import_kit42.getStructDecoder)([
|
|
4373
|
-
["discriminator", (0, import_kit42.fixDecoderSize)((0, import_kit42.getBytesDecoder)(), 8)],
|
|
4374
|
-
["tickLowerIndex", (0, import_kit42.getI32Decoder)()],
|
|
4375
|
-
["tickUpperIndex", (0, import_kit42.getI32Decoder)()],
|
|
4376
|
-
["tickArrayLowerStartIndex", (0, import_kit42.getI32Decoder)()],
|
|
4377
|
-
["tickArrayUpperStartIndex", (0, import_kit42.getI32Decoder)()],
|
|
4378
|
-
["liquidity", (0, import_kit42.getU128Decoder)()],
|
|
4379
|
-
["amount0Max", (0, import_kit42.getU64Decoder)()],
|
|
4380
|
-
["amount1Max", (0, import_kit42.getU64Decoder)()]
|
|
4381
|
-
]);
|
|
4382
|
-
}
|
|
4383
|
-
function getOpenPositionInstructionDataCodec() {
|
|
4384
|
-
return (0, import_kit42.combineCodec)(
|
|
4385
|
-
getOpenPositionInstructionDataEncoder(),
|
|
4386
|
-
getOpenPositionInstructionDataDecoder()
|
|
4387
|
-
);
|
|
4388
|
-
}
|
|
4389
|
-
async function getOpenPositionInstructionAsync(input, config) {
|
|
4390
|
-
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
4391
|
-
const originalAccounts = {
|
|
4392
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
4393
|
-
positionNftOwner: {
|
|
4394
|
-
value: input.positionNftOwner ?? null,
|
|
4395
|
-
isWritable: false
|
|
4396
|
-
},
|
|
4397
|
-
positionNftMint: { value: input.positionNftMint ?? null, isWritable: true },
|
|
4398
|
-
positionNftAccount: {
|
|
4399
|
-
value: input.positionNftAccount ?? null,
|
|
4400
|
-
isWritable: true
|
|
4401
|
-
},
|
|
4402
|
-
metadataAccount: { value: input.metadataAccount ?? null, isWritable: true },
|
|
4403
|
-
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
4404
|
-
protocolPosition: {
|
|
4405
|
-
value: input.protocolPosition ?? null,
|
|
4406
|
-
isWritable: false
|
|
4407
|
-
},
|
|
4408
|
-
tickArrayLower: { value: input.tickArrayLower ?? null, isWritable: true },
|
|
4409
|
-
tickArrayUpper: { value: input.tickArrayUpper ?? null, isWritable: true },
|
|
4410
|
-
personalPosition: {
|
|
4411
|
-
value: input.personalPosition ?? null,
|
|
4412
|
-
isWritable: true
|
|
4413
|
-
},
|
|
4414
|
-
tokenAccount0: { value: input.tokenAccount0 ?? null, isWritable: true },
|
|
4415
|
-
tokenAccount1: { value: input.tokenAccount1 ?? null, isWritable: true },
|
|
4416
|
-
tokenVault0: { value: input.tokenVault0 ?? null, isWritable: true },
|
|
4417
|
-
tokenVault1: { value: input.tokenVault1 ?? null, isWritable: true },
|
|
4418
|
-
rent: { value: input.rent ?? null, isWritable: false },
|
|
4419
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
4420
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
4421
|
-
associatedTokenProgram: {
|
|
4422
|
-
value: input.associatedTokenProgram ?? null,
|
|
4423
|
-
isWritable: false
|
|
4424
|
-
},
|
|
4425
|
-
metadataProgram: {
|
|
4426
|
-
value: input.metadataProgram ?? null,
|
|
4427
|
-
isWritable: false
|
|
4428
|
-
}
|
|
4429
|
-
};
|
|
4430
|
-
const accounts = originalAccounts;
|
|
4431
|
-
const args = { ...input };
|
|
4432
|
-
if (!accounts.positionNftAccount.value) {
|
|
4433
|
-
accounts.positionNftAccount.value = await (0, import_kit42.getProgramDerivedAddress)({
|
|
4434
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
4435
|
-
seeds: [
|
|
4436
|
-
(0, import_kit42.getAddressEncoder)().encode(
|
|
4437
|
-
expectAddress(accounts.positionNftOwner.value)
|
|
4438
|
-
),
|
|
4439
|
-
(0, import_kit42.getBytesEncoder)().encode(
|
|
4440
|
-
new Uint8Array([
|
|
4441
|
-
6,
|
|
4442
|
-
221,
|
|
4443
|
-
246,
|
|
4444
|
-
225,
|
|
4445
|
-
215,
|
|
4446
|
-
101,
|
|
4447
|
-
161,
|
|
4448
|
-
147,
|
|
4449
|
-
217,
|
|
4450
|
-
203,
|
|
4451
|
-
225,
|
|
4452
|
-
70,
|
|
4453
|
-
206,
|
|
4454
|
-
235,
|
|
4455
|
-
121,
|
|
4456
|
-
172,
|
|
4457
|
-
28,
|
|
4458
|
-
180,
|
|
4459
|
-
133,
|
|
4460
|
-
237,
|
|
4461
|
-
95,
|
|
4462
|
-
91,
|
|
4463
|
-
55,
|
|
4464
|
-
145,
|
|
4465
|
-
58,
|
|
4466
|
-
140,
|
|
4467
|
-
245,
|
|
4468
|
-
133,
|
|
4469
|
-
126,
|
|
4470
|
-
255,
|
|
4471
|
-
0,
|
|
4472
|
-
169
|
|
4473
|
-
])
|
|
4474
|
-
),
|
|
4475
|
-
(0, import_kit42.getAddressEncoder)().encode(
|
|
4476
|
-
expectAddress(accounts.positionNftMint.value)
|
|
4477
|
-
)
|
|
4478
|
-
]
|
|
4479
|
-
});
|
|
4480
|
-
}
|
|
4481
|
-
if (!accounts.tickArrayLower.value) {
|
|
4482
|
-
accounts.tickArrayLower.value = await (0, import_kit42.getProgramDerivedAddress)({
|
|
4483
|
-
programAddress,
|
|
4484
|
-
seeds: [
|
|
4485
|
-
(0, import_kit42.getBytesEncoder)().encode(
|
|
4486
|
-
new Uint8Array([116, 105, 99, 107, 95, 97, 114, 114, 97, 121])
|
|
4487
|
-
),
|
|
4488
|
-
(0, import_kit42.getAddressEncoder)().encode(expectAddress(accounts.poolState.value)),
|
|
4489
|
-
(0, import_kit42.getI32Encoder)().encode(expectSome(args.tickArrayLowerStartIndex))
|
|
4490
|
-
]
|
|
4491
|
-
});
|
|
4492
|
-
}
|
|
4493
|
-
if (!accounts.tickArrayUpper.value) {
|
|
4494
|
-
accounts.tickArrayUpper.value = await (0, import_kit42.getProgramDerivedAddress)({
|
|
4495
|
-
programAddress,
|
|
4496
|
-
seeds: [
|
|
4497
|
-
(0, import_kit42.getBytesEncoder)().encode(
|
|
4498
|
-
new Uint8Array([116, 105, 99, 107, 95, 97, 114, 114, 97, 121])
|
|
4499
|
-
),
|
|
4500
|
-
(0, import_kit42.getAddressEncoder)().encode(expectAddress(accounts.poolState.value)),
|
|
4501
|
-
(0, import_kit42.getI32Encoder)().encode(expectSome(args.tickArrayUpperStartIndex))
|
|
4502
|
-
]
|
|
4503
|
-
});
|
|
4504
|
-
}
|
|
4505
|
-
if (!accounts.personalPosition.value) {
|
|
4506
|
-
accounts.personalPosition.value = await (0, import_kit42.getProgramDerivedAddress)({
|
|
4507
|
-
programAddress,
|
|
4508
|
-
seeds: [
|
|
4509
|
-
(0, import_kit42.getBytesEncoder)().encode(
|
|
4510
|
-
new Uint8Array([112, 111, 115, 105, 116, 105, 111, 110])
|
|
4511
|
-
),
|
|
4512
|
-
(0, import_kit42.getAddressEncoder)().encode(
|
|
4513
|
-
expectAddress(accounts.positionNftMint.value)
|
|
4514
|
-
)
|
|
4515
|
-
]
|
|
4516
|
-
});
|
|
4517
|
-
}
|
|
4518
|
-
if (!accounts.rent.value) {
|
|
4519
|
-
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
4520
|
-
}
|
|
4521
|
-
if (!accounts.systemProgram.value) {
|
|
4522
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
4523
|
-
}
|
|
4524
|
-
if (!accounts.tokenProgram.value) {
|
|
4525
|
-
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
4526
|
-
}
|
|
4527
|
-
if (!accounts.associatedTokenProgram.value) {
|
|
4528
|
-
accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
4529
|
-
}
|
|
4530
|
-
if (!accounts.metadataProgram.value) {
|
|
4531
|
-
accounts.metadataProgram.value = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
|
|
4532
|
-
}
|
|
4533
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4534
|
-
return Object.freeze({
|
|
4535
|
-
accounts: [
|
|
4536
|
-
getAccountMeta(accounts.payer),
|
|
4537
|
-
getAccountMeta(accounts.positionNftOwner),
|
|
4538
|
-
getAccountMeta(accounts.positionNftMint),
|
|
4539
|
-
getAccountMeta(accounts.positionNftAccount),
|
|
4540
|
-
getAccountMeta(accounts.metadataAccount),
|
|
4541
|
-
getAccountMeta(accounts.poolState),
|
|
4542
|
-
getAccountMeta(accounts.protocolPosition),
|
|
4543
|
-
getAccountMeta(accounts.tickArrayLower),
|
|
4544
|
-
getAccountMeta(accounts.tickArrayUpper),
|
|
4545
|
-
getAccountMeta(accounts.personalPosition),
|
|
4546
|
-
getAccountMeta(accounts.tokenAccount0),
|
|
4547
|
-
getAccountMeta(accounts.tokenAccount1),
|
|
4548
|
-
getAccountMeta(accounts.tokenVault0),
|
|
4549
|
-
getAccountMeta(accounts.tokenVault1),
|
|
4550
|
-
getAccountMeta(accounts.rent),
|
|
4551
|
-
getAccountMeta(accounts.systemProgram),
|
|
4552
|
-
getAccountMeta(accounts.tokenProgram),
|
|
4553
|
-
getAccountMeta(accounts.associatedTokenProgram),
|
|
4554
|
-
getAccountMeta(accounts.metadataProgram)
|
|
4555
|
-
],
|
|
4556
|
-
data: getOpenPositionInstructionDataEncoder().encode(
|
|
4557
|
-
args
|
|
4558
|
-
),
|
|
4559
|
-
programAddress
|
|
4560
|
-
});
|
|
4561
|
-
}
|
|
4562
|
-
function getOpenPositionInstruction(input, config) {
|
|
4563
|
-
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
4564
|
-
const originalAccounts = {
|
|
4565
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
4566
|
-
positionNftOwner: {
|
|
4567
|
-
value: input.positionNftOwner ?? null,
|
|
4568
|
-
isWritable: false
|
|
4569
|
-
},
|
|
4570
|
-
positionNftMint: { value: input.positionNftMint ?? null, isWritable: true },
|
|
4571
|
-
positionNftAccount: {
|
|
4572
|
-
value: input.positionNftAccount ?? null,
|
|
4573
|
-
isWritable: true
|
|
4574
|
-
},
|
|
4575
|
-
metadataAccount: { value: input.metadataAccount ?? null, isWritable: true },
|
|
4576
|
-
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
4577
|
-
protocolPosition: {
|
|
4578
|
-
value: input.protocolPosition ?? null,
|
|
4579
|
-
isWritable: false
|
|
4580
|
-
},
|
|
4581
|
-
tickArrayLower: { value: input.tickArrayLower ?? null, isWritable: true },
|
|
4582
|
-
tickArrayUpper: { value: input.tickArrayUpper ?? null, isWritable: true },
|
|
4583
|
-
personalPosition: {
|
|
4584
|
-
value: input.personalPosition ?? null,
|
|
4585
|
-
isWritable: true
|
|
4586
|
-
},
|
|
4587
|
-
tokenAccount0: { value: input.tokenAccount0 ?? null, isWritable: true },
|
|
4588
|
-
tokenAccount1: { value: input.tokenAccount1 ?? null, isWritable: true },
|
|
4589
|
-
tokenVault0: { value: input.tokenVault0 ?? null, isWritable: true },
|
|
4590
|
-
tokenVault1: { value: input.tokenVault1 ?? null, isWritable: true },
|
|
4591
|
-
rent: { value: input.rent ?? null, isWritable: false },
|
|
4592
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
4593
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
4594
|
-
associatedTokenProgram: {
|
|
4595
|
-
value: input.associatedTokenProgram ?? null,
|
|
4596
|
-
isWritable: false
|
|
4597
|
-
},
|
|
4598
|
-
metadataProgram: {
|
|
4599
|
-
value: input.metadataProgram ?? null,
|
|
4600
|
-
isWritable: false
|
|
4601
|
-
}
|
|
4602
|
-
};
|
|
4603
|
-
const accounts = originalAccounts;
|
|
4604
|
-
const args = { ...input };
|
|
4605
|
-
if (!accounts.rent.value) {
|
|
4606
|
-
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
4607
|
-
}
|
|
4608
|
-
if (!accounts.systemProgram.value) {
|
|
4609
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
4610
|
-
}
|
|
4611
|
-
if (!accounts.tokenProgram.value) {
|
|
4612
|
-
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
4613
|
-
}
|
|
4614
|
-
if (!accounts.associatedTokenProgram.value) {
|
|
4615
|
-
accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
4616
|
-
}
|
|
4617
|
-
if (!accounts.metadataProgram.value) {
|
|
4618
|
-
accounts.metadataProgram.value = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
|
|
4619
|
-
}
|
|
4620
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4621
|
-
return Object.freeze({
|
|
4622
|
-
accounts: [
|
|
4623
|
-
getAccountMeta(accounts.payer),
|
|
4624
|
-
getAccountMeta(accounts.positionNftOwner),
|
|
4625
|
-
getAccountMeta(accounts.positionNftMint),
|
|
4626
|
-
getAccountMeta(accounts.positionNftAccount),
|
|
4627
|
-
getAccountMeta(accounts.metadataAccount),
|
|
4628
|
-
getAccountMeta(accounts.poolState),
|
|
4629
|
-
getAccountMeta(accounts.protocolPosition),
|
|
4630
|
-
getAccountMeta(accounts.tickArrayLower),
|
|
4631
|
-
getAccountMeta(accounts.tickArrayUpper),
|
|
4632
|
-
getAccountMeta(accounts.personalPosition),
|
|
4633
|
-
getAccountMeta(accounts.tokenAccount0),
|
|
4634
|
-
getAccountMeta(accounts.tokenAccount1),
|
|
4635
|
-
getAccountMeta(accounts.tokenVault0),
|
|
4636
|
-
getAccountMeta(accounts.tokenVault1),
|
|
4637
|
-
getAccountMeta(accounts.rent),
|
|
4638
|
-
getAccountMeta(accounts.systemProgram),
|
|
4639
|
-
getAccountMeta(accounts.tokenProgram),
|
|
4640
|
-
getAccountMeta(accounts.associatedTokenProgram),
|
|
4641
|
-
getAccountMeta(accounts.metadataProgram)
|
|
4642
|
-
],
|
|
4643
|
-
data: getOpenPositionInstructionDataEncoder().encode(
|
|
4644
|
-
args
|
|
4645
|
-
),
|
|
4646
|
-
programAddress
|
|
4647
|
-
});
|
|
4648
|
-
}
|
|
4649
|
-
function parseOpenPositionInstruction(instruction) {
|
|
4650
|
-
if (instruction.accounts.length < 19) {
|
|
4651
|
-
throw new Error("Not enough accounts");
|
|
4652
|
-
}
|
|
4653
|
-
let accountIndex = 0;
|
|
4654
|
-
const getNextAccount = () => {
|
|
4655
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
4656
|
-
accountIndex += 1;
|
|
4657
|
-
return accountMeta;
|
|
4658
|
-
};
|
|
4659
|
-
return {
|
|
4660
|
-
programAddress: instruction.programAddress,
|
|
4661
|
-
accounts: {
|
|
4662
|
-
payer: getNextAccount(),
|
|
4663
|
-
positionNftOwner: getNextAccount(),
|
|
4664
|
-
positionNftMint: getNextAccount(),
|
|
4665
|
-
positionNftAccount: getNextAccount(),
|
|
4666
|
-
metadataAccount: getNextAccount(),
|
|
4667
|
-
poolState: getNextAccount(),
|
|
4668
|
-
protocolPosition: getNextAccount(),
|
|
4669
|
-
tickArrayLower: getNextAccount(),
|
|
4670
|
-
tickArrayUpper: getNextAccount(),
|
|
4671
|
-
personalPosition: getNextAccount(),
|
|
4672
|
-
tokenAccount0: getNextAccount(),
|
|
4673
|
-
tokenAccount1: getNextAccount(),
|
|
4674
|
-
tokenVault0: getNextAccount(),
|
|
4675
|
-
tokenVault1: getNextAccount(),
|
|
4676
|
-
rent: getNextAccount(),
|
|
4677
|
-
systemProgram: getNextAccount(),
|
|
4678
|
-
tokenProgram: getNextAccount(),
|
|
4679
|
-
associatedTokenProgram: getNextAccount(),
|
|
4680
|
-
metadataProgram: getNextAccount()
|
|
4681
|
-
},
|
|
4682
|
-
data: getOpenPositionInstructionDataDecoder().decode(instruction.data)
|
|
4683
|
-
};
|
|
4684
|
-
}
|
|
4685
|
-
|
|
4686
|
-
// src/generated/instructions/openPositionV2.ts
|
|
4687
|
-
var import_kit43 = require("@solana/kit");
|
|
4688
|
-
var OPEN_POSITION_V2_DISCRIMINATOR = new Uint8Array([
|
|
4689
|
-
77,
|
|
4690
|
-
184,
|
|
4691
|
-
74,
|
|
4692
|
-
214,
|
|
4693
|
-
112,
|
|
4694
|
-
86,
|
|
4695
|
-
241,
|
|
4696
|
-
199
|
|
4697
|
-
]);
|
|
4698
|
-
function getOpenPositionV2DiscriminatorBytes() {
|
|
4699
|
-
return (0, import_kit43.fixEncoderSize)((0, import_kit43.getBytesEncoder)(), 8).encode(
|
|
4700
|
-
OPEN_POSITION_V2_DISCRIMINATOR
|
|
4701
|
-
);
|
|
4702
|
-
}
|
|
4703
|
-
function getOpenPositionV2InstructionDataEncoder() {
|
|
4704
|
-
return (0, import_kit43.transformEncoder)(
|
|
4705
|
-
(0, import_kit43.getStructEncoder)([
|
|
4706
|
-
["discriminator", (0, import_kit43.fixEncoderSize)((0, import_kit43.getBytesEncoder)(), 8)],
|
|
4707
|
-
["tickLowerIndex", (0, import_kit43.getI32Encoder)()],
|
|
4708
|
-
["tickUpperIndex", (0, import_kit43.getI32Encoder)()],
|
|
4709
|
-
["tickArrayLowerStartIndex", (0, import_kit43.getI32Encoder)()],
|
|
4710
|
-
["tickArrayUpperStartIndex", (0, import_kit43.getI32Encoder)()],
|
|
4711
|
-
["liquidity", (0, import_kit43.getU128Encoder)()],
|
|
4712
|
-
["amount0Max", (0, import_kit43.getU64Encoder)()],
|
|
4713
|
-
["amount1Max", (0, import_kit43.getU64Encoder)()],
|
|
4714
|
-
["withMetadata", (0, import_kit43.getBooleanEncoder)()],
|
|
4715
|
-
["baseFlag", (0, import_kit43.getOptionEncoder)((0, import_kit43.getBooleanEncoder)())]
|
|
4716
|
-
]),
|
|
4717
|
-
(value) => ({ ...value, discriminator: OPEN_POSITION_V2_DISCRIMINATOR })
|
|
4718
|
-
);
|
|
4719
|
-
}
|
|
4720
|
-
function getOpenPositionV2InstructionDataDecoder() {
|
|
4721
|
-
return (0, import_kit43.getStructDecoder)([
|
|
4722
|
-
["discriminator", (0, import_kit43.fixDecoderSize)((0, import_kit43.getBytesDecoder)(), 8)],
|
|
4723
|
-
["tickLowerIndex", (0, import_kit43.getI32Decoder)()],
|
|
4724
|
-
["tickUpperIndex", (0, import_kit43.getI32Decoder)()],
|
|
4725
|
-
["tickArrayLowerStartIndex", (0, import_kit43.getI32Decoder)()],
|
|
4726
|
-
["tickArrayUpperStartIndex", (0, import_kit43.getI32Decoder)()],
|
|
4727
|
-
["liquidity", (0, import_kit43.getU128Decoder)()],
|
|
4728
|
-
["amount0Max", (0, import_kit43.getU64Decoder)()],
|
|
4729
|
-
["amount1Max", (0, import_kit43.getU64Decoder)()],
|
|
4730
|
-
["withMetadata", (0, import_kit43.getBooleanDecoder)()],
|
|
4731
|
-
["baseFlag", (0, import_kit43.getOptionDecoder)((0, import_kit43.getBooleanDecoder)())]
|
|
4732
|
-
]);
|
|
4733
|
-
}
|
|
4734
|
-
function getOpenPositionV2InstructionDataCodec() {
|
|
4735
|
-
return (0, import_kit43.combineCodec)(
|
|
4736
|
-
getOpenPositionV2InstructionDataEncoder(),
|
|
4737
|
-
getOpenPositionV2InstructionDataDecoder()
|
|
4738
|
-
);
|
|
4739
|
-
}
|
|
4740
|
-
async function getOpenPositionV2InstructionAsync(input, config) {
|
|
4741
|
-
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
4742
|
-
const originalAccounts = {
|
|
4743
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
4744
|
-
positionNftOwner: {
|
|
4745
|
-
value: input.positionNftOwner ?? null,
|
|
4746
|
-
isWritable: false
|
|
4747
|
-
},
|
|
4748
|
-
positionNftMint: { value: input.positionNftMint ?? null, isWritable: true },
|
|
4749
|
-
positionNftAccount: {
|
|
4750
|
-
value: input.positionNftAccount ?? null,
|
|
4751
|
-
isWritable: true
|
|
4752
|
-
},
|
|
4753
|
-
metadataAccount: { value: input.metadataAccount ?? null, isWritable: true },
|
|
4754
|
-
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
4755
|
-
protocolPosition: {
|
|
4756
|
-
value: input.protocolPosition ?? null,
|
|
4757
|
-
isWritable: false
|
|
4758
|
-
},
|
|
4759
|
-
tickArrayLower: { value: input.tickArrayLower ?? null, isWritable: true },
|
|
4760
|
-
tickArrayUpper: { value: input.tickArrayUpper ?? null, isWritable: true },
|
|
4761
|
-
personalPosition: {
|
|
4762
|
-
value: input.personalPosition ?? null,
|
|
4763
|
-
isWritable: true
|
|
4764
|
-
},
|
|
4765
|
-
tokenAccount0: { value: input.tokenAccount0 ?? null, isWritable: true },
|
|
4766
|
-
tokenAccount1: { value: input.tokenAccount1 ?? null, isWritable: true },
|
|
4767
|
-
tokenVault0: { value: input.tokenVault0 ?? null, isWritable: true },
|
|
4768
|
-
tokenVault1: { value: input.tokenVault1 ?? null, isWritable: true },
|
|
4769
|
-
rent: { value: input.rent ?? null, isWritable: false },
|
|
4770
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
4771
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
4772
|
-
associatedTokenProgram: {
|
|
4773
|
-
value: input.associatedTokenProgram ?? null,
|
|
4774
|
-
isWritable: false
|
|
4775
|
-
},
|
|
4776
|
-
metadataProgram: {
|
|
4777
|
-
value: input.metadataProgram ?? null,
|
|
4778
|
-
isWritable: false
|
|
4779
|
-
},
|
|
4780
|
-
tokenProgram2022: {
|
|
4781
|
-
value: input.tokenProgram2022 ?? null,
|
|
4782
|
-
isWritable: false
|
|
4783
|
-
},
|
|
4784
|
-
vault0Mint: { value: input.vault0Mint ?? null, isWritable: false },
|
|
4785
|
-
vault1Mint: { value: input.vault1Mint ?? null, isWritable: false }
|
|
4786
|
-
};
|
|
4787
|
-
const accounts = originalAccounts;
|
|
4788
|
-
const args = { ...input };
|
|
4789
|
-
if (!accounts.positionNftAccount.value) {
|
|
4790
|
-
accounts.positionNftAccount.value = await (0, import_kit43.getProgramDerivedAddress)({
|
|
4791
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
3865
|
+
if (!accounts.rewardTokenVault.value) {
|
|
3866
|
+
accounts.rewardTokenVault.value = await (0, import_kit39.getProgramDerivedAddress)({
|
|
3867
|
+
programAddress,
|
|
4792
3868
|
seeds: [
|
|
4793
|
-
(0,
|
|
4794
|
-
expectAddress(accounts.positionNftOwner.value)
|
|
4795
|
-
),
|
|
4796
|
-
(0, import_kit43.getBytesEncoder)().encode(
|
|
3869
|
+
(0, import_kit39.getBytesEncoder)().encode(
|
|
4797
3870
|
new Uint8Array([
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
3871
|
+
112,
|
|
3872
|
+
111,
|
|
3873
|
+
111,
|
|
3874
|
+
108,
|
|
3875
|
+
95,
|
|
3876
|
+
114,
|
|
4803
3877
|
101,
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
225,
|
|
4809
|
-
70,
|
|
4810
|
-
206,
|
|
4811
|
-
235,
|
|
4812
|
-
121,
|
|
4813
|
-
172,
|
|
4814
|
-
28,
|
|
4815
|
-
180,
|
|
4816
|
-
133,
|
|
4817
|
-
237,
|
|
3878
|
+
119,
|
|
3879
|
+
97,
|
|
3880
|
+
114,
|
|
3881
|
+
100,
|
|
4818
3882
|
95,
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
245,
|
|
4825
|
-
133,
|
|
4826
|
-
126,
|
|
4827
|
-
255,
|
|
4828
|
-
0,
|
|
4829
|
-
169
|
|
3883
|
+
118,
|
|
3884
|
+
97,
|
|
3885
|
+
117,
|
|
3886
|
+
108,
|
|
3887
|
+
116
|
|
4830
3888
|
])
|
|
4831
3889
|
),
|
|
4832
|
-
(0,
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
]
|
|
4836
|
-
});
|
|
4837
|
-
}
|
|
4838
|
-
if (!accounts.tickArrayLower.value) {
|
|
4839
|
-
accounts.tickArrayLower.value = await (0, import_kit43.getProgramDerivedAddress)({
|
|
4840
|
-
programAddress,
|
|
4841
|
-
seeds: [
|
|
4842
|
-
(0, import_kit43.getBytesEncoder)().encode(
|
|
4843
|
-
new Uint8Array([116, 105, 99, 107, 95, 97, 114, 114, 97, 121])
|
|
4844
|
-
),
|
|
4845
|
-
(0, import_kit43.getAddressEncoder)().encode(expectAddress(accounts.poolState.value)),
|
|
4846
|
-
(0, import_kit43.getI32Encoder)().encode(expectSome(args.tickArrayLowerStartIndex))
|
|
4847
|
-
]
|
|
4848
|
-
});
|
|
4849
|
-
}
|
|
4850
|
-
if (!accounts.tickArrayUpper.value) {
|
|
4851
|
-
accounts.tickArrayUpper.value = await (0, import_kit43.getProgramDerivedAddress)({
|
|
4852
|
-
programAddress,
|
|
4853
|
-
seeds: [
|
|
4854
|
-
(0, import_kit43.getBytesEncoder)().encode(
|
|
4855
|
-
new Uint8Array([116, 105, 99, 107, 95, 97, 114, 114, 97, 121])
|
|
4856
|
-
),
|
|
4857
|
-
(0, import_kit43.getAddressEncoder)().encode(expectAddress(accounts.poolState.value)),
|
|
4858
|
-
(0, import_kit43.getI32Encoder)().encode(expectSome(args.tickArrayUpperStartIndex))
|
|
4859
|
-
]
|
|
4860
|
-
});
|
|
4861
|
-
}
|
|
4862
|
-
if (!accounts.personalPosition.value) {
|
|
4863
|
-
accounts.personalPosition.value = await (0, import_kit43.getProgramDerivedAddress)({
|
|
4864
|
-
programAddress,
|
|
4865
|
-
seeds: [
|
|
4866
|
-
(0, import_kit43.getBytesEncoder)().encode(
|
|
4867
|
-
new Uint8Array([112, 111, 115, 105, 116, 105, 111, 110])
|
|
4868
|
-
),
|
|
4869
|
-
(0, import_kit43.getAddressEncoder)().encode(
|
|
4870
|
-
expectAddress(accounts.positionNftMint.value)
|
|
3890
|
+
(0, import_kit39.getAddressEncoder)().encode(expectAddress(accounts.poolState.value)),
|
|
3891
|
+
(0, import_kit39.getAddressEncoder)().encode(
|
|
3892
|
+
expectAddress(accounts.rewardTokenMint.value)
|
|
4871
3893
|
)
|
|
4872
3894
|
]
|
|
4873
3895
|
});
|
|
4874
3896
|
}
|
|
4875
|
-
if (!accounts.rent.value) {
|
|
4876
|
-
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
4877
|
-
}
|
|
4878
3897
|
if (!accounts.systemProgram.value) {
|
|
4879
3898
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
4880
3899
|
}
|
|
4881
|
-
if (!accounts.
|
|
4882
|
-
accounts.
|
|
4883
|
-
}
|
|
4884
|
-
if (!accounts.associatedTokenProgram.value) {
|
|
4885
|
-
accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
4886
|
-
}
|
|
4887
|
-
if (!accounts.metadataProgram.value) {
|
|
4888
|
-
accounts.metadataProgram.value = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
|
|
4889
|
-
}
|
|
4890
|
-
if (!accounts.tokenProgram2022.value) {
|
|
4891
|
-
accounts.tokenProgram2022.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
3900
|
+
if (!accounts.rent.value) {
|
|
3901
|
+
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
4892
3902
|
}
|
|
4893
3903
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4894
3904
|
return Object.freeze({
|
|
4895
3905
|
accounts: [
|
|
4896
|
-
getAccountMeta(accounts.
|
|
4897
|
-
getAccountMeta(accounts.
|
|
4898
|
-
getAccountMeta(accounts.
|
|
4899
|
-
getAccountMeta(accounts.positionNftAccount),
|
|
4900
|
-
getAccountMeta(accounts.metadataAccount),
|
|
3906
|
+
getAccountMeta(accounts.rewardFunder),
|
|
3907
|
+
getAccountMeta(accounts.funderTokenAccount),
|
|
3908
|
+
getAccountMeta(accounts.ammConfig),
|
|
4901
3909
|
getAccountMeta(accounts.poolState),
|
|
4902
|
-
getAccountMeta(accounts.
|
|
4903
|
-
getAccountMeta(accounts.
|
|
4904
|
-
getAccountMeta(accounts.
|
|
4905
|
-
getAccountMeta(accounts.
|
|
4906
|
-
getAccountMeta(accounts.tokenAccount0),
|
|
4907
|
-
getAccountMeta(accounts.tokenAccount1),
|
|
4908
|
-
getAccountMeta(accounts.tokenVault0),
|
|
4909
|
-
getAccountMeta(accounts.tokenVault1),
|
|
4910
|
-
getAccountMeta(accounts.rent),
|
|
3910
|
+
getAccountMeta(accounts.operationState),
|
|
3911
|
+
getAccountMeta(accounts.rewardTokenMint),
|
|
3912
|
+
getAccountMeta(accounts.rewardTokenVault),
|
|
3913
|
+
getAccountMeta(accounts.rewardTokenProgram),
|
|
4911
3914
|
getAccountMeta(accounts.systemProgram),
|
|
4912
|
-
getAccountMeta(accounts.
|
|
4913
|
-
getAccountMeta(accounts.associatedTokenProgram),
|
|
4914
|
-
getAccountMeta(accounts.metadataProgram),
|
|
4915
|
-
getAccountMeta(accounts.tokenProgram2022),
|
|
4916
|
-
getAccountMeta(accounts.vault0Mint),
|
|
4917
|
-
getAccountMeta(accounts.vault1Mint)
|
|
3915
|
+
getAccountMeta(accounts.rent)
|
|
4918
3916
|
],
|
|
4919
|
-
data:
|
|
3917
|
+
data: getInitializeRewardInstructionDataEncoder().encode(
|
|
4920
3918
|
args
|
|
4921
3919
|
),
|
|
4922
3920
|
programAddress
|
|
4923
3921
|
});
|
|
4924
3922
|
}
|
|
4925
|
-
function
|
|
3923
|
+
function getInitializeRewardInstruction(input, config) {
|
|
4926
3924
|
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
4927
3925
|
const originalAccounts = {
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
value: input.
|
|
4931
|
-
isWritable: false
|
|
4932
|
-
},
|
|
4933
|
-
positionNftMint: { value: input.positionNftMint ?? null, isWritable: true },
|
|
4934
|
-
positionNftAccount: {
|
|
4935
|
-
value: input.positionNftAccount ?? null,
|
|
3926
|
+
rewardFunder: { value: input.rewardFunder ?? null, isWritable: true },
|
|
3927
|
+
funderTokenAccount: {
|
|
3928
|
+
value: input.funderTokenAccount ?? null,
|
|
4936
3929
|
isWritable: true
|
|
4937
3930
|
},
|
|
4938
|
-
|
|
3931
|
+
ammConfig: { value: input.ammConfig ?? null, isWritable: false },
|
|
4939
3932
|
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
4940
|
-
|
|
4941
|
-
|
|
3933
|
+
operationState: { value: input.operationState ?? null, isWritable: false },
|
|
3934
|
+
rewardTokenMint: {
|
|
3935
|
+
value: input.rewardTokenMint ?? null,
|
|
4942
3936
|
isWritable: false
|
|
4943
3937
|
},
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
personalPosition: {
|
|
4947
|
-
value: input.personalPosition ?? null,
|
|
3938
|
+
rewardTokenVault: {
|
|
3939
|
+
value: input.rewardTokenVault ?? null,
|
|
4948
3940
|
isWritable: true
|
|
4949
3941
|
},
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
tokenVault0: { value: input.tokenVault0 ?? null, isWritable: true },
|
|
4953
|
-
tokenVault1: { value: input.tokenVault1 ?? null, isWritable: true },
|
|
4954
|
-
rent: { value: input.rent ?? null, isWritable: false },
|
|
4955
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
4956
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
4957
|
-
associatedTokenProgram: {
|
|
4958
|
-
value: input.associatedTokenProgram ?? null,
|
|
4959
|
-
isWritable: false
|
|
4960
|
-
},
|
|
4961
|
-
metadataProgram: {
|
|
4962
|
-
value: input.metadataProgram ?? null,
|
|
4963
|
-
isWritable: false
|
|
4964
|
-
},
|
|
4965
|
-
tokenProgram2022: {
|
|
4966
|
-
value: input.tokenProgram2022 ?? null,
|
|
3942
|
+
rewardTokenProgram: {
|
|
3943
|
+
value: input.rewardTokenProgram ?? null,
|
|
4967
3944
|
isWritable: false
|
|
4968
3945
|
},
|
|
4969
|
-
|
|
4970
|
-
|
|
3946
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
3947
|
+
rent: { value: input.rent ?? null, isWritable: false }
|
|
4971
3948
|
};
|
|
4972
3949
|
const accounts = originalAccounts;
|
|
4973
3950
|
const args = { ...input };
|
|
4974
|
-
if (!accounts.rent.value) {
|
|
4975
|
-
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
4976
|
-
}
|
|
4977
3951
|
if (!accounts.systemProgram.value) {
|
|
4978
3952
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
4979
3953
|
}
|
|
4980
|
-
if (!accounts.
|
|
4981
|
-
accounts.
|
|
4982
|
-
}
|
|
4983
|
-
if (!accounts.associatedTokenProgram.value) {
|
|
4984
|
-
accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
4985
|
-
}
|
|
4986
|
-
if (!accounts.metadataProgram.value) {
|
|
4987
|
-
accounts.metadataProgram.value = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
|
|
4988
|
-
}
|
|
4989
|
-
if (!accounts.tokenProgram2022.value) {
|
|
4990
|
-
accounts.tokenProgram2022.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
3954
|
+
if (!accounts.rent.value) {
|
|
3955
|
+
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
4991
3956
|
}
|
|
4992
3957
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
4993
3958
|
return Object.freeze({
|
|
4994
3959
|
accounts: [
|
|
4995
|
-
getAccountMeta(accounts.
|
|
4996
|
-
getAccountMeta(accounts.
|
|
4997
|
-
getAccountMeta(accounts.
|
|
4998
|
-
getAccountMeta(accounts.positionNftAccount),
|
|
4999
|
-
getAccountMeta(accounts.metadataAccount),
|
|
3960
|
+
getAccountMeta(accounts.rewardFunder),
|
|
3961
|
+
getAccountMeta(accounts.funderTokenAccount),
|
|
3962
|
+
getAccountMeta(accounts.ammConfig),
|
|
5000
3963
|
getAccountMeta(accounts.poolState),
|
|
5001
|
-
getAccountMeta(accounts.
|
|
5002
|
-
getAccountMeta(accounts.
|
|
5003
|
-
getAccountMeta(accounts.
|
|
5004
|
-
getAccountMeta(accounts.
|
|
5005
|
-
getAccountMeta(accounts.tokenAccount0),
|
|
5006
|
-
getAccountMeta(accounts.tokenAccount1),
|
|
5007
|
-
getAccountMeta(accounts.tokenVault0),
|
|
5008
|
-
getAccountMeta(accounts.tokenVault1),
|
|
5009
|
-
getAccountMeta(accounts.rent),
|
|
3964
|
+
getAccountMeta(accounts.operationState),
|
|
3965
|
+
getAccountMeta(accounts.rewardTokenMint),
|
|
3966
|
+
getAccountMeta(accounts.rewardTokenVault),
|
|
3967
|
+
getAccountMeta(accounts.rewardTokenProgram),
|
|
5010
3968
|
getAccountMeta(accounts.systemProgram),
|
|
5011
|
-
getAccountMeta(accounts.
|
|
5012
|
-
getAccountMeta(accounts.associatedTokenProgram),
|
|
5013
|
-
getAccountMeta(accounts.metadataProgram),
|
|
5014
|
-
getAccountMeta(accounts.tokenProgram2022),
|
|
5015
|
-
getAccountMeta(accounts.vault0Mint),
|
|
5016
|
-
getAccountMeta(accounts.vault1Mint)
|
|
3969
|
+
getAccountMeta(accounts.rent)
|
|
5017
3970
|
],
|
|
5018
|
-
data:
|
|
3971
|
+
data: getInitializeRewardInstructionDataEncoder().encode(
|
|
5019
3972
|
args
|
|
5020
3973
|
),
|
|
5021
3974
|
programAddress
|
|
5022
3975
|
});
|
|
5023
3976
|
}
|
|
5024
|
-
function
|
|
5025
|
-
if (instruction.accounts.length <
|
|
3977
|
+
function parseInitializeRewardInstruction(instruction) {
|
|
3978
|
+
if (instruction.accounts.length < 10) {
|
|
5026
3979
|
throw new Error("Not enough accounts");
|
|
5027
3980
|
}
|
|
5028
3981
|
let accountIndex = 0;
|
|
@@ -5034,35 +3987,23 @@ function parseOpenPositionV2Instruction(instruction) {
|
|
|
5034
3987
|
return {
|
|
5035
3988
|
programAddress: instruction.programAddress,
|
|
5036
3989
|
accounts: {
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
positionNftAccount: getNextAccount(),
|
|
5041
|
-
metadataAccount: getNextAccount(),
|
|
3990
|
+
rewardFunder: getNextAccount(),
|
|
3991
|
+
funderTokenAccount: getNextAccount(),
|
|
3992
|
+
ammConfig: getNextAccount(),
|
|
5042
3993
|
poolState: getNextAccount(),
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
tokenAccount0: getNextAccount(),
|
|
5048
|
-
tokenAccount1: getNextAccount(),
|
|
5049
|
-
tokenVault0: getNextAccount(),
|
|
5050
|
-
tokenVault1: getNextAccount(),
|
|
5051
|
-
rent: getNextAccount(),
|
|
3994
|
+
operationState: getNextAccount(),
|
|
3995
|
+
rewardTokenMint: getNextAccount(),
|
|
3996
|
+
rewardTokenVault: getNextAccount(),
|
|
3997
|
+
rewardTokenProgram: getNextAccount(),
|
|
5052
3998
|
systemProgram: getNextAccount(),
|
|
5053
|
-
|
|
5054
|
-
associatedTokenProgram: getNextAccount(),
|
|
5055
|
-
metadataProgram: getNextAccount(),
|
|
5056
|
-
tokenProgram2022: getNextAccount(),
|
|
5057
|
-
vault0Mint: getNextAccount(),
|
|
5058
|
-
vault1Mint: getNextAccount()
|
|
3999
|
+
rent: getNextAccount()
|
|
5059
4000
|
},
|
|
5060
|
-
data:
|
|
4001
|
+
data: getInitializeRewardInstructionDataDecoder().decode(instruction.data)
|
|
5061
4002
|
};
|
|
5062
4003
|
}
|
|
5063
4004
|
|
|
5064
4005
|
// src/generated/instructions/openPositionWithToken22Nft.ts
|
|
5065
|
-
var
|
|
4006
|
+
var import_kit40 = require("@solana/kit");
|
|
5066
4007
|
var OPEN_POSITION_WITH_TOKEN22_NFT_DISCRIMINATOR = new Uint8Array([
|
|
5067
4008
|
77,
|
|
5068
4009
|
255,
|
|
@@ -5074,23 +4015,23 @@ var OPEN_POSITION_WITH_TOKEN22_NFT_DISCRIMINATOR = new Uint8Array([
|
|
|
5074
4015
|
46
|
|
5075
4016
|
]);
|
|
5076
4017
|
function getOpenPositionWithToken22NftDiscriminatorBytes() {
|
|
5077
|
-
return (0,
|
|
4018
|
+
return (0, import_kit40.fixEncoderSize)((0, import_kit40.getBytesEncoder)(), 8).encode(
|
|
5078
4019
|
OPEN_POSITION_WITH_TOKEN22_NFT_DISCRIMINATOR
|
|
5079
4020
|
);
|
|
5080
4021
|
}
|
|
5081
4022
|
function getOpenPositionWithToken22NftInstructionDataEncoder() {
|
|
5082
|
-
return (0,
|
|
5083
|
-
(0,
|
|
5084
|
-
["discriminator", (0,
|
|
5085
|
-
["tickLowerIndex", (0,
|
|
5086
|
-
["tickUpperIndex", (0,
|
|
5087
|
-
["tickArrayLowerStartIndex", (0,
|
|
5088
|
-
["tickArrayUpperStartIndex", (0,
|
|
5089
|
-
["liquidity", (0,
|
|
5090
|
-
["amount0Max", (0,
|
|
5091
|
-
["amount1Max", (0,
|
|
5092
|
-
["withMetadata", (0,
|
|
5093
|
-
["baseFlag", (0,
|
|
4023
|
+
return (0, import_kit40.transformEncoder)(
|
|
4024
|
+
(0, import_kit40.getStructEncoder)([
|
|
4025
|
+
["discriminator", (0, import_kit40.fixEncoderSize)((0, import_kit40.getBytesEncoder)(), 8)],
|
|
4026
|
+
["tickLowerIndex", (0, import_kit40.getI32Encoder)()],
|
|
4027
|
+
["tickUpperIndex", (0, import_kit40.getI32Encoder)()],
|
|
4028
|
+
["tickArrayLowerStartIndex", (0, import_kit40.getI32Encoder)()],
|
|
4029
|
+
["tickArrayUpperStartIndex", (0, import_kit40.getI32Encoder)()],
|
|
4030
|
+
["liquidity", (0, import_kit40.getU128Encoder)()],
|
|
4031
|
+
["amount0Max", (0, import_kit40.getU64Encoder)()],
|
|
4032
|
+
["amount1Max", (0, import_kit40.getU64Encoder)()],
|
|
4033
|
+
["withMetadata", (0, import_kit40.getBooleanEncoder)()],
|
|
4034
|
+
["baseFlag", (0, import_kit40.getOptionEncoder)((0, import_kit40.getBooleanEncoder)())]
|
|
5094
4035
|
]),
|
|
5095
4036
|
(value) => ({
|
|
5096
4037
|
...value,
|
|
@@ -5099,21 +4040,21 @@ function getOpenPositionWithToken22NftInstructionDataEncoder() {
|
|
|
5099
4040
|
);
|
|
5100
4041
|
}
|
|
5101
4042
|
function getOpenPositionWithToken22NftInstructionDataDecoder() {
|
|
5102
|
-
return (0,
|
|
5103
|
-
["discriminator", (0,
|
|
5104
|
-
["tickLowerIndex", (0,
|
|
5105
|
-
["tickUpperIndex", (0,
|
|
5106
|
-
["tickArrayLowerStartIndex", (0,
|
|
5107
|
-
["tickArrayUpperStartIndex", (0,
|
|
5108
|
-
["liquidity", (0,
|
|
5109
|
-
["amount0Max", (0,
|
|
5110
|
-
["amount1Max", (0,
|
|
5111
|
-
["withMetadata", (0,
|
|
5112
|
-
["baseFlag", (0,
|
|
4043
|
+
return (0, import_kit40.getStructDecoder)([
|
|
4044
|
+
["discriminator", (0, import_kit40.fixDecoderSize)((0, import_kit40.getBytesDecoder)(), 8)],
|
|
4045
|
+
["tickLowerIndex", (0, import_kit40.getI32Decoder)()],
|
|
4046
|
+
["tickUpperIndex", (0, import_kit40.getI32Decoder)()],
|
|
4047
|
+
["tickArrayLowerStartIndex", (0, import_kit40.getI32Decoder)()],
|
|
4048
|
+
["tickArrayUpperStartIndex", (0, import_kit40.getI32Decoder)()],
|
|
4049
|
+
["liquidity", (0, import_kit40.getU128Decoder)()],
|
|
4050
|
+
["amount0Max", (0, import_kit40.getU64Decoder)()],
|
|
4051
|
+
["amount1Max", (0, import_kit40.getU64Decoder)()],
|
|
4052
|
+
["withMetadata", (0, import_kit40.getBooleanDecoder)()],
|
|
4053
|
+
["baseFlag", (0, import_kit40.getOptionDecoder)((0, import_kit40.getBooleanDecoder)())]
|
|
5113
4054
|
]);
|
|
5114
4055
|
}
|
|
5115
4056
|
function getOpenPositionWithToken22NftInstructionDataCodec() {
|
|
5116
|
-
return (0,
|
|
4057
|
+
return (0, import_kit40.combineCodec)(
|
|
5117
4058
|
getOpenPositionWithToken22NftInstructionDataEncoder(),
|
|
5118
4059
|
getOpenPositionWithToken22NftInstructionDataDecoder()
|
|
5119
4060
|
);
|
|
@@ -5163,37 +4104,37 @@ async function getOpenPositionWithToken22NftInstructionAsync(input, config) {
|
|
|
5163
4104
|
const accounts = originalAccounts;
|
|
5164
4105
|
const args = { ...input };
|
|
5165
4106
|
if (!accounts.tickArrayLower.value) {
|
|
5166
|
-
accounts.tickArrayLower.value = await (0,
|
|
4107
|
+
accounts.tickArrayLower.value = await (0, import_kit40.getProgramDerivedAddress)({
|
|
5167
4108
|
programAddress,
|
|
5168
4109
|
seeds: [
|
|
5169
|
-
(0,
|
|
4110
|
+
(0, import_kit40.getBytesEncoder)().encode(
|
|
5170
4111
|
new Uint8Array([116, 105, 99, 107, 95, 97, 114, 114, 97, 121])
|
|
5171
4112
|
),
|
|
5172
|
-
(0,
|
|
5173
|
-
(0,
|
|
4113
|
+
(0, import_kit40.getAddressEncoder)().encode(expectAddress(accounts.poolState.value)),
|
|
4114
|
+
(0, import_kit40.getI32Encoder)().encode(expectSome(args.tickArrayLowerStartIndex))
|
|
5174
4115
|
]
|
|
5175
4116
|
});
|
|
5176
4117
|
}
|
|
5177
4118
|
if (!accounts.tickArrayUpper.value) {
|
|
5178
|
-
accounts.tickArrayUpper.value = await (0,
|
|
4119
|
+
accounts.tickArrayUpper.value = await (0, import_kit40.getProgramDerivedAddress)({
|
|
5179
4120
|
programAddress,
|
|
5180
4121
|
seeds: [
|
|
5181
|
-
(0,
|
|
4122
|
+
(0, import_kit40.getBytesEncoder)().encode(
|
|
5182
4123
|
new Uint8Array([116, 105, 99, 107, 95, 97, 114, 114, 97, 121])
|
|
5183
4124
|
),
|
|
5184
|
-
(0,
|
|
5185
|
-
(0,
|
|
4125
|
+
(0, import_kit40.getAddressEncoder)().encode(expectAddress(accounts.poolState.value)),
|
|
4126
|
+
(0, import_kit40.getI32Encoder)().encode(expectSome(args.tickArrayUpperStartIndex))
|
|
5186
4127
|
]
|
|
5187
4128
|
});
|
|
5188
4129
|
}
|
|
5189
4130
|
if (!accounts.personalPosition.value) {
|
|
5190
|
-
accounts.personalPosition.value = await (0,
|
|
4131
|
+
accounts.personalPosition.value = await (0, import_kit40.getProgramDerivedAddress)({
|
|
5191
4132
|
programAddress,
|
|
5192
4133
|
seeds: [
|
|
5193
|
-
(0,
|
|
4134
|
+
(0, import_kit40.getBytesEncoder)().encode(
|
|
5194
4135
|
new Uint8Array([112, 111, 115, 105, 116, 105, 111, 110])
|
|
5195
4136
|
),
|
|
5196
|
-
(0,
|
|
4137
|
+
(0, import_kit40.getAddressEncoder)().encode(
|
|
5197
4138
|
expectAddress(accounts.positionNftMint.value)
|
|
5198
4139
|
)
|
|
5199
4140
|
]
|
|
@@ -5374,7 +4315,7 @@ function parseOpenPositionWithToken22NftInstruction(instruction) {
|
|
|
5374
4315
|
}
|
|
5375
4316
|
|
|
5376
4317
|
// src/generated/instructions/setRewardParams.ts
|
|
5377
|
-
var
|
|
4318
|
+
var import_kit41 = require("@solana/kit");
|
|
5378
4319
|
var SET_REWARD_PARAMS_DISCRIMINATOR = new Uint8Array([
|
|
5379
4320
|
112,
|
|
5380
4321
|
52,
|
|
@@ -5386,33 +4327,33 @@ var SET_REWARD_PARAMS_DISCRIMINATOR = new Uint8Array([
|
|
|
5386
4327
|
137
|
|
5387
4328
|
]);
|
|
5388
4329
|
function getSetRewardParamsDiscriminatorBytes() {
|
|
5389
|
-
return (0,
|
|
4330
|
+
return (0, import_kit41.fixEncoderSize)((0, import_kit41.getBytesEncoder)(), 8).encode(
|
|
5390
4331
|
SET_REWARD_PARAMS_DISCRIMINATOR
|
|
5391
4332
|
);
|
|
5392
4333
|
}
|
|
5393
4334
|
function getSetRewardParamsInstructionDataEncoder() {
|
|
5394
|
-
return (0,
|
|
5395
|
-
(0,
|
|
5396
|
-
["discriminator", (0,
|
|
5397
|
-
["rewardIndex", (0,
|
|
5398
|
-
["emissionsPerSecondX64", (0,
|
|
5399
|
-
["openTime", (0,
|
|
5400
|
-
["endTime", (0,
|
|
4335
|
+
return (0, import_kit41.transformEncoder)(
|
|
4336
|
+
(0, import_kit41.getStructEncoder)([
|
|
4337
|
+
["discriminator", (0, import_kit41.fixEncoderSize)((0, import_kit41.getBytesEncoder)(), 8)],
|
|
4338
|
+
["rewardIndex", (0, import_kit41.getU8Encoder)()],
|
|
4339
|
+
["emissionsPerSecondX64", (0, import_kit41.getU128Encoder)()],
|
|
4340
|
+
["openTime", (0, import_kit41.getU64Encoder)()],
|
|
4341
|
+
["endTime", (0, import_kit41.getU64Encoder)()]
|
|
5401
4342
|
]),
|
|
5402
4343
|
(value) => ({ ...value, discriminator: SET_REWARD_PARAMS_DISCRIMINATOR })
|
|
5403
4344
|
);
|
|
5404
4345
|
}
|
|
5405
4346
|
function getSetRewardParamsInstructionDataDecoder() {
|
|
5406
|
-
return (0,
|
|
5407
|
-
["discriminator", (0,
|
|
5408
|
-
["rewardIndex", (0,
|
|
5409
|
-
["emissionsPerSecondX64", (0,
|
|
5410
|
-
["openTime", (0,
|
|
5411
|
-
["endTime", (0,
|
|
4347
|
+
return (0, import_kit41.getStructDecoder)([
|
|
4348
|
+
["discriminator", (0, import_kit41.fixDecoderSize)((0, import_kit41.getBytesDecoder)(), 8)],
|
|
4349
|
+
["rewardIndex", (0, import_kit41.getU8Decoder)()],
|
|
4350
|
+
["emissionsPerSecondX64", (0, import_kit41.getU128Decoder)()],
|
|
4351
|
+
["openTime", (0, import_kit41.getU64Decoder)()],
|
|
4352
|
+
["endTime", (0, import_kit41.getU64Decoder)()]
|
|
5412
4353
|
]);
|
|
5413
4354
|
}
|
|
5414
4355
|
function getSetRewardParamsInstructionDataCodec() {
|
|
5415
|
-
return (0,
|
|
4356
|
+
return (0, import_kit41.combineCodec)(
|
|
5416
4357
|
getSetRewardParamsInstructionDataEncoder(),
|
|
5417
4358
|
getSetRewardParamsInstructionDataDecoder()
|
|
5418
4359
|
);
|
|
@@ -5433,10 +4374,10 @@ async function getSetRewardParamsInstructionAsync(input, config) {
|
|
|
5433
4374
|
const accounts = originalAccounts;
|
|
5434
4375
|
const args = { ...input };
|
|
5435
4376
|
if (!accounts.operationState.value) {
|
|
5436
|
-
accounts.operationState.value = await (0,
|
|
4377
|
+
accounts.operationState.value = await (0, import_kit41.getProgramDerivedAddress)({
|
|
5437
4378
|
programAddress,
|
|
5438
4379
|
seeds: [
|
|
5439
|
-
(0,
|
|
4380
|
+
(0, import_kit41.getBytesEncoder)().encode(
|
|
5440
4381
|
new Uint8Array([111, 112, 101, 114, 97, 116, 105, 111, 110])
|
|
5441
4382
|
)
|
|
5442
4383
|
]
|
|
@@ -5525,126 +4466,8 @@ function parseSetRewardParamsInstruction(instruction) {
|
|
|
5525
4466
|
};
|
|
5526
4467
|
}
|
|
5527
4468
|
|
|
5528
|
-
// src/generated/instructions/swap.ts
|
|
5529
|
-
var import_kit46 = require("@solana/kit");
|
|
5530
|
-
var SWAP_DISCRIMINATOR = new Uint8Array([
|
|
5531
|
-
248,
|
|
5532
|
-
198,
|
|
5533
|
-
158,
|
|
5534
|
-
145,
|
|
5535
|
-
225,
|
|
5536
|
-
117,
|
|
5537
|
-
135,
|
|
5538
|
-
200
|
|
5539
|
-
]);
|
|
5540
|
-
function getSwapDiscriminatorBytes() {
|
|
5541
|
-
return (0, import_kit46.fixEncoderSize)((0, import_kit46.getBytesEncoder)(), 8).encode(SWAP_DISCRIMINATOR);
|
|
5542
|
-
}
|
|
5543
|
-
function getSwapInstructionDataEncoder() {
|
|
5544
|
-
return (0, import_kit46.transformEncoder)(
|
|
5545
|
-
(0, import_kit46.getStructEncoder)([
|
|
5546
|
-
["discriminator", (0, import_kit46.fixEncoderSize)((0, import_kit46.getBytesEncoder)(), 8)],
|
|
5547
|
-
["amount", (0, import_kit46.getU64Encoder)()],
|
|
5548
|
-
["otherAmountThreshold", (0, import_kit46.getU64Encoder)()],
|
|
5549
|
-
["sqrtPriceLimitX64", (0, import_kit46.getU128Encoder)()],
|
|
5550
|
-
["isBaseInput", (0, import_kit46.getBooleanEncoder)()]
|
|
5551
|
-
]),
|
|
5552
|
-
(value) => ({ ...value, discriminator: SWAP_DISCRIMINATOR })
|
|
5553
|
-
);
|
|
5554
|
-
}
|
|
5555
|
-
function getSwapInstructionDataDecoder() {
|
|
5556
|
-
return (0, import_kit46.getStructDecoder)([
|
|
5557
|
-
["discriminator", (0, import_kit46.fixDecoderSize)((0, import_kit46.getBytesDecoder)(), 8)],
|
|
5558
|
-
["amount", (0, import_kit46.getU64Decoder)()],
|
|
5559
|
-
["otherAmountThreshold", (0, import_kit46.getU64Decoder)()],
|
|
5560
|
-
["sqrtPriceLimitX64", (0, import_kit46.getU128Decoder)()],
|
|
5561
|
-
["isBaseInput", (0, import_kit46.getBooleanDecoder)()]
|
|
5562
|
-
]);
|
|
5563
|
-
}
|
|
5564
|
-
function getSwapInstructionDataCodec() {
|
|
5565
|
-
return (0, import_kit46.combineCodec)(
|
|
5566
|
-
getSwapInstructionDataEncoder(),
|
|
5567
|
-
getSwapInstructionDataDecoder()
|
|
5568
|
-
);
|
|
5569
|
-
}
|
|
5570
|
-
function getSwapInstruction(input, config) {
|
|
5571
|
-
const programAddress = config?.programAddress ?? AMM_V3_PROGRAM_ADDRESS;
|
|
5572
|
-
const originalAccounts = {
|
|
5573
|
-
payer: { value: input.payer ?? null, isWritable: false },
|
|
5574
|
-
ammConfig: { value: input.ammConfig ?? null, isWritable: false },
|
|
5575
|
-
poolState: { value: input.poolState ?? null, isWritable: true },
|
|
5576
|
-
inputTokenAccount: {
|
|
5577
|
-
value: input.inputTokenAccount ?? null,
|
|
5578
|
-
isWritable: true
|
|
5579
|
-
},
|
|
5580
|
-
outputTokenAccount: {
|
|
5581
|
-
value: input.outputTokenAccount ?? null,
|
|
5582
|
-
isWritable: true
|
|
5583
|
-
},
|
|
5584
|
-
inputVault: { value: input.inputVault ?? null, isWritable: true },
|
|
5585
|
-
outputVault: { value: input.outputVault ?? null, isWritable: true },
|
|
5586
|
-
observationState: {
|
|
5587
|
-
value: input.observationState ?? null,
|
|
5588
|
-
isWritable: true
|
|
5589
|
-
},
|
|
5590
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
5591
|
-
tickArray: { value: input.tickArray ?? null, isWritable: true }
|
|
5592
|
-
};
|
|
5593
|
-
const accounts = originalAccounts;
|
|
5594
|
-
const args = { ...input };
|
|
5595
|
-
if (!accounts.tokenProgram.value) {
|
|
5596
|
-
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
5597
|
-
}
|
|
5598
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5599
|
-
return Object.freeze({
|
|
5600
|
-
accounts: [
|
|
5601
|
-
getAccountMeta(accounts.payer),
|
|
5602
|
-
getAccountMeta(accounts.ammConfig),
|
|
5603
|
-
getAccountMeta(accounts.poolState),
|
|
5604
|
-
getAccountMeta(accounts.inputTokenAccount),
|
|
5605
|
-
getAccountMeta(accounts.outputTokenAccount),
|
|
5606
|
-
getAccountMeta(accounts.inputVault),
|
|
5607
|
-
getAccountMeta(accounts.outputVault),
|
|
5608
|
-
getAccountMeta(accounts.observationState),
|
|
5609
|
-
getAccountMeta(accounts.tokenProgram),
|
|
5610
|
-
getAccountMeta(accounts.tickArray)
|
|
5611
|
-
],
|
|
5612
|
-
data: getSwapInstructionDataEncoder().encode(
|
|
5613
|
-
args
|
|
5614
|
-
),
|
|
5615
|
-
programAddress
|
|
5616
|
-
});
|
|
5617
|
-
}
|
|
5618
|
-
function parseSwapInstruction(instruction) {
|
|
5619
|
-
if (instruction.accounts.length < 10) {
|
|
5620
|
-
throw new Error("Not enough accounts");
|
|
5621
|
-
}
|
|
5622
|
-
let accountIndex = 0;
|
|
5623
|
-
const getNextAccount = () => {
|
|
5624
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
5625
|
-
accountIndex += 1;
|
|
5626
|
-
return accountMeta;
|
|
5627
|
-
};
|
|
5628
|
-
return {
|
|
5629
|
-
programAddress: instruction.programAddress,
|
|
5630
|
-
accounts: {
|
|
5631
|
-
payer: getNextAccount(),
|
|
5632
|
-
ammConfig: getNextAccount(),
|
|
5633
|
-
poolState: getNextAccount(),
|
|
5634
|
-
inputTokenAccount: getNextAccount(),
|
|
5635
|
-
outputTokenAccount: getNextAccount(),
|
|
5636
|
-
inputVault: getNextAccount(),
|
|
5637
|
-
outputVault: getNextAccount(),
|
|
5638
|
-
observationState: getNextAccount(),
|
|
5639
|
-
tokenProgram: getNextAccount(),
|
|
5640
|
-
tickArray: getNextAccount()
|
|
5641
|
-
},
|
|
5642
|
-
data: getSwapInstructionDataDecoder().decode(instruction.data)
|
|
5643
|
-
};
|
|
5644
|
-
}
|
|
5645
|
-
|
|
5646
4469
|
// src/generated/instructions/swapRouterBaseIn.ts
|
|
5647
|
-
var
|
|
4470
|
+
var import_kit42 = require("@solana/kit");
|
|
5648
4471
|
var SWAP_ROUTER_BASE_IN_DISCRIMINATOR = new Uint8Array([
|
|
5649
4472
|
69,
|
|
5650
4473
|
125,
|
|
@@ -5656,29 +4479,29 @@ var SWAP_ROUTER_BASE_IN_DISCRIMINATOR = new Uint8Array([
|
|
|
5656
4479
|
196
|
|
5657
4480
|
]);
|
|
5658
4481
|
function getSwapRouterBaseInDiscriminatorBytes() {
|
|
5659
|
-
return (0,
|
|
4482
|
+
return (0, import_kit42.fixEncoderSize)((0, import_kit42.getBytesEncoder)(), 8).encode(
|
|
5660
4483
|
SWAP_ROUTER_BASE_IN_DISCRIMINATOR
|
|
5661
4484
|
);
|
|
5662
4485
|
}
|
|
5663
4486
|
function getSwapRouterBaseInInstructionDataEncoder() {
|
|
5664
|
-
return (0,
|
|
5665
|
-
(0,
|
|
5666
|
-
["discriminator", (0,
|
|
5667
|
-
["amountIn", (0,
|
|
5668
|
-
["amountOutMinimum", (0,
|
|
4487
|
+
return (0, import_kit42.transformEncoder)(
|
|
4488
|
+
(0, import_kit42.getStructEncoder)([
|
|
4489
|
+
["discriminator", (0, import_kit42.fixEncoderSize)((0, import_kit42.getBytesEncoder)(), 8)],
|
|
4490
|
+
["amountIn", (0, import_kit42.getU64Encoder)()],
|
|
4491
|
+
["amountOutMinimum", (0, import_kit42.getU64Encoder)()]
|
|
5669
4492
|
]),
|
|
5670
4493
|
(value) => ({ ...value, discriminator: SWAP_ROUTER_BASE_IN_DISCRIMINATOR })
|
|
5671
4494
|
);
|
|
5672
4495
|
}
|
|
5673
4496
|
function getSwapRouterBaseInInstructionDataDecoder() {
|
|
5674
|
-
return (0,
|
|
5675
|
-
["discriminator", (0,
|
|
5676
|
-
["amountIn", (0,
|
|
5677
|
-
["amountOutMinimum", (0,
|
|
4497
|
+
return (0, import_kit42.getStructDecoder)([
|
|
4498
|
+
["discriminator", (0, import_kit42.fixDecoderSize)((0, import_kit42.getBytesDecoder)(), 8)],
|
|
4499
|
+
["amountIn", (0, import_kit42.getU64Decoder)()],
|
|
4500
|
+
["amountOutMinimum", (0, import_kit42.getU64Decoder)()]
|
|
5678
4501
|
]);
|
|
5679
4502
|
}
|
|
5680
4503
|
function getSwapRouterBaseInInstructionDataCodec() {
|
|
5681
|
-
return (0,
|
|
4504
|
+
return (0, import_kit42.combineCodec)(
|
|
5682
4505
|
getSwapRouterBaseInInstructionDataEncoder(),
|
|
5683
4506
|
getSwapRouterBaseInInstructionDataDecoder()
|
|
5684
4507
|
);
|
|
@@ -5751,7 +4574,7 @@ function parseSwapRouterBaseInInstruction(instruction) {
|
|
|
5751
4574
|
}
|
|
5752
4575
|
|
|
5753
4576
|
// src/generated/instructions/swapV2.ts
|
|
5754
|
-
var
|
|
4577
|
+
var import_kit43 = require("@solana/kit");
|
|
5755
4578
|
var SWAP_V2_DISCRIMINATOR = new Uint8Array([
|
|
5756
4579
|
43,
|
|
5757
4580
|
4,
|
|
@@ -5763,31 +4586,31 @@ var SWAP_V2_DISCRIMINATOR = new Uint8Array([
|
|
|
5763
4586
|
98
|
|
5764
4587
|
]);
|
|
5765
4588
|
function getSwapV2DiscriminatorBytes() {
|
|
5766
|
-
return (0,
|
|
4589
|
+
return (0, import_kit43.fixEncoderSize)((0, import_kit43.getBytesEncoder)(), 8).encode(SWAP_V2_DISCRIMINATOR);
|
|
5767
4590
|
}
|
|
5768
4591
|
function getSwapV2InstructionDataEncoder() {
|
|
5769
|
-
return (0,
|
|
5770
|
-
(0,
|
|
5771
|
-
["discriminator", (0,
|
|
5772
|
-
["amount", (0,
|
|
5773
|
-
["otherAmountThreshold", (0,
|
|
5774
|
-
["sqrtPriceLimitX64", (0,
|
|
5775
|
-
["isBaseInput", (0,
|
|
4592
|
+
return (0, import_kit43.transformEncoder)(
|
|
4593
|
+
(0, import_kit43.getStructEncoder)([
|
|
4594
|
+
["discriminator", (0, import_kit43.fixEncoderSize)((0, import_kit43.getBytesEncoder)(), 8)],
|
|
4595
|
+
["amount", (0, import_kit43.getU64Encoder)()],
|
|
4596
|
+
["otherAmountThreshold", (0, import_kit43.getU64Encoder)()],
|
|
4597
|
+
["sqrtPriceLimitX64", (0, import_kit43.getU128Encoder)()],
|
|
4598
|
+
["isBaseInput", (0, import_kit43.getBooleanEncoder)()]
|
|
5776
4599
|
]),
|
|
5777
4600
|
(value) => ({ ...value, discriminator: SWAP_V2_DISCRIMINATOR })
|
|
5778
4601
|
);
|
|
5779
4602
|
}
|
|
5780
4603
|
function getSwapV2InstructionDataDecoder() {
|
|
5781
|
-
return (0,
|
|
5782
|
-
["discriminator", (0,
|
|
5783
|
-
["amount", (0,
|
|
5784
|
-
["otherAmountThreshold", (0,
|
|
5785
|
-
["sqrtPriceLimitX64", (0,
|
|
5786
|
-
["isBaseInput", (0,
|
|
4604
|
+
return (0, import_kit43.getStructDecoder)([
|
|
4605
|
+
["discriminator", (0, import_kit43.fixDecoderSize)((0, import_kit43.getBytesDecoder)(), 8)],
|
|
4606
|
+
["amount", (0, import_kit43.getU64Decoder)()],
|
|
4607
|
+
["otherAmountThreshold", (0, import_kit43.getU64Decoder)()],
|
|
4608
|
+
["sqrtPriceLimitX64", (0, import_kit43.getU128Decoder)()],
|
|
4609
|
+
["isBaseInput", (0, import_kit43.getBooleanDecoder)()]
|
|
5787
4610
|
]);
|
|
5788
4611
|
}
|
|
5789
4612
|
function getSwapV2InstructionDataCodec() {
|
|
5790
|
-
return (0,
|
|
4613
|
+
return (0, import_kit43.combineCodec)(
|
|
5791
4614
|
getSwapV2InstructionDataEncoder(),
|
|
5792
4615
|
getSwapV2InstructionDataDecoder()
|
|
5793
4616
|
);
|
|
@@ -5890,7 +4713,7 @@ function parseSwapV2Instruction(instruction) {
|
|
|
5890
4713
|
}
|
|
5891
4714
|
|
|
5892
4715
|
// src/generated/instructions/transferRewardOwner.ts
|
|
5893
|
-
var
|
|
4716
|
+
var import_kit44 = require("@solana/kit");
|
|
5894
4717
|
var TRANSFER_REWARD_OWNER_DISCRIMINATOR = new Uint8Array([
|
|
5895
4718
|
7,
|
|
5896
4719
|
22,
|
|
@@ -5902,15 +4725,15 @@ var TRANSFER_REWARD_OWNER_DISCRIMINATOR = new Uint8Array([
|
|
|
5902
4725
|
121
|
|
5903
4726
|
]);
|
|
5904
4727
|
function getTransferRewardOwnerDiscriminatorBytes() {
|
|
5905
|
-
return (0,
|
|
4728
|
+
return (0, import_kit44.fixEncoderSize)((0, import_kit44.getBytesEncoder)(), 8).encode(
|
|
5906
4729
|
TRANSFER_REWARD_OWNER_DISCRIMINATOR
|
|
5907
4730
|
);
|
|
5908
4731
|
}
|
|
5909
4732
|
function getTransferRewardOwnerInstructionDataEncoder() {
|
|
5910
|
-
return (0,
|
|
5911
|
-
(0,
|
|
5912
|
-
["discriminator", (0,
|
|
5913
|
-
["newOwner", (0,
|
|
4733
|
+
return (0, import_kit44.transformEncoder)(
|
|
4734
|
+
(0, import_kit44.getStructEncoder)([
|
|
4735
|
+
["discriminator", (0, import_kit44.fixEncoderSize)((0, import_kit44.getBytesEncoder)(), 8)],
|
|
4736
|
+
["newOwner", (0, import_kit44.getAddressEncoder)()]
|
|
5914
4737
|
]),
|
|
5915
4738
|
(value) => ({
|
|
5916
4739
|
...value,
|
|
@@ -5919,13 +4742,13 @@ function getTransferRewardOwnerInstructionDataEncoder() {
|
|
|
5919
4742
|
);
|
|
5920
4743
|
}
|
|
5921
4744
|
function getTransferRewardOwnerInstructionDataDecoder() {
|
|
5922
|
-
return (0,
|
|
5923
|
-
["discriminator", (0,
|
|
5924
|
-
["newOwner", (0,
|
|
4745
|
+
return (0, import_kit44.getStructDecoder)([
|
|
4746
|
+
["discriminator", (0, import_kit44.fixDecoderSize)((0, import_kit44.getBytesDecoder)(), 8)],
|
|
4747
|
+
["newOwner", (0, import_kit44.getAddressDecoder)()]
|
|
5925
4748
|
]);
|
|
5926
4749
|
}
|
|
5927
4750
|
function getTransferRewardOwnerInstructionDataCodec() {
|
|
5928
|
-
return (0,
|
|
4751
|
+
return (0, import_kit44.combineCodec)(
|
|
5929
4752
|
getTransferRewardOwnerInstructionDataEncoder(),
|
|
5930
4753
|
getTransferRewardOwnerInstructionDataDecoder()
|
|
5931
4754
|
);
|
|
@@ -5939,7 +4762,7 @@ function getTransferRewardOwnerInstruction(input, config) {
|
|
|
5939
4762
|
const accounts = originalAccounts;
|
|
5940
4763
|
const args = { ...input };
|
|
5941
4764
|
if (!accounts.authority.value) {
|
|
5942
|
-
accounts.authority.value = "
|
|
4765
|
+
accounts.authority.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
5943
4766
|
}
|
|
5944
4767
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5945
4768
|
return Object.freeze({
|
|
@@ -5973,7 +4796,7 @@ function parseTransferRewardOwnerInstruction(instruction) {
|
|
|
5973
4796
|
}
|
|
5974
4797
|
|
|
5975
4798
|
// src/generated/instructions/updateAmmConfig.ts
|
|
5976
|
-
var
|
|
4799
|
+
var import_kit45 = require("@solana/kit");
|
|
5977
4800
|
var UPDATE_AMM_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
5978
4801
|
49,
|
|
5979
4802
|
60,
|
|
@@ -5985,29 +4808,29 @@ var UPDATE_AMM_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
|
5985
4808
|
200
|
|
5986
4809
|
]);
|
|
5987
4810
|
function getUpdateAmmConfigDiscriminatorBytes() {
|
|
5988
|
-
return (0,
|
|
4811
|
+
return (0, import_kit45.fixEncoderSize)((0, import_kit45.getBytesEncoder)(), 8).encode(
|
|
5989
4812
|
UPDATE_AMM_CONFIG_DISCRIMINATOR
|
|
5990
4813
|
);
|
|
5991
4814
|
}
|
|
5992
4815
|
function getUpdateAmmConfigInstructionDataEncoder() {
|
|
5993
|
-
return (0,
|
|
5994
|
-
(0,
|
|
5995
|
-
["discriminator", (0,
|
|
5996
|
-
["param", (0,
|
|
5997
|
-
["value", (0,
|
|
4816
|
+
return (0, import_kit45.transformEncoder)(
|
|
4817
|
+
(0, import_kit45.getStructEncoder)([
|
|
4818
|
+
["discriminator", (0, import_kit45.fixEncoderSize)((0, import_kit45.getBytesEncoder)(), 8)],
|
|
4819
|
+
["param", (0, import_kit45.getU8Encoder)()],
|
|
4820
|
+
["value", (0, import_kit45.getU32Encoder)()]
|
|
5998
4821
|
]),
|
|
5999
4822
|
(value) => ({ ...value, discriminator: UPDATE_AMM_CONFIG_DISCRIMINATOR })
|
|
6000
4823
|
);
|
|
6001
4824
|
}
|
|
6002
4825
|
function getUpdateAmmConfigInstructionDataDecoder() {
|
|
6003
|
-
return (0,
|
|
6004
|
-
["discriminator", (0,
|
|
6005
|
-
["param", (0,
|
|
6006
|
-
["value", (0,
|
|
4826
|
+
return (0, import_kit45.getStructDecoder)([
|
|
4827
|
+
["discriminator", (0, import_kit45.fixDecoderSize)((0, import_kit45.getBytesDecoder)(), 8)],
|
|
4828
|
+
["param", (0, import_kit45.getU8Decoder)()],
|
|
4829
|
+
["value", (0, import_kit45.getU32Decoder)()]
|
|
6007
4830
|
]);
|
|
6008
4831
|
}
|
|
6009
4832
|
function getUpdateAmmConfigInstructionDataCodec() {
|
|
6010
|
-
return (0,
|
|
4833
|
+
return (0, import_kit45.combineCodec)(
|
|
6011
4834
|
getUpdateAmmConfigInstructionDataEncoder(),
|
|
6012
4835
|
getUpdateAmmConfigInstructionDataDecoder()
|
|
6013
4836
|
);
|
|
@@ -6021,7 +4844,7 @@ function getUpdateAmmConfigInstruction(input, config) {
|
|
|
6021
4844
|
const accounts = originalAccounts;
|
|
6022
4845
|
const args = { ...input };
|
|
6023
4846
|
if (!accounts.owner.value) {
|
|
6024
|
-
accounts.owner.value = "
|
|
4847
|
+
accounts.owner.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
6025
4848
|
}
|
|
6026
4849
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
6027
4850
|
return Object.freeze({
|
|
@@ -6053,7 +4876,7 @@ function parseUpdateAmmConfigInstruction(instruction) {
|
|
|
6053
4876
|
}
|
|
6054
4877
|
|
|
6055
4878
|
// src/generated/instructions/updateOperationAccount.ts
|
|
6056
|
-
var
|
|
4879
|
+
var import_kit46 = require("@solana/kit");
|
|
6057
4880
|
var UPDATE_OPERATION_ACCOUNT_DISCRIMINATOR = new Uint8Array([
|
|
6058
4881
|
127,
|
|
6059
4882
|
70,
|
|
@@ -6065,16 +4888,16 @@ var UPDATE_OPERATION_ACCOUNT_DISCRIMINATOR = new Uint8Array([
|
|
|
6065
4888
|
7
|
|
6066
4889
|
]);
|
|
6067
4890
|
function getUpdateOperationAccountDiscriminatorBytes() {
|
|
6068
|
-
return (0,
|
|
4891
|
+
return (0, import_kit46.fixEncoderSize)((0, import_kit46.getBytesEncoder)(), 8).encode(
|
|
6069
4892
|
UPDATE_OPERATION_ACCOUNT_DISCRIMINATOR
|
|
6070
4893
|
);
|
|
6071
4894
|
}
|
|
6072
4895
|
function getUpdateOperationAccountInstructionDataEncoder() {
|
|
6073
|
-
return (0,
|
|
6074
|
-
(0,
|
|
6075
|
-
["discriminator", (0,
|
|
6076
|
-
["param", (0,
|
|
6077
|
-
["keys", (0,
|
|
4896
|
+
return (0, import_kit46.transformEncoder)(
|
|
4897
|
+
(0, import_kit46.getStructEncoder)([
|
|
4898
|
+
["discriminator", (0, import_kit46.fixEncoderSize)((0, import_kit46.getBytesEncoder)(), 8)],
|
|
4899
|
+
["param", (0, import_kit46.getU8Encoder)()],
|
|
4900
|
+
["keys", (0, import_kit46.getArrayEncoder)((0, import_kit46.getAddressEncoder)())]
|
|
6078
4901
|
]),
|
|
6079
4902
|
(value) => ({
|
|
6080
4903
|
...value,
|
|
@@ -6083,14 +4906,14 @@ function getUpdateOperationAccountInstructionDataEncoder() {
|
|
|
6083
4906
|
);
|
|
6084
4907
|
}
|
|
6085
4908
|
function getUpdateOperationAccountInstructionDataDecoder() {
|
|
6086
|
-
return (0,
|
|
6087
|
-
["discriminator", (0,
|
|
6088
|
-
["param", (0,
|
|
6089
|
-
["keys", (0,
|
|
4909
|
+
return (0, import_kit46.getStructDecoder)([
|
|
4910
|
+
["discriminator", (0, import_kit46.fixDecoderSize)((0, import_kit46.getBytesDecoder)(), 8)],
|
|
4911
|
+
["param", (0, import_kit46.getU8Decoder)()],
|
|
4912
|
+
["keys", (0, import_kit46.getArrayDecoder)((0, import_kit46.getAddressDecoder)())]
|
|
6090
4913
|
]);
|
|
6091
4914
|
}
|
|
6092
4915
|
function getUpdateOperationAccountInstructionDataCodec() {
|
|
6093
|
-
return (0,
|
|
4916
|
+
return (0, import_kit46.combineCodec)(
|
|
6094
4917
|
getUpdateOperationAccountInstructionDataEncoder(),
|
|
6095
4918
|
getUpdateOperationAccountInstructionDataDecoder()
|
|
6096
4919
|
);
|
|
@@ -6105,13 +4928,13 @@ async function getUpdateOperationAccountInstructionAsync(input, config) {
|
|
|
6105
4928
|
const accounts = originalAccounts;
|
|
6106
4929
|
const args = { ...input };
|
|
6107
4930
|
if (!accounts.owner.value) {
|
|
6108
|
-
accounts.owner.value = "
|
|
4931
|
+
accounts.owner.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
6109
4932
|
}
|
|
6110
4933
|
if (!accounts.operationState.value) {
|
|
6111
|
-
accounts.operationState.value = await (0,
|
|
4934
|
+
accounts.operationState.value = await (0, import_kit46.getProgramDerivedAddress)({
|
|
6112
4935
|
programAddress,
|
|
6113
4936
|
seeds: [
|
|
6114
|
-
(0,
|
|
4937
|
+
(0, import_kit46.getBytesEncoder)().encode(
|
|
6115
4938
|
new Uint8Array([111, 112, 101, 114, 97, 116, 105, 111, 110])
|
|
6116
4939
|
)
|
|
6117
4940
|
]
|
|
@@ -6143,7 +4966,7 @@ function getUpdateOperationAccountInstruction(input, config) {
|
|
|
6143
4966
|
const accounts = originalAccounts;
|
|
6144
4967
|
const args = { ...input };
|
|
6145
4968
|
if (!accounts.owner.value) {
|
|
6146
|
-
accounts.owner.value = "
|
|
4969
|
+
accounts.owner.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
6147
4970
|
}
|
|
6148
4971
|
if (!accounts.systemProgram.value) {
|
|
6149
4972
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
@@ -6185,7 +5008,7 @@ function parseUpdateOperationAccountInstruction(instruction) {
|
|
|
6185
5008
|
}
|
|
6186
5009
|
|
|
6187
5010
|
// src/generated/instructions/updatePoolStatus.ts
|
|
6188
|
-
var
|
|
5011
|
+
var import_kit47 = require("@solana/kit");
|
|
6189
5012
|
var UPDATE_POOL_STATUS_DISCRIMINATOR = new Uint8Array([
|
|
6190
5013
|
130,
|
|
6191
5014
|
87,
|
|
@@ -6197,27 +5020,27 @@ var UPDATE_POOL_STATUS_DISCRIMINATOR = new Uint8Array([
|
|
|
6197
5020
|
123
|
|
6198
5021
|
]);
|
|
6199
5022
|
function getUpdatePoolStatusDiscriminatorBytes() {
|
|
6200
|
-
return (0,
|
|
5023
|
+
return (0, import_kit47.fixEncoderSize)((0, import_kit47.getBytesEncoder)(), 8).encode(
|
|
6201
5024
|
UPDATE_POOL_STATUS_DISCRIMINATOR
|
|
6202
5025
|
);
|
|
6203
5026
|
}
|
|
6204
5027
|
function getUpdatePoolStatusInstructionDataEncoder() {
|
|
6205
|
-
return (0,
|
|
6206
|
-
(0,
|
|
6207
|
-
["discriminator", (0,
|
|
6208
|
-
["status", (0,
|
|
5028
|
+
return (0, import_kit47.transformEncoder)(
|
|
5029
|
+
(0, import_kit47.getStructEncoder)([
|
|
5030
|
+
["discriminator", (0, import_kit47.fixEncoderSize)((0, import_kit47.getBytesEncoder)(), 8)],
|
|
5031
|
+
["status", (0, import_kit47.getU8Encoder)()]
|
|
6209
5032
|
]),
|
|
6210
5033
|
(value) => ({ ...value, discriminator: UPDATE_POOL_STATUS_DISCRIMINATOR })
|
|
6211
5034
|
);
|
|
6212
5035
|
}
|
|
6213
5036
|
function getUpdatePoolStatusInstructionDataDecoder() {
|
|
6214
|
-
return (0,
|
|
6215
|
-
["discriminator", (0,
|
|
6216
|
-
["status", (0,
|
|
5037
|
+
return (0, import_kit47.getStructDecoder)([
|
|
5038
|
+
["discriminator", (0, import_kit47.fixDecoderSize)((0, import_kit47.getBytesDecoder)(), 8)],
|
|
5039
|
+
["status", (0, import_kit47.getU8Decoder)()]
|
|
6217
5040
|
]);
|
|
6218
5041
|
}
|
|
6219
5042
|
function getUpdatePoolStatusInstructionDataCodec() {
|
|
6220
|
-
return (0,
|
|
5043
|
+
return (0, import_kit47.combineCodec)(
|
|
6221
5044
|
getUpdatePoolStatusInstructionDataEncoder(),
|
|
6222
5045
|
getUpdatePoolStatusInstructionDataDecoder()
|
|
6223
5046
|
);
|
|
@@ -6231,7 +5054,7 @@ function getUpdatePoolStatusInstruction(input, config) {
|
|
|
6231
5054
|
const accounts = originalAccounts;
|
|
6232
5055
|
const args = { ...input };
|
|
6233
5056
|
if (!accounts.authority.value) {
|
|
6234
|
-
accounts.authority.value = "
|
|
5057
|
+
accounts.authority.value = "3kXrf8w8Z6EjLJU4S8dAkpRL2von8z7Eh3kJnFrmo7Z2";
|
|
6235
5058
|
}
|
|
6236
5059
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
6237
5060
|
return Object.freeze({
|
|
@@ -6263,7 +5086,7 @@ function parseUpdatePoolStatusInstruction(instruction) {
|
|
|
6263
5086
|
}
|
|
6264
5087
|
|
|
6265
5088
|
// src/generated/instructions/updateRewardInfos.ts
|
|
6266
|
-
var
|
|
5089
|
+
var import_kit48 = require("@solana/kit");
|
|
6267
5090
|
var UPDATE_REWARD_INFOS_DISCRIMINATOR = new Uint8Array([
|
|
6268
5091
|
163,
|
|
6269
5092
|
172,
|
|
@@ -6275,23 +5098,23 @@ var UPDATE_REWARD_INFOS_DISCRIMINATOR = new Uint8Array([
|
|
|
6275
5098
|
223
|
|
6276
5099
|
]);
|
|
6277
5100
|
function getUpdateRewardInfosDiscriminatorBytes() {
|
|
6278
|
-
return (0,
|
|
5101
|
+
return (0, import_kit48.fixEncoderSize)((0, import_kit48.getBytesEncoder)(), 8).encode(
|
|
6279
5102
|
UPDATE_REWARD_INFOS_DISCRIMINATOR
|
|
6280
5103
|
);
|
|
6281
5104
|
}
|
|
6282
5105
|
function getUpdateRewardInfosInstructionDataEncoder() {
|
|
6283
|
-
return (0,
|
|
6284
|
-
(0,
|
|
5106
|
+
return (0, import_kit48.transformEncoder)(
|
|
5107
|
+
(0, import_kit48.getStructEncoder)([["discriminator", (0, import_kit48.fixEncoderSize)((0, import_kit48.getBytesEncoder)(), 8)]]),
|
|
6285
5108
|
(value) => ({ ...value, discriminator: UPDATE_REWARD_INFOS_DISCRIMINATOR })
|
|
6286
5109
|
);
|
|
6287
5110
|
}
|
|
6288
5111
|
function getUpdateRewardInfosInstructionDataDecoder() {
|
|
6289
|
-
return (0,
|
|
6290
|
-
["discriminator", (0,
|
|
5112
|
+
return (0, import_kit48.getStructDecoder)([
|
|
5113
|
+
["discriminator", (0, import_kit48.fixDecoderSize)((0, import_kit48.getBytesDecoder)(), 8)]
|
|
6291
5114
|
]);
|
|
6292
5115
|
}
|
|
6293
5116
|
function getUpdateRewardInfosInstructionDataCodec() {
|
|
6294
|
-
return (0,
|
|
5117
|
+
return (0, import_kit48.combineCodec)(
|
|
6295
5118
|
getUpdateRewardInfosInstructionDataEncoder(),
|
|
6296
5119
|
getUpdateRewardInfosInstructionDataDecoder()
|
|
6297
5120
|
);
|
|
@@ -6898,9 +5721,9 @@ var LiquidityMath = class _LiquidityMath {
|
|
|
6898
5721
|
};
|
|
6899
5722
|
|
|
6900
5723
|
// src/utils/pda.ts
|
|
6901
|
-
var
|
|
6902
|
-
var addressEncoder = (0,
|
|
6903
|
-
var i32Encoder = (0,
|
|
5724
|
+
var import_kit49 = require("@solana/kit");
|
|
5725
|
+
var addressEncoder = (0, import_kit49.getAddressEncoder)();
|
|
5726
|
+
var i32Encoder = (0, import_kit49.getI32Encoder)({ endian: import_kit49.Endian.Big });
|
|
6904
5727
|
var PdaUtils = class {
|
|
6905
5728
|
/**
|
|
6906
5729
|
* Derive pool state PDA
|
|
@@ -6910,7 +5733,7 @@ var PdaUtils = class {
|
|
|
6910
5733
|
* @returns Pool state PDA
|
|
6911
5734
|
*/
|
|
6912
5735
|
static async getPoolStatePda(ammConfig, tokenMintA, tokenMintB) {
|
|
6913
|
-
return await (0,
|
|
5736
|
+
return await (0, import_kit49.getProgramDerivedAddress)({
|
|
6914
5737
|
programAddress: STABBLE_CLMM_PROGRAM_ID,
|
|
6915
5738
|
seeds: [
|
|
6916
5739
|
PDA_SEEDS.POOL_STATE,
|
|
@@ -6926,9 +5749,9 @@ var PdaUtils = class {
|
|
|
6926
5749
|
* @returns AMM config PDA
|
|
6927
5750
|
*/
|
|
6928
5751
|
static async getAmmConfigPda(index) {
|
|
6929
|
-
return await (0,
|
|
5752
|
+
return await (0, import_kit49.getProgramDerivedAddress)({
|
|
6930
5753
|
programAddress: STABBLE_CLMM_PROGRAM_ID,
|
|
6931
|
-
seeds: [PDA_SEEDS.AMM_CONFIG, (0,
|
|
5754
|
+
seeds: [PDA_SEEDS.AMM_CONFIG, (0, import_kit49.getU16Encoder)().encode(index)]
|
|
6932
5755
|
});
|
|
6933
5756
|
}
|
|
6934
5757
|
/**
|
|
@@ -6937,7 +5760,7 @@ var PdaUtils = class {
|
|
|
6937
5760
|
* @returns Position state PDA
|
|
6938
5761
|
*/
|
|
6939
5762
|
static async getPositionStatePda(nftMint) {
|
|
6940
|
-
return await (0,
|
|
5763
|
+
return await (0, import_kit49.getProgramDerivedAddress)({
|
|
6941
5764
|
programAddress: STABBLE_CLMM_PROGRAM_ID,
|
|
6942
5765
|
seeds: [PDA_SEEDS.POSITION_STATE, addressEncoder.encode(nftMint)]
|
|
6943
5766
|
});
|
|
@@ -6949,7 +5772,7 @@ var PdaUtils = class {
|
|
|
6949
5772
|
* @returns Tick array state PDA
|
|
6950
5773
|
*/
|
|
6951
5774
|
static async getTickArrayStatePda(poolState, startTickIndex) {
|
|
6952
|
-
return await (0,
|
|
5775
|
+
return await (0, import_kit49.getProgramDerivedAddress)({
|
|
6953
5776
|
programAddress: STABBLE_CLMM_PROGRAM_ID,
|
|
6954
5777
|
seeds: [
|
|
6955
5778
|
PDA_SEEDS.TICK_ARRAY_STATE,
|
|
@@ -6964,13 +5787,13 @@ var PdaUtils = class {
|
|
|
6964
5787
|
* @returns Observation state PDA
|
|
6965
5788
|
*/
|
|
6966
5789
|
static async getObservationStatePda(poolState) {
|
|
6967
|
-
return await (0,
|
|
5790
|
+
return await (0, import_kit49.getProgramDerivedAddress)({
|
|
6968
5791
|
programAddress: STABBLE_CLMM_PROGRAM_ID,
|
|
6969
5792
|
seeds: [PDA_SEEDS.OBSERVATION_STATE, addressEncoder.encode(poolState)]
|
|
6970
5793
|
});
|
|
6971
5794
|
}
|
|
6972
5795
|
static async getPoolVaultIdPda(poolAddress, vaultAddress) {
|
|
6973
|
-
return await (0,
|
|
5796
|
+
return await (0, import_kit49.getProgramDerivedAddress)({
|
|
6974
5797
|
seeds: [
|
|
6975
5798
|
PDA_SEEDS.POOL_VAULT,
|
|
6976
5799
|
addressEncoder.encode(poolAddress),
|
|
@@ -6985,7 +5808,7 @@ var PdaUtils = class {
|
|
|
6985
5808
|
* @returns Tick array bitmap extension PDA
|
|
6986
5809
|
*/
|
|
6987
5810
|
static async getTickArrayBitmapExtensionPda(poolState) {
|
|
6988
|
-
return await (0,
|
|
5811
|
+
return await (0, import_kit49.getProgramDerivedAddress)({
|
|
6989
5812
|
programAddress: STABBLE_CLMM_PROGRAM_ID,
|
|
6990
5813
|
seeds: [PDA_SEEDS.BITMAP_EXTENSION, addressEncoder.encode(poolState)]
|
|
6991
5814
|
});
|
|
@@ -7037,7 +5860,7 @@ var PdaUtils = class {
|
|
|
7037
5860
|
* @returns Protocol position state PDA
|
|
7038
5861
|
*/
|
|
7039
5862
|
static async getProtocolPositionStatePda(poolState, tickLowerIndex, tickUpperIndex) {
|
|
7040
|
-
return await (0,
|
|
5863
|
+
return await (0, import_kit49.getProgramDerivedAddress)({
|
|
7041
5864
|
programAddress: STABBLE_CLMM_PROGRAM_ID,
|
|
7042
5865
|
seeds: [
|
|
7043
5866
|
PDA_SEEDS.POSITION_STATE,
|
|
@@ -7053,20 +5876,20 @@ var PdaUtils = class {
|
|
|
7053
5876
|
* @returns Operation state PDA
|
|
7054
5877
|
*/
|
|
7055
5878
|
static async getOperationStatePda(poolState) {
|
|
7056
|
-
return await (0,
|
|
5879
|
+
return await (0, import_kit49.getProgramDerivedAddress)({
|
|
7057
5880
|
programAddress: STABBLE_CLMM_PROGRAM_ID,
|
|
7058
5881
|
seeds: [PDA_SEEDS.OPERATION, addressEncoder.encode(poolState)]
|
|
7059
5882
|
});
|
|
7060
5883
|
}
|
|
7061
5884
|
};
|
|
7062
5885
|
async function getMetadataPda(mint) {
|
|
7063
|
-
return await (0,
|
|
5886
|
+
return await (0, import_kit49.getProgramDerivedAddress)({
|
|
7064
5887
|
seeds: [
|
|
7065
5888
|
"metadata",
|
|
7066
|
-
addressEncoder.encode((0,
|
|
5889
|
+
addressEncoder.encode((0, import_kit49.address)(METADATA_PROGRAM_ID)),
|
|
7067
5890
|
addressEncoder.encode(mint)
|
|
7068
5891
|
],
|
|
7069
|
-
programAddress: (0,
|
|
5892
|
+
programAddress: (0, import_kit49.address)(METADATA_PROGRAM_ID)
|
|
7070
5893
|
});
|
|
7071
5894
|
}
|
|
7072
5895
|
|
|
@@ -8124,9 +6947,9 @@ var PoolUtils = class {
|
|
|
8124
6947
|
};
|
|
8125
6948
|
|
|
8126
6949
|
// src/utils/index.ts
|
|
8127
|
-
var
|
|
8128
|
-
function validateAddress(
|
|
8129
|
-
if (!
|
|
6950
|
+
var import_kit50 = require("@solana/kit");
|
|
6951
|
+
function validateAddress(address5, name = "address") {
|
|
6952
|
+
if (!address5 || address5.length === 0) {
|
|
8130
6953
|
throw new ClmmError(
|
|
8131
6954
|
"POOL_NOT_FOUND" /* POOL_NOT_FOUND */,
|
|
8132
6955
|
`Invalid ${name}: address cannot be empty`
|
|
@@ -8187,21 +7010,21 @@ function basisPointsToPercentage(basisPoints) {
|
|
|
8187
7010
|
function percentageToBasisPoints(percentage) {
|
|
8188
7011
|
return Math.round(percentage * 1e4);
|
|
8189
7012
|
}
|
|
8190
|
-
function isValidSolanaAddress(
|
|
7013
|
+
function isValidSolanaAddress(address5) {
|
|
8191
7014
|
try {
|
|
8192
|
-
const decoded = Buffer.from(
|
|
7015
|
+
const decoded = Buffer.from(address5, "base64");
|
|
8193
7016
|
return decoded.length === 32;
|
|
8194
7017
|
} catch {
|
|
8195
7018
|
return false;
|
|
8196
7019
|
}
|
|
8197
7020
|
}
|
|
8198
|
-
function addresstoBytes(
|
|
8199
|
-
const encoder = (0,
|
|
8200
|
-
return encoder.encode(
|
|
7021
|
+
function addresstoBytes(address5) {
|
|
7022
|
+
const encoder = (0, import_kit50.getAddressEncoder)();
|
|
7023
|
+
return encoder.encode(address5);
|
|
8201
7024
|
}
|
|
8202
|
-
function getFakeSigner(
|
|
7025
|
+
function getFakeSigner(address5) {
|
|
8203
7026
|
return {
|
|
8204
|
-
address:
|
|
7027
|
+
address: address5,
|
|
8205
7028
|
signAndSendTransactions: async (transactions, _config) => {
|
|
8206
7029
|
return transactions.map(
|
|
8207
7030
|
() => new Uint8Array(64).fill(0)
|
|
@@ -8286,7 +7109,7 @@ var Clmm = class {
|
|
|
8286
7109
|
};
|
|
8287
7110
|
|
|
8288
7111
|
// src/pool-manager.ts
|
|
8289
|
-
var
|
|
7112
|
+
var import_kit51 = require("@solana/kit");
|
|
8290
7113
|
var import_token2 = require("@solana-program/token");
|
|
8291
7114
|
var import_bn5 = __toESM(require("bn.js"));
|
|
8292
7115
|
var import_decimal3 = __toESM(require("decimal.js"));
|
|
@@ -8325,8 +7148,8 @@ var PoolManager = class {
|
|
|
8325
7148
|
mintADecimals,
|
|
8326
7149
|
mintBDecimals
|
|
8327
7150
|
} = params;
|
|
8328
|
-
const addressA = (0,
|
|
8329
|
-
const addressB = (0,
|
|
7151
|
+
const addressA = (0, import_kit51.address)(tokenMintA);
|
|
7152
|
+
const addressB = (0, import_kit51.address)(tokenMintB);
|
|
8330
7153
|
const isAFirst = new import_bn5.default(Buffer.from(addressB)).gt(
|
|
8331
7154
|
new import_bn5.default(Buffer.from(addressA))
|
|
8332
7155
|
);
|
|
@@ -8552,14 +7375,44 @@ var PoolManager = class {
|
|
|
8552
7375
|
};
|
|
8553
7376
|
|
|
8554
7377
|
// src/position-manager.ts
|
|
8555
|
-
var
|
|
7378
|
+
var import_kit52 = require("@solana/kit");
|
|
8556
7379
|
var import_token4 = require("@solana-program/token");
|
|
8557
7380
|
var import_token_20222 = require("@solana-program/token-2022");
|
|
8558
7381
|
var import_bn6 = __toESM(require("bn.js"));
|
|
7382
|
+
|
|
7383
|
+
// ../node_modules/@solana/spl-token/lib/esm/constants.js
|
|
7384
|
+
var import_web3 = require("@solana/web3.js");
|
|
7385
|
+
var TOKEN_PROGRAM_ID = new import_web3.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
|
|
7386
|
+
var TOKEN_2022_PROGRAM_ID = new import_web3.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");
|
|
7387
|
+
var ASSOCIATED_TOKEN_PROGRAM_ID = new import_web3.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");
|
|
7388
|
+
var NATIVE_MINT = new import_web3.PublicKey("So11111111111111111111111111111111111111112");
|
|
7389
|
+
var NATIVE_MINT_2022 = new import_web3.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");
|
|
7390
|
+
|
|
7391
|
+
// src/position-manager.ts
|
|
7392
|
+
var import_system = require("@solana-program/system");
|
|
8559
7393
|
var PositionManager = class {
|
|
8560
7394
|
constructor(config) {
|
|
8561
7395
|
this.config = config;
|
|
8562
7396
|
}
|
|
7397
|
+
buildWrapSolInstructions(params) {
|
|
7398
|
+
const { payer, ata, owner, amount } = params;
|
|
7399
|
+
return [
|
|
7400
|
+
(0, import_token4.getCreateAssociatedTokenInstruction)({
|
|
7401
|
+
payer,
|
|
7402
|
+
ata,
|
|
7403
|
+
owner,
|
|
7404
|
+
mint: (0, import_kit52.address)(NATIVE_MINT.toString()),
|
|
7405
|
+
tokenProgram: import_token4.TOKEN_PROGRAM_ADDRESS,
|
|
7406
|
+
systemProgram: SYSTEM_PROGRAM_ID
|
|
7407
|
+
}),
|
|
7408
|
+
(0, import_system.getTransferSolInstruction)({
|
|
7409
|
+
source: payer,
|
|
7410
|
+
destination: ata,
|
|
7411
|
+
amount
|
|
7412
|
+
}),
|
|
7413
|
+
(0, import_token4.getSyncNativeInstruction)({ account: ata })
|
|
7414
|
+
];
|
|
7415
|
+
}
|
|
8563
7416
|
/**
|
|
8564
7417
|
* Make open position from liquidity instructions
|
|
8565
7418
|
* Use this when you know the exact liquidity amount you want to provide
|
|
@@ -8583,7 +7436,7 @@ var PositionManager = class {
|
|
|
8583
7436
|
if (getEphemeralSigners) {
|
|
8584
7437
|
nftMintAccount = getEphemeralSigners()[0];
|
|
8585
7438
|
} else {
|
|
8586
|
-
let k = await (0,
|
|
7439
|
+
let k = await (0, import_kit52.generateKeyPairSigner)();
|
|
8587
7440
|
signers.push(k);
|
|
8588
7441
|
nftMintAccount = k;
|
|
8589
7442
|
}
|
|
@@ -8668,7 +7521,7 @@ var PositionManager = class {
|
|
|
8668
7521
|
if (getEphemeralSigners) {
|
|
8669
7522
|
nftMintAccount = getEphemeralSigners()[0];
|
|
8670
7523
|
} else {
|
|
8671
|
-
let k = await (0,
|
|
7524
|
+
let k = await (0, import_kit52.generateKeyPairSigner)();
|
|
8672
7525
|
signers.push(k);
|
|
8673
7526
|
nftMintAccount = k;
|
|
8674
7527
|
}
|
|
@@ -8709,7 +7562,27 @@ var PositionManager = class {
|
|
|
8709
7562
|
[tickArrayLowerStartIndex, tickArrayUpperStartIndex]
|
|
8710
7563
|
);
|
|
8711
7564
|
const extBitmapAccount = isOverflow ? await PdaUtils.getTickArrayBitmapExtensionPda(poolAccount.address) : void 0;
|
|
8712
|
-
const remAccounts = extBitmapAccount ? [{ address: extBitmapAccount[0], role:
|
|
7565
|
+
const remAccounts = extBitmapAccount ? [{ address: extBitmapAccount[0], role: import_kit52.AccountRole.WRITABLE }] : [];
|
|
7566
|
+
const wrapSolInstructions = [];
|
|
7567
|
+
if (poolAccount.data.tokenMint0.toString() === NATIVE_MINT.toString()) {
|
|
7568
|
+
wrapSolInstructions.push(
|
|
7569
|
+
...this.buildWrapSolInstructions({
|
|
7570
|
+
payer: ownerInfo.wallet,
|
|
7571
|
+
ata: ownerInfo.tokenAccountA,
|
|
7572
|
+
owner: ownerInfo.wallet.address,
|
|
7573
|
+
amount: baseAmount
|
|
7574
|
+
})
|
|
7575
|
+
);
|
|
7576
|
+
} else if (poolAccount.data.tokenMint1.toString() === NATIVE_MINT.toString()) {
|
|
7577
|
+
wrapSolInstructions.push(
|
|
7578
|
+
...this.buildWrapSolInstructions({
|
|
7579
|
+
payer: ownerInfo.wallet,
|
|
7580
|
+
ata: ownerInfo.tokenAccountB,
|
|
7581
|
+
owner: ownerInfo.wallet.address,
|
|
7582
|
+
amount: baseAmount
|
|
7583
|
+
})
|
|
7584
|
+
);
|
|
7585
|
+
}
|
|
8713
7586
|
const instruction = await getOpenPositionWithToken22NftInstructionAsync({
|
|
8714
7587
|
payer: ownerInfo.wallet,
|
|
8715
7588
|
positionNftOwner: ownerInfo.wallet.address,
|
|
@@ -8741,7 +7614,7 @@ var PositionManager = class {
|
|
|
8741
7614
|
accounts: [...instruction.accounts, ...remAccounts]
|
|
8742
7615
|
};
|
|
8743
7616
|
return {
|
|
8744
|
-
instructions: [ixWithRemAccounts],
|
|
7617
|
+
instructions: [...wrapSolInstructions, ixWithRemAccounts],
|
|
8745
7618
|
signers,
|
|
8746
7619
|
instructionTypes: ["OpenPositionV2"],
|
|
8747
7620
|
address: {
|
|
@@ -8799,7 +7672,7 @@ var PositionManager = class {
|
|
|
8799
7672
|
[ownerPosition.tickLowerIndex, ownerPosition.tickUpperIndex]
|
|
8800
7673
|
);
|
|
8801
7674
|
const extBitmapAccount = isOverflow ? await PdaUtils.getTickArrayBitmapExtensionPda(poolState.address) : void 0;
|
|
8802
|
-
const remAccounts = extBitmapAccount ? [{ address: extBitmapAccount[0], role:
|
|
7675
|
+
const remAccounts = extBitmapAccount ? [{ address: extBitmapAccount[0], role: import_kit52.AccountRole.WRITABLE }] : [];
|
|
8803
7676
|
const instruction = getIncreaseLiquidityV2Instruction({
|
|
8804
7677
|
nftOwner: ownerInfo.wallet,
|
|
8805
7678
|
nftAccount: positionNftAccount,
|
|
@@ -8884,7 +7757,7 @@ var PositionManager = class {
|
|
|
8884
7757
|
[ownerPosition.tickLowerIndex, ownerPosition.tickUpperIndex]
|
|
8885
7758
|
);
|
|
8886
7759
|
const extBitmapAccount = isOverflow ? await PdaUtils.getTickArrayBitmapExtensionPda(poolState.address) : void 0;
|
|
8887
|
-
const remAccounts = extBitmapAccount ? [{ address: extBitmapAccount[0], role:
|
|
7760
|
+
const remAccounts = extBitmapAccount ? [{ address: extBitmapAccount[0], role: import_kit52.AccountRole.WRITABLE }] : [];
|
|
8888
7761
|
const instruction = getDecreaseLiquidityV2Instruction({
|
|
8889
7762
|
nftOwner: ownerInfo.wallet,
|
|
8890
7763
|
nftAccount: positionNftAccount,
|
|
@@ -9054,24 +7927,19 @@ var PositionManager = class {
|
|
|
9054
7927
|
};
|
|
9055
7928
|
}
|
|
9056
7929
|
/**
|
|
9057
|
-
* Get all positions for a wallet
|
|
7930
|
+
* Get all positions for a wallet
|
|
9058
7931
|
* @param wallet - Wallet address
|
|
9059
|
-
* @returns Array of
|
|
7932
|
+
* @returns Array of positions owned by the wallet
|
|
9060
7933
|
*/
|
|
9061
7934
|
async getPositionsForWallet(wallet) {
|
|
9062
7935
|
try {
|
|
9063
|
-
const response = await this.config.rpc.getTokenAccountsByOwner(
|
|
9064
|
-
wallet,
|
|
9065
|
-
{ programId: import_token4.TOKEN_PROGRAM_ADDRESS },
|
|
9066
|
-
{ encoding: "jsonParsed" }
|
|
9067
|
-
).send();
|
|
9068
7936
|
const response22 = await this.config.rpc.getTokenAccountsByOwner(
|
|
9069
7937
|
wallet,
|
|
9070
7938
|
{ programId: import_token_20222.TOKEN_2022_PROGRAM_ADDRESS },
|
|
9071
7939
|
{ encoding: "jsonParsed" }
|
|
9072
7940
|
).send();
|
|
9073
|
-
let
|
|
9074
|
-
const nftTokenAccounts =
|
|
7941
|
+
let tokenAccounts = [...response22.value];
|
|
7942
|
+
const nftTokenAccounts = tokenAccounts.filter((account) => {
|
|
9075
7943
|
const parsedInfo = account.account.data.parsed.info;
|
|
9076
7944
|
return parsedInfo.tokenAmount.amount == "1" && parsedInfo.tokenAmount.decimals == 0;
|
|
9077
7945
|
});
|
|
@@ -9418,13 +8286,8 @@ var DEFAULT_SDK_CONFIG = {
|
|
|
9418
8286
|
getClosePositionInstruction,
|
|
9419
8287
|
getCreateAmmConfigInstruction,
|
|
9420
8288
|
getCreatePoolInstruction,
|
|
9421
|
-
getDecreaseLiquidityInstruction,
|
|
9422
8289
|
getFakeSigner,
|
|
9423
|
-
getIncreaseLiquidityInstruction,
|
|
9424
8290
|
getMetadataPda,
|
|
9425
|
-
getOpenPositionInstruction,
|
|
9426
|
-
getOpenPositionV2Instruction,
|
|
9427
|
-
getSwapInstruction,
|
|
9428
8291
|
getSwapV2Instruction,
|
|
9429
8292
|
isAmmV3Error,
|
|
9430
8293
|
isValidSolanaAddress,
|