@suilend/sdk 1.1.20 → 1.1.21
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/client.d.ts +1 -0
- package/client.js +21 -32
- package/package.json +1 -1
package/client.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export declare class SuilendClient {
|
|
|
51
51
|
depositIntoObligation(ownerId: string, coinType: string, value: string, transaction: Transaction, obligationOwnerCapId?: string): Promise<void>;
|
|
52
52
|
depositLiquidityAndGetCTokens(ownerId: string, coinType: string, value: string, transaction: Transaction): Promise<void>;
|
|
53
53
|
withdraw(obligationOwnerCapId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<import("@mysten/sui/transactions").TransactionResult>;
|
|
54
|
+
redeem(ctokens: TransactionObjectInput, coinType: string, exemption: TransactionObjectInput, transaction: Transaction): import("@mysten/sui/transactions").TransactionResult;
|
|
54
55
|
withdrawAndSendToUser(ownerId: string, obligationOwnerCapId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<void>;
|
|
55
56
|
borrow(obligationOwnerCapId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<import("@mysten/sui/transactions").TransactionResult>;
|
|
56
57
|
borrowAndSendToUser(ownerId: string, obligationOwnerCapId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<void>;
|
package/client.js
CHANGED
|
@@ -459,30 +459,29 @@ class SuilendClient {
|
|
|
459
459
|
],
|
|
460
460
|
arguments: [],
|
|
461
461
|
});
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
lendingMarket: transaction.object(this.lendingMarket.id),
|
|
476
|
-
suiReserveArrayIndex: transaction.pure.u64(this.findReserveArrayIndex(coinType)),
|
|
477
|
-
liquidityRequest,
|
|
478
|
-
systemState: transaction.object(utils_1.SUI_SYSTEM_STATE_OBJECT_ID),
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
return (0, functions_1.fulfillLiquidityRequest)(transaction, [this.lendingMarket.$typeArgs[0], coinType], {
|
|
462
|
+
return this.redeem(ctokens, coinType, exemption, transaction);
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
redeem(ctokens, coinType, exemption, transaction) {
|
|
466
|
+
const [liquidityRequest] = (0, functions_1.redeemCtokensAndWithdrawLiquidityRequest)(transaction, [this.lendingMarket.$typeArgs[0], coinType], {
|
|
467
|
+
lendingMarket: transaction.object(this.lendingMarket.id),
|
|
468
|
+
reserveArrayIndex: transaction.pure.u64(this.findReserveArrayIndex(coinType)),
|
|
469
|
+
clock: transaction.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
470
|
+
ctokens,
|
|
471
|
+
rateLimiterExemption: exemption,
|
|
472
|
+
});
|
|
473
|
+
if ((0, utils_1.normalizeStructTag)(coinType) == (0, utils_1.normalizeStructTag)("0x2::sui::SUI")) {
|
|
474
|
+
(0, functions_1.unstakeSuiFromStaker)(transaction, this.lendingMarket.$typeArgs[0], {
|
|
482
475
|
lendingMarket: transaction.object(this.lendingMarket.id),
|
|
483
|
-
|
|
476
|
+
suiReserveArrayIndex: transaction.pure.u64(this.findReserveArrayIndex(coinType)),
|
|
484
477
|
liquidityRequest,
|
|
478
|
+
systemState: transaction.object(utils_1.SUI_SYSTEM_STATE_OBJECT_ID),
|
|
485
479
|
});
|
|
480
|
+
}
|
|
481
|
+
return (0, functions_1.fulfillLiquidityRequest)(transaction, [this.lendingMarket.$typeArgs[0], coinType], {
|
|
482
|
+
lendingMarket: transaction.object(this.lendingMarket.id),
|
|
483
|
+
reserveArrayIndex: transaction.pure.u64(this.findReserveArrayIndex(coinType)),
|
|
484
|
+
liquidityRequest,
|
|
486
485
|
});
|
|
487
486
|
}
|
|
488
487
|
withdrawAndSendToUser(ownerId, obligationOwnerCapId, obligationId, coinType, value, transaction) {
|
|
@@ -561,17 +560,7 @@ class SuilendClient {
|
|
|
561
560
|
],
|
|
562
561
|
arguments: [exemption],
|
|
563
562
|
});
|
|
564
|
-
return
|
|
565
|
-
target: `${suilend_2.PUBLISHED_AT}::lending_market::redeem_ctokens_and_withdraw_liquidity`,
|
|
566
|
-
typeArguments: [this.lendingMarket.$typeArgs[0], withdrawCoinType],
|
|
567
|
-
arguments: [
|
|
568
|
-
transaction.object(this.lendingMarket.id),
|
|
569
|
-
transaction.pure.u64(this.findReserveArrayIndex(withdrawCoinType)),
|
|
570
|
-
transaction.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
571
|
-
ctokens,
|
|
572
|
-
optionalExemption,
|
|
573
|
-
],
|
|
574
|
-
});
|
|
563
|
+
return this.redeem(ctokens, withdrawCoinType, optionalExemption, transaction);
|
|
575
564
|
});
|
|
576
565
|
}
|
|
577
566
|
liquidate(transaction, obligation, repayCoinType, withdrawCoinType, repayCoinId) {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@suilend/sdk","version":"1.1.
|
|
1
|
+
{"name":"@suilend/sdk","version":"1.1.21","private":false,"description":"A TypeScript SDK for interacting with the Suilend program","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./client":"./client.js","./constants":"./constants.js","./types":"./types.js","./api/events":"./api/events.js","./api":"./api/index.js","./parsers/apiReserveAssetDataEvent":"./parsers/apiReserveAssetDataEvent.js","./parsers":"./parsers/index.js","./parsers/lendingMarket":"./parsers/lendingMarket.js","./parsers/obligation":"./parsers/obligation.js","./parsers/rateLimiter":"./parsers/rateLimiter.js","./parsers/reserve":"./parsers/reserve.js","./utils/events":"./utils/events.js","./utils":"./utils/index.js","./utils/obligation":"./utils/obligation.js","./utils/simulate":"./utils/simulate.js","./_generated/_framework/reified":"./_generated/_framework/reified.js","./_generated/_framework/util":"./_generated/_framework/util.js","./_generated/_framework/vector":"./_generated/_framework/vector.js","./_generated/suilend":"./_generated/suilend/index.js","./_generated/suilend/cell/structs":"./_generated/suilend/cell/structs.js","./_generated/suilend/decimal/structs":"./_generated/suilend/decimal/structs.js","./_generated/suilend/lending-market/functions":"./_generated/suilend/lending-market/functions.js","./_generated/suilend/lending-market/structs":"./_generated/suilend/lending-market/structs.js","./_generated/suilend/lending-market-registry/functions":"./_generated/suilend/lending-market-registry/functions.js","./_generated/suilend/liquidity-mining/structs":"./_generated/suilend/liquidity-mining/structs.js","./_generated/suilend/obligation/structs":"./_generated/suilend/obligation/structs.js","./_generated/suilend/rate-limiter/functions":"./_generated/suilend/rate-limiter/functions.js","./_generated/suilend/rate-limiter/structs":"./_generated/suilend/rate-limiter/structs.js","./_generated/suilend/reserve/structs":"./_generated/suilend/reserve/structs.js","./_generated/suilend/reserve-config/functions":"./_generated/suilend/reserve-config/functions.js","./_generated/suilend/reserve-config/structs":"./_generated/suilend/reserve-config/structs.js","./_generated/_dependencies/source/0x1":"./_generated/_dependencies/source/0x1/index.js","./_generated/_dependencies/source/0x2":"./_generated/_dependencies/source/0x2/index.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.js","./_generated/_dependencies/source/0x1/ascii/structs":"./_generated/_dependencies/source/0x1/ascii/structs.js","./_generated/_dependencies/source/0x1/option/structs":"./_generated/_dependencies/source/0x1/option/structs.js","./_generated/_dependencies/source/0x1/type-name/structs":"./_generated/_dependencies/source/0x1/type-name/structs.js","./_generated/_dependencies/source/0x2/bag/structs":"./_generated/_dependencies/source/0x2/bag/structs.js","./_generated/_dependencies/source/0x2/balance/structs":"./_generated/_dependencies/source/0x2/balance/structs.js","./_generated/_dependencies/source/0x2/object/structs":"./_generated/_dependencies/source/0x2/object/structs.js","./_generated/_dependencies/source/0x2/object-table/structs":"./_generated/_dependencies/source/0x2/object-table/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc","eslint":"eslint --fix \"./src/**/*.ts\"","prettier":"prettier --write \"./src/**/*\"","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ts-node ./release.ts && cd ./dist && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/solendprotocol/suilend-public.git"},"bugs":{"url":"https://github.com/solendprotocol/suilend-public/issues"},"dependencies":{"@mysten/bcs":"1.1.0","@mysten/sui":"1.14.3","@pythnetwork/pyth-sui-js":"^2.1.0","bignumber.js":"^9.1.2","p-limit":"3.1.0","uuid":"^11.0.3"},"devDependencies":{"ts-node":"^10.9.2"}}
|