@crypticdot/defituna-client 3.5.4 → 3.5.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.cjs +537 -503
- package/dist/index.d.cts +4 -12
- package/dist/index.d.ts +4 -12
- package/dist/index.js +535 -493
- 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,85 +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");
|
|
13129
|
+
var import_kit129 = require("@solana/kit");
|
|
13123
13130
|
var import_token_202225 = require("@solana-program/token-2022");
|
|
13124
13131
|
var import_assert16 = __toESM(require("assert"), 1);
|
|
13125
13132
|
async function openTunaLpPositionFusionInstruction(rpc, authority, positionMint, fusionPoolAddress, args) {
|
|
@@ -13187,88 +13194,93 @@ async function openTunaLpPositionFusionInstruction(rpc, authority, positionMint,
|
|
|
13187
13194
|
...args
|
|
13188
13195
|
});
|
|
13189
13196
|
}
|
|
13190
|
-
function getOpenTunaLpPositionFusionInstructionWithEphemeralSigner(input
|
|
13191
|
-
|
|
13192
|
-
const originalAccounts = {
|
|
13193
|
-
authority: { value: input.authority ?? null, isWritable: true },
|
|
13194
|
-
mintA: { value: input.mintA ?? null, isWritable: false },
|
|
13195
|
-
mintB: { value: input.mintB ?? null, isWritable: false },
|
|
13196
|
-
tokenProgramA: { value: input.tokenProgramA ?? null, isWritable: false },
|
|
13197
|
-
tokenProgramB: { value: input.tokenProgramB ?? null, isWritable: false },
|
|
13198
|
-
market: { value: input.market ?? null, isWritable: false },
|
|
13199
|
-
tunaPosition: { value: input.tunaPosition ?? null, isWritable: true },
|
|
13200
|
-
tunaPositionMint: {
|
|
13201
|
-
value: input.tunaPositionMint ?? null,
|
|
13202
|
-
isWritable: true
|
|
13203
|
-
},
|
|
13204
|
-
tunaPositionAta: { value: input.tunaPositionAta ?? null, isWritable: true },
|
|
13205
|
-
tunaPositionAtaA: {
|
|
13206
|
-
value: input.tunaPositionAtaA ?? null,
|
|
13207
|
-
isWritable: true
|
|
13208
|
-
},
|
|
13209
|
-
tunaPositionAtaB: {
|
|
13210
|
-
value: input.tunaPositionAtaB ?? null,
|
|
13211
|
-
isWritable: true
|
|
13212
|
-
},
|
|
13213
|
-
fusionammProgram: {
|
|
13214
|
-
value: input.fusionammProgram ?? null,
|
|
13215
|
-
isWritable: false
|
|
13216
|
-
},
|
|
13217
|
-
fusionPool: { value: input.fusionPool ?? null, isWritable: false },
|
|
13218
|
-
fusionPosition: { value: input.fusionPosition ?? null, isWritable: true },
|
|
13219
|
-
metadataUpdateAuth: {
|
|
13220
|
-
value: input.metadataUpdateAuth ?? null,
|
|
13221
|
-
isWritable: false
|
|
13222
|
-
},
|
|
13223
|
-
token2022Program: {
|
|
13224
|
-
value: input.token2022Program ?? null,
|
|
13225
|
-
isWritable: false
|
|
13226
|
-
},
|
|
13227
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
13228
|
-
associatedTokenProgram: {
|
|
13229
|
-
value: input.associatedTokenProgram ?? null,
|
|
13230
|
-
isWritable: false
|
|
13231
|
-
}
|
|
13232
|
-
};
|
|
13233
|
-
const accounts = originalAccounts;
|
|
13234
|
-
const args = { ...input };
|
|
13235
|
-
if (!accounts.systemProgram.value) {
|
|
13236
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
13237
|
-
}
|
|
13238
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
13239
|
-
const instruction = {
|
|
13197
|
+
function getOpenTunaLpPositionFusionInstructionWithEphemeralSigner(input) {
|
|
13198
|
+
return {
|
|
13240
13199
|
accounts: [
|
|
13241
|
-
|
|
13242
|
-
|
|
13243
|
-
|
|
13244
|
-
|
|
13245
|
-
|
|
13246
|
-
|
|
13247
|
-
|
|
13248
|
-
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
|
|
13252
|
-
|
|
13253
|
-
|
|
13254
|
-
|
|
13255
|
-
|
|
13256
|
-
|
|
13257
|
-
|
|
13258
|
-
|
|
13200
|
+
{
|
|
13201
|
+
address: input.authority.address,
|
|
13202
|
+
role: import_kit129.AccountRole.WRITABLE_SIGNER
|
|
13203
|
+
},
|
|
13204
|
+
{
|
|
13205
|
+
address: input.mintA,
|
|
13206
|
+
role: import_kit129.AccountRole.READONLY
|
|
13207
|
+
},
|
|
13208
|
+
{
|
|
13209
|
+
address: input.mintB,
|
|
13210
|
+
role: import_kit129.AccountRole.READONLY
|
|
13211
|
+
},
|
|
13212
|
+
{
|
|
13213
|
+
address: input.tokenProgramA,
|
|
13214
|
+
role: import_kit129.AccountRole.READONLY
|
|
13215
|
+
},
|
|
13216
|
+
{
|
|
13217
|
+
address: input.tokenProgramB,
|
|
13218
|
+
role: import_kit129.AccountRole.READONLY
|
|
13219
|
+
},
|
|
13220
|
+
{
|
|
13221
|
+
address: input.market,
|
|
13222
|
+
role: import_kit129.AccountRole.READONLY
|
|
13223
|
+
},
|
|
13224
|
+
{
|
|
13225
|
+
address: input.tunaPosition,
|
|
13226
|
+
role: import_kit129.AccountRole.WRITABLE
|
|
13227
|
+
},
|
|
13228
|
+
{
|
|
13229
|
+
address: input.tunaPositionMint,
|
|
13230
|
+
role: import_kit129.AccountRole.WRITABLE_SIGNER
|
|
13231
|
+
},
|
|
13232
|
+
{
|
|
13233
|
+
address: input.tunaPositionAta,
|
|
13234
|
+
role: import_kit129.AccountRole.WRITABLE
|
|
13235
|
+
},
|
|
13236
|
+
{
|
|
13237
|
+
address: input.tunaPositionAtaA,
|
|
13238
|
+
role: import_kit129.AccountRole.WRITABLE
|
|
13239
|
+
},
|
|
13240
|
+
{
|
|
13241
|
+
address: input.tunaPositionAtaB,
|
|
13242
|
+
role: import_kit129.AccountRole.WRITABLE
|
|
13243
|
+
},
|
|
13244
|
+
{
|
|
13245
|
+
address: input.fusionammProgram,
|
|
13246
|
+
role: import_kit129.AccountRole.READONLY
|
|
13247
|
+
},
|
|
13248
|
+
{
|
|
13249
|
+
address: input.fusionPool,
|
|
13250
|
+
role: import_kit129.AccountRole.READONLY
|
|
13251
|
+
},
|
|
13252
|
+
{
|
|
13253
|
+
address: input.fusionPosition,
|
|
13254
|
+
role: import_kit129.AccountRole.WRITABLE
|
|
13255
|
+
},
|
|
13256
|
+
{
|
|
13257
|
+
address: input.metadataUpdateAuth,
|
|
13258
|
+
role: import_kit129.AccountRole.READONLY
|
|
13259
|
+
},
|
|
13260
|
+
{
|
|
13261
|
+
address: input.token2022Program,
|
|
13262
|
+
role: import_kit129.AccountRole.READONLY
|
|
13263
|
+
},
|
|
13264
|
+
{
|
|
13265
|
+
address: input.systemProgram ?? (0, import_kit129.address)("11111111111111111111111111111111"),
|
|
13266
|
+
role: import_kit129.AccountRole.READONLY
|
|
13267
|
+
},
|
|
13268
|
+
{
|
|
13269
|
+
address: input.associatedTokenProgram,
|
|
13270
|
+
role: import_kit129.AccountRole.READONLY
|
|
13271
|
+
}
|
|
13259
13272
|
],
|
|
13260
|
-
programAddress,
|
|
13273
|
+
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
13261
13274
|
data: getOpenTunaLpPositionFusionInstructionDataEncoder().encode(
|
|
13262
|
-
|
|
13275
|
+
input
|
|
13263
13276
|
)
|
|
13264
13277
|
};
|
|
13265
|
-
return instruction;
|
|
13266
13278
|
}
|
|
13267
13279
|
|
|
13268
13280
|
// src/txbuilder/openAndIncreaseTunaLpPositionOrca.ts
|
|
13269
13281
|
var import_whirlpools_client12 = require("@orca-so/whirlpools-client");
|
|
13270
13282
|
var import_whirlpools_core4 = require("@orca-so/whirlpools-core");
|
|
13271
|
-
var
|
|
13283
|
+
var import_kit130 = require("@solana/kit");
|
|
13272
13284
|
var import_sysvars = require("@solana/sysvars");
|
|
13273
13285
|
var import_memo16 = require("@solana-program/memo");
|
|
13274
13286
|
var import_token_202226 = require("@solana-program/token-2022");
|
|
@@ -13380,7 +13392,7 @@ async function openAndIncreaseTunaLpPositionOrcaInstructions(rpc, authority, pos
|
|
|
13380
13392
|
cleanupInstructions.push(...createUserAtaBInstructions.cleanup);
|
|
13381
13393
|
return {
|
|
13382
13394
|
instructions,
|
|
13383
|
-
initializationCost: (0,
|
|
13395
|
+
initializationCost: (0, import_kit130.lamports)(nonRefundableRent)
|
|
13384
13396
|
};
|
|
13385
13397
|
}
|
|
13386
13398
|
async function openAndIncreaseTunaLpPositionOrcaInstruction(authority, positionMint, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool, args) {
|
|
@@ -13438,16 +13450,16 @@ async function openAndIncreaseTunaLpPositionOrcaInstruction(authority, positionM
|
|
|
13438
13450
|
const lowerTickArrayAddress = await OrcaUtils.getTickArrayAddressFromTickIndex(whirlpool, args.tickLowerIndex);
|
|
13439
13451
|
const upperTickArrayAddress = await OrcaUtils.getTickArrayAddressFromTickIndex(whirlpool, args.tickUpperIndex);
|
|
13440
13452
|
const remainingAccounts = [
|
|
13441
|
-
{ address: swapTickArrays[0], role:
|
|
13442
|
-
{ address: swapTickArrays[1], role:
|
|
13443
|
-
{ address: swapTickArrays[2], role:
|
|
13444
|
-
{ address: swapTickArrays[3], role:
|
|
13445
|
-
{ address: swapTickArrays[4], role:
|
|
13446
|
-
{ address: lowerTickArrayAddress, role:
|
|
13447
|
-
{ address: upperTickArrayAddress, role:
|
|
13448
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
13449
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
13450
|
-
{ 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 }
|
|
13451
13463
|
];
|
|
13452
13464
|
const remainingAccountsInfo = {
|
|
13453
13465
|
slices: [
|
|
@@ -13522,135 +13534,146 @@ async function openAndIncreaseTunaLpPositionOrcaInstruction(authority, positionM
|
|
|
13522
13534
|
associatedTokenProgram: import_token_202226.ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
13523
13535
|
token2022Program: import_token_202226.TOKEN_2022_PROGRAM_ADDRESS,
|
|
13524
13536
|
...args,
|
|
13525
|
-
remainingAccountsInfo
|
|
13526
|
-
});
|
|
13527
|
-
ix.accounts.push(...remainingAccounts);
|
|
13528
|
-
return ix;
|
|
13529
|
-
}
|
|
13530
|
-
function getOpenAndIncreaseTunaLpPositionOrcaInstructionWithEphemeralSigner(input
|
|
13531
|
-
|
|
13532
|
-
const originalAccounts = {
|
|
13533
|
-
authority: { value: input.authority ?? null, isWritable: true },
|
|
13534
|
-
tunaConfig: { value: input.tunaConfig ?? null, isWritable: false },
|
|
13535
|
-
mintA: { value: input.mintA ?? null, isWritable: false },
|
|
13536
|
-
mintB: { value: input.mintB ?? null, isWritable: false },
|
|
13537
|
-
market: { value: input.market ?? null, isWritable: true },
|
|
13538
|
-
vaultA: { value: input.vaultA ?? null, isWritable: true },
|
|
13539
|
-
vaultB: { value: input.vaultB ?? null, isWritable: true },
|
|
13540
|
-
vaultAAta: { value: input.vaultAAta ?? null, isWritable: true },
|
|
13541
|
-
vaultBAta: { value: input.vaultBAta ?? null, isWritable: true },
|
|
13542
|
-
tunaPosition: { value: input.tunaPosition ?? null, isWritable: true },
|
|
13543
|
-
tunaPositionMint: {
|
|
13544
|
-
value: input.tunaPositionMint ?? null,
|
|
13545
|
-
isWritable: true
|
|
13546
|
-
},
|
|
13547
|
-
tunaPositionAta: { value: input.tunaPositionAta ?? null, isWritable: true },
|
|
13548
|
-
tunaPositionAtaA: {
|
|
13549
|
-
value: input.tunaPositionAtaA ?? null,
|
|
13550
|
-
isWritable: true
|
|
13551
|
-
},
|
|
13552
|
-
tunaPositionAtaB: {
|
|
13553
|
-
value: input.tunaPositionAtaB ?? null,
|
|
13554
|
-
isWritable: true
|
|
13555
|
-
},
|
|
13556
|
-
tunaPositionOwnerAtaA: {
|
|
13557
|
-
value: input.tunaPositionOwnerAtaA ?? null,
|
|
13558
|
-
isWritable: true
|
|
13559
|
-
},
|
|
13560
|
-
tunaPositionOwnerAtaB: {
|
|
13561
|
-
value: input.tunaPositionOwnerAtaB ?? null,
|
|
13562
|
-
isWritable: true
|
|
13563
|
-
},
|
|
13564
|
-
feeRecipientAtaA: {
|
|
13565
|
-
value: input.feeRecipientAtaA ?? null,
|
|
13566
|
-
isWritable: true
|
|
13567
|
-
},
|
|
13568
|
-
feeRecipientAtaB: {
|
|
13569
|
-
value: input.feeRecipientAtaB ?? null,
|
|
13570
|
-
isWritable: true
|
|
13571
|
-
},
|
|
13572
|
-
pythOraclePriceFeedA: {
|
|
13573
|
-
value: input.pythOraclePriceFeedA ?? null,
|
|
13574
|
-
isWritable: false
|
|
13575
|
-
},
|
|
13576
|
-
pythOraclePriceFeedB: {
|
|
13577
|
-
value: input.pythOraclePriceFeedB ?? null,
|
|
13578
|
-
isWritable: false
|
|
13579
|
-
},
|
|
13580
|
-
whirlpoolProgram: {
|
|
13581
|
-
value: input.whirlpoolProgram ?? null,
|
|
13582
|
-
isWritable: false
|
|
13583
|
-
},
|
|
13584
|
-
whirlpool: { value: input.whirlpool ?? null, isWritable: true },
|
|
13585
|
-
orcaPosition: { value: input.orcaPosition ?? null, isWritable: true },
|
|
13586
|
-
tokenProgramA: { value: input.tokenProgramA ?? null, isWritable: false },
|
|
13587
|
-
tokenProgramB: { value: input.tokenProgramB ?? null, isWritable: false },
|
|
13588
|
-
metadataUpdateAuth: {
|
|
13589
|
-
value: input.metadataUpdateAuth ?? null,
|
|
13590
|
-
isWritable: false
|
|
13591
|
-
},
|
|
13592
|
-
memoProgram: { value: input.memoProgram ?? null, isWritable: false },
|
|
13593
|
-
token2022Program: {
|
|
13594
|
-
value: input.token2022Program ?? null,
|
|
13595
|
-
isWritable: false
|
|
13596
|
-
},
|
|
13597
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
13598
|
-
associatedTokenProgram: {
|
|
13599
|
-
value: input.associatedTokenProgram ?? null,
|
|
13600
|
-
isWritable: false
|
|
13601
|
-
}
|
|
13602
|
-
};
|
|
13603
|
-
const accounts = originalAccounts;
|
|
13604
|
-
const args = { ...input };
|
|
13605
|
-
if (!accounts.systemProgram.value) {
|
|
13606
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
13607
|
-
}
|
|
13608
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
13609
|
-
const instruction = {
|
|
13537
|
+
remainingAccountsInfo
|
|
13538
|
+
});
|
|
13539
|
+
ix.accounts.push(...remainingAccounts);
|
|
13540
|
+
return ix;
|
|
13541
|
+
}
|
|
13542
|
+
function getOpenAndIncreaseTunaLpPositionOrcaInstructionWithEphemeralSigner(input) {
|
|
13543
|
+
return {
|
|
13610
13544
|
accounts: [
|
|
13611
|
-
|
|
13612
|
-
|
|
13613
|
-
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
13620
|
-
|
|
13621
|
-
|
|
13622
|
-
|
|
13623
|
-
|
|
13624
|
-
|
|
13625
|
-
|
|
13626
|
-
|
|
13627
|
-
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
|
|
13632
|
-
|
|
13633
|
-
|
|
13634
|
-
|
|
13635
|
-
|
|
13636
|
-
|
|
13637
|
-
|
|
13638
|
-
|
|
13639
|
-
|
|
13640
|
-
|
|
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
|
+
}
|
|
13641
13665
|
],
|
|
13642
|
-
programAddress,
|
|
13666
|
+
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
13643
13667
|
data: getOpenAndIncreaseTunaLpPositionOrcaInstructionDataEncoder().encode(
|
|
13644
|
-
|
|
13668
|
+
input
|
|
13645
13669
|
)
|
|
13646
13670
|
};
|
|
13647
|
-
return instruction;
|
|
13648
13671
|
}
|
|
13649
13672
|
|
|
13650
13673
|
// src/txbuilder/openAndIncreaseTunaLpPositionFusion.ts
|
|
13651
13674
|
var import_fusionamm_client13 = require("@crypticdot/fusionamm-client");
|
|
13652
13675
|
var import_fusionamm_core4 = require("@crypticdot/fusionamm-core");
|
|
13653
|
-
var
|
|
13676
|
+
var import_kit131 = require("@solana/kit");
|
|
13654
13677
|
var import_sysvars2 = require("@solana/sysvars");
|
|
13655
13678
|
var import_memo17 = require("@solana-program/memo");
|
|
13656
13679
|
var import_token_202227 = require("@solana-program/token-2022");
|
|
@@ -13749,7 +13772,7 @@ async function openAndIncreaseTunaLpPositionFusionInstructions(rpc, authority, p
|
|
|
13749
13772
|
cleanupInstructions.push(...createUserAtaBInstructions.cleanup);
|
|
13750
13773
|
return {
|
|
13751
13774
|
instructions,
|
|
13752
|
-
initializationCost: (0,
|
|
13775
|
+
initializationCost: (0, import_kit131.lamports)(nonRefundableRent)
|
|
13753
13776
|
};
|
|
13754
13777
|
}
|
|
13755
13778
|
async function openAndIncreaseTunaLpPositionFusionInstruction(authority, positionMint, tunaConfig, mintA, mintB, vaultA, vaultB, fusionPool, args) {
|
|
@@ -13806,15 +13829,15 @@ async function openAndIncreaseTunaLpPositionFusionInstruction(authority, positio
|
|
|
13806
13829
|
const lowerTickArrayAddress = await FusionUtils.getTickArrayAddressFromTickIndex(fusionPool, args.tickLowerIndex);
|
|
13807
13830
|
const upperTickArrayAddress = await FusionUtils.getTickArrayAddressFromTickIndex(fusionPool, args.tickUpperIndex);
|
|
13808
13831
|
const remainingAccounts = [
|
|
13809
|
-
{ address: swapTickArrays[0], role:
|
|
13810
|
-
{ address: swapTickArrays[1], role:
|
|
13811
|
-
{ address: swapTickArrays[2], role:
|
|
13812
|
-
{ address: swapTickArrays[3], role:
|
|
13813
|
-
{ address: swapTickArrays[4], role:
|
|
13814
|
-
{ address: lowerTickArrayAddress, role:
|
|
13815
|
-
{ address: upperTickArrayAddress, role:
|
|
13816
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
13817
|
-
{ 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 }
|
|
13818
13841
|
];
|
|
13819
13842
|
const remainingAccountsInfo = {
|
|
13820
13843
|
slices: [
|
|
@@ -13893,140 +13916,151 @@ async function openAndIncreaseTunaLpPositionFusionInstruction(authority, positio
|
|
|
13893
13916
|
ix.accounts.push(...remainingAccounts);
|
|
13894
13917
|
return ix;
|
|
13895
13918
|
}
|
|
13896
|
-
function getOpenAndIncreaseTunaLpPositionFusionInstructionWithEphemeralSigner(input
|
|
13897
|
-
|
|
13898
|
-
const originalAccounts = {
|
|
13899
|
-
authority: { value: input.authority ?? null, isWritable: true },
|
|
13900
|
-
tunaConfig: { value: input.tunaConfig ?? null, isWritable: false },
|
|
13901
|
-
mintA: { value: input.mintA ?? null, isWritable: false },
|
|
13902
|
-
mintB: { value: input.mintB ?? null, isWritable: false },
|
|
13903
|
-
tokenProgramA: { value: input.tokenProgramA ?? null, isWritable: false },
|
|
13904
|
-
tokenProgramB: { value: input.tokenProgramB ?? null, isWritable: false },
|
|
13905
|
-
market: { value: input.market ?? null, isWritable: true },
|
|
13906
|
-
vaultA: { value: input.vaultA ?? null, isWritable: true },
|
|
13907
|
-
vaultB: { value: input.vaultB ?? null, isWritable: true },
|
|
13908
|
-
vaultAAta: { value: input.vaultAAta ?? null, isWritable: true },
|
|
13909
|
-
vaultBAta: { value: input.vaultBAta ?? null, isWritable: true },
|
|
13910
|
-
tunaPosition: { value: input.tunaPosition ?? null, isWritable: true },
|
|
13911
|
-
tunaPositionMint: {
|
|
13912
|
-
value: input.tunaPositionMint ?? null,
|
|
13913
|
-
isWritable: true
|
|
13914
|
-
},
|
|
13915
|
-
tunaPositionAta: { value: input.tunaPositionAta ?? null, isWritable: true },
|
|
13916
|
-
tunaPositionAtaA: {
|
|
13917
|
-
value: input.tunaPositionAtaA ?? null,
|
|
13918
|
-
isWritable: true
|
|
13919
|
-
},
|
|
13920
|
-
tunaPositionAtaB: {
|
|
13921
|
-
value: input.tunaPositionAtaB ?? null,
|
|
13922
|
-
isWritable: true
|
|
13923
|
-
},
|
|
13924
|
-
tunaPositionOwnerAtaA: {
|
|
13925
|
-
value: input.tunaPositionOwnerAtaA ?? null,
|
|
13926
|
-
isWritable: true
|
|
13927
|
-
},
|
|
13928
|
-
tunaPositionOwnerAtaB: {
|
|
13929
|
-
value: input.tunaPositionOwnerAtaB ?? null,
|
|
13930
|
-
isWritable: true
|
|
13931
|
-
},
|
|
13932
|
-
feeRecipientAtaA: {
|
|
13933
|
-
value: input.feeRecipientAtaA ?? null,
|
|
13934
|
-
isWritable: true
|
|
13935
|
-
},
|
|
13936
|
-
feeRecipientAtaB: {
|
|
13937
|
-
value: input.feeRecipientAtaB ?? null,
|
|
13938
|
-
isWritable: true
|
|
13939
|
-
},
|
|
13940
|
-
pythOraclePriceFeedA: {
|
|
13941
|
-
value: input.pythOraclePriceFeedA ?? null,
|
|
13942
|
-
isWritable: false
|
|
13943
|
-
},
|
|
13944
|
-
pythOraclePriceFeedB: {
|
|
13945
|
-
value: input.pythOraclePriceFeedB ?? null,
|
|
13946
|
-
isWritable: false
|
|
13947
|
-
},
|
|
13948
|
-
fusionammProgram: {
|
|
13949
|
-
value: input.fusionammProgram ?? null,
|
|
13950
|
-
isWritable: false
|
|
13951
|
-
},
|
|
13952
|
-
fusionPool: { value: input.fusionPool ?? null, isWritable: true },
|
|
13953
|
-
fusionPosition: { value: input.fusionPosition ?? null, isWritable: true },
|
|
13954
|
-
metadataUpdateAuth: {
|
|
13955
|
-
value: input.metadataUpdateAuth ?? null,
|
|
13956
|
-
isWritable: false
|
|
13957
|
-
},
|
|
13958
|
-
memoProgram: { value: input.memoProgram ?? null, isWritable: false },
|
|
13959
|
-
token2022Program: {
|
|
13960
|
-
value: input.token2022Program ?? null,
|
|
13961
|
-
isWritable: false
|
|
13962
|
-
},
|
|
13963
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
13964
|
-
associatedTokenProgram: {
|
|
13965
|
-
value: input.associatedTokenProgram ?? null,
|
|
13966
|
-
isWritable: false
|
|
13967
|
-
}
|
|
13968
|
-
};
|
|
13969
|
-
const accounts = originalAccounts;
|
|
13970
|
-
const args = { ...input };
|
|
13971
|
-
if (!accounts.systemProgram.value) {
|
|
13972
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
13973
|
-
}
|
|
13974
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
13975
|
-
const instruction = {
|
|
13919
|
+
function getOpenAndIncreaseTunaLpPositionFusionInstructionWithEphemeralSigner(input) {
|
|
13920
|
+
return {
|
|
13976
13921
|
accounts: [
|
|
13977
|
-
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
|
|
13981
|
-
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13985
|
-
|
|
13986
|
-
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
|
|
13992
|
-
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
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
|
+
}
|
|
14007
14042
|
],
|
|
14008
|
-
programAddress,
|
|
14043
|
+
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
14009
14044
|
data: getOpenAndIncreaseTunaLpPositionFusionInstructionDataEncoder().encode(
|
|
14010
|
-
|
|
14045
|
+
input
|
|
14011
14046
|
)
|
|
14012
14047
|
};
|
|
14013
|
-
return instruction;
|
|
14014
14048
|
}
|
|
14015
14049
|
|
|
14016
14050
|
// src/txbuilder/openTunaSpotPosition.ts
|
|
14017
14051
|
var import_fusionamm_client14 = require("@crypticdot/fusionamm-client");
|
|
14018
14052
|
var import_whirlpools_client13 = require("@orca-so/whirlpools-client");
|
|
14019
|
-
var
|
|
14053
|
+
var import_kit132 = require("@solana/kit");
|
|
14020
14054
|
var import_token_202228 = require("@solana-program/token-2022");
|
|
14021
14055
|
var import_assert19 = __toESM(require("assert"), 1);
|
|
14022
14056
|
async function openTunaSpotPositionInstructions(rpc, authority, poolAddress, args) {
|
|
14023
|
-
const poolAccount = await (0,
|
|
14057
|
+
const poolAccount = await (0, import_kit132.fetchEncodedAccount)(rpc, poolAddress);
|
|
14024
14058
|
(0, import_assert19.default)(poolAccount.exists, "Pool account not found");
|
|
14025
14059
|
let pool;
|
|
14026
14060
|
if (poolAccount.programAddress == import_fusionamm_client14.FUSIONAMM_PROGRAM_ADDRESS) {
|
|
14027
|
-
pool = (0,
|
|
14061
|
+
pool = (0, import_kit132.decodeAccount)(poolAccount, (0, import_fusionamm_client14.getFusionPoolDecoder)());
|
|
14028
14062
|
} else if (poolAccount.programAddress == import_whirlpools_client13.WHIRLPOOL_PROGRAM_ADDRESS) {
|
|
14029
|
-
pool = (0,
|
|
14063
|
+
pool = (0, import_kit132.decodeAccount)(poolAccount, (0, import_whirlpools_client13.getWhirlpoolDecoder)());
|
|
14030
14064
|
} else {
|
|
14031
14065
|
throw new Error("Incorrect Fusion or Orca pool account");
|
|
14032
14066
|
}
|
|
@@ -14066,7 +14100,7 @@ async function openTunaSpotPositionInstruction(authority, mintA, mintB, poolAddr
|
|
|
14066
14100
|
// src/txbuilder/decreaseTunaLpPositionOrca.ts
|
|
14067
14101
|
var import_whirlpools_client14 = require("@orca-so/whirlpools-client");
|
|
14068
14102
|
var import_whirlpools_core5 = require("@orca-so/whirlpools-core");
|
|
14069
|
-
var
|
|
14103
|
+
var import_kit133 = require("@solana/kit");
|
|
14070
14104
|
var import_memo18 = require("@solana-program/memo");
|
|
14071
14105
|
var import_token_202229 = require("@solana-program/token-2022");
|
|
14072
14106
|
var import_assert20 = __toESM(require("assert"), 1);
|
|
@@ -14088,7 +14122,7 @@ async function decreaseTunaLpPositionOrcaInstructions(rpc, authority, positionMi
|
|
|
14088
14122
|
const allMints = [mintA, mintB, ...rewardMints];
|
|
14089
14123
|
(0, import_assert20.default)(mintA.exists, "Token A account not found");
|
|
14090
14124
|
(0, import_assert20.default)(mintB.exists, "Token B account not found");
|
|
14091
|
-
(0,
|
|
14125
|
+
(0, import_kit133.assertAccountsExist)(rewardMints);
|
|
14092
14126
|
const lowerTickArrayStartIndex = (0, import_whirlpools_core5.getTickArrayStartTickIndex)(
|
|
14093
14127
|
tunaPosition.data.tickLowerIndex,
|
|
14094
14128
|
whirlpool.data.tickSpacing
|
|
@@ -14200,16 +14234,16 @@ async function decreaseTunaLpPositionOrcaInstruction(authority, tunaPosition, mi
|
|
|
14200
14234
|
tunaPosition.data.tickUpperIndex
|
|
14201
14235
|
);
|
|
14202
14236
|
const remainingAccounts = [
|
|
14203
|
-
{ address: swapTickArrays[0], role:
|
|
14204
|
-
{ address: swapTickArrays[1], role:
|
|
14205
|
-
{ address: swapTickArrays[2], role:
|
|
14206
|
-
{ address: swapTickArrays[3], role:
|
|
14207
|
-
{ address: swapTickArrays[4], role:
|
|
14208
|
-
{ address: lowerTickArrayAddress, role:
|
|
14209
|
-
{ address: upperTickArrayAddress, role:
|
|
14210
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
14211
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
14212
|
-
{ 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 }
|
|
14213
14247
|
];
|
|
14214
14248
|
for (const rewardIndex of rewardIndicesToClaim) {
|
|
14215
14249
|
const rewardInfo = whirlpool.data.rewardInfos[rewardIndex];
|
|
@@ -14220,10 +14254,10 @@ async function decreaseTunaLpPositionOrcaInstruction(authority, tunaPosition, mi
|
|
|
14220
14254
|
mint: rewardMint.address,
|
|
14221
14255
|
tokenProgram: rewardMint.programAddress
|
|
14222
14256
|
});
|
|
14223
|
-
remainingAccounts.push({ address: rewardMint.address, role:
|
|
14224
|
-
remainingAccounts.push({ address: rewardMint.programAddress, role:
|
|
14225
|
-
remainingAccounts.push({ address: ownerAta[0], role:
|
|
14226
|
-
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 });
|
|
14227
14261
|
}
|
|
14228
14262
|
const remainingAccountsInfo = {
|
|
14229
14263
|
slices: [
|
|
@@ -14271,7 +14305,7 @@ async function decreaseTunaLpPositionOrcaInstruction(authority, tunaPosition, mi
|
|
|
14271
14305
|
|
|
14272
14306
|
// src/txbuilder/decreaseTunaLpPositionFusion.ts
|
|
14273
14307
|
var import_fusionamm_client15 = require("@crypticdot/fusionamm-client");
|
|
14274
|
-
var
|
|
14308
|
+
var import_kit134 = require("@solana/kit");
|
|
14275
14309
|
var import_memo19 = require("@solana-program/memo");
|
|
14276
14310
|
var import_token_202230 = require("@solana-program/token-2022");
|
|
14277
14311
|
var import_assert21 = __toESM(require("assert"), 1);
|
|
@@ -14371,15 +14405,15 @@ async function decreaseTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
14371
14405
|
tunaPosition.data.tickUpperIndex
|
|
14372
14406
|
);
|
|
14373
14407
|
const remainingAccounts = [
|
|
14374
|
-
{ address: swapTickArrays[0], role:
|
|
14375
|
-
{ address: swapTickArrays[1], role:
|
|
14376
|
-
{ address: swapTickArrays[2], role:
|
|
14377
|
-
{ address: swapTickArrays[3], role:
|
|
14378
|
-
{ address: swapTickArrays[4], role:
|
|
14379
|
-
{ address: lowerTickArrayAddress, role:
|
|
14380
|
-
{ address: upperTickArrayAddress, role:
|
|
14381
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
14382
|
-
{ 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 }
|
|
14383
14417
|
];
|
|
14384
14418
|
const remainingAccountsInfo = {
|
|
14385
14419
|
slices: [
|
|
@@ -14591,7 +14625,7 @@ async function withdrawInstruction(authority, mint, vault, funds, shares) {
|
|
|
14591
14625
|
// src/txbuilder/createMarketLookupTable.ts
|
|
14592
14626
|
var import_fusionamm_client16 = require("@crypticdot/fusionamm-client");
|
|
14593
14627
|
var import_whirlpools_client15 = require("@orca-so/whirlpools-client");
|
|
14594
|
-
var
|
|
14628
|
+
var import_kit135 = require("@solana/kit");
|
|
14595
14629
|
var import_address_lookup_table2 = require("@solana-program/address-lookup-table");
|
|
14596
14630
|
var import_memo22 = require("@solana-program/memo");
|
|
14597
14631
|
var import_system2 = require("@solana-program/system");
|
|
@@ -14631,7 +14665,7 @@ async function getAddressesForMarketLookupTable(rpc, poolAddress, marketMaker) {
|
|
|
14631
14665
|
}))[0];
|
|
14632
14666
|
const addresses = [
|
|
14633
14667
|
import_system2.SYSTEM_PROGRAM_ADDRESS,
|
|
14634
|
-
(0,
|
|
14668
|
+
(0, import_kit135.address)("SysvarRent111111111111111111111111111111111"),
|
|
14635
14669
|
import_token_202234.ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
14636
14670
|
import_token2.TOKEN_PROGRAM_ADDRESS,
|
|
14637
14671
|
import_token_202234.TOKEN_2022_PROGRAM_ADDRESS,
|
|
@@ -14791,7 +14825,7 @@ async function repayTunaLpPositionDebtInstruction(authority, positionMint, mintA
|
|
|
14791
14825
|
|
|
14792
14826
|
// src/txbuilder/rebalanceTunaLpPositionOrca.ts
|
|
14793
14827
|
var import_whirlpools_client16 = require("@orca-so/whirlpools-client");
|
|
14794
|
-
var
|
|
14828
|
+
var import_kit136 = require("@solana/kit");
|
|
14795
14829
|
var import_sysvars3 = require("@solana/sysvars");
|
|
14796
14830
|
var import_memo24 = require("@solana-program/memo");
|
|
14797
14831
|
var import_token_202236 = require("@solana-program/token-2022");
|
|
@@ -14874,7 +14908,7 @@ async function rebalanceTunaLpPositionOrcaInstructions(rpc, authority, positionM
|
|
|
14874
14908
|
cleanupInstructions.push(...internalCleanupInstructions);
|
|
14875
14909
|
return {
|
|
14876
14910
|
instructions,
|
|
14877
|
-
initializationCost: (0,
|
|
14911
|
+
initializationCost: (0, import_kit136.lamports)(nonRefundableRent)
|
|
14878
14912
|
};
|
|
14879
14913
|
}
|
|
14880
14914
|
async function rebalanceTunaLpPositionOrcaInstruction(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool) {
|
|
@@ -14918,18 +14952,18 @@ async function rebalanceTunaLpPositionOrcaInstruction(authority, tunaPosition, t
|
|
|
14918
14952
|
);
|
|
14919
14953
|
const secondaryTickArrays = await OrcaUtils.getTickArraysForRebalancedPosition(whirlpool, tunaPosition);
|
|
14920
14954
|
const remainingAccounts = [
|
|
14921
|
-
{ address: swapTickArrays[0], role:
|
|
14922
|
-
{ address: swapTickArrays[1], role:
|
|
14923
|
-
{ address: swapTickArrays[2], role:
|
|
14924
|
-
{ address: swapTickArrays[3], role:
|
|
14925
|
-
{ address: swapTickArrays[4], role:
|
|
14926
|
-
{ address: lowerTickArrayAddress, role:
|
|
14927
|
-
{ address: upperTickArrayAddress, role:
|
|
14928
|
-
{ address: secondaryTickArrays.lowerTickArrayAddress, role:
|
|
14929
|
-
{ address: secondaryTickArrays.upperTickArrayAddress, role:
|
|
14930
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
14931
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
14932
|
-
{ 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 }
|
|
14933
14967
|
];
|
|
14934
14968
|
const remainingAccountsInfo = {
|
|
14935
14969
|
slices: [
|
|
@@ -14973,7 +15007,7 @@ async function rebalanceTunaLpPositionOrcaInstruction(authority, tunaPosition, t
|
|
|
14973
15007
|
|
|
14974
15008
|
// src/txbuilder/rebalanceTunaLpPositionFusion.ts
|
|
14975
15009
|
var import_fusionamm_client17 = require("@crypticdot/fusionamm-client");
|
|
14976
|
-
var
|
|
15010
|
+
var import_kit137 = require("@solana/kit");
|
|
14977
15011
|
var import_sysvars4 = require("@solana/sysvars");
|
|
14978
15012
|
var import_memo25 = require("@solana-program/memo");
|
|
14979
15013
|
var import_token_202237 = require("@solana-program/token-2022");
|
|
@@ -15052,7 +15086,7 @@ async function rebalanceTunaLpPositionFusionInstructions(rpc, authority, positio
|
|
|
15052
15086
|
instructions.push(ix);
|
|
15053
15087
|
return {
|
|
15054
15088
|
instructions,
|
|
15055
|
-
initializationCost: (0,
|
|
15089
|
+
initializationCost: (0, import_kit137.lamports)(nonRefundableRent)
|
|
15056
15090
|
};
|
|
15057
15091
|
}
|
|
15058
15092
|
async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, fusionPool) {
|
|
@@ -15095,17 +15129,17 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
15095
15129
|
);
|
|
15096
15130
|
const secondaryTickArrays = await FusionUtils.getTickArraysForRebalancedPosition(fusionPool, tunaPosition);
|
|
15097
15131
|
const remainingAccounts = [
|
|
15098
|
-
{ address: swapTickArrays[0], role:
|
|
15099
|
-
{ address: swapTickArrays[1], role:
|
|
15100
|
-
{ address: swapTickArrays[2], role:
|
|
15101
|
-
{ address: swapTickArrays[3], role:
|
|
15102
|
-
{ address: swapTickArrays[4], role:
|
|
15103
|
-
{ address: lowerTickArrayAddress, role:
|
|
15104
|
-
{ address: upperTickArrayAddress, role:
|
|
15105
|
-
{ address: secondaryTickArrays.lowerTickArrayAddress, role:
|
|
15106
|
-
{ address: secondaryTickArrays.upperTickArrayAddress, role:
|
|
15107
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
15108
|
-
{ 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 }
|
|
15109
15143
|
];
|
|
15110
15144
|
const remainingAccountsInfo = {
|
|
15111
15145
|
slices: [
|