@kamino-finance/klend-sdk 5.11.0-beta.0 → 5.11.1
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 +16 -17
- package/dist/classes/action.d.ts.map +1 -1
- package/dist/classes/action.js +61 -102
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/manager.d.ts +16 -4
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +28 -3
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/obligation.d.ts +6 -1
- package/dist/classes/obligation.d.ts.map +1 -1
- package/dist/classes/obligation.js +4 -2
- package/dist/classes/obligation.js.map +1 -1
- package/dist/classes/reserve.d.ts +2 -2
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +15 -11
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/types.d.ts +4 -0
- package/dist/classes/types.d.ts.map +1 -1
- package/dist/classes/utils.d.ts.map +1 -1
- package/dist/classes/utils.js +1 -2
- package/dist/classes/utils.js.map +1 -1
- package/dist/classes/vault.d.ts +18 -4
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +87 -30
- package/dist/classes/vault.js.map +1 -1
- package/dist/client_kamino_manager.d.ts.map +1 -1
- package/dist/client_kamino_manager.js +8 -3
- package/dist/client_kamino_manager.js.map +1 -1
- package/dist/idl.json +199 -152
- package/dist/idl_codegen/accounts/LendingMarket.d.ts +15 -0
- package/dist/idl_codegen/accounts/LendingMarket.d.ts.map +1 -1
- package/dist/idl_codegen/accounts/LendingMarket.js +11 -1
- package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
- package/dist/idl_codegen/errors/custom.d.ts +18 -2
- package/dist/idl_codegen/errors/custom.d.ts.map +1 -1
- package/dist/idl_codegen/errors/custom.js +31 -3
- package/dist/idl_codegen/errors/custom.js.map +1 -1
- package/dist/idl_codegen/instructions/borrowObligationLiquidity.js +1 -1
- package/dist/idl_codegen/instructions/borrowObligationLiquidity.js.map +1 -1
- package/dist/idl_codegen/instructions/borrowObligationLiquidityV2.js +1 -1
- package/dist/idl_codegen/instructions/borrowObligationLiquidityV2.js.map +1 -1
- package/dist/idl_codegen/instructions/depositAndWithdraw.d.ts +52 -0
- package/dist/idl_codegen/instructions/depositAndWithdraw.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/depositAndWithdraw.js +219 -0
- package/dist/idl_codegen/instructions/depositAndWithdraw.js.map +1 -0
- package/dist/idl_codegen/instructions/depositReserveLiquidity.js +1 -1
- package/dist/idl_codegen/instructions/depositReserveLiquidity.js.map +1 -1
- package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateral.js +1 -1
- package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateral.js.map +1 -1
- package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateralV2.js +1 -1
- package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateralV2.js.map +1 -1
- package/dist/idl_codegen/instructions/index.d.ts +2 -2
- package/dist/idl_codegen/instructions/index.d.ts.map +1 -1
- package/dist/idl_codegen/instructions/index.js +3 -3
- package/dist/idl_codegen/instructions/index.js.map +1 -1
- package/dist/idl_codegen/instructions/initFarmsForReserve.js +1 -1
- package/dist/idl_codegen/instructions/initFarmsForReserve.js.map +1 -1
- package/dist/idl_codegen/instructions/initObligationFarmsForReserve.js +1 -1
- package/dist/idl_codegen/instructions/initObligationFarmsForReserve.js.map +1 -1
- package/dist/idl_codegen/instructions/initReserve.d.ts +1 -0
- package/dist/idl_codegen/instructions/initReserve.d.ts.map +1 -1
- package/dist/idl_codegen/instructions/initReserve.js +5 -0
- package/dist/idl_codegen/instructions/initReserve.js.map +1 -1
- package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.js +2 -2
- package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.js.map +1 -1
- package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateralV2.js +2 -2
- package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateralV2.js.map +1 -1
- package/dist/idl_codegen/instructions/redeemFees.js +1 -1
- package/dist/idl_codegen/instructions/redeemFees.js.map +1 -1
- package/dist/idl_codegen/instructions/redeemReserveCollateral.js +1 -1
- package/dist/idl_codegen/instructions/redeemReserveCollateral.js.map +1 -1
- package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.js +1 -1
- package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.js.map +1 -1
- package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeem.js +2 -2
- package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeem.js.map +1 -1
- package/dist/idl_codegen/instructions/repayObligationLiquidity.js +1 -1
- package/dist/idl_codegen/instructions/repayObligationLiquidity.js.map +1 -1
- package/dist/idl_codegen/instructions/repayObligationLiquidityV2.js +1 -1
- package/dist/idl_codegen/instructions/repayObligationLiquidityV2.js.map +1 -1
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js +1 -1
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js.map +1 -1
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js +1 -1
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js.map +1 -1
- package/dist/idl_codegen/instructions/withdrawProtocolFee.js +1 -1
- package/dist/idl_codegen/instructions/withdrawProtocolFee.js.map +1 -1
- package/dist/idl_codegen/instructions/withdrawReferrerFees.js +1 -1
- package/dist/idl_codegen/instructions/withdrawReferrerFees.js.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +13 -0
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js +25 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
- package/dist/idl_codegen/types/index.d.ts +2 -2
- package/dist/idl_codegen/types/index.d.ts.map +1 -1
- package/dist/idl_codegen/types/index.js.map +1 -1
- package/dist/idl_codegen/zero_padding/ObligationZP.d.ts +10 -4
- package/dist/idl_codegen/zero_padding/ObligationZP.d.ts.map +1 -1
- package/dist/idl_codegen/zero_padding/ObligationZP.js +9 -7
- package/dist/idl_codegen/zero_padding/ObligationZP.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts +3 -0
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.js +7 -1
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/custom.d.ts +25 -1
- package/dist/idl_codegen_kamino_vault/errors/custom.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/custom.js +43 -1
- package/dist/idl_codegen_kamino_vault/errors/custom.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/initVault.js +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/initVault.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts +13 -0
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js +25 -1
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/index.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/index.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/index.js.map +1 -1
- package/dist/lending_operations/repay_with_collateral_operations.js +1 -1
- package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
- package/dist/lending_operations/swap_collateral_operations.d.ts.map +1 -1
- package/dist/lending_operations/swap_collateral_operations.js +5 -3
- package/dist/lending_operations/swap_collateral_operations.js.map +1 -1
- package/dist/leverage/calcs.d.ts +1 -1
- package/dist/leverage/calcs.d.ts.map +1 -1
- package/dist/leverage/calcs.js +12 -10
- package/dist/leverage/calcs.js.map +1 -1
- package/dist/leverage/instructions.d.ts +1 -2
- package/dist/leverage/instructions.d.ts.map +1 -1
- package/dist/leverage/instructions.js +2 -6
- package/dist/leverage/instructions.js.map +1 -1
- package/dist/leverage/operations.d.ts.map +1 -1
- package/dist/leverage/operations.js +19 -13
- package/dist/leverage/operations.js.map +1 -1
- package/dist/utils/ata.d.ts +1 -1
- package/dist/utils/ata.d.ts.map +1 -1
- package/dist/utils/ata.js +2 -2
- package/dist/utils/ata.js.map +1 -1
- package/dist/utils/constants.d.ts +5 -9
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +6 -10
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/instruction.d.ts.map +1 -1
- package/dist/utils/instruction.js +1 -3
- package/dist/utils/instruction.js.map +1 -1
- package/dist/utils/managerTypes.d.ts +1 -0
- package/dist/utils/managerTypes.d.ts.map +1 -1
- package/dist/utils/managerTypes.js.map +1 -1
- package/dist/utils/userMetadata.d.ts.map +1 -1
- package/dist/utils/userMetadata.js +2 -1
- package/dist/utils/userMetadata.js.map +1 -1
- package/package.json +7 -7
- package/src/classes/action.ts +77 -105
- package/src/classes/manager.ts +35 -3
- package/src/classes/obligation.ts +8 -4
- package/src/classes/reserve.ts +16 -13
- package/src/classes/types.ts +5 -0
- package/src/classes/utils.ts +3 -3
- package/src/classes/vault.ts +103 -45
- package/src/client_kamino_manager.ts +10 -3
- package/src/idl.json +199 -152
- package/src/idl_codegen/accounts/LendingMarket.ts +21 -1
- package/src/idl_codegen/errors/custom.ts +39 -2
- package/src/idl_codegen/instructions/borrowObligationLiquidity.ts +1 -1
- package/src/idl_codegen/instructions/borrowObligationLiquidityV2.ts +1 -1
- package/src/idl_codegen/instructions/depositAndWithdraw.ts +241 -0
- package/src/idl_codegen/instructions/depositReserveLiquidity.ts +1 -1
- package/src/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateral.ts +1 -1
- package/src/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateralV2.ts +1 -1
- package/src/idl_codegen/instructions/index.ts +4 -4
- package/src/idl_codegen/instructions/initFarmsForReserve.ts +1 -1
- package/src/idl_codegen/instructions/initObligationFarmsForReserve.ts +1 -1
- package/src/idl_codegen/instructions/initReserve.ts +6 -0
- package/src/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.ts +2 -2
- package/src/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateralV2.ts +2 -2
- package/src/idl_codegen/instructions/redeemFees.ts +1 -1
- package/src/idl_codegen/instructions/redeemReserveCollateral.ts +1 -1
- package/src/idl_codegen/instructions/refreshObligationFarmsForReserve.ts +1 -1
- package/src/idl_codegen/instructions/repayAndWithdrawAndRedeem.ts +2 -2
- package/src/idl_codegen/instructions/repayObligationLiquidity.ts +1 -1
- package/src/idl_codegen/instructions/repayObligationLiquidityV2.ts +1 -1
- package/src/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.ts +1 -1
- package/src/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.ts +1 -1
- package/src/idl_codegen/instructions/withdrawProtocolFee.ts +1 -1
- package/src/idl_codegen/instructions/withdrawReferrerFees.ts +1 -1
- package/src/idl_codegen/types/UpdateLendingMarketMode.ts +30 -0
- package/src/idl_codegen/types/index.ts +2 -0
- package/src/idl_codegen/zero_padding/ObligationZP.ts +12 -6
- package/src/idl_codegen_kamino_vault/accounts/VaultState.ts +9 -1
- package/src/idl_codegen_kamino_vault/errors/custom.ts +42 -0
- package/src/idl_codegen_kamino_vault/instructions/initVault.ts +2 -0
- package/src/idl_codegen_kamino_vault/instructions/updateReserveAllocation.ts +2 -2
- package/src/idl_codegen_kamino_vault/types/VaultConfigField.ts +30 -0
- package/src/idl_codegen_kamino_vault/types/index.ts +2 -0
- package/src/idl_kamino_vault.json +30 -3
- package/src/lending_operations/repay_with_collateral_operations.ts +1 -0
- package/src/lending_operations/swap_collateral_operations.ts +6 -5
- package/src/leverage/calcs.ts +16 -13
- package/src/leverage/instructions.ts +1 -6
- package/src/leverage/operations.ts +28 -18
- package/src/utils/ata.ts +1 -1
- package/src/utils/constants.ts +6 -11
- package/src/utils/instruction.ts +1 -3
- package/src/utils/managerTypes.ts +1 -0
- package/src/utils/userMetadata.ts +2 -2
package/dist/classes/action.d.ts
CHANGED
|
@@ -58,38 +58,36 @@ export declare class KaminoAction {
|
|
|
58
58
|
includeAtaIxns?: boolean, // if true it includes create and close wsol and token atas,
|
|
59
59
|
requestElevationGroup?: boolean, // to be requested *before* the deposit
|
|
60
60
|
includeUserMetadata?: boolean, // if true it includes user metadata
|
|
61
|
-
referrer?: PublicKey, currentSlot?: number, scopeRefresh?: ScopeRefresh, overrideElevationGroupRequest?: number | undefined): Promise<KaminoAction>;
|
|
61
|
+
createLookupTable?: boolean, referrer?: PublicKey, currentSlot?: number, scopeRefresh?: ScopeRefresh, overrideElevationGroupRequest?: number | undefined): Promise<KaminoAction>;
|
|
62
62
|
getTokenIdsForScopeRefresh(kaminoMarket: KaminoMarket, reserves: PublicKey[]): number[];
|
|
63
63
|
addScopeRefreshIxs(tokens: number[], feed?: string): Promise<void>;
|
|
64
64
|
static buildBorrowTxns(kaminoMarket: KaminoMarket, amount: string | BN, mint: PublicKey, owner: PublicKey, obligation: KaminoObligation | ObligationType, useV2Ixs: boolean, extraComputeBudget?: number, // if > 0 then adds the ixn
|
|
65
65
|
includeAtaIxns?: boolean, // if true it includes create and close wsol and token atas,
|
|
66
66
|
requestElevationGroup?: boolean, includeUserMetadata?: boolean, // if true it includes user metadata
|
|
67
|
-
referrer?: PublicKey, currentSlot?: number, scopeRefresh?: ScopeRefresh, overrideElevationGroupRequest?: number | undefined): Promise<KaminoAction>;
|
|
67
|
+
createLookupTable?: boolean, referrer?: PublicKey, currentSlot?: number, scopeRefresh?: ScopeRefresh, overrideElevationGroupRequest?: number | undefined): Promise<KaminoAction>;
|
|
68
68
|
static buildDepositReserveLiquidityTxns(kaminoMarket: KaminoMarket, amount: string | BN, mint: PublicKey, owner: PublicKey, obligation: KaminoObligation | ObligationType, extraComputeBudget?: number, // if > 0 then adds the ixn
|
|
69
69
|
includeAtaIxns?: boolean, // if true it includes create and close wsol and token atas
|
|
70
|
-
requestElevationGroup?: boolean,
|
|
71
|
-
referrer?: PublicKey, currentSlot?: number, scopeRefresh?: ScopeRefresh): Promise<KaminoAction>;
|
|
70
|
+
requestElevationGroup?: boolean, referrer?: PublicKey, currentSlot?: number, scopeRefresh?: ScopeRefresh): Promise<KaminoAction>;
|
|
72
71
|
static buildRedeemReserveCollateralTxns(kaminoMarket: KaminoMarket, amount: string | BN, mint: PublicKey, owner: PublicKey, obligation: KaminoObligation | ObligationType, extraComputeBudget?: number, // if > 0 then adds the ixn
|
|
73
72
|
includeAtaIxns?: boolean, // if true it includes create and close wsol and token atas
|
|
74
|
-
requestElevationGroup?: boolean,
|
|
75
|
-
referrer?: PublicKey, currentSlot?: number, scopeRefresh?: ScopeRefresh): Promise<KaminoAction>;
|
|
73
|
+
requestElevationGroup?: boolean, referrer?: PublicKey, currentSlot?: number, scopeRefresh?: ScopeRefresh): Promise<KaminoAction>;
|
|
76
74
|
static buildDepositObligationCollateralTxns(kaminoMarket: KaminoMarket, amount: string | BN, mint: PublicKey, owner: PublicKey, obligation: KaminoObligation | ObligationType, useV2Ixs: boolean, extraComputeBudget?: number, // if > 0 then adds the ixn
|
|
77
75
|
includeAtaIxns?: boolean, // if true it includes create and close wsol and token atas
|
|
78
76
|
requestElevationGroup?: boolean, includeUserMetadata?: boolean, // if true it includes user metadata
|
|
79
|
-
referrer?: PublicKey, currentSlot?: number, scopeRefresh?: ScopeRefresh): Promise<KaminoAction>;
|
|
77
|
+
createLookupTable?: boolean, referrer?: PublicKey, currentSlot?: number, scopeRefresh?: ScopeRefresh): Promise<KaminoAction>;
|
|
80
78
|
static buildDepositAndBorrowTxns(kaminoMarket: KaminoMarket, depositAmount: string | BN, depositMint: PublicKey, borrowAmount: string | BN, borrowMint: PublicKey, payer: PublicKey, obligation: KaminoObligation | ObligationType, useV2Ixs: boolean, extraComputeBudget?: number, // if > 0 then adds the ixn
|
|
81
79
|
includeAtaIxns?: boolean, // if true it includes create and close wsol and token atas,
|
|
82
80
|
requestElevationGroup?: boolean, includeUserMetadata?: boolean, // if true it includes user metadata,
|
|
83
|
-
referrer?: PublicKey, currentSlot?: number, scopeRefresh?: ScopeRefresh): Promise<KaminoAction>;
|
|
81
|
+
createLookupTable?: boolean, referrer?: PublicKey, currentSlot?: number, scopeRefresh?: ScopeRefresh): Promise<KaminoAction>;
|
|
84
82
|
static buildRepayAndWithdrawTxns(kaminoMarket: KaminoMarket, repayAmount: string | BN, repayMint: PublicKey, withdrawAmount: string | BN, withdrawMint: PublicKey, payer: PublicKey, currentSlot: number, obligation: KaminoObligation | ObligationType, useV2Ixs: boolean, extraComputeBudget?: number, // if > 0 then adds the ixn
|
|
85
83
|
includeAtaIxns?: boolean, // if true it includes create and close wsol and token atas,
|
|
86
84
|
requestElevationGroup?: boolean, includeUserMetadata?: boolean, // if true it includes user metadata,
|
|
87
|
-
referrer?: PublicKey, scopeRefresh?: ScopeRefresh): Promise<KaminoAction>;
|
|
85
|
+
createLookupTable?: boolean, referrer?: PublicKey, scopeRefresh?: ScopeRefresh): Promise<KaminoAction>;
|
|
88
86
|
static buildWithdrawTxns(kaminoMarket: KaminoMarket, amount: string | BN, mint: PublicKey, owner: PublicKey, obligation: KaminoObligation | ObligationType, useV2Ixs: boolean, extraComputeBudget?: number, // if > 0 then adds the ixn
|
|
89
87
|
includeAtaIxns?: boolean, // if true it includes create and close wsol and token atas,
|
|
90
88
|
requestElevationGroup?: boolean, // to be requested *after* the withdraw
|
|
91
89
|
includeUserMetadata?: boolean, // if true it includes user metadata
|
|
92
|
-
referrer?: PublicKey, currentSlot?: number, scopeRefresh?: ScopeRefresh | undefined, overrideElevationGroupRequest?: number, obligationCustomizations?: {
|
|
90
|
+
createLookupTable?: boolean, referrer?: PublicKey, currentSlot?: number, scopeRefresh?: ScopeRefresh | undefined, overrideElevationGroupRequest?: number, obligationCustomizations?: {
|
|
93
91
|
addedDepositReserves?: PublicKey[];
|
|
94
92
|
}): Promise<KaminoAction>;
|
|
95
93
|
/**
|
|
@@ -107,11 +105,11 @@ export declare class KaminoAction {
|
|
|
107
105
|
* @param includeUserMetadata - if true it includes user metadata
|
|
108
106
|
* @param referrer
|
|
109
107
|
*/
|
|
110
|
-
static buildRepayTxns(kaminoMarket: KaminoMarket, amount: string | BN, mint: PublicKey, owner: PublicKey, obligation: KaminoObligation | ObligationType, useV2Ixs: boolean, currentSlot: number, payer?: PublicKey | undefined, extraComputeBudget?: number, includeAtaIxns?: boolean, requestElevationGroup?: boolean, includeUserMetadata?: boolean, referrer?: PublicKey, scopeRefresh?: ScopeRefresh): Promise<KaminoAction>;
|
|
108
|
+
static buildRepayTxns(kaminoMarket: KaminoMarket, amount: string | BN, mint: PublicKey, owner: PublicKey, obligation: KaminoObligation | ObligationType, useV2Ixs: boolean, currentSlot: number, payer?: PublicKey | undefined, extraComputeBudget?: number, includeAtaIxns?: boolean, requestElevationGroup?: boolean, includeUserMetadata?: boolean, createLookupTable?: boolean, referrer?: PublicKey, scopeRefresh?: ScopeRefresh): Promise<KaminoAction>;
|
|
111
109
|
static buildLiquidateTxns(kaminoMarket: KaminoMarket, amount: string | BN, minCollateralReceiveAmount: string | BN, repayTokenMint: PublicKey, withdrawTokenMint: PublicKey, liquidator: PublicKey, obligationOwner: PublicKey, obligation: KaminoObligation | ObligationType, useV2Ixs: boolean, extraComputeBudget?: number, // if > 0 then adds the ixn
|
|
112
110
|
includeAtaIxns?: boolean, // if true it includes create and close wsol and token atas, and creates all other token atas if they don't exist
|
|
113
111
|
requestElevationGroup?: boolean, includeUserMetadata?: boolean, // if true it includes user metadata
|
|
114
|
-
referrer?: PublicKey, maxAllowedLtvOverridePercent?: number, currentSlot?: number, scopeRefresh?: ScopeRefresh): Promise<KaminoAction>;
|
|
112
|
+
createLookupTable?: boolean, referrer?: PublicKey, maxAllowedLtvOverridePercent?: number, currentSlot?: number, scopeRefresh?: ScopeRefresh): Promise<KaminoAction>;
|
|
115
113
|
static buildWithdrawReferrerFeeTxns(owner: PublicKey, tokenMint: PublicKey, kaminoMarket: KaminoMarket, currentSlot?: number): Promise<KaminoAction>;
|
|
116
114
|
getTransactions(): Promise<{
|
|
117
115
|
preLendingTxn: Transaction | null;
|
|
@@ -130,20 +128,20 @@ export declare class KaminoAction {
|
|
|
130
128
|
addDepositObligationCollateralIxV2(): void;
|
|
131
129
|
addBorrowIx(): void;
|
|
132
130
|
addBorrowIxV2(): void;
|
|
133
|
-
addWithdrawIx(): Promise<void>;
|
|
134
|
-
addWithdrawIxV2(): Promise<void>;
|
|
131
|
+
addWithdrawIx(collateralAmount: BN): Promise<void>;
|
|
132
|
+
addWithdrawIxV2(collateralAmount: BN): Promise<void>;
|
|
135
133
|
addRepayIx(): Promise<void>;
|
|
136
134
|
addRepayIxV2(): Promise<void>;
|
|
137
135
|
addDepositAndBorrowIx(): Promise<void>;
|
|
138
136
|
addDepositAndBorrowIxV2(): Promise<void>;
|
|
139
|
-
addRepayAndWithdrawIxs(): Promise<void>;
|
|
140
|
-
addRepayAndWithdrawIxsV2(): Promise<void>;
|
|
137
|
+
addRepayAndWithdrawIxs(withdrawCollateralAmount: BN): Promise<void>;
|
|
138
|
+
addRepayAndWithdrawIxsV2(withdrawCollateralAmount: BN): Promise<void>;
|
|
141
139
|
addLiquidateIx(maxAllowedLtvOverridePercent?: number): Promise<void>;
|
|
142
140
|
addLiquidateIxV2(maxAllowedLtvOverridePercent?: number): Promise<void>;
|
|
143
141
|
addInBetweenIxs(action: ActionType, includeAtaIxns: boolean, requestElevationGroup: boolean, addInitObligationForFarm: boolean, useV2Ixs: boolean): Promise<void>;
|
|
144
142
|
addRefreshObligation(crank: PublicKey): void;
|
|
145
143
|
addSupportIxsWithoutInitObligation(action: ActionType, includeAtaIxns: boolean, useV2Ixs: boolean, addAsSupportIx?: AuxiliaryIx, requestElevationGroup?: boolean, addInitObligationForFarm?: boolean, twoTokenAction?: boolean, overrideElevationGroupRequest?: number): Promise<void>;
|
|
146
|
-
addSupportIxs(action: ActionType, includeAtaIxns: boolean, requestElevationGroup: boolean, includeUserMetadata: boolean, addInitObligationForFarm: boolean, useV2Ixs: boolean, twoTokenAction?: boolean, overrideElevationGroupRequest?: number): Promise<void>;
|
|
144
|
+
addSupportIxs(action: ActionType, includeAtaIxns: boolean, requestElevationGroup: boolean, includeUserMetadata: boolean, addInitObligationForFarm: boolean, useV2Ixs: boolean, createLookupTable: boolean, twoTokenAction?: boolean, overrideElevationGroupRequest?: number): Promise<void>;
|
|
147
145
|
private static optionalAccount;
|
|
148
146
|
private addRefreshReserveIxs;
|
|
149
147
|
static getRefreshAllReserves(kaminoMarket: KaminoMarket, reserves: PublicKey[]): TransactionInstruction[];
|
|
@@ -164,6 +162,7 @@ export declare class KaminoAction {
|
|
|
164
162
|
axn: KaminoAction;
|
|
165
163
|
createAtaIxs: TransactionInstruction[];
|
|
166
164
|
}>;
|
|
165
|
+
getWithdrawCollateralAmount(reserve: KaminoReserve, amount: BN): BN;
|
|
167
166
|
getObligationPda(): PublicKey;
|
|
168
167
|
getAdditionalDepositReservesList(): PublicKey[];
|
|
169
168
|
private static getReferrerKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/classes/action.ts"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143
143
|
...(action === 'deposit' ? [reserve] : []),
|
|
144
144
|
...(action === 'depositAndBorrow' ? [outflowReserve] : []),
|
|
145
145
|
]).toArray().length;
|
|
146
|
-
if (distinctReserveCount > utils_1.POSITION_LIMIT) {
|
|
147
|
-
throw Error(`Obligation already has max number of positions: ${utils_1.POSITION_LIMIT}`);
|
|
148
|
-
}
|
|
149
146
|
return {
|
|
150
147
|
kaminoObligation,
|
|
151
148
|
depositReserves,
|
|
@@ -187,7 +184,7 @@ class KaminoAction {
|
|
|
187
184
|
includeAtaIxns = true, // if true it includes create and close wsol and token atas,
|
|
188
185
|
requestElevationGroup = false, // to be requested *before* the deposit
|
|
189
186
|
includeUserMetadata = true, // if true it includes user metadata
|
|
190
|
-
referrer = web3_js_1.PublicKey.default, currentSlot = 0, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }, overrideElevationGroupRequest = undefined // if set, when an elevationgroup request is made, it will use this value
|
|
187
|
+
createLookupTable = true, referrer = web3_js_1.PublicKey.default, currentSlot = 0, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }, overrideElevationGroupRequest = undefined // if set, when an elevationgroup request is made, it will use this value
|
|
191
188
|
) {
|
|
192
189
|
const axn = await KaminoAction.initialize('deposit', amount, mint, owner, kaminoMarket, obligation, referrer, currentSlot);
|
|
193
190
|
const addInitObligationForFarm = true;
|
|
@@ -203,7 +200,7 @@ class KaminoAction {
|
|
|
203
200
|
if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
|
|
204
201
|
await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
|
|
205
202
|
}
|
|
206
|
-
await axn.addSupportIxs('deposit', includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarm, useV2Ixs, undefined, overrideElevationGroupRequest);
|
|
203
|
+
await axn.addSupportIxs('deposit', includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarm, useV2Ixs, createLookupTable, undefined, overrideElevationGroupRequest);
|
|
207
204
|
if (useV2Ixs) {
|
|
208
205
|
axn.addDepositIxV2();
|
|
209
206
|
}
|
|
@@ -244,7 +241,7 @@ class KaminoAction {
|
|
|
244
241
|
static async buildBorrowTxns(kaminoMarket, amount, mint, owner, obligation, useV2Ixs, extraComputeBudget = 1_000_000, // if > 0 then adds the ixn
|
|
245
242
|
includeAtaIxns = true, // if true it includes create and close wsol and token atas,
|
|
246
243
|
requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata
|
|
247
|
-
referrer = web3_js_1.PublicKey.default, currentSlot = 0, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }, overrideElevationGroupRequest = undefined // if set, when an elevationgroup request is made, it will use this value
|
|
244
|
+
createLookupTable = true, referrer = web3_js_1.PublicKey.default, currentSlot = 0, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }, overrideElevationGroupRequest = undefined // if set, when an elevationgroup request is made, it will use this value
|
|
248
245
|
) {
|
|
249
246
|
const axn = await KaminoAction.initialize('borrow', amount, mint, owner, kaminoMarket, obligation, referrer, currentSlot);
|
|
250
247
|
const addInitObligationForFarm = true;
|
|
@@ -260,7 +257,7 @@ class KaminoAction {
|
|
|
260
257
|
if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
|
|
261
258
|
await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
|
|
262
259
|
}
|
|
263
|
-
await axn.addSupportIxs('borrow', includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarm, useV2Ixs, undefined, overrideElevationGroupRequest);
|
|
260
|
+
await axn.addSupportIxs('borrow', includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarm, useV2Ixs, createLookupTable, undefined, overrideElevationGroupRequest);
|
|
264
261
|
if (useV2Ixs) {
|
|
265
262
|
axn.addBorrowIxV2();
|
|
266
263
|
}
|
|
@@ -272,8 +269,7 @@ class KaminoAction {
|
|
|
272
269
|
}
|
|
273
270
|
static async buildDepositReserveLiquidityTxns(kaminoMarket, amount, mint, owner, obligation, extraComputeBudget = 1_000_000, // if > 0 then adds the ixn
|
|
274
271
|
includeAtaIxns = true, // if true it includes create and close wsol and token atas
|
|
275
|
-
requestElevationGroup = false,
|
|
276
|
-
referrer = web3_js_1.PublicKey.default, currentSlot = 0, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }) {
|
|
272
|
+
requestElevationGroup = false, referrer = web3_js_1.PublicKey.default, currentSlot = 0, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }) {
|
|
277
273
|
const axn = await KaminoAction.initialize('mint', amount, mint, owner, kaminoMarket, obligation, referrer, currentSlot);
|
|
278
274
|
const addInitObligationForFarm = true;
|
|
279
275
|
if (extraComputeBudget > 0) {
|
|
@@ -288,15 +284,14 @@ class KaminoAction {
|
|
|
288
284
|
if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
|
|
289
285
|
await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
|
|
290
286
|
}
|
|
291
|
-
await axn.addSupportIxs('mint', includeAtaIxns, requestElevationGroup,
|
|
287
|
+
await axn.addSupportIxs('mint', includeAtaIxns, requestElevationGroup, false, addInitObligationForFarm, false, false);
|
|
292
288
|
axn.addDepositReserveLiquidityIx();
|
|
293
289
|
axn.addRefreshFarmsCleanupTxnIxsToCleanupIxs();
|
|
294
290
|
return axn;
|
|
295
291
|
}
|
|
296
292
|
static async buildRedeemReserveCollateralTxns(kaminoMarket, amount, mint, owner, obligation, extraComputeBudget = 1_000_000, // if > 0 then adds the ixn
|
|
297
293
|
includeAtaIxns = true, // if true it includes create and close wsol and token atas
|
|
298
|
-
requestElevationGroup = false,
|
|
299
|
-
referrer = web3_js_1.PublicKey.default, currentSlot = 0, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }) {
|
|
294
|
+
requestElevationGroup = false, referrer = web3_js_1.PublicKey.default, currentSlot = 0, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }) {
|
|
300
295
|
const axn = await KaminoAction.initialize('redeem', amount, mint, owner, kaminoMarket, obligation, referrer, currentSlot);
|
|
301
296
|
const addInitObligationForFarm = true;
|
|
302
297
|
if (extraComputeBudget > 0) {
|
|
@@ -311,7 +306,7 @@ class KaminoAction {
|
|
|
311
306
|
if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
|
|
312
307
|
await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
|
|
313
308
|
}
|
|
314
|
-
await axn.addSupportIxs('redeem', includeAtaIxns, requestElevationGroup,
|
|
309
|
+
await axn.addSupportIxs('redeem', includeAtaIxns, requestElevationGroup, false, addInitObligationForFarm, false, false);
|
|
315
310
|
axn.addRedeemReserveCollateralIx();
|
|
316
311
|
axn.addRefreshFarmsCleanupTxnIxsToCleanupIxs();
|
|
317
312
|
return axn;
|
|
@@ -319,7 +314,7 @@ class KaminoAction {
|
|
|
319
314
|
static async buildDepositObligationCollateralTxns(kaminoMarket, amount, mint, owner, obligation, useV2Ixs, extraComputeBudget = 1_000_000, // if > 0 then adds the ixn
|
|
320
315
|
includeAtaIxns = true, // if true it includes create and close wsol and token atas
|
|
321
316
|
requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata
|
|
322
|
-
referrer = web3_js_1.PublicKey.default, currentSlot = 0, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }) {
|
|
317
|
+
createLookupTable = true, referrer = web3_js_1.PublicKey.default, currentSlot = 0, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }) {
|
|
323
318
|
const axn = await KaminoAction.initialize('depositCollateral', amount, mint, owner, kaminoMarket, obligation, referrer, currentSlot);
|
|
324
319
|
const addInitObligationForFarm = true;
|
|
325
320
|
if (extraComputeBudget > 0) {
|
|
@@ -334,7 +329,7 @@ class KaminoAction {
|
|
|
334
329
|
if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
|
|
335
330
|
await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
|
|
336
331
|
}
|
|
337
|
-
await axn.addSupportIxs('depositCollateral', includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarm, useV2Ixs);
|
|
332
|
+
await axn.addSupportIxs('depositCollateral', includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarm, useV2Ixs, createLookupTable);
|
|
338
333
|
if (useV2Ixs) {
|
|
339
334
|
axn.addDepositObligationCollateralIxV2();
|
|
340
335
|
}
|
|
@@ -347,7 +342,7 @@ class KaminoAction {
|
|
|
347
342
|
static async buildDepositAndBorrowTxns(kaminoMarket, depositAmount, depositMint, borrowAmount, borrowMint, payer, obligation, useV2Ixs, extraComputeBudget = 1_000_000, // if > 0 then adds the ixn
|
|
348
343
|
includeAtaIxns = true, // if true it includes create and close wsol and token atas,
|
|
349
344
|
requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata,
|
|
350
|
-
referrer = web3_js_1.PublicKey.default, currentSlot = 0, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }) {
|
|
345
|
+
createLookupTable = true, referrer = web3_js_1.PublicKey.default, currentSlot = 0, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }) {
|
|
351
346
|
const axn = await KaminoAction.initializeMultiTokenAction(kaminoMarket, 'depositAndBorrow', depositAmount, depositMint, borrowMint, payer, payer, obligation, borrowAmount, referrer, currentSlot);
|
|
352
347
|
const addInitObligationForFarmForDeposit = true;
|
|
353
348
|
const addInitObligationForFarmForBorrow = false;
|
|
@@ -365,7 +360,7 @@ class KaminoAction {
|
|
|
365
360
|
if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
|
|
366
361
|
await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
|
|
367
362
|
}
|
|
368
|
-
await axn.addSupportIxs('deposit', includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarmForDeposit, useV2Ixs, twoTokenAction);
|
|
363
|
+
await axn.addSupportIxs('deposit', includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarmForDeposit, useV2Ixs, createLookupTable, twoTokenAction);
|
|
369
364
|
if (useV2Ixs) {
|
|
370
365
|
await axn.addDepositAndBorrowIxV2();
|
|
371
366
|
}
|
|
@@ -379,7 +374,7 @@ class KaminoAction {
|
|
|
379
374
|
static async buildRepayAndWithdrawTxns(kaminoMarket, repayAmount, repayMint, withdrawAmount, withdrawMint, payer, currentSlot, obligation, useV2Ixs, extraComputeBudget = 1_000_000, // if > 0 then adds the ixn
|
|
380
375
|
includeAtaIxns = true, // if true it includes create and close wsol and token atas,
|
|
381
376
|
requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata,
|
|
382
|
-
referrer = web3_js_1.PublicKey.default, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }) {
|
|
377
|
+
createLookupTable = true, referrer = web3_js_1.PublicKey.default, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }) {
|
|
383
378
|
const axn = await KaminoAction.initializeMultiTokenAction(kaminoMarket, 'repayAndWithdraw', repayAmount, repayMint, withdrawMint, payer, payer, obligation, withdrawAmount, referrer, currentSlot);
|
|
384
379
|
const addInitObligationForFarmForRepay = true;
|
|
385
380
|
const addInitObligationForFarmForWithdraw = false;
|
|
@@ -397,12 +392,13 @@ class KaminoAction {
|
|
|
397
392
|
if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
|
|
398
393
|
await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
|
|
399
394
|
}
|
|
400
|
-
await axn.addSupportIxs('repay', includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarmForRepay, useV2Ixs, twoTokenAction);
|
|
395
|
+
await axn.addSupportIxs('repay', includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarmForRepay, useV2Ixs, createLookupTable, twoTokenAction);
|
|
396
|
+
const withdrawCollateralAmount = axn.getWithdrawCollateralAmount(axn.outflowReserve, axn.outflowAmount);
|
|
401
397
|
if (useV2Ixs) {
|
|
402
|
-
await axn.addRepayAndWithdrawIxsV2();
|
|
398
|
+
await axn.addRepayAndWithdrawIxsV2(withdrawCollateralAmount);
|
|
403
399
|
}
|
|
404
400
|
else {
|
|
405
|
-
await axn.addRepayAndWithdrawIxs();
|
|
401
|
+
await axn.addRepayAndWithdrawIxs(withdrawCollateralAmount);
|
|
406
402
|
}
|
|
407
403
|
await axn.addInBetweenIxs('repayAndWithdraw', includeAtaIxns, requestElevationGroup, addInitObligationForFarmForWithdraw, useV2Ixs);
|
|
408
404
|
axn.addRefreshFarmsCleanupTxnIxsToCleanupIxs();
|
|
@@ -412,7 +408,7 @@ class KaminoAction {
|
|
|
412
408
|
includeAtaIxns = true, // if true it includes create and close wsol and token atas,
|
|
413
409
|
requestElevationGroup = false, // to be requested *after* the withdraw
|
|
414
410
|
includeUserMetadata = true, // if true it includes user metadata
|
|
415
|
-
referrer = web3_js_1.PublicKey.default, currentSlot = 0, scopeRefresh = undefined, overrideElevationGroupRequest,
|
|
411
|
+
createLookupTable = true, referrer = web3_js_1.PublicKey.default, currentSlot = 0, scopeRefresh = undefined, overrideElevationGroupRequest,
|
|
416
412
|
// Optional customizations which may be needed if the obligation was mutated by some previous ixn.
|
|
417
413
|
obligationCustomizations) {
|
|
418
414
|
const axn = await KaminoAction.initialize('withdraw', amount, mint, owner, kaminoMarket, obligation, referrer, currentSlot);
|
|
@@ -430,12 +426,13 @@ class KaminoAction {
|
|
|
430
426
|
if (tokenIds.length > 0 && scopeRefresh && scopeRefresh.includeScopeRefresh) {
|
|
431
427
|
await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
|
|
432
428
|
}
|
|
433
|
-
await axn.addSupportIxs('withdraw', includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarm, useV2Ixs, false, overrideElevationGroupRequest);
|
|
429
|
+
await axn.addSupportIxs('withdraw', includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarm, useV2Ixs, createLookupTable, false, overrideElevationGroupRequest);
|
|
430
|
+
const collateralAmount = axn.getWithdrawCollateralAmount(axn.reserve, axn.amount);
|
|
434
431
|
if (useV2Ixs) {
|
|
435
|
-
await axn.addWithdrawIxV2();
|
|
432
|
+
await axn.addWithdrawIxV2(collateralAmount);
|
|
436
433
|
}
|
|
437
434
|
else {
|
|
438
|
-
await axn.addWithdrawIx();
|
|
435
|
+
await axn.addWithdrawIx(collateralAmount);
|
|
439
436
|
}
|
|
440
437
|
axn.addRefreshFarmsCleanupTxnIxsToCleanupIxs();
|
|
441
438
|
return axn;
|
|
@@ -455,7 +452,7 @@ class KaminoAction {
|
|
|
455
452
|
* @param includeUserMetadata - if true it includes user metadata
|
|
456
453
|
* @param referrer
|
|
457
454
|
*/
|
|
458
|
-
static async buildRepayTxns(kaminoMarket, amount, mint, owner, obligation, useV2Ixs, currentSlot, payer = undefined, extraComputeBudget = 1_000_000, includeAtaIxns = true, requestElevationGroup = false, includeUserMetadata = true, referrer = web3_js_1.PublicKey.default, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }) {
|
|
455
|
+
static async buildRepayTxns(kaminoMarket, amount, mint, owner, obligation, useV2Ixs, currentSlot, payer = undefined, extraComputeBudget = 1_000_000, includeAtaIxns = true, requestElevationGroup = false, includeUserMetadata = true, createLookupTable = true, referrer = web3_js_1.PublicKey.default, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }) {
|
|
459
456
|
const axn = await KaminoAction.initialize('repay', amount, mint, owner, kaminoMarket, obligation, referrer, currentSlot, payer);
|
|
460
457
|
const addInitObligationForFarm = true;
|
|
461
458
|
if (extraComputeBudget > 0) {
|
|
@@ -470,7 +467,7 @@ class KaminoAction {
|
|
|
470
467
|
if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
|
|
471
468
|
await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
|
|
472
469
|
}
|
|
473
|
-
await axn.addSupportIxs('repay', includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarm, useV2Ixs);
|
|
470
|
+
await axn.addSupportIxs('repay', includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarm, useV2Ixs, createLookupTable);
|
|
474
471
|
if (useV2Ixs) {
|
|
475
472
|
await axn.addRepayIxV2();
|
|
476
473
|
}
|
|
@@ -483,7 +480,7 @@ class KaminoAction {
|
|
|
483
480
|
static async buildLiquidateTxns(kaminoMarket, amount, minCollateralReceiveAmount, repayTokenMint, withdrawTokenMint, liquidator, obligationOwner, obligation, useV2Ixs, extraComputeBudget = 1_000_000, // if > 0 then adds the ixn
|
|
484
481
|
includeAtaIxns = true, // if true it includes create and close wsol and token atas, and creates all other token atas if they don't exist
|
|
485
482
|
requestElevationGroup = false, includeUserMetadata = true, // if true it includes user metadata
|
|
486
|
-
referrer = web3_js_1.PublicKey.default, maxAllowedLtvOverridePercent = 0, currentSlot = 0, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }) {
|
|
483
|
+
createLookupTable = true, referrer = web3_js_1.PublicKey.default, maxAllowedLtvOverridePercent = 0, currentSlot = 0, scopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }) {
|
|
487
484
|
const axn = await KaminoAction.initializeMultiTokenAction(kaminoMarket, 'liquidate', amount, repayTokenMint, withdrawTokenMint, liquidator, obligationOwner, obligation, minCollateralReceiveAmount, referrer, currentSlot);
|
|
488
485
|
const addInitObligationForFarm = true;
|
|
489
486
|
if (extraComputeBudget > 0) {
|
|
@@ -499,7 +496,7 @@ class KaminoAction {
|
|
|
499
496
|
if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
|
|
500
497
|
await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
|
|
501
498
|
}
|
|
502
|
-
await axn.addSupportIxs('liquidate', includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarm, useV2Ixs);
|
|
499
|
+
await axn.addSupportIxs('liquidate', includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarm, useV2Ixs, createLookupTable);
|
|
503
500
|
if (useV2Ixs) {
|
|
504
501
|
await axn.addLiquidateIxV2(maxAllowedLtvOverridePercent);
|
|
505
502
|
}
|
|
@@ -785,11 +782,7 @@ class KaminoAction {
|
|
|
785
782
|
this.lendingIxs.push(borrowIx);
|
|
786
783
|
}
|
|
787
784
|
/// @deprecated -- use addWithdrawIxV2 instead
|
|
788
|
-
async addWithdrawIx() {
|
|
789
|
-
const collateralExchangeRate = this.reserve.getEstimatedCollateralExchangeRate(this.currentSlot, this.kaminoMarket.state.referralFeeBps);
|
|
790
|
-
const collateralAmount = this.amount.eq(new bn_js_1.default(utils_1.U64_MAX))
|
|
791
|
-
? this.amount
|
|
792
|
-
: new bn_js_1.default(new decimal_js_1.default(this.amount.toString()).mul(collateralExchangeRate).ceil().toString());
|
|
785
|
+
async addWithdrawIx(collateralAmount) {
|
|
793
786
|
this.lendingIxsLabels.push(`withdrawObligationCollateralAndRedeemReserveCollateral`);
|
|
794
787
|
this.lendingIxs.push((0, instructions_1.withdrawObligationCollateralAndRedeemReserveCollateral)({
|
|
795
788
|
collateralAmount,
|
|
@@ -810,12 +803,7 @@ class KaminoAction {
|
|
|
810
803
|
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
811
804
|
}, this.kaminoMarket.programId));
|
|
812
805
|
}
|
|
813
|
-
async addWithdrawIxV2() {
|
|
814
|
-
const collateralExchangeRate = this.reserve.getEstimatedCollateralExchangeRate(this.currentSlot, this.kaminoMarket.state.referralFeeBps);
|
|
815
|
-
// TODO: Move this side effect from here...
|
|
816
|
-
const collateralAmount = this.amount.eq(new bn_js_1.default(utils_1.U64_MAX))
|
|
817
|
-
? this.amount
|
|
818
|
-
: new bn_js_1.default(new decimal_js_1.default(this.amount.toString()).mul(collateralExchangeRate).ceil().toString());
|
|
806
|
+
async addWithdrawIxV2(collateralAmount) {
|
|
819
807
|
const farmsAccounts = this.reserve.state.farmCollateral.equals(web3_js_1.PublicKey.default)
|
|
820
808
|
? {
|
|
821
809
|
obligationFarmUserState: lib_1.PROGRAM_ID,
|
|
@@ -1048,7 +1036,7 @@ class KaminoAction {
|
|
|
1048
1036
|
borrowIx.keys = borrowIx.keys.concat([...depositReserveAccountMetas]);
|
|
1049
1037
|
this.lendingIxs.push(borrowIx);
|
|
1050
1038
|
}
|
|
1051
|
-
async addRepayAndWithdrawIxs() {
|
|
1039
|
+
async addRepayAndWithdrawIxs(withdrawCollateralAmount) {
|
|
1052
1040
|
this.lendingIxsLabels.push(`repayObligationLiquidity(reserve=${this.reserve.address})(obligation=${this.getObligationPda()})`);
|
|
1053
1041
|
this.lendingIxsLabels.push(`withdrawObligationCollateralAndRedeemReserveCollateral`);
|
|
1054
1042
|
const depositReservesList = this.getAdditionalDepositReservesList();
|
|
@@ -1079,11 +1067,8 @@ class KaminoAction {
|
|
|
1079
1067
|
if (!this.outflowAmount) {
|
|
1080
1068
|
throw new Error(`outflowAmount not set`);
|
|
1081
1069
|
}
|
|
1082
|
-
const collateralExchangeRate = this.outflowReserve.getEstimatedCollateralExchangeRate(this.currentSlot, this.kaminoMarket.state.referralFeeBps);
|
|
1083
1070
|
this.lendingIxs.push((0, instructions_1.withdrawObligationCollateralAndRedeemReserveCollateral)({
|
|
1084
|
-
collateralAmount:
|
|
1085
|
-
? this.outflowAmount
|
|
1086
|
-
: new bn_js_1.default(new decimal_js_1.default(this.outflowAmount.toString()).mul(collateralExchangeRate).ceil().toString()),
|
|
1071
|
+
collateralAmount: withdrawCollateralAmount,
|
|
1087
1072
|
}, {
|
|
1088
1073
|
owner: this.owner,
|
|
1089
1074
|
obligation: this.getObligationPda(),
|
|
@@ -1101,7 +1086,7 @@ class KaminoAction {
|
|
|
1101
1086
|
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
1102
1087
|
}, this.kaminoMarket.programId));
|
|
1103
1088
|
}
|
|
1104
|
-
async addRepayAndWithdrawIxsV2() {
|
|
1089
|
+
async addRepayAndWithdrawIxsV2(withdrawCollateralAmount) {
|
|
1105
1090
|
this.lendingIxsLabels.push(`repayObligationLiquidityV2(reserve=${this.reserve.address})(obligation=${this.getObligationPda()})`);
|
|
1106
1091
|
this.lendingIxsLabels.push(`withdrawObligationCollateralAndRedeemReserveCollateralV2`);
|
|
1107
1092
|
const depositReservesList = this.getAdditionalDepositReservesList();
|
|
@@ -1146,7 +1131,6 @@ class KaminoAction {
|
|
|
1146
1131
|
if (!this.outflowAmount) {
|
|
1147
1132
|
throw new Error(`outflowAmount not set`);
|
|
1148
1133
|
}
|
|
1149
|
-
const collateralExchangeRate = this.outflowReserve.getEstimatedCollateralExchangeRate(this.currentSlot, this.kaminoMarket.state.referralFeeBps);
|
|
1150
1134
|
const collateralFarmsAccounts = this.outflowReserve.state.farmCollateral.equals(web3_js_1.PublicKey.default)
|
|
1151
1135
|
? {
|
|
1152
1136
|
obligationFarmUserState: lib_1.PROGRAM_ID,
|
|
@@ -1157,9 +1141,7 @@ class KaminoAction {
|
|
|
1157
1141
|
reserveFarmState: this.outflowReserve.state.farmCollateral,
|
|
1158
1142
|
};
|
|
1159
1143
|
this.lendingIxs.push((0, instructions_1.withdrawObligationCollateralAndRedeemReserveCollateralV2)({
|
|
1160
|
-
collateralAmount:
|
|
1161
|
-
? this.outflowAmount
|
|
1162
|
-
: new bn_js_1.default(new decimal_js_1.default(this.outflowAmount.toString()).mul(collateralExchangeRate).ceil().toString()),
|
|
1144
|
+
collateralAmount: withdrawCollateralAmount,
|
|
1163
1145
|
}, {
|
|
1164
1146
|
withdrawAccounts: {
|
|
1165
1147
|
owner: this.owner,
|
|
@@ -1539,11 +1521,18 @@ class KaminoAction {
|
|
|
1539
1521
|
}
|
|
1540
1522
|
}
|
|
1541
1523
|
}
|
|
1542
|
-
async addSupportIxs(action, includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarm, useV2Ixs, twoTokenAction = false, overrideElevationGroupRequest) {
|
|
1524
|
+
async addSupportIxs(action, includeAtaIxns, requestElevationGroup, includeUserMetadata, addInitObligationForFarm, useV2Ixs, createLookupTable, twoTokenAction = false, overrideElevationGroupRequest) {
|
|
1543
1525
|
if (!['mint', 'redeem'].includes(action)) {
|
|
1544
1526
|
const [, ownerUserMetadata] = await this.kaminoMarket.getUserMetadata(this.owner);
|
|
1545
1527
|
if (!ownerUserMetadata && includeUserMetadata) {
|
|
1546
|
-
|
|
1528
|
+
let lookupTable = web3_js_1.PublicKey.default;
|
|
1529
|
+
if (createLookupTable) {
|
|
1530
|
+
const [createLutIx, lookupTableAddress] = await (0, utils_1.createLookupTableIx)(this.kaminoMarket.getConnection(), this.owner);
|
|
1531
|
+
lookupTable = lookupTableAddress;
|
|
1532
|
+
this.setupIxs.push(createLutIx);
|
|
1533
|
+
this.setupIxsLabels.push(`createUserLutIx[${lookupTableAddress.toString()}]`);
|
|
1534
|
+
}
|
|
1535
|
+
this.addInitUserMetadataIxs(lookupTable);
|
|
1547
1536
|
}
|
|
1548
1537
|
if (['borrow', 'withdrawReferrerFees'].includes(action)) {
|
|
1549
1538
|
await this.addInitReferrerTokenStateIx(this.reserve);
|
|
@@ -1829,10 +1818,7 @@ class KaminoAction {
|
|
|
1829
1818
|
this.setupIxsLabels.push(`InitObligation[${obligationPda.toString()}]`);
|
|
1830
1819
|
}
|
|
1831
1820
|
}
|
|
1832
|
-
|
|
1833
|
-
const [createLutIx, lookupTableAddress] = await (0, utils_1.createLookupTableIx)(this.kaminoMarket.getConnection(), this.owner);
|
|
1834
|
-
this.setupIxs.push(createLutIx);
|
|
1835
|
-
this.setupIxsLabels.push(`createUserLutIx[${lookupTableAddress.toString()}]`);
|
|
1821
|
+
addInitUserMetadataIxs(lookupTableAddress) {
|
|
1836
1822
|
const [userMetadataAddress, _bump] = (0, utils_1.userMetadataPda)(this.owner, this.kaminoMarket.programId);
|
|
1837
1823
|
const referrerUserMetadataAddress = this.referrer.equals(web3_js_1.PublicKey.default)
|
|
1838
1824
|
? this.kaminoMarket.programId
|
|
@@ -1891,48 +1877,29 @@ class KaminoAction {
|
|
|
1891
1877
|
this.computeBudgetIxsLabels.push(`AddComputeBudget[${units}]`);
|
|
1892
1878
|
}
|
|
1893
1879
|
async addAtaIxs(action) {
|
|
1894
|
-
if (this.mint.equals(
|
|
1880
|
+
if (this.mint.equals(spl_token_1.NATIVE_MINT) || this.secondaryMint?.equals(spl_token_1.NATIVE_MINT)) {
|
|
1895
1881
|
await this.updateWSOLAccount(action);
|
|
1896
1882
|
}
|
|
1897
|
-
if ((action === 'withdraw' || action === 'borrow' || action === 'redeem') && !this.mint.equals(
|
|
1883
|
+
if ((action === 'withdraw' || action === 'borrow' || action === 'redeem') && !this.mint.equals(spl_token_1.NATIVE_MINT)) {
|
|
1898
1884
|
const [, createUserTokenAccountIx] = (0, utils_1.createAssociatedTokenAccountIdempotentInstruction)(this.owner, this.reserve.getLiquidityMint(), this.owner, this.reserve.getLiquidityTokenProgram(), this.userTokenAccountAddress);
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
this.preTxnIxsLabels.push(`CreateLiquidityUserAta[${this.owner}]`);
|
|
1902
|
-
}
|
|
1903
|
-
else {
|
|
1904
|
-
this.setupIxs.unshift(createUserTokenAccountIx);
|
|
1905
|
-
this.setupIxsLabels.unshift(`CreateLiquidityUserAta[${this.owner}]`);
|
|
1906
|
-
}
|
|
1885
|
+
this.setupIxs.unshift(createUserTokenAccountIx);
|
|
1886
|
+
this.setupIxsLabels.unshift(`CreateLiquidityUserAta[${this.owner}]`);
|
|
1907
1887
|
}
|
|
1908
1888
|
if (action === 'liquidate') {
|
|
1909
1889
|
if (!this.outflowReserve) {
|
|
1910
1890
|
throw new Error(`Outflow reserve state not found ${this.mint}`);
|
|
1911
1891
|
}
|
|
1912
1892
|
const [, createUserTokenAccountIx] = (0, utils_1.createAssociatedTokenAccountIdempotentInstruction)(this.owner, this.outflowReserve.getLiquidityMint(), this.owner, this.outflowReserve.getLiquidityTokenProgram(), this.userTokenAccountAddress);
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
this.preTxnIxsLabels.push(`CreateUserAta[${this.userTokenAccountAddress.toBase58()}]`);
|
|
1916
|
-
}
|
|
1917
|
-
else {
|
|
1918
|
-
this.setupIxs.unshift(createUserTokenAccountIx);
|
|
1919
|
-
this.setupIxsLabels.unshift(`CreateUserAta[${this.userTokenAccountAddress.toBase58()}]`);
|
|
1920
|
-
}
|
|
1893
|
+
this.setupIxs.unshift(createUserTokenAccountIx);
|
|
1894
|
+
this.setupIxsLabels.unshift(`CreateUserAta[${this.userTokenAccountAddress.toBase58()}]`);
|
|
1921
1895
|
const [, createUserCollateralAccountIx] = (0, utils_1.createAssociatedTokenAccountIdempotentInstruction)(this.owner, this.outflowReserve.getCTokenMint(), this.owner, spl_token_1.TOKEN_PROGRAM_ID, this.userCollateralAccountAddress);
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
this.preTxnIxsLabels.push(`CreateCollateralUserAta[${this.userCollateralAccountAddress.toString()}]`);
|
|
1925
|
-
}
|
|
1926
|
-
else {
|
|
1927
|
-
this.setupIxs.unshift(createUserCollateralAccountIx);
|
|
1928
|
-
this.setupIxsLabels.unshift(`CreateCollateralUserAta[${this.userCollateralAccountAddress.toString()}]`);
|
|
1929
|
-
}
|
|
1896
|
+
this.setupIxs.unshift(createUserCollateralAccountIx);
|
|
1897
|
+
this.setupIxsLabels.unshift(`CreateCollateralUserAta[${this.userCollateralAccountAddress.toString()}]`);
|
|
1930
1898
|
if (!this.additionalTokenAccountAddress) {
|
|
1931
1899
|
throw new Error(`Additional token account address not found ${this.mint}`);
|
|
1932
1900
|
}
|
|
1933
1901
|
}
|
|
1934
|
-
if (action === 'depositAndBorrow' ||
|
|
1935
|
-
(action === 'repayAndWithdraw' && !this.secondaryMint?.equals(utils_1.WRAPPED_SOL_MINT))) {
|
|
1902
|
+
if (action === 'depositAndBorrow' || (action === 'repayAndWithdraw' && !this.secondaryMint?.equals(spl_token_1.NATIVE_MINT))) {
|
|
1936
1903
|
if (!this.additionalTokenAccountAddress) {
|
|
1937
1904
|
throw new Error(`Additional token account address not found ${this.secondaryMint}`);
|
|
1938
1905
|
}
|
|
@@ -1956,14 +1923,8 @@ class KaminoAction {
|
|
|
1956
1923
|
if (action === 'mint') {
|
|
1957
1924
|
const collateralMintPubkey = this.reserve.getCTokenMint();
|
|
1958
1925
|
const [, createUserCollateralAccountIx] = (0, utils_1.createAssociatedTokenAccountIdempotentInstruction)(this.owner, collateralMintPubkey, this.owner, spl_token_1.TOKEN_PROGRAM_ID, this.userCollateralAccountAddress);
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
this.preTxnIxsLabels.push(`CreateCollateralUserAta[${this.userCollateralAccountAddress.toString()}]`);
|
|
1962
|
-
}
|
|
1963
|
-
else {
|
|
1964
|
-
this.setupIxs.unshift(createUserCollateralAccountIx);
|
|
1965
|
-
this.setupIxsLabels.unshift(`CreateCollateralUserAta[${this.userCollateralAccountAddress.toString()}]`);
|
|
1966
|
-
}
|
|
1926
|
+
this.setupIxs.unshift(createUserCollateralAccountIx);
|
|
1927
|
+
this.setupIxsLabels.unshift(`CreateCollateralUserAta[${this.userCollateralAccountAddress.toString()}]`);
|
|
1967
1928
|
}
|
|
1968
1929
|
}
|
|
1969
1930
|
async updateWSOLAccount(action) {
|
|
@@ -1990,7 +1951,7 @@ class KaminoAction {
|
|
|
1990
1951
|
.toNumber()).toString());
|
|
1991
1952
|
}
|
|
1992
1953
|
let userTokenAccountAddress = this.userTokenAccountAddress;
|
|
1993
|
-
if (this.secondaryMint?.equals(
|
|
1954
|
+
if (this.secondaryMint?.equals(spl_token_1.NATIVE_MINT)) {
|
|
1994
1955
|
if (!this.additionalTokenAccountAddress) {
|
|
1995
1956
|
throw new Error(`Additional token account address not found ${this.secondaryMint}`);
|
|
1996
1957
|
}
|
|
@@ -2002,7 +1963,7 @@ class KaminoAction {
|
|
|
2002
1963
|
const sendAction = action === 'deposit' ||
|
|
2003
1964
|
action === 'repay' ||
|
|
2004
1965
|
action === 'mint' ||
|
|
2005
|
-
(action === 'liquidate' && this.secondaryMint?.equals(
|
|
1966
|
+
(action === 'liquidate' && this.secondaryMint?.equals(spl_token_1.NATIVE_MINT)); // only sync WSOL amount if liquidator repays SOL which is secondaryMint
|
|
2006
1967
|
const transferLamportsIx = web3_js_1.SystemProgram.transfer({
|
|
2007
1968
|
fromPubkey: this.owner,
|
|
2008
1969
|
toPubkey: userTokenAccountAddress,
|
|
@@ -2031,14 +1992,6 @@ class KaminoAction {
|
|
|
2031
1992
|
postIxs.push(closeWSOLAccountIx);
|
|
2032
1993
|
postIxsLabels.push(`CloseUserAtaSOL[${userTokenAccountAddress}]`);
|
|
2033
1994
|
}
|
|
2034
|
-
// TODO: Consider for liquidations and other types of actions if we have to split up some ixs in 2-3 txs
|
|
2035
|
-
// if (this.positions && this.positions >= POSITION_LIMIT) {
|
|
2036
|
-
// this.preTxnIxs.push(...preIxs);
|
|
2037
|
-
// this.preTxnIxsLabels.push(...preIxsLabels);
|
|
2038
|
-
// this.postTxnIxs.push(...postIxs);
|
|
2039
|
-
// this.postTxnIxsLabels.push(...postIxsLabels);
|
|
2040
|
-
// } else {
|
|
2041
|
-
// }
|
|
2042
1995
|
this.setupIxs.unshift(...preIxs);
|
|
2043
1996
|
this.setupIxsLabels.unshift(...preIxsLabels);
|
|
2044
1997
|
this.cleanupIxs.push(...postIxs);
|
|
@@ -2102,6 +2055,12 @@ class KaminoAction {
|
|
|
2102
2055
|
createAtaIxs: [createAtaIx],
|
|
2103
2056
|
};
|
|
2104
2057
|
}
|
|
2058
|
+
getWithdrawCollateralAmount(reserve, amount) {
|
|
2059
|
+
const collateralExchangeRate = reserve.getEstimatedCollateralExchangeRate(this.currentSlot, this.kaminoMarket.state.referralFeeBps);
|
|
2060
|
+
return amount.eq(new bn_js_1.default(utils_1.U64_MAX))
|
|
2061
|
+
? amount
|
|
2062
|
+
: new bn_js_1.default(new decimal_js_1.default(amount.toString()).mul(collateralExchangeRate).ceil().toString());
|
|
2063
|
+
}
|
|
2105
2064
|
getObligationPda() {
|
|
2106
2065
|
return this.obligation
|
|
2107
2066
|
? this.obligation.obligationAddress
|