@haven-fi/solauto-sdk 1.0.52 → 1.0.53
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/clients/solautoClient.d.ts.map +1 -1
- package/dist/clients/solautoClient.js +1 -7
- package/dist/clients/solautoMarginfiClient.d.ts.map +1 -1
- package/dist/clients/solautoMarginfiClient.js +3 -1
- package/dist/generated/accounts/referralState.d.ts.map +1 -1
- package/dist/generated/accounts/referralState.js +8 -9
- package/dist/generated/accounts/solautoPosition.d.ts.map +1 -1
- package/dist/generated/accounts/solautoPosition.js +8 -9
- package/dist/generated/errors/solauto.js +3 -3
- package/dist/generated/instructions/cancelDCA.js +2 -3
- package/dist/generated/instructions/claimReferralFees.js +2 -3
- package/dist/generated/instructions/closePosition.js +2 -3
- package/dist/generated/instructions/convertReferralFees.js +2 -3
- package/dist/generated/instructions/marginfiOpenPosition.d.ts +1 -0
- package/dist/generated/instructions/marginfiOpenPosition.d.ts.map +1 -1
- package/dist/generated/instructions/marginfiOpenPosition.js +22 -18
- package/dist/generated/instructions/marginfiProtocolInteraction.js +2 -3
- package/dist/generated/instructions/marginfiRebalance.js +2 -3
- package/dist/generated/instructions/marginfiRefreshData.js +2 -3
- package/dist/generated/instructions/updatePosition.js +2 -3
- package/dist/generated/instructions/updateReferralStates.js +2 -3
- package/dist/generated/programs/solauto.d.ts.map +1 -1
- package/dist/generated/programs/solauto.js +4 -4
- package/dist/generated/shared/index.js +4 -5
- package/dist/generated/types/automationSettings.js +1 -2
- package/dist/generated/types/automationSettingsInp.js +1 -2
- package/dist/generated/types/dCASettings.js +1 -2
- package/dist/generated/types/dCASettingsInp.js +1 -2
- package/dist/generated/types/feeType.js +3 -3
- package/dist/generated/types/lendingPlatform.js +3 -3
- package/dist/generated/types/podBool.js +1 -2
- package/dist/generated/types/positionData.js +1 -2
- package/dist/generated/types/positionState.js +1 -2
- package/dist/generated/types/positionTokenUsage.js +1 -2
- package/dist/generated/types/rebalanceData.js +1 -2
- package/dist/generated/types/solautoAction.js +3 -4
- package/dist/generated/types/solautoRebalanceType.js +3 -3
- package/dist/generated/types/solautoSettingsParameters.js +1 -2
- package/dist/generated/types/solautoSettingsParametersInp.js +1 -2
- package/dist/generated/types/tokenAmount.js +1 -2
- package/dist/generated/types/tokenBalanceAmount.js +3 -4
- package/dist/generated/types/updatePositionData.js +1 -2
- package/dist/marginfi-sdk/accounts/bank.d.ts.map +1 -1
- package/dist/marginfi-sdk/accounts/bank.js +8 -9
- package/dist/marginfi-sdk/accounts/marginfiAccount.d.ts.map +1 -1
- package/dist/marginfi-sdk/accounts/marginfiAccount.js +8 -9
- package/dist/marginfi-sdk/accounts/marginfiGroup.d.ts.map +1 -1
- package/dist/marginfi-sdk/accounts/marginfiGroup.js +8 -9
- package/dist/marginfi-sdk/errors/marginfi.js +3 -3
- package/dist/marginfi-sdk/instructions/lendingAccountBorrow.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingAccountCloseBalance.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingAccountDeposit.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingAccountEndFlashloan.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingAccountLiquidate.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingAccountRepay.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingAccountSettleEmissions.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingAccountStartFlashloan.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingAccountWithdraw.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingAccountWithdrawEmissions.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingPoolAccrueBankInterest.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingPoolAddBank.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingPoolAddBankWithSeed.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingPoolCollectBankFees.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingPoolConfigureBank.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingPoolHandleBankruptcy.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingPoolSetupEmissions.js +2 -3
- package/dist/marginfi-sdk/instructions/lendingPoolUpdateEmissionsParameters.js +2 -3
- package/dist/marginfi-sdk/instructions/marginfiAccountInitialize.js +2 -3
- package/dist/marginfi-sdk/instructions/marginfiGroupConfigure.js +2 -3
- package/dist/marginfi-sdk/instructions/marginfiGroupInitialize.js +2 -3
- package/dist/marginfi-sdk/instructions/setAccountFlag.js +2 -3
- package/dist/marginfi-sdk/instructions/setNewAccountAuthority.js +2 -3
- package/dist/marginfi-sdk/instructions/unsetAccountFlag.js +2 -3
- package/dist/marginfi-sdk/programs/marginfi.d.ts.map +1 -1
- package/dist/marginfi-sdk/programs/marginfi.js +4 -4
- package/dist/marginfi-sdk/shared/index.js +4 -5
- package/dist/marginfi-sdk/types/accountEventHeader.js +1 -2
- package/dist/marginfi-sdk/types/balance.js +1 -2
- package/dist/marginfi-sdk/types/balanceDecreaseType.js +3 -3
- package/dist/marginfi-sdk/types/balanceIncreaseType.js +3 -3
- package/dist/marginfi-sdk/types/balanceSide.js +3 -3
- package/dist/marginfi-sdk/types/bankConfig.js +1 -2
- package/dist/marginfi-sdk/types/bankConfigCompact.js +1 -2
- package/dist/marginfi-sdk/types/bankOperationalState.js +3 -3
- package/dist/marginfi-sdk/types/bankVaultType.js +3 -3
- package/dist/marginfi-sdk/types/groupEventHeader.js +1 -2
- package/dist/marginfi-sdk/types/interestRateConfig.js +1 -2
- package/dist/marginfi-sdk/types/interestRateConfigCompact.js +1 -2
- package/dist/marginfi-sdk/types/interestRateConfigOpt.js +1 -2
- package/dist/marginfi-sdk/types/lendingAccount.js +1 -2
- package/dist/marginfi-sdk/types/liquidationBalances.js +1 -2
- package/dist/marginfi-sdk/types/oracleConfig.js +1 -2
- package/dist/marginfi-sdk/types/oraclePriceType.js +3 -3
- package/dist/marginfi-sdk/types/oracleSetup.js +3 -3
- package/dist/marginfi-sdk/types/priceBias.js +3 -3
- package/dist/marginfi-sdk/types/requirementType.js +3 -3
- package/dist/marginfi-sdk/types/riskRequirementType.js +3 -3
- package/dist/marginfi-sdk/types/riskTier.js +3 -3
- package/dist/marginfi-sdk/types/wrappedI80F48.js +1 -2
- package/dist/transactions/transactionUtils.js +4 -5
- package/dist/transactions/transactionsManager.d.ts.map +1 -1
- package/dist/transactions/transactionsManager.js +1 -1
- package/dist/types/solauto.js +1 -1
- package/dist/utils/accountUtils.d.ts +0 -1
- package/dist/utils/accountUtils.d.ts.map +1 -1
- package/dist/utils/accountUtils.js +7 -8
- package/dist/utils/generalUtils.js +8 -9
- package/dist/utils/jupiterUtils.js +1 -2
- package/dist/utils/marginfiUtils.js +5 -6
- package/dist/utils/numberUtils.js +11 -12
- package/dist/utils/solanaUtils.js +13 -14
- package/dist/utils/solauto/generalUtils.js +13 -13
- package/dist/utils/solauto/rebalanceUtils.js +3 -4
- package/package.json +3 -2
- package/src/clients/solautoClient.ts +1 -10
- package/src/clients/solautoMarginfiClient.ts +2 -0
- package/src/generated/instructions/marginfiOpenPosition.ts +21 -15
@@ -7,7 +7,7 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.getAccountEventHeaderSerializer =
|
10
|
+
exports.getAccountEventHeaderSerializer = getAccountEventHeaderSerializer;
|
11
11
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
12
|
function getAccountEventHeaderSerializer() {
|
13
13
|
return (0, serializers_1.struct)([
|
@@ -17,4 +17,3 @@ function getAccountEventHeaderSerializer() {
|
|
17
17
|
['marginfiGroup', (0, serializers_1.publicKey)()],
|
18
18
|
], { description: 'AccountEventHeader' });
|
19
19
|
}
|
20
|
-
exports.getAccountEventHeaderSerializer = getAccountEventHeaderSerializer;
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.getBalanceSerializer =
|
10
|
+
exports.getBalanceSerializer = getBalanceSerializer;
|
11
11
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
12
|
const _1 = require(".");
|
13
13
|
function getBalanceSerializer() {
|
@@ -22,4 +22,3 @@ function getBalanceSerializer() {
|
|
22
22
|
['padding', (0, serializers_1.array)((0, serializers_1.u64)(), { size: 1 })],
|
23
23
|
], { description: 'Balance' });
|
24
24
|
}
|
25
|
-
exports.getBalanceSerializer = getBalanceSerializer;
|
@@ -7,7 +7,8 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.
|
10
|
+
exports.BalanceDecreaseType = void 0;
|
11
|
+
exports.getBalanceDecreaseTypeSerializer = getBalanceDecreaseTypeSerializer;
|
11
12
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
13
|
var BalanceDecreaseType;
|
13
14
|
(function (BalanceDecreaseType) {
|
@@ -15,10 +16,9 @@ var BalanceDecreaseType;
|
|
15
16
|
BalanceDecreaseType[BalanceDecreaseType["WithdrawOnly"] = 1] = "WithdrawOnly";
|
16
17
|
BalanceDecreaseType[BalanceDecreaseType["BorrowOnly"] = 2] = "BorrowOnly";
|
17
18
|
BalanceDecreaseType[BalanceDecreaseType["BypassBorrowLimit"] = 3] = "BypassBorrowLimit";
|
18
|
-
})(BalanceDecreaseType
|
19
|
+
})(BalanceDecreaseType || (exports.BalanceDecreaseType = BalanceDecreaseType = {}));
|
19
20
|
function getBalanceDecreaseTypeSerializer() {
|
20
21
|
return (0, serializers_1.scalarEnum)(BalanceDecreaseType, {
|
21
22
|
description: 'BalanceDecreaseType',
|
22
23
|
});
|
23
24
|
}
|
24
|
-
exports.getBalanceDecreaseTypeSerializer = getBalanceDecreaseTypeSerializer;
|
@@ -7,7 +7,8 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.
|
10
|
+
exports.BalanceIncreaseType = void 0;
|
11
|
+
exports.getBalanceIncreaseTypeSerializer = getBalanceIncreaseTypeSerializer;
|
11
12
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
13
|
var BalanceIncreaseType;
|
13
14
|
(function (BalanceIncreaseType) {
|
@@ -15,10 +16,9 @@ var BalanceIncreaseType;
|
|
15
16
|
BalanceIncreaseType[BalanceIncreaseType["RepayOnly"] = 1] = "RepayOnly";
|
16
17
|
BalanceIncreaseType[BalanceIncreaseType["DepositOnly"] = 2] = "DepositOnly";
|
17
18
|
BalanceIncreaseType[BalanceIncreaseType["BypassDepositLimit"] = 3] = "BypassDepositLimit";
|
18
|
-
})(BalanceIncreaseType
|
19
|
+
})(BalanceIncreaseType || (exports.BalanceIncreaseType = BalanceIncreaseType = {}));
|
19
20
|
function getBalanceIncreaseTypeSerializer() {
|
20
21
|
return (0, serializers_1.scalarEnum)(BalanceIncreaseType, {
|
21
22
|
description: 'BalanceIncreaseType',
|
22
23
|
});
|
23
24
|
}
|
24
|
-
exports.getBalanceIncreaseTypeSerializer = getBalanceIncreaseTypeSerializer;
|
@@ -7,16 +7,16 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.
|
10
|
+
exports.BalanceSide = void 0;
|
11
|
+
exports.getBalanceSideSerializer = getBalanceSideSerializer;
|
11
12
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
13
|
var BalanceSide;
|
13
14
|
(function (BalanceSide) {
|
14
15
|
BalanceSide[BalanceSide["Assets"] = 0] = "Assets";
|
15
16
|
BalanceSide[BalanceSide["Liabilities"] = 1] = "Liabilities";
|
16
|
-
})(BalanceSide
|
17
|
+
})(BalanceSide || (exports.BalanceSide = BalanceSide = {}));
|
17
18
|
function getBalanceSideSerializer() {
|
18
19
|
return (0, serializers_1.scalarEnum)(BalanceSide, {
|
19
20
|
description: 'BalanceSide',
|
20
21
|
});
|
21
22
|
}
|
22
|
-
exports.getBalanceSideSerializer = getBalanceSideSerializer;
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.getBankConfigSerializer =
|
10
|
+
exports.getBankConfigSerializer = getBankConfigSerializer;
|
11
11
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
12
|
const _1 = require(".");
|
13
13
|
function getBankConfigSerializer() {
|
@@ -29,4 +29,3 @@ function getBankConfigSerializer() {
|
|
29
29
|
['padding', (0, serializers_1.array)((0, serializers_1.u64)(), { size: 5 })],
|
30
30
|
], { description: 'BankConfig' });
|
31
31
|
}
|
32
|
-
exports.getBankConfigSerializer = getBankConfigSerializer;
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.getBankConfigCompactSerializer =
|
10
|
+
exports.getBankConfigCompactSerializer = getBankConfigCompactSerializer;
|
11
11
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
12
|
const _1 = require(".");
|
13
13
|
function getBankConfigCompactSerializer() {
|
@@ -28,4 +28,3 @@ function getBankConfigCompactSerializer() {
|
|
28
28
|
['totalAssetValueInitLimit', (0, serializers_1.u64)()],
|
29
29
|
], { description: 'BankConfigCompact' });
|
30
30
|
}
|
31
|
-
exports.getBankConfigCompactSerializer = getBankConfigCompactSerializer;
|
@@ -7,17 +7,17 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.
|
10
|
+
exports.BankOperationalState = void 0;
|
11
|
+
exports.getBankOperationalStateSerializer = getBankOperationalStateSerializer;
|
11
12
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
13
|
var BankOperationalState;
|
13
14
|
(function (BankOperationalState) {
|
14
15
|
BankOperationalState[BankOperationalState["Paused"] = 0] = "Paused";
|
15
16
|
BankOperationalState[BankOperationalState["Operational"] = 1] = "Operational";
|
16
17
|
BankOperationalState[BankOperationalState["ReduceOnly"] = 2] = "ReduceOnly";
|
17
|
-
})(BankOperationalState
|
18
|
+
})(BankOperationalState || (exports.BankOperationalState = BankOperationalState = {}));
|
18
19
|
function getBankOperationalStateSerializer() {
|
19
20
|
return (0, serializers_1.scalarEnum)(BankOperationalState, {
|
20
21
|
description: 'BankOperationalState',
|
21
22
|
});
|
22
23
|
}
|
23
|
-
exports.getBankOperationalStateSerializer = getBankOperationalStateSerializer;
|
@@ -7,17 +7,17 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.
|
10
|
+
exports.BankVaultType = void 0;
|
11
|
+
exports.getBankVaultTypeSerializer = getBankVaultTypeSerializer;
|
11
12
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
13
|
var BankVaultType;
|
13
14
|
(function (BankVaultType) {
|
14
15
|
BankVaultType[BankVaultType["Liquidity"] = 0] = "Liquidity";
|
15
16
|
BankVaultType[BankVaultType["Insurance"] = 1] = "Insurance";
|
16
17
|
BankVaultType[BankVaultType["Fee"] = 2] = "Fee";
|
17
|
-
})(BankVaultType
|
18
|
+
})(BankVaultType || (exports.BankVaultType = BankVaultType = {}));
|
18
19
|
function getBankVaultTypeSerializer() {
|
19
20
|
return (0, serializers_1.scalarEnum)(BankVaultType, {
|
20
21
|
description: 'BankVaultType',
|
21
22
|
});
|
22
23
|
}
|
23
|
-
exports.getBankVaultTypeSerializer = getBankVaultTypeSerializer;
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.getGroupEventHeaderSerializer =
|
10
|
+
exports.getGroupEventHeaderSerializer = getGroupEventHeaderSerializer;
|
11
11
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
12
|
function getGroupEventHeaderSerializer() {
|
13
13
|
return (0, serializers_1.struct)([
|
@@ -15,4 +15,3 @@ function getGroupEventHeaderSerializer() {
|
|
15
15
|
['marginfiGroup', (0, serializers_1.publicKey)()],
|
16
16
|
], { description: 'GroupEventHeader' });
|
17
17
|
}
|
18
|
-
exports.getGroupEventHeaderSerializer = getGroupEventHeaderSerializer;
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.getInterestRateConfigSerializer =
|
10
|
+
exports.getInterestRateConfigSerializer = getInterestRateConfigSerializer;
|
11
11
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
12
|
const _1 = require(".");
|
13
13
|
function getInterestRateConfigSerializer() {
|
@@ -22,4 +22,3 @@ function getInterestRateConfigSerializer() {
|
|
22
22
|
['padding', (0, serializers_1.array)((0, serializers_1.u128)(), { size: 8 })],
|
23
23
|
], { description: 'InterestRateConfig' });
|
24
24
|
}
|
25
|
-
exports.getInterestRateConfigSerializer = getInterestRateConfigSerializer;
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.getInterestRateConfigCompactSerializer =
|
10
|
+
exports.getInterestRateConfigCompactSerializer = getInterestRateConfigCompactSerializer;
|
11
11
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
12
|
const _1 = require(".");
|
13
13
|
function getInterestRateConfigCompactSerializer() {
|
@@ -21,4 +21,3 @@ function getInterestRateConfigCompactSerializer() {
|
|
21
21
|
['protocolIrFee', (0, _1.getWrappedI80F48Serializer)()],
|
22
22
|
], { description: 'InterestRateConfigCompact' });
|
23
23
|
}
|
24
|
-
exports.getInterestRateConfigCompactSerializer = getInterestRateConfigCompactSerializer;
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.getInterestRateConfigOptSerializer =
|
10
|
+
exports.getInterestRateConfigOptSerializer = getInterestRateConfigOptSerializer;
|
11
11
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
12
|
const _1 = require(".");
|
13
13
|
function getInterestRateConfigOptSerializer() {
|
@@ -21,4 +21,3 @@ function getInterestRateConfigOptSerializer() {
|
|
21
21
|
['protocolIrFee', (0, serializers_1.option)((0, _1.getWrappedI80F48Serializer)())],
|
22
22
|
], { description: 'InterestRateConfigOpt' });
|
23
23
|
}
|
24
|
-
exports.getInterestRateConfigOptSerializer = getInterestRateConfigOptSerializer;
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.getLendingAccountSerializer =
|
10
|
+
exports.getLendingAccountSerializer = getLendingAccountSerializer;
|
11
11
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
12
|
const _1 = require(".");
|
13
13
|
function getLendingAccountSerializer() {
|
@@ -16,4 +16,3 @@ function getLendingAccountSerializer() {
|
|
16
16
|
['padding', (0, serializers_1.array)((0, serializers_1.u64)(), { size: 8 })],
|
17
17
|
], { description: 'LendingAccount' });
|
18
18
|
}
|
19
|
-
exports.getLendingAccountSerializer = getLendingAccountSerializer;
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.getLiquidationBalancesSerializer =
|
10
|
+
exports.getLiquidationBalancesSerializer = getLiquidationBalancesSerializer;
|
11
11
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
12
|
function getLiquidationBalancesSerializer() {
|
13
13
|
return (0, serializers_1.struct)([
|
@@ -17,4 +17,3 @@ function getLiquidationBalancesSerializer() {
|
|
17
17
|
['liquidatorLiabilityBalance', (0, serializers_1.f64)()],
|
18
18
|
], { description: 'LiquidationBalances' });
|
19
19
|
}
|
20
|
-
exports.getLiquidationBalancesSerializer = getLiquidationBalancesSerializer;
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.getOracleConfigSerializer =
|
10
|
+
exports.getOracleConfigSerializer = getOracleConfigSerializer;
|
11
11
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
12
|
const _1 = require(".");
|
13
13
|
function getOracleConfigSerializer() {
|
@@ -16,4 +16,3 @@ function getOracleConfigSerializer() {
|
|
16
16
|
['keys', (0, serializers_1.array)((0, serializers_1.publicKey)(), { size: 5 })],
|
17
17
|
], { description: 'OracleConfig' });
|
18
18
|
}
|
19
|
-
exports.getOracleConfigSerializer = getOracleConfigSerializer;
|
@@ -7,16 +7,16 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.
|
10
|
+
exports.OraclePriceType = void 0;
|
11
|
+
exports.getOraclePriceTypeSerializer = getOraclePriceTypeSerializer;
|
11
12
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
13
|
var OraclePriceType;
|
13
14
|
(function (OraclePriceType) {
|
14
15
|
OraclePriceType[OraclePriceType["TimeWeighted"] = 0] = "TimeWeighted";
|
15
16
|
OraclePriceType[OraclePriceType["RealTime"] = 1] = "RealTime";
|
16
|
-
})(OraclePriceType
|
17
|
+
})(OraclePriceType || (exports.OraclePriceType = OraclePriceType = {}));
|
17
18
|
function getOraclePriceTypeSerializer() {
|
18
19
|
return (0, serializers_1.scalarEnum)(OraclePriceType, {
|
19
20
|
description: 'OraclePriceType',
|
20
21
|
});
|
21
22
|
}
|
22
|
-
exports.getOraclePriceTypeSerializer = getOraclePriceTypeSerializer;
|
@@ -7,7 +7,8 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.
|
10
|
+
exports.OracleSetup = void 0;
|
11
|
+
exports.getOracleSetupSerializer = getOracleSetupSerializer;
|
11
12
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
13
|
var OracleSetup;
|
13
14
|
(function (OracleSetup) {
|
@@ -15,10 +16,9 @@ var OracleSetup;
|
|
15
16
|
OracleSetup[OracleSetup["PythLegacy"] = 1] = "PythLegacy";
|
16
17
|
OracleSetup[OracleSetup["SwitchboardV2"] = 2] = "SwitchboardV2";
|
17
18
|
OracleSetup[OracleSetup["PythPushOracle"] = 3] = "PythPushOracle";
|
18
|
-
})(OracleSetup
|
19
|
+
})(OracleSetup || (exports.OracleSetup = OracleSetup = {}));
|
19
20
|
function getOracleSetupSerializer() {
|
20
21
|
return (0, serializers_1.scalarEnum)(OracleSetup, {
|
21
22
|
description: 'OracleSetup',
|
22
23
|
});
|
23
24
|
}
|
24
|
-
exports.getOracleSetupSerializer = getOracleSetupSerializer;
|
@@ -7,16 +7,16 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.
|
10
|
+
exports.PriceBias = void 0;
|
11
|
+
exports.getPriceBiasSerializer = getPriceBiasSerializer;
|
11
12
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
13
|
var PriceBias;
|
13
14
|
(function (PriceBias) {
|
14
15
|
PriceBias[PriceBias["Low"] = 0] = "Low";
|
15
16
|
PriceBias[PriceBias["High"] = 1] = "High";
|
16
|
-
})(PriceBias
|
17
|
+
})(PriceBias || (exports.PriceBias = PriceBias = {}));
|
17
18
|
function getPriceBiasSerializer() {
|
18
19
|
return (0, serializers_1.scalarEnum)(PriceBias, {
|
19
20
|
description: 'PriceBias',
|
20
21
|
});
|
21
22
|
}
|
22
|
-
exports.getPriceBiasSerializer = getPriceBiasSerializer;
|
@@ -7,17 +7,17 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.
|
10
|
+
exports.RequirementType = void 0;
|
11
|
+
exports.getRequirementTypeSerializer = getRequirementTypeSerializer;
|
11
12
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
13
|
var RequirementType;
|
13
14
|
(function (RequirementType) {
|
14
15
|
RequirementType[RequirementType["Initial"] = 0] = "Initial";
|
15
16
|
RequirementType[RequirementType["Maintenance"] = 1] = "Maintenance";
|
16
17
|
RequirementType[RequirementType["Equity"] = 2] = "Equity";
|
17
|
-
})(RequirementType
|
18
|
+
})(RequirementType || (exports.RequirementType = RequirementType = {}));
|
18
19
|
function getRequirementTypeSerializer() {
|
19
20
|
return (0, serializers_1.scalarEnum)(RequirementType, {
|
20
21
|
description: 'RequirementType',
|
21
22
|
});
|
22
23
|
}
|
23
|
-
exports.getRequirementTypeSerializer = getRequirementTypeSerializer;
|
@@ -7,17 +7,17 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.
|
10
|
+
exports.RiskRequirementType = void 0;
|
11
|
+
exports.getRiskRequirementTypeSerializer = getRiskRequirementTypeSerializer;
|
11
12
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
13
|
var RiskRequirementType;
|
13
14
|
(function (RiskRequirementType) {
|
14
15
|
RiskRequirementType[RiskRequirementType["Initial"] = 0] = "Initial";
|
15
16
|
RiskRequirementType[RiskRequirementType["Maintenance"] = 1] = "Maintenance";
|
16
17
|
RiskRequirementType[RiskRequirementType["Equity"] = 2] = "Equity";
|
17
|
-
})(RiskRequirementType
|
18
|
+
})(RiskRequirementType || (exports.RiskRequirementType = RiskRequirementType = {}));
|
18
19
|
function getRiskRequirementTypeSerializer() {
|
19
20
|
return (0, serializers_1.scalarEnum)(RiskRequirementType, {
|
20
21
|
description: 'RiskRequirementType',
|
21
22
|
});
|
22
23
|
}
|
23
|
-
exports.getRiskRequirementTypeSerializer = getRiskRequirementTypeSerializer;
|
@@ -7,16 +7,16 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.
|
10
|
+
exports.RiskTier = void 0;
|
11
|
+
exports.getRiskTierSerializer = getRiskTierSerializer;
|
11
12
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
13
|
var RiskTier;
|
13
14
|
(function (RiskTier) {
|
14
15
|
RiskTier[RiskTier["Collateral"] = 0] = "Collateral";
|
15
16
|
RiskTier[RiskTier["Isolated"] = 1] = "Isolated";
|
16
|
-
})(RiskTier
|
17
|
+
})(RiskTier || (exports.RiskTier = RiskTier = {}));
|
17
18
|
function getRiskTierSerializer() {
|
18
19
|
return (0, serializers_1.scalarEnum)(RiskTier, {
|
19
20
|
description: 'RiskTier',
|
20
21
|
});
|
21
22
|
}
|
22
|
-
exports.getRiskTierSerializer = getRiskTierSerializer;
|
@@ -7,11 +7,10 @@
|
|
7
7
|
* @see https://github.com/metaplex-foundation/kinobi
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.getWrappedI80F48Serializer =
|
10
|
+
exports.getWrappedI80F48Serializer = getWrappedI80F48Serializer;
|
11
11
|
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
12
|
function getWrappedI80F48Serializer() {
|
13
13
|
return (0, serializers_1.struct)([['value', (0, serializers_1.array)((0, serializers_1.u8)(), { size: 16 })]], {
|
14
14
|
description: 'WrappedI80F48',
|
15
15
|
});
|
16
16
|
}
|
17
|
-
exports.getWrappedI80F48Serializer = getWrappedI80F48Serializer;
|
@@ -1,6 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.rebalanceChoresBefore = rebalanceChoresBefore;
|
4
|
+
exports.getTransactionChores = getTransactionChores;
|
5
|
+
exports.buildSolautoRebalanceTransaction = buildSolautoRebalanceTransaction;
|
6
|
+
exports.convertReferralFeesToDestination = convertReferralFeesToDestination;
|
4
7
|
const umi_1 = require("@metaplex-foundation/umi");
|
5
8
|
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
6
9
|
const web3_js_1 = require("@solana/web3.js");
|
@@ -163,7 +166,6 @@ async function rebalanceChoresBefore(client, tx, accountsGettingCreated) {
|
|
163
166
|
}
|
164
167
|
return chores;
|
165
168
|
}
|
166
|
-
exports.rebalanceChoresBefore = rebalanceChoresBefore;
|
167
169
|
function transactionChoresAfter(client, solautoActions, cancellingDcaIn) {
|
168
170
|
let chores = (0, umi_1.transactionBuilder)();
|
169
171
|
const wSolUsage = getWSolUsage(client, solautoActions, undefined, cancellingDcaIn);
|
@@ -316,7 +318,6 @@ async function getTransactionChores(client, tx) {
|
|
316
318
|
choresAfter = choresAfter.add(transactionChoresAfter(client, solautoActions, client.livePositionUpdates.debtTaBalanceAdjustment < 0));
|
317
319
|
return [choresBefore, choresAfter];
|
318
320
|
}
|
319
|
-
exports.getTransactionChores = getTransactionChores;
|
320
321
|
async function buildSolautoRebalanceTransaction(client, targetLiqUtilizationRateBps, attemptNum) {
|
321
322
|
client.solautoPositionState = await client.getFreshPositionState();
|
322
323
|
if (client.solautoPositionState?.supply.amountUsed.baseUnit === BigInt(0) ||
|
@@ -372,7 +373,6 @@ async function buildSolautoRebalanceTransaction(client, targetLiqUtilizationRate
|
|
372
373
|
lookupTableAddresses,
|
373
374
|
};
|
374
375
|
}
|
375
|
-
exports.buildSolautoRebalanceTransaction = buildSolautoRebalanceTransaction;
|
376
376
|
async function convertReferralFeesToDestination(umi, referralState, tokenAccount) {
|
377
377
|
const { lookupTableAddresses, setupInstructions, swapIx } = await (0, jupiterUtils_1.getJupSwapTransaction)(umi.identity, {
|
378
378
|
amount: tokenAccount.amount,
|
@@ -394,4 +394,3 @@ async function convertReferralFeesToDestination(umi, referralState, tokenAccount
|
|
394
394
|
.add(swapIx);
|
395
395
|
return [tx, lookupTableAddresses];
|
396
396
|
}
|
397
|
-
exports.convertReferralFeesToDestination = convertReferralFeesToDestination;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EAGvB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAG9C,cAAM,YAAY;IAIJ,OAAO,CAAC,MAAM;IAH1B,WAAW,EAAE,MAAM,EAAE,CAAM;IAC3B,KAAK,EAAE,uBAAuB,EAAE,CAAM;gBAElB,MAAM,EAAE,aAAa;IAInC,YAAY,CAChB,mBAAmB,EAAE,MAAM,EAAE,GAC5B,OAAO,CAAC,uBAAuB,EAAE,CAAC;CAqBtC;AAED,qBAAa,eAAe;IAKjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE;IACM,IAAI,CAAC;
|
1
|
+
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"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"}
|
@@ -118,7 +118,7 @@ var TransactionStatus;
|
|
118
118
|
TransactionStatus["Processing"] = "Processing";
|
119
119
|
TransactionStatus["Queued"] = "Queued";
|
120
120
|
TransactionStatus["Successful"] = "Successful";
|
121
|
-
})(TransactionStatus
|
121
|
+
})(TransactionStatus || (exports.TransactionStatus = TransactionStatus = {}));
|
122
122
|
class TransactionsManager {
|
123
123
|
constructor(client, items, statusCallback, simulateOnly, mustBeAtomic, errorsToThrow) {
|
124
124
|
this.client = client;
|
package/dist/types/solauto.js
CHANGED
@@ -5,4 +5,4 @@ var PriorityFeeSetting;
|
|
5
5
|
(function (PriorityFeeSetting) {
|
6
6
|
PriorityFeeSetting["Default"] = "Medium";
|
7
7
|
PriorityFeeSetting["High"] = "High";
|
8
|
-
})(PriorityFeeSetting
|
8
|
+
})(PriorityFeeSetting || (exports.PriorityFeeSetting = PriorityFeeSetting = {}));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"accountUtils.d.ts","sourceRoot":"","sources":["../../src/utils/accountUtils.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"accountUtils.d.ts","sourceRoot":"","sources":["../../src/utils/accountUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,GAAG,SAAS,CAMlF;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAExF;AAED,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,MAAM,sBAQnB;AAED,wBAAsB,gBAAgB,CAAC,SAAS,EAAE,SAAS,sBAU1D;AAED,wBAAsB,qBAAqB,CACzC,sBAAsB,EAAE,SAAS,EACjC,sBAAsB,EAAE,MAAM,sBAa/B"}
|
@@ -1,6 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.bufferFromU8 = bufferFromU8;
|
4
|
+
exports.bufferFromU64 = bufferFromU64;
|
5
|
+
exports.getTokenAccount = getTokenAccount;
|
6
|
+
exports.getTokenAccounts = getTokenAccounts;
|
7
|
+
exports.getSolautoPositionAccount = getSolautoPositionAccount;
|
8
|
+
exports.getReferralState = getReferralState;
|
9
|
+
exports.getMarginfiAccountPDA = getMarginfiAccountPDA;
|
4
10
|
const web3_js_1 = require("@solana/web3.js");
|
5
11
|
const spl_token_1 = require("@solana/spl-token");
|
6
12
|
const generated_1 = require("../generated");
|
@@ -9,33 +15,27 @@ function bufferFromU8(num) {
|
|
9
15
|
buffer.writeUInt8(num);
|
10
16
|
return buffer;
|
11
17
|
}
|
12
|
-
exports.bufferFromU8 = bufferFromU8;
|
13
18
|
function bufferFromU64(num) {
|
14
19
|
const buffer = Buffer.alloc(8);
|
15
20
|
buffer.writeBigUInt64LE(num);
|
16
21
|
return buffer;
|
17
22
|
}
|
18
|
-
exports.bufferFromU64 = bufferFromU64;
|
19
23
|
function getTokenAccount(wallet, tokenMint) {
|
20
24
|
return (0, spl_token_1.getAssociatedTokenAddressSync)(tokenMint, wallet, true);
|
21
25
|
}
|
22
|
-
exports.getTokenAccount = getTokenAccount;
|
23
26
|
function getTokenAccounts(wallet, tokenMints) {
|
24
27
|
return tokenMints.map(x => getTokenAccount(wallet, x));
|
25
28
|
}
|
26
|
-
exports.getTokenAccounts = getTokenAccounts;
|
27
29
|
async function getSolautoPositionAccount(signer, positionId) {
|
28
30
|
const [positionAccount, _] = await web3_js_1.PublicKey.findProgramAddress([bufferFromU8(positionId), signer.toBuffer()], new web3_js_1.PublicKey(generated_1.SOLAUTO_PROGRAM_ID));
|
29
31
|
return positionAccount;
|
30
32
|
}
|
31
|
-
exports.getSolautoPositionAccount = getSolautoPositionAccount;
|
32
33
|
async function getReferralState(authority) {
|
33
34
|
const str = "referral_state";
|
34
35
|
const strBuffer = Buffer.from(str, "utf-8");
|
35
36
|
const [ReferralState, _] = await web3_js_1.PublicKey.findProgramAddress([strBuffer, authority.toBuffer()], new web3_js_1.PublicKey(generated_1.SOLAUTO_PROGRAM_ID));
|
36
37
|
return ReferralState;
|
37
38
|
}
|
38
|
-
exports.getReferralState = getReferralState;
|
39
39
|
async function getMarginfiAccountPDA(solautoPositionAccount, marginfiAccountSeedIdx) {
|
40
40
|
const seeds = [
|
41
41
|
solautoPositionAccount.toBuffer(),
|
@@ -44,4 +44,3 @@ async function getMarginfiAccountPDA(solautoPositionAccount, marginfiAccountSeed
|
|
44
44
|
const [marginfiAccount, _] = await web3_js_1.PublicKey.findProgramAddress(seeds, new web3_js_1.PublicKey(generated_1.SOLAUTO_PROGRAM_ID));
|
45
45
|
return marginfiAccount;
|
46
46
|
}
|
47
|
-
exports.getMarginfiAccountPDA = getMarginfiAccountPDA;
|
@@ -1,6 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.generateRandomU8 = generateRandomU8;
|
4
|
+
exports.generateRandomU64 = generateRandomU64;
|
5
|
+
exports.currentUnixSeconds = currentUnixSeconds;
|
6
|
+
exports.getSolanaAccountCreated = getSolanaAccountCreated;
|
7
|
+
exports.rpcAccountCreated = rpcAccountCreated;
|
8
|
+
exports.arraysAreEqual = arraysAreEqual;
|
9
|
+
exports.getTokenPrices = getTokenPrices;
|
10
|
+
exports.retryWithExponentialBackoff = retryWithExponentialBackoff;
|
4
11
|
const umi_1 = require("@metaplex-foundation/umi");
|
5
12
|
const pythConstants_1 = require("../constants/pythConstants");
|
6
13
|
const numberUtils_1 = require("./numberUtils");
|
@@ -8,7 +15,6 @@ const solautoConstants_1 = require("../constants/solautoConstants");
|
|
8
15
|
function generateRandomU8() {
|
9
16
|
return Math.floor(Math.random() * 255 + 1);
|
10
17
|
}
|
11
|
-
exports.generateRandomU8 = generateRandomU8;
|
12
18
|
function generateRandomU64() {
|
13
19
|
const upperBound = 2n ** 64n;
|
14
20
|
let result = 0n;
|
@@ -17,20 +23,16 @@ function generateRandomU64() {
|
|
17
23
|
}
|
18
24
|
return result % upperBound;
|
19
25
|
}
|
20
|
-
exports.generateRandomU64 = generateRandomU64;
|
21
26
|
function currentUnixSeconds() {
|
22
27
|
return Math.round(new Date().getTime() / 1000);
|
23
28
|
}
|
24
|
-
exports.currentUnixSeconds = currentUnixSeconds;
|
25
29
|
async function getSolanaAccountCreated(umi, pk) {
|
26
30
|
const account = await umi.rpc.getAccount((0, umi_1.publicKey)(pk));
|
27
31
|
return rpcAccountCreated(account);
|
28
32
|
}
|
29
|
-
exports.getSolanaAccountCreated = getSolanaAccountCreated;
|
30
33
|
function rpcAccountCreated(account) {
|
31
34
|
return account.exists && account.data.length > 0;
|
32
35
|
}
|
33
|
-
exports.rpcAccountCreated = rpcAccountCreated;
|
34
36
|
function arraysAreEqual(arrayA, arrayB) {
|
35
37
|
if (arrayA.length !== arrayB.length) {
|
36
38
|
return false;
|
@@ -42,7 +44,6 @@ function arraysAreEqual(arrayA, arrayB) {
|
|
42
44
|
}
|
43
45
|
return true;
|
44
46
|
}
|
45
|
-
exports.arraysAreEqual = arraysAreEqual;
|
46
47
|
async function getTokenPrices(mints) {
|
47
48
|
const currentTime = currentUnixSeconds();
|
48
49
|
if (!mints.some((mint) => !(mint.toString() in solautoConstants_1.PRICES) ||
|
@@ -78,7 +79,6 @@ async function getTokenPrices(mints) {
|
|
78
79
|
}
|
79
80
|
return prices;
|
80
81
|
}
|
81
|
-
exports.getTokenPrices = getTokenPrices;
|
82
82
|
function retryWithExponentialBackoff(fn, retries = 5, delay = 150, errorsToThrow) {
|
83
83
|
return new Promise((resolve, reject) => {
|
84
84
|
const attempt = (attemptNum) => {
|
@@ -107,4 +107,3 @@ function retryWithExponentialBackoff(fn, retries = 5, delay = 150, errorsToThrow
|
|
107
107
|
return attempt(0);
|
108
108
|
});
|
109
109
|
}
|
110
|
-
exports.retryWithExponentialBackoff = retryWithExponentialBackoff;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getJupSwapTransaction =
|
3
|
+
exports.getJupSwapTransaction = getJupSwapTransaction;
|
4
4
|
const umi_1 = require("@metaplex-foundation/umi");
|
5
5
|
const web3_js_1 = require("@solana/web3.js");
|
6
6
|
const solanaUtils_1 = require("./solanaUtils");
|
@@ -61,4 +61,3 @@ async function getJupSwapTransaction(signer, swapDetails, attemptNum) {
|
|
61
61
|
swapIx: (0, umi_1.transactionBuilder)().add((0, solanaUtils_1.getWrappedInstruction)(signer, createTransactionInstruction(instructions.swapInstruction))),
|
62
62
|
};
|
63
63
|
}
|
64
|
-
exports.getJupSwapTransaction = getJupSwapTransaction;
|