@typus/typus-perp-sdk 1.2.1 → 1.3.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/dist/src/client.d.ts +22 -3
- package/dist/src/client.js +66 -8
- package/dist/src/fetch.d.ts +61 -20
- package/dist/src/fetch.js +20 -14
- package/dist/src/generated/typus_perp/admin.d.ts +65 -21
- package/dist/src/generated/typus_perp/admin.js +139 -123
- package/dist/src/generated/typus_perp/competition.d.ts +5 -17
- package/dist/src/generated/typus_perp/competition.js +63 -39
- package/dist/src/generated/typus_perp/deps/std/type_name.d.ts +9 -9
- package/dist/src/generated/typus_perp/deps/std/type_name.js +13 -16
- package/dist/src/generated/typus_perp/deps/sui/balance.d.ts +2 -2
- package/dist/src/generated/typus_perp/deps/sui/balance.js +5 -8
- package/dist/src/generated/typus_perp/deps/sui/object.d.ts +8 -0
- package/dist/src/generated/typus_perp/deps/sui/object.js +13 -0
- package/dist/src/generated/typus_perp/deps/sui/object_table.d.ts +5 -3
- package/dist/src/generated/typus_perp/deps/sui/object_table.js +40 -9
- package/dist/src/generated/typus_perp/deps/sui/table.d.ts +5 -3
- package/dist/src/generated/typus_perp/deps/sui/table.js +40 -9
- package/dist/src/generated/typus_perp/deps/sui/vec_set.d.ts +5 -3
- package/dist/src/generated/typus_perp/deps/sui/vec_set.js +5 -8
- package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.d.ts +4 -2
- package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.js +9 -12
- package/dist/src/generated/typus_perp/deps/typus/linked_object_table.d.ts +12 -6
- package/dist/src/generated/typus_perp/deps/typus/linked_object_table.js +41 -10
- package/dist/src/generated/typus_perp/deps/typus_framework/vault.d.ts +4 -2
- package/dist/src/generated/typus_perp/deps/typus_framework/vault.js +40 -9
- package/dist/src/generated/typus_perp/error.d.ts +201 -94
- package/dist/src/generated/typus_perp/error.js +300 -273
- package/dist/src/generated/typus_perp/escrow.d.ts +14 -6
- package/dist/src/generated/typus_perp/escrow.js +38 -37
- package/dist/src/generated/typus_perp/lending.d.ts +1 -1
- package/dist/src/generated/typus_perp/lending.js +3 -3
- package/dist/src/generated/typus_perp/lp_pool.d.ts +438 -392
- package/dist/src/generated/typus_perp/lp_pool.js +987 -934
- package/dist/src/generated/typus_perp/math.d.ts +13 -16
- package/dist/src/generated/typus_perp/math.js +51 -50
- package/dist/src/generated/typus_perp/position.d.ts +194 -106
- package/dist/src/generated/typus_perp/position.js +714 -733
- package/dist/src/generated/typus_perp/profit_vault.d.ts +62 -20
- package/dist/src/generated/typus_perp/profit_vault.js +162 -148
- package/dist/src/generated/typus_perp/symbol.d.ts +12 -5
- package/dist/src/generated/typus_perp/symbol.js +28 -25
- package/dist/src/generated/typus_perp/trading.d.ts +956 -139
- package/dist/src/generated/typus_perp/trading.js +1577 -1151
- package/dist/src/generated/typus_perp/treasury_caps.d.ts +16 -7
- package/dist/src/generated/typus_perp/treasury_caps.js +60 -24
- package/dist/src/generated/typus_perp/user_account.d.ts +40 -0
- package/dist/src/generated/typus_perp/user_account.js +66 -0
- package/dist/src/generated/typus_stake_pool/admin.d.ts +144 -10
- package/dist/src/generated/typus_stake_pool/admin.js +132 -49
- package/dist/src/generated/typus_stake_pool/deps/std/type_name.d.ts +9 -9
- package/dist/src/generated/typus_stake_pool/deps/std/type_name.js +13 -16
- package/dist/src/generated/typus_stake_pool/deps/sui/object.d.ts +8 -0
- package/dist/src/generated/typus_stake_pool/deps/sui/object.js +13 -0
- package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.js +31 -0
- package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.d.ts +5 -3
- package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.js +5 -8
- package/dist/src/generated/typus_stake_pool/stake_pool.d.ts +180 -79
- package/dist/src/generated/typus_stake_pool/stake_pool.js +446 -414
- package/dist/src/generated/utils/index.d.ts +4 -23
- package/dist/src/generated/utils/index.js +34 -54
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +35 -13
- package/dist/src/user/order.d.ts +0 -4
- package/dist/src/user/order.js +31 -74
- package/dist/src/user/orderWithBidReceipt.d.ts +0 -3
- package/dist/src/user/orderWithBidReceipt.js +24 -45
- package/dist/src/user/tlp.d.ts +0 -5
- package/dist/src/user/tlp.js +28 -73
- package/package.json +42 -40
|
@@ -84,8 +84,6 @@ exports.calculateTradingFee = calculateTradingFee;
|
|
|
84
84
|
exports.splitBidReceipt = splitBidReceipt;
|
|
85
85
|
exports.isOptionCollateralPosition = isOptionCollateralPosition;
|
|
86
86
|
exports.emitRealizedFundingEvent = emitRealizedFundingEvent;
|
|
87
|
-
exports.checkPositionUpdateTimestamp = checkPositionUpdateTimestamp;
|
|
88
|
-
exports.checkPositionUpdateTimestamp_ = checkPositionUpdateTimestamp_;
|
|
89
87
|
exports.getPositionId = getPositionId;
|
|
90
88
|
exports.getPositionSize = getPositionSize;
|
|
91
89
|
exports.getPositionSide = getPositionSide;
|
|
@@ -108,39 +106,24 @@ exports.getMaxOrderTypeTag = getMaxOrderTypeTag;
|
|
|
108
106
|
* logic for creating, updating, and closing them. All of the functions are inner
|
|
109
107
|
* package functions used in `trading.move`.
|
|
110
108
|
*/
|
|
111
|
-
const
|
|
109
|
+
const index_1 = require("../utils/index");
|
|
112
110
|
const bcs_1 = require("@mysten/sui/bcs");
|
|
113
|
-
const type_name = __importStar(require("./deps/std/type_name
|
|
114
|
-
const
|
|
115
|
-
const symbol = __importStar(require("./symbol
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
const type_name_3 = __importStar(require("./deps/std/type_name.js"));
|
|
119
|
-
const symbol_2 = __importStar(require("./symbol.js"));
|
|
120
|
-
const type_name_4 = __importStar(require("./deps/std/type_name.js"));
|
|
121
|
-
const symbol_3 = __importStar(require("./symbol.js"));
|
|
122
|
-
const type_name_5 = __importStar(require("./deps/std/type_name.js"));
|
|
123
|
-
const symbol_4 = __importStar(require("./symbol.js"));
|
|
124
|
-
const $moduleName = "@typus/perp::position";
|
|
125
|
-
exports.OptionCollateralInfo = new index_js_1.MoveStruct({
|
|
126
|
-
name: `${$moduleName}::OptionCollateralInfo`,
|
|
127
|
-
fields: {
|
|
111
|
+
const type_name = __importStar(require("./deps/std/type_name"));
|
|
112
|
+
const object = __importStar(require("./deps/sui/object"));
|
|
113
|
+
const symbol = __importStar(require("./symbol"));
|
|
114
|
+
const $moduleName = '@typus/perp::position';
|
|
115
|
+
exports.OptionCollateralInfo = new index_1.MoveStruct({ name: `${$moduleName}::OptionCollateralInfo`, fields: {
|
|
128
116
|
/** The index of the portfolio. */
|
|
129
117
|
index: bcs_1.bcs.u64(),
|
|
130
118
|
/** The type name of the bid token. */
|
|
131
119
|
bid_token: type_name.TypeName,
|
|
132
120
|
/** A vector of the BCS-serialized bid receipts. */
|
|
133
|
-
bid_receipts_bcs: bcs_1.bcs.vector(bcs_1.bcs.vector(bcs_1.bcs.u8()))
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
name: `${$moduleName}::Position`,
|
|
138
|
-
fields: {
|
|
139
|
-
id: bcs_1.bcs.Address,
|
|
121
|
+
bid_receipts_bcs: bcs_1.bcs.vector(bcs_1.bcs.vector(bcs_1.bcs.u8()))
|
|
122
|
+
} });
|
|
123
|
+
exports.Position = new index_1.MoveStruct({ name: `${$moduleName}::Position`, fields: {
|
|
124
|
+
id: object.UID,
|
|
140
125
|
/** The timestamp when the position was created. */
|
|
141
126
|
create_ts_ms: bcs_1.bcs.u64(),
|
|
142
|
-
/** The timestamp when the position was last updated. */
|
|
143
|
-
update_ts_ms: bcs_1.bcs.u64(),
|
|
144
127
|
/** The ID of the position. */
|
|
145
128
|
position_id: bcs_1.bcs.u64(),
|
|
146
129
|
/** A vector of the linked order IDs. */
|
|
@@ -156,7 +139,7 @@ exports.Position = new index_js_1.MoveStruct({
|
|
|
156
139
|
/** The number of decimals for the size. */
|
|
157
140
|
size_decimal: bcs_1.bcs.u64(),
|
|
158
141
|
/** The type name of the collateral token. */
|
|
159
|
-
collateral_token:
|
|
142
|
+
collateral_token: type_name.TypeName,
|
|
160
143
|
/** The number of decimals for the collateral token. */
|
|
161
144
|
collateral_token_decimal: bcs_1.bcs.u64(),
|
|
162
145
|
/** The symbol of the trading pair. */
|
|
@@ -188,13 +171,10 @@ exports.Position = new index_js_1.MoveStruct({
|
|
|
188
171
|
/** Information about the option collateral. */
|
|
189
172
|
option_collateral_info: bcs_1.bcs.option(exports.OptionCollateralInfo),
|
|
190
173
|
/** Padding for future use. */
|
|
191
|
-
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
name: `${$moduleName}::TradingOrder`,
|
|
196
|
-
fields: {
|
|
197
|
-
id: bcs_1.bcs.Address,
|
|
174
|
+
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
|
|
175
|
+
} });
|
|
176
|
+
exports.TradingOrder = new index_1.MoveStruct({ name: `${$moduleName}::TradingOrder`, fields: {
|
|
177
|
+
id: object.UID,
|
|
198
178
|
/** The timestamp when the order was created. */
|
|
199
179
|
create_ts_ms: bcs_1.bcs.u64(),
|
|
200
180
|
/** The ID of the order. */
|
|
@@ -204,11 +184,11 @@ exports.TradingOrder = new index_js_1.MoveStruct({
|
|
|
204
184
|
/** The address of the user. */
|
|
205
185
|
user: bcs_1.bcs.Address,
|
|
206
186
|
/** The type name of the collateral token. */
|
|
207
|
-
collateral_token:
|
|
187
|
+
collateral_token: type_name.TypeName,
|
|
208
188
|
/** The number of decimals for the collateral token. */
|
|
209
189
|
collateral_token_decimal: bcs_1.bcs.u64(),
|
|
210
190
|
/** The symbol of the trading pair. */
|
|
211
|
-
symbol:
|
|
191
|
+
symbol: symbol.Symbol,
|
|
212
192
|
/** The leverage in mega basis points. */
|
|
213
193
|
leverage_mbp: bcs_1.bcs.u64(),
|
|
214
194
|
/** Whether the order is reduce-only. */
|
|
@@ -226,29 +206,23 @@ exports.TradingOrder = new index_js_1.MoveStruct({
|
|
|
226
206
|
/** The oracle price when the order was placed. */
|
|
227
207
|
oracle_price_when_placing: bcs_1.bcs.u64(),
|
|
228
208
|
/** Padding for future use. */
|
|
229
|
-
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
exports.RemovePositionEvent = new index_js_1.MoveStruct({
|
|
233
|
-
name: `${$moduleName}::RemovePositionEvent`,
|
|
234
|
-
fields: {
|
|
209
|
+
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
|
|
210
|
+
} });
|
|
211
|
+
exports.RemovePositionEvent = new index_1.MoveStruct({ name: `${$moduleName}::RemovePositionEvent`, fields: {
|
|
235
212
|
user: bcs_1.bcs.Address,
|
|
236
|
-
collateral_token:
|
|
237
|
-
symbol:
|
|
213
|
+
collateral_token: type_name.TypeName,
|
|
214
|
+
symbol: symbol.Symbol,
|
|
238
215
|
linked_order_ids: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
239
216
|
linked_order_prices: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
240
217
|
remaining_collateral_amount: bcs_1.bcs.u64(),
|
|
241
218
|
realized_trading_fee_amount: bcs_1.bcs.u64(),
|
|
242
219
|
realized_borrow_fee_amount: bcs_1.bcs.u64(),
|
|
243
|
-
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
exports.OrderFilledEvent = new index_js_1.MoveStruct({
|
|
247
|
-
name: `${$moduleName}::OrderFilledEvent`,
|
|
248
|
-
fields: {
|
|
220
|
+
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
|
|
221
|
+
} });
|
|
222
|
+
exports.OrderFilledEvent = new index_1.MoveStruct({ name: `${$moduleName}::OrderFilledEvent`, fields: {
|
|
249
223
|
user: bcs_1.bcs.Address,
|
|
250
|
-
collateral_token:
|
|
251
|
-
symbol:
|
|
224
|
+
collateral_token: type_name.TypeName,
|
|
225
|
+
symbol: symbol.Symbol,
|
|
252
226
|
order_id: bcs_1.bcs.u64(),
|
|
253
227
|
linked_position_id: bcs_1.bcs.option(bcs_1.bcs.u64()),
|
|
254
228
|
new_position_id: bcs_1.bcs.option(bcs_1.bcs.u64()),
|
|
@@ -262,534 +236,463 @@ exports.OrderFilledEvent = new index_js_1.MoveStruct({
|
|
|
262
236
|
realized_fee_in_usd: bcs_1.bcs.u64(),
|
|
263
237
|
realized_amount: bcs_1.bcs.u64(),
|
|
264
238
|
realized_amount_sign: bcs_1.bcs.bool(),
|
|
265
|
-
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
exports.RealizeFundingEvent = new index_js_1.MoveStruct({
|
|
269
|
-
name: `${$moduleName}::RealizeFundingEvent`,
|
|
270
|
-
fields: {
|
|
239
|
+
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
|
|
240
|
+
} });
|
|
241
|
+
exports.RealizeFundingEvent = new index_1.MoveStruct({ name: `${$moduleName}::RealizeFundingEvent`, fields: {
|
|
271
242
|
user: bcs_1.bcs.Address,
|
|
272
|
-
collateral_token:
|
|
273
|
-
symbol:
|
|
243
|
+
collateral_token: type_name.TypeName,
|
|
244
|
+
symbol: symbol.Symbol,
|
|
274
245
|
position_id: bcs_1.bcs.u64(),
|
|
275
246
|
realized_funding_sign: bcs_1.bcs.bool(),
|
|
276
247
|
realized_funding_fee: bcs_1.bcs.u64(),
|
|
277
248
|
realized_funding_fee_usd: bcs_1.bcs.u64(),
|
|
278
|
-
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
|
|
279
|
-
}
|
|
280
|
-
});
|
|
249
|
+
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
|
|
250
|
+
} });
|
|
281
251
|
/** Creates a new trading order. WARNING: no authority check inside */
|
|
282
252
|
function createOrder(options) {
|
|
283
|
-
const packageAddress = options.package ??
|
|
253
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
284
254
|
const argumentsTypes = [
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
];
|
|
301
|
-
const parameterNames = [
|
|
302
|
-
"version",
|
|
303
|
-
"symbol",
|
|
304
|
-
"leverageMbp",
|
|
305
|
-
"reduceOnly",
|
|
306
|
-
"isLong",
|
|
307
|
-
"isStopOrder",
|
|
308
|
-
"size",
|
|
309
|
-
"sizeDecimal",
|
|
310
|
-
"triggerPrice",
|
|
311
|
-
"collateral",
|
|
312
|
-
"collateralTokenDecimal",
|
|
313
|
-
"linkedPositionId",
|
|
314
|
-
"orderId",
|
|
315
|
-
"oraclePrice",
|
|
255
|
+
`${packageAddress}::admin::Version`,
|
|
256
|
+
`${packageAddress}::symbol::Symbol`,
|
|
257
|
+
'u64',
|
|
258
|
+
'bool',
|
|
259
|
+
'bool',
|
|
260
|
+
'bool',
|
|
261
|
+
'u64',
|
|
262
|
+
'u64',
|
|
263
|
+
'u64',
|
|
264
|
+
`0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[0]}>`,
|
|
265
|
+
'u64',
|
|
266
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
|
|
267
|
+
'u64',
|
|
268
|
+
'u64',
|
|
269
|
+
'0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
|
|
316
270
|
];
|
|
271
|
+
const parameterNames = ["version", "symbol", "leverageMbp", "reduceOnly", "isLong", "isStopOrder", "size", "sizeDecimal", "triggerPrice", "collateral", "collateralTokenDecimal", "linkedPositionId", "orderId", "oraclePrice"];
|
|
317
272
|
return (tx) => tx.moveCall({
|
|
318
273
|
package: packageAddress,
|
|
319
|
-
module:
|
|
320
|
-
function:
|
|
321
|
-
arguments: (0,
|
|
322
|
-
typeArguments: options.typeArguments
|
|
274
|
+
module: 'position',
|
|
275
|
+
function: 'create_order',
|
|
276
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
277
|
+
typeArguments: options.typeArguments
|
|
323
278
|
});
|
|
324
279
|
}
|
|
325
280
|
/** Removes a trading order. WARNING: no authority check inside */
|
|
326
281
|
function removeOrder(options) {
|
|
327
|
-
const packageAddress = options.package ??
|
|
328
|
-
const argumentsTypes = [
|
|
282
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
283
|
+
const argumentsTypes = [
|
|
284
|
+
`${packageAddress}::admin::Version`,
|
|
285
|
+
`${packageAddress}::position::TradingOrder`
|
|
286
|
+
];
|
|
329
287
|
const parameterNames = ["version", "order"];
|
|
330
288
|
return (tx) => tx.moveCall({
|
|
331
289
|
package: packageAddress,
|
|
332
|
-
module:
|
|
333
|
-
function:
|
|
334
|
-
arguments: (0,
|
|
335
|
-
typeArguments: options.typeArguments
|
|
290
|
+
module: 'position',
|
|
291
|
+
function: 'remove_order',
|
|
292
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
293
|
+
typeArguments: options.typeArguments
|
|
336
294
|
});
|
|
337
295
|
}
|
|
338
296
|
/** [Authorized Function] Creates a reduce-only order by the manager. */
|
|
339
297
|
function managerCreateReduceOnlyOrder(options) {
|
|
340
|
-
const packageAddress = options.package ??
|
|
298
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
341
299
|
const argumentsTypes = [
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
];
|
|
356
|
-
const parameterNames = [
|
|
357
|
-
"version",
|
|
358
|
-
"symbol",
|
|
359
|
-
"isLong",
|
|
360
|
-
"size",
|
|
361
|
-
"sizeDecimal",
|
|
362
|
-
"triggerPrice",
|
|
363
|
-
"collateral",
|
|
364
|
-
"collateralTokenDecimal",
|
|
365
|
-
"linkedPositionId",
|
|
366
|
-
"user",
|
|
367
|
-
"orderId",
|
|
368
|
-
"oraclePrice",
|
|
300
|
+
`${packageAddress}::admin::Version`,
|
|
301
|
+
`${packageAddress}::symbol::Symbol`,
|
|
302
|
+
'bool',
|
|
303
|
+
'u64',
|
|
304
|
+
'u64',
|
|
305
|
+
'u64',
|
|
306
|
+
`0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[0]}>`,
|
|
307
|
+
'u64',
|
|
308
|
+
'u64',
|
|
309
|
+
'address',
|
|
310
|
+
'u64',
|
|
311
|
+
'u64',
|
|
312
|
+
'0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
|
|
369
313
|
];
|
|
314
|
+
const parameterNames = ["version", "symbol", "isLong", "size", "sizeDecimal", "triggerPrice", "collateral", "collateralTokenDecimal", "linkedPositionId", "user", "orderId", "oraclePrice"];
|
|
370
315
|
return (tx) => tx.moveCall({
|
|
371
316
|
package: packageAddress,
|
|
372
|
-
module:
|
|
373
|
-
function:
|
|
374
|
-
arguments: (0,
|
|
375
|
-
typeArguments: options.typeArguments
|
|
317
|
+
module: 'position',
|
|
318
|
+
function: 'manager_create_reduce_only_order',
|
|
319
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
320
|
+
typeArguments: options.typeArguments
|
|
376
321
|
});
|
|
377
322
|
}
|
|
378
323
|
/** Increases the collateral of a position. WARNING: no authority check inside */
|
|
379
324
|
function increaseCollateral(options) {
|
|
380
|
-
const packageAddress = options.package ??
|
|
381
|
-
const argumentsTypes = [
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
"tradingPairOraclePriceDecimal",
|
|
325
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
326
|
+
const argumentsTypes = [
|
|
327
|
+
`${packageAddress}::position::Position`,
|
|
328
|
+
`0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[0]}>`,
|
|
329
|
+
'u64',
|
|
330
|
+
'u64',
|
|
331
|
+
'u64',
|
|
332
|
+
'u64'
|
|
389
333
|
];
|
|
334
|
+
const parameterNames = ["position", "collateral", "collateralOraclePrice", "collateralOraclePriceDecimal", "tradingPairOraclePrice", "tradingPairOraclePriceDecimal"];
|
|
390
335
|
return (tx) => tx.moveCall({
|
|
391
336
|
package: packageAddress,
|
|
392
|
-
module:
|
|
393
|
-
function:
|
|
394
|
-
arguments: (0,
|
|
395
|
-
typeArguments: options.typeArguments
|
|
337
|
+
module: 'position',
|
|
338
|
+
function: 'increase_collateral',
|
|
339
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
340
|
+
typeArguments: options.typeArguments
|
|
396
341
|
});
|
|
397
342
|
}
|
|
398
343
|
/** Releases collateral from a position. WARNING: no authority check inside */
|
|
399
344
|
function releaseCollateral(options) {
|
|
400
|
-
const packageAddress = options.package ??
|
|
401
|
-
const argumentsTypes = [
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
"tradingPairOraclePriceDecimal",
|
|
345
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
346
|
+
const argumentsTypes = [
|
|
347
|
+
`${packageAddress}::position::Position`,
|
|
348
|
+
'u64',
|
|
349
|
+
'u64',
|
|
350
|
+
'u64',
|
|
351
|
+
'u64',
|
|
352
|
+
'u64'
|
|
409
353
|
];
|
|
354
|
+
const parameterNames = ["position", "releaseAmount", "collateralOraclePrice", "collateralOraclePriceDecimal", "tradingPairOraclePrice", "tradingPairOraclePriceDecimal"];
|
|
410
355
|
return (tx) => tx.moveCall({
|
|
411
356
|
package: packageAddress,
|
|
412
|
-
module:
|
|
413
|
-
function:
|
|
414
|
-
arguments: (0,
|
|
415
|
-
typeArguments: options.typeArguments
|
|
357
|
+
module: 'position',
|
|
358
|
+
function: 'release_collateral',
|
|
359
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
360
|
+
typeArguments: options.typeArguments
|
|
416
361
|
});
|
|
417
362
|
}
|
|
418
363
|
/** Removes a position. WARNING: no authority check inside */
|
|
419
364
|
function removePosition(options) {
|
|
420
|
-
const packageAddress = options.package ??
|
|
421
|
-
const argumentsTypes = [
|
|
365
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
366
|
+
const argumentsTypes = [
|
|
367
|
+
`${packageAddress}::admin::Version`,
|
|
368
|
+
`${packageAddress}::position::Position`
|
|
369
|
+
];
|
|
422
370
|
const parameterNames = ["version", "position"];
|
|
423
371
|
return (tx) => tx.moveCall({
|
|
424
372
|
package: packageAddress,
|
|
425
|
-
module:
|
|
426
|
-
function:
|
|
427
|
-
arguments: (0,
|
|
428
|
-
typeArguments: options.typeArguments
|
|
373
|
+
module: 'position',
|
|
374
|
+
function: 'remove_position',
|
|
375
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
376
|
+
typeArguments: options.typeArguments
|
|
429
377
|
});
|
|
430
378
|
}
|
|
431
379
|
/** Handles a filled order. WARNING: no authority check inside */
|
|
432
380
|
function orderFilled(options) {
|
|
433
|
-
const packageAddress = options.package ??
|
|
381
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
434
382
|
const argumentsTypes = [
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
"version",
|
|
455
|
-
"ecosystemVersion",
|
|
456
|
-
"typusLeaderboardRegistry",
|
|
457
|
-
"tailsStakingRegistry",
|
|
458
|
-
"competitionConfig",
|
|
459
|
-
"order",
|
|
460
|
-
"originalPosition",
|
|
461
|
-
"nextPositionId",
|
|
462
|
-
"collateralOraclePrice",
|
|
463
|
-
"collateralOraclePriceDecimal",
|
|
464
|
-
"tradingPairOraclePrice",
|
|
465
|
-
"tradingPairOraclePriceDecimal",
|
|
466
|
-
"cumulativeBorrowRate",
|
|
467
|
-
"cumulativeFundingRateIndexSign",
|
|
468
|
-
"cumulativeFundingRateIndex",
|
|
469
|
-
"tradingFeeMbp",
|
|
383
|
+
`${packageAddress}::admin::Version`,
|
|
384
|
+
'0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::ecosystem::Version',
|
|
385
|
+
'0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::leaderboard::TypusLeaderboardRegistry',
|
|
386
|
+
'0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::tails_staking::TailsStakingRegistry',
|
|
387
|
+
`${packageAddress}::competition::CompetitionConfig`,
|
|
388
|
+
`${packageAddress}::position::TradingOrder`,
|
|
389
|
+
`0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<${packageAddress}::position::Position>`,
|
|
390
|
+
'u64',
|
|
391
|
+
'u64',
|
|
392
|
+
'u64',
|
|
393
|
+
'u64',
|
|
394
|
+
'u64',
|
|
395
|
+
'u64',
|
|
396
|
+
'bool',
|
|
397
|
+
'u64',
|
|
398
|
+
'u64',
|
|
399
|
+
'u64',
|
|
400
|
+
'u64',
|
|
401
|
+
'0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
|
|
470
402
|
];
|
|
403
|
+
const parameterNames = ["version", "ecosystemVersion", "typusLeaderboardRegistry", "tailsStakingRegistry", "competitionConfig", "order", "originalPosition", "nextPositionId", "collateralOraclePrice", "collateralOraclePriceDecimal", "tradingPairOraclePrice", "tradingPairOraclePriceDecimal", "cumulativeBorrowRate", "cumulativeFundingRateIndexSign", "cumulativeFundingRateIndex", "tradingFeeMbp", "referralCodeId", "feeReductionBp"];
|
|
471
404
|
return (tx) => tx.moveCall({
|
|
472
405
|
package: packageAddress,
|
|
473
|
-
module:
|
|
474
|
-
function:
|
|
475
|
-
arguments: (0,
|
|
476
|
-
typeArguments: options.typeArguments
|
|
406
|
+
module: 'position',
|
|
407
|
+
function: 'order_filled',
|
|
408
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
409
|
+
typeArguments: options.typeArguments
|
|
477
410
|
});
|
|
478
411
|
}
|
|
479
412
|
/** Realizes the PnL and fees of a position. WARNING: no authority check inside */
|
|
480
413
|
function realizePositionPnlAndFee(options) {
|
|
481
|
-
const packageAddress = options.package ??
|
|
482
|
-
const argumentsTypes = [
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
"collateralOraclePriceDecimal",
|
|
414
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
415
|
+
const argumentsTypes = [
|
|
416
|
+
`${packageAddress}::admin::Version`,
|
|
417
|
+
`${packageAddress}::lp_pool::LiquidityPool`,
|
|
418
|
+
`${packageAddress}::position::Position`,
|
|
419
|
+
'u64',
|
|
420
|
+
'u64',
|
|
421
|
+
'u64',
|
|
422
|
+
'u64',
|
|
423
|
+
'u64',
|
|
424
|
+
'u64'
|
|
493
425
|
];
|
|
426
|
+
const parameterNames = ["version", "liquidityPool", "position", "profitValueToRealize", "lossValueToRealize", "originalReserve", "protocolFeeShareBp", "collateralOraclePrice", "collateralOraclePriceDecimal"];
|
|
494
427
|
return (tx) => tx.moveCall({
|
|
495
428
|
package: packageAddress,
|
|
496
|
-
module:
|
|
497
|
-
function:
|
|
498
|
-
arguments: (0,
|
|
499
|
-
typeArguments: options.typeArguments
|
|
429
|
+
module: 'position',
|
|
430
|
+
function: 'realize_position_pnl_and_fee',
|
|
431
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
432
|
+
typeArguments: options.typeArguments
|
|
500
433
|
});
|
|
501
434
|
}
|
|
502
435
|
/** Realizes the funding fee of a position. WARNING: no authority check inside */
|
|
503
436
|
function realizeFundingFee(options) {
|
|
504
|
-
const packageAddress = options.package ??
|
|
505
|
-
const argumentsTypes = [
|
|
437
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
438
|
+
const argumentsTypes = [
|
|
439
|
+
`${packageAddress}::lp_pool::LiquidityPool`,
|
|
440
|
+
`${packageAddress}::position::Position`,
|
|
441
|
+
'u64',
|
|
442
|
+
'u64'
|
|
443
|
+
];
|
|
506
444
|
const parameterNames = ["liquidityPool", "position", "collateralOraclePrice", "collateralOraclePriceDecimal"];
|
|
507
445
|
return (tx) => tx.moveCall({
|
|
508
446
|
package: packageAddress,
|
|
509
|
-
module:
|
|
510
|
-
function:
|
|
511
|
-
arguments: (0,
|
|
512
|
-
typeArguments: options.typeArguments
|
|
447
|
+
module: 'position',
|
|
448
|
+
function: 'realize_funding_fee',
|
|
449
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
450
|
+
typeArguments: options.typeArguments
|
|
513
451
|
});
|
|
514
452
|
}
|
|
515
453
|
function checkOrderFilled(options) {
|
|
516
|
-
const packageAddress = options.package ??
|
|
517
|
-
const argumentsTypes = [
|
|
454
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
455
|
+
const argumentsTypes = [
|
|
456
|
+
`${packageAddress}::position::TradingOrder`,
|
|
457
|
+
'u64'
|
|
458
|
+
];
|
|
518
459
|
const parameterNames = ["order", "oraclePrice"];
|
|
519
460
|
return (tx) => tx.moveCall({
|
|
520
461
|
package: packageAddress,
|
|
521
|
-
module:
|
|
522
|
-
function:
|
|
523
|
-
arguments: (0,
|
|
462
|
+
module: 'position',
|
|
463
|
+
function: 'check_order_filled',
|
|
464
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
524
465
|
});
|
|
525
466
|
}
|
|
526
467
|
function calculatePeriodBorrowCost(options) {
|
|
527
|
-
const packageAddress = options.package ??
|
|
528
|
-
const argumentsTypes = [
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
"cumulativeBorrowRate",
|
|
468
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
469
|
+
const argumentsTypes = [
|
|
470
|
+
`${packageAddress}::position::Position`,
|
|
471
|
+
'u64',
|
|
472
|
+
'u64',
|
|
473
|
+
'u64',
|
|
474
|
+
'u64',
|
|
475
|
+
'u64'
|
|
536
476
|
];
|
|
477
|
+
const parameterNames = ["position", "collateralOraclePrice", "collateralOraclePriceDecimal", "tradingPairOraclePrice", "tradingPairOraclePriceDecimal", "cumulativeBorrowRate"];
|
|
537
478
|
return (tx) => tx.moveCall({
|
|
538
479
|
package: packageAddress,
|
|
539
|
-
module:
|
|
540
|
-
function:
|
|
541
|
-
arguments: (0,
|
|
480
|
+
module: 'position',
|
|
481
|
+
function: 'calculate_period_borrow_cost',
|
|
482
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
542
483
|
});
|
|
543
484
|
}
|
|
544
485
|
function checkPositionLiquidated(options) {
|
|
545
|
-
const packageAddress = options.package ??
|
|
546
|
-
const argumentsTypes = [
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
"cumulativeFundingRateIndex",
|
|
486
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
487
|
+
const argumentsTypes = [
|
|
488
|
+
`${packageAddress}::position::Position`,
|
|
489
|
+
'u64',
|
|
490
|
+
'u64',
|
|
491
|
+
'u64',
|
|
492
|
+
'u64',
|
|
493
|
+
'u64',
|
|
494
|
+
'u64',
|
|
495
|
+
'u64',
|
|
496
|
+
'bool',
|
|
497
|
+
'u64'
|
|
558
498
|
];
|
|
499
|
+
const parameterNames = ["position", "collateralOraclePrice", "collateralOraclePriceDecimal", "tradingPairOraclePrice", "tradingPairOraclePriceDecimal", "tradingFeeMbp", "maintenanceMarginRateBp", "cumulativeBorrowRate", "cumulativeFundingRateIndexSign", "cumulativeFundingRateIndex"];
|
|
559
500
|
return (tx) => tx.moveCall({
|
|
560
501
|
package: packageAddress,
|
|
561
|
-
module:
|
|
562
|
-
function:
|
|
563
|
-
arguments: (0,
|
|
502
|
+
module: 'position',
|
|
503
|
+
function: 'check_position_liquidated',
|
|
504
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
564
505
|
});
|
|
565
506
|
}
|
|
566
507
|
function calculateUnrealizedPnl(options) {
|
|
567
|
-
const packageAddress = options.package ??
|
|
568
|
-
const argumentsTypes = [
|
|
508
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
509
|
+
const argumentsTypes = [
|
|
510
|
+
`${packageAddress}::position::Position`,
|
|
511
|
+
'u64',
|
|
512
|
+
'u64',
|
|
513
|
+
'u64'
|
|
514
|
+
];
|
|
569
515
|
const parameterNames = ["position", "tradingPairOraclePrice", "tradingPairOraclePriceDecimal", "tradingFeeMbp"];
|
|
570
516
|
return (tx) => tx.moveCall({
|
|
571
517
|
package: packageAddress,
|
|
572
|
-
module:
|
|
573
|
-
function:
|
|
574
|
-
arguments: (0,
|
|
518
|
+
module: 'position',
|
|
519
|
+
function: 'calculate_unrealized_pnl',
|
|
520
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
575
521
|
});
|
|
576
522
|
}
|
|
577
523
|
function maxReleasingCollateralAmount(options) {
|
|
578
|
-
const packageAddress = options.package ??
|
|
579
|
-
const argumentsTypes = [
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
"maxEntryLeverageMbp",
|
|
524
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
525
|
+
const argumentsTypes = [
|
|
526
|
+
`${packageAddress}::position::Position`,
|
|
527
|
+
'u64',
|
|
528
|
+
'u64',
|
|
529
|
+
'u64',
|
|
530
|
+
'u64',
|
|
531
|
+
'u64',
|
|
532
|
+
'u64',
|
|
533
|
+
'u64'
|
|
589
534
|
];
|
|
535
|
+
const parameterNames = ["position", "collateralOraclePrice", "collateralOraclePriceDecimal", "tradingPairOraclePrice", "tradingPairOraclePriceDecimal", "tradingFeeMbp", "cumulativeBorrowRate", "maxEntryLeverageMbp"];
|
|
590
536
|
return (tx) => tx.moveCall({
|
|
591
537
|
package: packageAddress,
|
|
592
|
-
module:
|
|
593
|
-
function:
|
|
594
|
-
arguments: (0,
|
|
538
|
+
module: 'position',
|
|
539
|
+
function: 'max_releasing_collateral_amount',
|
|
540
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
595
541
|
});
|
|
596
542
|
}
|
|
597
543
|
function getEstimatedLiquidationPrice(options) {
|
|
598
|
-
const packageAddress = options.package ??
|
|
599
|
-
const argumentsTypes = [
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
"maintenanceMarginRateBp",
|
|
544
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
545
|
+
const argumentsTypes = [
|
|
546
|
+
`${packageAddress}::position::Position`,
|
|
547
|
+
'bool',
|
|
548
|
+
'u64',
|
|
549
|
+
'u64',
|
|
550
|
+
'u64',
|
|
551
|
+
'u64',
|
|
552
|
+
'u64'
|
|
608
553
|
];
|
|
554
|
+
const parameterNames = ["position", "isSameToken", "collateralOraclePrice", "collateralOraclePriceDecimal", "tradingOraclePriceDecimal", "tradingFeeMbp", "maintenanceMarginRateBp"];
|
|
609
555
|
return (tx) => tx.moveCall({
|
|
610
556
|
package: packageAddress,
|
|
611
|
-
module:
|
|
612
|
-
function:
|
|
613
|
-
arguments: (0,
|
|
557
|
+
module: 'position',
|
|
558
|
+
function: 'get_estimated_liquidation_price',
|
|
559
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
614
560
|
});
|
|
615
561
|
}
|
|
616
562
|
function createOrderWithBidReceipts(options) {
|
|
617
|
-
const packageAddress = options.package ??
|
|
563
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
618
564
|
const argumentsTypes = [
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
];
|
|
638
|
-
const parameterNames = [
|
|
639
|
-
"version",
|
|
640
|
-
"symbol",
|
|
641
|
-
"portfolioIndex",
|
|
642
|
-
"depositToken",
|
|
643
|
-
"leverageMbp",
|
|
644
|
-
"reduceOnly",
|
|
645
|
-
"isLong",
|
|
646
|
-
"isStopOrder",
|
|
647
|
-
"size",
|
|
648
|
-
"sizeDecimal",
|
|
649
|
-
"triggerPrice",
|
|
650
|
-
"collateralBidReceipts",
|
|
651
|
-
"depositTokenDecimal",
|
|
652
|
-
"linkedPositionId",
|
|
653
|
-
"orderId",
|
|
654
|
-
"oraclePrice",
|
|
655
|
-
"user",
|
|
565
|
+
`${packageAddress}::admin::Version`,
|
|
566
|
+
`${packageAddress}::symbol::Symbol`,
|
|
567
|
+
'u64',
|
|
568
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName',
|
|
569
|
+
'u64',
|
|
570
|
+
'bool',
|
|
571
|
+
'bool',
|
|
572
|
+
'bool',
|
|
573
|
+
'u64',
|
|
574
|
+
'u64',
|
|
575
|
+
'u64',
|
|
576
|
+
'vector<0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded::vault::TypusBidReceipt>',
|
|
577
|
+
'u64',
|
|
578
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>',
|
|
579
|
+
'u64',
|
|
580
|
+
'u64',
|
|
581
|
+
'address',
|
|
582
|
+
'0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
|
|
656
583
|
];
|
|
584
|
+
const parameterNames = ["version", "symbol", "portfolioIndex", "depositToken", "leverageMbp", "reduceOnly", "isLong", "isStopOrder", "size", "sizeDecimal", "triggerPrice", "collateralBidReceipts", "depositTokenDecimal", "linkedPositionId", "orderId", "oraclePrice", "user"];
|
|
657
585
|
return (tx) => tx.moveCall({
|
|
658
586
|
package: packageAddress,
|
|
659
|
-
module:
|
|
660
|
-
function:
|
|
661
|
-
arguments: (0,
|
|
587
|
+
module: 'position',
|
|
588
|
+
function: 'create_order_with_bid_receipts',
|
|
589
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
662
590
|
});
|
|
663
591
|
}
|
|
664
592
|
function removePositionWithBidReceipts(options) {
|
|
665
|
-
const packageAddress = options.package ??
|
|
666
|
-
const argumentsTypes = [
|
|
593
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
594
|
+
const argumentsTypes = [
|
|
595
|
+
`${packageAddress}::admin::Version`,
|
|
596
|
+
`${packageAddress}::position::Position`
|
|
597
|
+
];
|
|
667
598
|
const parameterNames = ["version", "position"];
|
|
668
599
|
return (tx) => tx.moveCall({
|
|
669
600
|
package: packageAddress,
|
|
670
|
-
module:
|
|
671
|
-
function:
|
|
672
|
-
arguments: (0,
|
|
601
|
+
module: 'position',
|
|
602
|
+
function: 'remove_position_with_bid_receipts',
|
|
603
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
673
604
|
});
|
|
674
605
|
}
|
|
675
606
|
function orderFilledWithBidReceiptsCollateral(options) {
|
|
676
|
-
const packageAddress = options.package ??
|
|
607
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
677
608
|
const argumentsTypes = [
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
const parameterNames = [
|
|
701
|
-
"version",
|
|
702
|
-
"ecosystemVersion",
|
|
703
|
-
"typusLeaderboardRegistry",
|
|
704
|
-
"tailsStakingRegistry",
|
|
705
|
-
"competitionConfig",
|
|
706
|
-
"liquidityPool",
|
|
707
|
-
"dovRegistry",
|
|
708
|
-
"typusOracleTradingSymbol",
|
|
709
|
-
"typusOracleCToken",
|
|
710
|
-
"order",
|
|
711
|
-
"originalPosition",
|
|
712
|
-
"nextPositionId",
|
|
713
|
-
"collateralOraclePrice",
|
|
714
|
-
"collateralOraclePriceDecimal",
|
|
715
|
-
"tradingPairOraclePrice",
|
|
716
|
-
"tradingPairOraclePriceDecimal",
|
|
717
|
-
"cumulativeBorrowRate",
|
|
718
|
-
"cumulativeFundingRateIndexSign",
|
|
719
|
-
"cumulativeFundingRateIndex",
|
|
720
|
-
"tradingFeeMbp",
|
|
609
|
+
`${packageAddress}::admin::Version`,
|
|
610
|
+
'0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::ecosystem::Version',
|
|
611
|
+
'0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::leaderboard::TypusLeaderboardRegistry',
|
|
612
|
+
'0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::tails_staking::TailsStakingRegistry',
|
|
613
|
+
`${packageAddress}::competition::CompetitionConfig`,
|
|
614
|
+
`${packageAddress}::lp_pool::LiquidityPool`,
|
|
615
|
+
'0x02821e55ac15f878ebc46f5bbd611de4d683c70e6308abb78880fd7f9d1d98ed::typus_dov_single::Registry',
|
|
616
|
+
'0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
|
|
617
|
+
`${packageAddress}::position::TradingOrder`,
|
|
618
|
+
`0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<${packageAddress}::position::Position>`,
|
|
619
|
+
'u64',
|
|
620
|
+
'u64',
|
|
621
|
+
'u64',
|
|
622
|
+
'u64',
|
|
623
|
+
'u64',
|
|
624
|
+
'u64',
|
|
625
|
+
'bool',
|
|
626
|
+
'u64',
|
|
627
|
+
'u64',
|
|
628
|
+
'u64',
|
|
629
|
+
'u64',
|
|
630
|
+
'0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
|
|
721
631
|
];
|
|
632
|
+
const parameterNames = ["version", "ecosystemVersion", "typusLeaderboardRegistry", "tailsStakingRegistry", "competitionConfig", "liquidityPool", "dovRegistry", "oracleV2", "order", "originalPosition", "nextPositionId", "collateralOraclePrice", "collateralOraclePriceDecimal", "tradingPairOraclePrice", "tradingPairOraclePriceDecimal", "cumulativeBorrowRate", "cumulativeFundingRateIndexSign", "cumulativeFundingRateIndex", "tradingFeeMbp", "referralCodeId", "feeReductionBp"];
|
|
722
633
|
return (tx) => tx.moveCall({
|
|
723
634
|
package: packageAddress,
|
|
724
|
-
module:
|
|
725
|
-
function:
|
|
726
|
-
arguments: (0,
|
|
727
|
-
typeArguments: options.typeArguments
|
|
635
|
+
module: 'position',
|
|
636
|
+
function: 'order_filled_with_bid_receipts_collateral',
|
|
637
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
638
|
+
typeArguments: options.typeArguments
|
|
728
639
|
});
|
|
729
640
|
}
|
|
730
641
|
function checkOptionCollateralPositionLiquidated(options) {
|
|
731
|
-
const packageAddress = options.package ??
|
|
642
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
732
643
|
const argumentsTypes = [
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
"0x2::clock::Clock",
|
|
747
|
-
];
|
|
748
|
-
const parameterNames = [
|
|
749
|
-
"dovRegistry",
|
|
750
|
-
"typusOracleTradingSymbol",
|
|
751
|
-
"typusOracleCToken",
|
|
752
|
-
"position",
|
|
753
|
-
"collateralOraclePrice",
|
|
754
|
-
"collateralOraclePriceDecimal",
|
|
755
|
-
"tradingPairOraclePrice",
|
|
756
|
-
"tradingPairOraclePriceDecimal",
|
|
757
|
-
"tradingFeeMbp",
|
|
758
|
-
"maintenanceMarginRateBp",
|
|
759
|
-
"cumulativeBorrowRate",
|
|
760
|
-
"cumulativeFundingRateIndexSign",
|
|
761
|
-
"cumulativeFundingRateIndex",
|
|
644
|
+
'0x02821e55ac15f878ebc46f5bbd611de4d683c70e6308abb78880fd7f9d1d98ed::typus_dov_single::Registry',
|
|
645
|
+
'0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
|
|
646
|
+
`${packageAddress}::position::Position`,
|
|
647
|
+
'u64',
|
|
648
|
+
'u64',
|
|
649
|
+
'u64',
|
|
650
|
+
'u64',
|
|
651
|
+
'u64',
|
|
652
|
+
'u64',
|
|
653
|
+
'u64',
|
|
654
|
+
'bool',
|
|
655
|
+
'u64',
|
|
656
|
+
'0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
|
|
762
657
|
];
|
|
658
|
+
const parameterNames = ["dovRegistry", "oracleV2", "position", "collateralOraclePrice", "collateralOraclePriceDecimal", "tradingPairOraclePrice", "tradingPairOraclePriceDecimal", "tradingFeeMbp", "maintenanceMarginRateBp", "cumulativeBorrowRate", "cumulativeFundingRateIndexSign", "cumulativeFundingRateIndex"];
|
|
763
659
|
return (tx) => tx.moveCall({
|
|
764
660
|
package: packageAddress,
|
|
765
|
-
module:
|
|
766
|
-
function:
|
|
767
|
-
arguments: (0,
|
|
768
|
-
typeArguments: options.typeArguments
|
|
661
|
+
module: 'position',
|
|
662
|
+
function: 'check_option_collateral_position_liquidated',
|
|
663
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
664
|
+
typeArguments: options.typeArguments
|
|
769
665
|
});
|
|
770
666
|
}
|
|
771
667
|
/** Adds linked order info to a position. WARNING: no authority check inside */
|
|
772
668
|
function addPositionLinkedOrderInfo(options) {
|
|
773
|
-
const packageAddress = options.package ??
|
|
774
|
-
const argumentsTypes = [
|
|
669
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
670
|
+
const argumentsTypes = [
|
|
671
|
+
`${packageAddress}::position::Position`,
|
|
672
|
+
'u64',
|
|
673
|
+
'u64'
|
|
674
|
+
];
|
|
775
675
|
const parameterNames = ["position", "linkedOrderId", "linkedOrderPrice"];
|
|
776
676
|
return (tx) => tx.moveCall({
|
|
777
677
|
package: packageAddress,
|
|
778
|
-
module:
|
|
779
|
-
function:
|
|
780
|
-
arguments: (0,
|
|
678
|
+
module: 'position',
|
|
679
|
+
function: 'add_position_linked_order_info',
|
|
680
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
781
681
|
});
|
|
782
682
|
}
|
|
783
683
|
/** Removes linked order info from a position. WARNING: no authority check inside */
|
|
784
684
|
function removePositionLinkedOrderInfo(options) {
|
|
785
|
-
const packageAddress = options.package ??
|
|
786
|
-
const argumentsTypes = [
|
|
685
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
686
|
+
const argumentsTypes = [
|
|
687
|
+
`${packageAddress}::position::Position`,
|
|
688
|
+
'u64'
|
|
689
|
+
];
|
|
787
690
|
const parameterNames = ["position", "linkedOrderId"];
|
|
788
691
|
return (tx) => tx.moveCall({
|
|
789
692
|
package: packageAddress,
|
|
790
|
-
module:
|
|
791
|
-
function:
|
|
792
|
-
arguments: (0,
|
|
693
|
+
module: 'position',
|
|
694
|
+
function: 'remove_position_linked_order_info',
|
|
695
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
793
696
|
});
|
|
794
697
|
}
|
|
795
698
|
/**
|
|
@@ -797,23 +700,23 @@ function removePositionLinkedOrderInfo(options) {
|
|
|
797
700
|
* check inside
|
|
798
701
|
*/
|
|
799
702
|
function updatePositionBorrowRateAndFundingRate(options) {
|
|
800
|
-
const packageAddress = options.package ??
|
|
801
|
-
const argumentsTypes = [
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
"cumulativeFundingRateIndex",
|
|
703
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
704
|
+
const argumentsTypes = [
|
|
705
|
+
`${packageAddress}::position::Position`,
|
|
706
|
+
'u64',
|
|
707
|
+
'u64',
|
|
708
|
+
'u64',
|
|
709
|
+
'u64',
|
|
710
|
+
'u64',
|
|
711
|
+
'bool',
|
|
712
|
+
'u64'
|
|
811
713
|
];
|
|
714
|
+
const parameterNames = ["position", "collateralOraclePrice", "collateralOraclePriceDecimal", "tradingPairOraclePrice", "tradingPairOraclePriceDecimal", "cumulativeBorrowRate", "cumulativeFundingRateIndexSign", "cumulativeFundingRateIndex"];
|
|
812
715
|
return (tx) => tx.moveCall({
|
|
813
716
|
package: packageAddress,
|
|
814
|
-
module:
|
|
815
|
-
function:
|
|
816
|
-
arguments: (0,
|
|
717
|
+
module: 'position',
|
|
718
|
+
function: 'update_position_borrow_rate_and_funding_rate',
|
|
719
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
817
720
|
});
|
|
818
721
|
}
|
|
819
722
|
/**
|
|
@@ -821,532 +724,610 @@ function updatePositionBorrowRateAndFundingRate(options) {
|
|
|
821
724
|
* inside
|
|
822
725
|
*/
|
|
823
726
|
function updateOptionPositionCollateralAmount(options) {
|
|
824
|
-
const packageAddress = options.package ??
|
|
825
|
-
const argumentsTypes = [
|
|
826
|
-
|
|
727
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
728
|
+
const argumentsTypes = [
|
|
729
|
+
'0x02821e55ac15f878ebc46f5bbd611de4d683c70e6308abb78880fd7f9d1d98ed::typus_dov_single::Registry',
|
|
730
|
+
'0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
|
|
731
|
+
`${packageAddress}::position::Position`,
|
|
732
|
+
'0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
|
|
733
|
+
];
|
|
734
|
+
const parameterNames = ["dovRegistry", "oracleV2", "position"];
|
|
827
735
|
return (tx) => tx.moveCall({
|
|
828
736
|
package: packageAddress,
|
|
829
|
-
module:
|
|
830
|
-
function:
|
|
831
|
-
arguments: (0,
|
|
832
|
-
typeArguments: options.typeArguments
|
|
737
|
+
module: 'position',
|
|
738
|
+
function: 'update_option_position_collateral_amount',
|
|
739
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
740
|
+
typeArguments: options.typeArguments
|
|
833
741
|
});
|
|
834
742
|
}
|
|
835
743
|
function calculateRealizedPnlUsd(options) {
|
|
836
|
-
const packageAddress = options.package ??
|
|
837
|
-
const argumentsTypes = [
|
|
744
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
745
|
+
const argumentsTypes = [
|
|
746
|
+
'bool',
|
|
747
|
+
'u64',
|
|
748
|
+
'u64',
|
|
749
|
+
'u64',
|
|
750
|
+
'u64',
|
|
751
|
+
'u64'
|
|
752
|
+
];
|
|
838
753
|
const parameterNames = ["side", "size", "entryPrice", "exitPrice", "sizeDecimal", "priceDecimal"];
|
|
839
754
|
return (tx) => tx.moveCall({
|
|
840
755
|
package: packageAddress,
|
|
841
|
-
module:
|
|
842
|
-
function:
|
|
843
|
-
arguments: (0,
|
|
756
|
+
module: 'position',
|
|
757
|
+
function: 'calculate_realized_pnl_usd',
|
|
758
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
844
759
|
});
|
|
845
760
|
}
|
|
846
761
|
function calculateFilled_(options) {
|
|
847
|
-
const packageAddress = options.package ??
|
|
848
|
-
const argumentsTypes = [
|
|
762
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
763
|
+
const argumentsTypes = [
|
|
764
|
+
`${packageAddress}::position::Position`,
|
|
765
|
+
'bool',
|
|
766
|
+
'bool',
|
|
767
|
+
'u64',
|
|
768
|
+
'u64',
|
|
769
|
+
'u64'
|
|
770
|
+
];
|
|
849
771
|
const parameterNames = ["position", "reduceOnly", "orderSide", "orderSize", "tradingPairOraclePrice", "tradingPairOraclePriceDecimal"];
|
|
850
772
|
return (tx) => tx.moveCall({
|
|
851
773
|
package: packageAddress,
|
|
852
|
-
module:
|
|
853
|
-
function:
|
|
854
|
-
arguments: (0,
|
|
774
|
+
module: 'position',
|
|
775
|
+
function: 'calculate_filled_',
|
|
776
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
855
777
|
});
|
|
856
778
|
}
|
|
857
779
|
function calculateIntrinsicValue(options) {
|
|
858
|
-
const packageAddress = options.package ??
|
|
859
|
-
const argumentsTypes = [
|
|
860
|
-
|
|
780
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
781
|
+
const argumentsTypes = [
|
|
782
|
+
'0x02821e55ac15f878ebc46f5bbd611de4d683c70e6308abb78880fd7f9d1d98ed::typus_dov_single::Registry',
|
|
783
|
+
'0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
|
|
784
|
+
'vector<0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded::vault::TypusBidReceipt>',
|
|
785
|
+
'0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
|
|
786
|
+
];
|
|
787
|
+
const parameterNames = ["dovRegistry", "oracleV2", "receipts"];
|
|
861
788
|
return (tx) => tx.moveCall({
|
|
862
789
|
package: packageAddress,
|
|
863
|
-
module:
|
|
864
|
-
function:
|
|
865
|
-
arguments: (0,
|
|
866
|
-
typeArguments: options.typeArguments
|
|
790
|
+
module: 'position',
|
|
791
|
+
function: 'calculate_intrinsic_value',
|
|
792
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
793
|
+
typeArguments: options.typeArguments
|
|
867
794
|
});
|
|
868
795
|
}
|
|
869
796
|
function collateralWithPnl(options) {
|
|
870
|
-
const packageAddress = options.package ??
|
|
871
|
-
const argumentsTypes = [
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
"tradingFeeMbp",
|
|
797
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
798
|
+
const argumentsTypes = [
|
|
799
|
+
`${packageAddress}::position::Position`,
|
|
800
|
+
'u64',
|
|
801
|
+
'u64',
|
|
802
|
+
'u64',
|
|
803
|
+
'u64',
|
|
804
|
+
'u64'
|
|
879
805
|
];
|
|
806
|
+
const parameterNames = ["position", "collateralOraclePrice", "collateralOraclePriceDecimal", "tradingPairOraclePrice", "tradingPairOraclePriceDecimal", "tradingFeeMbp"];
|
|
880
807
|
return (tx) => tx.moveCall({
|
|
881
808
|
package: packageAddress,
|
|
882
|
-
module:
|
|
883
|
-
function:
|
|
884
|
-
arguments: (0,
|
|
809
|
+
module: 'position',
|
|
810
|
+
function: 'collateral_with_pnl',
|
|
811
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
885
812
|
});
|
|
886
813
|
}
|
|
887
814
|
function calculatePositionFundingRate(options) {
|
|
888
|
-
const packageAddress = options.package ??
|
|
889
|
-
const argumentsTypes = [
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
"cumulativeFundingRateIndex",
|
|
815
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
816
|
+
const argumentsTypes = [
|
|
817
|
+
`${packageAddress}::position::Position`,
|
|
818
|
+
'u64',
|
|
819
|
+
'u64',
|
|
820
|
+
'u64',
|
|
821
|
+
'u64',
|
|
822
|
+
'bool',
|
|
823
|
+
'u64'
|
|
898
824
|
];
|
|
825
|
+
const parameterNames = ["position", "collateralOraclePrice", "collateralOraclePriceDecimal", "tradingPairOraclePrice", "tradingPairOraclePriceDecimal", "cumulativeFundingRateIndexSign", "cumulativeFundingRateIndex"];
|
|
899
826
|
return (tx) => tx.moveCall({
|
|
900
827
|
package: packageAddress,
|
|
901
|
-
module:
|
|
902
|
-
function:
|
|
903
|
-
arguments: (0,
|
|
828
|
+
module: 'position',
|
|
829
|
+
function: 'calculate_position_funding_rate',
|
|
830
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
904
831
|
});
|
|
905
832
|
}
|
|
906
833
|
function calculateReserveAmount(options) {
|
|
907
|
-
const packageAddress = options.package ??
|
|
908
|
-
const argumentsTypes = [
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
"tradingPairOraclePriceDecimal",
|
|
834
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
835
|
+
const argumentsTypes = [
|
|
836
|
+
'u64',
|
|
837
|
+
'u64',
|
|
838
|
+
'u64',
|
|
839
|
+
'u64',
|
|
840
|
+
'u64',
|
|
841
|
+
'u64',
|
|
842
|
+
'u64',
|
|
843
|
+
'u64'
|
|
918
844
|
];
|
|
845
|
+
const parameterNames = ["newSize", "sizeDecimal", "collateralAmount", "collateralTokenDecimal", "collateralOraclePrice", "collateralOraclePriceDecimal", "tradingPairOraclePrice", "tradingPairOraclePriceDecimal"];
|
|
919
846
|
return (tx) => tx.moveCall({
|
|
920
847
|
package: packageAddress,
|
|
921
|
-
module:
|
|
922
|
-
function:
|
|
923
|
-
arguments: (0,
|
|
848
|
+
module: 'position',
|
|
849
|
+
function: 'calculate_reserve_amount',
|
|
850
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
924
851
|
});
|
|
925
852
|
}
|
|
926
853
|
function isOptionCollateralOrder(options) {
|
|
927
|
-
const packageAddress = options.package ??
|
|
928
|
-
const argumentsTypes = [
|
|
854
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
855
|
+
const argumentsTypes = [
|
|
856
|
+
`${packageAddress}::position::TradingOrder`
|
|
857
|
+
];
|
|
929
858
|
const parameterNames = ["order"];
|
|
930
859
|
return (tx) => tx.moveCall({
|
|
931
860
|
package: packageAddress,
|
|
932
|
-
module:
|
|
933
|
-
function:
|
|
934
|
-
arguments: (0,
|
|
861
|
+
module: 'position',
|
|
862
|
+
function: 'is_option_collateral_order',
|
|
863
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
935
864
|
});
|
|
936
865
|
}
|
|
937
866
|
function getOrderCollateralToken(options) {
|
|
938
|
-
const packageAddress = options.package ??
|
|
939
|
-
const argumentsTypes = [
|
|
867
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
868
|
+
const argumentsTypes = [
|
|
869
|
+
`${packageAddress}::position::TradingOrder`
|
|
870
|
+
];
|
|
940
871
|
const parameterNames = ["order"];
|
|
941
872
|
return (tx) => tx.moveCall({
|
|
942
873
|
package: packageAddress,
|
|
943
|
-
module:
|
|
944
|
-
function:
|
|
945
|
-
arguments: (0,
|
|
874
|
+
module: 'position',
|
|
875
|
+
function: 'get_order_collateral_token',
|
|
876
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
946
877
|
});
|
|
947
878
|
}
|
|
948
879
|
function getOrderCollateralTokenDecimal(options) {
|
|
949
|
-
const packageAddress = options.package ??
|
|
950
|
-
const argumentsTypes = [
|
|
880
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
881
|
+
const argumentsTypes = [
|
|
882
|
+
`${packageAddress}::position::TradingOrder`
|
|
883
|
+
];
|
|
951
884
|
const parameterNames = ["order"];
|
|
952
885
|
return (tx) => tx.moveCall({
|
|
953
886
|
package: packageAddress,
|
|
954
|
-
module:
|
|
955
|
-
function:
|
|
956
|
-
arguments: (0,
|
|
887
|
+
module: 'position',
|
|
888
|
+
function: 'get_order_collateral_token_decimal',
|
|
889
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
957
890
|
});
|
|
958
891
|
}
|
|
959
892
|
function getOrderTradingSymbol(options) {
|
|
960
|
-
const packageAddress = options.package ??
|
|
961
|
-
const argumentsTypes = [
|
|
893
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
894
|
+
const argumentsTypes = [
|
|
895
|
+
`${packageAddress}::position::TradingOrder`
|
|
896
|
+
];
|
|
962
897
|
const parameterNames = ["order"];
|
|
963
898
|
return (tx) => tx.moveCall({
|
|
964
899
|
package: packageAddress,
|
|
965
|
-
module:
|
|
966
|
-
function:
|
|
967
|
-
arguments: (0,
|
|
900
|
+
module: 'position',
|
|
901
|
+
function: 'get_order_trading_symbol',
|
|
902
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
968
903
|
});
|
|
969
904
|
}
|
|
970
905
|
function getOrderPrice(options) {
|
|
971
|
-
const packageAddress = options.package ??
|
|
972
|
-
const argumentsTypes = [
|
|
906
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
907
|
+
const argumentsTypes = [
|
|
908
|
+
`${packageAddress}::position::TradingOrder`
|
|
909
|
+
];
|
|
973
910
|
const parameterNames = ["order"];
|
|
974
911
|
return (tx) => tx.moveCall({
|
|
975
912
|
package: packageAddress,
|
|
976
|
-
module:
|
|
977
|
-
function:
|
|
978
|
-
arguments: (0,
|
|
913
|
+
module: 'position',
|
|
914
|
+
function: 'get_order_price',
|
|
915
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
979
916
|
});
|
|
980
917
|
}
|
|
981
918
|
function getOrderUser(options) {
|
|
982
|
-
const packageAddress = options.package ??
|
|
983
|
-
const argumentsTypes = [
|
|
919
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
920
|
+
const argumentsTypes = [
|
|
921
|
+
`${packageAddress}::position::TradingOrder`
|
|
922
|
+
];
|
|
984
923
|
const parameterNames = ["order"];
|
|
985
924
|
return (tx) => tx.moveCall({
|
|
986
925
|
package: packageAddress,
|
|
987
|
-
module:
|
|
988
|
-
function:
|
|
989
|
-
arguments: (0,
|
|
926
|
+
module: 'position',
|
|
927
|
+
function: 'get_order_user',
|
|
928
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
990
929
|
});
|
|
991
930
|
}
|
|
992
931
|
function getOrderId(options) {
|
|
993
|
-
const packageAddress = options.package ??
|
|
994
|
-
const argumentsTypes = [
|
|
932
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
933
|
+
const argumentsTypes = [
|
|
934
|
+
`${packageAddress}::position::TradingOrder`
|
|
935
|
+
];
|
|
995
936
|
const parameterNames = ["order"];
|
|
996
937
|
return (tx) => tx.moveCall({
|
|
997
938
|
package: packageAddress,
|
|
998
|
-
module:
|
|
999
|
-
function:
|
|
1000
|
-
arguments: (0,
|
|
939
|
+
module: 'position',
|
|
940
|
+
function: 'get_order_id',
|
|
941
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1001
942
|
});
|
|
1002
943
|
}
|
|
1003
944
|
function getOrderSize(options) {
|
|
1004
|
-
const packageAddress = options.package ??
|
|
1005
|
-
const argumentsTypes = [
|
|
945
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
946
|
+
const argumentsTypes = [
|
|
947
|
+
`${packageAddress}::position::TradingOrder`
|
|
948
|
+
];
|
|
1006
949
|
const parameterNames = ["order"];
|
|
1007
950
|
return (tx) => tx.moveCall({
|
|
1008
951
|
package: packageAddress,
|
|
1009
|
-
module:
|
|
1010
|
-
function:
|
|
1011
|
-
arguments: (0,
|
|
952
|
+
module: 'position',
|
|
953
|
+
function: 'get_order_size',
|
|
954
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1012
955
|
});
|
|
1013
956
|
}
|
|
1014
957
|
function getOrderSide(options) {
|
|
1015
|
-
const packageAddress = options.package ??
|
|
1016
|
-
const argumentsTypes = [
|
|
958
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
959
|
+
const argumentsTypes = [
|
|
960
|
+
`${packageAddress}::position::TradingOrder`
|
|
961
|
+
];
|
|
1017
962
|
const parameterNames = ["order"];
|
|
1018
963
|
return (tx) => tx.moveCall({
|
|
1019
964
|
package: packageAddress,
|
|
1020
|
-
module:
|
|
1021
|
-
function:
|
|
1022
|
-
arguments: (0,
|
|
965
|
+
module: 'position',
|
|
966
|
+
function: 'get_order_side',
|
|
967
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1023
968
|
});
|
|
1024
969
|
}
|
|
1025
970
|
function getOrderReduceOnly(options) {
|
|
1026
|
-
const packageAddress = options.package ??
|
|
1027
|
-
const argumentsTypes = [
|
|
971
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
972
|
+
const argumentsTypes = [
|
|
973
|
+
`${packageAddress}::position::TradingOrder`
|
|
974
|
+
];
|
|
1028
975
|
const parameterNames = ["order"];
|
|
1029
976
|
return (tx) => tx.moveCall({
|
|
1030
977
|
package: packageAddress,
|
|
1031
|
-
module:
|
|
1032
|
-
function:
|
|
1033
|
-
arguments: (0,
|
|
978
|
+
module: 'position',
|
|
979
|
+
function: 'get_order_reduce_only',
|
|
980
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1034
981
|
});
|
|
1035
982
|
}
|
|
1036
983
|
function getOrderLinkedPositionId(options) {
|
|
1037
|
-
const packageAddress = options.package ??
|
|
1038
|
-
const argumentsTypes = [
|
|
984
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
985
|
+
const argumentsTypes = [
|
|
986
|
+
`${packageAddress}::position::TradingOrder`
|
|
987
|
+
];
|
|
1039
988
|
const parameterNames = ["order"];
|
|
1040
989
|
return (tx) => tx.moveCall({
|
|
1041
990
|
package: packageAddress,
|
|
1042
|
-
module:
|
|
1043
|
-
function:
|
|
1044
|
-
arguments: (0,
|
|
991
|
+
module: 'position',
|
|
992
|
+
function: 'get_order_linked_position_id',
|
|
993
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1045
994
|
});
|
|
1046
995
|
}
|
|
1047
996
|
function getOrderTypeTag(options) {
|
|
1048
|
-
const packageAddress = options.package ??
|
|
1049
|
-
const argumentsTypes = [
|
|
997
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
998
|
+
const argumentsTypes = [
|
|
999
|
+
`${packageAddress}::position::TradingOrder`
|
|
1000
|
+
];
|
|
1050
1001
|
const parameterNames = ["order"];
|
|
1051
1002
|
return (tx) => tx.moveCall({
|
|
1052
1003
|
package: packageAddress,
|
|
1053
|
-
module:
|
|
1054
|
-
function:
|
|
1055
|
-
arguments: (0,
|
|
1004
|
+
module: 'position',
|
|
1005
|
+
function: 'get_order_type_tag',
|
|
1006
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1056
1007
|
});
|
|
1057
1008
|
}
|
|
1058
1009
|
function getOrderCollateralAmount(options) {
|
|
1059
|
-
const packageAddress = options.package ??
|
|
1060
|
-
const argumentsTypes = [
|
|
1010
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1011
|
+
const argumentsTypes = [
|
|
1012
|
+
`${packageAddress}::position::TradingOrder`
|
|
1013
|
+
];
|
|
1061
1014
|
const parameterNames = ["order"];
|
|
1062
1015
|
return (tx) => tx.moveCall({
|
|
1063
1016
|
package: packageAddress,
|
|
1064
|
-
module:
|
|
1065
|
-
function:
|
|
1066
|
-
arguments: (0,
|
|
1067
|
-
typeArguments: options.typeArguments
|
|
1017
|
+
module: 'position',
|
|
1018
|
+
function: 'get_order_collateral_amount',
|
|
1019
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1020
|
+
typeArguments: options.typeArguments
|
|
1068
1021
|
});
|
|
1069
1022
|
}
|
|
1070
1023
|
function getOptionCollateralOrderCollateralAmount(options) {
|
|
1071
|
-
const packageAddress = options.package ??
|
|
1072
|
-
const argumentsTypes = [
|
|
1073
|
-
|
|
1024
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1025
|
+
const argumentsTypes = [
|
|
1026
|
+
'0x02821e55ac15f878ebc46f5bbd611de4d683c70e6308abb78880fd7f9d1d98ed::typus_dov_single::Registry',
|
|
1027
|
+
'0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
|
|
1028
|
+
`${packageAddress}::position::TradingOrder`,
|
|
1029
|
+
'0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
|
|
1030
|
+
];
|
|
1031
|
+
const parameterNames = ["dovRegistry", "oracleV2", "order"];
|
|
1074
1032
|
return (tx) => tx.moveCall({
|
|
1075
1033
|
package: packageAddress,
|
|
1076
|
-
module:
|
|
1077
|
-
function:
|
|
1078
|
-
arguments: (0,
|
|
1079
|
-
typeArguments: options.typeArguments
|
|
1034
|
+
module: 'position',
|
|
1035
|
+
function: 'get_option_collateral_order_collateral_amount',
|
|
1036
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1037
|
+
typeArguments: options.typeArguments
|
|
1080
1038
|
});
|
|
1081
1039
|
}
|
|
1082
1040
|
function calculateTradingFee(options) {
|
|
1083
|
-
const packageAddress = options.package ??
|
|
1084
|
-
const argumentsTypes = [
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
"collateralTokenDecimal",
|
|
1041
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1042
|
+
const argumentsTypes = [
|
|
1043
|
+
'u64',
|
|
1044
|
+
'u64',
|
|
1045
|
+
'u64',
|
|
1046
|
+
'u64',
|
|
1047
|
+
'u64',
|
|
1048
|
+
'u64',
|
|
1049
|
+
'u64',
|
|
1050
|
+
'u64'
|
|
1094
1051
|
];
|
|
1052
|
+
const parameterNames = ["size", "sizeDecimal", "collateralOraclePrice", "collateralOraclePriceDecimal", "tradingPairOraclePrice", "tradingPairOraclePriceDecimal", "tradingFeeMbp", "collateralTokenDecimal"];
|
|
1095
1053
|
return (tx) => tx.moveCall({
|
|
1096
1054
|
package: packageAddress,
|
|
1097
|
-
module:
|
|
1098
|
-
function:
|
|
1099
|
-
arguments: (0,
|
|
1055
|
+
module: 'position',
|
|
1056
|
+
function: 'calculate_trading_fee',
|
|
1057
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1100
1058
|
});
|
|
1101
1059
|
}
|
|
1102
1060
|
function splitBidReceipt(options) {
|
|
1103
|
-
const packageAddress = options.package ??
|
|
1104
|
-
const argumentsTypes = [
|
|
1061
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1062
|
+
const argumentsTypes = [
|
|
1063
|
+
'0x02821e55ac15f878ebc46f5bbd611de4d683c70e6308abb78880fd7f9d1d98ed::typus_dov_single::Registry',
|
|
1064
|
+
`${packageAddress}::position::Position`,
|
|
1065
|
+
'u64'
|
|
1066
|
+
];
|
|
1105
1067
|
const parameterNames = ["dovRegistry", "position", "size"];
|
|
1106
1068
|
return (tx) => tx.moveCall({
|
|
1107
1069
|
package: packageAddress,
|
|
1108
|
-
module:
|
|
1109
|
-
function:
|
|
1110
|
-
arguments: (0,
|
|
1070
|
+
module: 'position',
|
|
1071
|
+
function: 'split_bid_receipt',
|
|
1072
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1111
1073
|
});
|
|
1112
1074
|
}
|
|
1113
1075
|
function isOptionCollateralPosition(options) {
|
|
1114
|
-
const packageAddress = options.package ??
|
|
1115
|
-
const argumentsTypes = [
|
|
1076
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1077
|
+
const argumentsTypes = [
|
|
1078
|
+
`${packageAddress}::position::Position`
|
|
1079
|
+
];
|
|
1116
1080
|
const parameterNames = ["position"];
|
|
1117
1081
|
return (tx) => tx.moveCall({
|
|
1118
1082
|
package: packageAddress,
|
|
1119
|
-
module:
|
|
1120
|
-
function:
|
|
1121
|
-
arguments: (0,
|
|
1083
|
+
module: 'position',
|
|
1084
|
+
function: 'is_option_collateral_position',
|
|
1085
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1122
1086
|
});
|
|
1123
1087
|
}
|
|
1124
1088
|
function emitRealizedFundingEvent(options) {
|
|
1125
|
-
const packageAddress = options.package ??
|
|
1126
|
-
const argumentsTypes = [
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
"u64Padding",
|
|
1089
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1090
|
+
const argumentsTypes = [
|
|
1091
|
+
'address',
|
|
1092
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName',
|
|
1093
|
+
`${packageAddress}::symbol::Symbol`,
|
|
1094
|
+
'u64',
|
|
1095
|
+
'bool',
|
|
1096
|
+
'u64',
|
|
1097
|
+
'u64',
|
|
1098
|
+
'vector<u64>'
|
|
1136
1099
|
];
|
|
1100
|
+
const parameterNames = ["user", "collateralToken", "symbol", "positionId", "realizedFundingSign", "realizedFundingFee", "realizedFundingFeeUsd", "u64Padding"];
|
|
1137
1101
|
return (tx) => tx.moveCall({
|
|
1138
1102
|
package: packageAddress,
|
|
1139
|
-
module:
|
|
1140
|
-
function:
|
|
1141
|
-
arguments: (0,
|
|
1142
|
-
});
|
|
1143
|
-
}
|
|
1144
|
-
function checkPositionUpdateTimestamp(options) {
|
|
1145
|
-
const packageAddress = options.package ?? "@typus/perp";
|
|
1146
|
-
const argumentsTypes = [null, "0x2::clock::Clock", "u64"];
|
|
1147
|
-
const parameterNames = ["position", "thresholdTsMs"];
|
|
1148
|
-
return (tx) => tx.moveCall({
|
|
1149
|
-
package: packageAddress,
|
|
1150
|
-
module: "position",
|
|
1151
|
-
function: "check_position_update_timestamp",
|
|
1152
|
-
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1153
|
-
});
|
|
1154
|
-
}
|
|
1155
|
-
function checkPositionUpdateTimestamp_(options) {
|
|
1156
|
-
const packageAddress = options.package ?? "@typus/perp";
|
|
1157
|
-
const argumentsTypes = [null, "0x2::clock::Clock", "u64"];
|
|
1158
|
-
const parameterNames = ["position", "thresholdTsMs"];
|
|
1159
|
-
return (tx) => tx.moveCall({
|
|
1160
|
-
package: packageAddress,
|
|
1161
|
-
module: "position",
|
|
1162
|
-
function: "check_position_update_timestamp_",
|
|
1163
|
-
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1103
|
+
module: 'position',
|
|
1104
|
+
function: 'emit_realized_funding_event',
|
|
1105
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1164
1106
|
});
|
|
1165
1107
|
}
|
|
1166
1108
|
function getPositionId(options) {
|
|
1167
|
-
const packageAddress = options.package ??
|
|
1168
|
-
const argumentsTypes = [
|
|
1109
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1110
|
+
const argumentsTypes = [
|
|
1111
|
+
`${packageAddress}::position::Position`
|
|
1112
|
+
];
|
|
1169
1113
|
const parameterNames = ["position"];
|
|
1170
1114
|
return (tx) => tx.moveCall({
|
|
1171
1115
|
package: packageAddress,
|
|
1172
|
-
module:
|
|
1173
|
-
function:
|
|
1174
|
-
arguments: (0,
|
|
1116
|
+
module: 'position',
|
|
1117
|
+
function: 'get_position_id',
|
|
1118
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1175
1119
|
});
|
|
1176
1120
|
}
|
|
1177
1121
|
function getPositionSize(options) {
|
|
1178
|
-
const packageAddress = options.package ??
|
|
1179
|
-
const argumentsTypes = [
|
|
1122
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1123
|
+
const argumentsTypes = [
|
|
1124
|
+
`${packageAddress}::position::Position`
|
|
1125
|
+
];
|
|
1180
1126
|
const parameterNames = ["position"];
|
|
1181
1127
|
return (tx) => tx.moveCall({
|
|
1182
1128
|
package: packageAddress,
|
|
1183
|
-
module:
|
|
1184
|
-
function:
|
|
1185
|
-
arguments: (0,
|
|
1129
|
+
module: 'position',
|
|
1130
|
+
function: 'get_position_size',
|
|
1131
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1186
1132
|
});
|
|
1187
1133
|
}
|
|
1188
1134
|
function getPositionSide(options) {
|
|
1189
|
-
const packageAddress = options.package ??
|
|
1190
|
-
const argumentsTypes = [
|
|
1135
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1136
|
+
const argumentsTypes = [
|
|
1137
|
+
`${packageAddress}::position::Position`
|
|
1138
|
+
];
|
|
1191
1139
|
const parameterNames = ["position"];
|
|
1192
1140
|
return (tx) => tx.moveCall({
|
|
1193
1141
|
package: packageAddress,
|
|
1194
|
-
module:
|
|
1195
|
-
function:
|
|
1196
|
-
arguments: (0,
|
|
1142
|
+
module: 'position',
|
|
1143
|
+
function: 'get_position_side',
|
|
1144
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1197
1145
|
});
|
|
1198
1146
|
}
|
|
1199
1147
|
function getPositionUser(options) {
|
|
1200
|
-
const packageAddress = options.package ??
|
|
1201
|
-
const argumentsTypes = [
|
|
1148
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1149
|
+
const argumentsTypes = [
|
|
1150
|
+
`${packageAddress}::position::Position`
|
|
1151
|
+
];
|
|
1202
1152
|
const parameterNames = ["position"];
|
|
1203
1153
|
return (tx) => tx.moveCall({
|
|
1204
1154
|
package: packageAddress,
|
|
1205
|
-
module:
|
|
1206
|
-
function:
|
|
1207
|
-
arguments: (0,
|
|
1155
|
+
module: 'position',
|
|
1156
|
+
function: 'get_position_user',
|
|
1157
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1208
1158
|
});
|
|
1209
1159
|
}
|
|
1210
1160
|
function getPositionSymbol(options) {
|
|
1211
|
-
const packageAddress = options.package ??
|
|
1212
|
-
const argumentsTypes = [
|
|
1161
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1162
|
+
const argumentsTypes = [
|
|
1163
|
+
`${packageAddress}::position::Position`
|
|
1164
|
+
];
|
|
1213
1165
|
const parameterNames = ["position"];
|
|
1214
1166
|
return (tx) => tx.moveCall({
|
|
1215
1167
|
package: packageAddress,
|
|
1216
|
-
module:
|
|
1217
|
-
function:
|
|
1218
|
-
arguments: (0,
|
|
1168
|
+
module: 'position',
|
|
1169
|
+
function: 'get_position_symbol',
|
|
1170
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1219
1171
|
});
|
|
1220
1172
|
}
|
|
1221
1173
|
function getPositionOptionCollateralInfo(options) {
|
|
1222
|
-
const packageAddress = options.package ??
|
|
1223
|
-
const argumentsTypes = [
|
|
1174
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1175
|
+
const argumentsTypes = [
|
|
1176
|
+
`${packageAddress}::position::Position`
|
|
1177
|
+
];
|
|
1224
1178
|
const parameterNames = ["position"];
|
|
1225
1179
|
return (tx) => tx.moveCall({
|
|
1226
1180
|
package: packageAddress,
|
|
1227
|
-
module:
|
|
1228
|
-
function:
|
|
1229
|
-
arguments: (0,
|
|
1181
|
+
module: 'position',
|
|
1182
|
+
function: 'get_position_option_collateral_info',
|
|
1183
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1230
1184
|
});
|
|
1231
1185
|
}
|
|
1232
1186
|
function getReserveAmount(options) {
|
|
1233
|
-
const packageAddress = options.package ??
|
|
1234
|
-
const argumentsTypes = [
|
|
1187
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1188
|
+
const argumentsTypes = [
|
|
1189
|
+
`${packageAddress}::position::Position`
|
|
1190
|
+
];
|
|
1235
1191
|
const parameterNames = ["position"];
|
|
1236
1192
|
return (tx) => tx.moveCall({
|
|
1237
1193
|
package: packageAddress,
|
|
1238
|
-
module:
|
|
1239
|
-
function:
|
|
1240
|
-
arguments: (0,
|
|
1194
|
+
module: 'position',
|
|
1195
|
+
function: 'get_reserve_amount',
|
|
1196
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1241
1197
|
});
|
|
1242
1198
|
}
|
|
1243
1199
|
function getPositionSizeDecimal(options) {
|
|
1244
|
-
const packageAddress = options.package ??
|
|
1245
|
-
const argumentsTypes = [
|
|
1200
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1201
|
+
const argumentsTypes = [
|
|
1202
|
+
`${packageAddress}::position::Position`
|
|
1203
|
+
];
|
|
1246
1204
|
const parameterNames = ["position"];
|
|
1247
1205
|
return (tx) => tx.moveCall({
|
|
1248
1206
|
package: packageAddress,
|
|
1249
|
-
module:
|
|
1250
|
-
function:
|
|
1251
|
-
arguments: (0,
|
|
1207
|
+
module: 'position',
|
|
1208
|
+
function: 'get_position_size_decimal',
|
|
1209
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1252
1210
|
});
|
|
1253
1211
|
}
|
|
1254
1212
|
function getPositionCollateralTokenDecimal(options) {
|
|
1255
|
-
const packageAddress = options.package ??
|
|
1256
|
-
const argumentsTypes = [
|
|
1213
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1214
|
+
const argumentsTypes = [
|
|
1215
|
+
`${packageAddress}::position::Position`
|
|
1216
|
+
];
|
|
1257
1217
|
const parameterNames = ["position"];
|
|
1258
1218
|
return (tx) => tx.moveCall({
|
|
1259
1219
|
package: packageAddress,
|
|
1260
|
-
module:
|
|
1261
|
-
function:
|
|
1262
|
-
arguments: (0,
|
|
1220
|
+
module: 'position',
|
|
1221
|
+
function: 'get_position_collateral_token_decimal',
|
|
1222
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1263
1223
|
});
|
|
1264
1224
|
}
|
|
1265
1225
|
function calculateUnrealizedCost(options) {
|
|
1266
|
-
const packageAddress = options.package ??
|
|
1267
|
-
const argumentsTypes = [
|
|
1226
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1227
|
+
const argumentsTypes = [
|
|
1228
|
+
`${packageAddress}::position::Position`
|
|
1229
|
+
];
|
|
1268
1230
|
const parameterNames = ["position"];
|
|
1269
1231
|
return (tx) => tx.moveCall({
|
|
1270
1232
|
package: packageAddress,
|
|
1271
|
-
module:
|
|
1272
|
-
function:
|
|
1273
|
-
arguments: (0,
|
|
1233
|
+
module: 'position',
|
|
1234
|
+
function: 'calculate_unrealized_cost',
|
|
1235
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1274
1236
|
});
|
|
1275
1237
|
}
|
|
1276
1238
|
function getPositionLinkedOrderIds(options) {
|
|
1277
|
-
const packageAddress = options.package ??
|
|
1278
|
-
const argumentsTypes = [
|
|
1239
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1240
|
+
const argumentsTypes = [
|
|
1241
|
+
`${packageAddress}::position::Position`
|
|
1242
|
+
];
|
|
1279
1243
|
const parameterNames = ["position"];
|
|
1280
1244
|
return (tx) => tx.moveCall({
|
|
1281
1245
|
package: packageAddress,
|
|
1282
|
-
module:
|
|
1283
|
-
function:
|
|
1284
|
-
arguments: (0,
|
|
1246
|
+
module: 'position',
|
|
1247
|
+
function: 'get_position_linked_order_ids',
|
|
1248
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1285
1249
|
});
|
|
1286
1250
|
}
|
|
1287
1251
|
function getPositionCollateralTokenType(options) {
|
|
1288
|
-
const packageAddress = options.package ??
|
|
1289
|
-
const argumentsTypes = [
|
|
1252
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1253
|
+
const argumentsTypes = [
|
|
1254
|
+
`${packageAddress}::position::Position`
|
|
1255
|
+
];
|
|
1290
1256
|
const parameterNames = ["position"];
|
|
1291
1257
|
return (tx) => tx.moveCall({
|
|
1292
1258
|
package: packageAddress,
|
|
1293
|
-
module:
|
|
1294
|
-
function:
|
|
1295
|
-
arguments: (0,
|
|
1259
|
+
module: 'position',
|
|
1260
|
+
function: 'get_position_collateral_token_type',
|
|
1261
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1296
1262
|
});
|
|
1297
1263
|
}
|
|
1298
1264
|
function getPositionCollateralAmount(options) {
|
|
1299
|
-
const packageAddress = options.package ??
|
|
1300
|
-
const argumentsTypes = [
|
|
1265
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1266
|
+
const argumentsTypes = [
|
|
1267
|
+
`${packageAddress}::position::Position`
|
|
1268
|
+
];
|
|
1301
1269
|
const parameterNames = ["position"];
|
|
1302
1270
|
return (tx) => tx.moveCall({
|
|
1303
1271
|
package: packageAddress,
|
|
1304
|
-
module:
|
|
1305
|
-
function:
|
|
1306
|
-
arguments: (0,
|
|
1307
|
-
typeArguments: options.typeArguments
|
|
1272
|
+
module: 'position',
|
|
1273
|
+
function: 'get_position_collateral_amount',
|
|
1274
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1275
|
+
typeArguments: options.typeArguments
|
|
1308
1276
|
});
|
|
1309
1277
|
}
|
|
1310
1278
|
function getOptionPositionCollateralAmount(options) {
|
|
1311
|
-
const packageAddress = options.package ??
|
|
1312
|
-
const argumentsTypes = [
|
|
1313
|
-
|
|
1279
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1280
|
+
const argumentsTypes = [
|
|
1281
|
+
'0x02821e55ac15f878ebc46f5bbd611de4d683c70e6308abb78880fd7f9d1d98ed::typus_dov_single::Registry',
|
|
1282
|
+
'0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
|
|
1283
|
+
`${packageAddress}::position::Position`,
|
|
1284
|
+
'0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
|
|
1285
|
+
];
|
|
1286
|
+
const parameterNames = ["dovRegistry", "oracleV2", "position"];
|
|
1314
1287
|
return (tx) => tx.moveCall({
|
|
1315
1288
|
package: packageAddress,
|
|
1316
|
-
module:
|
|
1317
|
-
function:
|
|
1318
|
-
arguments: (0,
|
|
1319
|
-
typeArguments: options.typeArguments
|
|
1289
|
+
module: 'position',
|
|
1290
|
+
function: 'get_option_position_collateral_amount',
|
|
1291
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1292
|
+
typeArguments: options.typeArguments
|
|
1320
1293
|
});
|
|
1321
1294
|
}
|
|
1322
1295
|
function optionPositionBidReceiptsExpired(options) {
|
|
1323
|
-
const packageAddress = options.package ??
|
|
1324
|
-
const argumentsTypes = [
|
|
1296
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1297
|
+
const argumentsTypes = [
|
|
1298
|
+
'0x02821e55ac15f878ebc46f5bbd611de4d683c70e6308abb78880fd7f9d1d98ed::typus_dov_single::Registry',
|
|
1299
|
+
`${packageAddress}::position::Position`
|
|
1300
|
+
];
|
|
1325
1301
|
const parameterNames = ["dovRegistry", "position"];
|
|
1326
1302
|
return (tx) => tx.moveCall({
|
|
1327
1303
|
package: packageAddress,
|
|
1328
|
-
module:
|
|
1329
|
-
function:
|
|
1330
|
-
arguments: (0,
|
|
1304
|
+
module: 'position',
|
|
1305
|
+
function: 'option_position_bid_receipts_expired',
|
|
1306
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1331
1307
|
});
|
|
1332
1308
|
}
|
|
1333
1309
|
function getOptionPositionExerciseValue(options) {
|
|
1334
|
-
const packageAddress = options.package ??
|
|
1335
|
-
const argumentsTypes = [
|
|
1336
|
-
|
|
1310
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1311
|
+
const argumentsTypes = [
|
|
1312
|
+
'0x02821e55ac15f878ebc46f5bbd611de4d683c70e6308abb78880fd7f9d1d98ed::typus_dov_single::Registry',
|
|
1313
|
+
'0xd2e030ab7f0fc956c7e683cf3c6faf3d22868dee81a4aae9f4a10a6d998a8a02::oracle_v2::OracleV2',
|
|
1314
|
+
`${packageAddress}::position::Position`,
|
|
1315
|
+
'0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock'
|
|
1316
|
+
];
|
|
1317
|
+
const parameterNames = ["dovRegistry", "oracleV2", "position"];
|
|
1337
1318
|
return (tx) => tx.moveCall({
|
|
1338
1319
|
package: packageAddress,
|
|
1339
|
-
module:
|
|
1340
|
-
function:
|
|
1341
|
-
arguments: (0,
|
|
1342
|
-
typeArguments: options.typeArguments
|
|
1320
|
+
module: 'position',
|
|
1321
|
+
function: 'get_option_position_exercise_value',
|
|
1322
|
+
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1323
|
+
typeArguments: options.typeArguments
|
|
1343
1324
|
});
|
|
1344
1325
|
}
|
|
1345
1326
|
function getMaxOrderTypeTag(options = {}) {
|
|
1346
|
-
const packageAddress = options.package ??
|
|
1327
|
+
const packageAddress = options.package ?? '@typus/perp';
|
|
1347
1328
|
return (tx) => tx.moveCall({
|
|
1348
1329
|
package: packageAddress,
|
|
1349
|
-
module:
|
|
1350
|
-
function:
|
|
1330
|
+
module: 'position',
|
|
1331
|
+
function: 'get_max_order_type_tag',
|
|
1351
1332
|
});
|
|
1352
1333
|
}
|