@suilend/sdk 2.0.2 → 2.0.3
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/api/events.js +2 -1
- package/client.d.ts +1 -0
- package/lib/initialize.js +4 -2
- package/lib/liquidityMining.d.ts +2 -2
- package/lib/liquidityMining.js +7 -5
- package/margin/index.d.ts +6 -0
- package/margin/index.js +6 -0
- package/margin/margin/admin_cap.d.ts +10 -0
- package/margin/margin/admin_cap.js +12 -0
- package/margin/margin/deps/std/type_name.d.ts +17 -0
- package/margin/margin/deps/std/type_name.js +19 -0
- package/margin/margin/deps/sui/vec_set.d.ts +20 -0
- package/margin/margin/deps/sui/vec_set.js +19 -0
- package/margin/margin/deps/suilend/lending_market.d.ts +8 -0
- package/margin/margin/deps/suilend/lending_market.js +10 -0
- package/margin/margin/market.d.ts +248 -0
- package/margin/margin/market.js +220 -0
- package/margin/margin/permissions.d.ts +56 -0
- package/margin/margin/permissions.js +77 -0
- package/margin/margin/position.d.ts +153 -0
- package/margin/margin/position.js +149 -0
- package/margin/margin/router.d.ts +204 -0
- package/margin/margin/router.js +176 -0
- package/margin/margin/version.d.ts +5 -0
- package/margin/margin/version.js +7 -0
- package/margin/utils/index.d.ts +30 -0
- package/margin/utils/index.js +171 -0
- package/package.json +1 -1
- package/strategies.js +1 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { MoveStruct, normalizeMoveArguments } from '../utils/index.js';
|
|
5
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
6
|
+
import * as version from './version.js';
|
|
7
|
+
import * as vec_set from './deps/sui/vec_set.js';
|
|
8
|
+
import * as permissions_1 from './permissions.js';
|
|
9
|
+
import * as type_name from './deps/std/type_name.js';
|
|
10
|
+
const $moduleName = '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::market';
|
|
11
|
+
export const Market = new MoveStruct({ name: `${$moduleName}::Market<phantom BASE, phantom QUOTE>`, fields: {
|
|
12
|
+
id: bcs.Address,
|
|
13
|
+
version: version.Version,
|
|
14
|
+
fee_recipient: bcs.Address,
|
|
15
|
+
open_fee_rate: bcs.u64(),
|
|
16
|
+
close_fee_rate: bcs.u64(),
|
|
17
|
+
permissions: vec_set.VecSet(permissions_1.Permission)
|
|
18
|
+
} });
|
|
19
|
+
export const CreateMarketEvent = new MoveStruct({ name: `${$moduleName}::CreateMarketEvent`, fields: {
|
|
20
|
+
market_id: bcs.Address,
|
|
21
|
+
base_token: type_name.TypeName,
|
|
22
|
+
quote_token: type_name.TypeName,
|
|
23
|
+
open_fee_rate: bcs.u64(),
|
|
24
|
+
close_fee_rate: bcs.u64()
|
|
25
|
+
} });
|
|
26
|
+
export const MarketUpdatedEvent = new MoveStruct({ name: `${$moduleName}::MarketUpdatedEvent`, fields: {
|
|
27
|
+
market_id: bcs.Address,
|
|
28
|
+
open_fee_rate: bcs.u64(),
|
|
29
|
+
close_fee_rate: bcs.u64()
|
|
30
|
+
} });
|
|
31
|
+
export const UpdateMarketPermissionEvent = new MoveStruct({ name: `${$moduleName}::UpdateMarketPermissionEvent`, fields: {
|
|
32
|
+
market_id: bcs.Address,
|
|
33
|
+
permission: permissions_1.Permission,
|
|
34
|
+
is_pause: bcs.bool(),
|
|
35
|
+
sender: bcs.Address
|
|
36
|
+
} });
|
|
37
|
+
export function checkVersion(options) {
|
|
38
|
+
var _a;
|
|
39
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
40
|
+
const argumentsTypes = [
|
|
41
|
+
null
|
|
42
|
+
];
|
|
43
|
+
const parameterNames = ["market"];
|
|
44
|
+
return (tx) => tx.moveCall({
|
|
45
|
+
package: packageAddress,
|
|
46
|
+
module: 'market',
|
|
47
|
+
function: 'check_version',
|
|
48
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
49
|
+
typeArguments: options.typeArguments
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export function upgradeVersion(options) {
|
|
53
|
+
var _a;
|
|
54
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
55
|
+
const argumentsTypes = [
|
|
56
|
+
null,
|
|
57
|
+
null
|
|
58
|
+
];
|
|
59
|
+
const parameterNames = ["_", "market"];
|
|
60
|
+
return (tx) => tx.moveCall({
|
|
61
|
+
package: packageAddress,
|
|
62
|
+
module: 'market',
|
|
63
|
+
function: 'upgrade_version',
|
|
64
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
65
|
+
typeArguments: options.typeArguments
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export function createMarket(options) {
|
|
69
|
+
var _a;
|
|
70
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
71
|
+
const argumentsTypes = [
|
|
72
|
+
null,
|
|
73
|
+
'address',
|
|
74
|
+
'u64',
|
|
75
|
+
'u64'
|
|
76
|
+
];
|
|
77
|
+
const parameterNames = ["_", "feeRecipient", "openFeeRate", "closeFeeRate"];
|
|
78
|
+
return (tx) => tx.moveCall({
|
|
79
|
+
package: packageAddress,
|
|
80
|
+
module: 'market',
|
|
81
|
+
function: 'create_market',
|
|
82
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
83
|
+
typeArguments: options.typeArguments
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/** Update a market permission */
|
|
87
|
+
export function updateMarketPermission(options) {
|
|
88
|
+
var _a;
|
|
89
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
90
|
+
const argumentsTypes = [
|
|
91
|
+
null,
|
|
92
|
+
null,
|
|
93
|
+
null,
|
|
94
|
+
'bool'
|
|
95
|
+
];
|
|
96
|
+
const parameterNames = ["_", "market", "permission", "pause"];
|
|
97
|
+
return (tx) => tx.moveCall({
|
|
98
|
+
package: packageAddress,
|
|
99
|
+
module: 'market',
|
|
100
|
+
function: 'update_market_permission',
|
|
101
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
102
|
+
typeArguments: options.typeArguments
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/** Set fee rates */
|
|
106
|
+
export function setFeeRate(options) {
|
|
107
|
+
var _a;
|
|
108
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
109
|
+
const argumentsTypes = [
|
|
110
|
+
null,
|
|
111
|
+
null,
|
|
112
|
+
'u64',
|
|
113
|
+
'u64'
|
|
114
|
+
];
|
|
115
|
+
const parameterNames = ["_", "market", "openFee", "closeFee"];
|
|
116
|
+
return (tx) => tx.moveCall({
|
|
117
|
+
package: packageAddress,
|
|
118
|
+
module: 'market',
|
|
119
|
+
function: 'set_fee_rate',
|
|
120
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
121
|
+
typeArguments: options.typeArguments
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/** Set fee recipient address */
|
|
125
|
+
export function setFeeRecipient(options) {
|
|
126
|
+
var _a;
|
|
127
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
128
|
+
const argumentsTypes = [
|
|
129
|
+
null,
|
|
130
|
+
null,
|
|
131
|
+
'address'
|
|
132
|
+
];
|
|
133
|
+
const parameterNames = ["_", "market", "feeRecipient"];
|
|
134
|
+
return (tx) => tx.moveCall({
|
|
135
|
+
package: packageAddress,
|
|
136
|
+
module: 'market',
|
|
137
|
+
function: 'set_fee_recipient',
|
|
138
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
139
|
+
typeArguments: options.typeArguments
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/** Get market ID */
|
|
143
|
+
export function marketId(options) {
|
|
144
|
+
var _a;
|
|
145
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
146
|
+
const argumentsTypes = [
|
|
147
|
+
null
|
|
148
|
+
];
|
|
149
|
+
const parameterNames = ["market"];
|
|
150
|
+
return (tx) => tx.moveCall({
|
|
151
|
+
package: packageAddress,
|
|
152
|
+
module: 'market',
|
|
153
|
+
function: 'market_id',
|
|
154
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
155
|
+
typeArguments: options.typeArguments
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
/** Get open fee rate */
|
|
159
|
+
export function openFeeRate(options) {
|
|
160
|
+
var _a;
|
|
161
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
162
|
+
const argumentsTypes = [
|
|
163
|
+
null
|
|
164
|
+
];
|
|
165
|
+
const parameterNames = ["market"];
|
|
166
|
+
return (tx) => tx.moveCall({
|
|
167
|
+
package: packageAddress,
|
|
168
|
+
module: 'market',
|
|
169
|
+
function: 'open_fee_rate',
|
|
170
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
171
|
+
typeArguments: options.typeArguments
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
/** Get close fee rate */
|
|
175
|
+
export function closeFeeRate(options) {
|
|
176
|
+
var _a;
|
|
177
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
178
|
+
const argumentsTypes = [
|
|
179
|
+
null
|
|
180
|
+
];
|
|
181
|
+
const parameterNames = ["market"];
|
|
182
|
+
return (tx) => tx.moveCall({
|
|
183
|
+
package: packageAddress,
|
|
184
|
+
module: 'market',
|
|
185
|
+
function: 'close_fee_rate',
|
|
186
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
187
|
+
typeArguments: options.typeArguments
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/** Get fee recipient address */
|
|
191
|
+
export function feeRecipient(options) {
|
|
192
|
+
var _a;
|
|
193
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
194
|
+
const argumentsTypes = [
|
|
195
|
+
null
|
|
196
|
+
];
|
|
197
|
+
const parameterNames = ["market"];
|
|
198
|
+
return (tx) => tx.moveCall({
|
|
199
|
+
package: packageAddress,
|
|
200
|
+
module: 'market',
|
|
201
|
+
function: 'fee_recipient',
|
|
202
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
203
|
+
typeArguments: options.typeArguments
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
export function permissions(options) {
|
|
207
|
+
var _a;
|
|
208
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
209
|
+
const argumentsTypes = [
|
|
210
|
+
null
|
|
211
|
+
];
|
|
212
|
+
const parameterNames = ["market"];
|
|
213
|
+
return (tx) => tx.moveCall({
|
|
214
|
+
package: packageAddress,
|
|
215
|
+
module: 'market',
|
|
216
|
+
function: 'permissions',
|
|
217
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
218
|
+
typeArguments: options.typeArguments
|
|
219
|
+
});
|
|
220
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { MoveEnum } from '../utils/index.js';
|
|
5
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
6
|
+
export declare const Permission: MoveEnum<{
|
|
7
|
+
OpenPosition: null;
|
|
8
|
+
ClosePosition: null;
|
|
9
|
+
Deposit: null;
|
|
10
|
+
Borrow: null;
|
|
11
|
+
Withdraw: null;
|
|
12
|
+
Repay: null;
|
|
13
|
+
ClaimReward: null;
|
|
14
|
+
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::permissions::Permission">;
|
|
15
|
+
export interface OpenPositionOptions {
|
|
16
|
+
package?: string;
|
|
17
|
+
arguments?: [
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
export declare function openPosition(options?: OpenPositionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
21
|
+
export interface ClosePositionOptions {
|
|
22
|
+
package?: string;
|
|
23
|
+
arguments?: [
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
export declare function closePosition(options?: ClosePositionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
27
|
+
export interface DepositOptions {
|
|
28
|
+
package?: string;
|
|
29
|
+
arguments?: [
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
export declare function deposit(options?: DepositOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
33
|
+
export interface BorrowOptions {
|
|
34
|
+
package?: string;
|
|
35
|
+
arguments?: [
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
export declare function borrow(options?: BorrowOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
39
|
+
export interface WithdrawOptions {
|
|
40
|
+
package?: string;
|
|
41
|
+
arguments?: [
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
export declare function withdraw(options?: WithdrawOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
45
|
+
export interface RepayOptions {
|
|
46
|
+
package?: string;
|
|
47
|
+
arguments?: [
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
export declare function repay(options?: RepayOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
51
|
+
export interface ClaimRewardOptions {
|
|
52
|
+
package?: string;
|
|
53
|
+
arguments?: [
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
export declare function claimReward(options?: ClaimRewardOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { MoveEnum } from '../utils/index.js';
|
|
5
|
+
const $moduleName = '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::permissions';
|
|
6
|
+
export const Permission = new MoveEnum({ name: `${$moduleName}::Permission`, fields: {
|
|
7
|
+
OpenPosition: null,
|
|
8
|
+
ClosePosition: null,
|
|
9
|
+
Deposit: null,
|
|
10
|
+
Borrow: null,
|
|
11
|
+
Withdraw: null,
|
|
12
|
+
Repay: null,
|
|
13
|
+
ClaimReward: null
|
|
14
|
+
} });
|
|
15
|
+
export function openPosition(options = {}) {
|
|
16
|
+
var _a;
|
|
17
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
18
|
+
return (tx) => tx.moveCall({
|
|
19
|
+
package: packageAddress,
|
|
20
|
+
module: 'permissions',
|
|
21
|
+
function: 'open_position',
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export function closePosition(options = {}) {
|
|
25
|
+
var _a;
|
|
26
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
27
|
+
return (tx) => tx.moveCall({
|
|
28
|
+
package: packageAddress,
|
|
29
|
+
module: 'permissions',
|
|
30
|
+
function: 'close_position',
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export function deposit(options = {}) {
|
|
34
|
+
var _a;
|
|
35
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
36
|
+
return (tx) => tx.moveCall({
|
|
37
|
+
package: packageAddress,
|
|
38
|
+
module: 'permissions',
|
|
39
|
+
function: 'deposit',
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export function borrow(options = {}) {
|
|
43
|
+
var _a;
|
|
44
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
45
|
+
return (tx) => tx.moveCall({
|
|
46
|
+
package: packageAddress,
|
|
47
|
+
module: 'permissions',
|
|
48
|
+
function: 'borrow',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export function withdraw(options = {}) {
|
|
52
|
+
var _a;
|
|
53
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
54
|
+
return (tx) => tx.moveCall({
|
|
55
|
+
package: packageAddress,
|
|
56
|
+
module: 'permissions',
|
|
57
|
+
function: 'withdraw',
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export function repay(options = {}) {
|
|
61
|
+
var _a;
|
|
62
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
63
|
+
return (tx) => tx.moveCall({
|
|
64
|
+
package: packageAddress,
|
|
65
|
+
module: 'permissions',
|
|
66
|
+
function: 'repay',
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export function claimReward(options = {}) {
|
|
70
|
+
var _a;
|
|
71
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
72
|
+
return (tx) => tx.moveCall({
|
|
73
|
+
package: packageAddress,
|
|
74
|
+
module: 'permissions',
|
|
75
|
+
function: 'claim_reward',
|
|
76
|
+
});
|
|
77
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { MoveStruct, type RawTransactionArgument } from '../utils/index.js';
|
|
5
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
6
|
+
export declare const Position: MoveStruct<{
|
|
7
|
+
id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
8
|
+
is_long: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
|
|
9
|
+
obligation_owner_cap: MoveStruct<{
|
|
10
|
+
id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
11
|
+
obligation_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
12
|
+
}, "suilend::lending_market::ObligationOwnerCap<phantom P>">;
|
|
13
|
+
created_ts: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
14
|
+
owner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
15
|
+
market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
16
|
+
lending_market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
17
|
+
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::Position<phantom P>">;
|
|
18
|
+
export declare const PositionCap: MoveStruct<{
|
|
19
|
+
id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
20
|
+
position_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
21
|
+
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::PositionCap">;
|
|
22
|
+
export declare const OpenPositionEvent: MoveStruct<{
|
|
23
|
+
position_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
24
|
+
market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
25
|
+
obligation_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
26
|
+
is_long: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
|
|
27
|
+
collateral_coin_type: MoveStruct<{
|
|
28
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
29
|
+
}, "std::type_name::TypeName">;
|
|
30
|
+
loan_coin_type: MoveStruct<{
|
|
31
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
32
|
+
}, "std::type_name::TypeName">;
|
|
33
|
+
owner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
34
|
+
timestamp: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
35
|
+
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::OpenPositionEvent">;
|
|
36
|
+
export declare const ClosePositionEvent: MoveStruct<{
|
|
37
|
+
position_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
38
|
+
market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
39
|
+
owner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
40
|
+
timestamp: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
41
|
+
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::ClosePositionEvent">;
|
|
42
|
+
export declare const DepositEvent: MoveStruct<{
|
|
43
|
+
position_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
44
|
+
owner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
45
|
+
coin_type: MoveStruct<{
|
|
46
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
47
|
+
}, "std::type_name::TypeName">;
|
|
48
|
+
deposit_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
49
|
+
timestamp: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
50
|
+
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::DepositEvent">;
|
|
51
|
+
export declare const WithdrawEvent: MoveStruct<{
|
|
52
|
+
position_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
53
|
+
owner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
54
|
+
coin_type: MoveStruct<{
|
|
55
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
56
|
+
}, "std::type_name::TypeName">;
|
|
57
|
+
withdraw_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
58
|
+
timestamp: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
59
|
+
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::WithdrawEvent">;
|
|
60
|
+
export declare const BorrowEvent: MoveStruct<{
|
|
61
|
+
position_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
62
|
+
owner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
63
|
+
coin_type: MoveStruct<{
|
|
64
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
65
|
+
}, "std::type_name::TypeName">;
|
|
66
|
+
borrow_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
67
|
+
timestamp: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
68
|
+
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::BorrowEvent">;
|
|
69
|
+
export declare const RepayEvent: MoveStruct<{
|
|
70
|
+
position_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
71
|
+
owner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
72
|
+
repay_coin_type: MoveStruct<{
|
|
73
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
74
|
+
}, "std::type_name::TypeName">;
|
|
75
|
+
repay_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
76
|
+
timestamp: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
77
|
+
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::RepayEvent">;
|
|
78
|
+
export declare const ClaimRewardEvent: MoveStruct<{
|
|
79
|
+
position_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
80
|
+
owner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
81
|
+
reward_coin_type: MoveStruct<{
|
|
82
|
+
name: import("@mysten/bcs").BcsType<string, string, "string">;
|
|
83
|
+
}, "std::type_name::TypeName">;
|
|
84
|
+
reward_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
85
|
+
timestamp: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
86
|
+
}, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position::ClaimRewardEvent">;
|
|
87
|
+
export interface OwnerArguments {
|
|
88
|
+
position: RawTransactionArgument<string>;
|
|
89
|
+
}
|
|
90
|
+
export interface OwnerOptions {
|
|
91
|
+
package?: string;
|
|
92
|
+
arguments: OwnerArguments | [
|
|
93
|
+
position: RawTransactionArgument<string>
|
|
94
|
+
];
|
|
95
|
+
typeArguments: [
|
|
96
|
+
string
|
|
97
|
+
];
|
|
98
|
+
}
|
|
99
|
+
/** Get position owner */
|
|
100
|
+
export declare function owner(options: OwnerOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
101
|
+
export interface IsLongArguments {
|
|
102
|
+
position: RawTransactionArgument<string>;
|
|
103
|
+
}
|
|
104
|
+
export interface IsLongOptions {
|
|
105
|
+
package?: string;
|
|
106
|
+
arguments: IsLongArguments | [
|
|
107
|
+
position: RawTransactionArgument<string>
|
|
108
|
+
];
|
|
109
|
+
typeArguments: [
|
|
110
|
+
string
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
/** Check if it's a long position */
|
|
114
|
+
export declare function isLong(options: IsLongOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
115
|
+
export interface ObligationIdArguments {
|
|
116
|
+
position: RawTransactionArgument<string>;
|
|
117
|
+
}
|
|
118
|
+
export interface ObligationIdOptions {
|
|
119
|
+
package?: string;
|
|
120
|
+
arguments: ObligationIdArguments | [
|
|
121
|
+
position: RawTransactionArgument<string>
|
|
122
|
+
];
|
|
123
|
+
typeArguments: [
|
|
124
|
+
string
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
export declare function obligationId(options: ObligationIdOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
128
|
+
export interface LendingMarketIdArguments {
|
|
129
|
+
position: RawTransactionArgument<string>;
|
|
130
|
+
}
|
|
131
|
+
export interface LendingMarketIdOptions {
|
|
132
|
+
package?: string;
|
|
133
|
+
arguments: LendingMarketIdArguments | [
|
|
134
|
+
position: RawTransactionArgument<string>
|
|
135
|
+
];
|
|
136
|
+
typeArguments: [
|
|
137
|
+
string
|
|
138
|
+
];
|
|
139
|
+
}
|
|
140
|
+
export declare function lendingMarketId(options: LendingMarketIdOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
141
|
+
export interface MarketIdArguments {
|
|
142
|
+
position: RawTransactionArgument<string>;
|
|
143
|
+
}
|
|
144
|
+
export interface MarketIdOptions {
|
|
145
|
+
package?: string;
|
|
146
|
+
arguments: MarketIdArguments | [
|
|
147
|
+
position: RawTransactionArgument<string>
|
|
148
|
+
];
|
|
149
|
+
typeArguments: [
|
|
150
|
+
string
|
|
151
|
+
];
|
|
152
|
+
}
|
|
153
|
+
export declare function marketId(options: MarketIdOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { MoveStruct, normalizeMoveArguments } from '../utils/index.js';
|
|
5
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
6
|
+
import * as lending_market from './deps/suilend/lending_market.js';
|
|
7
|
+
import * as type_name from './deps/std/type_name.js';
|
|
8
|
+
const $moduleName = '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::position';
|
|
9
|
+
export const Position = new MoveStruct({ name: `${$moduleName}::Position<phantom P>`, fields: {
|
|
10
|
+
id: bcs.Address,
|
|
11
|
+
is_long: bcs.bool(),
|
|
12
|
+
obligation_owner_cap: lending_market.ObligationOwnerCap,
|
|
13
|
+
created_ts: bcs.u64(),
|
|
14
|
+
owner: bcs.Address,
|
|
15
|
+
market_id: bcs.Address,
|
|
16
|
+
lending_market_id: bcs.Address
|
|
17
|
+
} });
|
|
18
|
+
export const PositionCap = new MoveStruct({ name: `${$moduleName}::PositionCap`, fields: {
|
|
19
|
+
id: bcs.Address,
|
|
20
|
+
position_id: bcs.Address
|
|
21
|
+
} });
|
|
22
|
+
export const OpenPositionEvent = new MoveStruct({ name: `${$moduleName}::OpenPositionEvent`, fields: {
|
|
23
|
+
position_id: bcs.Address,
|
|
24
|
+
market_id: bcs.Address,
|
|
25
|
+
obligation_id: bcs.Address,
|
|
26
|
+
is_long: bcs.bool(),
|
|
27
|
+
collateral_coin_type: type_name.TypeName,
|
|
28
|
+
loan_coin_type: type_name.TypeName,
|
|
29
|
+
owner: bcs.Address,
|
|
30
|
+
timestamp: bcs.u64()
|
|
31
|
+
} });
|
|
32
|
+
export const ClosePositionEvent = new MoveStruct({ name: `${$moduleName}::ClosePositionEvent`, fields: {
|
|
33
|
+
position_id: bcs.Address,
|
|
34
|
+
market_id: bcs.Address,
|
|
35
|
+
owner: bcs.Address,
|
|
36
|
+
timestamp: bcs.u64()
|
|
37
|
+
} });
|
|
38
|
+
export const DepositEvent = new MoveStruct({ name: `${$moduleName}::DepositEvent`, fields: {
|
|
39
|
+
position_id: bcs.Address,
|
|
40
|
+
owner: bcs.Address,
|
|
41
|
+
coin_type: type_name.TypeName,
|
|
42
|
+
deposit_amount: bcs.u64(),
|
|
43
|
+
timestamp: bcs.u64()
|
|
44
|
+
} });
|
|
45
|
+
export const WithdrawEvent = new MoveStruct({ name: `${$moduleName}::WithdrawEvent`, fields: {
|
|
46
|
+
position_id: bcs.Address,
|
|
47
|
+
owner: bcs.Address,
|
|
48
|
+
coin_type: type_name.TypeName,
|
|
49
|
+
withdraw_amount: bcs.u64(),
|
|
50
|
+
timestamp: bcs.u64()
|
|
51
|
+
} });
|
|
52
|
+
export const BorrowEvent = new MoveStruct({ name: `${$moduleName}::BorrowEvent`, fields: {
|
|
53
|
+
position_id: bcs.Address,
|
|
54
|
+
owner: bcs.Address,
|
|
55
|
+
coin_type: type_name.TypeName,
|
|
56
|
+
borrow_amount: bcs.u64(),
|
|
57
|
+
timestamp: bcs.u64()
|
|
58
|
+
} });
|
|
59
|
+
export const RepayEvent = new MoveStruct({ name: `${$moduleName}::RepayEvent`, fields: {
|
|
60
|
+
position_id: bcs.Address,
|
|
61
|
+
owner: bcs.Address,
|
|
62
|
+
repay_coin_type: type_name.TypeName,
|
|
63
|
+
repay_amount: bcs.u64(),
|
|
64
|
+
timestamp: bcs.u64()
|
|
65
|
+
} });
|
|
66
|
+
export const ClaimRewardEvent = new MoveStruct({ name: `${$moduleName}::ClaimRewardEvent`, fields: {
|
|
67
|
+
position_id: bcs.Address,
|
|
68
|
+
owner: bcs.Address,
|
|
69
|
+
reward_coin_type: type_name.TypeName,
|
|
70
|
+
reward_amount: bcs.u64(),
|
|
71
|
+
timestamp: bcs.u64()
|
|
72
|
+
} });
|
|
73
|
+
/** Get position owner */
|
|
74
|
+
export function owner(options) {
|
|
75
|
+
var _a;
|
|
76
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
77
|
+
const argumentsTypes = [
|
|
78
|
+
null
|
|
79
|
+
];
|
|
80
|
+
const parameterNames = ["position"];
|
|
81
|
+
return (tx) => tx.moveCall({
|
|
82
|
+
package: packageAddress,
|
|
83
|
+
module: 'position',
|
|
84
|
+
function: 'owner',
|
|
85
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
86
|
+
typeArguments: options.typeArguments
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/** Check if it's a long position */
|
|
90
|
+
export function isLong(options) {
|
|
91
|
+
var _a;
|
|
92
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
93
|
+
const argumentsTypes = [
|
|
94
|
+
null
|
|
95
|
+
];
|
|
96
|
+
const parameterNames = ["position"];
|
|
97
|
+
return (tx) => tx.moveCall({
|
|
98
|
+
package: packageAddress,
|
|
99
|
+
module: 'position',
|
|
100
|
+
function: 'is_long',
|
|
101
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
102
|
+
typeArguments: options.typeArguments
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export function obligationId(options) {
|
|
106
|
+
var _a;
|
|
107
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
108
|
+
const argumentsTypes = [
|
|
109
|
+
null
|
|
110
|
+
];
|
|
111
|
+
const parameterNames = ["position"];
|
|
112
|
+
return (tx) => tx.moveCall({
|
|
113
|
+
package: packageAddress,
|
|
114
|
+
module: 'position',
|
|
115
|
+
function: 'obligation_id',
|
|
116
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
117
|
+
typeArguments: options.typeArguments
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
export function lendingMarketId(options) {
|
|
121
|
+
var _a;
|
|
122
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
123
|
+
const argumentsTypes = [
|
|
124
|
+
null
|
|
125
|
+
];
|
|
126
|
+
const parameterNames = ["position"];
|
|
127
|
+
return (tx) => tx.moveCall({
|
|
128
|
+
package: packageAddress,
|
|
129
|
+
module: 'position',
|
|
130
|
+
function: 'lending_market_id',
|
|
131
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
132
|
+
typeArguments: options.typeArguments
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
export function marketId(options) {
|
|
136
|
+
var _a;
|
|
137
|
+
const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53';
|
|
138
|
+
const argumentsTypes = [
|
|
139
|
+
null
|
|
140
|
+
];
|
|
141
|
+
const parameterNames = ["position"];
|
|
142
|
+
return (tx) => tx.moveCall({
|
|
143
|
+
package: packageAddress,
|
|
144
|
+
module: 'position',
|
|
145
|
+
function: 'market_id',
|
|
146
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
147
|
+
typeArguments: options.typeArguments
|
|
148
|
+
});
|
|
149
|
+
}
|