@crypticdot/defituna-client 2.0.5 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -6
- package/dist/index.d.mts +444 -114
- package/dist/index.d.ts +444 -114
- package/dist/index.js +1551 -677
- package/dist/index.mjs +1471 -571
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -69,6 +69,8 @@ __export(index_exports, {
|
|
|
69
69
|
OPEN_POSITION_WITH_LIQUIDITY_FUSION_DISCRIMINATOR: () => OPEN_POSITION_WITH_LIQUIDITY_FUSION_DISCRIMINATOR,
|
|
70
70
|
OPEN_POSITION_WITH_LIQUIDITY_ORCA_DISCRIMINATOR: () => OPEN_POSITION_WITH_LIQUIDITY_ORCA_DISCRIMINATOR,
|
|
71
71
|
OrcaUtils: () => OrcaUtils,
|
|
72
|
+
REBALANCE_POSITION_FUSION_DISCRIMINATOR: () => REBALANCE_POSITION_FUSION_DISCRIMINATOR,
|
|
73
|
+
REBALANCE_POSITION_ORCA_DISCRIMINATOR: () => REBALANCE_POSITION_ORCA_DISCRIMINATOR,
|
|
72
74
|
REMOVE_LIQUIDITY_FUSION_DISCRIMINATOR: () => REMOVE_LIQUIDITY_FUSION_DISCRIMINATOR,
|
|
73
75
|
REMOVE_LIQUIDITY_ORCA_DISCRIMINATOR: () => REMOVE_LIQUIDITY_ORCA_DISCRIMINATOR,
|
|
74
76
|
REPAY_BAD_DEBT_DISCRIMINATOR: () => REPAY_BAD_DEBT_DISCRIMINATOR,
|
|
@@ -83,6 +85,7 @@ __export(index_exports, {
|
|
|
83
85
|
SET_OWNER_AUTHORITY_DISCRIMINATOR: () => SET_OWNER_AUTHORITY_DISCRIMINATOR,
|
|
84
86
|
SET_SUSPENDED_STATE_DISCRIMINATOR: () => SET_SUSPENDED_STATE_DISCRIMINATOR,
|
|
85
87
|
SET_TUNA_POSITION_FLAGS_DISCRIMINATOR: () => SET_TUNA_POSITION_FLAGS_DISCRIMINATOR,
|
|
88
|
+
SET_TUNA_POSITION_REBALANCE_THRESHOLD_DISCRIMINATOR: () => SET_TUNA_POSITION_REBALANCE_THRESHOLD_DISCRIMINATOR,
|
|
86
89
|
TUNA_CONFIG_DISCRIMINATOR: () => TUNA_CONFIG_DISCRIMINATOR,
|
|
87
90
|
TUNA_ERROR__AMOUNT_SLIPPAGE_EXCEEDED: () => TUNA_ERROR__AMOUNT_SLIPPAGE_EXCEEDED,
|
|
88
91
|
TUNA_ERROR__BAD_DEBT: () => TUNA_ERROR__BAD_DEBT,
|
|
@@ -93,7 +96,6 @@ __export(index_exports, {
|
|
|
93
96
|
TUNA_ERROR__INVALID_MARKET_MAKER: () => TUNA_ERROR__INVALID_MARKET_MAKER,
|
|
94
97
|
TUNA_ERROR__INVALID_REMAINING_ACCOUNTS_LENGTH: () => TUNA_ERROR__INVALID_REMAINING_ACCOUNTS_LENGTH,
|
|
95
98
|
TUNA_ERROR__INVALID_SQRT_PRICE_LIMIT_DIRECTION: () => TUNA_ERROR__INVALID_SQRT_PRICE_LIMIT_DIRECTION,
|
|
96
|
-
TUNA_ERROR__INVALID_TICK_ARRAY_ACCOUNTS: () => TUNA_ERROR__INVALID_TICK_ARRAY_ACCOUNTS,
|
|
97
99
|
TUNA_ERROR__INVALID_TICK_ARRAY_SEQUENCE: () => TUNA_ERROR__INVALID_TICK_ARRAY_SEQUENCE,
|
|
98
100
|
TUNA_ERROR__LEFTOVERS_EXCEEDED: () => TUNA_ERROR__LEFTOVERS_EXCEEDED,
|
|
99
101
|
TUNA_ERROR__LEVERAGE_IS_OUT_OF_RANGE: () => TUNA_ERROR__LEVERAGE_IS_OUT_OF_RANGE,
|
|
@@ -122,6 +124,7 @@ __export(index_exports, {
|
|
|
122
124
|
TUNA_ERROR__RAYDIUM_NOT_ENOUGH_TICK_ARRAY_ACCOUNT: () => TUNA_ERROR__RAYDIUM_NOT_ENOUGH_TICK_ARRAY_ACCOUNT,
|
|
123
125
|
TUNA_ERROR__RAYDIUM_SQRT_PRICE_LIMIT_OVERFLOW: () => TUNA_ERROR__RAYDIUM_SQRT_PRICE_LIMIT_OVERFLOW,
|
|
124
126
|
TUNA_ERROR__RAYDIUM_ZERO_AMOUNT_SPECIFIED: () => TUNA_ERROR__RAYDIUM_ZERO_AMOUNT_SPECIFIED,
|
|
127
|
+
TUNA_ERROR__REBALANCE_CONDITIONS_NOT_MET: () => TUNA_ERROR__REBALANCE_CONDITIONS_NOT_MET,
|
|
125
128
|
TUNA_ERROR__REMAINING_ACCOUNTS_DUPLICATED_ACCOUNTS_TYPE: () => TUNA_ERROR__REMAINING_ACCOUNTS_DUPLICATED_ACCOUNTS_TYPE,
|
|
126
129
|
TUNA_ERROR__REMAINING_ACCOUNTS_INSUFFICIENT: () => TUNA_ERROR__REMAINING_ACCOUNTS_INSUFFICIENT,
|
|
127
130
|
TUNA_ERROR__REMAINING_ACCOUNTS_INVALID_SLICE: () => TUNA_ERROR__REMAINING_ACCOUNTS_INVALID_SLICE,
|
|
@@ -131,8 +134,10 @@ __export(index_exports, {
|
|
|
131
134
|
TUNA_ERROR__SQRT_PRICE_OUT_OF_BOUNDS: () => TUNA_ERROR__SQRT_PRICE_OUT_OF_BOUNDS,
|
|
132
135
|
TUNA_ERROR__SUPPLY_LIMIT_EXCEEDED: () => TUNA_ERROR__SUPPLY_LIMIT_EXCEEDED,
|
|
133
136
|
TUNA_ERROR__SUSPENDED: () => TUNA_ERROR__SUSPENDED,
|
|
137
|
+
TUNA_ERROR__SWAP_QUOTE_NOT_EQUAL_TO_ACTUAL_SWAP_AMOUNT: () => TUNA_ERROR__SWAP_QUOTE_NOT_EQUAL_TO_ACTUAL_SWAP_AMOUNT,
|
|
134
138
|
TUNA_ERROR__SWAP_SLIPPAGE_EXCEEDED: () => TUNA_ERROR__SWAP_SLIPPAGE_EXCEEDED,
|
|
135
139
|
TUNA_ERROR__SWAP_SLIPPAGE_IS_OUT_OF_RANGE: () => TUNA_ERROR__SWAP_SLIPPAGE_IS_OUT_OF_RANGE,
|
|
140
|
+
TUNA_ERROR__SWAP_TO_POSITION_RATIO_ESTIMATION_FAILED: () => TUNA_ERROR__SWAP_TO_POSITION_RATIO_ESTIMATION_FAILED,
|
|
136
141
|
TUNA_ERROR__TICK_INDEX_OF_BOUNDS: () => TUNA_ERROR__TICK_INDEX_OF_BOUNDS,
|
|
137
142
|
TUNA_ERROR__TRANSFER_FEE_CALCULATION_ERROR: () => TUNA_ERROR__TRANSFER_FEE_CALCULATION_ERROR,
|
|
138
143
|
TUNA_ERROR__TYPE_CAST_OVERFLOW: () => TUNA_ERROR__TYPE_CAST_OVERFLOW,
|
|
@@ -146,6 +151,7 @@ __export(index_exports, {
|
|
|
146
151
|
TUNA_ERROR__ZERO_TRADABLE_AMOUNT: () => TUNA_ERROR__ZERO_TRADABLE_AMOUNT,
|
|
147
152
|
TUNA_ERROR__ZERO_YIELD: () => TUNA_ERROR__ZERO_YIELD,
|
|
148
153
|
TUNA_POSITION_DISCRIMINATOR: () => TUNA_POSITION_DISCRIMINATOR,
|
|
154
|
+
TUNA_POSITION_FLAGS_ALLOW_REBALANCING: () => TUNA_POSITION_FLAGS_ALLOW_REBALANCING,
|
|
149
155
|
TUNA_POSITION_FLAGS_AUTO_COMPOUND_YIELD: () => TUNA_POSITION_FLAGS_AUTO_COMPOUND_YIELD,
|
|
150
156
|
TUNA_POSITION_FLAGS_AUTO_COMPOUND_YIELD_WITH_LEVERAGE: () => TUNA_POSITION_FLAGS_AUTO_COMPOUND_YIELD_WITH_LEVERAGE,
|
|
151
157
|
TUNA_POSITION_FLAGS_STOP_LOSS_SWAP_TO_TOKEN_A: () => TUNA_POSITION_FLAGS_STOP_LOSS_SWAP_TO_TOKEN_A,
|
|
@@ -334,6 +340,16 @@ __export(index_exports, {
|
|
|
334
340
|
getOpenPositionWithLiquidityOrcaInstructionDataCodec: () => getOpenPositionWithLiquidityOrcaInstructionDataCodec,
|
|
335
341
|
getOpenPositionWithLiquidityOrcaInstructionDataDecoder: () => getOpenPositionWithLiquidityOrcaInstructionDataDecoder,
|
|
336
342
|
getOpenPositionWithLiquidityOrcaInstructionDataEncoder: () => getOpenPositionWithLiquidityOrcaInstructionDataEncoder,
|
|
343
|
+
getRebalancePositionFusionDiscriminatorBytes: () => getRebalancePositionFusionDiscriminatorBytes,
|
|
344
|
+
getRebalancePositionFusionInstruction: () => getRebalancePositionFusionInstruction,
|
|
345
|
+
getRebalancePositionFusionInstructionDataCodec: () => getRebalancePositionFusionInstructionDataCodec,
|
|
346
|
+
getRebalancePositionFusionInstructionDataDecoder: () => getRebalancePositionFusionInstructionDataDecoder,
|
|
347
|
+
getRebalancePositionFusionInstructionDataEncoder: () => getRebalancePositionFusionInstructionDataEncoder,
|
|
348
|
+
getRebalancePositionOrcaDiscriminatorBytes: () => getRebalancePositionOrcaDiscriminatorBytes,
|
|
349
|
+
getRebalancePositionOrcaInstruction: () => getRebalancePositionOrcaInstruction,
|
|
350
|
+
getRebalancePositionOrcaInstructionDataCodec: () => getRebalancePositionOrcaInstructionDataCodec,
|
|
351
|
+
getRebalancePositionOrcaInstructionDataDecoder: () => getRebalancePositionOrcaInstructionDataDecoder,
|
|
352
|
+
getRebalancePositionOrcaInstructionDataEncoder: () => getRebalancePositionOrcaInstructionDataEncoder,
|
|
337
353
|
getRemainingAccountsInfoCodec: () => getRemainingAccountsInfoCodec,
|
|
338
354
|
getRemainingAccountsInfoDecoder: () => getRemainingAccountsInfoDecoder,
|
|
339
355
|
getRemainingAccountsInfoEncoder: () => getRemainingAccountsInfoEncoder,
|
|
@@ -410,6 +426,11 @@ __export(index_exports, {
|
|
|
410
426
|
getSetTunaPositionFlagsInstructionDataCodec: () => getSetTunaPositionFlagsInstructionDataCodec,
|
|
411
427
|
getSetTunaPositionFlagsInstructionDataDecoder: () => getSetTunaPositionFlagsInstructionDataDecoder,
|
|
412
428
|
getSetTunaPositionFlagsInstructionDataEncoder: () => getSetTunaPositionFlagsInstructionDataEncoder,
|
|
429
|
+
getSetTunaPositionRebalanceThresholdDiscriminatorBytes: () => getSetTunaPositionRebalanceThresholdDiscriminatorBytes,
|
|
430
|
+
getSetTunaPositionRebalanceThresholdInstruction: () => getSetTunaPositionRebalanceThresholdInstruction,
|
|
431
|
+
getSetTunaPositionRebalanceThresholdInstructionDataCodec: () => getSetTunaPositionRebalanceThresholdInstructionDataCodec,
|
|
432
|
+
getSetTunaPositionRebalanceThresholdInstructionDataDecoder: () => getSetTunaPositionRebalanceThresholdInstructionDataDecoder,
|
|
433
|
+
getSetTunaPositionRebalanceThresholdInstructionDataEncoder: () => getSetTunaPositionRebalanceThresholdInstructionDataEncoder,
|
|
413
434
|
getTunaConfigAddress: () => getTunaConfigAddress,
|
|
414
435
|
getTunaConfigCodec: () => getTunaConfigCodec,
|
|
415
436
|
getTunaConfigDecoder: () => getTunaConfigDecoder,
|
|
@@ -483,6 +504,8 @@ __export(index_exports, {
|
|
|
483
504
|
parseOpenPositionOrcaInstruction: () => parseOpenPositionOrcaInstruction,
|
|
484
505
|
parseOpenPositionWithLiquidityFusionInstruction: () => parseOpenPositionWithLiquidityFusionInstruction,
|
|
485
506
|
parseOpenPositionWithLiquidityOrcaInstruction: () => parseOpenPositionWithLiquidityOrcaInstruction,
|
|
507
|
+
parseRebalancePositionFusionInstruction: () => parseRebalancePositionFusionInstruction,
|
|
508
|
+
parseRebalancePositionOrcaInstruction: () => parseRebalancePositionOrcaInstruction,
|
|
486
509
|
parseRemoveLiquidityFusionInstruction: () => parseRemoveLiquidityFusionInstruction,
|
|
487
510
|
parseRemoveLiquidityOrcaInstruction: () => parseRemoveLiquidityOrcaInstruction,
|
|
488
511
|
parseRepayBadDebtInstruction: () => parseRepayBadDebtInstruction,
|
|
@@ -497,9 +520,14 @@ __export(index_exports, {
|
|
|
497
520
|
parseSetOwnerAuthorityInstruction: () => parseSetOwnerAuthorityInstruction,
|
|
498
521
|
parseSetSuspendedStateInstruction: () => parseSetSuspendedStateInstruction,
|
|
499
522
|
parseSetTunaPositionFlagsInstruction: () => parseSetTunaPositionFlagsInstruction,
|
|
523
|
+
parseSetTunaPositionRebalanceThresholdInstruction: () => parseSetTunaPositionRebalanceThresholdInstruction,
|
|
500
524
|
parseUpdateMarketInstruction: () => parseUpdateMarketInstruction,
|
|
501
525
|
parseUpdateVaultInstruction: () => parseUpdateVaultInstruction,
|
|
502
526
|
parseWithdrawInstruction: () => parseWithdrawInstruction,
|
|
527
|
+
rebalancePositionFusionInstruction: () => rebalancePositionFusionInstruction,
|
|
528
|
+
rebalancePositionFusionInstructions: () => rebalancePositionFusionInstructions,
|
|
529
|
+
rebalancePositionOrcaInstruction: () => rebalancePositionOrcaInstruction,
|
|
530
|
+
rebalancePositionOrcaInstructions: () => rebalancePositionOrcaInstructions,
|
|
503
531
|
removeLiquidityFusionInstruction: () => removeLiquidityFusionInstruction,
|
|
504
532
|
removeLiquidityFusionInstructions: () => removeLiquidityFusionInstructions,
|
|
505
533
|
removeLiquidityOrcaInstruction: () => removeLiquidityOrcaInstruction,
|
|
@@ -507,7 +535,7 @@ __export(index_exports, {
|
|
|
507
535
|
repayBadDebtInstruction: () => repayBadDebtInstruction,
|
|
508
536
|
repayDebtInstruction: () => repayDebtInstruction,
|
|
509
537
|
repayDebtInstructions: () => repayDebtInstructions,
|
|
510
|
-
|
|
538
|
+
setLimitOrdersInstruction: () => setLimitOrdersInstruction,
|
|
511
539
|
tunaPositionAuthorityFilter: () => tunaPositionAuthorityFilter,
|
|
512
540
|
tunaPositionMarketMakerFilter: () => tunaPositionMarketMakerFilter,
|
|
513
541
|
tunaPositionMintAFilter: () => tunaPositionMintAFilter,
|
|
@@ -611,10 +639,12 @@ var AccountsType = /* @__PURE__ */ ((AccountsType2) => {
|
|
|
611
639
|
AccountsType2[AccountsType2["SwapTickArrays"] = 0] = "SwapTickArrays";
|
|
612
640
|
AccountsType2[AccountsType2["TickArrayLower"] = 1] = "TickArrayLower";
|
|
613
641
|
AccountsType2[AccountsType2["TickArrayUpper"] = 2] = "TickArrayUpper";
|
|
614
|
-
AccountsType2[AccountsType2["
|
|
615
|
-
AccountsType2[AccountsType2["
|
|
616
|
-
AccountsType2[AccountsType2["
|
|
617
|
-
AccountsType2[AccountsType2["
|
|
642
|
+
AccountsType2[AccountsType2["SecondaryTickArrayLower"] = 3] = "SecondaryTickArrayLower";
|
|
643
|
+
AccountsType2[AccountsType2["SecondaryTickArrayUpper"] = 4] = "SecondaryTickArrayUpper";
|
|
644
|
+
AccountsType2[AccountsType2["PoolVaultTokenA"] = 5] = "PoolVaultTokenA";
|
|
645
|
+
AccountsType2[AccountsType2["PoolVaultTokenB"] = 6] = "PoolVaultTokenB";
|
|
646
|
+
AccountsType2[AccountsType2["WhirlpoolOracle"] = 7] = "WhirlpoolOracle";
|
|
647
|
+
AccountsType2[AccountsType2["Rewards"] = 8] = "Rewards";
|
|
618
648
|
return AccountsType2;
|
|
619
649
|
})(AccountsType || {});
|
|
620
650
|
function getAccountsTypeEncoder() {
|
|
@@ -934,7 +964,8 @@ function getTunaPositionEncoder() {
|
|
|
934
964
|
["compoundedYieldB", (0, import_kit9.getU64Encoder)()],
|
|
935
965
|
["flags", (0, import_kit9.getU32Encoder)()],
|
|
936
966
|
["marketMaker", getMarketMakerEncoder()],
|
|
937
|
-
["
|
|
967
|
+
["rebalanceThresholdTicks", (0, import_kit9.getU32Encoder)()],
|
|
968
|
+
["reserved", (0, import_kit9.fixEncoderSize)((0, import_kit9.getBytesEncoder)(), 57)]
|
|
938
969
|
]),
|
|
939
970
|
(value) => ({ ...value, discriminator: TUNA_POSITION_DISCRIMINATOR })
|
|
940
971
|
);
|
|
@@ -967,7 +998,8 @@ function getTunaPositionDecoder() {
|
|
|
967
998
|
["compoundedYieldB", (0, import_kit9.getU64Decoder)()],
|
|
968
999
|
["flags", (0, import_kit9.getU32Decoder)()],
|
|
969
1000
|
["marketMaker", getMarketMakerDecoder()],
|
|
970
|
-
["
|
|
1001
|
+
["rebalanceThresholdTicks", (0, import_kit9.getU32Decoder)()],
|
|
1002
|
+
["reserved", (0, import_kit9.fixDecoderSize)((0, import_kit9.getBytesDecoder)(), 57)]
|
|
971
1003
|
]);
|
|
972
1004
|
}
|
|
973
1005
|
function getTunaPositionCodec() {
|
|
@@ -1174,23 +1206,26 @@ var TunaInstruction = /* @__PURE__ */ ((TunaInstruction2) => {
|
|
|
1174
1206
|
TunaInstruction2[TunaInstruction2["OpenPositionOrca"] = 17] = "OpenPositionOrca";
|
|
1175
1207
|
TunaInstruction2[TunaInstruction2["OpenPositionWithLiquidityFusion"] = 18] = "OpenPositionWithLiquidityFusion";
|
|
1176
1208
|
TunaInstruction2[TunaInstruction2["OpenPositionWithLiquidityOrca"] = 19] = "OpenPositionWithLiquidityOrca";
|
|
1177
|
-
TunaInstruction2[TunaInstruction2["
|
|
1178
|
-
TunaInstruction2[TunaInstruction2["
|
|
1179
|
-
TunaInstruction2[TunaInstruction2["
|
|
1180
|
-
TunaInstruction2[TunaInstruction2["
|
|
1181
|
-
TunaInstruction2[TunaInstruction2["
|
|
1182
|
-
TunaInstruction2[TunaInstruction2["
|
|
1183
|
-
TunaInstruction2[TunaInstruction2["
|
|
1184
|
-
TunaInstruction2[TunaInstruction2["
|
|
1185
|
-
TunaInstruction2[TunaInstruction2["
|
|
1186
|
-
TunaInstruction2[TunaInstruction2["
|
|
1187
|
-
TunaInstruction2[TunaInstruction2["
|
|
1188
|
-
TunaInstruction2[TunaInstruction2["
|
|
1189
|
-
TunaInstruction2[TunaInstruction2["
|
|
1190
|
-
TunaInstruction2[TunaInstruction2["
|
|
1191
|
-
TunaInstruction2[TunaInstruction2["
|
|
1192
|
-
TunaInstruction2[TunaInstruction2["
|
|
1193
|
-
TunaInstruction2[TunaInstruction2["
|
|
1209
|
+
TunaInstruction2[TunaInstruction2["RebalancePositionFusion"] = 20] = "RebalancePositionFusion";
|
|
1210
|
+
TunaInstruction2[TunaInstruction2["RebalancePositionOrca"] = 21] = "RebalancePositionOrca";
|
|
1211
|
+
TunaInstruction2[TunaInstruction2["RemoveLiquidityFusion"] = 22] = "RemoveLiquidityFusion";
|
|
1212
|
+
TunaInstruction2[TunaInstruction2["RemoveLiquidityOrca"] = 23] = "RemoveLiquidityOrca";
|
|
1213
|
+
TunaInstruction2[TunaInstruction2["RepayBadDebt"] = 24] = "RepayBadDebt";
|
|
1214
|
+
TunaInstruction2[TunaInstruction2["RepayDebt"] = 25] = "RepayDebt";
|
|
1215
|
+
TunaInstruction2[TunaInstruction2["SetAdminAuthority"] = 26] = "SetAdminAuthority";
|
|
1216
|
+
TunaInstruction2[TunaInstruction2["SetDefaultMaxPercentageOfLeftovers"] = 27] = "SetDefaultMaxPercentageOfLeftovers";
|
|
1217
|
+
TunaInstruction2[TunaInstruction2["SetDefaultMaxSwapSlippage"] = 28] = "SetDefaultMaxSwapSlippage";
|
|
1218
|
+
TunaInstruction2[TunaInstruction2["SetDefaultOraclePriceDeviationThreshold"] = 29] = "SetDefaultOraclePriceDeviationThreshold";
|
|
1219
|
+
TunaInstruction2[TunaInstruction2["SetFeeRecipient"] = 30] = "SetFeeRecipient";
|
|
1220
|
+
TunaInstruction2[TunaInstruction2["SetLimitOrders"] = 31] = "SetLimitOrders";
|
|
1221
|
+
TunaInstruction2[TunaInstruction2["SetLiquidatorAuthority"] = 32] = "SetLiquidatorAuthority";
|
|
1222
|
+
TunaInstruction2[TunaInstruction2["SetOwnerAuthority"] = 33] = "SetOwnerAuthority";
|
|
1223
|
+
TunaInstruction2[TunaInstruction2["SetSuspendedState"] = 34] = "SetSuspendedState";
|
|
1224
|
+
TunaInstruction2[TunaInstruction2["SetTunaPositionFlags"] = 35] = "SetTunaPositionFlags";
|
|
1225
|
+
TunaInstruction2[TunaInstruction2["SetTunaPositionRebalanceThreshold"] = 36] = "SetTunaPositionRebalanceThreshold";
|
|
1226
|
+
TunaInstruction2[TunaInstruction2["UpdateMarket"] = 37] = "UpdateMarket";
|
|
1227
|
+
TunaInstruction2[TunaInstruction2["UpdateVault"] = 38] = "UpdateVault";
|
|
1228
|
+
TunaInstruction2[TunaInstruction2["Withdraw"] = 39] = "Withdraw";
|
|
1194
1229
|
return TunaInstruction2;
|
|
1195
1230
|
})(TunaInstruction || {});
|
|
1196
1231
|
function identifyTunaInstruction(instruction) {
|
|
@@ -1375,6 +1410,24 @@ function identifyTunaInstruction(instruction) {
|
|
|
1375
1410
|
)) {
|
|
1376
1411
|
return 19 /* OpenPositionWithLiquidityOrca */;
|
|
1377
1412
|
}
|
|
1413
|
+
if ((0, import_kit11.containsBytes)(
|
|
1414
|
+
data,
|
|
1415
|
+
(0, import_kit11.fixEncoderSize)((0, import_kit11.getBytesEncoder)(), 8).encode(
|
|
1416
|
+
new Uint8Array([190, 86, 41, 87, 5, 231, 10, 51])
|
|
1417
|
+
),
|
|
1418
|
+
0
|
|
1419
|
+
)) {
|
|
1420
|
+
return 20 /* RebalancePositionFusion */;
|
|
1421
|
+
}
|
|
1422
|
+
if ((0, import_kit11.containsBytes)(
|
|
1423
|
+
data,
|
|
1424
|
+
(0, import_kit11.fixEncoderSize)((0, import_kit11.getBytesEncoder)(), 8).encode(
|
|
1425
|
+
new Uint8Array([124, 212, 164, 128, 31, 143, 101, 231])
|
|
1426
|
+
),
|
|
1427
|
+
0
|
|
1428
|
+
)) {
|
|
1429
|
+
return 21 /* RebalancePositionOrca */;
|
|
1430
|
+
}
|
|
1378
1431
|
if ((0, import_kit11.containsBytes)(
|
|
1379
1432
|
data,
|
|
1380
1433
|
(0, import_kit11.fixEncoderSize)((0, import_kit11.getBytesEncoder)(), 8).encode(
|
|
@@ -1382,7 +1435,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1382
1435
|
),
|
|
1383
1436
|
0
|
|
1384
1437
|
)) {
|
|
1385
|
-
return
|
|
1438
|
+
return 22 /* RemoveLiquidityFusion */;
|
|
1386
1439
|
}
|
|
1387
1440
|
if ((0, import_kit11.containsBytes)(
|
|
1388
1441
|
data,
|
|
@@ -1391,7 +1444,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1391
1444
|
),
|
|
1392
1445
|
0
|
|
1393
1446
|
)) {
|
|
1394
|
-
return
|
|
1447
|
+
return 23 /* RemoveLiquidityOrca */;
|
|
1395
1448
|
}
|
|
1396
1449
|
if ((0, import_kit11.containsBytes)(
|
|
1397
1450
|
data,
|
|
@@ -1400,7 +1453,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1400
1453
|
),
|
|
1401
1454
|
0
|
|
1402
1455
|
)) {
|
|
1403
|
-
return
|
|
1456
|
+
return 24 /* RepayBadDebt */;
|
|
1404
1457
|
}
|
|
1405
1458
|
if ((0, import_kit11.containsBytes)(
|
|
1406
1459
|
data,
|
|
@@ -1409,7 +1462,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1409
1462
|
),
|
|
1410
1463
|
0
|
|
1411
1464
|
)) {
|
|
1412
|
-
return
|
|
1465
|
+
return 25 /* RepayDebt */;
|
|
1413
1466
|
}
|
|
1414
1467
|
if ((0, import_kit11.containsBytes)(
|
|
1415
1468
|
data,
|
|
@@ -1418,7 +1471,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1418
1471
|
),
|
|
1419
1472
|
0
|
|
1420
1473
|
)) {
|
|
1421
|
-
return
|
|
1474
|
+
return 26 /* SetAdminAuthority */;
|
|
1422
1475
|
}
|
|
1423
1476
|
if ((0, import_kit11.containsBytes)(
|
|
1424
1477
|
data,
|
|
@@ -1427,7 +1480,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1427
1480
|
),
|
|
1428
1481
|
0
|
|
1429
1482
|
)) {
|
|
1430
|
-
return
|
|
1483
|
+
return 27 /* SetDefaultMaxPercentageOfLeftovers */;
|
|
1431
1484
|
}
|
|
1432
1485
|
if ((0, import_kit11.containsBytes)(
|
|
1433
1486
|
data,
|
|
@@ -1436,7 +1489,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1436
1489
|
),
|
|
1437
1490
|
0
|
|
1438
1491
|
)) {
|
|
1439
|
-
return
|
|
1492
|
+
return 28 /* SetDefaultMaxSwapSlippage */;
|
|
1440
1493
|
}
|
|
1441
1494
|
if ((0, import_kit11.containsBytes)(
|
|
1442
1495
|
data,
|
|
@@ -1445,7 +1498,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1445
1498
|
),
|
|
1446
1499
|
0
|
|
1447
1500
|
)) {
|
|
1448
|
-
return
|
|
1501
|
+
return 29 /* SetDefaultOraclePriceDeviationThreshold */;
|
|
1449
1502
|
}
|
|
1450
1503
|
if ((0, import_kit11.containsBytes)(
|
|
1451
1504
|
data,
|
|
@@ -1454,7 +1507,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1454
1507
|
),
|
|
1455
1508
|
0
|
|
1456
1509
|
)) {
|
|
1457
|
-
return
|
|
1510
|
+
return 30 /* SetFeeRecipient */;
|
|
1458
1511
|
}
|
|
1459
1512
|
if ((0, import_kit11.containsBytes)(
|
|
1460
1513
|
data,
|
|
@@ -1463,7 +1516,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1463
1516
|
),
|
|
1464
1517
|
0
|
|
1465
1518
|
)) {
|
|
1466
|
-
return
|
|
1519
|
+
return 31 /* SetLimitOrders */;
|
|
1467
1520
|
}
|
|
1468
1521
|
if ((0, import_kit11.containsBytes)(
|
|
1469
1522
|
data,
|
|
@@ -1472,7 +1525,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1472
1525
|
),
|
|
1473
1526
|
0
|
|
1474
1527
|
)) {
|
|
1475
|
-
return
|
|
1528
|
+
return 32 /* SetLiquidatorAuthority */;
|
|
1476
1529
|
}
|
|
1477
1530
|
if ((0, import_kit11.containsBytes)(
|
|
1478
1531
|
data,
|
|
@@ -1481,7 +1534,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1481
1534
|
),
|
|
1482
1535
|
0
|
|
1483
1536
|
)) {
|
|
1484
|
-
return
|
|
1537
|
+
return 33 /* SetOwnerAuthority */;
|
|
1485
1538
|
}
|
|
1486
1539
|
if ((0, import_kit11.containsBytes)(
|
|
1487
1540
|
data,
|
|
@@ -1490,7 +1543,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1490
1543
|
),
|
|
1491
1544
|
0
|
|
1492
1545
|
)) {
|
|
1493
|
-
return
|
|
1546
|
+
return 34 /* SetSuspendedState */;
|
|
1494
1547
|
}
|
|
1495
1548
|
if ((0, import_kit11.containsBytes)(
|
|
1496
1549
|
data,
|
|
@@ -1499,7 +1552,16 @@ function identifyTunaInstruction(instruction) {
|
|
|
1499
1552
|
),
|
|
1500
1553
|
0
|
|
1501
1554
|
)) {
|
|
1502
|
-
return
|
|
1555
|
+
return 35 /* SetTunaPositionFlags */;
|
|
1556
|
+
}
|
|
1557
|
+
if ((0, import_kit11.containsBytes)(
|
|
1558
|
+
data,
|
|
1559
|
+
(0, import_kit11.fixEncoderSize)((0, import_kit11.getBytesEncoder)(), 8).encode(
|
|
1560
|
+
new Uint8Array([108, 170, 86, 159, 171, 164, 28, 51])
|
|
1561
|
+
),
|
|
1562
|
+
0
|
|
1563
|
+
)) {
|
|
1564
|
+
return 36 /* SetTunaPositionRebalanceThreshold */;
|
|
1503
1565
|
}
|
|
1504
1566
|
if ((0, import_kit11.containsBytes)(
|
|
1505
1567
|
data,
|
|
@@ -1508,7 +1570,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1508
1570
|
),
|
|
1509
1571
|
0
|
|
1510
1572
|
)) {
|
|
1511
|
-
return
|
|
1573
|
+
return 37 /* UpdateMarket */;
|
|
1512
1574
|
}
|
|
1513
1575
|
if ((0, import_kit11.containsBytes)(
|
|
1514
1576
|
data,
|
|
@@ -1517,7 +1579,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1517
1579
|
),
|
|
1518
1580
|
0
|
|
1519
1581
|
)) {
|
|
1520
|
-
return
|
|
1582
|
+
return 38 /* UpdateVault */;
|
|
1521
1583
|
}
|
|
1522
1584
|
if ((0, import_kit11.containsBytes)(
|
|
1523
1585
|
data,
|
|
@@ -1526,7 +1588,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1526
1588
|
),
|
|
1527
1589
|
0
|
|
1528
1590
|
)) {
|
|
1529
|
-
return
|
|
1591
|
+
return 39 /* Withdraw */;
|
|
1530
1592
|
}
|
|
1531
1593
|
throw new Error(
|
|
1532
1594
|
"The provided instruction could not be identified as a tuna instruction."
|
|
@@ -1537,34 +1599,34 @@ function identifyTunaInstruction(instruction) {
|
|
|
1537
1599
|
var TUNA_ERROR__AMOUNT_SLIPPAGE_EXCEEDED = 6e3;
|
|
1538
1600
|
var TUNA_ERROR__BAD_DEBT = 6001;
|
|
1539
1601
|
var TUNA_ERROR__INVALID_REMAINING_ACCOUNTS_LENGTH = 6002;
|
|
1540
|
-
var
|
|
1541
|
-
var
|
|
1542
|
-
var
|
|
1543
|
-
var
|
|
1544
|
-
var
|
|
1545
|
-
var
|
|
1546
|
-
var
|
|
1547
|
-
var
|
|
1548
|
-
var
|
|
1549
|
-
var
|
|
1550
|
-
var
|
|
1551
|
-
var
|
|
1552
|
-
var
|
|
1553
|
-
var
|
|
1554
|
-
var
|
|
1555
|
-
var
|
|
1556
|
-
var
|
|
1557
|
-
var
|
|
1558
|
-
var
|
|
1559
|
-
var
|
|
1560
|
-
var
|
|
1561
|
-
var
|
|
1562
|
-
var
|
|
1563
|
-
var
|
|
1564
|
-
var
|
|
1565
|
-
var
|
|
1566
|
-
var
|
|
1567
|
-
var
|
|
1602
|
+
var TUNA_ERROR__INVALID_ACCOUNT_OWNER = 6003;
|
|
1603
|
+
var TUNA_ERROR__INVALID_INSTRUCTION_ARGUMENTS = 6004;
|
|
1604
|
+
var TUNA_ERROR__INVALID_MARKET_MAKER = 6005;
|
|
1605
|
+
var TUNA_ERROR__INVALID_SQRT_PRICE_LIMIT_DIRECTION = 6006;
|
|
1606
|
+
var TUNA_ERROR__INVALID_TICK_ARRAY_SEQUENCE = 6007;
|
|
1607
|
+
var TUNA_ERROR__INSUFFICIENT_LIQUIDITY = 6008;
|
|
1608
|
+
var TUNA_ERROR__INTEREST_RATE_IS_OUT_OF_RANGE = 6009;
|
|
1609
|
+
var TUNA_ERROR__LEVERAGE_IS_OUT_OF_RANGE = 6010;
|
|
1610
|
+
var TUNA_ERROR__LEFTOVERS_EXCEEDED = 6011;
|
|
1611
|
+
var TUNA_ERROR__LIMIT_ORDER_EXECUTION_FEE_IS_OUT_OF_RANGE = 6012;
|
|
1612
|
+
var TUNA_ERROR__LIQUIDATION_FEE_IS_OUT_OF_RANGE = 6013;
|
|
1613
|
+
var TUNA_ERROR__LIQUIDATION_THRESHOLD_IS_OUT_OF_RANGE = 6014;
|
|
1614
|
+
var TUNA_ERROR__LIQUIDITY_ZERO = 6015;
|
|
1615
|
+
var TUNA_ERROR__MARKET_DISABLED = 6016;
|
|
1616
|
+
var TUNA_ERROR__MARKET_DEBT_LIMIT_EXCEEDED = 6017;
|
|
1617
|
+
var TUNA_ERROR__MATH_OVERFLOW = 6018;
|
|
1618
|
+
var TUNA_ERROR__MATH_UNDERFLOW = 6019;
|
|
1619
|
+
var TUNA_ERROR__NO_EXTRA_ACCOUNTS_FOR_TRANSFER_HOOK = 6020;
|
|
1620
|
+
var TUNA_ERROR__ORACLE_STALE_PRICE = 6021;
|
|
1621
|
+
var TUNA_ERROR__ORACLE_PRICE_DEVIATION_THRESHOLD_EXCEEDED = 6022;
|
|
1622
|
+
var TUNA_ERROR__ORACLE_PRICE_DEVIATION_THRESHOLD_OUT_OF_RANGE = 6023;
|
|
1623
|
+
var TUNA_ERROR__PARTIAL_FILL_ERROR = 6024;
|
|
1624
|
+
var TUNA_ERROR__POSITION_IS_HEALTHY = 6025;
|
|
1625
|
+
var TUNA_ERROR__POSITION_IS_LIQUIDATED = 6026;
|
|
1626
|
+
var TUNA_ERROR__POSITION_IS_UNHEALTHY = 6027;
|
|
1627
|
+
var TUNA_ERROR__POSITION_NOT_EMPTY = 6028;
|
|
1628
|
+
var TUNA_ERROR__PROTOCOL_FEE_IS_OUT_OF_RANGE = 6029;
|
|
1629
|
+
var TUNA_ERROR__REBALANCE_CONDITIONS_NOT_MET = 6030;
|
|
1568
1630
|
var TUNA_ERROR__REMAINING_ACCOUNTS_DUPLICATED_ACCOUNTS_TYPE = 6031;
|
|
1569
1631
|
var TUNA_ERROR__REMAINING_ACCOUNTS_INVALID_SLICE = 6032;
|
|
1570
1632
|
var TUNA_ERROR__REMAINING_ACCOUNTS_INVALID_SLICE_LENGTH = 6033;
|
|
@@ -1576,59 +1638,60 @@ var TUNA_ERROR__SUPPLY_LIMIT_EXCEEDED = 6038;
|
|
|
1576
1638
|
var TUNA_ERROR__SUSPENDED = 6039;
|
|
1577
1639
|
var TUNA_ERROR__SWAP_SLIPPAGE_EXCEEDED = 6040;
|
|
1578
1640
|
var TUNA_ERROR__SWAP_SLIPPAGE_IS_OUT_OF_RANGE = 6041;
|
|
1579
|
-
var
|
|
1580
|
-
var
|
|
1581
|
-
var
|
|
1582
|
-
var
|
|
1583
|
-
var
|
|
1584
|
-
var
|
|
1585
|
-
var
|
|
1586
|
-
var
|
|
1587
|
-
var
|
|
1588
|
-
var
|
|
1589
|
-
var
|
|
1590
|
-
var
|
|
1591
|
-
var
|
|
1592
|
-
var
|
|
1593
|
-
var
|
|
1594
|
-
var
|
|
1595
|
-
var
|
|
1596
|
-
var
|
|
1597
|
-
var
|
|
1641
|
+
var TUNA_ERROR__SWAP_TO_POSITION_RATIO_ESTIMATION_FAILED = 6042;
|
|
1642
|
+
var TUNA_ERROR__SWAP_QUOTE_NOT_EQUAL_TO_ACTUAL_SWAP_AMOUNT = 6043;
|
|
1643
|
+
var TUNA_ERROR__TICK_INDEX_OF_BOUNDS = 6044;
|
|
1644
|
+
var TUNA_ERROR__TRANSFER_FEE_CALCULATION_ERROR = 6045;
|
|
1645
|
+
var TUNA_ERROR__TYPE_CAST_OVERFLOW = 6046;
|
|
1646
|
+
var TUNA_ERROR__UNABLE_TO_LOAD_ACCOUNT_DATA = 6047;
|
|
1647
|
+
var TUNA_ERROR__UNABLE_TO_DESERIALIZE_ACCOUNT_DATA = 6048;
|
|
1648
|
+
var TUNA_ERROR__UNEXPECTED_VALUE = 6049;
|
|
1649
|
+
var TUNA_ERROR__UNSUPPORTED_TOKEN_MINT = 6050;
|
|
1650
|
+
var TUNA_ERROR__VAULT_NOT_INITIALIZED = 6051;
|
|
1651
|
+
var TUNA_ERROR__WITHDRAW_REQUEST_EXCEEDS_USER_BALANCE = 6052;
|
|
1652
|
+
var TUNA_ERROR__ZERO_PRICE_RANGE = 6053;
|
|
1653
|
+
var TUNA_ERROR__ZERO_TRADABLE_AMOUNT = 6054;
|
|
1654
|
+
var TUNA_ERROR__ZERO_YIELD = 6055;
|
|
1655
|
+
var TUNA_ERROR__RAYDIUM_INVALID_FIRST_TICK_ARRAY_ACCOUNT = 6056;
|
|
1656
|
+
var TUNA_ERROR__RAYDIUM_INVALID_TICK_ARRAY = 6057;
|
|
1657
|
+
var TUNA_ERROR__RAYDIUM_INVAILD_TICK_INDEX = 6058;
|
|
1658
|
+
var TUNA_ERROR__RAYDIUM_MAX_TOKEN_OVERFLOW = 6059;
|
|
1659
|
+
var TUNA_ERROR__RAYDIUM_NOT_ENOUGH_TICK_ARRAY_ACCOUNT = 6060;
|
|
1660
|
+
var TUNA_ERROR__RAYDIUM_SQRT_PRICE_LIMIT_OVERFLOW = 6061;
|
|
1661
|
+
var TUNA_ERROR__RAYDIUM_ZERO_AMOUNT_SPECIFIED = 6062;
|
|
1598
1662
|
var tunaErrorMessages;
|
|
1599
1663
|
if (process.env.NODE_ENV !== "production") {
|
|
1600
1664
|
tunaErrorMessages = {
|
|
1601
|
-
[TUNA_ERROR__AMOUNT_SLIPPAGE_EXCEEDED]: `
|
|
1602
|
-
[TUNA_ERROR__BAD_DEBT]: `
|
|
1603
|
-
[TUNA_ERROR__INSUFFICIENT_LIQUIDITY]: `
|
|
1604
|
-
[TUNA_ERROR__INTEREST_RATE_IS_OUT_OF_RANGE]: `
|
|
1605
|
-
[TUNA_ERROR__INVALID_ACCOUNT_OWNER]: `
|
|
1606
|
-
[TUNA_ERROR__INVALID_INSTRUCTION_ARGUMENTS]: `
|
|
1607
|
-
[TUNA_ERROR__INVALID_MARKET_MAKER]: `
|
|
1608
|
-
[TUNA_ERROR__INVALID_REMAINING_ACCOUNTS_LENGTH]: `
|
|
1665
|
+
[TUNA_ERROR__AMOUNT_SLIPPAGE_EXCEEDED]: `Amount slippage exceeded`,
|
|
1666
|
+
[TUNA_ERROR__BAD_DEBT]: `Bad debt is not allowed for the executed instruction`,
|
|
1667
|
+
[TUNA_ERROR__INSUFFICIENT_LIQUIDITY]: `Insufficient liquidity`,
|
|
1668
|
+
[TUNA_ERROR__INTEREST_RATE_IS_OUT_OF_RANGE]: `Interest rate is out of range`,
|
|
1669
|
+
[TUNA_ERROR__INVALID_ACCOUNT_OWNER]: `Invalid account owner`,
|
|
1670
|
+
[TUNA_ERROR__INVALID_INSTRUCTION_ARGUMENTS]: `Invalid instruction arguments`,
|
|
1671
|
+
[TUNA_ERROR__INVALID_MARKET_MAKER]: `Invalid market maker`,
|
|
1672
|
+
[TUNA_ERROR__INVALID_REMAINING_ACCOUNTS_LENGTH]: `Invalid number of remaining accounts`,
|
|
1609
1673
|
[TUNA_ERROR__INVALID_SQRT_PRICE_LIMIT_DIRECTION]: `Provided SqrtPriceLimit not in the same direction as the swap.`,
|
|
1610
|
-
[
|
|
1611
|
-
[
|
|
1612
|
-
[
|
|
1613
|
-
[
|
|
1614
|
-
[
|
|
1615
|
-
[
|
|
1616
|
-
[TUNA_ERROR__LIQUIDATION_THRESHOLD_IS_OUT_OF_RANGE]: `LiquidationThresholdIsOutOfRange`,
|
|
1674
|
+
[TUNA_ERROR__INVALID_TICK_ARRAY_SEQUENCE]: `Invalid tick array sequence provided for instruction`,
|
|
1675
|
+
[TUNA_ERROR__LEFTOVERS_EXCEEDED]: `Leftovers percentage exceeded the maximum allowed value`,
|
|
1676
|
+
[TUNA_ERROR__LEVERAGE_IS_OUT_OF_RANGE]: `Leverage is out or range`,
|
|
1677
|
+
[TUNA_ERROR__LIMIT_ORDER_EXECUTION_FEE_IS_OUT_OF_RANGE]: `Limit order execution fee is out of range`,
|
|
1678
|
+
[TUNA_ERROR__LIQUIDATION_FEE_IS_OUT_OF_RANGE]: `Liquidation fee is out of range`,
|
|
1679
|
+
[TUNA_ERROR__LIQUIDATION_THRESHOLD_IS_OUT_OF_RANGE]: `Liquidation threshold is out of range`,
|
|
1617
1680
|
[TUNA_ERROR__LIQUIDITY_ZERO]: `Liquidity amount must be greater than zero.`,
|
|
1618
|
-
[TUNA_ERROR__MARKET_DEBT_LIMIT_EXCEEDED]: `
|
|
1619
|
-
[TUNA_ERROR__MARKET_DISABLED]: `
|
|
1620
|
-
[TUNA_ERROR__MATH_OVERFLOW]: `
|
|
1621
|
-
[TUNA_ERROR__MATH_UNDERFLOW]: `
|
|
1681
|
+
[TUNA_ERROR__MARKET_DEBT_LIMIT_EXCEEDED]: `Exceed the maximum allowed debt for the market`,
|
|
1682
|
+
[TUNA_ERROR__MARKET_DISABLED]: `Market is disabled`,
|
|
1683
|
+
[TUNA_ERROR__MATH_OVERFLOW]: `Math overflow`,
|
|
1684
|
+
[TUNA_ERROR__MATH_UNDERFLOW]: `Math underflow`,
|
|
1622
1685
|
[TUNA_ERROR__NO_EXTRA_ACCOUNTS_FOR_TRANSFER_HOOK]: `Unable to call transfer hook without extra accounts`,
|
|
1623
1686
|
[TUNA_ERROR__ORACLE_PRICE_DEVIATION_THRESHOLD_EXCEEDED]: `OraclePriceDeviationThresholdExceeded`,
|
|
1624
1687
|
[TUNA_ERROR__ORACLE_PRICE_DEVIATION_THRESHOLD_OUT_OF_RANGE]: `OraclePriceDeviationThresholdOutOfRange`,
|
|
1625
|
-
[TUNA_ERROR__ORACLE_STALE_PRICE]: `
|
|
1688
|
+
[TUNA_ERROR__ORACLE_STALE_PRICE]: `Oracle price is stale`,
|
|
1626
1689
|
[TUNA_ERROR__PARTIAL_FILL_ERROR]: `Trade resulted in partial fill`,
|
|
1627
|
-
[TUNA_ERROR__POSITION_IS_HEALTHY]: `
|
|
1628
|
-
[TUNA_ERROR__POSITION_IS_LIQUIDATED]: `
|
|
1629
|
-
[TUNA_ERROR__POSITION_IS_UNHEALTHY]: `
|
|
1630
|
-
[TUNA_ERROR__POSITION_NOT_EMPTY]: `
|
|
1631
|
-
[TUNA_ERROR__PROTOCOL_FEE_IS_OUT_OF_RANGE]: `
|
|
1690
|
+
[TUNA_ERROR__POSITION_IS_HEALTHY]: `Position is healthy`,
|
|
1691
|
+
[TUNA_ERROR__POSITION_IS_LIQUIDATED]: `Position is already liquidated`,
|
|
1692
|
+
[TUNA_ERROR__POSITION_IS_UNHEALTHY]: `Position is unhealthy`,
|
|
1693
|
+
[TUNA_ERROR__POSITION_NOT_EMPTY]: `Position is not empty`,
|
|
1694
|
+
[TUNA_ERROR__PROTOCOL_FEE_IS_OUT_OF_RANGE]: `Protocol fee is out of range`,
|
|
1632
1695
|
[TUNA_ERROR__RAYDIUM_INVAILD_TICK_INDEX]: `RaydiumInvaildTickIndex`,
|
|
1633
1696
|
[TUNA_ERROR__RAYDIUM_INVALID_FIRST_TICK_ARRAY_ACCOUNT]: `RaydiumInvalidFirstTickArrayAccount`,
|
|
1634
1697
|
[TUNA_ERROR__RAYDIUM_INVALID_TICK_ARRAY]: `RaydiumInvalidTickArray`,
|
|
@@ -1636,29 +1699,32 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
1636
1699
|
[TUNA_ERROR__RAYDIUM_NOT_ENOUGH_TICK_ARRAY_ACCOUNT]: `RaydiumNotEnoughTickArrayAccount`,
|
|
1637
1700
|
[TUNA_ERROR__RAYDIUM_SQRT_PRICE_LIMIT_OVERFLOW]: `RaydiumSqrtPriceLimitOverflow`,
|
|
1638
1701
|
[TUNA_ERROR__RAYDIUM_ZERO_AMOUNT_SPECIFIED]: `RaydiumZeroAmountSpecified`,
|
|
1702
|
+
[TUNA_ERROR__REBALANCE_CONDITIONS_NOT_MET]: `Rebalance conditions are not met`,
|
|
1639
1703
|
[TUNA_ERROR__REMAINING_ACCOUNTS_DUPLICATED_ACCOUNTS_TYPE]: `Same accounts type is provided more than once`,
|
|
1640
1704
|
[TUNA_ERROR__REMAINING_ACCOUNTS_INSUFFICIENT]: `Insufficient remaining accounts`,
|
|
1641
1705
|
[TUNA_ERROR__REMAINING_ACCOUNTS_INVALID_SLICE]: `Invalid remaining accounts`,
|
|
1642
1706
|
[TUNA_ERROR__REMAINING_ACCOUNTS_INVALID_SLICE_LENGTH]: `Invalid remaining accounts slice length`,
|
|
1643
1707
|
[TUNA_ERROR__REQUIRED_REMAINING_ACCOUNT_NOT_PROVIDED]: `Required remaining account is not provided`,
|
|
1644
|
-
[TUNA_ERROR__SOLVER_FAILED_TO_FIND_ROOT]: `
|
|
1645
|
-
[TUNA_ERROR__SQRT_PRICE_OUT_OF_BOUNDS]: `
|
|
1646
|
-
[TUNA_ERROR__SUPPLY_LIMIT_EXCEEDED]: `
|
|
1647
|
-
[TUNA_ERROR__SUSPENDED]: `
|
|
1648
|
-
[
|
|
1649
|
-
[
|
|
1650
|
-
[
|
|
1708
|
+
[TUNA_ERROR__SOLVER_FAILED_TO_FIND_ROOT]: `Swap equation solver failed to t find the root`,
|
|
1709
|
+
[TUNA_ERROR__SQRT_PRICE_OUT_OF_BOUNDS]: `Provided sqrt price out of bounds`,
|
|
1710
|
+
[TUNA_ERROR__SUPPLY_LIMIT_EXCEEDED]: `Lending vault supply limit exceeded`,
|
|
1711
|
+
[TUNA_ERROR__SUSPENDED]: `Instruction is suspended`,
|
|
1712
|
+
[TUNA_ERROR__SWAP_QUOTE_NOT_EQUAL_TO_ACTUAL_SWAP_AMOUNT]: `Swap quote amount is not equal to the actual swap amount`,
|
|
1713
|
+
[TUNA_ERROR__SWAP_SLIPPAGE_EXCEEDED]: `Maximum allowed swap slippage is exceeded`,
|
|
1714
|
+
[TUNA_ERROR__SWAP_SLIPPAGE_IS_OUT_OF_RANGE]: `Provided swap slippage value is out of range`,
|
|
1715
|
+
[TUNA_ERROR__SWAP_TO_POSITION_RATIO_ESTIMATION_FAILED]: `Swap to position ratio estimation failed`,
|
|
1716
|
+
[TUNA_ERROR__TICK_INDEX_OF_BOUNDS]: `Tick index is out of bounds`,
|
|
1651
1717
|
[TUNA_ERROR__TRANSFER_FEE_CALCULATION_ERROR]: `Transfer fee calculation failed`,
|
|
1652
|
-
[TUNA_ERROR__TYPE_CAST_OVERFLOW]: `
|
|
1653
|
-
[TUNA_ERROR__UNABLE_TO_DESERIALIZE_ACCOUNT_DATA]: `
|
|
1654
|
-
[TUNA_ERROR__UNABLE_TO_LOAD_ACCOUNT_DATA]: `
|
|
1655
|
-
[TUNA_ERROR__UNEXPECTED_VALUE]: `
|
|
1718
|
+
[TUNA_ERROR__TYPE_CAST_OVERFLOW]: `Type cast overflow`,
|
|
1719
|
+
[TUNA_ERROR__UNABLE_TO_DESERIALIZE_ACCOUNT_DATA]: `Unable to deserialize the account data`,
|
|
1720
|
+
[TUNA_ERROR__UNABLE_TO_LOAD_ACCOUNT_DATA]: `Unable to load the account data`,
|
|
1721
|
+
[TUNA_ERROR__UNEXPECTED_VALUE]: `Unexpected value`,
|
|
1656
1722
|
[TUNA_ERROR__UNSUPPORTED_TOKEN_MINT]: `Token mint has unsupported attributes`,
|
|
1657
|
-
[TUNA_ERROR__VAULT_NOT_INITIALIZED]: `
|
|
1658
|
-
[TUNA_ERROR__WITHDRAW_REQUEST_EXCEEDS_USER_BALANCE]: `
|
|
1659
|
-
[TUNA_ERROR__ZERO_PRICE_RANGE]: `
|
|
1723
|
+
[TUNA_ERROR__VAULT_NOT_INITIALIZED]: `Lending vault is not initialized`,
|
|
1724
|
+
[TUNA_ERROR__WITHDRAW_REQUEST_EXCEEDS_USER_BALANCE]: `Withdraw request the exceeds user balance`,
|
|
1725
|
+
[TUNA_ERROR__ZERO_PRICE_RANGE]: `Zero price range: the lower price is equal to upper price)`,
|
|
1660
1726
|
[TUNA_ERROR__ZERO_TRADABLE_AMOUNT]: `There are no tradable amount to swap.`,
|
|
1661
|
-
[TUNA_ERROR__ZERO_YIELD]: `
|
|
1727
|
+
[TUNA_ERROR__ZERO_YIELD]: `Collected yield is zero`
|
|
1662
1728
|
};
|
|
1663
1729
|
}
|
|
1664
1730
|
function getTunaErrorMessage(code) {
|
|
@@ -4721,58 +4787,48 @@ function parseOpenPositionWithLiquidityOrcaInstruction(instruction) {
|
|
|
4721
4787
|
};
|
|
4722
4788
|
}
|
|
4723
4789
|
|
|
4724
|
-
// src/generated/instructions/
|
|
4790
|
+
// src/generated/instructions/rebalancePositionFusion.ts
|
|
4725
4791
|
var import_kit34 = require("@solana/kit");
|
|
4726
|
-
var
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4792
|
+
var REBALANCE_POSITION_FUSION_DISCRIMINATOR = new Uint8Array([
|
|
4793
|
+
190,
|
|
4794
|
+
86,
|
|
4795
|
+
41,
|
|
4796
|
+
87,
|
|
4797
|
+
5,
|
|
4798
|
+
231,
|
|
4799
|
+
10,
|
|
4800
|
+
51
|
|
4735
4801
|
]);
|
|
4736
|
-
function
|
|
4802
|
+
function getRebalancePositionFusionDiscriminatorBytes() {
|
|
4737
4803
|
return (0, import_kit34.fixEncoderSize)((0, import_kit34.getBytesEncoder)(), 8).encode(
|
|
4738
|
-
|
|
4804
|
+
REBALANCE_POSITION_FUSION_DISCRIMINATOR
|
|
4739
4805
|
);
|
|
4740
4806
|
}
|
|
4741
|
-
function
|
|
4807
|
+
function getRebalancePositionFusionInstructionDataEncoder() {
|
|
4742
4808
|
return (0, import_kit34.transformEncoder)(
|
|
4743
4809
|
(0, import_kit34.getStructEncoder)([
|
|
4744
4810
|
["discriminator", (0, import_kit34.fixEncoderSize)((0, import_kit34.getBytesEncoder)(), 8)],
|
|
4745
|
-
["withdrawPercent", (0, import_kit34.getU32Encoder)()],
|
|
4746
|
-
["swapToToken", (0, import_kit34.getU8Encoder)()],
|
|
4747
|
-
["minRemovedAmountA", (0, import_kit34.getU64Encoder)()],
|
|
4748
|
-
["minRemovedAmountB", (0, import_kit34.getU64Encoder)()],
|
|
4749
|
-
["maxSwapSlippage", (0, import_kit34.getU32Encoder)()],
|
|
4750
4811
|
["remainingAccountsInfo", getRemainingAccountsInfoEncoder()]
|
|
4751
4812
|
]),
|
|
4752
4813
|
(value) => ({
|
|
4753
4814
|
...value,
|
|
4754
|
-
discriminator:
|
|
4815
|
+
discriminator: REBALANCE_POSITION_FUSION_DISCRIMINATOR
|
|
4755
4816
|
})
|
|
4756
4817
|
);
|
|
4757
4818
|
}
|
|
4758
|
-
function
|
|
4819
|
+
function getRebalancePositionFusionInstructionDataDecoder() {
|
|
4759
4820
|
return (0, import_kit34.getStructDecoder)([
|
|
4760
4821
|
["discriminator", (0, import_kit34.fixDecoderSize)((0, import_kit34.getBytesDecoder)(), 8)],
|
|
4761
|
-
["withdrawPercent", (0, import_kit34.getU32Decoder)()],
|
|
4762
|
-
["swapToToken", (0, import_kit34.getU8Decoder)()],
|
|
4763
|
-
["minRemovedAmountA", (0, import_kit34.getU64Decoder)()],
|
|
4764
|
-
["minRemovedAmountB", (0, import_kit34.getU64Decoder)()],
|
|
4765
|
-
["maxSwapSlippage", (0, import_kit34.getU32Decoder)()],
|
|
4766
4822
|
["remainingAccountsInfo", getRemainingAccountsInfoDecoder()]
|
|
4767
4823
|
]);
|
|
4768
4824
|
}
|
|
4769
|
-
function
|
|
4825
|
+
function getRebalancePositionFusionInstructionDataCodec() {
|
|
4770
4826
|
return (0, import_kit34.combineCodec)(
|
|
4771
|
-
|
|
4772
|
-
|
|
4827
|
+
getRebalancePositionFusionInstructionDataEncoder(),
|
|
4828
|
+
getRebalancePositionFusionInstructionDataDecoder()
|
|
4773
4829
|
);
|
|
4774
4830
|
}
|
|
4775
|
-
function
|
|
4831
|
+
function getRebalancePositionFusionInstruction(input, config) {
|
|
4776
4832
|
const programAddress = config?.programAddress ?? TUNA_PROGRAM_ADDRESS;
|
|
4777
4833
|
const originalAccounts = {
|
|
4778
4834
|
authority: { value: input.authority ?? null, isWritable: true },
|
|
@@ -4784,8 +4840,6 @@ function getRemoveLiquidityFusionInstruction(input, config) {
|
|
|
4784
4840
|
tokenProgramB: { value: input.tokenProgramB ?? null, isWritable: false },
|
|
4785
4841
|
vaultA: { value: input.vaultA ?? null, isWritable: true },
|
|
4786
4842
|
vaultB: { value: input.vaultB ?? null, isWritable: true },
|
|
4787
|
-
vaultAAta: { value: input.vaultAAta ?? null, isWritable: true },
|
|
4788
|
-
vaultBAta: { value: input.vaultBAta ?? null, isWritable: true },
|
|
4789
4843
|
tunaPosition: { value: input.tunaPosition ?? null, isWritable: true },
|
|
4790
4844
|
tunaPositionAta: { value: input.tunaPositionAta ?? null, isWritable: true },
|
|
4791
4845
|
tunaPositionAtaA: {
|
|
@@ -4796,12 +4850,12 @@ function getRemoveLiquidityFusionInstruction(input, config) {
|
|
|
4796
4850
|
value: input.tunaPositionAtaB ?? null,
|
|
4797
4851
|
isWritable: true
|
|
4798
4852
|
},
|
|
4799
|
-
|
|
4800
|
-
value: input.
|
|
4853
|
+
feeRecipientAtaA: {
|
|
4854
|
+
value: input.feeRecipientAtaA ?? null,
|
|
4801
4855
|
isWritable: true
|
|
4802
4856
|
},
|
|
4803
|
-
|
|
4804
|
-
value: input.
|
|
4857
|
+
feeRecipientAtaB: {
|
|
4858
|
+
value: input.feeRecipientAtaB ?? null,
|
|
4805
4859
|
isWritable: true
|
|
4806
4860
|
},
|
|
4807
4861
|
pythOraclePriceFeedA: {
|
|
@@ -4834,14 +4888,12 @@ function getRemoveLiquidityFusionInstruction(input, config) {
|
|
|
4834
4888
|
getAccountMeta(accounts.tokenProgramB),
|
|
4835
4889
|
getAccountMeta(accounts.vaultA),
|
|
4836
4890
|
getAccountMeta(accounts.vaultB),
|
|
4837
|
-
getAccountMeta(accounts.vaultAAta),
|
|
4838
|
-
getAccountMeta(accounts.vaultBAta),
|
|
4839
4891
|
getAccountMeta(accounts.tunaPosition),
|
|
4840
4892
|
getAccountMeta(accounts.tunaPositionAta),
|
|
4841
4893
|
getAccountMeta(accounts.tunaPositionAtaA),
|
|
4842
4894
|
getAccountMeta(accounts.tunaPositionAtaB),
|
|
4843
|
-
getAccountMeta(accounts.
|
|
4844
|
-
getAccountMeta(accounts.
|
|
4895
|
+
getAccountMeta(accounts.feeRecipientAtaA),
|
|
4896
|
+
getAccountMeta(accounts.feeRecipientAtaB),
|
|
4845
4897
|
getAccountMeta(accounts.pythOraclePriceFeedA),
|
|
4846
4898
|
getAccountMeta(accounts.pythOraclePriceFeedB),
|
|
4847
4899
|
getAccountMeta(accounts.fusionammProgram),
|
|
@@ -4850,14 +4902,14 @@ function getRemoveLiquidityFusionInstruction(input, config) {
|
|
|
4850
4902
|
getAccountMeta(accounts.memoProgram)
|
|
4851
4903
|
],
|
|
4852
4904
|
programAddress,
|
|
4853
|
-
data:
|
|
4905
|
+
data: getRebalancePositionFusionInstructionDataEncoder().encode(
|
|
4854
4906
|
args
|
|
4855
4907
|
)
|
|
4856
4908
|
};
|
|
4857
4909
|
return instruction;
|
|
4858
4910
|
}
|
|
4859
|
-
function
|
|
4860
|
-
if (instruction.accounts.length <
|
|
4911
|
+
function parseRebalancePositionFusionInstruction(instruction) {
|
|
4912
|
+
if (instruction.accounts.length < 21) {
|
|
4861
4913
|
throw new Error("Not enough accounts");
|
|
4862
4914
|
}
|
|
4863
4915
|
let accountIndex = 0;
|
|
@@ -4878,14 +4930,12 @@ function parseRemoveLiquidityFusionInstruction(instruction) {
|
|
|
4878
4930
|
tokenProgramB: getNextAccount(),
|
|
4879
4931
|
vaultA: getNextAccount(),
|
|
4880
4932
|
vaultB: getNextAccount(),
|
|
4881
|
-
vaultAAta: getNextAccount(),
|
|
4882
|
-
vaultBAta: getNextAccount(),
|
|
4883
4933
|
tunaPosition: getNextAccount(),
|
|
4884
4934
|
tunaPositionAta: getNextAccount(),
|
|
4885
4935
|
tunaPositionAtaA: getNextAccount(),
|
|
4886
4936
|
tunaPositionAtaB: getNextAccount(),
|
|
4887
|
-
|
|
4888
|
-
|
|
4937
|
+
feeRecipientAtaA: getNextAccount(),
|
|
4938
|
+
feeRecipientAtaB: getNextAccount(),
|
|
4889
4939
|
pythOraclePriceFeedA: getNextAccount(),
|
|
4890
4940
|
pythOraclePriceFeedB: getNextAccount(),
|
|
4891
4941
|
fusionammProgram: getNextAccount(),
|
|
@@ -4893,75 +4943,63 @@ function parseRemoveLiquidityFusionInstruction(instruction) {
|
|
|
4893
4943
|
fusionPosition: getNextAccount(),
|
|
4894
4944
|
memoProgram: getNextAccount()
|
|
4895
4945
|
},
|
|
4896
|
-
data:
|
|
4946
|
+
data: getRebalancePositionFusionInstructionDataDecoder().decode(
|
|
4897
4947
|
instruction.data
|
|
4898
4948
|
)
|
|
4899
4949
|
};
|
|
4900
4950
|
}
|
|
4901
4951
|
|
|
4902
|
-
// src/generated/instructions/
|
|
4952
|
+
// src/generated/instructions/rebalancePositionOrca.ts
|
|
4903
4953
|
var import_kit35 = require("@solana/kit");
|
|
4904
|
-
var
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4954
|
+
var REBALANCE_POSITION_ORCA_DISCRIMINATOR = new Uint8Array([
|
|
4955
|
+
124,
|
|
4956
|
+
212,
|
|
4957
|
+
164,
|
|
4958
|
+
128,
|
|
4959
|
+
31,
|
|
4960
|
+
143,
|
|
4961
|
+
101,
|
|
4962
|
+
231
|
|
4913
4963
|
]);
|
|
4914
|
-
function
|
|
4964
|
+
function getRebalancePositionOrcaDiscriminatorBytes() {
|
|
4915
4965
|
return (0, import_kit35.fixEncoderSize)((0, import_kit35.getBytesEncoder)(), 8).encode(
|
|
4916
|
-
|
|
4966
|
+
REBALANCE_POSITION_ORCA_DISCRIMINATOR
|
|
4917
4967
|
);
|
|
4918
4968
|
}
|
|
4919
|
-
function
|
|
4969
|
+
function getRebalancePositionOrcaInstructionDataEncoder() {
|
|
4920
4970
|
return (0, import_kit35.transformEncoder)(
|
|
4921
4971
|
(0, import_kit35.getStructEncoder)([
|
|
4922
4972
|
["discriminator", (0, import_kit35.fixEncoderSize)((0, import_kit35.getBytesEncoder)(), 8)],
|
|
4923
|
-
["withdrawPercent", (0, import_kit35.getU32Encoder)()],
|
|
4924
|
-
["swapToToken", (0, import_kit35.getU8Encoder)()],
|
|
4925
|
-
["minRemovedAmountA", (0, import_kit35.getU64Encoder)()],
|
|
4926
|
-
["minRemovedAmountB", (0, import_kit35.getU64Encoder)()],
|
|
4927
|
-
["maxSwapSlippage", (0, import_kit35.getU32Encoder)()],
|
|
4928
4973
|
["remainingAccountsInfo", getRemainingAccountsInfoEncoder()]
|
|
4929
4974
|
]),
|
|
4930
4975
|
(value) => ({
|
|
4931
4976
|
...value,
|
|
4932
|
-
discriminator:
|
|
4977
|
+
discriminator: REBALANCE_POSITION_ORCA_DISCRIMINATOR
|
|
4933
4978
|
})
|
|
4934
4979
|
);
|
|
4935
4980
|
}
|
|
4936
|
-
function
|
|
4981
|
+
function getRebalancePositionOrcaInstructionDataDecoder() {
|
|
4937
4982
|
return (0, import_kit35.getStructDecoder)([
|
|
4938
4983
|
["discriminator", (0, import_kit35.fixDecoderSize)((0, import_kit35.getBytesDecoder)(), 8)],
|
|
4939
|
-
["withdrawPercent", (0, import_kit35.getU32Decoder)()],
|
|
4940
|
-
["swapToToken", (0, import_kit35.getU8Decoder)()],
|
|
4941
|
-
["minRemovedAmountA", (0, import_kit35.getU64Decoder)()],
|
|
4942
|
-
["minRemovedAmountB", (0, import_kit35.getU64Decoder)()],
|
|
4943
|
-
["maxSwapSlippage", (0, import_kit35.getU32Decoder)()],
|
|
4944
4984
|
["remainingAccountsInfo", getRemainingAccountsInfoDecoder()]
|
|
4945
4985
|
]);
|
|
4946
4986
|
}
|
|
4947
|
-
function
|
|
4987
|
+
function getRebalancePositionOrcaInstructionDataCodec() {
|
|
4948
4988
|
return (0, import_kit35.combineCodec)(
|
|
4949
|
-
|
|
4950
|
-
|
|
4989
|
+
getRebalancePositionOrcaInstructionDataEncoder(),
|
|
4990
|
+
getRebalancePositionOrcaInstructionDataDecoder()
|
|
4951
4991
|
);
|
|
4952
4992
|
}
|
|
4953
|
-
function
|
|
4993
|
+
function getRebalancePositionOrcaInstruction(input, config) {
|
|
4954
4994
|
const programAddress = config?.programAddress ?? TUNA_PROGRAM_ADDRESS;
|
|
4955
4995
|
const originalAccounts = {
|
|
4956
4996
|
authority: { value: input.authority ?? null, isWritable: true },
|
|
4957
4997
|
tunaConfig: { value: input.tunaConfig ?? null, isWritable: false },
|
|
4958
|
-
market: { value: input.market ?? null, isWritable: true },
|
|
4959
4998
|
mintA: { value: input.mintA ?? null, isWritable: false },
|
|
4960
4999
|
mintB: { value: input.mintB ?? null, isWritable: false },
|
|
5000
|
+
market: { value: input.market ?? null, isWritable: true },
|
|
4961
5001
|
vaultA: { value: input.vaultA ?? null, isWritable: true },
|
|
4962
5002
|
vaultB: { value: input.vaultB ?? null, isWritable: true },
|
|
4963
|
-
vaultAAta: { value: input.vaultAAta ?? null, isWritable: true },
|
|
4964
|
-
vaultBAta: { value: input.vaultBAta ?? null, isWritable: true },
|
|
4965
5003
|
tunaPosition: { value: input.tunaPosition ?? null, isWritable: true },
|
|
4966
5004
|
tunaPositionAta: { value: input.tunaPositionAta ?? null, isWritable: true },
|
|
4967
5005
|
tunaPositionAtaA: {
|
|
@@ -4972,12 +5010,12 @@ function getRemoveLiquidityOrcaInstruction(input, config) {
|
|
|
4972
5010
|
value: input.tunaPositionAtaB ?? null,
|
|
4973
5011
|
isWritable: true
|
|
4974
5012
|
},
|
|
4975
|
-
|
|
4976
|
-
value: input.
|
|
5013
|
+
feeRecipientAtaA: {
|
|
5014
|
+
value: input.feeRecipientAtaA ?? null,
|
|
4977
5015
|
isWritable: true
|
|
4978
5016
|
},
|
|
4979
|
-
|
|
4980
|
-
value: input.
|
|
5017
|
+
feeRecipientAtaB: {
|
|
5018
|
+
value: input.feeRecipientAtaB ?? null,
|
|
4981
5019
|
isWritable: true
|
|
4982
5020
|
},
|
|
4983
5021
|
pythOraclePriceFeedA: {
|
|
@@ -4996,28 +5034,30 @@ function getRemoveLiquidityOrcaInstruction(input, config) {
|
|
|
4996
5034
|
orcaPosition: { value: input.orcaPosition ?? null, isWritable: true },
|
|
4997
5035
|
tokenProgramA: { value: input.tokenProgramA ?? null, isWritable: false },
|
|
4998
5036
|
tokenProgramB: { value: input.tokenProgramB ?? null, isWritable: false },
|
|
5037
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
4999
5038
|
memoProgram: { value: input.memoProgram ?? null, isWritable: false }
|
|
5000
5039
|
};
|
|
5001
5040
|
const accounts = originalAccounts;
|
|
5002
5041
|
const args = { ...input };
|
|
5042
|
+
if (!accounts.systemProgram.value) {
|
|
5043
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
5044
|
+
}
|
|
5003
5045
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5004
5046
|
const instruction = {
|
|
5005
5047
|
accounts: [
|
|
5006
5048
|
getAccountMeta(accounts.authority),
|
|
5007
5049
|
getAccountMeta(accounts.tunaConfig),
|
|
5008
|
-
getAccountMeta(accounts.market),
|
|
5009
5050
|
getAccountMeta(accounts.mintA),
|
|
5010
5051
|
getAccountMeta(accounts.mintB),
|
|
5052
|
+
getAccountMeta(accounts.market),
|
|
5011
5053
|
getAccountMeta(accounts.vaultA),
|
|
5012
5054
|
getAccountMeta(accounts.vaultB),
|
|
5013
|
-
getAccountMeta(accounts.vaultAAta),
|
|
5014
|
-
getAccountMeta(accounts.vaultBAta),
|
|
5015
5055
|
getAccountMeta(accounts.tunaPosition),
|
|
5016
5056
|
getAccountMeta(accounts.tunaPositionAta),
|
|
5017
5057
|
getAccountMeta(accounts.tunaPositionAtaA),
|
|
5018
5058
|
getAccountMeta(accounts.tunaPositionAtaB),
|
|
5019
|
-
getAccountMeta(accounts.
|
|
5020
|
-
getAccountMeta(accounts.
|
|
5059
|
+
getAccountMeta(accounts.feeRecipientAtaA),
|
|
5060
|
+
getAccountMeta(accounts.feeRecipientAtaB),
|
|
5021
5061
|
getAccountMeta(accounts.pythOraclePriceFeedA),
|
|
5022
5062
|
getAccountMeta(accounts.pythOraclePriceFeedB),
|
|
5023
5063
|
getAccountMeta(accounts.whirlpoolProgram),
|
|
@@ -5025,17 +5065,18 @@ function getRemoveLiquidityOrcaInstruction(input, config) {
|
|
|
5025
5065
|
getAccountMeta(accounts.orcaPosition),
|
|
5026
5066
|
getAccountMeta(accounts.tokenProgramA),
|
|
5027
5067
|
getAccountMeta(accounts.tokenProgramB),
|
|
5068
|
+
getAccountMeta(accounts.systemProgram),
|
|
5028
5069
|
getAccountMeta(accounts.memoProgram)
|
|
5029
5070
|
],
|
|
5030
5071
|
programAddress,
|
|
5031
|
-
data:
|
|
5072
|
+
data: getRebalancePositionOrcaInstructionDataEncoder().encode(
|
|
5032
5073
|
args
|
|
5033
5074
|
)
|
|
5034
5075
|
};
|
|
5035
5076
|
return instruction;
|
|
5036
5077
|
}
|
|
5037
|
-
function
|
|
5038
|
-
if (instruction.accounts.length <
|
|
5078
|
+
function parseRebalancePositionOrcaInstruction(instruction) {
|
|
5079
|
+
if (instruction.accounts.length < 22) {
|
|
5039
5080
|
throw new Error("Not enough accounts");
|
|
5040
5081
|
}
|
|
5041
5082
|
let accountIndex = 0;
|
|
@@ -5049,19 +5090,17 @@ function parseRemoveLiquidityOrcaInstruction(instruction) {
|
|
|
5049
5090
|
accounts: {
|
|
5050
5091
|
authority: getNextAccount(),
|
|
5051
5092
|
tunaConfig: getNextAccount(),
|
|
5052
|
-
market: getNextAccount(),
|
|
5053
5093
|
mintA: getNextAccount(),
|
|
5054
5094
|
mintB: getNextAccount(),
|
|
5095
|
+
market: getNextAccount(),
|
|
5055
5096
|
vaultA: getNextAccount(),
|
|
5056
5097
|
vaultB: getNextAccount(),
|
|
5057
|
-
vaultAAta: getNextAccount(),
|
|
5058
|
-
vaultBAta: getNextAccount(),
|
|
5059
5098
|
tunaPosition: getNextAccount(),
|
|
5060
5099
|
tunaPositionAta: getNextAccount(),
|
|
5061
5100
|
tunaPositionAtaA: getNextAccount(),
|
|
5062
5101
|
tunaPositionAtaB: getNextAccount(),
|
|
5063
|
-
|
|
5064
|
-
|
|
5102
|
+
feeRecipientAtaA: getNextAccount(),
|
|
5103
|
+
feeRecipientAtaB: getNextAccount(),
|
|
5065
5104
|
pythOraclePriceFeedA: getNextAccount(),
|
|
5066
5105
|
pythOraclePriceFeedB: getNextAccount(),
|
|
5067
5106
|
whirlpoolProgram: getNextAccount(),
|
|
@@ -5069,92 +5108,449 @@ function parseRemoveLiquidityOrcaInstruction(instruction) {
|
|
|
5069
5108
|
orcaPosition: getNextAccount(),
|
|
5070
5109
|
tokenProgramA: getNextAccount(),
|
|
5071
5110
|
tokenProgramB: getNextAccount(),
|
|
5111
|
+
systemProgram: getNextAccount(),
|
|
5072
5112
|
memoProgram: getNextAccount()
|
|
5073
5113
|
},
|
|
5074
|
-
data:
|
|
5114
|
+
data: getRebalancePositionOrcaInstructionDataDecoder().decode(
|
|
5075
5115
|
instruction.data
|
|
5076
5116
|
)
|
|
5077
5117
|
};
|
|
5078
5118
|
}
|
|
5079
5119
|
|
|
5080
|
-
// src/generated/instructions/
|
|
5120
|
+
// src/generated/instructions/removeLiquidityFusion.ts
|
|
5081
5121
|
var import_kit36 = require("@solana/kit");
|
|
5082
|
-
var
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5122
|
+
var REMOVE_LIQUIDITY_FUSION_DISCRIMINATOR = new Uint8Array([
|
|
5123
|
+
175,
|
|
5124
|
+
74,
|
|
5125
|
+
205,
|
|
5126
|
+
238,
|
|
5127
|
+
4,
|
|
5128
|
+
123,
|
|
5129
|
+
166,
|
|
5130
|
+
35
|
|
5091
5131
|
]);
|
|
5092
|
-
function
|
|
5132
|
+
function getRemoveLiquidityFusionDiscriminatorBytes() {
|
|
5093
5133
|
return (0, import_kit36.fixEncoderSize)((0, import_kit36.getBytesEncoder)(), 8).encode(
|
|
5094
|
-
|
|
5134
|
+
REMOVE_LIQUIDITY_FUSION_DISCRIMINATOR
|
|
5095
5135
|
);
|
|
5096
5136
|
}
|
|
5097
|
-
function
|
|
5137
|
+
function getRemoveLiquidityFusionInstructionDataEncoder() {
|
|
5098
5138
|
return (0, import_kit36.transformEncoder)(
|
|
5099
5139
|
(0, import_kit36.getStructEncoder)([
|
|
5100
5140
|
["discriminator", (0, import_kit36.fixEncoderSize)((0, import_kit36.getBytesEncoder)(), 8)],
|
|
5101
|
-
["
|
|
5102
|
-
["
|
|
5141
|
+
["withdrawPercent", (0, import_kit36.getU32Encoder)()],
|
|
5142
|
+
["swapToToken", (0, import_kit36.getU8Encoder)()],
|
|
5143
|
+
["minRemovedAmountA", (0, import_kit36.getU64Encoder)()],
|
|
5144
|
+
["minRemovedAmountB", (0, import_kit36.getU64Encoder)()],
|
|
5145
|
+
["maxSwapSlippage", (0, import_kit36.getU32Encoder)()],
|
|
5146
|
+
["remainingAccountsInfo", getRemainingAccountsInfoEncoder()]
|
|
5103
5147
|
]),
|
|
5104
|
-
(value) => ({
|
|
5148
|
+
(value) => ({
|
|
5149
|
+
...value,
|
|
5150
|
+
discriminator: REMOVE_LIQUIDITY_FUSION_DISCRIMINATOR
|
|
5151
|
+
})
|
|
5105
5152
|
);
|
|
5106
5153
|
}
|
|
5107
|
-
function
|
|
5154
|
+
function getRemoveLiquidityFusionInstructionDataDecoder() {
|
|
5108
5155
|
return (0, import_kit36.getStructDecoder)([
|
|
5109
5156
|
["discriminator", (0, import_kit36.fixDecoderSize)((0, import_kit36.getBytesDecoder)(), 8)],
|
|
5110
|
-
["
|
|
5111
|
-
["
|
|
5157
|
+
["withdrawPercent", (0, import_kit36.getU32Decoder)()],
|
|
5158
|
+
["swapToToken", (0, import_kit36.getU8Decoder)()],
|
|
5159
|
+
["minRemovedAmountA", (0, import_kit36.getU64Decoder)()],
|
|
5160
|
+
["minRemovedAmountB", (0, import_kit36.getU64Decoder)()],
|
|
5161
|
+
["maxSwapSlippage", (0, import_kit36.getU32Decoder)()],
|
|
5162
|
+
["remainingAccountsInfo", getRemainingAccountsInfoDecoder()]
|
|
5112
5163
|
]);
|
|
5113
5164
|
}
|
|
5114
|
-
function
|
|
5165
|
+
function getRemoveLiquidityFusionInstructionDataCodec() {
|
|
5115
5166
|
return (0, import_kit36.combineCodec)(
|
|
5116
|
-
|
|
5117
|
-
|
|
5167
|
+
getRemoveLiquidityFusionInstructionDataEncoder(),
|
|
5168
|
+
getRemoveLiquidityFusionInstructionDataDecoder()
|
|
5118
5169
|
);
|
|
5119
5170
|
}
|
|
5120
|
-
function
|
|
5171
|
+
function getRemoveLiquidityFusionInstruction(input, config) {
|
|
5121
5172
|
const programAddress = config?.programAddress ?? TUNA_PROGRAM_ADDRESS;
|
|
5122
5173
|
const originalAccounts = {
|
|
5123
|
-
authority: { value: input.authority ?? null, isWritable:
|
|
5124
|
-
mint: { value: input.mint ?? null, isWritable: false },
|
|
5174
|
+
authority: { value: input.authority ?? null, isWritable: true },
|
|
5125
5175
|
tunaConfig: { value: input.tunaConfig ?? null, isWritable: false },
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5176
|
+
market: { value: input.market ?? null, isWritable: true },
|
|
5177
|
+
mintA: { value: input.mintA ?? null, isWritable: false },
|
|
5178
|
+
mintB: { value: input.mintB ?? null, isWritable: false },
|
|
5179
|
+
tokenProgramA: { value: input.tokenProgramA ?? null, isWritable: false },
|
|
5180
|
+
tokenProgramB: { value: input.tokenProgramB ?? null, isWritable: false },
|
|
5181
|
+
vaultA: { value: input.vaultA ?? null, isWritable: true },
|
|
5182
|
+
vaultB: { value: input.vaultB ?? null, isWritable: true },
|
|
5183
|
+
vaultAAta: { value: input.vaultAAta ?? null, isWritable: true },
|
|
5184
|
+
vaultBAta: { value: input.vaultBAta ?? null, isWritable: true },
|
|
5185
|
+
tunaPosition: { value: input.tunaPosition ?? null, isWritable: true },
|
|
5186
|
+
tunaPositionAta: { value: input.tunaPositionAta ?? null, isWritable: true },
|
|
5187
|
+
tunaPositionAtaA: {
|
|
5188
|
+
value: input.tunaPositionAtaA ?? null,
|
|
5189
|
+
isWritable: true
|
|
5190
|
+
},
|
|
5191
|
+
tunaPositionAtaB: {
|
|
5192
|
+
value: input.tunaPositionAtaB ?? null,
|
|
5193
|
+
isWritable: true
|
|
5194
|
+
},
|
|
5195
|
+
tunaPositionOwnerAtaA: {
|
|
5196
|
+
value: input.tunaPositionOwnerAtaA ?? null,
|
|
5197
|
+
isWritable: true
|
|
5198
|
+
},
|
|
5199
|
+
tunaPositionOwnerAtaB: {
|
|
5200
|
+
value: input.tunaPositionOwnerAtaB ?? null,
|
|
5201
|
+
isWritable: true
|
|
5202
|
+
},
|
|
5203
|
+
pythOraclePriceFeedA: {
|
|
5204
|
+
value: input.pythOraclePriceFeedA ?? null,
|
|
5205
|
+
isWritable: false
|
|
5206
|
+
},
|
|
5207
|
+
pythOraclePriceFeedB: {
|
|
5208
|
+
value: input.pythOraclePriceFeedB ?? null,
|
|
5209
|
+
isWritable: false
|
|
5210
|
+
},
|
|
5211
|
+
fusionammProgram: {
|
|
5212
|
+
value: input.fusionammProgram ?? null,
|
|
5213
|
+
isWritable: false
|
|
5214
|
+
},
|
|
5215
|
+
fusionPool: { value: input.fusionPool ?? null, isWritable: true },
|
|
5216
|
+
fusionPosition: { value: input.fusionPosition ?? null, isWritable: true },
|
|
5130
5217
|
memoProgram: { value: input.memoProgram ?? null, isWritable: false }
|
|
5131
5218
|
};
|
|
5132
5219
|
const accounts = originalAccounts;
|
|
5133
5220
|
const args = { ...input };
|
|
5134
|
-
if (!accounts.tokenProgram.value) {
|
|
5135
|
-
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
5136
|
-
}
|
|
5137
5221
|
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5138
5222
|
const instruction = {
|
|
5139
5223
|
accounts: [
|
|
5140
5224
|
getAccountMeta(accounts.authority),
|
|
5141
|
-
getAccountMeta(accounts.mint),
|
|
5142
5225
|
getAccountMeta(accounts.tunaConfig),
|
|
5143
|
-
getAccountMeta(accounts.
|
|
5144
|
-
getAccountMeta(accounts.
|
|
5145
|
-
getAccountMeta(accounts.
|
|
5146
|
-
getAccountMeta(accounts.
|
|
5226
|
+
getAccountMeta(accounts.market),
|
|
5227
|
+
getAccountMeta(accounts.mintA),
|
|
5228
|
+
getAccountMeta(accounts.mintB),
|
|
5229
|
+
getAccountMeta(accounts.tokenProgramA),
|
|
5230
|
+
getAccountMeta(accounts.tokenProgramB),
|
|
5231
|
+
getAccountMeta(accounts.vaultA),
|
|
5232
|
+
getAccountMeta(accounts.vaultB),
|
|
5233
|
+
getAccountMeta(accounts.vaultAAta),
|
|
5234
|
+
getAccountMeta(accounts.vaultBAta),
|
|
5235
|
+
getAccountMeta(accounts.tunaPosition),
|
|
5236
|
+
getAccountMeta(accounts.tunaPositionAta),
|
|
5237
|
+
getAccountMeta(accounts.tunaPositionAtaA),
|
|
5238
|
+
getAccountMeta(accounts.tunaPositionAtaB),
|
|
5239
|
+
getAccountMeta(accounts.tunaPositionOwnerAtaA),
|
|
5240
|
+
getAccountMeta(accounts.tunaPositionOwnerAtaB),
|
|
5241
|
+
getAccountMeta(accounts.pythOraclePriceFeedA),
|
|
5242
|
+
getAccountMeta(accounts.pythOraclePriceFeedB),
|
|
5243
|
+
getAccountMeta(accounts.fusionammProgram),
|
|
5244
|
+
getAccountMeta(accounts.fusionPool),
|
|
5245
|
+
getAccountMeta(accounts.fusionPosition),
|
|
5147
5246
|
getAccountMeta(accounts.memoProgram)
|
|
5148
5247
|
],
|
|
5149
5248
|
programAddress,
|
|
5150
|
-
data:
|
|
5249
|
+
data: getRemoveLiquidityFusionInstructionDataEncoder().encode(
|
|
5151
5250
|
args
|
|
5152
5251
|
)
|
|
5153
5252
|
};
|
|
5154
5253
|
return instruction;
|
|
5155
5254
|
}
|
|
5156
|
-
function
|
|
5157
|
-
if (instruction.accounts.length <
|
|
5255
|
+
function parseRemoveLiquidityFusionInstruction(instruction) {
|
|
5256
|
+
if (instruction.accounts.length < 23) {
|
|
5257
|
+
throw new Error("Not enough accounts");
|
|
5258
|
+
}
|
|
5259
|
+
let accountIndex = 0;
|
|
5260
|
+
const getNextAccount = () => {
|
|
5261
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
5262
|
+
accountIndex += 1;
|
|
5263
|
+
return accountMeta;
|
|
5264
|
+
};
|
|
5265
|
+
return {
|
|
5266
|
+
programAddress: instruction.programAddress,
|
|
5267
|
+
accounts: {
|
|
5268
|
+
authority: getNextAccount(),
|
|
5269
|
+
tunaConfig: getNextAccount(),
|
|
5270
|
+
market: getNextAccount(),
|
|
5271
|
+
mintA: getNextAccount(),
|
|
5272
|
+
mintB: getNextAccount(),
|
|
5273
|
+
tokenProgramA: getNextAccount(),
|
|
5274
|
+
tokenProgramB: getNextAccount(),
|
|
5275
|
+
vaultA: getNextAccount(),
|
|
5276
|
+
vaultB: getNextAccount(),
|
|
5277
|
+
vaultAAta: getNextAccount(),
|
|
5278
|
+
vaultBAta: getNextAccount(),
|
|
5279
|
+
tunaPosition: getNextAccount(),
|
|
5280
|
+
tunaPositionAta: getNextAccount(),
|
|
5281
|
+
tunaPositionAtaA: getNextAccount(),
|
|
5282
|
+
tunaPositionAtaB: getNextAccount(),
|
|
5283
|
+
tunaPositionOwnerAtaA: getNextAccount(),
|
|
5284
|
+
tunaPositionOwnerAtaB: getNextAccount(),
|
|
5285
|
+
pythOraclePriceFeedA: getNextAccount(),
|
|
5286
|
+
pythOraclePriceFeedB: getNextAccount(),
|
|
5287
|
+
fusionammProgram: getNextAccount(),
|
|
5288
|
+
fusionPool: getNextAccount(),
|
|
5289
|
+
fusionPosition: getNextAccount(),
|
|
5290
|
+
memoProgram: getNextAccount()
|
|
5291
|
+
},
|
|
5292
|
+
data: getRemoveLiquidityFusionInstructionDataDecoder().decode(
|
|
5293
|
+
instruction.data
|
|
5294
|
+
)
|
|
5295
|
+
};
|
|
5296
|
+
}
|
|
5297
|
+
|
|
5298
|
+
// src/generated/instructions/removeLiquidityOrca.ts
|
|
5299
|
+
var import_kit37 = require("@solana/kit");
|
|
5300
|
+
var REMOVE_LIQUIDITY_ORCA_DISCRIMINATOR = new Uint8Array([
|
|
5301
|
+
30,
|
|
5302
|
+
69,
|
|
5303
|
+
45,
|
|
5304
|
+
170,
|
|
5305
|
+
183,
|
|
5306
|
+
195,
|
|
5307
|
+
12,
|
|
5308
|
+
119
|
|
5309
|
+
]);
|
|
5310
|
+
function getRemoveLiquidityOrcaDiscriminatorBytes() {
|
|
5311
|
+
return (0, import_kit37.fixEncoderSize)((0, import_kit37.getBytesEncoder)(), 8).encode(
|
|
5312
|
+
REMOVE_LIQUIDITY_ORCA_DISCRIMINATOR
|
|
5313
|
+
);
|
|
5314
|
+
}
|
|
5315
|
+
function getRemoveLiquidityOrcaInstructionDataEncoder() {
|
|
5316
|
+
return (0, import_kit37.transformEncoder)(
|
|
5317
|
+
(0, import_kit37.getStructEncoder)([
|
|
5318
|
+
["discriminator", (0, import_kit37.fixEncoderSize)((0, import_kit37.getBytesEncoder)(), 8)],
|
|
5319
|
+
["withdrawPercent", (0, import_kit37.getU32Encoder)()],
|
|
5320
|
+
["swapToToken", (0, import_kit37.getU8Encoder)()],
|
|
5321
|
+
["minRemovedAmountA", (0, import_kit37.getU64Encoder)()],
|
|
5322
|
+
["minRemovedAmountB", (0, import_kit37.getU64Encoder)()],
|
|
5323
|
+
["maxSwapSlippage", (0, import_kit37.getU32Encoder)()],
|
|
5324
|
+
["remainingAccountsInfo", getRemainingAccountsInfoEncoder()]
|
|
5325
|
+
]),
|
|
5326
|
+
(value) => ({
|
|
5327
|
+
...value,
|
|
5328
|
+
discriminator: REMOVE_LIQUIDITY_ORCA_DISCRIMINATOR
|
|
5329
|
+
})
|
|
5330
|
+
);
|
|
5331
|
+
}
|
|
5332
|
+
function getRemoveLiquidityOrcaInstructionDataDecoder() {
|
|
5333
|
+
return (0, import_kit37.getStructDecoder)([
|
|
5334
|
+
["discriminator", (0, import_kit37.fixDecoderSize)((0, import_kit37.getBytesDecoder)(), 8)],
|
|
5335
|
+
["withdrawPercent", (0, import_kit37.getU32Decoder)()],
|
|
5336
|
+
["swapToToken", (0, import_kit37.getU8Decoder)()],
|
|
5337
|
+
["minRemovedAmountA", (0, import_kit37.getU64Decoder)()],
|
|
5338
|
+
["minRemovedAmountB", (0, import_kit37.getU64Decoder)()],
|
|
5339
|
+
["maxSwapSlippage", (0, import_kit37.getU32Decoder)()],
|
|
5340
|
+
["remainingAccountsInfo", getRemainingAccountsInfoDecoder()]
|
|
5341
|
+
]);
|
|
5342
|
+
}
|
|
5343
|
+
function getRemoveLiquidityOrcaInstructionDataCodec() {
|
|
5344
|
+
return (0, import_kit37.combineCodec)(
|
|
5345
|
+
getRemoveLiquidityOrcaInstructionDataEncoder(),
|
|
5346
|
+
getRemoveLiquidityOrcaInstructionDataDecoder()
|
|
5347
|
+
);
|
|
5348
|
+
}
|
|
5349
|
+
function getRemoveLiquidityOrcaInstruction(input, config) {
|
|
5350
|
+
const programAddress = config?.programAddress ?? TUNA_PROGRAM_ADDRESS;
|
|
5351
|
+
const originalAccounts = {
|
|
5352
|
+
authority: { value: input.authority ?? null, isWritable: true },
|
|
5353
|
+
tunaConfig: { value: input.tunaConfig ?? null, isWritable: false },
|
|
5354
|
+
market: { value: input.market ?? null, isWritable: true },
|
|
5355
|
+
mintA: { value: input.mintA ?? null, isWritable: false },
|
|
5356
|
+
mintB: { value: input.mintB ?? null, isWritable: false },
|
|
5357
|
+
vaultA: { value: input.vaultA ?? null, isWritable: true },
|
|
5358
|
+
vaultB: { value: input.vaultB ?? null, isWritable: true },
|
|
5359
|
+
vaultAAta: { value: input.vaultAAta ?? null, isWritable: true },
|
|
5360
|
+
vaultBAta: { value: input.vaultBAta ?? null, isWritable: true },
|
|
5361
|
+
tunaPosition: { value: input.tunaPosition ?? null, isWritable: true },
|
|
5362
|
+
tunaPositionAta: { value: input.tunaPositionAta ?? null, isWritable: true },
|
|
5363
|
+
tunaPositionAtaA: {
|
|
5364
|
+
value: input.tunaPositionAtaA ?? null,
|
|
5365
|
+
isWritable: true
|
|
5366
|
+
},
|
|
5367
|
+
tunaPositionAtaB: {
|
|
5368
|
+
value: input.tunaPositionAtaB ?? null,
|
|
5369
|
+
isWritable: true
|
|
5370
|
+
},
|
|
5371
|
+
tunaPositionOwnerAtaA: {
|
|
5372
|
+
value: input.tunaPositionOwnerAtaA ?? null,
|
|
5373
|
+
isWritable: true
|
|
5374
|
+
},
|
|
5375
|
+
tunaPositionOwnerAtaB: {
|
|
5376
|
+
value: input.tunaPositionOwnerAtaB ?? null,
|
|
5377
|
+
isWritable: true
|
|
5378
|
+
},
|
|
5379
|
+
pythOraclePriceFeedA: {
|
|
5380
|
+
value: input.pythOraclePriceFeedA ?? null,
|
|
5381
|
+
isWritable: false
|
|
5382
|
+
},
|
|
5383
|
+
pythOraclePriceFeedB: {
|
|
5384
|
+
value: input.pythOraclePriceFeedB ?? null,
|
|
5385
|
+
isWritable: false
|
|
5386
|
+
},
|
|
5387
|
+
whirlpoolProgram: {
|
|
5388
|
+
value: input.whirlpoolProgram ?? null,
|
|
5389
|
+
isWritable: false
|
|
5390
|
+
},
|
|
5391
|
+
whirlpool: { value: input.whirlpool ?? null, isWritable: true },
|
|
5392
|
+
orcaPosition: { value: input.orcaPosition ?? null, isWritable: true },
|
|
5393
|
+
tokenProgramA: { value: input.tokenProgramA ?? null, isWritable: false },
|
|
5394
|
+
tokenProgramB: { value: input.tokenProgramB ?? null, isWritable: false },
|
|
5395
|
+
memoProgram: { value: input.memoProgram ?? null, isWritable: false }
|
|
5396
|
+
};
|
|
5397
|
+
const accounts = originalAccounts;
|
|
5398
|
+
const args = { ...input };
|
|
5399
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5400
|
+
const instruction = {
|
|
5401
|
+
accounts: [
|
|
5402
|
+
getAccountMeta(accounts.authority),
|
|
5403
|
+
getAccountMeta(accounts.tunaConfig),
|
|
5404
|
+
getAccountMeta(accounts.market),
|
|
5405
|
+
getAccountMeta(accounts.mintA),
|
|
5406
|
+
getAccountMeta(accounts.mintB),
|
|
5407
|
+
getAccountMeta(accounts.vaultA),
|
|
5408
|
+
getAccountMeta(accounts.vaultB),
|
|
5409
|
+
getAccountMeta(accounts.vaultAAta),
|
|
5410
|
+
getAccountMeta(accounts.vaultBAta),
|
|
5411
|
+
getAccountMeta(accounts.tunaPosition),
|
|
5412
|
+
getAccountMeta(accounts.tunaPositionAta),
|
|
5413
|
+
getAccountMeta(accounts.tunaPositionAtaA),
|
|
5414
|
+
getAccountMeta(accounts.tunaPositionAtaB),
|
|
5415
|
+
getAccountMeta(accounts.tunaPositionOwnerAtaA),
|
|
5416
|
+
getAccountMeta(accounts.tunaPositionOwnerAtaB),
|
|
5417
|
+
getAccountMeta(accounts.pythOraclePriceFeedA),
|
|
5418
|
+
getAccountMeta(accounts.pythOraclePriceFeedB),
|
|
5419
|
+
getAccountMeta(accounts.whirlpoolProgram),
|
|
5420
|
+
getAccountMeta(accounts.whirlpool),
|
|
5421
|
+
getAccountMeta(accounts.orcaPosition),
|
|
5422
|
+
getAccountMeta(accounts.tokenProgramA),
|
|
5423
|
+
getAccountMeta(accounts.tokenProgramB),
|
|
5424
|
+
getAccountMeta(accounts.memoProgram)
|
|
5425
|
+
],
|
|
5426
|
+
programAddress,
|
|
5427
|
+
data: getRemoveLiquidityOrcaInstructionDataEncoder().encode(
|
|
5428
|
+
args
|
|
5429
|
+
)
|
|
5430
|
+
};
|
|
5431
|
+
return instruction;
|
|
5432
|
+
}
|
|
5433
|
+
function parseRemoveLiquidityOrcaInstruction(instruction) {
|
|
5434
|
+
if (instruction.accounts.length < 23) {
|
|
5435
|
+
throw new Error("Not enough accounts");
|
|
5436
|
+
}
|
|
5437
|
+
let accountIndex = 0;
|
|
5438
|
+
const getNextAccount = () => {
|
|
5439
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
5440
|
+
accountIndex += 1;
|
|
5441
|
+
return accountMeta;
|
|
5442
|
+
};
|
|
5443
|
+
return {
|
|
5444
|
+
programAddress: instruction.programAddress,
|
|
5445
|
+
accounts: {
|
|
5446
|
+
authority: getNextAccount(),
|
|
5447
|
+
tunaConfig: getNextAccount(),
|
|
5448
|
+
market: getNextAccount(),
|
|
5449
|
+
mintA: getNextAccount(),
|
|
5450
|
+
mintB: getNextAccount(),
|
|
5451
|
+
vaultA: getNextAccount(),
|
|
5452
|
+
vaultB: getNextAccount(),
|
|
5453
|
+
vaultAAta: getNextAccount(),
|
|
5454
|
+
vaultBAta: getNextAccount(),
|
|
5455
|
+
tunaPosition: getNextAccount(),
|
|
5456
|
+
tunaPositionAta: getNextAccount(),
|
|
5457
|
+
tunaPositionAtaA: getNextAccount(),
|
|
5458
|
+
tunaPositionAtaB: getNextAccount(),
|
|
5459
|
+
tunaPositionOwnerAtaA: getNextAccount(),
|
|
5460
|
+
tunaPositionOwnerAtaB: getNextAccount(),
|
|
5461
|
+
pythOraclePriceFeedA: getNextAccount(),
|
|
5462
|
+
pythOraclePriceFeedB: getNextAccount(),
|
|
5463
|
+
whirlpoolProgram: getNextAccount(),
|
|
5464
|
+
whirlpool: getNextAccount(),
|
|
5465
|
+
orcaPosition: getNextAccount(),
|
|
5466
|
+
tokenProgramA: getNextAccount(),
|
|
5467
|
+
tokenProgramB: getNextAccount(),
|
|
5468
|
+
memoProgram: getNextAccount()
|
|
5469
|
+
},
|
|
5470
|
+
data: getRemoveLiquidityOrcaInstructionDataDecoder().decode(
|
|
5471
|
+
instruction.data
|
|
5472
|
+
)
|
|
5473
|
+
};
|
|
5474
|
+
}
|
|
5475
|
+
|
|
5476
|
+
// src/generated/instructions/repayBadDebt.ts
|
|
5477
|
+
var import_kit38 = require("@solana/kit");
|
|
5478
|
+
var REPAY_BAD_DEBT_DISCRIMINATOR = new Uint8Array([
|
|
5479
|
+
112,
|
|
5480
|
+
144,
|
|
5481
|
+
188,
|
|
5482
|
+
157,
|
|
5483
|
+
43,
|
|
5484
|
+
106,
|
|
5485
|
+
141,
|
|
5486
|
+
34
|
|
5487
|
+
]);
|
|
5488
|
+
function getRepayBadDebtDiscriminatorBytes() {
|
|
5489
|
+
return (0, import_kit38.fixEncoderSize)((0, import_kit38.getBytesEncoder)(), 8).encode(
|
|
5490
|
+
REPAY_BAD_DEBT_DISCRIMINATOR
|
|
5491
|
+
);
|
|
5492
|
+
}
|
|
5493
|
+
function getRepayBadDebtInstructionDataEncoder() {
|
|
5494
|
+
return (0, import_kit38.transformEncoder)(
|
|
5495
|
+
(0, import_kit38.getStructEncoder)([
|
|
5496
|
+
["discriminator", (0, import_kit38.fixEncoderSize)((0, import_kit38.getBytesEncoder)(), 8)],
|
|
5497
|
+
["funds", (0, import_kit38.getU64Encoder)()],
|
|
5498
|
+
["shares", (0, import_kit38.getU64Encoder)()]
|
|
5499
|
+
]),
|
|
5500
|
+
(value) => ({ ...value, discriminator: REPAY_BAD_DEBT_DISCRIMINATOR })
|
|
5501
|
+
);
|
|
5502
|
+
}
|
|
5503
|
+
function getRepayBadDebtInstructionDataDecoder() {
|
|
5504
|
+
return (0, import_kit38.getStructDecoder)([
|
|
5505
|
+
["discriminator", (0, import_kit38.fixDecoderSize)((0, import_kit38.getBytesDecoder)(), 8)],
|
|
5506
|
+
["funds", (0, import_kit38.getU64Decoder)()],
|
|
5507
|
+
["shares", (0, import_kit38.getU64Decoder)()]
|
|
5508
|
+
]);
|
|
5509
|
+
}
|
|
5510
|
+
function getRepayBadDebtInstructionDataCodec() {
|
|
5511
|
+
return (0, import_kit38.combineCodec)(
|
|
5512
|
+
getRepayBadDebtInstructionDataEncoder(),
|
|
5513
|
+
getRepayBadDebtInstructionDataDecoder()
|
|
5514
|
+
);
|
|
5515
|
+
}
|
|
5516
|
+
function getRepayBadDebtInstruction(input, config) {
|
|
5517
|
+
const programAddress = config?.programAddress ?? TUNA_PROGRAM_ADDRESS;
|
|
5518
|
+
const originalAccounts = {
|
|
5519
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
5520
|
+
mint: { value: input.mint ?? null, isWritable: false },
|
|
5521
|
+
tunaConfig: { value: input.tunaConfig ?? null, isWritable: false },
|
|
5522
|
+
vault: { value: input.vault ?? null, isWritable: true },
|
|
5523
|
+
vaultAta: { value: input.vaultAta ?? null, isWritable: true },
|
|
5524
|
+
authorityAta: { value: input.authorityAta ?? null, isWritable: true },
|
|
5525
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
5526
|
+
memoProgram: { value: input.memoProgram ?? null, isWritable: false }
|
|
5527
|
+
};
|
|
5528
|
+
const accounts = originalAccounts;
|
|
5529
|
+
const args = { ...input };
|
|
5530
|
+
if (!accounts.tokenProgram.value) {
|
|
5531
|
+
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
5532
|
+
}
|
|
5533
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5534
|
+
const instruction = {
|
|
5535
|
+
accounts: [
|
|
5536
|
+
getAccountMeta(accounts.authority),
|
|
5537
|
+
getAccountMeta(accounts.mint),
|
|
5538
|
+
getAccountMeta(accounts.tunaConfig),
|
|
5539
|
+
getAccountMeta(accounts.vault),
|
|
5540
|
+
getAccountMeta(accounts.vaultAta),
|
|
5541
|
+
getAccountMeta(accounts.authorityAta),
|
|
5542
|
+
getAccountMeta(accounts.tokenProgram),
|
|
5543
|
+
getAccountMeta(accounts.memoProgram)
|
|
5544
|
+
],
|
|
5545
|
+
programAddress,
|
|
5546
|
+
data: getRepayBadDebtInstructionDataEncoder().encode(
|
|
5547
|
+
args
|
|
5548
|
+
)
|
|
5549
|
+
};
|
|
5550
|
+
return instruction;
|
|
5551
|
+
}
|
|
5552
|
+
function parseRepayBadDebtInstruction(instruction) {
|
|
5553
|
+
if (instruction.accounts.length < 8) {
|
|
5158
5554
|
throw new Error("Not enough accounts");
|
|
5159
5555
|
}
|
|
5160
5556
|
let accountIndex = 0;
|
|
@@ -5180,7 +5576,7 @@ function parseRepayBadDebtInstruction(instruction) {
|
|
|
5180
5576
|
}
|
|
5181
5577
|
|
|
5182
5578
|
// src/generated/instructions/repayDebt.ts
|
|
5183
|
-
var
|
|
5579
|
+
var import_kit39 = require("@solana/kit");
|
|
5184
5580
|
var REPAY_DEBT_DISCRIMINATOR = new Uint8Array([
|
|
5185
5581
|
79,
|
|
5186
5582
|
200,
|
|
@@ -5192,27 +5588,27 @@ var REPAY_DEBT_DISCRIMINATOR = new Uint8Array([
|
|
|
5192
5588
|
8
|
|
5193
5589
|
]);
|
|
5194
5590
|
function getRepayDebtDiscriminatorBytes() {
|
|
5195
|
-
return (0,
|
|
5591
|
+
return (0, import_kit39.fixEncoderSize)((0, import_kit39.getBytesEncoder)(), 8).encode(REPAY_DEBT_DISCRIMINATOR);
|
|
5196
5592
|
}
|
|
5197
5593
|
function getRepayDebtInstructionDataEncoder() {
|
|
5198
|
-
return (0,
|
|
5199
|
-
(0,
|
|
5200
|
-
["discriminator", (0,
|
|
5201
|
-
["collateralFundsA", (0,
|
|
5202
|
-
["collateralFundsB", (0,
|
|
5594
|
+
return (0, import_kit39.transformEncoder)(
|
|
5595
|
+
(0, import_kit39.getStructEncoder)([
|
|
5596
|
+
["discriminator", (0, import_kit39.fixEncoderSize)((0, import_kit39.getBytesEncoder)(), 8)],
|
|
5597
|
+
["collateralFundsA", (0, import_kit39.getU64Encoder)()],
|
|
5598
|
+
["collateralFundsB", (0, import_kit39.getU64Encoder)()]
|
|
5203
5599
|
]),
|
|
5204
5600
|
(value) => ({ ...value, discriminator: REPAY_DEBT_DISCRIMINATOR })
|
|
5205
5601
|
);
|
|
5206
5602
|
}
|
|
5207
5603
|
function getRepayDebtInstructionDataDecoder() {
|
|
5208
|
-
return (0,
|
|
5209
|
-
["discriminator", (0,
|
|
5210
|
-
["collateralFundsA", (0,
|
|
5211
|
-
["collateralFundsB", (0,
|
|
5604
|
+
return (0, import_kit39.getStructDecoder)([
|
|
5605
|
+
["discriminator", (0, import_kit39.fixDecoderSize)((0, import_kit39.getBytesDecoder)(), 8)],
|
|
5606
|
+
["collateralFundsA", (0, import_kit39.getU64Decoder)()],
|
|
5607
|
+
["collateralFundsB", (0, import_kit39.getU64Decoder)()]
|
|
5212
5608
|
]);
|
|
5213
5609
|
}
|
|
5214
5610
|
function getRepayDebtInstructionDataCodec() {
|
|
5215
|
-
return (0,
|
|
5611
|
+
return (0, import_kit39.combineCodec)(
|
|
5216
5612
|
getRepayDebtInstructionDataEncoder(),
|
|
5217
5613
|
getRepayDebtInstructionDataDecoder()
|
|
5218
5614
|
);
|
|
@@ -5313,7 +5709,7 @@ function parseRepayDebtInstruction(instruction) {
|
|
|
5313
5709
|
}
|
|
5314
5710
|
|
|
5315
5711
|
// src/generated/instructions/setAdminAuthority.ts
|
|
5316
|
-
var
|
|
5712
|
+
var import_kit40 = require("@solana/kit");
|
|
5317
5713
|
var SET_ADMIN_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
5318
5714
|
72,
|
|
5319
5715
|
49,
|
|
@@ -5325,27 +5721,27 @@ var SET_ADMIN_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
|
5325
5721
|
174
|
|
5326
5722
|
]);
|
|
5327
5723
|
function getSetAdminAuthorityDiscriminatorBytes() {
|
|
5328
|
-
return (0,
|
|
5724
|
+
return (0, import_kit40.fixEncoderSize)((0, import_kit40.getBytesEncoder)(), 8).encode(
|
|
5329
5725
|
SET_ADMIN_AUTHORITY_DISCRIMINATOR
|
|
5330
5726
|
);
|
|
5331
5727
|
}
|
|
5332
5728
|
function getSetAdminAuthorityInstructionDataEncoder() {
|
|
5333
|
-
return (0,
|
|
5334
|
-
(0,
|
|
5335
|
-
["discriminator", (0,
|
|
5336
|
-
["adminAuthority", (0,
|
|
5729
|
+
return (0, import_kit40.transformEncoder)(
|
|
5730
|
+
(0, import_kit40.getStructEncoder)([
|
|
5731
|
+
["discriminator", (0, import_kit40.fixEncoderSize)((0, import_kit40.getBytesEncoder)(), 8)],
|
|
5732
|
+
["adminAuthority", (0, import_kit40.getAddressEncoder)()]
|
|
5337
5733
|
]),
|
|
5338
5734
|
(value) => ({ ...value, discriminator: SET_ADMIN_AUTHORITY_DISCRIMINATOR })
|
|
5339
5735
|
);
|
|
5340
5736
|
}
|
|
5341
5737
|
function getSetAdminAuthorityInstructionDataDecoder() {
|
|
5342
|
-
return (0,
|
|
5343
|
-
["discriminator", (0,
|
|
5344
|
-
["adminAuthority", (0,
|
|
5738
|
+
return (0, import_kit40.getStructDecoder)([
|
|
5739
|
+
["discriminator", (0, import_kit40.fixDecoderSize)((0, import_kit40.getBytesDecoder)(), 8)],
|
|
5740
|
+
["adminAuthority", (0, import_kit40.getAddressDecoder)()]
|
|
5345
5741
|
]);
|
|
5346
5742
|
}
|
|
5347
5743
|
function getSetAdminAuthorityInstructionDataCodec() {
|
|
5348
|
-
return (0,
|
|
5744
|
+
return (0, import_kit40.combineCodec)(
|
|
5349
5745
|
getSetAdminAuthorityInstructionDataEncoder(),
|
|
5350
5746
|
getSetAdminAuthorityInstructionDataDecoder()
|
|
5351
5747
|
);
|
|
@@ -5392,18 +5788,18 @@ function parseSetAdminAuthorityInstruction(instruction) {
|
|
|
5392
5788
|
}
|
|
5393
5789
|
|
|
5394
5790
|
// src/generated/instructions/setDefaultMaxPercentageOfLeftovers.ts
|
|
5395
|
-
var
|
|
5791
|
+
var import_kit41 = require("@solana/kit");
|
|
5396
5792
|
var SET_DEFAULT_MAX_PERCENTAGE_OF_LEFTOVERS_DISCRIMINATOR = new Uint8Array([37, 179, 107, 65, 203, 141, 183, 27]);
|
|
5397
5793
|
function getSetDefaultMaxPercentageOfLeftoversDiscriminatorBytes() {
|
|
5398
|
-
return (0,
|
|
5794
|
+
return (0, import_kit41.fixEncoderSize)((0, import_kit41.getBytesEncoder)(), 8).encode(
|
|
5399
5795
|
SET_DEFAULT_MAX_PERCENTAGE_OF_LEFTOVERS_DISCRIMINATOR
|
|
5400
5796
|
);
|
|
5401
5797
|
}
|
|
5402
5798
|
function getSetDefaultMaxPercentageOfLeftoversInstructionDataEncoder() {
|
|
5403
|
-
return (0,
|
|
5404
|
-
(0,
|
|
5405
|
-
["discriminator", (0,
|
|
5406
|
-
["maxPercentageOfLeftovers", (0,
|
|
5799
|
+
return (0, import_kit41.transformEncoder)(
|
|
5800
|
+
(0, import_kit41.getStructEncoder)([
|
|
5801
|
+
["discriminator", (0, import_kit41.fixEncoderSize)((0, import_kit41.getBytesEncoder)(), 8)],
|
|
5802
|
+
["maxPercentageOfLeftovers", (0, import_kit41.getU32Encoder)()]
|
|
5407
5803
|
]),
|
|
5408
5804
|
(value) => ({
|
|
5409
5805
|
...value,
|
|
@@ -5412,13 +5808,13 @@ function getSetDefaultMaxPercentageOfLeftoversInstructionDataEncoder() {
|
|
|
5412
5808
|
);
|
|
5413
5809
|
}
|
|
5414
5810
|
function getSetDefaultMaxPercentageOfLeftoversInstructionDataDecoder() {
|
|
5415
|
-
return (0,
|
|
5416
|
-
["discriminator", (0,
|
|
5417
|
-
["maxPercentageOfLeftovers", (0,
|
|
5811
|
+
return (0, import_kit41.getStructDecoder)([
|
|
5812
|
+
["discriminator", (0, import_kit41.fixDecoderSize)((0, import_kit41.getBytesDecoder)(), 8)],
|
|
5813
|
+
["maxPercentageOfLeftovers", (0, import_kit41.getU32Decoder)()]
|
|
5418
5814
|
]);
|
|
5419
5815
|
}
|
|
5420
5816
|
function getSetDefaultMaxPercentageOfLeftoversInstructionDataCodec() {
|
|
5421
|
-
return (0,
|
|
5817
|
+
return (0, import_kit41.combineCodec)(
|
|
5422
5818
|
getSetDefaultMaxPercentageOfLeftoversInstructionDataEncoder(),
|
|
5423
5819
|
getSetDefaultMaxPercentageOfLeftoversInstructionDataDecoder()
|
|
5424
5820
|
);
|
|
@@ -5467,7 +5863,7 @@ function parseSetDefaultMaxPercentageOfLeftoversInstruction(instruction) {
|
|
|
5467
5863
|
}
|
|
5468
5864
|
|
|
5469
5865
|
// src/generated/instructions/setDefaultMaxSwapSlippage.ts
|
|
5470
|
-
var
|
|
5866
|
+
var import_kit42 = require("@solana/kit");
|
|
5471
5867
|
var SET_DEFAULT_MAX_SWAP_SLIPPAGE_DISCRIMINATOR = new Uint8Array([
|
|
5472
5868
|
122,
|
|
5473
5869
|
22,
|
|
@@ -5479,15 +5875,15 @@ var SET_DEFAULT_MAX_SWAP_SLIPPAGE_DISCRIMINATOR = new Uint8Array([
|
|
|
5479
5875
|
181
|
|
5480
5876
|
]);
|
|
5481
5877
|
function getSetDefaultMaxSwapSlippageDiscriminatorBytes() {
|
|
5482
|
-
return (0,
|
|
5878
|
+
return (0, import_kit42.fixEncoderSize)((0, import_kit42.getBytesEncoder)(), 8).encode(
|
|
5483
5879
|
SET_DEFAULT_MAX_SWAP_SLIPPAGE_DISCRIMINATOR
|
|
5484
5880
|
);
|
|
5485
5881
|
}
|
|
5486
5882
|
function getSetDefaultMaxSwapSlippageInstructionDataEncoder() {
|
|
5487
|
-
return (0,
|
|
5488
|
-
(0,
|
|
5489
|
-
["discriminator", (0,
|
|
5490
|
-
["maxSwapSlippage", (0,
|
|
5883
|
+
return (0, import_kit42.transformEncoder)(
|
|
5884
|
+
(0, import_kit42.getStructEncoder)([
|
|
5885
|
+
["discriminator", (0, import_kit42.fixEncoderSize)((0, import_kit42.getBytesEncoder)(), 8)],
|
|
5886
|
+
["maxSwapSlippage", (0, import_kit42.getU32Encoder)()]
|
|
5491
5887
|
]),
|
|
5492
5888
|
(value) => ({
|
|
5493
5889
|
...value,
|
|
@@ -5496,13 +5892,13 @@ function getSetDefaultMaxSwapSlippageInstructionDataEncoder() {
|
|
|
5496
5892
|
);
|
|
5497
5893
|
}
|
|
5498
5894
|
function getSetDefaultMaxSwapSlippageInstructionDataDecoder() {
|
|
5499
|
-
return (0,
|
|
5500
|
-
["discriminator", (0,
|
|
5501
|
-
["maxSwapSlippage", (0,
|
|
5895
|
+
return (0, import_kit42.getStructDecoder)([
|
|
5896
|
+
["discriminator", (0, import_kit42.fixDecoderSize)((0, import_kit42.getBytesDecoder)(), 8)],
|
|
5897
|
+
["maxSwapSlippage", (0, import_kit42.getU32Decoder)()]
|
|
5502
5898
|
]);
|
|
5503
5899
|
}
|
|
5504
5900
|
function getSetDefaultMaxSwapSlippageInstructionDataCodec() {
|
|
5505
|
-
return (0,
|
|
5901
|
+
return (0, import_kit42.combineCodec)(
|
|
5506
5902
|
getSetDefaultMaxSwapSlippageInstructionDataEncoder(),
|
|
5507
5903
|
getSetDefaultMaxSwapSlippageInstructionDataDecoder()
|
|
5508
5904
|
);
|
|
@@ -5551,18 +5947,18 @@ function parseSetDefaultMaxSwapSlippageInstruction(instruction) {
|
|
|
5551
5947
|
}
|
|
5552
5948
|
|
|
5553
5949
|
// src/generated/instructions/setDefaultOraclePriceDeviationThreshold.ts
|
|
5554
|
-
var
|
|
5950
|
+
var import_kit43 = require("@solana/kit");
|
|
5555
5951
|
var SET_DEFAULT_ORACLE_PRICE_DEVIATION_THRESHOLD_DISCRIMINATOR = new Uint8Array([142, 158, 143, 67, 206, 91, 139, 120]);
|
|
5556
5952
|
function getSetDefaultOraclePriceDeviationThresholdDiscriminatorBytes() {
|
|
5557
|
-
return (0,
|
|
5953
|
+
return (0, import_kit43.fixEncoderSize)((0, import_kit43.getBytesEncoder)(), 8).encode(
|
|
5558
5954
|
SET_DEFAULT_ORACLE_PRICE_DEVIATION_THRESHOLD_DISCRIMINATOR
|
|
5559
5955
|
);
|
|
5560
5956
|
}
|
|
5561
5957
|
function getSetDefaultOraclePriceDeviationThresholdInstructionDataEncoder() {
|
|
5562
|
-
return (0,
|
|
5563
|
-
(0,
|
|
5564
|
-
["discriminator", (0,
|
|
5565
|
-
["oraclePriceDeviationThreshold", (0,
|
|
5958
|
+
return (0, import_kit43.transformEncoder)(
|
|
5959
|
+
(0, import_kit43.getStructEncoder)([
|
|
5960
|
+
["discriminator", (0, import_kit43.fixEncoderSize)((0, import_kit43.getBytesEncoder)(), 8)],
|
|
5961
|
+
["oraclePriceDeviationThreshold", (0, import_kit43.getU32Encoder)()]
|
|
5566
5962
|
]),
|
|
5567
5963
|
(value) => ({
|
|
5568
5964
|
...value,
|
|
@@ -5571,13 +5967,13 @@ function getSetDefaultOraclePriceDeviationThresholdInstructionDataEncoder() {
|
|
|
5571
5967
|
);
|
|
5572
5968
|
}
|
|
5573
5969
|
function getSetDefaultOraclePriceDeviationThresholdInstructionDataDecoder() {
|
|
5574
|
-
return (0,
|
|
5575
|
-
["discriminator", (0,
|
|
5576
|
-
["oraclePriceDeviationThreshold", (0,
|
|
5970
|
+
return (0, import_kit43.getStructDecoder)([
|
|
5971
|
+
["discriminator", (0, import_kit43.fixDecoderSize)((0, import_kit43.getBytesDecoder)(), 8)],
|
|
5972
|
+
["oraclePriceDeviationThreshold", (0, import_kit43.getU32Decoder)()]
|
|
5577
5973
|
]);
|
|
5578
5974
|
}
|
|
5579
5975
|
function getSetDefaultOraclePriceDeviationThresholdInstructionDataCodec() {
|
|
5580
|
-
return (0,
|
|
5976
|
+
return (0, import_kit43.combineCodec)(
|
|
5581
5977
|
getSetDefaultOraclePriceDeviationThresholdInstructionDataEncoder(),
|
|
5582
5978
|
getSetDefaultOraclePriceDeviationThresholdInstructionDataDecoder()
|
|
5583
5979
|
);
|
|
@@ -5626,7 +6022,7 @@ function parseSetDefaultOraclePriceDeviationThresholdInstruction(instruction) {
|
|
|
5626
6022
|
}
|
|
5627
6023
|
|
|
5628
6024
|
// src/generated/instructions/setFeeRecipient.ts
|
|
5629
|
-
var
|
|
6025
|
+
var import_kit44 = require("@solana/kit");
|
|
5630
6026
|
var SET_FEE_RECIPIENT_DISCRIMINATOR = new Uint8Array([
|
|
5631
6027
|
227,
|
|
5632
6028
|
18,
|
|
@@ -5638,27 +6034,27 @@ var SET_FEE_RECIPIENT_DISCRIMINATOR = new Uint8Array([
|
|
|
5638
6034
|
66
|
|
5639
6035
|
]);
|
|
5640
6036
|
function getSetFeeRecipientDiscriminatorBytes() {
|
|
5641
|
-
return (0,
|
|
6037
|
+
return (0, import_kit44.fixEncoderSize)((0, import_kit44.getBytesEncoder)(), 8).encode(
|
|
5642
6038
|
SET_FEE_RECIPIENT_DISCRIMINATOR
|
|
5643
6039
|
);
|
|
5644
6040
|
}
|
|
5645
6041
|
function getSetFeeRecipientInstructionDataEncoder() {
|
|
5646
|
-
return (0,
|
|
5647
|
-
(0,
|
|
5648
|
-
["discriminator", (0,
|
|
5649
|
-
["feeRecipient", (0,
|
|
6042
|
+
return (0, import_kit44.transformEncoder)(
|
|
6043
|
+
(0, import_kit44.getStructEncoder)([
|
|
6044
|
+
["discriminator", (0, import_kit44.fixEncoderSize)((0, import_kit44.getBytesEncoder)(), 8)],
|
|
6045
|
+
["feeRecipient", (0, import_kit44.getAddressEncoder)()]
|
|
5650
6046
|
]),
|
|
5651
6047
|
(value) => ({ ...value, discriminator: SET_FEE_RECIPIENT_DISCRIMINATOR })
|
|
5652
6048
|
);
|
|
5653
6049
|
}
|
|
5654
6050
|
function getSetFeeRecipientInstructionDataDecoder() {
|
|
5655
|
-
return (0,
|
|
5656
|
-
["discriminator", (0,
|
|
5657
|
-
["feeRecipient", (0,
|
|
6051
|
+
return (0, import_kit44.getStructDecoder)([
|
|
6052
|
+
["discriminator", (0, import_kit44.fixDecoderSize)((0, import_kit44.getBytesDecoder)(), 8)],
|
|
6053
|
+
["feeRecipient", (0, import_kit44.getAddressDecoder)()]
|
|
5658
6054
|
]);
|
|
5659
6055
|
}
|
|
5660
6056
|
function getSetFeeRecipientInstructionDataCodec() {
|
|
5661
|
-
return (0,
|
|
6057
|
+
return (0, import_kit44.combineCodec)(
|
|
5662
6058
|
getSetFeeRecipientInstructionDataEncoder(),
|
|
5663
6059
|
getSetFeeRecipientInstructionDataDecoder()
|
|
5664
6060
|
);
|
|
@@ -5705,7 +6101,7 @@ function parseSetFeeRecipientInstruction(instruction) {
|
|
|
5705
6101
|
}
|
|
5706
6102
|
|
|
5707
6103
|
// src/generated/instructions/setLimitOrders.ts
|
|
5708
|
-
var
|
|
6104
|
+
var import_kit45 = require("@solana/kit");
|
|
5709
6105
|
var SET_LIMIT_ORDERS_DISCRIMINATOR = new Uint8Array([
|
|
5710
6106
|
65,
|
|
5711
6107
|
128,
|
|
@@ -5717,31 +6113,31 @@ var SET_LIMIT_ORDERS_DISCRIMINATOR = new Uint8Array([
|
|
|
5717
6113
|
255
|
|
5718
6114
|
]);
|
|
5719
6115
|
function getSetLimitOrdersDiscriminatorBytes() {
|
|
5720
|
-
return (0,
|
|
6116
|
+
return (0, import_kit45.fixEncoderSize)((0, import_kit45.getBytesEncoder)(), 8).encode(
|
|
5721
6117
|
SET_LIMIT_ORDERS_DISCRIMINATOR
|
|
5722
6118
|
);
|
|
5723
6119
|
}
|
|
5724
6120
|
function getSetLimitOrdersInstructionDataEncoder() {
|
|
5725
|
-
return (0,
|
|
5726
|
-
(0,
|
|
5727
|
-
["discriminator", (0,
|
|
5728
|
-
["tickStopLossIndex", (0,
|
|
5729
|
-
["tickTakeProfitIndex", (0,
|
|
5730
|
-
["swapToTokenOnLimitOrder", (0,
|
|
6121
|
+
return (0, import_kit45.transformEncoder)(
|
|
6122
|
+
(0, import_kit45.getStructEncoder)([
|
|
6123
|
+
["discriminator", (0, import_kit45.fixEncoderSize)((0, import_kit45.getBytesEncoder)(), 8)],
|
|
6124
|
+
["tickStopLossIndex", (0, import_kit45.getI32Encoder)()],
|
|
6125
|
+
["tickTakeProfitIndex", (0, import_kit45.getI32Encoder)()],
|
|
6126
|
+
["swapToTokenOnLimitOrder", (0, import_kit45.getU8Encoder)()]
|
|
5731
6127
|
]),
|
|
5732
6128
|
(value) => ({ ...value, discriminator: SET_LIMIT_ORDERS_DISCRIMINATOR })
|
|
5733
6129
|
);
|
|
5734
6130
|
}
|
|
5735
6131
|
function getSetLimitOrdersInstructionDataDecoder() {
|
|
5736
|
-
return (0,
|
|
5737
|
-
["discriminator", (0,
|
|
5738
|
-
["tickStopLossIndex", (0,
|
|
5739
|
-
["tickTakeProfitIndex", (0,
|
|
5740
|
-
["swapToTokenOnLimitOrder", (0,
|
|
6132
|
+
return (0, import_kit45.getStructDecoder)([
|
|
6133
|
+
["discriminator", (0, import_kit45.fixDecoderSize)((0, import_kit45.getBytesDecoder)(), 8)],
|
|
6134
|
+
["tickStopLossIndex", (0, import_kit45.getI32Decoder)()],
|
|
6135
|
+
["tickTakeProfitIndex", (0, import_kit45.getI32Decoder)()],
|
|
6136
|
+
["swapToTokenOnLimitOrder", (0, import_kit45.getU8Decoder)()]
|
|
5741
6137
|
]);
|
|
5742
6138
|
}
|
|
5743
6139
|
function getSetLimitOrdersInstructionDataCodec() {
|
|
5744
|
-
return (0,
|
|
6140
|
+
return (0, import_kit45.combineCodec)(
|
|
5745
6141
|
getSetLimitOrdersInstructionDataEncoder(),
|
|
5746
6142
|
getSetLimitOrdersInstructionDataDecoder()
|
|
5747
6143
|
);
|
|
@@ -5788,7 +6184,7 @@ function parseSetLimitOrdersInstruction(instruction) {
|
|
|
5788
6184
|
}
|
|
5789
6185
|
|
|
5790
6186
|
// src/generated/instructions/setLiquidatorAuthority.ts
|
|
5791
|
-
var
|
|
6187
|
+
var import_kit46 = require("@solana/kit");
|
|
5792
6188
|
var SET_LIQUIDATOR_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
5793
6189
|
246,
|
|
5794
6190
|
146,
|
|
@@ -5800,15 +6196,15 @@ var SET_LIQUIDATOR_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
|
5800
6196
|
143
|
|
5801
6197
|
]);
|
|
5802
6198
|
function getSetLiquidatorAuthorityDiscriminatorBytes() {
|
|
5803
|
-
return (0,
|
|
6199
|
+
return (0, import_kit46.fixEncoderSize)((0, import_kit46.getBytesEncoder)(), 8).encode(
|
|
5804
6200
|
SET_LIQUIDATOR_AUTHORITY_DISCRIMINATOR
|
|
5805
6201
|
);
|
|
5806
6202
|
}
|
|
5807
6203
|
function getSetLiquidatorAuthorityInstructionDataEncoder() {
|
|
5808
|
-
return (0,
|
|
5809
|
-
(0,
|
|
5810
|
-
["discriminator", (0,
|
|
5811
|
-
["liquidatorAuthority", (0,
|
|
6204
|
+
return (0, import_kit46.transformEncoder)(
|
|
6205
|
+
(0, import_kit46.getStructEncoder)([
|
|
6206
|
+
["discriminator", (0, import_kit46.fixEncoderSize)((0, import_kit46.getBytesEncoder)(), 8)],
|
|
6207
|
+
["liquidatorAuthority", (0, import_kit46.getAddressEncoder)()]
|
|
5812
6208
|
]),
|
|
5813
6209
|
(value) => ({
|
|
5814
6210
|
...value,
|
|
@@ -5817,13 +6213,13 @@ function getSetLiquidatorAuthorityInstructionDataEncoder() {
|
|
|
5817
6213
|
);
|
|
5818
6214
|
}
|
|
5819
6215
|
function getSetLiquidatorAuthorityInstructionDataDecoder() {
|
|
5820
|
-
return (0,
|
|
5821
|
-
["discriminator", (0,
|
|
5822
|
-
["liquidatorAuthority", (0,
|
|
6216
|
+
return (0, import_kit46.getStructDecoder)([
|
|
6217
|
+
["discriminator", (0, import_kit46.fixDecoderSize)((0, import_kit46.getBytesDecoder)(), 8)],
|
|
6218
|
+
["liquidatorAuthority", (0, import_kit46.getAddressDecoder)()]
|
|
5823
6219
|
]);
|
|
5824
6220
|
}
|
|
5825
6221
|
function getSetLiquidatorAuthorityInstructionDataCodec() {
|
|
5826
|
-
return (0,
|
|
6222
|
+
return (0, import_kit46.combineCodec)(
|
|
5827
6223
|
getSetLiquidatorAuthorityInstructionDataEncoder(),
|
|
5828
6224
|
getSetLiquidatorAuthorityInstructionDataDecoder()
|
|
5829
6225
|
);
|
|
@@ -5872,7 +6268,7 @@ function parseSetLiquidatorAuthorityInstruction(instruction) {
|
|
|
5872
6268
|
}
|
|
5873
6269
|
|
|
5874
6270
|
// src/generated/instructions/setOwnerAuthority.ts
|
|
5875
|
-
var
|
|
6271
|
+
var import_kit47 = require("@solana/kit");
|
|
5876
6272
|
var SET_OWNER_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
5877
6273
|
128,
|
|
5878
6274
|
171,
|
|
@@ -5884,27 +6280,27 @@ var SET_OWNER_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
|
5884
6280
|
117
|
|
5885
6281
|
]);
|
|
5886
6282
|
function getSetOwnerAuthorityDiscriminatorBytes() {
|
|
5887
|
-
return (0,
|
|
6283
|
+
return (0, import_kit47.fixEncoderSize)((0, import_kit47.getBytesEncoder)(), 8).encode(
|
|
5888
6284
|
SET_OWNER_AUTHORITY_DISCRIMINATOR
|
|
5889
6285
|
);
|
|
5890
6286
|
}
|
|
5891
6287
|
function getSetOwnerAuthorityInstructionDataEncoder() {
|
|
5892
|
-
return (0,
|
|
5893
|
-
(0,
|
|
5894
|
-
["discriminator", (0,
|
|
5895
|
-
["ownerAuthority", (0,
|
|
6288
|
+
return (0, import_kit47.transformEncoder)(
|
|
6289
|
+
(0, import_kit47.getStructEncoder)([
|
|
6290
|
+
["discriminator", (0, import_kit47.fixEncoderSize)((0, import_kit47.getBytesEncoder)(), 8)],
|
|
6291
|
+
["ownerAuthority", (0, import_kit47.getAddressEncoder)()]
|
|
5896
6292
|
]),
|
|
5897
6293
|
(value) => ({ ...value, discriminator: SET_OWNER_AUTHORITY_DISCRIMINATOR })
|
|
5898
6294
|
);
|
|
5899
6295
|
}
|
|
5900
6296
|
function getSetOwnerAuthorityInstructionDataDecoder() {
|
|
5901
|
-
return (0,
|
|
5902
|
-
["discriminator", (0,
|
|
5903
|
-
["ownerAuthority", (0,
|
|
6297
|
+
return (0, import_kit47.getStructDecoder)([
|
|
6298
|
+
["discriminator", (0, import_kit47.fixDecoderSize)((0, import_kit47.getBytesDecoder)(), 8)],
|
|
6299
|
+
["ownerAuthority", (0, import_kit47.getAddressDecoder)()]
|
|
5904
6300
|
]);
|
|
5905
6301
|
}
|
|
5906
6302
|
function getSetOwnerAuthorityInstructionDataCodec() {
|
|
5907
|
-
return (0,
|
|
6303
|
+
return (0, import_kit47.combineCodec)(
|
|
5908
6304
|
getSetOwnerAuthorityInstructionDataEncoder(),
|
|
5909
6305
|
getSetOwnerAuthorityInstructionDataDecoder()
|
|
5910
6306
|
);
|
|
@@ -5951,7 +6347,7 @@ function parseSetOwnerAuthorityInstruction(instruction) {
|
|
|
5951
6347
|
}
|
|
5952
6348
|
|
|
5953
6349
|
// src/generated/instructions/setSuspendedState.ts
|
|
5954
|
-
var
|
|
6350
|
+
var import_kit48 = require("@solana/kit");
|
|
5955
6351
|
var SET_SUSPENDED_STATE_DISCRIMINATOR = new Uint8Array([
|
|
5956
6352
|
145,
|
|
5957
6353
|
13,
|
|
@@ -5963,33 +6359,33 @@ var SET_SUSPENDED_STATE_DISCRIMINATOR = new Uint8Array([
|
|
|
5963
6359
|
32
|
|
5964
6360
|
]);
|
|
5965
6361
|
function getSetSuspendedStateDiscriminatorBytes() {
|
|
5966
|
-
return (0,
|
|
6362
|
+
return (0, import_kit48.fixEncoderSize)((0, import_kit48.getBytesEncoder)(), 8).encode(
|
|
5967
6363
|
SET_SUSPENDED_STATE_DISCRIMINATOR
|
|
5968
6364
|
);
|
|
5969
6365
|
}
|
|
5970
6366
|
function getSetSuspendedStateInstructionDataEncoder() {
|
|
5971
|
-
return (0,
|
|
5972
|
-
(0,
|
|
5973
|
-
["discriminator", (0,
|
|
5974
|
-
["suspendLendingDeposits", (0,
|
|
5975
|
-
["suspendLendingWithdrawals", (0,
|
|
5976
|
-
["suspendAddLiquidity", (0,
|
|
5977
|
-
["suspendRemoveLiquidity", (0,
|
|
6367
|
+
return (0, import_kit48.transformEncoder)(
|
|
6368
|
+
(0, import_kit48.getStructEncoder)([
|
|
6369
|
+
["discriminator", (0, import_kit48.fixEncoderSize)((0, import_kit48.getBytesEncoder)(), 8)],
|
|
6370
|
+
["suspendLendingDeposits", (0, import_kit48.getBooleanEncoder)()],
|
|
6371
|
+
["suspendLendingWithdrawals", (0, import_kit48.getBooleanEncoder)()],
|
|
6372
|
+
["suspendAddLiquidity", (0, import_kit48.getBooleanEncoder)()],
|
|
6373
|
+
["suspendRemoveLiquidity", (0, import_kit48.getBooleanEncoder)()]
|
|
5978
6374
|
]),
|
|
5979
6375
|
(value) => ({ ...value, discriminator: SET_SUSPENDED_STATE_DISCRIMINATOR })
|
|
5980
6376
|
);
|
|
5981
6377
|
}
|
|
5982
6378
|
function getSetSuspendedStateInstructionDataDecoder() {
|
|
5983
|
-
return (0,
|
|
5984
|
-
["discriminator", (0,
|
|
5985
|
-
["suspendLendingDeposits", (0,
|
|
5986
|
-
["suspendLendingWithdrawals", (0,
|
|
5987
|
-
["suspendAddLiquidity", (0,
|
|
5988
|
-
["suspendRemoveLiquidity", (0,
|
|
6379
|
+
return (0, import_kit48.getStructDecoder)([
|
|
6380
|
+
["discriminator", (0, import_kit48.fixDecoderSize)((0, import_kit48.getBytesDecoder)(), 8)],
|
|
6381
|
+
["suspendLendingDeposits", (0, import_kit48.getBooleanDecoder)()],
|
|
6382
|
+
["suspendLendingWithdrawals", (0, import_kit48.getBooleanDecoder)()],
|
|
6383
|
+
["suspendAddLiquidity", (0, import_kit48.getBooleanDecoder)()],
|
|
6384
|
+
["suspendRemoveLiquidity", (0, import_kit48.getBooleanDecoder)()]
|
|
5989
6385
|
]);
|
|
5990
6386
|
}
|
|
5991
6387
|
function getSetSuspendedStateInstructionDataCodec() {
|
|
5992
|
-
return (0,
|
|
6388
|
+
return (0, import_kit48.combineCodec)(
|
|
5993
6389
|
getSetSuspendedStateInstructionDataEncoder(),
|
|
5994
6390
|
getSetSuspendedStateInstructionDataDecoder()
|
|
5995
6391
|
);
|
|
@@ -6036,7 +6432,7 @@ function parseSetSuspendedStateInstruction(instruction) {
|
|
|
6036
6432
|
}
|
|
6037
6433
|
|
|
6038
6434
|
// src/generated/instructions/setTunaPositionFlags.ts
|
|
6039
|
-
var
|
|
6435
|
+
var import_kit49 = require("@solana/kit");
|
|
6040
6436
|
var SET_TUNA_POSITION_FLAGS_DISCRIMINATOR = new Uint8Array([
|
|
6041
6437
|
110,
|
|
6042
6438
|
73,
|
|
@@ -6048,15 +6444,15 @@ var SET_TUNA_POSITION_FLAGS_DISCRIMINATOR = new Uint8Array([
|
|
|
6048
6444
|
57
|
|
6049
6445
|
]);
|
|
6050
6446
|
function getSetTunaPositionFlagsDiscriminatorBytes() {
|
|
6051
|
-
return (0,
|
|
6447
|
+
return (0, import_kit49.fixEncoderSize)((0, import_kit49.getBytesEncoder)(), 8).encode(
|
|
6052
6448
|
SET_TUNA_POSITION_FLAGS_DISCRIMINATOR
|
|
6053
6449
|
);
|
|
6054
6450
|
}
|
|
6055
6451
|
function getSetTunaPositionFlagsInstructionDataEncoder() {
|
|
6056
|
-
return (0,
|
|
6057
|
-
(0,
|
|
6058
|
-
["discriminator", (0,
|
|
6059
|
-
["flags", (0,
|
|
6452
|
+
return (0, import_kit49.transformEncoder)(
|
|
6453
|
+
(0, import_kit49.getStructEncoder)([
|
|
6454
|
+
["discriminator", (0, import_kit49.fixEncoderSize)((0, import_kit49.getBytesEncoder)(), 8)],
|
|
6455
|
+
["flags", (0, import_kit49.getU32Encoder)()]
|
|
6060
6456
|
]),
|
|
6061
6457
|
(value) => ({
|
|
6062
6458
|
...value,
|
|
@@ -6065,13 +6461,13 @@ function getSetTunaPositionFlagsInstructionDataEncoder() {
|
|
|
6065
6461
|
);
|
|
6066
6462
|
}
|
|
6067
6463
|
function getSetTunaPositionFlagsInstructionDataDecoder() {
|
|
6068
|
-
return (0,
|
|
6069
|
-
["discriminator", (0,
|
|
6070
|
-
["flags", (0,
|
|
6464
|
+
return (0, import_kit49.getStructDecoder)([
|
|
6465
|
+
["discriminator", (0, import_kit49.fixDecoderSize)((0, import_kit49.getBytesDecoder)(), 8)],
|
|
6466
|
+
["flags", (0, import_kit49.getU32Decoder)()]
|
|
6071
6467
|
]);
|
|
6072
6468
|
}
|
|
6073
6469
|
function getSetTunaPositionFlagsInstructionDataCodec() {
|
|
6074
|
-
return (0,
|
|
6470
|
+
return (0, import_kit49.combineCodec)(
|
|
6075
6471
|
getSetTunaPositionFlagsInstructionDataEncoder(),
|
|
6076
6472
|
getSetTunaPositionFlagsInstructionDataDecoder()
|
|
6077
6473
|
);
|
|
@@ -6119,8 +6515,83 @@ function parseSetTunaPositionFlagsInstruction(instruction) {
|
|
|
6119
6515
|
};
|
|
6120
6516
|
}
|
|
6121
6517
|
|
|
6518
|
+
// src/generated/instructions/setTunaPositionRebalanceThreshold.ts
|
|
6519
|
+
var import_kit50 = require("@solana/kit");
|
|
6520
|
+
var SET_TUNA_POSITION_REBALANCE_THRESHOLD_DISCRIMINATOR = new Uint8Array([108, 170, 86, 159, 171, 164, 28, 51]);
|
|
6521
|
+
function getSetTunaPositionRebalanceThresholdDiscriminatorBytes() {
|
|
6522
|
+
return (0, import_kit50.fixEncoderSize)((0, import_kit50.getBytesEncoder)(), 8).encode(
|
|
6523
|
+
SET_TUNA_POSITION_REBALANCE_THRESHOLD_DISCRIMINATOR
|
|
6524
|
+
);
|
|
6525
|
+
}
|
|
6526
|
+
function getSetTunaPositionRebalanceThresholdInstructionDataEncoder() {
|
|
6527
|
+
return (0, import_kit50.transformEncoder)(
|
|
6528
|
+
(0, import_kit50.getStructEncoder)([
|
|
6529
|
+
["discriminator", (0, import_kit50.fixEncoderSize)((0, import_kit50.getBytesEncoder)(), 8)],
|
|
6530
|
+
["rebalanceThresholdTicks", (0, import_kit50.getU32Encoder)()]
|
|
6531
|
+
]),
|
|
6532
|
+
(value) => ({
|
|
6533
|
+
...value,
|
|
6534
|
+
discriminator: SET_TUNA_POSITION_REBALANCE_THRESHOLD_DISCRIMINATOR
|
|
6535
|
+
})
|
|
6536
|
+
);
|
|
6537
|
+
}
|
|
6538
|
+
function getSetTunaPositionRebalanceThresholdInstructionDataDecoder() {
|
|
6539
|
+
return (0, import_kit50.getStructDecoder)([
|
|
6540
|
+
["discriminator", (0, import_kit50.fixDecoderSize)((0, import_kit50.getBytesDecoder)(), 8)],
|
|
6541
|
+
["rebalanceThresholdTicks", (0, import_kit50.getU32Decoder)()]
|
|
6542
|
+
]);
|
|
6543
|
+
}
|
|
6544
|
+
function getSetTunaPositionRebalanceThresholdInstructionDataCodec() {
|
|
6545
|
+
return (0, import_kit50.combineCodec)(
|
|
6546
|
+
getSetTunaPositionRebalanceThresholdInstructionDataEncoder(),
|
|
6547
|
+
getSetTunaPositionRebalanceThresholdInstructionDataDecoder()
|
|
6548
|
+
);
|
|
6549
|
+
}
|
|
6550
|
+
function getSetTunaPositionRebalanceThresholdInstruction(input, config) {
|
|
6551
|
+
const programAddress = config?.programAddress ?? TUNA_PROGRAM_ADDRESS;
|
|
6552
|
+
const originalAccounts = {
|
|
6553
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
6554
|
+
tunaPosition: { value: input.tunaPosition ?? null, isWritable: true }
|
|
6555
|
+
};
|
|
6556
|
+
const accounts = originalAccounts;
|
|
6557
|
+
const args = { ...input };
|
|
6558
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
6559
|
+
const instruction = {
|
|
6560
|
+
accounts: [
|
|
6561
|
+
getAccountMeta(accounts.authority),
|
|
6562
|
+
getAccountMeta(accounts.tunaPosition)
|
|
6563
|
+
],
|
|
6564
|
+
programAddress,
|
|
6565
|
+
data: getSetTunaPositionRebalanceThresholdInstructionDataEncoder().encode(
|
|
6566
|
+
args
|
|
6567
|
+
)
|
|
6568
|
+
};
|
|
6569
|
+
return instruction;
|
|
6570
|
+
}
|
|
6571
|
+
function parseSetTunaPositionRebalanceThresholdInstruction(instruction) {
|
|
6572
|
+
if (instruction.accounts.length < 2) {
|
|
6573
|
+
throw new Error("Not enough accounts");
|
|
6574
|
+
}
|
|
6575
|
+
let accountIndex = 0;
|
|
6576
|
+
const getNextAccount = () => {
|
|
6577
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
6578
|
+
accountIndex += 1;
|
|
6579
|
+
return accountMeta;
|
|
6580
|
+
};
|
|
6581
|
+
return {
|
|
6582
|
+
programAddress: instruction.programAddress,
|
|
6583
|
+
accounts: {
|
|
6584
|
+
authority: getNextAccount(),
|
|
6585
|
+
tunaPosition: getNextAccount()
|
|
6586
|
+
},
|
|
6587
|
+
data: getSetTunaPositionRebalanceThresholdInstructionDataDecoder().decode(
|
|
6588
|
+
instruction.data
|
|
6589
|
+
)
|
|
6590
|
+
};
|
|
6591
|
+
}
|
|
6592
|
+
|
|
6122
6593
|
// src/generated/instructions/updateMarket.ts
|
|
6123
|
-
var
|
|
6594
|
+
var import_kit51 = require("@solana/kit");
|
|
6124
6595
|
var UPDATE_MARKET_DISCRIMINATOR = new Uint8Array([
|
|
6125
6596
|
153,
|
|
6126
6597
|
39,
|
|
@@ -6132,49 +6603,49 @@ var UPDATE_MARKET_DISCRIMINATOR = new Uint8Array([
|
|
|
6132
6603
|
217
|
|
6133
6604
|
]);
|
|
6134
6605
|
function getUpdateMarketDiscriminatorBytes() {
|
|
6135
|
-
return (0,
|
|
6606
|
+
return (0, import_kit51.fixEncoderSize)((0, import_kit51.getBytesEncoder)(), 8).encode(
|
|
6136
6607
|
UPDATE_MARKET_DISCRIMINATOR
|
|
6137
6608
|
);
|
|
6138
6609
|
}
|
|
6139
6610
|
function getUpdateMarketInstructionDataEncoder() {
|
|
6140
|
-
return (0,
|
|
6141
|
-
(0,
|
|
6142
|
-
["discriminator", (0,
|
|
6143
|
-
["addressLookupTable", (0,
|
|
6144
|
-
["maxLeverage", (0,
|
|
6145
|
-
["protocolFee", (0,
|
|
6146
|
-
["protocolFeeOnCollateral", (0,
|
|
6147
|
-
["liquidationFee", (0,
|
|
6148
|
-
["liquidationThreshold", (0,
|
|
6149
|
-
["limitOrderExecutionFee", (0,
|
|
6150
|
-
["oraclePriceDeviationThreshold", (0,
|
|
6151
|
-
["disabled", (0,
|
|
6152
|
-
["borrowLimitA", (0,
|
|
6153
|
-
["borrowLimitB", (0,
|
|
6154
|
-
["maxSwapSlippage", (0,
|
|
6611
|
+
return (0, import_kit51.transformEncoder)(
|
|
6612
|
+
(0, import_kit51.getStructEncoder)([
|
|
6613
|
+
["discriminator", (0, import_kit51.fixEncoderSize)((0, import_kit51.getBytesEncoder)(), 8)],
|
|
6614
|
+
["addressLookupTable", (0, import_kit51.getAddressEncoder)()],
|
|
6615
|
+
["maxLeverage", (0, import_kit51.getU32Encoder)()],
|
|
6616
|
+
["protocolFee", (0, import_kit51.getU16Encoder)()],
|
|
6617
|
+
["protocolFeeOnCollateral", (0, import_kit51.getU16Encoder)()],
|
|
6618
|
+
["liquidationFee", (0, import_kit51.getU32Encoder)()],
|
|
6619
|
+
["liquidationThreshold", (0, import_kit51.getU32Encoder)()],
|
|
6620
|
+
["limitOrderExecutionFee", (0, import_kit51.getU32Encoder)()],
|
|
6621
|
+
["oraclePriceDeviationThreshold", (0, import_kit51.getU32Encoder)()],
|
|
6622
|
+
["disabled", (0, import_kit51.getBooleanEncoder)()],
|
|
6623
|
+
["borrowLimitA", (0, import_kit51.getU64Encoder)()],
|
|
6624
|
+
["borrowLimitB", (0, import_kit51.getU64Encoder)()],
|
|
6625
|
+
["maxSwapSlippage", (0, import_kit51.getU32Encoder)()]
|
|
6155
6626
|
]),
|
|
6156
6627
|
(value) => ({ ...value, discriminator: UPDATE_MARKET_DISCRIMINATOR })
|
|
6157
6628
|
);
|
|
6158
6629
|
}
|
|
6159
6630
|
function getUpdateMarketInstructionDataDecoder() {
|
|
6160
|
-
return (0,
|
|
6161
|
-
["discriminator", (0,
|
|
6162
|
-
["addressLookupTable", (0,
|
|
6163
|
-
["maxLeverage", (0,
|
|
6164
|
-
["protocolFee", (0,
|
|
6165
|
-
["protocolFeeOnCollateral", (0,
|
|
6166
|
-
["liquidationFee", (0,
|
|
6167
|
-
["liquidationThreshold", (0,
|
|
6168
|
-
["limitOrderExecutionFee", (0,
|
|
6169
|
-
["oraclePriceDeviationThreshold", (0,
|
|
6170
|
-
["disabled", (0,
|
|
6171
|
-
["borrowLimitA", (0,
|
|
6172
|
-
["borrowLimitB", (0,
|
|
6173
|
-
["maxSwapSlippage", (0,
|
|
6631
|
+
return (0, import_kit51.getStructDecoder)([
|
|
6632
|
+
["discriminator", (0, import_kit51.fixDecoderSize)((0, import_kit51.getBytesDecoder)(), 8)],
|
|
6633
|
+
["addressLookupTable", (0, import_kit51.getAddressDecoder)()],
|
|
6634
|
+
["maxLeverage", (0, import_kit51.getU32Decoder)()],
|
|
6635
|
+
["protocolFee", (0, import_kit51.getU16Decoder)()],
|
|
6636
|
+
["protocolFeeOnCollateral", (0, import_kit51.getU16Decoder)()],
|
|
6637
|
+
["liquidationFee", (0, import_kit51.getU32Decoder)()],
|
|
6638
|
+
["liquidationThreshold", (0, import_kit51.getU32Decoder)()],
|
|
6639
|
+
["limitOrderExecutionFee", (0, import_kit51.getU32Decoder)()],
|
|
6640
|
+
["oraclePriceDeviationThreshold", (0, import_kit51.getU32Decoder)()],
|
|
6641
|
+
["disabled", (0, import_kit51.getBooleanDecoder)()],
|
|
6642
|
+
["borrowLimitA", (0, import_kit51.getU64Decoder)()],
|
|
6643
|
+
["borrowLimitB", (0, import_kit51.getU64Decoder)()],
|
|
6644
|
+
["maxSwapSlippage", (0, import_kit51.getU32Decoder)()]
|
|
6174
6645
|
]);
|
|
6175
6646
|
}
|
|
6176
6647
|
function getUpdateMarketInstructionDataCodec() {
|
|
6177
|
-
return (0,
|
|
6648
|
+
return (0, import_kit51.combineCodec)(
|
|
6178
6649
|
getUpdateMarketInstructionDataEncoder(),
|
|
6179
6650
|
getUpdateMarketInstructionDataDecoder()
|
|
6180
6651
|
);
|
|
@@ -6224,7 +6695,7 @@ function parseUpdateMarketInstruction(instruction) {
|
|
|
6224
6695
|
}
|
|
6225
6696
|
|
|
6226
6697
|
// src/generated/instructions/updateVault.ts
|
|
6227
|
-
var
|
|
6698
|
+
var import_kit52 = require("@solana/kit");
|
|
6228
6699
|
var UPDATE_VAULT_DISCRIMINATOR = new Uint8Array([
|
|
6229
6700
|
67,
|
|
6230
6701
|
229,
|
|
@@ -6236,33 +6707,33 @@ var UPDATE_VAULT_DISCRIMINATOR = new Uint8Array([
|
|
|
6236
6707
|
60
|
|
6237
6708
|
]);
|
|
6238
6709
|
function getUpdateVaultDiscriminatorBytes() {
|
|
6239
|
-
return (0,
|
|
6710
|
+
return (0, import_kit52.fixEncoderSize)((0, import_kit52.getBytesEncoder)(), 8).encode(
|
|
6240
6711
|
UPDATE_VAULT_DISCRIMINATOR
|
|
6241
6712
|
);
|
|
6242
6713
|
}
|
|
6243
6714
|
function getUpdateVaultInstructionDataEncoder() {
|
|
6244
|
-
return (0,
|
|
6245
|
-
(0,
|
|
6246
|
-
["discriminator", (0,
|
|
6247
|
-
["interestRate", (0,
|
|
6248
|
-
["supplyLimit", (0,
|
|
6249
|
-
["pythOraclePriceUpdate", (0,
|
|
6250
|
-
["pythOracleFeedId", (0,
|
|
6715
|
+
return (0, import_kit52.transformEncoder)(
|
|
6716
|
+
(0, import_kit52.getStructEncoder)([
|
|
6717
|
+
["discriminator", (0, import_kit52.fixEncoderSize)((0, import_kit52.getBytesEncoder)(), 8)],
|
|
6718
|
+
["interestRate", (0, import_kit52.getU64Encoder)()],
|
|
6719
|
+
["supplyLimit", (0, import_kit52.getU64Encoder)()],
|
|
6720
|
+
["pythOraclePriceUpdate", (0, import_kit52.getAddressEncoder)()],
|
|
6721
|
+
["pythOracleFeedId", (0, import_kit52.getAddressEncoder)()]
|
|
6251
6722
|
]),
|
|
6252
6723
|
(value) => ({ ...value, discriminator: UPDATE_VAULT_DISCRIMINATOR })
|
|
6253
6724
|
);
|
|
6254
6725
|
}
|
|
6255
6726
|
function getUpdateVaultInstructionDataDecoder() {
|
|
6256
|
-
return (0,
|
|
6257
|
-
["discriminator", (0,
|
|
6258
|
-
["interestRate", (0,
|
|
6259
|
-
["supplyLimit", (0,
|
|
6260
|
-
["pythOraclePriceUpdate", (0,
|
|
6261
|
-
["pythOracleFeedId", (0,
|
|
6727
|
+
return (0, import_kit52.getStructDecoder)([
|
|
6728
|
+
["discriminator", (0, import_kit52.fixDecoderSize)((0, import_kit52.getBytesDecoder)(), 8)],
|
|
6729
|
+
["interestRate", (0, import_kit52.getU64Decoder)()],
|
|
6730
|
+
["supplyLimit", (0, import_kit52.getU64Decoder)()],
|
|
6731
|
+
["pythOraclePriceUpdate", (0, import_kit52.getAddressDecoder)()],
|
|
6732
|
+
["pythOracleFeedId", (0, import_kit52.getAddressDecoder)()]
|
|
6262
6733
|
]);
|
|
6263
6734
|
}
|
|
6264
6735
|
function getUpdateVaultInstructionDataCodec() {
|
|
6265
|
-
return (0,
|
|
6736
|
+
return (0, import_kit52.combineCodec)(
|
|
6266
6737
|
getUpdateVaultInstructionDataEncoder(),
|
|
6267
6738
|
getUpdateVaultInstructionDataDecoder()
|
|
6268
6739
|
);
|
|
@@ -6312,7 +6783,7 @@ function parseUpdateVaultInstruction(instruction) {
|
|
|
6312
6783
|
}
|
|
6313
6784
|
|
|
6314
6785
|
// src/generated/instructions/withdraw.ts
|
|
6315
|
-
var
|
|
6786
|
+
var import_kit53 = require("@solana/kit");
|
|
6316
6787
|
var WITHDRAW_DISCRIMINATOR = new Uint8Array([
|
|
6317
6788
|
183,
|
|
6318
6789
|
18,
|
|
@@ -6324,27 +6795,27 @@ var WITHDRAW_DISCRIMINATOR = new Uint8Array([
|
|
|
6324
6795
|
34
|
|
6325
6796
|
]);
|
|
6326
6797
|
function getWithdrawDiscriminatorBytes() {
|
|
6327
|
-
return (0,
|
|
6798
|
+
return (0, import_kit53.fixEncoderSize)((0, import_kit53.getBytesEncoder)(), 8).encode(WITHDRAW_DISCRIMINATOR);
|
|
6328
6799
|
}
|
|
6329
6800
|
function getWithdrawInstructionDataEncoder() {
|
|
6330
|
-
return (0,
|
|
6331
|
-
(0,
|
|
6332
|
-
["discriminator", (0,
|
|
6333
|
-
["funds", (0,
|
|
6334
|
-
["shares", (0,
|
|
6801
|
+
return (0, import_kit53.transformEncoder)(
|
|
6802
|
+
(0, import_kit53.getStructEncoder)([
|
|
6803
|
+
["discriminator", (0, import_kit53.fixEncoderSize)((0, import_kit53.getBytesEncoder)(), 8)],
|
|
6804
|
+
["funds", (0, import_kit53.getU64Encoder)()],
|
|
6805
|
+
["shares", (0, import_kit53.getU64Encoder)()]
|
|
6335
6806
|
]),
|
|
6336
6807
|
(value) => ({ ...value, discriminator: WITHDRAW_DISCRIMINATOR })
|
|
6337
6808
|
);
|
|
6338
6809
|
}
|
|
6339
6810
|
function getWithdrawInstructionDataDecoder() {
|
|
6340
|
-
return (0,
|
|
6341
|
-
["discriminator", (0,
|
|
6342
|
-
["funds", (0,
|
|
6343
|
-
["shares", (0,
|
|
6811
|
+
return (0, import_kit53.getStructDecoder)([
|
|
6812
|
+
["discriminator", (0, import_kit53.fixDecoderSize)((0, import_kit53.getBytesDecoder)(), 8)],
|
|
6813
|
+
["funds", (0, import_kit53.getU64Decoder)()],
|
|
6814
|
+
["shares", (0, import_kit53.getU64Decoder)()]
|
|
6344
6815
|
]);
|
|
6345
6816
|
}
|
|
6346
6817
|
function getWithdrawInstructionDataCodec() {
|
|
6347
|
-
return (0,
|
|
6818
|
+
return (0, import_kit53.combineCodec)(
|
|
6348
6819
|
getWithdrawInstructionDataEncoder(),
|
|
6349
6820
|
getWithdrawInstructionDataDecoder()
|
|
6350
6821
|
);
|
|
@@ -6415,49 +6886,49 @@ function parseWithdrawInstruction(instruction) {
|
|
|
6415
6886
|
}
|
|
6416
6887
|
|
|
6417
6888
|
// src/pda.ts
|
|
6418
|
-
var
|
|
6889
|
+
var import_kit54 = require("@solana/kit");
|
|
6419
6890
|
async function getTunaConfigAddress() {
|
|
6420
|
-
return await (0,
|
|
6891
|
+
return await (0, import_kit54.getProgramDerivedAddress)({
|
|
6421
6892
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
6422
6893
|
seeds: ["tuna_config"]
|
|
6423
6894
|
});
|
|
6424
6895
|
}
|
|
6425
6896
|
async function getMarketAddress(pool) {
|
|
6426
|
-
return await (0,
|
|
6897
|
+
return await (0, import_kit54.getProgramDerivedAddress)({
|
|
6427
6898
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
6428
|
-
seeds: ["market", (0,
|
|
6899
|
+
seeds: ["market", (0, import_kit54.getAddressEncoder)().encode(pool)]
|
|
6429
6900
|
});
|
|
6430
6901
|
}
|
|
6431
6902
|
async function getLendingVaultAddress(mint) {
|
|
6432
|
-
return await (0,
|
|
6903
|
+
return await (0, import_kit54.getProgramDerivedAddress)({
|
|
6433
6904
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
6434
|
-
seeds: ["vault", (0,
|
|
6905
|
+
seeds: ["vault", (0, import_kit54.getAddressEncoder)().encode(mint)]
|
|
6435
6906
|
});
|
|
6436
6907
|
}
|
|
6437
6908
|
async function getLendingPositionAddress(wallet, mint) {
|
|
6438
|
-
return await (0,
|
|
6909
|
+
return await (0, import_kit54.getProgramDerivedAddress)({
|
|
6439
6910
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
6440
|
-
seeds: ["lending_position", (0,
|
|
6911
|
+
seeds: ["lending_position", (0, import_kit54.getAddressEncoder)().encode(wallet), (0, import_kit54.getAddressEncoder)().encode(mint)]
|
|
6441
6912
|
});
|
|
6442
6913
|
}
|
|
6443
6914
|
async function getTunaPositionAddress(position_mint) {
|
|
6444
|
-
return await (0,
|
|
6915
|
+
return await (0, import_kit54.getProgramDerivedAddress)({
|
|
6445
6916
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
6446
|
-
seeds: ["tuna_position", (0,
|
|
6917
|
+
seeds: ["tuna_position", (0, import_kit54.getAddressEncoder)().encode(position_mint)]
|
|
6447
6918
|
});
|
|
6448
6919
|
}
|
|
6449
6920
|
|
|
6450
6921
|
// src/gpa/tunaPosition.ts
|
|
6451
|
-
var
|
|
6922
|
+
var import_kit56 = require("@solana/kit");
|
|
6452
6923
|
|
|
6453
6924
|
// src/gpa/utils.ts
|
|
6454
|
-
var
|
|
6925
|
+
var import_kit55 = require("@solana/kit");
|
|
6455
6926
|
async function fetchDecodedProgramAccounts(rpc, programAddress, filters, decoder) {
|
|
6456
6927
|
const accountInfos = await rpc.getProgramAccounts(programAddress, {
|
|
6457
6928
|
encoding: "base64",
|
|
6458
6929
|
filters
|
|
6459
6930
|
}).send();
|
|
6460
|
-
const encoder = (0,
|
|
6931
|
+
const encoder = (0, import_kit55.getBase64Encoder)();
|
|
6461
6932
|
const datas = accountInfos.map((x) => encoder.encode(x.account.data[0]));
|
|
6462
6933
|
const decoded = datas.map((x) => decoder.decode(x));
|
|
6463
6934
|
return decoded.map((data, i) => ({
|
|
@@ -6473,7 +6944,7 @@ function tunaPositionAuthorityFilter(address4) {
|
|
|
6473
6944
|
return {
|
|
6474
6945
|
memcmp: {
|
|
6475
6946
|
offset: 11n,
|
|
6476
|
-
bytes: (0,
|
|
6947
|
+
bytes: (0, import_kit56.getBase58Decoder)().decode((0, import_kit56.getAddressEncoder)().encode(address4)),
|
|
6477
6948
|
encoding: "base58"
|
|
6478
6949
|
}
|
|
6479
6950
|
};
|
|
@@ -6482,7 +6953,7 @@ function tunaPositionPoolFilter(address4) {
|
|
|
6482
6953
|
return {
|
|
6483
6954
|
memcmp: {
|
|
6484
6955
|
offset: 43n,
|
|
6485
|
-
bytes: (0,
|
|
6956
|
+
bytes: (0, import_kit56.getBase58Decoder)().decode((0, import_kit56.getAddressEncoder)().encode(address4)),
|
|
6486
6957
|
encoding: "base58"
|
|
6487
6958
|
}
|
|
6488
6959
|
};
|
|
@@ -6491,7 +6962,7 @@ function tunaPositionMintAFilter(address4) {
|
|
|
6491
6962
|
return {
|
|
6492
6963
|
memcmp: {
|
|
6493
6964
|
offset: 75n,
|
|
6494
|
-
bytes: (0,
|
|
6965
|
+
bytes: (0, import_kit56.getBase58Decoder)().decode((0, import_kit56.getAddressEncoder)().encode(address4)),
|
|
6495
6966
|
encoding: "base58"
|
|
6496
6967
|
}
|
|
6497
6968
|
};
|
|
@@ -6500,7 +6971,7 @@ function tunaPositionMintBFilter(address4) {
|
|
|
6500
6971
|
return {
|
|
6501
6972
|
memcmp: {
|
|
6502
6973
|
offset: 107n,
|
|
6503
|
-
bytes: (0,
|
|
6974
|
+
bytes: (0, import_kit56.getBase58Decoder)().decode((0, import_kit56.getAddressEncoder)().encode(address4)),
|
|
6504
6975
|
encoding: "base58"
|
|
6505
6976
|
}
|
|
6506
6977
|
};
|
|
@@ -6509,7 +6980,7 @@ function tunaPositionMintFilter(address4) {
|
|
|
6509
6980
|
return {
|
|
6510
6981
|
memcmp: {
|
|
6511
6982
|
offset: 139n,
|
|
6512
|
-
bytes: (0,
|
|
6983
|
+
bytes: (0, import_kit56.getBase58Decoder)().decode((0, import_kit56.getAddressEncoder)().encode(address4)),
|
|
6513
6984
|
encoding: "base58"
|
|
6514
6985
|
}
|
|
6515
6986
|
};
|
|
@@ -6518,13 +6989,13 @@ function tunaPositionMarketMakerFilter(marketMaker) {
|
|
|
6518
6989
|
return {
|
|
6519
6990
|
memcmp: {
|
|
6520
6991
|
offset: 277n,
|
|
6521
|
-
bytes: (0,
|
|
6992
|
+
bytes: (0, import_kit56.getBase58Decoder)().decode((0, import_kit56.getI8Encoder)().encode(marketMaker)),
|
|
6522
6993
|
encoding: "base58"
|
|
6523
6994
|
}
|
|
6524
6995
|
};
|
|
6525
6996
|
}
|
|
6526
6997
|
async function fetchAllTunaPositionWithFilter(rpc, ...filters) {
|
|
6527
|
-
const discriminator = (0,
|
|
6998
|
+
const discriminator = (0, import_kit56.getBase58Decoder)().decode(TUNA_POSITION_DISCRIMINATOR);
|
|
6528
6999
|
const discriminatorFilter = {
|
|
6529
7000
|
memcmp: {
|
|
6530
7001
|
offset: 0n,
|
|
@@ -6541,12 +7012,12 @@ async function fetchAllTunaPositionWithFilter(rpc, ...filters) {
|
|
|
6541
7012
|
}
|
|
6542
7013
|
|
|
6543
7014
|
// src/gpa/lendingPosition.ts
|
|
6544
|
-
var
|
|
7015
|
+
var import_kit57 = require("@solana/kit");
|
|
6545
7016
|
function lendingPositionAuthorityFilter(address4) {
|
|
6546
7017
|
return {
|
|
6547
7018
|
memcmp: {
|
|
6548
7019
|
offset: 11n,
|
|
6549
|
-
bytes: (0,
|
|
7020
|
+
bytes: (0, import_kit57.getBase58Decoder)().decode((0, import_kit57.getAddressEncoder)().encode(address4)),
|
|
6550
7021
|
encoding: "base58"
|
|
6551
7022
|
}
|
|
6552
7023
|
};
|
|
@@ -6555,13 +7026,13 @@ function lendingPositionMintFilter(address4) {
|
|
|
6555
7026
|
return {
|
|
6556
7027
|
memcmp: {
|
|
6557
7028
|
offset: 43n,
|
|
6558
|
-
bytes: (0,
|
|
7029
|
+
bytes: (0, import_kit57.getBase58Decoder)().decode((0, import_kit57.getAddressEncoder)().encode(address4)),
|
|
6559
7030
|
encoding: "base58"
|
|
6560
7031
|
}
|
|
6561
7032
|
};
|
|
6562
7033
|
}
|
|
6563
7034
|
async function fetchAllLendingPositionWithFilter(rpc, ...filters) {
|
|
6564
|
-
const discriminator = (0,
|
|
7035
|
+
const discriminator = (0, import_kit57.getBase58Decoder)().decode(LENDING_POSITION_DISCRIMINATOR);
|
|
6565
7036
|
const discriminatorFilter = {
|
|
6566
7037
|
memcmp: {
|
|
6567
7038
|
offset: 0n,
|
|
@@ -6578,6 +7049,7 @@ async function fetchAllLendingPositionWithFilter(rpc, ...filters) {
|
|
|
6578
7049
|
}
|
|
6579
7050
|
|
|
6580
7051
|
// src/utils/orca.ts
|
|
7052
|
+
var import_fusionamm_core = require("@crypticdot/fusionamm-core");
|
|
6581
7053
|
var import_whirlpools_client = require("@orca-so/whirlpools-client");
|
|
6582
7054
|
var import_whirlpools_core = require("@orca-so/whirlpools-core");
|
|
6583
7055
|
var OrcaUtils = class {
|
|
@@ -6598,37 +7070,63 @@ var OrcaUtils = class {
|
|
|
6598
7070
|
)
|
|
6599
7071
|
);
|
|
6600
7072
|
}
|
|
7073
|
+
static async getTickArraysForRebalancedPosition(whirlpool, tunaPosition) {
|
|
7074
|
+
const positionRange = tunaPosition.data.tickUpperIndex - tunaPosition.data.tickLowerIndex;
|
|
7075
|
+
const newTickLowerIndex = (0, import_fusionamm_core.getInitializableTickIndex)(
|
|
7076
|
+
whirlpool.data.tickCurrentIndex - Math.trunc(positionRange / 2),
|
|
7077
|
+
whirlpool.data.tickSpacing
|
|
7078
|
+
);
|
|
7079
|
+
const newTickUpperIndex = newTickLowerIndex + positionRange;
|
|
7080
|
+
const lowerTickArrayStartIndex = (0, import_whirlpools_core.getTickArrayStartTickIndex)(newTickLowerIndex, whirlpool.data.tickSpacing);
|
|
7081
|
+
const [lowerTickArrayAddress] = await (0, import_whirlpools_client.getTickArrayAddress)(whirlpool.address, lowerTickArrayStartIndex);
|
|
7082
|
+
const upperTickArrayStartIndex = (0, import_whirlpools_core.getTickArrayStartTickIndex)(newTickUpperIndex, whirlpool.data.tickSpacing);
|
|
7083
|
+
const [upperTickArrayAddress] = await (0, import_whirlpools_client.getTickArrayAddress)(whirlpool.address, upperTickArrayStartIndex);
|
|
7084
|
+
return { lowerTickArrayAddress, lowerTickArrayStartIndex, upperTickArrayAddress, upperTickArrayStartIndex };
|
|
7085
|
+
}
|
|
6601
7086
|
};
|
|
6602
7087
|
|
|
6603
7088
|
// src/utils/fusion.ts
|
|
6604
7089
|
var import_fusionamm_client = require("@crypticdot/fusionamm-client");
|
|
6605
|
-
var
|
|
7090
|
+
var import_fusionamm_core2 = require("@crypticdot/fusionamm-core");
|
|
6606
7091
|
var FusionUtils = class {
|
|
6607
|
-
static async getTickArrayAddressFromTickIndex(
|
|
6608
|
-
const tickArrayStartTickIndex = (0,
|
|
6609
|
-
const [tickArrayPda] = await (0, import_fusionamm_client.getTickArrayAddress)(
|
|
7092
|
+
static async getTickArrayAddressFromTickIndex(fusionPool, tickIndex) {
|
|
7093
|
+
const tickArrayStartTickIndex = (0, import_fusionamm_core2.getTickArrayStartTickIndex)(tickIndex, fusionPool.data.tickSpacing);
|
|
7094
|
+
const [tickArrayPda] = await (0, import_fusionamm_client.getTickArrayAddress)(fusionPool.address, tickArrayStartTickIndex);
|
|
6610
7095
|
return tickArrayPda;
|
|
6611
7096
|
}
|
|
6612
|
-
static async getSwapTickArrayAddresses(
|
|
6613
|
-
const tickArrayStep = (0,
|
|
6614
|
-
const currentArrayStartTickIndex = (0,
|
|
6615
|
-
|
|
6616
|
-
|
|
7097
|
+
static async getSwapTickArrayAddresses(fusionPool) {
|
|
7098
|
+
const tickArrayStep = (0, import_fusionamm_core2._TICK_ARRAY_SIZE)() * fusionPool.data.tickSpacing;
|
|
7099
|
+
const currentArrayStartTickIndex = (0, import_fusionamm_core2.getTickArrayStartTickIndex)(
|
|
7100
|
+
fusionPool.data.tickCurrentIndex,
|
|
7101
|
+
fusionPool.data.tickSpacing
|
|
6617
7102
|
);
|
|
6618
7103
|
return Promise.all(
|
|
6619
7104
|
[-2, -1, 0, 1, 2].map(
|
|
6620
|
-
async (i) => (await (0, import_fusionamm_client.getTickArrayAddress)(
|
|
7105
|
+
async (i) => (await (0, import_fusionamm_client.getTickArrayAddress)(fusionPool.address, currentArrayStartTickIndex + i * tickArrayStep))[0]
|
|
6621
7106
|
)
|
|
6622
7107
|
);
|
|
6623
7108
|
}
|
|
7109
|
+
static async getTickArraysForRebalancedPosition(fusionPool, tunaPosition) {
|
|
7110
|
+
const positionRange = tunaPosition.data.tickUpperIndex - tunaPosition.data.tickLowerIndex;
|
|
7111
|
+
const newTickLowerIndex = (0, import_fusionamm_core2.getInitializableTickIndex)(
|
|
7112
|
+
fusionPool.data.tickCurrentIndex - Math.trunc(positionRange / 2),
|
|
7113
|
+
fusionPool.data.tickSpacing
|
|
7114
|
+
);
|
|
7115
|
+
const newTickUpperIndex = newTickLowerIndex + positionRange;
|
|
7116
|
+
const lowerTickArrayStartIndex = (0, import_fusionamm_core2.getTickArrayStartTickIndex)(newTickLowerIndex, fusionPool.data.tickSpacing);
|
|
7117
|
+
const [lowerTickArrayAddress] = await (0, import_fusionamm_client.getTickArrayAddress)(fusionPool.address, lowerTickArrayStartIndex);
|
|
7118
|
+
const upperTickArrayStartIndex = (0, import_fusionamm_core2.getTickArrayStartTickIndex)(newTickUpperIndex, fusionPool.data.tickSpacing);
|
|
7119
|
+
const [upperTickArrayAddress] = await (0, import_fusionamm_client.getTickArrayAddress)(fusionPool.address, upperTickArrayStartIndex);
|
|
7120
|
+
return { lowerTickArrayAddress, lowerTickArrayStartIndex, upperTickArrayAddress, upperTickArrayStartIndex };
|
|
7121
|
+
}
|
|
6624
7122
|
};
|
|
6625
7123
|
|
|
6626
7124
|
// src/utils/token.ts
|
|
6627
|
-
var
|
|
7125
|
+
var import_kit58 = require("@solana/kit");
|
|
7126
|
+
var import_system = require("@solana-program/system");
|
|
6628
7127
|
var import_token = require("@solana-program/token");
|
|
6629
7128
|
var import_token_2022 = require("@solana-program/token-2022");
|
|
6630
|
-
var
|
|
6631
|
-
var NATIVE_MINT = (0, import_kit55.address)("So11111111111111111111111111111111111111112");
|
|
7129
|
+
var NATIVE_MINT = (0, import_kit58.address)("So11111111111111111111111111111111111111112");
|
|
6632
7130
|
async function getCreateAtaInstruction(mint, owner, payer, tokenProgram = import_token.TOKEN_PROGRAM_ADDRESS) {
|
|
6633
7131
|
const ata = (await (0, import_token.findAssociatedTokenPda)({
|
|
6634
7132
|
mint,
|
|
@@ -6692,11 +7190,11 @@ async function createAddressLookupTableInstructions(authority, addresses, recent
|
|
|
6692
7190
|
}
|
|
6693
7191
|
|
|
6694
7192
|
// src/utils/positionMath.ts
|
|
6695
|
-
var
|
|
7193
|
+
var import_fusionamm_core3 = require("@crypticdot/fusionamm-core");
|
|
6696
7194
|
|
|
6697
7195
|
// src/consts.ts
|
|
6698
|
-
var
|
|
6699
|
-
var DEFAULT_ADDRESS = (0,
|
|
7196
|
+
var import_kit59 = require("@solana/kit");
|
|
7197
|
+
var DEFAULT_ADDRESS = (0, import_kit59.address)("11111111111111111111111111111111");
|
|
6700
7198
|
var HUNDRED_PERCENT = 1e6;
|
|
6701
7199
|
var LEVERAGE_ONE = HUNDRED_PERCENT;
|
|
6702
7200
|
var MAX_LEVERAGE = 11 * LEVERAGE_ONE;
|
|
@@ -6714,7 +7212,8 @@ var TUNA_POSITION_FLAGS_TAKE_PROFIT_SWAP_TO_TOKEN_A = 1 << 2;
|
|
|
6714
7212
|
var TUNA_POSITION_FLAGS_TAKE_PROFIT_SWAP_TO_TOKEN_B = 1 << 3;
|
|
6715
7213
|
var TUNA_POSITION_FLAGS_AUTO_COMPOUND_YIELD = 1 << 4;
|
|
6716
7214
|
var TUNA_POSITION_FLAGS_AUTO_COMPOUND_YIELD_WITH_LEVERAGE = 1 << 5;
|
|
6717
|
-
var
|
|
7215
|
+
var TUNA_POSITION_FLAGS_ALLOW_REBALANCING = 1 << 6;
|
|
7216
|
+
var WP_NFT_UPDATE_AUTH = (0, import_kit59.address)("3axbTs2z5GBy6usVbNVoqEgZMng3vZvMnAoX29BFfwhr");
|
|
6718
7217
|
|
|
6719
7218
|
// src/utils/positionMath.ts
|
|
6720
7219
|
var DEFAULT_MAX_AMOUNT_SLIPPAGE = HUNDRED_PERCENT / 2;
|
|
@@ -6733,14 +7232,14 @@ function getLiquidityIncreaseQuote(args) {
|
|
|
6733
7232
|
const maxAmountSlippage = args.maxAmountSlippage > 0 ? BigInt(args.maxAmountSlippage) : BigInt(DEFAULT_MAX_AMOUNT_SLIPPAGE);
|
|
6734
7233
|
let maxCollateralA = BigInt(collateralA);
|
|
6735
7234
|
let maxCollateralB = BigInt(collateralB);
|
|
6736
|
-
const lowerSqrtPrice = (0,
|
|
6737
|
-
const upperSqrtPrice = (0,
|
|
7235
|
+
const lowerSqrtPrice = (0, import_fusionamm_core3.tickIndexToSqrtPrice)(tickLowerIndex);
|
|
7236
|
+
const upperSqrtPrice = (0, import_fusionamm_core3.tickIndexToSqrtPrice)(tickUpperIndex);
|
|
6738
7237
|
if (collateralA == COMPUTED_AMOUNT) {
|
|
6739
7238
|
if (sqrtPrice <= lowerSqrtPrice) {
|
|
6740
7239
|
throw new Error("sqrtPrice must be greater than lowerSqrtPrice if collateral A is computed.");
|
|
6741
7240
|
} else if (sqrtPrice < upperSqrtPrice) {
|
|
6742
|
-
const liquidity = (0,
|
|
6743
|
-
const amountA = (0,
|
|
7241
|
+
const liquidity = (0, import_fusionamm_core3.tryGetLiquidityFromB)(collateralB + borrowB, lowerSqrtPrice, sqrtPrice);
|
|
7242
|
+
const amountA = (0, import_fusionamm_core3.tryGetTokenAFromLiquidity)(liquidity, sqrtPrice, upperSqrtPrice, false);
|
|
6744
7243
|
collateralA = amountA * collateralB / (collateralB + borrowB);
|
|
6745
7244
|
borrowA = amountA - collateralA;
|
|
6746
7245
|
maxCollateralA = collateralA + collateralA * maxAmountSlippage / BigInt(HUNDRED_PERCENT);
|
|
@@ -6755,8 +7254,8 @@ function getLiquidityIncreaseQuote(args) {
|
|
|
6755
7254
|
maxCollateralB = 0n;
|
|
6756
7255
|
borrowB = 0n;
|
|
6757
7256
|
} else if (sqrtPrice < upperSqrtPrice) {
|
|
6758
|
-
const liquidity = (0,
|
|
6759
|
-
const amountB = (0,
|
|
7257
|
+
const liquidity = (0, import_fusionamm_core3.tryGetLiquidityFromA)(collateralA + borrowA, sqrtPrice, upperSqrtPrice);
|
|
7258
|
+
const amountB = (0, import_fusionamm_core3.tryGetTokenBFromLiquidity)(liquidity, lowerSqrtPrice, sqrtPrice, false);
|
|
6760
7259
|
collateralB = amountB * collateralA / (collateralA + borrowA);
|
|
6761
7260
|
borrowB = amountB - collateralB;
|
|
6762
7261
|
maxCollateralB = collateralB + collateralB * maxAmountSlippage / BigInt(HUNDRED_PERCENT);
|
|
@@ -6774,7 +7273,7 @@ function getLiquidityIncreaseQuote(args) {
|
|
|
6774
7273
|
let totalA = providedA;
|
|
6775
7274
|
let totalB = providedB;
|
|
6776
7275
|
if (args.collateralA != COMPUTED_AMOUNT && args.collateralB != COMPUTED_AMOUNT) {
|
|
6777
|
-
const positionRatio = (0,
|
|
7276
|
+
const positionRatio = (0, import_fusionamm_core3.positionRatioX64)(sqrtPrice, tickLowerIndex, tickUpperIndex);
|
|
6778
7277
|
let total = (providedA * sqrtPrice * sqrtPrice >> 128n) + providedB;
|
|
6779
7278
|
totalA = (total * BigInt(positionRatio.ratioA) << 64n) / (sqrtPrice * sqrtPrice);
|
|
6780
7279
|
totalB = total * BigInt(positionRatio.ratioB) >> 64n;
|
|
@@ -6782,12 +7281,12 @@ function getLiquidityIncreaseQuote(args) {
|
|
|
6782
7281
|
let feeB = 0n;
|
|
6783
7282
|
if (totalA < providedA) {
|
|
6784
7283
|
swapInput = providedA - totalA;
|
|
6785
|
-
feeA = swapInput - (0,
|
|
7284
|
+
feeA = swapInput - (0, import_fusionamm_core3.tryApplySwapFee)(swapInput, swapFeeRate);
|
|
6786
7285
|
swapOutput = (swapInput - feeA) * sqrtPrice * sqrtPrice >> 128n;
|
|
6787
7286
|
swapAToB = true;
|
|
6788
7287
|
} else if (totalB < providedB) {
|
|
6789
7288
|
swapInput = providedB - totalB;
|
|
6790
|
-
feeB = swapInput - (0,
|
|
7289
|
+
feeB = swapInput - (0, import_fusionamm_core3.tryApplySwapFee)(swapInput, swapFeeRate);
|
|
6791
7290
|
swapOutput = (swapInput - feeB << 128n) / (sqrtPrice * sqrtPrice);
|
|
6792
7291
|
swapAToB = false;
|
|
6793
7292
|
}
|
|
@@ -6824,7 +7323,7 @@ function calculateProtocolFee(collateralAmount, borrowAmount, protocolFeeRateOnC
|
|
|
6824
7323
|
// src/txbuilder/addLiquidityOrca.ts
|
|
6825
7324
|
var import_whirlpools_client2 = require("@orca-so/whirlpools-client");
|
|
6826
7325
|
var import_whirlpools_core2 = require("@orca-so/whirlpools-core");
|
|
6827
|
-
var
|
|
7326
|
+
var import_kit60 = require("@solana/kit");
|
|
6828
7327
|
var import_memo = require("@solana-program/memo");
|
|
6829
7328
|
var import_token_20222 = require("@solana-program/token-2022");
|
|
6830
7329
|
var import_assert = __toESM(require("assert"));
|
|
@@ -7006,25 +7505,25 @@ async function addLiquidityOrcaInstruction(authority, tunaPosition, tunaConfig,
|
|
|
7006
7505
|
tunaPosition.data.tickUpperIndex
|
|
7007
7506
|
);
|
|
7008
7507
|
const remainingAccounts = [
|
|
7009
|
-
{ address: swapTickArrays[0], role:
|
|
7010
|
-
{ address: swapTickArrays[1], role:
|
|
7011
|
-
{ address: swapTickArrays[2], role:
|
|
7012
|
-
{ address: swapTickArrays[3], role:
|
|
7013
|
-
{ address: swapTickArrays[4], role:
|
|
7014
|
-
{ address: lowerTickArrayAddress, role:
|
|
7015
|
-
{ address: upperTickArrayAddress, role:
|
|
7016
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
7017
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
7018
|
-
{ address: orcaOracleAddress, role:
|
|
7508
|
+
{ address: swapTickArrays[0], role: import_kit60.AccountRole.WRITABLE },
|
|
7509
|
+
{ address: swapTickArrays[1], role: import_kit60.AccountRole.WRITABLE },
|
|
7510
|
+
{ address: swapTickArrays[2], role: import_kit60.AccountRole.WRITABLE },
|
|
7511
|
+
{ address: swapTickArrays[3], role: import_kit60.AccountRole.WRITABLE },
|
|
7512
|
+
{ address: swapTickArrays[4], role: import_kit60.AccountRole.WRITABLE },
|
|
7513
|
+
{ address: lowerTickArrayAddress, role: import_kit60.AccountRole.WRITABLE },
|
|
7514
|
+
{ address: upperTickArrayAddress, role: import_kit60.AccountRole.WRITABLE },
|
|
7515
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit60.AccountRole.WRITABLE },
|
|
7516
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit60.AccountRole.WRITABLE },
|
|
7517
|
+
{ address: orcaOracleAddress, role: import_kit60.AccountRole.WRITABLE }
|
|
7019
7518
|
];
|
|
7020
7519
|
const remainingAccountsInfo = {
|
|
7021
7520
|
slices: [
|
|
7022
7521
|
{ accountsType: 0 /* SwapTickArrays */, length: 5 },
|
|
7023
7522
|
{ accountsType: 1 /* TickArrayLower */, length: 1 },
|
|
7024
7523
|
{ accountsType: 2 /* TickArrayUpper */, length: 1 },
|
|
7025
|
-
{ accountsType:
|
|
7026
|
-
{ accountsType:
|
|
7027
|
-
{ accountsType:
|
|
7524
|
+
{ accountsType: 5 /* PoolVaultTokenA */, length: 1 },
|
|
7525
|
+
{ accountsType: 6 /* PoolVaultTokenB */, length: 1 },
|
|
7526
|
+
{ accountsType: 7 /* WhirlpoolOracle */, length: 1 }
|
|
7028
7527
|
]
|
|
7029
7528
|
};
|
|
7030
7529
|
const ix = getAddLiquidityOrcaInstruction({
|
|
@@ -7062,8 +7561,8 @@ async function addLiquidityOrcaInstruction(authority, tunaPosition, tunaConfig,
|
|
|
7062
7561
|
|
|
7063
7562
|
// src/txbuilder/addLiquidityFusion.ts
|
|
7064
7563
|
var import_fusionamm_client2 = require("@crypticdot/fusionamm-client");
|
|
7065
|
-
var
|
|
7066
|
-
var
|
|
7564
|
+
var import_fusionamm_core4 = require("@crypticdot/fusionamm-core");
|
|
7565
|
+
var import_kit61 = require("@solana/kit");
|
|
7067
7566
|
var import_memo2 = require("@solana-program/memo");
|
|
7068
7567
|
var import_token_20223 = require("@solana-program/token-2022");
|
|
7069
7568
|
var import_assert2 = __toESM(require("assert"));
|
|
@@ -7132,12 +7631,12 @@ async function addLiquidityFusionInstructions(rpc, authority, positionMint, args
|
|
|
7132
7631
|
mintB.programAddress
|
|
7133
7632
|
);
|
|
7134
7633
|
createInstructions.push(...createFeeRecipientAtaBInstructions.init);
|
|
7135
|
-
const lowerTickArrayStartIndex = (0,
|
|
7634
|
+
const lowerTickArrayStartIndex = (0, import_fusionamm_core4.getTickArrayStartTickIndex)(
|
|
7136
7635
|
tunaPosition.data.tickLowerIndex,
|
|
7137
7636
|
fusionPool.data.tickSpacing
|
|
7138
7637
|
);
|
|
7139
7638
|
const [lowerTickArrayAddress] = await (0, import_fusionamm_client2.getTickArrayAddress)(fusionPool.address, lowerTickArrayStartIndex);
|
|
7140
|
-
const upperTickArrayStartIndex = (0,
|
|
7639
|
+
const upperTickArrayStartIndex = (0, import_fusionamm_core4.getTickArrayStartTickIndex)(
|
|
7141
7640
|
tunaPosition.data.tickUpperIndex,
|
|
7142
7641
|
fusionPool.data.tickSpacing
|
|
7143
7642
|
);
|
|
@@ -7244,23 +7743,23 @@ async function addLiquidityFusionInstruction(authority, tunaPosition, tunaConfig
|
|
|
7244
7743
|
tunaPosition.data.tickUpperIndex
|
|
7245
7744
|
);
|
|
7246
7745
|
const remainingAccounts = [
|
|
7247
|
-
{ address: swapTickArrays[0], role:
|
|
7248
|
-
{ address: swapTickArrays[1], role:
|
|
7249
|
-
{ address: swapTickArrays[2], role:
|
|
7250
|
-
{ address: swapTickArrays[3], role:
|
|
7251
|
-
{ address: swapTickArrays[4], role:
|
|
7252
|
-
{ address: lowerTickArrayAddress, role:
|
|
7253
|
-
{ address: upperTickArrayAddress, role:
|
|
7254
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
7255
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
7746
|
+
{ address: swapTickArrays[0], role: import_kit61.AccountRole.WRITABLE },
|
|
7747
|
+
{ address: swapTickArrays[1], role: import_kit61.AccountRole.WRITABLE },
|
|
7748
|
+
{ address: swapTickArrays[2], role: import_kit61.AccountRole.WRITABLE },
|
|
7749
|
+
{ address: swapTickArrays[3], role: import_kit61.AccountRole.WRITABLE },
|
|
7750
|
+
{ address: swapTickArrays[4], role: import_kit61.AccountRole.WRITABLE },
|
|
7751
|
+
{ address: lowerTickArrayAddress, role: import_kit61.AccountRole.WRITABLE },
|
|
7752
|
+
{ address: upperTickArrayAddress, role: import_kit61.AccountRole.WRITABLE },
|
|
7753
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit61.AccountRole.WRITABLE },
|
|
7754
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit61.AccountRole.WRITABLE }
|
|
7256
7755
|
];
|
|
7257
7756
|
const remainingAccountsInfo = {
|
|
7258
7757
|
slices: [
|
|
7259
7758
|
{ accountsType: 0 /* SwapTickArrays */, length: 5 },
|
|
7260
7759
|
{ accountsType: 1 /* TickArrayLower */, length: 1 },
|
|
7261
7760
|
{ accountsType: 2 /* TickArrayUpper */, length: 1 },
|
|
7262
|
-
{ accountsType:
|
|
7263
|
-
{ accountsType:
|
|
7761
|
+
{ accountsType: 5 /* PoolVaultTokenA */, length: 1 },
|
|
7762
|
+
{ accountsType: 6 /* PoolVaultTokenB */, length: 1 }
|
|
7264
7763
|
]
|
|
7265
7764
|
};
|
|
7266
7765
|
const ix = getAddLiquidityFusionInstruction({
|
|
@@ -7390,7 +7889,7 @@ async function closePositionFusionInstruction(rpc, authority, positionMint) {
|
|
|
7390
7889
|
|
|
7391
7890
|
// src/txbuilder/collectAndCompoundFeesOrca.ts
|
|
7392
7891
|
var import_whirlpools_client4 = require("@orca-so/whirlpools-client");
|
|
7393
|
-
var
|
|
7892
|
+
var import_kit62 = require("@solana/kit");
|
|
7394
7893
|
var import_memo3 = require("@solana-program/memo");
|
|
7395
7894
|
var import_token_20226 = require("@solana-program/token-2022");
|
|
7396
7895
|
var import_assert5 = __toESM(require("assert"));
|
|
@@ -7490,25 +7989,25 @@ async function collectAndCompoundFeesOrcaInstruction(authority, tunaConfig, tuna
|
|
|
7490
7989
|
tunaPosition.data.tickUpperIndex
|
|
7491
7990
|
);
|
|
7492
7991
|
const remainingAccounts = [
|
|
7493
|
-
{ address: swapTickArrays[0], role:
|
|
7494
|
-
{ address: swapTickArrays[1], role:
|
|
7495
|
-
{ address: swapTickArrays[2], role:
|
|
7496
|
-
{ address: swapTickArrays[3], role:
|
|
7497
|
-
{ address: swapTickArrays[4], role:
|
|
7498
|
-
{ address: lowerTickArrayAddress, role:
|
|
7499
|
-
{ address: upperTickArrayAddress, role:
|
|
7500
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
7501
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
7502
|
-
{ address: orcaOracleAddress, role:
|
|
7992
|
+
{ address: swapTickArrays[0], role: import_kit62.AccountRole.WRITABLE },
|
|
7993
|
+
{ address: swapTickArrays[1], role: import_kit62.AccountRole.WRITABLE },
|
|
7994
|
+
{ address: swapTickArrays[2], role: import_kit62.AccountRole.WRITABLE },
|
|
7995
|
+
{ address: swapTickArrays[3], role: import_kit62.AccountRole.WRITABLE },
|
|
7996
|
+
{ address: swapTickArrays[4], role: import_kit62.AccountRole.WRITABLE },
|
|
7997
|
+
{ address: lowerTickArrayAddress, role: import_kit62.AccountRole.WRITABLE },
|
|
7998
|
+
{ address: upperTickArrayAddress, role: import_kit62.AccountRole.WRITABLE },
|
|
7999
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit62.AccountRole.WRITABLE },
|
|
8000
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit62.AccountRole.WRITABLE },
|
|
8001
|
+
{ address: orcaOracleAddress, role: import_kit62.AccountRole.WRITABLE }
|
|
7503
8002
|
];
|
|
7504
8003
|
const remainingAccountsInfo = {
|
|
7505
8004
|
slices: [
|
|
7506
8005
|
{ accountsType: 0 /* SwapTickArrays */, length: 5 },
|
|
7507
8006
|
{ accountsType: 1 /* TickArrayLower */, length: 1 },
|
|
7508
8007
|
{ accountsType: 2 /* TickArrayUpper */, length: 1 },
|
|
7509
|
-
{ accountsType:
|
|
7510
|
-
{ accountsType:
|
|
7511
|
-
{ accountsType:
|
|
8008
|
+
{ accountsType: 5 /* PoolVaultTokenA */, length: 1 },
|
|
8009
|
+
{ accountsType: 6 /* PoolVaultTokenB */, length: 1 },
|
|
8010
|
+
{ accountsType: 7 /* WhirlpoolOracle */, length: 1 }
|
|
7512
8011
|
]
|
|
7513
8012
|
};
|
|
7514
8013
|
const ix = getCollectAndCompoundFeesOrcaInstruction({
|
|
@@ -7544,7 +8043,7 @@ async function collectAndCompoundFeesOrcaInstruction(authority, tunaConfig, tuna
|
|
|
7544
8043
|
|
|
7545
8044
|
// src/txbuilder/collectAndCompoundFeesFusion.ts
|
|
7546
8045
|
var import_fusionamm_client4 = require("@crypticdot/fusionamm-client");
|
|
7547
|
-
var
|
|
8046
|
+
var import_kit63 = require("@solana/kit");
|
|
7548
8047
|
var import_memo4 = require("@solana-program/memo");
|
|
7549
8048
|
var import_token_20227 = require("@solana-program/token-2022");
|
|
7550
8049
|
var import_assert6 = __toESM(require("assert"));
|
|
@@ -7643,23 +8142,23 @@ async function collectAndCompoundFeesFusionInstruction(authority, tunaConfig, tu
|
|
|
7643
8142
|
tunaPosition.data.tickUpperIndex
|
|
7644
8143
|
);
|
|
7645
8144
|
const remainingAccounts = [
|
|
7646
|
-
{ address: swapTickArrays[0], role:
|
|
7647
|
-
{ address: swapTickArrays[1], role:
|
|
7648
|
-
{ address: swapTickArrays[2], role:
|
|
7649
|
-
{ address: swapTickArrays[3], role:
|
|
7650
|
-
{ address: swapTickArrays[4], role:
|
|
7651
|
-
{ address: lowerTickArrayAddress, role:
|
|
7652
|
-
{ address: upperTickArrayAddress, role:
|
|
7653
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
7654
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
8145
|
+
{ address: swapTickArrays[0], role: import_kit63.AccountRole.WRITABLE },
|
|
8146
|
+
{ address: swapTickArrays[1], role: import_kit63.AccountRole.WRITABLE },
|
|
8147
|
+
{ address: swapTickArrays[2], role: import_kit63.AccountRole.WRITABLE },
|
|
8148
|
+
{ address: swapTickArrays[3], role: import_kit63.AccountRole.WRITABLE },
|
|
8149
|
+
{ address: swapTickArrays[4], role: import_kit63.AccountRole.WRITABLE },
|
|
8150
|
+
{ address: lowerTickArrayAddress, role: import_kit63.AccountRole.WRITABLE },
|
|
8151
|
+
{ address: upperTickArrayAddress, role: import_kit63.AccountRole.WRITABLE },
|
|
8152
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit63.AccountRole.WRITABLE },
|
|
8153
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit63.AccountRole.WRITABLE }
|
|
7655
8154
|
];
|
|
7656
8155
|
const remainingAccountsInfo = {
|
|
7657
8156
|
slices: [
|
|
7658
8157
|
{ accountsType: 0 /* SwapTickArrays */, length: 5 },
|
|
7659
8158
|
{ accountsType: 1 /* TickArrayLower */, length: 1 },
|
|
7660
8159
|
{ accountsType: 2 /* TickArrayUpper */, length: 1 },
|
|
7661
|
-
{ accountsType:
|
|
7662
|
-
{ accountsType:
|
|
8160
|
+
{ accountsType: 5 /* PoolVaultTokenA */, length: 1 },
|
|
8161
|
+
{ accountsType: 6 /* PoolVaultTokenB */, length: 1 }
|
|
7663
8162
|
]
|
|
7664
8163
|
};
|
|
7665
8164
|
const ix = getCollectAndCompoundFeesFusionInstruction({
|
|
@@ -7695,7 +8194,7 @@ async function collectAndCompoundFeesFusionInstruction(authority, tunaConfig, tu
|
|
|
7695
8194
|
|
|
7696
8195
|
// src/txbuilder/collectFeesOrca.ts
|
|
7697
8196
|
var import_whirlpools_client5 = require("@orca-so/whirlpools-client");
|
|
7698
|
-
var
|
|
8197
|
+
var import_kit64 = require("@solana/kit");
|
|
7699
8198
|
var import_memo5 = require("@solana-program/memo");
|
|
7700
8199
|
var import_token_20228 = require("@solana-program/token-2022");
|
|
7701
8200
|
var import_assert7 = __toESM(require("assert"));
|
|
@@ -7771,17 +8270,17 @@ async function collectFeesOrcaInstruction(authority, tunaPosition, mintA, mintB,
|
|
|
7771
8270
|
tunaPosition.data.tickUpperIndex
|
|
7772
8271
|
);
|
|
7773
8272
|
const remainingAccounts = [
|
|
7774
|
-
{ address: lowerTickArrayAddress, role:
|
|
7775
|
-
{ address: upperTickArrayAddress, role:
|
|
7776
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
7777
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
8273
|
+
{ address: lowerTickArrayAddress, role: import_kit64.AccountRole.WRITABLE },
|
|
8274
|
+
{ address: upperTickArrayAddress, role: import_kit64.AccountRole.WRITABLE },
|
|
8275
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit64.AccountRole.WRITABLE },
|
|
8276
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit64.AccountRole.WRITABLE }
|
|
7778
8277
|
];
|
|
7779
8278
|
const remainingAccountsInfo = {
|
|
7780
8279
|
slices: [
|
|
7781
8280
|
{ accountsType: 1 /* TickArrayLower */, length: 1 },
|
|
7782
8281
|
{ accountsType: 2 /* TickArrayUpper */, length: 1 },
|
|
7783
|
-
{ accountsType:
|
|
7784
|
-
{ accountsType:
|
|
8282
|
+
{ accountsType: 5 /* PoolVaultTokenA */, length: 1 },
|
|
8283
|
+
{ accountsType: 6 /* PoolVaultTokenB */, length: 1 }
|
|
7785
8284
|
]
|
|
7786
8285
|
};
|
|
7787
8286
|
const ix = getCollectFeesOrcaInstruction({
|
|
@@ -7809,7 +8308,7 @@ async function collectFeesOrcaInstruction(authority, tunaPosition, mintA, mintB,
|
|
|
7809
8308
|
|
|
7810
8309
|
// src/txbuilder/collectFeesFusion.ts
|
|
7811
8310
|
var import_fusionamm_client5 = require("@crypticdot/fusionamm-client");
|
|
7812
|
-
var
|
|
8311
|
+
var import_kit65 = require("@solana/kit");
|
|
7813
8312
|
var import_memo6 = require("@solana-program/memo");
|
|
7814
8313
|
var import_token_20229 = require("@solana-program/token-2022");
|
|
7815
8314
|
var import_assert8 = __toESM(require("assert"));
|
|
@@ -7885,17 +8384,17 @@ async function collectFeesFusionInstruction(authority, tunaPosition, mintA, mint
|
|
|
7885
8384
|
tunaPosition.data.tickUpperIndex
|
|
7886
8385
|
);
|
|
7887
8386
|
const remainingAccounts = [
|
|
7888
|
-
{ address: lowerTickArrayAddress, role:
|
|
7889
|
-
{ address: upperTickArrayAddress, role:
|
|
7890
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
7891
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
8387
|
+
{ address: lowerTickArrayAddress, role: import_kit65.AccountRole.WRITABLE },
|
|
8388
|
+
{ address: upperTickArrayAddress, role: import_kit65.AccountRole.WRITABLE },
|
|
8389
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit65.AccountRole.WRITABLE },
|
|
8390
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit65.AccountRole.WRITABLE }
|
|
7892
8391
|
];
|
|
7893
8392
|
const remainingAccountsInfo = {
|
|
7894
8393
|
slices: [
|
|
7895
8394
|
{ accountsType: 1 /* TickArrayLower */, length: 1 },
|
|
7896
8395
|
{ accountsType: 2 /* TickArrayUpper */, length: 1 },
|
|
7897
|
-
{ accountsType:
|
|
7898
|
-
{ accountsType:
|
|
8396
|
+
{ accountsType: 5 /* PoolVaultTokenA */, length: 1 },
|
|
8397
|
+
{ accountsType: 6 /* PoolVaultTokenB */, length: 1 }
|
|
7899
8398
|
]
|
|
7900
8399
|
};
|
|
7901
8400
|
const ix = getCollectFeesFusionInstruction({
|
|
@@ -7999,7 +8498,7 @@ async function openLendingPositionAndDepositInstructions(rpc, authority, mintAdd
|
|
|
7999
8498
|
// src/txbuilder/closePositionWithLiquidityOrca.ts
|
|
8000
8499
|
var import_whirlpools_client6 = require("@orca-so/whirlpools-client");
|
|
8001
8500
|
var import_whirlpools_core3 = require("@orca-so/whirlpools-core");
|
|
8002
|
-
var
|
|
8501
|
+
var import_kit66 = require("@solana/kit");
|
|
8003
8502
|
var import_token_202211 = require("@solana-program/token-2022");
|
|
8004
8503
|
var import_assert9 = __toESM(require("assert"));
|
|
8005
8504
|
async function closePositionWithLiquidityOrcaInstructions(rpc, authority, positionMint, args) {
|
|
@@ -8020,7 +8519,7 @@ async function closePositionWithLiquidityOrcaInstructions(rpc, authority, positi
|
|
|
8020
8519
|
const allMints = [mintA, mintB, ...rewardMints];
|
|
8021
8520
|
(0, import_assert9.default)(mintA.exists, "Token A account not found");
|
|
8022
8521
|
(0, import_assert9.default)(mintB.exists, "Token B account not found");
|
|
8023
|
-
(0,
|
|
8522
|
+
(0, import_kit66.assertAccountsExist)(rewardMints);
|
|
8024
8523
|
const lowerTickArrayStartIndex = (0, import_whirlpools_core3.getTickArrayStartTickIndex)(
|
|
8025
8524
|
tunaPosition.data.tickLowerIndex,
|
|
8026
8525
|
whirlpool.data.tickSpacing
|
|
@@ -8213,7 +8712,7 @@ async function createMarketInstruction(authority, pool, args) {
|
|
|
8213
8712
|
}
|
|
8214
8713
|
|
|
8215
8714
|
// src/txbuilder/createTunaConfig.ts
|
|
8216
|
-
async function createTunaConfigInstruction(authority,
|
|
8715
|
+
async function createTunaConfigInstruction(authority, ownerAuthority, adminAuthority, liquidatorAuthority, feeRecipient) {
|
|
8217
8716
|
const tunaConfigAddress = await getTunaConfigAddress();
|
|
8218
8717
|
return getCreateTunaConfigInstruction({
|
|
8219
8718
|
adminAuthority,
|
|
@@ -8251,7 +8750,7 @@ async function createVaultInstructions(authority, mint, args) {
|
|
|
8251
8750
|
|
|
8252
8751
|
// src/txbuilder/liquidatePositionOrca.ts
|
|
8253
8752
|
var import_whirlpools_client7 = require("@orca-so/whirlpools-client");
|
|
8254
|
-
var
|
|
8753
|
+
var import_kit67 = require("@solana/kit");
|
|
8255
8754
|
var import_memo8 = require("@solana-program/memo");
|
|
8256
8755
|
var import_token_202214 = require("@solana-program/token-2022");
|
|
8257
8756
|
async function liquidatePositionOrcaInstructions(authority, tunaPosition, mintA, mintB, vaultA, vaultB, whirlpool, withdrawPercent) {
|
|
@@ -8338,25 +8837,25 @@ async function liquidatePositionOrcaInstruction(authority, tunaPosition, mintA,
|
|
|
8338
8837
|
tunaPosition.data.tickUpperIndex
|
|
8339
8838
|
);
|
|
8340
8839
|
const remainingAccounts = [
|
|
8341
|
-
{ address: swapTickArrays[0], role:
|
|
8342
|
-
{ address: swapTickArrays[1], role:
|
|
8343
|
-
{ address: swapTickArrays[2], role:
|
|
8344
|
-
{ address: swapTickArrays[3], role:
|
|
8345
|
-
{ address: swapTickArrays[4], role:
|
|
8346
|
-
{ address: lowerTickArrayAddress, role:
|
|
8347
|
-
{ address: upperTickArrayAddress, role:
|
|
8348
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
8349
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
8350
|
-
{ address: orcaOracleAddress, role:
|
|
8840
|
+
{ address: swapTickArrays[0], role: import_kit67.AccountRole.WRITABLE },
|
|
8841
|
+
{ address: swapTickArrays[1], role: import_kit67.AccountRole.WRITABLE },
|
|
8842
|
+
{ address: swapTickArrays[2], role: import_kit67.AccountRole.WRITABLE },
|
|
8843
|
+
{ address: swapTickArrays[3], role: import_kit67.AccountRole.WRITABLE },
|
|
8844
|
+
{ address: swapTickArrays[4], role: import_kit67.AccountRole.WRITABLE },
|
|
8845
|
+
{ address: lowerTickArrayAddress, role: import_kit67.AccountRole.WRITABLE },
|
|
8846
|
+
{ address: upperTickArrayAddress, role: import_kit67.AccountRole.WRITABLE },
|
|
8847
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit67.AccountRole.WRITABLE },
|
|
8848
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit67.AccountRole.WRITABLE },
|
|
8849
|
+
{ address: orcaOracleAddress, role: import_kit67.AccountRole.WRITABLE }
|
|
8351
8850
|
];
|
|
8352
8851
|
const remainingAccountsInfo = {
|
|
8353
8852
|
slices: [
|
|
8354
8853
|
{ accountsType: 0 /* SwapTickArrays */, length: 5 },
|
|
8355
8854
|
{ accountsType: 1 /* TickArrayLower */, length: 1 },
|
|
8356
8855
|
{ accountsType: 2 /* TickArrayUpper */, length: 1 },
|
|
8357
|
-
{ accountsType:
|
|
8358
|
-
{ accountsType:
|
|
8359
|
-
{ accountsType:
|
|
8856
|
+
{ accountsType: 5 /* PoolVaultTokenA */, length: 1 },
|
|
8857
|
+
{ accountsType: 6 /* PoolVaultTokenB */, length: 1 },
|
|
8858
|
+
{ accountsType: 7 /* WhirlpoolOracle */, length: 1 }
|
|
8360
8859
|
]
|
|
8361
8860
|
};
|
|
8362
8861
|
const ix = getLiquidatePositionOrcaInstruction({
|
|
@@ -8392,7 +8891,7 @@ async function liquidatePositionOrcaInstruction(authority, tunaPosition, mintA,
|
|
|
8392
8891
|
|
|
8393
8892
|
// src/txbuilder/liquidatePositionFusion.ts
|
|
8394
8893
|
var import_fusionamm_client7 = require("@crypticdot/fusionamm-client");
|
|
8395
|
-
var
|
|
8894
|
+
var import_kit68 = require("@solana/kit");
|
|
8396
8895
|
var import_memo9 = require("@solana-program/memo");
|
|
8397
8896
|
var import_token_202215 = require("@solana-program/token-2022");
|
|
8398
8897
|
async function liquidatePositionFusionInstructions(authority, tunaPosition, mintA, mintB, vaultA, vaultB, whirlpool, withdrawPercent) {
|
|
@@ -8478,23 +8977,23 @@ async function liquidatePositionFusionInstruction(authority, tunaPosition, mintA
|
|
|
8478
8977
|
tunaPosition.data.tickUpperIndex
|
|
8479
8978
|
);
|
|
8480
8979
|
const remainingAccounts = [
|
|
8481
|
-
{ address: swapTickArrays[0], role:
|
|
8482
|
-
{ address: swapTickArrays[1], role:
|
|
8483
|
-
{ address: swapTickArrays[2], role:
|
|
8484
|
-
{ address: swapTickArrays[3], role:
|
|
8485
|
-
{ address: swapTickArrays[4], role:
|
|
8486
|
-
{ address: lowerTickArrayAddress, role:
|
|
8487
|
-
{ address: upperTickArrayAddress, role:
|
|
8488
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
8489
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
8980
|
+
{ address: swapTickArrays[0], role: import_kit68.AccountRole.WRITABLE },
|
|
8981
|
+
{ address: swapTickArrays[1], role: import_kit68.AccountRole.WRITABLE },
|
|
8982
|
+
{ address: swapTickArrays[2], role: import_kit68.AccountRole.WRITABLE },
|
|
8983
|
+
{ address: swapTickArrays[3], role: import_kit68.AccountRole.WRITABLE },
|
|
8984
|
+
{ address: swapTickArrays[4], role: import_kit68.AccountRole.WRITABLE },
|
|
8985
|
+
{ address: lowerTickArrayAddress, role: import_kit68.AccountRole.WRITABLE },
|
|
8986
|
+
{ address: upperTickArrayAddress, role: import_kit68.AccountRole.WRITABLE },
|
|
8987
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit68.AccountRole.WRITABLE },
|
|
8988
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit68.AccountRole.WRITABLE }
|
|
8490
8989
|
];
|
|
8491
8990
|
const remainingAccountsInfo = {
|
|
8492
8991
|
slices: [
|
|
8493
8992
|
{ accountsType: 0 /* SwapTickArrays */, length: 5 },
|
|
8494
8993
|
{ accountsType: 1 /* TickArrayLower */, length: 1 },
|
|
8495
8994
|
{ accountsType: 2 /* TickArrayUpper */, length: 1 },
|
|
8496
|
-
{ accountsType:
|
|
8497
|
-
{ accountsType:
|
|
8995
|
+
{ accountsType: 5 /* PoolVaultTokenA */, length: 1 },
|
|
8996
|
+
{ accountsType: 6 /* PoolVaultTokenB */, length: 1 }
|
|
8498
8997
|
]
|
|
8499
8998
|
};
|
|
8500
8999
|
const ix = getLiquidatePositionFusionInstruction({
|
|
@@ -8632,7 +9131,7 @@ async function openPositionFusionInstruction(rpc, authority, positionMint, fusio
|
|
|
8632
9131
|
// src/txbuilder/openPositionWithLiquidityOrca.ts
|
|
8633
9132
|
var import_whirlpools_client9 = require("@orca-so/whirlpools-client");
|
|
8634
9133
|
var import_whirlpools_core4 = require("@orca-so/whirlpools-core");
|
|
8635
|
-
var
|
|
9134
|
+
var import_kit69 = require("@solana/kit");
|
|
8636
9135
|
var import_memo10 = require("@solana-program/memo");
|
|
8637
9136
|
var import_token_202218 = require("@solana-program/token-2022");
|
|
8638
9137
|
var import_assert13 = __toESM(require("assert"));
|
|
@@ -8799,25 +9298,25 @@ async function openPositionWithLiquidityOrcaInstruction(authority, positionMint,
|
|
|
8799
9298
|
const lowerTickArrayAddress = await OrcaUtils.getTickArrayAddressFromTickIndex(whirlpool, args.tickLowerIndex);
|
|
8800
9299
|
const upperTickArrayAddress = await OrcaUtils.getTickArrayAddressFromTickIndex(whirlpool, args.tickUpperIndex);
|
|
8801
9300
|
const remainingAccounts = [
|
|
8802
|
-
{ address: swapTickArrays[0], role:
|
|
8803
|
-
{ address: swapTickArrays[1], role:
|
|
8804
|
-
{ address: swapTickArrays[2], role:
|
|
8805
|
-
{ address: swapTickArrays[3], role:
|
|
8806
|
-
{ address: swapTickArrays[4], role:
|
|
8807
|
-
{ address: lowerTickArrayAddress, role:
|
|
8808
|
-
{ address: upperTickArrayAddress, role:
|
|
8809
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
8810
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
8811
|
-
{ address: orcaOracleAddress, role:
|
|
9301
|
+
{ address: swapTickArrays[0], role: import_kit69.AccountRole.WRITABLE },
|
|
9302
|
+
{ address: swapTickArrays[1], role: import_kit69.AccountRole.WRITABLE },
|
|
9303
|
+
{ address: swapTickArrays[2], role: import_kit69.AccountRole.WRITABLE },
|
|
9304
|
+
{ address: swapTickArrays[3], role: import_kit69.AccountRole.WRITABLE },
|
|
9305
|
+
{ address: swapTickArrays[4], role: import_kit69.AccountRole.WRITABLE },
|
|
9306
|
+
{ address: lowerTickArrayAddress, role: import_kit69.AccountRole.WRITABLE },
|
|
9307
|
+
{ address: upperTickArrayAddress, role: import_kit69.AccountRole.WRITABLE },
|
|
9308
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit69.AccountRole.WRITABLE },
|
|
9309
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit69.AccountRole.WRITABLE },
|
|
9310
|
+
{ address: orcaOracleAddress, role: import_kit69.AccountRole.WRITABLE }
|
|
8812
9311
|
];
|
|
8813
9312
|
const remainingAccountsInfo = {
|
|
8814
9313
|
slices: [
|
|
8815
9314
|
{ accountsType: 0 /* SwapTickArrays */, length: 5 },
|
|
8816
9315
|
{ accountsType: 1 /* TickArrayLower */, length: 1 },
|
|
8817
9316
|
{ accountsType: 2 /* TickArrayUpper */, length: 1 },
|
|
8818
|
-
{ accountsType:
|
|
8819
|
-
{ accountsType:
|
|
8820
|
-
{ accountsType:
|
|
9317
|
+
{ accountsType: 5 /* PoolVaultTokenA */, length: 1 },
|
|
9318
|
+
{ accountsType: 6 /* PoolVaultTokenB */, length: 1 },
|
|
9319
|
+
{ accountsType: 7 /* WhirlpoolOracle */, length: 1 }
|
|
8821
9320
|
]
|
|
8822
9321
|
};
|
|
8823
9322
|
const ix = getOpenPositionWithLiquidityOrcaInstruction({
|
|
@@ -8859,8 +9358,8 @@ async function openPositionWithLiquidityOrcaInstruction(authority, positionMint,
|
|
|
8859
9358
|
|
|
8860
9359
|
// src/txbuilder/openPositionWithLiquidityFusion.ts
|
|
8861
9360
|
var import_fusionamm_client10 = require("@crypticdot/fusionamm-client");
|
|
8862
|
-
var
|
|
8863
|
-
var
|
|
9361
|
+
var import_fusionamm_core5 = require("@crypticdot/fusionamm-core");
|
|
9362
|
+
var import_kit70 = require("@solana/kit");
|
|
8864
9363
|
var import_memo11 = require("@solana-program/memo");
|
|
8865
9364
|
var import_token_202219 = require("@solana-program/token-2022");
|
|
8866
9365
|
var import_assert14 = __toESM(require("assert"));
|
|
@@ -8927,9 +9426,9 @@ async function openPositionWithLiquidityFusionInstructions(rpc, authority, posit
|
|
|
8927
9426
|
mintB.programAddress
|
|
8928
9427
|
);
|
|
8929
9428
|
createInstructions.push(...createFeeRecipientAtaBInstructions.init);
|
|
8930
|
-
const lowerTickArrayIndex = (0,
|
|
9429
|
+
const lowerTickArrayIndex = (0, import_fusionamm_core5.getTickArrayStartTickIndex)(args.tickLowerIndex, fusionPool.data.tickSpacing);
|
|
8931
9430
|
const [lowerTickArrayAddress] = await (0, import_fusionamm_client10.getTickArrayAddress)(fusionPool.address, lowerTickArrayIndex);
|
|
8932
|
-
const upperTickArrayIndex = (0,
|
|
9431
|
+
const upperTickArrayIndex = (0, import_fusionamm_core5.getTickArrayStartTickIndex)(args.tickUpperIndex, fusionPool.data.tickSpacing);
|
|
8933
9432
|
const [upperTickArrayAddress] = await (0, import_fusionamm_client10.getTickArrayAddress)(fusionPool.address, upperTickArrayIndex);
|
|
8934
9433
|
const [lowerTickArray, upperTickArray] = await (0, import_fusionamm_client10.fetchAllMaybeTickArray)(rpc, [
|
|
8935
9434
|
lowerTickArrayAddress,
|
|
@@ -9026,23 +9525,23 @@ async function openPositionWithLiquidityFusionInstruction(authority, positionMin
|
|
|
9026
9525
|
const lowerTickArrayAddress = await FusionUtils.getTickArrayAddressFromTickIndex(fusionPool, args.tickLowerIndex);
|
|
9027
9526
|
const upperTickArrayAddress = await FusionUtils.getTickArrayAddressFromTickIndex(fusionPool, args.tickUpperIndex);
|
|
9028
9527
|
const remainingAccounts = [
|
|
9029
|
-
{ address: swapTickArrays[0], role:
|
|
9030
|
-
{ address: swapTickArrays[1], role:
|
|
9031
|
-
{ address: swapTickArrays[2], role:
|
|
9032
|
-
{ address: swapTickArrays[3], role:
|
|
9033
|
-
{ address: swapTickArrays[4], role:
|
|
9034
|
-
{ address: lowerTickArrayAddress, role:
|
|
9035
|
-
{ address: upperTickArrayAddress, role:
|
|
9036
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
9037
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
9528
|
+
{ address: swapTickArrays[0], role: import_kit70.AccountRole.WRITABLE },
|
|
9529
|
+
{ address: swapTickArrays[1], role: import_kit70.AccountRole.WRITABLE },
|
|
9530
|
+
{ address: swapTickArrays[2], role: import_kit70.AccountRole.WRITABLE },
|
|
9531
|
+
{ address: swapTickArrays[3], role: import_kit70.AccountRole.WRITABLE },
|
|
9532
|
+
{ address: swapTickArrays[4], role: import_kit70.AccountRole.WRITABLE },
|
|
9533
|
+
{ address: lowerTickArrayAddress, role: import_kit70.AccountRole.WRITABLE },
|
|
9534
|
+
{ address: upperTickArrayAddress, role: import_kit70.AccountRole.WRITABLE },
|
|
9535
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit70.AccountRole.WRITABLE },
|
|
9536
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit70.AccountRole.WRITABLE }
|
|
9038
9537
|
];
|
|
9039
9538
|
const remainingAccountsInfo = {
|
|
9040
9539
|
slices: [
|
|
9041
9540
|
{ accountsType: 0 /* SwapTickArrays */, length: 5 },
|
|
9042
9541
|
{ accountsType: 1 /* TickArrayLower */, length: 1 },
|
|
9043
9542
|
{ accountsType: 2 /* TickArrayUpper */, length: 1 },
|
|
9044
|
-
{ accountsType:
|
|
9045
|
-
{ accountsType:
|
|
9543
|
+
{ accountsType: 5 /* PoolVaultTokenA */, length: 1 },
|
|
9544
|
+
{ accountsType: 6 /* PoolVaultTokenB */, length: 1 }
|
|
9046
9545
|
]
|
|
9047
9546
|
};
|
|
9048
9547
|
const ix = getOpenPositionWithLiquidityFusionInstruction({
|
|
@@ -9085,7 +9584,7 @@ async function openPositionWithLiquidityFusionInstruction(authority, positionMin
|
|
|
9085
9584
|
// src/txbuilder/removeLiquidityOrca.ts
|
|
9086
9585
|
var import_whirlpools_client10 = require("@orca-so/whirlpools-client");
|
|
9087
9586
|
var import_whirlpools_core5 = require("@orca-so/whirlpools-core");
|
|
9088
|
-
var
|
|
9587
|
+
var import_kit71 = require("@solana/kit");
|
|
9089
9588
|
var import_memo12 = require("@solana-program/memo");
|
|
9090
9589
|
var import_token_202220 = require("@solana-program/token-2022");
|
|
9091
9590
|
var import_assert15 = __toESM(require("assert"));
|
|
@@ -9107,7 +9606,7 @@ async function removeLiquidityOrcaInstructions(rpc, authority, positionMint, arg
|
|
|
9107
9606
|
const allMints = [mintA, mintB, ...rewardMints];
|
|
9108
9607
|
(0, import_assert15.default)(mintA.exists, "Token A account not found");
|
|
9109
9608
|
(0, import_assert15.default)(mintB.exists, "Token B account not found");
|
|
9110
|
-
(0,
|
|
9609
|
+
(0, import_kit71.assertAccountsExist)(rewardMints);
|
|
9111
9610
|
const lowerTickArrayStartIndex = (0, import_whirlpools_core5.getTickArrayStartTickIndex)(
|
|
9112
9611
|
tunaPosition.data.tickLowerIndex,
|
|
9113
9612
|
whirlpool.data.tickSpacing
|
|
@@ -9220,16 +9719,16 @@ async function removeLiquidityOrcaInstruction(authority, tunaPosition, mintA, mi
|
|
|
9220
9719
|
tunaPosition.data.tickUpperIndex
|
|
9221
9720
|
);
|
|
9222
9721
|
const remainingAccounts = [
|
|
9223
|
-
{ address: swapTickArrays[0], role:
|
|
9224
|
-
{ address: swapTickArrays[1], role:
|
|
9225
|
-
{ address: swapTickArrays[2], role:
|
|
9226
|
-
{ address: swapTickArrays[3], role:
|
|
9227
|
-
{ address: swapTickArrays[4], role:
|
|
9228
|
-
{ address: lowerTickArrayAddress, role:
|
|
9229
|
-
{ address: upperTickArrayAddress, role:
|
|
9230
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
9231
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
9232
|
-
{ address: orcaOracleAddress, role:
|
|
9722
|
+
{ address: swapTickArrays[0], role: import_kit71.AccountRole.WRITABLE },
|
|
9723
|
+
{ address: swapTickArrays[1], role: import_kit71.AccountRole.WRITABLE },
|
|
9724
|
+
{ address: swapTickArrays[2], role: import_kit71.AccountRole.WRITABLE },
|
|
9725
|
+
{ address: swapTickArrays[3], role: import_kit71.AccountRole.WRITABLE },
|
|
9726
|
+
{ address: swapTickArrays[4], role: import_kit71.AccountRole.WRITABLE },
|
|
9727
|
+
{ address: lowerTickArrayAddress, role: import_kit71.AccountRole.WRITABLE },
|
|
9728
|
+
{ address: upperTickArrayAddress, role: import_kit71.AccountRole.WRITABLE },
|
|
9729
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit71.AccountRole.WRITABLE },
|
|
9730
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit71.AccountRole.WRITABLE },
|
|
9731
|
+
{ address: orcaOracleAddress, role: import_kit71.AccountRole.WRITABLE }
|
|
9233
9732
|
];
|
|
9234
9733
|
for (const rewardIndex of rewardIndicesToClaim) {
|
|
9235
9734
|
const rewardInfo = whirlpool.data.rewardInfos[rewardIndex];
|
|
@@ -9240,23 +9739,23 @@ async function removeLiquidityOrcaInstruction(authority, tunaPosition, mintA, mi
|
|
|
9240
9739
|
mint: rewardMint.address,
|
|
9241
9740
|
tokenProgram: rewardMint.programAddress
|
|
9242
9741
|
});
|
|
9243
|
-
remainingAccounts.push({ address: rewardMint.address, role:
|
|
9244
|
-
remainingAccounts.push({ address: rewardMint.programAddress, role:
|
|
9245
|
-
remainingAccounts.push({ address: ownerAta[0], role:
|
|
9246
|
-
remainingAccounts.push({ address: rewardInfo.vault, role:
|
|
9742
|
+
remainingAccounts.push({ address: rewardMint.address, role: import_kit71.AccountRole.READONLY });
|
|
9743
|
+
remainingAccounts.push({ address: rewardMint.programAddress, role: import_kit71.AccountRole.READONLY });
|
|
9744
|
+
remainingAccounts.push({ address: ownerAta[0], role: import_kit71.AccountRole.WRITABLE });
|
|
9745
|
+
remainingAccounts.push({ address: rewardInfo.vault, role: import_kit71.AccountRole.WRITABLE });
|
|
9247
9746
|
}
|
|
9248
9747
|
const remainingAccountsInfo = {
|
|
9249
9748
|
slices: [
|
|
9250
9749
|
{ accountsType: 0 /* SwapTickArrays */, length: 5 },
|
|
9251
9750
|
{ accountsType: 1 /* TickArrayLower */, length: 1 },
|
|
9252
9751
|
{ accountsType: 2 /* TickArrayUpper */, length: 1 },
|
|
9253
|
-
{ accountsType:
|
|
9254
|
-
{ accountsType:
|
|
9255
|
-
{ accountsType:
|
|
9752
|
+
{ accountsType: 5 /* PoolVaultTokenA */, length: 1 },
|
|
9753
|
+
{ accountsType: 6 /* PoolVaultTokenB */, length: 1 },
|
|
9754
|
+
{ accountsType: 7 /* WhirlpoolOracle */, length: 1 }
|
|
9256
9755
|
]
|
|
9257
9756
|
};
|
|
9258
9757
|
if (rewardIndicesToClaim.length > 0) {
|
|
9259
|
-
remainingAccountsInfo.slices.push({ accountsType:
|
|
9758
|
+
remainingAccountsInfo.slices.push({ accountsType: 8 /* Rewards */, length: 4 * rewardIndicesToClaim.length });
|
|
9260
9759
|
}
|
|
9261
9760
|
const ix = getRemoveLiquidityOrcaInstruction({
|
|
9262
9761
|
market: marketAddress,
|
|
@@ -9291,7 +9790,7 @@ async function removeLiquidityOrcaInstruction(authority, tunaPosition, mintA, mi
|
|
|
9291
9790
|
|
|
9292
9791
|
// src/txbuilder/removeLiquidityFusion.ts
|
|
9293
9792
|
var import_fusionamm_client11 = require("@crypticdot/fusionamm-client");
|
|
9294
|
-
var
|
|
9793
|
+
var import_kit72 = require("@solana/kit");
|
|
9295
9794
|
var import_memo13 = require("@solana-program/memo");
|
|
9296
9795
|
var import_token_202221 = require("@solana-program/token-2022");
|
|
9297
9796
|
var import_assert16 = __toESM(require("assert"));
|
|
@@ -9304,25 +9803,28 @@ async function removeLiquidityFusionInstructions(rpc, authority, positionMint, a
|
|
|
9304
9803
|
(await getLendingVaultAddress(fusionPool.data.tokenMintA))[0],
|
|
9305
9804
|
(await getLendingVaultAddress(fusionPool.data.tokenMintB))[0]
|
|
9306
9805
|
]);
|
|
9307
|
-
const [mintA, mintB
|
|
9308
|
-
fusionPool.data.tokenMintA,
|
|
9309
|
-
fusionPool.data.tokenMintB
|
|
9310
|
-
]);
|
|
9311
|
-
const allMints = [mintA, mintB, ...rewardMints];
|
|
9806
|
+
const [mintA, mintB] = await (0, import_token_202221.fetchAllMaybeMint)(rpc, [fusionPool.data.tokenMintA, fusionPool.data.tokenMintB]);
|
|
9312
9807
|
(0, import_assert16.default)(mintA.exists, "Token A account not found");
|
|
9313
9808
|
(0, import_assert16.default)(mintB.exists, "Token B account not found");
|
|
9314
9809
|
const instructions = [];
|
|
9315
9810
|
if (!createInstructions) createInstructions = instructions;
|
|
9316
9811
|
if (!cleanupInstructions) cleanupInstructions = instructions;
|
|
9317
|
-
const
|
|
9318
|
-
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
9812
|
+
const createUserAtaAInstructions = await getCreateAtaInstructions(
|
|
9813
|
+
rpc,
|
|
9814
|
+
authority,
|
|
9815
|
+
mintA.address,
|
|
9816
|
+
authority.address,
|
|
9817
|
+
mintA.programAddress
|
|
9818
|
+
);
|
|
9819
|
+
createInstructions.push(...createUserAtaAInstructions.init);
|
|
9820
|
+
const createUserAtaBInstructions = await getCreateAtaInstructions(
|
|
9821
|
+
rpc,
|
|
9822
|
+
authority,
|
|
9823
|
+
mintB.address,
|
|
9824
|
+
authority.address,
|
|
9825
|
+
mintB.programAddress
|
|
9826
|
+
);
|
|
9827
|
+
createInstructions.push(...createUserAtaBInstructions.init);
|
|
9326
9828
|
const ix = await removeLiquidityFusionInstruction(
|
|
9327
9829
|
authority,
|
|
9328
9830
|
tunaPosition,
|
|
@@ -9335,7 +9837,8 @@ async function removeLiquidityFusionInstructions(rpc, authority, positionMint, a
|
|
|
9335
9837
|
{ ...args, minRemovedAmountA: 0, minRemovedAmountB: 0 }
|
|
9336
9838
|
);
|
|
9337
9839
|
instructions.push(ix);
|
|
9338
|
-
cleanupInstructions.push(...
|
|
9840
|
+
cleanupInstructions.push(...createUserAtaAInstructions.cleanup);
|
|
9841
|
+
cleanupInstructions.push(...createUserAtaBInstructions.cleanup);
|
|
9339
9842
|
return instructions;
|
|
9340
9843
|
}
|
|
9341
9844
|
async function removeLiquidityFusionInstruction(authority, tunaPosition, mintA, mintB, vaultA, vaultB, fusionPool, args) {
|
|
@@ -9388,23 +9891,23 @@ async function removeLiquidityFusionInstruction(authority, tunaPosition, mintA,
|
|
|
9388
9891
|
tunaPosition.data.tickUpperIndex
|
|
9389
9892
|
);
|
|
9390
9893
|
const remainingAccounts = [
|
|
9391
|
-
{ address: swapTickArrays[0], role:
|
|
9392
|
-
{ address: swapTickArrays[1], role:
|
|
9393
|
-
{ address: swapTickArrays[2], role:
|
|
9394
|
-
{ address: swapTickArrays[3], role:
|
|
9395
|
-
{ address: swapTickArrays[4], role:
|
|
9396
|
-
{ address: lowerTickArrayAddress, role:
|
|
9397
|
-
{ address: upperTickArrayAddress, role:
|
|
9398
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
9399
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
9894
|
+
{ address: swapTickArrays[0], role: import_kit72.AccountRole.WRITABLE },
|
|
9895
|
+
{ address: swapTickArrays[1], role: import_kit72.AccountRole.WRITABLE },
|
|
9896
|
+
{ address: swapTickArrays[2], role: import_kit72.AccountRole.WRITABLE },
|
|
9897
|
+
{ address: swapTickArrays[3], role: import_kit72.AccountRole.WRITABLE },
|
|
9898
|
+
{ address: swapTickArrays[4], role: import_kit72.AccountRole.WRITABLE },
|
|
9899
|
+
{ address: lowerTickArrayAddress, role: import_kit72.AccountRole.WRITABLE },
|
|
9900
|
+
{ address: upperTickArrayAddress, role: import_kit72.AccountRole.WRITABLE },
|
|
9901
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit72.AccountRole.WRITABLE },
|
|
9902
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit72.AccountRole.WRITABLE }
|
|
9400
9903
|
];
|
|
9401
9904
|
const remainingAccountsInfo = {
|
|
9402
9905
|
slices: [
|
|
9403
9906
|
{ accountsType: 0 /* SwapTickArrays */, length: 5 },
|
|
9404
9907
|
{ accountsType: 1 /* TickArrayLower */, length: 1 },
|
|
9405
9908
|
{ accountsType: 2 /* TickArrayUpper */, length: 1 },
|
|
9406
|
-
{ accountsType:
|
|
9407
|
-
{ accountsType:
|
|
9909
|
+
{ accountsType: 5 /* PoolVaultTokenA */, length: 1 },
|
|
9910
|
+
{ accountsType: 6 /* PoolVaultTokenB */, length: 1 }
|
|
9408
9911
|
]
|
|
9409
9912
|
};
|
|
9410
9913
|
const ix = getRemoveLiquidityFusionInstruction({
|
|
@@ -9471,7 +9974,7 @@ async function repayBadDebtInstruction(rpc, authority, mintAddress, funds, share
|
|
|
9471
9974
|
}
|
|
9472
9975
|
|
|
9473
9976
|
// src/txbuilder/setLimitOrders.ts
|
|
9474
|
-
async function
|
|
9977
|
+
async function setLimitOrdersInstruction(authority, args, positionMint, tunaPositionAddress) {
|
|
9475
9978
|
if (tunaPositionAddress === void 0) {
|
|
9476
9979
|
if (positionMint === void 0) {
|
|
9477
9980
|
throw new Error("At least one of 'positionMint' or 'tunaPositionAddress' must be provided.");
|
|
@@ -9561,7 +10064,7 @@ async function withdrawInstruction(authority, mint, funds, shares) {
|
|
|
9561
10064
|
// src/txbuilder/createMarketLookupTable.ts
|
|
9562
10065
|
var import_fusionamm_client12 = require("@crypticdot/fusionamm-client");
|
|
9563
10066
|
var import_whirlpools_client11 = require("@orca-so/whirlpools-client");
|
|
9564
|
-
var
|
|
10067
|
+
var import_kit73 = require("@solana/kit");
|
|
9565
10068
|
var import_memo16 = require("@solana-program/memo");
|
|
9566
10069
|
var import_system2 = require("@solana-program/system");
|
|
9567
10070
|
var import_token2 = require("@solana-program/token");
|
|
@@ -9600,7 +10103,7 @@ async function getAddressesForMarketLookupTable(rpc, poolAddress, marketMaker) {
|
|
|
9600
10103
|
}))[0];
|
|
9601
10104
|
const addresses = [
|
|
9602
10105
|
import_system2.SYSTEM_PROGRAM_ADDRESS,
|
|
9603
|
-
(0,
|
|
10106
|
+
(0, import_kit73.address)("SysvarRent111111111111111111111111111111111"),
|
|
9604
10107
|
import_token_202224.ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
9605
10108
|
import_token2.TOKEN_PROGRAM_ADDRESS,
|
|
9606
10109
|
import_token_202224.TOKEN_2022_PROGRAM_ADDRESS,
|
|
@@ -9738,6 +10241,349 @@ async function repayDebtInstruction(authority, positionMint, mintA, mintB, marke
|
|
|
9738
10241
|
collateralFundsB: collateralB
|
|
9739
10242
|
});
|
|
9740
10243
|
}
|
|
10244
|
+
|
|
10245
|
+
// src/txbuilder/rebalancePositionOrca.ts
|
|
10246
|
+
var import_whirlpools_client12 = require("@orca-so/whirlpools-client");
|
|
10247
|
+
var import_kit74 = require("@solana/kit");
|
|
10248
|
+
var import_memo18 = require("@solana-program/memo");
|
|
10249
|
+
var import_token_202226 = require("@solana-program/token-2022");
|
|
10250
|
+
var import_assert18 = __toESM(require("assert"));
|
|
10251
|
+
async function rebalancePositionOrcaInstructions(rpc, authority, positionMint, createInstructions, cleanupInstructions) {
|
|
10252
|
+
const tunaConfig = await fetchTunaConfig(rpc, (await getTunaConfigAddress())[0]);
|
|
10253
|
+
const tunaPosition = await fetchMaybeTunaPosition(rpc, (await getTunaPositionAddress(positionMint))[0]);
|
|
10254
|
+
if (!tunaPosition.exists) throw new Error("Tuna position account not found");
|
|
10255
|
+
const whirlpool = await (0, import_whirlpools_client12.fetchMaybeWhirlpool)(rpc, tunaPosition.data.pool);
|
|
10256
|
+
if (!whirlpool.exists) throw new Error("Whirlpool account not found");
|
|
10257
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [
|
|
10258
|
+
(await getLendingVaultAddress(whirlpool.data.tokenMintA))[0],
|
|
10259
|
+
(await getLendingVaultAddress(whirlpool.data.tokenMintB))[0]
|
|
10260
|
+
]);
|
|
10261
|
+
const [mintA, mintB] = await (0, import_token_202226.fetchAllMaybeMint)(rpc, [whirlpool.data.tokenMintA, whirlpool.data.tokenMintB]);
|
|
10262
|
+
(0, import_assert18.default)(mintA.exists, "Token A account not found");
|
|
10263
|
+
(0, import_assert18.default)(mintB.exists, "Token B account not found");
|
|
10264
|
+
const instructions = [];
|
|
10265
|
+
if (!createInstructions) createInstructions = instructions;
|
|
10266
|
+
if (!cleanupInstructions) cleanupInstructions = instructions;
|
|
10267
|
+
const internalCleanupInstructions = [];
|
|
10268
|
+
const secondaryTickArrays = await OrcaUtils.getTickArraysForRebalancedPosition(whirlpool, tunaPosition);
|
|
10269
|
+
const [lowerTickArray, upperTickArray] = await (0, import_whirlpools_client12.fetchAllMaybeTickArray)(rpc, [
|
|
10270
|
+
secondaryTickArrays.lowerTickArrayAddress,
|
|
10271
|
+
secondaryTickArrays.upperTickArrayAddress
|
|
10272
|
+
]);
|
|
10273
|
+
if (!lowerTickArray.exists) {
|
|
10274
|
+
instructions.push(
|
|
10275
|
+
(0, import_whirlpools_client12.getInitializeTickArrayInstruction)({
|
|
10276
|
+
whirlpool: whirlpool.address,
|
|
10277
|
+
funder: authority,
|
|
10278
|
+
tickArray: secondaryTickArrays.lowerTickArrayAddress,
|
|
10279
|
+
startTickIndex: secondaryTickArrays.lowerTickArrayStartIndex
|
|
10280
|
+
})
|
|
10281
|
+
);
|
|
10282
|
+
}
|
|
10283
|
+
if (!upperTickArray.exists && secondaryTickArrays.lowerTickArrayStartIndex !== secondaryTickArrays.upperTickArrayStartIndex) {
|
|
10284
|
+
instructions.push(
|
|
10285
|
+
(0, import_whirlpools_client12.getInitializeTickArrayInstruction)({
|
|
10286
|
+
whirlpool: whirlpool.address,
|
|
10287
|
+
funder: authority,
|
|
10288
|
+
tickArray: secondaryTickArrays.upperTickArrayAddress,
|
|
10289
|
+
startTickIndex: secondaryTickArrays.upperTickArrayStartIndex
|
|
10290
|
+
})
|
|
10291
|
+
);
|
|
10292
|
+
}
|
|
10293
|
+
const createFeeRecipientAtaAInstructions = await getCreateAtaInstructions(
|
|
10294
|
+
rpc,
|
|
10295
|
+
authority,
|
|
10296
|
+
mintA.address,
|
|
10297
|
+
tunaConfig.data.feeRecipient,
|
|
10298
|
+
mintA.programAddress
|
|
10299
|
+
);
|
|
10300
|
+
createInstructions.push(...createFeeRecipientAtaAInstructions.init);
|
|
10301
|
+
const createFeeRecipientAtaBInstructions = await getCreateAtaInstructions(
|
|
10302
|
+
rpc,
|
|
10303
|
+
authority,
|
|
10304
|
+
mintB.address,
|
|
10305
|
+
tunaConfig.data.feeRecipient,
|
|
10306
|
+
mintB.programAddress
|
|
10307
|
+
);
|
|
10308
|
+
createInstructions.push(...createFeeRecipientAtaBInstructions.init);
|
|
10309
|
+
const ix = await rebalancePositionOrcaInstruction(
|
|
10310
|
+
authority,
|
|
10311
|
+
tunaPosition,
|
|
10312
|
+
tunaConfig,
|
|
10313
|
+
mintA,
|
|
10314
|
+
mintB,
|
|
10315
|
+
vaultA,
|
|
10316
|
+
vaultB,
|
|
10317
|
+
whirlpool
|
|
10318
|
+
);
|
|
10319
|
+
instructions.push(ix);
|
|
10320
|
+
cleanupInstructions.push(...internalCleanupInstructions);
|
|
10321
|
+
cleanupInstructions.push(...createFeeRecipientAtaAInstructions.cleanup);
|
|
10322
|
+
cleanupInstructions.push(...createFeeRecipientAtaBInstructions.cleanup);
|
|
10323
|
+
return instructions;
|
|
10324
|
+
}
|
|
10325
|
+
async function rebalancePositionOrcaInstruction(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool) {
|
|
10326
|
+
const positionMint = tunaPosition.data.positionMint;
|
|
10327
|
+
const marketAddress = (await getMarketAddress(whirlpool.address))[0];
|
|
10328
|
+
const orcaPositionAddress = (await (0, import_whirlpools_client12.getPositionAddress)(positionMint))[0];
|
|
10329
|
+
const orcaOracleAddress = (await (0, import_whirlpools_client12.getOracleAddress)(whirlpool.address))[0];
|
|
10330
|
+
const tunaPositionAta = (await (0, import_token_202226.findAssociatedTokenPda)({
|
|
10331
|
+
owner: tunaPosition.address,
|
|
10332
|
+
mint: positionMint,
|
|
10333
|
+
tokenProgram: import_token_202226.TOKEN_2022_PROGRAM_ADDRESS
|
|
10334
|
+
}))[0];
|
|
10335
|
+
const tunaPositionAtaA = (await (0, import_token_202226.findAssociatedTokenPda)({
|
|
10336
|
+
owner: tunaPosition.address,
|
|
10337
|
+
mint: mintA.address,
|
|
10338
|
+
tokenProgram: mintA.programAddress
|
|
10339
|
+
}))[0];
|
|
10340
|
+
const tunaPositionAtaB = (await (0, import_token_202226.findAssociatedTokenPda)({
|
|
10341
|
+
owner: tunaPosition.address,
|
|
10342
|
+
mint: mintB.address,
|
|
10343
|
+
tokenProgram: mintB.programAddress
|
|
10344
|
+
}))[0];
|
|
10345
|
+
const feeRecipientAtaA = (await (0, import_token_202226.findAssociatedTokenPda)({
|
|
10346
|
+
owner: tunaConfig.data.feeRecipient,
|
|
10347
|
+
mint: mintA.address,
|
|
10348
|
+
tokenProgram: mintA.programAddress
|
|
10349
|
+
}))[0];
|
|
10350
|
+
const feeRecipientAtaB = (await (0, import_token_202226.findAssociatedTokenPda)({
|
|
10351
|
+
owner: tunaConfig.data.feeRecipient,
|
|
10352
|
+
mint: mintB.address,
|
|
10353
|
+
tokenProgram: mintB.programAddress
|
|
10354
|
+
}))[0];
|
|
10355
|
+
const swapTickArrays = await OrcaUtils.getSwapTickArrayAddresses(whirlpool);
|
|
10356
|
+
const lowerTickArrayAddress = await OrcaUtils.getTickArrayAddressFromTickIndex(
|
|
10357
|
+
whirlpool,
|
|
10358
|
+
tunaPosition.data.tickLowerIndex
|
|
10359
|
+
);
|
|
10360
|
+
const upperTickArrayAddress = await OrcaUtils.getTickArrayAddressFromTickIndex(
|
|
10361
|
+
whirlpool,
|
|
10362
|
+
tunaPosition.data.tickUpperIndex
|
|
10363
|
+
);
|
|
10364
|
+
const secondaryTickArrays = await OrcaUtils.getTickArraysForRebalancedPosition(whirlpool, tunaPosition);
|
|
10365
|
+
const remainingAccounts = [
|
|
10366
|
+
{ address: swapTickArrays[0], role: import_kit74.AccountRole.WRITABLE },
|
|
10367
|
+
{ address: swapTickArrays[1], role: import_kit74.AccountRole.WRITABLE },
|
|
10368
|
+
{ address: swapTickArrays[2], role: import_kit74.AccountRole.WRITABLE },
|
|
10369
|
+
{ address: swapTickArrays[3], role: import_kit74.AccountRole.WRITABLE },
|
|
10370
|
+
{ address: swapTickArrays[4], role: import_kit74.AccountRole.WRITABLE },
|
|
10371
|
+
{ address: lowerTickArrayAddress, role: import_kit74.AccountRole.WRITABLE },
|
|
10372
|
+
{ address: upperTickArrayAddress, role: import_kit74.AccountRole.WRITABLE },
|
|
10373
|
+
{ address: secondaryTickArrays.lowerTickArrayAddress, role: import_kit74.AccountRole.WRITABLE },
|
|
10374
|
+
{ address: secondaryTickArrays.upperTickArrayAddress, role: import_kit74.AccountRole.WRITABLE },
|
|
10375
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit74.AccountRole.WRITABLE },
|
|
10376
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit74.AccountRole.WRITABLE },
|
|
10377
|
+
{ address: orcaOracleAddress, role: import_kit74.AccountRole.WRITABLE }
|
|
10378
|
+
];
|
|
10379
|
+
const remainingAccountsInfo = {
|
|
10380
|
+
slices: [
|
|
10381
|
+
{ accountsType: 0 /* SwapTickArrays */, length: 5 },
|
|
10382
|
+
{ accountsType: 1 /* TickArrayLower */, length: 1 },
|
|
10383
|
+
{ accountsType: 2 /* TickArrayUpper */, length: 1 },
|
|
10384
|
+
{ accountsType: 3 /* SecondaryTickArrayLower */, length: 1 },
|
|
10385
|
+
{ accountsType: 4 /* SecondaryTickArrayUpper */, length: 1 },
|
|
10386
|
+
{ accountsType: 5 /* PoolVaultTokenA */, length: 1 },
|
|
10387
|
+
{ accountsType: 6 /* PoolVaultTokenB */, length: 1 },
|
|
10388
|
+
{ accountsType: 7 /* WhirlpoolOracle */, length: 1 }
|
|
10389
|
+
]
|
|
10390
|
+
};
|
|
10391
|
+
const ix = getRebalancePositionOrcaInstruction({
|
|
10392
|
+
market: marketAddress,
|
|
10393
|
+
mintA: mintA.address,
|
|
10394
|
+
mintB: mintB.address,
|
|
10395
|
+
pythOraclePriceFeedA: vaultA.data.pythOraclePriceUpdate,
|
|
10396
|
+
pythOraclePriceFeedB: vaultB.data.pythOraclePriceUpdate,
|
|
10397
|
+
vaultA: vaultA.address,
|
|
10398
|
+
vaultB: vaultB.address,
|
|
10399
|
+
authority,
|
|
10400
|
+
tunaConfig: tunaConfig.address,
|
|
10401
|
+
tunaPositionAta,
|
|
10402
|
+
tunaPositionAtaA,
|
|
10403
|
+
tunaPositionAtaB,
|
|
10404
|
+
orcaPosition: orcaPositionAddress,
|
|
10405
|
+
tunaPosition: tunaPosition.address,
|
|
10406
|
+
feeRecipientAtaA,
|
|
10407
|
+
feeRecipientAtaB,
|
|
10408
|
+
whirlpool: whirlpool.address,
|
|
10409
|
+
whirlpoolProgram: import_whirlpools_client12.WHIRLPOOL_PROGRAM_ADDRESS,
|
|
10410
|
+
tokenProgramA: mintA.programAddress,
|
|
10411
|
+
tokenProgramB: mintB.programAddress,
|
|
10412
|
+
memoProgram: import_memo18.MEMO_PROGRAM_ADDRESS,
|
|
10413
|
+
remainingAccountsInfo
|
|
10414
|
+
});
|
|
10415
|
+
ix.accounts.push(...remainingAccounts);
|
|
10416
|
+
return ix;
|
|
10417
|
+
}
|
|
10418
|
+
|
|
10419
|
+
// src/txbuilder/rebalancePositionFusion.ts
|
|
10420
|
+
var import_fusionamm_client13 = require("@crypticdot/fusionamm-client");
|
|
10421
|
+
var import_kit75 = require("@solana/kit");
|
|
10422
|
+
var import_memo19 = require("@solana-program/memo");
|
|
10423
|
+
var import_token_202227 = require("@solana-program/token-2022");
|
|
10424
|
+
var import_assert19 = __toESM(require("assert"));
|
|
10425
|
+
async function rebalancePositionFusionInstructions(rpc, authority, positionMint, createInstructions, cleanupInstructions) {
|
|
10426
|
+
const tunaConfig = await fetchTunaConfig(rpc, (await getTunaConfigAddress())[0]);
|
|
10427
|
+
const tunaPosition = await fetchMaybeTunaPosition(rpc, (await getTunaPositionAddress(positionMint))[0]);
|
|
10428
|
+
if (!tunaPosition.exists) throw new Error("Tuna position account not found");
|
|
10429
|
+
const fusionPool = await (0, import_fusionamm_client13.fetchMaybeFusionPool)(rpc, tunaPosition.data.pool);
|
|
10430
|
+
if (!fusionPool.exists) throw new Error("FusionPool account not found");
|
|
10431
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [
|
|
10432
|
+
(await getLendingVaultAddress(fusionPool.data.tokenMintA))[0],
|
|
10433
|
+
(await getLendingVaultAddress(fusionPool.data.tokenMintB))[0]
|
|
10434
|
+
]);
|
|
10435
|
+
const [mintA, mintB] = await (0, import_token_202227.fetchAllMaybeMint)(rpc, [fusionPool.data.tokenMintA, fusionPool.data.tokenMintB]);
|
|
10436
|
+
(0, import_assert19.default)(mintA.exists, "Token A account not found");
|
|
10437
|
+
(0, import_assert19.default)(mintB.exists, "Token B account not found");
|
|
10438
|
+
const instructions = [];
|
|
10439
|
+
if (!createInstructions) createInstructions = instructions;
|
|
10440
|
+
if (!cleanupInstructions) cleanupInstructions = instructions;
|
|
10441
|
+
const secondaryTickArrays = await FusionUtils.getTickArraysForRebalancedPosition(fusionPool, tunaPosition);
|
|
10442
|
+
const [lowerTickArray, upperTickArray] = await (0, import_fusionamm_client13.fetchAllMaybeTickArray)(rpc, [
|
|
10443
|
+
secondaryTickArrays.lowerTickArrayAddress,
|
|
10444
|
+
secondaryTickArrays.upperTickArrayAddress
|
|
10445
|
+
]);
|
|
10446
|
+
if (!lowerTickArray.exists) {
|
|
10447
|
+
instructions.push(
|
|
10448
|
+
(0, import_fusionamm_client13.getInitializeTickArrayInstruction)({
|
|
10449
|
+
fusionPool: fusionPool.address,
|
|
10450
|
+
funder: authority,
|
|
10451
|
+
tickArray: secondaryTickArrays.lowerTickArrayAddress,
|
|
10452
|
+
startTickIndex: secondaryTickArrays.lowerTickArrayStartIndex
|
|
10453
|
+
})
|
|
10454
|
+
);
|
|
10455
|
+
}
|
|
10456
|
+
if (!upperTickArray.exists && secondaryTickArrays.lowerTickArrayStartIndex !== secondaryTickArrays.upperTickArrayStartIndex) {
|
|
10457
|
+
instructions.push(
|
|
10458
|
+
(0, import_fusionamm_client13.getInitializeTickArrayInstruction)({
|
|
10459
|
+
fusionPool: fusionPool.address,
|
|
10460
|
+
funder: authority,
|
|
10461
|
+
tickArray: secondaryTickArrays.upperTickArrayAddress,
|
|
10462
|
+
startTickIndex: secondaryTickArrays.upperTickArrayStartIndex
|
|
10463
|
+
})
|
|
10464
|
+
);
|
|
10465
|
+
}
|
|
10466
|
+
const createFeeRecipientAtaAInstructions = await getCreateAtaInstructions(
|
|
10467
|
+
rpc,
|
|
10468
|
+
authority,
|
|
10469
|
+
mintA.address,
|
|
10470
|
+
tunaConfig.data.feeRecipient,
|
|
10471
|
+
mintA.programAddress
|
|
10472
|
+
);
|
|
10473
|
+
createInstructions.push(...createFeeRecipientAtaAInstructions.init);
|
|
10474
|
+
const createFeeRecipientAtaBInstructions = await getCreateAtaInstructions(
|
|
10475
|
+
rpc,
|
|
10476
|
+
authority,
|
|
10477
|
+
mintB.address,
|
|
10478
|
+
tunaConfig.data.feeRecipient,
|
|
10479
|
+
mintB.programAddress
|
|
10480
|
+
);
|
|
10481
|
+
createInstructions.push(...createFeeRecipientAtaBInstructions.init);
|
|
10482
|
+
const ix = await rebalancePositionFusionInstruction(
|
|
10483
|
+
authority,
|
|
10484
|
+
tunaPosition,
|
|
10485
|
+
tunaConfig,
|
|
10486
|
+
mintA,
|
|
10487
|
+
mintB,
|
|
10488
|
+
vaultA,
|
|
10489
|
+
vaultB,
|
|
10490
|
+
fusionPool
|
|
10491
|
+
);
|
|
10492
|
+
instructions.push(ix);
|
|
10493
|
+
cleanupInstructions.push(...createFeeRecipientAtaAInstructions.cleanup);
|
|
10494
|
+
cleanupInstructions.push(...createFeeRecipientAtaBInstructions.cleanup);
|
|
10495
|
+
return instructions;
|
|
10496
|
+
}
|
|
10497
|
+
async function rebalancePositionFusionInstruction(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, fusionPool) {
|
|
10498
|
+
const positionMint = tunaPosition.data.positionMint;
|
|
10499
|
+
const marketAddress = (await getMarketAddress(fusionPool.address))[0];
|
|
10500
|
+
const fusionPositionAddress = (await (0, import_fusionamm_client13.getPositionAddress)(positionMint))[0];
|
|
10501
|
+
const tunaPositionAta = (await (0, import_token_202227.findAssociatedTokenPda)({
|
|
10502
|
+
owner: tunaPosition.address,
|
|
10503
|
+
mint: positionMint,
|
|
10504
|
+
tokenProgram: import_token_202227.TOKEN_2022_PROGRAM_ADDRESS
|
|
10505
|
+
}))[0];
|
|
10506
|
+
const tunaPositionAtaA = (await (0, import_token_202227.findAssociatedTokenPda)({
|
|
10507
|
+
owner: tunaPosition.address,
|
|
10508
|
+
mint: mintA.address,
|
|
10509
|
+
tokenProgram: mintA.programAddress
|
|
10510
|
+
}))[0];
|
|
10511
|
+
const tunaPositionAtaB = (await (0, import_token_202227.findAssociatedTokenPda)({
|
|
10512
|
+
owner: tunaPosition.address,
|
|
10513
|
+
mint: mintB.address,
|
|
10514
|
+
tokenProgram: mintB.programAddress
|
|
10515
|
+
}))[0];
|
|
10516
|
+
const feeRecipientAtaA = (await (0, import_token_202227.findAssociatedTokenPda)({
|
|
10517
|
+
owner: tunaConfig.data.feeRecipient,
|
|
10518
|
+
mint: mintA.address,
|
|
10519
|
+
tokenProgram: mintA.programAddress
|
|
10520
|
+
}))[0];
|
|
10521
|
+
const feeRecipientAtaB = (await (0, import_token_202227.findAssociatedTokenPda)({
|
|
10522
|
+
owner: tunaConfig.data.feeRecipient,
|
|
10523
|
+
mint: mintB.address,
|
|
10524
|
+
tokenProgram: mintB.programAddress
|
|
10525
|
+
}))[0];
|
|
10526
|
+
const swapTickArrays = await FusionUtils.getSwapTickArrayAddresses(fusionPool);
|
|
10527
|
+
const lowerTickArrayAddress = await FusionUtils.getTickArrayAddressFromTickIndex(
|
|
10528
|
+
fusionPool,
|
|
10529
|
+
tunaPosition.data.tickLowerIndex
|
|
10530
|
+
);
|
|
10531
|
+
const upperTickArrayAddress = await FusionUtils.getTickArrayAddressFromTickIndex(
|
|
10532
|
+
fusionPool,
|
|
10533
|
+
tunaPosition.data.tickUpperIndex
|
|
10534
|
+
);
|
|
10535
|
+
const secondaryTickArrays = await FusionUtils.getTickArraysForRebalancedPosition(fusionPool, tunaPosition);
|
|
10536
|
+
const remainingAccounts = [
|
|
10537
|
+
{ address: swapTickArrays[0], role: import_kit75.AccountRole.WRITABLE },
|
|
10538
|
+
{ address: swapTickArrays[1], role: import_kit75.AccountRole.WRITABLE },
|
|
10539
|
+
{ address: swapTickArrays[2], role: import_kit75.AccountRole.WRITABLE },
|
|
10540
|
+
{ address: swapTickArrays[3], role: import_kit75.AccountRole.WRITABLE },
|
|
10541
|
+
{ address: swapTickArrays[4], role: import_kit75.AccountRole.WRITABLE },
|
|
10542
|
+
{ address: lowerTickArrayAddress, role: import_kit75.AccountRole.WRITABLE },
|
|
10543
|
+
{ address: upperTickArrayAddress, role: import_kit75.AccountRole.WRITABLE },
|
|
10544
|
+
{ address: secondaryTickArrays.lowerTickArrayAddress, role: import_kit75.AccountRole.WRITABLE },
|
|
10545
|
+
{ address: secondaryTickArrays.upperTickArrayAddress, role: import_kit75.AccountRole.WRITABLE },
|
|
10546
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit75.AccountRole.WRITABLE },
|
|
10547
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit75.AccountRole.WRITABLE }
|
|
10548
|
+
];
|
|
10549
|
+
const remainingAccountsInfo = {
|
|
10550
|
+
slices: [
|
|
10551
|
+
{ accountsType: 0 /* SwapTickArrays */, length: 5 },
|
|
10552
|
+
{ accountsType: 1 /* TickArrayLower */, length: 1 },
|
|
10553
|
+
{ accountsType: 2 /* TickArrayUpper */, length: 1 },
|
|
10554
|
+
{ accountsType: 3 /* SecondaryTickArrayLower */, length: 1 },
|
|
10555
|
+
{ accountsType: 4 /* SecondaryTickArrayUpper */, length: 1 },
|
|
10556
|
+
{ accountsType: 5 /* PoolVaultTokenA */, length: 1 },
|
|
10557
|
+
{ accountsType: 6 /* PoolVaultTokenB */, length: 1 }
|
|
10558
|
+
]
|
|
10559
|
+
};
|
|
10560
|
+
const ix = getRebalancePositionFusionInstruction({
|
|
10561
|
+
market: marketAddress,
|
|
10562
|
+
mintA: mintA.address,
|
|
10563
|
+
mintB: mintB.address,
|
|
10564
|
+
pythOraclePriceFeedA: vaultA.data.pythOraclePriceUpdate,
|
|
10565
|
+
pythOraclePriceFeedB: vaultB.data.pythOraclePriceUpdate,
|
|
10566
|
+
vaultA: vaultA.address,
|
|
10567
|
+
vaultB: vaultB.address,
|
|
10568
|
+
authority,
|
|
10569
|
+
tunaConfig: tunaConfig.address,
|
|
10570
|
+
tunaPositionAta,
|
|
10571
|
+
tunaPositionAtaA,
|
|
10572
|
+
tunaPositionAtaB,
|
|
10573
|
+
fusionPosition: fusionPositionAddress,
|
|
10574
|
+
tunaPosition: tunaPosition.address,
|
|
10575
|
+
feeRecipientAtaA,
|
|
10576
|
+
feeRecipientAtaB,
|
|
10577
|
+
fusionPool: fusionPool.address,
|
|
10578
|
+
fusionammProgram: import_fusionamm_client13.FUSIONAMM_PROGRAM_ADDRESS,
|
|
10579
|
+
tokenProgramA: mintA.programAddress,
|
|
10580
|
+
tokenProgramB: mintB.programAddress,
|
|
10581
|
+
memoProgram: import_memo19.MEMO_PROGRAM_ADDRESS,
|
|
10582
|
+
remainingAccountsInfo
|
|
10583
|
+
});
|
|
10584
|
+
ix.accounts.push(...remainingAccounts);
|
|
10585
|
+
return ix;
|
|
10586
|
+
}
|
|
9741
10587
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9742
10588
|
0 && (module.exports = {
|
|
9743
10589
|
ADD_LIQUIDITY_FUSION_DISCRIMINATOR,
|
|
@@ -9780,6 +10626,8 @@ async function repayDebtInstruction(authority, positionMint, mintA, mintB, marke
|
|
|
9780
10626
|
OPEN_POSITION_WITH_LIQUIDITY_FUSION_DISCRIMINATOR,
|
|
9781
10627
|
OPEN_POSITION_WITH_LIQUIDITY_ORCA_DISCRIMINATOR,
|
|
9782
10628
|
OrcaUtils,
|
|
10629
|
+
REBALANCE_POSITION_FUSION_DISCRIMINATOR,
|
|
10630
|
+
REBALANCE_POSITION_ORCA_DISCRIMINATOR,
|
|
9783
10631
|
REMOVE_LIQUIDITY_FUSION_DISCRIMINATOR,
|
|
9784
10632
|
REMOVE_LIQUIDITY_ORCA_DISCRIMINATOR,
|
|
9785
10633
|
REPAY_BAD_DEBT_DISCRIMINATOR,
|
|
@@ -9794,6 +10642,7 @@ async function repayDebtInstruction(authority, positionMint, mintA, mintB, marke
|
|
|
9794
10642
|
SET_OWNER_AUTHORITY_DISCRIMINATOR,
|
|
9795
10643
|
SET_SUSPENDED_STATE_DISCRIMINATOR,
|
|
9796
10644
|
SET_TUNA_POSITION_FLAGS_DISCRIMINATOR,
|
|
10645
|
+
SET_TUNA_POSITION_REBALANCE_THRESHOLD_DISCRIMINATOR,
|
|
9797
10646
|
TUNA_CONFIG_DISCRIMINATOR,
|
|
9798
10647
|
TUNA_ERROR__AMOUNT_SLIPPAGE_EXCEEDED,
|
|
9799
10648
|
TUNA_ERROR__BAD_DEBT,
|
|
@@ -9804,7 +10653,6 @@ async function repayDebtInstruction(authority, positionMint, mintA, mintB, marke
|
|
|
9804
10653
|
TUNA_ERROR__INVALID_MARKET_MAKER,
|
|
9805
10654
|
TUNA_ERROR__INVALID_REMAINING_ACCOUNTS_LENGTH,
|
|
9806
10655
|
TUNA_ERROR__INVALID_SQRT_PRICE_LIMIT_DIRECTION,
|
|
9807
|
-
TUNA_ERROR__INVALID_TICK_ARRAY_ACCOUNTS,
|
|
9808
10656
|
TUNA_ERROR__INVALID_TICK_ARRAY_SEQUENCE,
|
|
9809
10657
|
TUNA_ERROR__LEFTOVERS_EXCEEDED,
|
|
9810
10658
|
TUNA_ERROR__LEVERAGE_IS_OUT_OF_RANGE,
|
|
@@ -9833,6 +10681,7 @@ async function repayDebtInstruction(authority, positionMint, mintA, mintB, marke
|
|
|
9833
10681
|
TUNA_ERROR__RAYDIUM_NOT_ENOUGH_TICK_ARRAY_ACCOUNT,
|
|
9834
10682
|
TUNA_ERROR__RAYDIUM_SQRT_PRICE_LIMIT_OVERFLOW,
|
|
9835
10683
|
TUNA_ERROR__RAYDIUM_ZERO_AMOUNT_SPECIFIED,
|
|
10684
|
+
TUNA_ERROR__REBALANCE_CONDITIONS_NOT_MET,
|
|
9836
10685
|
TUNA_ERROR__REMAINING_ACCOUNTS_DUPLICATED_ACCOUNTS_TYPE,
|
|
9837
10686
|
TUNA_ERROR__REMAINING_ACCOUNTS_INSUFFICIENT,
|
|
9838
10687
|
TUNA_ERROR__REMAINING_ACCOUNTS_INVALID_SLICE,
|
|
@@ -9842,8 +10691,10 @@ async function repayDebtInstruction(authority, positionMint, mintA, mintB, marke
|
|
|
9842
10691
|
TUNA_ERROR__SQRT_PRICE_OUT_OF_BOUNDS,
|
|
9843
10692
|
TUNA_ERROR__SUPPLY_LIMIT_EXCEEDED,
|
|
9844
10693
|
TUNA_ERROR__SUSPENDED,
|
|
10694
|
+
TUNA_ERROR__SWAP_QUOTE_NOT_EQUAL_TO_ACTUAL_SWAP_AMOUNT,
|
|
9845
10695
|
TUNA_ERROR__SWAP_SLIPPAGE_EXCEEDED,
|
|
9846
10696
|
TUNA_ERROR__SWAP_SLIPPAGE_IS_OUT_OF_RANGE,
|
|
10697
|
+
TUNA_ERROR__SWAP_TO_POSITION_RATIO_ESTIMATION_FAILED,
|
|
9847
10698
|
TUNA_ERROR__TICK_INDEX_OF_BOUNDS,
|
|
9848
10699
|
TUNA_ERROR__TRANSFER_FEE_CALCULATION_ERROR,
|
|
9849
10700
|
TUNA_ERROR__TYPE_CAST_OVERFLOW,
|
|
@@ -9857,6 +10708,7 @@ async function repayDebtInstruction(authority, positionMint, mintA, mintB, marke
|
|
|
9857
10708
|
TUNA_ERROR__ZERO_TRADABLE_AMOUNT,
|
|
9858
10709
|
TUNA_ERROR__ZERO_YIELD,
|
|
9859
10710
|
TUNA_POSITION_DISCRIMINATOR,
|
|
10711
|
+
TUNA_POSITION_FLAGS_ALLOW_REBALANCING,
|
|
9860
10712
|
TUNA_POSITION_FLAGS_AUTO_COMPOUND_YIELD,
|
|
9861
10713
|
TUNA_POSITION_FLAGS_AUTO_COMPOUND_YIELD_WITH_LEVERAGE,
|
|
9862
10714
|
TUNA_POSITION_FLAGS_STOP_LOSS_SWAP_TO_TOKEN_A,
|
|
@@ -10045,6 +10897,16 @@ async function repayDebtInstruction(authority, positionMint, mintA, mintB, marke
|
|
|
10045
10897
|
getOpenPositionWithLiquidityOrcaInstructionDataCodec,
|
|
10046
10898
|
getOpenPositionWithLiquidityOrcaInstructionDataDecoder,
|
|
10047
10899
|
getOpenPositionWithLiquidityOrcaInstructionDataEncoder,
|
|
10900
|
+
getRebalancePositionFusionDiscriminatorBytes,
|
|
10901
|
+
getRebalancePositionFusionInstruction,
|
|
10902
|
+
getRebalancePositionFusionInstructionDataCodec,
|
|
10903
|
+
getRebalancePositionFusionInstructionDataDecoder,
|
|
10904
|
+
getRebalancePositionFusionInstructionDataEncoder,
|
|
10905
|
+
getRebalancePositionOrcaDiscriminatorBytes,
|
|
10906
|
+
getRebalancePositionOrcaInstruction,
|
|
10907
|
+
getRebalancePositionOrcaInstructionDataCodec,
|
|
10908
|
+
getRebalancePositionOrcaInstructionDataDecoder,
|
|
10909
|
+
getRebalancePositionOrcaInstructionDataEncoder,
|
|
10048
10910
|
getRemainingAccountsInfoCodec,
|
|
10049
10911
|
getRemainingAccountsInfoDecoder,
|
|
10050
10912
|
getRemainingAccountsInfoEncoder,
|
|
@@ -10121,6 +10983,11 @@ async function repayDebtInstruction(authority, positionMint, mintA, mintB, marke
|
|
|
10121
10983
|
getSetTunaPositionFlagsInstructionDataCodec,
|
|
10122
10984
|
getSetTunaPositionFlagsInstructionDataDecoder,
|
|
10123
10985
|
getSetTunaPositionFlagsInstructionDataEncoder,
|
|
10986
|
+
getSetTunaPositionRebalanceThresholdDiscriminatorBytes,
|
|
10987
|
+
getSetTunaPositionRebalanceThresholdInstruction,
|
|
10988
|
+
getSetTunaPositionRebalanceThresholdInstructionDataCodec,
|
|
10989
|
+
getSetTunaPositionRebalanceThresholdInstructionDataDecoder,
|
|
10990
|
+
getSetTunaPositionRebalanceThresholdInstructionDataEncoder,
|
|
10124
10991
|
getTunaConfigAddress,
|
|
10125
10992
|
getTunaConfigCodec,
|
|
10126
10993
|
getTunaConfigDecoder,
|
|
@@ -10194,6 +11061,8 @@ async function repayDebtInstruction(authority, positionMint, mintA, mintB, marke
|
|
|
10194
11061
|
parseOpenPositionOrcaInstruction,
|
|
10195
11062
|
parseOpenPositionWithLiquidityFusionInstruction,
|
|
10196
11063
|
parseOpenPositionWithLiquidityOrcaInstruction,
|
|
11064
|
+
parseRebalancePositionFusionInstruction,
|
|
11065
|
+
parseRebalancePositionOrcaInstruction,
|
|
10197
11066
|
parseRemoveLiquidityFusionInstruction,
|
|
10198
11067
|
parseRemoveLiquidityOrcaInstruction,
|
|
10199
11068
|
parseRepayBadDebtInstruction,
|
|
@@ -10208,9 +11077,14 @@ async function repayDebtInstruction(authority, positionMint, mintA, mintB, marke
|
|
|
10208
11077
|
parseSetOwnerAuthorityInstruction,
|
|
10209
11078
|
parseSetSuspendedStateInstruction,
|
|
10210
11079
|
parseSetTunaPositionFlagsInstruction,
|
|
11080
|
+
parseSetTunaPositionRebalanceThresholdInstruction,
|
|
10211
11081
|
parseUpdateMarketInstruction,
|
|
10212
11082
|
parseUpdateVaultInstruction,
|
|
10213
11083
|
parseWithdrawInstruction,
|
|
11084
|
+
rebalancePositionFusionInstruction,
|
|
11085
|
+
rebalancePositionFusionInstructions,
|
|
11086
|
+
rebalancePositionOrcaInstruction,
|
|
11087
|
+
rebalancePositionOrcaInstructions,
|
|
10214
11088
|
removeLiquidityFusionInstruction,
|
|
10215
11089
|
removeLiquidityFusionInstructions,
|
|
10216
11090
|
removeLiquidityOrcaInstruction,
|
|
@@ -10218,7 +11092,7 @@ async function repayDebtInstruction(authority, positionMint, mintA, mintB, marke
|
|
|
10218
11092
|
repayBadDebtInstruction,
|
|
10219
11093
|
repayDebtInstruction,
|
|
10220
11094
|
repayDebtInstructions,
|
|
10221
|
-
|
|
11095
|
+
setLimitOrdersInstruction,
|
|
10222
11096
|
tunaPositionAuthorityFilter,
|
|
10223
11097
|
tunaPositionMarketMakerFilter,
|
|
10224
11098
|
tunaPositionMintAFilter,
|