@kamino-finance/klend-sdk 7.4.0-beta.6 → 7.4.0-beta.8
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 +4 -2
- package/dist/classes/action.d.ts.map +1 -1
- package/dist/classes/action.js +55 -2
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/actionTypes.d.ts +24 -0
- package/dist/classes/actionTypes.d.ts.map +1 -1
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/market.d.ts.map +1 -1
- package/dist/classes/market.js.map +1 -1
- package/dist/classes/obligation.d.ts +13 -3
- package/dist/classes/obligation.d.ts.map +1 -1
- package/dist/classes/obligation.js +9 -5
- package/dist/classes/obligation.js.map +1 -1
- package/dist/classes/reserve.d.ts +2 -0
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +17 -1
- package/dist/classes/reserve.js.map +1 -1
- package/dist/utils/seeds.d.ts.map +1 -1
- package/dist/utils/seeds.js +5 -1
- package/dist/utils/seeds.js.map +1 -1
- package/package.json +1 -1
- package/src/classes/action.ts +116 -4
- package/src/classes/actionTypes.ts +22 -0
- package/src/classes/manager.ts +6 -4
- package/src/classes/market.ts +4 -1
- package/src/classes/obligation.ts +26 -7
- package/src/classes/reserve.ts +23 -1
- package/src/utils/seeds.ts +5 -1
package/dist/classes/action.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ import { KaminoReserve } from './reserve';
|
|
|
7
7
|
import { ProgressCallbackType } from '../@codegen/klend/types';
|
|
8
8
|
import { Scope } from '@kamino-finance/scope-sdk';
|
|
9
9
|
import { ObligationOrderAtIndex } from './obligationOrder';
|
|
10
|
-
import { BuildDepositTxnsProps, BuildBorrowTxnsProps, BuildDepositReserveLiquidityTxnsProps, BuildRedeemReserveCollateralTxnsProps, BuildWithdrawTxnsProps, BuildRepayTxnsProps, BuildDepositAndBorrowTxnsProps, BuildRefreshObligationTxnsProps, BuildRequestElevationGroupTxnsProps, BuildDepositAndWithdrawV2TxnsProps, BuildRepayAndWithdrawTxnsProps, BuildRepayAndWithdrawV2TxnsProps, BuildLiquidateTxnsProps, BuildWithdrawReferrerFeeTxnsProps, BuildDepositObligationCollateralTxnsProps, InitializeActionProps } from './actionTypes';
|
|
11
|
-
export type ActionType = 'deposit' | 'borrow' | 'withdraw' | 'repay' | 'mint' | 'redeem' | 'depositCollateral' | 'liquidate' | 'depositAndBorrow' | 'repayAndWithdraw' | 'refreshObligation' | 'requestElevationGroup' | 'withdrawReferrerFees' | 'repayAndWithdrawV2' | 'depositAndWithdraw';
|
|
10
|
+
import { BuildDepositTxnsProps, BuildBorrowTxnsProps, BuildDepositReserveLiquidityTxnsProps, BuildRedeemReserveCollateralTxnsProps, BuildWithdrawTxnsProps, BuildWithdrawFromObligationAndEnqueueTxnsProps, BuildRepayTxnsProps, BuildDepositAndBorrowTxnsProps, BuildRefreshObligationTxnsProps, BuildRequestElevationGroupTxnsProps, BuildDepositAndWithdrawV2TxnsProps, BuildRepayAndWithdrawTxnsProps, BuildRepayAndWithdrawV2TxnsProps, BuildLiquidateTxnsProps, BuildWithdrawReferrerFeeTxnsProps, BuildDepositObligationCollateralTxnsProps, InitializeActionProps } from './actionTypes';
|
|
11
|
+
export type ActionType = 'deposit' | 'borrow' | 'withdraw' | 'repay' | 'mint' | 'redeem' | 'depositCollateral' | 'liquidate' | 'depositAndBorrow' | 'repayAndWithdraw' | 'refreshObligation' | 'requestElevationGroup' | 'withdrawReferrerFees' | 'repayAndWithdrawV2' | 'depositAndWithdraw' | 'withdrawAndEnqueue';
|
|
12
12
|
export type AuxiliaryIx = 'setup' | 'inBetween' | 'cleanup';
|
|
13
13
|
export declare class KaminoAction {
|
|
14
14
|
kaminoMarket: KaminoMarket;
|
|
@@ -60,6 +60,7 @@ export declare class KaminoAction {
|
|
|
60
60
|
static buildRepayAndWithdrawV2Txns(props: BuildRepayAndWithdrawV2TxnsProps): Promise<KaminoAction>;
|
|
61
61
|
static buildRepayAndWithdrawTxns(props: BuildRepayAndWithdrawTxnsProps): Promise<KaminoAction>;
|
|
62
62
|
static buildWithdrawTxns(props: BuildWithdrawTxnsProps): Promise<KaminoAction>;
|
|
63
|
+
static buildWithdrawFromObligationAndEnqueueTxns(props: BuildWithdrawFromObligationAndEnqueueTxnsProps): Promise<KaminoAction>;
|
|
63
64
|
/**
|
|
64
65
|
* Build repay transactions
|
|
65
66
|
* @param props - BuildRepayTxnsProps containing all required and optional parameters
|
|
@@ -95,6 +96,7 @@ export declare class KaminoAction {
|
|
|
95
96
|
private addBorrowRolloverConfigIxs;
|
|
96
97
|
addWithdrawIx(collateralAmount: BN): Promise<void>;
|
|
97
98
|
addWithdrawIxV2(collateralAmount: BN): Promise<void>;
|
|
99
|
+
addWithdrawObligationCollateralIxV2(collateralAmount: BN): Promise<void>;
|
|
98
100
|
addRepayIx(): Promise<void>;
|
|
99
101
|
addRepayIxV2(): Promise<void>;
|
|
100
102
|
addRepayAndWithdrawV2Ixs(withdrawCollateralAmount: BN): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/classes/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,EAEP,WAAW,EACX,WAAW,EAIX,MAAM,EACN,IAAI,EAEJ,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,OAAO,CAAC;AAyCvB,OAAO,EASL,cAAc,EAGd,uBAAuB,EAMxB,MAAM,UAAU,CAAC;AAElB,OAAO,EAA8B,YAAY,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,EAAsB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAA+C,MAAM,yBAAyB,CAAC;AAI5G,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2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C,WAAW,CAAC;WAW5D,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC;WAOrD,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC;mBAWrD,yBAAyB;mBA+CzB,cAAc;mBAsBd,gCAAgC;CAUtD"}
|
package/dist/classes/action.js
CHANGED
|
@@ -458,6 +458,30 @@ class KaminoAction {
|
|
|
458
458
|
axn.addRefreshFarmsCleanupTxnIxsToCleanupIxs();
|
|
459
459
|
return axn;
|
|
460
460
|
}
|
|
461
|
+
static async buildWithdrawFromObligationAndEnqueueTxns(props) {
|
|
462
|
+
const { kaminoMarket, collateralAmount, reserveAddress, owner, obligation, scopeRefreshConfig, extraComputeBudget = 1_000_000, includeAtaIxs = true, requestElevationGroup = false, initUserMetadata = { skipInitialization: false, skipLutCreation: false }, referrer = (0, kit_1.none)(), currentSlot = 0n, userDestinationLiquidityAta, progressCallbackType = new types_1.ProgressCallbackType.None(), progressCallbackCustomAccount0 = (0, kit_1.none)(), progressCallbackCustomAccount1 = (0, kit_1.none)(), } = props;
|
|
463
|
+
const axn = await KaminoAction.initialize({
|
|
464
|
+
kaminoMarket,
|
|
465
|
+
action: 'withdrawAndEnqueue',
|
|
466
|
+
amount: collateralAmount,
|
|
467
|
+
reserveAddress,
|
|
468
|
+
owner,
|
|
469
|
+
obligation,
|
|
470
|
+
referrer,
|
|
471
|
+
currentSlot,
|
|
472
|
+
});
|
|
473
|
+
if (extraComputeBudget > 0) {
|
|
474
|
+
axn.addComputeBudgetIx(extraComputeBudget);
|
|
475
|
+
}
|
|
476
|
+
await axn.addSupportIxs('withdrawAndEnqueue', includeAtaIxs, requestElevationGroup, true, true, scopeRefreshConfig, initUserMetadata);
|
|
477
|
+
await axn.addWithdrawObligationCollateralIxV2(axn.amount);
|
|
478
|
+
const destinationLiquidityAta = userDestinationLiquidityAta ?? (await axn.getUserTokenAccountAddress(axn.reserve));
|
|
479
|
+
const enqueueIx = await KaminoAction.buildEnqueueToWithdrawIx(owner, kaminoMarket, axn.reserve, axn.amount, destinationLiquidityAta, progressCallbackType, progressCallbackCustomAccount0, progressCallbackCustomAccount1);
|
|
480
|
+
axn.lendingIxs.push(enqueueIx);
|
|
481
|
+
axn.lendingIxsLabels.push(`enqueueToWithdraw`);
|
|
482
|
+
axn.addRefreshFarmsCleanupTxnIxsToCleanupIxs();
|
|
483
|
+
return axn;
|
|
484
|
+
}
|
|
461
485
|
/**
|
|
462
486
|
* Build repay transactions
|
|
463
487
|
* @param props - BuildRepayTxnsProps containing all required and optional parameters
|
|
@@ -886,6 +910,28 @@ class KaminoAction {
|
|
|
886
910
|
farmsProgram: programId_1.PROGRAM_ID,
|
|
887
911
|
}, undefined, this.kaminoMarket.programId));
|
|
888
912
|
}
|
|
913
|
+
async addWithdrawObligationCollateralIxV2(collateralAmount) {
|
|
914
|
+
const obligationAddress = await this.getObligationPda();
|
|
915
|
+
const { collateralFarmAccounts: farmsAccounts } = await KaminoAction.getFarmAccountsForReserve(obligationAddress, this.reserve);
|
|
916
|
+
this.lendingIxsLabels.push(`withdrawObligationCollateralV2`);
|
|
917
|
+
this.lendingIxs.push((0, instructions_1.withdrawObligationCollateralV2)({
|
|
918
|
+
collateralAmount,
|
|
919
|
+
}, {
|
|
920
|
+
withdrawAccounts: {
|
|
921
|
+
owner: this.owner,
|
|
922
|
+
obligation: obligationAddress,
|
|
923
|
+
lendingMarket: this.kaminoMarket.getAddress(),
|
|
924
|
+
lendingMarketAuthority: await this.kaminoMarket.getLendingMarketAuthority(),
|
|
925
|
+
withdrawReserve: this.reserve.address,
|
|
926
|
+
reserveSourceCollateral: this.reserve.state.collateral.supplyVault,
|
|
927
|
+
userDestinationCollateral: await this.getUserCollateralAccountAddress(this.reserve),
|
|
928
|
+
tokenProgram: token_1.TOKEN_PROGRAM_ADDRESS,
|
|
929
|
+
instructionSysvarAccount: sysvars_1.SYSVAR_INSTRUCTIONS_ADDRESS,
|
|
930
|
+
},
|
|
931
|
+
farmsAccounts,
|
|
932
|
+
farmsProgram: programId_1.PROGRAM_ID,
|
|
933
|
+
}, undefined, this.kaminoMarket.programId));
|
|
934
|
+
}
|
|
889
935
|
/// @deprecated -- use addRepayIxV2 instead
|
|
890
936
|
async addRepayIx() {
|
|
891
937
|
const obligationAddress = await this.getObligationPda();
|
|
@@ -1439,6 +1485,7 @@ class KaminoAction {
|
|
|
1439
1485
|
'depositCollateral',
|
|
1440
1486
|
'deposit',
|
|
1441
1487
|
'withdraw',
|
|
1488
|
+
'withdrawAndEnqueue',
|
|
1442
1489
|
'borrow',
|
|
1443
1490
|
'liquidate',
|
|
1444
1491
|
'repay',
|
|
@@ -1506,6 +1553,7 @@ class KaminoAction {
|
|
|
1506
1553
|
else if (action === 'depositAndBorrow' ||
|
|
1507
1554
|
action === 'depositCollateral' ||
|
|
1508
1555
|
action === 'withdraw' ||
|
|
1556
|
+
action === 'withdrawAndEnqueue' ||
|
|
1509
1557
|
action === 'deposit' ||
|
|
1510
1558
|
action === 'depositAndWithdraw') {
|
|
1511
1559
|
await this.addInitObligationForFarm(this.reserve, types_1.ReserveFarmKind.Collateral, addAsSupportIx);
|
|
@@ -1656,6 +1704,7 @@ class KaminoAction {
|
|
|
1656
1704
|
else if (action === 'depositAndBorrow' ||
|
|
1657
1705
|
action === 'depositCollateral' ||
|
|
1658
1706
|
action === 'withdraw' ||
|
|
1707
|
+
action === 'withdrawAndEnqueue' ||
|
|
1659
1708
|
action === 'deposit') {
|
|
1660
1709
|
await this.addRefreshFarmsForReserve(currentReserves, addAsSupportIx, types_1.ReserveFarmKind.Collateral, undefined, twoTokenAction);
|
|
1661
1710
|
}
|
|
@@ -2050,7 +2099,11 @@ class KaminoAction {
|
|
|
2050
2099
|
if (this.mint === utils_1.WRAPPED_SOL_MINT || this.secondaryMint === utils_1.WRAPPED_SOL_MINT) {
|
|
2051
2100
|
await this.updateWSOLAccount(action);
|
|
2052
2101
|
}
|
|
2053
|
-
if ((action === 'withdraw' ||
|
|
2102
|
+
if ((action === 'withdraw' ||
|
|
2103
|
+
action === 'withdrawAndEnqueue' ||
|
|
2104
|
+
action === 'borrow' ||
|
|
2105
|
+
action === 'redeem') &&
|
|
2106
|
+
this.mint !== utils_1.WRAPPED_SOL_MINT) {
|
|
2054
2107
|
const reserveAta = await this.getUserTokenAccountAddress(this.reserve);
|
|
2055
2108
|
const [, createUserTokenAccountIx] = await (0, utils_1.createAssociatedTokenAccountIdempotentInstruction)(this.owner, this.reserve.getLiquidityMint(), this.owner.address, this.reserve.getLiquidityTokenProgram(), reserveAta);
|
|
2056
2109
|
this.setupIxs.unshift(createUserTokenAccountIx);
|
|
@@ -2087,7 +2140,7 @@ class KaminoAction {
|
|
|
2087
2140
|
this.setupIxs.unshift(createUserTokenAccountIx);
|
|
2088
2141
|
this.setupIxsLabels.unshift(`CreateUserAta[${reserveAta}]`);
|
|
2089
2142
|
}
|
|
2090
|
-
if (action === 'mint') {
|
|
2143
|
+
if (action === 'mint' || action === 'withdrawAndEnqueue') {
|
|
2091
2144
|
const ctokenAta = await this.getUserCollateralAccountAddress(this.reserve);
|
|
2092
2145
|
const [, createUserCollateralAccountIx] = await (0, utils_1.createAssociatedTokenAccountIdempotentInstruction)(this.owner, this.reserve.getCTokenMint(), this.owner.address, token_1.TOKEN_PROGRAM_ADDRESS, ctokenAta);
|
|
2093
2146
|
this.setupIxs.unshift(createUserCollateralAccountIx);
|