@suilend/sdk 1.1.80 → 1.1.82
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 +5 -2
- package/client.js +6 -4
- package/lib/strategyOwnerCap.d.ts +4 -2
- package/lib/strategyOwnerCap.js +30 -0
- package/lib/types.d.ts +29 -5
- package/package.json +1 -1
package/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SuiClient } from "@mysten/sui/client";
|
|
2
2
|
import { Transaction, TransactionObjectArgument, TransactionObjectInput } from "@mysten/sui/transactions";
|
|
3
3
|
import { SuiPriceServiceConnection, SuiPythClient } from "@pythnetwork/pyth-sui-js";
|
|
4
|
-
import {
|
|
4
|
+
import { LendingMarket, ObligationOwnerCap } from "./_generated/suilend/lending-market/structs";
|
|
5
5
|
import { Obligation } from "./_generated/suilend/obligation/structs";
|
|
6
6
|
import { NewConfigArgs as CreateRateLimiterConfigArgs } from "./_generated/suilend/rate-limiter/functions";
|
|
7
7
|
import { CreateReserveConfigArgs } from "./_generated/suilend/reserve-config/functions";
|
|
@@ -33,7 +33,10 @@ export declare class SuilendClient {
|
|
|
33
33
|
pythConnection: SuiPriceServiceConnection;
|
|
34
34
|
constructor(lendingMarket: LendingMarket<string>, client: SuiClient);
|
|
35
35
|
static initialize(lendingMarketId: string, lendingMarketType: string, client: SuiClient, logPackageId?: boolean): Promise<SuilendClient>;
|
|
36
|
-
static getFeeReceivers(client: SuiClient, lendingMarketId: string): Promise<
|
|
36
|
+
static getFeeReceivers(client: SuiClient, lendingMarketId: string): Promise<{
|
|
37
|
+
receivers: string[];
|
|
38
|
+
weights: string[];
|
|
39
|
+
}>;
|
|
37
40
|
static createNewLendingMarket(registryId: string, lendingMarketType: string, transaction: Transaction): {
|
|
38
41
|
$kind: "NestedResult";
|
|
39
42
|
NestedResult: [number, number];
|
package/client.js
CHANGED
|
@@ -88,7 +88,7 @@ class SuilendClient {
|
|
|
88
88
|
}
|
|
89
89
|
static getFeeReceivers(client, lendingMarketId) {
|
|
90
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
var _a;
|
|
91
|
+
var _a, _b;
|
|
92
92
|
const feeReceiver = yield client.getDynamicFieldObject({
|
|
93
93
|
parentId: lendingMarketId,
|
|
94
94
|
name: {
|
|
@@ -98,9 +98,11 @@ class SuilendClient {
|
|
|
98
98
|
},
|
|
99
99
|
},
|
|
100
100
|
});
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
const receivers = ((_a = feeReceiver.data) === null || _a === void 0 ? void 0 : _a.content).fields.value.fields
|
|
102
|
+
.receivers;
|
|
103
|
+
const weights = ((_b = feeReceiver.data) === null || _b === void 0 ? void 0 : _b.content).fields.value.fields
|
|
104
|
+
.weights;
|
|
105
|
+
return { receivers, weights };
|
|
104
106
|
});
|
|
105
107
|
}
|
|
106
108
|
static createNewLendingMarket(registryId, lendingMarketType, transaction) {
|
|
@@ -8,7 +8,9 @@ export declare enum StrategyType {
|
|
|
8
8
|
sSUI_SUI_LOOPING = "1",
|
|
9
9
|
stratSUI_SUI_LOOPING = "2",
|
|
10
10
|
USDC_sSUI_SUI_LOOPING = "3",
|
|
11
|
-
AUSD_sSUI_SUI_LOOPING = "4"
|
|
11
|
+
AUSD_sSUI_SUI_LOOPING = "4",
|
|
12
|
+
xBTC_sSUI_SUI_LOOPING = "100",// Used to be for Slush Strategies #0
|
|
13
|
+
xBTC_wBTC_LOOPING = "101"
|
|
12
14
|
}
|
|
13
15
|
export declare const STRATEGY_TYPE_INFO_MAP: Record<StrategyType, {
|
|
14
16
|
queryParam: string;
|
|
@@ -19,7 +21,7 @@ export declare const STRATEGY_TYPE_INFO_MAP: Record<StrategyType, {
|
|
|
19
21
|
type: string;
|
|
20
22
|
};
|
|
21
23
|
depositBaseCoinType?: string;
|
|
22
|
-
depositLstCoinType
|
|
24
|
+
depositLstCoinType?: string;
|
|
23
25
|
borrowCoinType: string;
|
|
24
26
|
currencyCoinTypes: string[];
|
|
25
27
|
defaultCurrencyCoinType: string;
|
package/lib/strategyOwnerCap.js
CHANGED
|
@@ -27,6 +27,8 @@ var StrategyType;
|
|
|
27
27
|
StrategyType["stratSUI_SUI_LOOPING"] = "2";
|
|
28
28
|
StrategyType["USDC_sSUI_SUI_LOOPING"] = "3";
|
|
29
29
|
StrategyType["AUSD_sSUI_SUI_LOOPING"] = "4";
|
|
30
|
+
StrategyType["xBTC_sSUI_SUI_LOOPING"] = "100";
|
|
31
|
+
StrategyType["xBTC_wBTC_LOOPING"] = "101";
|
|
30
32
|
})(StrategyType || (exports.StrategyType = StrategyType = {}));
|
|
31
33
|
exports.STRATEGY_TYPE_INFO_MAP = {
|
|
32
34
|
[StrategyType.sSUI_SUI_LOOPING]: {
|
|
@@ -85,6 +87,34 @@ exports.STRATEGY_TYPE_INFO_MAP = {
|
|
|
85
87
|
currencyCoinTypes: [sui_fe_1.NORMALIZED_AUSD_COINTYPE],
|
|
86
88
|
defaultCurrencyCoinType: sui_fe_1.NORMALIZED_AUSD_COINTYPE,
|
|
87
89
|
},
|
|
90
|
+
[StrategyType.xBTC_sSUI_SUI_LOOPING]: {
|
|
91
|
+
queryParam: "xBTC-sSUI-SUI-looping",
|
|
92
|
+
header: {
|
|
93
|
+
coinTypes: [sui_fe_1.NORMALIZED_xBTC_COINTYPE],
|
|
94
|
+
title: "xBTC sSUI/SUI",
|
|
95
|
+
tooltip: "Sets up an xBTC sSUI/SUI Looping strategy by depositing xBTC and looping sSUI/SUI to the desired leverage",
|
|
96
|
+
type: "Looping",
|
|
97
|
+
},
|
|
98
|
+
depositBaseCoinType: sui_fe_1.NORMALIZED_xBTC_COINTYPE,
|
|
99
|
+
depositLstCoinType: sui_fe_1.NORMALIZED_sSUI_COINTYPE,
|
|
100
|
+
borrowCoinType: sui_fe_1.NORMALIZED_SUI_COINTYPE,
|
|
101
|
+
currencyCoinTypes: [sui_fe_1.NORMALIZED_xBTC_COINTYPE],
|
|
102
|
+
defaultCurrencyCoinType: sui_fe_1.NORMALIZED_xBTC_COINTYPE,
|
|
103
|
+
},
|
|
104
|
+
[StrategyType.xBTC_wBTC_LOOPING]: {
|
|
105
|
+
queryParam: "xBTC-wBTC-looping",
|
|
106
|
+
header: {
|
|
107
|
+
coinTypes: [sui_fe_1.NORMALIZED_xBTC_COINTYPE, sui_fe_1.NORMALIZED_wBTC_COINTYPE],
|
|
108
|
+
title: "xBTC/wBTC",
|
|
109
|
+
tooltip: "Sets up an xBTC/wBTC Looping strategy by depositing xBTC and borrowing wBTC to the desired leverage",
|
|
110
|
+
type: "Looping",
|
|
111
|
+
},
|
|
112
|
+
depositBaseCoinType: sui_fe_1.NORMALIZED_xBTC_COINTYPE,
|
|
113
|
+
depositLstCoinType: undefined,
|
|
114
|
+
borrowCoinType: sui_fe_1.NORMALIZED_wBTC_COINTYPE,
|
|
115
|
+
currencyCoinTypes: [sui_fe_1.NORMALIZED_xBTC_COINTYPE, sui_fe_1.NORMALIZED_wBTC_COINTYPE],
|
|
116
|
+
defaultCurrencyCoinType: sui_fe_1.NORMALIZED_xBTC_COINTYPE,
|
|
117
|
+
},
|
|
88
118
|
};
|
|
89
119
|
const strategyDeposit = (coin, coinType, strategyOwnerCap, reserveArrayIndex, transaction) => transaction.moveCall({
|
|
90
120
|
target: `${STRATEGY_WRAPPER_PACKAGE_ID_V6}::strategy_wrapper::deposit_liquidity_and_deposit_into_obligation`,
|
package/lib/types.d.ts
CHANGED
|
@@ -94,26 +94,26 @@ export type ApiDepositEvent = {
|
|
|
94
94
|
eventIndex: number;
|
|
95
95
|
sender: string;
|
|
96
96
|
};
|
|
97
|
-
export type
|
|
97
|
+
export type ApiBorrowEvent = {
|
|
98
98
|
id: number;
|
|
99
99
|
lendingMarketId: string;
|
|
100
100
|
coinType: string;
|
|
101
101
|
reserveId: string;
|
|
102
102
|
obligationId: string;
|
|
103
|
-
|
|
103
|
+
liquidityAmount: string;
|
|
104
|
+
originationFeeAmount: string;
|
|
104
105
|
timestamp: number;
|
|
105
106
|
digest: string;
|
|
106
107
|
eventIndex: number;
|
|
107
108
|
sender: string;
|
|
108
109
|
};
|
|
109
|
-
export type
|
|
110
|
+
export type ApiWithdrawEvent = {
|
|
110
111
|
id: number;
|
|
111
112
|
lendingMarketId: string;
|
|
112
113
|
coinType: string;
|
|
113
114
|
reserveId: string;
|
|
114
115
|
obligationId: string;
|
|
115
|
-
|
|
116
|
-
originationFeeAmount: string;
|
|
116
|
+
ctokenAmount: string;
|
|
117
117
|
timestamp: number;
|
|
118
118
|
digest: string;
|
|
119
119
|
eventIndex: number;
|
|
@@ -146,6 +146,30 @@ export type ApiLiquidateEvent = {
|
|
|
146
146
|
eventIndex: number;
|
|
147
147
|
sender: string;
|
|
148
148
|
};
|
|
149
|
+
export type ApiForgiveEvent = {
|
|
150
|
+
id: number;
|
|
151
|
+
lendingMarketId: string;
|
|
152
|
+
reserveId: string;
|
|
153
|
+
obligationId: string;
|
|
154
|
+
coinType: string;
|
|
155
|
+
liquidityAmount: string;
|
|
156
|
+
timestamp: number;
|
|
157
|
+
digest: string;
|
|
158
|
+
eventIndex: number;
|
|
159
|
+
sender: string;
|
|
160
|
+
};
|
|
161
|
+
export type ApiSocializeLossEvent = {
|
|
162
|
+
id: number;
|
|
163
|
+
lendingMarketId: string;
|
|
164
|
+
reserveId: string;
|
|
165
|
+
obligationId: string;
|
|
166
|
+
coinType: string;
|
|
167
|
+
lossAmount: string;
|
|
168
|
+
socializationRate: string;
|
|
169
|
+
relatedForgiveDigest: string;
|
|
170
|
+
timestamp: number;
|
|
171
|
+
sender: string;
|
|
172
|
+
};
|
|
149
173
|
export type ApiClaimRewardEvent = {
|
|
150
174
|
id: number;
|
|
151
175
|
lendingMarketId: string;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@suilend/sdk","version":"1.1.
|
|
1
|
+
{"name":"@suilend/sdk","version":"1.1.82","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","./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.4","@pythnetwork/pyth-sui-js":"^2.2.0","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.29"},"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"}}
|