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