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