@crypticdot/defituna-client 3.3.5 → 3.3.6
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.d.mts +81 -16
- package/dist/index.d.ts +81 -16
- package/dist/index.js +691 -424
- package/dist/index.mjs +455 -186
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -312,7 +312,9 @@ function getMarketEncoder() {
|
|
|
312
312
|
["rebalanceProtocolFee", getU32Encoder()],
|
|
313
313
|
["spotPositionSizeLimitA", getU64Encoder2()],
|
|
314
314
|
["spotPositionSizeLimitB", getU64Encoder2()],
|
|
315
|
-
["
|
|
315
|
+
["vaultA", getAddressEncoder2()],
|
|
316
|
+
["vaultB", getAddressEncoder2()],
|
|
317
|
+
["reserved", fixEncoderSize2(getBytesEncoder2(), 127)]
|
|
316
318
|
]),
|
|
317
319
|
(value) => ({ ...value, discriminator: MARKET_DISCRIMINATOR })
|
|
318
320
|
);
|
|
@@ -341,7 +343,9 @@ function getMarketDecoder() {
|
|
|
341
343
|
["rebalanceProtocolFee", getU32Decoder()],
|
|
342
344
|
["spotPositionSizeLimitA", getU64Decoder2()],
|
|
343
345
|
["spotPositionSizeLimitB", getU64Decoder2()],
|
|
344
|
-
["
|
|
346
|
+
["vaultA", getAddressDecoder2()],
|
|
347
|
+
["vaultB", getAddressDecoder2()],
|
|
348
|
+
["reserved", fixDecoderSize2(getBytesDecoder2(), 127)]
|
|
345
349
|
]);
|
|
346
350
|
}
|
|
347
351
|
function getMarketCodec() {
|
|
@@ -1006,8 +1010,9 @@ var TunaInstruction = /* @__PURE__ */ ((TunaInstruction2) => {
|
|
|
1006
1010
|
TunaInstruction2[TunaInstruction2["SetTunaLpPositionRebalanceThreshold"] = 45] = "SetTunaLpPositionRebalanceThreshold";
|
|
1007
1011
|
TunaInstruction2[TunaInstruction2["SetTunaSpotPositionLimitOrders"] = 46] = "SetTunaSpotPositionLimitOrders";
|
|
1008
1012
|
TunaInstruction2[TunaInstruction2["UpdateMarket"] = 47] = "UpdateMarket";
|
|
1009
|
-
TunaInstruction2[TunaInstruction2["
|
|
1010
|
-
TunaInstruction2[TunaInstruction2["
|
|
1013
|
+
TunaInstruction2[TunaInstruction2["UpdateMarketVaults"] = 48] = "UpdateMarketVaults";
|
|
1014
|
+
TunaInstruction2[TunaInstruction2["UpdateVault"] = 49] = "UpdateVault";
|
|
1015
|
+
TunaInstruction2[TunaInstruction2["Withdraw"] = 50] = "Withdraw";
|
|
1011
1016
|
return TunaInstruction2;
|
|
1012
1017
|
})(TunaInstruction || {});
|
|
1013
1018
|
function identifyTunaInstruction(instruction) {
|
|
@@ -1444,6 +1449,15 @@ function identifyTunaInstruction(instruction) {
|
|
|
1444
1449
|
)) {
|
|
1445
1450
|
return 47 /* UpdateMarket */;
|
|
1446
1451
|
}
|
|
1452
|
+
if (containsBytes(
|
|
1453
|
+
data,
|
|
1454
|
+
fixEncoderSize7(getBytesEncoder7(), 8).encode(
|
|
1455
|
+
new Uint8Array([59, 187, 50, 173, 89, 41, 205, 228])
|
|
1456
|
+
),
|
|
1457
|
+
0
|
|
1458
|
+
)) {
|
|
1459
|
+
return 48 /* UpdateMarketVaults */;
|
|
1460
|
+
}
|
|
1447
1461
|
if (containsBytes(
|
|
1448
1462
|
data,
|
|
1449
1463
|
fixEncoderSize7(getBytesEncoder7(), 8).encode(
|
|
@@ -1451,7 +1465,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1451
1465
|
),
|
|
1452
1466
|
0
|
|
1453
1467
|
)) {
|
|
1454
|
-
return
|
|
1468
|
+
return 49 /* UpdateVault */;
|
|
1455
1469
|
}
|
|
1456
1470
|
if (containsBytes(
|
|
1457
1471
|
data,
|
|
@@ -1460,7 +1474,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1460
1474
|
),
|
|
1461
1475
|
0
|
|
1462
1476
|
)) {
|
|
1463
|
-
return
|
|
1477
|
+
return 50 /* Withdraw */;
|
|
1464
1478
|
}
|
|
1465
1479
|
throw new Error(
|
|
1466
1480
|
"The provided instruction could not be identified as a tuna instruction."
|
|
@@ -2890,7 +2904,6 @@ function getCreateMarketInstructionDataEncoder() {
|
|
|
2890
2904
|
return transformEncoder15(
|
|
2891
2905
|
getStructEncoder17([
|
|
2892
2906
|
["discriminator", fixEncoderSize16(getBytesEncoder16(), 8)],
|
|
2893
|
-
["marketMaker", getMarketMakerEncoder()],
|
|
2894
2907
|
["addressLookupTable", getAddressEncoder7()],
|
|
2895
2908
|
["maxLeverage", getU32Encoder5()],
|
|
2896
2909
|
["protocolFee", getU16Encoder7()],
|
|
@@ -2913,7 +2926,6 @@ function getCreateMarketInstructionDataEncoder() {
|
|
|
2913
2926
|
function getCreateMarketInstructionDataDecoder() {
|
|
2914
2927
|
return getStructDecoder17([
|
|
2915
2928
|
["discriminator", fixDecoderSize15(getBytesDecoder15(), 8)],
|
|
2916
|
-
["marketMaker", getMarketMakerDecoder()],
|
|
2917
2929
|
["addressLookupTable", getAddressDecoder7()],
|
|
2918
2930
|
["maxLeverage", getU32Decoder5()],
|
|
2919
2931
|
["protocolFee", getU16Decoder7()],
|
|
@@ -2943,6 +2955,8 @@ function getCreateMarketInstruction(input, config) {
|
|
|
2943
2955
|
authority: { value: input.authority ?? null, isWritable: true },
|
|
2944
2956
|
tunaConfig: { value: input.tunaConfig ?? null, isWritable: false },
|
|
2945
2957
|
market: { value: input.market ?? null, isWritable: true },
|
|
2958
|
+
vaultA: { value: input.vaultA ?? null, isWritable: false },
|
|
2959
|
+
vaultB: { value: input.vaultB ?? null, isWritable: false },
|
|
2946
2960
|
pool: { value: input.pool ?? null, isWritable: false },
|
|
2947
2961
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
2948
2962
|
};
|
|
@@ -2957,6 +2971,8 @@ function getCreateMarketInstruction(input, config) {
|
|
|
2957
2971
|
getAccountMeta(accounts.authority),
|
|
2958
2972
|
getAccountMeta(accounts.tunaConfig),
|
|
2959
2973
|
getAccountMeta(accounts.market),
|
|
2974
|
+
getAccountMeta(accounts.vaultA),
|
|
2975
|
+
getAccountMeta(accounts.vaultB),
|
|
2960
2976
|
getAccountMeta(accounts.pool),
|
|
2961
2977
|
getAccountMeta(accounts.systemProgram)
|
|
2962
2978
|
],
|
|
@@ -2968,7 +2984,7 @@ function getCreateMarketInstruction(input, config) {
|
|
|
2968
2984
|
return instruction;
|
|
2969
2985
|
}
|
|
2970
2986
|
function parseCreateMarketInstruction(instruction) {
|
|
2971
|
-
if (instruction.accounts.length <
|
|
2987
|
+
if (instruction.accounts.length < 7) {
|
|
2972
2988
|
throw new Error("Not enough accounts");
|
|
2973
2989
|
}
|
|
2974
2990
|
let accountIndex = 0;
|
|
@@ -2983,6 +2999,8 @@ function parseCreateMarketInstruction(instruction) {
|
|
|
2983
2999
|
authority: getNextAccount(),
|
|
2984
3000
|
tunaConfig: getNextAccount(),
|
|
2985
3001
|
market: getNextAccount(),
|
|
3002
|
+
vaultA: getNextAccount(),
|
|
3003
|
+
vaultB: getNextAccount(),
|
|
2986
3004
|
pool: getNextAccount(),
|
|
2987
3005
|
systemProgram: getNextAccount()
|
|
2988
3006
|
},
|
|
@@ -8758,7 +8776,7 @@ function parseUpdateMarketInstruction(instruction) {
|
|
|
8758
8776
|
};
|
|
8759
8777
|
}
|
|
8760
8778
|
|
|
8761
|
-
// src/generated/instructions/
|
|
8779
|
+
// src/generated/instructions/updateMarketVaults.ts
|
|
8762
8780
|
import {
|
|
8763
8781
|
combineCodec as combineCodec61,
|
|
8764
8782
|
fixDecoderSize as fixDecoderSize55,
|
|
@@ -8769,9 +8787,106 @@ import {
|
|
|
8769
8787
|
getBytesEncoder as getBytesEncoder56,
|
|
8770
8788
|
getStructDecoder as getStructDecoder57,
|
|
8771
8789
|
getStructEncoder as getStructEncoder57,
|
|
8790
|
+
transformEncoder as transformEncoder55
|
|
8791
|
+
} from "@solana/kit";
|
|
8792
|
+
var UPDATE_MARKET_VAULTS_DISCRIMINATOR = new Uint8Array([
|
|
8793
|
+
59,
|
|
8794
|
+
187,
|
|
8795
|
+
50,
|
|
8796
|
+
173,
|
|
8797
|
+
89,
|
|
8798
|
+
41,
|
|
8799
|
+
205,
|
|
8800
|
+
228
|
|
8801
|
+
]);
|
|
8802
|
+
function getUpdateMarketVaultsDiscriminatorBytes() {
|
|
8803
|
+
return fixEncoderSize56(getBytesEncoder56(), 8).encode(
|
|
8804
|
+
UPDATE_MARKET_VAULTS_DISCRIMINATOR
|
|
8805
|
+
);
|
|
8806
|
+
}
|
|
8807
|
+
function getUpdateMarketVaultsInstructionDataEncoder() {
|
|
8808
|
+
return transformEncoder55(
|
|
8809
|
+
getStructEncoder57([
|
|
8810
|
+
["discriminator", fixEncoderSize56(getBytesEncoder56(), 8)],
|
|
8811
|
+
["vaultA", getAddressEncoder15()],
|
|
8812
|
+
["vaultB", getAddressEncoder15()]
|
|
8813
|
+
]),
|
|
8814
|
+
(value) => ({ ...value, discriminator: UPDATE_MARKET_VAULTS_DISCRIMINATOR })
|
|
8815
|
+
);
|
|
8816
|
+
}
|
|
8817
|
+
function getUpdateMarketVaultsInstructionDataDecoder() {
|
|
8818
|
+
return getStructDecoder57([
|
|
8819
|
+
["discriminator", fixDecoderSize55(getBytesDecoder55(), 8)],
|
|
8820
|
+
["vaultA", getAddressDecoder15()],
|
|
8821
|
+
["vaultB", getAddressDecoder15()]
|
|
8822
|
+
]);
|
|
8823
|
+
}
|
|
8824
|
+
function getUpdateMarketVaultsInstructionDataCodec() {
|
|
8825
|
+
return combineCodec61(
|
|
8826
|
+
getUpdateMarketVaultsInstructionDataEncoder(),
|
|
8827
|
+
getUpdateMarketVaultsInstructionDataDecoder()
|
|
8828
|
+
);
|
|
8829
|
+
}
|
|
8830
|
+
function getUpdateMarketVaultsInstruction(input, config) {
|
|
8831
|
+
const programAddress = config?.programAddress ?? TUNA_PROGRAM_ADDRESS;
|
|
8832
|
+
const originalAccounts = {
|
|
8833
|
+
authority: { value: input.authority ?? null, isWritable: true },
|
|
8834
|
+
tunaConfig: { value: input.tunaConfig ?? null, isWritable: false },
|
|
8835
|
+
market: { value: input.market ?? null, isWritable: true }
|
|
8836
|
+
};
|
|
8837
|
+
const accounts = originalAccounts;
|
|
8838
|
+
const args = { ...input };
|
|
8839
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
8840
|
+
const instruction = {
|
|
8841
|
+
accounts: [
|
|
8842
|
+
getAccountMeta(accounts.authority),
|
|
8843
|
+
getAccountMeta(accounts.tunaConfig),
|
|
8844
|
+
getAccountMeta(accounts.market)
|
|
8845
|
+
],
|
|
8846
|
+
programAddress,
|
|
8847
|
+
data: getUpdateMarketVaultsInstructionDataEncoder().encode(
|
|
8848
|
+
args
|
|
8849
|
+
)
|
|
8850
|
+
};
|
|
8851
|
+
return instruction;
|
|
8852
|
+
}
|
|
8853
|
+
function parseUpdateMarketVaultsInstruction(instruction) {
|
|
8854
|
+
if (instruction.accounts.length < 3) {
|
|
8855
|
+
throw new Error("Not enough accounts");
|
|
8856
|
+
}
|
|
8857
|
+
let accountIndex = 0;
|
|
8858
|
+
const getNextAccount = () => {
|
|
8859
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
8860
|
+
accountIndex += 1;
|
|
8861
|
+
return accountMeta;
|
|
8862
|
+
};
|
|
8863
|
+
return {
|
|
8864
|
+
programAddress: instruction.programAddress,
|
|
8865
|
+
accounts: {
|
|
8866
|
+
authority: getNextAccount(),
|
|
8867
|
+
tunaConfig: getNextAccount(),
|
|
8868
|
+
market: getNextAccount()
|
|
8869
|
+
},
|
|
8870
|
+
data: getUpdateMarketVaultsInstructionDataDecoder().decode(
|
|
8871
|
+
instruction.data
|
|
8872
|
+
)
|
|
8873
|
+
};
|
|
8874
|
+
}
|
|
8875
|
+
|
|
8876
|
+
// src/generated/instructions/updateVault.ts
|
|
8877
|
+
import {
|
|
8878
|
+
combineCodec as combineCodec62,
|
|
8879
|
+
fixDecoderSize as fixDecoderSize56,
|
|
8880
|
+
fixEncoderSize as fixEncoderSize57,
|
|
8881
|
+
getAddressDecoder as getAddressDecoder16,
|
|
8882
|
+
getAddressEncoder as getAddressEncoder16,
|
|
8883
|
+
getBytesDecoder as getBytesDecoder56,
|
|
8884
|
+
getBytesEncoder as getBytesEncoder57,
|
|
8885
|
+
getStructDecoder as getStructDecoder58,
|
|
8886
|
+
getStructEncoder as getStructEncoder58,
|
|
8772
8887
|
getU64Decoder as getU64Decoder21,
|
|
8773
8888
|
getU64Encoder as getU64Encoder21,
|
|
8774
|
-
transformEncoder as
|
|
8889
|
+
transformEncoder as transformEncoder56
|
|
8775
8890
|
} from "@solana/kit";
|
|
8776
8891
|
var UPDATE_VAULT_DISCRIMINATOR = new Uint8Array([
|
|
8777
8892
|
67,
|
|
@@ -8784,33 +8899,33 @@ var UPDATE_VAULT_DISCRIMINATOR = new Uint8Array([
|
|
|
8784
8899
|
60
|
|
8785
8900
|
]);
|
|
8786
8901
|
function getUpdateVaultDiscriminatorBytes() {
|
|
8787
|
-
return
|
|
8902
|
+
return fixEncoderSize57(getBytesEncoder57(), 8).encode(
|
|
8788
8903
|
UPDATE_VAULT_DISCRIMINATOR
|
|
8789
8904
|
);
|
|
8790
8905
|
}
|
|
8791
8906
|
function getUpdateVaultInstructionDataEncoder() {
|
|
8792
|
-
return
|
|
8793
|
-
|
|
8794
|
-
["discriminator",
|
|
8907
|
+
return transformEncoder56(
|
|
8908
|
+
getStructEncoder58([
|
|
8909
|
+
["discriminator", fixEncoderSize57(getBytesEncoder57(), 8)],
|
|
8795
8910
|
["interestRate", getU64Encoder21()],
|
|
8796
8911
|
["supplyLimit", getU64Encoder21()],
|
|
8797
|
-
["pythOraclePriceUpdate",
|
|
8798
|
-
["pythOracleFeedId",
|
|
8912
|
+
["pythOraclePriceUpdate", getAddressEncoder16()],
|
|
8913
|
+
["pythOracleFeedId", getAddressEncoder16()]
|
|
8799
8914
|
]),
|
|
8800
8915
|
(value) => ({ ...value, discriminator: UPDATE_VAULT_DISCRIMINATOR })
|
|
8801
8916
|
);
|
|
8802
8917
|
}
|
|
8803
8918
|
function getUpdateVaultInstructionDataDecoder() {
|
|
8804
|
-
return
|
|
8805
|
-
["discriminator",
|
|
8919
|
+
return getStructDecoder58([
|
|
8920
|
+
["discriminator", fixDecoderSize56(getBytesDecoder56(), 8)],
|
|
8806
8921
|
["interestRate", getU64Decoder21()],
|
|
8807
8922
|
["supplyLimit", getU64Decoder21()],
|
|
8808
|
-
["pythOraclePriceUpdate",
|
|
8809
|
-
["pythOracleFeedId",
|
|
8923
|
+
["pythOraclePriceUpdate", getAddressDecoder16()],
|
|
8924
|
+
["pythOracleFeedId", getAddressDecoder16()]
|
|
8810
8925
|
]);
|
|
8811
8926
|
}
|
|
8812
8927
|
function getUpdateVaultInstructionDataCodec() {
|
|
8813
|
-
return
|
|
8928
|
+
return combineCodec62(
|
|
8814
8929
|
getUpdateVaultInstructionDataEncoder(),
|
|
8815
8930
|
getUpdateVaultInstructionDataDecoder()
|
|
8816
8931
|
);
|
|
@@ -8861,16 +8976,16 @@ function parseUpdateVaultInstruction(instruction) {
|
|
|
8861
8976
|
|
|
8862
8977
|
// src/generated/instructions/withdraw.ts
|
|
8863
8978
|
import {
|
|
8864
|
-
combineCodec as
|
|
8865
|
-
fixDecoderSize as
|
|
8866
|
-
fixEncoderSize as
|
|
8867
|
-
getBytesDecoder as
|
|
8868
|
-
getBytesEncoder as
|
|
8869
|
-
getStructDecoder as
|
|
8870
|
-
getStructEncoder as
|
|
8979
|
+
combineCodec as combineCodec63,
|
|
8980
|
+
fixDecoderSize as fixDecoderSize57,
|
|
8981
|
+
fixEncoderSize as fixEncoderSize58,
|
|
8982
|
+
getBytesDecoder as getBytesDecoder57,
|
|
8983
|
+
getBytesEncoder as getBytesEncoder58,
|
|
8984
|
+
getStructDecoder as getStructDecoder59,
|
|
8985
|
+
getStructEncoder as getStructEncoder59,
|
|
8871
8986
|
getU64Decoder as getU64Decoder22,
|
|
8872
8987
|
getU64Encoder as getU64Encoder22,
|
|
8873
|
-
transformEncoder as
|
|
8988
|
+
transformEncoder as transformEncoder57
|
|
8874
8989
|
} from "@solana/kit";
|
|
8875
8990
|
var WITHDRAW_DISCRIMINATOR = new Uint8Array([
|
|
8876
8991
|
183,
|
|
@@ -8883,12 +8998,12 @@ var WITHDRAW_DISCRIMINATOR = new Uint8Array([
|
|
|
8883
8998
|
34
|
|
8884
8999
|
]);
|
|
8885
9000
|
function getWithdrawDiscriminatorBytes() {
|
|
8886
|
-
return
|
|
9001
|
+
return fixEncoderSize58(getBytesEncoder58(), 8).encode(WITHDRAW_DISCRIMINATOR);
|
|
8887
9002
|
}
|
|
8888
9003
|
function getWithdrawInstructionDataEncoder() {
|
|
8889
|
-
return
|
|
8890
|
-
|
|
8891
|
-
["discriminator",
|
|
9004
|
+
return transformEncoder57(
|
|
9005
|
+
getStructEncoder59([
|
|
9006
|
+
["discriminator", fixEncoderSize58(getBytesEncoder58(), 8)],
|
|
8892
9007
|
["funds", getU64Encoder22()],
|
|
8893
9008
|
["shares", getU64Encoder22()]
|
|
8894
9009
|
]),
|
|
@@ -8896,14 +9011,14 @@ function getWithdrawInstructionDataEncoder() {
|
|
|
8896
9011
|
);
|
|
8897
9012
|
}
|
|
8898
9013
|
function getWithdrawInstructionDataDecoder() {
|
|
8899
|
-
return
|
|
8900
|
-
["discriminator",
|
|
9014
|
+
return getStructDecoder59([
|
|
9015
|
+
["discriminator", fixDecoderSize57(getBytesDecoder57(), 8)],
|
|
8901
9016
|
["funds", getU64Decoder22()],
|
|
8902
9017
|
["shares", getU64Decoder22()]
|
|
8903
9018
|
]);
|
|
8904
9019
|
}
|
|
8905
9020
|
function getWithdrawInstructionDataCodec() {
|
|
8906
|
-
return
|
|
9021
|
+
return combineCodec63(
|
|
8907
9022
|
getWithdrawInstructionDataEncoder(),
|
|
8908
9023
|
getWithdrawInstructionDataDecoder()
|
|
8909
9024
|
);
|
|
@@ -8974,7 +9089,7 @@ function parseWithdrawInstruction(instruction) {
|
|
|
8974
9089
|
}
|
|
8975
9090
|
|
|
8976
9091
|
// src/pda.ts
|
|
8977
|
-
import { getAddressEncoder as
|
|
9092
|
+
import { getAddressEncoder as getAddressEncoder17, getProgramDerivedAddress } from "@solana/kit";
|
|
8978
9093
|
|
|
8979
9094
|
// src/consts.ts
|
|
8980
9095
|
import { address } from "@solana/kit";
|
|
@@ -9016,31 +9131,31 @@ async function getTunaConfigAddress() {
|
|
|
9016
9131
|
async function getMarketAddress(pool) {
|
|
9017
9132
|
return await getProgramDerivedAddress({
|
|
9018
9133
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
9019
|
-
seeds: ["market",
|
|
9134
|
+
seeds: ["market", getAddressEncoder17().encode(pool)]
|
|
9020
9135
|
});
|
|
9021
9136
|
}
|
|
9022
9137
|
async function getLendingVaultAddress(mint) {
|
|
9023
9138
|
return await getProgramDerivedAddress({
|
|
9024
9139
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
9025
|
-
seeds: ["vault",
|
|
9140
|
+
seeds: ["vault", getAddressEncoder17().encode(mint)]
|
|
9026
9141
|
});
|
|
9027
9142
|
}
|
|
9028
9143
|
async function getLendingPositionAddress(authority, mint) {
|
|
9029
9144
|
return await getProgramDerivedAddress({
|
|
9030
9145
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
9031
|
-
seeds: ["lending_position",
|
|
9146
|
+
seeds: ["lending_position", getAddressEncoder17().encode(authority), getAddressEncoder17().encode(mint)]
|
|
9032
9147
|
});
|
|
9033
9148
|
}
|
|
9034
9149
|
async function getTunaLpPositionAddress(positionMint) {
|
|
9035
9150
|
return await getProgramDerivedAddress({
|
|
9036
9151
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
9037
|
-
seeds: ["tuna_position",
|
|
9152
|
+
seeds: ["tuna_position", getAddressEncoder17().encode(positionMint)]
|
|
9038
9153
|
});
|
|
9039
9154
|
}
|
|
9040
9155
|
async function getTunaSpotPositionAddress(authority, pool) {
|
|
9041
9156
|
return await getProgramDerivedAddress({
|
|
9042
9157
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
9043
|
-
seeds: ["tuna_spot_position",
|
|
9158
|
+
seeds: ["tuna_spot_position", getAddressEncoder17().encode(authority), getAddressEncoder17().encode(pool)]
|
|
9044
9159
|
});
|
|
9045
9160
|
}
|
|
9046
9161
|
async function getPythPriceUpdateAccountAddress(shardId, priceFeedId) {
|
|
@@ -9064,7 +9179,7 @@ async function getPythPriceUpdateAccountAddress(shardId, priceFeedId) {
|
|
|
9064
9179
|
|
|
9065
9180
|
// src/gpa/tunaLpPosition.ts
|
|
9066
9181
|
import {
|
|
9067
|
-
getAddressEncoder as
|
|
9182
|
+
getAddressEncoder as getAddressEncoder18,
|
|
9068
9183
|
getBase58Decoder,
|
|
9069
9184
|
getI8Encoder
|
|
9070
9185
|
} from "@solana/kit";
|
|
@@ -9092,7 +9207,7 @@ function tunaLpPositionAuthorityFilter(address4) {
|
|
|
9092
9207
|
return {
|
|
9093
9208
|
memcmp: {
|
|
9094
9209
|
offset: 11n,
|
|
9095
|
-
bytes: getBase58Decoder().decode(
|
|
9210
|
+
bytes: getBase58Decoder().decode(getAddressEncoder18().encode(address4)),
|
|
9096
9211
|
encoding: "base58"
|
|
9097
9212
|
}
|
|
9098
9213
|
};
|
|
@@ -9101,7 +9216,7 @@ function tunaLpPositionPoolFilter(address4) {
|
|
|
9101
9216
|
return {
|
|
9102
9217
|
memcmp: {
|
|
9103
9218
|
offset: 43n,
|
|
9104
|
-
bytes: getBase58Decoder().decode(
|
|
9219
|
+
bytes: getBase58Decoder().decode(getAddressEncoder18().encode(address4)),
|
|
9105
9220
|
encoding: "base58"
|
|
9106
9221
|
}
|
|
9107
9222
|
};
|
|
@@ -9110,7 +9225,7 @@ function tunaLpPositionMintAFilter(address4) {
|
|
|
9110
9225
|
return {
|
|
9111
9226
|
memcmp: {
|
|
9112
9227
|
offset: 75n,
|
|
9113
|
-
bytes: getBase58Decoder().decode(
|
|
9228
|
+
bytes: getBase58Decoder().decode(getAddressEncoder18().encode(address4)),
|
|
9114
9229
|
encoding: "base58"
|
|
9115
9230
|
}
|
|
9116
9231
|
};
|
|
@@ -9119,7 +9234,7 @@ function tunaLpPositionMintBFilter(address4) {
|
|
|
9119
9234
|
return {
|
|
9120
9235
|
memcmp: {
|
|
9121
9236
|
offset: 107n,
|
|
9122
|
-
bytes: getBase58Decoder().decode(
|
|
9237
|
+
bytes: getBase58Decoder().decode(getAddressEncoder18().encode(address4)),
|
|
9123
9238
|
encoding: "base58"
|
|
9124
9239
|
}
|
|
9125
9240
|
};
|
|
@@ -9128,7 +9243,7 @@ function tunaLpPositionMintFilter(address4) {
|
|
|
9128
9243
|
return {
|
|
9129
9244
|
memcmp: {
|
|
9130
9245
|
offset: 139n,
|
|
9131
|
-
bytes: getBase58Decoder().decode(
|
|
9246
|
+
bytes: getBase58Decoder().decode(getAddressEncoder18().encode(address4)),
|
|
9132
9247
|
encoding: "base58"
|
|
9133
9248
|
}
|
|
9134
9249
|
};
|
|
@@ -9161,14 +9276,14 @@ async function fetchAllTunaLpPositionWithFilter(rpc, ...filters) {
|
|
|
9161
9276
|
|
|
9162
9277
|
// src/gpa/tunaSpotPosition.ts
|
|
9163
9278
|
import {
|
|
9164
|
-
getAddressEncoder as
|
|
9279
|
+
getAddressEncoder as getAddressEncoder19,
|
|
9165
9280
|
getBase58Decoder as getBase58Decoder2
|
|
9166
9281
|
} from "@solana/kit";
|
|
9167
9282
|
function tunaSpotPositionAuthorityFilter(address4) {
|
|
9168
9283
|
return {
|
|
9169
9284
|
memcmp: {
|
|
9170
9285
|
offset: 11n,
|
|
9171
|
-
bytes: getBase58Decoder2().decode(
|
|
9286
|
+
bytes: getBase58Decoder2().decode(getAddressEncoder19().encode(address4)),
|
|
9172
9287
|
encoding: "base58"
|
|
9173
9288
|
}
|
|
9174
9289
|
};
|
|
@@ -9177,7 +9292,7 @@ function tunaSpotPositionPoolFilter(address4) {
|
|
|
9177
9292
|
return {
|
|
9178
9293
|
memcmp: {
|
|
9179
9294
|
offset: 43n,
|
|
9180
|
-
bytes: getBase58Decoder2().decode(
|
|
9295
|
+
bytes: getBase58Decoder2().decode(getAddressEncoder19().encode(address4)),
|
|
9181
9296
|
encoding: "base58"
|
|
9182
9297
|
}
|
|
9183
9298
|
};
|
|
@@ -9186,7 +9301,7 @@ function tunaSpotPositionMintAFilter(address4) {
|
|
|
9186
9301
|
return {
|
|
9187
9302
|
memcmp: {
|
|
9188
9303
|
offset: 75n,
|
|
9189
|
-
bytes: getBase58Decoder2().decode(
|
|
9304
|
+
bytes: getBase58Decoder2().decode(getAddressEncoder19().encode(address4)),
|
|
9190
9305
|
encoding: "base58"
|
|
9191
9306
|
}
|
|
9192
9307
|
};
|
|
@@ -9195,7 +9310,7 @@ function tunaSpotPositionMintBFilter(address4) {
|
|
|
9195
9310
|
return {
|
|
9196
9311
|
memcmp: {
|
|
9197
9312
|
offset: 107n,
|
|
9198
|
-
bytes: getBase58Decoder2().decode(
|
|
9313
|
+
bytes: getBase58Decoder2().decode(getAddressEncoder19().encode(address4)),
|
|
9199
9314
|
encoding: "base58"
|
|
9200
9315
|
}
|
|
9201
9316
|
};
|
|
@@ -9219,14 +9334,14 @@ async function fetchAllTunaSpotPositionWithFilter(rpc, ...filters) {
|
|
|
9219
9334
|
|
|
9220
9335
|
// src/gpa/lendingPosition.ts
|
|
9221
9336
|
import {
|
|
9222
|
-
getAddressEncoder as
|
|
9337
|
+
getAddressEncoder as getAddressEncoder20,
|
|
9223
9338
|
getBase58Decoder as getBase58Decoder3
|
|
9224
9339
|
} from "@solana/kit";
|
|
9225
9340
|
function lendingPositionAuthorityFilter(address4) {
|
|
9226
9341
|
return {
|
|
9227
9342
|
memcmp: {
|
|
9228
9343
|
offset: 11n,
|
|
9229
|
-
bytes: getBase58Decoder3().decode(
|
|
9344
|
+
bytes: getBase58Decoder3().decode(getAddressEncoder20().encode(address4)),
|
|
9230
9345
|
encoding: "base58"
|
|
9231
9346
|
}
|
|
9232
9347
|
};
|
|
@@ -9235,7 +9350,7 @@ function lendingPositionMintFilter(address4) {
|
|
|
9235
9350
|
return {
|
|
9236
9351
|
memcmp: {
|
|
9237
9352
|
offset: 43n,
|
|
9238
|
-
bytes: getBase58Decoder3().decode(
|
|
9353
|
+
bytes: getBase58Decoder3().decode(getAddressEncoder20().encode(address4)),
|
|
9239
9354
|
encoding: "base58"
|
|
9240
9355
|
}
|
|
9241
9356
|
};
|
|
@@ -11413,21 +11528,21 @@ import { fetchFusionPool as fetchFusionPool2 } from "@crypticdot/fusionamm-clien
|
|
|
11413
11528
|
import {
|
|
11414
11529
|
assertAccountExists as assertAccountExists7,
|
|
11415
11530
|
assertAccountsExist as assertAccountsExist8,
|
|
11416
|
-
combineCodec as
|
|
11531
|
+
combineCodec as combineCodec64,
|
|
11417
11532
|
decodeAccount as decodeAccount7,
|
|
11418
11533
|
fetchEncodedAccount as fetchEncodedAccount7,
|
|
11419
11534
|
fetchEncodedAccounts as fetchEncodedAccounts7,
|
|
11420
|
-
fixDecoderSize as
|
|
11421
|
-
fixEncoderSize as
|
|
11422
|
-
getAddressDecoder as
|
|
11423
|
-
getAddressEncoder as
|
|
11424
|
-
getBytesDecoder as
|
|
11425
|
-
getBytesEncoder as
|
|
11426
|
-
getStructDecoder as
|
|
11427
|
-
getStructEncoder as
|
|
11535
|
+
fixDecoderSize as fixDecoderSize58,
|
|
11536
|
+
fixEncoderSize as fixEncoderSize59,
|
|
11537
|
+
getAddressDecoder as getAddressDecoder17,
|
|
11538
|
+
getAddressEncoder as getAddressEncoder21,
|
|
11539
|
+
getBytesDecoder as getBytesDecoder58,
|
|
11540
|
+
getBytesEncoder as getBytesEncoder59,
|
|
11541
|
+
getStructDecoder as getStructDecoder60,
|
|
11542
|
+
getStructEncoder as getStructEncoder60,
|
|
11428
11543
|
getU64Decoder as getU64Decoder23,
|
|
11429
11544
|
getU64Encoder as getU64Encoder23,
|
|
11430
|
-
transformEncoder as
|
|
11545
|
+
transformEncoder as transformEncoder58
|
|
11431
11546
|
} from "@solana/kit";
|
|
11432
11547
|
import {
|
|
11433
11548
|
isProgramError as isProgramError2
|
|
@@ -11472,11 +11587,11 @@ import {
|
|
|
11472
11587
|
import {
|
|
11473
11588
|
combineCodec as combineCodec410,
|
|
11474
11589
|
fixDecoderSize as fixDecoderSize410,
|
|
11475
|
-
fixEncoderSize as
|
|
11590
|
+
fixEncoderSize as fixEncoderSize510,
|
|
11476
11591
|
getBooleanDecoder as getBooleanDecoder9,
|
|
11477
11592
|
getBooleanEncoder as getBooleanEncoder9,
|
|
11478
11593
|
getBytesDecoder as getBytesDecoder410,
|
|
11479
|
-
getBytesEncoder as
|
|
11594
|
+
getBytesEncoder as getBytesEncoder510,
|
|
11480
11595
|
getStructDecoder as getStructDecoder410,
|
|
11481
11596
|
getStructEncoder as getStructEncoder410,
|
|
11482
11597
|
getU8Decoder as getU8Decoder32,
|
|
@@ -11485,18 +11600,18 @@ import {
|
|
|
11485
11600
|
} from "@solana/kit";
|
|
11486
11601
|
import {
|
|
11487
11602
|
combineCodec as combineCodec510,
|
|
11488
|
-
fixDecoderSize as
|
|
11603
|
+
fixDecoderSize as fixDecoderSize59,
|
|
11489
11604
|
fixEncoderSize as fixEncoderSize62,
|
|
11490
11605
|
getAddressEncoder as getAddressEncoder32,
|
|
11491
|
-
getBytesDecoder as
|
|
11606
|
+
getBytesDecoder as getBytesDecoder59,
|
|
11492
11607
|
getBytesEncoder as getBytesEncoder62,
|
|
11493
11608
|
getProgramDerivedAddress as getProgramDerivedAddress22,
|
|
11494
11609
|
getStructDecoder as getStructDecoder510,
|
|
11495
11610
|
getStructEncoder as getStructEncoder510,
|
|
11496
|
-
transformEncoder as
|
|
11611
|
+
transformEncoder as transformEncoder59
|
|
11497
11612
|
} from "@solana/kit";
|
|
11498
11613
|
import {
|
|
11499
|
-
combineCodec as
|
|
11614
|
+
combineCodec as combineCodec65,
|
|
11500
11615
|
fixDecoderSize as fixDecoderSize62,
|
|
11501
11616
|
fixEncoderSize as fixEncoderSize72,
|
|
11502
11617
|
getAddressEncoder as getAddressEncoder42,
|
|
@@ -12220,7 +12335,7 @@ async function closeTunaSpotPositionInstruction(authority, poolAddress, mintA, m
|
|
|
12220
12335
|
}
|
|
12221
12336
|
|
|
12222
12337
|
// src/txbuilder/createMarket.ts
|
|
12223
|
-
async function createMarketInstruction(authority, pool, args) {
|
|
12338
|
+
async function createMarketInstruction(authority, pool, vaultA, vaultB, args) {
|
|
12224
12339
|
const tunaConfig = (await getTunaConfigAddress())[0];
|
|
12225
12340
|
const marketAddress = (await getMarketAddress(pool))[0];
|
|
12226
12341
|
return getCreateMarketInstruction({
|
|
@@ -12228,6 +12343,8 @@ async function createMarketInstruction(authority, pool, args) {
|
|
|
12228
12343
|
tunaConfig,
|
|
12229
12344
|
market: marketAddress,
|
|
12230
12345
|
pool,
|
|
12346
|
+
vaultA,
|
|
12347
|
+
vaultB,
|
|
12231
12348
|
...args
|
|
12232
12349
|
});
|
|
12233
12350
|
}
|
|
@@ -12688,11 +12805,154 @@ async function liquidateTunaSpotPositionFusionInstruction(authority, tunaPositio
|
|
|
12688
12805
|
return ix;
|
|
12689
12806
|
}
|
|
12690
12807
|
|
|
12808
|
+
// src/txbuilder/liquidateTunaSpotPositionJupiter.ts
|
|
12809
|
+
import { MEMO_PROGRAM_ADDRESS as MEMO_PROGRAM_ADDRESS14 } from "@solana-program/memo";
|
|
12810
|
+
import { findAssociatedTokenPda as findAssociatedTokenPda21 } from "@solana-program/token-2022";
|
|
12811
|
+
async function liquidateTunaSpotPositionJupiterInstructions(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, poolAddress, remainingAccounts, args) {
|
|
12812
|
+
const instructions = [];
|
|
12813
|
+
const collateralTokenMint = tunaPosition.data.collateralToken == 0 /* A */ ? mintA : mintB;
|
|
12814
|
+
const useNativeSol = collateralTokenMint.address == NATIVE_MINT && args.decreasePercent == HUNDRED_PERCENT;
|
|
12815
|
+
if (!useNativeSol) {
|
|
12816
|
+
const createPositionOwnerAtaInstructions = await getCreateAtaInstructions(
|
|
12817
|
+
void 0,
|
|
12818
|
+
authority,
|
|
12819
|
+
collateralTokenMint.address,
|
|
12820
|
+
tunaPosition.data.authority,
|
|
12821
|
+
collateralTokenMint.programAddress
|
|
12822
|
+
);
|
|
12823
|
+
instructions.push(...createPositionOwnerAtaInstructions.init);
|
|
12824
|
+
}
|
|
12825
|
+
if (mintA.address != NATIVE_MINT || args.decreasePercent < HUNDRED_PERCENT) {
|
|
12826
|
+
const createUserAtaAInstructions = await getCreateAtaInstructions(
|
|
12827
|
+
void 0,
|
|
12828
|
+
authority,
|
|
12829
|
+
mintA.address,
|
|
12830
|
+
authority.address,
|
|
12831
|
+
mintA.programAddress
|
|
12832
|
+
);
|
|
12833
|
+
instructions.push(...createUserAtaAInstructions.init);
|
|
12834
|
+
}
|
|
12835
|
+
if (mintB.address != NATIVE_MINT || args.decreasePercent < HUNDRED_PERCENT) {
|
|
12836
|
+
const createUserAtaBInstructions = await getCreateAtaInstructions(
|
|
12837
|
+
void 0,
|
|
12838
|
+
authority,
|
|
12839
|
+
mintB.address,
|
|
12840
|
+
authority.address,
|
|
12841
|
+
mintB.programAddress
|
|
12842
|
+
);
|
|
12843
|
+
instructions.push(...createUserAtaBInstructions.init);
|
|
12844
|
+
}
|
|
12845
|
+
const createFeeRecipientAtaAInstructions = await getCreateAtaInstructions(
|
|
12846
|
+
void 0,
|
|
12847
|
+
authority,
|
|
12848
|
+
mintA.address,
|
|
12849
|
+
tunaConfig.data.feeRecipient,
|
|
12850
|
+
mintA.programAddress
|
|
12851
|
+
);
|
|
12852
|
+
instructions.push(...createFeeRecipientAtaAInstructions.init);
|
|
12853
|
+
const createFeeRecipientAtaBInstructions = await getCreateAtaInstructions(
|
|
12854
|
+
void 0,
|
|
12855
|
+
authority,
|
|
12856
|
+
mintB.address,
|
|
12857
|
+
tunaConfig.data.feeRecipient,
|
|
12858
|
+
mintB.programAddress
|
|
12859
|
+
);
|
|
12860
|
+
instructions.push(...createFeeRecipientAtaBInstructions.init);
|
|
12861
|
+
const ix = await liquidateTunaSpotPositionJupiterInstruction(
|
|
12862
|
+
authority,
|
|
12863
|
+
tunaPosition,
|
|
12864
|
+
tunaConfig,
|
|
12865
|
+
mintA,
|
|
12866
|
+
mintB,
|
|
12867
|
+
vaultA,
|
|
12868
|
+
vaultB,
|
|
12869
|
+
poolAddress,
|
|
12870
|
+
remainingAccounts,
|
|
12871
|
+
args
|
|
12872
|
+
);
|
|
12873
|
+
instructions.push(ix);
|
|
12874
|
+
return instructions;
|
|
12875
|
+
}
|
|
12876
|
+
async function liquidateTunaSpotPositionJupiterInstruction(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, poolAddress, remainingAccounts, args) {
|
|
12877
|
+
const marketAddress = (await getMarketAddress(poolAddress))[0];
|
|
12878
|
+
const tunaPositionOwnerAtaA = (await findAssociatedTokenPda21({
|
|
12879
|
+
owner: tunaPosition.data.authority,
|
|
12880
|
+
mint: mintA.address,
|
|
12881
|
+
tokenProgram: mintA.programAddress
|
|
12882
|
+
}))[0];
|
|
12883
|
+
const tunaPositionOwnerAtaB = (await findAssociatedTokenPda21({
|
|
12884
|
+
owner: tunaPosition.data.authority,
|
|
12885
|
+
mint: mintB.address,
|
|
12886
|
+
tokenProgram: mintB.programAddress
|
|
12887
|
+
}))[0];
|
|
12888
|
+
const tunaPositionAtaA = (await findAssociatedTokenPda21({
|
|
12889
|
+
owner: tunaPosition.address,
|
|
12890
|
+
mint: mintA.address,
|
|
12891
|
+
tokenProgram: mintA.programAddress
|
|
12892
|
+
}))[0];
|
|
12893
|
+
const tunaPositionAtaB = (await findAssociatedTokenPda21({
|
|
12894
|
+
owner: tunaPosition.address,
|
|
12895
|
+
mint: mintB.address,
|
|
12896
|
+
tokenProgram: mintB.programAddress
|
|
12897
|
+
}))[0];
|
|
12898
|
+
const feeRecipientAtaA = (await findAssociatedTokenPda21({
|
|
12899
|
+
owner: tunaConfig.data.feeRecipient,
|
|
12900
|
+
mint: mintA.address,
|
|
12901
|
+
tokenProgram: mintA.programAddress
|
|
12902
|
+
}))[0];
|
|
12903
|
+
const feeRecipientAtaB = (await findAssociatedTokenPda21({
|
|
12904
|
+
owner: tunaConfig.data.feeRecipient,
|
|
12905
|
+
mint: mintB.address,
|
|
12906
|
+
tokenProgram: mintB.programAddress
|
|
12907
|
+
}))[0];
|
|
12908
|
+
const vaultAAta = (await findAssociatedTokenPda21({
|
|
12909
|
+
owner: vaultA.address,
|
|
12910
|
+
mint: mintA.address,
|
|
12911
|
+
tokenProgram: mintA.programAddress
|
|
12912
|
+
}))[0];
|
|
12913
|
+
const vaultBAta = (await findAssociatedTokenPda21({
|
|
12914
|
+
owner: vaultB.address,
|
|
12915
|
+
mint: mintB.address,
|
|
12916
|
+
tokenProgram: mintB.programAddress
|
|
12917
|
+
}))[0];
|
|
12918
|
+
const ix = getLiquidateTunaSpotPositionJupiterInstruction({
|
|
12919
|
+
authority,
|
|
12920
|
+
tunaConfig: tunaConfig.address,
|
|
12921
|
+
mintA: mintA.address,
|
|
12922
|
+
mintB: mintB.address,
|
|
12923
|
+
tokenProgramA: mintA.programAddress,
|
|
12924
|
+
tokenProgramB: mintB.programAddress,
|
|
12925
|
+
market: marketAddress,
|
|
12926
|
+
pythOraclePriceFeedA: vaultA.data.pythOraclePriceUpdate,
|
|
12927
|
+
pythOraclePriceFeedB: vaultB.data.pythOraclePriceUpdate,
|
|
12928
|
+
vaultA: vaultA.address,
|
|
12929
|
+
vaultAAta,
|
|
12930
|
+
vaultB: vaultB.address,
|
|
12931
|
+
vaultBAta,
|
|
12932
|
+
tunaPosition: tunaPosition.address,
|
|
12933
|
+
tunaPositionAtaA,
|
|
12934
|
+
tunaPositionAtaB,
|
|
12935
|
+
tunaPositionOwner: tunaPosition.data.authority,
|
|
12936
|
+
tunaPositionOwnerAtaA,
|
|
12937
|
+
tunaPositionOwnerAtaB,
|
|
12938
|
+
feeRecipientAtaA,
|
|
12939
|
+
feeRecipientAtaB,
|
|
12940
|
+
pool: poolAddress,
|
|
12941
|
+
jupiterProgram: JUPITER_PROGRAM_ADDRESS,
|
|
12942
|
+
jupiterEventAuthority: JUPITER_EVENT_AUTHORITY,
|
|
12943
|
+
jupiterProgramAuthority: JUPITER_PROGRAM_AUTHORITY,
|
|
12944
|
+
memoProgram: MEMO_PROGRAM_ADDRESS14,
|
|
12945
|
+
...args
|
|
12946
|
+
});
|
|
12947
|
+
ix.accounts.push(...remainingAccounts);
|
|
12948
|
+
return ix;
|
|
12949
|
+
}
|
|
12950
|
+
|
|
12691
12951
|
// src/txbuilder/liquidateTunaSpotPositionOrca.ts
|
|
12692
12952
|
import { getOracleAddress as getOracleAddress5, WHIRLPOOL_PROGRAM_ADDRESS as WHIRLPOOL_PROGRAM_ADDRESS8 } from "@orca-so/whirlpools-client";
|
|
12693
12953
|
import { AccountRole as AccountRole14 } from "@solana/kit";
|
|
12694
|
-
import { MEMO_PROGRAM_ADDRESS as
|
|
12695
|
-
import { findAssociatedTokenPda as
|
|
12954
|
+
import { MEMO_PROGRAM_ADDRESS as MEMO_PROGRAM_ADDRESS15 } from "@solana-program/memo";
|
|
12955
|
+
import { findAssociatedTokenPda as findAssociatedTokenPda22 } from "@solana-program/token-2022";
|
|
12696
12956
|
async function liquidateTunaSpotPositionOrcaInstructions(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool, decreasePercent) {
|
|
12697
12957
|
const instructions = [];
|
|
12698
12958
|
const collateralTokenMint = tunaPosition.data.collateralToken == 0 /* A */ ? mintA : mintB;
|
|
@@ -12740,42 +13000,42 @@ async function liquidateTunaSpotPositionOrcaInstructions(authority, tunaPosition
|
|
|
12740
13000
|
async function liquidateTunaSpotPositionOrcaInstruction(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool, decreasePercent) {
|
|
12741
13001
|
const marketAddress = (await getMarketAddress(whirlpool.address))[0];
|
|
12742
13002
|
const orcaOracleAddress = (await getOracleAddress5(whirlpool.address))[0];
|
|
12743
|
-
const tunaPositionOwnerAtaA = (await
|
|
13003
|
+
const tunaPositionOwnerAtaA = (await findAssociatedTokenPda22({
|
|
12744
13004
|
owner: tunaPosition.data.authority,
|
|
12745
13005
|
mint: mintA.address,
|
|
12746
13006
|
tokenProgram: mintA.programAddress
|
|
12747
13007
|
}))[0];
|
|
12748
|
-
const tunaPositionOwnerAtaB = (await
|
|
13008
|
+
const tunaPositionOwnerAtaB = (await findAssociatedTokenPda22({
|
|
12749
13009
|
owner: tunaPosition.data.authority,
|
|
12750
13010
|
mint: mintB.address,
|
|
12751
13011
|
tokenProgram: mintB.programAddress
|
|
12752
13012
|
}))[0];
|
|
12753
|
-
const tunaPositionAtaA = (await
|
|
13013
|
+
const tunaPositionAtaA = (await findAssociatedTokenPda22({
|
|
12754
13014
|
owner: tunaPosition.address,
|
|
12755
13015
|
mint: mintA.address,
|
|
12756
13016
|
tokenProgram: mintA.programAddress
|
|
12757
13017
|
}))[0];
|
|
12758
|
-
const tunaPositionAtaB = (await
|
|
13018
|
+
const tunaPositionAtaB = (await findAssociatedTokenPda22({
|
|
12759
13019
|
owner: tunaPosition.address,
|
|
12760
13020
|
mint: mintB.address,
|
|
12761
13021
|
tokenProgram: mintB.programAddress
|
|
12762
13022
|
}))[0];
|
|
12763
|
-
const feeRecipientAtaA = (await
|
|
13023
|
+
const feeRecipientAtaA = (await findAssociatedTokenPda22({
|
|
12764
13024
|
owner: tunaConfig.data.feeRecipient,
|
|
12765
13025
|
mint: mintA.address,
|
|
12766
13026
|
tokenProgram: mintA.programAddress
|
|
12767
13027
|
}))[0];
|
|
12768
|
-
const feeRecipientAtaB = (await
|
|
13028
|
+
const feeRecipientAtaB = (await findAssociatedTokenPda22({
|
|
12769
13029
|
owner: tunaConfig.data.feeRecipient,
|
|
12770
13030
|
mint: mintB.address,
|
|
12771
13031
|
tokenProgram: mintB.programAddress
|
|
12772
13032
|
}))[0];
|
|
12773
|
-
const vaultAAta = (await
|
|
13033
|
+
const vaultAAta = (await findAssociatedTokenPda22({
|
|
12774
13034
|
owner: vaultA.address,
|
|
12775
13035
|
mint: mintA.address,
|
|
12776
13036
|
tokenProgram: mintA.programAddress
|
|
12777
13037
|
}))[0];
|
|
12778
|
-
const vaultBAta = (await
|
|
13038
|
+
const vaultBAta = (await findAssociatedTokenPda22({
|
|
12779
13039
|
owner: vaultB.address,
|
|
12780
13040
|
mint: mintB.address,
|
|
12781
13041
|
tokenProgram: mintB.programAddress
|
|
@@ -12823,7 +13083,7 @@ async function liquidateTunaSpotPositionOrcaInstruction(authority, tunaPosition,
|
|
|
12823
13083
|
feeRecipientAtaB,
|
|
12824
13084
|
whirlpool: whirlpool.address,
|
|
12825
13085
|
whirlpoolProgram: WHIRLPOOL_PROGRAM_ADDRESS8,
|
|
12826
|
-
memoProgram:
|
|
13086
|
+
memoProgram: MEMO_PROGRAM_ADDRESS15,
|
|
12827
13087
|
decreasePercent,
|
|
12828
13088
|
remainingAccountsInfo
|
|
12829
13089
|
});
|
|
@@ -12836,7 +13096,7 @@ import { fetchMaybeWhirlpool as fetchMaybeWhirlpool6, getPositionAddress as getP
|
|
|
12836
13096
|
import {
|
|
12837
13097
|
ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
12838
13098
|
fetchAllMaybeMint as fetchAllMaybeMint15,
|
|
12839
|
-
findAssociatedTokenPda as
|
|
13099
|
+
findAssociatedTokenPda as findAssociatedTokenPda23,
|
|
12840
13100
|
TOKEN_2022_PROGRAM_ADDRESS as TOKEN_2022_PROGRAM_ADDRESS13
|
|
12841
13101
|
} from "@solana-program/token-2022";
|
|
12842
13102
|
import assert15 from "assert";
|
|
@@ -12849,17 +13109,17 @@ async function openTunaLpPositionOrcaInstruction(rpc, authority, positionMint, w
|
|
|
12849
13109
|
const marketAddress = (await getMarketAddress(whirlpool.address))[0];
|
|
12850
13110
|
const orcaPositionAddress = (await getPositionAddress13(positionMint.address))[0];
|
|
12851
13111
|
const tunaPositionAddress = (await getTunaLpPositionAddress(positionMint.address))[0];
|
|
12852
|
-
const tunaPositionAta = (await
|
|
13112
|
+
const tunaPositionAta = (await findAssociatedTokenPda23({
|
|
12853
13113
|
owner: tunaPositionAddress,
|
|
12854
13114
|
mint: positionMint.address,
|
|
12855
13115
|
tokenProgram: TOKEN_2022_PROGRAM_ADDRESS13
|
|
12856
13116
|
}))[0];
|
|
12857
|
-
const tunaPositionAtaA = (await
|
|
13117
|
+
const tunaPositionAtaA = (await findAssociatedTokenPda23({
|
|
12858
13118
|
owner: tunaPositionAddress,
|
|
12859
13119
|
mint: mintA.address,
|
|
12860
13120
|
tokenProgram: mintA.programAddress
|
|
12861
13121
|
}))[0];
|
|
12862
|
-
const tunaPositionAtaB = (await
|
|
13122
|
+
const tunaPositionAtaB = (await findAssociatedTokenPda23({
|
|
12863
13123
|
owner: tunaPositionAddress,
|
|
12864
13124
|
mint: mintB.address,
|
|
12865
13125
|
tokenProgram: mintB.programAddress
|
|
@@ -12892,7 +13152,7 @@ import { FP_NFT_UPDATE_AUTH } from "@crypticdot/fusionamm-client";
|
|
|
12892
13152
|
import {
|
|
12893
13153
|
ASSOCIATED_TOKEN_PROGRAM_ADDRESS as ASSOCIATED_TOKEN_PROGRAM_ADDRESS2,
|
|
12894
13154
|
fetchAllMaybeMint as fetchAllMaybeMint16,
|
|
12895
|
-
findAssociatedTokenPda as
|
|
13155
|
+
findAssociatedTokenPda as findAssociatedTokenPda24,
|
|
12896
13156
|
TOKEN_2022_PROGRAM_ADDRESS as TOKEN_2022_PROGRAM_ADDRESS14
|
|
12897
13157
|
} from "@solana-program/token-2022";
|
|
12898
13158
|
import assert16 from "assert";
|
|
@@ -12905,17 +13165,17 @@ async function openTunaLpPositionFusionInstruction(rpc, authority, positionMint,
|
|
|
12905
13165
|
const marketAddress = (await getMarketAddress(fusionPool.address))[0];
|
|
12906
13166
|
const fusionPositionAddress = (await getPositionAddress14(positionMint.address))[0];
|
|
12907
13167
|
const tunaPositionAddress = (await getTunaLpPositionAddress(positionMint.address))[0];
|
|
12908
|
-
const tunaPositionAta = (await
|
|
13168
|
+
const tunaPositionAta = (await findAssociatedTokenPda24({
|
|
12909
13169
|
owner: tunaPositionAddress,
|
|
12910
13170
|
mint: positionMint.address,
|
|
12911
13171
|
tokenProgram: TOKEN_2022_PROGRAM_ADDRESS14
|
|
12912
13172
|
}))[0];
|
|
12913
|
-
const tunaPositionAtaA = (await
|
|
13173
|
+
const tunaPositionAtaA = (await findAssociatedTokenPda24({
|
|
12914
13174
|
owner: tunaPositionAddress,
|
|
12915
13175
|
mint: mintA.address,
|
|
12916
13176
|
tokenProgram: mintA.programAddress
|
|
12917
13177
|
}))[0];
|
|
12918
|
-
const tunaPositionAtaB = (await
|
|
13178
|
+
const tunaPositionAtaB = (await findAssociatedTokenPda24({
|
|
12919
13179
|
owner: tunaPositionAddress,
|
|
12920
13180
|
mint: mintB.address,
|
|
12921
13181
|
tokenProgram: mintB.programAddress
|
|
@@ -12960,11 +13220,11 @@ import {
|
|
|
12960
13220
|
lamports
|
|
12961
13221
|
} from "@solana/kit";
|
|
12962
13222
|
import { fetchSysvarRent } from "@solana/sysvars";
|
|
12963
|
-
import { MEMO_PROGRAM_ADDRESS as
|
|
13223
|
+
import { MEMO_PROGRAM_ADDRESS as MEMO_PROGRAM_ADDRESS16 } from "@solana-program/memo";
|
|
12964
13224
|
import {
|
|
12965
13225
|
ASSOCIATED_TOKEN_PROGRAM_ADDRESS as ASSOCIATED_TOKEN_PROGRAM_ADDRESS3,
|
|
12966
13226
|
fetchAllMaybeMint as fetchAllMaybeMint17,
|
|
12967
|
-
findAssociatedTokenPda as
|
|
13227
|
+
findAssociatedTokenPda as findAssociatedTokenPda25,
|
|
12968
13228
|
TOKEN_2022_PROGRAM_ADDRESS as TOKEN_2022_PROGRAM_ADDRESS15
|
|
12969
13229
|
} from "@solana-program/token-2022";
|
|
12970
13230
|
import assert17 from "assert";
|
|
@@ -13102,47 +13362,47 @@ async function openAndIncreaseTunaLpPositionOrcaInstruction(authority, positionM
|
|
|
13102
13362
|
const marketAddress = (await getMarketAddress(whirlpool.address))[0];
|
|
13103
13363
|
const orcaPositionAddress = (await getPositionAddress15(positionMint.address))[0];
|
|
13104
13364
|
const orcaOracleAddress = (await getOracleAddress6(whirlpool.address))[0];
|
|
13105
|
-
const tunaPositionAta = (await
|
|
13365
|
+
const tunaPositionAta = (await findAssociatedTokenPda25({
|
|
13106
13366
|
owner: tunaPositionAddress,
|
|
13107
13367
|
mint: positionMint.address,
|
|
13108
13368
|
tokenProgram: TOKEN_2022_PROGRAM_ADDRESS15
|
|
13109
13369
|
}))[0];
|
|
13110
|
-
const tunaPositionOwnerAtaA = (await
|
|
13370
|
+
const tunaPositionOwnerAtaA = (await findAssociatedTokenPda25({
|
|
13111
13371
|
owner: authority.address,
|
|
13112
13372
|
mint: mintA.address,
|
|
13113
13373
|
tokenProgram: mintA.programAddress
|
|
13114
13374
|
}))[0];
|
|
13115
|
-
const tunaPositionOwnerAtaB = (await
|
|
13375
|
+
const tunaPositionOwnerAtaB = (await findAssociatedTokenPda25({
|
|
13116
13376
|
owner: authority.address,
|
|
13117
13377
|
mint: mintB.address,
|
|
13118
13378
|
tokenProgram: mintB.programAddress
|
|
13119
13379
|
}))[0];
|
|
13120
|
-
const tunaPositionAtaA = (await
|
|
13380
|
+
const tunaPositionAtaA = (await findAssociatedTokenPda25({
|
|
13121
13381
|
owner: tunaPositionAddress,
|
|
13122
13382
|
mint: mintA.address,
|
|
13123
13383
|
tokenProgram: mintA.programAddress
|
|
13124
13384
|
}))[0];
|
|
13125
|
-
const tunaPositionAtaB = (await
|
|
13385
|
+
const tunaPositionAtaB = (await findAssociatedTokenPda25({
|
|
13126
13386
|
owner: tunaPositionAddress,
|
|
13127
13387
|
mint: mintB.address,
|
|
13128
13388
|
tokenProgram: mintB.programAddress
|
|
13129
13389
|
}))[0];
|
|
13130
|
-
const vaultAAta = (await
|
|
13390
|
+
const vaultAAta = (await findAssociatedTokenPda25({
|
|
13131
13391
|
owner: vaultA.address,
|
|
13132
13392
|
mint: mintA.address,
|
|
13133
13393
|
tokenProgram: mintA.programAddress
|
|
13134
13394
|
}))[0];
|
|
13135
|
-
const vaultBAta = (await
|
|
13395
|
+
const vaultBAta = (await findAssociatedTokenPda25({
|
|
13136
13396
|
owner: vaultB.address,
|
|
13137
13397
|
mint: mintB.address,
|
|
13138
13398
|
tokenProgram: mintB.programAddress
|
|
13139
13399
|
}))[0];
|
|
13140
|
-
const feeRecipientAtaA = (await
|
|
13400
|
+
const feeRecipientAtaA = (await findAssociatedTokenPda25({
|
|
13141
13401
|
owner: tunaConfig.data.feeRecipient,
|
|
13142
13402
|
mint: mintA.address,
|
|
13143
13403
|
tokenProgram: mintA.programAddress
|
|
13144
13404
|
}))[0];
|
|
13145
|
-
const feeRecipientAtaB = (await
|
|
13405
|
+
const feeRecipientAtaB = (await findAssociatedTokenPda25({
|
|
13146
13406
|
owner: tunaConfig.data.feeRecipient,
|
|
13147
13407
|
mint: mintB.address,
|
|
13148
13408
|
tokenProgram: mintB.programAddress
|
|
@@ -13198,7 +13458,7 @@ async function openAndIncreaseTunaLpPositionOrcaInstruction(authority, positionM
|
|
|
13198
13458
|
orcaPosition: orcaPositionAddress,
|
|
13199
13459
|
tokenProgramA: mintA.programAddress,
|
|
13200
13460
|
tokenProgramB: mintB.programAddress,
|
|
13201
|
-
memoProgram:
|
|
13461
|
+
memoProgram: MEMO_PROGRAM_ADDRESS16,
|
|
13202
13462
|
metadataUpdateAuth: WP_NFT_UPDATE_AUTH,
|
|
13203
13463
|
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ADDRESS3,
|
|
13204
13464
|
token2022Program: TOKEN_2022_PROGRAM_ADDRESS15,
|
|
@@ -13227,11 +13487,11 @@ import {
|
|
|
13227
13487
|
lamports as lamports2
|
|
13228
13488
|
} from "@solana/kit";
|
|
13229
13489
|
import { fetchSysvarRent as fetchSysvarRent2 } from "@solana/sysvars";
|
|
13230
|
-
import { MEMO_PROGRAM_ADDRESS as
|
|
13490
|
+
import { MEMO_PROGRAM_ADDRESS as MEMO_PROGRAM_ADDRESS17 } from "@solana-program/memo";
|
|
13231
13491
|
import {
|
|
13232
13492
|
ASSOCIATED_TOKEN_PROGRAM_ADDRESS as ASSOCIATED_TOKEN_PROGRAM_ADDRESS4,
|
|
13233
13493
|
fetchAllMaybeMint as fetchAllMaybeMint18,
|
|
13234
|
-
findAssociatedTokenPda as
|
|
13494
|
+
findAssociatedTokenPda as findAssociatedTokenPda26,
|
|
13235
13495
|
TOKEN_2022_PROGRAM_ADDRESS as TOKEN_2022_PROGRAM_ADDRESS16
|
|
13236
13496
|
} from "@solana-program/token-2022";
|
|
13237
13497
|
import assert18 from "assert";
|
|
@@ -13355,47 +13615,47 @@ async function openAndIncreaseTunaLpPositionFusionInstruction(authority, positio
|
|
|
13355
13615
|
const tunaPositionAddress = (await getTunaLpPositionAddress(positionMint.address))[0];
|
|
13356
13616
|
const marketAddress = (await getMarketAddress(fusionPool.address))[0];
|
|
13357
13617
|
const fusionPositionAddress = (await getPositionAddress16(positionMint.address))[0];
|
|
13358
|
-
const tunaPositionAta = (await
|
|
13618
|
+
const tunaPositionAta = (await findAssociatedTokenPda26({
|
|
13359
13619
|
owner: tunaPositionAddress,
|
|
13360
13620
|
mint: positionMint.address,
|
|
13361
13621
|
tokenProgram: TOKEN_2022_PROGRAM_ADDRESS16
|
|
13362
13622
|
}))[0];
|
|
13363
|
-
const tunaPositionOwnerAtaA = (await
|
|
13623
|
+
const tunaPositionOwnerAtaA = (await findAssociatedTokenPda26({
|
|
13364
13624
|
owner: authority.address,
|
|
13365
13625
|
mint: mintA.address,
|
|
13366
13626
|
tokenProgram: mintA.programAddress
|
|
13367
13627
|
}))[0];
|
|
13368
|
-
const tunaPositionOwnerAtaB = (await
|
|
13628
|
+
const tunaPositionOwnerAtaB = (await findAssociatedTokenPda26({
|
|
13369
13629
|
owner: authority.address,
|
|
13370
13630
|
mint: mintB.address,
|
|
13371
13631
|
tokenProgram: mintB.programAddress
|
|
13372
13632
|
}))[0];
|
|
13373
|
-
const tunaPositionAtaA = (await
|
|
13633
|
+
const tunaPositionAtaA = (await findAssociatedTokenPda26({
|
|
13374
13634
|
owner: tunaPositionAddress,
|
|
13375
13635
|
mint: mintA.address,
|
|
13376
13636
|
tokenProgram: mintA.programAddress
|
|
13377
13637
|
}))[0];
|
|
13378
|
-
const tunaPositionAtaB = (await
|
|
13638
|
+
const tunaPositionAtaB = (await findAssociatedTokenPda26({
|
|
13379
13639
|
owner: tunaPositionAddress,
|
|
13380
13640
|
mint: mintB.address,
|
|
13381
13641
|
tokenProgram: mintB.programAddress
|
|
13382
13642
|
}))[0];
|
|
13383
|
-
const vaultAAta = (await
|
|
13643
|
+
const vaultAAta = (await findAssociatedTokenPda26({
|
|
13384
13644
|
owner: vaultA.address,
|
|
13385
13645
|
mint: mintA.address,
|
|
13386
13646
|
tokenProgram: mintA.programAddress
|
|
13387
13647
|
}))[0];
|
|
13388
|
-
const vaultBAta = (await
|
|
13648
|
+
const vaultBAta = (await findAssociatedTokenPda26({
|
|
13389
13649
|
owner: vaultB.address,
|
|
13390
13650
|
mint: mintB.address,
|
|
13391
13651
|
tokenProgram: mintB.programAddress
|
|
13392
13652
|
}))[0];
|
|
13393
|
-
const feeRecipientAtaA = (await
|
|
13653
|
+
const feeRecipientAtaA = (await findAssociatedTokenPda26({
|
|
13394
13654
|
owner: tunaConfig.data.feeRecipient,
|
|
13395
13655
|
mint: mintA.address,
|
|
13396
13656
|
tokenProgram: mintA.programAddress
|
|
13397
13657
|
}))[0];
|
|
13398
|
-
const feeRecipientAtaB = (await
|
|
13658
|
+
const feeRecipientAtaB = (await findAssociatedTokenPda26({
|
|
13399
13659
|
owner: tunaConfig.data.feeRecipient,
|
|
13400
13660
|
mint: mintB.address,
|
|
13401
13661
|
tokenProgram: mintB.programAddress
|
|
@@ -13449,7 +13709,7 @@ async function openAndIncreaseTunaLpPositionFusionInstruction(authority, positio
|
|
|
13449
13709
|
fusionPosition: fusionPositionAddress,
|
|
13450
13710
|
tokenProgramA: mintA.programAddress,
|
|
13451
13711
|
tokenProgramB: mintB.programAddress,
|
|
13452
|
-
memoProgram:
|
|
13712
|
+
memoProgram: MEMO_PROGRAM_ADDRESS17,
|
|
13453
13713
|
metadataUpdateAuth: FP_NFT_UPDATE_AUTH2,
|
|
13454
13714
|
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ADDRESS4,
|
|
13455
13715
|
token2022Program: TOKEN_2022_PROGRAM_ADDRESS16,
|
|
@@ -13470,7 +13730,7 @@ import {
|
|
|
13470
13730
|
import {
|
|
13471
13731
|
ASSOCIATED_TOKEN_PROGRAM_ADDRESS as ASSOCIATED_TOKEN_PROGRAM_ADDRESS5,
|
|
13472
13732
|
fetchAllMaybeMint as fetchAllMaybeMint19,
|
|
13473
|
-
findAssociatedTokenPda as
|
|
13733
|
+
findAssociatedTokenPda as findAssociatedTokenPda27
|
|
13474
13734
|
} from "@solana-program/token-2022";
|
|
13475
13735
|
import assert19 from "assert";
|
|
13476
13736
|
async function openTunaSpotPositionInstructions(rpc, authority, poolAddress, args) {
|
|
@@ -13492,12 +13752,12 @@ async function openTunaSpotPositionInstructions(rpc, authority, poolAddress, arg
|
|
|
13492
13752
|
}
|
|
13493
13753
|
async function openTunaSpotPositionInstruction(authority, mintA, mintB, poolAddress, args) {
|
|
13494
13754
|
const tunaPositionAddress = (await getTunaSpotPositionAddress(authority.address, poolAddress))[0];
|
|
13495
|
-
const tunaPositionAtaA = (await
|
|
13755
|
+
const tunaPositionAtaA = (await findAssociatedTokenPda27({
|
|
13496
13756
|
owner: tunaPositionAddress,
|
|
13497
13757
|
mint: mintA.address,
|
|
13498
13758
|
tokenProgram: mintA.programAddress
|
|
13499
13759
|
}))[0];
|
|
13500
|
-
const tunaPositionAtaB = (await
|
|
13760
|
+
const tunaPositionAtaB = (await findAssociatedTokenPda27({
|
|
13501
13761
|
owner: tunaPositionAddress,
|
|
13502
13762
|
mint: mintB.address,
|
|
13503
13763
|
tokenProgram: mintB.programAddress
|
|
@@ -13532,10 +13792,10 @@ import {
|
|
|
13532
13792
|
AccountRole as AccountRole17,
|
|
13533
13793
|
assertAccountsExist as assertAccountsExist9
|
|
13534
13794
|
} from "@solana/kit";
|
|
13535
|
-
import { MEMO_PROGRAM_ADDRESS as
|
|
13795
|
+
import { MEMO_PROGRAM_ADDRESS as MEMO_PROGRAM_ADDRESS18 } from "@solana-program/memo";
|
|
13536
13796
|
import {
|
|
13537
13797
|
fetchAllMaybeMint as fetchAllMaybeMint20,
|
|
13538
|
-
findAssociatedTokenPda as
|
|
13798
|
+
findAssociatedTokenPda as findAssociatedTokenPda28,
|
|
13539
13799
|
TOKEN_2022_PROGRAM_ADDRESS as TOKEN_2022_PROGRAM_ADDRESS17
|
|
13540
13800
|
} from "@solana-program/token-2022";
|
|
13541
13801
|
import assert20 from "assert";
|
|
@@ -13625,37 +13885,37 @@ async function decreaseTunaLpPositionOrcaInstruction(authority, tunaPosition, mi
|
|
|
13625
13885
|
const marketAddress = (await getMarketAddress(whirlpool.address))[0];
|
|
13626
13886
|
const orcaPositionAddress = (await getPositionAddress17(positionMint))[0];
|
|
13627
13887
|
const orcaOracleAddress = (await getOracleAddress7(whirlpool.address))[0];
|
|
13628
|
-
const tunaPositionAta = (await
|
|
13888
|
+
const tunaPositionAta = (await findAssociatedTokenPda28({
|
|
13629
13889
|
owner: tunaPosition.address,
|
|
13630
13890
|
mint: positionMint,
|
|
13631
13891
|
tokenProgram: TOKEN_2022_PROGRAM_ADDRESS17
|
|
13632
13892
|
}))[0];
|
|
13633
|
-
const tunaPositionOwnerAtaA = (await
|
|
13893
|
+
const tunaPositionOwnerAtaA = (await findAssociatedTokenPda28({
|
|
13634
13894
|
owner: authority.address,
|
|
13635
13895
|
mint: mintA.address,
|
|
13636
13896
|
tokenProgram: mintA.programAddress
|
|
13637
13897
|
}))[0];
|
|
13638
|
-
const tunaPositionOwnerAtaB = (await
|
|
13898
|
+
const tunaPositionOwnerAtaB = (await findAssociatedTokenPda28({
|
|
13639
13899
|
owner: authority.address,
|
|
13640
13900
|
mint: mintB.address,
|
|
13641
13901
|
tokenProgram: mintB.programAddress
|
|
13642
13902
|
}))[0];
|
|
13643
|
-
const tunaPositionAtaA = (await
|
|
13903
|
+
const tunaPositionAtaA = (await findAssociatedTokenPda28({
|
|
13644
13904
|
owner: tunaPosition.address,
|
|
13645
13905
|
mint: mintA.address,
|
|
13646
13906
|
tokenProgram: mintA.programAddress
|
|
13647
13907
|
}))[0];
|
|
13648
|
-
const tunaPositionAtaB = (await
|
|
13908
|
+
const tunaPositionAtaB = (await findAssociatedTokenPda28({
|
|
13649
13909
|
owner: tunaPosition.address,
|
|
13650
13910
|
mint: mintB.address,
|
|
13651
13911
|
tokenProgram: mintB.programAddress
|
|
13652
13912
|
}))[0];
|
|
13653
|
-
const vaultAAta = (await
|
|
13913
|
+
const vaultAAta = (await findAssociatedTokenPda28({
|
|
13654
13914
|
owner: vaultA.address,
|
|
13655
13915
|
mint: mintA.address,
|
|
13656
13916
|
tokenProgram: mintA.programAddress
|
|
13657
13917
|
}))[0];
|
|
13658
|
-
const vaultBAta = (await
|
|
13918
|
+
const vaultBAta = (await findAssociatedTokenPda28({
|
|
13659
13919
|
owner: vaultB.address,
|
|
13660
13920
|
mint: mintB.address,
|
|
13661
13921
|
tokenProgram: mintB.programAddress
|
|
@@ -13685,7 +13945,7 @@ async function decreaseTunaLpPositionOrcaInstruction(authority, tunaPosition, mi
|
|
|
13685
13945
|
const rewardInfo = whirlpool.data.rewardInfos[rewardIndex];
|
|
13686
13946
|
const rewardMint = rewardMints.find((mint) => mint.address == rewardInfo.mint);
|
|
13687
13947
|
assert20(rewardMint, "Reward mint not found in the provided reward mint accounts");
|
|
13688
|
-
const ownerAta = await
|
|
13948
|
+
const ownerAta = await findAssociatedTokenPda28({
|
|
13689
13949
|
owner: authority.address,
|
|
13690
13950
|
mint: rewardMint.address,
|
|
13691
13951
|
tokenProgram: rewardMint.programAddress
|
|
@@ -13731,7 +13991,7 @@ async function decreaseTunaLpPositionOrcaInstruction(authority, tunaPosition, mi
|
|
|
13731
13991
|
whirlpoolProgram: WHIRLPOOL_PROGRAM_ADDRESS12,
|
|
13732
13992
|
tokenProgramA: mintA.programAddress,
|
|
13733
13993
|
tokenProgramB: mintB.programAddress,
|
|
13734
|
-
memoProgram:
|
|
13994
|
+
memoProgram: MEMO_PROGRAM_ADDRESS18,
|
|
13735
13995
|
...args,
|
|
13736
13996
|
remainingAccountsInfo
|
|
13737
13997
|
});
|
|
@@ -13748,10 +14008,10 @@ import {
|
|
|
13748
14008
|
import {
|
|
13749
14009
|
AccountRole as AccountRole18
|
|
13750
14010
|
} from "@solana/kit";
|
|
13751
|
-
import { MEMO_PROGRAM_ADDRESS as
|
|
14011
|
+
import { MEMO_PROGRAM_ADDRESS as MEMO_PROGRAM_ADDRESS19 } from "@solana-program/memo";
|
|
13752
14012
|
import {
|
|
13753
14013
|
fetchAllMaybeMint as fetchAllMaybeMint21,
|
|
13754
|
-
findAssociatedTokenPda as
|
|
14014
|
+
findAssociatedTokenPda as findAssociatedTokenPda29,
|
|
13755
14015
|
TOKEN_2022_PROGRAM_ADDRESS as TOKEN_2022_PROGRAM_ADDRESS18
|
|
13756
14016
|
} from "@solana-program/token-2022";
|
|
13757
14017
|
import assert21 from "assert";
|
|
@@ -13807,37 +14067,37 @@ async function decreaseTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
13807
14067
|
const tunaConfig = (await getTunaConfigAddress())[0];
|
|
13808
14068
|
const marketAddress = (await getMarketAddress(fusionPool.address))[0];
|
|
13809
14069
|
const fusionPositionAddress = (await getPositionAddress18(positionMint))[0];
|
|
13810
|
-
const tunaPositionAta = (await
|
|
14070
|
+
const tunaPositionAta = (await findAssociatedTokenPda29({
|
|
13811
14071
|
owner: tunaPosition.address,
|
|
13812
14072
|
mint: positionMint,
|
|
13813
14073
|
tokenProgram: TOKEN_2022_PROGRAM_ADDRESS18
|
|
13814
14074
|
}))[0];
|
|
13815
|
-
const tunaPositionOwnerAtaA = (await
|
|
14075
|
+
const tunaPositionOwnerAtaA = (await findAssociatedTokenPda29({
|
|
13816
14076
|
owner: authority.address,
|
|
13817
14077
|
mint: mintA.address,
|
|
13818
14078
|
tokenProgram: mintA.programAddress
|
|
13819
14079
|
}))[0];
|
|
13820
|
-
const tunaPositionOwnerAtaB = (await
|
|
14080
|
+
const tunaPositionOwnerAtaB = (await findAssociatedTokenPda29({
|
|
13821
14081
|
owner: authority.address,
|
|
13822
14082
|
mint: mintB.address,
|
|
13823
14083
|
tokenProgram: mintB.programAddress
|
|
13824
14084
|
}))[0];
|
|
13825
|
-
const tunaPositionAtaA = (await
|
|
14085
|
+
const tunaPositionAtaA = (await findAssociatedTokenPda29({
|
|
13826
14086
|
owner: tunaPosition.address,
|
|
13827
14087
|
mint: mintA.address,
|
|
13828
14088
|
tokenProgram: mintA.programAddress
|
|
13829
14089
|
}))[0];
|
|
13830
|
-
const tunaPositionAtaB = (await
|
|
14090
|
+
const tunaPositionAtaB = (await findAssociatedTokenPda29({
|
|
13831
14091
|
owner: tunaPosition.address,
|
|
13832
14092
|
mint: mintB.address,
|
|
13833
14093
|
tokenProgram: mintB.programAddress
|
|
13834
14094
|
}))[0];
|
|
13835
|
-
const vaultAAta = (await
|
|
14095
|
+
const vaultAAta = (await findAssociatedTokenPda29({
|
|
13836
14096
|
owner: vaultA.address,
|
|
13837
14097
|
mint: mintA.address,
|
|
13838
14098
|
tokenProgram: mintA.programAddress
|
|
13839
14099
|
}))[0];
|
|
13840
|
-
const vaultBAta = (await
|
|
14100
|
+
const vaultBAta = (await findAssociatedTokenPda29({
|
|
13841
14101
|
owner: vaultB.address,
|
|
13842
14102
|
mint: mintB.address,
|
|
13843
14103
|
tokenProgram: mintB.programAddress
|
|
@@ -13894,7 +14154,7 @@ async function decreaseTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
13894
14154
|
fusionammProgram: FUSIONAMM_PROGRAM_ADDRESS12,
|
|
13895
14155
|
tokenProgramA: mintA.programAddress,
|
|
13896
14156
|
tokenProgramB: mintB.programAddress,
|
|
13897
|
-
memoProgram:
|
|
14157
|
+
memoProgram: MEMO_PROGRAM_ADDRESS19,
|
|
13898
14158
|
...args,
|
|
13899
14159
|
remainingAccountsInfo
|
|
13900
14160
|
});
|
|
@@ -13903,19 +14163,19 @@ async function decreaseTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
13903
14163
|
}
|
|
13904
14164
|
|
|
13905
14165
|
// src/txbuilder/repayBadDebt.ts
|
|
13906
|
-
import { MEMO_PROGRAM_ADDRESS as
|
|
13907
|
-
import { fetchMaybeMint as fetchMaybeMint2, findAssociatedTokenPda as
|
|
14166
|
+
import { MEMO_PROGRAM_ADDRESS as MEMO_PROGRAM_ADDRESS20 } from "@solana-program/memo";
|
|
14167
|
+
import { fetchMaybeMint as fetchMaybeMint2, findAssociatedTokenPda as findAssociatedTokenPda30 } from "@solana-program/token-2022";
|
|
13908
14168
|
async function repayBadDebtInstruction(rpc, authority, mintAddress, funds, shares) {
|
|
13909
14169
|
const mint = await fetchMaybeMint2(rpc, mintAddress);
|
|
13910
14170
|
if (!mint.exists) throw new Error("Mint account not found");
|
|
13911
14171
|
const tunaConfig = (await getTunaConfigAddress())[0];
|
|
13912
14172
|
const vault = (await getLendingVaultAddress(mint.address))[0];
|
|
13913
|
-
const vaultAta = (await
|
|
14173
|
+
const vaultAta = (await findAssociatedTokenPda30({
|
|
13914
14174
|
owner: vault,
|
|
13915
14175
|
mint: mint.address,
|
|
13916
14176
|
tokenProgram: mint.programAddress
|
|
13917
14177
|
}))[0];
|
|
13918
|
-
const authorityAta = (await
|
|
14178
|
+
const authorityAta = (await findAssociatedTokenPda30({
|
|
13919
14179
|
owner: authority.address,
|
|
13920
14180
|
mint: mint.address,
|
|
13921
14181
|
tokenProgram: mint.programAddress
|
|
@@ -13928,7 +14188,7 @@ async function repayBadDebtInstruction(rpc, authority, mintAddress, funds, share
|
|
|
13928
14188
|
tunaConfig,
|
|
13929
14189
|
vault,
|
|
13930
14190
|
tokenProgram: mint.programAddress,
|
|
13931
|
-
memoProgram:
|
|
14191
|
+
memoProgram: MEMO_PROGRAM_ADDRESS20,
|
|
13932
14192
|
funds,
|
|
13933
14193
|
shares
|
|
13934
14194
|
});
|
|
@@ -13960,7 +14220,7 @@ async function setTunaSpotPositionLimitOrdersInstruction(authority, poolAddress,
|
|
|
13960
14220
|
}
|
|
13961
14221
|
|
|
13962
14222
|
// src/txbuilder/resetTunaSpotPosition.ts
|
|
13963
|
-
import { fetchAllMaybeMint as fetchAllMaybeMint22, findAssociatedTokenPda as
|
|
14223
|
+
import { fetchAllMaybeMint as fetchAllMaybeMint22, findAssociatedTokenPda as findAssociatedTokenPda31 } from "@solana-program/token-2022";
|
|
13964
14224
|
import assert22 from "assert";
|
|
13965
14225
|
async function resetTunaSpotPositionInstruction(rpc, authority, poolAddress, args) {
|
|
13966
14226
|
const tunaPositionAddress = (await getTunaSpotPositionAddress(authority.address, poolAddress))[0];
|
|
@@ -13968,12 +14228,12 @@ async function resetTunaSpotPositionInstruction(rpc, authority, poolAddress, arg
|
|
|
13968
14228
|
const [mintA, mintB] = await fetchAllMaybeMint22(rpc, [tunaPosition.data.mintA, tunaPosition.data.mintB]);
|
|
13969
14229
|
assert22(mintA.exists, "Token A not found");
|
|
13970
14230
|
assert22(mintB.exists, "Token B not found");
|
|
13971
|
-
const tunaPositionAtaA = (await
|
|
14231
|
+
const tunaPositionAtaA = (await findAssociatedTokenPda31({
|
|
13972
14232
|
owner: tunaPositionAddress,
|
|
13973
14233
|
mint: mintA.address,
|
|
13974
14234
|
tokenProgram: mintA.programAddress
|
|
13975
14235
|
}))[0];
|
|
13976
|
-
const tunaPositionAtaB = (await
|
|
14236
|
+
const tunaPositionAtaB = (await findAssociatedTokenPda31({
|
|
13977
14237
|
owner: tunaPositionAddress,
|
|
13978
14238
|
mint: mintB.address,
|
|
13979
14239
|
tokenProgram: mintB.programAddress
|
|
@@ -14014,8 +14274,8 @@ async function updateVaultInstruction(authority, mint, args) {
|
|
|
14014
14274
|
}
|
|
14015
14275
|
|
|
14016
14276
|
// src/txbuilder/withdraw.ts
|
|
14017
|
-
import { MEMO_PROGRAM_ADDRESS as
|
|
14018
|
-
import { fetchMaybeMint as fetchMaybeMint3, findAssociatedTokenPda as
|
|
14277
|
+
import { MEMO_PROGRAM_ADDRESS as MEMO_PROGRAM_ADDRESS21 } from "@solana-program/memo";
|
|
14278
|
+
import { fetchMaybeMint as fetchMaybeMint3, findAssociatedTokenPda as findAssociatedTokenPda32 } from "@solana-program/token-2022";
|
|
14019
14279
|
async function withdrawInstructions(rpc, authority, mintAddress, funds, shares) {
|
|
14020
14280
|
const instructions = [];
|
|
14021
14281
|
const mint = await fetchMaybeMint3(rpc, mintAddress);
|
|
@@ -14037,12 +14297,12 @@ async function withdrawInstruction(authority, mint, funds, shares) {
|
|
|
14037
14297
|
const tunaConfig = (await getTunaConfigAddress())[0];
|
|
14038
14298
|
const lendingPosition = (await getLendingPositionAddress(authority.address, mint.address))[0];
|
|
14039
14299
|
const vault = (await getLendingVaultAddress(mint.address))[0];
|
|
14040
|
-
const vaultAta = (await
|
|
14300
|
+
const vaultAta = (await findAssociatedTokenPda32({
|
|
14041
14301
|
owner: vault,
|
|
14042
14302
|
mint: mint.address,
|
|
14043
14303
|
tokenProgram: mint.programAddress
|
|
14044
14304
|
}))[0];
|
|
14045
|
-
const authorityAta = (await
|
|
14305
|
+
const authorityAta = (await findAssociatedTokenPda32({
|
|
14046
14306
|
owner: authority.address,
|
|
14047
14307
|
mint: mint.address,
|
|
14048
14308
|
tokenProgram: mint.programAddress
|
|
@@ -14056,7 +14316,7 @@ async function withdrawInstruction(authority, mint, funds, shares) {
|
|
|
14056
14316
|
vault,
|
|
14057
14317
|
vaultAta,
|
|
14058
14318
|
tokenProgram: mint.programAddress,
|
|
14059
|
-
memoProgram:
|
|
14319
|
+
memoProgram: MEMO_PROGRAM_ADDRESS21,
|
|
14060
14320
|
funds,
|
|
14061
14321
|
shares
|
|
14062
14322
|
});
|
|
@@ -14069,13 +14329,13 @@ import {
|
|
|
14069
14329
|
address as address3
|
|
14070
14330
|
} from "@solana/kit";
|
|
14071
14331
|
import { fetchAddressLookupTable, getExtendLookupTableInstruction as getExtendLookupTableInstruction2 } from "@solana-program/address-lookup-table";
|
|
14072
|
-
import { MEMO_PROGRAM_ADDRESS as
|
|
14332
|
+
import { MEMO_PROGRAM_ADDRESS as MEMO_PROGRAM_ADDRESS22 } from "@solana-program/memo";
|
|
14073
14333
|
import { SYSTEM_PROGRAM_ADDRESS } from "@solana-program/system";
|
|
14074
14334
|
import { TOKEN_PROGRAM_ADDRESS as TOKEN_PROGRAM_ADDRESS2 } from "@solana-program/token";
|
|
14075
14335
|
import {
|
|
14076
14336
|
ASSOCIATED_TOKEN_PROGRAM_ADDRESS as ASSOCIATED_TOKEN_PROGRAM_ADDRESS6,
|
|
14077
14337
|
fetchMint,
|
|
14078
|
-
findAssociatedTokenPda as
|
|
14338
|
+
findAssociatedTokenPda as findAssociatedTokenPda33,
|
|
14079
14339
|
TOKEN_2022_PROGRAM_ADDRESS as TOKEN_2022_PROGRAM_ADDRESS19
|
|
14080
14340
|
} from "@solana-program/token-2022";
|
|
14081
14341
|
async function getAddressesForMarketLookupTable(rpc, poolAddress, marketMaker) {
|
|
@@ -14086,12 +14346,12 @@ async function getAddressesForMarketLookupTable(rpc, poolAddress, marketMaker) {
|
|
|
14086
14346
|
const pool = marketMaker == 0 /* Orca */ ? await fetchWhirlpool3(rpc, poolAddress) : await fetchFusionPool3(rpc, poolAddress);
|
|
14087
14347
|
const mintA = await fetchMint(rpc, pool.data.tokenMintA);
|
|
14088
14348
|
const mintB = await fetchMint(rpc, pool.data.tokenMintB);
|
|
14089
|
-
const feeRecipientAtaA = (await
|
|
14349
|
+
const feeRecipientAtaA = (await findAssociatedTokenPda33({
|
|
14090
14350
|
owner: tunaConfig.data.feeRecipient,
|
|
14091
14351
|
mint: mintA.address,
|
|
14092
14352
|
tokenProgram: mintA.programAddress
|
|
14093
14353
|
}))[0];
|
|
14094
|
-
const feeRecipientAtaB = (await
|
|
14354
|
+
const feeRecipientAtaB = (await findAssociatedTokenPda33({
|
|
14095
14355
|
owner: tunaConfig.data.feeRecipient,
|
|
14096
14356
|
mint: mintB.address,
|
|
14097
14357
|
tokenProgram: mintB.programAddress
|
|
@@ -14100,12 +14360,12 @@ async function getAddressesForMarketLookupTable(rpc, poolAddress, marketMaker) {
|
|
|
14100
14360
|
(await getLendingVaultAddress(mintA.address))[0],
|
|
14101
14361
|
(await getLendingVaultAddress(mintB.address))[0]
|
|
14102
14362
|
]);
|
|
14103
|
-
const vaultAAta = (await
|
|
14363
|
+
const vaultAAta = (await findAssociatedTokenPda33({
|
|
14104
14364
|
owner: vaultA.address,
|
|
14105
14365
|
mint: mintA.address,
|
|
14106
14366
|
tokenProgram: mintA.programAddress
|
|
14107
14367
|
}))[0];
|
|
14108
|
-
const vaultBAta = (await
|
|
14368
|
+
const vaultBAta = (await findAssociatedTokenPda33({
|
|
14109
14369
|
owner: vaultB.address,
|
|
14110
14370
|
mint: mintB.address,
|
|
14111
14371
|
tokenProgram: mintB.programAddress
|
|
@@ -14117,7 +14377,7 @@ async function getAddressesForMarketLookupTable(rpc, poolAddress, marketMaker) {
|
|
|
14117
14377
|
TOKEN_PROGRAM_ADDRESS2,
|
|
14118
14378
|
TOKEN_2022_PROGRAM_ADDRESS19,
|
|
14119
14379
|
NATIVE_MINT,
|
|
14120
|
-
|
|
14380
|
+
MEMO_PROGRAM_ADDRESS22,
|
|
14121
14381
|
tunaConfigAddress,
|
|
14122
14382
|
marketAddress,
|
|
14123
14383
|
mintA.address,
|
|
@@ -14172,8 +14432,8 @@ async function extendAddressLookupTableForMarketInstructions(rpc, poolAddress, m
|
|
|
14172
14432
|
}
|
|
14173
14433
|
|
|
14174
14434
|
// src/txbuilder/repayTunaLpPositionDebt.ts
|
|
14175
|
-
import { MEMO_PROGRAM_ADDRESS as
|
|
14176
|
-
import { fetchAllMaybeMint as fetchAllMaybeMint23, findAssociatedTokenPda as
|
|
14435
|
+
import { MEMO_PROGRAM_ADDRESS as MEMO_PROGRAM_ADDRESS23 } from "@solana-program/memo";
|
|
14436
|
+
import { fetchAllMaybeMint as fetchAllMaybeMint23, findAssociatedTokenPda as findAssociatedTokenPda34 } from "@solana-program/token-2022";
|
|
14177
14437
|
import assert23 from "assert";
|
|
14178
14438
|
async function repayTunaLpPositionDebtInstructions(rpc, authority, positionMint, collateralA, collateralB, createInstructions, cleanupInstructions) {
|
|
14179
14439
|
const instructions = [];
|
|
@@ -14218,34 +14478,34 @@ async function repayTunaLpPositionDebtInstructions(rpc, authority, positionMint,
|
|
|
14218
14478
|
}
|
|
14219
14479
|
async function repayTunaLpPositionDebtInstruction(authority, positionMint, mintA, mintB, marketAddress, collateralA, collateralB) {
|
|
14220
14480
|
const tunaPositionAddress = (await getTunaLpPositionAddress(positionMint))[0];
|
|
14221
|
-
const tunaPositionOwnerAtaA = (await
|
|
14481
|
+
const tunaPositionOwnerAtaA = (await findAssociatedTokenPda34({
|
|
14222
14482
|
owner: authority.address,
|
|
14223
14483
|
mint: mintA.address,
|
|
14224
14484
|
tokenProgram: mintA.programAddress
|
|
14225
14485
|
}))[0];
|
|
14226
|
-
const tunaPositionOwnerAtaB = (await
|
|
14486
|
+
const tunaPositionOwnerAtaB = (await findAssociatedTokenPda34({
|
|
14227
14487
|
owner: authority.address,
|
|
14228
14488
|
mint: mintB.address,
|
|
14229
14489
|
tokenProgram: mintB.programAddress
|
|
14230
14490
|
}))[0];
|
|
14231
|
-
const tunaPositionAtaA = (await
|
|
14491
|
+
const tunaPositionAtaA = (await findAssociatedTokenPda34({
|
|
14232
14492
|
owner: tunaPositionAddress,
|
|
14233
14493
|
mint: mintA.address,
|
|
14234
14494
|
tokenProgram: mintA.programAddress
|
|
14235
14495
|
}))[0];
|
|
14236
|
-
const tunaPositionAtaB = (await
|
|
14496
|
+
const tunaPositionAtaB = (await findAssociatedTokenPda34({
|
|
14237
14497
|
owner: tunaPositionAddress,
|
|
14238
14498
|
mint: mintB.address,
|
|
14239
14499
|
tokenProgram: mintB.programAddress
|
|
14240
14500
|
}))[0];
|
|
14241
14501
|
const vaultAAddress = (await getLendingVaultAddress(mintA.address))[0];
|
|
14242
|
-
const vaultAAta = (await
|
|
14502
|
+
const vaultAAta = (await findAssociatedTokenPda34({
|
|
14243
14503
|
owner: vaultAAddress,
|
|
14244
14504
|
mint: mintA.address,
|
|
14245
14505
|
tokenProgram: mintA.programAddress
|
|
14246
14506
|
}))[0];
|
|
14247
14507
|
const vaultBAddress = (await getLendingVaultAddress(mintB.address))[0];
|
|
14248
|
-
const vaultBAta = (await
|
|
14508
|
+
const vaultBAta = (await findAssociatedTokenPda34({
|
|
14249
14509
|
owner: vaultBAddress,
|
|
14250
14510
|
mint: mintB.address,
|
|
14251
14511
|
tokenProgram: mintB.programAddress
|
|
@@ -14253,7 +14513,7 @@ async function repayTunaLpPositionDebtInstruction(authority, positionMint, mintA
|
|
|
14253
14513
|
return getRepayTunaLpPositionDebtInstruction({
|
|
14254
14514
|
authority,
|
|
14255
14515
|
market: marketAddress,
|
|
14256
|
-
memoProgram:
|
|
14516
|
+
memoProgram: MEMO_PROGRAM_ADDRESS23,
|
|
14257
14517
|
mintA: mintA.address,
|
|
14258
14518
|
mintB: mintB.address,
|
|
14259
14519
|
tokenProgramA: mintA.programAddress,
|
|
@@ -14287,10 +14547,10 @@ import {
|
|
|
14287
14547
|
lamports as lamports3
|
|
14288
14548
|
} from "@solana/kit";
|
|
14289
14549
|
import { fetchSysvarRent as fetchSysvarRent3 } from "@solana/sysvars";
|
|
14290
|
-
import { MEMO_PROGRAM_ADDRESS as
|
|
14550
|
+
import { MEMO_PROGRAM_ADDRESS as MEMO_PROGRAM_ADDRESS24 } from "@solana-program/memo";
|
|
14291
14551
|
import {
|
|
14292
14552
|
fetchAllMaybeMint as fetchAllMaybeMint24,
|
|
14293
|
-
findAssociatedTokenPda as
|
|
14553
|
+
findAssociatedTokenPda as findAssociatedTokenPda35,
|
|
14294
14554
|
TOKEN_2022_PROGRAM_ADDRESS as TOKEN_2022_PROGRAM_ADDRESS20
|
|
14295
14555
|
} from "@solana-program/token-2022";
|
|
14296
14556
|
import assert24 from "assert";
|
|
@@ -14380,27 +14640,27 @@ async function rebalanceTunaLpPositionOrcaInstruction(authority, tunaPosition, t
|
|
|
14380
14640
|
const marketAddress = (await getMarketAddress(whirlpool.address))[0];
|
|
14381
14641
|
const orcaPositionAddress = (await getPositionAddress19(positionMint))[0];
|
|
14382
14642
|
const orcaOracleAddress = (await getOracleAddress9(whirlpool.address))[0];
|
|
14383
|
-
const tunaPositionAta = (await
|
|
14643
|
+
const tunaPositionAta = (await findAssociatedTokenPda35({
|
|
14384
14644
|
owner: tunaPosition.address,
|
|
14385
14645
|
mint: positionMint,
|
|
14386
14646
|
tokenProgram: TOKEN_2022_PROGRAM_ADDRESS20
|
|
14387
14647
|
}))[0];
|
|
14388
|
-
const tunaPositionAtaA = (await
|
|
14648
|
+
const tunaPositionAtaA = (await findAssociatedTokenPda35({
|
|
14389
14649
|
owner: tunaPosition.address,
|
|
14390
14650
|
mint: mintA.address,
|
|
14391
14651
|
tokenProgram: mintA.programAddress
|
|
14392
14652
|
}))[0];
|
|
14393
|
-
const tunaPositionAtaB = (await
|
|
14653
|
+
const tunaPositionAtaB = (await findAssociatedTokenPda35({
|
|
14394
14654
|
owner: tunaPosition.address,
|
|
14395
14655
|
mint: mintB.address,
|
|
14396
14656
|
tokenProgram: mintB.programAddress
|
|
14397
14657
|
}))[0];
|
|
14398
|
-
const feeRecipientAtaA = (await
|
|
14658
|
+
const feeRecipientAtaA = (await findAssociatedTokenPda35({
|
|
14399
14659
|
owner: tunaConfig.data.feeRecipient,
|
|
14400
14660
|
mint: mintA.address,
|
|
14401
14661
|
tokenProgram: mintA.programAddress
|
|
14402
14662
|
}))[0];
|
|
14403
|
-
const feeRecipientAtaB = (await
|
|
14663
|
+
const feeRecipientAtaB = (await findAssociatedTokenPda35({
|
|
14404
14664
|
owner: tunaConfig.data.feeRecipient,
|
|
14405
14665
|
mint: mintB.address,
|
|
14406
14666
|
tokenProgram: mintB.programAddress
|
|
@@ -14462,7 +14722,7 @@ async function rebalanceTunaLpPositionOrcaInstruction(authority, tunaPosition, t
|
|
|
14462
14722
|
whirlpoolProgram: WHIRLPOOL_PROGRAM_ADDRESS14,
|
|
14463
14723
|
tokenProgramA: mintA.programAddress,
|
|
14464
14724
|
tokenProgramB: mintB.programAddress,
|
|
14465
|
-
memoProgram:
|
|
14725
|
+
memoProgram: MEMO_PROGRAM_ADDRESS24,
|
|
14466
14726
|
remainingAccountsInfo
|
|
14467
14727
|
});
|
|
14468
14728
|
ix.accounts.push(...remainingAccounts);
|
|
@@ -14483,10 +14743,10 @@ import {
|
|
|
14483
14743
|
lamports as lamports4
|
|
14484
14744
|
} from "@solana/kit";
|
|
14485
14745
|
import { fetchSysvarRent as fetchSysvarRent4 } from "@solana/sysvars";
|
|
14486
|
-
import { MEMO_PROGRAM_ADDRESS as
|
|
14746
|
+
import { MEMO_PROGRAM_ADDRESS as MEMO_PROGRAM_ADDRESS25 } from "@solana-program/memo";
|
|
14487
14747
|
import {
|
|
14488
14748
|
fetchAllMaybeMint as fetchAllMaybeMint25,
|
|
14489
|
-
findAssociatedTokenPda as
|
|
14749
|
+
findAssociatedTokenPda as findAssociatedTokenPda36,
|
|
14490
14750
|
TOKEN_2022_PROGRAM_ADDRESS as TOKEN_2022_PROGRAM_ADDRESS21
|
|
14491
14751
|
} from "@solana-program/token-2022";
|
|
14492
14752
|
import assert25 from "assert";
|
|
@@ -14571,27 +14831,27 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
14571
14831
|
const positionMint = tunaPosition.data.positionMint;
|
|
14572
14832
|
const marketAddress = (await getMarketAddress(fusionPool.address))[0];
|
|
14573
14833
|
const fusionPositionAddress = (await getPositionAddress20(positionMint))[0];
|
|
14574
|
-
const tunaPositionAta = (await
|
|
14834
|
+
const tunaPositionAta = (await findAssociatedTokenPda36({
|
|
14575
14835
|
owner: tunaPosition.address,
|
|
14576
14836
|
mint: positionMint,
|
|
14577
14837
|
tokenProgram: TOKEN_2022_PROGRAM_ADDRESS21
|
|
14578
14838
|
}))[0];
|
|
14579
|
-
const tunaPositionAtaA = (await
|
|
14839
|
+
const tunaPositionAtaA = (await findAssociatedTokenPda36({
|
|
14580
14840
|
owner: tunaPosition.address,
|
|
14581
14841
|
mint: mintA.address,
|
|
14582
14842
|
tokenProgram: mintA.programAddress
|
|
14583
14843
|
}))[0];
|
|
14584
|
-
const tunaPositionAtaB = (await
|
|
14844
|
+
const tunaPositionAtaB = (await findAssociatedTokenPda36({
|
|
14585
14845
|
owner: tunaPosition.address,
|
|
14586
14846
|
mint: mintB.address,
|
|
14587
14847
|
tokenProgram: mintB.programAddress
|
|
14588
14848
|
}))[0];
|
|
14589
|
-
const feeRecipientAtaA = (await
|
|
14849
|
+
const feeRecipientAtaA = (await findAssociatedTokenPda36({
|
|
14590
14850
|
owner: tunaConfig.data.feeRecipient,
|
|
14591
14851
|
mint: mintA.address,
|
|
14592
14852
|
tokenProgram: mintA.programAddress
|
|
14593
14853
|
}))[0];
|
|
14594
|
-
const feeRecipientAtaB = (await
|
|
14854
|
+
const feeRecipientAtaB = (await findAssociatedTokenPda36({
|
|
14595
14855
|
owner: tunaConfig.data.feeRecipient,
|
|
14596
14856
|
mint: mintB.address,
|
|
14597
14857
|
tokenProgram: mintB.programAddress
|
|
@@ -14651,7 +14911,7 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
14651
14911
|
fusionammProgram: FUSIONAMM_PROGRAM_ADDRESS14,
|
|
14652
14912
|
tokenProgramA: mintA.programAddress,
|
|
14653
14913
|
tokenProgramB: mintB.programAddress,
|
|
14654
|
-
memoProgram:
|
|
14914
|
+
memoProgram: MEMO_PROGRAM_ADDRESS25,
|
|
14655
14915
|
remainingAccountsInfo
|
|
14656
14916
|
});
|
|
14657
14917
|
ix.accounts.push(...remainingAccounts);
|
|
@@ -14817,6 +15077,7 @@ export {
|
|
|
14817
15077
|
TunaPositionState,
|
|
14818
15078
|
UNLIMITED_SUPPLY_LIMIT,
|
|
14819
15079
|
UPDATE_MARKET_DISCRIMINATOR,
|
|
15080
|
+
UPDATE_MARKET_VAULTS_DISCRIMINATOR,
|
|
14820
15081
|
UPDATE_VAULT_DISCRIMINATOR,
|
|
14821
15082
|
VAULT_DISCRIMINATOR,
|
|
14822
15083
|
WITHDRAW_DISCRIMINATOR,
|
|
@@ -15176,6 +15437,11 @@ export {
|
|
|
15176
15437
|
getUpdateMarketInstructionDataCodec,
|
|
15177
15438
|
getUpdateMarketInstructionDataDecoder,
|
|
15178
15439
|
getUpdateMarketInstructionDataEncoder,
|
|
15440
|
+
getUpdateMarketVaultsDiscriminatorBytes,
|
|
15441
|
+
getUpdateMarketVaultsInstruction,
|
|
15442
|
+
getUpdateMarketVaultsInstructionDataCodec,
|
|
15443
|
+
getUpdateMarketVaultsInstructionDataDecoder,
|
|
15444
|
+
getUpdateMarketVaultsInstructionDataEncoder,
|
|
15179
15445
|
getUpdateVaultDiscriminatorBytes,
|
|
15180
15446
|
getUpdateVaultInstruction,
|
|
15181
15447
|
getUpdateVaultInstructionDataCodec,
|
|
@@ -15206,6 +15472,8 @@ export {
|
|
|
15206
15472
|
liquidateTunaLpPositionOrcaInstructions,
|
|
15207
15473
|
liquidateTunaSpotPositionFusionInstruction,
|
|
15208
15474
|
liquidateTunaSpotPositionFusionInstructions,
|
|
15475
|
+
liquidateTunaSpotPositionJupiterInstruction,
|
|
15476
|
+
liquidateTunaSpotPositionJupiterInstructions,
|
|
15209
15477
|
liquidateTunaSpotPositionOrcaInstruction,
|
|
15210
15478
|
liquidateTunaSpotPositionOrcaInstructions,
|
|
15211
15479
|
modifyTunaSpotPositionFusionInstruction,
|
|
@@ -15273,6 +15541,7 @@ export {
|
|
|
15273
15541
|
parseSetTunaLpPositionRebalanceThresholdInstruction,
|
|
15274
15542
|
parseSetTunaSpotPositionLimitOrdersInstruction,
|
|
15275
15543
|
parseUpdateMarketInstruction,
|
|
15544
|
+
parseUpdateMarketVaultsInstruction,
|
|
15276
15545
|
parseUpdateVaultInstruction,
|
|
15277
15546
|
parseWithdrawInstruction,
|
|
15278
15547
|
rebalanceTunaLpPositionFusionInstruction,
|