@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/tlp.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.snapshot = snapshot;
|
|
4
67
|
exports.mintStakeLp = mintStakeLp;
|
|
@@ -9,334 +72,422 @@ exports.redeemTlp = redeemTlp;
|
|
|
9
72
|
exports.claim = claim;
|
|
10
73
|
exports.swap = swap;
|
|
11
74
|
exports.harvestStakeReward = harvestStakeReward;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
version: __1.STAKE_POOL_VERSION,
|
|
22
|
-
registry: __1.STAKE_POOL,
|
|
23
|
-
index: BigInt(input.perpIndex),
|
|
24
|
-
typusEcosystemVersion: client.config.version.typus,
|
|
25
|
-
typusUserRegistry: client.config.registry.typus.user,
|
|
26
|
-
},
|
|
27
|
-
}));
|
|
28
|
-
return tx;
|
|
29
|
-
}
|
|
30
|
-
async function mintStakeLp(client, tx, input) {
|
|
31
|
-
// update pyth oracle
|
|
32
|
-
let tokens = input.lpPool.token_pools.map((p) => (0, constants_1.typeArgToAsset)("0x" + p.token_type.name));
|
|
33
|
-
// console.log("tokens", tokens);
|
|
34
|
-
let cToken = constants_1.tokenType[__1.NETWORK][input.cTOKEN];
|
|
35
|
-
let coin;
|
|
36
|
-
let suiCoin;
|
|
37
|
-
if (input.cTOKEN == "SUI" && client.config.sponsored) {
|
|
38
|
-
// split together
|
|
39
|
-
[coin, suiCoin] = (0, utils_2.splitCoins)(tx, constants_1.tokenType.MAINNET.SUI, input.coins, [input.amount, tokens.length.toString()], client.config.sponsored);
|
|
40
|
-
}
|
|
41
|
-
else if (client.config.sponsored) {
|
|
42
|
-
coin = (0, utils_2.splitCoin)(tx, cToken, input.coins, input.amount, client.config.sponsored);
|
|
43
|
-
suiCoin = (0, utils_2.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), client.config.sponsored);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
coin = (0, utils_2.splitCoin)(tx, cToken, input.coins, input.amount, client.config.sponsored);
|
|
47
|
-
// no suiCoin
|
|
48
|
-
}
|
|
49
|
-
await (0, utils_2.updatePyth)(client.pythClient, tx, tokens, suiCoin);
|
|
50
|
-
for (let token of tokens) {
|
|
51
|
-
(0, utils_2.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
|
|
52
|
-
tx.add((0, lp_pool_1.updateLiquidityValue)({
|
|
53
|
-
arguments: {
|
|
54
|
-
version: __1.PERP_VERSION,
|
|
55
|
-
registry: __1.LP_POOL,
|
|
56
|
-
index: BigInt(input.stakePool.pool_info.index),
|
|
57
|
-
oracle: constants_1.oracle[__1.NETWORK][token],
|
|
58
|
-
},
|
|
59
|
-
typeArguments: [constants_1.tokenType[__1.NETWORK][token]],
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
// console.log(iToken);
|
|
63
|
-
if (input.userShareId) {
|
|
64
|
-
harvestStakeReward(client, tx, { stakePool: input.stakePool, userShareId: input.userShareId, user: input.user });
|
|
65
|
-
}
|
|
66
|
-
let lpToken = (0, utils_1.normalizeStructTag)(input.lpPool.lp_token_type.name);
|
|
67
|
-
let lpCoin = tx.add((0, lp_pool_1.mintLp)({
|
|
68
|
-
arguments: {
|
|
69
|
-
version: __1.PERP_VERSION,
|
|
70
|
-
registry: __1.LP_POOL,
|
|
71
|
-
treasuryCaps: __1.TLP_TREASURY_CAP,
|
|
72
|
-
index: BigInt(input.stakePool.pool_info.index),
|
|
73
|
-
oracle: constants_1.oracle[__1.NETWORK][input.cTOKEN],
|
|
74
|
-
coin,
|
|
75
|
-
},
|
|
76
|
-
typeArguments: [cToken, lpToken],
|
|
77
|
-
}));
|
|
78
|
-
if (input.stake) {
|
|
79
|
-
tx.add((0, stake_pool_1.stake)({
|
|
80
|
-
arguments: {
|
|
75
|
+
var functions_1 = require("../typus_perp/lp-pool/functions");
|
|
76
|
+
var functions_2 = require("../typus_stake_pool/stake-pool/functions");
|
|
77
|
+
var utils_1 = require("@typus/typus-sdk/dist/src/utils");
|
|
78
|
+
var constants_1 = require("@typus/typus-sdk/dist/src/constants");
|
|
79
|
+
var __1 = require("..");
|
|
80
|
+
function snapshot(config, tx, input) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
82
|
+
return __generator(this, function (_a) {
|
|
83
|
+
(0, functions_2.snapshot)(tx, {
|
|
81
84
|
version: __1.STAKE_POOL_VERSION,
|
|
82
85
|
registry: __1.STAKE_POOL,
|
|
83
|
-
index: BigInt(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
return tx;
|
|
86
|
+
index: BigInt(0),
|
|
87
|
+
clock: constants_1.CLOCK,
|
|
88
|
+
userShareId: BigInt(input.userShareId),
|
|
89
|
+
typusEcosystemVersion: config.version.typus,
|
|
90
|
+
typusUserRegistry: config.registry.typus.user,
|
|
91
|
+
});
|
|
92
|
+
return [2 /*return*/, tx];
|
|
93
|
+
});
|
|
94
|
+
});
|
|
93
95
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
96
|
+
function mintStakeLp(config, tx, pythClient, input) {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
+
var tokens, cToken, coin, suiCoin, tokens_1, tokens_1_1, token, lpCoin;
|
|
99
|
+
var _a, e_1, _b;
|
|
100
|
+
return __generator(this, function (_c) {
|
|
101
|
+
switch (_c.label) {
|
|
102
|
+
case 0:
|
|
103
|
+
tokens = input.lpPool.tokenPools.map(function (p) { return (0, constants_1.typeArgToAsset)("0x" + p.tokenType.name); });
|
|
104
|
+
cToken = constants_1.tokenType[__1.NETWORK][input.cTOKEN];
|
|
105
|
+
if (input.cTOKEN == "SUI" && config.sponsored) {
|
|
106
|
+
// split together
|
|
107
|
+
_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];
|
|
108
|
+
}
|
|
109
|
+
else if (config.sponsored) {
|
|
110
|
+
coin = (0, utils_1.splitCoin)(tx, cToken, input.coins, input.amount, config.sponsored);
|
|
111
|
+
suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), config.sponsored);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
coin = (0, utils_1.splitCoin)(tx, cToken, input.coins, input.amount, config.sponsored);
|
|
115
|
+
// no suiCoin
|
|
116
|
+
}
|
|
117
|
+
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens, suiCoin)];
|
|
118
|
+
case 1:
|
|
119
|
+
_c.sent();
|
|
120
|
+
try {
|
|
121
|
+
for (tokens_1 = __values(tokens), tokens_1_1 = tokens_1.next(); !tokens_1_1.done; tokens_1_1 = tokens_1.next()) {
|
|
122
|
+
token = tokens_1_1.value;
|
|
123
|
+
(0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, token);
|
|
124
|
+
(0, functions_1.updateLiquidityValue)(tx, constants_1.tokenType[__1.NETWORK][token], {
|
|
125
|
+
version: __1.PERP_VERSION,
|
|
126
|
+
registry: __1.LP_POOL,
|
|
127
|
+
index: BigInt(0),
|
|
128
|
+
oracle: constants_1.oracle[__1.NETWORK][token],
|
|
129
|
+
clock: constants_1.CLOCK,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
134
|
+
finally {
|
|
135
|
+
try {
|
|
136
|
+
if (tokens_1_1 && !tokens_1_1.done && (_b = tokens_1.return)) _b.call(tokens_1);
|
|
137
|
+
}
|
|
138
|
+
finally { if (e_1) throw e_1.error; }
|
|
139
|
+
}
|
|
140
|
+
// console.log(iToken);
|
|
141
|
+
if (input.userShareId) {
|
|
142
|
+
harvestStakeReward(config, tx, { stakePool: input.stakePool, userShareId: input.userShareId, user: input.user });
|
|
143
|
+
}
|
|
144
|
+
lpCoin = (0, functions_1.mintLp)(tx, [cToken, __1.TLP_TOKEN], {
|
|
145
|
+
version: __1.PERP_VERSION,
|
|
146
|
+
registry: __1.LP_POOL,
|
|
147
|
+
treasuryCaps: __1.TLP_TREASURY_CAP,
|
|
148
|
+
index: BigInt(0),
|
|
149
|
+
oracle: constants_1.oracle[__1.NETWORK][input.cTOKEN],
|
|
150
|
+
coin: coin,
|
|
151
|
+
clock: constants_1.CLOCK,
|
|
152
|
+
});
|
|
153
|
+
if (input.stake) {
|
|
154
|
+
(0, functions_2.stake)(tx, __1.TLP_TOKEN, {
|
|
155
|
+
version: __1.STAKE_POOL_VERSION,
|
|
156
|
+
registry: __1.STAKE_POOL,
|
|
157
|
+
index: BigInt(0),
|
|
158
|
+
lpToken: lpCoin,
|
|
159
|
+
clock: constants_1.CLOCK,
|
|
160
|
+
isAutoCompound: input.isAutoCompound ? BigInt(1) : null,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
tx.transferObjects([lpCoin], input.user);
|
|
165
|
+
}
|
|
166
|
+
return [2 /*return*/, tx];
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
});
|
|
115
170
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
171
|
+
function stakeLp(config, tx, input) {
|
|
172
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
173
|
+
var coin, destination;
|
|
174
|
+
var _a;
|
|
175
|
+
return __generator(this, function (_b) {
|
|
176
|
+
destination = input.lpCoins.pop();
|
|
177
|
+
if (input.lpCoins.length > 0) {
|
|
178
|
+
tx.mergeCoins(destination, input.lpCoins);
|
|
179
|
+
}
|
|
180
|
+
_a = __read(tx.splitCoins(destination, [input.amount]), 1), coin = _a[0];
|
|
181
|
+
// console.log(iToken);
|
|
182
|
+
if (input.userShareId) {
|
|
183
|
+
harvestStakeReward(config, tx, { stakePool: input.stakePool, userShareId: input.userShareId, user: input.user });
|
|
184
|
+
}
|
|
185
|
+
(0, functions_2.stake)(tx, __1.TLP_TOKEN, {
|
|
186
|
+
version: __1.STAKE_POOL_VERSION,
|
|
187
|
+
registry: __1.STAKE_POOL,
|
|
188
|
+
index: BigInt(0),
|
|
189
|
+
lpToken: coin,
|
|
190
|
+
clock: constants_1.CLOCK,
|
|
191
|
+
isAutoCompound: null,
|
|
192
|
+
});
|
|
193
|
+
return [2 /*return*/, tx];
|
|
194
|
+
});
|
|
195
|
+
});
|
|
138
196
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
arguments: {
|
|
163
|
-
version: __1.STAKE_POOL_VERSION,
|
|
164
|
-
registry: __1.STAKE_POOL,
|
|
165
|
-
index: BigInt(input.stakePool.pool_info.index),
|
|
166
|
-
unsubscribedShares: input.share ? BigInt(input.share) : null,
|
|
167
|
-
},
|
|
168
|
-
typeArguments: [lpToken],
|
|
169
|
-
}));
|
|
170
|
-
let lpCoin = tx.add((0, stake_pool_1.unstake)({
|
|
171
|
-
arguments: {
|
|
172
|
-
version: __1.STAKE_POOL_VERSION,
|
|
173
|
-
registry: __1.STAKE_POOL,
|
|
174
|
-
index: BigInt(input.stakePool.pool_info.index),
|
|
175
|
-
},
|
|
176
|
-
typeArguments: [lpToken],
|
|
177
|
-
}));
|
|
178
|
-
let balance = tx.moveCall({
|
|
179
|
-
target: `0x2::coin::into_balance`,
|
|
180
|
-
typeArguments: [input.lpPool.lp_token_type.name],
|
|
181
|
-
arguments: [lpCoin],
|
|
197
|
+
function unstake(config, tx, input) {
|
|
198
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
199
|
+
var lpCoin;
|
|
200
|
+
return __generator(this, function (_a) {
|
|
201
|
+
harvestStakeReward(config, tx, { stakePool: input.stakePool, userShareId: input.userShareId, user: input.user });
|
|
202
|
+
(0, functions_2.unsubscribe)(tx, __1.TLP_TOKEN, {
|
|
203
|
+
version: __1.STAKE_POOL_VERSION,
|
|
204
|
+
registry: __1.STAKE_POOL,
|
|
205
|
+
index: BigInt(0),
|
|
206
|
+
userShareId: BigInt(input.userShareId),
|
|
207
|
+
clock: constants_1.CLOCK,
|
|
208
|
+
unsubscribedShares: input.share ? BigInt(input.share) : null,
|
|
209
|
+
});
|
|
210
|
+
lpCoin = (0, functions_2.unstake)(tx, __1.TLP_TOKEN, {
|
|
211
|
+
version: __1.STAKE_POOL_VERSION,
|
|
212
|
+
registry: __1.STAKE_POOL,
|
|
213
|
+
index: BigInt(0),
|
|
214
|
+
userShareId: BigInt(input.userShareId),
|
|
215
|
+
clock: constants_1.CLOCK,
|
|
216
|
+
});
|
|
217
|
+
tx.transferObjects([lpCoin], input.user);
|
|
218
|
+
return [2 /*return*/, tx];
|
|
219
|
+
});
|
|
182
220
|
});
|
|
183
|
-
tx.add((0, lp_pool_1.redeem)({
|
|
184
|
-
arguments: {
|
|
185
|
-
version: __1.PERP_VERSION,
|
|
186
|
-
registry: __1.LP_POOL,
|
|
187
|
-
index: BigInt(input.stakePool.pool_info.index),
|
|
188
|
-
balance,
|
|
189
|
-
},
|
|
190
|
-
typeArguments: [input.lpPool.lp_token_type.name],
|
|
191
|
-
}));
|
|
192
|
-
return tx;
|
|
193
221
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
222
|
+
function unstakeRedeem(config, tx, pythClient, input) {
|
|
223
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
224
|
+
var tokens, suiCoin, tokens_2, tokens_2_1, token, lpCoin, balance;
|
|
225
|
+
var e_2, _a;
|
|
226
|
+
return __generator(this, function (_b) {
|
|
227
|
+
switch (_b.label) {
|
|
228
|
+
case 0:
|
|
229
|
+
tokens = input.lpPool.tokenPools.map(function (p) { return (0, constants_1.typeArgToAsset)("0x" + p.tokenType.name); });
|
|
230
|
+
if (config.sponsored) {
|
|
231
|
+
suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), config.sponsored);
|
|
232
|
+
}
|
|
233
|
+
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens, suiCoin)];
|
|
234
|
+
case 1:
|
|
235
|
+
_b.sent();
|
|
236
|
+
try {
|
|
237
|
+
for (tokens_2 = __values(tokens), tokens_2_1 = tokens_2.next(); !tokens_2_1.done; tokens_2_1 = tokens_2.next()) {
|
|
238
|
+
token = tokens_2_1.value;
|
|
239
|
+
(0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, token);
|
|
240
|
+
(0, functions_1.updateLiquidityValue)(tx, constants_1.tokenType[__1.NETWORK][token], {
|
|
241
|
+
version: __1.PERP_VERSION,
|
|
242
|
+
registry: __1.LP_POOL,
|
|
243
|
+
index: BigInt(0),
|
|
244
|
+
oracle: constants_1.oracle[__1.NETWORK][token],
|
|
245
|
+
clock: constants_1.CLOCK,
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
250
|
+
finally {
|
|
251
|
+
try {
|
|
252
|
+
if (tokens_2_1 && !tokens_2_1.done && (_a = tokens_2.return)) _a.call(tokens_2);
|
|
253
|
+
}
|
|
254
|
+
finally { if (e_2) throw e_2.error; }
|
|
255
|
+
}
|
|
256
|
+
harvestStakeReward(config, tx, { stakePool: input.stakePool, userShareId: input.userShareId, user: input.user });
|
|
257
|
+
(0, functions_2.unsubscribe)(tx, __1.TLP_TOKEN, {
|
|
258
|
+
version: __1.STAKE_POOL_VERSION,
|
|
259
|
+
registry: __1.STAKE_POOL,
|
|
260
|
+
index: BigInt(0),
|
|
261
|
+
userShareId: BigInt(input.userShareId),
|
|
262
|
+
clock: constants_1.CLOCK,
|
|
263
|
+
unsubscribedShares: input.share ? BigInt(input.share) : null,
|
|
264
|
+
});
|
|
265
|
+
lpCoin = (0, functions_2.unstake)(tx, __1.TLP_TOKEN, {
|
|
266
|
+
version: __1.STAKE_POOL_VERSION,
|
|
267
|
+
registry: __1.STAKE_POOL,
|
|
268
|
+
index: BigInt(0),
|
|
269
|
+
userShareId: BigInt(input.userShareId),
|
|
270
|
+
clock: constants_1.CLOCK,
|
|
271
|
+
});
|
|
272
|
+
balance = tx.moveCall({
|
|
273
|
+
target: "0x2::coin::into_balance",
|
|
274
|
+
typeArguments: [__1.TLP_TOKEN],
|
|
275
|
+
arguments: [lpCoin],
|
|
276
|
+
});
|
|
277
|
+
(0, functions_1.redeem)(tx, __1.TLP_TOKEN, {
|
|
278
|
+
version: __1.PERP_VERSION,
|
|
279
|
+
registry: __1.LP_POOL,
|
|
280
|
+
index: BigInt(0),
|
|
281
|
+
clock: constants_1.CLOCK,
|
|
282
|
+
balance: balance,
|
|
283
|
+
});
|
|
284
|
+
return [2 /*return*/, tx];
|
|
285
|
+
}
|
|
286
|
+
});
|
|
231
287
|
});
|
|
232
|
-
tx.add((0, lp_pool_1.redeem)({
|
|
233
|
-
arguments: {
|
|
234
|
-
version: __1.PERP_VERSION,
|
|
235
|
-
registry: __1.LP_POOL,
|
|
236
|
-
index: BigInt(input.lpPool.index),
|
|
237
|
-
balance,
|
|
238
|
-
},
|
|
239
|
-
typeArguments: [lpToken],
|
|
240
|
-
}));
|
|
241
|
-
return tx;
|
|
242
288
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
289
|
+
function redeemTlp(config, tx, pythClient, input) {
|
|
290
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
291
|
+
var tokens, suiCoin, tokens_3, tokens_3_1, token, destination, lpCoin, burnCoin, balance;
|
|
292
|
+
var e_3, _a;
|
|
293
|
+
return __generator(this, function (_b) {
|
|
294
|
+
switch (_b.label) {
|
|
295
|
+
case 0:
|
|
296
|
+
tokens = input.lpPool.tokenPools.map(function (p) { return (0, constants_1.typeArgToAsset)("0x" + p.tokenType.name); });
|
|
297
|
+
if (config.sponsored) {
|
|
298
|
+
suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), config.sponsored);
|
|
299
|
+
}
|
|
300
|
+
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens, suiCoin)];
|
|
301
|
+
case 1:
|
|
302
|
+
_b.sent();
|
|
303
|
+
try {
|
|
304
|
+
for (tokens_3 = __values(tokens), tokens_3_1 = tokens_3.next(); !tokens_3_1.done; tokens_3_1 = tokens_3.next()) {
|
|
305
|
+
token = tokens_3_1.value;
|
|
306
|
+
(0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, token);
|
|
307
|
+
(0, functions_1.updateLiquidityValue)(tx, constants_1.tokenType[__1.NETWORK][token], {
|
|
308
|
+
version: __1.PERP_VERSION,
|
|
309
|
+
registry: __1.LP_POOL,
|
|
310
|
+
index: BigInt(0),
|
|
311
|
+
oracle: constants_1.oracle[__1.NETWORK][token],
|
|
312
|
+
clock: constants_1.CLOCK,
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
317
|
+
finally {
|
|
318
|
+
try {
|
|
319
|
+
if (tokens_3_1 && !tokens_3_1.done && (_a = tokens_3.return)) _a.call(tokens_3);
|
|
320
|
+
}
|
|
321
|
+
finally { if (e_3) throw e_3.error; }
|
|
322
|
+
}
|
|
323
|
+
destination = input.lpCoins.pop();
|
|
324
|
+
if (input.lpCoins.length > 0) {
|
|
325
|
+
tx.mergeCoins(destination, input.lpCoins);
|
|
326
|
+
}
|
|
327
|
+
lpCoin = tx.object(destination);
|
|
328
|
+
if (input.share) {
|
|
329
|
+
burnCoin = tx.splitCoins(lpCoin, [input.share]);
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
burnCoin = lpCoin;
|
|
333
|
+
}
|
|
334
|
+
balance = tx.moveCall({
|
|
335
|
+
target: "0x2::coin::into_balance",
|
|
336
|
+
typeArguments: [__1.TLP_TOKEN],
|
|
337
|
+
arguments: [burnCoin],
|
|
338
|
+
});
|
|
339
|
+
(0, functions_1.redeem)(tx, __1.TLP_TOKEN, {
|
|
340
|
+
version: __1.PERP_VERSION,
|
|
341
|
+
registry: __1.LP_POOL,
|
|
342
|
+
index: BigInt(0),
|
|
343
|
+
clock: constants_1.CLOCK,
|
|
344
|
+
balance: balance,
|
|
345
|
+
});
|
|
346
|
+
return [2 /*return*/, tx];
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
});
|
|
276
350
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
351
|
+
function claim(config, tx, pythClient, input) {
|
|
352
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
353
|
+
var tokens, suiCoin, tokens_4, tokens_4_1, token_1, cToken, token;
|
|
354
|
+
var e_4, _a;
|
|
355
|
+
return __generator(this, function (_b) {
|
|
356
|
+
switch (_b.label) {
|
|
357
|
+
case 0:
|
|
358
|
+
tokens = input.lpPool.tokenPools.map(function (p) { return (0, constants_1.typeArgToAsset)("0x" + p.tokenType.name); });
|
|
359
|
+
if (config.sponsored) {
|
|
360
|
+
suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), config.sponsored);
|
|
361
|
+
}
|
|
362
|
+
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens, suiCoin)];
|
|
363
|
+
case 1:
|
|
364
|
+
_b.sent();
|
|
365
|
+
try {
|
|
366
|
+
for (tokens_4 = __values(tokens), tokens_4_1 = tokens_4.next(); !tokens_4_1.done; tokens_4_1 = tokens_4.next()) {
|
|
367
|
+
token_1 = tokens_4_1.value;
|
|
368
|
+
(0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, token_1);
|
|
369
|
+
(0, functions_1.updateLiquidityValue)(tx, constants_1.tokenType[__1.NETWORK][token_1], {
|
|
370
|
+
version: __1.PERP_VERSION,
|
|
371
|
+
registry: __1.LP_POOL,
|
|
372
|
+
index: BigInt(0),
|
|
373
|
+
oracle: constants_1.oracle[__1.NETWORK][token_1],
|
|
374
|
+
clock: constants_1.CLOCK,
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
379
|
+
finally {
|
|
380
|
+
try {
|
|
381
|
+
if (tokens_4_1 && !tokens_4_1.done && (_a = tokens_4.return)) _a.call(tokens_4);
|
|
382
|
+
}
|
|
383
|
+
finally { if (e_4) throw e_4.error; }
|
|
384
|
+
}
|
|
385
|
+
cToken = constants_1.tokenType[__1.NETWORK][input.cTOKEN];
|
|
386
|
+
token = (0, functions_1.claim)(tx, [__1.TLP_TOKEN, cToken], {
|
|
387
|
+
version: __1.PERP_VERSION,
|
|
388
|
+
registry: __1.LP_POOL,
|
|
389
|
+
index: BigInt(0),
|
|
390
|
+
clock: constants_1.CLOCK,
|
|
391
|
+
treasuryCaps: __1.TLP_TREASURY_CAP,
|
|
392
|
+
oracle: constants_1.oracle[__1.NETWORK][input.cTOKEN],
|
|
393
|
+
});
|
|
394
|
+
tx.transferObjects([token], input.user);
|
|
395
|
+
return [2 /*return*/, tx];
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
});
|
|
311
399
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
400
|
+
function swap(config, tx, pythClient, input) {
|
|
401
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
402
|
+
var fromToken, toToken, coin, suiCoin, token;
|
|
403
|
+
var _a;
|
|
404
|
+
return __generator(this, function (_b) {
|
|
405
|
+
switch (_b.label) {
|
|
406
|
+
case 0:
|
|
407
|
+
fromToken = constants_1.tokenType[__1.NETWORK][input.FROM_TOKEN];
|
|
408
|
+
toToken = constants_1.tokenType[__1.NETWORK][input.TO_TOKEN];
|
|
409
|
+
if (input.FROM_TOKEN == "SUI" && config.sponsored) {
|
|
410
|
+
// split together
|
|
411
|
+
_a = __read((0, utils_1.splitCoins)(tx, constants_1.tokenType.MAINNET.SUI, input.coins, [input.amount, "2"], config.sponsored), 2), coin = _a[0], suiCoin = _a[1];
|
|
412
|
+
}
|
|
413
|
+
else if (config.sponsored) {
|
|
414
|
+
coin = (0, utils_1.splitCoin)(tx, fromToken, input.coins, input.amount, config.sponsored);
|
|
415
|
+
suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, "2", config.sponsored);
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
coin = (0, utils_1.splitCoin)(tx, fromToken, input.coins, input.amount, config.sponsored);
|
|
419
|
+
// no suiCoin
|
|
420
|
+
}
|
|
421
|
+
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, [input.FROM_TOKEN, input.TO_TOKEN], suiCoin)];
|
|
422
|
+
case 1:
|
|
423
|
+
_b.sent();
|
|
424
|
+
(0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, input.FROM_TOKEN);
|
|
425
|
+
(0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, input.TO_TOKEN);
|
|
426
|
+
token = (0, functions_1.swap)(tx, [fromToken, toToken], {
|
|
427
|
+
version: __1.PERP_VERSION,
|
|
428
|
+
registry: __1.LP_POOL,
|
|
429
|
+
clock: constants_1.CLOCK,
|
|
430
|
+
index: BigInt(0),
|
|
431
|
+
oracleFromToken: constants_1.oracle[__1.NETWORK][input.FROM_TOKEN],
|
|
432
|
+
oracleToToken: constants_1.oracle[__1.NETWORK][input.TO_TOKEN],
|
|
433
|
+
fromCoin: coin,
|
|
434
|
+
minToAmount: BigInt(0),
|
|
435
|
+
});
|
|
436
|
+
tx.transferObjects([token], input.user);
|
|
437
|
+
return [2 /*return*/, tx];
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
function harvestStakeReward(config, tx, input) {
|
|
443
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
444
|
+
var iTokens, iTokens_1, iTokens_1_1, iToken, iCoin;
|
|
445
|
+
var e_5, _a;
|
|
446
|
+
return __generator(this, function (_b) {
|
|
447
|
+
iTokens = input.stakePool.incentives.map(function (i) { return i.tokenType.name; });
|
|
448
|
+
(0, functions_2.snapshot)(tx, {
|
|
319
449
|
version: __1.STAKE_POOL_VERSION,
|
|
320
450
|
registry: __1.STAKE_POOL,
|
|
321
|
-
index: BigInt(
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
451
|
+
index: BigInt(0),
|
|
452
|
+
clock: constants_1.CLOCK,
|
|
453
|
+
userShareId: BigInt(input.userShareId),
|
|
454
|
+
typusEcosystemVersion: config.version.typus,
|
|
455
|
+
typusUserRegistry: config.registry.typus.user,
|
|
456
|
+
});
|
|
457
|
+
try {
|
|
458
|
+
for (iTokens_1 = __values(iTokens), iTokens_1_1 = iTokens_1.next(); !iTokens_1_1.done; iTokens_1_1 = iTokens_1.next()) {
|
|
459
|
+
iToken = iTokens_1_1.value;
|
|
460
|
+
iCoin = (0, functions_2.harvestPerUserShare)(tx, iToken, {
|
|
461
|
+
version: __1.STAKE_POOL_VERSION,
|
|
462
|
+
registry: __1.STAKE_POOL,
|
|
463
|
+
index: BigInt(0),
|
|
464
|
+
userShareId: BigInt(input.userShareId),
|
|
465
|
+
clock: constants_1.CLOCK,
|
|
466
|
+
});
|
|
467
|
+
if (iToken.endsWith("TLP")) {
|
|
468
|
+
// stake
|
|
469
|
+
(0, functions_2.stake)(tx, __1.TLP_TOKEN, {
|
|
470
|
+
version: __1.STAKE_POOL_VERSION,
|
|
471
|
+
registry: __1.STAKE_POOL,
|
|
472
|
+
index: BigInt(0),
|
|
473
|
+
lpToken: iCoin,
|
|
474
|
+
clock: constants_1.CLOCK,
|
|
475
|
+
isAutoCompound: null,
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
tx.transferObjects([iCoin], input.user);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
484
|
+
finally {
|
|
485
|
+
try {
|
|
486
|
+
if (iTokens_1_1 && !iTokens_1_1.done && (_a = iTokens_1.return)) _a.call(iTokens_1);
|
|
487
|
+
}
|
|
488
|
+
finally { if (e_5) throw e_5.error; }
|
|
489
|
+
}
|
|
490
|
+
return [2 /*return*/, tx];
|
|
491
|
+
});
|
|
492
|
+
});
|
|
342
493
|
}
|