@typus/typus-perp-sdk 1.1.32-codegen-exp3 → 1.1.32-testnet-exp1
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/_dependencies/source/0x1/ascii/structs.d.ts +88 -0
- package/dist/src/_dependencies/source/0x1/ascii/structs.js +398 -0
- package/dist/src/_dependencies/source/0x1/index.d.ts +3 -0
- package/dist/src/_dependencies/source/0x1/index.js +6 -0
- package/dist/src/_dependencies/source/0x1/option/structs.d.ts +50 -0
- package/dist/src/_dependencies/source/0x1/option/structs.js +271 -0
- package/dist/src/_dependencies/source/0x1/string/structs.d.ts +48 -0
- package/dist/src/_dependencies/source/0x1/string/structs.js +256 -0
- package/dist/src/_dependencies/source/0x1/type-name/structs.d.ts +49 -0
- package/dist/src/_dependencies/source/0x1/type-name/structs.js +223 -0
- package/dist/src/_dependencies/source/0x2/bag/structs.d.ts +54 -0
- package/dist/src/_dependencies/source/0x2/bag/structs.js +229 -0
- package/dist/src/_dependencies/source/0x2/balance/structs.d.ts +84 -0
- package/dist/src/_dependencies/source/0x2/balance/structs.js +386 -0
- package/dist/src/_dependencies/source/0x2/coin/structs.d.ts +406 -0
- package/dist/src/_dependencies/source/0x2/coin/structs.js +1247 -0
- package/dist/src/_dependencies/source/0x2/index.d.ts +3 -0
- package/dist/src/_dependencies/source/0x2/index.js +6 -0
- package/dist/src/_dependencies/source/0x2/linked-table/structs.d.ts +132 -0
- package/dist/src/_dependencies/source/0x2/linked-table/structs.js +438 -0
- package/dist/src/_dependencies/source/0x2/object/structs.d.ts +86 -0
- package/dist/src/_dependencies/source/0x2/object/structs.js +364 -0
- package/dist/src/_dependencies/source/0x2/object-table/structs.d.ts +54 -0
- package/dist/src/_dependencies/source/0x2/object-table/structs.js +248 -0
- package/dist/src/_dependencies/source/0x2/sui/structs.d.ts +44 -0
- package/dist/src/_dependencies/source/0x2/sui/structs.js +222 -0
- package/dist/src/_dependencies/source/0x2/table/structs.d.ts +54 -0
- package/dist/src/_dependencies/source/0x2/table/structs.js +248 -0
- package/dist/src/_dependencies/source/0x2/table-vec/structs.d.ts +59 -0
- package/dist/src/_dependencies/source/0x2/table-vec/structs.js +274 -0
- package/dist/src/_dependencies/source/0x2/token/structs.d.ts +421 -0
- package/dist/src/_dependencies/source/0x2/token/structs.js +1095 -0
- package/dist/src/_dependencies/source/0x2/transfer-policy/structs.d.ts +348 -0
- package/dist/src/_dependencies/source/0x2/transfer-policy/structs.js +1091 -0
- package/dist/src/_dependencies/source/0x2/url/structs.d.ts +49 -0
- package/dist/src/_dependencies/source/0x2/url/structs.js +223 -0
- package/dist/src/_dependencies/source/0x2/vec-map/structs.d.ts +106 -0
- package/dist/src/_dependencies/source/0x2/vec-map/structs.js +446 -0
- package/dist/src/_dependencies/source/0x2/vec-set/structs.d.ts +49 -0
- package/dist/src/_dependencies/source/0x2/vec-set/structs.js +270 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.d.ts +422 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.js +1084 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.d.ts +130 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.js +456 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.d.ts +208 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.js +653 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.d.ts +362 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.js +899 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.d.ts +8 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.js +11 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.d.ts +2 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.js +102 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/keyed-big-vector/structs.d.ts +202 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/keyed-big-vector/structs.js +632 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.d.ts +600 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.js +1459 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-object-table/structs.d.ts +136 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-object-table/structs.js +438 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.d.ts +127 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.js +430 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.d.ts +957 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.js +2261 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.d.ts +244 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.js +733 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.d.ts +294 -0
- package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.js +892 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.d.ts +73 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.js +263 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.d.ts +294 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.js +591 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.d.ts +64 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.js +258 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.d.ts +756 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.js +1721 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.d.ts +44 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.js +222 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.d.ts +3 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.js +6 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.d.ts +2 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.js +89 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.d.ts +135 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.js +444 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/vault/structs.d.ts +2106 -0
- package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/vault/structs.js +4952 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.d.ts +390 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.js +844 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.d.ts +6 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.js +9 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.d.ts +2 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.js +69 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.d.ts +89 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.js +376 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.d.ts +386 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.js +881 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.d.ts +59 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.js +274 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.d.ts +974 -0
- package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.js +2387 -0
- package/dist/src/_framework/init-loader.d.ts +2 -0
- package/dist/src/{generated/typus_perp/treasury_caps.js → _framework/init-loader.js} +10 -17
- package/dist/src/_framework/loader.d.ts +17 -0
- package/dist/src/_framework/loader.js +108 -0
- package/dist/src/_framework/reified.d.ts +108 -0
- package/dist/src/_framework/reified.js +237 -0
- package/dist/src/_framework/util.d.ts +35 -0
- package/dist/src/_framework/util.js +396 -0
- package/dist/src/_framework/vector.d.ts +42 -0
- package/dist/src/_framework/vector.js +112 -0
- package/dist/src/api/sentio.js +538 -604
- package/dist/src/fetch.d.ts +36 -577
- package/dist/src/fetch.js +665 -367
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +39 -20
- package/dist/src/pyth.js +1 -0
- package/dist/src/typus_perp/admin/functions.d.ts +59 -0
- package/dist/src/typus_perp/admin/functions.js +122 -0
- package/dist/src/typus_perp/admin/structs.d.ts +467 -0
- package/dist/src/typus_perp/admin/structs.js +1065 -0
- package/dist/src/typus_perp/competition/functions.d.ts +24 -0
- package/dist/src/typus_perp/competition/functions.js +38 -0
- package/dist/src/typus_perp/competition/structs.d.ts +80 -0
- package/dist/src/typus_perp/competition/structs.js +288 -0
- package/dist/src/typus_perp/error/functions.d.ts +73 -0
- package/dist/src/typus_perp/error/functions.js +363 -0
- package/dist/src/typus_perp/escrow/functions.d.ts +17 -0
- package/dist/src/typus_perp/escrow/functions.js +36 -0
- package/dist/src/typus_perp/escrow/structs.d.ts +160 -0
- package/dist/src/typus_perp/escrow/structs.js +324 -0
- package/dist/src/typus_perp/index.d.ts +1 -0
- package/dist/src/typus_perp/index.js +7 -0
- package/dist/src/typus_perp/init.d.ts +2 -0
- package/dist/src/typus_perp/init.js +118 -0
- package/dist/src/typus_perp/lending/functions.d.ts +15 -0
- package/dist/src/typus_perp/lending/functions.js +22 -0
- package/dist/src/typus_perp/lp-pool/functions.d.ts +460 -0
- package/dist/src/typus_perp/lp-pool/functions.js +732 -0
- package/dist/src/typus_perp/lp-pool/structs.d.ts +3705 -0
- package/dist/src/typus_perp/lp-pool/structs.js +6789 -0
- package/dist/src/typus_perp/math/functions.d.ts +29 -0
- package/dist/src/typus_perp/math/functions.js +61 -0
- package/dist/src/typus_perp/position/functions.d.ts +379 -0
- package/dist/src/typus_perp/position/functions.js +713 -0
- package/dist/src/typus_perp/position/structs.d.ts +905 -0
- package/dist/src/typus_perp/position/structs.js +1450 -0
- package/dist/src/typus_perp/symbol/functions.d.ts +9 -0
- package/dist/src/typus_perp/symbol/functions.js +24 -0
- package/dist/src/typus_perp/symbol/structs.d.ts +70 -0
- package/dist/src/typus_perp/symbol/structs.js +235 -0
- package/dist/src/typus_perp/tlp/functions.d.ts +19 -0
- package/dist/src/typus_perp/tlp/functions.js +40 -0
- package/dist/src/typus_perp/tlp/structs.d.ts +89 -0
- package/dist/src/typus_perp/tlp/structs.js +365 -0
- package/dist/src/typus_perp/token-interface/functions.d.ts +11 -0
- package/dist/src/typus_perp/token-interface/functions.js +22 -0
- package/dist/src/typus_perp/trading/functions.d.ts +812 -0
- package/dist/src/typus_perp/trading/functions.js +1218 -0
- package/dist/src/typus_perp/trading/structs.d.ts +3060 -0
- package/dist/src/typus_perp/trading/structs.js +5813 -0
- package/dist/src/typus_perp/treasury-caps/functions.d.ts +9 -0
- package/dist/src/typus_perp/treasury-caps/functions.js +36 -0
- package/dist/src/typus_perp/treasury-caps/structs.d.ts +49 -0
- package/dist/src/typus_perp/treasury-caps/structs.js +223 -0
- package/dist/src/typus_perp/user-account/functions.d.ts +36 -0
- package/dist/src/typus_perp/user-account/functions.js +70 -0
- package/dist/src/typus_perp/user-account/structs.d.ts +148 -0
- package/dist/src/typus_perp/user-account/structs.js +448 -0
- package/dist/src/typus_stake_pool/admin/functions.d.ts +49 -0
- package/dist/src/typus_stake_pool/admin/functions.js +105 -0
- package/dist/src/typus_stake_pool/admin/structs.d.ts +365 -0
- package/dist/src/typus_stake_pool/admin/structs.js +789 -0
- package/dist/src/typus_stake_pool/index.d.ts +1 -0
- package/dist/src/typus_stake_pool/index.js +7 -0
- package/dist/src/typus_stake_pool/init.d.ts +2 -0
- package/dist/src/typus_stake_pool/init.js +69 -0
- package/dist/src/typus_stake_pool/stake-pool/functions.d.ts +229 -0
- package/dist/src/typus_stake_pool/stake-pool/functions.js +380 -0
- package/dist/src/typus_stake_pool/stake-pool/structs.d.ts +2199 -0
- package/dist/src/typus_stake_pool/stake-pool/structs.js +4653 -0
- package/dist/src/user/history.js +685 -614
- package/dist/src/user/order.d.ts +11 -16
- package/dist/src/user/order.js +302 -171
- package/dist/src/user/orderWithBidReceipt.d.ts +6 -8
- package/dist/src/user/orderWithBidReceipt.js +225 -127
- package/dist/src/user/tlp.d.ts +24 -25
- package/dist/src/user/tlp.js +468 -317
- package/package.json +3 -11
- package/dist/src/client.d.ts +0 -27
- package/dist/src/client.js +0 -108
- package/dist/src/generated/typus_perp/admin.d.ts +0 -117
- package/dist/src/generated/typus_perp/admin.js +0 -110
- package/dist/src/generated/typus_perp/competition.d.ts +0 -22
- package/dist/src/generated/typus_perp/competition.js +0 -58
- package/dist/src/generated/typus_perp/deps/std/type_name.d.ts +0 -17
- package/dist/src/generated/typus_perp/deps/std/type_name.js +0 -25
- package/dist/src/generated/typus_perp/deps/sui/balance.d.ts +0 -12
- package/dist/src/generated/typus_perp/deps/sui/balance.js +0 -20
- package/dist/src/generated/typus_perp/deps/sui/object.d.ts +0 -8
- package/dist/src/generated/typus_perp/deps/sui/object.js +0 -16
- package/dist/src/generated/typus_perp/deps/sui/object_table.d.ts +0 -19
- package/dist/src/generated/typus_perp/deps/sui/object_table.js +0 -59
- package/dist/src/generated/typus_perp/deps/sui/vec_set.d.ts +0 -18
- package/dist/src/generated/typus_perp/deps/sui/vec_set.js +0 -25
- package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.d.ts +0 -30
- package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.js +0 -67
- package/dist/src/generated/typus_perp/deps/typus/linked_object_table.d.ts +0 -32
- package/dist/src/generated/typus_perp/deps/typus/linked_object_table.js +0 -71
- package/dist/src/generated/typus_perp/deps/typus_framework/vault.d.ts +0 -23
- package/dist/src/generated/typus_perp/deps/typus_framework/vault.js +0 -61
- package/dist/src/generated/typus_perp/escrow.d.ts +0 -59
- package/dist/src/generated/typus_perp/escrow.js +0 -76
- 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/lp_pool.d.ts +0 -2327
- package/dist/src/generated/typus_perp/lp_pool.js +0 -1956
- package/dist/src/generated/typus_perp/math.d.ts +0 -95
- package/dist/src/generated/typus_perp/math.js +0 -97
- package/dist/src/generated/typus_perp/position.d.ts +0 -234
- package/dist/src/generated/typus_perp/position.js +0 -204
- package/dist/src/generated/typus_perp/symbol.d.ts +0 -18
- package/dist/src/generated/typus_perp/symbol.js +0 -55
- package/dist/src/generated/typus_perp/tlp.d.ts +0 -13
- package/dist/src/generated/typus_perp/tlp.js +0 -56
- package/dist/src/generated/typus_perp/trading.d.ts +0 -2486
- package/dist/src/generated/typus_perp/trading.js +0 -2476
- package/dist/src/generated/typus_perp/treasury_caps.d.ts +0 -13
- package/dist/src/generated/typus_perp/user_account.d.ts +0 -40
- package/dist/src/generated/typus_perp/user_account.js +0 -72
- package/dist/src/generated/typus_stake_pool/admin.d.ts +0 -234
- package/dist/src/generated/typus_stake_pool/admin.js +0 -272
- package/dist/src/generated/typus_stake_pool/deps/std/type_name.d.ts +0 -17
- package/dist/src/generated/typus_stake_pool/deps/std/type_name.js +0 -25
- package/dist/src/generated/typus_stake_pool/deps/sui/object.d.ts +0 -8
- package/dist/src/generated/typus_stake_pool/deps/sui/object.js +0 -16
- package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.d.ts +0 -30
- package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.js +0 -37
- package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.d.ts +0 -18
- package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.js +0 -25
- package/dist/src/generated/typus_stake_pool/stake_pool.d.ts +0 -986
- package/dist/src/generated/typus_stake_pool/stake_pool.js +0 -874
- package/dist/src/generated/utils/index.d.ts +0 -11
- package/dist/src/generated/utils/index.js +0 -135
- package/dist/src/grpc/graphql.d.ts +0 -26
- package/dist/src/grpc/graphql.js +0 -126
- package/dist/src/grpc/grpc.d.ts +0 -1
- package/dist/src/grpc/grpc.js +0 -38
- package/dist/src/grpc/ledgerService.js +0 -64
- package/dist/src/grpc/liveDataService.d.ts +0 -0
- package/dist/src/grpc/liveDataService.js +0 -49
- /package/dist/src/{grpc/ledgerService.d.ts → pyth.d.ts} +0 -0
package/dist/src/user/order.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Position, TradingOrder } from "
|
|
1
|
+
import { Position, TradingOrder } from "../typus_perp/position/structs";
|
|
2
|
+
import { PythClient, TypusConfig } from "@typus/typus-sdk/dist/src/utils";
|
|
2
3
|
import { TOKEN } from "@typus/typus-sdk/dist/src/constants";
|
|
3
4
|
import { Transaction } from "@mysten/sui/transactions";
|
|
4
|
-
|
|
5
|
-
export declare function createTradingOrder(client: TypusClient, tx: Transaction, input: {
|
|
6
|
-
perpIndex: string;
|
|
5
|
+
export declare function createTradingOrder(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
7
6
|
coins: string[];
|
|
8
7
|
cToken: TOKEN;
|
|
9
8
|
amount: string;
|
|
@@ -17,26 +16,22 @@ export declare function createTradingOrder(client: TypusClient, tx: Transaction,
|
|
|
17
16
|
suiCoins?: string[];
|
|
18
17
|
}): Promise<Transaction>;
|
|
19
18
|
export declare function zeroCoin(tx: Transaction, typeArgs: [string]): import("@mysten/sui/transactions").TransactionResult;
|
|
20
|
-
export declare function cancelTradingOrder(
|
|
21
|
-
|
|
22
|
-
order: typeof TradingOrder.$inferType;
|
|
19
|
+
export declare function cancelTradingOrder(config: TypusConfig, tx: Transaction, input: {
|
|
20
|
+
order: TradingOrder;
|
|
23
21
|
user: string;
|
|
24
22
|
}): Promise<Transaction>;
|
|
25
|
-
export declare function increaseCollateral(
|
|
26
|
-
perpIndex: string;
|
|
23
|
+
export declare function increaseCollateral(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
27
24
|
coins: string[];
|
|
28
25
|
amount: string;
|
|
29
|
-
position:
|
|
26
|
+
position: Position;
|
|
30
27
|
suiCoins?: string[];
|
|
31
28
|
}): Promise<Transaction>;
|
|
32
|
-
export declare function releaseCollateral(
|
|
33
|
-
|
|
34
|
-
position: typeof Position.$inferType;
|
|
29
|
+
export declare function releaseCollateral(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
30
|
+
position: Position;
|
|
35
31
|
amount: string;
|
|
36
32
|
suiCoins?: string[];
|
|
37
33
|
}): Promise<Transaction>;
|
|
38
|
-
export declare function collectPositionFundingFee(
|
|
39
|
-
|
|
40
|
-
position: typeof Position.$inferType;
|
|
34
|
+
export declare function collectPositionFundingFee(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
35
|
+
position: Position;
|
|
41
36
|
suiCoins?: string[];
|
|
42
37
|
}): Promise<Transaction>;
|
package/dist/src/user/order.js
CHANGED
|
@@ -1,4 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
39
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
40
|
+
if (!m) return o;
|
|
41
|
+
var i = m.call(o), r, ar = [], e;
|
|
42
|
+
try {
|
|
43
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
44
|
+
}
|
|
45
|
+
catch (error) { e = { error: error }; }
|
|
46
|
+
finally {
|
|
47
|
+
try {
|
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
+
}
|
|
50
|
+
finally { if (e) throw e.error; }
|
|
51
|
+
}
|
|
52
|
+
return ar;
|
|
53
|
+
};
|
|
54
|
+
var __values = (this && this.__values) || function(o) {
|
|
55
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
56
|
+
if (m) return m.call(o);
|
|
57
|
+
if (o && typeof o.length === "number") return {
|
|
58
|
+
next: function () {
|
|
59
|
+
if (o && i >= o.length) o = void 0;
|
|
60
|
+
return { value: o && o[i++], done: !o };
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
64
|
+
};
|
|
2
65
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
66
|
exports.createTradingOrder = createTradingOrder;
|
|
4
67
|
exports.zeroCoin = zeroCoin;
|
|
@@ -6,185 +69,253 @@ exports.cancelTradingOrder = cancelTradingOrder;
|
|
|
6
69
|
exports.increaseCollateral = increaseCollateral;
|
|
7
70
|
exports.releaseCollateral = releaseCollateral;
|
|
8
71
|
exports.collectPositionFundingFee = collectPositionFundingFee;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
var functions_1 = require("../typus_perp/trading/functions");
|
|
73
|
+
var __1 = require("..");
|
|
74
|
+
var utils_1 = require("@typus/typus-sdk/dist/src/utils");
|
|
75
|
+
var constants_1 = require("@typus/typus-sdk/dist/src/constants");
|
|
76
|
+
function createTradingOrder(config, tx, pythClient, input) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
+
var TOKEN, BASE_TOKEN, tokens, cToken, baseToken, coin, suiCoin, tokens_1, tokens_1_1, token;
|
|
79
|
+
var _a, e_1, _b;
|
|
80
|
+
return __generator(this, function (_c) {
|
|
81
|
+
switch (_c.label) {
|
|
82
|
+
case 0:
|
|
83
|
+
TOKEN = input.cToken;
|
|
84
|
+
BASE_TOKEN = input.tradingToken;
|
|
85
|
+
tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
|
|
86
|
+
cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
|
|
87
|
+
baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
|
|
88
|
+
if (TOKEN == "SUI" && config.sponsored) {
|
|
89
|
+
// split together
|
|
90
|
+
_a = __read((0, utils_1.splitCoins)(tx, constants_1.tokenType.MAINNET.SUI, input.coins, [input.amount, tokens.length.toString()], config.sponsored), 2), coin = _a[0], suiCoin = _a[1];
|
|
91
|
+
}
|
|
92
|
+
else if (config.sponsored) {
|
|
93
|
+
coin = (0, utils_1.splitCoin)(tx, cToken, input.coins, input.amount, config.sponsored);
|
|
94
|
+
suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), config.sponsored);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
coin = (0, utils_1.splitCoin)(tx, cToken, input.coins, input.amount, config.sponsored);
|
|
98
|
+
// no suiCoin
|
|
99
|
+
}
|
|
100
|
+
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens, suiCoin)];
|
|
101
|
+
case 1:
|
|
102
|
+
_c.sent();
|
|
103
|
+
try {
|
|
104
|
+
for (tokens_1 = __values(tokens), tokens_1_1 = tokens_1.next(); !tokens_1_1.done; tokens_1_1 = tokens_1.next()) {
|
|
105
|
+
token = tokens_1_1.value;
|
|
106
|
+
(0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, token);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
110
|
+
finally {
|
|
111
|
+
try {
|
|
112
|
+
if (tokens_1_1 && !tokens_1_1.done && (_b = tokens_1.return)) _b.call(tokens_1);
|
|
113
|
+
}
|
|
114
|
+
finally { if (e_1) throw e_1.error; }
|
|
115
|
+
}
|
|
116
|
+
(0, functions_1.createTradingOrderV2)(tx, [cToken, baseToken], {
|
|
117
|
+
version: __1.PERP_VERSION,
|
|
118
|
+
registry: __1.MARKET,
|
|
119
|
+
poolRegistry: __1.LP_POOL,
|
|
120
|
+
marketIndex: BigInt(0),
|
|
121
|
+
poolIndex: BigInt(0),
|
|
122
|
+
typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
|
|
123
|
+
typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
|
|
124
|
+
clock: constants_1.CLOCK,
|
|
125
|
+
typusEcosystemVersion: config.version.typus,
|
|
126
|
+
typusUserRegistry: config.registry.typus.user,
|
|
127
|
+
typusLeaderboardRegistry: config.registry.typus.leaderboard,
|
|
128
|
+
collateral: coin,
|
|
129
|
+
size: BigInt(input.size),
|
|
130
|
+
triggerPrice: BigInt(input.triggerPrice),
|
|
131
|
+
isLong: input.isLong,
|
|
132
|
+
isStopOrder: input.isStopOrder,
|
|
133
|
+
reduceOnly: input.reduceOnly,
|
|
134
|
+
linkedPositionId: input.linkedPositionId ? BigInt(input.linkedPositionId) : null,
|
|
135
|
+
tailsStakingRegistry: config.registry.typus.tailsStaking,
|
|
136
|
+
competitionConfig: __1.COMPETITION_CONFIG,
|
|
137
|
+
});
|
|
138
|
+
return [2 /*return*/, tx];
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
});
|
|
63
142
|
}
|
|
64
143
|
function zeroCoin(tx, typeArgs) {
|
|
65
144
|
return tx.moveCall({
|
|
66
|
-
target:
|
|
145
|
+
target: "0x2::coin::zero",
|
|
67
146
|
typeArguments: typeArgs,
|
|
68
147
|
arguments: [],
|
|
69
148
|
});
|
|
70
149
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
150
|
+
function cancelTradingOrder(config, tx, input) {
|
|
151
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152
|
+
var cToken, BASE_TOKEN, coin;
|
|
153
|
+
return __generator(this, function (_a) {
|
|
154
|
+
cToken = "0x" + input.order.collateralToken.name;
|
|
155
|
+
BASE_TOKEN = "0x" + input.order.symbol.baseToken.name;
|
|
156
|
+
coin = (0, functions_1.cancelTradingOrder)(tx, [cToken, BASE_TOKEN], {
|
|
157
|
+
version: __1.PERP_VERSION,
|
|
158
|
+
registry: __1.MARKET,
|
|
159
|
+
marketIndex: BigInt(0),
|
|
160
|
+
orderId: input.order.orderId,
|
|
161
|
+
triggerPrice: input.order.triggerPrice,
|
|
162
|
+
orderUser: null,
|
|
163
|
+
});
|
|
164
|
+
tx.transferObjects([coin], input.user);
|
|
165
|
+
return [2 /*return*/, tx];
|
|
166
|
+
});
|
|
167
|
+
});
|
|
87
168
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
169
|
+
function increaseCollateral(config, tx, pythClient, input) {
|
|
170
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
171
|
+
var TOKEN, BASE_TOKEN, tokens, cToken, baseToken, coin, suiCoin, tokens_2, tokens_2_1, token;
|
|
172
|
+
var _a, e_2, _b;
|
|
173
|
+
return __generator(this, function (_c) {
|
|
174
|
+
switch (_c.label) {
|
|
175
|
+
case 0:
|
|
176
|
+
TOKEN = (0, constants_1.typeArgToAsset)(input.position.collateralToken.name);
|
|
177
|
+
BASE_TOKEN = (0, constants_1.typeArgToAsset)(input.position.symbol.baseToken.name);
|
|
178
|
+
tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
|
|
179
|
+
cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
|
|
180
|
+
baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
|
|
181
|
+
if (TOKEN == "SUI" && config.sponsored) {
|
|
182
|
+
// split together
|
|
183
|
+
_a = __read((0, utils_1.splitCoins)(tx, constants_1.tokenType.MAINNET.SUI, input.coins, [input.amount, tokens.length.toString()], config.sponsored), 2), coin = _a[0], suiCoin = _a[1];
|
|
184
|
+
}
|
|
185
|
+
else if (config.sponsored) {
|
|
186
|
+
coin = (0, utils_1.splitCoin)(tx, cToken, input.coins, input.amount, config.sponsored);
|
|
187
|
+
suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), config.sponsored);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
coin = (0, utils_1.splitCoin)(tx, cToken, input.coins, input.amount, config.sponsored);
|
|
191
|
+
// no suiCoin
|
|
192
|
+
}
|
|
193
|
+
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens, suiCoin)];
|
|
194
|
+
case 1:
|
|
195
|
+
_c.sent();
|
|
196
|
+
try {
|
|
197
|
+
for (tokens_2 = __values(tokens), tokens_2_1 = tokens_2.next(); !tokens_2_1.done; tokens_2_1 = tokens_2.next()) {
|
|
198
|
+
token = tokens_2_1.value;
|
|
199
|
+
(0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, token);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
203
|
+
finally {
|
|
204
|
+
try {
|
|
205
|
+
if (tokens_2_1 && !tokens_2_1.done && (_b = tokens_2.return)) _b.call(tokens_2);
|
|
206
|
+
}
|
|
207
|
+
finally { if (e_2) throw e_2.error; }
|
|
208
|
+
}
|
|
209
|
+
(0, functions_1.increaseCollateral)(tx, [cToken, baseToken], {
|
|
210
|
+
version: __1.PERP_VERSION,
|
|
211
|
+
registry: __1.MARKET,
|
|
212
|
+
poolRegistry: __1.LP_POOL,
|
|
213
|
+
marketIndex: BigInt(0),
|
|
214
|
+
poolIndex: BigInt(0),
|
|
215
|
+
typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
|
|
216
|
+
typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
|
|
217
|
+
clock: constants_1.CLOCK,
|
|
218
|
+
positionId: BigInt(input.position.positionId),
|
|
219
|
+
collateral: coin,
|
|
220
|
+
});
|
|
221
|
+
return [2 /*return*/, tx];
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
});
|
|
128
225
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
226
|
+
function releaseCollateral(config, tx, pythClient, input) {
|
|
227
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
228
|
+
var TOKEN, BASE_TOKEN, tokens, suiCoin, tokens_3, tokens_3_1, token, cToken, baseToken, coin;
|
|
229
|
+
var e_3, _a;
|
|
230
|
+
return __generator(this, function (_b) {
|
|
231
|
+
switch (_b.label) {
|
|
232
|
+
case 0:
|
|
233
|
+
TOKEN = (0, constants_1.typeArgToAsset)(input.position.collateralToken.name);
|
|
234
|
+
BASE_TOKEN = (0, constants_1.typeArgToAsset)(input.position.symbol.baseToken.name);
|
|
235
|
+
tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
|
|
236
|
+
if (config.sponsored) {
|
|
237
|
+
suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), config.sponsored);
|
|
238
|
+
}
|
|
239
|
+
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens, suiCoin)];
|
|
240
|
+
case 1:
|
|
241
|
+
_b.sent();
|
|
242
|
+
try {
|
|
243
|
+
for (tokens_3 = __values(tokens), tokens_3_1 = tokens_3.next(); !tokens_3_1.done; tokens_3_1 = tokens_3.next()) {
|
|
244
|
+
token = tokens_3_1.value;
|
|
245
|
+
(0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, token);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
249
|
+
finally {
|
|
250
|
+
try {
|
|
251
|
+
if (tokens_3_1 && !tokens_3_1.done && (_a = tokens_3.return)) _a.call(tokens_3);
|
|
252
|
+
}
|
|
253
|
+
finally { if (e_3) throw e_3.error; }
|
|
254
|
+
}
|
|
255
|
+
cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
|
|
256
|
+
baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
|
|
257
|
+
coin = (0, functions_1.releaseCollateral)(tx, [cToken, baseToken], {
|
|
258
|
+
version: __1.PERP_VERSION,
|
|
259
|
+
registry: __1.MARKET,
|
|
260
|
+
poolRegistry: __1.LP_POOL,
|
|
261
|
+
marketIndex: BigInt(0),
|
|
262
|
+
poolIndex: BigInt(0),
|
|
263
|
+
typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
|
|
264
|
+
typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
|
|
265
|
+
clock: constants_1.CLOCK,
|
|
266
|
+
positionId: BigInt(input.position.positionId),
|
|
267
|
+
releaseAmount: BigInt(input.amount),
|
|
268
|
+
});
|
|
269
|
+
tx.transferObjects([coin], input.position.user);
|
|
270
|
+
return [2 /*return*/, tx];
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
});
|
|
160
274
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
275
|
+
function collectPositionFundingFee(config, tx, pythClient, input) {
|
|
276
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
277
|
+
var TOKEN, BASE_TOKEN, tokens, suiCoin, tokens_4, tokens_4_1, token, cToken, baseToken;
|
|
278
|
+
var e_4, _a;
|
|
279
|
+
return __generator(this, function (_b) {
|
|
280
|
+
switch (_b.label) {
|
|
281
|
+
case 0:
|
|
282
|
+
TOKEN = (0, constants_1.typeArgToAsset)(input.position.collateralToken.name);
|
|
283
|
+
BASE_TOKEN = (0, constants_1.typeArgToAsset)(input.position.symbol.baseToken.name);
|
|
284
|
+
tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
|
|
285
|
+
if (config.sponsored) {
|
|
286
|
+
suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), config.sponsored);
|
|
287
|
+
}
|
|
288
|
+
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens, suiCoin)];
|
|
289
|
+
case 1:
|
|
290
|
+
_b.sent();
|
|
291
|
+
try {
|
|
292
|
+
for (tokens_4 = __values(tokens), tokens_4_1 = tokens_4.next(); !tokens_4_1.done; tokens_4_1 = tokens_4.next()) {
|
|
293
|
+
token = tokens_4_1.value;
|
|
294
|
+
(0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, token);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
298
|
+
finally {
|
|
299
|
+
try {
|
|
300
|
+
if (tokens_4_1 && !tokens_4_1.done && (_a = tokens_4.return)) _a.call(tokens_4);
|
|
301
|
+
}
|
|
302
|
+
finally { if (e_4) throw e_4.error; }
|
|
303
|
+
}
|
|
304
|
+
cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
|
|
305
|
+
baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
|
|
306
|
+
(0, functions_1.collectPositionFundingFee)(tx, [cToken, baseToken], {
|
|
307
|
+
version: __1.PERP_VERSION,
|
|
308
|
+
registry: __1.MARKET,
|
|
309
|
+
poolRegistry: __1.LP_POOL,
|
|
310
|
+
marketIndex: BigInt(0),
|
|
311
|
+
poolIndex: BigInt(0),
|
|
312
|
+
typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
|
|
313
|
+
typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
|
|
314
|
+
clock: constants_1.CLOCK,
|
|
315
|
+
positionId: BigInt(input.position.positionId),
|
|
316
|
+
});
|
|
317
|
+
return [2 /*return*/, tx];
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
});
|
|
190
321
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
+
import { PythClient, TypusConfig } from "@typus/typus-sdk/dist/src/utils";
|
|
2
3
|
import { TOKEN } from "@typus/typus-sdk/dist/src/constants";
|
|
3
|
-
|
|
4
|
-
export declare function createTradingOrderWithBidReceiptByAutoBid(client: TypusClient, tx: Transaction, input: {
|
|
4
|
+
export declare function createTradingOrderWithBidReceiptByAutoBid(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
5
5
|
cToken: TOKEN;
|
|
6
6
|
tradingToken: TOKEN;
|
|
7
7
|
isLong: boolean;
|
|
8
8
|
user: string;
|
|
9
|
-
|
|
9
|
+
index: string;
|
|
10
10
|
bToken: TOKEN;
|
|
11
11
|
signalIndex: string;
|
|
12
12
|
strategyIndex: string;
|
|
13
|
+
share?: string;
|
|
13
14
|
suiCoins?: string[];
|
|
14
|
-
perpIndex?: number;
|
|
15
15
|
}): Promise<Transaction>;
|
|
16
|
-
export declare function createTradingOrderWithBidReceipt(
|
|
16
|
+
export declare function createTradingOrderWithBidReceipt(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
17
17
|
cToken: TOKEN;
|
|
18
18
|
tradingToken: TOKEN;
|
|
19
19
|
isLong: boolean;
|
|
@@ -23,14 +23,12 @@ export declare function createTradingOrderWithBidReceipt(client: TypusClient, tx
|
|
|
23
23
|
bidReceipts: string[];
|
|
24
24
|
share?: string;
|
|
25
25
|
suiCoins?: string[];
|
|
26
|
-
perpIndex?: number;
|
|
27
26
|
}): Promise<Transaction>;
|
|
28
|
-
export declare function reduceOptionCollateralPositionSize(
|
|
27
|
+
export declare function reduceOptionCollateralPositionSize(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
29
28
|
cToken: TOKEN;
|
|
30
29
|
tradingToken: TOKEN;
|
|
31
30
|
bToken: string;
|
|
32
31
|
positionId: string;
|
|
33
32
|
orderSize: string | null;
|
|
34
33
|
suiCoins?: string[];
|
|
35
|
-
perpIndex?: number;
|
|
36
34
|
}): Promise<Transaction>;
|