@haneullabs/deepbook-v3 0.1.0 → 1.0.11
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/CHANGELOG.md +268 -81
- package/dist/client.d.mts +957 -0
- package/dist/client.d.mts.map +1 -0
- package/dist/client.mjs +2293 -0
- package/dist/client.mjs.map +1 -0
- package/dist/contracts/deepbook/account.d.mts +38 -0
- package/dist/contracts/deepbook/account.d.mts.map +1 -0
- package/dist/contracts/deepbook/account.mjs +31 -0
- package/dist/contracts/deepbook/account.mjs.map +1 -0
- package/dist/contracts/deepbook/balances.d.mts +13 -0
- package/dist/contracts/deepbook/balances.d.mts.map +1 -0
- package/dist/contracts/deepbook/balances.mjs +24 -0
- package/dist/contracts/deepbook/balances.mjs.map +1 -0
- package/dist/contracts/deepbook/deep_price.d.mts +13 -0
- package/dist/contracts/deepbook/deep_price.d.mts.map +1 -0
- package/dist/contracts/deepbook/deep_price.mjs +49 -0
- package/dist/contracts/deepbook/deep_price.mjs.map +1 -0
- package/dist/contracts/deepbook/deps/haneul/vec_set.d.mts +22 -0
- package/dist/contracts/deepbook/deps/haneul/vec_set.d.mts.map +1 -0
- package/dist/contracts/deepbook/deps/haneul/vec_set.mjs +26 -0
- package/dist/contracts/deepbook/deps/haneul/vec_set.mjs.map +1 -0
- package/dist/contracts/deepbook/order.d.mts +24 -0
- package/dist/contracts/deepbook/order.d.mts.map +1 -0
- package/dist/contracts/deepbook/order.mjs +63 -0
- package/dist/contracts/deepbook/order.mjs.map +1 -0
- package/dist/contracts/pyth/data_source.mjs +20 -0
- package/dist/contracts/pyth/data_source.mjs.map +1 -0
- package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs +21 -0
- package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs.map +1 -0
- package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs +19 -0
- package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs.map +1 -0
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32.mjs +16 -0
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32.mjs.map +1 -0
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed_vaas.mjs +16 -0
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed_vaas.mjs.map +1 -0
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external_address.mjs +16 -0
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external_address.mjs.map +1 -0
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set.mjs +16 -0
- package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set.mjs.map +1 -0
- package/dist/contracts/pyth/i64.mjs +19 -0
- package/dist/contracts/pyth/i64.mjs.map +1 -0
- package/dist/contracts/pyth/price.mjs +22 -0
- package/dist/contracts/pyth/price.mjs.map +1 -0
- package/dist/contracts/pyth/price_feed.mjs +21 -0
- package/dist/contracts/pyth/price_feed.mjs.map +1 -0
- package/dist/contracts/pyth/price_identifier.mjs +16 -0
- package/dist/contracts/pyth/price_identifier.mjs.map +1 -0
- package/dist/contracts/pyth/price_info.mjs +28 -0
- package/dist/contracts/pyth/price_info.mjs.map +1 -0
- package/dist/contracts/pyth/state.mjs +36 -0
- package/dist/contracts/pyth/state.mjs.map +1 -0
- package/dist/contracts/utils/index.d.mts +34 -0
- package/dist/contracts/utils/index.d.mts.map +1 -0
- package/dist/contracts/utils/index.mjs +35 -0
- package/dist/contracts/utils/index.mjs.map +1 -0
- package/dist/contracts/wormhole/bytes32.mjs +16 -0
- package/dist/contracts/wormhole/bytes32.mjs.map +1 -0
- package/dist/contracts/wormhole/consumed_vaas.mjs +16 -0
- package/dist/contracts/wormhole/consumed_vaas.mjs.map +1 -0
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/balance.mjs +16 -0
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/balance.mjs.map +1 -0
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs +21 -0
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs.map +1 -0
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs +19 -0
- package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs.map +1 -0
- package/dist/contracts/wormhole/external_address.mjs +16 -0
- package/dist/contracts/wormhole/external_address.mjs.map +1 -0
- package/dist/contracts/wormhole/fee_collector.mjs +20 -0
- package/dist/contracts/wormhole/fee_collector.mjs.map +1 -0
- package/dist/contracts/wormhole/set.mjs +16 -0
- package/dist/contracts/wormhole/set.mjs.map +1 -0
- package/dist/contracts/wormhole/state.mjs +31 -0
- package/dist/contracts/wormhole/state.mjs.map +1 -0
- package/dist/index.d.mts +25 -0
- package/dist/index.mjs +26 -0
- package/dist/pyth/PriceServiceConnection.d.mts +26 -0
- package/dist/pyth/PriceServiceConnection.d.mts.map +1 -0
- package/dist/pyth/PriceServiceConnection.mjs +35 -0
- package/dist/pyth/PriceServiceConnection.mjs.map +1 -0
- package/dist/pyth/pyth-helpers.mjs +18 -0
- package/dist/pyth/pyth-helpers.mjs.map +1 -0
- package/dist/pyth/pyth.d.mts +69 -0
- package/dist/pyth/pyth.d.mts.map +1 -0
- package/dist/pyth/pyth.mjs +220 -0
- package/dist/pyth/pyth.mjs.map +1 -0
- package/dist/transactions/balanceManager.d.mts +174 -0
- package/dist/transactions/balanceManager.d.mts.map +1 -0
- package/dist/transactions/balanceManager.mjs +233 -0
- package/dist/transactions/balanceManager.mjs.map +1 -0
- package/dist/transactions/deepbook.d.mts +490 -0
- package/dist/transactions/deepbook.d.mts.map +1 -0
- package/dist/transactions/deepbook.mjs +978 -0
- package/dist/transactions/deepbook.mjs.map +1 -0
- package/dist/transactions/deepbookAdmin.d.mts +111 -0
- package/dist/transactions/deepbookAdmin.d.mts.map +1 -0
- package/dist/transactions/deepbookAdmin.mjs +221 -0
- package/dist/transactions/deepbookAdmin.mjs.map +1 -0
- package/dist/transactions/flashLoans.d.mts +62 -0
- package/dist/transactions/flashLoans.d.mts.map +1 -0
- package/dist/transactions/flashLoans.mjs +75 -0
- package/dist/transactions/flashLoans.mjs.map +1 -0
- package/dist/transactions/governance.d.mts +48 -0
- package/dist/transactions/governance.d.mts.map +1 -0
- package/dist/transactions/governance.mjs +90 -0
- package/dist/transactions/governance.mjs.map +1 -0
- package/dist/transactions/marginAdmin.d.mts +139 -0
- package/dist/transactions/marginAdmin.d.mts.map +1 -0
- package/dist/transactions/marginAdmin.mjs +249 -0
- package/dist/transactions/marginAdmin.mjs.map +1 -0
- package/dist/transactions/marginLiquidations.d.mts +67 -0
- package/dist/transactions/marginLiquidations.d.mts.map +1 -0
- package/dist/transactions/marginLiquidations.mjs +109 -0
- package/dist/transactions/marginLiquidations.mjs.map +1 -0
- package/dist/transactions/marginMaintainer.d.mts +86 -0
- package/dist/transactions/marginMaintainer.d.mts.map +1 -0
- package/dist/transactions/marginMaintainer.mjs +160 -0
- package/dist/transactions/marginMaintainer.mjs.map +1 -0
- package/dist/transactions/marginManager.d.mts +255 -0
- package/dist/transactions/marginManager.d.mts.map +1 -0
- package/dist/transactions/marginManager.mjs +558 -0
- package/dist/transactions/marginManager.mjs.map +1 -0
- package/dist/transactions/marginPool.d.mts +140 -0
- package/dist/transactions/marginPool.d.mts.map +1 -0
- package/dist/transactions/marginPool.mjs +206 -0
- package/dist/transactions/marginPool.mjs.map +1 -0
- package/dist/transactions/marginRegistry.d.mts +100 -0
- package/dist/transactions/marginRegistry.d.mts.map +1 -0
- package/dist/transactions/marginRegistry.mjs +128 -0
- package/dist/transactions/marginRegistry.mjs.map +1 -0
- package/dist/transactions/marginTPSL.d.mts +100 -0
- package/dist/transactions/marginTPSL.d.mts.map +1 -0
- package/dist/transactions/marginTPSL.mjs +175 -0
- package/dist/transactions/marginTPSL.mjs.map +1 -0
- package/dist/transactions/poolProxy.d.mts +123 -0
- package/dist/transactions/poolProxy.d.mts.map +1 -0
- package/dist/transactions/poolProxy.mjs +336 -0
- package/dist/transactions/poolProxy.mjs.map +1 -0
- package/dist/types/bcs.d.mts +5 -0
- package/dist/types/bcs.mjs +7 -0
- package/dist/types/index.d.mts +237 -0
- package/dist/types/index.d.mts.map +1 -0
- package/dist/types/index.mjs +18 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/utils/config.d.mts +82 -0
- package/dist/utils/config.d.mts.map +1 -0
- package/dist/utils/config.mjs +88 -0
- package/dist/utils/config.mjs.map +1 -0
- package/dist/utils/constants.d.mts +85 -0
- package/dist/utils/constants.d.mts.map +1 -0
- package/dist/utils/constants.mjs +384 -0
- package/dist/utils/constants.mjs.map +1 -0
- package/dist/utils/errors.d.mts +46 -0
- package/dist/utils/errors.d.mts.map +1 -0
- package/dist/utils/errors.mjs +59 -0
- package/dist/utils/errors.mjs.map +1 -0
- package/dist/{cjs/utils/validation.d.ts → utils/validation.d.mts} +11 -7
- package/dist/utils/validation.d.mts.map +1 -0
- package/dist/utils/validation.mjs +76 -0
- package/dist/utils/validation.mjs.map +1 -0
- package/package.json +29 -26
- package/src/client.ts +1016 -545
- package/src/contracts/deepbook/account.ts +15 -15
- package/src/contracts/deepbook/balance_manager.ts +343 -57
- package/src/contracts/deepbook/balances.ts +3 -2
- package/src/contracts/deepbook/big_vector.ts +6 -7
- package/src/contracts/deepbook/book.ts +3 -2
- package/src/contracts/deepbook/constants.ts +95 -3
- package/src/contracts/deepbook/deep_price.ts +7 -7
- package/src/contracts/deepbook/deps/{sui → haneul}/bag.ts +8 -8
- package/src/contracts/deepbook/deps/{sui → haneul}/balance.ts +4 -3
- package/src/contracts/deepbook/deps/{sui → haneul}/table.ts +6 -6
- package/src/contracts/deepbook/deps/{sui → haneul}/vec_map.ts +4 -4
- package/src/contracts/deepbook/deps/{sui → haneul}/vec_set.ts +4 -4
- package/src/contracts/deepbook/deps/{sui → haneul}/versioned.ts +4 -4
- package/src/contracts/deepbook/deps/std/type_name.ts +3 -2
- package/src/contracts/deepbook/ewma.ts +14 -3
- package/src/contracts/deepbook/fill.ts +21 -21
- package/src/contracts/deepbook/governance.ts +4 -3
- package/src/contracts/deepbook/history.ts +4 -3
- package/src/contracts/deepbook/math.ts +15 -15
- package/src/contracts/deepbook/order.ts +16 -16
- package/src/contracts/deepbook/order_info.ts +39 -27
- package/src/contracts/deepbook/order_query.ts +12 -12
- package/src/contracts/deepbook/pool.ts +883 -526
- package/src/contracts/deepbook/registry.ts +149 -38
- package/src/contracts/deepbook/state.ts +14 -3
- package/src/contracts/deepbook/trade_params.ts +3 -2
- package/src/contracts/deepbook/vault.ts +5 -4
- package/src/contracts/pyth/batch_price_attestation.ts +92 -0
- package/src/contracts/pyth/contract_upgrade.ts +54 -0
- package/src/contracts/pyth/data_source.ts +64 -0
- package/src/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.ts +15 -0
- package/src/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.ts +13 -0
- package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32.ts +12 -0
- package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed_vaas.ts +13 -0
- package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external_address.ts +13 -0
- package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set.ts +12 -0
- package/src/contracts/pyth/deserialize.ts +117 -0
- package/src/contracts/pyth/event.ts +20 -0
- package/src/contracts/pyth/governance.ts +113 -0
- package/src/contracts/pyth/governance_action.ts +130 -0
- package/src/contracts/pyth/governance_instruction.ts +98 -0
- package/src/contracts/pyth/hot_potato_vector.ts +70 -0
- package/src/contracts/pyth/i64.ts +94 -0
- package/src/contracts/pyth/merkle_tree.ts +41 -0
- package/src/contracts/pyth/migrate.ts +29 -0
- package/src/contracts/pyth/price.ts +102 -0
- package/src/contracts/pyth/price_feed.ts +101 -0
- package/src/contracts/pyth/price_identifier.ts +46 -0
- package/src/contracts/pyth/price_info.ts +220 -0
- package/src/contracts/pyth/price_status.ts +74 -0
- package/src/contracts/pyth/pyth.ts +236 -0
- package/src/contracts/pyth/set.ts +93 -0
- package/src/contracts/pyth/set_data_sources.ts +14 -0
- package/src/contracts/pyth/set_fee_recipient.ts +13 -0
- package/src/contracts/pyth/set_governance_data_source.ts +16 -0
- package/src/contracts/pyth/set_stale_price_threshold.ts +13 -0
- package/src/contracts/pyth/set_update_fee.ts +14 -0
- package/src/contracts/pyth/setup.ts +12 -0
- package/src/contracts/pyth/state.ts +227 -0
- package/src/contracts/pyth/version_control.ts +25 -0
- package/src/contracts/utils/index.ts +100 -50
- package/src/contracts/wormhole/bytes32.ts +12 -0
- package/src/contracts/wormhole/consumed_vaas.ts +13 -0
- package/src/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/balance.ts +12 -0
- package/src/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.ts +15 -0
- package/src/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.ts +13 -0
- package/src/contracts/wormhole/external_address.ts +13 -0
- package/src/contracts/wormhole/fee_collector.ts +15 -0
- package/src/contracts/wormhole/set.ts +12 -0
- package/src/contracts/wormhole/state.ts +25 -0
- package/src/index.ts +17 -3
- package/src/pyth/pyth.ts +51 -50
- package/src/transactions/deepbook.ts +31 -12
- package/src/transactions/deepbookAdmin.ts +3 -3
- package/src/transactions/marginAdmin.ts +11 -8
- package/src/transactions/marginMaintainer.ts +23 -12
- package/src/transactions/marginManager.ts +104 -28
- package/src/transactions/marginPool.ts +5 -6
- package/src/transactions/marginTPSL.ts +5 -5
- package/src/transactions/poolProxy.ts +50 -0
- package/src/types/bcs.ts +1 -1
- package/src/types/index.ts +19 -2
- package/src/utils/config.ts +12 -14
- package/src/utils/constants.ts +44 -12
- package/src/utils/validation.ts +1 -1
- package/dist/cjs/client.d.ts +0 -861
- package/dist/cjs/client.js +0 -1982
- package/dist/cjs/client.js.map +0 -7
- package/dist/cjs/contracts/deepbook/account.d.ts +0 -105
- package/dist/cjs/contracts/deepbook/account.js +0 -163
- package/dist/cjs/contracts/deepbook/account.js.map +0 -7
- package/dist/cjs/contracts/deepbook/balance_manager.d.ts +0 -268
- package/dist/cjs/contracts/deepbook/balance_manager.js +0 -361
- package/dist/cjs/contracts/deepbook/balance_manager.js.map +0 -7
- package/dist/cjs/contracts/deepbook/balances.d.ts +0 -10
- package/dist/cjs/contracts/deepbook/balances.js +0 -35
- package/dist/cjs/contracts/deepbook/balances.js.map +0 -7
- package/dist/cjs/contracts/deepbook/big_vector.d.ts +0 -62
- package/dist/cjs/contracts/deepbook/big_vector.js +0 -80
- package/dist/cjs/contracts/deepbook/big_vector.js.map +0 -7
- package/dist/cjs/contracts/deepbook/book.d.ts +0 -34
- package/dist/cjs/contracts/deepbook/book.js +0 -50
- package/dist/cjs/contracts/deepbook/book.js.map +0 -7
- package/dist/cjs/contracts/deepbook/constants.d.ts +0 -176
- package/dist/cjs/contracts/deepbook/constants.js +0 -338
- package/dist/cjs/contracts/deepbook/constants.js.map +0 -7
- package/dist/cjs/contracts/deepbook/deep_price.d.ts +0 -60
- package/dist/cjs/contracts/deepbook/deep_price.js +0 -87
- package/dist/cjs/contracts/deepbook/deep_price.js.map +0 -7
- package/dist/cjs/contracts/deepbook/deps/std/type_name.d.ts +0 -14
- package/dist/cjs/contracts/deepbook/deps/std/type_name.js +0 -42
- package/dist/cjs/contracts/deepbook/deps/std/type_name.js.map +0 -7
- package/dist/cjs/contracts/deepbook/deps/sui/bag.d.ts +0 -33
- package/dist/cjs/contracts/deepbook/deps/sui/bag.js +0 -47
- package/dist/cjs/contracts/deepbook/deps/sui/bag.js.map +0 -7
- package/dist/cjs/contracts/deepbook/deps/sui/balance.d.ts +0 -9
- package/dist/cjs/contracts/deepbook/deps/sui/balance.js +0 -33
- package/dist/cjs/contracts/deepbook/deps/sui/balance.js.map +0 -7
- package/dist/cjs/contracts/deepbook/deps/sui/object.d.ts +0 -5
- package/dist/cjs/contracts/deepbook/deps/sui/object.js +0 -33
- package/dist/cjs/contracts/deepbook/deps/sui/object.js.map +0 -7
- package/dist/cjs/contracts/deepbook/deps/sui/table.d.ts +0 -28
- package/dist/cjs/contracts/deepbook/deps/sui/table.js +0 -47
- package/dist/cjs/contracts/deepbook/deps/sui/table.js.map +0 -7
- package/dist/cjs/contracts/deepbook/deps/sui/vec_map.d.ts +0 -27
- package/dist/cjs/contracts/deepbook/deps/sui/vec_map.js +0 -45
- package/dist/cjs/contracts/deepbook/deps/sui/vec_map.js.map +0 -7
- package/dist/cjs/contracts/deepbook/deps/sui/vec_set.d.ts +0 -15
- package/dist/cjs/contracts/deepbook/deps/sui/vec_set.js +0 -35
- package/dist/cjs/contracts/deepbook/deps/sui/vec_set.js.map +0 -7
- package/dist/cjs/contracts/deepbook/deps/sui/versioned.d.ts +0 -7
- package/dist/cjs/contracts/deepbook/deps/sui/versioned.js +0 -45
- package/dist/cjs/contracts/deepbook/deps/sui/versioned.js.map +0 -7
- package/dist/cjs/contracts/deepbook/ewma.d.ts +0 -17
- package/dist/cjs/contracts/deepbook/ewma.js +0 -39
- package/dist/cjs/contracts/deepbook/ewma.js.map +0 -7
- package/dist/cjs/contracts/deepbook/fill.d.ts +0 -153
- package/dist/cjs/contracts/deepbook/fill.js +0 -251
- package/dist/cjs/contracts/deepbook/fill.js.map +0 -7
- package/dist/cjs/contracts/deepbook/governance.d.ts +0 -63
- package/dist/cjs/contracts/deepbook/governance.js +0 -79
- package/dist/cjs/contracts/deepbook/governance.js.map +0 -7
- package/dist/cjs/contracts/deepbook/history.d.ts +0 -60
- package/dist/cjs/contracts/deepbook/history.js +0 -78
- package/dist/cjs/contracts/deepbook/history.js.map +0 -7
- package/dist/cjs/contracts/deepbook/math.d.ts +0 -94
- package/dist/cjs/contracts/deepbook/math.js +0 -132
- package/dist/cjs/contracts/deepbook/math.js.map +0 -7
- package/dist/cjs/contracts/deepbook/order.d.ts +0 -135
- package/dist/cjs/contracts/deepbook/order.js +0 -218
- package/dist/cjs/contracts/deepbook/order.js.map +0 -7
- package/dist/cjs/contracts/deepbook/order_info.d.ts +0 -296
- package/dist/cjs/contracts/deepbook/order_info.js +0 -386
- package/dist/cjs/contracts/deepbook/order_info.js.map +0 -7
- package/dist/cjs/contracts/deepbook/order_query.d.ts +0 -85
- package/dist/cjs/contracts/deepbook/order_query.js +0 -96
- package/dist/cjs/contracts/deepbook/order_query.js.map +0 -7
- package/dist/cjs/contracts/deepbook/pool.d.ts +0 -1218
- package/dist/cjs/contracts/deepbook/pool.js +0 -1236
- package/dist/cjs/contracts/deepbook/pool.js.map +0 -7
- package/dist/cjs/contracts/deepbook/registry.d.ts +0 -134
- package/dist/cjs/contracts/deepbook/registry.js +0 -182
- package/dist/cjs/contracts/deepbook/registry.js.map +0 -7
- package/dist/cjs/contracts/deepbook/state.d.ts +0 -117
- package/dist/cjs/contracts/deepbook/state.js +0 -104
- package/dist/cjs/contracts/deepbook/state.js.map +0 -7
- package/dist/cjs/contracts/deepbook/trade_params.d.ts +0 -7
- package/dist/cjs/contracts/deepbook/trade_params.js +0 -35
- package/dist/cjs/contracts/deepbook/trade_params.js.map +0 -7
- package/dist/cjs/contracts/deepbook/vault.d.ts +0 -30
- package/dist/cjs/contracts/deepbook/vault.js +0 -65
- package/dist/cjs/contracts/deepbook/vault.js.map +0 -7
- package/dist/cjs/contracts/utils/index.d.ts +0 -25
- package/dist/cjs/contracts/utils/index.js +0 -148
- package/dist/cjs/contracts/utils/index.js.map +0 -7
- package/dist/cjs/index.d.ts +0 -23
- package/dist/cjs/index.js +0 -81
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/package.json +0 -4
- package/dist/cjs/pyth/PriceServiceConnection.d.ts +0 -26
- package/dist/cjs/pyth/PriceServiceConnection.js +0 -68
- package/dist/cjs/pyth/PriceServiceConnection.js.map +0 -7
- package/dist/cjs/pyth/pyth-helpers.d.ts +0 -7
- package/dist/cjs/pyth/pyth-helpers.js +0 -36
- package/dist/cjs/pyth/pyth-helpers.js.map +0 -7
- package/dist/cjs/pyth/pyth.d.ts +0 -65
- package/dist/cjs/pyth/pyth.js +0 -269
- package/dist/cjs/pyth/pyth.js.map +0 -7
- package/dist/cjs/transactions/balanceManager.d.ts +0 -168
- package/dist/cjs/transactions/balanceManager.js +0 -384
- package/dist/cjs/transactions/balanceManager.js.map +0 -7
- package/dist/cjs/transactions/deepbook.d.ts +0 -477
- package/dist/cjs/transactions/deepbook.js +0 -1335
- package/dist/cjs/transactions/deepbook.js.map +0 -7
- package/dist/cjs/transactions/deepbookAdmin.d.ts +0 -105
- package/dist/cjs/transactions/deepbookAdmin.js +0 -334
- package/dist/cjs/transactions/deepbookAdmin.js.map +0 -7
- package/dist/cjs/transactions/flashLoans.d.ts +0 -56
- package/dist/cjs/transactions/flashLoans.js +0 -124
- package/dist/cjs/transactions/flashLoans.js.map +0 -7
- package/dist/cjs/transactions/governance.d.ts +0 -42
- package/dist/cjs/transactions/governance.js +0 -135
- package/dist/cjs/transactions/governance.js.map +0 -7
- package/dist/cjs/transactions/marginAdmin.d.ts +0 -133
- package/dist/cjs/transactions/marginAdmin.js +0 -393
- package/dist/cjs/transactions/marginAdmin.js.map +0 -7
- package/dist/cjs/transactions/marginLiquidations.d.ts +0 -61
- package/dist/cjs/transactions/marginLiquidations.js +0 -173
- package/dist/cjs/transactions/marginLiquidations.js.map +0 -7
- package/dist/cjs/transactions/marginMaintainer.d.ts +0 -80
- package/dist/cjs/transactions/marginMaintainer.js +0 -251
- package/dist/cjs/transactions/marginMaintainer.js.map +0 -7
- package/dist/cjs/transactions/marginManager.d.ts +0 -236
- package/dist/cjs/transactions/marginManager.js +0 -688
- package/dist/cjs/transactions/marginManager.js.map +0 -7
- package/dist/cjs/transactions/marginPool.d.ts +0 -134
- package/dist/cjs/transactions/marginPool.js +0 -330
- package/dist/cjs/transactions/marginPool.js.map +0 -7
- package/dist/cjs/transactions/marginRegistry.d.ts +0 -94
- package/dist/cjs/transactions/marginRegistry.js +0 -221
- package/dist/cjs/transactions/marginRegistry.js.map +0 -7
- package/dist/cjs/transactions/marginTPSL.d.ts +0 -93
- package/dist/cjs/transactions/marginTPSL.js +0 -286
- package/dist/cjs/transactions/marginTPSL.js.map +0 -7
- package/dist/cjs/transactions/poolProxy.d.ts +0 -104
- package/dist/cjs/transactions/poolProxy.js +0 -435
- package/dist/cjs/transactions/poolProxy.js.map +0 -7
- package/dist/cjs/types/bcs.d.ts +0 -5
- package/dist/cjs/types/bcs.js +0 -33
- package/dist/cjs/types/bcs.js.map +0 -7
- package/dist/cjs/types/index.d.ts +0 -218
- package/dist/cjs/types/index.js +0 -38
- package/dist/cjs/types/index.js.map +0 -7
- package/dist/cjs/utils/config.d.ts +0 -65
- package/dist/cjs/utils/config.js +0 -144
- package/dist/cjs/utils/config.js.map +0 -7
- package/dist/cjs/utils/constants.d.ts +0 -76
- package/dist/cjs/utils/constants.js +0 -382
- package/dist/cjs/utils/constants.js.map +0 -7
- package/dist/cjs/utils/errors.d.ts +0 -42
- package/dist/cjs/utils/errors.js +0 -70
- package/dist/cjs/utils/errors.js.map +0 -7
- package/dist/cjs/utils/validation.js +0 -67
- package/dist/cjs/utils/validation.js.map +0 -7
- package/dist/esm/client.d.ts +0 -861
- package/dist/esm/client.js +0 -1967
- package/dist/esm/client.js.map +0 -7
- package/dist/esm/contracts/deepbook/account.d.ts +0 -105
- package/dist/esm/contracts/deepbook/account.js +0 -133
- package/dist/esm/contracts/deepbook/account.js.map +0 -7
- package/dist/esm/contracts/deepbook/balance_manager.d.ts +0 -268
- package/dist/esm/contracts/deepbook/balance_manager.js +0 -331
- package/dist/esm/contracts/deepbook/balance_manager.js.map +0 -7
- package/dist/esm/contracts/deepbook/balances.d.ts +0 -10
- package/dist/esm/contracts/deepbook/balances.js +0 -15
- package/dist/esm/contracts/deepbook/balances.js.map +0 -7
- package/dist/esm/contracts/deepbook/big_vector.d.ts +0 -62
- package/dist/esm/contracts/deepbook/big_vector.js +0 -50
- package/dist/esm/contracts/deepbook/big_vector.js.map +0 -7
- package/dist/esm/contracts/deepbook/book.d.ts +0 -34
- package/dist/esm/contracts/deepbook/book.js +0 -20
- package/dist/esm/contracts/deepbook/book.js.map +0 -7
- package/dist/esm/contracts/deepbook/constants.d.ts +0 -176
- package/dist/esm/contracts/deepbook/constants.js +0 -318
- package/dist/esm/contracts/deepbook/constants.js.map +0 -7
- package/dist/esm/contracts/deepbook/deep_price.d.ts +0 -60
- package/dist/esm/contracts/deepbook/deep_price.js +0 -67
- package/dist/esm/contracts/deepbook/deep_price.js.map +0 -7
- package/dist/esm/contracts/deepbook/deps/std/type_name.d.ts +0 -14
- package/dist/esm/contracts/deepbook/deps/std/type_name.js +0 -22
- package/dist/esm/contracts/deepbook/deps/std/type_name.js.map +0 -7
- package/dist/esm/contracts/deepbook/deps/sui/bag.d.ts +0 -33
- package/dist/esm/contracts/deepbook/deps/sui/bag.js +0 -17
- package/dist/esm/contracts/deepbook/deps/sui/bag.js.map +0 -7
- package/dist/esm/contracts/deepbook/deps/sui/balance.d.ts +0 -9
- package/dist/esm/contracts/deepbook/deps/sui/balance.js +0 -13
- package/dist/esm/contracts/deepbook/deps/sui/balance.js.map +0 -7
- package/dist/esm/contracts/deepbook/deps/sui/object.d.ts +0 -5
- package/dist/esm/contracts/deepbook/deps/sui/object.js +0 -13
- package/dist/esm/contracts/deepbook/deps/sui/object.js.map +0 -7
- package/dist/esm/contracts/deepbook/deps/sui/table.d.ts +0 -28
- package/dist/esm/contracts/deepbook/deps/sui/table.js +0 -17
- package/dist/esm/contracts/deepbook/deps/sui/table.js.map +0 -7
- package/dist/esm/contracts/deepbook/deps/sui/vec_map.d.ts +0 -27
- package/dist/esm/contracts/deepbook/deps/sui/vec_map.js +0 -25
- package/dist/esm/contracts/deepbook/deps/sui/vec_map.js.map +0 -7
- package/dist/esm/contracts/deepbook/deps/sui/vec_set.d.ts +0 -15
- package/dist/esm/contracts/deepbook/deps/sui/vec_set.js +0 -15
- package/dist/esm/contracts/deepbook/deps/sui/vec_set.js.map +0 -7
- package/dist/esm/contracts/deepbook/deps/sui/versioned.d.ts +0 -7
- package/dist/esm/contracts/deepbook/deps/sui/versioned.js +0 -15
- package/dist/esm/contracts/deepbook/deps/sui/versioned.js.map +0 -7
- package/dist/esm/contracts/deepbook/ewma.d.ts +0 -17
- package/dist/esm/contracts/deepbook/ewma.js +0 -19
- package/dist/esm/contracts/deepbook/ewma.js.map +0 -7
- package/dist/esm/contracts/deepbook/fill.d.ts +0 -153
- package/dist/esm/contracts/deepbook/fill.js +0 -221
- package/dist/esm/contracts/deepbook/fill.js.map +0 -7
- package/dist/esm/contracts/deepbook/governance.d.ts +0 -63
- package/dist/esm/contracts/deepbook/governance.js +0 -49
- package/dist/esm/contracts/deepbook/governance.js.map +0 -7
- package/dist/esm/contracts/deepbook/history.d.ts +0 -60
- package/dist/esm/contracts/deepbook/history.js +0 -48
- package/dist/esm/contracts/deepbook/history.js.map +0 -7
- package/dist/esm/contracts/deepbook/math.d.ts +0 -94
- package/dist/esm/contracts/deepbook/math.js +0 -112
- package/dist/esm/contracts/deepbook/math.js.map +0 -7
- package/dist/esm/contracts/deepbook/order.d.ts +0 -135
- package/dist/esm/contracts/deepbook/order.js +0 -188
- package/dist/esm/contracts/deepbook/order.js.map +0 -7
- package/dist/esm/contracts/deepbook/order_info.d.ts +0 -296
- package/dist/esm/contracts/deepbook/order_info.js +0 -356
- package/dist/esm/contracts/deepbook/order_info.js.map +0 -7
- package/dist/esm/contracts/deepbook/order_query.d.ts +0 -85
- package/dist/esm/contracts/deepbook/order_query.js +0 -66
- package/dist/esm/contracts/deepbook/order_query.js.map +0 -7
- package/dist/esm/contracts/deepbook/pool.d.ts +0 -1218
- package/dist/esm/contracts/deepbook/pool.js +0 -1206
- package/dist/esm/contracts/deepbook/pool.js.map +0 -7
- package/dist/esm/contracts/deepbook/registry.d.ts +0 -134
- package/dist/esm/contracts/deepbook/registry.js +0 -152
- package/dist/esm/contracts/deepbook/registry.js.map +0 -7
- package/dist/esm/contracts/deepbook/state.d.ts +0 -117
- package/dist/esm/contracts/deepbook/state.js +0 -74
- package/dist/esm/contracts/deepbook/state.js.map +0 -7
- package/dist/esm/contracts/deepbook/trade_params.d.ts +0 -7
- package/dist/esm/contracts/deepbook/trade_params.js +0 -15
- package/dist/esm/contracts/deepbook/trade_params.js.map +0 -7
- package/dist/esm/contracts/deepbook/vault.d.ts +0 -30
- package/dist/esm/contracts/deepbook/vault.js +0 -35
- package/dist/esm/contracts/deepbook/vault.js.map +0 -7
- package/dist/esm/contracts/utils/index.d.ts +0 -25
- package/dist/esm/contracts/utils/index.js +0 -128
- package/dist/esm/contracts/utils/index.js.map +0 -7
- package/dist/esm/index.d.ts +0 -23
- package/dist/esm/index.js +0 -81
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/package.json +0 -4
- package/dist/esm/pyth/PriceServiceConnection.d.ts +0 -26
- package/dist/esm/pyth/PriceServiceConnection.js +0 -38
- package/dist/esm/pyth/PriceServiceConnection.js.map +0 -7
- package/dist/esm/pyth/pyth-helpers.d.ts +0 -7
- package/dist/esm/pyth/pyth-helpers.js +0 -16
- package/dist/esm/pyth/pyth-helpers.js.map +0 -7
- package/dist/esm/pyth/pyth.d.ts +0 -65
- package/dist/esm/pyth/pyth.js +0 -249
- package/dist/esm/pyth/pyth.js.map +0 -7
- package/dist/esm/transactions/balanceManager.d.ts +0 -168
- package/dist/esm/transactions/balanceManager.js +0 -364
- package/dist/esm/transactions/balanceManager.js.map +0 -7
- package/dist/esm/transactions/deepbook.d.ts +0 -477
- package/dist/esm/transactions/deepbook.js +0 -1321
- package/dist/esm/transactions/deepbook.js.map +0 -7
- package/dist/esm/transactions/deepbookAdmin.d.ts +0 -105
- package/dist/esm/transactions/deepbookAdmin.js +0 -314
- package/dist/esm/transactions/deepbookAdmin.js.map +0 -7
- package/dist/esm/transactions/flashLoans.d.ts +0 -56
- package/dist/esm/transactions/flashLoans.js +0 -104
- package/dist/esm/transactions/flashLoans.js.map +0 -7
- package/dist/esm/transactions/governance.d.ts +0 -42
- package/dist/esm/transactions/governance.js +0 -115
- package/dist/esm/transactions/governance.js.map +0 -7
- package/dist/esm/transactions/marginAdmin.d.ts +0 -133
- package/dist/esm/transactions/marginAdmin.js +0 -373
- package/dist/esm/transactions/marginAdmin.js.map +0 -7
- package/dist/esm/transactions/marginLiquidations.d.ts +0 -61
- package/dist/esm/transactions/marginLiquidations.js +0 -153
- package/dist/esm/transactions/marginLiquidations.js.map +0 -7
- package/dist/esm/transactions/marginMaintainer.d.ts +0 -80
- package/dist/esm/transactions/marginMaintainer.js +0 -231
- package/dist/esm/transactions/marginMaintainer.js.map +0 -7
- package/dist/esm/transactions/marginManager.d.ts +0 -236
- package/dist/esm/transactions/marginManager.js +0 -668
- package/dist/esm/transactions/marginManager.js.map +0 -7
- package/dist/esm/transactions/marginPool.d.ts +0 -134
- package/dist/esm/transactions/marginPool.js +0 -310
- package/dist/esm/transactions/marginPool.js.map +0 -7
- package/dist/esm/transactions/marginRegistry.d.ts +0 -94
- package/dist/esm/transactions/marginRegistry.js +0 -201
- package/dist/esm/transactions/marginRegistry.js.map +0 -7
- package/dist/esm/transactions/marginTPSL.d.ts +0 -93
- package/dist/esm/transactions/marginTPSL.js +0 -266
- package/dist/esm/transactions/marginTPSL.js.map +0 -7
- package/dist/esm/transactions/poolProxy.d.ts +0 -104
- package/dist/esm/transactions/poolProxy.js +0 -415
- package/dist/esm/transactions/poolProxy.js.map +0 -7
- package/dist/esm/types/bcs.d.ts +0 -5
- package/dist/esm/types/bcs.js +0 -13
- package/dist/esm/types/bcs.js.map +0 -7
- package/dist/esm/types/index.d.ts +0 -218
- package/dist/esm/types/index.js +0 -18
- package/dist/esm/types/index.js.map +0 -7
- package/dist/esm/utils/config.d.ts +0 -65
- package/dist/esm/utils/config.js +0 -135
- package/dist/esm/utils/config.js.map +0 -7
- package/dist/esm/utils/constants.d.ts +0 -76
- package/dist/esm/utils/constants.js +0 -362
- package/dist/esm/utils/constants.js.map +0 -7
- package/dist/esm/utils/errors.d.ts +0 -42
- package/dist/esm/utils/errors.js +0 -50
- package/dist/esm/utils/errors.js.map +0 -7
- package/dist/esm/utils/validation.d.ts +0 -50
- package/dist/esm/utils/validation.js +0 -47
- package/dist/esm/utils/validation.js.map +0 -7
- package/dist/tsconfig.esm.tsbuildinfo +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/contracts/deepbook/deps/sui/object.ts +0 -14
|
@@ -0,0 +1,558 @@
|
|
|
1
|
+
import { coinWithBalance } from "@haneullabs/haneul/transactions";
|
|
2
|
+
|
|
3
|
+
//#region src/transactions/marginManager.ts
|
|
4
|
+
/**
|
|
5
|
+
* MarginManagerContract class for managing MarginManager operations.
|
|
6
|
+
*/
|
|
7
|
+
var MarginManagerContract = class {
|
|
8
|
+
#config;
|
|
9
|
+
/**
|
|
10
|
+
* @param {DeepBookConfig} config Configuration for MarginManagerContract
|
|
11
|
+
*/
|
|
12
|
+
constructor(config) {
|
|
13
|
+
this.newMarginManager = (poolKey) => (tx) => {
|
|
14
|
+
const pool = this.#config.getPool(poolKey);
|
|
15
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
16
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
17
|
+
tx.moveCall({
|
|
18
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::new`,
|
|
19
|
+
arguments: [
|
|
20
|
+
tx.object(pool.address),
|
|
21
|
+
tx.object(this.#config.REGISTRY_ID),
|
|
22
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
23
|
+
tx.object.clock()
|
|
24
|
+
],
|
|
25
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
this.newMarginManagerWithInitializer = (poolKey) => (tx) => {
|
|
29
|
+
const pool = this.#config.getPool(poolKey);
|
|
30
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
31
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
32
|
+
const [manager, initializer] = tx.moveCall({
|
|
33
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::new_with_initializer`,
|
|
34
|
+
arguments: [
|
|
35
|
+
tx.object(pool.address),
|
|
36
|
+
tx.object(this.#config.REGISTRY_ID),
|
|
37
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
38
|
+
tx.object.clock()
|
|
39
|
+
],
|
|
40
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
manager,
|
|
44
|
+
initializer
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
this.shareMarginManager = (poolKey, manager, initializer) => (tx) => {
|
|
48
|
+
const pool = this.#config.getPool(poolKey);
|
|
49
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
50
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
51
|
+
tx.moveCall({
|
|
52
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::share`,
|
|
53
|
+
arguments: [manager, initializer],
|
|
54
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
this.depositDuringInitialization = (params) => (tx) => {
|
|
58
|
+
const { manager, poolKey, coinType } = params;
|
|
59
|
+
const pool = this.#config.getPool(poolKey);
|
|
60
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
61
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
62
|
+
const depositCoin = this.#config.getCoin(coinType);
|
|
63
|
+
const coin = "amount" in params && params.amount !== void 0 ? coinWithBalance({
|
|
64
|
+
type: depositCoin.type,
|
|
65
|
+
balance: Math.round(params.amount * depositCoin.scalar)
|
|
66
|
+
}) : params.coin;
|
|
67
|
+
tx.moveCall({
|
|
68
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::deposit`,
|
|
69
|
+
arguments: [
|
|
70
|
+
manager,
|
|
71
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
72
|
+
tx.object(baseCoin.priceInfoObjectId),
|
|
73
|
+
tx.object(quoteCoin.priceInfoObjectId),
|
|
74
|
+
coin,
|
|
75
|
+
tx.object.clock()
|
|
76
|
+
],
|
|
77
|
+
typeArguments: [
|
|
78
|
+
baseCoin.type,
|
|
79
|
+
quoteCoin.type,
|
|
80
|
+
depositCoin.type
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
this.depositBase = (params) => (tx) => {
|
|
85
|
+
const { managerKey } = params;
|
|
86
|
+
const manager = this.#config.getMarginManager(managerKey);
|
|
87
|
+
const pool = this.#config.getPool(manager.poolKey);
|
|
88
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
89
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
90
|
+
const coin = "amount" in params && params.amount !== void 0 ? coinWithBalance({
|
|
91
|
+
type: baseCoin.type,
|
|
92
|
+
balance: Math.round(params.amount * baseCoin.scalar)
|
|
93
|
+
}) : params.coin;
|
|
94
|
+
tx.moveCall({
|
|
95
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::deposit`,
|
|
96
|
+
arguments: [
|
|
97
|
+
tx.object(manager.address),
|
|
98
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
99
|
+
tx.object(baseCoin.priceInfoObjectId),
|
|
100
|
+
tx.object(quoteCoin.priceInfoObjectId),
|
|
101
|
+
coin,
|
|
102
|
+
tx.object.clock()
|
|
103
|
+
],
|
|
104
|
+
typeArguments: [
|
|
105
|
+
baseCoin.type,
|
|
106
|
+
quoteCoin.type,
|
|
107
|
+
baseCoin.type
|
|
108
|
+
]
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
this.depositQuote = (params) => (tx) => {
|
|
112
|
+
const { managerKey } = params;
|
|
113
|
+
const manager = this.#config.getMarginManager(managerKey);
|
|
114
|
+
const pool = this.#config.getPool(manager.poolKey);
|
|
115
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
116
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
117
|
+
const coin = "amount" in params && params.amount !== void 0 ? coinWithBalance({
|
|
118
|
+
type: quoteCoin.type,
|
|
119
|
+
balance: Math.round(params.amount * quoteCoin.scalar)
|
|
120
|
+
}) : params.coin;
|
|
121
|
+
tx.moveCall({
|
|
122
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::deposit`,
|
|
123
|
+
arguments: [
|
|
124
|
+
tx.object(manager.address),
|
|
125
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
126
|
+
tx.object(baseCoin.priceInfoObjectId),
|
|
127
|
+
tx.object(quoteCoin.priceInfoObjectId),
|
|
128
|
+
coin,
|
|
129
|
+
tx.object.clock()
|
|
130
|
+
],
|
|
131
|
+
typeArguments: [
|
|
132
|
+
baseCoin.type,
|
|
133
|
+
quoteCoin.type,
|
|
134
|
+
quoteCoin.type
|
|
135
|
+
]
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
this.depositDeep = (params) => (tx) => {
|
|
139
|
+
const { managerKey } = params;
|
|
140
|
+
const manager = this.#config.getMarginManager(managerKey);
|
|
141
|
+
const pool = this.#config.getPool(manager.poolKey);
|
|
142
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
143
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
144
|
+
const deepCoin = this.#config.getCoin("DEEP");
|
|
145
|
+
const coin = "amount" in params && params.amount !== void 0 ? coinWithBalance({
|
|
146
|
+
type: deepCoin.type,
|
|
147
|
+
balance: Math.round(params.amount * deepCoin.scalar)
|
|
148
|
+
}) : params.coin;
|
|
149
|
+
tx.moveCall({
|
|
150
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::deposit`,
|
|
151
|
+
arguments: [
|
|
152
|
+
tx.object(manager.address),
|
|
153
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
154
|
+
tx.object(baseCoin.priceInfoObjectId),
|
|
155
|
+
tx.object(quoteCoin.priceInfoObjectId),
|
|
156
|
+
coin,
|
|
157
|
+
tx.object.clock()
|
|
158
|
+
],
|
|
159
|
+
typeArguments: [
|
|
160
|
+
baseCoin.type,
|
|
161
|
+
quoteCoin.type,
|
|
162
|
+
deepCoin.type
|
|
163
|
+
]
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
this.withdrawBase = (managerKey, amount) => (tx) => {
|
|
167
|
+
const manager = this.#config.getMarginManager(managerKey);
|
|
168
|
+
const pool = this.#config.getPool(manager.poolKey);
|
|
169
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
170
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
171
|
+
const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
|
|
172
|
+
const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
|
|
173
|
+
return tx.moveCall({
|
|
174
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::withdraw`,
|
|
175
|
+
arguments: [
|
|
176
|
+
tx.object(manager.address),
|
|
177
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
178
|
+
tx.object(baseMarginPool.address),
|
|
179
|
+
tx.object(quoteMarginPool.address),
|
|
180
|
+
tx.object(baseCoin.priceInfoObjectId),
|
|
181
|
+
tx.object(quoteCoin.priceInfoObjectId),
|
|
182
|
+
tx.object(pool.address),
|
|
183
|
+
tx.pure.u64(Math.round(amount * baseCoin.scalar)),
|
|
184
|
+
tx.object.clock()
|
|
185
|
+
],
|
|
186
|
+
typeArguments: [
|
|
187
|
+
baseCoin.type,
|
|
188
|
+
quoteCoin.type,
|
|
189
|
+
baseCoin.type
|
|
190
|
+
]
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
this.withdrawQuote = (managerKey, amount) => (tx) => {
|
|
194
|
+
const manager = this.#config.getMarginManager(managerKey);
|
|
195
|
+
const pool = this.#config.getPool(manager.poolKey);
|
|
196
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
197
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
198
|
+
const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
|
|
199
|
+
const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
|
|
200
|
+
return tx.moveCall({
|
|
201
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::withdraw`,
|
|
202
|
+
arguments: [
|
|
203
|
+
tx.object(manager.address),
|
|
204
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
205
|
+
tx.object(baseMarginPool.address),
|
|
206
|
+
tx.object(quoteMarginPool.address),
|
|
207
|
+
tx.object(baseCoin.priceInfoObjectId),
|
|
208
|
+
tx.object(quoteCoin.priceInfoObjectId),
|
|
209
|
+
tx.object(pool.address),
|
|
210
|
+
tx.pure.u64(Math.round(amount * quoteCoin.scalar)),
|
|
211
|
+
tx.object.clock()
|
|
212
|
+
],
|
|
213
|
+
typeArguments: [
|
|
214
|
+
baseCoin.type,
|
|
215
|
+
quoteCoin.type,
|
|
216
|
+
quoteCoin.type
|
|
217
|
+
]
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
this.withdrawDeep = (managerKey, amount) => (tx) => {
|
|
221
|
+
const manager = this.#config.getMarginManager(managerKey);
|
|
222
|
+
const pool = this.#config.getPool(manager.poolKey);
|
|
223
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
224
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
225
|
+
const deepCoin = this.#config.getCoin("DEEP");
|
|
226
|
+
const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
|
|
227
|
+
const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
|
|
228
|
+
return tx.moveCall({
|
|
229
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::withdraw`,
|
|
230
|
+
arguments: [
|
|
231
|
+
tx.object(manager.address),
|
|
232
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
233
|
+
tx.object(baseMarginPool.address),
|
|
234
|
+
tx.object(quoteMarginPool.address),
|
|
235
|
+
tx.object(baseCoin.priceInfoObjectId),
|
|
236
|
+
tx.object(quoteCoin.priceInfoObjectId),
|
|
237
|
+
tx.object(pool.address),
|
|
238
|
+
tx.pure.u64(Math.round(amount * deepCoin.scalar)),
|
|
239
|
+
tx.object.clock()
|
|
240
|
+
],
|
|
241
|
+
typeArguments: [
|
|
242
|
+
baseCoin.type,
|
|
243
|
+
quoteCoin.type,
|
|
244
|
+
deepCoin.type
|
|
245
|
+
]
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
this.borrowBase = (managerKey, amount) => (tx) => {
|
|
249
|
+
const manager = this.#config.getMarginManager(managerKey);
|
|
250
|
+
const pool = this.#config.getPool(manager.poolKey);
|
|
251
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
252
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
253
|
+
const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
|
|
254
|
+
return tx.moveCall({
|
|
255
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::borrow_base`,
|
|
256
|
+
arguments: [
|
|
257
|
+
tx.object(manager.address),
|
|
258
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
259
|
+
tx.object(baseMarginPool.address),
|
|
260
|
+
tx.object(baseCoin.priceInfoObjectId),
|
|
261
|
+
tx.object(quoteCoin.priceInfoObjectId),
|
|
262
|
+
tx.object(pool.address),
|
|
263
|
+
tx.pure.u64(Math.round(amount * baseCoin.scalar)),
|
|
264
|
+
tx.object.clock()
|
|
265
|
+
],
|
|
266
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
267
|
+
});
|
|
268
|
+
};
|
|
269
|
+
this.borrowQuote = (managerKey, amount) => (tx) => {
|
|
270
|
+
const manager = this.#config.getMarginManager(managerKey);
|
|
271
|
+
const pool = this.#config.getPool(manager.poolKey);
|
|
272
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
273
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
274
|
+
const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
|
|
275
|
+
return tx.moveCall({
|
|
276
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::borrow_quote`,
|
|
277
|
+
arguments: [
|
|
278
|
+
tx.object(manager.address),
|
|
279
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
280
|
+
tx.object(quoteMarginPool.address),
|
|
281
|
+
tx.object(baseCoin.priceInfoObjectId),
|
|
282
|
+
tx.object(quoteCoin.priceInfoObjectId),
|
|
283
|
+
tx.object(pool.address),
|
|
284
|
+
tx.pure.u64(Math.round(amount * quoteCoin.scalar)),
|
|
285
|
+
tx.object.clock()
|
|
286
|
+
],
|
|
287
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
288
|
+
});
|
|
289
|
+
};
|
|
290
|
+
this.repayBase = (managerKey, amount) => (tx) => {
|
|
291
|
+
const manager = this.#config.getMarginManager(managerKey);
|
|
292
|
+
const pool = this.#config.getPool(manager.poolKey);
|
|
293
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
294
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
295
|
+
const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
|
|
296
|
+
return tx.moveCall({
|
|
297
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::repay_base`,
|
|
298
|
+
arguments: [
|
|
299
|
+
tx.object(manager.address),
|
|
300
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
301
|
+
tx.object(baseMarginPool.address),
|
|
302
|
+
tx.object.option({
|
|
303
|
+
type: "u64",
|
|
304
|
+
value: amount ? tx.pure.u64(Math.round(amount * baseCoin.scalar)) : null
|
|
305
|
+
}),
|
|
306
|
+
tx.object.clock()
|
|
307
|
+
],
|
|
308
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
this.repayQuote = (managerKey, amount) => (tx) => {
|
|
312
|
+
const manager = this.#config.getMarginManager(managerKey);
|
|
313
|
+
const pool = this.#config.getPool(manager.poolKey);
|
|
314
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
315
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
316
|
+
const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
|
|
317
|
+
return tx.moveCall({
|
|
318
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::repay_quote`,
|
|
319
|
+
arguments: [
|
|
320
|
+
tx.object(manager.address),
|
|
321
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
322
|
+
tx.object(quoteMarginPool.address),
|
|
323
|
+
tx.object.option({
|
|
324
|
+
type: "u64",
|
|
325
|
+
value: amount ? tx.pure.u64(Math.round(amount * quoteCoin.scalar)) : null
|
|
326
|
+
}),
|
|
327
|
+
tx.object.clock()
|
|
328
|
+
],
|
|
329
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
330
|
+
});
|
|
331
|
+
};
|
|
332
|
+
this.liquidate = (managerAddress, poolKey, debtIsBase, repayCoin) => (tx) => {
|
|
333
|
+
const pool = this.#config.getPool(poolKey);
|
|
334
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
335
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
336
|
+
const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
|
|
337
|
+
const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
|
|
338
|
+
const marginPool = debtIsBase ? baseMarginPool : quoteMarginPool;
|
|
339
|
+
return tx.moveCall({
|
|
340
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::liquidate`,
|
|
341
|
+
arguments: [
|
|
342
|
+
tx.object(managerAddress),
|
|
343
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
344
|
+
tx.object(baseCoin.priceInfoObjectId),
|
|
345
|
+
tx.object(quoteCoin.priceInfoObjectId),
|
|
346
|
+
tx.object(marginPool.address),
|
|
347
|
+
tx.object(pool.address),
|
|
348
|
+
repayCoin,
|
|
349
|
+
tx.object.clock()
|
|
350
|
+
],
|
|
351
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
352
|
+
});
|
|
353
|
+
};
|
|
354
|
+
this.setMarginManagerReferral = (managerKey, referral) => (tx) => {
|
|
355
|
+
const manager = this.#config.getMarginManager(managerKey);
|
|
356
|
+
const pool = this.#config.getPool(manager.poolKey);
|
|
357
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
358
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
359
|
+
tx.moveCall({
|
|
360
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::set_margin_manager_referral`,
|
|
361
|
+
arguments: [tx.object(manager.address), tx.object(referral)],
|
|
362
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
363
|
+
});
|
|
364
|
+
};
|
|
365
|
+
this.unsetMarginManagerReferral = (managerKey, poolKey) => (tx) => {
|
|
366
|
+
const manager = this.#config.getMarginManager(managerKey);
|
|
367
|
+
const pool = this.#config.getPool(poolKey);
|
|
368
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
369
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
370
|
+
tx.moveCall({
|
|
371
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::unset_margin_manager_referral`,
|
|
372
|
+
arguments: [tx.object(manager.address), tx.pure.id(pool.address)],
|
|
373
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
374
|
+
});
|
|
375
|
+
};
|
|
376
|
+
this.ownerByPoolKey = (poolKey, marginManagerId) => (tx) => {
|
|
377
|
+
const pool = this.#config.getPool(poolKey);
|
|
378
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
379
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
380
|
+
return tx.moveCall({
|
|
381
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::owner`,
|
|
382
|
+
arguments: [tx.object(marginManagerId)],
|
|
383
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
384
|
+
});
|
|
385
|
+
};
|
|
386
|
+
this.deepbookPool = (poolKey, marginManagerId) => (tx) => {
|
|
387
|
+
const pool = this.#config.getPool(poolKey);
|
|
388
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
389
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
390
|
+
return tx.moveCall({
|
|
391
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::deepbook_pool`,
|
|
392
|
+
arguments: [tx.object(marginManagerId)],
|
|
393
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
394
|
+
});
|
|
395
|
+
};
|
|
396
|
+
this.marginPoolId = (poolKey, marginManagerId) => (tx) => {
|
|
397
|
+
const pool = this.#config.getPool(poolKey);
|
|
398
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
399
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
400
|
+
return tx.moveCall({
|
|
401
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::margin_pool_id`,
|
|
402
|
+
arguments: [tx.object(marginManagerId)],
|
|
403
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
404
|
+
});
|
|
405
|
+
};
|
|
406
|
+
this.borrowedShares = (poolKey, marginManagerId) => (tx) => {
|
|
407
|
+
const pool = this.#config.getPool(poolKey);
|
|
408
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
409
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
410
|
+
return tx.moveCall({
|
|
411
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::borrowed_shares`,
|
|
412
|
+
arguments: [tx.object(marginManagerId)],
|
|
413
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
414
|
+
});
|
|
415
|
+
};
|
|
416
|
+
this.borrowedBaseShares = (poolKey, marginManagerId) => (tx) => {
|
|
417
|
+
const pool = this.#config.getPool(poolKey);
|
|
418
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
419
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
420
|
+
return tx.moveCall({
|
|
421
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::borrowed_base_shares`,
|
|
422
|
+
arguments: [tx.object(marginManagerId)],
|
|
423
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
424
|
+
});
|
|
425
|
+
};
|
|
426
|
+
this.borrowedQuoteShares = (poolKey, marginManagerId) => (tx) => {
|
|
427
|
+
const pool = this.#config.getPool(poolKey);
|
|
428
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
429
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
430
|
+
return tx.moveCall({
|
|
431
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::borrowed_quote_shares`,
|
|
432
|
+
arguments: [tx.object(marginManagerId)],
|
|
433
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
434
|
+
});
|
|
435
|
+
};
|
|
436
|
+
this.hasBaseDebt = (poolKey, marginManagerId) => (tx) => {
|
|
437
|
+
const pool = this.#config.getPool(poolKey);
|
|
438
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
439
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
440
|
+
return tx.moveCall({
|
|
441
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::has_base_debt`,
|
|
442
|
+
arguments: [tx.object(marginManagerId)],
|
|
443
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
444
|
+
});
|
|
445
|
+
};
|
|
446
|
+
this.balanceManager = (poolKey, marginManagerId) => (tx) => {
|
|
447
|
+
const pool = this.#config.getPool(poolKey);
|
|
448
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
449
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
450
|
+
return tx.moveCall({
|
|
451
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::balance_manager`,
|
|
452
|
+
arguments: [tx.object(marginManagerId)],
|
|
453
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
454
|
+
});
|
|
455
|
+
};
|
|
456
|
+
this.calculateAssets = (poolKey, marginManagerId) => (tx) => {
|
|
457
|
+
const pool = this.#config.getPool(poolKey);
|
|
458
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
459
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
460
|
+
return tx.moveCall({
|
|
461
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::calculate_assets`,
|
|
462
|
+
arguments: [tx.object(marginManagerId), tx.object(pool.address)],
|
|
463
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
464
|
+
});
|
|
465
|
+
};
|
|
466
|
+
this.calculateDebts = (poolKey, coinKey, marginManagerId) => (tx) => {
|
|
467
|
+
const pool = this.#config.getPool(poolKey);
|
|
468
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
469
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
470
|
+
const debtCoin = this.#config.getCoin(coinKey);
|
|
471
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
472
|
+
return tx.moveCall({
|
|
473
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::calculate_debts`,
|
|
474
|
+
arguments: [
|
|
475
|
+
tx.object(marginManagerId),
|
|
476
|
+
tx.object(marginPool.address),
|
|
477
|
+
tx.object.clock()
|
|
478
|
+
],
|
|
479
|
+
typeArguments: [
|
|
480
|
+
baseCoin.type,
|
|
481
|
+
quoteCoin.type,
|
|
482
|
+
debtCoin.type
|
|
483
|
+
]
|
|
484
|
+
});
|
|
485
|
+
};
|
|
486
|
+
this.managerState = (poolKey, marginManagerId) => (tx) => {
|
|
487
|
+
const pool = this.#config.getPool(poolKey);
|
|
488
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
489
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
490
|
+
const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
|
|
491
|
+
const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
|
|
492
|
+
return tx.moveCall({
|
|
493
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::manager_state`,
|
|
494
|
+
arguments: [
|
|
495
|
+
tx.object(marginManagerId),
|
|
496
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
497
|
+
tx.object(baseCoin.priceInfoObjectId),
|
|
498
|
+
tx.object(quoteCoin.priceInfoObjectId),
|
|
499
|
+
tx.object(pool.address),
|
|
500
|
+
tx.object(baseMarginPool.address),
|
|
501
|
+
tx.object(quoteMarginPool.address),
|
|
502
|
+
tx.object.clock()
|
|
503
|
+
],
|
|
504
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
505
|
+
});
|
|
506
|
+
};
|
|
507
|
+
this.baseBalance = (poolKey, marginManagerId) => (tx) => {
|
|
508
|
+
const pool = this.#config.getPool(poolKey);
|
|
509
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
510
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
511
|
+
return tx.moveCall({
|
|
512
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::base_balance`,
|
|
513
|
+
arguments: [tx.object(marginManagerId)],
|
|
514
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
515
|
+
});
|
|
516
|
+
};
|
|
517
|
+
this.quoteBalance = (poolKey, marginManagerId) => (tx) => {
|
|
518
|
+
const pool = this.#config.getPool(poolKey);
|
|
519
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
520
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
521
|
+
return tx.moveCall({
|
|
522
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::quote_balance`,
|
|
523
|
+
arguments: [tx.object(marginManagerId)],
|
|
524
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
525
|
+
});
|
|
526
|
+
};
|
|
527
|
+
this.deepBalance = (poolKey, marginManagerId) => (tx) => {
|
|
528
|
+
const pool = this.#config.getPool(poolKey);
|
|
529
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
530
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
531
|
+
return tx.moveCall({
|
|
532
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::deep_balance`,
|
|
533
|
+
arguments: [tx.object(marginManagerId)],
|
|
534
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
535
|
+
});
|
|
536
|
+
};
|
|
537
|
+
this.getMarginAccountOrderDetails = (poolKey, marginManagerId) => (tx) => {
|
|
538
|
+
const pool = this.#config.getPool(poolKey);
|
|
539
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
540
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
541
|
+
const balanceManager = tx.moveCall({
|
|
542
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::balance_manager`,
|
|
543
|
+
arguments: [tx.object(marginManagerId)],
|
|
544
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
545
|
+
});
|
|
546
|
+
return tx.moveCall({
|
|
547
|
+
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_account_order_details`,
|
|
548
|
+
arguments: [tx.object(pool.address), balanceManager],
|
|
549
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
550
|
+
});
|
|
551
|
+
};
|
|
552
|
+
this.#config = config;
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
//#endregion
|
|
557
|
+
export { MarginManagerContract };
|
|
558
|
+
//# sourceMappingURL=marginManager.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marginManager.mjs","names":["#config"],"sources":["../../src/transactions/marginManager.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport type { Transaction, TransactionArgument } from '@haneullabs/haneul/transactions';\nimport { coinWithBalance } from '@haneullabs/haneul/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport type { DepositParams, DepositDuringInitParams } from '../types/index.js';\n\n/**\n * MarginManagerContract class for managing MarginManager operations.\n */\nexport class MarginManagerContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginManagerContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @description Create a new margin manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewMarginManager = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::new`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Create a new margin manager with an initializer\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewMarginManagerWithInitializer = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst [manager, initializer] = tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::new_with_initializer`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t\treturn { manager, initializer };\n\t};\n\n\t/**\n\t * @description Share a margin manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {TransactionArgument} manager The margin manager to share\n\t * @param {TransactionArgument} initializer The initializer for the manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tshareMarginManager =\n\t\t(poolKey: string, manager: TransactionArgument, initializer: TransactionArgument) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::share`,\n\t\t\t\targuments: [manager, initializer],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Deposit into a margin manager during initialization (before sharing).\n\t * Use this when you need to deposit funds into a newly created manager in the same transaction.\n\t * @param {DepositDuringInitParams} params The deposit parameters\n\t * @returns A function that takes a Transaction object\n\t */\n\tdepositDuringInitialization = (params: DepositDuringInitParams) => (tx: Transaction) => {\n\t\tconst { manager, poolKey, coinType } = params;\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\t// Get the deposit coin from config using the coinType key (e.g., 'HANEUL', 'DBUSDC', 'DEEP')\n\t\tconst depositCoin = this.#config.getCoin(coinType);\n\n\t\t// If amount is provided, create a coin with balance; otherwise use the provided coin\n\t\tconst coin =\n\t\t\t'amount' in params && params.amount !== undefined\n\t\t\t\t? coinWithBalance({\n\t\t\t\t\t\ttype: depositCoin.type,\n\t\t\t\t\t\tbalance: Math.round(params.amount * depositCoin.scalar),\n\t\t\t\t\t})\n\t\t\t\t: params.coin;\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::deposit`,\n\t\t\targuments: [\n\t\t\t\tmanager,\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(baseCoin.priceInfoObjectId!),\n\t\t\t\ttx.object(quoteCoin.priceInfoObjectId!),\n\t\t\t\tcoin,\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type, depositCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Deposit base into a margin manager\n\t * @param {DepositParams} params The deposit parameters\n\t * @returns A function that takes a Transaction object\n\t */\n\tdepositBase = (params: DepositParams) => (tx: Transaction) => {\n\t\tconst { managerKey } = params;\n\t\tconst manager = this.#config.getMarginManager(managerKey);\n\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst coin =\n\t\t\t'amount' in params && params.amount !== undefined\n\t\t\t\t? coinWithBalance({\n\t\t\t\t\t\ttype: baseCoin.type,\n\t\t\t\t\t\tbalance: Math.round(params.amount * baseCoin.scalar),\n\t\t\t\t\t})\n\t\t\t\t: params.coin;\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::deposit`,\n\t\t\targuments: [\n\t\t\t\ttx.object(manager.address),\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(baseCoin.priceInfoObjectId!),\n\t\t\t\ttx.object(quoteCoin.priceInfoObjectId!),\n\t\t\t\tcoin,\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type, baseCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Deposit quote into a margin manager\n\t * @param {DepositParams} params The deposit parameters\n\t * @returns A function that takes a Transaction object\n\t */\n\tdepositQuote = (params: DepositParams) => (tx: Transaction) => {\n\t\tconst { managerKey } = params;\n\t\tconst manager = this.#config.getMarginManager(managerKey);\n\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst coin =\n\t\t\t'amount' in params && params.amount !== undefined\n\t\t\t\t? coinWithBalance({\n\t\t\t\t\t\ttype: quoteCoin.type,\n\t\t\t\t\t\tbalance: Math.round(params.amount * quoteCoin.scalar),\n\t\t\t\t\t})\n\t\t\t\t: params.coin;\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::deposit`,\n\t\t\targuments: [\n\t\t\t\ttx.object(manager.address),\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(baseCoin.priceInfoObjectId!),\n\t\t\t\ttx.object(quoteCoin.priceInfoObjectId!),\n\t\t\t\tcoin,\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Deposit deep into a margin manager\n\t * @param {DepositParams} params The deposit parameters\n\t * @returns A function that takes a Transaction object\n\t */\n\tdepositDeep = (params: DepositParams) => (tx: Transaction) => {\n\t\tconst { managerKey } = params;\n\t\tconst manager = this.#config.getMarginManager(managerKey);\n\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst deepCoin = this.#config.getCoin('DEEP');\n\t\tconst coin =\n\t\t\t'amount' in params && params.amount !== undefined\n\t\t\t\t? coinWithBalance({\n\t\t\t\t\t\ttype: deepCoin.type,\n\t\t\t\t\t\tbalance: Math.round(params.amount * deepCoin.scalar),\n\t\t\t\t\t})\n\t\t\t\t: params.coin;\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::deposit`,\n\t\t\targuments: [\n\t\t\t\ttx.object(manager.address),\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(baseCoin.priceInfoObjectId!),\n\t\t\t\ttx.object(quoteCoin.priceInfoObjectId!),\n\t\t\t\tcoin,\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type, deepCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Withdraw base from a margin manager\n\t * @param {string} managerKey The key to identify the manager\n\t * @param {number} amount The amount to withdraw\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawBase = (managerKey: string, amount: number) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getMarginManager(managerKey);\n\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::withdraw`,\n\t\t\targuments: [\n\t\t\t\ttx.object(manager.address),\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(baseMarginPool.address),\n\t\t\t\ttx.object(quoteMarginPool.address),\n\t\t\t\ttx.object(baseCoin.priceInfoObjectId!),\n\t\t\t\ttx.object(quoteCoin.priceInfoObjectId!),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.pure.u64(Math.round(amount * baseCoin.scalar)),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type, baseCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Withdraw quote from a margin manager\n\t * @param {string} managerKey The key to identify the manager\n\t * @param {number} amount The amount to withdraw\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawQuote = (managerKey: string, amount: number) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getMarginManager(managerKey);\n\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::withdraw`,\n\t\t\targuments: [\n\t\t\t\ttx.object(manager.address),\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(baseMarginPool.address),\n\t\t\t\ttx.object(quoteMarginPool.address),\n\t\t\t\ttx.object(baseCoin.priceInfoObjectId!),\n\t\t\t\ttx.object(quoteCoin.priceInfoObjectId!),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.pure.u64(Math.round(amount * quoteCoin.scalar)),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Withdraw deep from a margin manager\n\t * @param {string} managerKey The key to identify the manager\n\t * @param {number} amount The amount to withdraw\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawDeep = (managerKey: string, amount: number) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getMarginManager(managerKey);\n\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst deepCoin = this.#config.getCoin('DEEP');\n\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::withdraw`,\n\t\t\targuments: [\n\t\t\t\ttx.object(manager.address),\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(baseMarginPool.address),\n\t\t\t\ttx.object(quoteMarginPool.address),\n\t\t\t\ttx.object(baseCoin.priceInfoObjectId!),\n\t\t\t\ttx.object(quoteCoin.priceInfoObjectId!),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.pure.u64(Math.round(amount * deepCoin.scalar)),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type, deepCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Borrow base from a margin manager\n\t * @param {string} managerKey The key to identify the manager\n\t * @param {number} amount The amount to borrow\n\t * @returns A function that takes a Transaction object\n\t */\n\tborrowBase = (managerKey: string, amount: number) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getMarginManager(managerKey);\n\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::borrow_base`,\n\t\t\targuments: [\n\t\t\t\ttx.object(manager.address),\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(baseMarginPool.address),\n\t\t\t\ttx.object(baseCoin.priceInfoObjectId!),\n\t\t\t\ttx.object(quoteCoin.priceInfoObjectId!),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.pure.u64(Math.round(amount * baseCoin.scalar)),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Borrow quote from a margin manager\n\t * @param {string} managerKey The key to identify the manager\n\t * @param {number} amount The amount to borrow\n\t * @returns A function that takes a Transaction object\n\t */\n\tborrowQuote = (managerKey: string, amount: number) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getMarginManager(managerKey);\n\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::borrow_quote`,\n\t\t\targuments: [\n\t\t\t\ttx.object(manager.address),\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(quoteMarginPool.address),\n\t\t\t\ttx.object(baseCoin.priceInfoObjectId!),\n\t\t\t\ttx.object(quoteCoin.priceInfoObjectId!),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.pure.u64(Math.round(amount * quoteCoin.scalar)),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Repay base from a margin manager\n\t * @param {string} managerKey The key to identify the manager\n\t * @param {number} amount The amount to repay\n\t * @returns A function that takes a Transaction object\n\t */\n\trepayBase = (managerKey: string, amount?: number) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getMarginManager(managerKey);\n\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::repay_base`,\n\t\t\targuments: [\n\t\t\t\ttx.object(manager.address),\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(baseMarginPool.address),\n\t\t\t\ttx.object.option({\n\t\t\t\t\ttype: 'u64',\n\t\t\t\t\tvalue: amount ? tx.pure.u64(Math.round(amount * baseCoin.scalar)) : null,\n\t\t\t\t}),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Repay quote from a margin manager\n\t * @param {string} managerKey The key to identify the manager\n\t * @param {number} amount The amount to repay\n\t * @returns A function that takes a Transaction object\n\t */\n\trepayQuote = (managerKey: string, amount?: number) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getMarginManager(managerKey);\n\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::repay_quote`,\n\t\t\targuments: [\n\t\t\t\ttx.object(manager.address),\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(quoteMarginPool.address),\n\t\t\t\ttx.object.option({\n\t\t\t\t\ttype: 'u64',\n\t\t\t\t\tvalue: amount ? tx.pure.u64(Math.round(amount * quoteCoin.scalar)) : null,\n\t\t\t\t}),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Liquidate a margin manager\n\t * @param {string} managerAddress The address of the manager to liquidate\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {boolean} debtIsBase Whether the debt is in base\n\t * @param {TransactionArgument} repayCoin The coin to repay\n\t * @returns A function that takes a Transaction object\n\t */\n\tliquidate =\n\t\t(\n\t\t\tmanagerAddress: string,\n\t\t\tpoolKey: string,\n\t\t\tdebtIsBase: boolean,\n\t\t\trepayCoin: TransactionArgument,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\t\tconst marginPool = debtIsBase ? baseMarginPool : quoteMarginPool;\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::liquidate`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(managerAddress),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\ttx.object(baseCoin.priceInfoObjectId!),\n\t\t\t\t\ttx.object(quoteCoin.priceInfoObjectId!),\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(pool.address),\n\t\t\t\t\trepayCoin,\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Set the referral for a margin manager (DeepBookPoolReferral)\n\t * @param {string} managerKey The key to identify the margin manager\n\t * @param {string} referral The referral (DeepBookPoolReferral) to set\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMarginManagerReferral = (managerKey: string, referral: string) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getMarginManager(managerKey);\n\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::set_margin_manager_referral`,\n\t\t\targuments: [tx.object(manager.address), tx.object(referral)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Unset the referral for a margin manager\n\t * @param {string} managerKey The key to identify the margin manager\n\t * @param {string} poolKey The key of the pool to unset the referral for\n\t * @returns A function that takes a Transaction object\n\t */\n\tunsetMarginManagerReferral = (managerKey: string, poolKey: string) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getMarginManager(managerKey);\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::unset_margin_manager_referral`,\n\t\t\targuments: [tx.object(manager.address), tx.pure.id(pool.address)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t// === Read-Only Functions ===\n\n\t/**\n\t * @description Get the owner address of a margin manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\townerByPoolKey = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::owner`,\n\t\t\targuments: [tx.object(marginManagerId)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the DeepBook pool ID associated with a margin manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tdeepbookPool = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::deepbook_pool`,\n\t\t\targuments: [tx.object(marginManagerId)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the margin pool ID (if any) associated with a margin manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tmarginPoolId = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::margin_pool_id`,\n\t\t\targuments: [tx.object(marginManagerId)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get borrowed shares for both base and quote assets\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tborrowedShares = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::borrowed_shares`,\n\t\t\targuments: [tx.object(marginManagerId)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get borrowed base shares\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tborrowedBaseShares = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::borrowed_base_shares`,\n\t\t\targuments: [tx.object(marginManagerId)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get borrowed quote shares\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tborrowedQuoteShares = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::borrowed_quote_shares`,\n\t\t\targuments: [tx.object(marginManagerId)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Check if margin manager has base asset debt\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\thasBaseDebt = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::has_base_debt`,\n\t\t\targuments: [tx.object(marginManagerId)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the balance manager ID for a margin manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tbalanceManager = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::balance_manager`,\n\t\t\targuments: [tx.object(marginManagerId)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Calculate assets (base and quote) for a margin manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tcalculateAssets = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::calculate_assets`,\n\t\t\targuments: [tx.object(marginManagerId), tx.object(pool.address)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Calculate debts (base and quote) for a margin manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} coinKey The key to identify the debt coin (base or quote)\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tcalculateDebts =\n\t\t(poolKey: string, coinKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst debtCoin = this.#config.getCoin(coinKey);\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::calculate_debts`,\n\t\t\t\targuments: [tx.object(marginManagerId), tx.object(marginPool.address), tx.object.clock()],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type, debtCoin.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Get comprehensive state information for a margin manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t * @returns Returns (manager_id, deepbook_pool_id, risk_ratio, base_asset, quote_asset,\n\t * base_debt, quote_debt, base_pyth_price, base_pyth_decimals,\n\t * quote_pyth_price, quote_pyth_decimals)\n\t */\n\tmanagerState = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::manager_state`,\n\t\t\targuments: [\n\t\t\t\ttx.object(marginManagerId),\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(baseCoin.priceInfoObjectId!),\n\t\t\t\ttx.object(quoteCoin.priceInfoObjectId!),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(baseMarginPool.address),\n\t\t\t\ttx.object(quoteMarginPool.address),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the base asset balance of a margin manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tbaseBalance = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::base_balance`,\n\t\t\targuments: [tx.object(marginManagerId)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the quote asset balance of a margin manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tquoteBalance = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::quote_balance`,\n\t\t\targuments: [tx.object(marginManagerId)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the DEEP token balance of a margin manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tdeepBalance = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::deep_balance`,\n\t\t\targuments: [tx.object(marginManagerId)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get account order details for a margin manager.\n\t * This retrieves the balance manager from the margin manager and calls get_account_order_details.\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetMarginAccountOrderDetails =\n\t\t(poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\t\t// Get the balance manager from the margin manager\n\t\t\tconst balanceManager = tx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::balance_manager`,\n\t\t\t\targuments: [tx.object(marginManagerId)],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t});\n\n\t\t\t// Call get_account_order_details with the balance manager\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_account_order_details`,\n\t\t\t\targuments: [tx.object(pool.address), balanceManager],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t});\n\t\t};\n}\n"],"mappings":";;;;;;AAWA,IAAa,wBAAb,MAAmC;CAClC;;;;CAKA,YAAY,QAAwB;2BAShB,aAAqB,OAAoB;GAC5D,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;GAC1C,MAAM,WAAW,MAAKA,OAAQ,QAAQ,KAAK,SAAS;GACpD,MAAM,YAAY,MAAKA,OAAQ,QAAQ,KAAK,UAAU;AACtD,MAAG,SAAS;IACX,QAAQ,GAAG,MAAKA,OAAQ,kBAAkB;IAC1C,WAAW;KACV,GAAG,OAAO,KAAK,QAAQ;KACvB,GAAG,OAAO,MAAKA,OAAQ,YAAY;KACnC,GAAG,OAA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