@suilend/sdk 1.1.84 → 1.1.85
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.js
CHANGED
|
@@ -638,8 +638,7 @@ class SuilendClient {
|
|
|
638
638
|
for (const ctokenCoinType of ctokenCoinTypes) {
|
|
639
639
|
const coins = yield (0, sui_fe_1.getAllCoins)(this.client, ownerId, ctokenCoinType);
|
|
640
640
|
const mergeCoin = (0, sui_fe_1.mergeAllCoins)(ctokenCoinType, transaction, coins);
|
|
641
|
-
|
|
642
|
-
mergeCoinMap[ctokenCoinType] = mergeCoin;
|
|
641
|
+
mergeCoinMap[ctokenCoinType] = mergeCoin;
|
|
643
642
|
}
|
|
644
643
|
for (const [ctokenCoinType, mergeCoin] of Object.entries(mergeCoinMap)) {
|
|
645
644
|
const coinType = (0, sui_fe_1.extractCTokenCoinType)(ctokenCoinType);
|
package/lib/initialize.js
CHANGED
|
@@ -92,12 +92,10 @@ exports.RESERVES_CUSTOM_ORDER = [
|
|
|
92
92
|
sui_fe_1.NORMALIZED_NS_COINTYPE,
|
|
93
93
|
sui_fe_1.NORMALIZED_UP_COINTYPE,
|
|
94
94
|
sui_fe_1.NORMALIZED_DMC_COINTYPE,
|
|
95
|
-
sui_fe_1.NORMALIZED_STRAT_COINTYPE,
|
|
96
95
|
sui_fe_1.NORMALIZED_ALKIMI_COINTYPE,
|
|
97
96
|
sui_fe_1.NORMALIZED_KOBAN_COINTYPE,
|
|
98
97
|
sui_fe_1.NORMALIZED_mUSD_COINTYPE,
|
|
99
98
|
sui_fe_1.NORMALIZED_BUCK_COINTYPE,
|
|
100
|
-
// ISOLATED ASSETS - Memecoins
|
|
101
99
|
sui_fe_1.NORMALIZED_HIPPO_COINTYPE,
|
|
102
100
|
sui_fe_1.NORMALIZED_FUD_COINTYPE,
|
|
103
101
|
];
|
|
@@ -10,7 +10,8 @@ export declare enum StrategyType {
|
|
|
10
10
|
USDC_sSUI_SUI_LOOPING = "3",
|
|
11
11
|
AUSD_sSUI_SUI_LOOPING = "4",
|
|
12
12
|
xBTC_sSUI_SUI_LOOPING = "100",// Used to be for Slush Strategies #0
|
|
13
|
-
xBTC_wBTC_LOOPING = "101"
|
|
13
|
+
xBTC_wBTC_LOOPING = "101",// Used to be for Slush Strategies #1
|
|
14
|
+
suiUSDT_sSUI_SUI_LOOPING = "5"
|
|
14
15
|
}
|
|
15
16
|
export declare const STRATEGY_TYPE_INFO_MAP: Record<StrategyType, {
|
|
16
17
|
queryParam: string;
|
package/lib/strategyOwnerCap.js
CHANGED
|
@@ -20,7 +20,7 @@ const sui_fe_1 = require("@suilend/sui-fe");
|
|
|
20
20
|
const client_1 = require("../client");
|
|
21
21
|
const types_1 = require("./types");
|
|
22
22
|
exports.STRATEGY_WRAPPER_PACKAGE_ID_V1 = "0xba97dc73a07638d03d77ad2161484eb21db577edc9cadcd7035fef4b4f2f6fa1";
|
|
23
|
-
const
|
|
23
|
+
const STRATEGY_WRAPPER_PACKAGE_ID_V7 = "0x864b66441e95323c320ee7584592769930a2d236b45d731011ee7a98eb785b35";
|
|
24
24
|
var StrategyType;
|
|
25
25
|
(function (StrategyType) {
|
|
26
26
|
StrategyType["sSUI_SUI_LOOPING"] = "1";
|
|
@@ -29,6 +29,7 @@ var StrategyType;
|
|
|
29
29
|
StrategyType["AUSD_sSUI_SUI_LOOPING"] = "4";
|
|
30
30
|
StrategyType["xBTC_sSUI_SUI_LOOPING"] = "100";
|
|
31
31
|
StrategyType["xBTC_wBTC_LOOPING"] = "101";
|
|
32
|
+
StrategyType["suiUSDT_sSUI_SUI_LOOPING"] = "5";
|
|
32
33
|
})(StrategyType || (exports.StrategyType = StrategyType = {}));
|
|
33
34
|
exports.STRATEGY_TYPE_INFO_MAP = {
|
|
34
35
|
[StrategyType.sSUI_SUI_LOOPING]: {
|
|
@@ -115,9 +116,23 @@ exports.STRATEGY_TYPE_INFO_MAP = {
|
|
|
115
116
|
currencyCoinTypes: [sui_fe_1.NORMALIZED_xBTC_COINTYPE, sui_fe_1.NORMALIZED_wBTC_COINTYPE],
|
|
116
117
|
defaultCurrencyCoinType: sui_fe_1.NORMALIZED_xBTC_COINTYPE,
|
|
117
118
|
},
|
|
119
|
+
[StrategyType.suiUSDT_sSUI_SUI_LOOPING]: {
|
|
120
|
+
queryParam: "suiUSDT-sSUI-SUI-looping",
|
|
121
|
+
header: {
|
|
122
|
+
coinTypes: [sui_fe_1.NORMALIZED_suiUSDT_COINTYPE],
|
|
123
|
+
title: "suiUSDT sSUI/SUI",
|
|
124
|
+
tooltip: "Sets up a suiUSDT sSUI/SUI Looping strategy by depositing suiUSDT and looping sSUI/SUI to the desired leverage",
|
|
125
|
+
type: "Looping",
|
|
126
|
+
},
|
|
127
|
+
depositBaseCoinType: sui_fe_1.NORMALIZED_suiUSDT_COINTYPE,
|
|
128
|
+
depositLstCoinType: sui_fe_1.NORMALIZED_sSUI_COINTYPE,
|
|
129
|
+
borrowCoinType: sui_fe_1.NORMALIZED_SUI_COINTYPE,
|
|
130
|
+
currencyCoinTypes: [sui_fe_1.NORMALIZED_suiUSDT_COINTYPE],
|
|
131
|
+
defaultCurrencyCoinType: sui_fe_1.NORMALIZED_suiUSDT_COINTYPE,
|
|
132
|
+
},
|
|
118
133
|
};
|
|
119
134
|
const strategyDeposit = (coin, coinType, strategyOwnerCap, reserveArrayIndex, transaction) => transaction.moveCall({
|
|
120
|
-
target: `${
|
|
135
|
+
target: `${STRATEGY_WRAPPER_PACKAGE_ID_V7}::strategy_wrapper::deposit_liquidity_and_deposit_into_obligation`,
|
|
121
136
|
typeArguments: [client_1.LENDING_MARKET_TYPE, coinType],
|
|
122
137
|
arguments: [
|
|
123
138
|
transaction.object(strategyOwnerCap),
|
|
@@ -130,7 +145,7 @@ const strategyDeposit = (coin, coinType, strategyOwnerCap, reserveArrayIndex, tr
|
|
|
130
145
|
exports.strategyDeposit = strategyDeposit;
|
|
131
146
|
const strategyBorrow = (coinType, strategyOwnerCap, reserveArrayIndex, value, transaction) => (0, sui_fe_1.isSui)(coinType)
|
|
132
147
|
? transaction.moveCall({
|
|
133
|
-
target: `${
|
|
148
|
+
target: `${STRATEGY_WRAPPER_PACKAGE_ID_V7}::strategy_wrapper::borrow_sui_from_obligation`,
|
|
134
149
|
typeArguments: [client_1.LENDING_MARKET_TYPE],
|
|
135
150
|
arguments: [
|
|
136
151
|
transaction.object(strategyOwnerCap),
|
|
@@ -142,7 +157,7 @@ const strategyBorrow = (coinType, strategyOwnerCap, reserveArrayIndex, value, tr
|
|
|
142
157
|
],
|
|
143
158
|
})
|
|
144
159
|
: transaction.moveCall({
|
|
145
|
-
target: `${
|
|
160
|
+
target: `${STRATEGY_WRAPPER_PACKAGE_ID_V7}::strategy_wrapper::borrow_from_obligation`,
|
|
146
161
|
typeArguments: [client_1.LENDING_MARKET_TYPE, coinType],
|
|
147
162
|
arguments: [
|
|
148
163
|
transaction.object(strategyOwnerCap),
|
|
@@ -154,7 +169,7 @@ const strategyBorrow = (coinType, strategyOwnerCap, reserveArrayIndex, value, tr
|
|
|
154
169
|
});
|
|
155
170
|
exports.strategyBorrow = strategyBorrow;
|
|
156
171
|
const strategyWithdraw = (coinType, strategyOwnerCap, reserveArrayIndex, value, transaction) => transaction.moveCall({
|
|
157
|
-
target: `${
|
|
172
|
+
target: `${STRATEGY_WRAPPER_PACKAGE_ID_V7}::strategy_wrapper::withdraw_from_obligation_and_redeem`,
|
|
158
173
|
typeArguments: [client_1.LENDING_MARKET_TYPE, coinType],
|
|
159
174
|
arguments: [
|
|
160
175
|
transaction.object(strategyOwnerCap),
|
|
@@ -166,7 +181,7 @@ const strategyWithdraw = (coinType, strategyOwnerCap, reserveArrayIndex, value,
|
|
|
166
181
|
});
|
|
167
182
|
exports.strategyWithdraw = strategyWithdraw;
|
|
168
183
|
const strategyClaimRewards = (coinType, strategyOwnerCap, reserveArrayIndex, rewardIndex, side, transaction) => transaction.moveCall({
|
|
169
|
-
target: `${
|
|
184
|
+
target: `${STRATEGY_WRAPPER_PACKAGE_ID_V7}::strategy_wrapper::claim_rewards`,
|
|
170
185
|
typeArguments: [client_1.LENDING_MARKET_TYPE, coinType],
|
|
171
186
|
arguments: [
|
|
172
187
|
transaction.object(strategyOwnerCap),
|
|
@@ -361,7 +376,7 @@ const createStrategyOwnerCapIfNoneExists = (strategyType, strategyOwnerCap, tran
|
|
|
361
376
|
strategyOwnerCapId = strategyOwnerCap.id;
|
|
362
377
|
else {
|
|
363
378
|
strategyOwnerCapId = transaction.moveCall({
|
|
364
|
-
target: `${
|
|
379
|
+
target: `${STRATEGY_WRAPPER_PACKAGE_ID_V7}::strategy_wrapper::create_strategy_owner_cap`,
|
|
365
380
|
typeArguments: [client_1.LENDING_MARKET_TYPE],
|
|
366
381
|
arguments: [
|
|
367
382
|
transaction.object(client_1.LENDING_MARKET_ID),
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@suilend/sdk","version":"1.1.
|
|
1
|
+
{"name":"@suilend/sdk","version":"1.1.85","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","./strategies":"./strategies.js","./api/events":"./api/events.js","./api":"./api/index.js","./lib/constants":"./lib/constants.js","./lib":"./lib/index.js","./lib/initialize":"./lib/initialize.js","./lib/liquidityMining":"./lib/liquidityMining.js","./lib/strategyOwnerCap":"./lib/strategyOwnerCap.js","./lib/transactions":"./lib/transactions.js","./lib/types":"./lib/types.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","./swap":"./swap/index.js","./swap/quote":"./swap/quote.js","./swap/transaction":"./swap/transaction.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/i64/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/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/suilend/suilend-fe-public.git"},"bugs":{"url":"https://github.com/suilend/suilend-fe-public/issues"},"dependencies":{"@7kprotocol/sdk-ts":"^3.4.1","@cetusprotocol/aggregator-sdk":"^1.2.1","@flowx-finance/sdk":"^1.13.5","@pythnetwork/pyth-sui-js":"^2.2.0","@suilend/springsui-sdk":"^1.0.26","aftermath-ts-sdk":"^1.3.22","bignumber.js":"^9.1.2","bn.js":"^5.2.2","crypto-js":"^4.2.0","lodash":"^4.17.21","p-limit":"3.1.0","uuid":"^11.0.3"},"devDependencies":{"@types/bn.js":"^5.2.0","@types/lodash":"^4.17.20","ts-node":"^10.9.2"},"peerDependencies":{"@mysten/bcs":"1.6.0","@mysten/sui":"1.28.2","@suilend/sui-fe":"^0.3.32"},"overrides":{"chalk":"5.3.0","strip-ansi":"7.1.0","color-convert":"2.0.1","color-name":"1.1.4","is-core-module":"2.13.1","error-ex":"1.3.2","has-ansi":"5.0.1"}}
|
|
@@ -27,6 +27,7 @@ export declare const parseReserveAssetDataEvent: (event: ApiReserveAssetDataEven
|
|
|
27
27
|
eventIndex: number;
|
|
28
28
|
sender: string;
|
|
29
29
|
utilizationPercent: BigNumber;
|
|
30
|
+
original: ApiReserveAssetDataEvent;
|
|
30
31
|
};
|
|
31
32
|
export type ParsedDownsampledApiReserveAssetDataEvent = ReturnType<typeof parseDownsampledApiReserveAssetDataEvent>;
|
|
32
33
|
export declare const parseDownsampledApiReserveAssetDataEvent: (event: DownsampledApiReserveAssetDataEvent, reserve: ParsedReserve) => {
|
|
@@ -55,4 +56,5 @@ export declare const parseDownsampledApiReserveAssetDataEvent: (event: Downsampl
|
|
|
55
56
|
eventIndex: number;
|
|
56
57
|
sender: string;
|
|
57
58
|
utilizationPercent: BigNumber;
|
|
59
|
+
original: ApiReserveAssetDataEvent;
|
|
58
60
|
};
|
package/strategies.js
CHANGED
|
@@ -147,6 +147,11 @@ exports.STRATEGY_TYPE_EXPOSURE_MAP = {
|
|
|
147
147
|
max: new bignumber_js_1.default(2.2), // Actual max: 1 / (1 - (xBTC Open LTV %)) = 2.5x, where xBTC Open LTV % = 60%
|
|
148
148
|
default: new bignumber_js_1.default(2.2),
|
|
149
149
|
},
|
|
150
|
+
[strategyOwnerCap_1.StrategyType.suiUSDT_sSUI_SUI_LOOPING]: {
|
|
151
|
+
min: new bignumber_js_1.default(1),
|
|
152
|
+
max: new bignumber_js_1.default(3), // Actual max: 1 + (suiUSDT Open LTV %) * (1 / (1 - (sSUI Open LTV %))) = 3.5666x, where suiUSDT Open LTV % = 77% and sSUI Open LTV % = 70%
|
|
153
|
+
default: new bignumber_js_1.default(3),
|
|
154
|
+
},
|
|
150
155
|
};
|
|
151
156
|
// Reserves
|
|
152
157
|
const getStrategyDepositReserves = (
|