@suilend/sdk 3.0.8 → 4.0.0
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 +4 -4
- package/_generated/_dependencies/source/0x1/ascii/structs.js +42 -41
- package/_generated/_dependencies/source/0x1/option/structs.js +22 -26
- package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +3 -3
- package/_generated/_dependencies/source/0x1/type-name/structs.js +21 -25
- package/_generated/_dependencies/source/0x2/bag/structs.d.ts +5 -5
- package/_generated/_dependencies/source/0x2/bag/structs.js +22 -25
- package/_generated/_dependencies/source/0x2/balance/structs.d.ts +4 -4
- package/_generated/_dependencies/source/0x2/balance/structs.js +42 -41
- package/_generated/_dependencies/source/0x2/object/structs.d.ts +5 -5
- package/_generated/_dependencies/source/0x2/object/structs.js +42 -41
- package/_generated/_dependencies/source/0x2/object-table/structs.d.ts +5 -5
- package/_generated/_dependencies/source/0x2/object-table/structs.js +22 -25
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.d.ts +3 -3
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js +22 -25
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.d.ts +9 -9
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js +24 -25
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.d.ts +21 -21
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js +23 -25
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.d.ts +2 -2
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js +21 -25
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.d.ts +52 -52
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js +45 -41
- package/_generated/_framework/vector.js +9 -6
- package/_generated/suilend/cell/structs.d.ts +1 -1
- package/_generated/suilend/cell/structs.js +21 -25
- package/_generated/suilend/decimal/structs.d.ts +2 -2
- package/_generated/suilend/decimal/structs.js +21 -25
- package/_generated/suilend/lending-market/structs.d.ts +129 -129
- package/_generated/suilend/lending-market/structs.js +391 -265
- package/_generated/suilend/liquidity-mining/structs.d.ts +44 -44
- package/_generated/suilend/liquidity-mining/structs.js +122 -89
- package/_generated/suilend/obligation/structs.d.ts +98 -98
- package/_generated/suilend/obligation/structs.js +194 -121
- package/_generated/suilend/rate-limiter/structs.d.ts +12 -12
- package/_generated/suilend/rate-limiter/structs.js +46 -41
- package/_generated/suilend/reserve/structs.d.ts +128 -128
- package/_generated/suilend/reserve/structs.js +243 -153
- package/_generated/suilend/reserve-config/structs.d.ts +30 -30
- package/_generated/suilend/reserve-config/structs.js +60 -41
- package/api/events.js +5 -14
- package/client.js +267 -319
- package/lib/initialize.d.ts +2 -2
- package/lib/initialize.js +26 -31
- package/lib/liquidityMining.js +15 -19
- package/lib/pyth.js +6 -15
- package/lib/pythAdapter.js +96 -112
- package/lib/strategyOwnerCap.js +8 -17
- package/margin/margin/admin_cap.d.ts +2 -2
- package/margin/margin/deps/std/type_name.d.ts +1 -1
- package/margin/margin/deps/suilend/lending_market.d.ts +2 -2
- package/margin/margin/market.d.ts +11 -11
- package/margin/margin/market.js +22 -22
- package/margin/margin/permissions.js +14 -14
- package/margin/margin/position.d.ts +47 -47
- package/margin/margin/position.js +10 -10
- package/margin/margin/router.d.ts +5 -5
- package/margin/margin/router.js +16 -16
- package/margin/margin/version.d.ts +1 -1
- package/margin/utils/index.js +22 -36
- package/package.json +1 -1
- package/parsers/apiReserveAssetDataEvent.js +4 -1
- package/parsers/lendingMarket.js +3 -4
- package/parsers/reserve.js +4 -1
- package/strategies.js +188 -204
- package/swap/quote.d.ts +1 -1
- package/swap/quote.js +28 -39
- package/swap/transaction.js +17 -26
- package/utils/events.js +20 -32
- package/utils/obligation.js +111 -135
- package/utils/simulate.js +16 -24
|
@@ -15,23 +15,23 @@ export declare const Market: MoveStruct<{
|
|
|
15
15
|
permissions: ReturnType<typeof vec_set.VecSet>;
|
|
16
16
|
}>;
|
|
17
17
|
export declare const CreateMarketEvent: MoveStruct<{
|
|
18
|
-
market_id: import("@mysten/
|
|
18
|
+
market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
19
19
|
base_token: MoveStruct<{
|
|
20
|
-
name: import("@mysten/
|
|
20
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
21
21
|
}, "std::type_name::TypeName">;
|
|
22
22
|
quote_token: MoveStruct<{
|
|
23
|
-
name: import("@mysten/
|
|
23
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
24
24
|
}, "std::type_name::TypeName">;
|
|
25
|
-
open_fee_rate: import("@mysten/
|
|
26
|
-
close_fee_rate: import("@mysten/
|
|
25
|
+
open_fee_rate: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
26
|
+
close_fee_rate: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
27
27
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::market::CreateMarketEvent">;
|
|
28
28
|
export declare const MarketUpdatedEvent: MoveStruct<{
|
|
29
|
-
market_id: import("@mysten/
|
|
30
|
-
open_fee_rate: import("@mysten/
|
|
31
|
-
close_fee_rate: import("@mysten/
|
|
29
|
+
market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
30
|
+
open_fee_rate: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
31
|
+
close_fee_rate: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
32
32
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::market::MarketUpdatedEvent">;
|
|
33
33
|
export declare const UpdateMarketPermissionEvent: MoveStruct<{
|
|
34
|
-
market_id: import("@mysten/
|
|
34
|
+
market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
35
35
|
permission: import("../utils/index.js").MoveEnum<{
|
|
36
36
|
OpenPosition: null;
|
|
37
37
|
ClosePosition: null;
|
|
@@ -41,8 +41,8 @@ export declare const UpdateMarketPermissionEvent: MoveStruct<{
|
|
|
41
41
|
Repay: null;
|
|
42
42
|
ClaimReward: null;
|
|
43
43
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::permissions::Permission">;
|
|
44
|
-
is_pause: import("@mysten/
|
|
45
|
-
sender: import("@mysten/
|
|
44
|
+
is_pause: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
|
|
45
|
+
sender: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
46
46
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::market::UpdateMarketPermissionEvent">;
|
|
47
47
|
export interface CheckVersionArguments {
|
|
48
48
|
market: RawTransactionArgument<string>;
|
package/margin/margin/market.js
CHANGED
|
@@ -47,8 +47,8 @@ export const UpdateMarketPermissionEvent = new MoveStruct({
|
|
|
47
47
|
},
|
|
48
48
|
});
|
|
49
49
|
export function checkVersion(options) {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
const packageAddress = options.package ??
|
|
51
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
52
52
|
const argumentsTypes = [null];
|
|
53
53
|
const parameterNames = ["market"];
|
|
54
54
|
return (tx) => tx.moveCall({
|
|
@@ -60,8 +60,8 @@ export function checkVersion(options) {
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
export function upgradeVersion(options) {
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
const packageAddress = options.package ??
|
|
64
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
65
65
|
const argumentsTypes = [null, null];
|
|
66
66
|
const parameterNames = ["_", "market"];
|
|
67
67
|
return (tx) => tx.moveCall({
|
|
@@ -73,8 +73,8 @@ export function upgradeVersion(options) {
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
export function createMarket(options) {
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
const packageAddress = options.package ??
|
|
77
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
78
78
|
const argumentsTypes = [null, "address", "u64", "u64"];
|
|
79
79
|
const parameterNames = ["_", "feeRecipient", "openFeeRate", "closeFeeRate"];
|
|
80
80
|
return (tx) => tx.moveCall({
|
|
@@ -87,8 +87,8 @@ export function createMarket(options) {
|
|
|
87
87
|
}
|
|
88
88
|
/** Update a market permission */
|
|
89
89
|
export function updateMarketPermission(options) {
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
const packageAddress = options.package ??
|
|
91
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
92
92
|
const argumentsTypes = [null, null, null, "bool"];
|
|
93
93
|
const parameterNames = ["_", "market", "permission", "pause"];
|
|
94
94
|
return (tx) => tx.moveCall({
|
|
@@ -101,8 +101,8 @@ export function updateMarketPermission(options) {
|
|
|
101
101
|
}
|
|
102
102
|
/** Set fee rates */
|
|
103
103
|
export function setFeeRate(options) {
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
const packageAddress = options.package ??
|
|
105
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
106
106
|
const argumentsTypes = [null, null, "u64", "u64"];
|
|
107
107
|
const parameterNames = ["_", "market", "openFee", "closeFee"];
|
|
108
108
|
return (tx) => tx.moveCall({
|
|
@@ -115,8 +115,8 @@ export function setFeeRate(options) {
|
|
|
115
115
|
}
|
|
116
116
|
/** Set fee recipient address */
|
|
117
117
|
export function setFeeRecipient(options) {
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
const packageAddress = options.package ??
|
|
119
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
120
120
|
const argumentsTypes = [null, null, "address"];
|
|
121
121
|
const parameterNames = ["_", "market", "feeRecipient"];
|
|
122
122
|
return (tx) => tx.moveCall({
|
|
@@ -129,8 +129,8 @@ export function setFeeRecipient(options) {
|
|
|
129
129
|
}
|
|
130
130
|
/** Get market ID */
|
|
131
131
|
export function marketId(options) {
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
const packageAddress = options.package ??
|
|
133
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
134
134
|
const argumentsTypes = [null];
|
|
135
135
|
const parameterNames = ["market"];
|
|
136
136
|
return (tx) => tx.moveCall({
|
|
@@ -143,8 +143,8 @@ export function marketId(options) {
|
|
|
143
143
|
}
|
|
144
144
|
/** Get open fee rate */
|
|
145
145
|
export function openFeeRate(options) {
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
const packageAddress = options.package ??
|
|
147
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
148
148
|
const argumentsTypes = [null];
|
|
149
149
|
const parameterNames = ["market"];
|
|
150
150
|
return (tx) => tx.moveCall({
|
|
@@ -157,8 +157,8 @@ export function openFeeRate(options) {
|
|
|
157
157
|
}
|
|
158
158
|
/** Get close fee rate */
|
|
159
159
|
export function closeFeeRate(options) {
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
const packageAddress = options.package ??
|
|
161
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
162
162
|
const argumentsTypes = [null];
|
|
163
163
|
const parameterNames = ["market"];
|
|
164
164
|
return (tx) => tx.moveCall({
|
|
@@ -171,8 +171,8 @@ export function closeFeeRate(options) {
|
|
|
171
171
|
}
|
|
172
172
|
/** Get fee recipient address */
|
|
173
173
|
export function feeRecipient(options) {
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
const packageAddress = options.package ??
|
|
175
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
176
176
|
const argumentsTypes = [null];
|
|
177
177
|
const parameterNames = ["market"];
|
|
178
178
|
return (tx) => tx.moveCall({
|
|
@@ -184,8 +184,8 @@ export function feeRecipient(options) {
|
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
export function permissions(options) {
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
const packageAddress = options.package ??
|
|
188
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
189
189
|
const argumentsTypes = [null];
|
|
190
190
|
const parameterNames = ["market"];
|
|
191
191
|
return (tx) => tx.moveCall({
|
|
@@ -13,8 +13,8 @@ export const Permission = new MoveEnum({
|
|
|
13
13
|
},
|
|
14
14
|
});
|
|
15
15
|
export function openPosition(options = {}) {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const packageAddress = options.package ??
|
|
17
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
18
18
|
return (tx) => tx.moveCall({
|
|
19
19
|
package: packageAddress,
|
|
20
20
|
module: "permissions",
|
|
@@ -22,8 +22,8 @@ export function openPosition(options = {}) {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
export function closePosition(options = {}) {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const packageAddress = options.package ??
|
|
26
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
27
27
|
return (tx) => tx.moveCall({
|
|
28
28
|
package: packageAddress,
|
|
29
29
|
module: "permissions",
|
|
@@ -31,8 +31,8 @@ export function closePosition(options = {}) {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
export function deposit(options = {}) {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const packageAddress = options.package ??
|
|
35
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
36
36
|
return (tx) => tx.moveCall({
|
|
37
37
|
package: packageAddress,
|
|
38
38
|
module: "permissions",
|
|
@@ -40,8 +40,8 @@ export function deposit(options = {}) {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
export function borrow(options = {}) {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const packageAddress = options.package ??
|
|
44
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
45
45
|
return (tx) => tx.moveCall({
|
|
46
46
|
package: packageAddress,
|
|
47
47
|
module: "permissions",
|
|
@@ -49,8 +49,8 @@ export function borrow(options = {}) {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
export function withdraw(options = {}) {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const packageAddress = options.package ??
|
|
53
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
54
54
|
return (tx) => tx.moveCall({
|
|
55
55
|
package: packageAddress,
|
|
56
56
|
module: "permissions",
|
|
@@ -58,8 +58,8 @@ export function withdraw(options = {}) {
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
export function repay(options = {}) {
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
const packageAddress = options.package ??
|
|
62
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
63
63
|
return (tx) => tx.moveCall({
|
|
64
64
|
package: packageAddress,
|
|
65
65
|
module: "permissions",
|
|
@@ -67,8 +67,8 @@ export function repay(options = {}) {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
export function claimReward(options = {}) {
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
const packageAddress = options.package ??
|
|
71
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
72
72
|
return (tx) => tx.moveCall({
|
|
73
73
|
package: packageAddress,
|
|
74
74
|
module: "permissions",
|
|
@@ -1,85 +1,85 @@
|
|
|
1
1
|
import { type Transaction } from "@mysten/sui/transactions";
|
|
2
2
|
import { MoveStruct, type RawTransactionArgument } from "../utils/index.js";
|
|
3
3
|
export declare const Position: MoveStruct<{
|
|
4
|
-
id: import("@mysten/
|
|
5
|
-
is_long: import("@mysten/
|
|
4
|
+
id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
5
|
+
is_long: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
|
|
6
6
|
obligation_owner_cap: MoveStruct<{
|
|
7
|
-
id: import("@mysten/
|
|
8
|
-
obligation_id: import("@mysten/
|
|
7
|
+
id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
8
|
+
obligation_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
9
9
|
}, "suilend::lending_market::ObligationOwnerCap<phantom P>">;
|
|
10
|
-
created_ts: import("@mysten/
|
|
11
|
-
owner: import("@mysten/
|
|
12
|
-
market_id: import("@mysten/
|
|
13
|
-
lending_market_id: import("@mysten/
|
|
10
|
+
created_ts: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
11
|
+
owner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
12
|
+
market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
13
|
+
lending_market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
14
14
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::Position<phantom P>">;
|
|
15
15
|
export declare const PositionCap: MoveStruct<{
|
|
16
|
-
id: import("@mysten/
|
|
17
|
-
position_id: import("@mysten/
|
|
16
|
+
id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
17
|
+
position_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
18
18
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::PositionCap">;
|
|
19
19
|
export declare const OpenPositionEvent: MoveStruct<{
|
|
20
|
-
position_id: import("@mysten/
|
|
21
|
-
market_id: import("@mysten/
|
|
22
|
-
obligation_id: import("@mysten/
|
|
23
|
-
is_long: import("@mysten/
|
|
20
|
+
position_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
21
|
+
market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
22
|
+
obligation_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
23
|
+
is_long: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
|
|
24
24
|
collateral_coin_type: MoveStruct<{
|
|
25
|
-
name: import("@mysten/
|
|
25
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
26
26
|
}, "std::type_name::TypeName">;
|
|
27
27
|
loan_coin_type: MoveStruct<{
|
|
28
|
-
name: import("@mysten/
|
|
28
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
29
29
|
}, "std::type_name::TypeName">;
|
|
30
|
-
owner: import("@mysten/
|
|
31
|
-
timestamp: import("@mysten/
|
|
30
|
+
owner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
31
|
+
timestamp: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
32
32
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::OpenPositionEvent">;
|
|
33
33
|
export declare const ClosePositionEvent: MoveStruct<{
|
|
34
|
-
position_id: import("@mysten/
|
|
35
|
-
market_id: import("@mysten/
|
|
36
|
-
owner: import("@mysten/
|
|
37
|
-
timestamp: import("@mysten/
|
|
34
|
+
position_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
35
|
+
market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
36
|
+
owner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
37
|
+
timestamp: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
38
38
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::ClosePositionEvent">;
|
|
39
39
|
export declare const DepositEvent: MoveStruct<{
|
|
40
|
-
position_id: import("@mysten/
|
|
41
|
-
owner: import("@mysten/
|
|
40
|
+
position_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
41
|
+
owner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
42
42
|
coin_type: MoveStruct<{
|
|
43
|
-
name: import("@mysten/
|
|
43
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
44
44
|
}, "std::type_name::TypeName">;
|
|
45
|
-
deposit_amount: import("@mysten/
|
|
46
|
-
timestamp: import("@mysten/
|
|
45
|
+
deposit_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
46
|
+
timestamp: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
47
47
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::DepositEvent">;
|
|
48
48
|
export declare const WithdrawEvent: MoveStruct<{
|
|
49
|
-
position_id: import("@mysten/
|
|
50
|
-
owner: import("@mysten/
|
|
49
|
+
position_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
50
|
+
owner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
51
51
|
coin_type: MoveStruct<{
|
|
52
|
-
name: import("@mysten/
|
|
52
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
53
53
|
}, "std::type_name::TypeName">;
|
|
54
|
-
withdraw_amount: import("@mysten/
|
|
55
|
-
timestamp: import("@mysten/
|
|
54
|
+
withdraw_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
55
|
+
timestamp: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
56
56
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::WithdrawEvent">;
|
|
57
57
|
export declare const BorrowEvent: MoveStruct<{
|
|
58
|
-
position_id: import("@mysten/
|
|
59
|
-
owner: import("@mysten/
|
|
58
|
+
position_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
59
|
+
owner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
60
60
|
coin_type: MoveStruct<{
|
|
61
|
-
name: import("@mysten/
|
|
61
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
62
62
|
}, "std::type_name::TypeName">;
|
|
63
|
-
borrow_amount: import("@mysten/
|
|
64
|
-
timestamp: import("@mysten/
|
|
63
|
+
borrow_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
64
|
+
timestamp: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
65
65
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::BorrowEvent">;
|
|
66
66
|
export declare const RepayEvent: MoveStruct<{
|
|
67
|
-
position_id: import("@mysten/
|
|
68
|
-
owner: import("@mysten/
|
|
67
|
+
position_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
68
|
+
owner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
69
69
|
repay_coin_type: MoveStruct<{
|
|
70
|
-
name: import("@mysten/
|
|
70
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
71
71
|
}, "std::type_name::TypeName">;
|
|
72
|
-
repay_amount: import("@mysten/
|
|
73
|
-
timestamp: import("@mysten/
|
|
72
|
+
repay_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
73
|
+
timestamp: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
74
74
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::RepayEvent">;
|
|
75
75
|
export declare const ClaimRewardEvent: MoveStruct<{
|
|
76
|
-
position_id: import("@mysten/
|
|
77
|
-
owner: import("@mysten/
|
|
76
|
+
position_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
77
|
+
owner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
78
78
|
reward_coin_type: MoveStruct<{
|
|
79
|
-
name: import("@mysten/
|
|
79
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
80
80
|
}, "std::type_name::TypeName">;
|
|
81
|
-
reward_amount: import("@mysten/
|
|
82
|
-
timestamp: import("@mysten/
|
|
81
|
+
reward_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
82
|
+
timestamp: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
83
83
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::ClaimRewardEvent">;
|
|
84
84
|
export interface OwnerArguments {
|
|
85
85
|
position: RawTransactionArgument<string>;
|
|
@@ -99,8 +99,8 @@ export const ClaimRewardEvent = new MoveStruct({
|
|
|
99
99
|
});
|
|
100
100
|
/** Get position owner */
|
|
101
101
|
export function owner(options) {
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
const packageAddress = options.package ??
|
|
103
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
104
104
|
const argumentsTypes = [null];
|
|
105
105
|
const parameterNames = ["position"];
|
|
106
106
|
return (tx) => tx.moveCall({
|
|
@@ -113,8 +113,8 @@ export function owner(options) {
|
|
|
113
113
|
}
|
|
114
114
|
/** Check if it's a long position */
|
|
115
115
|
export function isLong(options) {
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
const packageAddress = options.package ??
|
|
117
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
118
118
|
const argumentsTypes = [null];
|
|
119
119
|
const parameterNames = ["position"];
|
|
120
120
|
return (tx) => tx.moveCall({
|
|
@@ -126,8 +126,8 @@ export function isLong(options) {
|
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
export function obligationId(options) {
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
const packageAddress = options.package ??
|
|
130
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
131
131
|
const argumentsTypes = [null];
|
|
132
132
|
const parameterNames = ["position"];
|
|
133
133
|
return (tx) => tx.moveCall({
|
|
@@ -139,8 +139,8 @@ export function obligationId(options) {
|
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
export function lendingMarketId(options) {
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
const packageAddress = options.package ??
|
|
143
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
144
144
|
const argumentsTypes = [null];
|
|
145
145
|
const parameterNames = ["position"];
|
|
146
146
|
return (tx) => tx.moveCall({
|
|
@@ -152,8 +152,8 @@ export function lendingMarketId(options) {
|
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
export function marketId(options) {
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
const packageAddress = options.package ??
|
|
156
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
157
157
|
const argumentsTypes = [null];
|
|
158
158
|
const parameterNames = ["position"];
|
|
159
159
|
return (tx) => tx.moveCall({
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type Transaction } from "@mysten/sui/transactions";
|
|
2
2
|
import { MoveStruct, type RawTransactionArgument } from "../utils/index.js";
|
|
3
3
|
export declare const FeeCollectedEvent: MoveStruct<{
|
|
4
|
-
market_id: import("@mysten/
|
|
5
|
-
is_open: import("@mysten/
|
|
6
|
-
fee_amount: import("@mysten/
|
|
4
|
+
market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
5
|
+
is_open: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
|
|
6
|
+
fee_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
7
7
|
fee_coin_type: MoveStruct<{
|
|
8
|
-
name: import("@mysten/
|
|
8
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
9
9
|
}, "std::type_name::TypeName">;
|
|
10
|
-
recipient: import("@mysten/
|
|
10
|
+
recipient: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
11
11
|
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::router::FeeCollectedEvent">;
|
|
12
12
|
export interface OpenPositionArguments {
|
|
13
13
|
market: RawTransactionArgument<string>;
|
package/margin/margin/router.js
CHANGED
|
@@ -16,8 +16,8 @@ export const FeeCollectedEvent = new MoveStruct({
|
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
export function openPosition(options) {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const packageAddress = options.package ??
|
|
20
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
21
21
|
const argumentsTypes = [null, null, "bool", "0x2::clock::Clock"];
|
|
22
22
|
const parameterNames = ["market", "lendingMarket", "isLong"];
|
|
23
23
|
return (tx) => tx.moveCall({
|
|
@@ -30,8 +30,8 @@ export function openPosition(options) {
|
|
|
30
30
|
}
|
|
31
31
|
/** Close position */
|
|
32
32
|
export function closePosition(options) {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const packageAddress = options.package ??
|
|
34
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
35
35
|
const argumentsTypes = [
|
|
36
36
|
null,
|
|
37
37
|
null,
|
|
@@ -49,8 +49,8 @@ export function closePosition(options) {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
export function borrow(options) {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const packageAddress = options.package ??
|
|
53
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
54
54
|
const argumentsTypes = [
|
|
55
55
|
null,
|
|
56
56
|
null,
|
|
@@ -76,8 +76,8 @@ export function borrow(options) {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
export function repay(options) {
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
const packageAddress = options.package ??
|
|
80
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
81
81
|
const argumentsTypes = [
|
|
82
82
|
null,
|
|
83
83
|
null,
|
|
@@ -102,8 +102,8 @@ export function repay(options) {
|
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
export function withdraw(options) {
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
const packageAddress = options.package ??
|
|
106
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
107
107
|
const argumentsTypes = [
|
|
108
108
|
null,
|
|
109
109
|
null,
|
|
@@ -131,8 +131,8 @@ export function withdraw(options) {
|
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
export function deposit(options) {
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
const packageAddress = options.package ??
|
|
135
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
136
136
|
const argumentsTypes = [
|
|
137
137
|
null,
|
|
138
138
|
null,
|
|
@@ -157,8 +157,8 @@ export function deposit(options) {
|
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
159
|
export function claimRewards(options) {
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
const packageAddress = options.package ??
|
|
161
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
162
162
|
const argumentsTypes = [
|
|
163
163
|
null,
|
|
164
164
|
null,
|
|
@@ -187,8 +187,8 @@ export function claimRewards(options) {
|
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
export function compoundDebt(options) {
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
const packageAddress = options.package ??
|
|
191
|
+
"0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
|
|
192
192
|
const argumentsTypes = [null, null, null, null, "u64"];
|
|
193
193
|
const parameterNames = [
|
|
194
194
|
"lendingMarket",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { MoveTuple } from "../utils/index.js";
|
|
2
|
-
export declare const Version: MoveTuple<readonly [import("@mysten/
|
|
2
|
+
export declare const Version: MoveTuple<readonly [import("@mysten/bcs").BcsType<number, number, "u16">], "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::version::Version">;
|
package/margin/utils/index.js
CHANGED
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
-
var t = {};
|
|
12
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
-
t[p] = s[p];
|
|
14
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
-
t[p[i]] = s[p[i]];
|
|
18
|
-
}
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
21
1
|
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
22
2
|
import { BcsEnum, BcsStruct, BcsTuple, TypeTagSerializer, bcs, } from "@mysten/sui/bcs";
|
|
23
3
|
import { isArgument } from "@mysten/sui/transactions";
|
|
@@ -139,23 +119,29 @@ export function normalizeMoveArguments(args, argTypes, parameterNames) {
|
|
|
139
119
|
return normalizedArgs;
|
|
140
120
|
}
|
|
141
121
|
export class MoveStruct extends BcsStruct {
|
|
142
|
-
get(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return res;
|
|
122
|
+
async get({ objectId, ...options }) {
|
|
123
|
+
const [res] = await this.getMany({
|
|
124
|
+
...options,
|
|
125
|
+
objectIds: [objectId],
|
|
147
126
|
});
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
127
|
+
return res;
|
|
128
|
+
}
|
|
129
|
+
async getMany({ client, ...options }) {
|
|
130
|
+
const response = (await client.core.getObjects({
|
|
131
|
+
...options,
|
|
132
|
+
include: {
|
|
133
|
+
...options.include,
|
|
134
|
+
content: true,
|
|
135
|
+
},
|
|
136
|
+
}));
|
|
137
|
+
return response.objects.map((obj) => {
|
|
138
|
+
if (obj instanceof Error) {
|
|
139
|
+
throw obj;
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
...obj,
|
|
143
|
+
json: this.parse(obj.content),
|
|
144
|
+
};
|
|
159
145
|
});
|
|
160
146
|
}
|
|
161
147
|
}
|