@suilend/sdk 2.0.4 → 3.0.2
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/_generated/_dependencies/source/0x1/ascii/structs.d.ts +7 -11
- package/_generated/_dependencies/source/0x1/ascii/structs.js +6 -63
- package/_generated/_dependencies/source/0x1/option/structs.d.ts +3 -9
- package/_generated/_dependencies/source/0x1/option/structs.js +4 -42
- package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +5 -7
- package/_generated/_dependencies/source/0x1/type-name/structs.js +3 -32
- package/_generated/_dependencies/source/0x2/bag/structs.d.ts +7 -9
- package/_generated/_dependencies/source/0x2/bag/structs.js +3 -31
- package/_generated/_dependencies/source/0x2/balance/structs.d.ts +7 -11
- package/_generated/_dependencies/source/0x2/balance/structs.js +7 -82
- package/_generated/_dependencies/source/0x2/object/structs.d.ts +8 -12
- package/_generated/_dependencies/source/0x2/object/structs.js +7 -61
- package/_generated/_dependencies/source/0x2/object-table/structs.d.ts +7 -9
- package/_generated/_dependencies/source/0x2/object-table/structs.js +4 -44
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.d.ts +5 -7
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js +3 -31
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.d.ts +11 -13
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js +3 -32
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.d.ts +23 -25
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js +3 -32
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.d.ts +4 -6
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js +3 -33
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.d.ts +55 -59
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js +6 -64
- package/_generated/_framework/reified.d.ts +2 -4
- package/_generated/_framework/vector.d.ts +2 -12
- package/_generated/suilend/cell/structs.d.ts +4 -10
- package/_generated/suilend/cell/structs.js +4 -42
- package/_generated/suilend/decimal/structs.d.ts +4 -6
- package/_generated/suilend/decimal/structs.js +3 -32
- package/_generated/suilend/lending-market/structs.d.ts +152 -392
- package/_generated/suilend/lending-market/structs.js +50 -548
- package/_generated/suilend/liquidity-mining/structs.d.ts +50 -158
- package/_generated/suilend/liquidity-mining/structs.js +16 -169
- package/_generated/suilend/obligation/structs.d.ts +108 -148
- package/_generated/suilend/obligation/structs.js +23 -232
- package/_generated/suilend/rate-limiter/structs.d.ts +15 -19
- package/_generated/suilend/rate-limiter/structs.js +6 -64
- package/_generated/suilend/reserve/structs.d.ts +138 -362
- package/_generated/suilend/reserve/structs.js +29 -327
- package/_generated/suilend/reserve-config/structs.d.ts +33 -37
- package/_generated/suilend/reserve-config/structs.js +6 -65
- package/client.d.ts +8 -8
- package/client.js +55 -88
- package/lib/initialize.d.ts +29 -28
- package/lib/initialize.js +20 -16
- package/lib/liquidityMining.d.ts +3 -3
- package/lib/pythAdapter.d.ts +9 -0
- package/lib/pythAdapter.js +120 -0
- package/lib/strategyOwnerCap.d.ts +12 -7
- package/lib/strategyOwnerCap.js +159 -156
- package/margin/margin/admin_cap.d.ts +2 -2
- package/margin/margin/deps/std/type_name.d.ts +1 -1
- package/margin/margin/deps/sui/vec_set.d.ts +3 -5
- package/margin/margin/deps/suilend/lending_market.d.ts +2 -2
- package/margin/margin/market.d.ts +21 -38
- package/margin/margin/position.d.ts +47 -47
- package/margin/margin/router.d.ts +5 -5
- package/margin/margin/version.d.ts +1 -1
- package/package.json +1 -1
- package/parsers/lendingMarket.d.ts +6 -6
- package/parsers/obligation.d.ts +8 -8
- package/parsers/reserve.d.ts +8 -8
- package/strategies.d.ts +38 -21
- package/strategies.js +239 -79
- package/swap/quote.d.ts +1 -9
- package/swap/quote.js +1 -52
- package/swap/transaction.d.ts +2 -4
- package/swap/transaction.js +9 -25
- package/utils/events.d.ts +6 -5
- package/utils/events.js +11 -8
- package/utils/obligation.d.ts +6 -5
- package/utils/obligation.js +118 -117
package/lib/strategyOwnerCap.js
CHANGED
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { SUI_CLOCK_OBJECT_ID, SUI_SYSTEM_STATE_OBJECT_ID, } from "@mysten/sui/utils";
|
|
11
11
|
import BigNumber from "bignumber.js";
|
|
12
12
|
import BN from "bn.js";
|
|
13
|
-
import { MAX_U64, NORMALIZED_AUSD_COINTYPE, NORMALIZED_SUI_COINTYPE, NORMALIZED_USDC_COINTYPE, NORMALIZED_sSUI_COINTYPE, NORMALIZED_stratSUI_COINTYPE, NORMALIZED_suiUSDT_COINTYPE, NORMALIZED_suiWBTC_COINTYPE, NORMALIZED_xBTC_COINTYPE, isSui, } from "@suilend/sui-fe";
|
|
13
|
+
import { MAX_U64, NORMALIZED_AUSD_COINTYPE, NORMALIZED_SUI_COINTYPE, NORMALIZED_USDC_COINTYPE, NORMALIZED_USDsui_COINTYPE, NORMALIZED_eEARN_COINTYPE, NORMALIZED_sSUI_COINTYPE, NORMALIZED_stratSUI_COINTYPE, NORMALIZED_suiUSDT_COINTYPE, NORMALIZED_suiWBTC_COINTYPE, NORMALIZED_xBTC_COINTYPE, isSui, } from "@suilend/sui-fe";
|
|
14
14
|
import { LENDING_MARKET_ID, LENDING_MARKET_TYPE, } from "../client";
|
|
15
15
|
import { Side } from "./types";
|
|
16
16
|
export const STRATEGY_WRAPPER_PACKAGE_ID_V1 = "0xba97dc73a07638d03d77ad2161484eb21db577edc9cadcd7035fef4b4f2f6fa1";
|
|
@@ -18,8 +18,9 @@ const STRATEGY_WRAPPER_PACKAGE_ID_V7 = "0x864b66441e95323c320ee7584592769930a2d2
|
|
|
18
18
|
export var StrategyType;
|
|
19
19
|
(function (StrategyType) {
|
|
20
20
|
StrategyType["sSUI_SUI_LOOPING"] = "1";
|
|
21
|
-
StrategyType["stratSUI_SUI_LOOPING"] = "2";
|
|
22
21
|
StrategyType["USDC_sSUI_SUI_LOOPING"] = "3";
|
|
22
|
+
StrategyType["USDsui_USDC_LOOPING"] = "10";
|
|
23
|
+
StrategyType["eEARN_USDC_LOOPING"] = "11";
|
|
23
24
|
StrategyType["AUSD_sSUI_SUI_LOOPING"] = "4";
|
|
24
25
|
StrategyType["xBTC_sSUI_SUI_LOOPING"] = "100";
|
|
25
26
|
StrategyType["xBTC_suiWBTC_LOOPING"] = "101";
|
|
@@ -27,9 +28,13 @@ export var StrategyType;
|
|
|
27
28
|
StrategyType["AUSD_USDC_LOOPING"] = "6";
|
|
28
29
|
StrategyType["AUSD_suiUSDT_LOOPING"] = "7";
|
|
29
30
|
StrategyType["USDC_suiUSDT_LOOPING"] = "8";
|
|
31
|
+
StrategyType["USDsui_sSUI_SUI_LOOPING"] = "9";
|
|
32
|
+
StrategyType["stratSUI_SUI_LOOPING"] = "2";
|
|
30
33
|
})(StrategyType || (StrategyType = {}));
|
|
31
34
|
export const STRATEGY_TYPE_INFO_MAP = {
|
|
32
35
|
[StrategyType.sSUI_SUI_LOOPING]: {
|
|
36
|
+
lendingMarketId: LENDING_MARKET_ID,
|
|
37
|
+
lendingMarketType: LENDING_MARKET_TYPE,
|
|
33
38
|
queryParam: "sSUI-SUI-looping",
|
|
34
39
|
header: {
|
|
35
40
|
coinTypes: [NORMALIZED_sSUI_COINTYPE, NORMALIZED_SUI_COINTYPE],
|
|
@@ -43,21 +48,9 @@ export const STRATEGY_TYPE_INFO_MAP = {
|
|
|
43
48
|
currencyCoinTypes: [NORMALIZED_SUI_COINTYPE, NORMALIZED_sSUI_COINTYPE],
|
|
44
49
|
defaultCurrencyCoinType: NORMALIZED_SUI_COINTYPE,
|
|
45
50
|
},
|
|
46
|
-
[StrategyType.stratSUI_SUI_LOOPING]: {
|
|
47
|
-
queryParam: "stratSUI-SUI-looping",
|
|
48
|
-
header: {
|
|
49
|
-
coinTypes: [NORMALIZED_stratSUI_COINTYPE, NORMALIZED_SUI_COINTYPE],
|
|
50
|
-
title: "stratSUI/SUI",
|
|
51
|
-
tooltip: "Sets up a stratSUI/SUI Looping strategy by depositing stratSUI and borrowing SUI to the desired leverage",
|
|
52
|
-
type: "Looping",
|
|
53
|
-
},
|
|
54
|
-
depositBaseCoinType: undefined,
|
|
55
|
-
depositLstCoinType: NORMALIZED_stratSUI_COINTYPE,
|
|
56
|
-
borrowCoinType: NORMALIZED_SUI_COINTYPE,
|
|
57
|
-
currencyCoinTypes: [NORMALIZED_SUI_COINTYPE, NORMALIZED_stratSUI_COINTYPE],
|
|
58
|
-
defaultCurrencyCoinType: NORMALIZED_SUI_COINTYPE,
|
|
59
|
-
},
|
|
60
51
|
[StrategyType.USDC_sSUI_SUI_LOOPING]: {
|
|
52
|
+
lendingMarketId: LENDING_MARKET_ID,
|
|
53
|
+
lendingMarketType: LENDING_MARKET_TYPE,
|
|
61
54
|
queryParam: "USDC-sSUI-SUI-looping",
|
|
62
55
|
header: {
|
|
63
56
|
coinTypes: [NORMALIZED_USDC_COINTYPE],
|
|
@@ -71,7 +64,41 @@ export const STRATEGY_TYPE_INFO_MAP = {
|
|
|
71
64
|
currencyCoinTypes: [NORMALIZED_USDC_COINTYPE],
|
|
72
65
|
defaultCurrencyCoinType: NORMALIZED_USDC_COINTYPE,
|
|
73
66
|
},
|
|
67
|
+
[StrategyType.USDsui_USDC_LOOPING]: {
|
|
68
|
+
lendingMarketId: LENDING_MARKET_ID,
|
|
69
|
+
lendingMarketType: LENDING_MARKET_TYPE,
|
|
70
|
+
queryParam: "USDsui-USDC-looping",
|
|
71
|
+
header: {
|
|
72
|
+
coinTypes: [NORMALIZED_USDsui_COINTYPE, NORMALIZED_USDC_COINTYPE],
|
|
73
|
+
title: "USDsui/USDC",
|
|
74
|
+
tooltip: "Sets up an USDsui/USDC Looping strategy by depositing USDsui and borrowing USDC to the desired leverage",
|
|
75
|
+
type: "Looping",
|
|
76
|
+
},
|
|
77
|
+
depositBaseCoinType: NORMALIZED_USDsui_COINTYPE,
|
|
78
|
+
depositLstCoinType: undefined,
|
|
79
|
+
borrowCoinType: NORMALIZED_USDC_COINTYPE,
|
|
80
|
+
currencyCoinTypes: [NORMALIZED_USDsui_COINTYPE, NORMALIZED_USDC_COINTYPE],
|
|
81
|
+
defaultCurrencyCoinType: NORMALIZED_USDsui_COINTYPE,
|
|
82
|
+
},
|
|
83
|
+
[StrategyType.eEARN_USDC_LOOPING]: {
|
|
84
|
+
lendingMarketId: "0x74d92cb095b618f344486f77bcce87fbffc0fe0b46584bb1828bb291a222dda8",
|
|
85
|
+
lendingMarketType: "0x423f05ea163ae1bc5c03d75ef70d3e5d887455084118e46c4f76878530a03619::ember_market::EMBER_MARKET",
|
|
86
|
+
queryParam: "eEARN-USDC-looping",
|
|
87
|
+
header: {
|
|
88
|
+
coinTypes: [NORMALIZED_eEARN_COINTYPE, NORMALIZED_USDC_COINTYPE],
|
|
89
|
+
title: "eEARN/USDC",
|
|
90
|
+
tooltip: "Sets up an eEARN/USDC Looping strategy by depositing eEARN and borrowing USDC to the desired leverage",
|
|
91
|
+
type: "Looping",
|
|
92
|
+
},
|
|
93
|
+
depositBaseCoinType: NORMALIZED_eEARN_COINTYPE,
|
|
94
|
+
depositLstCoinType: undefined,
|
|
95
|
+
borrowCoinType: NORMALIZED_USDC_COINTYPE,
|
|
96
|
+
currencyCoinTypes: [NORMALIZED_eEARN_COINTYPE, NORMALIZED_USDC_COINTYPE],
|
|
97
|
+
defaultCurrencyCoinType: NORMALIZED_eEARN_COINTYPE,
|
|
98
|
+
},
|
|
74
99
|
[StrategyType.AUSD_sSUI_SUI_LOOPING]: {
|
|
100
|
+
lendingMarketId: LENDING_MARKET_ID,
|
|
101
|
+
lendingMarketType: LENDING_MARKET_TYPE,
|
|
75
102
|
queryParam: "AUSD-sSUI-SUI-looping",
|
|
76
103
|
header: {
|
|
77
104
|
coinTypes: [NORMALIZED_AUSD_COINTYPE],
|
|
@@ -86,6 +113,8 @@ export const STRATEGY_TYPE_INFO_MAP = {
|
|
|
86
113
|
defaultCurrencyCoinType: NORMALIZED_AUSD_COINTYPE,
|
|
87
114
|
},
|
|
88
115
|
[StrategyType.xBTC_sSUI_SUI_LOOPING]: {
|
|
116
|
+
lendingMarketId: LENDING_MARKET_ID,
|
|
117
|
+
lendingMarketType: LENDING_MARKET_TYPE,
|
|
89
118
|
queryParam: "xBTC-sSUI-SUI-looping",
|
|
90
119
|
header: {
|
|
91
120
|
coinTypes: [NORMALIZED_xBTC_COINTYPE],
|
|
@@ -100,6 +129,8 @@ export const STRATEGY_TYPE_INFO_MAP = {
|
|
|
100
129
|
defaultCurrencyCoinType: NORMALIZED_xBTC_COINTYPE,
|
|
101
130
|
},
|
|
102
131
|
[StrategyType.xBTC_suiWBTC_LOOPING]: {
|
|
132
|
+
lendingMarketId: LENDING_MARKET_ID,
|
|
133
|
+
lendingMarketType: LENDING_MARKET_TYPE,
|
|
103
134
|
queryParam: "xBTC-suiWBTC-looping",
|
|
104
135
|
header: {
|
|
105
136
|
coinTypes: [NORMALIZED_xBTC_COINTYPE, NORMALIZED_suiWBTC_COINTYPE],
|
|
@@ -114,6 +145,8 @@ export const STRATEGY_TYPE_INFO_MAP = {
|
|
|
114
145
|
defaultCurrencyCoinType: NORMALIZED_xBTC_COINTYPE,
|
|
115
146
|
},
|
|
116
147
|
[StrategyType.suiUSDT_sSUI_SUI_LOOPING]: {
|
|
148
|
+
lendingMarketId: LENDING_MARKET_ID,
|
|
149
|
+
lendingMarketType: LENDING_MARKET_TYPE,
|
|
117
150
|
queryParam: "suiUSDT-sSUI-SUI-looping",
|
|
118
151
|
header: {
|
|
119
152
|
coinTypes: [NORMALIZED_suiUSDT_COINTYPE],
|
|
@@ -128,6 +161,8 @@ export const STRATEGY_TYPE_INFO_MAP = {
|
|
|
128
161
|
defaultCurrencyCoinType: NORMALIZED_suiUSDT_COINTYPE,
|
|
129
162
|
},
|
|
130
163
|
[StrategyType.AUSD_USDC_LOOPING]: {
|
|
164
|
+
lendingMarketId: LENDING_MARKET_ID,
|
|
165
|
+
lendingMarketType: LENDING_MARKET_TYPE,
|
|
131
166
|
queryParam: "AUSD-USDC-looping",
|
|
132
167
|
header: {
|
|
133
168
|
coinTypes: [NORMALIZED_AUSD_COINTYPE, NORMALIZED_USDC_COINTYPE],
|
|
@@ -142,6 +177,8 @@ export const STRATEGY_TYPE_INFO_MAP = {
|
|
|
142
177
|
defaultCurrencyCoinType: NORMALIZED_AUSD_COINTYPE,
|
|
143
178
|
},
|
|
144
179
|
[StrategyType.AUSD_suiUSDT_LOOPING]: {
|
|
180
|
+
lendingMarketId: LENDING_MARKET_ID,
|
|
181
|
+
lendingMarketType: LENDING_MARKET_TYPE,
|
|
145
182
|
queryParam: "AUSD-suiUSDT-looping",
|
|
146
183
|
header: {
|
|
147
184
|
coinTypes: [NORMALIZED_AUSD_COINTYPE, NORMALIZED_suiUSDT_COINTYPE],
|
|
@@ -156,6 +193,8 @@ export const STRATEGY_TYPE_INFO_MAP = {
|
|
|
156
193
|
defaultCurrencyCoinType: NORMALIZED_AUSD_COINTYPE,
|
|
157
194
|
},
|
|
158
195
|
[StrategyType.USDC_suiUSDT_LOOPING]: {
|
|
196
|
+
lendingMarketId: LENDING_MARKET_ID,
|
|
197
|
+
lendingMarketType: LENDING_MARKET_TYPE,
|
|
159
198
|
queryParam: "USDC-suiUSDT-looping",
|
|
160
199
|
header: {
|
|
161
200
|
coinTypes: [NORMALIZED_USDC_COINTYPE, NORMALIZED_suiUSDT_COINTYPE],
|
|
@@ -169,66 +208,117 @@ export const STRATEGY_TYPE_INFO_MAP = {
|
|
|
169
208
|
currencyCoinTypes: [NORMALIZED_USDC_COINTYPE, NORMALIZED_suiUSDT_COINTYPE],
|
|
170
209
|
defaultCurrencyCoinType: NORMALIZED_USDC_COINTYPE,
|
|
171
210
|
},
|
|
211
|
+
[StrategyType.USDsui_sSUI_SUI_LOOPING]: {
|
|
212
|
+
lendingMarketId: LENDING_MARKET_ID,
|
|
213
|
+
lendingMarketType: LENDING_MARKET_TYPE,
|
|
214
|
+
queryParam: "USDsui-sSUI-SUI-looping",
|
|
215
|
+
header: {
|
|
216
|
+
coinTypes: [NORMALIZED_USDsui_COINTYPE],
|
|
217
|
+
title: "USDsui sSUI/SUI",
|
|
218
|
+
tooltip: "Sets up a USDsui sSUI/SUI Looping strategy by depositing USDsui and looping sSUI/SUI to the desired leverage",
|
|
219
|
+
type: "Looping",
|
|
220
|
+
},
|
|
221
|
+
depositBaseCoinType: NORMALIZED_USDsui_COINTYPE,
|
|
222
|
+
depositLstCoinType: NORMALIZED_sSUI_COINTYPE,
|
|
223
|
+
borrowCoinType: NORMALIZED_SUI_COINTYPE,
|
|
224
|
+
currencyCoinTypes: [NORMALIZED_USDsui_COINTYPE],
|
|
225
|
+
defaultCurrencyCoinType: NORMALIZED_USDsui_COINTYPE,
|
|
226
|
+
},
|
|
227
|
+
[StrategyType.stratSUI_SUI_LOOPING]: {
|
|
228
|
+
lendingMarketId: LENDING_MARKET_ID,
|
|
229
|
+
lendingMarketType: LENDING_MARKET_TYPE,
|
|
230
|
+
queryParam: "stratSUI-SUI-looping",
|
|
231
|
+
header: {
|
|
232
|
+
coinTypes: [NORMALIZED_stratSUI_COINTYPE, NORMALIZED_SUI_COINTYPE],
|
|
233
|
+
title: "stratSUI/SUI",
|
|
234
|
+
tooltip: "Sets up a stratSUI/SUI Looping strategy by depositing stratSUI and borrowing SUI to the desired leverage",
|
|
235
|
+
type: "Looping",
|
|
236
|
+
},
|
|
237
|
+
depositBaseCoinType: undefined,
|
|
238
|
+
depositLstCoinType: NORMALIZED_stratSUI_COINTYPE,
|
|
239
|
+
borrowCoinType: NORMALIZED_SUI_COINTYPE,
|
|
240
|
+
currencyCoinTypes: [NORMALIZED_SUI_COINTYPE, NORMALIZED_stratSUI_COINTYPE],
|
|
241
|
+
defaultCurrencyCoinType: NORMALIZED_SUI_COINTYPE,
|
|
242
|
+
},
|
|
172
243
|
};
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
? transaction.moveCall({
|
|
186
|
-
target: `${STRATEGY_WRAPPER_PACKAGE_ID_V7}::strategy_wrapper::borrow_sui_from_obligation`,
|
|
187
|
-
typeArguments: [LENDING_MARKET_TYPE],
|
|
244
|
+
const getStrategyLendingMarket = (strategyType) => {
|
|
245
|
+
const info = STRATEGY_TYPE_INFO_MAP[strategyType];
|
|
246
|
+
return {
|
|
247
|
+
lendingMarketId: info.lendingMarketId,
|
|
248
|
+
lendingMarketType: info.lendingMarketType,
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
export const strategyDeposit = (strategyType, coin, coinType, strategyOwnerCap, reserveArrayIndex, transaction) => {
|
|
252
|
+
const { lendingMarketId, lendingMarketType } = getStrategyLendingMarket(strategyType);
|
|
253
|
+
return transaction.moveCall({
|
|
254
|
+
target: `${STRATEGY_WRAPPER_PACKAGE_ID_V7}::strategy_wrapper::deposit_liquidity_and_deposit_into_obligation`,
|
|
255
|
+
typeArguments: [lendingMarketType, coinType],
|
|
188
256
|
arguments: [
|
|
189
257
|
transaction.object(strategyOwnerCap),
|
|
190
|
-
transaction.object(
|
|
258
|
+
transaction.object(lendingMarketId),
|
|
191
259
|
transaction.pure.u64(reserveArrayIndex),
|
|
192
260
|
transaction.object(SUI_CLOCK_OBJECT_ID),
|
|
193
|
-
transaction.
|
|
194
|
-
transaction.object(SUI_SYSTEM_STATE_OBJECT_ID),
|
|
261
|
+
transaction.object(coin),
|
|
195
262
|
],
|
|
196
|
-
})
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
263
|
+
});
|
|
264
|
+
};
|
|
265
|
+
export const strategyBorrow = (strategyType, coinType, strategyOwnerCap, reserveArrayIndex, value, transaction) => {
|
|
266
|
+
const { lendingMarketId, lendingMarketType } = getStrategyLendingMarket(strategyType);
|
|
267
|
+
return isSui(coinType)
|
|
268
|
+
? transaction.moveCall({
|
|
269
|
+
target: `${STRATEGY_WRAPPER_PACKAGE_ID_V7}::strategy_wrapper::borrow_sui_from_obligation`,
|
|
270
|
+
typeArguments: [lendingMarketType],
|
|
271
|
+
arguments: [
|
|
272
|
+
transaction.object(strategyOwnerCap),
|
|
273
|
+
transaction.object(lendingMarketId),
|
|
274
|
+
transaction.pure.u64(reserveArrayIndex),
|
|
275
|
+
transaction.object(SUI_CLOCK_OBJECT_ID),
|
|
276
|
+
transaction.pure.u64(value),
|
|
277
|
+
transaction.object(SUI_SYSTEM_STATE_OBJECT_ID),
|
|
278
|
+
],
|
|
279
|
+
})
|
|
280
|
+
: transaction.moveCall({
|
|
281
|
+
target: `${STRATEGY_WRAPPER_PACKAGE_ID_V7}::strategy_wrapper::borrow_from_obligation`,
|
|
282
|
+
typeArguments: [lendingMarketType, coinType],
|
|
283
|
+
arguments: [
|
|
284
|
+
transaction.object(strategyOwnerCap),
|
|
285
|
+
transaction.object(lendingMarketId),
|
|
286
|
+
transaction.pure.u64(reserveArrayIndex),
|
|
287
|
+
transaction.object(SUI_CLOCK_OBJECT_ID),
|
|
288
|
+
transaction.pure.u64(value),
|
|
289
|
+
],
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
export const strategyWithdraw = (strategyType, coinType, strategyOwnerCap, reserveArrayIndex, value, transaction) => {
|
|
293
|
+
const { lendingMarketId, lendingMarketType } = getStrategyLendingMarket(strategyType);
|
|
294
|
+
return transaction.moveCall({
|
|
295
|
+
target: `${STRATEGY_WRAPPER_PACKAGE_ID_V7}::strategy_wrapper::withdraw_from_obligation_and_redeem`,
|
|
296
|
+
typeArguments: [lendingMarketType, coinType],
|
|
200
297
|
arguments: [
|
|
201
298
|
transaction.object(strategyOwnerCap),
|
|
202
|
-
transaction.object(
|
|
299
|
+
transaction.object(lendingMarketId),
|
|
203
300
|
transaction.pure.u64(reserveArrayIndex),
|
|
204
301
|
transaction.object(SUI_CLOCK_OBJECT_ID),
|
|
205
302
|
transaction.pure.u64(value),
|
|
206
303
|
],
|
|
207
304
|
});
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
transaction.object(SUI_CLOCK_OBJECT_ID),
|
|
226
|
-
transaction.pure.u64(reserveArrayIndex),
|
|
227
|
-
transaction.pure.u64(rewardIndex),
|
|
228
|
-
transaction.pure.bool(side === Side.DEPOSIT),
|
|
229
|
-
],
|
|
230
|
-
});
|
|
231
|
-
const strategyClaimRewardsAndMergeCoins = (rewardsMap, strategyOwnerCap, transaction) => {
|
|
305
|
+
};
|
|
306
|
+
const strategyClaimRewards = (strategyType, coinType, strategyOwnerCap, reserveArrayIndex, rewardIndex, side, transaction) => {
|
|
307
|
+
const { lendingMarketId, lendingMarketType } = getStrategyLendingMarket(strategyType);
|
|
308
|
+
return transaction.moveCall({
|
|
309
|
+
target: `${STRATEGY_WRAPPER_PACKAGE_ID_V7}::strategy_wrapper::claim_rewards`,
|
|
310
|
+
typeArguments: [lendingMarketType, coinType],
|
|
311
|
+
arguments: [
|
|
312
|
+
transaction.object(strategyOwnerCap),
|
|
313
|
+
transaction.object(lendingMarketId),
|
|
314
|
+
transaction.object(SUI_CLOCK_OBJECT_ID),
|
|
315
|
+
transaction.pure.u64(reserveArrayIndex),
|
|
316
|
+
transaction.pure.u64(rewardIndex),
|
|
317
|
+
transaction.pure.bool(side === Side.DEPOSIT),
|
|
318
|
+
],
|
|
319
|
+
});
|
|
320
|
+
};
|
|
321
|
+
export const strategyClaimRewardsAndMergeCoins = (strategyType, rewardsMap, strategyOwnerCap, transaction) => {
|
|
232
322
|
// 1) Get rewards
|
|
233
323
|
const rewards = Object.values(rewardsMap)
|
|
234
324
|
.flatMap((r) => r.rewards)
|
|
@@ -241,7 +331,7 @@ const strategyClaimRewardsAndMergeCoins = (rewardsMap, strategyOwnerCap, transac
|
|
|
241
331
|
// 2) Claim rewards and merge coins
|
|
242
332
|
const mergeCoinsMap = {};
|
|
243
333
|
for (const reward of rewards) {
|
|
244
|
-
const [claimedCoin] = strategyClaimRewards(reward.rewardCoinType, strategyOwnerCap, reward.reserveArrayIndex, reward.rewardIndex, reward.side, transaction);
|
|
334
|
+
const [claimedCoin] = strategyClaimRewards(strategyType, reward.rewardCoinType, strategyOwnerCap, reward.reserveArrayIndex, reward.rewardIndex, reward.side, transaction);
|
|
245
335
|
if (mergeCoinsMap[reward.rewardCoinType] === undefined)
|
|
246
336
|
mergeCoinsMap[reward.rewardCoinType] = [];
|
|
247
337
|
mergeCoinsMap[reward.rewardCoinType].push(claimedCoin);
|
|
@@ -255,94 +345,6 @@ const strategyClaimRewardsAndMergeCoins = (rewardsMap, strategyOwnerCap, transac
|
|
|
255
345
|
}
|
|
256
346
|
return mergedCoinsMap;
|
|
257
347
|
};
|
|
258
|
-
export const strategyClaimRewardsAndSwapForCoinType = (address, cetusSdk, cetusPartnerId, rewardsMap, rewardPriceMap, depositReserve, strategyOwnerCap, isDepositing, transaction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
259
|
-
const filteredRewardsMap = Object.fromEntries(Object.entries(rewardsMap).filter(([coinType]) => {
|
|
260
|
-
var _a;
|
|
261
|
-
return ((_a = rewardPriceMap[coinType]) !== null && _a !== void 0 ? _a : new BigNumber(0))
|
|
262
|
-
.times(rewardsMap[coinType].amount)
|
|
263
|
-
.gte(0.01);
|
|
264
|
-
}));
|
|
265
|
-
// 1) Claim rewards and merge coins
|
|
266
|
-
const mergedCoinsMap = strategyClaimRewardsAndMergeCoins(filteredRewardsMap, strategyOwnerCap, transaction);
|
|
267
|
-
// 2) Prepare
|
|
268
|
-
const nonSwappedCoinTypes = Object.keys(mergedCoinsMap).filter((coinType) => coinType === depositReserve.coinType);
|
|
269
|
-
const swappedCoinTypes = Object.keys(mergedCoinsMap).filter((coinType) => coinType !== depositReserve.coinType);
|
|
270
|
-
let resultCoin = undefined;
|
|
271
|
-
// 3.1) Non-swapped coins
|
|
272
|
-
for (const [coinType, coin] of Object.entries(mergedCoinsMap).filter(([coinType]) => nonSwappedCoinTypes.includes(coinType))) {
|
|
273
|
-
if (resultCoin)
|
|
274
|
-
transaction.mergeCoins(resultCoin, [coin]);
|
|
275
|
-
else
|
|
276
|
-
resultCoin = coin;
|
|
277
|
-
}
|
|
278
|
-
// 3.2) Swapped coins
|
|
279
|
-
// 3.2.1) Get routers
|
|
280
|
-
const amountsAndSortedQuotesMap = Object.fromEntries(yield Promise.all(Object.entries(mergedCoinsMap)
|
|
281
|
-
.filter(([coinType]) => swappedCoinTypes.includes(coinType))
|
|
282
|
-
.map(([coinType, coin]) => (() => __awaiter(void 0, void 0, void 0, function* () {
|
|
283
|
-
try {
|
|
284
|
-
// Get amount
|
|
285
|
-
const { rawAmount: amount } = filteredRewardsMap[coinType]; // Use underestimate (rewards keep accruing)
|
|
286
|
-
// Get routes
|
|
287
|
-
const routers = yield cetusSdk.findRouters({
|
|
288
|
-
from: coinType,
|
|
289
|
-
target: depositReserve.coinType,
|
|
290
|
-
amount: new BN(amount.toString()), // Underestimate (rewards keep accruing)
|
|
291
|
-
byAmountIn: true,
|
|
292
|
-
});
|
|
293
|
-
if (!routers)
|
|
294
|
-
throw new Error(`No swap quote found for ${coinType}`);
|
|
295
|
-
console.log("[strategyClaimRewardsAndSwapForCoinType] routers", {
|
|
296
|
-
coinType,
|
|
297
|
-
routers,
|
|
298
|
-
});
|
|
299
|
-
return [coinType, { coin, routers }];
|
|
300
|
-
}
|
|
301
|
-
catch (err) {
|
|
302
|
-
console.error(err);
|
|
303
|
-
return [coinType, { coin, routers: undefined }];
|
|
304
|
-
}
|
|
305
|
-
}))())));
|
|
306
|
-
console.log("[strategyClaimRewardsAndSwapForCoinType] amountsAndSortedQuotesMap", { amountsAndSortedQuotesMap });
|
|
307
|
-
// 3.2.2) Swap
|
|
308
|
-
for (const [coinType, { coin: coinIn, routers }] of Object.entries(amountsAndSortedQuotesMap)) {
|
|
309
|
-
if (routers === undefined)
|
|
310
|
-
continue; // Skip coin if no swap quote found
|
|
311
|
-
console.log("[strategyClaimRewardsAndSwapForCoinType] swapping coinType", coinType);
|
|
312
|
-
try {
|
|
313
|
-
let coinOut;
|
|
314
|
-
try {
|
|
315
|
-
coinOut = (yield cetusSdk.fixableRouterSwapV3({
|
|
316
|
-
router: routers,
|
|
317
|
-
inputCoin: coinIn,
|
|
318
|
-
slippage: 3 / 100,
|
|
319
|
-
txb: transaction,
|
|
320
|
-
partner: cetusPartnerId,
|
|
321
|
-
}));
|
|
322
|
-
if (resultCoin)
|
|
323
|
-
transaction.mergeCoins(resultCoin, [coinOut]);
|
|
324
|
-
else
|
|
325
|
-
resultCoin = coinOut;
|
|
326
|
-
}
|
|
327
|
-
catch (err) {
|
|
328
|
-
throw new Error(`No swap quote found for ${coinType}`);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
catch (err) {
|
|
332
|
-
console.error(err);
|
|
333
|
-
continue; // Skip coin if swap fails
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
// 4) Deposit
|
|
337
|
-
if (!resultCoin)
|
|
338
|
-
throw new Error("No coin to deposit or transfer");
|
|
339
|
-
if (isDepositing) {
|
|
340
|
-
strategyDeposit(resultCoin, depositReserve.coinType, strategyOwnerCap, depositReserve.arrayIndex, transaction);
|
|
341
|
-
}
|
|
342
|
-
else {
|
|
343
|
-
transaction.transferObjects([resultCoin], transaction.pure.address(address));
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
348
|
export const strategySwapSomeDepositsForCoinType = (strategyType, cetusSdk, cetusPartnerId, obligation, noSwapCoinTypes, // coinTypes to not swap for depositReserve.coinType
|
|
347
349
|
swapPercent, // percent of deposit to swap for depositReserve.coinType (0-100)
|
|
348
350
|
depositReserve, strategyOwnerCap, transaction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -352,7 +354,7 @@ depositReserve, strategyOwnerCap, transaction) => __awaiter(void 0, void 0, void
|
|
|
352
354
|
return;
|
|
353
355
|
const withdrawnCoinsMap = {};
|
|
354
356
|
for (const deposit of swapCoinTypeDeposits) {
|
|
355
|
-
const [withdrawnCoin] = strategyWithdraw(deposit.coinType, strategyOwnerCap, deposit.reserve.arrayIndex, swapPercent.eq(100)
|
|
357
|
+
const [withdrawnCoin] = strategyWithdraw(strategyType, deposit.coinType, strategyOwnerCap, deposit.reserve.arrayIndex, swapPercent.eq(100)
|
|
356
358
|
? BigInt(MAX_U64.toString())
|
|
357
359
|
: BigInt(new BigNumber(new BigNumber(deposit.depositedAmount.times(swapPercent.div(100)))
|
|
358
360
|
.times(10 ** deposit.reserve.token.decimals)
|
|
@@ -429,9 +431,10 @@ depositReserve, strategyOwnerCap, transaction) => __awaiter(void 0, void 0, void
|
|
|
429
431
|
if (!resultCoin)
|
|
430
432
|
throw new Error("No coin to deposit or transfer");
|
|
431
433
|
console.log("[strategySwapSomeDepositsForCoinType] depositing resultCoin");
|
|
432
|
-
strategyDeposit(resultCoin, depositReserve.coinType, strategyOwnerCap, depositReserve.arrayIndex, transaction);
|
|
434
|
+
strategyDeposit(strategyType, resultCoin, depositReserve.coinType, strategyOwnerCap, depositReserve.arrayIndex, transaction);
|
|
433
435
|
});
|
|
434
436
|
export const createStrategyOwnerCapIfNoneExists = (strategyType, strategyOwnerCap, transaction) => {
|
|
437
|
+
const { lendingMarketId, lendingMarketType } = getStrategyLendingMarket(strategyType);
|
|
435
438
|
let strategyOwnerCapId;
|
|
436
439
|
let didCreate = false;
|
|
437
440
|
if (strategyOwnerCap)
|
|
@@ -439,9 +442,9 @@ export const createStrategyOwnerCapIfNoneExists = (strategyType, strategyOwnerCa
|
|
|
439
442
|
else {
|
|
440
443
|
strategyOwnerCapId = transaction.moveCall({
|
|
441
444
|
target: `${STRATEGY_WRAPPER_PACKAGE_ID_V7}::strategy_wrapper::create_strategy_owner_cap`,
|
|
442
|
-
typeArguments: [
|
|
445
|
+
typeArguments: [lendingMarketType],
|
|
443
446
|
arguments: [
|
|
444
|
-
transaction.object(
|
|
447
|
+
transaction.object(lendingMarketId),
|
|
445
448
|
transaction.pure.u8(+strategyType),
|
|
446
449
|
],
|
|
447
450
|
});
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
**************************************************************/
|
|
4
4
|
import { MoveStruct } from '../utils/index.js';
|
|
5
5
|
export declare const AdminCap: MoveStruct<{
|
|
6
|
-
id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
6
|
+
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
7
7
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::admin_cap::AdminCap">;
|
|
8
8
|
export declare const InitEvent: MoveStruct<{
|
|
9
|
-
admin_cap_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
9
|
+
admin_cap_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
10
10
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::admin_cap::InitEvent">;
|
|
@@ -13,5 +13,5 @@ export declare const TypeName: MoveStruct<{
|
|
|
13
13
|
* Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
|
|
14
14
|
* 32 depending on the Move platform)
|
|
15
15
|
*/
|
|
16
|
-
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
16
|
+
name: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
17
17
|
}, "std::type_name::TypeName">;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**************************************************************
|
|
2
2
|
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
3
|
**************************************************************/
|
|
4
|
-
import { type BcsType } from '@mysten/sui/bcs';
|
|
4
|
+
import { type BcsType, bcs } from '@mysten/sui/bcs';
|
|
5
5
|
import { MoveStruct } from '../../../utils/index.js';
|
|
6
6
|
/**
|
|
7
7
|
* A set data structure backed by a vector. The set is guaranteed not to contain
|
|
@@ -14,7 +14,5 @@ import { MoveStruct } from '../../../utils/index.js';
|
|
|
14
14
|
export declare function VecSet<K extends BcsType<any>>(...typeParameters: [
|
|
15
15
|
K
|
|
16
16
|
]): MoveStruct<{
|
|
17
|
-
contents:
|
|
18
|
-
|
|
19
|
-
}, string>;
|
|
20
|
-
}, `0x2::vec_set::VecSet<${K["name"]}>`>;
|
|
17
|
+
contents: ReturnType<typeof bcs.vector<K>>;
|
|
18
|
+
}>;
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
**************************************************************/
|
|
4
4
|
import { MoveStruct } from '../../../utils/index.js';
|
|
5
5
|
export declare const ObligationOwnerCap: MoveStruct<{
|
|
6
|
-
id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
7
|
-
obligation_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
6
|
+
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
7
|
+
obligation_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
8
8
|
}, "suilend::lending_market::ObligationOwnerCap<phantom P>">;
|
|
@@ -2,53 +2,36 @@
|
|
|
2
2
|
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
3
|
**************************************************************/
|
|
4
4
|
import { MoveStruct, type RawTransactionArgument } from '../utils/index.js';
|
|
5
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
5
6
|
import { type Transaction } from '@mysten/sui/transactions';
|
|
7
|
+
import * as version from './version.js';
|
|
8
|
+
import * as vec_set from './deps/sui/vec_set.js';
|
|
6
9
|
export declare const Market: MoveStruct<{
|
|
7
|
-
id:
|
|
8
|
-
version:
|
|
9
|
-
fee_recipient:
|
|
10
|
-
open_fee_rate:
|
|
11
|
-
close_fee_rate:
|
|
12
|
-
permissions:
|
|
13
|
-
|
|
14
|
-
OpenPosition: true;
|
|
15
|
-
ClosePosition: true;
|
|
16
|
-
Deposit: true;
|
|
17
|
-
Borrow: true;
|
|
18
|
-
Withdraw: true;
|
|
19
|
-
Repay: true;
|
|
20
|
-
ClaimReward: true;
|
|
21
|
-
}, "Borrow" | "Deposit" | "Withdraw" | "Repay" | "OpenPosition" | "ClosePosition" | "ClaimReward">[], Iterable<import("@mysten/bcs").EnumInputShape<{
|
|
22
|
-
OpenPosition: boolean | object | null;
|
|
23
|
-
ClosePosition: boolean | object | null;
|
|
24
|
-
Deposit: boolean | object | null;
|
|
25
|
-
Borrow: boolean | object | null;
|
|
26
|
-
Withdraw: boolean | object | null;
|
|
27
|
-
Repay: boolean | object | null;
|
|
28
|
-
ClaimReward: boolean | object | null;
|
|
29
|
-
}>> & {
|
|
30
|
-
length: number;
|
|
31
|
-
}, string>;
|
|
32
|
-
}, "0x2::vec_set::VecSet<0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::permissions::Permission>">;
|
|
33
|
-
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::market::Market<phantom BASE, phantom QUOTE>">;
|
|
10
|
+
id: typeof bcs.Address;
|
|
11
|
+
version: typeof version.Version;
|
|
12
|
+
fee_recipient: typeof bcs.Address;
|
|
13
|
+
open_fee_rate: ReturnType<typeof bcs.u64>;
|
|
14
|
+
close_fee_rate: ReturnType<typeof bcs.u64>;
|
|
15
|
+
permissions: ReturnType<typeof vec_set.VecSet>;
|
|
16
|
+
}>;
|
|
34
17
|
export declare const CreateMarketEvent: MoveStruct<{
|
|
35
|
-
market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
18
|
+
market_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
36
19
|
base_token: MoveStruct<{
|
|
37
|
-
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
20
|
+
name: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
38
21
|
}, "std::type_name::TypeName">;
|
|
39
22
|
quote_token: MoveStruct<{
|
|
40
|
-
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
23
|
+
name: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
41
24
|
}, "std::type_name::TypeName">;
|
|
42
|
-
open_fee_rate: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
43
|
-
close_fee_rate: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
25
|
+
open_fee_rate: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
26
|
+
close_fee_rate: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
44
27
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::market::CreateMarketEvent">;
|
|
45
28
|
export declare const MarketUpdatedEvent: MoveStruct<{
|
|
46
|
-
market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
47
|
-
open_fee_rate: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
48
|
-
close_fee_rate: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
29
|
+
market_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
30
|
+
open_fee_rate: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
31
|
+
close_fee_rate: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
49
32
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::market::MarketUpdatedEvent">;
|
|
50
33
|
export declare const UpdateMarketPermissionEvent: MoveStruct<{
|
|
51
|
-
market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
34
|
+
market_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
52
35
|
permission: import("../utils/index.js").MoveEnum<{
|
|
53
36
|
OpenPosition: null;
|
|
54
37
|
ClosePosition: null;
|
|
@@ -58,8 +41,8 @@ export declare const UpdateMarketPermissionEvent: MoveStruct<{
|
|
|
58
41
|
Repay: null;
|
|
59
42
|
ClaimReward: null;
|
|
60
43
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::permissions::Permission">;
|
|
61
|
-
is_pause: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
|
|
62
|
-
sender: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
44
|
+
is_pause: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
|
|
45
|
+
sender: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
63
46
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::market::UpdateMarketPermissionEvent">;
|
|
64
47
|
export interface CheckVersionArguments {
|
|
65
48
|
market: RawTransactionArgument<string>;
|