@crypticdot/defituna-client 3.5.12 → 3.6.0
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/dist/index.cjs +497 -534
- package/dist/index.d.cts +67 -69
- package/dist/index.d.ts +67 -69
- package/dist/index.js +299 -343
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -40,11 +40,11 @@ __export(index_exports, {
|
|
|
40
40
|
COLLECT_REWARD_ORCA_DISCRIMINATOR: () => COLLECT_REWARD_ORCA_DISCRIMINATOR,
|
|
41
41
|
COMPUTED_AMOUNT: () => COMPUTED_AMOUNT,
|
|
42
42
|
CREATE_MARKET_DISCRIMINATOR: () => CREATE_MARKET_DISCRIMINATOR,
|
|
43
|
-
|
|
43
|
+
CREATE_MARKET_PERMISSIONLESS_DISCRIMINATOR: () => CREATE_MARKET_PERMISSIONLESS_DISCRIMINATOR,
|
|
44
44
|
CREATE_PRICE_UPDATE_DISCRIMINATOR: () => CREATE_PRICE_UPDATE_DISCRIMINATOR,
|
|
45
45
|
CREATE_TUNA_CONFIG_DISCRIMINATOR: () => CREATE_TUNA_CONFIG_DISCRIMINATOR,
|
|
46
46
|
CREATE_VAULT_DISCRIMINATOR: () => CREATE_VAULT_DISCRIMINATOR,
|
|
47
|
-
|
|
47
|
+
CREATE_VAULT_PERMISSIONLESS_DISCRIMINATOR: () => CREATE_VAULT_PERMISSIONLESS_DISCRIMINATOR,
|
|
48
48
|
DECREASE_TUNA_LP_POSITION_FUSION_DISCRIMINATOR: () => DECREASE_TUNA_LP_POSITION_FUSION_DISCRIMINATOR,
|
|
49
49
|
DECREASE_TUNA_LP_POSITION_ORCA_DISCRIMINATOR: () => DECREASE_TUNA_LP_POSITION_ORCA_DISCRIMINATOR,
|
|
50
50
|
DEFAULT_ADDRESS: () => DEFAULT_ADDRESS,
|
|
@@ -213,10 +213,10 @@ __export(index_exports, {
|
|
|
213
213
|
createAddressLookupTableForMarketInstructions: () => createAddressLookupTableForMarketInstructions,
|
|
214
214
|
createAddressLookupTableInstructions: () => createAddressLookupTableInstructions,
|
|
215
215
|
createMarketInstruction: () => createMarketInstruction,
|
|
216
|
-
|
|
216
|
+
createMarketPermissionlessInstruction: () => createMarketPermissionlessInstruction,
|
|
217
217
|
createTunaConfigInstruction: () => createTunaConfigInstruction,
|
|
218
218
|
createVaultInstructions: () => createVaultInstructions,
|
|
219
|
-
|
|
219
|
+
createVaultPermissionlessInstructions: () => createVaultPermissionlessInstructions,
|
|
220
220
|
decodeLendingPosition: () => decodeLendingPosition,
|
|
221
221
|
decodeMarket: () => decodeMarket,
|
|
222
222
|
decodeTunaConfig: () => decodeTunaConfig,
|
|
@@ -314,11 +314,11 @@ __export(index_exports, {
|
|
|
314
314
|
getCreateMarketInstructionDataCodec: () => getCreateMarketInstructionDataCodec,
|
|
315
315
|
getCreateMarketInstructionDataDecoder: () => getCreateMarketInstructionDataDecoder,
|
|
316
316
|
getCreateMarketInstructionDataEncoder: () => getCreateMarketInstructionDataEncoder,
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
317
|
+
getCreateMarketPermissionlessDiscriminatorBytes: () => getCreateMarketPermissionlessDiscriminatorBytes,
|
|
318
|
+
getCreateMarketPermissionlessInstruction: () => getCreateMarketPermissionlessInstruction,
|
|
319
|
+
getCreateMarketPermissionlessInstructionDataCodec: () => getCreateMarketPermissionlessInstructionDataCodec,
|
|
320
|
+
getCreateMarketPermissionlessInstructionDataDecoder: () => getCreateMarketPermissionlessInstructionDataDecoder,
|
|
321
|
+
getCreateMarketPermissionlessInstructionDataEncoder: () => getCreateMarketPermissionlessInstructionDataEncoder,
|
|
322
322
|
getCreatePriceUpdateDiscriminatorBytes: () => getCreatePriceUpdateDiscriminatorBytes,
|
|
323
323
|
getCreatePriceUpdateInstruction: () => getCreatePriceUpdateInstruction,
|
|
324
324
|
getCreatePriceUpdateInstructionDataCodec: () => getCreatePriceUpdateInstructionDataCodec,
|
|
@@ -334,11 +334,11 @@ __export(index_exports, {
|
|
|
334
334
|
getCreateVaultInstructionDataCodec: () => getCreateVaultInstructionDataCodec,
|
|
335
335
|
getCreateVaultInstructionDataDecoder: () => getCreateVaultInstructionDataDecoder,
|
|
336
336
|
getCreateVaultInstructionDataEncoder: () => getCreateVaultInstructionDataEncoder,
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
337
|
+
getCreateVaultPermissionlessDiscriminatorBytes: () => getCreateVaultPermissionlessDiscriminatorBytes,
|
|
338
|
+
getCreateVaultPermissionlessInstruction: () => getCreateVaultPermissionlessInstruction,
|
|
339
|
+
getCreateVaultPermissionlessInstructionDataCodec: () => getCreateVaultPermissionlessInstructionDataCodec,
|
|
340
|
+
getCreateVaultPermissionlessInstructionDataDecoder: () => getCreateVaultPermissionlessInstructionDataDecoder,
|
|
341
|
+
getCreateVaultPermissionlessInstructionDataEncoder: () => getCreateVaultPermissionlessInstructionDataEncoder,
|
|
342
342
|
getDecreaseTunaLpPositionFusionDiscriminatorBytes: () => getDecreaseTunaLpPositionFusionDiscriminatorBytes,
|
|
343
343
|
getDecreaseTunaLpPositionFusionInstruction: () => getDecreaseTunaLpPositionFusionInstruction,
|
|
344
344
|
getDecreaseTunaLpPositionFusionInstructionDataCodec: () => getDecreaseTunaLpPositionFusionInstructionDataCodec,
|
|
@@ -371,7 +371,6 @@ __export(index_exports, {
|
|
|
371
371
|
getLendingPositionEncoder: () => getLendingPositionEncoder,
|
|
372
372
|
getLendingPositionSize: () => getLendingPositionSize,
|
|
373
373
|
getLendingVaultAddress: () => getLendingVaultAddress,
|
|
374
|
-
getLendingVaultV2Address: () => getLendingVaultV2Address,
|
|
375
374
|
getLiquidateTunaLpPositionFusionDiscriminatorBytes: () => getLiquidateTunaLpPositionFusionDiscriminatorBytes,
|
|
376
375
|
getLiquidateTunaLpPositionFusionInstruction: () => getLiquidateTunaLpPositionFusionInstruction,
|
|
377
376
|
getLiquidateTunaLpPositionFusionInstructionDataCodec: () => getLiquidateTunaLpPositionFusionInstructionDataCodec,
|
|
@@ -683,11 +682,11 @@ __export(index_exports, {
|
|
|
683
682
|
parseCollectFeesOrcaInstruction: () => parseCollectFeesOrcaInstruction,
|
|
684
683
|
parseCollectRewardOrcaInstruction: () => parseCollectRewardOrcaInstruction,
|
|
685
684
|
parseCreateMarketInstruction: () => parseCreateMarketInstruction,
|
|
686
|
-
|
|
685
|
+
parseCreateMarketPermissionlessInstruction: () => parseCreateMarketPermissionlessInstruction,
|
|
687
686
|
parseCreatePriceUpdateInstruction: () => parseCreatePriceUpdateInstruction,
|
|
688
687
|
parseCreateTunaConfigInstruction: () => parseCreateTunaConfigInstruction,
|
|
689
688
|
parseCreateVaultInstruction: () => parseCreateVaultInstruction,
|
|
690
|
-
|
|
689
|
+
parseCreateVaultPermissionlessInstruction: () => parseCreateVaultPermissionlessInstruction,
|
|
691
690
|
parseDecreaseTunaLpPositionFusionInstruction: () => parseDecreaseTunaLpPositionFusionInstruction,
|
|
692
691
|
parseDecreaseTunaLpPositionOrcaInstruction: () => parseDecreaseTunaLpPositionOrcaInstruction,
|
|
693
692
|
parseDepositInstruction: () => parseDepositInstruction,
|
|
@@ -1031,7 +1030,8 @@ function getMarketEncoder() {
|
|
|
1031
1030
|
["vaultB", (0, import_kit9.getAddressEncoder)()],
|
|
1032
1031
|
["badDebtA", (0, import_kit9.getU64Encoder)()],
|
|
1033
1032
|
["badDebtB", (0, import_kit9.getU64Encoder)()],
|
|
1034
|
-
["
|
|
1033
|
+
["authority", (0, import_kit9.getAddressEncoder)()],
|
|
1034
|
+
["reserved", (0, import_kit9.fixEncoderSize)((0, import_kit9.getBytesEncoder)(), 79)]
|
|
1035
1035
|
]),
|
|
1036
1036
|
(value) => ({ ...value, discriminator: MARKET_DISCRIMINATOR })
|
|
1037
1037
|
);
|
|
@@ -1064,7 +1064,8 @@ function getMarketDecoder() {
|
|
|
1064
1064
|
["vaultB", (0, import_kit9.getAddressDecoder)()],
|
|
1065
1065
|
["badDebtA", (0, import_kit9.getU64Decoder)()],
|
|
1066
1066
|
["badDebtB", (0, import_kit9.getU64Decoder)()],
|
|
1067
|
-
["
|
|
1067
|
+
["authority", (0, import_kit9.getAddressDecoder)()],
|
|
1068
|
+
["reserved", (0, import_kit9.fixDecoderSize)((0, import_kit9.getBytesDecoder)(), 79)]
|
|
1068
1069
|
]);
|
|
1069
1070
|
}
|
|
1070
1071
|
function getMarketCodec() {
|
|
@@ -1531,8 +1532,9 @@ function getVaultEncoder() {
|
|
|
1531
1532
|
["supplyLimit", (0, import_kit14.getU64Encoder)()],
|
|
1532
1533
|
["oraclePriceUpdate", (0, import_kit14.getAddressEncoder)()],
|
|
1533
1534
|
["pythOracleFeedId", (0, import_kit14.getAddressEncoder)()],
|
|
1534
|
-
["
|
|
1535
|
-
["
|
|
1535
|
+
["authority", (0, import_kit14.getAddressEncoder)()],
|
|
1536
|
+
["market", (0, import_kit14.getAddressEncoder)()],
|
|
1537
|
+
["reserved", (0, import_kit14.fixEncoderSize)((0, import_kit14.getBytesEncoder)(), 120)]
|
|
1536
1538
|
]),
|
|
1537
1539
|
(value) => ({ ...value, discriminator: VAULT_DISCRIMINATOR })
|
|
1538
1540
|
);
|
|
@@ -1553,8 +1555,9 @@ function getVaultDecoder() {
|
|
|
1553
1555
|
["supplyLimit", (0, import_kit14.getU64Decoder)()],
|
|
1554
1556
|
["oraclePriceUpdate", (0, import_kit14.getAddressDecoder)()],
|
|
1555
1557
|
["pythOracleFeedId", (0, import_kit14.getAddressDecoder)()],
|
|
1556
|
-
["
|
|
1557
|
-
["
|
|
1558
|
+
["authority", (0, import_kit14.getAddressDecoder)()],
|
|
1559
|
+
["market", (0, import_kit14.getAddressDecoder)()],
|
|
1560
|
+
["reserved", (0, import_kit14.fixDecoderSize)((0, import_kit14.getBytesDecoder)(), 120)]
|
|
1558
1561
|
]);
|
|
1559
1562
|
}
|
|
1560
1563
|
function getVaultCodec() {
|
|
@@ -1683,11 +1686,11 @@ var TunaInstruction = /* @__PURE__ */ ((TunaInstruction2) => {
|
|
|
1683
1686
|
TunaInstruction2[TunaInstruction2["CollectFeesOrca"] = 6] = "CollectFeesOrca";
|
|
1684
1687
|
TunaInstruction2[TunaInstruction2["CollectRewardOrca"] = 7] = "CollectRewardOrca";
|
|
1685
1688
|
TunaInstruction2[TunaInstruction2["CreateMarket"] = 8] = "CreateMarket";
|
|
1686
|
-
TunaInstruction2[TunaInstruction2["
|
|
1689
|
+
TunaInstruction2[TunaInstruction2["CreateMarketPermissionless"] = 9] = "CreateMarketPermissionless";
|
|
1687
1690
|
TunaInstruction2[TunaInstruction2["CreatePriceUpdate"] = 10] = "CreatePriceUpdate";
|
|
1688
1691
|
TunaInstruction2[TunaInstruction2["CreateTunaConfig"] = 11] = "CreateTunaConfig";
|
|
1689
1692
|
TunaInstruction2[TunaInstruction2["CreateVault"] = 12] = "CreateVault";
|
|
1690
|
-
TunaInstruction2[TunaInstruction2["
|
|
1693
|
+
TunaInstruction2[TunaInstruction2["CreateVaultPermissionless"] = 13] = "CreateVaultPermissionless";
|
|
1691
1694
|
TunaInstruction2[TunaInstruction2["DecreaseTunaLpPositionFusion"] = 14] = "DecreaseTunaLpPositionFusion";
|
|
1692
1695
|
TunaInstruction2[TunaInstruction2["DecreaseTunaLpPositionOrca"] = 15] = "DecreaseTunaLpPositionOrca";
|
|
1693
1696
|
TunaInstruction2[TunaInstruction2["Deposit"] = 16] = "Deposit";
|
|
@@ -1822,11 +1825,11 @@ function identifyTunaInstruction(instruction) {
|
|
|
1822
1825
|
if ((0, import_kit15.containsBytes)(
|
|
1823
1826
|
data,
|
|
1824
1827
|
(0, import_kit15.fixEncoderSize)((0, import_kit15.getBytesEncoder)(), 8).encode(
|
|
1825
|
-
new Uint8Array([
|
|
1828
|
+
new Uint8Array([72, 192, 190, 142, 105, 151, 2, 80])
|
|
1826
1829
|
),
|
|
1827
1830
|
0
|
|
1828
1831
|
)) {
|
|
1829
|
-
return 9 /*
|
|
1832
|
+
return 9 /* CreateMarketPermissionless */;
|
|
1830
1833
|
}
|
|
1831
1834
|
if ((0, import_kit15.containsBytes)(
|
|
1832
1835
|
data,
|
|
@@ -1858,11 +1861,11 @@ function identifyTunaInstruction(instruction) {
|
|
|
1858
1861
|
if ((0, import_kit15.containsBytes)(
|
|
1859
1862
|
data,
|
|
1860
1863
|
(0, import_kit15.fixEncoderSize)((0, import_kit15.getBytesEncoder)(), 8).encode(
|
|
1861
|
-
new Uint8Array([
|
|
1864
|
+
new Uint8Array([85, 69, 196, 28, 252, 85, 47, 3])
|
|
1862
1865
|
),
|
|
1863
1866
|
0
|
|
1864
1867
|
)) {
|
|
1865
|
-
return 13 /*
|
|
1868
|
+
return 13 /* CreateVaultPermissionless */;
|
|
1866
1869
|
}
|
|
1867
1870
|
if ((0, import_kit15.containsBytes)(
|
|
1868
1871
|
data,
|
|
@@ -3706,47 +3709,48 @@ function parseCreateMarketInstruction(instruction) {
|
|
|
3706
3709
|
};
|
|
3707
3710
|
}
|
|
3708
3711
|
|
|
3709
|
-
// src/generated/instructions/
|
|
3712
|
+
// src/generated/instructions/createMarketPermissionless.ts
|
|
3710
3713
|
var import_kit27 = require("@solana/kit");
|
|
3711
|
-
var
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3714
|
+
var CREATE_MARKET_PERMISSIONLESS_DISCRIMINATOR = new Uint8Array([
|
|
3715
|
+
72,
|
|
3716
|
+
192,
|
|
3717
|
+
190,
|
|
3718
|
+
142,
|
|
3719
|
+
105,
|
|
3720
|
+
151,
|
|
3721
|
+
2,
|
|
3722
|
+
80
|
|
3720
3723
|
]);
|
|
3721
|
-
function
|
|
3724
|
+
function getCreateMarketPermissionlessDiscriminatorBytes() {
|
|
3722
3725
|
return (0, import_kit27.fixEncoderSize)((0, import_kit27.getBytesEncoder)(), 8).encode(
|
|
3723
|
-
|
|
3726
|
+
CREATE_MARKET_PERMISSIONLESS_DISCRIMINATOR
|
|
3724
3727
|
);
|
|
3725
3728
|
}
|
|
3726
|
-
function
|
|
3729
|
+
function getCreateMarketPermissionlessInstructionDataEncoder() {
|
|
3727
3730
|
return (0, import_kit27.transformEncoder)(
|
|
3728
3731
|
(0, import_kit27.getStructEncoder)([
|
|
3729
3732
|
["discriminator", (0, import_kit27.fixEncoderSize)((0, import_kit27.getBytesEncoder)(), 8)],
|
|
3730
|
-
["addressLookupTable", (0, import_kit27.getAddressEncoder)()]
|
|
3731
|
-
["maxLeverage", (0, import_kit27.getU32Encoder)()]
|
|
3733
|
+
["addressLookupTable", (0, import_kit27.getAddressEncoder)()]
|
|
3732
3734
|
]),
|
|
3733
|
-
(value) => ({
|
|
3735
|
+
(value) => ({
|
|
3736
|
+
...value,
|
|
3737
|
+
discriminator: CREATE_MARKET_PERMISSIONLESS_DISCRIMINATOR
|
|
3738
|
+
})
|
|
3734
3739
|
);
|
|
3735
3740
|
}
|
|
3736
|
-
function
|
|
3741
|
+
function getCreateMarketPermissionlessInstructionDataDecoder() {
|
|
3737
3742
|
return (0, import_kit27.getStructDecoder)([
|
|
3738
3743
|
["discriminator", (0, import_kit27.fixDecoderSize)((0, import_kit27.getBytesDecoder)(), 8)],
|
|
3739
|
-
["addressLookupTable", (0, import_kit27.getAddressDecoder)()]
|
|
3740
|
-
["maxLeverage", (0, import_kit27.getU32Decoder)()]
|
|
3744
|
+
["addressLookupTable", (0, import_kit27.getAddressDecoder)()]
|
|
3741
3745
|
]);
|
|
3742
3746
|
}
|
|
3743
|
-
function
|
|
3747
|
+
function getCreateMarketPermissionlessInstructionDataCodec() {
|
|
3744
3748
|
return (0, import_kit27.combineCodec)(
|
|
3745
|
-
|
|
3746
|
-
|
|
3749
|
+
getCreateMarketPermissionlessInstructionDataEncoder(),
|
|
3750
|
+
getCreateMarketPermissionlessInstructionDataDecoder()
|
|
3747
3751
|
);
|
|
3748
3752
|
}
|
|
3749
|
-
function
|
|
3753
|
+
function getCreateMarketPermissionlessInstruction(input, config) {
|
|
3750
3754
|
const programAddress = config?.programAddress ?? TUNA_PROGRAM_ADDRESS;
|
|
3751
3755
|
const originalAccounts = {
|
|
3752
3756
|
authority: { value: input.authority ?? null, isWritable: true },
|
|
@@ -3774,13 +3778,13 @@ function getCreateMarketV2Instruction(input, config) {
|
|
|
3774
3778
|
getAccountMeta(accounts.systemProgram)
|
|
3775
3779
|
],
|
|
3776
3780
|
programAddress,
|
|
3777
|
-
data:
|
|
3781
|
+
data: getCreateMarketPermissionlessInstructionDataEncoder().encode(
|
|
3778
3782
|
args
|
|
3779
3783
|
)
|
|
3780
3784
|
};
|
|
3781
3785
|
return instruction;
|
|
3782
3786
|
}
|
|
3783
|
-
function
|
|
3787
|
+
function parseCreateMarketPermissionlessInstruction(instruction) {
|
|
3784
3788
|
if (instruction.accounts.length < 7) {
|
|
3785
3789
|
throw new Error("Not enough accounts");
|
|
3786
3790
|
}
|
|
@@ -3801,7 +3805,9 @@ function parseCreateMarketV2Instruction(instruction) {
|
|
|
3801
3805
|
pool: getNextAccount(),
|
|
3802
3806
|
systemProgram: getNextAccount()
|
|
3803
3807
|
},
|
|
3804
|
-
data:
|
|
3808
|
+
data: getCreateMarketPermissionlessInstructionDataDecoder().decode(
|
|
3809
|
+
instruction.data
|
|
3810
|
+
)
|
|
3805
3811
|
};
|
|
3806
3812
|
}
|
|
3807
3813
|
|
|
@@ -4096,55 +4102,50 @@ function parseCreateVaultInstruction(instruction) {
|
|
|
4096
4102
|
};
|
|
4097
4103
|
}
|
|
4098
4104
|
|
|
4099
|
-
// src/generated/instructions/
|
|
4105
|
+
// src/generated/instructions/createVaultPermissionless.ts
|
|
4100
4106
|
var import_kit31 = require("@solana/kit");
|
|
4101
|
-
var
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4107
|
+
var CREATE_VAULT_PERMISSIONLESS_DISCRIMINATOR = new Uint8Array([
|
|
4108
|
+
85,
|
|
4109
|
+
69,
|
|
4110
|
+
196,
|
|
4111
|
+
28,
|
|
4112
|
+
252,
|
|
4113
|
+
85,
|
|
4114
|
+
47,
|
|
4115
|
+
3
|
|
4110
4116
|
]);
|
|
4111
|
-
function
|
|
4117
|
+
function getCreateVaultPermissionlessDiscriminatorBytes() {
|
|
4112
4118
|
return (0, import_kit31.fixEncoderSize)((0, import_kit31.getBytesEncoder)(), 8).encode(
|
|
4113
|
-
|
|
4119
|
+
CREATE_VAULT_PERMISSIONLESS_DISCRIMINATOR
|
|
4114
4120
|
);
|
|
4115
4121
|
}
|
|
4116
|
-
function
|
|
4122
|
+
function getCreateVaultPermissionlessInstructionDataEncoder() {
|
|
4117
4123
|
return (0, import_kit31.transformEncoder)(
|
|
4118
4124
|
(0, import_kit31.getStructEncoder)([
|
|
4119
4125
|
["discriminator", (0, import_kit31.fixEncoderSize)((0, import_kit31.getBytesEncoder)(), 8)],
|
|
4120
|
-
["
|
|
4121
|
-
["interestRate", (0, import_kit31.getU64Encoder)()]
|
|
4122
|
-
["supplyLimit", (0, import_kit31.getU64Encoder)()],
|
|
4123
|
-
["oraclePriceUpdate", (0, import_kit31.getAddressEncoder)()],
|
|
4124
|
-
["pythOracleFeedId", (0, import_kit31.getAddressEncoder)()],
|
|
4125
|
-
["allowUnsafeTokenExtensions", (0, import_kit31.getBooleanEncoder)()]
|
|
4126
|
+
["market", (0, import_kit31.getAddressEncoder)()],
|
|
4127
|
+
["interestRate", (0, import_kit31.getU64Encoder)()]
|
|
4126
4128
|
]),
|
|
4127
|
-
(value) => ({
|
|
4129
|
+
(value) => ({
|
|
4130
|
+
...value,
|
|
4131
|
+
discriminator: CREATE_VAULT_PERMISSIONLESS_DISCRIMINATOR
|
|
4132
|
+
})
|
|
4128
4133
|
);
|
|
4129
4134
|
}
|
|
4130
|
-
function
|
|
4135
|
+
function getCreateVaultPermissionlessInstructionDataDecoder() {
|
|
4131
4136
|
return (0, import_kit31.getStructDecoder)([
|
|
4132
4137
|
["discriminator", (0, import_kit31.fixDecoderSize)((0, import_kit31.getBytesDecoder)(), 8)],
|
|
4133
|
-
["
|
|
4134
|
-
["interestRate", (0, import_kit31.getU64Decoder)()]
|
|
4135
|
-
["supplyLimit", (0, import_kit31.getU64Decoder)()],
|
|
4136
|
-
["oraclePriceUpdate", (0, import_kit31.getAddressDecoder)()],
|
|
4137
|
-
["pythOracleFeedId", (0, import_kit31.getAddressDecoder)()],
|
|
4138
|
-
["allowUnsafeTokenExtensions", (0, import_kit31.getBooleanDecoder)()]
|
|
4138
|
+
["market", (0, import_kit31.getAddressDecoder)()],
|
|
4139
|
+
["interestRate", (0, import_kit31.getU64Decoder)()]
|
|
4139
4140
|
]);
|
|
4140
4141
|
}
|
|
4141
|
-
function
|
|
4142
|
+
function getCreateVaultPermissionlessInstructionDataCodec() {
|
|
4142
4143
|
return (0, import_kit31.combineCodec)(
|
|
4143
|
-
|
|
4144
|
-
|
|
4144
|
+
getCreateVaultPermissionlessInstructionDataEncoder(),
|
|
4145
|
+
getCreateVaultPermissionlessInstructionDataDecoder()
|
|
4145
4146
|
);
|
|
4146
4147
|
}
|
|
4147
|
-
function
|
|
4148
|
+
function getCreateVaultPermissionlessInstruction(input, config) {
|
|
4148
4149
|
const programAddress = config?.programAddress ?? TUNA_PROGRAM_ADDRESS;
|
|
4149
4150
|
const originalAccounts = {
|
|
4150
4151
|
authority: { value: input.authority ?? null, isWritable: true },
|
|
@@ -4175,13 +4176,13 @@ function getCreateVaultV2Instruction(input, config) {
|
|
|
4175
4176
|
getAccountMeta(accounts.systemProgram)
|
|
4176
4177
|
],
|
|
4177
4178
|
programAddress,
|
|
4178
|
-
data:
|
|
4179
|
+
data: getCreateVaultPermissionlessInstructionDataEncoder().encode(
|
|
4179
4180
|
args
|
|
4180
4181
|
)
|
|
4181
4182
|
};
|
|
4182
4183
|
return instruction;
|
|
4183
4184
|
}
|
|
4184
|
-
function
|
|
4185
|
+
function parseCreateVaultPermissionlessInstruction(instruction) {
|
|
4185
4186
|
if (instruction.accounts.length < 7) {
|
|
4186
4187
|
throw new Error("Not enough accounts");
|
|
4187
4188
|
}
|
|
@@ -4202,7 +4203,9 @@ function parseCreateVaultV2Instruction(instruction) {
|
|
|
4202
4203
|
tokenProgram: getNextAccount(),
|
|
4203
4204
|
systemProgram: getNextAccount()
|
|
4204
4205
|
},
|
|
4205
|
-
data:
|
|
4206
|
+
data: getCreateVaultPermissionlessInstructionDataDecoder().decode(
|
|
4207
|
+
instruction.data
|
|
4208
|
+
)
|
|
4206
4209
|
};
|
|
4207
4210
|
}
|
|
4208
4211
|
|
|
@@ -10090,7 +10093,6 @@ function parseWithdrawInstruction(instruction) {
|
|
|
10090
10093
|
|
|
10091
10094
|
// src/pda.ts
|
|
10092
10095
|
var import_kit79 = require("@solana/kit");
|
|
10093
|
-
var import_kit80 = require("@solana/kit");
|
|
10094
10096
|
|
|
10095
10097
|
// src/consts.ts
|
|
10096
10098
|
var import_kit78 = require("@solana/kit");
|
|
@@ -10123,51 +10125,45 @@ var MAX_SQRT_PRICE = 79226673515401279992447579055n;
|
|
|
10123
10125
|
|
|
10124
10126
|
// src/pda.ts
|
|
10125
10127
|
async function getTunaConfigAddress() {
|
|
10126
|
-
return await (0,
|
|
10128
|
+
return await (0, import_kit79.getProgramDerivedAddress)({
|
|
10127
10129
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
10128
10130
|
seeds: ["tuna_config"]
|
|
10129
10131
|
});
|
|
10130
10132
|
}
|
|
10131
10133
|
async function getMarketAddress(pool) {
|
|
10132
|
-
return await (0,
|
|
10134
|
+
return await (0, import_kit79.getProgramDerivedAddress)({
|
|
10133
10135
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
10134
|
-
seeds: ["market", (0,
|
|
10136
|
+
seeds: ["market", (0, import_kit79.getAddressEncoder)().encode(pool)]
|
|
10135
10137
|
});
|
|
10136
10138
|
}
|
|
10137
|
-
async function getLendingVaultAddress(mint) {
|
|
10138
|
-
return await (0,
|
|
10139
|
+
async function getLendingVaultAddress(mint, market) {
|
|
10140
|
+
return await (0, import_kit79.getProgramDerivedAddress)({
|
|
10139
10141
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
10140
|
-
seeds: ["vault", (0,
|
|
10141
|
-
});
|
|
10142
|
-
}
|
|
10143
|
-
async function getLendingVaultV2Address(mint, id) {
|
|
10144
|
-
return await (0, import_kit80.getProgramDerivedAddress)({
|
|
10145
|
-
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
10146
|
-
seeds: ["vault", (0, import_kit80.getAddressEncoder)().encode(mint), (0, import_kit79.getU32Encoder)().encode(id)]
|
|
10142
|
+
seeds: market ? ["vault", (0, import_kit79.getAddressEncoder)().encode(mint), (0, import_kit79.getAddressEncoder)().encode(market)] : ["vault", (0, import_kit79.getAddressEncoder)().encode(mint)]
|
|
10147
10143
|
});
|
|
10148
10144
|
}
|
|
10149
10145
|
async function getLendingPositionAddress(authority, mintOrVault) {
|
|
10150
|
-
return await (0,
|
|
10146
|
+
return await (0, import_kit79.getProgramDerivedAddress)({
|
|
10151
10147
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
10152
|
-
seeds: ["lending_position", (0,
|
|
10148
|
+
seeds: ["lending_position", (0, import_kit79.getAddressEncoder)().encode(authority), (0, import_kit79.getAddressEncoder)().encode(mintOrVault)]
|
|
10153
10149
|
});
|
|
10154
10150
|
}
|
|
10155
10151
|
async function getTunaLpPositionAddress(positionMint) {
|
|
10156
|
-
return await (0,
|
|
10152
|
+
return await (0, import_kit79.getProgramDerivedAddress)({
|
|
10157
10153
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
10158
|
-
seeds: ["tuna_position", (0,
|
|
10154
|
+
seeds: ["tuna_position", (0, import_kit79.getAddressEncoder)().encode(positionMint)]
|
|
10159
10155
|
});
|
|
10160
10156
|
}
|
|
10161
10157
|
async function getTunaSpotPositionAddress(authority, pool) {
|
|
10162
|
-
return await (0,
|
|
10158
|
+
return await (0, import_kit79.getProgramDerivedAddress)({
|
|
10163
10159
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
10164
|
-
seeds: ["tuna_spot_position", (0,
|
|
10160
|
+
seeds: ["tuna_spot_position", (0, import_kit79.getAddressEncoder)().encode(authority), (0, import_kit79.getAddressEncoder)().encode(pool)]
|
|
10165
10161
|
});
|
|
10166
10162
|
}
|
|
10167
10163
|
async function getTunaPriceUpdateAddress(mint) {
|
|
10168
|
-
return await (0,
|
|
10164
|
+
return await (0, import_kit79.getProgramDerivedAddress)({
|
|
10169
10165
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
10170
|
-
seeds: ["tuna_price_update", (0,
|
|
10166
|
+
seeds: ["tuna_price_update", (0, import_kit79.getAddressEncoder)().encode(mint)]
|
|
10171
10167
|
});
|
|
10172
10168
|
}
|
|
10173
10169
|
async function getPythPriceUpdateAccountAddress(shardId, priceFeedId) {
|
|
@@ -10183,23 +10179,23 @@ async function getPythPriceUpdateAccountAddress(shardId, priceFeedId) {
|
|
|
10183
10179
|
}
|
|
10184
10180
|
const shardBuffer = Buffer.alloc(2);
|
|
10185
10181
|
shardBuffer.writeUint16LE(shardId, 0);
|
|
10186
|
-
return await (0,
|
|
10182
|
+
return await (0, import_kit79.getProgramDerivedAddress)({
|
|
10187
10183
|
programAddress: DEFAULT_PUSH_ORACLE_PROGRAM_ID,
|
|
10188
10184
|
seeds: [shardBuffer, priceFeedId]
|
|
10189
10185
|
});
|
|
10190
10186
|
}
|
|
10191
10187
|
|
|
10192
10188
|
// src/gpa/tunaLpPosition.ts
|
|
10193
|
-
var
|
|
10189
|
+
var import_kit81 = require("@solana/kit");
|
|
10194
10190
|
|
|
10195
10191
|
// src/gpa/utils.ts
|
|
10196
|
-
var
|
|
10192
|
+
var import_kit80 = require("@solana/kit");
|
|
10197
10193
|
async function fetchDecodedProgramAccounts(rpc, programAddress, filters, decoder) {
|
|
10198
10194
|
const accountInfos = await rpc.getProgramAccounts(programAddress, {
|
|
10199
10195
|
encoding: "base64",
|
|
10200
10196
|
filters
|
|
10201
10197
|
}).send();
|
|
10202
|
-
const encoder = (0,
|
|
10198
|
+
const encoder = (0, import_kit80.getBase64Encoder)();
|
|
10203
10199
|
const datas = accountInfos.map((x) => encoder.encode(x.account.data[0]));
|
|
10204
10200
|
const decoded = datas.map((x) => decoder.decode(x));
|
|
10205
10201
|
return decoded.map((data, i) => ({
|
|
@@ -10215,7 +10211,7 @@ function tunaLpPositionAuthorityFilter(address8) {
|
|
|
10215
10211
|
return {
|
|
10216
10212
|
memcmp: {
|
|
10217
10213
|
offset: 11n,
|
|
10218
|
-
bytes: (0,
|
|
10214
|
+
bytes: (0, import_kit81.getBase58Decoder)().decode((0, import_kit81.getAddressEncoder)().encode(address8)),
|
|
10219
10215
|
encoding: "base58"
|
|
10220
10216
|
}
|
|
10221
10217
|
};
|
|
@@ -10224,7 +10220,7 @@ function tunaLpPositionPoolFilter(address8) {
|
|
|
10224
10220
|
return {
|
|
10225
10221
|
memcmp: {
|
|
10226
10222
|
offset: 43n,
|
|
10227
|
-
bytes: (0,
|
|
10223
|
+
bytes: (0, import_kit81.getBase58Decoder)().decode((0, import_kit81.getAddressEncoder)().encode(address8)),
|
|
10228
10224
|
encoding: "base58"
|
|
10229
10225
|
}
|
|
10230
10226
|
};
|
|
@@ -10233,7 +10229,7 @@ function tunaLpPositionMintAFilter(address8) {
|
|
|
10233
10229
|
return {
|
|
10234
10230
|
memcmp: {
|
|
10235
10231
|
offset: 75n,
|
|
10236
|
-
bytes: (0,
|
|
10232
|
+
bytes: (0, import_kit81.getBase58Decoder)().decode((0, import_kit81.getAddressEncoder)().encode(address8)),
|
|
10237
10233
|
encoding: "base58"
|
|
10238
10234
|
}
|
|
10239
10235
|
};
|
|
@@ -10242,7 +10238,7 @@ function tunaLpPositionMintBFilter(address8) {
|
|
|
10242
10238
|
return {
|
|
10243
10239
|
memcmp: {
|
|
10244
10240
|
offset: 107n,
|
|
10245
|
-
bytes: (0,
|
|
10241
|
+
bytes: (0, import_kit81.getBase58Decoder)().decode((0, import_kit81.getAddressEncoder)().encode(address8)),
|
|
10246
10242
|
encoding: "base58"
|
|
10247
10243
|
}
|
|
10248
10244
|
};
|
|
@@ -10251,7 +10247,7 @@ function tunaLpPositionMintFilter(address8) {
|
|
|
10251
10247
|
return {
|
|
10252
10248
|
memcmp: {
|
|
10253
10249
|
offset: 139n,
|
|
10254
|
-
bytes: (0,
|
|
10250
|
+
bytes: (0, import_kit81.getBase58Decoder)().decode((0, import_kit81.getAddressEncoder)().encode(address8)),
|
|
10255
10251
|
encoding: "base58"
|
|
10256
10252
|
}
|
|
10257
10253
|
};
|
|
@@ -10260,13 +10256,13 @@ function tunaLpPositionMarketMakerFilter(marketMaker) {
|
|
|
10260
10256
|
return {
|
|
10261
10257
|
memcmp: {
|
|
10262
10258
|
offset: 277n,
|
|
10263
|
-
bytes: (0,
|
|
10259
|
+
bytes: (0, import_kit81.getBase58Decoder)().decode((0, import_kit81.getI8Encoder)().encode(marketMaker)),
|
|
10264
10260
|
encoding: "base58"
|
|
10265
10261
|
}
|
|
10266
10262
|
};
|
|
10267
10263
|
}
|
|
10268
10264
|
async function fetchAllTunaLpPositionWithFilter(rpc, ...filters) {
|
|
10269
|
-
const discriminator = (0,
|
|
10265
|
+
const discriminator = (0, import_kit81.getBase58Decoder)().decode(TUNA_LP_POSITION_DISCRIMINATOR);
|
|
10270
10266
|
const discriminatorFilter = {
|
|
10271
10267
|
memcmp: {
|
|
10272
10268
|
offset: 0n,
|
|
@@ -10283,12 +10279,12 @@ async function fetchAllTunaLpPositionWithFilter(rpc, ...filters) {
|
|
|
10283
10279
|
}
|
|
10284
10280
|
|
|
10285
10281
|
// src/gpa/tunaSpotPosition.ts
|
|
10286
|
-
var
|
|
10282
|
+
var import_kit82 = require("@solana/kit");
|
|
10287
10283
|
function tunaSpotPositionAuthorityFilter(address8) {
|
|
10288
10284
|
return {
|
|
10289
10285
|
memcmp: {
|
|
10290
10286
|
offset: 11n,
|
|
10291
|
-
bytes: (0,
|
|
10287
|
+
bytes: (0, import_kit82.getBase58Decoder)().decode((0, import_kit82.getAddressEncoder)().encode(address8)),
|
|
10292
10288
|
encoding: "base58"
|
|
10293
10289
|
}
|
|
10294
10290
|
};
|
|
@@ -10297,7 +10293,7 @@ function tunaSpotPositionPoolFilter(address8) {
|
|
|
10297
10293
|
return {
|
|
10298
10294
|
memcmp: {
|
|
10299
10295
|
offset: 43n,
|
|
10300
|
-
bytes: (0,
|
|
10296
|
+
bytes: (0, import_kit82.getBase58Decoder)().decode((0, import_kit82.getAddressEncoder)().encode(address8)),
|
|
10301
10297
|
encoding: "base58"
|
|
10302
10298
|
}
|
|
10303
10299
|
};
|
|
@@ -10306,7 +10302,7 @@ function tunaSpotPositionMintAFilter(address8) {
|
|
|
10306
10302
|
return {
|
|
10307
10303
|
memcmp: {
|
|
10308
10304
|
offset: 75n,
|
|
10309
|
-
bytes: (0,
|
|
10305
|
+
bytes: (0, import_kit82.getBase58Decoder)().decode((0, import_kit82.getAddressEncoder)().encode(address8)),
|
|
10310
10306
|
encoding: "base58"
|
|
10311
10307
|
}
|
|
10312
10308
|
};
|
|
@@ -10315,13 +10311,13 @@ function tunaSpotPositionMintBFilter(address8) {
|
|
|
10315
10311
|
return {
|
|
10316
10312
|
memcmp: {
|
|
10317
10313
|
offset: 107n,
|
|
10318
|
-
bytes: (0,
|
|
10314
|
+
bytes: (0, import_kit82.getBase58Decoder)().decode((0, import_kit82.getAddressEncoder)().encode(address8)),
|
|
10319
10315
|
encoding: "base58"
|
|
10320
10316
|
}
|
|
10321
10317
|
};
|
|
10322
10318
|
}
|
|
10323
10319
|
async function fetchAllTunaSpotPositionWithFilter(rpc, ...filters) {
|
|
10324
|
-
const discriminator = (0,
|
|
10320
|
+
const discriminator = (0, import_kit82.getBase58Decoder)().decode(TUNA_SPOT_POSITION_DISCRIMINATOR);
|
|
10325
10321
|
const discriminatorFilter = {
|
|
10326
10322
|
memcmp: {
|
|
10327
10323
|
offset: 0n,
|
|
@@ -10338,12 +10334,12 @@ async function fetchAllTunaSpotPositionWithFilter(rpc, ...filters) {
|
|
|
10338
10334
|
}
|
|
10339
10335
|
|
|
10340
10336
|
// src/gpa/lendingPosition.ts
|
|
10341
|
-
var
|
|
10337
|
+
var import_kit83 = require("@solana/kit");
|
|
10342
10338
|
function lendingPositionAuthorityFilter(address8) {
|
|
10343
10339
|
return {
|
|
10344
10340
|
memcmp: {
|
|
10345
10341
|
offset: 11n,
|
|
10346
|
-
bytes: (0,
|
|
10342
|
+
bytes: (0, import_kit83.getBase58Decoder)().decode((0, import_kit83.getAddressEncoder)().encode(address8)),
|
|
10347
10343
|
encoding: "base58"
|
|
10348
10344
|
}
|
|
10349
10345
|
};
|
|
@@ -10352,7 +10348,7 @@ function lendingPositionMintFilter(address8) {
|
|
|
10352
10348
|
return {
|
|
10353
10349
|
memcmp: {
|
|
10354
10350
|
offset: 43n,
|
|
10355
|
-
bytes: (0,
|
|
10351
|
+
bytes: (0, import_kit83.getBase58Decoder)().decode((0, import_kit83.getAddressEncoder)().encode(address8)),
|
|
10356
10352
|
encoding: "base58"
|
|
10357
10353
|
}
|
|
10358
10354
|
};
|
|
@@ -10361,13 +10357,13 @@ function lendingPositionVaultFilter(address8) {
|
|
|
10361
10357
|
return {
|
|
10362
10358
|
memcmp: {
|
|
10363
10359
|
offset: 91n,
|
|
10364
|
-
bytes: (0,
|
|
10360
|
+
bytes: (0, import_kit83.getBase58Decoder)().decode((0, import_kit83.getAddressEncoder)().encode(address8)),
|
|
10365
10361
|
encoding: "base58"
|
|
10366
10362
|
}
|
|
10367
10363
|
};
|
|
10368
10364
|
}
|
|
10369
10365
|
async function fetchAllLendingPositionWithFilter(rpc, ...filters) {
|
|
10370
|
-
const discriminator = (0,
|
|
10366
|
+
const discriminator = (0, import_kit83.getBase58Decoder)().decode(LENDING_POSITION_DISCRIMINATOR);
|
|
10371
10367
|
const discriminatorFilter = {
|
|
10372
10368
|
memcmp: {
|
|
10373
10369
|
offset: 0n,
|
|
@@ -10384,9 +10380,9 @@ async function fetchAllLendingPositionWithFilter(rpc, ...filters) {
|
|
|
10384
10380
|
}
|
|
10385
10381
|
|
|
10386
10382
|
// src/gpa/market.ts
|
|
10387
|
-
var
|
|
10383
|
+
var import_kit84 = require("@solana/kit");
|
|
10388
10384
|
async function fetchAllMarketWithFilter(rpc, ...filters) {
|
|
10389
|
-
const discriminator = (0,
|
|
10385
|
+
const discriminator = (0, import_kit84.getBase58Decoder)().decode(MARKET_DISCRIMINATOR);
|
|
10390
10386
|
const discriminatorFilter = {
|
|
10391
10387
|
memcmp: {
|
|
10392
10388
|
offset: 0n,
|
|
@@ -10488,11 +10484,11 @@ var FusionUtils = class {
|
|
|
10488
10484
|
};
|
|
10489
10485
|
|
|
10490
10486
|
// src/utils/token.ts
|
|
10491
|
-
var
|
|
10487
|
+
var import_kit85 = require("@solana/kit");
|
|
10492
10488
|
var import_system = require("@solana-program/system");
|
|
10493
10489
|
var import_token = require("@solana-program/token");
|
|
10494
10490
|
var import_token_2022 = require("@solana-program/token-2022");
|
|
10495
|
-
var NATIVE_MINT = (0,
|
|
10491
|
+
var NATIVE_MINT = (0, import_kit85.address)("So11111111111111111111111111111111111111112");
|
|
10496
10492
|
async function getCreateAtaInstruction(mint, owner, payer, tokenProgram = import_token.TOKEN_PROGRAM_ADDRESS) {
|
|
10497
10493
|
const ata = (await (0, import_token.findAssociatedTokenPda)({
|
|
10498
10494
|
mint,
|
|
@@ -10574,7 +10570,7 @@ async function createAddressLookupTableInstructions(authority, addresses, recent
|
|
|
10574
10570
|
// src/txbuilder/increaseTunaLpPositionOrca.ts
|
|
10575
10571
|
var import_whirlpools_client2 = require("@orca-so/whirlpools-client");
|
|
10576
10572
|
var import_whirlpools_core2 = require("@orca-so/whirlpools-core");
|
|
10577
|
-
var
|
|
10573
|
+
var import_kit86 = require("@solana/kit");
|
|
10578
10574
|
var import_memo = require("@solana-program/memo");
|
|
10579
10575
|
var import_token_20222 = require("@solana-program/token-2022");
|
|
10580
10576
|
var import_assert = __toESM(require("assert"), 1);
|
|
@@ -10587,13 +10583,12 @@ async function increaseTunaLpPositionOrcaInstructions(rpc, authority, positionMi
|
|
|
10587
10583
|
if (!tunaPosition.exists) throw new Error("Tuna position account not found");
|
|
10588
10584
|
const whirlpool = await (0, import_whirlpools_client2.fetchMaybeWhirlpool)(rpc, tunaPosition.data.pool);
|
|
10589
10585
|
if (!whirlpool.exists) throw new Error("Whirlpool account not found");
|
|
10590
|
-
const [vaultA, vaultB] = await fetchAllVault(rpc, [
|
|
10591
|
-
(await getLendingVaultAddress(whirlpool.data.tokenMintA))[0],
|
|
10592
|
-
(await getLendingVaultAddress(whirlpool.data.tokenMintB))[0]
|
|
10593
|
-
]);
|
|
10594
10586
|
const [mintA, mintB] = await (0, import_token_20222.fetchAllMaybeMint)(rpc, [whirlpool.data.tokenMintA, whirlpool.data.tokenMintB]);
|
|
10595
10587
|
(0, import_assert.default)(mintA.exists, "Token A not found");
|
|
10596
10588
|
(0, import_assert.default)(mintB.exists, "Token B not found");
|
|
10589
|
+
const marketAddress = (await getMarketAddress(tunaPosition.data.pool))[0];
|
|
10590
|
+
const market = await fetchMarket(rpc, marketAddress);
|
|
10591
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [market.data.vaultA, market.data.vaultB]);
|
|
10597
10592
|
const createUserAtaAInstructions = await getCreateAtaInstructions(
|
|
10598
10593
|
rpc,
|
|
10599
10594
|
authority,
|
|
@@ -10731,16 +10726,16 @@ async function increaseTunaLpPositionOrcaInstruction(authority, tunaPosition, tu
|
|
|
10731
10726
|
tunaPosition.data.tickUpperIndex
|
|
10732
10727
|
);
|
|
10733
10728
|
const remainingAccounts = [
|
|
10734
|
-
{ address: swapTickArrays[0], role:
|
|
10735
|
-
{ address: swapTickArrays[1], role:
|
|
10736
|
-
{ address: swapTickArrays[2], role:
|
|
10737
|
-
{ address: swapTickArrays[3], role:
|
|
10738
|
-
{ address: swapTickArrays[4], role:
|
|
10739
|
-
{ address: lowerTickArrayAddress, role:
|
|
10740
|
-
{ address: upperTickArrayAddress, role:
|
|
10741
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
10742
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
10743
|
-
{ address: orcaOracleAddress, role:
|
|
10729
|
+
{ address: swapTickArrays[0], role: import_kit86.AccountRole.WRITABLE },
|
|
10730
|
+
{ address: swapTickArrays[1], role: import_kit86.AccountRole.WRITABLE },
|
|
10731
|
+
{ address: swapTickArrays[2], role: import_kit86.AccountRole.WRITABLE },
|
|
10732
|
+
{ address: swapTickArrays[3], role: import_kit86.AccountRole.WRITABLE },
|
|
10733
|
+
{ address: swapTickArrays[4], role: import_kit86.AccountRole.WRITABLE },
|
|
10734
|
+
{ address: lowerTickArrayAddress, role: import_kit86.AccountRole.WRITABLE },
|
|
10735
|
+
{ address: upperTickArrayAddress, role: import_kit86.AccountRole.WRITABLE },
|
|
10736
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit86.AccountRole.WRITABLE },
|
|
10737
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit86.AccountRole.WRITABLE },
|
|
10738
|
+
{ address: orcaOracleAddress, role: import_kit86.AccountRole.WRITABLE }
|
|
10744
10739
|
];
|
|
10745
10740
|
const remainingAccountsInfo = {
|
|
10746
10741
|
slices: [
|
|
@@ -10788,7 +10783,7 @@ async function increaseTunaLpPositionOrcaInstruction(authority, tunaPosition, tu
|
|
|
10788
10783
|
// src/txbuilder/increaseTunaLpPositionFusion.ts
|
|
10789
10784
|
var import_fusionamm_client2 = require("@crypticdot/fusionamm-client");
|
|
10790
10785
|
var import_fusionamm_core3 = require("@crypticdot/fusionamm-core");
|
|
10791
|
-
var
|
|
10786
|
+
var import_kit87 = require("@solana/kit");
|
|
10792
10787
|
var import_memo2 = require("@solana-program/memo");
|
|
10793
10788
|
var import_token_20223 = require("@solana-program/token-2022");
|
|
10794
10789
|
var import_assert2 = __toESM(require("assert"), 1);
|
|
@@ -10801,13 +10796,12 @@ async function increaseTunaLpPositionFusionInstructions(rpc, authority, position
|
|
|
10801
10796
|
if (!tunaPosition.exists) throw new Error("Tuna position account not found");
|
|
10802
10797
|
const fusionPool = await (0, import_fusionamm_client2.fetchMaybeFusionPool)(rpc, tunaPosition.data.pool);
|
|
10803
10798
|
if (!fusionPool.exists) throw new Error("FusionPool account not found");
|
|
10804
|
-
const [vaultA, vaultB] = await fetchAllVault(rpc, [
|
|
10805
|
-
(await getLendingVaultAddress(fusionPool.data.tokenMintA))[0],
|
|
10806
|
-
(await getLendingVaultAddress(fusionPool.data.tokenMintB))[0]
|
|
10807
|
-
]);
|
|
10808
10799
|
const [mintA, mintB] = await (0, import_token_20223.fetchAllMaybeMint)(rpc, [fusionPool.data.tokenMintA, fusionPool.data.tokenMintB]);
|
|
10809
10800
|
(0, import_assert2.default)(mintA.exists, "Token A not found");
|
|
10810
10801
|
(0, import_assert2.default)(mintB.exists, "Token B not found");
|
|
10802
|
+
const marketAddress = (await getMarketAddress(tunaPosition.data.pool))[0];
|
|
10803
|
+
const market = await fetchMarket(rpc, marketAddress);
|
|
10804
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [market.data.vaultA, market.data.vaultB]);
|
|
10811
10805
|
const createUserAtaAInstructions = await getCreateAtaInstructions(
|
|
10812
10806
|
rpc,
|
|
10813
10807
|
authority,
|
|
@@ -10950,15 +10944,15 @@ async function increaseTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
10950
10944
|
tunaPosition.data.tickUpperIndex
|
|
10951
10945
|
);
|
|
10952
10946
|
const remainingAccounts = [
|
|
10953
|
-
{ address: swapTickArrays[0], role:
|
|
10954
|
-
{ address: swapTickArrays[1], role:
|
|
10955
|
-
{ address: swapTickArrays[2], role:
|
|
10956
|
-
{ address: swapTickArrays[3], role:
|
|
10957
|
-
{ address: swapTickArrays[4], role:
|
|
10958
|
-
{ address: lowerTickArrayAddress, role:
|
|
10959
|
-
{ address: upperTickArrayAddress, role:
|
|
10960
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
10961
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
10947
|
+
{ address: swapTickArrays[0], role: import_kit87.AccountRole.WRITABLE },
|
|
10948
|
+
{ address: swapTickArrays[1], role: import_kit87.AccountRole.WRITABLE },
|
|
10949
|
+
{ address: swapTickArrays[2], role: import_kit87.AccountRole.WRITABLE },
|
|
10950
|
+
{ address: swapTickArrays[3], role: import_kit87.AccountRole.WRITABLE },
|
|
10951
|
+
{ address: swapTickArrays[4], role: import_kit87.AccountRole.WRITABLE },
|
|
10952
|
+
{ address: lowerTickArrayAddress, role: import_kit87.AccountRole.WRITABLE },
|
|
10953
|
+
{ address: upperTickArrayAddress, role: import_kit87.AccountRole.WRITABLE },
|
|
10954
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit87.AccountRole.WRITABLE },
|
|
10955
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit87.AccountRole.WRITABLE }
|
|
10962
10956
|
];
|
|
10963
10957
|
const remainingAccountsInfo = {
|
|
10964
10958
|
slices: [
|
|
@@ -11096,7 +11090,7 @@ async function closeTunaLpPositionFusionInstruction(rpc, authority, positionMint
|
|
|
11096
11090
|
|
|
11097
11091
|
// src/txbuilder/collectAndCompoundFeesOrca.ts
|
|
11098
11092
|
var import_whirlpools_client4 = require("@orca-so/whirlpools-client");
|
|
11099
|
-
var
|
|
11093
|
+
var import_kit88 = require("@solana/kit");
|
|
11100
11094
|
var import_memo3 = require("@solana-program/memo");
|
|
11101
11095
|
var import_token_20226 = require("@solana-program/token-2022");
|
|
11102
11096
|
var import_assert5 = __toESM(require("assert"), 1);
|
|
@@ -11107,10 +11101,9 @@ async function collectAndCompoundFeesOrcaInstructions(rpc, authority, positionMi
|
|
|
11107
11101
|
if (!tunaPosition.exists) throw new Error("Tuna position account not found");
|
|
11108
11102
|
const whirlpool = await (0, import_whirlpools_client4.fetchMaybeWhirlpool)(rpc, tunaPosition.data.pool);
|
|
11109
11103
|
if (!whirlpool.exists) throw new Error("Whirlpool account not found");
|
|
11110
|
-
const
|
|
11111
|
-
|
|
11112
|
-
|
|
11113
|
-
]);
|
|
11104
|
+
const marketAddress = (await getMarketAddress(tunaPosition.data.pool))[0];
|
|
11105
|
+
const market = await fetchMarket(rpc, marketAddress);
|
|
11106
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [market.data.vaultA, market.data.vaultB]);
|
|
11114
11107
|
const [mintA, mintB] = await (0, import_token_20226.fetchAllMaybeMint)(rpc, [whirlpool.data.tokenMintA, whirlpool.data.tokenMintB]);
|
|
11115
11108
|
(0, import_assert5.default)(mintA.exists, "Token A account not found");
|
|
11116
11109
|
(0, import_assert5.default)(mintB.exists, "Token B account not found");
|
|
@@ -11194,16 +11187,16 @@ async function collectAndCompoundFeesOrcaInstruction(authority, tunaConfig, tuna
|
|
|
11194
11187
|
tunaPosition.data.tickUpperIndex
|
|
11195
11188
|
);
|
|
11196
11189
|
const remainingAccounts = [
|
|
11197
|
-
{ address: swapTickArrays[0], role:
|
|
11198
|
-
{ address: swapTickArrays[1], role:
|
|
11199
|
-
{ address: swapTickArrays[2], role:
|
|
11200
|
-
{ address: swapTickArrays[3], role:
|
|
11201
|
-
{ address: swapTickArrays[4], role:
|
|
11202
|
-
{ address: lowerTickArrayAddress, role:
|
|
11203
|
-
{ address: upperTickArrayAddress, role:
|
|
11204
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
11205
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
11206
|
-
{ address: orcaOracleAddress, role:
|
|
11190
|
+
{ address: swapTickArrays[0], role: import_kit88.AccountRole.WRITABLE },
|
|
11191
|
+
{ address: swapTickArrays[1], role: import_kit88.AccountRole.WRITABLE },
|
|
11192
|
+
{ address: swapTickArrays[2], role: import_kit88.AccountRole.WRITABLE },
|
|
11193
|
+
{ address: swapTickArrays[3], role: import_kit88.AccountRole.WRITABLE },
|
|
11194
|
+
{ address: swapTickArrays[4], role: import_kit88.AccountRole.WRITABLE },
|
|
11195
|
+
{ address: lowerTickArrayAddress, role: import_kit88.AccountRole.WRITABLE },
|
|
11196
|
+
{ address: upperTickArrayAddress, role: import_kit88.AccountRole.WRITABLE },
|
|
11197
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit88.AccountRole.WRITABLE },
|
|
11198
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit88.AccountRole.WRITABLE },
|
|
11199
|
+
{ address: orcaOracleAddress, role: import_kit88.AccountRole.WRITABLE }
|
|
11207
11200
|
];
|
|
11208
11201
|
const remainingAccountsInfo = {
|
|
11209
11202
|
slices: [
|
|
@@ -11248,7 +11241,7 @@ async function collectAndCompoundFeesOrcaInstruction(authority, tunaConfig, tuna
|
|
|
11248
11241
|
|
|
11249
11242
|
// src/txbuilder/collectAndCompoundFeesFusion.ts
|
|
11250
11243
|
var import_fusionamm_client4 = require("@crypticdot/fusionamm-client");
|
|
11251
|
-
var
|
|
11244
|
+
var import_kit89 = require("@solana/kit");
|
|
11252
11245
|
var import_memo4 = require("@solana-program/memo");
|
|
11253
11246
|
var import_token_20227 = require("@solana-program/token-2022");
|
|
11254
11247
|
var import_assert6 = __toESM(require("assert"), 1);
|
|
@@ -11259,10 +11252,9 @@ async function collectAndCompoundFeesFusionInstructions(rpc, authority, position
|
|
|
11259
11252
|
if (!tunaPosition.exists) throw new Error("Tuna position account not found");
|
|
11260
11253
|
const fusionPool = await (0, import_fusionamm_client4.fetchMaybeFusionPool)(rpc, tunaPosition.data.pool);
|
|
11261
11254
|
if (!fusionPool.exists) throw new Error("FusionPool account not found");
|
|
11262
|
-
const
|
|
11263
|
-
|
|
11264
|
-
|
|
11265
|
-
]);
|
|
11255
|
+
const marketAddress = (await getMarketAddress(tunaPosition.data.pool))[0];
|
|
11256
|
+
const market = await fetchMarket(rpc, marketAddress);
|
|
11257
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [market.data.vaultA, market.data.vaultB]);
|
|
11266
11258
|
const [mintA, mintB] = await (0, import_token_20227.fetchAllMaybeMint)(rpc, [fusionPool.data.tokenMintA, fusionPool.data.tokenMintB]);
|
|
11267
11259
|
(0, import_assert6.default)(mintA.exists, "Token A account not found");
|
|
11268
11260
|
(0, import_assert6.default)(mintB.exists, "Token B account not found");
|
|
@@ -11345,15 +11337,15 @@ async function collectAndCompoundFeesFusionInstruction(authority, tunaConfig, tu
|
|
|
11345
11337
|
tunaPosition.data.tickUpperIndex
|
|
11346
11338
|
);
|
|
11347
11339
|
const remainingAccounts = [
|
|
11348
|
-
{ address: swapTickArrays[0], role:
|
|
11349
|
-
{ address: swapTickArrays[1], role:
|
|
11350
|
-
{ address: swapTickArrays[2], role:
|
|
11351
|
-
{ address: swapTickArrays[3], role:
|
|
11352
|
-
{ address: swapTickArrays[4], role:
|
|
11353
|
-
{ address: lowerTickArrayAddress, role:
|
|
11354
|
-
{ address: upperTickArrayAddress, role:
|
|
11355
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
11356
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
11340
|
+
{ address: swapTickArrays[0], role: import_kit89.AccountRole.WRITABLE },
|
|
11341
|
+
{ address: swapTickArrays[1], role: import_kit89.AccountRole.WRITABLE },
|
|
11342
|
+
{ address: swapTickArrays[2], role: import_kit89.AccountRole.WRITABLE },
|
|
11343
|
+
{ address: swapTickArrays[3], role: import_kit89.AccountRole.WRITABLE },
|
|
11344
|
+
{ address: swapTickArrays[4], role: import_kit89.AccountRole.WRITABLE },
|
|
11345
|
+
{ address: lowerTickArrayAddress, role: import_kit89.AccountRole.WRITABLE },
|
|
11346
|
+
{ address: upperTickArrayAddress, role: import_kit89.AccountRole.WRITABLE },
|
|
11347
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit89.AccountRole.WRITABLE },
|
|
11348
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit89.AccountRole.WRITABLE }
|
|
11357
11349
|
];
|
|
11358
11350
|
const remainingAccountsInfo = {
|
|
11359
11351
|
slices: [
|
|
@@ -11397,7 +11389,7 @@ async function collectAndCompoundFeesFusionInstruction(authority, tunaConfig, tu
|
|
|
11397
11389
|
|
|
11398
11390
|
// src/txbuilder/collectFeesOrca.ts
|
|
11399
11391
|
var import_whirlpools_client5 = require("@orca-so/whirlpools-client");
|
|
11400
|
-
var
|
|
11392
|
+
var import_kit90 = require("@solana/kit");
|
|
11401
11393
|
var import_memo5 = require("@solana-program/memo");
|
|
11402
11394
|
var import_token_20228 = require("@solana-program/token-2022");
|
|
11403
11395
|
var import_assert7 = __toESM(require("assert"), 1);
|
|
@@ -11473,10 +11465,10 @@ async function collectFeesOrcaInstruction(authority, tunaPosition, mintA, mintB,
|
|
|
11473
11465
|
tunaPosition.data.tickUpperIndex
|
|
11474
11466
|
);
|
|
11475
11467
|
const remainingAccounts = [
|
|
11476
|
-
{ address: lowerTickArrayAddress, role:
|
|
11477
|
-
{ address: upperTickArrayAddress, role:
|
|
11478
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
11479
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
11468
|
+
{ address: lowerTickArrayAddress, role: import_kit90.AccountRole.WRITABLE },
|
|
11469
|
+
{ address: upperTickArrayAddress, role: import_kit90.AccountRole.WRITABLE },
|
|
11470
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit90.AccountRole.WRITABLE },
|
|
11471
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit90.AccountRole.WRITABLE }
|
|
11480
11472
|
];
|
|
11481
11473
|
const remainingAccountsInfo = {
|
|
11482
11474
|
slices: [
|
|
@@ -11511,7 +11503,7 @@ async function collectFeesOrcaInstruction(authority, tunaPosition, mintA, mintB,
|
|
|
11511
11503
|
|
|
11512
11504
|
// src/txbuilder/collectFeesFusion.ts
|
|
11513
11505
|
var import_fusionamm_client5 = require("@crypticdot/fusionamm-client");
|
|
11514
|
-
var
|
|
11506
|
+
var import_kit91 = require("@solana/kit");
|
|
11515
11507
|
var import_memo6 = require("@solana-program/memo");
|
|
11516
11508
|
var import_token_20229 = require("@solana-program/token-2022");
|
|
11517
11509
|
var import_assert8 = __toESM(require("assert"), 1);
|
|
@@ -11587,10 +11579,10 @@ async function collectFeesFusionInstruction(authority, tunaPosition, mintA, mint
|
|
|
11587
11579
|
tunaPosition.data.tickUpperIndex
|
|
11588
11580
|
);
|
|
11589
11581
|
const remainingAccounts = [
|
|
11590
|
-
{ address: lowerTickArrayAddress, role:
|
|
11591
|
-
{ address: upperTickArrayAddress, role:
|
|
11592
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
11593
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
11582
|
+
{ address: lowerTickArrayAddress, role: import_kit91.AccountRole.WRITABLE },
|
|
11583
|
+
{ address: upperTickArrayAddress, role: import_kit91.AccountRole.WRITABLE },
|
|
11584
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit91.AccountRole.WRITABLE },
|
|
11585
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit91.AccountRole.WRITABLE }
|
|
11594
11586
|
];
|
|
11595
11587
|
const remainingAccountsInfo = {
|
|
11596
11588
|
slices: [
|
|
@@ -11653,14 +11645,6 @@ var import_memo7 = require("@solana-program/memo");
|
|
|
11653
11645
|
var import_token_202210 = require("@solana-program/token-2022");
|
|
11654
11646
|
async function depositInstructions(rpc, authority, mintAddress, vaultAddress, amount) {
|
|
11655
11647
|
const instructions = [];
|
|
11656
|
-
if (!mintAddress && !vaultAddress) {
|
|
11657
|
-
throw new Error("Mint or vault address must be provided.");
|
|
11658
|
-
}
|
|
11659
|
-
if (vaultAddress && !mintAddress) {
|
|
11660
|
-
const vault = await fetchMaybeVault(rpc, vaultAddress);
|
|
11661
|
-
if (!vault.exists) throw new Error("Vault account not found");
|
|
11662
|
-
mintAddress = vault.data.mint;
|
|
11663
|
-
}
|
|
11664
11648
|
const mint = await (0, import_token_202210.fetchMaybeMint)(rpc, mintAddress);
|
|
11665
11649
|
if (!mint.exists) throw new Error("Mint account not found");
|
|
11666
11650
|
const createUserAtaInstructions = await getCreateAtaInstructions(
|
|
@@ -11726,7 +11710,7 @@ async function openLendingPositionAndDepositInstructions(rpc, authority, mintAdd
|
|
|
11726
11710
|
// src/txbuilder/closeActiveTunaLpPositionOrca.ts
|
|
11727
11711
|
var import_whirlpools_client6 = require("@orca-so/whirlpools-client");
|
|
11728
11712
|
var import_whirlpools_core3 = require("@orca-so/whirlpools-core");
|
|
11729
|
-
var
|
|
11713
|
+
var import_kit92 = require("@solana/kit");
|
|
11730
11714
|
var import_token_202211 = require("@solana-program/token-2022");
|
|
11731
11715
|
var import_assert9 = __toESM(require("assert"), 1);
|
|
11732
11716
|
async function closeActiveTunaLpPositionOrcaInstructions(rpc, authority, positionMint, args) {
|
|
@@ -11735,10 +11719,9 @@ async function closeActiveTunaLpPositionOrcaInstructions(rpc, authority, positio
|
|
|
11735
11719
|
const orcaPosition = await (0, import_whirlpools_client6.fetchPosition)(rpc, (await (0, import_whirlpools_client6.getPositionAddress)(positionMint))[0]);
|
|
11736
11720
|
const whirlpool = await (0, import_whirlpools_client6.fetchMaybeWhirlpool)(rpc, tunaPosition.data.pool);
|
|
11737
11721
|
if (!whirlpool.exists) throw new Error("Whirlpool account not found");
|
|
11738
|
-
const
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
]);
|
|
11722
|
+
const marketAddress = (await getMarketAddress(tunaPosition.data.pool))[0];
|
|
11723
|
+
const market = await fetchMarket(rpc, marketAddress);
|
|
11724
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [market.data.vaultA, market.data.vaultB]);
|
|
11742
11725
|
const [mintA, mintB, ...rewardMints] = await (0, import_token_202211.fetchAllMaybeMint)(rpc, [
|
|
11743
11726
|
whirlpool.data.tokenMintA,
|
|
11744
11727
|
whirlpool.data.tokenMintB,
|
|
@@ -11747,7 +11730,7 @@ async function closeActiveTunaLpPositionOrcaInstructions(rpc, authority, positio
|
|
|
11747
11730
|
const allMints = [mintA, mintB, ...rewardMints];
|
|
11748
11731
|
(0, import_assert9.default)(mintA.exists, "Token A account not found");
|
|
11749
11732
|
(0, import_assert9.default)(mintB.exists, "Token B account not found");
|
|
11750
|
-
(0,
|
|
11733
|
+
(0, import_kit92.assertAccountsExist)(rewardMints);
|
|
11751
11734
|
const lowerTickArrayStartIndex = (0, import_whirlpools_core3.getTickArrayStartTickIndex)(
|
|
11752
11735
|
tunaPosition.data.tickLowerIndex,
|
|
11753
11736
|
whirlpool.data.tickSpacing
|
|
@@ -11853,10 +11836,9 @@ async function closeActiveTunaLpPositionFusionInstructions(rpc, authority, posit
|
|
|
11853
11836
|
const fusionPosition = await (0, import_fusionamm_client6.fetchPosition)(rpc, (await (0, import_fusionamm_client6.getPositionAddress)(positionMint))[0]);
|
|
11854
11837
|
const fusionPool = await (0, import_fusionamm_client6.fetchMaybeFusionPool)(rpc, tunaPosition.data.pool);
|
|
11855
11838
|
if (!fusionPool.exists) throw new Error("Whirlpool account not found");
|
|
11856
|
-
const
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
]);
|
|
11839
|
+
const marketAddress = (await getMarketAddress(tunaPosition.data.pool))[0];
|
|
11840
|
+
const market = await fetchMarket(rpc, marketAddress);
|
|
11841
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [market.data.vaultA, market.data.vaultB]);
|
|
11860
11842
|
const [mintA, mintB] = await (0, import_token_202212.fetchAllMaybeMint)(rpc, [fusionPool.data.tokenMintA, fusionPool.data.tokenMintB]);
|
|
11861
11843
|
const allMints = [mintA, mintB];
|
|
11862
11844
|
(0, import_assert10.default)(mintA.exists, "Token A account not found");
|
|
@@ -11923,7 +11905,7 @@ async function closeActiveTunaLpPositionFusionInstructions(rpc, authority, posit
|
|
|
11923
11905
|
|
|
11924
11906
|
// src/txbuilder/modifyTunaSpotPositionOrca.ts
|
|
11925
11907
|
var import_whirlpools_client7 = require("@orca-so/whirlpools-client");
|
|
11926
|
-
var
|
|
11908
|
+
var import_kit93 = require("@solana/kit");
|
|
11927
11909
|
var import_memo8 = require("@solana-program/memo");
|
|
11928
11910
|
var import_token_202213 = require("@solana-program/token-2022");
|
|
11929
11911
|
var import_assert11 = __toESM(require("assert"), 1);
|
|
@@ -11943,10 +11925,9 @@ async function modifyTunaSpotPositionOrcaInstructions(rpc, authority, poolAddres
|
|
|
11943
11925
|
const [mintA, mintB] = await (0, import_token_202213.fetchAllMaybeMint)(rpc, [pool.data.tokenMintA, pool.data.tokenMintB]);
|
|
11944
11926
|
(0, import_assert11.default)(mintA.exists, "Token A account not found");
|
|
11945
11927
|
(0, import_assert11.default)(mintB.exists, "Token B account not found");
|
|
11946
|
-
const
|
|
11947
|
-
|
|
11948
|
-
|
|
11949
|
-
]);
|
|
11928
|
+
const marketAddress = (await getMarketAddress(poolAddress))[0];
|
|
11929
|
+
const market = await fetchMarket(rpc, marketAddress);
|
|
11930
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [market.data.vaultA, market.data.vaultB]);
|
|
11950
11931
|
let hasDirectlyTransferredTokensA = false;
|
|
11951
11932
|
let hasDirectlyTransferredTokensB = false;
|
|
11952
11933
|
if (tunaPosition.exists) {
|
|
@@ -12050,14 +12031,14 @@ async function modifyTunaSpotPositionOrcaInstruction(authority, tunaConfig, mint
|
|
|
12050
12031
|
}))[0];
|
|
12051
12032
|
const swapTickArrays = await OrcaUtils.getSwapTickArrayAddresses(pool);
|
|
12052
12033
|
const remainingAccounts = [
|
|
12053
|
-
{ address: swapTickArrays[0], role:
|
|
12054
|
-
{ address: swapTickArrays[1], role:
|
|
12055
|
-
{ address: swapTickArrays[2], role:
|
|
12056
|
-
{ address: swapTickArrays[3], role:
|
|
12057
|
-
{ address: swapTickArrays[4], role:
|
|
12058
|
-
{ address: pool.data.tokenVaultA, role:
|
|
12059
|
-
{ address: pool.data.tokenVaultB, role:
|
|
12060
|
-
{ address: orcaOracleAddress, role:
|
|
12034
|
+
{ address: swapTickArrays[0], role: import_kit93.AccountRole.WRITABLE },
|
|
12035
|
+
{ address: swapTickArrays[1], role: import_kit93.AccountRole.WRITABLE },
|
|
12036
|
+
{ address: swapTickArrays[2], role: import_kit93.AccountRole.WRITABLE },
|
|
12037
|
+
{ address: swapTickArrays[3], role: import_kit93.AccountRole.WRITABLE },
|
|
12038
|
+
{ address: swapTickArrays[4], role: import_kit93.AccountRole.WRITABLE },
|
|
12039
|
+
{ address: pool.data.tokenVaultA, role: import_kit93.AccountRole.WRITABLE },
|
|
12040
|
+
{ address: pool.data.tokenVaultB, role: import_kit93.AccountRole.WRITABLE },
|
|
12041
|
+
{ address: orcaOracleAddress, role: import_kit93.AccountRole.WRITABLE }
|
|
12061
12042
|
];
|
|
12062
12043
|
const remainingAccountsInfo = {
|
|
12063
12044
|
slices: [
|
|
@@ -12100,7 +12081,7 @@ async function modifyTunaSpotPositionOrcaInstruction(authority, tunaConfig, mint
|
|
|
12100
12081
|
|
|
12101
12082
|
// src/txbuilder/modifyTunaSpotPositionFusion.ts
|
|
12102
12083
|
var import_fusionamm_client7 = require("@crypticdot/fusionamm-client");
|
|
12103
|
-
var
|
|
12084
|
+
var import_kit94 = require("@solana/kit");
|
|
12104
12085
|
var import_memo9 = require("@solana-program/memo");
|
|
12105
12086
|
var import_token_202214 = require("@solana-program/token-2022");
|
|
12106
12087
|
var import_assert12 = __toESM(require("assert"), 1);
|
|
@@ -12120,10 +12101,9 @@ async function modifyTunaSpotPositionFusionInstructions(rpc, authority, poolAddr
|
|
|
12120
12101
|
const [mintA, mintB] = await (0, import_token_202214.fetchAllMaybeMint)(rpc, [pool.data.tokenMintA, pool.data.tokenMintB]);
|
|
12121
12102
|
(0, import_assert12.default)(mintA.exists, "Token A account not found");
|
|
12122
12103
|
(0, import_assert12.default)(mintB.exists, "Token B account not found");
|
|
12123
|
-
const
|
|
12124
|
-
|
|
12125
|
-
|
|
12126
|
-
]);
|
|
12104
|
+
const marketAddress = (await getMarketAddress(poolAddress))[0];
|
|
12105
|
+
const market = await fetchMarket(rpc, marketAddress);
|
|
12106
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [market.data.vaultA, market.data.vaultB]);
|
|
12127
12107
|
let hasDirectlyTransferredTokensA = false;
|
|
12128
12108
|
let hasDirectlyTransferredTokensB = false;
|
|
12129
12109
|
if (tunaPosition.exists) {
|
|
@@ -12226,13 +12206,13 @@ async function modifyTunaSpotPositionFusionInstruction(authority, tunaConfig, mi
|
|
|
12226
12206
|
}))[0];
|
|
12227
12207
|
const swapTickArrays = await FusionUtils.getSwapTickArrayAddresses(pool);
|
|
12228
12208
|
const remainingAccounts = [
|
|
12229
|
-
{ address: swapTickArrays[0], role:
|
|
12230
|
-
{ address: swapTickArrays[1], role:
|
|
12231
|
-
{ address: swapTickArrays[2], role:
|
|
12232
|
-
{ address: swapTickArrays[3], role:
|
|
12233
|
-
{ address: swapTickArrays[4], role:
|
|
12234
|
-
{ address: pool.data.tokenVaultA, role:
|
|
12235
|
-
{ address: pool.data.tokenVaultB, role:
|
|
12209
|
+
{ address: swapTickArrays[0], role: import_kit94.AccountRole.WRITABLE },
|
|
12210
|
+
{ address: swapTickArrays[1], role: import_kit94.AccountRole.WRITABLE },
|
|
12211
|
+
{ address: swapTickArrays[2], role: import_kit94.AccountRole.WRITABLE },
|
|
12212
|
+
{ address: swapTickArrays[3], role: import_kit94.AccountRole.WRITABLE },
|
|
12213
|
+
{ address: swapTickArrays[4], role: import_kit94.AccountRole.WRITABLE },
|
|
12214
|
+
{ address: pool.data.tokenVaultA, role: import_kit94.AccountRole.WRITABLE },
|
|
12215
|
+
{ address: pool.data.tokenVaultB, role: import_kit94.AccountRole.WRITABLE }
|
|
12236
12216
|
];
|
|
12237
12217
|
const remainingAccountsInfo = {
|
|
12238
12218
|
slices: [
|
|
@@ -12276,6 +12256,7 @@ async function modifyTunaSpotPositionFusionInstruction(authority, tunaConfig, mi
|
|
|
12276
12256
|
var import_fusionamm_client8 = require("@crypticdot/fusionamm-client");
|
|
12277
12257
|
|
|
12278
12258
|
// ../../node_modules/.pnpm/@crypticdot+jupiter-solana-client@1.0.0_fastestsmallesttextencoderdecoder@1.0.22_typesc_c15ee540b6a974c893a6f86bc9defff2/node_modules/@crypticdot/jupiter-solana-client/dist/index.mjs
|
|
12259
|
+
var import_kit95 = require("@solana/kit");
|
|
12279
12260
|
var import_kit96 = require("@solana/kit");
|
|
12280
12261
|
var import_kit97 = require("@solana/kit");
|
|
12281
12262
|
var import_kit98 = require("@solana/kit");
|
|
@@ -12309,7 +12290,6 @@ var import_kit125 = require("@solana/kit");
|
|
|
12309
12290
|
var import_kit126 = require("@solana/kit");
|
|
12310
12291
|
var import_kit127 = require("@solana/kit");
|
|
12311
12292
|
var import_kit128 = require("@solana/kit");
|
|
12312
|
-
var import_kit129 = require("@solana/kit");
|
|
12313
12293
|
var TOKEN_LEDGER_DISCRIMINATOR = new Uint8Array([
|
|
12314
12294
|
156,
|
|
12315
12295
|
247,
|
|
@@ -12552,10 +12532,7 @@ async function modifyTunaSpotPositionJupiterInstructions(rpc, authority, poolAdd
|
|
|
12552
12532
|
const [mintA, mintB] = await (0, import_token_202215.fetchAllMaybeMint)(rpc, [pool.data.tokenMintA, pool.data.tokenMintB]);
|
|
12553
12533
|
(0, import_assert13.default)(mintA.exists, "Token A account not found");
|
|
12554
12534
|
(0, import_assert13.default)(mintB.exists, "Token B account not found");
|
|
12555
|
-
const [vaultA, vaultB] = await fetchAllVault(rpc, [
|
|
12556
|
-
(await getLendingVaultAddress(mintA.address))[0],
|
|
12557
|
-
(await getLendingVaultAddress(mintB.address))[0]
|
|
12558
|
-
]);
|
|
12535
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [market.data.vaultA, market.data.vaultB]);
|
|
12559
12536
|
const createUserAtaAInstructions = await getCreateAtaInstructions(
|
|
12560
12537
|
rpc,
|
|
12561
12538
|
authority,
|
|
@@ -12731,11 +12708,11 @@ async function createMarketInstruction(authority, pool, vaultA, vaultB, args) {
|
|
|
12731
12708
|
});
|
|
12732
12709
|
}
|
|
12733
12710
|
|
|
12734
|
-
// src/txbuilder/
|
|
12735
|
-
async function
|
|
12711
|
+
// src/txbuilder/createMarketPermissionless.ts
|
|
12712
|
+
async function createMarketPermissionlessInstruction(authority, pool, vaultA, vaultB, args) {
|
|
12736
12713
|
const tunaConfig = (await getTunaConfigAddress())[0];
|
|
12737
12714
|
const marketAddress = (await getMarketAddress(pool))[0];
|
|
12738
|
-
return
|
|
12715
|
+
return getCreateMarketPermissionlessInstruction({
|
|
12739
12716
|
authority,
|
|
12740
12717
|
tunaConfig,
|
|
12741
12718
|
market: marketAddress,
|
|
@@ -12784,9 +12761,9 @@ async function createVaultInstructions(authority, mint, args) {
|
|
|
12784
12761
|
];
|
|
12785
12762
|
}
|
|
12786
12763
|
|
|
12787
|
-
// src/txbuilder/
|
|
12764
|
+
// src/txbuilder/createVaultPermissionless.ts
|
|
12788
12765
|
var import_token_202218 = require("@solana-program/token-2022");
|
|
12789
|
-
async function
|
|
12766
|
+
async function createVaultPermissionlessInstructions(authority, vault, mint, args) {
|
|
12790
12767
|
const tunaConfig = (await getTunaConfigAddress())[0];
|
|
12791
12768
|
const vaultAta = (await (0, import_token_202218.findAssociatedTokenPda)({
|
|
12792
12769
|
owner: vault,
|
|
@@ -12795,7 +12772,7 @@ async function createVaultV2Instructions(authority, vault, mint, args) {
|
|
|
12795
12772
|
}))[0];
|
|
12796
12773
|
return [
|
|
12797
12774
|
await getCreateAtaInstruction(mint.address, vault, authority, mint.programAddress),
|
|
12798
|
-
|
|
12775
|
+
getCreateVaultPermissionlessInstruction({
|
|
12799
12776
|
authority,
|
|
12800
12777
|
mint: mint.address,
|
|
12801
12778
|
vault,
|
|
@@ -12809,7 +12786,7 @@ async function createVaultV2Instructions(authority, vault, mint, args) {
|
|
|
12809
12786
|
|
|
12810
12787
|
// src/txbuilder/liquidateTunaLpPositionOrca.ts
|
|
12811
12788
|
var import_whirlpools_client9 = require("@orca-so/whirlpools-client");
|
|
12812
|
-
var
|
|
12789
|
+
var import_kit129 = require("@solana/kit");
|
|
12813
12790
|
var import_memo11 = require("@solana-program/memo");
|
|
12814
12791
|
var import_token_202219 = require("@solana-program/token-2022");
|
|
12815
12792
|
async function liquidateTunaLpPositionOrcaInstructions(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool, decreasePercent) {
|
|
@@ -12896,16 +12873,16 @@ async function liquidateTunaLpPositionOrcaInstruction(authority, tunaPosition, t
|
|
|
12896
12873
|
tunaPosition.data.tickUpperIndex
|
|
12897
12874
|
);
|
|
12898
12875
|
const remainingAccounts = [
|
|
12899
|
-
{ address: swapTickArrays[0], role:
|
|
12900
|
-
{ address: swapTickArrays[1], role:
|
|
12901
|
-
{ address: swapTickArrays[2], role:
|
|
12902
|
-
{ address: swapTickArrays[3], role:
|
|
12903
|
-
{ address: swapTickArrays[4], role:
|
|
12904
|
-
{ address: lowerTickArrayAddress, role:
|
|
12905
|
-
{ address: upperTickArrayAddress, role:
|
|
12906
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
12907
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
12908
|
-
{ address: orcaOracleAddress, role:
|
|
12876
|
+
{ address: swapTickArrays[0], role: import_kit129.AccountRole.WRITABLE },
|
|
12877
|
+
{ address: swapTickArrays[1], role: import_kit129.AccountRole.WRITABLE },
|
|
12878
|
+
{ address: swapTickArrays[2], role: import_kit129.AccountRole.WRITABLE },
|
|
12879
|
+
{ address: swapTickArrays[3], role: import_kit129.AccountRole.WRITABLE },
|
|
12880
|
+
{ address: swapTickArrays[4], role: import_kit129.AccountRole.WRITABLE },
|
|
12881
|
+
{ address: lowerTickArrayAddress, role: import_kit129.AccountRole.WRITABLE },
|
|
12882
|
+
{ address: upperTickArrayAddress, role: import_kit129.AccountRole.WRITABLE },
|
|
12883
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit129.AccountRole.WRITABLE },
|
|
12884
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit129.AccountRole.WRITABLE },
|
|
12885
|
+
{ address: orcaOracleAddress, role: import_kit129.AccountRole.WRITABLE }
|
|
12909
12886
|
];
|
|
12910
12887
|
const remainingAccountsInfo = {
|
|
12911
12888
|
slices: [
|
|
@@ -12950,7 +12927,7 @@ async function liquidateTunaLpPositionOrcaInstruction(authority, tunaPosition, t
|
|
|
12950
12927
|
|
|
12951
12928
|
// src/txbuilder/liquidateTunaLpPositionFusion.ts
|
|
12952
12929
|
var import_fusionamm_client9 = require("@crypticdot/fusionamm-client");
|
|
12953
|
-
var
|
|
12930
|
+
var import_kit130 = require("@solana/kit");
|
|
12954
12931
|
var import_memo12 = require("@solana-program/memo");
|
|
12955
12932
|
var import_token_202220 = require("@solana-program/token-2022");
|
|
12956
12933
|
async function liquidateTunaLpPositionFusionInstructions(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool, decreasePercent) {
|
|
@@ -13036,15 +13013,15 @@ async function liquidateTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
13036
13013
|
tunaPosition.data.tickUpperIndex
|
|
13037
13014
|
);
|
|
13038
13015
|
const remainingAccounts = [
|
|
13039
|
-
{ address: swapTickArrays[0], role:
|
|
13040
|
-
{ address: swapTickArrays[1], role:
|
|
13041
|
-
{ address: swapTickArrays[2], role:
|
|
13042
|
-
{ address: swapTickArrays[3], role:
|
|
13043
|
-
{ address: swapTickArrays[4], role:
|
|
13044
|
-
{ address: lowerTickArrayAddress, role:
|
|
13045
|
-
{ address: upperTickArrayAddress, role:
|
|
13046
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
13047
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
13016
|
+
{ address: swapTickArrays[0], role: import_kit130.AccountRole.WRITABLE },
|
|
13017
|
+
{ address: swapTickArrays[1], role: import_kit130.AccountRole.WRITABLE },
|
|
13018
|
+
{ address: swapTickArrays[2], role: import_kit130.AccountRole.WRITABLE },
|
|
13019
|
+
{ address: swapTickArrays[3], role: import_kit130.AccountRole.WRITABLE },
|
|
13020
|
+
{ address: swapTickArrays[4], role: import_kit130.AccountRole.WRITABLE },
|
|
13021
|
+
{ address: lowerTickArrayAddress, role: import_kit130.AccountRole.WRITABLE },
|
|
13022
|
+
{ address: upperTickArrayAddress, role: import_kit130.AccountRole.WRITABLE },
|
|
13023
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit130.AccountRole.WRITABLE },
|
|
13024
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit130.AccountRole.WRITABLE }
|
|
13048
13025
|
];
|
|
13049
13026
|
const remainingAccountsInfo = {
|
|
13050
13027
|
slices: [
|
|
@@ -13088,7 +13065,7 @@ async function liquidateTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
13088
13065
|
|
|
13089
13066
|
// src/txbuilder/liquidateTunaSpotPositionFusion.ts
|
|
13090
13067
|
var import_fusionamm_client10 = require("@crypticdot/fusionamm-client");
|
|
13091
|
-
var
|
|
13068
|
+
var import_kit131 = require("@solana/kit");
|
|
13092
13069
|
var import_memo13 = require("@solana-program/memo");
|
|
13093
13070
|
var import_token_202221 = require("@solana-program/token-2022");
|
|
13094
13071
|
async function liquidateTunaSpotPositionFusionInstructions(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, fusionPool, decreasePercent) {
|
|
@@ -13179,13 +13156,13 @@ async function liquidateTunaSpotPositionFusionInstruction(authority, tunaPositio
|
|
|
13179
13156
|
}))[0];
|
|
13180
13157
|
const swapTickArrays = await FusionUtils.getSwapTickArrayAddresses(fusionPool);
|
|
13181
13158
|
const remainingAccounts = [
|
|
13182
|
-
{ address: swapTickArrays[0], role:
|
|
13183
|
-
{ address: swapTickArrays[1], role:
|
|
13184
|
-
{ address: swapTickArrays[2], role:
|
|
13185
|
-
{ address: swapTickArrays[3], role:
|
|
13186
|
-
{ address: swapTickArrays[4], role:
|
|
13187
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
13188
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
13159
|
+
{ address: swapTickArrays[0], role: import_kit131.AccountRole.WRITABLE },
|
|
13160
|
+
{ address: swapTickArrays[1], role: import_kit131.AccountRole.WRITABLE },
|
|
13161
|
+
{ address: swapTickArrays[2], role: import_kit131.AccountRole.WRITABLE },
|
|
13162
|
+
{ address: swapTickArrays[3], role: import_kit131.AccountRole.WRITABLE },
|
|
13163
|
+
{ address: swapTickArrays[4], role: import_kit131.AccountRole.WRITABLE },
|
|
13164
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit131.AccountRole.WRITABLE },
|
|
13165
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit131.AccountRole.WRITABLE }
|
|
13189
13166
|
];
|
|
13190
13167
|
const remainingAccountsInfo = {
|
|
13191
13168
|
slices: [
|
|
@@ -13371,7 +13348,7 @@ async function liquidateTunaSpotPositionJupiterInstruction(authority, tunaPositi
|
|
|
13371
13348
|
|
|
13372
13349
|
// src/txbuilder/liquidateTunaSpotPositionOrca.ts
|
|
13373
13350
|
var import_whirlpools_client10 = require("@orca-so/whirlpools-client");
|
|
13374
|
-
var
|
|
13351
|
+
var import_kit132 = require("@solana/kit");
|
|
13375
13352
|
var import_memo15 = require("@solana-program/memo");
|
|
13376
13353
|
var import_token_202223 = require("@solana-program/token-2022");
|
|
13377
13354
|
async function liquidateTunaSpotPositionOrcaInstructions(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool, decreasePercent) {
|
|
@@ -13463,14 +13440,14 @@ async function liquidateTunaSpotPositionOrcaInstruction(authority, tunaPosition,
|
|
|
13463
13440
|
}))[0];
|
|
13464
13441
|
const swapTickArrays = await OrcaUtils.getSwapTickArrayAddresses(whirlpool);
|
|
13465
13442
|
const remainingAccounts = [
|
|
13466
|
-
{ address: swapTickArrays[0], role:
|
|
13467
|
-
{ address: swapTickArrays[1], role:
|
|
13468
|
-
{ address: swapTickArrays[2], role:
|
|
13469
|
-
{ address: swapTickArrays[3], role:
|
|
13470
|
-
{ address: swapTickArrays[4], role:
|
|
13471
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
13472
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
13473
|
-
{ address: orcaOracleAddress, role:
|
|
13443
|
+
{ address: swapTickArrays[0], role: import_kit132.AccountRole.WRITABLE },
|
|
13444
|
+
{ address: swapTickArrays[1], role: import_kit132.AccountRole.WRITABLE },
|
|
13445
|
+
{ address: swapTickArrays[2], role: import_kit132.AccountRole.WRITABLE },
|
|
13446
|
+
{ address: swapTickArrays[3], role: import_kit132.AccountRole.WRITABLE },
|
|
13447
|
+
{ address: swapTickArrays[4], role: import_kit132.AccountRole.WRITABLE },
|
|
13448
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit132.AccountRole.WRITABLE },
|
|
13449
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit132.AccountRole.WRITABLE },
|
|
13450
|
+
{ address: orcaOracleAddress, role: import_kit132.AccountRole.WRITABLE }
|
|
13474
13451
|
];
|
|
13475
13452
|
const remainingAccountsInfo = {
|
|
13476
13453
|
slices: [
|
|
@@ -13514,7 +13491,7 @@ async function liquidateTunaSpotPositionOrcaInstruction(authority, tunaPosition,
|
|
|
13514
13491
|
|
|
13515
13492
|
// src/txbuilder/openTunaLpPositionOrca.ts
|
|
13516
13493
|
var import_whirlpools_client11 = require("@orca-so/whirlpools-client");
|
|
13517
|
-
var
|
|
13494
|
+
var import_kit133 = require("@solana/kit");
|
|
13518
13495
|
var import_token_202224 = require("@solana-program/token-2022");
|
|
13519
13496
|
var import_assert15 = __toESM(require("assert"), 1);
|
|
13520
13497
|
async function openTunaLpPositionOrcaInstruction(rpc, authority, positionMint, whirlpoolAddress, args) {
|
|
@@ -13587,75 +13564,75 @@ function getOpenTunaLpPositionOrcaInstructionWithEphemeralSigner(input) {
|
|
|
13587
13564
|
accounts: [
|
|
13588
13565
|
{
|
|
13589
13566
|
address: input.authority.address,
|
|
13590
|
-
role:
|
|
13567
|
+
role: import_kit133.AccountRole.WRITABLE_SIGNER
|
|
13591
13568
|
},
|
|
13592
13569
|
{
|
|
13593
13570
|
address: input.mintA,
|
|
13594
|
-
role:
|
|
13571
|
+
role: import_kit133.AccountRole.READONLY
|
|
13595
13572
|
},
|
|
13596
13573
|
{
|
|
13597
13574
|
address: input.mintB,
|
|
13598
|
-
role:
|
|
13575
|
+
role: import_kit133.AccountRole.READONLY
|
|
13599
13576
|
},
|
|
13600
13577
|
{
|
|
13601
13578
|
address: input.tokenProgramA,
|
|
13602
|
-
role:
|
|
13579
|
+
role: import_kit133.AccountRole.READONLY
|
|
13603
13580
|
},
|
|
13604
13581
|
{
|
|
13605
13582
|
address: input.tokenProgramB,
|
|
13606
|
-
role:
|
|
13583
|
+
role: import_kit133.AccountRole.READONLY
|
|
13607
13584
|
},
|
|
13608
13585
|
{
|
|
13609
13586
|
address: input.market,
|
|
13610
|
-
role:
|
|
13587
|
+
role: import_kit133.AccountRole.READONLY
|
|
13611
13588
|
},
|
|
13612
13589
|
{
|
|
13613
13590
|
address: input.tunaPosition,
|
|
13614
|
-
role:
|
|
13591
|
+
role: import_kit133.AccountRole.WRITABLE
|
|
13615
13592
|
},
|
|
13616
13593
|
{
|
|
13617
13594
|
address: input.tunaPositionMint,
|
|
13618
|
-
role:
|
|
13595
|
+
role: import_kit133.AccountRole.WRITABLE_SIGNER
|
|
13619
13596
|
},
|
|
13620
13597
|
{
|
|
13621
13598
|
address: input.tunaPositionAta,
|
|
13622
|
-
role:
|
|
13599
|
+
role: import_kit133.AccountRole.WRITABLE
|
|
13623
13600
|
},
|
|
13624
13601
|
{
|
|
13625
13602
|
address: input.tunaPositionAtaA,
|
|
13626
|
-
role:
|
|
13603
|
+
role: import_kit133.AccountRole.WRITABLE
|
|
13627
13604
|
},
|
|
13628
13605
|
{
|
|
13629
13606
|
address: input.tunaPositionAtaB,
|
|
13630
|
-
role:
|
|
13607
|
+
role: import_kit133.AccountRole.WRITABLE
|
|
13631
13608
|
},
|
|
13632
13609
|
{
|
|
13633
13610
|
address: input.whirlpoolProgram,
|
|
13634
|
-
role:
|
|
13611
|
+
role: import_kit133.AccountRole.READONLY
|
|
13635
13612
|
},
|
|
13636
13613
|
{
|
|
13637
13614
|
address: input.whirlpool,
|
|
13638
|
-
role:
|
|
13615
|
+
role: import_kit133.AccountRole.READONLY
|
|
13639
13616
|
},
|
|
13640
13617
|
{
|
|
13641
13618
|
address: input.orcaPosition,
|
|
13642
|
-
role:
|
|
13619
|
+
role: import_kit133.AccountRole.WRITABLE
|
|
13643
13620
|
},
|
|
13644
13621
|
{
|
|
13645
13622
|
address: input.metadataUpdateAuth,
|
|
13646
|
-
role:
|
|
13623
|
+
role: import_kit133.AccountRole.READONLY
|
|
13647
13624
|
},
|
|
13648
13625
|
{
|
|
13649
13626
|
address: input.token2022Program,
|
|
13650
|
-
role:
|
|
13627
|
+
role: import_kit133.AccountRole.READONLY
|
|
13651
13628
|
},
|
|
13652
13629
|
{
|
|
13653
|
-
address: input.systemProgram ?? (0,
|
|
13654
|
-
role:
|
|
13630
|
+
address: input.systemProgram ?? (0, import_kit133.address)("11111111111111111111111111111111"),
|
|
13631
|
+
role: import_kit133.AccountRole.READONLY
|
|
13655
13632
|
},
|
|
13656
13633
|
{
|
|
13657
13634
|
address: input.associatedTokenProgram,
|
|
13658
|
-
role:
|
|
13635
|
+
role: import_kit133.AccountRole.READONLY
|
|
13659
13636
|
}
|
|
13660
13637
|
],
|
|
13661
13638
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
@@ -13666,7 +13643,7 @@ function getOpenTunaLpPositionOrcaInstructionWithEphemeralSigner(input) {
|
|
|
13666
13643
|
// src/txbuilder/openTunaLpPositionFusion.ts
|
|
13667
13644
|
var import_fusionamm_client11 = require("@crypticdot/fusionamm-client");
|
|
13668
13645
|
var import_fusionamm_client12 = require("@crypticdot/fusionamm-client");
|
|
13669
|
-
var
|
|
13646
|
+
var import_kit134 = require("@solana/kit");
|
|
13670
13647
|
var import_token_202225 = require("@solana-program/token-2022");
|
|
13671
13648
|
var import_assert16 = __toESM(require("assert"), 1);
|
|
13672
13649
|
async function openTunaLpPositionFusionInstruction(rpc, authority, positionMint, fusionPoolAddress, args) {
|
|
@@ -13739,75 +13716,75 @@ function getOpenTunaLpPositionFusionInstructionWithEphemeralSigner(input) {
|
|
|
13739
13716
|
accounts: [
|
|
13740
13717
|
{
|
|
13741
13718
|
address: input.authority.address,
|
|
13742
|
-
role:
|
|
13719
|
+
role: import_kit134.AccountRole.WRITABLE_SIGNER
|
|
13743
13720
|
},
|
|
13744
13721
|
{
|
|
13745
13722
|
address: input.mintA,
|
|
13746
|
-
role:
|
|
13723
|
+
role: import_kit134.AccountRole.READONLY
|
|
13747
13724
|
},
|
|
13748
13725
|
{
|
|
13749
13726
|
address: input.mintB,
|
|
13750
|
-
role:
|
|
13727
|
+
role: import_kit134.AccountRole.READONLY
|
|
13751
13728
|
},
|
|
13752
13729
|
{
|
|
13753
13730
|
address: input.tokenProgramA,
|
|
13754
|
-
role:
|
|
13731
|
+
role: import_kit134.AccountRole.READONLY
|
|
13755
13732
|
},
|
|
13756
13733
|
{
|
|
13757
13734
|
address: input.tokenProgramB,
|
|
13758
|
-
role:
|
|
13735
|
+
role: import_kit134.AccountRole.READONLY
|
|
13759
13736
|
},
|
|
13760
13737
|
{
|
|
13761
13738
|
address: input.market,
|
|
13762
|
-
role:
|
|
13739
|
+
role: import_kit134.AccountRole.READONLY
|
|
13763
13740
|
},
|
|
13764
13741
|
{
|
|
13765
13742
|
address: input.tunaPosition,
|
|
13766
|
-
role:
|
|
13743
|
+
role: import_kit134.AccountRole.WRITABLE
|
|
13767
13744
|
},
|
|
13768
13745
|
{
|
|
13769
13746
|
address: input.tunaPositionMint,
|
|
13770
|
-
role:
|
|
13747
|
+
role: import_kit134.AccountRole.WRITABLE_SIGNER
|
|
13771
13748
|
},
|
|
13772
13749
|
{
|
|
13773
13750
|
address: input.tunaPositionAta,
|
|
13774
|
-
role:
|
|
13751
|
+
role: import_kit134.AccountRole.WRITABLE
|
|
13775
13752
|
},
|
|
13776
13753
|
{
|
|
13777
13754
|
address: input.tunaPositionAtaA,
|
|
13778
|
-
role:
|
|
13755
|
+
role: import_kit134.AccountRole.WRITABLE
|
|
13779
13756
|
},
|
|
13780
13757
|
{
|
|
13781
13758
|
address: input.tunaPositionAtaB,
|
|
13782
|
-
role:
|
|
13759
|
+
role: import_kit134.AccountRole.WRITABLE
|
|
13783
13760
|
},
|
|
13784
13761
|
{
|
|
13785
13762
|
address: input.fusionammProgram,
|
|
13786
|
-
role:
|
|
13763
|
+
role: import_kit134.AccountRole.READONLY
|
|
13787
13764
|
},
|
|
13788
13765
|
{
|
|
13789
13766
|
address: input.fusionPool,
|
|
13790
|
-
role:
|
|
13767
|
+
role: import_kit134.AccountRole.READONLY
|
|
13791
13768
|
},
|
|
13792
13769
|
{
|
|
13793
13770
|
address: input.fusionPosition,
|
|
13794
|
-
role:
|
|
13771
|
+
role: import_kit134.AccountRole.WRITABLE
|
|
13795
13772
|
},
|
|
13796
13773
|
{
|
|
13797
13774
|
address: input.metadataUpdateAuth,
|
|
13798
|
-
role:
|
|
13775
|
+
role: import_kit134.AccountRole.READONLY
|
|
13799
13776
|
},
|
|
13800
13777
|
{
|
|
13801
13778
|
address: input.token2022Program,
|
|
13802
|
-
role:
|
|
13779
|
+
role: import_kit134.AccountRole.READONLY
|
|
13803
13780
|
},
|
|
13804
13781
|
{
|
|
13805
|
-
address: input.systemProgram ?? (0,
|
|
13806
|
-
role:
|
|
13782
|
+
address: input.systemProgram ?? (0, import_kit134.address)("11111111111111111111111111111111"),
|
|
13783
|
+
role: import_kit134.AccountRole.READONLY
|
|
13807
13784
|
},
|
|
13808
13785
|
{
|
|
13809
13786
|
address: input.associatedTokenProgram,
|
|
13810
|
-
role:
|
|
13787
|
+
role: import_kit134.AccountRole.READONLY
|
|
13811
13788
|
}
|
|
13812
13789
|
],
|
|
13813
13790
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
@@ -13820,7 +13797,7 @@ function getOpenTunaLpPositionFusionInstructionWithEphemeralSigner(input) {
|
|
|
13820
13797
|
// src/txbuilder/openAndIncreaseTunaLpPositionOrca.ts
|
|
13821
13798
|
var import_whirlpools_client12 = require("@orca-so/whirlpools-client");
|
|
13822
13799
|
var import_whirlpools_core4 = require("@orca-so/whirlpools-core");
|
|
13823
|
-
var
|
|
13800
|
+
var import_kit135 = require("@solana/kit");
|
|
13824
13801
|
var import_sysvars = require("@solana/sysvars");
|
|
13825
13802
|
var import_memo16 = require("@solana-program/memo");
|
|
13826
13803
|
var import_token_202226 = require("@solana-program/token-2022");
|
|
@@ -13848,10 +13825,9 @@ async function openAndIncreaseTunaLpPositionOrcaInstructions(rpc, authority, pos
|
|
|
13848
13825
|
const [mintA, mintB] = await (0, import_token_202226.fetchAllMaybeMint)(rpc, [whirlpool.data.tokenMintA, whirlpool.data.tokenMintB]);
|
|
13849
13826
|
(0, import_assert17.default)(mintA.exists, "Token A account not found");
|
|
13850
13827
|
(0, import_assert17.default)(mintB.exists, "Token B account not found");
|
|
13851
|
-
const
|
|
13852
|
-
|
|
13853
|
-
|
|
13854
|
-
]);
|
|
13828
|
+
const marketAddress = (await getMarketAddress(whirlpoolAddress))[0];
|
|
13829
|
+
const market = await fetchMarket(rpc, marketAddress);
|
|
13830
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [market.data.vaultA, market.data.vaultB]);
|
|
13855
13831
|
const createUserAtaAInstructions = await getCreateAtaInstructions(
|
|
13856
13832
|
rpc,
|
|
13857
13833
|
authority,
|
|
@@ -13932,7 +13908,7 @@ async function openAndIncreaseTunaLpPositionOrcaInstructions(rpc, authority, pos
|
|
|
13932
13908
|
cleanupInstructions.push(...createUserAtaBInstructions.cleanup);
|
|
13933
13909
|
return {
|
|
13934
13910
|
instructions,
|
|
13935
|
-
initializationCost: (0,
|
|
13911
|
+
initializationCost: (0, import_kit135.lamports)(nonRefundableRent)
|
|
13936
13912
|
};
|
|
13937
13913
|
}
|
|
13938
13914
|
async function openAndIncreaseTunaLpPositionOrcaInstruction(authority, positionMint, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool, args) {
|
|
@@ -13990,16 +13966,16 @@ async function openAndIncreaseTunaLpPositionOrcaInstruction(authority, positionM
|
|
|
13990
13966
|
const lowerTickArrayAddress = await OrcaUtils.getTickArrayAddressFromTickIndex(whirlpool, args.tickLowerIndex);
|
|
13991
13967
|
const upperTickArrayAddress = await OrcaUtils.getTickArrayAddressFromTickIndex(whirlpool, args.tickUpperIndex);
|
|
13992
13968
|
const remainingAccounts = [
|
|
13993
|
-
{ address: swapTickArrays[0], role:
|
|
13994
|
-
{ address: swapTickArrays[1], role:
|
|
13995
|
-
{ address: swapTickArrays[2], role:
|
|
13996
|
-
{ address: swapTickArrays[3], role:
|
|
13997
|
-
{ address: swapTickArrays[4], role:
|
|
13998
|
-
{ address: lowerTickArrayAddress, role:
|
|
13999
|
-
{ address: upperTickArrayAddress, role:
|
|
14000
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
14001
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
14002
|
-
{ address: orcaOracleAddress, role:
|
|
13969
|
+
{ address: swapTickArrays[0], role: import_kit135.AccountRole.WRITABLE },
|
|
13970
|
+
{ address: swapTickArrays[1], role: import_kit135.AccountRole.WRITABLE },
|
|
13971
|
+
{ address: swapTickArrays[2], role: import_kit135.AccountRole.WRITABLE },
|
|
13972
|
+
{ address: swapTickArrays[3], role: import_kit135.AccountRole.WRITABLE },
|
|
13973
|
+
{ address: swapTickArrays[4], role: import_kit135.AccountRole.WRITABLE },
|
|
13974
|
+
{ address: lowerTickArrayAddress, role: import_kit135.AccountRole.WRITABLE },
|
|
13975
|
+
{ address: upperTickArrayAddress, role: import_kit135.AccountRole.WRITABLE },
|
|
13976
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit135.AccountRole.WRITABLE },
|
|
13977
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit135.AccountRole.WRITABLE },
|
|
13978
|
+
{ address: orcaOracleAddress, role: import_kit135.AccountRole.WRITABLE }
|
|
14003
13979
|
];
|
|
14004
13980
|
const remainingAccountsInfo = {
|
|
14005
13981
|
slices: [
|
|
@@ -14084,123 +14060,123 @@ function getOpenAndIncreaseTunaLpPositionOrcaInstructionWithEphemeralSigner(inpu
|
|
|
14084
14060
|
accounts: [
|
|
14085
14061
|
{
|
|
14086
14062
|
address: input.authority.address,
|
|
14087
|
-
role:
|
|
14063
|
+
role: import_kit135.AccountRole.WRITABLE_SIGNER
|
|
14088
14064
|
},
|
|
14089
14065
|
{
|
|
14090
14066
|
address: input.tunaConfig,
|
|
14091
|
-
role:
|
|
14067
|
+
role: import_kit135.AccountRole.READONLY
|
|
14092
14068
|
},
|
|
14093
14069
|
{
|
|
14094
14070
|
address: input.mintA,
|
|
14095
|
-
role:
|
|
14071
|
+
role: import_kit135.AccountRole.READONLY
|
|
14096
14072
|
},
|
|
14097
14073
|
{
|
|
14098
14074
|
address: input.mintB,
|
|
14099
|
-
role:
|
|
14075
|
+
role: import_kit135.AccountRole.READONLY
|
|
14100
14076
|
},
|
|
14101
14077
|
{
|
|
14102
14078
|
address: input.market,
|
|
14103
|
-
role:
|
|
14079
|
+
role: import_kit135.AccountRole.WRITABLE
|
|
14104
14080
|
},
|
|
14105
14081
|
{
|
|
14106
14082
|
address: input.vaultA,
|
|
14107
|
-
role:
|
|
14083
|
+
role: import_kit135.AccountRole.WRITABLE
|
|
14108
14084
|
},
|
|
14109
14085
|
{
|
|
14110
14086
|
address: input.vaultB,
|
|
14111
|
-
role:
|
|
14087
|
+
role: import_kit135.AccountRole.WRITABLE
|
|
14112
14088
|
},
|
|
14113
14089
|
{
|
|
14114
14090
|
address: input.vaultAAta,
|
|
14115
|
-
role:
|
|
14091
|
+
role: import_kit135.AccountRole.WRITABLE
|
|
14116
14092
|
},
|
|
14117
14093
|
{
|
|
14118
14094
|
address: input.vaultBAta,
|
|
14119
|
-
role:
|
|
14095
|
+
role: import_kit135.AccountRole.WRITABLE
|
|
14120
14096
|
},
|
|
14121
14097
|
{
|
|
14122
14098
|
address: input.tunaPosition,
|
|
14123
|
-
role:
|
|
14099
|
+
role: import_kit135.AccountRole.WRITABLE
|
|
14124
14100
|
},
|
|
14125
14101
|
{
|
|
14126
14102
|
address: input.tunaPositionMint,
|
|
14127
|
-
role:
|
|
14103
|
+
role: import_kit135.AccountRole.WRITABLE
|
|
14128
14104
|
},
|
|
14129
14105
|
{
|
|
14130
14106
|
address: input.tunaPositionAta,
|
|
14131
|
-
role:
|
|
14107
|
+
role: import_kit135.AccountRole.WRITABLE
|
|
14132
14108
|
},
|
|
14133
14109
|
{
|
|
14134
14110
|
address: input.tunaPositionAtaA,
|
|
14135
|
-
role:
|
|
14111
|
+
role: import_kit135.AccountRole.WRITABLE
|
|
14136
14112
|
},
|
|
14137
14113
|
{
|
|
14138
14114
|
address: input.tunaPositionAtaB,
|
|
14139
|
-
role:
|
|
14115
|
+
role: import_kit135.AccountRole.WRITABLE
|
|
14140
14116
|
},
|
|
14141
14117
|
{
|
|
14142
14118
|
address: input.tunaPositionOwnerAtaA,
|
|
14143
|
-
role:
|
|
14119
|
+
role: import_kit135.AccountRole.WRITABLE
|
|
14144
14120
|
},
|
|
14145
14121
|
{
|
|
14146
14122
|
address: input.tunaPositionOwnerAtaB,
|
|
14147
|
-
role:
|
|
14123
|
+
role: import_kit135.AccountRole.WRITABLE
|
|
14148
14124
|
},
|
|
14149
14125
|
{
|
|
14150
14126
|
address: input.feeRecipientAtaA,
|
|
14151
|
-
role:
|
|
14127
|
+
role: import_kit135.AccountRole.WRITABLE
|
|
14152
14128
|
},
|
|
14153
14129
|
{
|
|
14154
14130
|
address: input.feeRecipientAtaB,
|
|
14155
|
-
role:
|
|
14131
|
+
role: import_kit135.AccountRole.WRITABLE
|
|
14156
14132
|
},
|
|
14157
14133
|
{
|
|
14158
14134
|
address: input.oraclePriceUpdateA,
|
|
14159
|
-
role:
|
|
14135
|
+
role: import_kit135.AccountRole.READONLY
|
|
14160
14136
|
},
|
|
14161
14137
|
{
|
|
14162
14138
|
address: input.oraclePriceUpdateB,
|
|
14163
|
-
role:
|
|
14139
|
+
role: import_kit135.AccountRole.READONLY
|
|
14164
14140
|
},
|
|
14165
14141
|
{
|
|
14166
14142
|
address: input.whirlpoolProgram,
|
|
14167
|
-
role:
|
|
14143
|
+
role: import_kit135.AccountRole.READONLY
|
|
14168
14144
|
},
|
|
14169
14145
|
{
|
|
14170
14146
|
address: input.whirlpool,
|
|
14171
|
-
role:
|
|
14147
|
+
role: import_kit135.AccountRole.WRITABLE
|
|
14172
14148
|
},
|
|
14173
14149
|
{
|
|
14174
14150
|
address: input.orcaPosition,
|
|
14175
|
-
role:
|
|
14151
|
+
role: import_kit135.AccountRole.WRITABLE
|
|
14176
14152
|
},
|
|
14177
14153
|
{
|
|
14178
14154
|
address: input.tokenProgramA,
|
|
14179
|
-
role:
|
|
14155
|
+
role: import_kit135.AccountRole.READONLY
|
|
14180
14156
|
},
|
|
14181
14157
|
{
|
|
14182
14158
|
address: input.tokenProgramB,
|
|
14183
|
-
role:
|
|
14159
|
+
role: import_kit135.AccountRole.READONLY
|
|
14184
14160
|
},
|
|
14185
14161
|
{
|
|
14186
14162
|
address: input.metadataUpdateAuth,
|
|
14187
|
-
role:
|
|
14163
|
+
role: import_kit135.AccountRole.READONLY
|
|
14188
14164
|
},
|
|
14189
14165
|
{
|
|
14190
14166
|
address: input.memoProgram,
|
|
14191
|
-
role:
|
|
14167
|
+
role: import_kit135.AccountRole.READONLY
|
|
14192
14168
|
},
|
|
14193
14169
|
{
|
|
14194
14170
|
address: input.token2022Program,
|
|
14195
|
-
role:
|
|
14171
|
+
role: import_kit135.AccountRole.READONLY
|
|
14196
14172
|
},
|
|
14197
14173
|
{
|
|
14198
|
-
address: input.systemProgram ?? (0,
|
|
14199
|
-
role:
|
|
14174
|
+
address: input.systemProgram ?? (0, import_kit135.address)("11111111111111111111111111111111"),
|
|
14175
|
+
role: import_kit135.AccountRole.READONLY
|
|
14200
14176
|
},
|
|
14201
14177
|
{
|
|
14202
14178
|
address: input.associatedTokenProgram,
|
|
14203
|
-
role:
|
|
14179
|
+
role: import_kit135.AccountRole.READONLY
|
|
14204
14180
|
}
|
|
14205
14181
|
],
|
|
14206
14182
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
@@ -14213,7 +14189,7 @@ function getOpenAndIncreaseTunaLpPositionOrcaInstructionWithEphemeralSigner(inpu
|
|
|
14213
14189
|
// src/txbuilder/openAndIncreaseTunaLpPositionFusion.ts
|
|
14214
14190
|
var import_fusionamm_client13 = require("@crypticdot/fusionamm-client");
|
|
14215
14191
|
var import_fusionamm_core4 = require("@crypticdot/fusionamm-core");
|
|
14216
|
-
var
|
|
14192
|
+
var import_kit136 = require("@solana/kit");
|
|
14217
14193
|
var import_sysvars2 = require("@solana/sysvars");
|
|
14218
14194
|
var import_memo17 = require("@solana-program/memo");
|
|
14219
14195
|
var import_token_202227 = require("@solana-program/token-2022");
|
|
@@ -14230,10 +14206,9 @@ async function openAndIncreaseTunaLpPositionFusionInstructions(rpc, authority, p
|
|
|
14230
14206
|
const [mintA, mintB] = await (0, import_token_202227.fetchAllMaybeMint)(rpc, [fusionPool.data.tokenMintA, fusionPool.data.tokenMintB]);
|
|
14231
14207
|
(0, import_assert18.default)(mintA.exists, "Token A account not found");
|
|
14232
14208
|
(0, import_assert18.default)(mintB.exists, "Token B account not found");
|
|
14233
|
-
const
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
]);
|
|
14209
|
+
const marketAddress = (await getMarketAddress(fusionPoolAddress))[0];
|
|
14210
|
+
const market = await fetchMarket(rpc, marketAddress);
|
|
14211
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [market.data.vaultA, market.data.vaultB]);
|
|
14237
14212
|
const createUserAtaAInstructions = await getCreateAtaInstructions(
|
|
14238
14213
|
rpc,
|
|
14239
14214
|
authority,
|
|
@@ -14312,7 +14287,7 @@ async function openAndIncreaseTunaLpPositionFusionInstructions(rpc, authority, p
|
|
|
14312
14287
|
cleanupInstructions.push(...createUserAtaBInstructions.cleanup);
|
|
14313
14288
|
return {
|
|
14314
14289
|
instructions,
|
|
14315
|
-
initializationCost: (0,
|
|
14290
|
+
initializationCost: (0, import_kit136.lamports)(nonRefundableRent)
|
|
14316
14291
|
};
|
|
14317
14292
|
}
|
|
14318
14293
|
async function openAndIncreaseTunaLpPositionFusionInstruction(authority, positionMint, tunaConfig, mintA, mintB, vaultA, vaultB, fusionPool, args) {
|
|
@@ -14369,15 +14344,15 @@ async function openAndIncreaseTunaLpPositionFusionInstruction(authority, positio
|
|
|
14369
14344
|
const lowerTickArrayAddress = await FusionUtils.getTickArrayAddressFromTickIndex(fusionPool, args.tickLowerIndex);
|
|
14370
14345
|
const upperTickArrayAddress = await FusionUtils.getTickArrayAddressFromTickIndex(fusionPool, args.tickUpperIndex);
|
|
14371
14346
|
const remainingAccounts = [
|
|
14372
|
-
{ address: swapTickArrays[0], role:
|
|
14373
|
-
{ address: swapTickArrays[1], role:
|
|
14374
|
-
{ address: swapTickArrays[2], role:
|
|
14375
|
-
{ address: swapTickArrays[3], role:
|
|
14376
|
-
{ address: swapTickArrays[4], role:
|
|
14377
|
-
{ address: lowerTickArrayAddress, role:
|
|
14378
|
-
{ address: upperTickArrayAddress, role:
|
|
14379
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
14380
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
14347
|
+
{ address: swapTickArrays[0], role: import_kit136.AccountRole.WRITABLE },
|
|
14348
|
+
{ address: swapTickArrays[1], role: import_kit136.AccountRole.WRITABLE },
|
|
14349
|
+
{ address: swapTickArrays[2], role: import_kit136.AccountRole.WRITABLE },
|
|
14350
|
+
{ address: swapTickArrays[3], role: import_kit136.AccountRole.WRITABLE },
|
|
14351
|
+
{ address: swapTickArrays[4], role: import_kit136.AccountRole.WRITABLE },
|
|
14352
|
+
{ address: lowerTickArrayAddress, role: import_kit136.AccountRole.WRITABLE },
|
|
14353
|
+
{ address: upperTickArrayAddress, role: import_kit136.AccountRole.WRITABLE },
|
|
14354
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit136.AccountRole.WRITABLE },
|
|
14355
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit136.AccountRole.WRITABLE }
|
|
14381
14356
|
];
|
|
14382
14357
|
const remainingAccountsInfo = {
|
|
14383
14358
|
slices: [
|
|
@@ -14461,123 +14436,123 @@ function getOpenAndIncreaseTunaLpPositionFusionInstructionWithEphemeralSigner(in
|
|
|
14461
14436
|
accounts: [
|
|
14462
14437
|
{
|
|
14463
14438
|
address: input.authority.address,
|
|
14464
|
-
role:
|
|
14439
|
+
role: import_kit136.AccountRole.WRITABLE_SIGNER
|
|
14465
14440
|
},
|
|
14466
14441
|
{
|
|
14467
14442
|
address: input.tunaConfig,
|
|
14468
|
-
role:
|
|
14443
|
+
role: import_kit136.AccountRole.READONLY
|
|
14469
14444
|
},
|
|
14470
14445
|
{
|
|
14471
14446
|
address: input.mintA,
|
|
14472
|
-
role:
|
|
14447
|
+
role: import_kit136.AccountRole.READONLY
|
|
14473
14448
|
},
|
|
14474
14449
|
{
|
|
14475
14450
|
address: input.mintB,
|
|
14476
|
-
role:
|
|
14451
|
+
role: import_kit136.AccountRole.READONLY
|
|
14477
14452
|
},
|
|
14478
14453
|
{
|
|
14479
14454
|
address: input.tokenProgramA,
|
|
14480
|
-
role:
|
|
14455
|
+
role: import_kit136.AccountRole.READONLY
|
|
14481
14456
|
},
|
|
14482
14457
|
{
|
|
14483
14458
|
address: input.tokenProgramB,
|
|
14484
|
-
role:
|
|
14459
|
+
role: import_kit136.AccountRole.READONLY
|
|
14485
14460
|
},
|
|
14486
14461
|
{
|
|
14487
14462
|
address: input.market,
|
|
14488
|
-
role:
|
|
14463
|
+
role: import_kit136.AccountRole.WRITABLE
|
|
14489
14464
|
},
|
|
14490
14465
|
{
|
|
14491
14466
|
address: input.vaultA,
|
|
14492
|
-
role:
|
|
14467
|
+
role: import_kit136.AccountRole.WRITABLE
|
|
14493
14468
|
},
|
|
14494
14469
|
{
|
|
14495
14470
|
address: input.vaultB,
|
|
14496
|
-
role:
|
|
14471
|
+
role: import_kit136.AccountRole.WRITABLE
|
|
14497
14472
|
},
|
|
14498
14473
|
{
|
|
14499
14474
|
address: input.vaultAAta,
|
|
14500
|
-
role:
|
|
14475
|
+
role: import_kit136.AccountRole.WRITABLE
|
|
14501
14476
|
},
|
|
14502
14477
|
{
|
|
14503
14478
|
address: input.vaultBAta,
|
|
14504
|
-
role:
|
|
14479
|
+
role: import_kit136.AccountRole.WRITABLE
|
|
14505
14480
|
},
|
|
14506
14481
|
{
|
|
14507
14482
|
address: input.tunaPosition,
|
|
14508
|
-
role:
|
|
14483
|
+
role: import_kit136.AccountRole.WRITABLE
|
|
14509
14484
|
},
|
|
14510
14485
|
{
|
|
14511
14486
|
address: input.tunaPositionMint,
|
|
14512
|
-
role:
|
|
14487
|
+
role: import_kit136.AccountRole.WRITABLE
|
|
14513
14488
|
},
|
|
14514
14489
|
{
|
|
14515
14490
|
address: input.tunaPositionAta,
|
|
14516
|
-
role:
|
|
14491
|
+
role: import_kit136.AccountRole.WRITABLE
|
|
14517
14492
|
},
|
|
14518
14493
|
{
|
|
14519
14494
|
address: input.tunaPositionAtaA,
|
|
14520
|
-
role:
|
|
14495
|
+
role: import_kit136.AccountRole.WRITABLE
|
|
14521
14496
|
},
|
|
14522
14497
|
{
|
|
14523
14498
|
address: input.tunaPositionAtaB,
|
|
14524
|
-
role:
|
|
14499
|
+
role: import_kit136.AccountRole.WRITABLE
|
|
14525
14500
|
},
|
|
14526
14501
|
{
|
|
14527
14502
|
address: input.tunaPositionOwnerAtaA,
|
|
14528
|
-
role:
|
|
14503
|
+
role: import_kit136.AccountRole.WRITABLE
|
|
14529
14504
|
},
|
|
14530
14505
|
{
|
|
14531
14506
|
address: input.tunaPositionOwnerAtaB,
|
|
14532
|
-
role:
|
|
14507
|
+
role: import_kit136.AccountRole.WRITABLE
|
|
14533
14508
|
},
|
|
14534
14509
|
{
|
|
14535
14510
|
address: input.feeRecipientAtaA,
|
|
14536
|
-
role:
|
|
14511
|
+
role: import_kit136.AccountRole.WRITABLE
|
|
14537
14512
|
},
|
|
14538
14513
|
{
|
|
14539
14514
|
address: input.feeRecipientAtaB,
|
|
14540
|
-
role:
|
|
14515
|
+
role: import_kit136.AccountRole.WRITABLE
|
|
14541
14516
|
},
|
|
14542
14517
|
{
|
|
14543
14518
|
address: input.oraclePriceUpdateA,
|
|
14544
|
-
role:
|
|
14519
|
+
role: import_kit136.AccountRole.READONLY
|
|
14545
14520
|
},
|
|
14546
14521
|
{
|
|
14547
14522
|
address: input.oraclePriceUpdateB,
|
|
14548
|
-
role:
|
|
14523
|
+
role: import_kit136.AccountRole.READONLY
|
|
14549
14524
|
},
|
|
14550
14525
|
{
|
|
14551
14526
|
address: input.fusionammProgram,
|
|
14552
|
-
role:
|
|
14527
|
+
role: import_kit136.AccountRole.READONLY
|
|
14553
14528
|
},
|
|
14554
14529
|
{
|
|
14555
14530
|
address: input.fusionPool,
|
|
14556
|
-
role:
|
|
14531
|
+
role: import_kit136.AccountRole.WRITABLE
|
|
14557
14532
|
},
|
|
14558
14533
|
{
|
|
14559
14534
|
address: input.fusionPosition,
|
|
14560
|
-
role:
|
|
14535
|
+
role: import_kit136.AccountRole.WRITABLE
|
|
14561
14536
|
},
|
|
14562
14537
|
{
|
|
14563
14538
|
address: input.metadataUpdateAuth,
|
|
14564
|
-
role:
|
|
14539
|
+
role: import_kit136.AccountRole.READONLY
|
|
14565
14540
|
},
|
|
14566
14541
|
{
|
|
14567
14542
|
address: input.memoProgram,
|
|
14568
|
-
role:
|
|
14543
|
+
role: import_kit136.AccountRole.READONLY
|
|
14569
14544
|
},
|
|
14570
14545
|
{
|
|
14571
14546
|
address: input.token2022Program,
|
|
14572
|
-
role:
|
|
14547
|
+
role: import_kit136.AccountRole.READONLY
|
|
14573
14548
|
},
|
|
14574
14549
|
{
|
|
14575
|
-
address: input.systemProgram ?? (0,
|
|
14576
|
-
role:
|
|
14550
|
+
address: input.systemProgram ?? (0, import_kit136.address)("11111111111111111111111111111111"),
|
|
14551
|
+
role: import_kit136.AccountRole.READONLY
|
|
14577
14552
|
},
|
|
14578
14553
|
{
|
|
14579
14554
|
address: input.associatedTokenProgram,
|
|
14580
|
-
role:
|
|
14555
|
+
role: import_kit136.AccountRole.READONLY
|
|
14581
14556
|
}
|
|
14582
14557
|
],
|
|
14583
14558
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
@@ -14590,17 +14565,17 @@ function getOpenAndIncreaseTunaLpPositionFusionInstructionWithEphemeralSigner(in
|
|
|
14590
14565
|
// src/txbuilder/openTunaSpotPosition.ts
|
|
14591
14566
|
var import_fusionamm_client14 = require("@crypticdot/fusionamm-client");
|
|
14592
14567
|
var import_whirlpools_client13 = require("@orca-so/whirlpools-client");
|
|
14593
|
-
var
|
|
14568
|
+
var import_kit137 = require("@solana/kit");
|
|
14594
14569
|
var import_token_202228 = require("@solana-program/token-2022");
|
|
14595
14570
|
var import_assert19 = __toESM(require("assert"), 1);
|
|
14596
14571
|
async function openTunaSpotPositionInstructions(rpc, authority, poolAddress, args) {
|
|
14597
|
-
const poolAccount = await (0,
|
|
14572
|
+
const poolAccount = await (0, import_kit137.fetchEncodedAccount)(rpc, poolAddress);
|
|
14598
14573
|
(0, import_assert19.default)(poolAccount.exists, "Pool account not found");
|
|
14599
14574
|
let pool;
|
|
14600
14575
|
if (poolAccount.programAddress == import_fusionamm_client14.FUSIONAMM_PROGRAM_ADDRESS) {
|
|
14601
|
-
pool = (0,
|
|
14576
|
+
pool = (0, import_kit137.decodeAccount)(poolAccount, (0, import_fusionamm_client14.getFusionPoolDecoder)());
|
|
14602
14577
|
} else if (poolAccount.programAddress == import_whirlpools_client13.WHIRLPOOL_PROGRAM_ADDRESS) {
|
|
14603
|
-
pool = (0,
|
|
14578
|
+
pool = (0, import_kit137.decodeAccount)(poolAccount, (0, import_whirlpools_client13.getWhirlpoolDecoder)());
|
|
14604
14579
|
} else {
|
|
14605
14580
|
throw new Error("Incorrect Fusion or Orca pool account");
|
|
14606
14581
|
}
|
|
@@ -14640,7 +14615,7 @@ async function openTunaSpotPositionInstruction(authority, mintA, mintB, poolAddr
|
|
|
14640
14615
|
// src/txbuilder/decreaseTunaLpPositionOrca.ts
|
|
14641
14616
|
var import_whirlpools_client14 = require("@orca-so/whirlpools-client");
|
|
14642
14617
|
var import_whirlpools_core5 = require("@orca-so/whirlpools-core");
|
|
14643
|
-
var
|
|
14618
|
+
var import_kit138 = require("@solana/kit");
|
|
14644
14619
|
var import_memo18 = require("@solana-program/memo");
|
|
14645
14620
|
var import_token_202229 = require("@solana-program/token-2022");
|
|
14646
14621
|
var import_assert20 = __toESM(require("assert"), 1);
|
|
@@ -14650,10 +14625,9 @@ async function decreaseTunaLpPositionOrcaInstructions(rpc, authority, positionMi
|
|
|
14650
14625
|
const orcaPosition = await (0, import_whirlpools_client14.fetchPosition)(rpc, (await (0, import_whirlpools_client14.getPositionAddress)(positionMint))[0]);
|
|
14651
14626
|
const whirlpool = await (0, import_whirlpools_client14.fetchMaybeWhirlpool)(rpc, tunaPosition.data.pool);
|
|
14652
14627
|
if (!whirlpool.exists) throw new Error("Whirlpool account not found");
|
|
14653
|
-
const
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
]);
|
|
14628
|
+
const marketAddress = (await getMarketAddress(tunaPosition.data.pool))[0];
|
|
14629
|
+
const market = await fetchMarket(rpc, marketAddress);
|
|
14630
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [market.data.vaultA, market.data.vaultB]);
|
|
14657
14631
|
const [mintA, mintB, ...rewardMints] = await (0, import_token_202229.fetchAllMaybeMint)(rpc, [
|
|
14658
14632
|
whirlpool.data.tokenMintA,
|
|
14659
14633
|
whirlpool.data.tokenMintB,
|
|
@@ -14662,7 +14636,7 @@ async function decreaseTunaLpPositionOrcaInstructions(rpc, authority, positionMi
|
|
|
14662
14636
|
const allMints = [mintA, mintB, ...rewardMints];
|
|
14663
14637
|
(0, import_assert20.default)(mintA.exists, "Token A account not found");
|
|
14664
14638
|
(0, import_assert20.default)(mintB.exists, "Token B account not found");
|
|
14665
|
-
(0,
|
|
14639
|
+
(0, import_kit138.assertAccountsExist)(rewardMints);
|
|
14666
14640
|
const lowerTickArrayStartIndex = (0, import_whirlpools_core5.getTickArrayStartTickIndex)(
|
|
14667
14641
|
tunaPosition.data.tickLowerIndex,
|
|
14668
14642
|
whirlpool.data.tickSpacing
|
|
@@ -14774,16 +14748,16 @@ async function decreaseTunaLpPositionOrcaInstruction(authority, tunaPosition, mi
|
|
|
14774
14748
|
tunaPosition.data.tickUpperIndex
|
|
14775
14749
|
);
|
|
14776
14750
|
const remainingAccounts = [
|
|
14777
|
-
{ address: swapTickArrays[0], role:
|
|
14778
|
-
{ address: swapTickArrays[1], role:
|
|
14779
|
-
{ address: swapTickArrays[2], role:
|
|
14780
|
-
{ address: swapTickArrays[3], role:
|
|
14781
|
-
{ address: swapTickArrays[4], role:
|
|
14782
|
-
{ address: lowerTickArrayAddress, role:
|
|
14783
|
-
{ address: upperTickArrayAddress, role:
|
|
14784
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
14785
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
14786
|
-
{ address: orcaOracleAddress, role:
|
|
14751
|
+
{ address: swapTickArrays[0], role: import_kit138.AccountRole.WRITABLE },
|
|
14752
|
+
{ address: swapTickArrays[1], role: import_kit138.AccountRole.WRITABLE },
|
|
14753
|
+
{ address: swapTickArrays[2], role: import_kit138.AccountRole.WRITABLE },
|
|
14754
|
+
{ address: swapTickArrays[3], role: import_kit138.AccountRole.WRITABLE },
|
|
14755
|
+
{ address: swapTickArrays[4], role: import_kit138.AccountRole.WRITABLE },
|
|
14756
|
+
{ address: lowerTickArrayAddress, role: import_kit138.AccountRole.WRITABLE },
|
|
14757
|
+
{ address: upperTickArrayAddress, role: import_kit138.AccountRole.WRITABLE },
|
|
14758
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit138.AccountRole.WRITABLE },
|
|
14759
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit138.AccountRole.WRITABLE },
|
|
14760
|
+
{ address: orcaOracleAddress, role: import_kit138.AccountRole.WRITABLE }
|
|
14787
14761
|
];
|
|
14788
14762
|
for (const rewardIndex of rewardIndicesToClaim) {
|
|
14789
14763
|
const rewardInfo = whirlpool.data.rewardInfos[rewardIndex];
|
|
@@ -14794,10 +14768,10 @@ async function decreaseTunaLpPositionOrcaInstruction(authority, tunaPosition, mi
|
|
|
14794
14768
|
mint: rewardMint.address,
|
|
14795
14769
|
tokenProgram: rewardMint.programAddress
|
|
14796
14770
|
});
|
|
14797
|
-
remainingAccounts.push({ address: rewardMint.address, role:
|
|
14798
|
-
remainingAccounts.push({ address: rewardMint.programAddress, role:
|
|
14799
|
-
remainingAccounts.push({ address: ownerAta[0], role:
|
|
14800
|
-
remainingAccounts.push({ address: rewardInfo.vault, role:
|
|
14771
|
+
remainingAccounts.push({ address: rewardMint.address, role: import_kit138.AccountRole.READONLY });
|
|
14772
|
+
remainingAccounts.push({ address: rewardMint.programAddress, role: import_kit138.AccountRole.READONLY });
|
|
14773
|
+
remainingAccounts.push({ address: ownerAta[0], role: import_kit138.AccountRole.WRITABLE });
|
|
14774
|
+
remainingAccounts.push({ address: rewardInfo.vault, role: import_kit138.AccountRole.WRITABLE });
|
|
14801
14775
|
}
|
|
14802
14776
|
const remainingAccountsInfo = {
|
|
14803
14777
|
slices: [
|
|
@@ -14845,7 +14819,7 @@ async function decreaseTunaLpPositionOrcaInstruction(authority, tunaPosition, mi
|
|
|
14845
14819
|
|
|
14846
14820
|
// src/txbuilder/decreaseTunaLpPositionFusion.ts
|
|
14847
14821
|
var import_fusionamm_client15 = require("@crypticdot/fusionamm-client");
|
|
14848
|
-
var
|
|
14822
|
+
var import_kit139 = require("@solana/kit");
|
|
14849
14823
|
var import_memo19 = require("@solana-program/memo");
|
|
14850
14824
|
var import_token_202230 = require("@solana-program/token-2022");
|
|
14851
14825
|
var import_assert21 = __toESM(require("assert"), 1);
|
|
@@ -14854,13 +14828,12 @@ async function decreaseTunaLpPositionFusionInstructions(rpc, authority, position
|
|
|
14854
14828
|
if (!tunaPosition.exists) throw new Error("Tuna position account not found");
|
|
14855
14829
|
const fusionPool = await (0, import_fusionamm_client15.fetchMaybeFusionPool)(rpc, tunaPosition.data.pool);
|
|
14856
14830
|
if (!fusionPool.exists) throw new Error("FusionPool account not found");
|
|
14857
|
-
const [vaultA, vaultB] = await fetchAllVault(rpc, [
|
|
14858
|
-
(await getLendingVaultAddress(fusionPool.data.tokenMintA))[0],
|
|
14859
|
-
(await getLendingVaultAddress(fusionPool.data.tokenMintB))[0]
|
|
14860
|
-
]);
|
|
14861
14831
|
const [mintA, mintB] = await (0, import_token_202230.fetchAllMaybeMint)(rpc, [fusionPool.data.tokenMintA, fusionPool.data.tokenMintB]);
|
|
14862
14832
|
(0, import_assert21.default)(mintA.exists, "Token A account not found");
|
|
14863
14833
|
(0, import_assert21.default)(mintB.exists, "Token B account not found");
|
|
14834
|
+
const marketAddress = (await getMarketAddress(tunaPosition.data.pool))[0];
|
|
14835
|
+
const market = await fetchMarket(rpc, marketAddress);
|
|
14836
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [market.data.vaultA, market.data.vaultB]);
|
|
14864
14837
|
const instructions = [];
|
|
14865
14838
|
if (!createInstructions) createInstructions = instructions;
|
|
14866
14839
|
if (!cleanupInstructions) cleanupInstructions = instructions;
|
|
@@ -14945,15 +14918,15 @@ async function decreaseTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
14945
14918
|
tunaPosition.data.tickUpperIndex
|
|
14946
14919
|
);
|
|
14947
14920
|
const remainingAccounts = [
|
|
14948
|
-
{ address: swapTickArrays[0], role:
|
|
14949
|
-
{ address: swapTickArrays[1], role:
|
|
14950
|
-
{ address: swapTickArrays[2], role:
|
|
14951
|
-
{ address: swapTickArrays[3], role:
|
|
14952
|
-
{ address: swapTickArrays[4], role:
|
|
14953
|
-
{ address: lowerTickArrayAddress, role:
|
|
14954
|
-
{ address: upperTickArrayAddress, role:
|
|
14955
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
14956
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
14921
|
+
{ address: swapTickArrays[0], role: import_kit139.AccountRole.WRITABLE },
|
|
14922
|
+
{ address: swapTickArrays[1], role: import_kit139.AccountRole.WRITABLE },
|
|
14923
|
+
{ address: swapTickArrays[2], role: import_kit139.AccountRole.WRITABLE },
|
|
14924
|
+
{ address: swapTickArrays[3], role: import_kit139.AccountRole.WRITABLE },
|
|
14925
|
+
{ address: swapTickArrays[4], role: import_kit139.AccountRole.WRITABLE },
|
|
14926
|
+
{ address: lowerTickArrayAddress, role: import_kit139.AccountRole.WRITABLE },
|
|
14927
|
+
{ address: upperTickArrayAddress, role: import_kit139.AccountRole.WRITABLE },
|
|
14928
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit139.AccountRole.WRITABLE },
|
|
14929
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit139.AccountRole.WRITABLE }
|
|
14957
14930
|
];
|
|
14958
14931
|
const remainingAccountsInfo = {
|
|
14959
14932
|
slices: [
|
|
@@ -14998,12 +14971,13 @@ async function decreaseTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
14998
14971
|
// src/txbuilder/repayBadDebt.ts
|
|
14999
14972
|
var import_memo20 = require("@solana-program/memo");
|
|
15000
14973
|
var import_token_202231 = require("@solana-program/token-2022");
|
|
15001
|
-
async function repayBadDebtInstruction(rpc, authority,
|
|
15002
|
-
const
|
|
14974
|
+
async function repayBadDebtInstruction(rpc, authority, vaultAddress, funds, shares) {
|
|
14975
|
+
const vault = await fetchMaybeVault(rpc, vaultAddress);
|
|
14976
|
+
if (!vault.exists) throw new Error("Vault account not found");
|
|
14977
|
+
const mint = await (0, import_token_202231.fetchMaybeMint)(rpc, vault.data.mint);
|
|
15003
14978
|
if (!mint.exists) throw new Error("Mint account not found");
|
|
15004
|
-
const vault = (await getLendingVaultAddress(mint.address))[0];
|
|
15005
14979
|
const vaultAta = (await (0, import_token_202231.findAssociatedTokenPda)({
|
|
15006
|
-
owner: vault,
|
|
14980
|
+
owner: vault.address,
|
|
15007
14981
|
mint: mint.address,
|
|
15008
14982
|
tokenProgram: mint.programAddress
|
|
15009
14983
|
}))[0];
|
|
@@ -15017,7 +14991,7 @@ async function repayBadDebtInstruction(rpc, authority, mintAddress, funds, share
|
|
|
15017
14991
|
mint: mint.address,
|
|
15018
14992
|
vaultAta,
|
|
15019
14993
|
authority,
|
|
15020
|
-
vault,
|
|
14994
|
+
vault: vault.address,
|
|
15021
14995
|
tokenProgram: mint.programAddress,
|
|
15022
14996
|
memoProgram: import_memo20.MEMO_PROGRAM_ADDRESS,
|
|
15023
14997
|
funds,
|
|
@@ -15108,14 +15082,6 @@ var import_memo21 = require("@solana-program/memo");
|
|
|
15108
15082
|
var import_token_202233 = require("@solana-program/token-2022");
|
|
15109
15083
|
async function withdrawInstructions(rpc, authority, mintAddress, vaultAddress, funds, shares) {
|
|
15110
15084
|
const instructions = [];
|
|
15111
|
-
if (!mintAddress && !vaultAddress) {
|
|
15112
|
-
throw new Error("Mint or vault address must be provided.");
|
|
15113
|
-
}
|
|
15114
|
-
if (vaultAddress && !mintAddress) {
|
|
15115
|
-
const vault = await fetchMaybeVault(rpc, vaultAddress);
|
|
15116
|
-
if (!vault.exists) throw new Error("Vault account not found");
|
|
15117
|
-
mintAddress = vault.data.mint;
|
|
15118
|
-
}
|
|
15119
15085
|
const mint = await (0, import_token_202233.fetchMaybeMint)(rpc, mintAddress);
|
|
15120
15086
|
if (!mint.exists) throw new Error("Mint account not found");
|
|
15121
15087
|
const createUserAtaInstructions = await getCreateAtaInstructions(
|
|
@@ -15165,7 +15131,7 @@ async function withdrawInstruction(authority, mint, vault, funds, shares) {
|
|
|
15165
15131
|
// src/txbuilder/createMarketLookupTable.ts
|
|
15166
15132
|
var import_fusionamm_client16 = require("@crypticdot/fusionamm-client");
|
|
15167
15133
|
var import_whirlpools_client15 = require("@orca-so/whirlpools-client");
|
|
15168
|
-
var
|
|
15134
|
+
var import_kit140 = require("@solana/kit");
|
|
15169
15135
|
var import_address_lookup_table2 = require("@solana-program/address-lookup-table");
|
|
15170
15136
|
var import_memo22 = require("@solana-program/memo");
|
|
15171
15137
|
var import_system2 = require("@solana-program/system");
|
|
@@ -15205,7 +15171,7 @@ async function getAddressesForMarketLookupTable(rpc, poolAddress, marketMaker) {
|
|
|
15205
15171
|
}))[0];
|
|
15206
15172
|
const addresses = [
|
|
15207
15173
|
import_system2.SYSTEM_PROGRAM_ADDRESS,
|
|
15208
|
-
(0,
|
|
15174
|
+
(0, import_kit140.address)("SysvarRent111111111111111111111111111111111"),
|
|
15209
15175
|
import_token_202234.ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
15210
15176
|
import_token2.TOKEN_PROGRAM_ADDRESS,
|
|
15211
15177
|
import_token_202234.TOKEN_2022_PROGRAM_ADDRESS,
|
|
@@ -15365,7 +15331,7 @@ async function repayTunaLpPositionDebtInstruction(authority, positionMint, mintA
|
|
|
15365
15331
|
|
|
15366
15332
|
// src/txbuilder/rebalanceTunaLpPositionOrca.ts
|
|
15367
15333
|
var import_whirlpools_client16 = require("@orca-so/whirlpools-client");
|
|
15368
|
-
var
|
|
15334
|
+
var import_kit141 = require("@solana/kit");
|
|
15369
15335
|
var import_sysvars3 = require("@solana/sysvars");
|
|
15370
15336
|
var import_memo24 = require("@solana-program/memo");
|
|
15371
15337
|
var import_token_202236 = require("@solana-program/token-2022");
|
|
@@ -15378,10 +15344,9 @@ async function rebalanceTunaLpPositionOrcaInstructions(rpc, authority, positionM
|
|
|
15378
15344
|
if (!tunaPosition.exists) throw new Error("Tuna position account not found");
|
|
15379
15345
|
const whirlpool = await (0, import_whirlpools_client16.fetchMaybeWhirlpool)(rpc, tunaPosition.data.pool);
|
|
15380
15346
|
if (!whirlpool.exists) throw new Error("Whirlpool account not found");
|
|
15381
|
-
const
|
|
15382
|
-
|
|
15383
|
-
|
|
15384
|
-
]);
|
|
15347
|
+
const marketAddress = (await getMarketAddress(tunaPosition.data.pool))[0];
|
|
15348
|
+
const market = await fetchMarket(rpc, marketAddress);
|
|
15349
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [market.data.vaultA, market.data.vaultB]);
|
|
15385
15350
|
const [mintA, mintB] = await (0, import_token_202236.fetchAllMaybeMint)(rpc, [whirlpool.data.tokenMintA, whirlpool.data.tokenMintB]);
|
|
15386
15351
|
(0, import_assert24.default)(mintA.exists, "Token A account not found");
|
|
15387
15352
|
(0, import_assert24.default)(mintB.exists, "Token B account not found");
|
|
@@ -15448,7 +15413,7 @@ async function rebalanceTunaLpPositionOrcaInstructions(rpc, authority, positionM
|
|
|
15448
15413
|
cleanupInstructions.push(...internalCleanupInstructions);
|
|
15449
15414
|
return {
|
|
15450
15415
|
instructions,
|
|
15451
|
-
initializationCost: (0,
|
|
15416
|
+
initializationCost: (0, import_kit141.lamports)(nonRefundableRent)
|
|
15452
15417
|
};
|
|
15453
15418
|
}
|
|
15454
15419
|
async function rebalanceTunaLpPositionOrcaInstruction(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool) {
|
|
@@ -15492,18 +15457,18 @@ async function rebalanceTunaLpPositionOrcaInstruction(authority, tunaPosition, t
|
|
|
15492
15457
|
);
|
|
15493
15458
|
const secondaryTickArrays = await OrcaUtils.getTickArraysForRebalancedPosition(whirlpool, tunaPosition);
|
|
15494
15459
|
const remainingAccounts = [
|
|
15495
|
-
{ address: swapTickArrays[0], role:
|
|
15496
|
-
{ address: swapTickArrays[1], role:
|
|
15497
|
-
{ address: swapTickArrays[2], role:
|
|
15498
|
-
{ address: swapTickArrays[3], role:
|
|
15499
|
-
{ address: swapTickArrays[4], role:
|
|
15500
|
-
{ address: lowerTickArrayAddress, role:
|
|
15501
|
-
{ address: upperTickArrayAddress, role:
|
|
15502
|
-
{ address: secondaryTickArrays.lowerTickArrayAddress, role:
|
|
15503
|
-
{ address: secondaryTickArrays.upperTickArrayAddress, role:
|
|
15504
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
15505
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
15506
|
-
{ address: orcaOracleAddress, role:
|
|
15460
|
+
{ address: swapTickArrays[0], role: import_kit141.AccountRole.WRITABLE },
|
|
15461
|
+
{ address: swapTickArrays[1], role: import_kit141.AccountRole.WRITABLE },
|
|
15462
|
+
{ address: swapTickArrays[2], role: import_kit141.AccountRole.WRITABLE },
|
|
15463
|
+
{ address: swapTickArrays[3], role: import_kit141.AccountRole.WRITABLE },
|
|
15464
|
+
{ address: swapTickArrays[4], role: import_kit141.AccountRole.WRITABLE },
|
|
15465
|
+
{ address: lowerTickArrayAddress, role: import_kit141.AccountRole.WRITABLE },
|
|
15466
|
+
{ address: upperTickArrayAddress, role: import_kit141.AccountRole.WRITABLE },
|
|
15467
|
+
{ address: secondaryTickArrays.lowerTickArrayAddress, role: import_kit141.AccountRole.WRITABLE },
|
|
15468
|
+
{ address: secondaryTickArrays.upperTickArrayAddress, role: import_kit141.AccountRole.WRITABLE },
|
|
15469
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit141.AccountRole.WRITABLE },
|
|
15470
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit141.AccountRole.WRITABLE },
|
|
15471
|
+
{ address: orcaOracleAddress, role: import_kit141.AccountRole.WRITABLE }
|
|
15507
15472
|
];
|
|
15508
15473
|
const remainingAccountsInfo = {
|
|
15509
15474
|
slices: [
|
|
@@ -15547,7 +15512,7 @@ async function rebalanceTunaLpPositionOrcaInstruction(authority, tunaPosition, t
|
|
|
15547
15512
|
|
|
15548
15513
|
// src/txbuilder/rebalanceTunaLpPositionFusion.ts
|
|
15549
15514
|
var import_fusionamm_client17 = require("@crypticdot/fusionamm-client");
|
|
15550
|
-
var
|
|
15515
|
+
var import_kit142 = require("@solana/kit");
|
|
15551
15516
|
var import_sysvars4 = require("@solana/sysvars");
|
|
15552
15517
|
var import_memo25 = require("@solana-program/memo");
|
|
15553
15518
|
var import_token_202237 = require("@solana-program/token-2022");
|
|
@@ -15560,10 +15525,9 @@ async function rebalanceTunaLpPositionFusionInstructions(rpc, authority, positio
|
|
|
15560
15525
|
if (!tunaPosition.exists) throw new Error("Tuna position account not found");
|
|
15561
15526
|
const fusionPool = await (0, import_fusionamm_client17.fetchMaybeFusionPool)(rpc, tunaPosition.data.pool);
|
|
15562
15527
|
if (!fusionPool.exists) throw new Error("FusionPool account not found");
|
|
15563
|
-
const
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
]);
|
|
15528
|
+
const marketAddress = (await getMarketAddress(tunaPosition.data.pool))[0];
|
|
15529
|
+
const market = await fetchMarket(rpc, marketAddress);
|
|
15530
|
+
const [vaultA, vaultB] = await fetchAllVault(rpc, [market.data.vaultA, market.data.vaultB]);
|
|
15567
15531
|
const [mintA, mintB] = await (0, import_token_202237.fetchAllMaybeMint)(rpc, [fusionPool.data.tokenMintA, fusionPool.data.tokenMintB]);
|
|
15568
15532
|
(0, import_assert25.default)(mintA.exists, "Token A account not found");
|
|
15569
15533
|
(0, import_assert25.default)(mintB.exists, "Token B account not found");
|
|
@@ -15626,7 +15590,7 @@ async function rebalanceTunaLpPositionFusionInstructions(rpc, authority, positio
|
|
|
15626
15590
|
instructions.push(ix);
|
|
15627
15591
|
return {
|
|
15628
15592
|
instructions,
|
|
15629
|
-
initializationCost: (0,
|
|
15593
|
+
initializationCost: (0, import_kit142.lamports)(nonRefundableRent)
|
|
15630
15594
|
};
|
|
15631
15595
|
}
|
|
15632
15596
|
async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, fusionPool) {
|
|
@@ -15669,17 +15633,17 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
15669
15633
|
);
|
|
15670
15634
|
const secondaryTickArrays = await FusionUtils.getTickArraysForRebalancedPosition(fusionPool, tunaPosition);
|
|
15671
15635
|
const remainingAccounts = [
|
|
15672
|
-
{ address: swapTickArrays[0], role:
|
|
15673
|
-
{ address: swapTickArrays[1], role:
|
|
15674
|
-
{ address: swapTickArrays[2], role:
|
|
15675
|
-
{ address: swapTickArrays[3], role:
|
|
15676
|
-
{ address: swapTickArrays[4], role:
|
|
15677
|
-
{ address: lowerTickArrayAddress, role:
|
|
15678
|
-
{ address: upperTickArrayAddress, role:
|
|
15679
|
-
{ address: secondaryTickArrays.lowerTickArrayAddress, role:
|
|
15680
|
-
{ address: secondaryTickArrays.upperTickArrayAddress, role:
|
|
15681
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
15682
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
15636
|
+
{ address: swapTickArrays[0], role: import_kit142.AccountRole.WRITABLE },
|
|
15637
|
+
{ address: swapTickArrays[1], role: import_kit142.AccountRole.WRITABLE },
|
|
15638
|
+
{ address: swapTickArrays[2], role: import_kit142.AccountRole.WRITABLE },
|
|
15639
|
+
{ address: swapTickArrays[3], role: import_kit142.AccountRole.WRITABLE },
|
|
15640
|
+
{ address: swapTickArrays[4], role: import_kit142.AccountRole.WRITABLE },
|
|
15641
|
+
{ address: lowerTickArrayAddress, role: import_kit142.AccountRole.WRITABLE },
|
|
15642
|
+
{ address: upperTickArrayAddress, role: import_kit142.AccountRole.WRITABLE },
|
|
15643
|
+
{ address: secondaryTickArrays.lowerTickArrayAddress, role: import_kit142.AccountRole.WRITABLE },
|
|
15644
|
+
{ address: secondaryTickArrays.upperTickArrayAddress, role: import_kit142.AccountRole.WRITABLE },
|
|
15645
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit142.AccountRole.WRITABLE },
|
|
15646
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit142.AccountRole.WRITABLE }
|
|
15683
15647
|
];
|
|
15684
15648
|
const remainingAccountsInfo = {
|
|
15685
15649
|
slices: [
|
|
@@ -15732,11 +15696,11 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
15732
15696
|
COLLECT_REWARD_ORCA_DISCRIMINATOR,
|
|
15733
15697
|
COMPUTED_AMOUNT,
|
|
15734
15698
|
CREATE_MARKET_DISCRIMINATOR,
|
|
15735
|
-
|
|
15699
|
+
CREATE_MARKET_PERMISSIONLESS_DISCRIMINATOR,
|
|
15736
15700
|
CREATE_PRICE_UPDATE_DISCRIMINATOR,
|
|
15737
15701
|
CREATE_TUNA_CONFIG_DISCRIMINATOR,
|
|
15738
15702
|
CREATE_VAULT_DISCRIMINATOR,
|
|
15739
|
-
|
|
15703
|
+
CREATE_VAULT_PERMISSIONLESS_DISCRIMINATOR,
|
|
15740
15704
|
DECREASE_TUNA_LP_POSITION_FUSION_DISCRIMINATOR,
|
|
15741
15705
|
DECREASE_TUNA_LP_POSITION_ORCA_DISCRIMINATOR,
|
|
15742
15706
|
DEFAULT_ADDRESS,
|
|
@@ -15905,10 +15869,10 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
15905
15869
|
createAddressLookupTableForMarketInstructions,
|
|
15906
15870
|
createAddressLookupTableInstructions,
|
|
15907
15871
|
createMarketInstruction,
|
|
15908
|
-
|
|
15872
|
+
createMarketPermissionlessInstruction,
|
|
15909
15873
|
createTunaConfigInstruction,
|
|
15910
15874
|
createVaultInstructions,
|
|
15911
|
-
|
|
15875
|
+
createVaultPermissionlessInstructions,
|
|
15912
15876
|
decodeLendingPosition,
|
|
15913
15877
|
decodeMarket,
|
|
15914
15878
|
decodeTunaConfig,
|
|
@@ -16006,11 +15970,11 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
16006
15970
|
getCreateMarketInstructionDataCodec,
|
|
16007
15971
|
getCreateMarketInstructionDataDecoder,
|
|
16008
15972
|
getCreateMarketInstructionDataEncoder,
|
|
16009
|
-
|
|
16010
|
-
|
|
16011
|
-
|
|
16012
|
-
|
|
16013
|
-
|
|
15973
|
+
getCreateMarketPermissionlessDiscriminatorBytes,
|
|
15974
|
+
getCreateMarketPermissionlessInstruction,
|
|
15975
|
+
getCreateMarketPermissionlessInstructionDataCodec,
|
|
15976
|
+
getCreateMarketPermissionlessInstructionDataDecoder,
|
|
15977
|
+
getCreateMarketPermissionlessInstructionDataEncoder,
|
|
16014
15978
|
getCreatePriceUpdateDiscriminatorBytes,
|
|
16015
15979
|
getCreatePriceUpdateInstruction,
|
|
16016
15980
|
getCreatePriceUpdateInstructionDataCodec,
|
|
@@ -16026,11 +15990,11 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
16026
15990
|
getCreateVaultInstructionDataCodec,
|
|
16027
15991
|
getCreateVaultInstructionDataDecoder,
|
|
16028
15992
|
getCreateVaultInstructionDataEncoder,
|
|
16029
|
-
|
|
16030
|
-
|
|
16031
|
-
|
|
16032
|
-
|
|
16033
|
-
|
|
15993
|
+
getCreateVaultPermissionlessDiscriminatorBytes,
|
|
15994
|
+
getCreateVaultPermissionlessInstruction,
|
|
15995
|
+
getCreateVaultPermissionlessInstructionDataCodec,
|
|
15996
|
+
getCreateVaultPermissionlessInstructionDataDecoder,
|
|
15997
|
+
getCreateVaultPermissionlessInstructionDataEncoder,
|
|
16034
15998
|
getDecreaseTunaLpPositionFusionDiscriminatorBytes,
|
|
16035
15999
|
getDecreaseTunaLpPositionFusionInstruction,
|
|
16036
16000
|
getDecreaseTunaLpPositionFusionInstructionDataCodec,
|
|
@@ -16063,7 +16027,6 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
16063
16027
|
getLendingPositionEncoder,
|
|
16064
16028
|
getLendingPositionSize,
|
|
16065
16029
|
getLendingVaultAddress,
|
|
16066
|
-
getLendingVaultV2Address,
|
|
16067
16030
|
getLiquidateTunaLpPositionFusionDiscriminatorBytes,
|
|
16068
16031
|
getLiquidateTunaLpPositionFusionInstruction,
|
|
16069
16032
|
getLiquidateTunaLpPositionFusionInstructionDataCodec,
|
|
@@ -16375,11 +16338,11 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
16375
16338
|
parseCollectFeesOrcaInstruction,
|
|
16376
16339
|
parseCollectRewardOrcaInstruction,
|
|
16377
16340
|
parseCreateMarketInstruction,
|
|
16378
|
-
|
|
16341
|
+
parseCreateMarketPermissionlessInstruction,
|
|
16379
16342
|
parseCreatePriceUpdateInstruction,
|
|
16380
16343
|
parseCreateTunaConfigInstruction,
|
|
16381
16344
|
parseCreateVaultInstruction,
|
|
16382
|
-
|
|
16345
|
+
parseCreateVaultPermissionlessInstruction,
|
|
16383
16346
|
parseDecreaseTunaLpPositionFusionInstruction,
|
|
16384
16347
|
parseDecreaseTunaLpPositionOrcaInstruction,
|
|
16385
16348
|
parseDepositInstruction,
|