@crypticdot/defituna-client 3.5.5 → 3.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +476 -449
- package/dist/index.d.cts +3 -9
- package/dist/index.d.ts +3 -9
- package/dist/index.js +473 -441
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -773,13 +773,13 @@ function decodeLendingPosition(encodedAccount) {
|
|
|
773
773
|
getLendingPositionDecoder()
|
|
774
774
|
);
|
|
775
775
|
}
|
|
776
|
-
async function fetchLendingPosition(rpc,
|
|
777
|
-
const maybeAccount = await fetchMaybeLendingPosition(rpc,
|
|
776
|
+
async function fetchLendingPosition(rpc, address8, config) {
|
|
777
|
+
const maybeAccount = await fetchMaybeLendingPosition(rpc, address8, config);
|
|
778
778
|
(0, import_kit.assertAccountExists)(maybeAccount);
|
|
779
779
|
return maybeAccount;
|
|
780
780
|
}
|
|
781
|
-
async function fetchMaybeLendingPosition(rpc,
|
|
782
|
-
const maybeAccount = await (0, import_kit.fetchEncodedAccount)(rpc,
|
|
781
|
+
async function fetchMaybeLendingPosition(rpc, address8, config) {
|
|
782
|
+
const maybeAccount = await (0, import_kit.fetchEncodedAccount)(rpc, address8, config);
|
|
783
783
|
return decodeLendingPosition(maybeAccount);
|
|
784
784
|
}
|
|
785
785
|
async function fetchAllLendingPosition(rpc, addresses, config) {
|
|
@@ -1007,13 +1007,13 @@ function decodeMarket(encodedAccount) {
|
|
|
1007
1007
|
getMarketDecoder()
|
|
1008
1008
|
);
|
|
1009
1009
|
}
|
|
1010
|
-
async function fetchMarket(rpc,
|
|
1011
|
-
const maybeAccount = await fetchMaybeMarket(rpc,
|
|
1010
|
+
async function fetchMarket(rpc, address8, config) {
|
|
1011
|
+
const maybeAccount = await fetchMaybeMarket(rpc, address8, config);
|
|
1012
1012
|
(0, import_kit8.assertAccountExists)(maybeAccount);
|
|
1013
1013
|
return maybeAccount;
|
|
1014
1014
|
}
|
|
1015
|
-
async function fetchMaybeMarket(rpc,
|
|
1016
|
-
const maybeAccount = await (0, import_kit8.fetchEncodedAccount)(rpc,
|
|
1015
|
+
async function fetchMaybeMarket(rpc, address8, config) {
|
|
1016
|
+
const maybeAccount = await (0, import_kit8.fetchEncodedAccount)(rpc, address8, config);
|
|
1017
1017
|
return decodeMarket(maybeAccount);
|
|
1018
1018
|
}
|
|
1019
1019
|
async function fetchAllMarket(rpc, addresses, config) {
|
|
@@ -1100,13 +1100,13 @@ function decodeTunaConfig(encodedAccount) {
|
|
|
1100
1100
|
getTunaConfigDecoder()
|
|
1101
1101
|
);
|
|
1102
1102
|
}
|
|
1103
|
-
async function fetchTunaConfig(rpc,
|
|
1104
|
-
const maybeAccount = await fetchMaybeTunaConfig(rpc,
|
|
1103
|
+
async function fetchTunaConfig(rpc, address8, config) {
|
|
1104
|
+
const maybeAccount = await fetchMaybeTunaConfig(rpc, address8, config);
|
|
1105
1105
|
(0, import_kit9.assertAccountExists)(maybeAccount);
|
|
1106
1106
|
return maybeAccount;
|
|
1107
1107
|
}
|
|
1108
|
-
async function fetchMaybeTunaConfig(rpc,
|
|
1109
|
-
const maybeAccount = await (0, import_kit9.fetchEncodedAccount)(rpc,
|
|
1108
|
+
async function fetchMaybeTunaConfig(rpc, address8, config) {
|
|
1109
|
+
const maybeAccount = await (0, import_kit9.fetchEncodedAccount)(rpc, address8, config);
|
|
1110
1110
|
return decodeTunaConfig(maybeAccount);
|
|
1111
1111
|
}
|
|
1112
1112
|
async function fetchAllTunaConfig(rpc, addresses, config) {
|
|
@@ -1221,13 +1221,13 @@ function decodeTunaLpPosition(encodedAccount) {
|
|
|
1221
1221
|
getTunaLpPositionDecoder()
|
|
1222
1222
|
);
|
|
1223
1223
|
}
|
|
1224
|
-
async function fetchTunaLpPosition(rpc,
|
|
1225
|
-
const maybeAccount = await fetchMaybeTunaLpPosition(rpc,
|
|
1224
|
+
async function fetchTunaLpPosition(rpc, address8, config) {
|
|
1225
|
+
const maybeAccount = await fetchMaybeTunaLpPosition(rpc, address8, config);
|
|
1226
1226
|
(0, import_kit10.assertAccountExists)(maybeAccount);
|
|
1227
1227
|
return maybeAccount;
|
|
1228
1228
|
}
|
|
1229
|
-
async function fetchMaybeTunaLpPosition(rpc,
|
|
1230
|
-
const maybeAccount = await (0, import_kit10.fetchEncodedAccount)(rpc,
|
|
1229
|
+
async function fetchMaybeTunaLpPosition(rpc, address8, config) {
|
|
1230
|
+
const maybeAccount = await (0, import_kit10.fetchEncodedAccount)(rpc, address8, config);
|
|
1231
1231
|
return decodeTunaLpPosition(maybeAccount);
|
|
1232
1232
|
}
|
|
1233
1233
|
async function fetchAllTunaLpPosition(rpc, addresses, config) {
|
|
@@ -1325,13 +1325,13 @@ function decodeTunaSpotPosition(encodedAccount) {
|
|
|
1325
1325
|
getTunaSpotPositionDecoder()
|
|
1326
1326
|
);
|
|
1327
1327
|
}
|
|
1328
|
-
async function fetchTunaSpotPosition(rpc,
|
|
1329
|
-
const maybeAccount = await fetchMaybeTunaSpotPosition(rpc,
|
|
1328
|
+
async function fetchTunaSpotPosition(rpc, address8, config) {
|
|
1329
|
+
const maybeAccount = await fetchMaybeTunaSpotPosition(rpc, address8, config);
|
|
1330
1330
|
(0, import_kit11.assertAccountExists)(maybeAccount);
|
|
1331
1331
|
return maybeAccount;
|
|
1332
1332
|
}
|
|
1333
|
-
async function fetchMaybeTunaSpotPosition(rpc,
|
|
1334
|
-
const maybeAccount = await (0, import_kit11.fetchEncodedAccount)(rpc,
|
|
1333
|
+
async function fetchMaybeTunaSpotPosition(rpc, address8, config) {
|
|
1334
|
+
const maybeAccount = await (0, import_kit11.fetchEncodedAccount)(rpc, address8, config);
|
|
1335
1335
|
return decodeTunaSpotPosition(maybeAccount);
|
|
1336
1336
|
}
|
|
1337
1337
|
async function fetchAllTunaSpotPosition(rpc, addresses, config) {
|
|
@@ -1420,13 +1420,13 @@ function decodeVault(encodedAccount) {
|
|
|
1420
1420
|
getVaultDecoder()
|
|
1421
1421
|
);
|
|
1422
1422
|
}
|
|
1423
|
-
async function fetchVault(rpc,
|
|
1424
|
-
const maybeAccount = await fetchMaybeVault(rpc,
|
|
1423
|
+
async function fetchVault(rpc, address8, config) {
|
|
1424
|
+
const maybeAccount = await fetchMaybeVault(rpc, address8, config);
|
|
1425
1425
|
(0, import_kit12.assertAccountExists)(maybeAccount);
|
|
1426
1426
|
return maybeAccount;
|
|
1427
1427
|
}
|
|
1428
|
-
async function fetchMaybeVault(rpc,
|
|
1429
|
-
const maybeAccount = await (0, import_kit12.fetchEncodedAccount)(rpc,
|
|
1428
|
+
async function fetchMaybeVault(rpc, address8, config) {
|
|
1429
|
+
const maybeAccount = await (0, import_kit12.fetchEncodedAccount)(rpc, address8, config);
|
|
1430
1430
|
return decodeVault(maybeAccount);
|
|
1431
1431
|
}
|
|
1432
1432
|
async function fetchAllVault(rpc, addresses, config) {
|
|
@@ -9672,47 +9672,47 @@ async function fetchDecodedProgramAccounts(rpc, programAddress, filters, decoder
|
|
|
9672
9672
|
}
|
|
9673
9673
|
|
|
9674
9674
|
// src/gpa/tunaLpPosition.ts
|
|
9675
|
-
function tunaLpPositionAuthorityFilter(
|
|
9675
|
+
function tunaLpPositionAuthorityFilter(address8) {
|
|
9676
9676
|
return {
|
|
9677
9677
|
memcmp: {
|
|
9678
9678
|
offset: 11n,
|
|
9679
|
-
bytes: (0, import_kit76.getBase58Decoder)().decode((0, import_kit76.getAddressEncoder)().encode(
|
|
9679
|
+
bytes: (0, import_kit76.getBase58Decoder)().decode((0, import_kit76.getAddressEncoder)().encode(address8)),
|
|
9680
9680
|
encoding: "base58"
|
|
9681
9681
|
}
|
|
9682
9682
|
};
|
|
9683
9683
|
}
|
|
9684
|
-
function tunaLpPositionPoolFilter(
|
|
9684
|
+
function tunaLpPositionPoolFilter(address8) {
|
|
9685
9685
|
return {
|
|
9686
9686
|
memcmp: {
|
|
9687
9687
|
offset: 43n,
|
|
9688
|
-
bytes: (0, import_kit76.getBase58Decoder)().decode((0, import_kit76.getAddressEncoder)().encode(
|
|
9688
|
+
bytes: (0, import_kit76.getBase58Decoder)().decode((0, import_kit76.getAddressEncoder)().encode(address8)),
|
|
9689
9689
|
encoding: "base58"
|
|
9690
9690
|
}
|
|
9691
9691
|
};
|
|
9692
9692
|
}
|
|
9693
|
-
function tunaLpPositionMintAFilter(
|
|
9693
|
+
function tunaLpPositionMintAFilter(address8) {
|
|
9694
9694
|
return {
|
|
9695
9695
|
memcmp: {
|
|
9696
9696
|
offset: 75n,
|
|
9697
|
-
bytes: (0, import_kit76.getBase58Decoder)().decode((0, import_kit76.getAddressEncoder)().encode(
|
|
9697
|
+
bytes: (0, import_kit76.getBase58Decoder)().decode((0, import_kit76.getAddressEncoder)().encode(address8)),
|
|
9698
9698
|
encoding: "base58"
|
|
9699
9699
|
}
|
|
9700
9700
|
};
|
|
9701
9701
|
}
|
|
9702
|
-
function tunaLpPositionMintBFilter(
|
|
9702
|
+
function tunaLpPositionMintBFilter(address8) {
|
|
9703
9703
|
return {
|
|
9704
9704
|
memcmp: {
|
|
9705
9705
|
offset: 107n,
|
|
9706
|
-
bytes: (0, import_kit76.getBase58Decoder)().decode((0, import_kit76.getAddressEncoder)().encode(
|
|
9706
|
+
bytes: (0, import_kit76.getBase58Decoder)().decode((0, import_kit76.getAddressEncoder)().encode(address8)),
|
|
9707
9707
|
encoding: "base58"
|
|
9708
9708
|
}
|
|
9709
9709
|
};
|
|
9710
9710
|
}
|
|
9711
|
-
function tunaLpPositionMintFilter(
|
|
9711
|
+
function tunaLpPositionMintFilter(address8) {
|
|
9712
9712
|
return {
|
|
9713
9713
|
memcmp: {
|
|
9714
9714
|
offset: 139n,
|
|
9715
|
-
bytes: (0, import_kit76.getBase58Decoder)().decode((0, import_kit76.getAddressEncoder)().encode(
|
|
9715
|
+
bytes: (0, import_kit76.getBase58Decoder)().decode((0, import_kit76.getAddressEncoder)().encode(address8)),
|
|
9716
9716
|
encoding: "base58"
|
|
9717
9717
|
}
|
|
9718
9718
|
};
|
|
@@ -9745,38 +9745,38 @@ async function fetchAllTunaLpPositionWithFilter(rpc, ...filters) {
|
|
|
9745
9745
|
|
|
9746
9746
|
// src/gpa/tunaSpotPosition.ts
|
|
9747
9747
|
var import_kit77 = require("@solana/kit");
|
|
9748
|
-
function tunaSpotPositionAuthorityFilter(
|
|
9748
|
+
function tunaSpotPositionAuthorityFilter(address8) {
|
|
9749
9749
|
return {
|
|
9750
9750
|
memcmp: {
|
|
9751
9751
|
offset: 11n,
|
|
9752
|
-
bytes: (0, import_kit77.getBase58Decoder)().decode((0, import_kit77.getAddressEncoder)().encode(
|
|
9752
|
+
bytes: (0, import_kit77.getBase58Decoder)().decode((0, import_kit77.getAddressEncoder)().encode(address8)),
|
|
9753
9753
|
encoding: "base58"
|
|
9754
9754
|
}
|
|
9755
9755
|
};
|
|
9756
9756
|
}
|
|
9757
|
-
function tunaSpotPositionPoolFilter(
|
|
9757
|
+
function tunaSpotPositionPoolFilter(address8) {
|
|
9758
9758
|
return {
|
|
9759
9759
|
memcmp: {
|
|
9760
9760
|
offset: 43n,
|
|
9761
|
-
bytes: (0, import_kit77.getBase58Decoder)().decode((0, import_kit77.getAddressEncoder)().encode(
|
|
9761
|
+
bytes: (0, import_kit77.getBase58Decoder)().decode((0, import_kit77.getAddressEncoder)().encode(address8)),
|
|
9762
9762
|
encoding: "base58"
|
|
9763
9763
|
}
|
|
9764
9764
|
};
|
|
9765
9765
|
}
|
|
9766
|
-
function tunaSpotPositionMintAFilter(
|
|
9766
|
+
function tunaSpotPositionMintAFilter(address8) {
|
|
9767
9767
|
return {
|
|
9768
9768
|
memcmp: {
|
|
9769
9769
|
offset: 75n,
|
|
9770
|
-
bytes: (0, import_kit77.getBase58Decoder)().decode((0, import_kit77.getAddressEncoder)().encode(
|
|
9770
|
+
bytes: (0, import_kit77.getBase58Decoder)().decode((0, import_kit77.getAddressEncoder)().encode(address8)),
|
|
9771
9771
|
encoding: "base58"
|
|
9772
9772
|
}
|
|
9773
9773
|
};
|
|
9774
9774
|
}
|
|
9775
|
-
function tunaSpotPositionMintBFilter(
|
|
9775
|
+
function tunaSpotPositionMintBFilter(address8) {
|
|
9776
9776
|
return {
|
|
9777
9777
|
memcmp: {
|
|
9778
9778
|
offset: 107n,
|
|
9779
|
-
bytes: (0, import_kit77.getBase58Decoder)().decode((0, import_kit77.getAddressEncoder)().encode(
|
|
9779
|
+
bytes: (0, import_kit77.getBase58Decoder)().decode((0, import_kit77.getAddressEncoder)().encode(address8)),
|
|
9780
9780
|
encoding: "base58"
|
|
9781
9781
|
}
|
|
9782
9782
|
};
|
|
@@ -9800,29 +9800,29 @@ async function fetchAllTunaSpotPositionWithFilter(rpc, ...filters) {
|
|
|
9800
9800
|
|
|
9801
9801
|
// src/gpa/lendingPosition.ts
|
|
9802
9802
|
var import_kit78 = require("@solana/kit");
|
|
9803
|
-
function lendingPositionAuthorityFilter(
|
|
9803
|
+
function lendingPositionAuthorityFilter(address8) {
|
|
9804
9804
|
return {
|
|
9805
9805
|
memcmp: {
|
|
9806
9806
|
offset: 11n,
|
|
9807
|
-
bytes: (0, import_kit78.getBase58Decoder)().decode((0, import_kit78.getAddressEncoder)().encode(
|
|
9807
|
+
bytes: (0, import_kit78.getBase58Decoder)().decode((0, import_kit78.getAddressEncoder)().encode(address8)),
|
|
9808
9808
|
encoding: "base58"
|
|
9809
9809
|
}
|
|
9810
9810
|
};
|
|
9811
9811
|
}
|
|
9812
|
-
function lendingPositionMintFilter(
|
|
9812
|
+
function lendingPositionMintFilter(address8) {
|
|
9813
9813
|
return {
|
|
9814
9814
|
memcmp: {
|
|
9815
9815
|
offset: 43n,
|
|
9816
|
-
bytes: (0, import_kit78.getBase58Decoder)().decode((0, import_kit78.getAddressEncoder)().encode(
|
|
9816
|
+
bytes: (0, import_kit78.getBase58Decoder)().decode((0, import_kit78.getAddressEncoder)().encode(address8)),
|
|
9817
9817
|
encoding: "base58"
|
|
9818
9818
|
}
|
|
9819
9819
|
};
|
|
9820
9820
|
}
|
|
9821
|
-
function lendingPositionVaultFilter(
|
|
9821
|
+
function lendingPositionVaultFilter(address8) {
|
|
9822
9822
|
return {
|
|
9823
9823
|
memcmp: {
|
|
9824
9824
|
offset: 91n,
|
|
9825
|
-
bytes: (0, import_kit78.getBase58Decoder)().decode((0, import_kit78.getAddressEncoder)().encode(
|
|
9825
|
+
bytes: (0, import_kit78.getBase58Decoder)().decode((0, import_kit78.getAddressEncoder)().encode(address8)),
|
|
9826
9826
|
encoding: "base58"
|
|
9827
9827
|
}
|
|
9828
9828
|
};
|
|
@@ -12974,6 +12974,7 @@ async function liquidateTunaSpotPositionOrcaInstruction(authority, tunaPosition,
|
|
|
12974
12974
|
|
|
12975
12975
|
// src/txbuilder/openTunaLpPositionOrca.ts
|
|
12976
12976
|
var import_whirlpools_client11 = require("@orca-so/whirlpools-client");
|
|
12977
|
+
var import_kit128 = require("@solana/kit");
|
|
12977
12978
|
var import_token_202224 = require("@solana-program/token-2022");
|
|
12978
12979
|
var import_assert15 = __toESM(require("assert"), 1);
|
|
12979
12980
|
async function openTunaLpPositionOrcaInstruction(rpc, authority, positionMint, whirlpoolAddress, args) {
|
|
@@ -13041,86 +13042,91 @@ async function openTunaLpPositionOrcaInstruction(rpc, authority, positionMint, w
|
|
|
13041
13042
|
...args
|
|
13042
13043
|
});
|
|
13043
13044
|
}
|
|
13044
|
-
function getOpenTunaLpPositionOrcaInstructionWithEphemeralSigner(input
|
|
13045
|
-
|
|
13046
|
-
const originalAccounts = {
|
|
13047
|
-
authority: { value: input.authority ?? null, isWritable: true },
|
|
13048
|
-
mintA: { value: input.mintA ?? null, isWritable: false },
|
|
13049
|
-
mintB: { value: input.mintB ?? null, isWritable: false },
|
|
13050
|
-
market: { value: input.market ?? null, isWritable: false },
|
|
13051
|
-
tunaPosition: { value: input.tunaPosition ?? null, isWritable: true },
|
|
13052
|
-
tunaPositionMint: {
|
|
13053
|
-
value: input.tunaPositionMint ?? null,
|
|
13054
|
-
isWritable: true
|
|
13055
|
-
},
|
|
13056
|
-
tunaPositionAta: { value: input.tunaPositionAta ?? null, isWritable: true },
|
|
13057
|
-
tunaPositionAtaA: {
|
|
13058
|
-
value: input.tunaPositionAtaA ?? null,
|
|
13059
|
-
isWritable: true
|
|
13060
|
-
},
|
|
13061
|
-
tunaPositionAtaB: {
|
|
13062
|
-
value: input.tunaPositionAtaB ?? null,
|
|
13063
|
-
isWritable: true
|
|
13064
|
-
},
|
|
13065
|
-
whirlpoolProgram: {
|
|
13066
|
-
value: input.whirlpoolProgram ?? null,
|
|
13067
|
-
isWritable: false
|
|
13068
|
-
},
|
|
13069
|
-
whirlpool: { value: input.whirlpool ?? null, isWritable: false },
|
|
13070
|
-
orcaPosition: { value: input.orcaPosition ?? null, isWritable: true },
|
|
13071
|
-
metadataUpdateAuth: {
|
|
13072
|
-
value: input.metadataUpdateAuth ?? null,
|
|
13073
|
-
isWritable: false
|
|
13074
|
-
},
|
|
13075
|
-
tokenProgramA: { value: input.tokenProgramA ?? null, isWritable: false },
|
|
13076
|
-
tokenProgramB: { value: input.tokenProgramB ?? null, isWritable: false },
|
|
13077
|
-
token2022Program: {
|
|
13078
|
-
value: input.token2022Program ?? null,
|
|
13079
|
-
isWritable: false
|
|
13080
|
-
},
|
|
13081
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
13082
|
-
associatedTokenProgram: {
|
|
13083
|
-
value: input.associatedTokenProgram ?? null,
|
|
13084
|
-
isWritable: false
|
|
13085
|
-
}
|
|
13086
|
-
};
|
|
13087
|
-
const accounts = originalAccounts;
|
|
13088
|
-
const args = { ...input };
|
|
13089
|
-
if (!accounts.systemProgram.value) {
|
|
13090
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
13091
|
-
}
|
|
13092
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
13093
|
-
const instruction = {
|
|
13045
|
+
function getOpenTunaLpPositionOrcaInstructionWithEphemeralSigner(input) {
|
|
13046
|
+
return {
|
|
13094
13047
|
accounts: [
|
|
13095
|
-
|
|
13096
|
-
|
|
13097
|
-
|
|
13098
|
-
|
|
13099
|
-
|
|
13100
|
-
|
|
13101
|
-
|
|
13102
|
-
|
|
13103
|
-
|
|
13104
|
-
|
|
13105
|
-
|
|
13106
|
-
|
|
13107
|
-
|
|
13108
|
-
|
|
13109
|
-
|
|
13110
|
-
|
|
13111
|
-
|
|
13112
|
-
|
|
13048
|
+
{
|
|
13049
|
+
address: input.authority.address,
|
|
13050
|
+
role: import_kit128.AccountRole.WRITABLE_SIGNER
|
|
13051
|
+
},
|
|
13052
|
+
{
|
|
13053
|
+
address: input.mintA,
|
|
13054
|
+
role: import_kit128.AccountRole.READONLY
|
|
13055
|
+
},
|
|
13056
|
+
{
|
|
13057
|
+
address: input.mintB,
|
|
13058
|
+
role: import_kit128.AccountRole.READONLY
|
|
13059
|
+
},
|
|
13060
|
+
{
|
|
13061
|
+
address: input.tokenProgramA,
|
|
13062
|
+
role: import_kit128.AccountRole.READONLY
|
|
13063
|
+
},
|
|
13064
|
+
{
|
|
13065
|
+
address: input.tokenProgramB,
|
|
13066
|
+
role: import_kit128.AccountRole.READONLY
|
|
13067
|
+
},
|
|
13068
|
+
{
|
|
13069
|
+
address: input.market,
|
|
13070
|
+
role: import_kit128.AccountRole.READONLY
|
|
13071
|
+
},
|
|
13072
|
+
{
|
|
13073
|
+
address: input.tunaPosition,
|
|
13074
|
+
role: import_kit128.AccountRole.WRITABLE
|
|
13075
|
+
},
|
|
13076
|
+
{
|
|
13077
|
+
address: input.tunaPositionMint,
|
|
13078
|
+
role: import_kit128.AccountRole.WRITABLE_SIGNER
|
|
13079
|
+
},
|
|
13080
|
+
{
|
|
13081
|
+
address: input.tunaPositionAta,
|
|
13082
|
+
role: import_kit128.AccountRole.WRITABLE
|
|
13083
|
+
},
|
|
13084
|
+
{
|
|
13085
|
+
address: input.tunaPositionAtaA,
|
|
13086
|
+
role: import_kit128.AccountRole.WRITABLE
|
|
13087
|
+
},
|
|
13088
|
+
{
|
|
13089
|
+
address: input.tunaPositionAtaB,
|
|
13090
|
+
role: import_kit128.AccountRole.WRITABLE
|
|
13091
|
+
},
|
|
13092
|
+
{
|
|
13093
|
+
address: input.whirlpoolProgram,
|
|
13094
|
+
role: import_kit128.AccountRole.READONLY
|
|
13095
|
+
},
|
|
13096
|
+
{
|
|
13097
|
+
address: input.whirlpool,
|
|
13098
|
+
role: import_kit128.AccountRole.READONLY
|
|
13099
|
+
},
|
|
13100
|
+
{
|
|
13101
|
+
address: input.orcaPosition,
|
|
13102
|
+
role: import_kit128.AccountRole.WRITABLE
|
|
13103
|
+
},
|
|
13104
|
+
{
|
|
13105
|
+
address: input.metadataUpdateAuth,
|
|
13106
|
+
role: import_kit128.AccountRole.READONLY
|
|
13107
|
+
},
|
|
13108
|
+
{
|
|
13109
|
+
address: input.token2022Program,
|
|
13110
|
+
role: import_kit128.AccountRole.READONLY
|
|
13111
|
+
},
|
|
13112
|
+
{
|
|
13113
|
+
address: input.systemProgram ?? (0, import_kit128.address)("11111111111111111111111111111111"),
|
|
13114
|
+
role: import_kit128.AccountRole.READONLY
|
|
13115
|
+
},
|
|
13116
|
+
{
|
|
13117
|
+
address: input.associatedTokenProgram,
|
|
13118
|
+
role: import_kit128.AccountRole.READONLY
|
|
13119
|
+
}
|
|
13113
13120
|
],
|
|
13114
|
-
programAddress,
|
|
13115
|
-
data: getOpenTunaLpPositionOrcaInstructionDataEncoder().encode(
|
|
13121
|
+
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
13122
|
+
data: getOpenTunaLpPositionOrcaInstructionDataEncoder().encode(input)
|
|
13116
13123
|
};
|
|
13117
|
-
return instruction;
|
|
13118
13124
|
}
|
|
13119
13125
|
|
|
13120
13126
|
// src/txbuilder/openTunaLpPositionFusion.ts
|
|
13121
13127
|
var import_fusionamm_client11 = require("@crypticdot/fusionamm-client");
|
|
13122
13128
|
var import_fusionamm_client12 = require("@crypticdot/fusionamm-client");
|
|
13123
|
-
var
|
|
13129
|
+
var import_kit129 = require("@solana/kit");
|
|
13124
13130
|
var import_token_202225 = require("@solana-program/token-2022");
|
|
13125
13131
|
var import_assert16 = __toESM(require("assert"), 1);
|
|
13126
13132
|
async function openTunaLpPositionFusionInstruction(rpc, authority, positionMint, fusionPoolAddress, args) {
|
|
@@ -13189,79 +13195,79 @@ async function openTunaLpPositionFusionInstruction(rpc, authority, positionMint,
|
|
|
13189
13195
|
});
|
|
13190
13196
|
}
|
|
13191
13197
|
function getOpenTunaLpPositionFusionInstructionWithEphemeralSigner(input) {
|
|
13192
|
-
|
|
13198
|
+
return {
|
|
13193
13199
|
accounts: [
|
|
13194
13200
|
{
|
|
13195
13201
|
address: input.authority.address,
|
|
13196
|
-
role:
|
|
13202
|
+
role: import_kit129.AccountRole.WRITABLE_SIGNER
|
|
13197
13203
|
},
|
|
13198
13204
|
{
|
|
13199
13205
|
address: input.mintA,
|
|
13200
|
-
role:
|
|
13206
|
+
role: import_kit129.AccountRole.READONLY
|
|
13201
13207
|
},
|
|
13202
13208
|
{
|
|
13203
13209
|
address: input.mintB,
|
|
13204
|
-
role:
|
|
13210
|
+
role: import_kit129.AccountRole.READONLY
|
|
13205
13211
|
},
|
|
13206
13212
|
{
|
|
13207
13213
|
address: input.tokenProgramA,
|
|
13208
|
-
role:
|
|
13214
|
+
role: import_kit129.AccountRole.READONLY
|
|
13209
13215
|
},
|
|
13210
13216
|
{
|
|
13211
13217
|
address: input.tokenProgramB,
|
|
13212
|
-
role:
|
|
13218
|
+
role: import_kit129.AccountRole.READONLY
|
|
13213
13219
|
},
|
|
13214
13220
|
{
|
|
13215
13221
|
address: input.market,
|
|
13216
|
-
role:
|
|
13222
|
+
role: import_kit129.AccountRole.READONLY
|
|
13217
13223
|
},
|
|
13218
13224
|
{
|
|
13219
13225
|
address: input.tunaPosition,
|
|
13220
|
-
role:
|
|
13226
|
+
role: import_kit129.AccountRole.WRITABLE
|
|
13221
13227
|
},
|
|
13222
13228
|
{
|
|
13223
13229
|
address: input.tunaPositionMint,
|
|
13224
|
-
role:
|
|
13230
|
+
role: import_kit129.AccountRole.WRITABLE_SIGNER
|
|
13225
13231
|
},
|
|
13226
13232
|
{
|
|
13227
13233
|
address: input.tunaPositionAta,
|
|
13228
|
-
role:
|
|
13234
|
+
role: import_kit129.AccountRole.WRITABLE
|
|
13229
13235
|
},
|
|
13230
13236
|
{
|
|
13231
13237
|
address: input.tunaPositionAtaA,
|
|
13232
|
-
role:
|
|
13238
|
+
role: import_kit129.AccountRole.WRITABLE
|
|
13233
13239
|
},
|
|
13234
13240
|
{
|
|
13235
13241
|
address: input.tunaPositionAtaB,
|
|
13236
|
-
role:
|
|
13242
|
+
role: import_kit129.AccountRole.WRITABLE
|
|
13237
13243
|
},
|
|
13238
13244
|
{
|
|
13239
13245
|
address: input.fusionammProgram,
|
|
13240
|
-
role:
|
|
13246
|
+
role: import_kit129.AccountRole.READONLY
|
|
13241
13247
|
},
|
|
13242
13248
|
{
|
|
13243
13249
|
address: input.fusionPool,
|
|
13244
|
-
role:
|
|
13250
|
+
role: import_kit129.AccountRole.READONLY
|
|
13245
13251
|
},
|
|
13246
13252
|
{
|
|
13247
13253
|
address: input.fusionPosition,
|
|
13248
|
-
role:
|
|
13254
|
+
role: import_kit129.AccountRole.WRITABLE
|
|
13249
13255
|
},
|
|
13250
13256
|
{
|
|
13251
13257
|
address: input.metadataUpdateAuth,
|
|
13252
|
-
role:
|
|
13258
|
+
role: import_kit129.AccountRole.READONLY
|
|
13253
13259
|
},
|
|
13254
13260
|
{
|
|
13255
13261
|
address: input.token2022Program,
|
|
13256
|
-
role:
|
|
13262
|
+
role: import_kit129.AccountRole.READONLY
|
|
13257
13263
|
},
|
|
13258
13264
|
{
|
|
13259
|
-
address: input.systemProgram ?? (0,
|
|
13260
|
-
role:
|
|
13265
|
+
address: input.systemProgram ?? (0, import_kit129.address)("11111111111111111111111111111111"),
|
|
13266
|
+
role: import_kit129.AccountRole.READONLY
|
|
13261
13267
|
},
|
|
13262
13268
|
{
|
|
13263
13269
|
address: input.associatedTokenProgram,
|
|
13264
|
-
role:
|
|
13270
|
+
role: import_kit129.AccountRole.READONLY
|
|
13265
13271
|
}
|
|
13266
13272
|
],
|
|
13267
13273
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
@@ -13269,13 +13275,12 @@ function getOpenTunaLpPositionFusionInstructionWithEphemeralSigner(input) {
|
|
|
13269
13275
|
input
|
|
13270
13276
|
)
|
|
13271
13277
|
};
|
|
13272
|
-
return instruction;
|
|
13273
13278
|
}
|
|
13274
13279
|
|
|
13275
13280
|
// src/txbuilder/openAndIncreaseTunaLpPositionOrca.ts
|
|
13276
13281
|
var import_whirlpools_client12 = require("@orca-so/whirlpools-client");
|
|
13277
13282
|
var import_whirlpools_core4 = require("@orca-so/whirlpools-core");
|
|
13278
|
-
var
|
|
13283
|
+
var import_kit130 = require("@solana/kit");
|
|
13279
13284
|
var import_sysvars = require("@solana/sysvars");
|
|
13280
13285
|
var import_memo16 = require("@solana-program/memo");
|
|
13281
13286
|
var import_token_202226 = require("@solana-program/token-2022");
|
|
@@ -13387,7 +13392,7 @@ async function openAndIncreaseTunaLpPositionOrcaInstructions(rpc, authority, pos
|
|
|
13387
13392
|
cleanupInstructions.push(...createUserAtaBInstructions.cleanup);
|
|
13388
13393
|
return {
|
|
13389
13394
|
instructions,
|
|
13390
|
-
initializationCost: (0,
|
|
13395
|
+
initializationCost: (0, import_kit130.lamports)(nonRefundableRent)
|
|
13391
13396
|
};
|
|
13392
13397
|
}
|
|
13393
13398
|
async function openAndIncreaseTunaLpPositionOrcaInstruction(authority, positionMint, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool, args) {
|
|
@@ -13445,16 +13450,16 @@ async function openAndIncreaseTunaLpPositionOrcaInstruction(authority, positionM
|
|
|
13445
13450
|
const lowerTickArrayAddress = await OrcaUtils.getTickArrayAddressFromTickIndex(whirlpool, args.tickLowerIndex);
|
|
13446
13451
|
const upperTickArrayAddress = await OrcaUtils.getTickArrayAddressFromTickIndex(whirlpool, args.tickUpperIndex);
|
|
13447
13452
|
const remainingAccounts = [
|
|
13448
|
-
{ address: swapTickArrays[0], role:
|
|
13449
|
-
{ address: swapTickArrays[1], role:
|
|
13450
|
-
{ address: swapTickArrays[2], role:
|
|
13451
|
-
{ address: swapTickArrays[3], role:
|
|
13452
|
-
{ address: swapTickArrays[4], role:
|
|
13453
|
-
{ address: lowerTickArrayAddress, role:
|
|
13454
|
-
{ address: upperTickArrayAddress, role:
|
|
13455
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
13456
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
13457
|
-
{ address: orcaOracleAddress, role:
|
|
13453
|
+
{ address: swapTickArrays[0], role: import_kit130.AccountRole.WRITABLE },
|
|
13454
|
+
{ address: swapTickArrays[1], role: import_kit130.AccountRole.WRITABLE },
|
|
13455
|
+
{ address: swapTickArrays[2], role: import_kit130.AccountRole.WRITABLE },
|
|
13456
|
+
{ address: swapTickArrays[3], role: import_kit130.AccountRole.WRITABLE },
|
|
13457
|
+
{ address: swapTickArrays[4], role: import_kit130.AccountRole.WRITABLE },
|
|
13458
|
+
{ address: lowerTickArrayAddress, role: import_kit130.AccountRole.WRITABLE },
|
|
13459
|
+
{ address: upperTickArrayAddress, role: import_kit130.AccountRole.WRITABLE },
|
|
13460
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit130.AccountRole.WRITABLE },
|
|
13461
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit130.AccountRole.WRITABLE },
|
|
13462
|
+
{ address: orcaOracleAddress, role: import_kit130.AccountRole.WRITABLE }
|
|
13458
13463
|
];
|
|
13459
13464
|
const remainingAccountsInfo = {
|
|
13460
13465
|
slices: [
|
|
@@ -13534,130 +13539,141 @@ async function openAndIncreaseTunaLpPositionOrcaInstruction(authority, positionM
|
|
|
13534
13539
|
ix.accounts.push(...remainingAccounts);
|
|
13535
13540
|
return ix;
|
|
13536
13541
|
}
|
|
13537
|
-
function getOpenAndIncreaseTunaLpPositionOrcaInstructionWithEphemeralSigner(input
|
|
13538
|
-
|
|
13539
|
-
const originalAccounts = {
|
|
13540
|
-
authority: { value: input.authority ?? null, isWritable: true },
|
|
13541
|
-
tunaConfig: { value: input.tunaConfig ?? null, isWritable: false },
|
|
13542
|
-
mintA: { value: input.mintA ?? null, isWritable: false },
|
|
13543
|
-
mintB: { value: input.mintB ?? null, isWritable: false },
|
|
13544
|
-
market: { value: input.market ?? null, isWritable: true },
|
|
13545
|
-
vaultA: { value: input.vaultA ?? null, isWritable: true },
|
|
13546
|
-
vaultB: { value: input.vaultB ?? null, isWritable: true },
|
|
13547
|
-
vaultAAta: { value: input.vaultAAta ?? null, isWritable: true },
|
|
13548
|
-
vaultBAta: { value: input.vaultBAta ?? null, isWritable: true },
|
|
13549
|
-
tunaPosition: { value: input.tunaPosition ?? null, isWritable: true },
|
|
13550
|
-
tunaPositionMint: {
|
|
13551
|
-
value: input.tunaPositionMint ?? null,
|
|
13552
|
-
isWritable: true
|
|
13553
|
-
},
|
|
13554
|
-
tunaPositionAta: { value: input.tunaPositionAta ?? null, isWritable: true },
|
|
13555
|
-
tunaPositionAtaA: {
|
|
13556
|
-
value: input.tunaPositionAtaA ?? null,
|
|
13557
|
-
isWritable: true
|
|
13558
|
-
},
|
|
13559
|
-
tunaPositionAtaB: {
|
|
13560
|
-
value: input.tunaPositionAtaB ?? null,
|
|
13561
|
-
isWritable: true
|
|
13562
|
-
},
|
|
13563
|
-
tunaPositionOwnerAtaA: {
|
|
13564
|
-
value: input.tunaPositionOwnerAtaA ?? null,
|
|
13565
|
-
isWritable: true
|
|
13566
|
-
},
|
|
13567
|
-
tunaPositionOwnerAtaB: {
|
|
13568
|
-
value: input.tunaPositionOwnerAtaB ?? null,
|
|
13569
|
-
isWritable: true
|
|
13570
|
-
},
|
|
13571
|
-
feeRecipientAtaA: {
|
|
13572
|
-
value: input.feeRecipientAtaA ?? null,
|
|
13573
|
-
isWritable: true
|
|
13574
|
-
},
|
|
13575
|
-
feeRecipientAtaB: {
|
|
13576
|
-
value: input.feeRecipientAtaB ?? null,
|
|
13577
|
-
isWritable: true
|
|
13578
|
-
},
|
|
13579
|
-
pythOraclePriceFeedA: {
|
|
13580
|
-
value: input.pythOraclePriceFeedA ?? null,
|
|
13581
|
-
isWritable: false
|
|
13582
|
-
},
|
|
13583
|
-
pythOraclePriceFeedB: {
|
|
13584
|
-
value: input.pythOraclePriceFeedB ?? null,
|
|
13585
|
-
isWritable: false
|
|
13586
|
-
},
|
|
13587
|
-
whirlpoolProgram: {
|
|
13588
|
-
value: input.whirlpoolProgram ?? null,
|
|
13589
|
-
isWritable: false
|
|
13590
|
-
},
|
|
13591
|
-
whirlpool: { value: input.whirlpool ?? null, isWritable: true },
|
|
13592
|
-
orcaPosition: { value: input.orcaPosition ?? null, isWritable: true },
|
|
13593
|
-
tokenProgramA: { value: input.tokenProgramA ?? null, isWritable: false },
|
|
13594
|
-
tokenProgramB: { value: input.tokenProgramB ?? null, isWritable: false },
|
|
13595
|
-
metadataUpdateAuth: {
|
|
13596
|
-
value: input.metadataUpdateAuth ?? null,
|
|
13597
|
-
isWritable: false
|
|
13598
|
-
},
|
|
13599
|
-
memoProgram: { value: input.memoProgram ?? null, isWritable: false },
|
|
13600
|
-
token2022Program: {
|
|
13601
|
-
value: input.token2022Program ?? null,
|
|
13602
|
-
isWritable: false
|
|
13603
|
-
},
|
|
13604
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
13605
|
-
associatedTokenProgram: {
|
|
13606
|
-
value: input.associatedTokenProgram ?? null,
|
|
13607
|
-
isWritable: false
|
|
13608
|
-
}
|
|
13609
|
-
};
|
|
13610
|
-
const accounts = originalAccounts;
|
|
13611
|
-
const args = { ...input };
|
|
13612
|
-
if (!accounts.systemProgram.value) {
|
|
13613
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
13614
|
-
}
|
|
13615
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
13616
|
-
const instruction = {
|
|
13542
|
+
function getOpenAndIncreaseTunaLpPositionOrcaInstructionWithEphemeralSigner(input) {
|
|
13543
|
+
return {
|
|
13617
13544
|
accounts: [
|
|
13618
|
-
|
|
13619
|
-
|
|
13620
|
-
|
|
13621
|
-
|
|
13622
|
-
|
|
13623
|
-
|
|
13624
|
-
|
|
13625
|
-
|
|
13626
|
-
|
|
13627
|
-
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
|
|
13632
|
-
|
|
13633
|
-
|
|
13634
|
-
|
|
13635
|
-
|
|
13636
|
-
|
|
13637
|
-
|
|
13638
|
-
|
|
13639
|
-
|
|
13640
|
-
|
|
13641
|
-
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
|
|
13646
|
-
|
|
13647
|
-
|
|
13545
|
+
{
|
|
13546
|
+
address: input.authority.address,
|
|
13547
|
+
role: import_kit130.AccountRole.WRITABLE_SIGNER
|
|
13548
|
+
},
|
|
13549
|
+
{
|
|
13550
|
+
address: input.tunaConfig,
|
|
13551
|
+
role: import_kit130.AccountRole.READONLY
|
|
13552
|
+
},
|
|
13553
|
+
{
|
|
13554
|
+
address: input.mintA,
|
|
13555
|
+
role: import_kit130.AccountRole.READONLY
|
|
13556
|
+
},
|
|
13557
|
+
{
|
|
13558
|
+
address: input.mintB,
|
|
13559
|
+
role: import_kit130.AccountRole.READONLY
|
|
13560
|
+
},
|
|
13561
|
+
{
|
|
13562
|
+
address: input.market,
|
|
13563
|
+
role: import_kit130.AccountRole.WRITABLE
|
|
13564
|
+
},
|
|
13565
|
+
{
|
|
13566
|
+
address: input.vaultA,
|
|
13567
|
+
role: import_kit130.AccountRole.WRITABLE
|
|
13568
|
+
},
|
|
13569
|
+
{
|
|
13570
|
+
address: input.vaultB,
|
|
13571
|
+
role: import_kit130.AccountRole.WRITABLE
|
|
13572
|
+
},
|
|
13573
|
+
{
|
|
13574
|
+
address: input.vaultAAta,
|
|
13575
|
+
role: import_kit130.AccountRole.WRITABLE
|
|
13576
|
+
},
|
|
13577
|
+
{
|
|
13578
|
+
address: input.vaultBAta,
|
|
13579
|
+
role: import_kit130.AccountRole.WRITABLE
|
|
13580
|
+
},
|
|
13581
|
+
{
|
|
13582
|
+
address: input.tunaPosition,
|
|
13583
|
+
role: import_kit130.AccountRole.WRITABLE
|
|
13584
|
+
},
|
|
13585
|
+
{
|
|
13586
|
+
address: input.tunaPositionMint,
|
|
13587
|
+
role: import_kit130.AccountRole.WRITABLE
|
|
13588
|
+
},
|
|
13589
|
+
{
|
|
13590
|
+
address: input.tunaPositionAta,
|
|
13591
|
+
role: import_kit130.AccountRole.WRITABLE
|
|
13592
|
+
},
|
|
13593
|
+
{
|
|
13594
|
+
address: input.tunaPositionAtaA,
|
|
13595
|
+
role: import_kit130.AccountRole.WRITABLE
|
|
13596
|
+
},
|
|
13597
|
+
{
|
|
13598
|
+
address: input.tunaPositionAtaB,
|
|
13599
|
+
role: import_kit130.AccountRole.WRITABLE
|
|
13600
|
+
},
|
|
13601
|
+
{
|
|
13602
|
+
address: input.tunaPositionOwnerAtaA,
|
|
13603
|
+
role: import_kit130.AccountRole.WRITABLE
|
|
13604
|
+
},
|
|
13605
|
+
{
|
|
13606
|
+
address: input.tunaPositionOwnerAtaB,
|
|
13607
|
+
role: import_kit130.AccountRole.WRITABLE
|
|
13608
|
+
},
|
|
13609
|
+
{
|
|
13610
|
+
address: input.feeRecipientAtaA,
|
|
13611
|
+
role: import_kit130.AccountRole.WRITABLE
|
|
13612
|
+
},
|
|
13613
|
+
{
|
|
13614
|
+
address: input.feeRecipientAtaB,
|
|
13615
|
+
role: import_kit130.AccountRole.WRITABLE
|
|
13616
|
+
},
|
|
13617
|
+
{
|
|
13618
|
+
address: input.pythOraclePriceFeedA,
|
|
13619
|
+
role: import_kit130.AccountRole.READONLY
|
|
13620
|
+
},
|
|
13621
|
+
{
|
|
13622
|
+
address: input.pythOraclePriceFeedB,
|
|
13623
|
+
role: import_kit130.AccountRole.READONLY
|
|
13624
|
+
},
|
|
13625
|
+
{
|
|
13626
|
+
address: input.whirlpoolProgram,
|
|
13627
|
+
role: import_kit130.AccountRole.READONLY
|
|
13628
|
+
},
|
|
13629
|
+
{
|
|
13630
|
+
address: input.whirlpool,
|
|
13631
|
+
role: import_kit130.AccountRole.WRITABLE
|
|
13632
|
+
},
|
|
13633
|
+
{
|
|
13634
|
+
address: input.orcaPosition,
|
|
13635
|
+
role: import_kit130.AccountRole.WRITABLE
|
|
13636
|
+
},
|
|
13637
|
+
{
|
|
13638
|
+
address: input.tokenProgramA,
|
|
13639
|
+
role: import_kit130.AccountRole.READONLY
|
|
13640
|
+
},
|
|
13641
|
+
{
|
|
13642
|
+
address: input.tokenProgramB,
|
|
13643
|
+
role: import_kit130.AccountRole.READONLY
|
|
13644
|
+
},
|
|
13645
|
+
{
|
|
13646
|
+
address: input.metadataUpdateAuth,
|
|
13647
|
+
role: import_kit130.AccountRole.READONLY
|
|
13648
|
+
},
|
|
13649
|
+
{
|
|
13650
|
+
address: input.memoProgram,
|
|
13651
|
+
role: import_kit130.AccountRole.READONLY
|
|
13652
|
+
},
|
|
13653
|
+
{
|
|
13654
|
+
address: input.token2022Program,
|
|
13655
|
+
role: import_kit130.AccountRole.READONLY
|
|
13656
|
+
},
|
|
13657
|
+
{
|
|
13658
|
+
address: input.systemProgram ?? (0, import_kit130.address)("11111111111111111111111111111111"),
|
|
13659
|
+
role: import_kit130.AccountRole.READONLY
|
|
13660
|
+
},
|
|
13661
|
+
{
|
|
13662
|
+
address: input.associatedTokenProgram,
|
|
13663
|
+
role: import_kit130.AccountRole.READONLY
|
|
13664
|
+
}
|
|
13648
13665
|
],
|
|
13649
|
-
programAddress,
|
|
13666
|
+
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
13650
13667
|
data: getOpenAndIncreaseTunaLpPositionOrcaInstructionDataEncoder().encode(
|
|
13651
|
-
|
|
13668
|
+
input
|
|
13652
13669
|
)
|
|
13653
13670
|
};
|
|
13654
|
-
return instruction;
|
|
13655
13671
|
}
|
|
13656
13672
|
|
|
13657
13673
|
// src/txbuilder/openAndIncreaseTunaLpPositionFusion.ts
|
|
13658
13674
|
var import_fusionamm_client13 = require("@crypticdot/fusionamm-client");
|
|
13659
13675
|
var import_fusionamm_core4 = require("@crypticdot/fusionamm-core");
|
|
13660
|
-
var
|
|
13676
|
+
var import_kit131 = require("@solana/kit");
|
|
13661
13677
|
var import_sysvars2 = require("@solana/sysvars");
|
|
13662
13678
|
var import_memo17 = require("@solana-program/memo");
|
|
13663
13679
|
var import_token_202227 = require("@solana-program/token-2022");
|
|
@@ -13756,7 +13772,7 @@ async function openAndIncreaseTunaLpPositionFusionInstructions(rpc, authority, p
|
|
|
13756
13772
|
cleanupInstructions.push(...createUserAtaBInstructions.cleanup);
|
|
13757
13773
|
return {
|
|
13758
13774
|
instructions,
|
|
13759
|
-
initializationCost: (0,
|
|
13775
|
+
initializationCost: (0, import_kit131.lamports)(nonRefundableRent)
|
|
13760
13776
|
};
|
|
13761
13777
|
}
|
|
13762
13778
|
async function openAndIncreaseTunaLpPositionFusionInstruction(authority, positionMint, tunaConfig, mintA, mintB, vaultA, vaultB, fusionPool, args) {
|
|
@@ -13813,15 +13829,15 @@ async function openAndIncreaseTunaLpPositionFusionInstruction(authority, positio
|
|
|
13813
13829
|
const lowerTickArrayAddress = await FusionUtils.getTickArrayAddressFromTickIndex(fusionPool, args.tickLowerIndex);
|
|
13814
13830
|
const upperTickArrayAddress = await FusionUtils.getTickArrayAddressFromTickIndex(fusionPool, args.tickUpperIndex);
|
|
13815
13831
|
const remainingAccounts = [
|
|
13816
|
-
{ address: swapTickArrays[0], role:
|
|
13817
|
-
{ address: swapTickArrays[1], role:
|
|
13818
|
-
{ address: swapTickArrays[2], role:
|
|
13819
|
-
{ address: swapTickArrays[3], role:
|
|
13820
|
-
{ address: swapTickArrays[4], role:
|
|
13821
|
-
{ address: lowerTickArrayAddress, role:
|
|
13822
|
-
{ address: upperTickArrayAddress, role:
|
|
13823
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
13824
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
13832
|
+
{ address: swapTickArrays[0], role: import_kit131.AccountRole.WRITABLE },
|
|
13833
|
+
{ address: swapTickArrays[1], role: import_kit131.AccountRole.WRITABLE },
|
|
13834
|
+
{ address: swapTickArrays[2], role: import_kit131.AccountRole.WRITABLE },
|
|
13835
|
+
{ address: swapTickArrays[3], role: import_kit131.AccountRole.WRITABLE },
|
|
13836
|
+
{ address: swapTickArrays[4], role: import_kit131.AccountRole.WRITABLE },
|
|
13837
|
+
{ address: lowerTickArrayAddress, role: import_kit131.AccountRole.WRITABLE },
|
|
13838
|
+
{ address: upperTickArrayAddress, role: import_kit131.AccountRole.WRITABLE },
|
|
13839
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit131.AccountRole.WRITABLE },
|
|
13840
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit131.AccountRole.WRITABLE }
|
|
13825
13841
|
];
|
|
13826
13842
|
const remainingAccountsInfo = {
|
|
13827
13843
|
slices: [
|
|
@@ -13900,140 +13916,151 @@ async function openAndIncreaseTunaLpPositionFusionInstruction(authority, positio
|
|
|
13900
13916
|
ix.accounts.push(...remainingAccounts);
|
|
13901
13917
|
return ix;
|
|
13902
13918
|
}
|
|
13903
|
-
function getOpenAndIncreaseTunaLpPositionFusionInstructionWithEphemeralSigner(input
|
|
13904
|
-
|
|
13905
|
-
const originalAccounts = {
|
|
13906
|
-
authority: { value: input.authority ?? null, isWritable: true },
|
|
13907
|
-
tunaConfig: { value: input.tunaConfig ?? null, isWritable: false },
|
|
13908
|
-
mintA: { value: input.mintA ?? null, isWritable: false },
|
|
13909
|
-
mintB: { value: input.mintB ?? null, isWritable: false },
|
|
13910
|
-
tokenProgramA: { value: input.tokenProgramA ?? null, isWritable: false },
|
|
13911
|
-
tokenProgramB: { value: input.tokenProgramB ?? null, isWritable: false },
|
|
13912
|
-
market: { value: input.market ?? null, isWritable: true },
|
|
13913
|
-
vaultA: { value: input.vaultA ?? null, isWritable: true },
|
|
13914
|
-
vaultB: { value: input.vaultB ?? null, isWritable: true },
|
|
13915
|
-
vaultAAta: { value: input.vaultAAta ?? null, isWritable: true },
|
|
13916
|
-
vaultBAta: { value: input.vaultBAta ?? null, isWritable: true },
|
|
13917
|
-
tunaPosition: { value: input.tunaPosition ?? null, isWritable: true },
|
|
13918
|
-
tunaPositionMint: {
|
|
13919
|
-
value: input.tunaPositionMint ?? null,
|
|
13920
|
-
isWritable: true
|
|
13921
|
-
},
|
|
13922
|
-
tunaPositionAta: { value: input.tunaPositionAta ?? null, isWritable: true },
|
|
13923
|
-
tunaPositionAtaA: {
|
|
13924
|
-
value: input.tunaPositionAtaA ?? null,
|
|
13925
|
-
isWritable: true
|
|
13926
|
-
},
|
|
13927
|
-
tunaPositionAtaB: {
|
|
13928
|
-
value: input.tunaPositionAtaB ?? null,
|
|
13929
|
-
isWritable: true
|
|
13930
|
-
},
|
|
13931
|
-
tunaPositionOwnerAtaA: {
|
|
13932
|
-
value: input.tunaPositionOwnerAtaA ?? null,
|
|
13933
|
-
isWritable: true
|
|
13934
|
-
},
|
|
13935
|
-
tunaPositionOwnerAtaB: {
|
|
13936
|
-
value: input.tunaPositionOwnerAtaB ?? null,
|
|
13937
|
-
isWritable: true
|
|
13938
|
-
},
|
|
13939
|
-
feeRecipientAtaA: {
|
|
13940
|
-
value: input.feeRecipientAtaA ?? null,
|
|
13941
|
-
isWritable: true
|
|
13942
|
-
},
|
|
13943
|
-
feeRecipientAtaB: {
|
|
13944
|
-
value: input.feeRecipientAtaB ?? null,
|
|
13945
|
-
isWritable: true
|
|
13946
|
-
},
|
|
13947
|
-
pythOraclePriceFeedA: {
|
|
13948
|
-
value: input.pythOraclePriceFeedA ?? null,
|
|
13949
|
-
isWritable: false
|
|
13950
|
-
},
|
|
13951
|
-
pythOraclePriceFeedB: {
|
|
13952
|
-
value: input.pythOraclePriceFeedB ?? null,
|
|
13953
|
-
isWritable: false
|
|
13954
|
-
},
|
|
13955
|
-
fusionammProgram: {
|
|
13956
|
-
value: input.fusionammProgram ?? null,
|
|
13957
|
-
isWritable: false
|
|
13958
|
-
},
|
|
13959
|
-
fusionPool: { value: input.fusionPool ?? null, isWritable: true },
|
|
13960
|
-
fusionPosition: { value: input.fusionPosition ?? null, isWritable: true },
|
|
13961
|
-
metadataUpdateAuth: {
|
|
13962
|
-
value: input.metadataUpdateAuth ?? null,
|
|
13963
|
-
isWritable: false
|
|
13964
|
-
},
|
|
13965
|
-
memoProgram: { value: input.memoProgram ?? null, isWritable: false },
|
|
13966
|
-
token2022Program: {
|
|
13967
|
-
value: input.token2022Program ?? null,
|
|
13968
|
-
isWritable: false
|
|
13969
|
-
},
|
|
13970
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
13971
|
-
associatedTokenProgram: {
|
|
13972
|
-
value: input.associatedTokenProgram ?? null,
|
|
13973
|
-
isWritable: false
|
|
13974
|
-
}
|
|
13975
|
-
};
|
|
13976
|
-
const accounts = originalAccounts;
|
|
13977
|
-
const args = { ...input };
|
|
13978
|
-
if (!accounts.systemProgram.value) {
|
|
13979
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
13980
|
-
}
|
|
13981
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
13982
|
-
const instruction = {
|
|
13919
|
+
function getOpenAndIncreaseTunaLpPositionFusionInstructionWithEphemeralSigner(input) {
|
|
13920
|
+
return {
|
|
13983
13921
|
accounts: [
|
|
13984
|
-
|
|
13985
|
-
|
|
13986
|
-
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
|
|
13992
|
-
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
14007
|
-
|
|
14008
|
-
|
|
14009
|
-
|
|
14010
|
-
|
|
14011
|
-
|
|
14012
|
-
|
|
14013
|
-
|
|
13922
|
+
{
|
|
13923
|
+
address: input.authority.address,
|
|
13924
|
+
role: import_kit131.AccountRole.WRITABLE_SIGNER
|
|
13925
|
+
},
|
|
13926
|
+
{
|
|
13927
|
+
address: input.tunaConfig,
|
|
13928
|
+
role: import_kit131.AccountRole.READONLY
|
|
13929
|
+
},
|
|
13930
|
+
{
|
|
13931
|
+
address: input.mintA,
|
|
13932
|
+
role: import_kit131.AccountRole.READONLY
|
|
13933
|
+
},
|
|
13934
|
+
{
|
|
13935
|
+
address: input.mintB,
|
|
13936
|
+
role: import_kit131.AccountRole.READONLY
|
|
13937
|
+
},
|
|
13938
|
+
{
|
|
13939
|
+
address: input.tokenProgramA,
|
|
13940
|
+
role: import_kit131.AccountRole.READONLY
|
|
13941
|
+
},
|
|
13942
|
+
{
|
|
13943
|
+
address: input.tokenProgramB,
|
|
13944
|
+
role: import_kit131.AccountRole.READONLY
|
|
13945
|
+
},
|
|
13946
|
+
{
|
|
13947
|
+
address: input.market,
|
|
13948
|
+
role: import_kit131.AccountRole.WRITABLE
|
|
13949
|
+
},
|
|
13950
|
+
{
|
|
13951
|
+
address: input.vaultA,
|
|
13952
|
+
role: import_kit131.AccountRole.WRITABLE
|
|
13953
|
+
},
|
|
13954
|
+
{
|
|
13955
|
+
address: input.vaultB,
|
|
13956
|
+
role: import_kit131.AccountRole.WRITABLE
|
|
13957
|
+
},
|
|
13958
|
+
{
|
|
13959
|
+
address: input.vaultAAta,
|
|
13960
|
+
role: import_kit131.AccountRole.WRITABLE
|
|
13961
|
+
},
|
|
13962
|
+
{
|
|
13963
|
+
address: input.vaultBAta,
|
|
13964
|
+
role: import_kit131.AccountRole.WRITABLE
|
|
13965
|
+
},
|
|
13966
|
+
{
|
|
13967
|
+
address: input.tunaPosition,
|
|
13968
|
+
role: import_kit131.AccountRole.WRITABLE
|
|
13969
|
+
},
|
|
13970
|
+
{
|
|
13971
|
+
address: input.tunaPositionMint,
|
|
13972
|
+
role: import_kit131.AccountRole.WRITABLE
|
|
13973
|
+
},
|
|
13974
|
+
{
|
|
13975
|
+
address: input.tunaPositionAta,
|
|
13976
|
+
role: import_kit131.AccountRole.WRITABLE
|
|
13977
|
+
},
|
|
13978
|
+
{
|
|
13979
|
+
address: input.tunaPositionAtaA,
|
|
13980
|
+
role: import_kit131.AccountRole.WRITABLE
|
|
13981
|
+
},
|
|
13982
|
+
{
|
|
13983
|
+
address: input.tunaPositionAtaB,
|
|
13984
|
+
role: import_kit131.AccountRole.WRITABLE
|
|
13985
|
+
},
|
|
13986
|
+
{
|
|
13987
|
+
address: input.tunaPositionOwnerAtaA,
|
|
13988
|
+
role: import_kit131.AccountRole.WRITABLE
|
|
13989
|
+
},
|
|
13990
|
+
{
|
|
13991
|
+
address: input.tunaPositionOwnerAtaB,
|
|
13992
|
+
role: import_kit131.AccountRole.WRITABLE
|
|
13993
|
+
},
|
|
13994
|
+
{
|
|
13995
|
+
address: input.feeRecipientAtaA,
|
|
13996
|
+
role: import_kit131.AccountRole.WRITABLE
|
|
13997
|
+
},
|
|
13998
|
+
{
|
|
13999
|
+
address: input.feeRecipientAtaB,
|
|
14000
|
+
role: import_kit131.AccountRole.WRITABLE
|
|
14001
|
+
},
|
|
14002
|
+
{
|
|
14003
|
+
address: input.pythOraclePriceFeedA,
|
|
14004
|
+
role: import_kit131.AccountRole.READONLY
|
|
14005
|
+
},
|
|
14006
|
+
{
|
|
14007
|
+
address: input.pythOraclePriceFeedB,
|
|
14008
|
+
role: import_kit131.AccountRole.READONLY
|
|
14009
|
+
},
|
|
14010
|
+
{
|
|
14011
|
+
address: input.fusionammProgram,
|
|
14012
|
+
role: import_kit131.AccountRole.READONLY
|
|
14013
|
+
},
|
|
14014
|
+
{
|
|
14015
|
+
address: input.fusionPool,
|
|
14016
|
+
role: import_kit131.AccountRole.WRITABLE
|
|
14017
|
+
},
|
|
14018
|
+
{
|
|
14019
|
+
address: input.fusionPosition,
|
|
14020
|
+
role: import_kit131.AccountRole.WRITABLE
|
|
14021
|
+
},
|
|
14022
|
+
{
|
|
14023
|
+
address: input.metadataUpdateAuth,
|
|
14024
|
+
role: import_kit131.AccountRole.READONLY
|
|
14025
|
+
},
|
|
14026
|
+
{
|
|
14027
|
+
address: input.memoProgram,
|
|
14028
|
+
role: import_kit131.AccountRole.READONLY
|
|
14029
|
+
},
|
|
14030
|
+
{
|
|
14031
|
+
address: input.token2022Program,
|
|
14032
|
+
role: import_kit131.AccountRole.READONLY
|
|
14033
|
+
},
|
|
14034
|
+
{
|
|
14035
|
+
address: input.systemProgram ?? (0, import_kit131.address)("11111111111111111111111111111111"),
|
|
14036
|
+
role: import_kit131.AccountRole.READONLY
|
|
14037
|
+
},
|
|
14038
|
+
{
|
|
14039
|
+
address: input.associatedTokenProgram,
|
|
14040
|
+
role: import_kit131.AccountRole.READONLY
|
|
14041
|
+
}
|
|
14014
14042
|
],
|
|
14015
|
-
programAddress,
|
|
14043
|
+
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
14016
14044
|
data: getOpenAndIncreaseTunaLpPositionFusionInstructionDataEncoder().encode(
|
|
14017
|
-
|
|
14045
|
+
input
|
|
14018
14046
|
)
|
|
14019
14047
|
};
|
|
14020
|
-
return instruction;
|
|
14021
14048
|
}
|
|
14022
14049
|
|
|
14023
14050
|
// src/txbuilder/openTunaSpotPosition.ts
|
|
14024
14051
|
var import_fusionamm_client14 = require("@crypticdot/fusionamm-client");
|
|
14025
14052
|
var import_whirlpools_client13 = require("@orca-so/whirlpools-client");
|
|
14026
|
-
var
|
|
14053
|
+
var import_kit132 = require("@solana/kit");
|
|
14027
14054
|
var import_token_202228 = require("@solana-program/token-2022");
|
|
14028
14055
|
var import_assert19 = __toESM(require("assert"), 1);
|
|
14029
14056
|
async function openTunaSpotPositionInstructions(rpc, authority, poolAddress, args) {
|
|
14030
|
-
const poolAccount = await (0,
|
|
14057
|
+
const poolAccount = await (0, import_kit132.fetchEncodedAccount)(rpc, poolAddress);
|
|
14031
14058
|
(0, import_assert19.default)(poolAccount.exists, "Pool account not found");
|
|
14032
14059
|
let pool;
|
|
14033
14060
|
if (poolAccount.programAddress == import_fusionamm_client14.FUSIONAMM_PROGRAM_ADDRESS) {
|
|
14034
|
-
pool = (0,
|
|
14061
|
+
pool = (0, import_kit132.decodeAccount)(poolAccount, (0, import_fusionamm_client14.getFusionPoolDecoder)());
|
|
14035
14062
|
} else if (poolAccount.programAddress == import_whirlpools_client13.WHIRLPOOL_PROGRAM_ADDRESS) {
|
|
14036
|
-
pool = (0,
|
|
14063
|
+
pool = (0, import_kit132.decodeAccount)(poolAccount, (0, import_whirlpools_client13.getWhirlpoolDecoder)());
|
|
14037
14064
|
} else {
|
|
14038
14065
|
throw new Error("Incorrect Fusion or Orca pool account");
|
|
14039
14066
|
}
|
|
@@ -14073,7 +14100,7 @@ async function openTunaSpotPositionInstruction(authority, mintA, mintB, poolAddr
|
|
|
14073
14100
|
// src/txbuilder/decreaseTunaLpPositionOrca.ts
|
|
14074
14101
|
var import_whirlpools_client14 = require("@orca-so/whirlpools-client");
|
|
14075
14102
|
var import_whirlpools_core5 = require("@orca-so/whirlpools-core");
|
|
14076
|
-
var
|
|
14103
|
+
var import_kit133 = require("@solana/kit");
|
|
14077
14104
|
var import_memo18 = require("@solana-program/memo");
|
|
14078
14105
|
var import_token_202229 = require("@solana-program/token-2022");
|
|
14079
14106
|
var import_assert20 = __toESM(require("assert"), 1);
|
|
@@ -14095,7 +14122,7 @@ async function decreaseTunaLpPositionOrcaInstructions(rpc, authority, positionMi
|
|
|
14095
14122
|
const allMints = [mintA, mintB, ...rewardMints];
|
|
14096
14123
|
(0, import_assert20.default)(mintA.exists, "Token A account not found");
|
|
14097
14124
|
(0, import_assert20.default)(mintB.exists, "Token B account not found");
|
|
14098
|
-
(0,
|
|
14125
|
+
(0, import_kit133.assertAccountsExist)(rewardMints);
|
|
14099
14126
|
const lowerTickArrayStartIndex = (0, import_whirlpools_core5.getTickArrayStartTickIndex)(
|
|
14100
14127
|
tunaPosition.data.tickLowerIndex,
|
|
14101
14128
|
whirlpool.data.tickSpacing
|
|
@@ -14207,16 +14234,16 @@ async function decreaseTunaLpPositionOrcaInstruction(authority, tunaPosition, mi
|
|
|
14207
14234
|
tunaPosition.data.tickUpperIndex
|
|
14208
14235
|
);
|
|
14209
14236
|
const remainingAccounts = [
|
|
14210
|
-
{ address: swapTickArrays[0], role:
|
|
14211
|
-
{ address: swapTickArrays[1], role:
|
|
14212
|
-
{ address: swapTickArrays[2], role:
|
|
14213
|
-
{ address: swapTickArrays[3], role:
|
|
14214
|
-
{ address: swapTickArrays[4], role:
|
|
14215
|
-
{ address: lowerTickArrayAddress, role:
|
|
14216
|
-
{ address: upperTickArrayAddress, role:
|
|
14217
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
14218
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
14219
|
-
{ address: orcaOracleAddress, role:
|
|
14237
|
+
{ address: swapTickArrays[0], role: import_kit133.AccountRole.WRITABLE },
|
|
14238
|
+
{ address: swapTickArrays[1], role: import_kit133.AccountRole.WRITABLE },
|
|
14239
|
+
{ address: swapTickArrays[2], role: import_kit133.AccountRole.WRITABLE },
|
|
14240
|
+
{ address: swapTickArrays[3], role: import_kit133.AccountRole.WRITABLE },
|
|
14241
|
+
{ address: swapTickArrays[4], role: import_kit133.AccountRole.WRITABLE },
|
|
14242
|
+
{ address: lowerTickArrayAddress, role: import_kit133.AccountRole.WRITABLE },
|
|
14243
|
+
{ address: upperTickArrayAddress, role: import_kit133.AccountRole.WRITABLE },
|
|
14244
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit133.AccountRole.WRITABLE },
|
|
14245
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit133.AccountRole.WRITABLE },
|
|
14246
|
+
{ address: orcaOracleAddress, role: import_kit133.AccountRole.WRITABLE }
|
|
14220
14247
|
];
|
|
14221
14248
|
for (const rewardIndex of rewardIndicesToClaim) {
|
|
14222
14249
|
const rewardInfo = whirlpool.data.rewardInfos[rewardIndex];
|
|
@@ -14227,10 +14254,10 @@ async function decreaseTunaLpPositionOrcaInstruction(authority, tunaPosition, mi
|
|
|
14227
14254
|
mint: rewardMint.address,
|
|
14228
14255
|
tokenProgram: rewardMint.programAddress
|
|
14229
14256
|
});
|
|
14230
|
-
remainingAccounts.push({ address: rewardMint.address, role:
|
|
14231
|
-
remainingAccounts.push({ address: rewardMint.programAddress, role:
|
|
14232
|
-
remainingAccounts.push({ address: ownerAta[0], role:
|
|
14233
|
-
remainingAccounts.push({ address: rewardInfo.vault, role:
|
|
14257
|
+
remainingAccounts.push({ address: rewardMint.address, role: import_kit133.AccountRole.READONLY });
|
|
14258
|
+
remainingAccounts.push({ address: rewardMint.programAddress, role: import_kit133.AccountRole.READONLY });
|
|
14259
|
+
remainingAccounts.push({ address: ownerAta[0], role: import_kit133.AccountRole.WRITABLE });
|
|
14260
|
+
remainingAccounts.push({ address: rewardInfo.vault, role: import_kit133.AccountRole.WRITABLE });
|
|
14234
14261
|
}
|
|
14235
14262
|
const remainingAccountsInfo = {
|
|
14236
14263
|
slices: [
|
|
@@ -14278,7 +14305,7 @@ async function decreaseTunaLpPositionOrcaInstruction(authority, tunaPosition, mi
|
|
|
14278
14305
|
|
|
14279
14306
|
// src/txbuilder/decreaseTunaLpPositionFusion.ts
|
|
14280
14307
|
var import_fusionamm_client15 = require("@crypticdot/fusionamm-client");
|
|
14281
|
-
var
|
|
14308
|
+
var import_kit134 = require("@solana/kit");
|
|
14282
14309
|
var import_memo19 = require("@solana-program/memo");
|
|
14283
14310
|
var import_token_202230 = require("@solana-program/token-2022");
|
|
14284
14311
|
var import_assert21 = __toESM(require("assert"), 1);
|
|
@@ -14378,15 +14405,15 @@ async function decreaseTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
14378
14405
|
tunaPosition.data.tickUpperIndex
|
|
14379
14406
|
);
|
|
14380
14407
|
const remainingAccounts = [
|
|
14381
|
-
{ address: swapTickArrays[0], role:
|
|
14382
|
-
{ address: swapTickArrays[1], role:
|
|
14383
|
-
{ address: swapTickArrays[2], role:
|
|
14384
|
-
{ address: swapTickArrays[3], role:
|
|
14385
|
-
{ address: swapTickArrays[4], role:
|
|
14386
|
-
{ address: lowerTickArrayAddress, role:
|
|
14387
|
-
{ address: upperTickArrayAddress, role:
|
|
14388
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
14389
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
14408
|
+
{ address: swapTickArrays[0], role: import_kit134.AccountRole.WRITABLE },
|
|
14409
|
+
{ address: swapTickArrays[1], role: import_kit134.AccountRole.WRITABLE },
|
|
14410
|
+
{ address: swapTickArrays[2], role: import_kit134.AccountRole.WRITABLE },
|
|
14411
|
+
{ address: swapTickArrays[3], role: import_kit134.AccountRole.WRITABLE },
|
|
14412
|
+
{ address: swapTickArrays[4], role: import_kit134.AccountRole.WRITABLE },
|
|
14413
|
+
{ address: lowerTickArrayAddress, role: import_kit134.AccountRole.WRITABLE },
|
|
14414
|
+
{ address: upperTickArrayAddress, role: import_kit134.AccountRole.WRITABLE },
|
|
14415
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit134.AccountRole.WRITABLE },
|
|
14416
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit134.AccountRole.WRITABLE }
|
|
14390
14417
|
];
|
|
14391
14418
|
const remainingAccountsInfo = {
|
|
14392
14419
|
slices: [
|
|
@@ -14598,7 +14625,7 @@ async function withdrawInstruction(authority, mint, vault, funds, shares) {
|
|
|
14598
14625
|
// src/txbuilder/createMarketLookupTable.ts
|
|
14599
14626
|
var import_fusionamm_client16 = require("@crypticdot/fusionamm-client");
|
|
14600
14627
|
var import_whirlpools_client15 = require("@orca-so/whirlpools-client");
|
|
14601
|
-
var
|
|
14628
|
+
var import_kit135 = require("@solana/kit");
|
|
14602
14629
|
var import_address_lookup_table2 = require("@solana-program/address-lookup-table");
|
|
14603
14630
|
var import_memo22 = require("@solana-program/memo");
|
|
14604
14631
|
var import_system2 = require("@solana-program/system");
|
|
@@ -14638,7 +14665,7 @@ async function getAddressesForMarketLookupTable(rpc, poolAddress, marketMaker) {
|
|
|
14638
14665
|
}))[0];
|
|
14639
14666
|
const addresses = [
|
|
14640
14667
|
import_system2.SYSTEM_PROGRAM_ADDRESS,
|
|
14641
|
-
(0,
|
|
14668
|
+
(0, import_kit135.address)("SysvarRent111111111111111111111111111111111"),
|
|
14642
14669
|
import_token_202234.ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
14643
14670
|
import_token2.TOKEN_PROGRAM_ADDRESS,
|
|
14644
14671
|
import_token_202234.TOKEN_2022_PROGRAM_ADDRESS,
|
|
@@ -14798,7 +14825,7 @@ async function repayTunaLpPositionDebtInstruction(authority, positionMint, mintA
|
|
|
14798
14825
|
|
|
14799
14826
|
// src/txbuilder/rebalanceTunaLpPositionOrca.ts
|
|
14800
14827
|
var import_whirlpools_client16 = require("@orca-so/whirlpools-client");
|
|
14801
|
-
var
|
|
14828
|
+
var import_kit136 = require("@solana/kit");
|
|
14802
14829
|
var import_sysvars3 = require("@solana/sysvars");
|
|
14803
14830
|
var import_memo24 = require("@solana-program/memo");
|
|
14804
14831
|
var import_token_202236 = require("@solana-program/token-2022");
|
|
@@ -14881,7 +14908,7 @@ async function rebalanceTunaLpPositionOrcaInstructions(rpc, authority, positionM
|
|
|
14881
14908
|
cleanupInstructions.push(...internalCleanupInstructions);
|
|
14882
14909
|
return {
|
|
14883
14910
|
instructions,
|
|
14884
|
-
initializationCost: (0,
|
|
14911
|
+
initializationCost: (0, import_kit136.lamports)(nonRefundableRent)
|
|
14885
14912
|
};
|
|
14886
14913
|
}
|
|
14887
14914
|
async function rebalanceTunaLpPositionOrcaInstruction(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool) {
|
|
@@ -14925,18 +14952,18 @@ async function rebalanceTunaLpPositionOrcaInstruction(authority, tunaPosition, t
|
|
|
14925
14952
|
);
|
|
14926
14953
|
const secondaryTickArrays = await OrcaUtils.getTickArraysForRebalancedPosition(whirlpool, tunaPosition);
|
|
14927
14954
|
const remainingAccounts = [
|
|
14928
|
-
{ address: swapTickArrays[0], role:
|
|
14929
|
-
{ address: swapTickArrays[1], role:
|
|
14930
|
-
{ address: swapTickArrays[2], role:
|
|
14931
|
-
{ address: swapTickArrays[3], role:
|
|
14932
|
-
{ address: swapTickArrays[4], role:
|
|
14933
|
-
{ address: lowerTickArrayAddress, role:
|
|
14934
|
-
{ address: upperTickArrayAddress, role:
|
|
14935
|
-
{ address: secondaryTickArrays.lowerTickArrayAddress, role:
|
|
14936
|
-
{ address: secondaryTickArrays.upperTickArrayAddress, role:
|
|
14937
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
14938
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
14939
|
-
{ address: orcaOracleAddress, role:
|
|
14955
|
+
{ address: swapTickArrays[0], role: import_kit136.AccountRole.WRITABLE },
|
|
14956
|
+
{ address: swapTickArrays[1], role: import_kit136.AccountRole.WRITABLE },
|
|
14957
|
+
{ address: swapTickArrays[2], role: import_kit136.AccountRole.WRITABLE },
|
|
14958
|
+
{ address: swapTickArrays[3], role: import_kit136.AccountRole.WRITABLE },
|
|
14959
|
+
{ address: swapTickArrays[4], role: import_kit136.AccountRole.WRITABLE },
|
|
14960
|
+
{ address: lowerTickArrayAddress, role: import_kit136.AccountRole.WRITABLE },
|
|
14961
|
+
{ address: upperTickArrayAddress, role: import_kit136.AccountRole.WRITABLE },
|
|
14962
|
+
{ address: secondaryTickArrays.lowerTickArrayAddress, role: import_kit136.AccountRole.WRITABLE },
|
|
14963
|
+
{ address: secondaryTickArrays.upperTickArrayAddress, role: import_kit136.AccountRole.WRITABLE },
|
|
14964
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit136.AccountRole.WRITABLE },
|
|
14965
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit136.AccountRole.WRITABLE },
|
|
14966
|
+
{ address: orcaOracleAddress, role: import_kit136.AccountRole.WRITABLE }
|
|
14940
14967
|
];
|
|
14941
14968
|
const remainingAccountsInfo = {
|
|
14942
14969
|
slices: [
|
|
@@ -14980,7 +15007,7 @@ async function rebalanceTunaLpPositionOrcaInstruction(authority, tunaPosition, t
|
|
|
14980
15007
|
|
|
14981
15008
|
// src/txbuilder/rebalanceTunaLpPositionFusion.ts
|
|
14982
15009
|
var import_fusionamm_client17 = require("@crypticdot/fusionamm-client");
|
|
14983
|
-
var
|
|
15010
|
+
var import_kit137 = require("@solana/kit");
|
|
14984
15011
|
var import_sysvars4 = require("@solana/sysvars");
|
|
14985
15012
|
var import_memo25 = require("@solana-program/memo");
|
|
14986
15013
|
var import_token_202237 = require("@solana-program/token-2022");
|
|
@@ -15059,7 +15086,7 @@ async function rebalanceTunaLpPositionFusionInstructions(rpc, authority, positio
|
|
|
15059
15086
|
instructions.push(ix);
|
|
15060
15087
|
return {
|
|
15061
15088
|
instructions,
|
|
15062
|
-
initializationCost: (0,
|
|
15089
|
+
initializationCost: (0, import_kit137.lamports)(nonRefundableRent)
|
|
15063
15090
|
};
|
|
15064
15091
|
}
|
|
15065
15092
|
async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, fusionPool) {
|
|
@@ -15102,17 +15129,17 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
15102
15129
|
);
|
|
15103
15130
|
const secondaryTickArrays = await FusionUtils.getTickArraysForRebalancedPosition(fusionPool, tunaPosition);
|
|
15104
15131
|
const remainingAccounts = [
|
|
15105
|
-
{ address: swapTickArrays[0], role:
|
|
15106
|
-
{ address: swapTickArrays[1], role:
|
|
15107
|
-
{ address: swapTickArrays[2], role:
|
|
15108
|
-
{ address: swapTickArrays[3], role:
|
|
15109
|
-
{ address: swapTickArrays[4], role:
|
|
15110
|
-
{ address: lowerTickArrayAddress, role:
|
|
15111
|
-
{ address: upperTickArrayAddress, role:
|
|
15112
|
-
{ address: secondaryTickArrays.lowerTickArrayAddress, role:
|
|
15113
|
-
{ address: secondaryTickArrays.upperTickArrayAddress, role:
|
|
15114
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
15115
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
15132
|
+
{ address: swapTickArrays[0], role: import_kit137.AccountRole.WRITABLE },
|
|
15133
|
+
{ address: swapTickArrays[1], role: import_kit137.AccountRole.WRITABLE },
|
|
15134
|
+
{ address: swapTickArrays[2], role: import_kit137.AccountRole.WRITABLE },
|
|
15135
|
+
{ address: swapTickArrays[3], role: import_kit137.AccountRole.WRITABLE },
|
|
15136
|
+
{ address: swapTickArrays[4], role: import_kit137.AccountRole.WRITABLE },
|
|
15137
|
+
{ address: lowerTickArrayAddress, role: import_kit137.AccountRole.WRITABLE },
|
|
15138
|
+
{ address: upperTickArrayAddress, role: import_kit137.AccountRole.WRITABLE },
|
|
15139
|
+
{ address: secondaryTickArrays.lowerTickArrayAddress, role: import_kit137.AccountRole.WRITABLE },
|
|
15140
|
+
{ address: secondaryTickArrays.upperTickArrayAddress, role: import_kit137.AccountRole.WRITABLE },
|
|
15141
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit137.AccountRole.WRITABLE },
|
|
15142
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit137.AccountRole.WRITABLE }
|
|
15116
15143
|
];
|
|
15117
15144
|
const remainingAccountsInfo = {
|
|
15118
15145
|
slices: [
|