@crypticdot/defituna-client 3.0.2 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +89 -16
- package/dist/index.d.ts +89 -16
- package/dist/index.js +786 -577
- package/dist/index.mjs +542 -333
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -51,6 +51,7 @@ __export(index_exports, {
|
|
|
51
51
|
DEFAULT_ADDRESS: () => DEFAULT_ADDRESS,
|
|
52
52
|
DEFAULT_MAX_AMOUNT_SLIPPAGE: () => DEFAULT_MAX_AMOUNT_SLIPPAGE,
|
|
53
53
|
DEFAULT_MAX_SWAP_SLIPPAGE: () => DEFAULT_MAX_SWAP_SLIPPAGE,
|
|
54
|
+
DEFAULT_PUSH_ORACLE_PROGRAM_ID: () => DEFAULT_PUSH_ORACLE_PROGRAM_ID,
|
|
54
55
|
DEPOSIT_DISCRIMINATOR: () => DEPOSIT_DISCRIMINATOR,
|
|
55
56
|
FusionUtils: () => FusionUtils,
|
|
56
57
|
HUNDRED_PERCENT: () => HUNDRED_PERCENT,
|
|
@@ -91,6 +92,7 @@ __export(index_exports, {
|
|
|
91
92
|
REBALANCE_TUNA_LP_POSITION_ORCA_DISCRIMINATOR: () => REBALANCE_TUNA_LP_POSITION_ORCA_DISCRIMINATOR,
|
|
92
93
|
REPAY_BAD_DEBT_DISCRIMINATOR: () => REPAY_BAD_DEBT_DISCRIMINATOR,
|
|
93
94
|
REPAY_TUNA_LP_POSITION_DEBT_DISCRIMINATOR: () => REPAY_TUNA_LP_POSITION_DEBT_DISCRIMINATOR,
|
|
95
|
+
RESET_TUNA_SPOT_POSITION_DISCRIMINATOR: () => RESET_TUNA_SPOT_POSITION_DISCRIMINATOR,
|
|
94
96
|
SET_ADMIN_AUTHORITY_DISCRIMINATOR: () => SET_ADMIN_AUTHORITY_DISCRIMINATOR,
|
|
95
97
|
SET_DEFAULT_MAX_PERCENTAGE_OF_LEFTOVERS_DISCRIMINATOR: () => SET_DEFAULT_MAX_PERCENTAGE_OF_LEFTOVERS_DISCRIMINATOR,
|
|
96
98
|
SET_DEFAULT_MAX_SWAP_SLIPPAGE_DISCRIMINATOR: () => SET_DEFAULT_MAX_SWAP_SLIPPAGE_DISCRIMINATOR,
|
|
@@ -452,6 +454,7 @@ __export(index_exports, {
|
|
|
452
454
|
getPoolTokenCodec: () => getPoolTokenCodec,
|
|
453
455
|
getPoolTokenDecoder: () => getPoolTokenDecoder,
|
|
454
456
|
getPoolTokenEncoder: () => getPoolTokenEncoder,
|
|
457
|
+
getPythPriceUpdateAccountAddress: () => getPythPriceUpdateAccountAddress,
|
|
455
458
|
getRebalanceTunaLpPositionFusionDiscriminatorBytes: () => getRebalanceTunaLpPositionFusionDiscriminatorBytes,
|
|
456
459
|
getRebalanceTunaLpPositionFusionInstruction: () => getRebalanceTunaLpPositionFusionInstruction,
|
|
457
460
|
getRebalanceTunaLpPositionFusionInstructionDataCodec: () => getRebalanceTunaLpPositionFusionInstructionDataCodec,
|
|
@@ -478,6 +481,11 @@ __export(index_exports, {
|
|
|
478
481
|
getRepayTunaLpPositionDebtInstructionDataCodec: () => getRepayTunaLpPositionDebtInstructionDataCodec,
|
|
479
482
|
getRepayTunaLpPositionDebtInstructionDataDecoder: () => getRepayTunaLpPositionDebtInstructionDataDecoder,
|
|
480
483
|
getRepayTunaLpPositionDebtInstructionDataEncoder: () => getRepayTunaLpPositionDebtInstructionDataEncoder,
|
|
484
|
+
getResetTunaSpotPositionDiscriminatorBytes: () => getResetTunaSpotPositionDiscriminatorBytes,
|
|
485
|
+
getResetTunaSpotPositionInstruction: () => getResetTunaSpotPositionInstruction,
|
|
486
|
+
getResetTunaSpotPositionInstructionDataCodec: () => getResetTunaSpotPositionInstructionDataCodec,
|
|
487
|
+
getResetTunaSpotPositionInstructionDataDecoder: () => getResetTunaSpotPositionInstructionDataDecoder,
|
|
488
|
+
getResetTunaSpotPositionInstructionDataEncoder: () => getResetTunaSpotPositionInstructionDataEncoder,
|
|
481
489
|
getSetAdminAuthorityDiscriminatorBytes: () => getSetAdminAuthorityDiscriminatorBytes,
|
|
482
490
|
getSetAdminAuthorityInstruction: () => getSetAdminAuthorityInstruction,
|
|
483
491
|
getSetAdminAuthorityInstructionDataCodec: () => getSetAdminAuthorityInstructionDataCodec,
|
|
@@ -656,6 +664,7 @@ __export(index_exports, {
|
|
|
656
664
|
parseRebalanceTunaLpPositionOrcaInstruction: () => parseRebalanceTunaLpPositionOrcaInstruction,
|
|
657
665
|
parseRepayBadDebtInstruction: () => parseRepayBadDebtInstruction,
|
|
658
666
|
parseRepayTunaLpPositionDebtInstruction: () => parseRepayTunaLpPositionDebtInstruction,
|
|
667
|
+
parseResetTunaSpotPositionInstruction: () => parseResetTunaSpotPositionInstruction,
|
|
659
668
|
parseSetAdminAuthorityInstruction: () => parseSetAdminAuthorityInstruction,
|
|
660
669
|
parseSetDefaultMaxPercentageOfLeftoversInstruction: () => parseSetDefaultMaxPercentageOfLeftoversInstruction,
|
|
661
670
|
parseSetDefaultMaxSwapSlippageInstruction: () => parseSetDefaultMaxSwapSlippageInstruction,
|
|
@@ -678,7 +687,9 @@ __export(index_exports, {
|
|
|
678
687
|
repayBadDebtInstruction: () => repayBadDebtInstruction,
|
|
679
688
|
repayTunaLpPositionDebtInstruction: () => repayTunaLpPositionDebtInstruction,
|
|
680
689
|
repayTunaLpPositionDebtInstructions: () => repayTunaLpPositionDebtInstructions,
|
|
690
|
+
resetTunaSpotPositionInstruction: () => resetTunaSpotPositionInstruction,
|
|
681
691
|
setTunaLpPositionLimitOrdersInstruction: () => setTunaLpPositionLimitOrdersInstruction,
|
|
692
|
+
setTunaSpotPositionLimitOrdersInstruction: () => setTunaSpotPositionLimitOrdersInstruction,
|
|
682
693
|
tunaLpPositionAuthorityFilter: () => tunaLpPositionAuthorityFilter,
|
|
683
694
|
tunaLpPositionMarketMakerFilter: () => tunaLpPositionMarketMakerFilter,
|
|
684
695
|
tunaLpPositionMintAFilter: () => tunaLpPositionMintAFilter,
|
|
@@ -1522,21 +1533,22 @@ var TunaInstruction = /* @__PURE__ */ ((TunaInstruction2) => {
|
|
|
1522
1533
|
TunaInstruction2[TunaInstruction2["RebalanceTunaLpPositionOrca"] = 36] = "RebalanceTunaLpPositionOrca";
|
|
1523
1534
|
TunaInstruction2[TunaInstruction2["RepayBadDebt"] = 37] = "RepayBadDebt";
|
|
1524
1535
|
TunaInstruction2[TunaInstruction2["RepayTunaLpPositionDebt"] = 38] = "RepayTunaLpPositionDebt";
|
|
1525
|
-
TunaInstruction2[TunaInstruction2["
|
|
1526
|
-
TunaInstruction2[TunaInstruction2["
|
|
1527
|
-
TunaInstruction2[TunaInstruction2["
|
|
1528
|
-
TunaInstruction2[TunaInstruction2["
|
|
1529
|
-
TunaInstruction2[TunaInstruction2["
|
|
1530
|
-
TunaInstruction2[TunaInstruction2["
|
|
1531
|
-
TunaInstruction2[TunaInstruction2["
|
|
1532
|
-
TunaInstruction2[TunaInstruction2["
|
|
1533
|
-
TunaInstruction2[TunaInstruction2["
|
|
1534
|
-
TunaInstruction2[TunaInstruction2["
|
|
1535
|
-
TunaInstruction2[TunaInstruction2["
|
|
1536
|
-
TunaInstruction2[TunaInstruction2["
|
|
1537
|
-
TunaInstruction2[TunaInstruction2["
|
|
1538
|
-
TunaInstruction2[TunaInstruction2["
|
|
1539
|
-
TunaInstruction2[TunaInstruction2["
|
|
1536
|
+
TunaInstruction2[TunaInstruction2["ResetTunaSpotPosition"] = 39] = "ResetTunaSpotPosition";
|
|
1537
|
+
TunaInstruction2[TunaInstruction2["SetAdminAuthority"] = 40] = "SetAdminAuthority";
|
|
1538
|
+
TunaInstruction2[TunaInstruction2["SetDefaultMaxPercentageOfLeftovers"] = 41] = "SetDefaultMaxPercentageOfLeftovers";
|
|
1539
|
+
TunaInstruction2[TunaInstruction2["SetDefaultMaxSwapSlippage"] = 42] = "SetDefaultMaxSwapSlippage";
|
|
1540
|
+
TunaInstruction2[TunaInstruction2["SetDefaultOraclePriceDeviationThreshold"] = 43] = "SetDefaultOraclePriceDeviationThreshold";
|
|
1541
|
+
TunaInstruction2[TunaInstruction2["SetFeeRecipient"] = 44] = "SetFeeRecipient";
|
|
1542
|
+
TunaInstruction2[TunaInstruction2["SetLiquidatorAuthority"] = 45] = "SetLiquidatorAuthority";
|
|
1543
|
+
TunaInstruction2[TunaInstruction2["SetOwnerAuthority"] = 46] = "SetOwnerAuthority";
|
|
1544
|
+
TunaInstruction2[TunaInstruction2["SetSuspendedState"] = 47] = "SetSuspendedState";
|
|
1545
|
+
TunaInstruction2[TunaInstruction2["SetTunaLpPositionFlags"] = 48] = "SetTunaLpPositionFlags";
|
|
1546
|
+
TunaInstruction2[TunaInstruction2["SetTunaLpPositionLimitOrders"] = 49] = "SetTunaLpPositionLimitOrders";
|
|
1547
|
+
TunaInstruction2[TunaInstruction2["SetTunaLpPositionRebalanceThreshold"] = 50] = "SetTunaLpPositionRebalanceThreshold";
|
|
1548
|
+
TunaInstruction2[TunaInstruction2["SetTunaSpotPositionLimitOrders"] = 51] = "SetTunaSpotPositionLimitOrders";
|
|
1549
|
+
TunaInstruction2[TunaInstruction2["UpdateMarket"] = 52] = "UpdateMarket";
|
|
1550
|
+
TunaInstruction2[TunaInstruction2["UpdateVault"] = 53] = "UpdateVault";
|
|
1551
|
+
TunaInstruction2[TunaInstruction2["Withdraw"] = 54] = "Withdraw";
|
|
1540
1552
|
return TunaInstruction2;
|
|
1541
1553
|
})(TunaInstruction || {});
|
|
1542
1554
|
function identifyTunaInstruction(instruction) {
|
|
@@ -1892,6 +1904,15 @@ function identifyTunaInstruction(instruction) {
|
|
|
1892
1904
|
)) {
|
|
1893
1905
|
return 38 /* RepayTunaLpPositionDebt */;
|
|
1894
1906
|
}
|
|
1907
|
+
if ((0, import_kit13.containsBytes)(
|
|
1908
|
+
data,
|
|
1909
|
+
(0, import_kit13.fixEncoderSize)((0, import_kit13.getBytesEncoder)(), 8).encode(
|
|
1910
|
+
new Uint8Array([194, 68, 113, 71, 103, 77, 29, 127])
|
|
1911
|
+
),
|
|
1912
|
+
0
|
|
1913
|
+
)) {
|
|
1914
|
+
return 39 /* ResetTunaSpotPosition */;
|
|
1915
|
+
}
|
|
1895
1916
|
if ((0, import_kit13.containsBytes)(
|
|
1896
1917
|
data,
|
|
1897
1918
|
(0, import_kit13.fixEncoderSize)((0, import_kit13.getBytesEncoder)(), 8).encode(
|
|
@@ -1899,7 +1920,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1899
1920
|
),
|
|
1900
1921
|
0
|
|
1901
1922
|
)) {
|
|
1902
|
-
return
|
|
1923
|
+
return 40 /* SetAdminAuthority */;
|
|
1903
1924
|
}
|
|
1904
1925
|
if ((0, import_kit13.containsBytes)(
|
|
1905
1926
|
data,
|
|
@@ -1908,7 +1929,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1908
1929
|
),
|
|
1909
1930
|
0
|
|
1910
1931
|
)) {
|
|
1911
|
-
return
|
|
1932
|
+
return 41 /* SetDefaultMaxPercentageOfLeftovers */;
|
|
1912
1933
|
}
|
|
1913
1934
|
if ((0, import_kit13.containsBytes)(
|
|
1914
1935
|
data,
|
|
@@ -1917,7 +1938,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1917
1938
|
),
|
|
1918
1939
|
0
|
|
1919
1940
|
)) {
|
|
1920
|
-
return
|
|
1941
|
+
return 42 /* SetDefaultMaxSwapSlippage */;
|
|
1921
1942
|
}
|
|
1922
1943
|
if ((0, import_kit13.containsBytes)(
|
|
1923
1944
|
data,
|
|
@@ -1926,7 +1947,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1926
1947
|
),
|
|
1927
1948
|
0
|
|
1928
1949
|
)) {
|
|
1929
|
-
return
|
|
1950
|
+
return 43 /* SetDefaultOraclePriceDeviationThreshold */;
|
|
1930
1951
|
}
|
|
1931
1952
|
if ((0, import_kit13.containsBytes)(
|
|
1932
1953
|
data,
|
|
@@ -1935,7 +1956,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1935
1956
|
),
|
|
1936
1957
|
0
|
|
1937
1958
|
)) {
|
|
1938
|
-
return
|
|
1959
|
+
return 44 /* SetFeeRecipient */;
|
|
1939
1960
|
}
|
|
1940
1961
|
if ((0, import_kit13.containsBytes)(
|
|
1941
1962
|
data,
|
|
@@ -1944,7 +1965,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1944
1965
|
),
|
|
1945
1966
|
0
|
|
1946
1967
|
)) {
|
|
1947
|
-
return
|
|
1968
|
+
return 45 /* SetLiquidatorAuthority */;
|
|
1948
1969
|
}
|
|
1949
1970
|
if ((0, import_kit13.containsBytes)(
|
|
1950
1971
|
data,
|
|
@@ -1953,7 +1974,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1953
1974
|
),
|
|
1954
1975
|
0
|
|
1955
1976
|
)) {
|
|
1956
|
-
return
|
|
1977
|
+
return 46 /* SetOwnerAuthority */;
|
|
1957
1978
|
}
|
|
1958
1979
|
if ((0, import_kit13.containsBytes)(
|
|
1959
1980
|
data,
|
|
@@ -1962,7 +1983,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1962
1983
|
),
|
|
1963
1984
|
0
|
|
1964
1985
|
)) {
|
|
1965
|
-
return
|
|
1986
|
+
return 47 /* SetSuspendedState */;
|
|
1966
1987
|
}
|
|
1967
1988
|
if ((0, import_kit13.containsBytes)(
|
|
1968
1989
|
data,
|
|
@@ -1971,7 +1992,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1971
1992
|
),
|
|
1972
1993
|
0
|
|
1973
1994
|
)) {
|
|
1974
|
-
return
|
|
1995
|
+
return 48 /* SetTunaLpPositionFlags */;
|
|
1975
1996
|
}
|
|
1976
1997
|
if ((0, import_kit13.containsBytes)(
|
|
1977
1998
|
data,
|
|
@@ -1980,7 +2001,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1980
2001
|
),
|
|
1981
2002
|
0
|
|
1982
2003
|
)) {
|
|
1983
|
-
return
|
|
2004
|
+
return 49 /* SetTunaLpPositionLimitOrders */;
|
|
1984
2005
|
}
|
|
1985
2006
|
if ((0, import_kit13.containsBytes)(
|
|
1986
2007
|
data,
|
|
@@ -1989,7 +2010,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1989
2010
|
),
|
|
1990
2011
|
0
|
|
1991
2012
|
)) {
|
|
1992
|
-
return
|
|
2013
|
+
return 50 /* SetTunaLpPositionRebalanceThreshold */;
|
|
1993
2014
|
}
|
|
1994
2015
|
if ((0, import_kit13.containsBytes)(
|
|
1995
2016
|
data,
|
|
@@ -1998,7 +2019,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
1998
2019
|
),
|
|
1999
2020
|
0
|
|
2000
2021
|
)) {
|
|
2001
|
-
return
|
|
2022
|
+
return 51 /* SetTunaSpotPositionLimitOrders */;
|
|
2002
2023
|
}
|
|
2003
2024
|
if ((0, import_kit13.containsBytes)(
|
|
2004
2025
|
data,
|
|
@@ -2007,7 +2028,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
2007
2028
|
),
|
|
2008
2029
|
0
|
|
2009
2030
|
)) {
|
|
2010
|
-
return
|
|
2031
|
+
return 52 /* UpdateMarket */;
|
|
2011
2032
|
}
|
|
2012
2033
|
if ((0, import_kit13.containsBytes)(
|
|
2013
2034
|
data,
|
|
@@ -2016,7 +2037,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
2016
2037
|
),
|
|
2017
2038
|
0
|
|
2018
2039
|
)) {
|
|
2019
|
-
return
|
|
2040
|
+
return 53 /* UpdateVault */;
|
|
2020
2041
|
}
|
|
2021
2042
|
if ((0, import_kit13.containsBytes)(
|
|
2022
2043
|
data,
|
|
@@ -2025,7 +2046,7 @@ function identifyTunaInstruction(instruction) {
|
|
|
2025
2046
|
),
|
|
2026
2047
|
0
|
|
2027
2048
|
)) {
|
|
2028
|
-
return
|
|
2049
|
+
return 54 /* Withdraw */;
|
|
2029
2050
|
}
|
|
2030
2051
|
throw new Error(
|
|
2031
2052
|
"The provided instruction could not be identified as a tuna instruction."
|
|
@@ -8326,8 +8347,116 @@ function parseRepayTunaLpPositionDebtInstruction(instruction) {
|
|
|
8326
8347
|
};
|
|
8327
8348
|
}
|
|
8328
8349
|
|
|
8329
|
-
// src/generated/instructions/
|
|
8350
|
+
// src/generated/instructions/resetTunaSpotPosition.ts
|
|
8330
8351
|
var import_kit55 = require("@solana/kit");
|
|
8352
|
+
var RESET_TUNA_SPOT_POSITION_DISCRIMINATOR = new Uint8Array([
|
|
8353
|
+
194,
|
|
8354
|
+
68,
|
|
8355
|
+
113,
|
|
8356
|
+
71,
|
|
8357
|
+
103,
|
|
8358
|
+
77,
|
|
8359
|
+
29,
|
|
8360
|
+
127
|
|
8361
|
+
]);
|
|
8362
|
+
function getResetTunaSpotPositionDiscriminatorBytes() {
|
|
8363
|
+
return (0, import_kit55.fixEncoderSize)((0, import_kit55.getBytesEncoder)(), 8).encode(
|
|
8364
|
+
RESET_TUNA_SPOT_POSITION_DISCRIMINATOR
|
|
8365
|
+
);
|
|
8366
|
+
}
|
|
8367
|
+
function getResetTunaSpotPositionInstructionDataEncoder() {
|
|
8368
|
+
return (0, import_kit55.transformEncoder)(
|
|
8369
|
+
(0, import_kit55.getStructEncoder)([
|
|
8370
|
+
["discriminator", (0, import_kit55.fixEncoderSize)((0, import_kit55.getBytesEncoder)(), 8)],
|
|
8371
|
+
["positionToken", getPoolTokenEncoder()],
|
|
8372
|
+
["collateralToken", getPoolTokenEncoder()],
|
|
8373
|
+
["lowerLimitOrderSqrtPrice", (0, import_kit55.getU128Encoder)()],
|
|
8374
|
+
["upperLimitOrderSqrtPrice", (0, import_kit55.getU128Encoder)()]
|
|
8375
|
+
]),
|
|
8376
|
+
(value) => ({
|
|
8377
|
+
...value,
|
|
8378
|
+
discriminator: RESET_TUNA_SPOT_POSITION_DISCRIMINATOR
|
|
8379
|
+
})
|
|
8380
|
+
);
|
|
8381
|
+
}
|
|
8382
|
+
function getResetTunaSpotPositionInstructionDataDecoder() {
|
|
8383
|
+
return (0, import_kit55.getStructDecoder)([
|
|
8384
|
+
["discriminator", (0, import_kit55.fixDecoderSize)((0, import_kit55.getBytesDecoder)(), 8)],
|
|
8385
|
+
["positionToken", getPoolTokenDecoder()],
|
|
8386
|
+
["collateralToken", getPoolTokenDecoder()],
|
|
8387
|
+
["lowerLimitOrderSqrtPrice", (0, import_kit55.getU128Decoder)()],
|
|
8388
|
+
["upperLimitOrderSqrtPrice", (0, import_kit55.getU128Decoder)()]
|
|
8389
|
+
]);
|
|
8390
|
+
}
|
|
8391
|
+
function getResetTunaSpotPositionInstructionDataCodec() {
|
|
8392
|
+
return (0, import_kit55.combineCodec)(
|
|
8393
|
+
getResetTunaSpotPositionInstructionDataEncoder(),
|
|
8394
|
+
getResetTunaSpotPositionInstructionDataDecoder()
|
|
8395
|
+
);
|
|
8396
|
+
}
|
|
8397
|
+
function getResetTunaSpotPositionInstruction(input, config) {
|
|
8398
|
+
const programAddress = config?.programAddress ?? TUNA_PROGRAM_ADDRESS;
|
|
8399
|
+
const originalAccounts = {
|
|
8400
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
8401
|
+
mintA: { value: input.mintA ?? null, isWritable: false },
|
|
8402
|
+
mintB: { value: input.mintB ?? null, isWritable: false },
|
|
8403
|
+
tunaPosition: { value: input.tunaPosition ?? null, isWritable: true },
|
|
8404
|
+
tunaPositionAtaA: {
|
|
8405
|
+
value: input.tunaPositionAtaA ?? null,
|
|
8406
|
+
isWritable: true
|
|
8407
|
+
},
|
|
8408
|
+
tunaPositionAtaB: {
|
|
8409
|
+
value: input.tunaPositionAtaB ?? null,
|
|
8410
|
+
isWritable: true
|
|
8411
|
+
}
|
|
8412
|
+
};
|
|
8413
|
+
const accounts = originalAccounts;
|
|
8414
|
+
const args = { ...input };
|
|
8415
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
8416
|
+
const instruction = {
|
|
8417
|
+
accounts: [
|
|
8418
|
+
getAccountMeta(accounts.authority),
|
|
8419
|
+
getAccountMeta(accounts.mintA),
|
|
8420
|
+
getAccountMeta(accounts.mintB),
|
|
8421
|
+
getAccountMeta(accounts.tunaPosition),
|
|
8422
|
+
getAccountMeta(accounts.tunaPositionAtaA),
|
|
8423
|
+
getAccountMeta(accounts.tunaPositionAtaB)
|
|
8424
|
+
],
|
|
8425
|
+
programAddress,
|
|
8426
|
+
data: getResetTunaSpotPositionInstructionDataEncoder().encode(
|
|
8427
|
+
args
|
|
8428
|
+
)
|
|
8429
|
+
};
|
|
8430
|
+
return instruction;
|
|
8431
|
+
}
|
|
8432
|
+
function parseResetTunaSpotPositionInstruction(instruction) {
|
|
8433
|
+
if (instruction.accounts.length < 6) {
|
|
8434
|
+
throw new Error("Not enough accounts");
|
|
8435
|
+
}
|
|
8436
|
+
let accountIndex = 0;
|
|
8437
|
+
const getNextAccount = () => {
|
|
8438
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
8439
|
+
accountIndex += 1;
|
|
8440
|
+
return accountMeta;
|
|
8441
|
+
};
|
|
8442
|
+
return {
|
|
8443
|
+
programAddress: instruction.programAddress,
|
|
8444
|
+
accounts: {
|
|
8445
|
+
authority: getNextAccount(),
|
|
8446
|
+
mintA: getNextAccount(),
|
|
8447
|
+
mintB: getNextAccount(),
|
|
8448
|
+
tunaPosition: getNextAccount(),
|
|
8449
|
+
tunaPositionAtaA: getNextAccount(),
|
|
8450
|
+
tunaPositionAtaB: getNextAccount()
|
|
8451
|
+
},
|
|
8452
|
+
data: getResetTunaSpotPositionInstructionDataDecoder().decode(
|
|
8453
|
+
instruction.data
|
|
8454
|
+
)
|
|
8455
|
+
};
|
|
8456
|
+
}
|
|
8457
|
+
|
|
8458
|
+
// src/generated/instructions/setAdminAuthority.ts
|
|
8459
|
+
var import_kit56 = require("@solana/kit");
|
|
8331
8460
|
var SET_ADMIN_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
8332
8461
|
72,
|
|
8333
8462
|
49,
|
|
@@ -8339,27 +8468,27 @@ var SET_ADMIN_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
|
8339
8468
|
174
|
|
8340
8469
|
]);
|
|
8341
8470
|
function getSetAdminAuthorityDiscriminatorBytes() {
|
|
8342
|
-
return (0,
|
|
8471
|
+
return (0, import_kit56.fixEncoderSize)((0, import_kit56.getBytesEncoder)(), 8).encode(
|
|
8343
8472
|
SET_ADMIN_AUTHORITY_DISCRIMINATOR
|
|
8344
8473
|
);
|
|
8345
8474
|
}
|
|
8346
8475
|
function getSetAdminAuthorityInstructionDataEncoder() {
|
|
8347
|
-
return (0,
|
|
8348
|
-
(0,
|
|
8349
|
-
["discriminator", (0,
|
|
8350
|
-
["adminAuthority", (0,
|
|
8476
|
+
return (0, import_kit56.transformEncoder)(
|
|
8477
|
+
(0, import_kit56.getStructEncoder)([
|
|
8478
|
+
["discriminator", (0, import_kit56.fixEncoderSize)((0, import_kit56.getBytesEncoder)(), 8)],
|
|
8479
|
+
["adminAuthority", (0, import_kit56.getAddressEncoder)()]
|
|
8351
8480
|
]),
|
|
8352
8481
|
(value) => ({ ...value, discriminator: SET_ADMIN_AUTHORITY_DISCRIMINATOR })
|
|
8353
8482
|
);
|
|
8354
8483
|
}
|
|
8355
8484
|
function getSetAdminAuthorityInstructionDataDecoder() {
|
|
8356
|
-
return (0,
|
|
8357
|
-
["discriminator", (0,
|
|
8358
|
-
["adminAuthority", (0,
|
|
8485
|
+
return (0, import_kit56.getStructDecoder)([
|
|
8486
|
+
["discriminator", (0, import_kit56.fixDecoderSize)((0, import_kit56.getBytesDecoder)(), 8)],
|
|
8487
|
+
["adminAuthority", (0, import_kit56.getAddressDecoder)()]
|
|
8359
8488
|
]);
|
|
8360
8489
|
}
|
|
8361
8490
|
function getSetAdminAuthorityInstructionDataCodec() {
|
|
8362
|
-
return (0,
|
|
8491
|
+
return (0, import_kit56.combineCodec)(
|
|
8363
8492
|
getSetAdminAuthorityInstructionDataEncoder(),
|
|
8364
8493
|
getSetAdminAuthorityInstructionDataDecoder()
|
|
8365
8494
|
);
|
|
@@ -8406,18 +8535,18 @@ function parseSetAdminAuthorityInstruction(instruction) {
|
|
|
8406
8535
|
}
|
|
8407
8536
|
|
|
8408
8537
|
// src/generated/instructions/setDefaultMaxPercentageOfLeftovers.ts
|
|
8409
|
-
var
|
|
8538
|
+
var import_kit57 = require("@solana/kit");
|
|
8410
8539
|
var SET_DEFAULT_MAX_PERCENTAGE_OF_LEFTOVERS_DISCRIMINATOR = new Uint8Array([37, 179, 107, 65, 203, 141, 183, 27]);
|
|
8411
8540
|
function getSetDefaultMaxPercentageOfLeftoversDiscriminatorBytes() {
|
|
8412
|
-
return (0,
|
|
8541
|
+
return (0, import_kit57.fixEncoderSize)((0, import_kit57.getBytesEncoder)(), 8).encode(
|
|
8413
8542
|
SET_DEFAULT_MAX_PERCENTAGE_OF_LEFTOVERS_DISCRIMINATOR
|
|
8414
8543
|
);
|
|
8415
8544
|
}
|
|
8416
8545
|
function getSetDefaultMaxPercentageOfLeftoversInstructionDataEncoder() {
|
|
8417
|
-
return (0,
|
|
8418
|
-
(0,
|
|
8419
|
-
["discriminator", (0,
|
|
8420
|
-
["maxPercentageOfLeftovers", (0,
|
|
8546
|
+
return (0, import_kit57.transformEncoder)(
|
|
8547
|
+
(0, import_kit57.getStructEncoder)([
|
|
8548
|
+
["discriminator", (0, import_kit57.fixEncoderSize)((0, import_kit57.getBytesEncoder)(), 8)],
|
|
8549
|
+
["maxPercentageOfLeftovers", (0, import_kit57.getU32Encoder)()]
|
|
8421
8550
|
]),
|
|
8422
8551
|
(value) => ({
|
|
8423
8552
|
...value,
|
|
@@ -8426,13 +8555,13 @@ function getSetDefaultMaxPercentageOfLeftoversInstructionDataEncoder() {
|
|
|
8426
8555
|
);
|
|
8427
8556
|
}
|
|
8428
8557
|
function getSetDefaultMaxPercentageOfLeftoversInstructionDataDecoder() {
|
|
8429
|
-
return (0,
|
|
8430
|
-
["discriminator", (0,
|
|
8431
|
-
["maxPercentageOfLeftovers", (0,
|
|
8558
|
+
return (0, import_kit57.getStructDecoder)([
|
|
8559
|
+
["discriminator", (0, import_kit57.fixDecoderSize)((0, import_kit57.getBytesDecoder)(), 8)],
|
|
8560
|
+
["maxPercentageOfLeftovers", (0, import_kit57.getU32Decoder)()]
|
|
8432
8561
|
]);
|
|
8433
8562
|
}
|
|
8434
8563
|
function getSetDefaultMaxPercentageOfLeftoversInstructionDataCodec() {
|
|
8435
|
-
return (0,
|
|
8564
|
+
return (0, import_kit57.combineCodec)(
|
|
8436
8565
|
getSetDefaultMaxPercentageOfLeftoversInstructionDataEncoder(),
|
|
8437
8566
|
getSetDefaultMaxPercentageOfLeftoversInstructionDataDecoder()
|
|
8438
8567
|
);
|
|
@@ -8481,7 +8610,7 @@ function parseSetDefaultMaxPercentageOfLeftoversInstruction(instruction) {
|
|
|
8481
8610
|
}
|
|
8482
8611
|
|
|
8483
8612
|
// src/generated/instructions/setDefaultMaxSwapSlippage.ts
|
|
8484
|
-
var
|
|
8613
|
+
var import_kit58 = require("@solana/kit");
|
|
8485
8614
|
var SET_DEFAULT_MAX_SWAP_SLIPPAGE_DISCRIMINATOR = new Uint8Array([
|
|
8486
8615
|
122,
|
|
8487
8616
|
22,
|
|
@@ -8493,15 +8622,15 @@ var SET_DEFAULT_MAX_SWAP_SLIPPAGE_DISCRIMINATOR = new Uint8Array([
|
|
|
8493
8622
|
181
|
|
8494
8623
|
]);
|
|
8495
8624
|
function getSetDefaultMaxSwapSlippageDiscriminatorBytes() {
|
|
8496
|
-
return (0,
|
|
8625
|
+
return (0, import_kit58.fixEncoderSize)((0, import_kit58.getBytesEncoder)(), 8).encode(
|
|
8497
8626
|
SET_DEFAULT_MAX_SWAP_SLIPPAGE_DISCRIMINATOR
|
|
8498
8627
|
);
|
|
8499
8628
|
}
|
|
8500
8629
|
function getSetDefaultMaxSwapSlippageInstructionDataEncoder() {
|
|
8501
|
-
return (0,
|
|
8502
|
-
(0,
|
|
8503
|
-
["discriminator", (0,
|
|
8504
|
-
["maxSwapSlippage", (0,
|
|
8630
|
+
return (0, import_kit58.transformEncoder)(
|
|
8631
|
+
(0, import_kit58.getStructEncoder)([
|
|
8632
|
+
["discriminator", (0, import_kit58.fixEncoderSize)((0, import_kit58.getBytesEncoder)(), 8)],
|
|
8633
|
+
["maxSwapSlippage", (0, import_kit58.getU32Encoder)()]
|
|
8505
8634
|
]),
|
|
8506
8635
|
(value) => ({
|
|
8507
8636
|
...value,
|
|
@@ -8510,13 +8639,13 @@ function getSetDefaultMaxSwapSlippageInstructionDataEncoder() {
|
|
|
8510
8639
|
);
|
|
8511
8640
|
}
|
|
8512
8641
|
function getSetDefaultMaxSwapSlippageInstructionDataDecoder() {
|
|
8513
|
-
return (0,
|
|
8514
|
-
["discriminator", (0,
|
|
8515
|
-
["maxSwapSlippage", (0,
|
|
8642
|
+
return (0, import_kit58.getStructDecoder)([
|
|
8643
|
+
["discriminator", (0, import_kit58.fixDecoderSize)((0, import_kit58.getBytesDecoder)(), 8)],
|
|
8644
|
+
["maxSwapSlippage", (0, import_kit58.getU32Decoder)()]
|
|
8516
8645
|
]);
|
|
8517
8646
|
}
|
|
8518
8647
|
function getSetDefaultMaxSwapSlippageInstructionDataCodec() {
|
|
8519
|
-
return (0,
|
|
8648
|
+
return (0, import_kit58.combineCodec)(
|
|
8520
8649
|
getSetDefaultMaxSwapSlippageInstructionDataEncoder(),
|
|
8521
8650
|
getSetDefaultMaxSwapSlippageInstructionDataDecoder()
|
|
8522
8651
|
);
|
|
@@ -8565,18 +8694,18 @@ function parseSetDefaultMaxSwapSlippageInstruction(instruction) {
|
|
|
8565
8694
|
}
|
|
8566
8695
|
|
|
8567
8696
|
// src/generated/instructions/setDefaultOraclePriceDeviationThreshold.ts
|
|
8568
|
-
var
|
|
8697
|
+
var import_kit59 = require("@solana/kit");
|
|
8569
8698
|
var SET_DEFAULT_ORACLE_PRICE_DEVIATION_THRESHOLD_DISCRIMINATOR = new Uint8Array([142, 158, 143, 67, 206, 91, 139, 120]);
|
|
8570
8699
|
function getSetDefaultOraclePriceDeviationThresholdDiscriminatorBytes() {
|
|
8571
|
-
return (0,
|
|
8700
|
+
return (0, import_kit59.fixEncoderSize)((0, import_kit59.getBytesEncoder)(), 8).encode(
|
|
8572
8701
|
SET_DEFAULT_ORACLE_PRICE_DEVIATION_THRESHOLD_DISCRIMINATOR
|
|
8573
8702
|
);
|
|
8574
8703
|
}
|
|
8575
8704
|
function getSetDefaultOraclePriceDeviationThresholdInstructionDataEncoder() {
|
|
8576
|
-
return (0,
|
|
8577
|
-
(0,
|
|
8578
|
-
["discriminator", (0,
|
|
8579
|
-
["oraclePriceDeviationThreshold", (0,
|
|
8705
|
+
return (0, import_kit59.transformEncoder)(
|
|
8706
|
+
(0, import_kit59.getStructEncoder)([
|
|
8707
|
+
["discriminator", (0, import_kit59.fixEncoderSize)((0, import_kit59.getBytesEncoder)(), 8)],
|
|
8708
|
+
["oraclePriceDeviationThreshold", (0, import_kit59.getU32Encoder)()]
|
|
8580
8709
|
]),
|
|
8581
8710
|
(value) => ({
|
|
8582
8711
|
...value,
|
|
@@ -8585,13 +8714,13 @@ function getSetDefaultOraclePriceDeviationThresholdInstructionDataEncoder() {
|
|
|
8585
8714
|
);
|
|
8586
8715
|
}
|
|
8587
8716
|
function getSetDefaultOraclePriceDeviationThresholdInstructionDataDecoder() {
|
|
8588
|
-
return (0,
|
|
8589
|
-
["discriminator", (0,
|
|
8590
|
-
["oraclePriceDeviationThreshold", (0,
|
|
8717
|
+
return (0, import_kit59.getStructDecoder)([
|
|
8718
|
+
["discriminator", (0, import_kit59.fixDecoderSize)((0, import_kit59.getBytesDecoder)(), 8)],
|
|
8719
|
+
["oraclePriceDeviationThreshold", (0, import_kit59.getU32Decoder)()]
|
|
8591
8720
|
]);
|
|
8592
8721
|
}
|
|
8593
8722
|
function getSetDefaultOraclePriceDeviationThresholdInstructionDataCodec() {
|
|
8594
|
-
return (0,
|
|
8723
|
+
return (0, import_kit59.combineCodec)(
|
|
8595
8724
|
getSetDefaultOraclePriceDeviationThresholdInstructionDataEncoder(),
|
|
8596
8725
|
getSetDefaultOraclePriceDeviationThresholdInstructionDataDecoder()
|
|
8597
8726
|
);
|
|
@@ -8640,7 +8769,7 @@ function parseSetDefaultOraclePriceDeviationThresholdInstruction(instruction) {
|
|
|
8640
8769
|
}
|
|
8641
8770
|
|
|
8642
8771
|
// src/generated/instructions/setFeeRecipient.ts
|
|
8643
|
-
var
|
|
8772
|
+
var import_kit60 = require("@solana/kit");
|
|
8644
8773
|
var SET_FEE_RECIPIENT_DISCRIMINATOR = new Uint8Array([
|
|
8645
8774
|
227,
|
|
8646
8775
|
18,
|
|
@@ -8652,27 +8781,27 @@ var SET_FEE_RECIPIENT_DISCRIMINATOR = new Uint8Array([
|
|
|
8652
8781
|
66
|
|
8653
8782
|
]);
|
|
8654
8783
|
function getSetFeeRecipientDiscriminatorBytes() {
|
|
8655
|
-
return (0,
|
|
8784
|
+
return (0, import_kit60.fixEncoderSize)((0, import_kit60.getBytesEncoder)(), 8).encode(
|
|
8656
8785
|
SET_FEE_RECIPIENT_DISCRIMINATOR
|
|
8657
8786
|
);
|
|
8658
8787
|
}
|
|
8659
8788
|
function getSetFeeRecipientInstructionDataEncoder() {
|
|
8660
|
-
return (0,
|
|
8661
|
-
(0,
|
|
8662
|
-
["discriminator", (0,
|
|
8663
|
-
["feeRecipient", (0,
|
|
8789
|
+
return (0, import_kit60.transformEncoder)(
|
|
8790
|
+
(0, import_kit60.getStructEncoder)([
|
|
8791
|
+
["discriminator", (0, import_kit60.fixEncoderSize)((0, import_kit60.getBytesEncoder)(), 8)],
|
|
8792
|
+
["feeRecipient", (0, import_kit60.getAddressEncoder)()]
|
|
8664
8793
|
]),
|
|
8665
8794
|
(value) => ({ ...value, discriminator: SET_FEE_RECIPIENT_DISCRIMINATOR })
|
|
8666
8795
|
);
|
|
8667
8796
|
}
|
|
8668
8797
|
function getSetFeeRecipientInstructionDataDecoder() {
|
|
8669
|
-
return (0,
|
|
8670
|
-
["discriminator", (0,
|
|
8671
|
-
["feeRecipient", (0,
|
|
8798
|
+
return (0, import_kit60.getStructDecoder)([
|
|
8799
|
+
["discriminator", (0, import_kit60.fixDecoderSize)((0, import_kit60.getBytesDecoder)(), 8)],
|
|
8800
|
+
["feeRecipient", (0, import_kit60.getAddressDecoder)()]
|
|
8672
8801
|
]);
|
|
8673
8802
|
}
|
|
8674
8803
|
function getSetFeeRecipientInstructionDataCodec() {
|
|
8675
|
-
return (0,
|
|
8804
|
+
return (0, import_kit60.combineCodec)(
|
|
8676
8805
|
getSetFeeRecipientInstructionDataEncoder(),
|
|
8677
8806
|
getSetFeeRecipientInstructionDataDecoder()
|
|
8678
8807
|
);
|
|
@@ -8719,7 +8848,7 @@ function parseSetFeeRecipientInstruction(instruction) {
|
|
|
8719
8848
|
}
|
|
8720
8849
|
|
|
8721
8850
|
// src/generated/instructions/setLiquidatorAuthority.ts
|
|
8722
|
-
var
|
|
8851
|
+
var import_kit61 = require("@solana/kit");
|
|
8723
8852
|
var SET_LIQUIDATOR_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
8724
8853
|
246,
|
|
8725
8854
|
146,
|
|
@@ -8731,15 +8860,15 @@ var SET_LIQUIDATOR_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
|
8731
8860
|
143
|
|
8732
8861
|
]);
|
|
8733
8862
|
function getSetLiquidatorAuthorityDiscriminatorBytes() {
|
|
8734
|
-
return (0,
|
|
8863
|
+
return (0, import_kit61.fixEncoderSize)((0, import_kit61.getBytesEncoder)(), 8).encode(
|
|
8735
8864
|
SET_LIQUIDATOR_AUTHORITY_DISCRIMINATOR
|
|
8736
8865
|
);
|
|
8737
8866
|
}
|
|
8738
8867
|
function getSetLiquidatorAuthorityInstructionDataEncoder() {
|
|
8739
|
-
return (0,
|
|
8740
|
-
(0,
|
|
8741
|
-
["discriminator", (0,
|
|
8742
|
-
["liquidatorAuthority", (0,
|
|
8868
|
+
return (0, import_kit61.transformEncoder)(
|
|
8869
|
+
(0, import_kit61.getStructEncoder)([
|
|
8870
|
+
["discriminator", (0, import_kit61.fixEncoderSize)((0, import_kit61.getBytesEncoder)(), 8)],
|
|
8871
|
+
["liquidatorAuthority", (0, import_kit61.getAddressEncoder)()]
|
|
8743
8872
|
]),
|
|
8744
8873
|
(value) => ({
|
|
8745
8874
|
...value,
|
|
@@ -8748,13 +8877,13 @@ function getSetLiquidatorAuthorityInstructionDataEncoder() {
|
|
|
8748
8877
|
);
|
|
8749
8878
|
}
|
|
8750
8879
|
function getSetLiquidatorAuthorityInstructionDataDecoder() {
|
|
8751
|
-
return (0,
|
|
8752
|
-
["discriminator", (0,
|
|
8753
|
-
["liquidatorAuthority", (0,
|
|
8880
|
+
return (0, import_kit61.getStructDecoder)([
|
|
8881
|
+
["discriminator", (0, import_kit61.fixDecoderSize)((0, import_kit61.getBytesDecoder)(), 8)],
|
|
8882
|
+
["liquidatorAuthority", (0, import_kit61.getAddressDecoder)()]
|
|
8754
8883
|
]);
|
|
8755
8884
|
}
|
|
8756
8885
|
function getSetLiquidatorAuthorityInstructionDataCodec() {
|
|
8757
|
-
return (0,
|
|
8886
|
+
return (0, import_kit61.combineCodec)(
|
|
8758
8887
|
getSetLiquidatorAuthorityInstructionDataEncoder(),
|
|
8759
8888
|
getSetLiquidatorAuthorityInstructionDataDecoder()
|
|
8760
8889
|
);
|
|
@@ -8803,7 +8932,7 @@ function parseSetLiquidatorAuthorityInstruction(instruction) {
|
|
|
8803
8932
|
}
|
|
8804
8933
|
|
|
8805
8934
|
// src/generated/instructions/setOwnerAuthority.ts
|
|
8806
|
-
var
|
|
8935
|
+
var import_kit62 = require("@solana/kit");
|
|
8807
8936
|
var SET_OWNER_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
8808
8937
|
128,
|
|
8809
8938
|
171,
|
|
@@ -8815,27 +8944,27 @@ var SET_OWNER_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
|
8815
8944
|
117
|
|
8816
8945
|
]);
|
|
8817
8946
|
function getSetOwnerAuthorityDiscriminatorBytes() {
|
|
8818
|
-
return (0,
|
|
8947
|
+
return (0, import_kit62.fixEncoderSize)((0, import_kit62.getBytesEncoder)(), 8).encode(
|
|
8819
8948
|
SET_OWNER_AUTHORITY_DISCRIMINATOR
|
|
8820
8949
|
);
|
|
8821
8950
|
}
|
|
8822
8951
|
function getSetOwnerAuthorityInstructionDataEncoder() {
|
|
8823
|
-
return (0,
|
|
8824
|
-
(0,
|
|
8825
|
-
["discriminator", (0,
|
|
8826
|
-
["ownerAuthority", (0,
|
|
8952
|
+
return (0, import_kit62.transformEncoder)(
|
|
8953
|
+
(0, import_kit62.getStructEncoder)([
|
|
8954
|
+
["discriminator", (0, import_kit62.fixEncoderSize)((0, import_kit62.getBytesEncoder)(), 8)],
|
|
8955
|
+
["ownerAuthority", (0, import_kit62.getAddressEncoder)()]
|
|
8827
8956
|
]),
|
|
8828
8957
|
(value) => ({ ...value, discriminator: SET_OWNER_AUTHORITY_DISCRIMINATOR })
|
|
8829
8958
|
);
|
|
8830
8959
|
}
|
|
8831
8960
|
function getSetOwnerAuthorityInstructionDataDecoder() {
|
|
8832
|
-
return (0,
|
|
8833
|
-
["discriminator", (0,
|
|
8834
|
-
["ownerAuthority", (0,
|
|
8961
|
+
return (0, import_kit62.getStructDecoder)([
|
|
8962
|
+
["discriminator", (0, import_kit62.fixDecoderSize)((0, import_kit62.getBytesDecoder)(), 8)],
|
|
8963
|
+
["ownerAuthority", (0, import_kit62.getAddressDecoder)()]
|
|
8835
8964
|
]);
|
|
8836
8965
|
}
|
|
8837
8966
|
function getSetOwnerAuthorityInstructionDataCodec() {
|
|
8838
|
-
return (0,
|
|
8967
|
+
return (0, import_kit62.combineCodec)(
|
|
8839
8968
|
getSetOwnerAuthorityInstructionDataEncoder(),
|
|
8840
8969
|
getSetOwnerAuthorityInstructionDataDecoder()
|
|
8841
8970
|
);
|
|
@@ -8882,7 +9011,7 @@ function parseSetOwnerAuthorityInstruction(instruction) {
|
|
|
8882
9011
|
}
|
|
8883
9012
|
|
|
8884
9013
|
// src/generated/instructions/setSuspendedState.ts
|
|
8885
|
-
var
|
|
9014
|
+
var import_kit63 = require("@solana/kit");
|
|
8886
9015
|
var SET_SUSPENDED_STATE_DISCRIMINATOR = new Uint8Array([
|
|
8887
9016
|
145,
|
|
8888
9017
|
13,
|
|
@@ -8894,33 +9023,33 @@ var SET_SUSPENDED_STATE_DISCRIMINATOR = new Uint8Array([
|
|
|
8894
9023
|
32
|
|
8895
9024
|
]);
|
|
8896
9025
|
function getSetSuspendedStateDiscriminatorBytes() {
|
|
8897
|
-
return (0,
|
|
9026
|
+
return (0, import_kit63.fixEncoderSize)((0, import_kit63.getBytesEncoder)(), 8).encode(
|
|
8898
9027
|
SET_SUSPENDED_STATE_DISCRIMINATOR
|
|
8899
9028
|
);
|
|
8900
9029
|
}
|
|
8901
9030
|
function getSetSuspendedStateInstructionDataEncoder() {
|
|
8902
|
-
return (0,
|
|
8903
|
-
(0,
|
|
8904
|
-
["discriminator", (0,
|
|
8905
|
-
["suspendLendingDeposits", (0,
|
|
8906
|
-
["suspendLendingWithdrawals", (0,
|
|
8907
|
-
["suspendAddLiquidity", (0,
|
|
8908
|
-
["suspendRemoveLiquidity", (0,
|
|
9031
|
+
return (0, import_kit63.transformEncoder)(
|
|
9032
|
+
(0, import_kit63.getStructEncoder)([
|
|
9033
|
+
["discriminator", (0, import_kit63.fixEncoderSize)((0, import_kit63.getBytesEncoder)(), 8)],
|
|
9034
|
+
["suspendLendingDeposits", (0, import_kit63.getBooleanEncoder)()],
|
|
9035
|
+
["suspendLendingWithdrawals", (0, import_kit63.getBooleanEncoder)()],
|
|
9036
|
+
["suspendAddLiquidity", (0, import_kit63.getBooleanEncoder)()],
|
|
9037
|
+
["suspendRemoveLiquidity", (0, import_kit63.getBooleanEncoder)()]
|
|
8909
9038
|
]),
|
|
8910
9039
|
(value) => ({ ...value, discriminator: SET_SUSPENDED_STATE_DISCRIMINATOR })
|
|
8911
9040
|
);
|
|
8912
9041
|
}
|
|
8913
9042
|
function getSetSuspendedStateInstructionDataDecoder() {
|
|
8914
|
-
return (0,
|
|
8915
|
-
["discriminator", (0,
|
|
8916
|
-
["suspendLendingDeposits", (0,
|
|
8917
|
-
["suspendLendingWithdrawals", (0,
|
|
8918
|
-
["suspendAddLiquidity", (0,
|
|
8919
|
-
["suspendRemoveLiquidity", (0,
|
|
9043
|
+
return (0, import_kit63.getStructDecoder)([
|
|
9044
|
+
["discriminator", (0, import_kit63.fixDecoderSize)((0, import_kit63.getBytesDecoder)(), 8)],
|
|
9045
|
+
["suspendLendingDeposits", (0, import_kit63.getBooleanDecoder)()],
|
|
9046
|
+
["suspendLendingWithdrawals", (0, import_kit63.getBooleanDecoder)()],
|
|
9047
|
+
["suspendAddLiquidity", (0, import_kit63.getBooleanDecoder)()],
|
|
9048
|
+
["suspendRemoveLiquidity", (0, import_kit63.getBooleanDecoder)()]
|
|
8920
9049
|
]);
|
|
8921
9050
|
}
|
|
8922
9051
|
function getSetSuspendedStateInstructionDataCodec() {
|
|
8923
|
-
return (0,
|
|
9052
|
+
return (0, import_kit63.combineCodec)(
|
|
8924
9053
|
getSetSuspendedStateInstructionDataEncoder(),
|
|
8925
9054
|
getSetSuspendedStateInstructionDataDecoder()
|
|
8926
9055
|
);
|
|
@@ -8967,7 +9096,7 @@ function parseSetSuspendedStateInstruction(instruction) {
|
|
|
8967
9096
|
}
|
|
8968
9097
|
|
|
8969
9098
|
// src/generated/instructions/setTunaLpPositionFlags.ts
|
|
8970
|
-
var
|
|
9099
|
+
var import_kit64 = require("@solana/kit");
|
|
8971
9100
|
var SET_TUNA_LP_POSITION_FLAGS_DISCRIMINATOR = new Uint8Array([
|
|
8972
9101
|
110,
|
|
8973
9102
|
73,
|
|
@@ -8979,15 +9108,15 @@ var SET_TUNA_LP_POSITION_FLAGS_DISCRIMINATOR = new Uint8Array([
|
|
|
8979
9108
|
57
|
|
8980
9109
|
]);
|
|
8981
9110
|
function getSetTunaLpPositionFlagsDiscriminatorBytes() {
|
|
8982
|
-
return (0,
|
|
9111
|
+
return (0, import_kit64.fixEncoderSize)((0, import_kit64.getBytesEncoder)(), 8).encode(
|
|
8983
9112
|
SET_TUNA_LP_POSITION_FLAGS_DISCRIMINATOR
|
|
8984
9113
|
);
|
|
8985
9114
|
}
|
|
8986
9115
|
function getSetTunaLpPositionFlagsInstructionDataEncoder() {
|
|
8987
|
-
return (0,
|
|
8988
|
-
(0,
|
|
8989
|
-
["discriminator", (0,
|
|
8990
|
-
["flags", (0,
|
|
9116
|
+
return (0, import_kit64.transformEncoder)(
|
|
9117
|
+
(0, import_kit64.getStructEncoder)([
|
|
9118
|
+
["discriminator", (0, import_kit64.fixEncoderSize)((0, import_kit64.getBytesEncoder)(), 8)],
|
|
9119
|
+
["flags", (0, import_kit64.getU32Encoder)()]
|
|
8991
9120
|
]),
|
|
8992
9121
|
(value) => ({
|
|
8993
9122
|
...value,
|
|
@@ -8996,13 +9125,13 @@ function getSetTunaLpPositionFlagsInstructionDataEncoder() {
|
|
|
8996
9125
|
);
|
|
8997
9126
|
}
|
|
8998
9127
|
function getSetTunaLpPositionFlagsInstructionDataDecoder() {
|
|
8999
|
-
return (0,
|
|
9000
|
-
["discriminator", (0,
|
|
9001
|
-
["flags", (0,
|
|
9128
|
+
return (0, import_kit64.getStructDecoder)([
|
|
9129
|
+
["discriminator", (0, import_kit64.fixDecoderSize)((0, import_kit64.getBytesDecoder)(), 8)],
|
|
9130
|
+
["flags", (0, import_kit64.getU32Decoder)()]
|
|
9002
9131
|
]);
|
|
9003
9132
|
}
|
|
9004
9133
|
function getSetTunaLpPositionFlagsInstructionDataCodec() {
|
|
9005
|
-
return (0,
|
|
9134
|
+
return (0, import_kit64.combineCodec)(
|
|
9006
9135
|
getSetTunaLpPositionFlagsInstructionDataEncoder(),
|
|
9007
9136
|
getSetTunaLpPositionFlagsInstructionDataDecoder()
|
|
9008
9137
|
);
|
|
@@ -9051,7 +9180,7 @@ function parseSetTunaLpPositionFlagsInstruction(instruction) {
|
|
|
9051
9180
|
}
|
|
9052
9181
|
|
|
9053
9182
|
// src/generated/instructions/setTunaLpPositionLimitOrders.ts
|
|
9054
|
-
var
|
|
9183
|
+
var import_kit65 = require("@solana/kit");
|
|
9055
9184
|
var SET_TUNA_LP_POSITION_LIMIT_ORDERS_DISCRIMINATOR = new Uint8Array([
|
|
9056
9185
|
65,
|
|
9057
9186
|
128,
|
|
@@ -9063,17 +9192,17 @@ var SET_TUNA_LP_POSITION_LIMIT_ORDERS_DISCRIMINATOR = new Uint8Array([
|
|
|
9063
9192
|
255
|
|
9064
9193
|
]);
|
|
9065
9194
|
function getSetTunaLpPositionLimitOrdersDiscriminatorBytes() {
|
|
9066
|
-
return (0,
|
|
9195
|
+
return (0, import_kit65.fixEncoderSize)((0, import_kit65.getBytesEncoder)(), 8).encode(
|
|
9067
9196
|
SET_TUNA_LP_POSITION_LIMIT_ORDERS_DISCRIMINATOR
|
|
9068
9197
|
);
|
|
9069
9198
|
}
|
|
9070
9199
|
function getSetTunaLpPositionLimitOrdersInstructionDataEncoder() {
|
|
9071
|
-
return (0,
|
|
9072
|
-
(0,
|
|
9073
|
-
["discriminator", (0,
|
|
9074
|
-
["lowerLimitOrderSqrtPrice", (0,
|
|
9075
|
-
["upperLimitOrderSqrtPrice", (0,
|
|
9076
|
-
["swapToTokenOnLimitOrder", (0,
|
|
9200
|
+
return (0, import_kit65.transformEncoder)(
|
|
9201
|
+
(0, import_kit65.getStructEncoder)([
|
|
9202
|
+
["discriminator", (0, import_kit65.fixEncoderSize)((0, import_kit65.getBytesEncoder)(), 8)],
|
|
9203
|
+
["lowerLimitOrderSqrtPrice", (0, import_kit65.getU128Encoder)()],
|
|
9204
|
+
["upperLimitOrderSqrtPrice", (0, import_kit65.getU128Encoder)()],
|
|
9205
|
+
["swapToTokenOnLimitOrder", (0, import_kit65.getU8Encoder)()]
|
|
9077
9206
|
]),
|
|
9078
9207
|
(value) => ({
|
|
9079
9208
|
...value,
|
|
@@ -9082,15 +9211,15 @@ function getSetTunaLpPositionLimitOrdersInstructionDataEncoder() {
|
|
|
9082
9211
|
);
|
|
9083
9212
|
}
|
|
9084
9213
|
function getSetTunaLpPositionLimitOrdersInstructionDataDecoder() {
|
|
9085
|
-
return (0,
|
|
9086
|
-
["discriminator", (0,
|
|
9087
|
-
["lowerLimitOrderSqrtPrice", (0,
|
|
9088
|
-
["upperLimitOrderSqrtPrice", (0,
|
|
9089
|
-
["swapToTokenOnLimitOrder", (0,
|
|
9214
|
+
return (0, import_kit65.getStructDecoder)([
|
|
9215
|
+
["discriminator", (0, import_kit65.fixDecoderSize)((0, import_kit65.getBytesDecoder)(), 8)],
|
|
9216
|
+
["lowerLimitOrderSqrtPrice", (0, import_kit65.getU128Decoder)()],
|
|
9217
|
+
["upperLimitOrderSqrtPrice", (0, import_kit65.getU128Decoder)()],
|
|
9218
|
+
["swapToTokenOnLimitOrder", (0, import_kit65.getU8Decoder)()]
|
|
9090
9219
|
]);
|
|
9091
9220
|
}
|
|
9092
9221
|
function getSetTunaLpPositionLimitOrdersInstructionDataCodec() {
|
|
9093
|
-
return (0,
|
|
9222
|
+
return (0, import_kit65.combineCodec)(
|
|
9094
9223
|
getSetTunaLpPositionLimitOrdersInstructionDataEncoder(),
|
|
9095
9224
|
getSetTunaLpPositionLimitOrdersInstructionDataDecoder()
|
|
9096
9225
|
);
|
|
@@ -9139,18 +9268,18 @@ function parseSetTunaLpPositionLimitOrdersInstruction(instruction) {
|
|
|
9139
9268
|
}
|
|
9140
9269
|
|
|
9141
9270
|
// src/generated/instructions/setTunaLpPositionRebalanceThreshold.ts
|
|
9142
|
-
var
|
|
9271
|
+
var import_kit66 = require("@solana/kit");
|
|
9143
9272
|
var SET_TUNA_LP_POSITION_REBALANCE_THRESHOLD_DISCRIMINATOR = new Uint8Array([244, 174, 185, 58, 90, 150, 162, 51]);
|
|
9144
9273
|
function getSetTunaLpPositionRebalanceThresholdDiscriminatorBytes() {
|
|
9145
|
-
return (0,
|
|
9274
|
+
return (0, import_kit66.fixEncoderSize)((0, import_kit66.getBytesEncoder)(), 8).encode(
|
|
9146
9275
|
SET_TUNA_LP_POSITION_REBALANCE_THRESHOLD_DISCRIMINATOR
|
|
9147
9276
|
);
|
|
9148
9277
|
}
|
|
9149
9278
|
function getSetTunaLpPositionRebalanceThresholdInstructionDataEncoder() {
|
|
9150
|
-
return (0,
|
|
9151
|
-
(0,
|
|
9152
|
-
["discriminator", (0,
|
|
9153
|
-
["rebalanceThresholdTicks", (0,
|
|
9279
|
+
return (0, import_kit66.transformEncoder)(
|
|
9280
|
+
(0, import_kit66.getStructEncoder)([
|
|
9281
|
+
["discriminator", (0, import_kit66.fixEncoderSize)((0, import_kit66.getBytesEncoder)(), 8)],
|
|
9282
|
+
["rebalanceThresholdTicks", (0, import_kit66.getU32Encoder)()]
|
|
9154
9283
|
]),
|
|
9155
9284
|
(value) => ({
|
|
9156
9285
|
...value,
|
|
@@ -9159,13 +9288,13 @@ function getSetTunaLpPositionRebalanceThresholdInstructionDataEncoder() {
|
|
|
9159
9288
|
);
|
|
9160
9289
|
}
|
|
9161
9290
|
function getSetTunaLpPositionRebalanceThresholdInstructionDataDecoder() {
|
|
9162
|
-
return (0,
|
|
9163
|
-
["discriminator", (0,
|
|
9164
|
-
["rebalanceThresholdTicks", (0,
|
|
9291
|
+
return (0, import_kit66.getStructDecoder)([
|
|
9292
|
+
["discriminator", (0, import_kit66.fixDecoderSize)((0, import_kit66.getBytesDecoder)(), 8)],
|
|
9293
|
+
["rebalanceThresholdTicks", (0, import_kit66.getU32Decoder)()]
|
|
9165
9294
|
]);
|
|
9166
9295
|
}
|
|
9167
9296
|
function getSetTunaLpPositionRebalanceThresholdInstructionDataCodec() {
|
|
9168
|
-
return (0,
|
|
9297
|
+
return (0, import_kit66.combineCodec)(
|
|
9169
9298
|
getSetTunaLpPositionRebalanceThresholdInstructionDataEncoder(),
|
|
9170
9299
|
getSetTunaLpPositionRebalanceThresholdInstructionDataDecoder()
|
|
9171
9300
|
);
|
|
@@ -9214,21 +9343,21 @@ function parseSetTunaLpPositionRebalanceThresholdInstruction(instruction) {
|
|
|
9214
9343
|
}
|
|
9215
9344
|
|
|
9216
9345
|
// src/generated/instructions/setTunaSpotPositionLimitOrders.ts
|
|
9217
|
-
var
|
|
9346
|
+
var import_kit67 = require("@solana/kit");
|
|
9218
9347
|
var SET_TUNA_SPOT_POSITION_LIMIT_ORDERS_DISCRIMINATOR = new Uint8Array(
|
|
9219
9348
|
[10, 180, 19, 205, 169, 133, 52, 118]
|
|
9220
9349
|
);
|
|
9221
9350
|
function getSetTunaSpotPositionLimitOrdersDiscriminatorBytes() {
|
|
9222
|
-
return (0,
|
|
9351
|
+
return (0, import_kit67.fixEncoderSize)((0, import_kit67.getBytesEncoder)(), 8).encode(
|
|
9223
9352
|
SET_TUNA_SPOT_POSITION_LIMIT_ORDERS_DISCRIMINATOR
|
|
9224
9353
|
);
|
|
9225
9354
|
}
|
|
9226
9355
|
function getSetTunaSpotPositionLimitOrdersInstructionDataEncoder() {
|
|
9227
|
-
return (0,
|
|
9228
|
-
(0,
|
|
9229
|
-
["discriminator", (0,
|
|
9230
|
-
["lowerLimitOrderSqrtPrice", (0,
|
|
9231
|
-
["upperLimitOrderSqrtPrice", (0,
|
|
9356
|
+
return (0, import_kit67.transformEncoder)(
|
|
9357
|
+
(0, import_kit67.getStructEncoder)([
|
|
9358
|
+
["discriminator", (0, import_kit67.fixEncoderSize)((0, import_kit67.getBytesEncoder)(), 8)],
|
|
9359
|
+
["lowerLimitOrderSqrtPrice", (0, import_kit67.getU128Encoder)()],
|
|
9360
|
+
["upperLimitOrderSqrtPrice", (0, import_kit67.getU128Encoder)()]
|
|
9232
9361
|
]),
|
|
9233
9362
|
(value) => ({
|
|
9234
9363
|
...value,
|
|
@@ -9237,14 +9366,14 @@ function getSetTunaSpotPositionLimitOrdersInstructionDataEncoder() {
|
|
|
9237
9366
|
);
|
|
9238
9367
|
}
|
|
9239
9368
|
function getSetTunaSpotPositionLimitOrdersInstructionDataDecoder() {
|
|
9240
|
-
return (0,
|
|
9241
|
-
["discriminator", (0,
|
|
9242
|
-
["lowerLimitOrderSqrtPrice", (0,
|
|
9243
|
-
["upperLimitOrderSqrtPrice", (0,
|
|
9369
|
+
return (0, import_kit67.getStructDecoder)([
|
|
9370
|
+
["discriminator", (0, import_kit67.fixDecoderSize)((0, import_kit67.getBytesDecoder)(), 8)],
|
|
9371
|
+
["lowerLimitOrderSqrtPrice", (0, import_kit67.getU128Decoder)()],
|
|
9372
|
+
["upperLimitOrderSqrtPrice", (0, import_kit67.getU128Decoder)()]
|
|
9244
9373
|
]);
|
|
9245
9374
|
}
|
|
9246
9375
|
function getSetTunaSpotPositionLimitOrdersInstructionDataCodec() {
|
|
9247
|
-
return (0,
|
|
9376
|
+
return (0, import_kit67.combineCodec)(
|
|
9248
9377
|
getSetTunaSpotPositionLimitOrdersInstructionDataEncoder(),
|
|
9249
9378
|
getSetTunaSpotPositionLimitOrdersInstructionDataDecoder()
|
|
9250
9379
|
);
|
|
@@ -9293,7 +9422,7 @@ function parseSetTunaSpotPositionLimitOrdersInstruction(instruction) {
|
|
|
9293
9422
|
}
|
|
9294
9423
|
|
|
9295
9424
|
// src/generated/instructions/updateMarket.ts
|
|
9296
|
-
var
|
|
9425
|
+
var import_kit68 = require("@solana/kit");
|
|
9297
9426
|
var UPDATE_MARKET_DISCRIMINATOR = new Uint8Array([
|
|
9298
9427
|
153,
|
|
9299
9428
|
39,
|
|
@@ -9305,51 +9434,51 @@ var UPDATE_MARKET_DISCRIMINATOR = new Uint8Array([
|
|
|
9305
9434
|
217
|
|
9306
9435
|
]);
|
|
9307
9436
|
function getUpdateMarketDiscriminatorBytes() {
|
|
9308
|
-
return (0,
|
|
9437
|
+
return (0, import_kit68.fixEncoderSize)((0, import_kit68.getBytesEncoder)(), 8).encode(
|
|
9309
9438
|
UPDATE_MARKET_DISCRIMINATOR
|
|
9310
9439
|
);
|
|
9311
9440
|
}
|
|
9312
9441
|
function getUpdateMarketInstructionDataEncoder() {
|
|
9313
|
-
return (0,
|
|
9314
|
-
(0,
|
|
9315
|
-
["discriminator", (0,
|
|
9316
|
-
["addressLookupTable", (0,
|
|
9317
|
-
["maxLeverage", (0,
|
|
9318
|
-
["protocolFee", (0,
|
|
9319
|
-
["protocolFeeOnCollateral", (0,
|
|
9320
|
-
["liquidationFee", (0,
|
|
9321
|
-
["liquidationThreshold", (0,
|
|
9322
|
-
["limitOrderExecutionFee", (0,
|
|
9323
|
-
["oraclePriceDeviationThreshold", (0,
|
|
9324
|
-
["disabled", (0,
|
|
9325
|
-
["borrowLimitA", (0,
|
|
9326
|
-
["borrowLimitB", (0,
|
|
9327
|
-
["maxSwapSlippage", (0,
|
|
9328
|
-
["rebalanceProtocolFee", (0,
|
|
9442
|
+
return (0, import_kit68.transformEncoder)(
|
|
9443
|
+
(0, import_kit68.getStructEncoder)([
|
|
9444
|
+
["discriminator", (0, import_kit68.fixEncoderSize)((0, import_kit68.getBytesEncoder)(), 8)],
|
|
9445
|
+
["addressLookupTable", (0, import_kit68.getAddressEncoder)()],
|
|
9446
|
+
["maxLeverage", (0, import_kit68.getU32Encoder)()],
|
|
9447
|
+
["protocolFee", (0, import_kit68.getU16Encoder)()],
|
|
9448
|
+
["protocolFeeOnCollateral", (0, import_kit68.getU16Encoder)()],
|
|
9449
|
+
["liquidationFee", (0, import_kit68.getU32Encoder)()],
|
|
9450
|
+
["liquidationThreshold", (0, import_kit68.getU32Encoder)()],
|
|
9451
|
+
["limitOrderExecutionFee", (0, import_kit68.getU32Encoder)()],
|
|
9452
|
+
["oraclePriceDeviationThreshold", (0, import_kit68.getU32Encoder)()],
|
|
9453
|
+
["disabled", (0, import_kit68.getBooleanEncoder)()],
|
|
9454
|
+
["borrowLimitA", (0, import_kit68.getU64Encoder)()],
|
|
9455
|
+
["borrowLimitB", (0, import_kit68.getU64Encoder)()],
|
|
9456
|
+
["maxSwapSlippage", (0, import_kit68.getU32Encoder)()],
|
|
9457
|
+
["rebalanceProtocolFee", (0, import_kit68.getU32Encoder)()]
|
|
9329
9458
|
]),
|
|
9330
9459
|
(value) => ({ ...value, discriminator: UPDATE_MARKET_DISCRIMINATOR })
|
|
9331
9460
|
);
|
|
9332
9461
|
}
|
|
9333
9462
|
function getUpdateMarketInstructionDataDecoder() {
|
|
9334
|
-
return (0,
|
|
9335
|
-
["discriminator", (0,
|
|
9336
|
-
["addressLookupTable", (0,
|
|
9337
|
-
["maxLeverage", (0,
|
|
9338
|
-
["protocolFee", (0,
|
|
9339
|
-
["protocolFeeOnCollateral", (0,
|
|
9340
|
-
["liquidationFee", (0,
|
|
9341
|
-
["liquidationThreshold", (0,
|
|
9342
|
-
["limitOrderExecutionFee", (0,
|
|
9343
|
-
["oraclePriceDeviationThreshold", (0,
|
|
9344
|
-
["disabled", (0,
|
|
9345
|
-
["borrowLimitA", (0,
|
|
9346
|
-
["borrowLimitB", (0,
|
|
9347
|
-
["maxSwapSlippage", (0,
|
|
9348
|
-
["rebalanceProtocolFee", (0,
|
|
9463
|
+
return (0, import_kit68.getStructDecoder)([
|
|
9464
|
+
["discriminator", (0, import_kit68.fixDecoderSize)((0, import_kit68.getBytesDecoder)(), 8)],
|
|
9465
|
+
["addressLookupTable", (0, import_kit68.getAddressDecoder)()],
|
|
9466
|
+
["maxLeverage", (0, import_kit68.getU32Decoder)()],
|
|
9467
|
+
["protocolFee", (0, import_kit68.getU16Decoder)()],
|
|
9468
|
+
["protocolFeeOnCollateral", (0, import_kit68.getU16Decoder)()],
|
|
9469
|
+
["liquidationFee", (0, import_kit68.getU32Decoder)()],
|
|
9470
|
+
["liquidationThreshold", (0, import_kit68.getU32Decoder)()],
|
|
9471
|
+
["limitOrderExecutionFee", (0, import_kit68.getU32Decoder)()],
|
|
9472
|
+
["oraclePriceDeviationThreshold", (0, import_kit68.getU32Decoder)()],
|
|
9473
|
+
["disabled", (0, import_kit68.getBooleanDecoder)()],
|
|
9474
|
+
["borrowLimitA", (0, import_kit68.getU64Decoder)()],
|
|
9475
|
+
["borrowLimitB", (0, import_kit68.getU64Decoder)()],
|
|
9476
|
+
["maxSwapSlippage", (0, import_kit68.getU32Decoder)()],
|
|
9477
|
+
["rebalanceProtocolFee", (0, import_kit68.getU32Decoder)()]
|
|
9349
9478
|
]);
|
|
9350
9479
|
}
|
|
9351
9480
|
function getUpdateMarketInstructionDataCodec() {
|
|
9352
|
-
return (0,
|
|
9481
|
+
return (0, import_kit68.combineCodec)(
|
|
9353
9482
|
getUpdateMarketInstructionDataEncoder(),
|
|
9354
9483
|
getUpdateMarketInstructionDataDecoder()
|
|
9355
9484
|
);
|
|
@@ -9399,7 +9528,7 @@ function parseUpdateMarketInstruction(instruction) {
|
|
|
9399
9528
|
}
|
|
9400
9529
|
|
|
9401
9530
|
// src/generated/instructions/updateVault.ts
|
|
9402
|
-
var
|
|
9531
|
+
var import_kit69 = require("@solana/kit");
|
|
9403
9532
|
var UPDATE_VAULT_DISCRIMINATOR = new Uint8Array([
|
|
9404
9533
|
67,
|
|
9405
9534
|
229,
|
|
@@ -9411,33 +9540,33 @@ var UPDATE_VAULT_DISCRIMINATOR = new Uint8Array([
|
|
|
9411
9540
|
60
|
|
9412
9541
|
]);
|
|
9413
9542
|
function getUpdateVaultDiscriminatorBytes() {
|
|
9414
|
-
return (0,
|
|
9543
|
+
return (0, import_kit69.fixEncoderSize)((0, import_kit69.getBytesEncoder)(), 8).encode(
|
|
9415
9544
|
UPDATE_VAULT_DISCRIMINATOR
|
|
9416
9545
|
);
|
|
9417
9546
|
}
|
|
9418
9547
|
function getUpdateVaultInstructionDataEncoder() {
|
|
9419
|
-
return (0,
|
|
9420
|
-
(0,
|
|
9421
|
-
["discriminator", (0,
|
|
9422
|
-
["interestRate", (0,
|
|
9423
|
-
["supplyLimit", (0,
|
|
9424
|
-
["pythOraclePriceUpdate", (0,
|
|
9425
|
-
["pythOracleFeedId", (0,
|
|
9548
|
+
return (0, import_kit69.transformEncoder)(
|
|
9549
|
+
(0, import_kit69.getStructEncoder)([
|
|
9550
|
+
["discriminator", (0, import_kit69.fixEncoderSize)((0, import_kit69.getBytesEncoder)(), 8)],
|
|
9551
|
+
["interestRate", (0, import_kit69.getU64Encoder)()],
|
|
9552
|
+
["supplyLimit", (0, import_kit69.getU64Encoder)()],
|
|
9553
|
+
["pythOraclePriceUpdate", (0, import_kit69.getAddressEncoder)()],
|
|
9554
|
+
["pythOracleFeedId", (0, import_kit69.getAddressEncoder)()]
|
|
9426
9555
|
]),
|
|
9427
9556
|
(value) => ({ ...value, discriminator: UPDATE_VAULT_DISCRIMINATOR })
|
|
9428
9557
|
);
|
|
9429
9558
|
}
|
|
9430
9559
|
function getUpdateVaultInstructionDataDecoder() {
|
|
9431
|
-
return (0,
|
|
9432
|
-
["discriminator", (0,
|
|
9433
|
-
["interestRate", (0,
|
|
9434
|
-
["supplyLimit", (0,
|
|
9435
|
-
["pythOraclePriceUpdate", (0,
|
|
9436
|
-
["pythOracleFeedId", (0,
|
|
9560
|
+
return (0, import_kit69.getStructDecoder)([
|
|
9561
|
+
["discriminator", (0, import_kit69.fixDecoderSize)((0, import_kit69.getBytesDecoder)(), 8)],
|
|
9562
|
+
["interestRate", (0, import_kit69.getU64Decoder)()],
|
|
9563
|
+
["supplyLimit", (0, import_kit69.getU64Decoder)()],
|
|
9564
|
+
["pythOraclePriceUpdate", (0, import_kit69.getAddressDecoder)()],
|
|
9565
|
+
["pythOracleFeedId", (0, import_kit69.getAddressDecoder)()]
|
|
9437
9566
|
]);
|
|
9438
9567
|
}
|
|
9439
9568
|
function getUpdateVaultInstructionDataCodec() {
|
|
9440
|
-
return (0,
|
|
9569
|
+
return (0, import_kit69.combineCodec)(
|
|
9441
9570
|
getUpdateVaultInstructionDataEncoder(),
|
|
9442
9571
|
getUpdateVaultInstructionDataDecoder()
|
|
9443
9572
|
);
|
|
@@ -9487,7 +9616,7 @@ function parseUpdateVaultInstruction(instruction) {
|
|
|
9487
9616
|
}
|
|
9488
9617
|
|
|
9489
9618
|
// src/generated/instructions/withdraw.ts
|
|
9490
|
-
var
|
|
9619
|
+
var import_kit70 = require("@solana/kit");
|
|
9491
9620
|
var WITHDRAW_DISCRIMINATOR = new Uint8Array([
|
|
9492
9621
|
183,
|
|
9493
9622
|
18,
|
|
@@ -9499,27 +9628,27 @@ var WITHDRAW_DISCRIMINATOR = new Uint8Array([
|
|
|
9499
9628
|
34
|
|
9500
9629
|
]);
|
|
9501
9630
|
function getWithdrawDiscriminatorBytes() {
|
|
9502
|
-
return (0,
|
|
9631
|
+
return (0, import_kit70.fixEncoderSize)((0, import_kit70.getBytesEncoder)(), 8).encode(WITHDRAW_DISCRIMINATOR);
|
|
9503
9632
|
}
|
|
9504
9633
|
function getWithdrawInstructionDataEncoder() {
|
|
9505
|
-
return (0,
|
|
9506
|
-
(0,
|
|
9507
|
-
["discriminator", (0,
|
|
9508
|
-
["funds", (0,
|
|
9509
|
-
["shares", (0,
|
|
9634
|
+
return (0, import_kit70.transformEncoder)(
|
|
9635
|
+
(0, import_kit70.getStructEncoder)([
|
|
9636
|
+
["discriminator", (0, import_kit70.fixEncoderSize)((0, import_kit70.getBytesEncoder)(), 8)],
|
|
9637
|
+
["funds", (0, import_kit70.getU64Encoder)()],
|
|
9638
|
+
["shares", (0, import_kit70.getU64Encoder)()]
|
|
9510
9639
|
]),
|
|
9511
9640
|
(value) => ({ ...value, discriminator: WITHDRAW_DISCRIMINATOR })
|
|
9512
9641
|
);
|
|
9513
9642
|
}
|
|
9514
9643
|
function getWithdrawInstructionDataDecoder() {
|
|
9515
|
-
return (0,
|
|
9516
|
-
["discriminator", (0,
|
|
9517
|
-
["funds", (0,
|
|
9518
|
-
["shares", (0,
|
|
9644
|
+
return (0, import_kit70.getStructDecoder)([
|
|
9645
|
+
["discriminator", (0, import_kit70.fixDecoderSize)((0, import_kit70.getBytesDecoder)(), 8)],
|
|
9646
|
+
["funds", (0, import_kit70.getU64Decoder)()],
|
|
9647
|
+
["shares", (0, import_kit70.getU64Decoder)()]
|
|
9519
9648
|
]);
|
|
9520
9649
|
}
|
|
9521
9650
|
function getWithdrawInstructionDataCodec() {
|
|
9522
|
-
return (0,
|
|
9651
|
+
return (0, import_kit70.combineCodec)(
|
|
9523
9652
|
getWithdrawInstructionDataEncoder(),
|
|
9524
9653
|
getWithdrawInstructionDataDecoder()
|
|
9525
9654
|
);
|
|
@@ -9590,55 +9719,102 @@ function parseWithdrawInstruction(instruction) {
|
|
|
9590
9719
|
}
|
|
9591
9720
|
|
|
9592
9721
|
// src/pda.ts
|
|
9593
|
-
var
|
|
9722
|
+
var import_kit72 = require("@solana/kit");
|
|
9723
|
+
|
|
9724
|
+
// src/consts.ts
|
|
9725
|
+
var import_kit71 = require("@solana/kit");
|
|
9726
|
+
var DEFAULT_ADDRESS = (0, import_kit71.address)("11111111111111111111111111111111");
|
|
9727
|
+
var HUNDRED_PERCENT = 1e6;
|
|
9728
|
+
var LEVERAGE_ONE = HUNDRED_PERCENT;
|
|
9729
|
+
var MAX_LEVERAGE = 11 * LEVERAGE_ONE;
|
|
9730
|
+
var MAX_PROTOCOL_FEE = HUNDRED_PERCENT / 100;
|
|
9731
|
+
var MAX_LIQUIDATION_FEE = HUNDRED_PERCENT / 5;
|
|
9732
|
+
var MAX_LIMIT_ORDER_EXECUTION_FEE = HUNDRED_PERCENT / 100;
|
|
9733
|
+
var DEFAULT_MAX_SWAP_SLIPPAGE = HUNDRED_PERCENT / 50;
|
|
9734
|
+
var MAX_LIQUIDATION_THRESHOLD = HUNDRED_PERCENT * 95 / 100;
|
|
9735
|
+
var NO_LOWER_LIMIT_ORDER = -2147483648;
|
|
9736
|
+
var NO_UPPER_LIMIT_ORDER = 2147483647;
|
|
9737
|
+
var COMPUTED_AMOUNT = 18446744073709551615n;
|
|
9738
|
+
var UNLIMITED_SUPPLY_LIMIT = 18446744073709551615n;
|
|
9739
|
+
var TUNA_POSITION_FLAGS_LOWER_LIMIT_ORDER_SWAP_TO_TOKEN_A = 1;
|
|
9740
|
+
var TUNA_POSITION_FLAGS_LOWER_LIMIT_ORDER_SWAP_TO_TOKEN_B = 1 << 1;
|
|
9741
|
+
var TUNA_POSITION_FLAGS_UPPER_LIMIT_ORDER_SWAP_TO_TOKEN_A = 1 << 2;
|
|
9742
|
+
var TUNA_POSITION_FLAGS_UPPER_LIMIT_ORDER_SWAP_TO_TOKEN_B = 1 << 3;
|
|
9743
|
+
var TUNA_POSITION_FLAGS_AUTO_COMPOUND_YIELD = 1 << 4;
|
|
9744
|
+
var TUNA_POSITION_FLAGS_AUTO_COMPOUND_YIELD_WITH_LEVERAGE = 1 << 5;
|
|
9745
|
+
var TUNA_POSITION_FLAGS_ALLOW_REBALANCING = 1 << 6;
|
|
9746
|
+
var WP_NFT_UPDATE_AUTH = (0, import_kit71.address)("3axbTs2z5GBy6usVbNVoqEgZMng3vZvMnAoX29BFfwhr");
|
|
9747
|
+
var DEFAULT_PUSH_ORACLE_PROGRAM_ID = (0, import_kit71.address)("pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT");
|
|
9748
|
+
var MIN_SQRT_PRICE = 4295048016n;
|
|
9749
|
+
var MAX_SQRT_PRICE = 79226673515401279992447579055n;
|
|
9750
|
+
|
|
9751
|
+
// src/pda.ts
|
|
9594
9752
|
async function getTunaConfigAddress() {
|
|
9595
|
-
return await (0,
|
|
9753
|
+
return await (0, import_kit72.getProgramDerivedAddress)({
|
|
9596
9754
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
9597
9755
|
seeds: ["tuna_config"]
|
|
9598
9756
|
});
|
|
9599
9757
|
}
|
|
9600
9758
|
async function getMarketAddress(pool) {
|
|
9601
|
-
return await (0,
|
|
9759
|
+
return await (0, import_kit72.getProgramDerivedAddress)({
|
|
9602
9760
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
9603
|
-
seeds: ["market", (0,
|
|
9761
|
+
seeds: ["market", (0, import_kit72.getAddressEncoder)().encode(pool)]
|
|
9604
9762
|
});
|
|
9605
9763
|
}
|
|
9606
9764
|
async function getLendingVaultAddress(mint) {
|
|
9607
|
-
return await (0,
|
|
9765
|
+
return await (0, import_kit72.getProgramDerivedAddress)({
|
|
9608
9766
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
9609
|
-
seeds: ["vault", (0,
|
|
9767
|
+
seeds: ["vault", (0, import_kit72.getAddressEncoder)().encode(mint)]
|
|
9610
9768
|
});
|
|
9611
9769
|
}
|
|
9612
9770
|
async function getLendingPositionAddress(wallet, mint) {
|
|
9613
|
-
return await (0,
|
|
9771
|
+
return await (0, import_kit72.getProgramDerivedAddress)({
|
|
9614
9772
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
9615
|
-
seeds: ["lending_position", (0,
|
|
9773
|
+
seeds: ["lending_position", (0, import_kit72.getAddressEncoder)().encode(wallet), (0, import_kit72.getAddressEncoder)().encode(mint)]
|
|
9616
9774
|
});
|
|
9617
9775
|
}
|
|
9618
9776
|
async function getTunaLpPositionAddress(positionMint) {
|
|
9619
|
-
return await (0,
|
|
9777
|
+
return await (0, import_kit72.getProgramDerivedAddress)({
|
|
9620
9778
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
9621
|
-
seeds: ["tuna_position", (0,
|
|
9779
|
+
seeds: ["tuna_position", (0, import_kit72.getAddressEncoder)().encode(positionMint)]
|
|
9622
9780
|
});
|
|
9623
9781
|
}
|
|
9624
9782
|
async function getTunaSpotPositionAddress(positionMint) {
|
|
9625
|
-
return await (0,
|
|
9783
|
+
return await (0, import_kit72.getProgramDerivedAddress)({
|
|
9626
9784
|
programAddress: TUNA_PROGRAM_ADDRESS,
|
|
9627
|
-
seeds: ["tuna_spot_position", (0,
|
|
9785
|
+
seeds: ["tuna_spot_position", (0, import_kit72.getAddressEncoder)().encode(positionMint)]
|
|
9786
|
+
});
|
|
9787
|
+
}
|
|
9788
|
+
async function getPythPriceUpdateAccountAddress(shardId, priceFeedId) {
|
|
9789
|
+
if (typeof priceFeedId == "string") {
|
|
9790
|
+
if (priceFeedId.startsWith("0x")) {
|
|
9791
|
+
priceFeedId = Buffer.from(priceFeedId.slice(2), "hex");
|
|
9792
|
+
} else {
|
|
9793
|
+
priceFeedId = Buffer.from(priceFeedId, "hex");
|
|
9794
|
+
}
|
|
9795
|
+
}
|
|
9796
|
+
if (priceFeedId.length != 32) {
|
|
9797
|
+
throw new Error("Feed ID should be 32 bytes long");
|
|
9798
|
+
}
|
|
9799
|
+
const shardBuffer = Buffer.alloc(2);
|
|
9800
|
+
shardBuffer.writeUint16LE(shardId, 0);
|
|
9801
|
+
return await (0, import_kit72.getProgramDerivedAddress)({
|
|
9802
|
+
programAddress: DEFAULT_PUSH_ORACLE_PROGRAM_ID,
|
|
9803
|
+
seeds: [shardBuffer, priceFeedId]
|
|
9628
9804
|
});
|
|
9629
9805
|
}
|
|
9630
9806
|
|
|
9631
9807
|
// src/gpa/tunaLpPosition.ts
|
|
9632
|
-
var
|
|
9808
|
+
var import_kit74 = require("@solana/kit");
|
|
9633
9809
|
|
|
9634
9810
|
// src/gpa/utils.ts
|
|
9635
|
-
var
|
|
9811
|
+
var import_kit73 = require("@solana/kit");
|
|
9636
9812
|
async function fetchDecodedProgramAccounts(rpc, programAddress, filters, decoder) {
|
|
9637
9813
|
const accountInfos = await rpc.getProgramAccounts(programAddress, {
|
|
9638
9814
|
encoding: "base64",
|
|
9639
9815
|
filters
|
|
9640
9816
|
}).send();
|
|
9641
|
-
const encoder = (0,
|
|
9817
|
+
const encoder = (0, import_kit73.getBase64Encoder)();
|
|
9642
9818
|
const datas = accountInfos.map((x) => encoder.encode(x.account.data[0]));
|
|
9643
9819
|
const decoded = datas.map((x) => decoder.decode(x));
|
|
9644
9820
|
return decoded.map((data, i) => ({
|
|
@@ -9654,7 +9830,7 @@ function tunaLpPositionAuthorityFilter(address4) {
|
|
|
9654
9830
|
return {
|
|
9655
9831
|
memcmp: {
|
|
9656
9832
|
offset: 11n,
|
|
9657
|
-
bytes: (0,
|
|
9833
|
+
bytes: (0, import_kit74.getBase58Decoder)().decode((0, import_kit74.getAddressEncoder)().encode(address4)),
|
|
9658
9834
|
encoding: "base58"
|
|
9659
9835
|
}
|
|
9660
9836
|
};
|
|
@@ -9663,7 +9839,7 @@ function tunaLpPositionPoolFilter(address4) {
|
|
|
9663
9839
|
return {
|
|
9664
9840
|
memcmp: {
|
|
9665
9841
|
offset: 43n,
|
|
9666
|
-
bytes: (0,
|
|
9842
|
+
bytes: (0, import_kit74.getBase58Decoder)().decode((0, import_kit74.getAddressEncoder)().encode(address4)),
|
|
9667
9843
|
encoding: "base58"
|
|
9668
9844
|
}
|
|
9669
9845
|
};
|
|
@@ -9672,7 +9848,7 @@ function tunaLpPositionMintAFilter(address4) {
|
|
|
9672
9848
|
return {
|
|
9673
9849
|
memcmp: {
|
|
9674
9850
|
offset: 75n,
|
|
9675
|
-
bytes: (0,
|
|
9851
|
+
bytes: (0, import_kit74.getBase58Decoder)().decode((0, import_kit74.getAddressEncoder)().encode(address4)),
|
|
9676
9852
|
encoding: "base58"
|
|
9677
9853
|
}
|
|
9678
9854
|
};
|
|
@@ -9681,7 +9857,7 @@ function tunaLpPositionMintBFilter(address4) {
|
|
|
9681
9857
|
return {
|
|
9682
9858
|
memcmp: {
|
|
9683
9859
|
offset: 107n,
|
|
9684
|
-
bytes: (0,
|
|
9860
|
+
bytes: (0, import_kit74.getBase58Decoder)().decode((0, import_kit74.getAddressEncoder)().encode(address4)),
|
|
9685
9861
|
encoding: "base58"
|
|
9686
9862
|
}
|
|
9687
9863
|
};
|
|
@@ -9690,7 +9866,7 @@ function tunaLpPositionMintFilter(address4) {
|
|
|
9690
9866
|
return {
|
|
9691
9867
|
memcmp: {
|
|
9692
9868
|
offset: 139n,
|
|
9693
|
-
bytes: (0,
|
|
9869
|
+
bytes: (0, import_kit74.getBase58Decoder)().decode((0, import_kit74.getAddressEncoder)().encode(address4)),
|
|
9694
9870
|
encoding: "base58"
|
|
9695
9871
|
}
|
|
9696
9872
|
};
|
|
@@ -9699,13 +9875,13 @@ function tunaLpPositionMarketMakerFilter(marketMaker) {
|
|
|
9699
9875
|
return {
|
|
9700
9876
|
memcmp: {
|
|
9701
9877
|
offset: 277n,
|
|
9702
|
-
bytes: (0,
|
|
9878
|
+
bytes: (0, import_kit74.getBase58Decoder)().decode((0, import_kit74.getI8Encoder)().encode(marketMaker)),
|
|
9703
9879
|
encoding: "base58"
|
|
9704
9880
|
}
|
|
9705
9881
|
};
|
|
9706
9882
|
}
|
|
9707
9883
|
async function fetchAllTunaLpPositionWithFilter(rpc, ...filters) {
|
|
9708
|
-
const discriminator = (0,
|
|
9884
|
+
const discriminator = (0, import_kit74.getBase58Decoder)().decode(TUNA_LP_POSITION_DISCRIMINATOR);
|
|
9709
9885
|
const discriminatorFilter = {
|
|
9710
9886
|
memcmp: {
|
|
9711
9887
|
offset: 0n,
|
|
@@ -9722,12 +9898,12 @@ async function fetchAllTunaLpPositionWithFilter(rpc, ...filters) {
|
|
|
9722
9898
|
}
|
|
9723
9899
|
|
|
9724
9900
|
// src/gpa/tunaSpotPosition.ts
|
|
9725
|
-
var
|
|
9901
|
+
var import_kit75 = require("@solana/kit");
|
|
9726
9902
|
function tunaSpotPositionAuthorityFilter(address4) {
|
|
9727
9903
|
return {
|
|
9728
9904
|
memcmp: {
|
|
9729
9905
|
offset: 11n,
|
|
9730
|
-
bytes: (0,
|
|
9906
|
+
bytes: (0, import_kit75.getBase58Decoder)().decode((0, import_kit75.getAddressEncoder)().encode(address4)),
|
|
9731
9907
|
encoding: "base58"
|
|
9732
9908
|
}
|
|
9733
9909
|
};
|
|
@@ -9736,7 +9912,7 @@ function tunaSpotPositionPoolFilter(address4) {
|
|
|
9736
9912
|
return {
|
|
9737
9913
|
memcmp: {
|
|
9738
9914
|
offset: 43n,
|
|
9739
|
-
bytes: (0,
|
|
9915
|
+
bytes: (0, import_kit75.getBase58Decoder)().decode((0, import_kit75.getAddressEncoder)().encode(address4)),
|
|
9740
9916
|
encoding: "base58"
|
|
9741
9917
|
}
|
|
9742
9918
|
};
|
|
@@ -9745,7 +9921,7 @@ function tunaSpotPositionMintAFilter(address4) {
|
|
|
9745
9921
|
return {
|
|
9746
9922
|
memcmp: {
|
|
9747
9923
|
offset: 75n,
|
|
9748
|
-
bytes: (0,
|
|
9924
|
+
bytes: (0, import_kit75.getBase58Decoder)().decode((0, import_kit75.getAddressEncoder)().encode(address4)),
|
|
9749
9925
|
encoding: "base58"
|
|
9750
9926
|
}
|
|
9751
9927
|
};
|
|
@@ -9754,7 +9930,7 @@ function tunaSpotPositionMintBFilter(address4) {
|
|
|
9754
9930
|
return {
|
|
9755
9931
|
memcmp: {
|
|
9756
9932
|
offset: 107n,
|
|
9757
|
-
bytes: (0,
|
|
9933
|
+
bytes: (0, import_kit75.getBase58Decoder)().decode((0, import_kit75.getAddressEncoder)().encode(address4)),
|
|
9758
9934
|
encoding: "base58"
|
|
9759
9935
|
}
|
|
9760
9936
|
};
|
|
@@ -9763,13 +9939,13 @@ function tunaSpotPositionMintFilter(address4) {
|
|
|
9763
9939
|
return {
|
|
9764
9940
|
memcmp: {
|
|
9765
9941
|
offset: 139n,
|
|
9766
|
-
bytes: (0,
|
|
9942
|
+
bytes: (0, import_kit75.getBase58Decoder)().decode((0, import_kit75.getAddressEncoder)().encode(address4)),
|
|
9767
9943
|
encoding: "base58"
|
|
9768
9944
|
}
|
|
9769
9945
|
};
|
|
9770
9946
|
}
|
|
9771
9947
|
async function fetchAllTunaSpotPositionWithFilter(rpc, ...filters) {
|
|
9772
|
-
const discriminator = (0,
|
|
9948
|
+
const discriminator = (0, import_kit75.getBase58Decoder)().decode(TUNA_SPOT_POSITION_DISCRIMINATOR);
|
|
9773
9949
|
const discriminatorFilter = {
|
|
9774
9950
|
memcmp: {
|
|
9775
9951
|
offset: 0n,
|
|
@@ -9786,12 +9962,12 @@ async function fetchAllTunaSpotPositionWithFilter(rpc, ...filters) {
|
|
|
9786
9962
|
}
|
|
9787
9963
|
|
|
9788
9964
|
// src/gpa/lendingPosition.ts
|
|
9789
|
-
var
|
|
9965
|
+
var import_kit76 = require("@solana/kit");
|
|
9790
9966
|
function lendingPositionAuthorityFilter(address4) {
|
|
9791
9967
|
return {
|
|
9792
9968
|
memcmp: {
|
|
9793
9969
|
offset: 11n,
|
|
9794
|
-
bytes: (0,
|
|
9970
|
+
bytes: (0, import_kit76.getBase58Decoder)().decode((0, import_kit76.getAddressEncoder)().encode(address4)),
|
|
9795
9971
|
encoding: "base58"
|
|
9796
9972
|
}
|
|
9797
9973
|
};
|
|
@@ -9800,13 +9976,13 @@ function lendingPositionMintFilter(address4) {
|
|
|
9800
9976
|
return {
|
|
9801
9977
|
memcmp: {
|
|
9802
9978
|
offset: 43n,
|
|
9803
|
-
bytes: (0,
|
|
9979
|
+
bytes: (0, import_kit76.getBase58Decoder)().decode((0, import_kit76.getAddressEncoder)().encode(address4)),
|
|
9804
9980
|
encoding: "base58"
|
|
9805
9981
|
}
|
|
9806
9982
|
};
|
|
9807
9983
|
}
|
|
9808
9984
|
async function fetchAllLendingPositionWithFilter(rpc, ...filters) {
|
|
9809
|
-
const discriminator = (0,
|
|
9985
|
+
const discriminator = (0, import_kit76.getBase58Decoder)().decode(LENDING_POSITION_DISCRIMINATOR);
|
|
9810
9986
|
const discriminatorFilter = {
|
|
9811
9987
|
memcmp: {
|
|
9812
9988
|
offset: 0n,
|
|
@@ -9823,9 +9999,9 @@ async function fetchAllLendingPositionWithFilter(rpc, ...filters) {
|
|
|
9823
9999
|
}
|
|
9824
10000
|
|
|
9825
10001
|
// src/gpa/market.ts
|
|
9826
|
-
var
|
|
10002
|
+
var import_kit77 = require("@solana/kit");
|
|
9827
10003
|
async function fetchAllMarketWithFilter(rpc, ...filters) {
|
|
9828
|
-
const discriminator = (0,
|
|
10004
|
+
const discriminator = (0, import_kit77.getBase58Decoder)().decode(MARKET_DISCRIMINATOR);
|
|
9829
10005
|
const discriminatorFilter = {
|
|
9830
10006
|
memcmp: {
|
|
9831
10007
|
offset: 0n,
|
|
@@ -9918,11 +10094,11 @@ var FusionUtils = class {
|
|
|
9918
10094
|
};
|
|
9919
10095
|
|
|
9920
10096
|
// src/utils/token.ts
|
|
9921
|
-
var
|
|
10097
|
+
var import_kit78 = require("@solana/kit");
|
|
9922
10098
|
var import_system = require("@solana-program/system");
|
|
9923
10099
|
var import_token = require("@solana-program/token");
|
|
9924
10100
|
var import_token_2022 = require("@solana-program/token-2022");
|
|
9925
|
-
var NATIVE_MINT = (0,
|
|
10101
|
+
var NATIVE_MINT = (0, import_kit78.address)("So11111111111111111111111111111111111111112");
|
|
9926
10102
|
async function getCreateAtaInstruction(mint, owner, payer, tokenProgram = import_token.TOKEN_PROGRAM_ADDRESS) {
|
|
9927
10103
|
const ata = (await (0, import_token.findAssociatedTokenPda)({
|
|
9928
10104
|
mint,
|
|
@@ -9987,34 +10163,6 @@ async function createAddressLookupTableInstructions(authority, addresses, recent
|
|
|
9987
10163
|
|
|
9988
10164
|
// src/utils/positionMath.ts
|
|
9989
10165
|
var import_fusionamm_core3 = require("@crypticdot/fusionamm-core");
|
|
9990
|
-
|
|
9991
|
-
// src/consts.ts
|
|
9992
|
-
var import_kit77 = require("@solana/kit");
|
|
9993
|
-
var DEFAULT_ADDRESS = (0, import_kit77.address)("11111111111111111111111111111111");
|
|
9994
|
-
var HUNDRED_PERCENT = 1e6;
|
|
9995
|
-
var LEVERAGE_ONE = HUNDRED_PERCENT;
|
|
9996
|
-
var MAX_LEVERAGE = 11 * LEVERAGE_ONE;
|
|
9997
|
-
var MAX_PROTOCOL_FEE = HUNDRED_PERCENT / 100;
|
|
9998
|
-
var MAX_LIQUIDATION_FEE = HUNDRED_PERCENT / 5;
|
|
9999
|
-
var MAX_LIMIT_ORDER_EXECUTION_FEE = HUNDRED_PERCENT / 100;
|
|
10000
|
-
var DEFAULT_MAX_SWAP_SLIPPAGE = HUNDRED_PERCENT / 50;
|
|
10001
|
-
var MAX_LIQUIDATION_THRESHOLD = HUNDRED_PERCENT * 95 / 100;
|
|
10002
|
-
var NO_LOWER_LIMIT_ORDER = -2147483648;
|
|
10003
|
-
var NO_UPPER_LIMIT_ORDER = 2147483647;
|
|
10004
|
-
var COMPUTED_AMOUNT = 18446744073709551615n;
|
|
10005
|
-
var UNLIMITED_SUPPLY_LIMIT = 18446744073709551615n;
|
|
10006
|
-
var TUNA_POSITION_FLAGS_LOWER_LIMIT_ORDER_SWAP_TO_TOKEN_A = 1;
|
|
10007
|
-
var TUNA_POSITION_FLAGS_LOWER_LIMIT_ORDER_SWAP_TO_TOKEN_B = 1 << 1;
|
|
10008
|
-
var TUNA_POSITION_FLAGS_UPPER_LIMIT_ORDER_SWAP_TO_TOKEN_A = 1 << 2;
|
|
10009
|
-
var TUNA_POSITION_FLAGS_UPPER_LIMIT_ORDER_SWAP_TO_TOKEN_B = 1 << 3;
|
|
10010
|
-
var TUNA_POSITION_FLAGS_AUTO_COMPOUND_YIELD = 1 << 4;
|
|
10011
|
-
var TUNA_POSITION_FLAGS_AUTO_COMPOUND_YIELD_WITH_LEVERAGE = 1 << 5;
|
|
10012
|
-
var TUNA_POSITION_FLAGS_ALLOW_REBALANCING = 1 << 6;
|
|
10013
|
-
var WP_NFT_UPDATE_AUTH = (0, import_kit77.address)("3axbTs2z5GBy6usVbNVoqEgZMng3vZvMnAoX29BFfwhr");
|
|
10014
|
-
var MIN_SQRT_PRICE = 4295048016n;
|
|
10015
|
-
var MAX_SQRT_PRICE = 79226673515401279992447579055n;
|
|
10016
|
-
|
|
10017
|
-
// src/utils/positionMath.ts
|
|
10018
10166
|
var DEFAULT_MAX_AMOUNT_SLIPPAGE = HUNDRED_PERCENT / 2;
|
|
10019
10167
|
function getLiquidityIncreaseQuote(args) {
|
|
10020
10168
|
const { protocolFeeRate, protocolFeeRateOnCollateral, swapFeeRate, sqrtPrice, tickLowerIndex, tickUpperIndex } = args;
|
|
@@ -10122,7 +10270,7 @@ function calculateProtocolFee(collateralAmount, borrowAmount, protocolFeeRateOnC
|
|
|
10122
10270
|
// src/txbuilder/increaseTunaLpPositionOrca.ts
|
|
10123
10271
|
var import_whirlpools_client2 = require("@orca-so/whirlpools-client");
|
|
10124
10272
|
var import_whirlpools_core2 = require("@orca-so/whirlpools-core");
|
|
10125
|
-
var
|
|
10273
|
+
var import_kit79 = require("@solana/kit");
|
|
10126
10274
|
var import_memo = require("@solana-program/memo");
|
|
10127
10275
|
var import_token_20222 = require("@solana-program/token-2022");
|
|
10128
10276
|
var import_assert = __toESM(require("assert"));
|
|
@@ -10296,16 +10444,16 @@ async function increaseTunaLpPositionOrcaInstruction(authority, tunaPosition, tu
|
|
|
10296
10444
|
tunaPosition.data.tickUpperIndex
|
|
10297
10445
|
);
|
|
10298
10446
|
const remainingAccounts = [
|
|
10299
|
-
{ address: swapTickArrays[0], role:
|
|
10300
|
-
{ address: swapTickArrays[1], role:
|
|
10301
|
-
{ address: swapTickArrays[2], role:
|
|
10302
|
-
{ address: swapTickArrays[3], role:
|
|
10303
|
-
{ address: swapTickArrays[4], role:
|
|
10304
|
-
{ address: lowerTickArrayAddress, role:
|
|
10305
|
-
{ address: upperTickArrayAddress, role:
|
|
10306
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
10307
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
10308
|
-
{ address: orcaOracleAddress, role:
|
|
10447
|
+
{ address: swapTickArrays[0], role: import_kit79.AccountRole.WRITABLE },
|
|
10448
|
+
{ address: swapTickArrays[1], role: import_kit79.AccountRole.WRITABLE },
|
|
10449
|
+
{ address: swapTickArrays[2], role: import_kit79.AccountRole.WRITABLE },
|
|
10450
|
+
{ address: swapTickArrays[3], role: import_kit79.AccountRole.WRITABLE },
|
|
10451
|
+
{ address: swapTickArrays[4], role: import_kit79.AccountRole.WRITABLE },
|
|
10452
|
+
{ address: lowerTickArrayAddress, role: import_kit79.AccountRole.WRITABLE },
|
|
10453
|
+
{ address: upperTickArrayAddress, role: import_kit79.AccountRole.WRITABLE },
|
|
10454
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit79.AccountRole.WRITABLE },
|
|
10455
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit79.AccountRole.WRITABLE },
|
|
10456
|
+
{ address: orcaOracleAddress, role: import_kit79.AccountRole.WRITABLE }
|
|
10309
10457
|
];
|
|
10310
10458
|
const remainingAccountsInfo = {
|
|
10311
10459
|
slices: [
|
|
@@ -10353,7 +10501,7 @@ async function increaseTunaLpPositionOrcaInstruction(authority, tunaPosition, tu
|
|
|
10353
10501
|
// src/txbuilder/increaseTunaLpPositionFusion.ts
|
|
10354
10502
|
var import_fusionamm_client2 = require("@crypticdot/fusionamm-client");
|
|
10355
10503
|
var import_fusionamm_core4 = require("@crypticdot/fusionamm-core");
|
|
10356
|
-
var
|
|
10504
|
+
var import_kit80 = require("@solana/kit");
|
|
10357
10505
|
var import_memo2 = require("@solana-program/memo");
|
|
10358
10506
|
var import_token_20223 = require("@solana-program/token-2022");
|
|
10359
10507
|
var import_assert2 = __toESM(require("assert"));
|
|
@@ -10532,15 +10680,15 @@ async function increaseTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
10532
10680
|
tunaPosition.data.tickUpperIndex
|
|
10533
10681
|
);
|
|
10534
10682
|
const remainingAccounts = [
|
|
10535
|
-
{ address: swapTickArrays[0], role:
|
|
10536
|
-
{ address: swapTickArrays[1], role:
|
|
10537
|
-
{ address: swapTickArrays[2], role:
|
|
10538
|
-
{ address: swapTickArrays[3], role:
|
|
10539
|
-
{ address: swapTickArrays[4], role:
|
|
10540
|
-
{ address: lowerTickArrayAddress, role:
|
|
10541
|
-
{ address: upperTickArrayAddress, role:
|
|
10542
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
10543
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
10683
|
+
{ address: swapTickArrays[0], role: import_kit80.AccountRole.WRITABLE },
|
|
10684
|
+
{ address: swapTickArrays[1], role: import_kit80.AccountRole.WRITABLE },
|
|
10685
|
+
{ address: swapTickArrays[2], role: import_kit80.AccountRole.WRITABLE },
|
|
10686
|
+
{ address: swapTickArrays[3], role: import_kit80.AccountRole.WRITABLE },
|
|
10687
|
+
{ address: swapTickArrays[4], role: import_kit80.AccountRole.WRITABLE },
|
|
10688
|
+
{ address: lowerTickArrayAddress, role: import_kit80.AccountRole.WRITABLE },
|
|
10689
|
+
{ address: upperTickArrayAddress, role: import_kit80.AccountRole.WRITABLE },
|
|
10690
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit80.AccountRole.WRITABLE },
|
|
10691
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit80.AccountRole.WRITABLE }
|
|
10544
10692
|
];
|
|
10545
10693
|
const remainingAccountsInfo = {
|
|
10546
10694
|
slices: [
|
|
@@ -10678,7 +10826,7 @@ async function closeTunaLpPositionFusionInstruction(rpc, authority, positionMint
|
|
|
10678
10826
|
|
|
10679
10827
|
// src/txbuilder/collectAndCompoundFeesOrca.ts
|
|
10680
10828
|
var import_whirlpools_client4 = require("@orca-so/whirlpools-client");
|
|
10681
|
-
var
|
|
10829
|
+
var import_kit81 = require("@solana/kit");
|
|
10682
10830
|
var import_memo3 = require("@solana-program/memo");
|
|
10683
10831
|
var import_token_20226 = require("@solana-program/token-2022");
|
|
10684
10832
|
var import_assert5 = __toESM(require("assert"));
|
|
@@ -10776,16 +10924,16 @@ async function collectAndCompoundFeesOrcaInstruction(authority, tunaConfig, tuna
|
|
|
10776
10924
|
tunaPosition.data.tickUpperIndex
|
|
10777
10925
|
);
|
|
10778
10926
|
const remainingAccounts = [
|
|
10779
|
-
{ address: swapTickArrays[0], role:
|
|
10780
|
-
{ address: swapTickArrays[1], role:
|
|
10781
|
-
{ address: swapTickArrays[2], role:
|
|
10782
|
-
{ address: swapTickArrays[3], role:
|
|
10783
|
-
{ address: swapTickArrays[4], role:
|
|
10784
|
-
{ address: lowerTickArrayAddress, role:
|
|
10785
|
-
{ address: upperTickArrayAddress, role:
|
|
10786
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
10787
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
10788
|
-
{ address: orcaOracleAddress, role:
|
|
10927
|
+
{ address: swapTickArrays[0], role: import_kit81.AccountRole.WRITABLE },
|
|
10928
|
+
{ address: swapTickArrays[1], role: import_kit81.AccountRole.WRITABLE },
|
|
10929
|
+
{ address: swapTickArrays[2], role: import_kit81.AccountRole.WRITABLE },
|
|
10930
|
+
{ address: swapTickArrays[3], role: import_kit81.AccountRole.WRITABLE },
|
|
10931
|
+
{ address: swapTickArrays[4], role: import_kit81.AccountRole.WRITABLE },
|
|
10932
|
+
{ address: lowerTickArrayAddress, role: import_kit81.AccountRole.WRITABLE },
|
|
10933
|
+
{ address: upperTickArrayAddress, role: import_kit81.AccountRole.WRITABLE },
|
|
10934
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit81.AccountRole.WRITABLE },
|
|
10935
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit81.AccountRole.WRITABLE },
|
|
10936
|
+
{ address: orcaOracleAddress, role: import_kit81.AccountRole.WRITABLE }
|
|
10789
10937
|
];
|
|
10790
10938
|
const remainingAccountsInfo = {
|
|
10791
10939
|
slices: [
|
|
@@ -10830,7 +10978,7 @@ async function collectAndCompoundFeesOrcaInstruction(authority, tunaConfig, tuna
|
|
|
10830
10978
|
|
|
10831
10979
|
// src/txbuilder/collectAndCompoundFeesFusion.ts
|
|
10832
10980
|
var import_fusionamm_client4 = require("@crypticdot/fusionamm-client");
|
|
10833
|
-
var
|
|
10981
|
+
var import_kit82 = require("@solana/kit");
|
|
10834
10982
|
var import_memo4 = require("@solana-program/memo");
|
|
10835
10983
|
var import_token_20227 = require("@solana-program/token-2022");
|
|
10836
10984
|
var import_assert6 = __toESM(require("assert"));
|
|
@@ -10927,15 +11075,15 @@ async function collectAndCompoundFeesFusionInstruction(authority, tunaConfig, tu
|
|
|
10927
11075
|
tunaPosition.data.tickUpperIndex
|
|
10928
11076
|
);
|
|
10929
11077
|
const remainingAccounts = [
|
|
10930
|
-
{ address: swapTickArrays[0], role:
|
|
10931
|
-
{ address: swapTickArrays[1], role:
|
|
10932
|
-
{ address: swapTickArrays[2], role:
|
|
10933
|
-
{ address: swapTickArrays[3], role:
|
|
10934
|
-
{ address: swapTickArrays[4], role:
|
|
10935
|
-
{ address: lowerTickArrayAddress, role:
|
|
10936
|
-
{ address: upperTickArrayAddress, role:
|
|
10937
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
10938
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
11078
|
+
{ address: swapTickArrays[0], role: import_kit82.AccountRole.WRITABLE },
|
|
11079
|
+
{ address: swapTickArrays[1], role: import_kit82.AccountRole.WRITABLE },
|
|
11080
|
+
{ address: swapTickArrays[2], role: import_kit82.AccountRole.WRITABLE },
|
|
11081
|
+
{ address: swapTickArrays[3], role: import_kit82.AccountRole.WRITABLE },
|
|
11082
|
+
{ address: swapTickArrays[4], role: import_kit82.AccountRole.WRITABLE },
|
|
11083
|
+
{ address: lowerTickArrayAddress, role: import_kit82.AccountRole.WRITABLE },
|
|
11084
|
+
{ address: upperTickArrayAddress, role: import_kit82.AccountRole.WRITABLE },
|
|
11085
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit82.AccountRole.WRITABLE },
|
|
11086
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit82.AccountRole.WRITABLE }
|
|
10939
11087
|
];
|
|
10940
11088
|
const remainingAccountsInfo = {
|
|
10941
11089
|
slices: [
|
|
@@ -10979,7 +11127,7 @@ async function collectAndCompoundFeesFusionInstruction(authority, tunaConfig, tu
|
|
|
10979
11127
|
|
|
10980
11128
|
// src/txbuilder/collectFeesOrca.ts
|
|
10981
11129
|
var import_whirlpools_client5 = require("@orca-so/whirlpools-client");
|
|
10982
|
-
var
|
|
11130
|
+
var import_kit83 = require("@solana/kit");
|
|
10983
11131
|
var import_memo5 = require("@solana-program/memo");
|
|
10984
11132
|
var import_token_20228 = require("@solana-program/token-2022");
|
|
10985
11133
|
var import_assert7 = __toESM(require("assert"));
|
|
@@ -11055,10 +11203,10 @@ async function collectFeesOrcaInstruction(authority, tunaPosition, mintA, mintB,
|
|
|
11055
11203
|
tunaPosition.data.tickUpperIndex
|
|
11056
11204
|
);
|
|
11057
11205
|
const remainingAccounts = [
|
|
11058
|
-
{ address: lowerTickArrayAddress, role:
|
|
11059
|
-
{ address: upperTickArrayAddress, role:
|
|
11060
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
11061
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
11206
|
+
{ address: lowerTickArrayAddress, role: import_kit83.AccountRole.WRITABLE },
|
|
11207
|
+
{ address: upperTickArrayAddress, role: import_kit83.AccountRole.WRITABLE },
|
|
11208
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit83.AccountRole.WRITABLE },
|
|
11209
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit83.AccountRole.WRITABLE }
|
|
11062
11210
|
];
|
|
11063
11211
|
const remainingAccountsInfo = {
|
|
11064
11212
|
slices: [
|
|
@@ -11093,7 +11241,7 @@ async function collectFeesOrcaInstruction(authority, tunaPosition, mintA, mintB,
|
|
|
11093
11241
|
|
|
11094
11242
|
// src/txbuilder/collectFeesFusion.ts
|
|
11095
11243
|
var import_fusionamm_client5 = require("@crypticdot/fusionamm-client");
|
|
11096
|
-
var
|
|
11244
|
+
var import_kit84 = require("@solana/kit");
|
|
11097
11245
|
var import_memo6 = require("@solana-program/memo");
|
|
11098
11246
|
var import_token_20229 = require("@solana-program/token-2022");
|
|
11099
11247
|
var import_assert8 = __toESM(require("assert"));
|
|
@@ -11169,10 +11317,10 @@ async function collectFeesFusionInstruction(authority, tunaPosition, mintA, mint
|
|
|
11169
11317
|
tunaPosition.data.tickUpperIndex
|
|
11170
11318
|
);
|
|
11171
11319
|
const remainingAccounts = [
|
|
11172
|
-
{ address: lowerTickArrayAddress, role:
|
|
11173
|
-
{ address: upperTickArrayAddress, role:
|
|
11174
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
11175
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
11320
|
+
{ address: lowerTickArrayAddress, role: import_kit84.AccountRole.WRITABLE },
|
|
11321
|
+
{ address: upperTickArrayAddress, role: import_kit84.AccountRole.WRITABLE },
|
|
11322
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit84.AccountRole.WRITABLE },
|
|
11323
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit84.AccountRole.WRITABLE }
|
|
11176
11324
|
];
|
|
11177
11325
|
const remainingAccountsInfo = {
|
|
11178
11326
|
slices: [
|
|
@@ -11283,7 +11431,7 @@ async function openLendingPositionAndDepositInstructions(rpc, authority, mintAdd
|
|
|
11283
11431
|
// src/txbuilder/closeActiveTunaLpPositionOrca.ts
|
|
11284
11432
|
var import_whirlpools_client6 = require("@orca-so/whirlpools-client");
|
|
11285
11433
|
var import_whirlpools_core3 = require("@orca-so/whirlpools-core");
|
|
11286
|
-
var
|
|
11434
|
+
var import_kit85 = require("@solana/kit");
|
|
11287
11435
|
var import_token_202211 = require("@solana-program/token-2022");
|
|
11288
11436
|
var import_assert9 = __toESM(require("assert"));
|
|
11289
11437
|
async function closeActiveTunaLpPositionOrcaInstructions(rpc, authority, positionMint, args) {
|
|
@@ -11304,7 +11452,7 @@ async function closeActiveTunaLpPositionOrcaInstructions(rpc, authority, positio
|
|
|
11304
11452
|
const allMints = [mintA, mintB, ...rewardMints];
|
|
11305
11453
|
(0, import_assert9.default)(mintA.exists, "Token A account not found");
|
|
11306
11454
|
(0, import_assert9.default)(mintB.exists, "Token B account not found");
|
|
11307
|
-
(0,
|
|
11455
|
+
(0, import_kit85.assertAccountsExist)(rewardMints);
|
|
11308
11456
|
const lowerTickArrayStartIndex = (0, import_whirlpools_core3.getTickArrayStartTickIndex)(
|
|
11309
11457
|
tunaPosition.data.tickLowerIndex,
|
|
11310
11458
|
whirlpool.data.tickSpacing
|
|
@@ -11485,7 +11633,7 @@ async function closeActiveTunaLpPositionFusionInstructions(rpc, authority, posit
|
|
|
11485
11633
|
|
|
11486
11634
|
// src/txbuilder/closeActiveTunaSpotPositionFusion.ts
|
|
11487
11635
|
var import_fusionamm_client7 = require("@crypticdot/fusionamm-client");
|
|
11488
|
-
var
|
|
11636
|
+
var import_kit86 = require("@solana/kit");
|
|
11489
11637
|
var import_memo8 = require("@solana-program/memo");
|
|
11490
11638
|
var import_token_202213 = require("@solana-program/token-2022");
|
|
11491
11639
|
var import_assert11 = __toESM(require("assert"));
|
|
@@ -11562,13 +11710,13 @@ async function closeActiveTunaSpotPositionFusionInstruction(authority, tunaPosit
|
|
|
11562
11710
|
}))[0];
|
|
11563
11711
|
const swapTickArrays = await FusionUtils.getSwapTickArrayAddresses(fusionPool);
|
|
11564
11712
|
const remainingAccounts = [
|
|
11565
|
-
{ address: swapTickArrays[0], role:
|
|
11566
|
-
{ address: swapTickArrays[1], role:
|
|
11567
|
-
{ address: swapTickArrays[2], role:
|
|
11568
|
-
{ address: swapTickArrays[3], role:
|
|
11569
|
-
{ address: swapTickArrays[4], role:
|
|
11570
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
11571
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
11713
|
+
{ address: swapTickArrays[0], role: import_kit86.AccountRole.WRITABLE },
|
|
11714
|
+
{ address: swapTickArrays[1], role: import_kit86.AccountRole.WRITABLE },
|
|
11715
|
+
{ address: swapTickArrays[2], role: import_kit86.AccountRole.WRITABLE },
|
|
11716
|
+
{ address: swapTickArrays[3], role: import_kit86.AccountRole.WRITABLE },
|
|
11717
|
+
{ address: swapTickArrays[4], role: import_kit86.AccountRole.WRITABLE },
|
|
11718
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit86.AccountRole.WRITABLE },
|
|
11719
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit86.AccountRole.WRITABLE }
|
|
11572
11720
|
];
|
|
11573
11721
|
const remainingAccountsInfo = {
|
|
11574
11722
|
slices: [
|
|
@@ -11608,7 +11756,7 @@ async function closeActiveTunaSpotPositionFusionInstruction(authority, tunaPosit
|
|
|
11608
11756
|
|
|
11609
11757
|
// src/txbuilder/closeActiveTunaSpotPositionOrca.ts
|
|
11610
11758
|
var import_whirlpools_client7 = require("@orca-so/whirlpools-client");
|
|
11611
|
-
var
|
|
11759
|
+
var import_kit87 = require("@solana/kit");
|
|
11612
11760
|
var import_memo9 = require("@solana-program/memo");
|
|
11613
11761
|
var import_token_202214 = require("@solana-program/token-2022");
|
|
11614
11762
|
var import_assert12 = __toESM(require("assert"));
|
|
@@ -11686,14 +11834,14 @@ async function closeActiveTunaSpotPositionOrcaInstruction(authority, tunaPositio
|
|
|
11686
11834
|
}))[0];
|
|
11687
11835
|
const swapTickArrays = await OrcaUtils.getSwapTickArrayAddresses(whirlpool);
|
|
11688
11836
|
const remainingAccounts = [
|
|
11689
|
-
{ address: swapTickArrays[0], role:
|
|
11690
|
-
{ address: swapTickArrays[1], role:
|
|
11691
|
-
{ address: swapTickArrays[2], role:
|
|
11692
|
-
{ address: swapTickArrays[3], role:
|
|
11693
|
-
{ address: swapTickArrays[4], role:
|
|
11694
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
11695
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
11696
|
-
{ address: orcaOracleAddress, role:
|
|
11837
|
+
{ address: swapTickArrays[0], role: import_kit87.AccountRole.WRITABLE },
|
|
11838
|
+
{ address: swapTickArrays[1], role: import_kit87.AccountRole.WRITABLE },
|
|
11839
|
+
{ address: swapTickArrays[2], role: import_kit87.AccountRole.WRITABLE },
|
|
11840
|
+
{ address: swapTickArrays[3], role: import_kit87.AccountRole.WRITABLE },
|
|
11841
|
+
{ address: swapTickArrays[4], role: import_kit87.AccountRole.WRITABLE },
|
|
11842
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit87.AccountRole.WRITABLE },
|
|
11843
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit87.AccountRole.WRITABLE },
|
|
11844
|
+
{ address: orcaOracleAddress, role: import_kit87.AccountRole.WRITABLE }
|
|
11697
11845
|
];
|
|
11698
11846
|
const remainingAccountsInfo = {
|
|
11699
11847
|
slices: [
|
|
@@ -11734,7 +11882,7 @@ async function closeActiveTunaSpotPositionOrcaInstruction(authority, tunaPositio
|
|
|
11734
11882
|
|
|
11735
11883
|
// src/txbuilder/increaseTunaSpotPositionOrca.ts
|
|
11736
11884
|
var import_whirlpools_client8 = require("@orca-so/whirlpools-client");
|
|
11737
|
-
var
|
|
11885
|
+
var import_kit88 = require("@solana/kit");
|
|
11738
11886
|
var import_memo10 = require("@solana-program/memo");
|
|
11739
11887
|
var import_token_202215 = require("@solana-program/token-2022");
|
|
11740
11888
|
var import_assert13 = __toESM(require("assert"));
|
|
@@ -11839,14 +11987,14 @@ async function increaseTunaSpotPositionOrcaInstruction(authority, tunaPosition,
|
|
|
11839
11987
|
}))[0];
|
|
11840
11988
|
const swapTickArrays = await OrcaUtils.getSwapTickArrayAddresses(whirlpool);
|
|
11841
11989
|
const remainingAccounts = [
|
|
11842
|
-
{ address: swapTickArrays[0], role:
|
|
11843
|
-
{ address: swapTickArrays[1], role:
|
|
11844
|
-
{ address: swapTickArrays[2], role:
|
|
11845
|
-
{ address: swapTickArrays[3], role:
|
|
11846
|
-
{ address: swapTickArrays[4], role:
|
|
11847
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
11848
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
11849
|
-
{ address: orcaOracleAddress, role:
|
|
11990
|
+
{ address: swapTickArrays[0], role: import_kit88.AccountRole.WRITABLE },
|
|
11991
|
+
{ address: swapTickArrays[1], role: import_kit88.AccountRole.WRITABLE },
|
|
11992
|
+
{ address: swapTickArrays[2], role: import_kit88.AccountRole.WRITABLE },
|
|
11993
|
+
{ address: swapTickArrays[3], role: import_kit88.AccountRole.WRITABLE },
|
|
11994
|
+
{ address: swapTickArrays[4], role: import_kit88.AccountRole.WRITABLE },
|
|
11995
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit88.AccountRole.WRITABLE },
|
|
11996
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit88.AccountRole.WRITABLE },
|
|
11997
|
+
{ address: orcaOracleAddress, role: import_kit88.AccountRole.WRITABLE }
|
|
11850
11998
|
];
|
|
11851
11999
|
const remainingAccountsInfo = {
|
|
11852
12000
|
slices: [
|
|
@@ -11889,7 +12037,7 @@ async function increaseTunaSpotPositionOrcaInstruction(authority, tunaPosition,
|
|
|
11889
12037
|
|
|
11890
12038
|
// src/txbuilder/increaseTunaSpotPositionFusion.ts
|
|
11891
12039
|
var import_fusionamm_client8 = require("@crypticdot/fusionamm-client");
|
|
11892
|
-
var
|
|
12040
|
+
var import_kit89 = require("@solana/kit");
|
|
11893
12041
|
var import_memo11 = require("@solana-program/memo");
|
|
11894
12042
|
var import_token_202216 = require("@solana-program/token-2022");
|
|
11895
12043
|
var import_assert14 = __toESM(require("assert"));
|
|
@@ -11993,13 +12141,13 @@ async function increaseTunaSpotPositionFusionInstruction(authority, tunaPosition
|
|
|
11993
12141
|
}))[0];
|
|
11994
12142
|
const swapTickArrays = await FusionUtils.getSwapTickArrayAddresses(fusionPool);
|
|
11995
12143
|
const remainingAccounts = [
|
|
11996
|
-
{ address: swapTickArrays[0], role:
|
|
11997
|
-
{ address: swapTickArrays[1], role:
|
|
11998
|
-
{ address: swapTickArrays[2], role:
|
|
11999
|
-
{ address: swapTickArrays[3], role:
|
|
12000
|
-
{ address: swapTickArrays[4], role:
|
|
12001
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
12002
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
12144
|
+
{ address: swapTickArrays[0], role: import_kit89.AccountRole.WRITABLE },
|
|
12145
|
+
{ address: swapTickArrays[1], role: import_kit89.AccountRole.WRITABLE },
|
|
12146
|
+
{ address: swapTickArrays[2], role: import_kit89.AccountRole.WRITABLE },
|
|
12147
|
+
{ address: swapTickArrays[3], role: import_kit89.AccountRole.WRITABLE },
|
|
12148
|
+
{ address: swapTickArrays[4], role: import_kit89.AccountRole.WRITABLE },
|
|
12149
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit89.AccountRole.WRITABLE },
|
|
12150
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit89.AccountRole.WRITABLE }
|
|
12003
12151
|
];
|
|
12004
12152
|
const remainingAccountsInfo = {
|
|
12005
12153
|
slices: [
|
|
@@ -12041,7 +12189,7 @@ async function increaseTunaSpotPositionFusionInstruction(authority, tunaPosition
|
|
|
12041
12189
|
|
|
12042
12190
|
// src/txbuilder/decreaseTunaSpotPositionOrca.ts
|
|
12043
12191
|
var import_whirlpools_client9 = require("@orca-so/whirlpools-client");
|
|
12044
|
-
var
|
|
12192
|
+
var import_kit90 = require("@solana/kit");
|
|
12045
12193
|
var import_memo12 = require("@solana-program/memo");
|
|
12046
12194
|
var import_token_202217 = require("@solana-program/token-2022");
|
|
12047
12195
|
var import_assert15 = __toESM(require("assert"));
|
|
@@ -12146,14 +12294,14 @@ async function decreaseTunaSpotPositionOrcaInstruction(authority, tunaPosition,
|
|
|
12146
12294
|
}))[0];
|
|
12147
12295
|
const swapTickArrays = await OrcaUtils.getSwapTickArrayAddresses(whirlpool);
|
|
12148
12296
|
const remainingAccounts = [
|
|
12149
|
-
{ address: swapTickArrays[0], role:
|
|
12150
|
-
{ address: swapTickArrays[1], role:
|
|
12151
|
-
{ address: swapTickArrays[2], role:
|
|
12152
|
-
{ address: swapTickArrays[3], role:
|
|
12153
|
-
{ address: swapTickArrays[4], role:
|
|
12154
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
12155
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
12156
|
-
{ address: orcaOracleAddress, role:
|
|
12297
|
+
{ address: swapTickArrays[0], role: import_kit90.AccountRole.WRITABLE },
|
|
12298
|
+
{ address: swapTickArrays[1], role: import_kit90.AccountRole.WRITABLE },
|
|
12299
|
+
{ address: swapTickArrays[2], role: import_kit90.AccountRole.WRITABLE },
|
|
12300
|
+
{ address: swapTickArrays[3], role: import_kit90.AccountRole.WRITABLE },
|
|
12301
|
+
{ address: swapTickArrays[4], role: import_kit90.AccountRole.WRITABLE },
|
|
12302
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit90.AccountRole.WRITABLE },
|
|
12303
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit90.AccountRole.WRITABLE },
|
|
12304
|
+
{ address: orcaOracleAddress, role: import_kit90.AccountRole.WRITABLE }
|
|
12157
12305
|
];
|
|
12158
12306
|
const remainingAccountsInfo = {
|
|
12159
12307
|
slices: [
|
|
@@ -12194,7 +12342,7 @@ async function decreaseTunaSpotPositionOrcaInstruction(authority, tunaPosition,
|
|
|
12194
12342
|
|
|
12195
12343
|
// src/txbuilder/decreaseTunaSpotPositionFusion.ts
|
|
12196
12344
|
var import_fusionamm_client9 = require("@crypticdot/fusionamm-client");
|
|
12197
|
-
var
|
|
12345
|
+
var import_kit91 = require("@solana/kit");
|
|
12198
12346
|
var import_memo13 = require("@solana-program/memo");
|
|
12199
12347
|
var import_token_202218 = require("@solana-program/token-2022");
|
|
12200
12348
|
var import_assert16 = __toESM(require("assert"));
|
|
@@ -12298,13 +12446,13 @@ async function decreaseTunaSpotPositionFusionInstruction(authority, tunaPosition
|
|
|
12298
12446
|
}))[0];
|
|
12299
12447
|
const swapTickArrays = await FusionUtils.getSwapTickArrayAddresses(fusionPool);
|
|
12300
12448
|
const remainingAccounts = [
|
|
12301
|
-
{ address: swapTickArrays[0], role:
|
|
12302
|
-
{ address: swapTickArrays[1], role:
|
|
12303
|
-
{ address: swapTickArrays[2], role:
|
|
12304
|
-
{ address: swapTickArrays[3], role:
|
|
12305
|
-
{ address: swapTickArrays[4], role:
|
|
12306
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
12307
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
12449
|
+
{ address: swapTickArrays[0], role: import_kit91.AccountRole.WRITABLE },
|
|
12450
|
+
{ address: swapTickArrays[1], role: import_kit91.AccountRole.WRITABLE },
|
|
12451
|
+
{ address: swapTickArrays[2], role: import_kit91.AccountRole.WRITABLE },
|
|
12452
|
+
{ address: swapTickArrays[3], role: import_kit91.AccountRole.WRITABLE },
|
|
12453
|
+
{ address: swapTickArrays[4], role: import_kit91.AccountRole.WRITABLE },
|
|
12454
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit91.AccountRole.WRITABLE },
|
|
12455
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit91.AccountRole.WRITABLE }
|
|
12308
12456
|
];
|
|
12309
12457
|
const remainingAccountsInfo = {
|
|
12310
12458
|
slices: [
|
|
@@ -12430,7 +12578,7 @@ async function createVaultInstructions(authority, mint, args) {
|
|
|
12430
12578
|
|
|
12431
12579
|
// src/txbuilder/liquidateTunaLpPositionOrca.ts
|
|
12432
12580
|
var import_whirlpools_client10 = require("@orca-so/whirlpools-client");
|
|
12433
|
-
var
|
|
12581
|
+
var import_kit92 = require("@solana/kit");
|
|
12434
12582
|
var import_memo14 = require("@solana-program/memo");
|
|
12435
12583
|
var import_token_202221 = require("@solana-program/token-2022");
|
|
12436
12584
|
async function liquidateTunaLpPositionOrcaInstructions(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool, withdrawPercent) {
|
|
@@ -12517,16 +12665,16 @@ async function liquidateTunaLpPositionOrcaInstruction(authority, tunaPosition, t
|
|
|
12517
12665
|
tunaPosition.data.tickUpperIndex
|
|
12518
12666
|
);
|
|
12519
12667
|
const remainingAccounts = [
|
|
12520
|
-
{ address: swapTickArrays[0], role:
|
|
12521
|
-
{ address: swapTickArrays[1], role:
|
|
12522
|
-
{ address: swapTickArrays[2], role:
|
|
12523
|
-
{ address: swapTickArrays[3], role:
|
|
12524
|
-
{ address: swapTickArrays[4], role:
|
|
12525
|
-
{ address: lowerTickArrayAddress, role:
|
|
12526
|
-
{ address: upperTickArrayAddress, role:
|
|
12527
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
12528
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
12529
|
-
{ address: orcaOracleAddress, role:
|
|
12668
|
+
{ address: swapTickArrays[0], role: import_kit92.AccountRole.WRITABLE },
|
|
12669
|
+
{ address: swapTickArrays[1], role: import_kit92.AccountRole.WRITABLE },
|
|
12670
|
+
{ address: swapTickArrays[2], role: import_kit92.AccountRole.WRITABLE },
|
|
12671
|
+
{ address: swapTickArrays[3], role: import_kit92.AccountRole.WRITABLE },
|
|
12672
|
+
{ address: swapTickArrays[4], role: import_kit92.AccountRole.WRITABLE },
|
|
12673
|
+
{ address: lowerTickArrayAddress, role: import_kit92.AccountRole.WRITABLE },
|
|
12674
|
+
{ address: upperTickArrayAddress, role: import_kit92.AccountRole.WRITABLE },
|
|
12675
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit92.AccountRole.WRITABLE },
|
|
12676
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit92.AccountRole.WRITABLE },
|
|
12677
|
+
{ address: orcaOracleAddress, role: import_kit92.AccountRole.WRITABLE }
|
|
12530
12678
|
];
|
|
12531
12679
|
const remainingAccountsInfo = {
|
|
12532
12680
|
slices: [
|
|
@@ -12571,7 +12719,7 @@ async function liquidateTunaLpPositionOrcaInstruction(authority, tunaPosition, t
|
|
|
12571
12719
|
|
|
12572
12720
|
// src/txbuilder/liquidateTunaLpPositionFusion.ts
|
|
12573
12721
|
var import_fusionamm_client10 = require("@crypticdot/fusionamm-client");
|
|
12574
|
-
var
|
|
12722
|
+
var import_kit93 = require("@solana/kit");
|
|
12575
12723
|
var import_memo15 = require("@solana-program/memo");
|
|
12576
12724
|
var import_token_202222 = require("@solana-program/token-2022");
|
|
12577
12725
|
async function liquidateTunaLpPositionFusionInstructions(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool, withdrawPercent) {
|
|
@@ -12657,15 +12805,15 @@ async function liquidateTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
12657
12805
|
tunaPosition.data.tickUpperIndex
|
|
12658
12806
|
);
|
|
12659
12807
|
const remainingAccounts = [
|
|
12660
|
-
{ address: swapTickArrays[0], role:
|
|
12661
|
-
{ address: swapTickArrays[1], role:
|
|
12662
|
-
{ address: swapTickArrays[2], role:
|
|
12663
|
-
{ address: swapTickArrays[3], role:
|
|
12664
|
-
{ address: swapTickArrays[4], role:
|
|
12665
|
-
{ address: lowerTickArrayAddress, role:
|
|
12666
|
-
{ address: upperTickArrayAddress, role:
|
|
12667
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
12668
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
12808
|
+
{ address: swapTickArrays[0], role: import_kit93.AccountRole.WRITABLE },
|
|
12809
|
+
{ address: swapTickArrays[1], role: import_kit93.AccountRole.WRITABLE },
|
|
12810
|
+
{ address: swapTickArrays[2], role: import_kit93.AccountRole.WRITABLE },
|
|
12811
|
+
{ address: swapTickArrays[3], role: import_kit93.AccountRole.WRITABLE },
|
|
12812
|
+
{ address: swapTickArrays[4], role: import_kit93.AccountRole.WRITABLE },
|
|
12813
|
+
{ address: lowerTickArrayAddress, role: import_kit93.AccountRole.WRITABLE },
|
|
12814
|
+
{ address: upperTickArrayAddress, role: import_kit93.AccountRole.WRITABLE },
|
|
12815
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit93.AccountRole.WRITABLE },
|
|
12816
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit93.AccountRole.WRITABLE }
|
|
12669
12817
|
];
|
|
12670
12818
|
const remainingAccountsInfo = {
|
|
12671
12819
|
slices: [
|
|
@@ -12709,7 +12857,7 @@ async function liquidateTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
12709
12857
|
|
|
12710
12858
|
// src/txbuilder/liquidateTunaSpotPositionFusion.ts
|
|
12711
12859
|
var import_fusionamm_client11 = require("@crypticdot/fusionamm-client");
|
|
12712
|
-
var
|
|
12860
|
+
var import_kit94 = require("@solana/kit");
|
|
12713
12861
|
var import_memo16 = require("@solana-program/memo");
|
|
12714
12862
|
var import_token_202223 = require("@solana-program/token-2022");
|
|
12715
12863
|
async function liquidateTunaSpotPositionFusionInstructions(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, fusionPool, withdrawPercent) {
|
|
@@ -12772,13 +12920,13 @@ async function liquidateTunaSpotPositionFusionInstruction(authority, positionMin
|
|
|
12772
12920
|
}))[0];
|
|
12773
12921
|
const swapTickArrays = await FusionUtils.getSwapTickArrayAddresses(fusionPool);
|
|
12774
12922
|
const remainingAccounts = [
|
|
12775
|
-
{ address: swapTickArrays[0], role:
|
|
12776
|
-
{ address: swapTickArrays[1], role:
|
|
12777
|
-
{ address: swapTickArrays[2], role:
|
|
12778
|
-
{ address: swapTickArrays[3], role:
|
|
12779
|
-
{ address: swapTickArrays[4], role:
|
|
12780
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
12781
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
12923
|
+
{ address: swapTickArrays[0], role: import_kit94.AccountRole.WRITABLE },
|
|
12924
|
+
{ address: swapTickArrays[1], role: import_kit94.AccountRole.WRITABLE },
|
|
12925
|
+
{ address: swapTickArrays[2], role: import_kit94.AccountRole.WRITABLE },
|
|
12926
|
+
{ address: swapTickArrays[3], role: import_kit94.AccountRole.WRITABLE },
|
|
12927
|
+
{ address: swapTickArrays[4], role: import_kit94.AccountRole.WRITABLE },
|
|
12928
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit94.AccountRole.WRITABLE },
|
|
12929
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit94.AccountRole.WRITABLE }
|
|
12782
12930
|
];
|
|
12783
12931
|
const remainingAccountsInfo = {
|
|
12784
12932
|
slices: [
|
|
@@ -12818,7 +12966,7 @@ async function liquidateTunaSpotPositionFusionInstruction(authority, positionMin
|
|
|
12818
12966
|
|
|
12819
12967
|
// src/txbuilder/liquidateTunaSpotPositionOrca.ts
|
|
12820
12968
|
var import_whirlpools_client11 = require("@orca-so/whirlpools-client");
|
|
12821
|
-
var
|
|
12969
|
+
var import_kit95 = require("@solana/kit");
|
|
12822
12970
|
var import_memo17 = require("@solana-program/memo");
|
|
12823
12971
|
var import_token_202224 = require("@solana-program/token-2022");
|
|
12824
12972
|
async function liquidateTunaSpotPositionOrcaInstructions(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool, withdrawPercent) {
|
|
@@ -12882,14 +13030,14 @@ async function liquidateTunaSpotPositionOrcaInstruction(authority, positionMint,
|
|
|
12882
13030
|
}))[0];
|
|
12883
13031
|
const swapTickArrays = await OrcaUtils.getSwapTickArrayAddresses(whirlpool);
|
|
12884
13032
|
const remainingAccounts = [
|
|
12885
|
-
{ address: swapTickArrays[0], role:
|
|
12886
|
-
{ address: swapTickArrays[1], role:
|
|
12887
|
-
{ address: swapTickArrays[2], role:
|
|
12888
|
-
{ address: swapTickArrays[3], role:
|
|
12889
|
-
{ address: swapTickArrays[4], role:
|
|
12890
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
12891
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
12892
|
-
{ address: orcaOracleAddress, role:
|
|
13033
|
+
{ address: swapTickArrays[0], role: import_kit95.AccountRole.WRITABLE },
|
|
13034
|
+
{ address: swapTickArrays[1], role: import_kit95.AccountRole.WRITABLE },
|
|
13035
|
+
{ address: swapTickArrays[2], role: import_kit95.AccountRole.WRITABLE },
|
|
13036
|
+
{ address: swapTickArrays[3], role: import_kit95.AccountRole.WRITABLE },
|
|
13037
|
+
{ address: swapTickArrays[4], role: import_kit95.AccountRole.WRITABLE },
|
|
13038
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit95.AccountRole.WRITABLE },
|
|
13039
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit95.AccountRole.WRITABLE },
|
|
13040
|
+
{ address: orcaOracleAddress, role: import_kit95.AccountRole.WRITABLE }
|
|
12893
13041
|
];
|
|
12894
13042
|
const remainingAccountsInfo = {
|
|
12895
13043
|
slices: [
|
|
@@ -13032,7 +13180,7 @@ async function openTunaLpPositionFusionInstruction(rpc, authority, positionMint,
|
|
|
13032
13180
|
// src/txbuilder/openAndIncreaseTunaLpPositionOrca.ts
|
|
13033
13181
|
var import_whirlpools_client13 = require("@orca-so/whirlpools-client");
|
|
13034
13182
|
var import_whirlpools_core4 = require("@orca-so/whirlpools-core");
|
|
13035
|
-
var
|
|
13183
|
+
var import_kit96 = require("@solana/kit");
|
|
13036
13184
|
var import_sysvars = require("@solana/sysvars");
|
|
13037
13185
|
var import_memo18 = require("@solana-program/memo");
|
|
13038
13186
|
var import_token_202227 = require("@solana-program/token-2022");
|
|
@@ -13054,7 +13202,7 @@ async function openAndIncreaseTunaLpPositionOrcaInstructions(rpc, authority, whi
|
|
|
13054
13202
|
if (!cleanupInstructions) cleanupInstructions = instructions;
|
|
13055
13203
|
const rent = await (0, import_sysvars.fetchSysvarRent)(rpc);
|
|
13056
13204
|
let nonRefundableRent = 0n;
|
|
13057
|
-
const positionMint = await (0,
|
|
13205
|
+
const positionMint = await (0, import_kit96.generateKeyPairSigner)();
|
|
13058
13206
|
const tunaConfig = await fetchTunaConfig(rpc, (await getTunaConfigAddress())[0]);
|
|
13059
13207
|
const whirlpool = await (0, import_whirlpools_client13.fetchMaybeWhirlpool)(rpc, whirlpoolAddress);
|
|
13060
13208
|
if (!whirlpool.exists) throw new Error("Whirlpool account not found");
|
|
@@ -13163,7 +13311,7 @@ async function openAndIncreaseTunaLpPositionOrcaInstructions(rpc, authority, whi
|
|
|
13163
13311
|
return {
|
|
13164
13312
|
instructions,
|
|
13165
13313
|
positionMint: positionMint.address,
|
|
13166
|
-
initializationCost: (0,
|
|
13314
|
+
initializationCost: (0, import_kit96.lamports)(nonRefundableRent)
|
|
13167
13315
|
};
|
|
13168
13316
|
}
|
|
13169
13317
|
async function openAndIncreaseTunaLpPositionOrcaInstruction(authority, positionMint, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool, args) {
|
|
@@ -13220,16 +13368,16 @@ async function openAndIncreaseTunaLpPositionOrcaInstruction(authority, positionM
|
|
|
13220
13368
|
const lowerTickArrayAddress = await OrcaUtils.getTickArrayAddressFromTickIndex(whirlpool, args.tickLowerIndex);
|
|
13221
13369
|
const upperTickArrayAddress = await OrcaUtils.getTickArrayAddressFromTickIndex(whirlpool, args.tickUpperIndex);
|
|
13222
13370
|
const remainingAccounts = [
|
|
13223
|
-
{ address: swapTickArrays[0], role:
|
|
13224
|
-
{ address: swapTickArrays[1], role:
|
|
13225
|
-
{ address: swapTickArrays[2], role:
|
|
13226
|
-
{ address: swapTickArrays[3], role:
|
|
13227
|
-
{ address: swapTickArrays[4], role:
|
|
13228
|
-
{ address: lowerTickArrayAddress, role:
|
|
13229
|
-
{ address: upperTickArrayAddress, role:
|
|
13230
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
13231
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
13232
|
-
{ address: orcaOracleAddress, role:
|
|
13371
|
+
{ address: swapTickArrays[0], role: import_kit96.AccountRole.WRITABLE },
|
|
13372
|
+
{ address: swapTickArrays[1], role: import_kit96.AccountRole.WRITABLE },
|
|
13373
|
+
{ address: swapTickArrays[2], role: import_kit96.AccountRole.WRITABLE },
|
|
13374
|
+
{ address: swapTickArrays[3], role: import_kit96.AccountRole.WRITABLE },
|
|
13375
|
+
{ address: swapTickArrays[4], role: import_kit96.AccountRole.WRITABLE },
|
|
13376
|
+
{ address: lowerTickArrayAddress, role: import_kit96.AccountRole.WRITABLE },
|
|
13377
|
+
{ address: upperTickArrayAddress, role: import_kit96.AccountRole.WRITABLE },
|
|
13378
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit96.AccountRole.WRITABLE },
|
|
13379
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit96.AccountRole.WRITABLE },
|
|
13380
|
+
{ address: orcaOracleAddress, role: import_kit96.AccountRole.WRITABLE }
|
|
13233
13381
|
];
|
|
13234
13382
|
const remainingAccountsInfo = {
|
|
13235
13383
|
slices: [
|
|
@@ -13281,7 +13429,7 @@ async function openAndIncreaseTunaLpPositionOrcaInstruction(authority, positionM
|
|
|
13281
13429
|
// src/txbuilder/openAndIncreaseTunaLpPositionFusion.ts
|
|
13282
13430
|
var import_fusionamm_client14 = require("@crypticdot/fusionamm-client");
|
|
13283
13431
|
var import_fusionamm_core5 = require("@crypticdot/fusionamm-core");
|
|
13284
|
-
var
|
|
13432
|
+
var import_kit97 = require("@solana/kit");
|
|
13285
13433
|
var import_sysvars2 = require("@solana/sysvars");
|
|
13286
13434
|
var import_memo19 = require("@solana-program/memo");
|
|
13287
13435
|
var import_token_202228 = require("@solana-program/token-2022");
|
|
@@ -13292,7 +13440,7 @@ async function openAndIncreaseTunaLpPositionFusionInstructions(rpc, authority, f
|
|
|
13292
13440
|
if (!cleanupInstructions) cleanupInstructions = instructions;
|
|
13293
13441
|
const rent = await (0, import_sysvars2.fetchSysvarRent)(rpc);
|
|
13294
13442
|
let nonRefundableRent = 0n;
|
|
13295
|
-
const positionMint = await (0,
|
|
13443
|
+
const positionMint = await (0, import_kit97.generateKeyPairSigner)();
|
|
13296
13444
|
const tunaConfig = await fetchTunaConfig(rpc, (await getTunaConfigAddress())[0]);
|
|
13297
13445
|
const fusionPool = await (0, import_fusionamm_client14.fetchMaybeFusionPool)(rpc, fusionPoolAddress);
|
|
13298
13446
|
if (!fusionPool.exists) throw new Error("FusionPool account not found");
|
|
@@ -13399,7 +13547,7 @@ async function openAndIncreaseTunaLpPositionFusionInstructions(rpc, authority, f
|
|
|
13399
13547
|
return {
|
|
13400
13548
|
instructions,
|
|
13401
13549
|
positionMint: positionMint.address,
|
|
13402
|
-
initializationCost: (0,
|
|
13550
|
+
initializationCost: (0, import_kit97.lamports)(nonRefundableRent)
|
|
13403
13551
|
};
|
|
13404
13552
|
}
|
|
13405
13553
|
async function openAndIncreaseTunaLpPositionFusionInstruction(authority, positionMint, tunaConfig, mintA, mintB, vaultA, vaultB, fusionPool, args) {
|
|
@@ -13455,15 +13603,15 @@ async function openAndIncreaseTunaLpPositionFusionInstruction(authority, positio
|
|
|
13455
13603
|
const lowerTickArrayAddress = await FusionUtils.getTickArrayAddressFromTickIndex(fusionPool, args.tickLowerIndex);
|
|
13456
13604
|
const upperTickArrayAddress = await FusionUtils.getTickArrayAddressFromTickIndex(fusionPool, args.tickUpperIndex);
|
|
13457
13605
|
const remainingAccounts = [
|
|
13458
|
-
{ address: swapTickArrays[0], role:
|
|
13459
|
-
{ address: swapTickArrays[1], role:
|
|
13460
|
-
{ address: swapTickArrays[2], role:
|
|
13461
|
-
{ address: swapTickArrays[3], role:
|
|
13462
|
-
{ address: swapTickArrays[4], role:
|
|
13463
|
-
{ address: lowerTickArrayAddress, role:
|
|
13464
|
-
{ address: upperTickArrayAddress, role:
|
|
13465
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
13466
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
13606
|
+
{ address: swapTickArrays[0], role: import_kit97.AccountRole.WRITABLE },
|
|
13607
|
+
{ address: swapTickArrays[1], role: import_kit97.AccountRole.WRITABLE },
|
|
13608
|
+
{ address: swapTickArrays[2], role: import_kit97.AccountRole.WRITABLE },
|
|
13609
|
+
{ address: swapTickArrays[3], role: import_kit97.AccountRole.WRITABLE },
|
|
13610
|
+
{ address: swapTickArrays[4], role: import_kit97.AccountRole.WRITABLE },
|
|
13611
|
+
{ address: lowerTickArrayAddress, role: import_kit97.AccountRole.WRITABLE },
|
|
13612
|
+
{ address: upperTickArrayAddress, role: import_kit97.AccountRole.WRITABLE },
|
|
13613
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit97.AccountRole.WRITABLE },
|
|
13614
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit97.AccountRole.WRITABLE }
|
|
13467
13615
|
];
|
|
13468
13616
|
const remainingAccountsInfo = {
|
|
13469
13617
|
slices: [
|
|
@@ -13513,7 +13661,7 @@ async function openAndIncreaseTunaLpPositionFusionInstruction(authority, positio
|
|
|
13513
13661
|
|
|
13514
13662
|
// src/txbuilder/openAndIncreaseTunaSpotPositionFusion.ts
|
|
13515
13663
|
var import_fusionamm_client15 = require("@crypticdot/fusionamm-client");
|
|
13516
|
-
var
|
|
13664
|
+
var import_kit98 = require("@solana/kit");
|
|
13517
13665
|
var import_memo20 = require("@solana-program/memo");
|
|
13518
13666
|
var import_token_202229 = require("@solana-program/token-2022");
|
|
13519
13667
|
var import_assert22 = __toESM(require("assert"));
|
|
@@ -13521,7 +13669,7 @@ async function openAndIncreaseTunaSpotPositionFusionInstructions(rpc, authority,
|
|
|
13521
13669
|
const instructions = [];
|
|
13522
13670
|
if (!createInstructions) createInstructions = instructions;
|
|
13523
13671
|
if (!cleanupInstructions) cleanupInstructions = instructions;
|
|
13524
|
-
const positionMint = await (0,
|
|
13672
|
+
const positionMint = await (0, import_kit98.generateKeyPairSigner)();
|
|
13525
13673
|
const tunaConfig = await fetchTunaConfig(rpc, (await getTunaConfigAddress())[0]);
|
|
13526
13674
|
const fusionPool = await (0, import_fusionamm_client15.fetchMaybeFusionPool)(rpc, fusionPoolAddress);
|
|
13527
13675
|
if (!fusionPool.exists) throw new Error("FusionPool account not found");
|
|
@@ -13621,13 +13769,13 @@ async function openAndIncreaseTunaSpotPositionFusionInstruction(authority, posit
|
|
|
13621
13769
|
}))[0];
|
|
13622
13770
|
const swapTickArrays = await FusionUtils.getSwapTickArrayAddresses(fusionPool);
|
|
13623
13771
|
const remainingAccounts = [
|
|
13624
|
-
{ address: swapTickArrays[0], role:
|
|
13625
|
-
{ address: swapTickArrays[1], role:
|
|
13626
|
-
{ address: swapTickArrays[2], role:
|
|
13627
|
-
{ address: swapTickArrays[3], role:
|
|
13628
|
-
{ address: swapTickArrays[4], role:
|
|
13629
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
13630
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
13772
|
+
{ address: swapTickArrays[0], role: import_kit98.AccountRole.WRITABLE },
|
|
13773
|
+
{ address: swapTickArrays[1], role: import_kit98.AccountRole.WRITABLE },
|
|
13774
|
+
{ address: swapTickArrays[2], role: import_kit98.AccountRole.WRITABLE },
|
|
13775
|
+
{ address: swapTickArrays[3], role: import_kit98.AccountRole.WRITABLE },
|
|
13776
|
+
{ address: swapTickArrays[4], role: import_kit98.AccountRole.WRITABLE },
|
|
13777
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit98.AccountRole.WRITABLE },
|
|
13778
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit98.AccountRole.WRITABLE }
|
|
13631
13779
|
];
|
|
13632
13780
|
const remainingAccountsInfo = {
|
|
13633
13781
|
slices: [
|
|
@@ -13671,7 +13819,7 @@ async function openAndIncreaseTunaSpotPositionFusionInstruction(authority, posit
|
|
|
13671
13819
|
|
|
13672
13820
|
// src/txbuilder/openAndIncreaseTunaSpotPositionOrca.ts
|
|
13673
13821
|
var import_whirlpools_client14 = require("@orca-so/whirlpools-client");
|
|
13674
|
-
var
|
|
13822
|
+
var import_kit99 = require("@solana/kit");
|
|
13675
13823
|
var import_memo21 = require("@solana-program/memo");
|
|
13676
13824
|
var import_token_202230 = require("@solana-program/token-2022");
|
|
13677
13825
|
var import_assert23 = __toESM(require("assert"));
|
|
@@ -13679,7 +13827,7 @@ async function openAndIncreaseTunaSpotPositionOrcaInstructions(rpc, authority, w
|
|
|
13679
13827
|
const instructions = [];
|
|
13680
13828
|
if (!createInstructions) createInstructions = instructions;
|
|
13681
13829
|
if (!cleanupInstructions) cleanupInstructions = instructions;
|
|
13682
|
-
const positionMint = await (0,
|
|
13830
|
+
const positionMint = await (0, import_kit99.generateKeyPairSigner)();
|
|
13683
13831
|
const tunaConfig = await fetchTunaConfig(rpc, (await getTunaConfigAddress())[0]);
|
|
13684
13832
|
const whirlpool = await (0, import_whirlpools_client14.fetchMaybeWhirlpool)(rpc, whirlpoolAddress);
|
|
13685
13833
|
if (!whirlpool.exists) throw new Error("Whirlpool account not found");
|
|
@@ -13780,14 +13928,14 @@ async function openAndIncreaseTunaSpotPositionOrcaInstruction(authority, positio
|
|
|
13780
13928
|
}))[0];
|
|
13781
13929
|
const swapTickArrays = await OrcaUtils.getSwapTickArrayAddresses(whirlpool);
|
|
13782
13930
|
const remainingAccounts = [
|
|
13783
|
-
{ address: swapTickArrays[0], role:
|
|
13784
|
-
{ address: swapTickArrays[1], role:
|
|
13785
|
-
{ address: swapTickArrays[2], role:
|
|
13786
|
-
{ address: swapTickArrays[3], role:
|
|
13787
|
-
{ address: swapTickArrays[4], role:
|
|
13788
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
13789
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
13790
|
-
{ address: orcaOracleAddress, role:
|
|
13931
|
+
{ address: swapTickArrays[0], role: import_kit99.AccountRole.WRITABLE },
|
|
13932
|
+
{ address: swapTickArrays[1], role: import_kit99.AccountRole.WRITABLE },
|
|
13933
|
+
{ address: swapTickArrays[2], role: import_kit99.AccountRole.WRITABLE },
|
|
13934
|
+
{ address: swapTickArrays[3], role: import_kit99.AccountRole.WRITABLE },
|
|
13935
|
+
{ address: swapTickArrays[4], role: import_kit99.AccountRole.WRITABLE },
|
|
13936
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit99.AccountRole.WRITABLE },
|
|
13937
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit99.AccountRole.WRITABLE },
|
|
13938
|
+
{ address: orcaOracleAddress, role: import_kit99.AccountRole.WRITABLE }
|
|
13791
13939
|
];
|
|
13792
13940
|
const remainingAccountsInfo = {
|
|
13793
13941
|
slices: [
|
|
@@ -13922,7 +14070,7 @@ async function openTunaSpotPositionOrcaInstruction(authority, positionMint, mint
|
|
|
13922
14070
|
// src/txbuilder/decreaseTunaLpPositionOrca.ts
|
|
13923
14071
|
var import_whirlpools_client16 = require("@orca-so/whirlpools-client");
|
|
13924
14072
|
var import_whirlpools_core5 = require("@orca-so/whirlpools-core");
|
|
13925
|
-
var
|
|
14073
|
+
var import_kit100 = require("@solana/kit");
|
|
13926
14074
|
var import_memo22 = require("@solana-program/memo");
|
|
13927
14075
|
var import_token_202233 = require("@solana-program/token-2022");
|
|
13928
14076
|
var import_assert26 = __toESM(require("assert"));
|
|
@@ -13944,7 +14092,7 @@ async function decreaseTunaLpPositionOrcaInstructions(rpc, authority, positionMi
|
|
|
13944
14092
|
const allMints = [mintA, mintB, ...rewardMints];
|
|
13945
14093
|
(0, import_assert26.default)(mintA.exists, "Token A account not found");
|
|
13946
14094
|
(0, import_assert26.default)(mintB.exists, "Token B account not found");
|
|
13947
|
-
(0,
|
|
14095
|
+
(0, import_kit100.assertAccountsExist)(rewardMints);
|
|
13948
14096
|
const lowerTickArrayStartIndex = (0, import_whirlpools_core5.getTickArrayStartTickIndex)(
|
|
13949
14097
|
tunaPosition.data.tickLowerIndex,
|
|
13950
14098
|
whirlpool.data.tickSpacing
|
|
@@ -14057,16 +14205,16 @@ async function decreaseTunaLpPositionOrcaInstruction(authority, tunaPosition, mi
|
|
|
14057
14205
|
tunaPosition.data.tickUpperIndex
|
|
14058
14206
|
);
|
|
14059
14207
|
const remainingAccounts = [
|
|
14060
|
-
{ address: swapTickArrays[0], role:
|
|
14061
|
-
{ address: swapTickArrays[1], role:
|
|
14062
|
-
{ address: swapTickArrays[2], role:
|
|
14063
|
-
{ address: swapTickArrays[3], role:
|
|
14064
|
-
{ address: swapTickArrays[4], role:
|
|
14065
|
-
{ address: lowerTickArrayAddress, role:
|
|
14066
|
-
{ address: upperTickArrayAddress, role:
|
|
14067
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
14068
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
14069
|
-
{ address: orcaOracleAddress, role:
|
|
14208
|
+
{ address: swapTickArrays[0], role: import_kit100.AccountRole.WRITABLE },
|
|
14209
|
+
{ address: swapTickArrays[1], role: import_kit100.AccountRole.WRITABLE },
|
|
14210
|
+
{ address: swapTickArrays[2], role: import_kit100.AccountRole.WRITABLE },
|
|
14211
|
+
{ address: swapTickArrays[3], role: import_kit100.AccountRole.WRITABLE },
|
|
14212
|
+
{ address: swapTickArrays[4], role: import_kit100.AccountRole.WRITABLE },
|
|
14213
|
+
{ address: lowerTickArrayAddress, role: import_kit100.AccountRole.WRITABLE },
|
|
14214
|
+
{ address: upperTickArrayAddress, role: import_kit100.AccountRole.WRITABLE },
|
|
14215
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit100.AccountRole.WRITABLE },
|
|
14216
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit100.AccountRole.WRITABLE },
|
|
14217
|
+
{ address: orcaOracleAddress, role: import_kit100.AccountRole.WRITABLE }
|
|
14070
14218
|
];
|
|
14071
14219
|
for (const rewardIndex of rewardIndicesToClaim) {
|
|
14072
14220
|
const rewardInfo = whirlpool.data.rewardInfos[rewardIndex];
|
|
@@ -14077,10 +14225,10 @@ async function decreaseTunaLpPositionOrcaInstruction(authority, tunaPosition, mi
|
|
|
14077
14225
|
mint: rewardMint.address,
|
|
14078
14226
|
tokenProgram: rewardMint.programAddress
|
|
14079
14227
|
});
|
|
14080
|
-
remainingAccounts.push({ address: rewardMint.address, role:
|
|
14081
|
-
remainingAccounts.push({ address: rewardMint.programAddress, role:
|
|
14082
|
-
remainingAccounts.push({ address: ownerAta[0], role:
|
|
14083
|
-
remainingAccounts.push({ address: rewardInfo.vault, role:
|
|
14228
|
+
remainingAccounts.push({ address: rewardMint.address, role: import_kit100.AccountRole.READONLY });
|
|
14229
|
+
remainingAccounts.push({ address: rewardMint.programAddress, role: import_kit100.AccountRole.READONLY });
|
|
14230
|
+
remainingAccounts.push({ address: ownerAta[0], role: import_kit100.AccountRole.WRITABLE });
|
|
14231
|
+
remainingAccounts.push({ address: rewardInfo.vault, role: import_kit100.AccountRole.WRITABLE });
|
|
14084
14232
|
}
|
|
14085
14233
|
const remainingAccountsInfo = {
|
|
14086
14234
|
slices: [
|
|
@@ -14128,7 +14276,7 @@ async function decreaseTunaLpPositionOrcaInstruction(authority, tunaPosition, mi
|
|
|
14128
14276
|
|
|
14129
14277
|
// src/txbuilder/decreaseTunaLpPositionFusion.ts
|
|
14130
14278
|
var import_fusionamm_client17 = require("@crypticdot/fusionamm-client");
|
|
14131
|
-
var
|
|
14279
|
+
var import_kit101 = require("@solana/kit");
|
|
14132
14280
|
var import_memo23 = require("@solana-program/memo");
|
|
14133
14281
|
var import_token_202234 = require("@solana-program/token-2022");
|
|
14134
14282
|
var import_assert27 = __toESM(require("assert"));
|
|
@@ -14229,15 +14377,15 @@ async function decreaseTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
14229
14377
|
tunaPosition.data.tickUpperIndex
|
|
14230
14378
|
);
|
|
14231
14379
|
const remainingAccounts = [
|
|
14232
|
-
{ address: swapTickArrays[0], role:
|
|
14233
|
-
{ address: swapTickArrays[1], role:
|
|
14234
|
-
{ address: swapTickArrays[2], role:
|
|
14235
|
-
{ address: swapTickArrays[3], role:
|
|
14236
|
-
{ address: swapTickArrays[4], role:
|
|
14237
|
-
{ address: lowerTickArrayAddress, role:
|
|
14238
|
-
{ address: upperTickArrayAddress, role:
|
|
14239
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
14240
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
14380
|
+
{ address: swapTickArrays[0], role: import_kit101.AccountRole.WRITABLE },
|
|
14381
|
+
{ address: swapTickArrays[1], role: import_kit101.AccountRole.WRITABLE },
|
|
14382
|
+
{ address: swapTickArrays[2], role: import_kit101.AccountRole.WRITABLE },
|
|
14383
|
+
{ address: swapTickArrays[3], role: import_kit101.AccountRole.WRITABLE },
|
|
14384
|
+
{ address: swapTickArrays[4], role: import_kit101.AccountRole.WRITABLE },
|
|
14385
|
+
{ address: lowerTickArrayAddress, role: import_kit101.AccountRole.WRITABLE },
|
|
14386
|
+
{ address: upperTickArrayAddress, role: import_kit101.AccountRole.WRITABLE },
|
|
14387
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit101.AccountRole.WRITABLE },
|
|
14388
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit101.AccountRole.WRITABLE }
|
|
14241
14389
|
];
|
|
14242
14390
|
const remainingAccountsInfo = {
|
|
14243
14391
|
slices: [
|
|
@@ -14326,6 +14474,56 @@ async function setTunaLpPositionLimitOrdersInstruction(authority, args, position
|
|
|
14326
14474
|
});
|
|
14327
14475
|
}
|
|
14328
14476
|
|
|
14477
|
+
// src/txbuilder/setTunaSpotPositionLimitOrders.ts
|
|
14478
|
+
async function setTunaSpotPositionLimitOrdersInstruction(authority, args, positionMint, tunaPositionAddress) {
|
|
14479
|
+
if (tunaPositionAddress === void 0) {
|
|
14480
|
+
if (positionMint === void 0) {
|
|
14481
|
+
throw new Error("At least one of 'positionMint' or 'tunaPositionAddress' must be provided.");
|
|
14482
|
+
}
|
|
14483
|
+
tunaPositionAddress = (await getTunaSpotPositionAddress(positionMint))[0];
|
|
14484
|
+
}
|
|
14485
|
+
return getSetTunaSpotPositionLimitOrdersInstruction({
|
|
14486
|
+
...args,
|
|
14487
|
+
authority,
|
|
14488
|
+
tunaPosition: tunaPositionAddress
|
|
14489
|
+
});
|
|
14490
|
+
}
|
|
14491
|
+
|
|
14492
|
+
// src/txbuilder/resetTunaSpotPosition.ts
|
|
14493
|
+
var import_token_202236 = require("@solana-program/token-2022");
|
|
14494
|
+
var import_assert28 = __toESM(require("assert"));
|
|
14495
|
+
async function resetTunaSpotPositionInstruction(rpc, authority, args, positionMint, tunaPositionAddress) {
|
|
14496
|
+
if (tunaPositionAddress === void 0) {
|
|
14497
|
+
if (positionMint === void 0) {
|
|
14498
|
+
throw new Error("At least one of 'positionMint' or 'tunaPositionAddress' must be provided.");
|
|
14499
|
+
}
|
|
14500
|
+
tunaPositionAddress = (await getTunaSpotPositionAddress(positionMint))[0];
|
|
14501
|
+
}
|
|
14502
|
+
const tunaPosition = await fetchTunaSpotPosition(rpc, tunaPositionAddress);
|
|
14503
|
+
const [mintA, mintB] = await (0, import_token_202236.fetchAllMaybeMint)(rpc, [tunaPosition.data.mintA, tunaPosition.data.mintB]);
|
|
14504
|
+
(0, import_assert28.default)(mintA.exists, "Token A not found");
|
|
14505
|
+
(0, import_assert28.default)(mintB.exists, "Token B not found");
|
|
14506
|
+
const tunaPositionAtaA = (await (0, import_token_202236.findAssociatedTokenPda)({
|
|
14507
|
+
owner: tunaPositionAddress,
|
|
14508
|
+
mint: mintA.address,
|
|
14509
|
+
tokenProgram: mintA.programAddress
|
|
14510
|
+
}))[0];
|
|
14511
|
+
const tunaPositionAtaB = (await (0, import_token_202236.findAssociatedTokenPda)({
|
|
14512
|
+
owner: tunaPositionAddress,
|
|
14513
|
+
mint: mintB.address,
|
|
14514
|
+
tokenProgram: mintB.programAddress
|
|
14515
|
+
}))[0];
|
|
14516
|
+
return getResetTunaSpotPositionInstruction({
|
|
14517
|
+
...args,
|
|
14518
|
+
authority,
|
|
14519
|
+
mintA: tunaPosition.data.mintA,
|
|
14520
|
+
mintB: tunaPosition.data.mintB,
|
|
14521
|
+
tunaPositionAtaA,
|
|
14522
|
+
tunaPositionAtaB,
|
|
14523
|
+
tunaPosition: tunaPositionAddress
|
|
14524
|
+
});
|
|
14525
|
+
}
|
|
14526
|
+
|
|
14329
14527
|
// src/txbuilder/updateMarket.ts
|
|
14330
14528
|
async function updateMarketInstruction(authority, pool, args) {
|
|
14331
14529
|
const tunaConfig = (await getTunaConfigAddress())[0];
|
|
@@ -14352,10 +14550,10 @@ async function updateVaultInstruction(authority, mint, args) {
|
|
|
14352
14550
|
|
|
14353
14551
|
// src/txbuilder/withdraw.ts
|
|
14354
14552
|
var import_memo25 = require("@solana-program/memo");
|
|
14355
|
-
var
|
|
14553
|
+
var import_token_202237 = require("@solana-program/token-2022");
|
|
14356
14554
|
async function withdrawInstructions(rpc, authority, mintAddress, funds, shares) {
|
|
14357
14555
|
const instructions = [];
|
|
14358
|
-
const mint = await (0,
|
|
14556
|
+
const mint = await (0, import_token_202237.fetchMaybeMint)(rpc, mintAddress);
|
|
14359
14557
|
if (!mint.exists) throw new Error("Mint account not found");
|
|
14360
14558
|
const createUserAtaInstructions = await getCreateAtaInstructions(
|
|
14361
14559
|
rpc,
|
|
@@ -14374,12 +14572,12 @@ async function withdrawInstruction(authority, mint, funds, shares) {
|
|
|
14374
14572
|
const tunaConfig = (await getTunaConfigAddress())[0];
|
|
14375
14573
|
const lendingPosition = (await getLendingPositionAddress(authority.address, mint.address))[0];
|
|
14376
14574
|
const vault = (await getLendingVaultAddress(mint.address))[0];
|
|
14377
|
-
const vaultAta = (await (0,
|
|
14575
|
+
const vaultAta = (await (0, import_token_202237.findAssociatedTokenPda)({
|
|
14378
14576
|
owner: vault,
|
|
14379
14577
|
mint: mint.address,
|
|
14380
14578
|
tokenProgram: mint.programAddress
|
|
14381
14579
|
}))[0];
|
|
14382
|
-
const authorityAta = (await (0,
|
|
14580
|
+
const authorityAta = (await (0, import_token_202237.findAssociatedTokenPda)({
|
|
14383
14581
|
owner: authority.address,
|
|
14384
14582
|
mint: mint.address,
|
|
14385
14583
|
tokenProgram: mint.programAddress
|
|
@@ -14402,25 +14600,25 @@ async function withdrawInstruction(authority, mint, funds, shares) {
|
|
|
14402
14600
|
// src/txbuilder/createMarketLookupTable.ts
|
|
14403
14601
|
var import_fusionamm_client18 = require("@crypticdot/fusionamm-client");
|
|
14404
14602
|
var import_whirlpools_client17 = require("@orca-so/whirlpools-client");
|
|
14405
|
-
var
|
|
14603
|
+
var import_kit102 = require("@solana/kit");
|
|
14406
14604
|
var import_memo26 = require("@solana-program/memo");
|
|
14407
14605
|
var import_system2 = require("@solana-program/system");
|
|
14408
14606
|
var import_token2 = require("@solana-program/token");
|
|
14409
|
-
var
|
|
14607
|
+
var import_token_202238 = require("@solana-program/token-2022");
|
|
14410
14608
|
async function getAddressesForMarketLookupTable(rpc, poolAddress, marketMaker) {
|
|
14411
14609
|
const tunaConfigAddress = (await getTunaConfigAddress())[0];
|
|
14412
14610
|
const marketAddress = (await getMarketAddress(poolAddress))[0];
|
|
14413
14611
|
const orcaOracleAddress = (await (0, import_whirlpools_client17.getOracleAddress)(poolAddress))[0];
|
|
14414
14612
|
const tunaConfig = await fetchTunaConfig(rpc, tunaConfigAddress);
|
|
14415
14613
|
const pool = marketMaker == 0 /* Orca */ ? await (0, import_whirlpools_client17.fetchWhirlpool)(rpc, poolAddress) : await (0, import_fusionamm_client18.fetchFusionPool)(rpc, poolAddress);
|
|
14416
|
-
const mintA = await (0,
|
|
14417
|
-
const mintB = await (0,
|
|
14418
|
-
const feeRecipientAtaA = (await (0,
|
|
14614
|
+
const mintA = await (0, import_token_202238.fetchMint)(rpc, pool.data.tokenMintA);
|
|
14615
|
+
const mintB = await (0, import_token_202238.fetchMint)(rpc, pool.data.tokenMintB);
|
|
14616
|
+
const feeRecipientAtaA = (await (0, import_token_202238.findAssociatedTokenPda)({
|
|
14419
14617
|
owner: tunaConfig.data.feeRecipient,
|
|
14420
14618
|
mint: mintA.address,
|
|
14421
14619
|
tokenProgram: mintA.programAddress
|
|
14422
14620
|
}))[0];
|
|
14423
|
-
const feeRecipientAtaB = (await (0,
|
|
14621
|
+
const feeRecipientAtaB = (await (0, import_token_202238.findAssociatedTokenPda)({
|
|
14424
14622
|
owner: tunaConfig.data.feeRecipient,
|
|
14425
14623
|
mint: mintB.address,
|
|
14426
14624
|
tokenProgram: mintB.programAddress
|
|
@@ -14429,22 +14627,22 @@ async function getAddressesForMarketLookupTable(rpc, poolAddress, marketMaker) {
|
|
|
14429
14627
|
(await getLendingVaultAddress(mintA.address))[0],
|
|
14430
14628
|
(await getLendingVaultAddress(mintB.address))[0]
|
|
14431
14629
|
]);
|
|
14432
|
-
const vaultAAta = (await (0,
|
|
14630
|
+
const vaultAAta = (await (0, import_token_202238.findAssociatedTokenPda)({
|
|
14433
14631
|
owner: vaultA.address,
|
|
14434
14632
|
mint: mintA.address,
|
|
14435
14633
|
tokenProgram: mintA.programAddress
|
|
14436
14634
|
}))[0];
|
|
14437
|
-
const vaultBAta = (await (0,
|
|
14635
|
+
const vaultBAta = (await (0, import_token_202238.findAssociatedTokenPda)({
|
|
14438
14636
|
owner: vaultB.address,
|
|
14439
14637
|
mint: mintB.address,
|
|
14440
14638
|
tokenProgram: mintB.programAddress
|
|
14441
14639
|
}))[0];
|
|
14442
14640
|
const addresses = [
|
|
14443
14641
|
import_system2.SYSTEM_PROGRAM_ADDRESS,
|
|
14444
|
-
(0,
|
|
14445
|
-
|
|
14642
|
+
(0, import_kit102.address)("SysvarRent111111111111111111111111111111111"),
|
|
14643
|
+
import_token_202238.ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
14446
14644
|
import_token2.TOKEN_PROGRAM_ADDRESS,
|
|
14447
|
-
|
|
14645
|
+
import_token_202238.TOKEN_2022_PROGRAM_ADDRESS,
|
|
14448
14646
|
NATIVE_MINT,
|
|
14449
14647
|
import_memo26.MEMO_PROGRAM_ADDRESS,
|
|
14450
14648
|
tunaConfigAddress,
|
|
@@ -14489,16 +14687,16 @@ async function createAddressLookupTableForMarketInstructions(rpc, poolAddress, m
|
|
|
14489
14687
|
|
|
14490
14688
|
// src/txbuilder/repayTunaLpPositionDebt.ts
|
|
14491
14689
|
var import_memo27 = require("@solana-program/memo");
|
|
14492
|
-
var
|
|
14493
|
-
var
|
|
14690
|
+
var import_token_202239 = require("@solana-program/token-2022");
|
|
14691
|
+
var import_assert29 = __toESM(require("assert"));
|
|
14494
14692
|
async function repayTunaLpPositionDebtInstructions(rpc, authority, positionMint, collateralA, collateralB, createInstructions, cleanupInstructions) {
|
|
14495
14693
|
const instructions = [];
|
|
14496
14694
|
if (!createInstructions) createInstructions = instructions;
|
|
14497
14695
|
if (!cleanupInstructions) cleanupInstructions = instructions;
|
|
14498
14696
|
const tunaPosition = await fetchTunaLpPosition(rpc, (await getTunaLpPositionAddress(positionMint))[0]);
|
|
14499
|
-
const [mintA, mintB] = await (0,
|
|
14500
|
-
(0,
|
|
14501
|
-
(0,
|
|
14697
|
+
const [mintA, mintB] = await (0, import_token_202239.fetchAllMaybeMint)(rpc, [tunaPosition.data.mintA, tunaPosition.data.mintB]);
|
|
14698
|
+
(0, import_assert29.default)(mintA.exists, "Token A not found");
|
|
14699
|
+
(0, import_assert29.default)(mintB.exists, "Token B not found");
|
|
14502
14700
|
const marketAddress = (await getMarketAddress(tunaPosition.data.pool))[0];
|
|
14503
14701
|
const createUserAtaAInstructions = await getCreateAtaInstructions(
|
|
14504
14702
|
rpc,
|
|
@@ -14534,34 +14732,34 @@ async function repayTunaLpPositionDebtInstructions(rpc, authority, positionMint,
|
|
|
14534
14732
|
}
|
|
14535
14733
|
async function repayTunaLpPositionDebtInstruction(authority, positionMint, mintA, mintB, marketAddress, collateralA, collateralB) {
|
|
14536
14734
|
const tunaPositionAddress = (await getTunaLpPositionAddress(positionMint))[0];
|
|
14537
|
-
const tunaPositionOwnerAtaA = (await (0,
|
|
14735
|
+
const tunaPositionOwnerAtaA = (await (0, import_token_202239.findAssociatedTokenPda)({
|
|
14538
14736
|
owner: authority.address,
|
|
14539
14737
|
mint: mintA.address,
|
|
14540
14738
|
tokenProgram: mintA.programAddress
|
|
14541
14739
|
}))[0];
|
|
14542
|
-
const tunaPositionOwnerAtaB = (await (0,
|
|
14740
|
+
const tunaPositionOwnerAtaB = (await (0, import_token_202239.findAssociatedTokenPda)({
|
|
14543
14741
|
owner: authority.address,
|
|
14544
14742
|
mint: mintB.address,
|
|
14545
14743
|
tokenProgram: mintB.programAddress
|
|
14546
14744
|
}))[0];
|
|
14547
|
-
const tunaPositionAtaA = (await (0,
|
|
14745
|
+
const tunaPositionAtaA = (await (0, import_token_202239.findAssociatedTokenPda)({
|
|
14548
14746
|
owner: tunaPositionAddress,
|
|
14549
14747
|
mint: mintA.address,
|
|
14550
14748
|
tokenProgram: mintA.programAddress
|
|
14551
14749
|
}))[0];
|
|
14552
|
-
const tunaPositionAtaB = (await (0,
|
|
14750
|
+
const tunaPositionAtaB = (await (0, import_token_202239.findAssociatedTokenPda)({
|
|
14553
14751
|
owner: tunaPositionAddress,
|
|
14554
14752
|
mint: mintB.address,
|
|
14555
14753
|
tokenProgram: mintB.programAddress
|
|
14556
14754
|
}))[0];
|
|
14557
14755
|
const vaultAAddress = (await getLendingVaultAddress(mintA.address))[0];
|
|
14558
|
-
const vaultAAta = (await (0,
|
|
14756
|
+
const vaultAAta = (await (0, import_token_202239.findAssociatedTokenPda)({
|
|
14559
14757
|
owner: vaultAAddress,
|
|
14560
14758
|
mint: mintA.address,
|
|
14561
14759
|
tokenProgram: mintA.programAddress
|
|
14562
14760
|
}))[0];
|
|
14563
14761
|
const vaultBAddress = (await getLendingVaultAddress(mintB.address))[0];
|
|
14564
|
-
const vaultBAta = (await (0,
|
|
14762
|
+
const vaultBAta = (await (0, import_token_202239.findAssociatedTokenPda)({
|
|
14565
14763
|
owner: vaultBAddress,
|
|
14566
14764
|
mint: mintB.address,
|
|
14567
14765
|
tokenProgram: mintB.programAddress
|
|
@@ -14590,11 +14788,11 @@ async function repayTunaLpPositionDebtInstruction(authority, positionMint, mintA
|
|
|
14590
14788
|
|
|
14591
14789
|
// src/txbuilder/rebalanceTunaLpPositionOrca.ts
|
|
14592
14790
|
var import_whirlpools_client18 = require("@orca-so/whirlpools-client");
|
|
14593
|
-
var
|
|
14791
|
+
var import_kit103 = require("@solana/kit");
|
|
14594
14792
|
var import_sysvars3 = require("@solana/sysvars");
|
|
14595
14793
|
var import_memo28 = require("@solana-program/memo");
|
|
14596
|
-
var
|
|
14597
|
-
var
|
|
14794
|
+
var import_token_202240 = require("@solana-program/token-2022");
|
|
14795
|
+
var import_assert30 = __toESM(require("assert"));
|
|
14598
14796
|
async function rebalanceTunaLpPositionOrcaInstructions(rpc, authority, positionMint, createInstructions, cleanupInstructions) {
|
|
14599
14797
|
const rent = await (0, import_sysvars3.fetchSysvarRent)(rpc);
|
|
14600
14798
|
let nonRefundableRent = 0n;
|
|
@@ -14607,9 +14805,9 @@ async function rebalanceTunaLpPositionOrcaInstructions(rpc, authority, positionM
|
|
|
14607
14805
|
(await getLendingVaultAddress(whirlpool.data.tokenMintA))[0],
|
|
14608
14806
|
(await getLendingVaultAddress(whirlpool.data.tokenMintB))[0]
|
|
14609
14807
|
]);
|
|
14610
|
-
const [mintA, mintB] = await (0,
|
|
14611
|
-
(0,
|
|
14612
|
-
(0,
|
|
14808
|
+
const [mintA, mintB] = await (0, import_token_202240.fetchAllMaybeMint)(rpc, [whirlpool.data.tokenMintA, whirlpool.data.tokenMintB]);
|
|
14809
|
+
(0, import_assert30.default)(mintA.exists, "Token A account not found");
|
|
14810
|
+
(0, import_assert30.default)(mintB.exists, "Token B account not found");
|
|
14613
14811
|
const instructions = [];
|
|
14614
14812
|
if (!createInstructions) createInstructions = instructions;
|
|
14615
14813
|
if (!cleanupInstructions) cleanupInstructions = instructions;
|
|
@@ -14673,7 +14871,7 @@ async function rebalanceTunaLpPositionOrcaInstructions(rpc, authority, positionM
|
|
|
14673
14871
|
cleanupInstructions.push(...internalCleanupInstructions);
|
|
14674
14872
|
return {
|
|
14675
14873
|
instructions,
|
|
14676
|
-
initializationCost: (0,
|
|
14874
|
+
initializationCost: (0, import_kit103.lamports)(nonRefundableRent)
|
|
14677
14875
|
};
|
|
14678
14876
|
}
|
|
14679
14877
|
async function rebalanceTunaLpPositionOrcaInstruction(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, whirlpool) {
|
|
@@ -14681,27 +14879,27 @@ async function rebalanceTunaLpPositionOrcaInstruction(authority, tunaPosition, t
|
|
|
14681
14879
|
const marketAddress = (await getMarketAddress(whirlpool.address))[0];
|
|
14682
14880
|
const orcaPositionAddress = (await (0, import_whirlpools_client18.getPositionAddress)(positionMint))[0];
|
|
14683
14881
|
const orcaOracleAddress = (await (0, import_whirlpools_client18.getOracleAddress)(whirlpool.address))[0];
|
|
14684
|
-
const tunaPositionAta = (await (0,
|
|
14882
|
+
const tunaPositionAta = (await (0, import_token_202240.findAssociatedTokenPda)({
|
|
14685
14883
|
owner: tunaPosition.address,
|
|
14686
14884
|
mint: positionMint,
|
|
14687
|
-
tokenProgram:
|
|
14885
|
+
tokenProgram: import_token_202240.TOKEN_2022_PROGRAM_ADDRESS
|
|
14688
14886
|
}))[0];
|
|
14689
|
-
const tunaPositionAtaA = (await (0,
|
|
14887
|
+
const tunaPositionAtaA = (await (0, import_token_202240.findAssociatedTokenPda)({
|
|
14690
14888
|
owner: tunaPosition.address,
|
|
14691
14889
|
mint: mintA.address,
|
|
14692
14890
|
tokenProgram: mintA.programAddress
|
|
14693
14891
|
}))[0];
|
|
14694
|
-
const tunaPositionAtaB = (await (0,
|
|
14892
|
+
const tunaPositionAtaB = (await (0, import_token_202240.findAssociatedTokenPda)({
|
|
14695
14893
|
owner: tunaPosition.address,
|
|
14696
14894
|
mint: mintB.address,
|
|
14697
14895
|
tokenProgram: mintB.programAddress
|
|
14698
14896
|
}))[0];
|
|
14699
|
-
const feeRecipientAtaA = (await (0,
|
|
14897
|
+
const feeRecipientAtaA = (await (0, import_token_202240.findAssociatedTokenPda)({
|
|
14700
14898
|
owner: tunaConfig.data.feeRecipient,
|
|
14701
14899
|
mint: mintA.address,
|
|
14702
14900
|
tokenProgram: mintA.programAddress
|
|
14703
14901
|
}))[0];
|
|
14704
|
-
const feeRecipientAtaB = (await (0,
|
|
14902
|
+
const feeRecipientAtaB = (await (0, import_token_202240.findAssociatedTokenPda)({
|
|
14705
14903
|
owner: tunaConfig.data.feeRecipient,
|
|
14706
14904
|
mint: mintB.address,
|
|
14707
14905
|
tokenProgram: mintB.programAddress
|
|
@@ -14717,18 +14915,18 @@ async function rebalanceTunaLpPositionOrcaInstruction(authority, tunaPosition, t
|
|
|
14717
14915
|
);
|
|
14718
14916
|
const secondaryTickArrays = await OrcaUtils.getTickArraysForRebalancedPosition(whirlpool, tunaPosition);
|
|
14719
14917
|
const remainingAccounts = [
|
|
14720
|
-
{ address: swapTickArrays[0], role:
|
|
14721
|
-
{ address: swapTickArrays[1], role:
|
|
14722
|
-
{ address: swapTickArrays[2], role:
|
|
14723
|
-
{ address: swapTickArrays[3], role:
|
|
14724
|
-
{ address: swapTickArrays[4], role:
|
|
14725
|
-
{ address: lowerTickArrayAddress, role:
|
|
14726
|
-
{ address: upperTickArrayAddress, role:
|
|
14727
|
-
{ address: secondaryTickArrays.lowerTickArrayAddress, role:
|
|
14728
|
-
{ address: secondaryTickArrays.upperTickArrayAddress, role:
|
|
14729
|
-
{ address: whirlpool.data.tokenVaultA, role:
|
|
14730
|
-
{ address: whirlpool.data.tokenVaultB, role:
|
|
14731
|
-
{ address: orcaOracleAddress, role:
|
|
14918
|
+
{ address: swapTickArrays[0], role: import_kit103.AccountRole.WRITABLE },
|
|
14919
|
+
{ address: swapTickArrays[1], role: import_kit103.AccountRole.WRITABLE },
|
|
14920
|
+
{ address: swapTickArrays[2], role: import_kit103.AccountRole.WRITABLE },
|
|
14921
|
+
{ address: swapTickArrays[3], role: import_kit103.AccountRole.WRITABLE },
|
|
14922
|
+
{ address: swapTickArrays[4], role: import_kit103.AccountRole.WRITABLE },
|
|
14923
|
+
{ address: lowerTickArrayAddress, role: import_kit103.AccountRole.WRITABLE },
|
|
14924
|
+
{ address: upperTickArrayAddress, role: import_kit103.AccountRole.WRITABLE },
|
|
14925
|
+
{ address: secondaryTickArrays.lowerTickArrayAddress, role: import_kit103.AccountRole.WRITABLE },
|
|
14926
|
+
{ address: secondaryTickArrays.upperTickArrayAddress, role: import_kit103.AccountRole.WRITABLE },
|
|
14927
|
+
{ address: whirlpool.data.tokenVaultA, role: import_kit103.AccountRole.WRITABLE },
|
|
14928
|
+
{ address: whirlpool.data.tokenVaultB, role: import_kit103.AccountRole.WRITABLE },
|
|
14929
|
+
{ address: orcaOracleAddress, role: import_kit103.AccountRole.WRITABLE }
|
|
14732
14930
|
];
|
|
14733
14931
|
const remainingAccountsInfo = {
|
|
14734
14932
|
slices: [
|
|
@@ -14772,11 +14970,11 @@ async function rebalanceTunaLpPositionOrcaInstruction(authority, tunaPosition, t
|
|
|
14772
14970
|
|
|
14773
14971
|
// src/txbuilder/rebalanceTunaLpPositionFusion.ts
|
|
14774
14972
|
var import_fusionamm_client19 = require("@crypticdot/fusionamm-client");
|
|
14775
|
-
var
|
|
14973
|
+
var import_kit104 = require("@solana/kit");
|
|
14776
14974
|
var import_sysvars4 = require("@solana/sysvars");
|
|
14777
14975
|
var import_memo29 = require("@solana-program/memo");
|
|
14778
|
-
var
|
|
14779
|
-
var
|
|
14976
|
+
var import_token_202241 = require("@solana-program/token-2022");
|
|
14977
|
+
var import_assert31 = __toESM(require("assert"));
|
|
14780
14978
|
async function rebalanceTunaLpPositionFusionInstructions(rpc, authority, positionMint, createInstructions, cleanupInstructions) {
|
|
14781
14979
|
const rent = await (0, import_sysvars4.fetchSysvarRent)(rpc);
|
|
14782
14980
|
let nonRefundableRent = 0n;
|
|
@@ -14789,9 +14987,9 @@ async function rebalanceTunaLpPositionFusionInstructions(rpc, authority, positio
|
|
|
14789
14987
|
(await getLendingVaultAddress(fusionPool.data.tokenMintA))[0],
|
|
14790
14988
|
(await getLendingVaultAddress(fusionPool.data.tokenMintB))[0]
|
|
14791
14989
|
]);
|
|
14792
|
-
const [mintA, mintB] = await (0,
|
|
14793
|
-
(0,
|
|
14794
|
-
(0,
|
|
14990
|
+
const [mintA, mintB] = await (0, import_token_202241.fetchAllMaybeMint)(rpc, [fusionPool.data.tokenMintA, fusionPool.data.tokenMintB]);
|
|
14991
|
+
(0, import_assert31.default)(mintA.exists, "Token A account not found");
|
|
14992
|
+
(0, import_assert31.default)(mintB.exists, "Token B account not found");
|
|
14795
14993
|
const instructions = [];
|
|
14796
14994
|
if (!createInstructions) createInstructions = instructions;
|
|
14797
14995
|
if (!cleanupInstructions) cleanupInstructions = instructions;
|
|
@@ -14851,34 +15049,34 @@ async function rebalanceTunaLpPositionFusionInstructions(rpc, authority, positio
|
|
|
14851
15049
|
instructions.push(ix);
|
|
14852
15050
|
return {
|
|
14853
15051
|
instructions,
|
|
14854
|
-
initializationCost: (0,
|
|
15052
|
+
initializationCost: (0, import_kit104.lamports)(nonRefundableRent)
|
|
14855
15053
|
};
|
|
14856
15054
|
}
|
|
14857
15055
|
async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition, tunaConfig, mintA, mintB, vaultA, vaultB, fusionPool) {
|
|
14858
15056
|
const positionMint = tunaPosition.data.positionMint;
|
|
14859
15057
|
const marketAddress = (await getMarketAddress(fusionPool.address))[0];
|
|
14860
15058
|
const fusionPositionAddress = (await (0, import_fusionamm_client19.getPositionAddress)(positionMint))[0];
|
|
14861
|
-
const tunaPositionAta = (await (0,
|
|
15059
|
+
const tunaPositionAta = (await (0, import_token_202241.findAssociatedTokenPda)({
|
|
14862
15060
|
owner: tunaPosition.address,
|
|
14863
15061
|
mint: positionMint,
|
|
14864
|
-
tokenProgram:
|
|
15062
|
+
tokenProgram: import_token_202241.TOKEN_2022_PROGRAM_ADDRESS
|
|
14865
15063
|
}))[0];
|
|
14866
|
-
const tunaPositionAtaA = (await (0,
|
|
15064
|
+
const tunaPositionAtaA = (await (0, import_token_202241.findAssociatedTokenPda)({
|
|
14867
15065
|
owner: tunaPosition.address,
|
|
14868
15066
|
mint: mintA.address,
|
|
14869
15067
|
tokenProgram: mintA.programAddress
|
|
14870
15068
|
}))[0];
|
|
14871
|
-
const tunaPositionAtaB = (await (0,
|
|
15069
|
+
const tunaPositionAtaB = (await (0, import_token_202241.findAssociatedTokenPda)({
|
|
14872
15070
|
owner: tunaPosition.address,
|
|
14873
15071
|
mint: mintB.address,
|
|
14874
15072
|
tokenProgram: mintB.programAddress
|
|
14875
15073
|
}))[0];
|
|
14876
|
-
const feeRecipientAtaA = (await (0,
|
|
15074
|
+
const feeRecipientAtaA = (await (0, import_token_202241.findAssociatedTokenPda)({
|
|
14877
15075
|
owner: tunaConfig.data.feeRecipient,
|
|
14878
15076
|
mint: mintA.address,
|
|
14879
15077
|
tokenProgram: mintA.programAddress
|
|
14880
15078
|
}))[0];
|
|
14881
|
-
const feeRecipientAtaB = (await (0,
|
|
15079
|
+
const feeRecipientAtaB = (await (0, import_token_202241.findAssociatedTokenPda)({
|
|
14882
15080
|
owner: tunaConfig.data.feeRecipient,
|
|
14883
15081
|
mint: mintB.address,
|
|
14884
15082
|
tokenProgram: mintB.programAddress
|
|
@@ -14894,17 +15092,17 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
14894
15092
|
);
|
|
14895
15093
|
const secondaryTickArrays = await FusionUtils.getTickArraysForRebalancedPosition(fusionPool, tunaPosition);
|
|
14896
15094
|
const remainingAccounts = [
|
|
14897
|
-
{ address: swapTickArrays[0], role:
|
|
14898
|
-
{ address: swapTickArrays[1], role:
|
|
14899
|
-
{ address: swapTickArrays[2], role:
|
|
14900
|
-
{ address: swapTickArrays[3], role:
|
|
14901
|
-
{ address: swapTickArrays[4], role:
|
|
14902
|
-
{ address: lowerTickArrayAddress, role:
|
|
14903
|
-
{ address: upperTickArrayAddress, role:
|
|
14904
|
-
{ address: secondaryTickArrays.lowerTickArrayAddress, role:
|
|
14905
|
-
{ address: secondaryTickArrays.upperTickArrayAddress, role:
|
|
14906
|
-
{ address: fusionPool.data.tokenVaultA, role:
|
|
14907
|
-
{ address: fusionPool.data.tokenVaultB, role:
|
|
15095
|
+
{ address: swapTickArrays[0], role: import_kit104.AccountRole.WRITABLE },
|
|
15096
|
+
{ address: swapTickArrays[1], role: import_kit104.AccountRole.WRITABLE },
|
|
15097
|
+
{ address: swapTickArrays[2], role: import_kit104.AccountRole.WRITABLE },
|
|
15098
|
+
{ address: swapTickArrays[3], role: import_kit104.AccountRole.WRITABLE },
|
|
15099
|
+
{ address: swapTickArrays[4], role: import_kit104.AccountRole.WRITABLE },
|
|
15100
|
+
{ address: lowerTickArrayAddress, role: import_kit104.AccountRole.WRITABLE },
|
|
15101
|
+
{ address: upperTickArrayAddress, role: import_kit104.AccountRole.WRITABLE },
|
|
15102
|
+
{ address: secondaryTickArrays.lowerTickArrayAddress, role: import_kit104.AccountRole.WRITABLE },
|
|
15103
|
+
{ address: secondaryTickArrays.upperTickArrayAddress, role: import_kit104.AccountRole.WRITABLE },
|
|
15104
|
+
{ address: fusionPool.data.tokenVaultA, role: import_kit104.AccountRole.WRITABLE },
|
|
15105
|
+
{ address: fusionPool.data.tokenVaultB, role: import_kit104.AccountRole.WRITABLE }
|
|
14908
15106
|
];
|
|
14909
15107
|
const remainingAccountsInfo = {
|
|
14910
15108
|
slices: [
|
|
@@ -14968,6 +15166,7 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
14968
15166
|
DEFAULT_ADDRESS,
|
|
14969
15167
|
DEFAULT_MAX_AMOUNT_SLIPPAGE,
|
|
14970
15168
|
DEFAULT_MAX_SWAP_SLIPPAGE,
|
|
15169
|
+
DEFAULT_PUSH_ORACLE_PROGRAM_ID,
|
|
14971
15170
|
DEPOSIT_DISCRIMINATOR,
|
|
14972
15171
|
FusionUtils,
|
|
14973
15172
|
HUNDRED_PERCENT,
|
|
@@ -15008,6 +15207,7 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
15008
15207
|
REBALANCE_TUNA_LP_POSITION_ORCA_DISCRIMINATOR,
|
|
15009
15208
|
REPAY_BAD_DEBT_DISCRIMINATOR,
|
|
15010
15209
|
REPAY_TUNA_LP_POSITION_DEBT_DISCRIMINATOR,
|
|
15210
|
+
RESET_TUNA_SPOT_POSITION_DISCRIMINATOR,
|
|
15011
15211
|
SET_ADMIN_AUTHORITY_DISCRIMINATOR,
|
|
15012
15212
|
SET_DEFAULT_MAX_PERCENTAGE_OF_LEFTOVERS_DISCRIMINATOR,
|
|
15013
15213
|
SET_DEFAULT_MAX_SWAP_SLIPPAGE_DISCRIMINATOR,
|
|
@@ -15369,6 +15569,7 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
15369
15569
|
getPoolTokenCodec,
|
|
15370
15570
|
getPoolTokenDecoder,
|
|
15371
15571
|
getPoolTokenEncoder,
|
|
15572
|
+
getPythPriceUpdateAccountAddress,
|
|
15372
15573
|
getRebalanceTunaLpPositionFusionDiscriminatorBytes,
|
|
15373
15574
|
getRebalanceTunaLpPositionFusionInstruction,
|
|
15374
15575
|
getRebalanceTunaLpPositionFusionInstructionDataCodec,
|
|
@@ -15395,6 +15596,11 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
15395
15596
|
getRepayTunaLpPositionDebtInstructionDataCodec,
|
|
15396
15597
|
getRepayTunaLpPositionDebtInstructionDataDecoder,
|
|
15397
15598
|
getRepayTunaLpPositionDebtInstructionDataEncoder,
|
|
15599
|
+
getResetTunaSpotPositionDiscriminatorBytes,
|
|
15600
|
+
getResetTunaSpotPositionInstruction,
|
|
15601
|
+
getResetTunaSpotPositionInstructionDataCodec,
|
|
15602
|
+
getResetTunaSpotPositionInstructionDataDecoder,
|
|
15603
|
+
getResetTunaSpotPositionInstructionDataEncoder,
|
|
15398
15604
|
getSetAdminAuthorityDiscriminatorBytes,
|
|
15399
15605
|
getSetAdminAuthorityInstruction,
|
|
15400
15606
|
getSetAdminAuthorityInstructionDataCodec,
|
|
@@ -15573,6 +15779,7 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
15573
15779
|
parseRebalanceTunaLpPositionOrcaInstruction,
|
|
15574
15780
|
parseRepayBadDebtInstruction,
|
|
15575
15781
|
parseRepayTunaLpPositionDebtInstruction,
|
|
15782
|
+
parseResetTunaSpotPositionInstruction,
|
|
15576
15783
|
parseSetAdminAuthorityInstruction,
|
|
15577
15784
|
parseSetDefaultMaxPercentageOfLeftoversInstruction,
|
|
15578
15785
|
parseSetDefaultMaxSwapSlippageInstruction,
|
|
@@ -15595,7 +15802,9 @@ async function rebalanceTunaLpPositionFusionInstruction(authority, tunaPosition,
|
|
|
15595
15802
|
repayBadDebtInstruction,
|
|
15596
15803
|
repayTunaLpPositionDebtInstruction,
|
|
15597
15804
|
repayTunaLpPositionDebtInstructions,
|
|
15805
|
+
resetTunaSpotPositionInstruction,
|
|
15598
15806
|
setTunaLpPositionLimitOrdersInstruction,
|
|
15807
|
+
setTunaSpotPositionLimitOrdersInstruction,
|
|
15599
15808
|
tunaLpPositionAuthorityFilter,
|
|
15600
15809
|
tunaLpPositionMarketMakerFilter,
|
|
15601
15810
|
tunaLpPositionMintAFilter,
|