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