@kamino-finance/klend-sdk 2.10.21 → 2.12.0-SNAPSHOT
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/classes/action.d.ts +1 -0
- package/dist/classes/action.js +104 -70
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/obligation.js +21 -0
- package/dist/classes/obligation.js.map +1 -1
- package/dist/classes/reserve.d.ts +34 -0
- package/dist/classes/reserve.js +72 -6
- package/dist/classes/reserve.js.map +1 -1
- package/dist/idl.json +280 -98
- package/dist/idl_codegen/accounts/LendingMarket.d.ts +3 -3
- package/dist/idl_codegen/accounts/LendingMarket.js +7 -1
- package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
- package/dist/idl_codegen/accounts/Obligation.d.ts +6 -3
- package/dist/idl_codegen/accounts/Obligation.js +12 -6
- package/dist/idl_codegen/accounts/Obligation.js.map +1 -1
- package/dist/idl_codegen/accounts/Reserve.d.ts +18 -0
- package/dist/idl_codegen/accounts/Reserve.js +14 -2
- package/dist/idl_codegen/accounts/Reserve.js.map +1 -1
- package/dist/idl_codegen/errors/custom.d.ts +84 -4
- package/dist/idl_codegen/errors/custom.js +139 -8
- package/dist/idl_codegen/errors/custom.js.map +1 -1
- package/dist/idl_codegen/instructions/borrowObligationLiquidity.d.ts +1 -0
- package/dist/idl_codegen/instructions/borrowObligationLiquidity.js +5 -0
- package/dist/idl_codegen/instructions/borrowObligationLiquidity.js.map +1 -1
- package/dist/idl_codegen/instructions/depositReserveLiquidity.d.ts +3 -1
- package/dist/idl_codegen/instructions/depositReserveLiquidity.js +15 -1
- package/dist/idl_codegen/instructions/depositReserveLiquidity.js.map +1 -1
- package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateral.d.ts +3 -1
- package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateral.js +15 -1
- package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateral.js.map +1 -1
- package/dist/idl_codegen/instructions/flashBorrowReserveLiquidity.d.ts +2 -0
- package/dist/idl_codegen/instructions/flashBorrowReserveLiquidity.js +5 -0
- package/dist/idl_codegen/instructions/flashBorrowReserveLiquidity.js.map +1 -1
- package/dist/idl_codegen/instructions/flashRepayReserveLiquidity.d.ts +2 -0
- package/dist/idl_codegen/instructions/flashRepayReserveLiquidity.js +5 -0
- package/dist/idl_codegen/instructions/flashRepayReserveLiquidity.js.map +1 -1
- package/dist/idl_codegen/instructions/index.d.ts +2 -4
- package/dist/idl_codegen/instructions/index.js +3 -5
- package/dist/idl_codegen/instructions/index.js.map +1 -1
- package/dist/idl_codegen/instructions/initFarmsForReserve.d.ts +0 -1
- package/dist/idl_codegen/instructions/initFarmsForReserve.js +0 -1
- package/dist/idl_codegen/instructions/initFarmsForReserve.js.map +1 -1
- package/dist/idl_codegen/instructions/initObligation.d.ts +0 -1
- package/dist/idl_codegen/instructions/initObligation.js +0 -1
- package/dist/idl_codegen/instructions/initObligation.js.map +1 -1
- package/dist/idl_codegen/instructions/initObligationFarmsForReserve.d.ts +0 -1
- package/dist/idl_codegen/instructions/initObligationFarmsForReserve.js +0 -1
- package/dist/idl_codegen/instructions/initObligationFarmsForReserve.js.map +1 -1
- package/dist/idl_codegen/instructions/initReserve.d.ts +2 -1
- package/dist/idl_codegen/instructions/initReserve.js +10 -1
- package/dist/idl_codegen/instructions/initReserve.js.map +1 -1
- package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.d.ts +6 -2
- package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.js +27 -3
- package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.js.map +1 -1
- package/dist/idl_codegen/instructions/redeemFees.d.ts +1 -0
- package/dist/idl_codegen/instructions/redeemFees.js +5 -0
- package/dist/idl_codegen/instructions/redeemFees.js.map +1 -1
- package/dist/idl_codegen/instructions/redeemReserveCollateral.d.ts +3 -1
- package/dist/idl_codegen/instructions/redeemReserveCollateral.js +15 -1
- package/dist/idl_codegen/instructions/redeemReserveCollateral.js.map +1 -1
- package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.d.ts +0 -1
- package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.js +0 -1
- package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.js.map +1 -1
- package/dist/idl_codegen/instructions/repayObligationLiquidity.d.ts +1 -0
- package/dist/idl_codegen/instructions/repayObligationLiquidity.js +5 -0
- package/dist/idl_codegen/instructions/repayObligationLiquidity.js.map +1 -1
- package/dist/idl_codegen/instructions/updateReserveConfig.d.ts +2 -1
- package/dist/idl_codegen/instructions/updateReserveConfig.js +4 -2
- package/dist/idl_codegen/instructions/updateReserveConfig.js.map +1 -1
- package/dist/idl_codegen/instructions/withdrawObligationCollateral.js +1 -1
- package/dist/idl_codegen/instructions/withdrawObligationCollateral.js.map +1 -1
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.d.ts +3 -1
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js +15 -1
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js.map +1 -1
- package/dist/idl_codegen/instructions/withdrawProtocolFee.d.ts +1 -0
- package/dist/idl_codegen/instructions/withdrawProtocolFee.js +5 -0
- package/dist/idl_codegen/instructions/withdrawProtocolFee.js.map +1 -1
- package/dist/idl_codegen/instructions/withdrawReferrerFees.d.ts +1 -0
- package/dist/idl_codegen/instructions/withdrawReferrerFees.js +5 -0
- package/dist/idl_codegen/instructions/withdrawReferrerFees.js.map +1 -1
- package/dist/idl_codegen/programId.js.map +1 -1
- package/dist/idl_codegen/types/ElevationGroup.d.ts +24 -10
- package/dist/idl_codegen/types/ElevationGroup.js +25 -12
- package/dist/idl_codegen/types/ElevationGroup.js.map +1 -1
- package/dist/idl_codegen/types/ObligationCollateral.d.ts +23 -0
- package/dist/idl_codegen/types/ObligationCollateral.js +8 -1
- package/dist/idl_codegen/types/ObligationCollateral.js.map +1 -1
- package/dist/idl_codegen/types/ObligationLiquidity.d.ts +8 -0
- package/dist/idl_codegen/types/ObligationLiquidity.js +8 -1
- package/dist/idl_codegen/types/ObligationLiquidity.js.map +1 -1
- package/dist/idl_codegen/types/ReserveConfig.d.ts +55 -9
- package/dist/idl_codegen/types/ReserveConfig.js +20 -6
- package/dist/idl_codegen/types/ReserveConfig.js.map +1 -1
- package/dist/idl_codegen/types/ReserveLiquidity.d.ts +8 -0
- package/dist/idl_codegen/types/ReserveLiquidity.js +7 -1
- package/dist/idl_codegen/types/ReserveLiquidity.js.map +1 -1
- package/dist/idl_codegen/types/UpdateConfigMode.d.ts +39 -0
- package/dist/idl_codegen/types/UpdateConfigMode.js +79 -1
- package/dist/idl_codegen/types/UpdateConfigMode.js.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.d.ts +4 -2
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +13 -0
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js +27 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
- package/dist/idl_codegen/types/index.d.ts +4 -4
- package/dist/idl_codegen/types/index.js.map +1 -1
- package/dist/idl_codegen/zero_padding/ObligationZP.d.ts +3 -2
- package/dist/idl_codegen/zero_padding/ObligationZP.js +8 -3
- package/dist/idl_codegen/zero_padding/ObligationZP.js.map +1 -1
- package/dist/leverage/instructions.js +2 -0
- package/dist/leverage/instructions.js.map +1 -1
- package/dist/leverage/operations.js +4 -3
- package/dist/leverage/operations.js.map +1 -1
- package/dist/utils/ata.d.ts +5 -5
- package/dist/utils/ata.js +39 -29
- package/dist/utils/ata.js.map +1 -1
- package/dist/utils/instruction.d.ts +1 -1
- package/dist/utils/token.d.ts +2 -0
- package/dist/utils/token.js +20 -0
- package/dist/utils/token.js.map +1 -0
- package/package.json +2 -2
package/dist/classes/action.d.ts
CHANGED
package/dist/classes/action.js
CHANGED
|
@@ -24,6 +24,7 @@ const types_1 = require("../idl_codegen/types");
|
|
|
24
24
|
const farms_sdk_1 = require("@hubbleprotocol/farms-sdk");
|
|
25
25
|
const ObligationType_1 = require("../utils/ObligationType");
|
|
26
26
|
const lib_1 = require("../lib");
|
|
27
|
+
const token_1 = require("../utils/token");
|
|
27
28
|
exports.POSITION_LIMIT = 10;
|
|
28
29
|
exports.BORROWS_LIMIT = 5;
|
|
29
30
|
exports.DEPOSITS_LIMIT = 8;
|
|
@@ -82,7 +83,7 @@ class KaminoAction {
|
|
|
82
83
|
if (reserve === undefined) {
|
|
83
84
|
throw new Error(`Reserve ${mint} not found in market ${kaminoMarket.getAddress().toBase58()}`);
|
|
84
85
|
}
|
|
85
|
-
const { userTokenAccountAddress, userCollateralAccountAddress } =
|
|
86
|
+
const { userTokenAccountAddress, userCollateralAccountAddress } = KaminoAction.getUserAccountAddresses(payer !== null && payer !== void 0 ? payer : owner, reserve.state);
|
|
86
87
|
const { kaminoObligation, depositReserves, borrowReserves, distinctReserveCount } = yield KaminoAction.loadObligation(action, kaminoMarket, owner, reserve.address, obligation);
|
|
87
88
|
const [_, userMetadata] = yield kaminoMarket.getUserMetadata(owner);
|
|
88
89
|
if (userMetadata) {
|
|
@@ -93,11 +94,9 @@ class KaminoAction {
|
|
|
93
94
|
});
|
|
94
95
|
}
|
|
95
96
|
static getUserAccountAddresses(owner, reserve) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return { userTokenAccountAddress, userCollateralAccountAddress };
|
|
100
|
-
});
|
|
97
|
+
const userTokenAccountAddress = (0, utils_1.getAssociatedTokenAddress)(reserve.liquidity.mintPubkey, owner, true, reserve.liquidity.tokenProgram, spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID);
|
|
98
|
+
const userCollateralAccountAddress = (0, utils_1.getAssociatedTokenAddress)(reserve.collateral.mintPubkey, owner, true, spl_token_1.TOKEN_PROGRAM_ID, spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID);
|
|
99
|
+
return { userTokenAccountAddress, userCollateralAccountAddress };
|
|
101
100
|
}
|
|
102
101
|
static loadObligation(action, kaminoMarket, owner, reserve, obligation, outflowReserve) {
|
|
103
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -444,12 +443,14 @@ class KaminoAction {
|
|
|
444
443
|
lendingMarket: this.kaminoMarket.getAddress(),
|
|
445
444
|
lendingMarketAuthority: this.kaminoMarket.getLendingMarketAuthority(),
|
|
446
445
|
reserve: this.reserve.address,
|
|
446
|
+
reserveLiquidityMint: this.reserve.getLiquidityMint(),
|
|
447
447
|
reserveLiquiditySupply: this.reserve.state.liquidity.supplyVault,
|
|
448
448
|
reserveCollateralMint: this.reserve.getCTokenMint(),
|
|
449
449
|
reserveDestinationDepositCollateral: this.reserve.state.collateral.supplyVault,
|
|
450
450
|
userSourceLiquidity: this.userTokenAccountAddress,
|
|
451
451
|
placeholderUserDestinationCollateral: this.kaminoMarket.programId,
|
|
452
|
-
|
|
452
|
+
collateralTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
453
|
+
liquidityTokenProgram: this.reserve.getLiquidityTokenProgram(),
|
|
453
454
|
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
454
455
|
}, this.kaminoMarket.programId));
|
|
455
456
|
}
|
|
@@ -462,11 +463,13 @@ class KaminoAction {
|
|
|
462
463
|
lendingMarket: this.kaminoMarket.getAddress(),
|
|
463
464
|
lendingMarketAuthority: this.kaminoMarket.getLendingMarketAuthority(),
|
|
464
465
|
reserve: this.reserve.address,
|
|
466
|
+
reserveLiquidityMint: this.reserve.getLiquidityMint(),
|
|
465
467
|
reserveLiquiditySupply: this.reserve.state.liquidity.supplyVault,
|
|
466
468
|
reserveCollateralMint: this.reserve.getCTokenMint(),
|
|
467
469
|
userSourceLiquidity: this.userTokenAccountAddress,
|
|
468
470
|
userDestinationCollateral: this.userCollateralAccountAddress,
|
|
469
|
-
|
|
471
|
+
collateralTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
472
|
+
liquidityTokenProgram: this.reserve.getLiquidityTokenProgram(),
|
|
470
473
|
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
471
474
|
}, this.kaminoMarket.programId));
|
|
472
475
|
}
|
|
@@ -479,11 +482,13 @@ class KaminoAction {
|
|
|
479
482
|
lendingMarket: this.kaminoMarket.getAddress(),
|
|
480
483
|
lendingMarketAuthority: this.kaminoMarket.getLendingMarketAuthority(),
|
|
481
484
|
reserve: this.reserve.address,
|
|
485
|
+
reserveLiquidityMint: this.reserve.getLiquidityMint(),
|
|
482
486
|
reserveLiquiditySupply: this.reserve.state.liquidity.supplyVault,
|
|
483
487
|
reserveCollateralMint: this.reserve.getCTokenMint(),
|
|
484
488
|
userSourceCollateral: this.userCollateralAccountAddress,
|
|
485
489
|
userDestinationLiquidity: this.userTokenAccountAddress,
|
|
486
|
-
|
|
490
|
+
collateralTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
491
|
+
liquidityTokenProgram: this.reserve.getLiquidityTokenProgram(),
|
|
487
492
|
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
488
493
|
}, this.kaminoMarket.programId));
|
|
489
494
|
}
|
|
@@ -504,7 +509,11 @@ class KaminoAction {
|
|
|
504
509
|
}
|
|
505
510
|
addBorrowIx() {
|
|
506
511
|
this.lendingIxsLabels.push(`borrowObligationLiquidity`);
|
|
507
|
-
this.
|
|
512
|
+
const depositReservesList = this.getAdditionalDepositReservesList();
|
|
513
|
+
const depositReserveAccountMetas = depositReservesList.map((reserve) => {
|
|
514
|
+
return { pubkey: reserve, isSigner: false, isWritable: true };
|
|
515
|
+
});
|
|
516
|
+
const borrowIx = (0, instructions_1.borrowObligationLiquidity)({
|
|
508
517
|
liquidityAmount: this.amount,
|
|
509
518
|
}, {
|
|
510
519
|
owner: this.owner,
|
|
@@ -512,13 +521,16 @@ class KaminoAction {
|
|
|
512
521
|
lendingMarket: this.kaminoMarket.getAddress(),
|
|
513
522
|
lendingMarketAuthority: this.kaminoMarket.getLendingMarketAuthority(),
|
|
514
523
|
borrowReserve: this.reserve.address,
|
|
524
|
+
borrowReserveLiquidityMint: this.reserve.getLiquidityMint(),
|
|
515
525
|
reserveSourceLiquidity: this.reserve.state.liquidity.supplyVault,
|
|
516
526
|
userDestinationLiquidity: this.userTokenAccountAddress,
|
|
517
527
|
borrowReserveLiquidityFeeReceiver: this.reserve.state.liquidity.feeVault,
|
|
518
528
|
referrerTokenState: (0, utils_1.referrerTokenStatePda)(this.referrer, this.reserve.address, this.kaminoMarket.programId)[0],
|
|
519
|
-
tokenProgram:
|
|
529
|
+
tokenProgram: this.reserve.getLiquidityTokenProgram(),
|
|
520
530
|
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
521
|
-
}, this.kaminoMarket.programId)
|
|
531
|
+
}, this.kaminoMarket.programId);
|
|
532
|
+
borrowIx.keys = borrowIx.keys.concat([...depositReserveAccountMetas]);
|
|
533
|
+
this.lendingIxs.push(borrowIx);
|
|
522
534
|
}
|
|
523
535
|
addDepositAndBorrowIx() {
|
|
524
536
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -532,12 +544,14 @@ class KaminoAction {
|
|
|
532
544
|
lendingMarket: this.kaminoMarket.getAddress(),
|
|
533
545
|
lendingMarketAuthority: this.kaminoMarket.getLendingMarketAuthority(),
|
|
534
546
|
reserve: this.reserve.address,
|
|
547
|
+
reserveLiquidityMint: this.reserve.getLiquidityMint(),
|
|
535
548
|
reserveLiquiditySupply: this.reserve.state.liquidity.supplyVault,
|
|
536
549
|
reserveCollateralMint: this.reserve.getCTokenMint(),
|
|
537
550
|
reserveDestinationDepositCollateral: this.reserve.state.collateral.supplyVault,
|
|
538
551
|
userSourceLiquidity: this.userTokenAccountAddress,
|
|
539
552
|
placeholderUserDestinationCollateral: this.kaminoMarket.programId,
|
|
540
|
-
|
|
553
|
+
collateralTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
554
|
+
liquidityTokenProgram: this.reserve.getLiquidityTokenProgram(),
|
|
541
555
|
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
542
556
|
}, this.kaminoMarket.programId));
|
|
543
557
|
if (!this.outflowReserve) {
|
|
@@ -549,7 +563,14 @@ class KaminoAction {
|
|
|
549
563
|
if (!this.outflowAmount) {
|
|
550
564
|
throw new Error(`outflowAmount not set`);
|
|
551
565
|
}
|
|
552
|
-
this.
|
|
566
|
+
const depositReservesList = this.getAdditionalDepositReservesList();
|
|
567
|
+
if (depositReservesList.length === 0) {
|
|
568
|
+
depositReservesList.push(this.reserve.address);
|
|
569
|
+
}
|
|
570
|
+
const depositReserveAccountMetas = depositReservesList.map((reserve) => {
|
|
571
|
+
return { pubkey: reserve, isSigner: false, isWritable: true };
|
|
572
|
+
});
|
|
573
|
+
const borrowIx = (0, instructions_1.borrowObligationLiquidity)({
|
|
553
574
|
liquidityAmount: this.outflowAmount,
|
|
554
575
|
}, {
|
|
555
576
|
owner: this.owner,
|
|
@@ -557,13 +578,16 @@ class KaminoAction {
|
|
|
557
578
|
lendingMarket: this.kaminoMarket.getAddress(),
|
|
558
579
|
lendingMarketAuthority: this.kaminoMarket.getLendingMarketAuthority(),
|
|
559
580
|
borrowReserve: this.outflowReserve.address,
|
|
581
|
+
borrowReserveLiquidityMint: this.outflowReserve.getLiquidityMint(),
|
|
560
582
|
reserveSourceLiquidity: this.outflowReserve.state.liquidity.supplyVault,
|
|
561
583
|
userDestinationLiquidity: this.additionalTokenAccountAddress,
|
|
562
584
|
borrowReserveLiquidityFeeReceiver: this.outflowReserve.state.liquidity.feeVault,
|
|
563
585
|
referrerTokenState: (0, utils_1.referrerTokenStatePda)(this.referrer, this.outflowReserve.address, this.kaminoMarket.programId)[0],
|
|
564
|
-
tokenProgram:
|
|
586
|
+
tokenProgram: this.reserve.getLiquidityTokenProgram(),
|
|
565
587
|
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
566
|
-
}, this.kaminoMarket.programId)
|
|
588
|
+
}, this.kaminoMarket.programId);
|
|
589
|
+
borrowIx.keys = borrowIx.keys.concat([...depositReserveAccountMetas]);
|
|
590
|
+
this.lendingIxs.push(borrowIx);
|
|
567
591
|
});
|
|
568
592
|
}
|
|
569
593
|
addRepayAndWithdrawIxs() {
|
|
@@ -577,9 +601,10 @@ class KaminoAction {
|
|
|
577
601
|
obligation: this.getObligationPda(),
|
|
578
602
|
lendingMarket: this.kaminoMarket.getAddress(),
|
|
579
603
|
repayReserve: this.reserve.address,
|
|
604
|
+
reserveLiquidityMint: this.reserve.getLiquidityMint(),
|
|
580
605
|
userSourceLiquidity: this.userTokenAccountAddress,
|
|
581
606
|
reserveDestinationLiquidity: this.reserve.state.liquidity.supplyVault,
|
|
582
|
-
tokenProgram:
|
|
607
|
+
tokenProgram: this.reserve.getLiquidityTokenProgram(),
|
|
583
608
|
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
584
609
|
}, this.kaminoMarket.programId));
|
|
585
610
|
if (!this.outflowReserve) {
|
|
@@ -602,12 +627,14 @@ class KaminoAction {
|
|
|
602
627
|
lendingMarket: this.kaminoMarket.getAddress(),
|
|
603
628
|
lendingMarketAuthority: this.kaminoMarket.getLendingMarketAuthority(),
|
|
604
629
|
withdrawReserve: this.outflowReserve.address,
|
|
630
|
+
reserveLiquidityMint: this.outflowReserve.getLiquidityMint(),
|
|
605
631
|
reserveCollateralMint: this.outflowReserve.getCTokenMint(),
|
|
606
632
|
reserveLiquiditySupply: this.outflowReserve.state.liquidity.supplyVault,
|
|
607
633
|
reserveSourceCollateral: this.outflowReserve.state.collateral.supplyVault,
|
|
608
634
|
userDestinationLiquidity: this.additionalTokenAccountAddress,
|
|
609
635
|
placeholderUserDestinationCollateral: this.kaminoMarket.programId,
|
|
610
|
-
|
|
636
|
+
collateralTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
637
|
+
liquidityTokenProgram: this.reserve.getLiquidityTokenProgram(),
|
|
611
638
|
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
612
639
|
}, this.kaminoMarket.programId));
|
|
613
640
|
});
|
|
@@ -627,12 +654,14 @@ class KaminoAction {
|
|
|
627
654
|
lendingMarket: this.kaminoMarket.getAddress(),
|
|
628
655
|
lendingMarketAuthority: this.kaminoMarket.getLendingMarketAuthority(),
|
|
629
656
|
withdrawReserve: this.reserve.address,
|
|
657
|
+
reserveLiquidityMint: this.reserve.getLiquidityMint(),
|
|
630
658
|
reserveCollateralMint: this.reserve.getCTokenMint(),
|
|
631
659
|
reserveLiquiditySupply: this.reserve.state.liquidity.supplyVault,
|
|
632
660
|
reserveSourceCollateral: this.reserve.state.collateral.supplyVault,
|
|
633
661
|
userDestinationLiquidity: this.userTokenAccountAddress,
|
|
634
662
|
placeholderUserDestinationCollateral: this.kaminoMarket.programId,
|
|
635
|
-
|
|
663
|
+
collateralTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
664
|
+
liquidityTokenProgram: this.reserve.getLiquidityTokenProgram(),
|
|
636
665
|
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
637
666
|
}, this.kaminoMarket.programId));
|
|
638
667
|
});
|
|
@@ -640,18 +669,25 @@ class KaminoAction {
|
|
|
640
669
|
addRepayIx() {
|
|
641
670
|
return __awaiter(this, void 0, void 0, function* () {
|
|
642
671
|
this.lendingIxsLabels.push(`repayObligationLiquidity(reserve=${this.reserve.address})(obligation=${this.getObligationPda()})`);
|
|
643
|
-
this.
|
|
672
|
+
const depositReservesList = this.getAdditionalDepositReservesList();
|
|
673
|
+
const depositReserveAccountMetas = depositReservesList.map((reserve) => {
|
|
674
|
+
return { pubkey: reserve, isSigner: false, isWritable: true };
|
|
675
|
+
});
|
|
676
|
+
const repayIx = (0, instructions_1.repayObligationLiquidity)({
|
|
644
677
|
liquidityAmount: this.amount,
|
|
645
678
|
}, {
|
|
646
679
|
owner: this.payer,
|
|
647
680
|
obligation: this.getObligationPda(),
|
|
648
681
|
lendingMarket: this.kaminoMarket.getAddress(),
|
|
649
682
|
repayReserve: this.reserve.address,
|
|
683
|
+
reserveLiquidityMint: this.reserve.getLiquidityMint(),
|
|
650
684
|
userSourceLiquidity: this.userTokenAccountAddress,
|
|
651
685
|
reserveDestinationLiquidity: this.reserve.state.liquidity.supplyVault,
|
|
652
|
-
tokenProgram:
|
|
686
|
+
tokenProgram: this.reserve.getLiquidityTokenProgram(),
|
|
653
687
|
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
654
|
-
}, this.kaminoMarket.programId)
|
|
688
|
+
}, this.kaminoMarket.programId);
|
|
689
|
+
repayIx.keys = repayIx.keys.concat([...depositReserveAccountMetas]);
|
|
690
|
+
this.lendingIxs.push(repayIx);
|
|
655
691
|
});
|
|
656
692
|
}
|
|
657
693
|
addLiquidateIx(maxAllowedLtvOverridePercent = 0) {
|
|
@@ -663,11 +699,14 @@ class KaminoAction {
|
|
|
663
699
|
if (!this.additionalTokenAccountAddress) {
|
|
664
700
|
throw Error(`Liquidating token account address is not defined`);
|
|
665
701
|
}
|
|
666
|
-
this.
|
|
702
|
+
const depositReservesList = this.getAdditionalDepositReservesList();
|
|
703
|
+
const depositReserveAccountMetas = depositReservesList.map((reserve) => {
|
|
704
|
+
return { pubkey: reserve, isSigner: false, isWritable: true };
|
|
705
|
+
});
|
|
706
|
+
const liquidateIx = (0, instructions_1.liquidateObligationAndRedeemReserveCollateral)({
|
|
667
707
|
liquidityAmount: this.amount,
|
|
668
708
|
// TODO: Configure this when updating liquidator with new interface
|
|
669
|
-
|
|
670
|
-
// TODO: remove this before going live
|
|
709
|
+
minAcceptableReceivedLiquidityAmount: this.outflowAmount || new bn_js_1.default(0),
|
|
671
710
|
maxAllowedLtvOverridePercent: new bn_js_1.default(maxAllowedLtvOverridePercent),
|
|
672
711
|
}, {
|
|
673
712
|
liquidator: this.owner,
|
|
@@ -675,8 +714,10 @@ class KaminoAction {
|
|
|
675
714
|
lendingMarket: this.kaminoMarket.getAddress(),
|
|
676
715
|
lendingMarketAuthority: this.kaminoMarket.getLendingMarketAuthority(),
|
|
677
716
|
repayReserve: this.reserve.address,
|
|
717
|
+
repayReserveLiquidityMint: this.reserve.getLiquidityMint(),
|
|
678
718
|
repayReserveLiquiditySupply: this.reserve.state.liquidity.supplyVault,
|
|
679
719
|
withdrawReserve: this.outflowReserve.address,
|
|
720
|
+
withdrawReserveLiquidityMint: this.outflowReserve.getLiquidityMint(),
|
|
680
721
|
withdrawReserveCollateralMint: this.outflowReserve.getCTokenMint(),
|
|
681
722
|
withdrawReserveCollateralSupply: this.outflowReserve.state.collateral.supplyVault,
|
|
682
723
|
withdrawReserveLiquiditySupply: this.outflowReserve.state.liquidity.supplyVault,
|
|
@@ -684,9 +725,13 @@ class KaminoAction {
|
|
|
684
725
|
userDestinationCollateral: this.userCollateralAccountAddress,
|
|
685
726
|
userDestinationLiquidity: this.userTokenAccountAddress,
|
|
686
727
|
withdrawReserveLiquidityFeeReceiver: this.outflowReserve.state.liquidity.feeVault,
|
|
687
|
-
|
|
728
|
+
collateralTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
729
|
+
repayLiquidityTokenProgram: this.reserve.getLiquidityTokenProgram(),
|
|
730
|
+
withdrawLiquidityTokenProgram: this.outflowReserve.getLiquidityTokenProgram(),
|
|
688
731
|
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
689
|
-
}, this.kaminoMarket.programId)
|
|
732
|
+
}, this.kaminoMarket.programId);
|
|
733
|
+
liquidateIx.keys = liquidateIx.keys.concat([...depositReserveAccountMetas]);
|
|
734
|
+
this.lendingIxs.push(liquidateIx);
|
|
690
735
|
});
|
|
691
736
|
}
|
|
692
737
|
addInBetweenIxs(action, includeAtaIxns, requestElevationGroup, addInitObligationForFarm, isClosingPosition = false) {
|
|
@@ -957,20 +1002,7 @@ class KaminoAction {
|
|
|
957
1002
|
lendingMarket: marketAddress,
|
|
958
1003
|
obligation: obligationPda,
|
|
959
1004
|
}, this.kaminoMarket.programId);
|
|
960
|
-
const depositReservesList = this.
|
|
961
|
-
// check if there's any member in the preloadedDepositReserves that is not in the depositReserves
|
|
962
|
-
// if so, add it to the depositReserves
|
|
963
|
-
for (let i = 0; i < this.preLoadedDepositReservesSameTx.length; i++) {
|
|
964
|
-
const preloadedDepositReserve = this.preLoadedDepositReservesSameTx[i];
|
|
965
|
-
// Check if the depositReserves array contains the current preloadedDepositReserve
|
|
966
|
-
const found = this.depositReserves.some((depositReserve) => {
|
|
967
|
-
return depositReserve.equals(preloadedDepositReserve);
|
|
968
|
-
});
|
|
969
|
-
// If not found, push the current preloadedDepositReserve to the depositReserves array
|
|
970
|
-
if (!found) {
|
|
971
|
-
depositReservesList.push(this.preLoadedDepositReservesSameTx[i]);
|
|
972
|
-
}
|
|
973
|
-
}
|
|
1005
|
+
const depositReservesList = this.getAdditionalDepositReservesList();
|
|
974
1006
|
const depositReserveAccountMetas = depositReservesList.map((reserve) => {
|
|
975
1007
|
return { pubkey: reserve, isSigner: false, isWritable: true };
|
|
976
1008
|
});
|
|
@@ -1012,20 +1044,7 @@ class KaminoAction {
|
|
|
1012
1044
|
lendingMarket: this.kaminoMarket.getAddress(),
|
|
1013
1045
|
};
|
|
1014
1046
|
const requestElevationGroupIx = (0, instructions_1.requestElevationGroup)(args, accounts, this.kaminoMarket.programId);
|
|
1015
|
-
const depositReservesList = this.
|
|
1016
|
-
// check if there's any member in the preloadedDepositReserves that is not in the depositReserves
|
|
1017
|
-
// if so, add it to the depositReserves
|
|
1018
|
-
for (let i = 0; i < this.preLoadedDepositReservesSameTx.length; i++) {
|
|
1019
|
-
const preloadedDepositReserveString = this.preLoadedDepositReservesSameTx[i].toString();
|
|
1020
|
-
// Check if the depositReserves array contains the current preloadedDepositReserve
|
|
1021
|
-
const found = this.depositReserves.some((depositReserve) => {
|
|
1022
|
-
return depositReserve.toString() === preloadedDepositReserveString;
|
|
1023
|
-
});
|
|
1024
|
-
// If not found, push the current preloadedDepositReserve to the depositReserves array
|
|
1025
|
-
if (!found) {
|
|
1026
|
-
depositReservesList.push(this.preLoadedDepositReservesSameTx[i]);
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1047
|
+
const depositReservesList = this.getAdditionalDepositReservesList();
|
|
1029
1048
|
const depositReserveAccountMetas = depositReservesList.map((reserve) => {
|
|
1030
1049
|
return { pubkey: reserve, isSigner: false, isWritable: true };
|
|
1031
1050
|
});
|
|
@@ -1092,7 +1111,6 @@ class KaminoAction {
|
|
|
1092
1111
|
lendingMarket: this.kaminoMarket.getAddress(),
|
|
1093
1112
|
farmsProgram: farms_sdk_1.farmsId,
|
|
1094
1113
|
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
1095
|
-
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
1096
1114
|
systemProgram: web3_js_1.SystemProgram.programId,
|
|
1097
1115
|
};
|
|
1098
1116
|
const refreshFarmForObligationix = (0, instructions_1.refreshObligationFarmsForReserve)(args, accounts, this.kaminoMarket.programId);
|
|
@@ -1153,7 +1171,6 @@ class KaminoAction {
|
|
|
1153
1171
|
lendingMarket: this.kaminoMarket.getAddress(),
|
|
1154
1172
|
farmsProgram: farms_sdk_1.farmsId,
|
|
1155
1173
|
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
1156
|
-
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
1157
1174
|
systemProgram: web3_js_1.SystemProgram.programId,
|
|
1158
1175
|
};
|
|
1159
1176
|
const initObligationForFarm = (0, instructions_1.initObligationFarmsForReserve)(args, accounts, this.kaminoMarket.programId);
|
|
@@ -1187,7 +1204,6 @@ class KaminoAction {
|
|
|
1187
1204
|
seed2Account: this.obligationType.toArgs().seed2,
|
|
1188
1205
|
ownerUserMetadata: userMetadataAddress,
|
|
1189
1206
|
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
1190
|
-
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
1191
1207
|
systemProgram: web3_js_1.SystemProgram.programId,
|
|
1192
1208
|
}, this.kaminoMarket.programId);
|
|
1193
1209
|
this.setupIxs.push(initObligationIx);
|
|
@@ -1256,11 +1272,12 @@ class KaminoAction {
|
|
|
1256
1272
|
referrer: this.owner,
|
|
1257
1273
|
lendingMarket: this.kaminoMarket.getAddress(),
|
|
1258
1274
|
reserve: this.reserve.address,
|
|
1275
|
+
reserveLiquidityMint: this.reserve.getLiquidityMint(),
|
|
1259
1276
|
referrerTokenState: referrerTokenStateAddress,
|
|
1260
1277
|
reserveSupplyLiquidity: this.reserve.state.liquidity.supplyVault,
|
|
1261
1278
|
referrerTokenAccount: this.userTokenAccountAddress,
|
|
1262
1279
|
lendingMarketAuthority: this.kaminoMarket.getLendingMarketAuthority(),
|
|
1263
|
-
tokenProgram:
|
|
1280
|
+
tokenProgram: this.reserve.getLiquidityTokenProgram(),
|
|
1264
1281
|
}, this.kaminoMarket.programId);
|
|
1265
1282
|
this.lendingIxs.push(withdrawReferrerFeesIx);
|
|
1266
1283
|
this.lendingIxsLabels.push(`WithdrawReferrerFeesIx[${this.owner.toString()}]`);
|
|
@@ -1278,7 +1295,7 @@ class KaminoAction {
|
|
|
1278
1295
|
if ((action === 'withdraw' || action === 'borrow' || action === 'redeem') && !this.mint.equals(utils_1.WRAPPED_SOL_MINT)) {
|
|
1279
1296
|
const userTokenAccountInfo = yield this.kaminoMarket.getConnection().getAccountInfo(this.userTokenAccountAddress);
|
|
1280
1297
|
if (!userTokenAccountInfo) {
|
|
1281
|
-
const [, createUserTokenAccountIx] =
|
|
1298
|
+
const [, createUserTokenAccountIx] = (0, utils_1.createAssociatedTokenAccountIdempotentInstruction)(this.owner, this.reserve.getLiquidityMint(), this.owner, this.reserve.getLiquidityTokenProgram(), this.userTokenAccountAddress);
|
|
1282
1299
|
if (this.positions === exports.POSITION_LIMIT && this.hostAta) {
|
|
1283
1300
|
this.preTxnIxs.push(createUserTokenAccountIx);
|
|
1284
1301
|
this.preTxnIxsLabels.push(`CreateLiquidityUserAta[${this.owner}]`);
|
|
@@ -1295,7 +1312,7 @@ class KaminoAction {
|
|
|
1295
1312
|
throw new Error(`Outflow reserve state not found ${this.mint}`);
|
|
1296
1313
|
}
|
|
1297
1314
|
if (!userTokenAccountInfo) {
|
|
1298
|
-
const [, createUserTokenAccountIx] =
|
|
1315
|
+
const [, createUserTokenAccountIx] = (0, utils_1.createAssociatedTokenAccountIdempotentInstruction)(this.owner, this.outflowReserve.getLiquidityMint(), this.owner, this.outflowReserve.getLiquidityTokenProgram(), this.userTokenAccountAddress);
|
|
1299
1316
|
if (this.positions === exports.POSITION_LIMIT && this.mint.equals(utils_1.WRAPPED_SOL_MINT)) {
|
|
1300
1317
|
this.preTxnIxs.push(createUserTokenAccountIx);
|
|
1301
1318
|
this.preTxnIxsLabels.push(`CreateUserAta[${this.userTokenAccountAddress.toBase58()}]`);
|
|
@@ -1309,7 +1326,7 @@ class KaminoAction {
|
|
|
1309
1326
|
.getConnection()
|
|
1310
1327
|
.getAccountInfo(this.userCollateralAccountAddress);
|
|
1311
1328
|
if (!userCollateralAccountInfo) {
|
|
1312
|
-
const [, createUserCollateralAccountIx] =
|
|
1329
|
+
const [, createUserCollateralAccountIx] = (0, utils_1.createAssociatedTokenAccountIdempotentInstruction)(this.owner, this.outflowReserve.getCTokenMint(), this.owner, spl_token_1.TOKEN_PROGRAM_ID, this.userCollateralAccountAddress);
|
|
1313
1330
|
if (this.positions === exports.POSITION_LIMIT && this.mint.equals(utils_1.WRAPPED_SOL_MINT)) {
|
|
1314
1331
|
this.preTxnIxs.push(createUserCollateralAccountIx);
|
|
1315
1332
|
this.preTxnIxsLabels.push(`CreateCollateralUserAta[${this.userCollateralAccountAddress.toString()}]`);
|
|
@@ -1335,7 +1352,7 @@ class KaminoAction {
|
|
|
1335
1352
|
.getConnection()
|
|
1336
1353
|
.getAccountInfo(this.additionalTokenAccountAddress);
|
|
1337
1354
|
if (!additionalUserTokenAccountInfo) {
|
|
1338
|
-
const [, createUserTokenAccountIx] =
|
|
1355
|
+
const [, createUserTokenAccountIx] = (0, utils_1.createAssociatedTokenAccountIdempotentInstruction)(this.owner, this.outflowReserve.getLiquidityMint(), this.owner, this.outflowReserve.getLiquidityTokenProgram(), this.additionalTokenAccountAddress);
|
|
1339
1356
|
this.setupIxs.unshift(createUserTokenAccountIx);
|
|
1340
1357
|
this.setupIxsLabels.unshift(`CreateAdditionalUserTokenAta[${this.owner}]`);
|
|
1341
1358
|
}
|
|
@@ -1344,7 +1361,7 @@ class KaminoAction {
|
|
|
1344
1361
|
const userTokenAccountInfo = yield this.kaminoMarket.getConnection().getAccountInfo(this.userTokenAccountAddress);
|
|
1345
1362
|
// TODO: Might need to remove this
|
|
1346
1363
|
if (!userTokenAccountInfo) {
|
|
1347
|
-
const [, createUserTokenAccountIx] =
|
|
1364
|
+
const [, createUserTokenAccountIx] = (0, utils_1.createAssociatedTokenAccountIdempotentInstruction)(this.owner, this.reserve.getLiquidityMint(), this.owner, this.reserve.getLiquidityTokenProgram(), this.userTokenAccountAddress);
|
|
1348
1365
|
this.preTxnIxs.push(createUserTokenAccountIx);
|
|
1349
1366
|
this.preTxnIxsLabels.push(`CreateUserAta[${this.userTokenAccountAddress.toBase58()}]`);
|
|
1350
1367
|
}
|
|
@@ -1355,7 +1372,7 @@ class KaminoAction {
|
|
|
1355
1372
|
.getAccountInfo(this.userCollateralAccountAddress);
|
|
1356
1373
|
if (!userCollateralAccountInfo) {
|
|
1357
1374
|
const collateralMintPubkey = this.reserve.getCTokenMint();
|
|
1358
|
-
const [, createUserCollateralAccountIx] =
|
|
1375
|
+
const [, createUserCollateralAccountIx] = (0, utils_1.createAssociatedTokenAccountIdempotentInstruction)(this.owner, collateralMintPubkey, this.owner, spl_token_1.TOKEN_PROGRAM_ID, this.userCollateralAccountAddress);
|
|
1359
1376
|
if (this.positions === exports.POSITION_LIMIT && this.mint.equals(utils_1.WRAPPED_SOL_MINT)) {
|
|
1360
1377
|
this.preTxnIxs.push(createUserCollateralAccountIx);
|
|
1361
1378
|
this.preTxnIxsLabels.push(`CreateCollateralUserAta[${this.userCollateralAccountAddress.toString()}]`);
|
|
@@ -1401,7 +1418,7 @@ class KaminoAction {
|
|
|
1401
1418
|
userTokenAccountAddress = this.additionalTokenAccountAddress;
|
|
1402
1419
|
}
|
|
1403
1420
|
const userWSOLAccountInfo = yield this.kaminoMarket.getConnection().getAccountInfo(userTokenAccountAddress);
|
|
1404
|
-
const rentExempt = yield
|
|
1421
|
+
const rentExempt = yield this.kaminoMarket.getConnection().getMinimumBalanceForRentExemption(165);
|
|
1405
1422
|
// Add rent exemption lamports for WSOL accounts that need to be pre-funded for inflow/send transactions
|
|
1406
1423
|
const sendAction = action === 'deposit' ||
|
|
1407
1424
|
action === 'repay' ||
|
|
@@ -1414,7 +1431,7 @@ class KaminoAction {
|
|
|
1414
1431
|
});
|
|
1415
1432
|
preIxs.push(transferLamportsIx);
|
|
1416
1433
|
preIxsLabels.push(`TransferLamportsToUserAtaSOL[${userTokenAccountAddress}]`);
|
|
1417
|
-
const closeWSOLAccountIx =
|
|
1434
|
+
const closeWSOLAccountIx = (0, token_1.createCloseAccountInstruction)(userTokenAccountAddress, this.owner, this.owner, spl_token_1.TOKEN_PROGRAM_ID);
|
|
1418
1435
|
const syncIx = (0, utils_1.syncNative)(userTokenAccountAddress);
|
|
1419
1436
|
if (userWSOLAccountInfo) {
|
|
1420
1437
|
if (sendAction) {
|
|
@@ -1427,7 +1444,7 @@ class KaminoAction {
|
|
|
1427
1444
|
}
|
|
1428
1445
|
}
|
|
1429
1446
|
else {
|
|
1430
|
-
const [, createUserWSOLAccountIx] =
|
|
1447
|
+
const [, createUserWSOLAccountIx] = (0, utils_1.createAssociatedTokenAccountIdempotentInstruction)(this.owner, spl_token_1.NATIVE_MINT, this.owner, spl_token_1.TOKEN_PROGRAM_ID, userTokenAccountAddress);
|
|
1431
1448
|
preIxs.push(createUserWSOLAccountIx);
|
|
1432
1449
|
preIxsLabels.push(`CreateUserAtaSOL[${userTokenAccountAddress}]`);
|
|
1433
1450
|
preIxs.push(syncIx);
|
|
@@ -1456,8 +1473,8 @@ class KaminoAction {
|
|
|
1456
1473
|
if (!outflowReserve || !inflowReserve) {
|
|
1457
1474
|
throw new Error('reserve states are not fetched');
|
|
1458
1475
|
}
|
|
1459
|
-
const { userTokenAccountAddress: userOutflowTokenAccountAddress, userCollateralAccountAddress: userOutflowCollateralAccountAddress, } =
|
|
1460
|
-
const { userTokenAccountAddress: userInflowTokenAccountAddress, userCollateralAccountAddress: userInflowCollateralAccountAddress, } =
|
|
1476
|
+
const { userTokenAccountAddress: userOutflowTokenAccountAddress, userCollateralAccountAddress: userOutflowCollateralAccountAddress, } = KaminoAction.getUserAccountAddresses(payer, outflowReserve.state);
|
|
1477
|
+
const { userTokenAccountAddress: userInflowTokenAccountAddress, userCollateralAccountAddress: userInflowCollateralAccountAddress, } = KaminoAction.getUserAccountAddresses(payer, inflowReserve.state);
|
|
1461
1478
|
const { kaminoObligation, depositReserves, borrowReserves, distinctReserveCount } = yield KaminoAction.loadObligation(action, kaminoMarket, obligationOwner, inflowReserve.address, obligation, outflowReserve.address);
|
|
1462
1479
|
const [_, userMetadata] = yield kaminoMarket.getUserMetadata(payer);
|
|
1463
1480
|
if (userMetadata) {
|
|
@@ -1517,6 +1534,23 @@ class KaminoAction {
|
|
|
1517
1534
|
? this.obligation.obligationAddress
|
|
1518
1535
|
: this.obligationType.toPda(this.kaminoMarket.getAddress(), this.owner);
|
|
1519
1536
|
}
|
|
1537
|
+
getAdditionalDepositReservesList() {
|
|
1538
|
+
const depositReservesList = this.depositReserves;
|
|
1539
|
+
// check if there's any member in the preloadedDepositReserves that is not in the depositReserves
|
|
1540
|
+
// if so, add it to the depositReserves
|
|
1541
|
+
for (let i = 0; i < this.preLoadedDepositReservesSameTx.length; i++) {
|
|
1542
|
+
const preloadedDepositReserve = this.preLoadedDepositReservesSameTx[i];
|
|
1543
|
+
// Check if the depositReserves array contains the current preloadedDepositReserve
|
|
1544
|
+
const found = this.depositReserves.some((depositReserve) => {
|
|
1545
|
+
return depositReserve.equals(preloadedDepositReserve);
|
|
1546
|
+
});
|
|
1547
|
+
// If not found, push the current preloadedDepositReserve to the depositReserves array
|
|
1548
|
+
if (!found) {
|
|
1549
|
+
depositReservesList.push(this.preLoadedDepositReservesSameTx[i]);
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
return depositReservesList;
|
|
1553
|
+
}
|
|
1520
1554
|
}
|
|
1521
1555
|
exports.KaminoAction = KaminoAction;
|
|
1522
1556
|
//# sourceMappingURL=action.js.map
|