@haneullabs/deepbook-v3 0.1.0 → 1.2.1
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 +342 -81
- package/dist/client.d.mts +238 -0
- package/dist/client.d.mts.map +1 -0
- package/dist/client.mjs +397 -0
- package/dist/client.mjs.map +1 -0
- package/dist/contracts/deepbook/account.d.mts +37 -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 +12 -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 +12 -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 +21 -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 +23 -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/queries/accountQueries.mjs +104 -0
- package/dist/queries/accountQueries.mjs.map +1 -0
- package/dist/queries/balanceManagerQueries.mjs +113 -0
- package/dist/queries/balanceManagerQueries.mjs.map +1 -0
- package/dist/queries/context.mjs +15 -0
- package/dist/queries/context.mjs.map +1 -0
- package/dist/queries/marginManagerQueries.mjs +365 -0
- package/dist/queries/marginManagerQueries.mjs.map +1 -0
- package/dist/queries/marginPoolQueries.mjs +184 -0
- package/dist/queries/marginPoolQueries.mjs.map +1 -0
- package/dist/queries/orderQueries.mjs +165 -0
- package/dist/queries/orderQueries.mjs.map +1 -0
- package/dist/queries/poolQueries.mjs +234 -0
- package/dist/queries/poolQueries.mjs.map +1 -0
- package/dist/queries/priceFeedQueries.mjs +83 -0
- package/dist/queries/priceFeedQueries.mjs.map +1 -0
- package/dist/queries/quantityQueries.mjs +216 -0
- package/dist/queries/quantityQueries.mjs.map +1 -0
- package/dist/queries/referralQueries.mjs +96 -0
- package/dist/queries/referralQueries.mjs.map +1 -0
- package/dist/queries/registryQueries.mjs +162 -0
- package/dist/queries/registryQueries.mjs.map +1 -0
- package/dist/queries/tpslQueries.mjs +62 -0
- package/dist/queries/tpslQueries.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 +234 -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 +979 -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 +222 -0
- package/dist/transactions/deepbookAdmin.mjs.map +1 -0
- package/dist/transactions/flashLoans.d.mts +61 -0
- package/dist/transactions/flashLoans.d.mts.map +1 -0
- package/dist/transactions/flashLoans.mjs +77 -0
- package/dist/transactions/flashLoans.mjs.map +1 -0
- package/dist/transactions/governance.d.mts +47 -0
- package/dist/transactions/governance.d.mts.map +1 -0
- package/dist/transactions/governance.mjs +91 -0
- package/dist/transactions/governance.mjs.map +1 -0
- package/dist/transactions/marginAdmin.d.mts +138 -0
- package/dist/transactions/marginAdmin.d.mts.map +1 -0
- package/dist/transactions/marginAdmin.mjs +250 -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 +110 -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 +161 -0
- package/dist/transactions/marginMaintainer.mjs.map +1 -0
- package/dist/transactions/marginManager.d.mts +247 -0
- package/dist/transactions/marginManager.d.mts.map +1 -0
- package/dist/transactions/marginManager.mjs +548 -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 +207 -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 +173 -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 +374 -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 +90 -0
- package/dist/utils/config.d.mts.map +1 -0
- package/dist/utils/config.mjs +104 -0
- package/dist/utils/config.mjs.map +1 -0
- package/dist/utils/constants.d.mts +93 -0
- package/dist/utils/constants.d.mts.map +1 -0
- package/dist/utils/constants.mjs +408 -0
- package/dist/utils/constants.mjs.map +1 -0
- package/dist/utils/conversion.mjs +26 -0
- package/dist/utils/conversion.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 +30 -26
- package/src/client.ts +467 -2255
- 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 +44 -3
- package/src/pyth/pyth.ts +51 -50
- package/src/queries/accountQueries.ts +117 -0
- package/src/queries/balanceManagerQueries.ts +156 -0
- package/src/queries/context.ts +44 -0
- package/src/queries/index.ts +16 -0
- package/src/queries/marginManagerQueries.ts +575 -0
- package/src/queries/marginPoolQueries.ts +226 -0
- package/src/queries/orderQueries.ts +202 -0
- package/src/queries/poolQueries.ts +266 -0
- package/src/queries/priceFeedQueries.ts +141 -0
- package/src/queries/quantityQueries.ts +266 -0
- package/src/queries/referralQueries.ts +112 -0
- package/src/queries/registryQueries.ts +185 -0
- package/src/queries/tpslQueries.ts +88 -0
- package/src/transactions/balanceManager.ts +5 -4
- package/src/transactions/deepbook.ts +117 -84
- package/src/transactions/deepbookAdmin.ts +10 -9
- package/src/transactions/flashLoans.ts +5 -4
- package/src/transactions/governance.ts +5 -4
- package/src/transactions/marginAdmin.ts +12 -8
- package/src/transactions/marginLiquidations.ts +5 -4
- package/src/transactions/marginMaintainer.ts +28 -16
- package/src/transactions/marginManager.ts +78 -29
- package/src/transactions/marginPool.ts +7 -7
- package/src/transactions/marginTPSL.ts +16 -11
- package/src/transactions/poolProxy.ts +62 -11
- package/src/types/bcs.ts +1 -1
- package/src/types/index.ts +217 -53
- package/src/utils/config.ts +38 -17
- package/src/utils/constants.ts +73 -18
- package/src/utils/conversion.ts +33 -0
- 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,140 @@
|
|
|
1
|
+
import { DeepBookConfig } from "../utils/config.mjs";
|
|
2
|
+
import * as _haneullabs_haneul_transactions29 from "@haneullabs/haneul/transactions";
|
|
3
|
+
import { Transaction, TransactionObjectArgument } from "@haneullabs/haneul/transactions";
|
|
4
|
+
|
|
5
|
+
//#region src/transactions/marginPool.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* MarginPoolContract class for managing MarginPool operations.
|
|
8
|
+
*/
|
|
9
|
+
declare class MarginPoolContract {
|
|
10
|
+
#private;
|
|
11
|
+
/**
|
|
12
|
+
* @param {DeepBookConfig} config Configuration for MarginPoolContract
|
|
13
|
+
*/
|
|
14
|
+
constructor(config: DeepBookConfig);
|
|
15
|
+
/**
|
|
16
|
+
* @description Mint a supplier cap for margin pool
|
|
17
|
+
* @returns A function that takes a Transaction object
|
|
18
|
+
*/
|
|
19
|
+
mintSupplierCap: () => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
20
|
+
/**
|
|
21
|
+
* @description Supply to a margin pool
|
|
22
|
+
* @param {string} coinKey The key to identify the pool
|
|
23
|
+
* @param {TransactionObjectArgument} supplierCap The supplier cap object
|
|
24
|
+
* @param {number} amountToDeposit The amount to deposit
|
|
25
|
+
* @param {string} referralId The ID of the referral
|
|
26
|
+
* @returns A function that takes a Transaction object
|
|
27
|
+
*/
|
|
28
|
+
supplyToMarginPool: (coinKey: string, supplierCap: TransactionObjectArgument, amountToDeposit: number, referralId?: string) => (tx: Transaction) => void;
|
|
29
|
+
/**
|
|
30
|
+
* @description Withdraw from a margin pool. If amountToWithdraw is not provided, withdraws all.
|
|
31
|
+
* @param {string} coinKey The key to identify the pool
|
|
32
|
+
* @param {TransactionObjectArgument} supplierCap The supplier cap object
|
|
33
|
+
* @param {number} [amountToWithdraw] The amount to withdraw. If omitted, withdraws all.
|
|
34
|
+
* @returns A function that takes a Transaction object
|
|
35
|
+
*/
|
|
36
|
+
withdrawFromMarginPool: (coinKey: string, supplierCap: TransactionObjectArgument, amountToWithdraw?: number) => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
37
|
+
/**
|
|
38
|
+
* @description Mint a referral for a margin pool
|
|
39
|
+
* @param {string} coinKey The key to identify the pool
|
|
40
|
+
* @returns A function that takes a Transaction object
|
|
41
|
+
*/
|
|
42
|
+
mintSupplyReferral: (coinKey: string) => (tx: Transaction) => void;
|
|
43
|
+
/**
|
|
44
|
+
* @description Withdraw referral fees from a margin pool
|
|
45
|
+
* @param {string} coinKey The key to identify the pool
|
|
46
|
+
* @param {string} referralId The ID of the referral
|
|
47
|
+
* @returns A function that takes a Transaction object
|
|
48
|
+
*/
|
|
49
|
+
withdrawReferralFees: (coinKey: string, referralId: string) => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
50
|
+
/**
|
|
51
|
+
* @description Get the margin pool ID
|
|
52
|
+
* @param {string} coinKey The key to identify the pool
|
|
53
|
+
* @returns A function that takes a Transaction object
|
|
54
|
+
*/
|
|
55
|
+
getId: (coinKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
56
|
+
/**
|
|
57
|
+
* @description Check if a deepbook pool is allowed for borrowing
|
|
58
|
+
* @param {string} coinKey The key to identify the margin pool
|
|
59
|
+
* @param {string} deepbookPoolId The ID of the deepbook pool
|
|
60
|
+
* @returns A function that takes a Transaction object
|
|
61
|
+
*/
|
|
62
|
+
deepbookPoolAllowed: (coinKey: string, deepbookPoolId: string) => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
63
|
+
/**
|
|
64
|
+
* @description Get the total supply amount
|
|
65
|
+
* @param {string} coinKey The key to identify the pool
|
|
66
|
+
* @returns A function that takes a Transaction object
|
|
67
|
+
*/
|
|
68
|
+
totalSupply: (coinKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
69
|
+
/**
|
|
70
|
+
* @description Get the total supply shares
|
|
71
|
+
* @param {string} coinKey The key to identify the pool
|
|
72
|
+
* @returns A function that takes a Transaction object
|
|
73
|
+
*/
|
|
74
|
+
supplyShares: (coinKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
75
|
+
/**
|
|
76
|
+
* @description Get the total borrow amount
|
|
77
|
+
* @param {string} coinKey The key to identify the pool
|
|
78
|
+
* @returns A function that takes a Transaction object
|
|
79
|
+
*/
|
|
80
|
+
totalBorrow: (coinKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
81
|
+
/**
|
|
82
|
+
* @description Get the total borrow shares
|
|
83
|
+
* @param {string} coinKey The key to identify the pool
|
|
84
|
+
* @returns A function that takes a Transaction object
|
|
85
|
+
*/
|
|
86
|
+
borrowShares: (coinKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
87
|
+
/**
|
|
88
|
+
* @description Get the last update timestamp
|
|
89
|
+
* @param {string} coinKey The key to identify the pool
|
|
90
|
+
* @returns A function that takes a Transaction object
|
|
91
|
+
*/
|
|
92
|
+
lastUpdateTimestamp: (coinKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
93
|
+
/**
|
|
94
|
+
* @description Get the supply cap
|
|
95
|
+
* @param {string} coinKey The key to identify the pool
|
|
96
|
+
* @returns A function that takes a Transaction object
|
|
97
|
+
*/
|
|
98
|
+
supplyCap: (coinKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
99
|
+
/**
|
|
100
|
+
* @description Get the max utilization rate
|
|
101
|
+
* @param {string} coinKey The key to identify the pool
|
|
102
|
+
* @returns A function that takes a Transaction object
|
|
103
|
+
*/
|
|
104
|
+
maxUtilizationRate: (coinKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
105
|
+
/**
|
|
106
|
+
* @description Get the protocol spread
|
|
107
|
+
* @param {string} coinKey The key to identify the pool
|
|
108
|
+
* @returns A function that takes a Transaction object
|
|
109
|
+
*/
|
|
110
|
+
protocolSpread: (coinKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
111
|
+
/**
|
|
112
|
+
* @description Get the minimum borrow amount
|
|
113
|
+
* @param {string} coinKey The key to identify the pool
|
|
114
|
+
* @returns A function that takes a Transaction object
|
|
115
|
+
*/
|
|
116
|
+
minBorrow: (coinKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
117
|
+
/**
|
|
118
|
+
* @description Get the current interest rate
|
|
119
|
+
* @param {string} coinKey The key to identify the pool
|
|
120
|
+
* @returns A function that takes a Transaction object
|
|
121
|
+
*/
|
|
122
|
+
interestRate: (coinKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
123
|
+
/**
|
|
124
|
+
* @description Get user supply shares for a supplier cap
|
|
125
|
+
* @param {string} coinKey The key to identify the pool
|
|
126
|
+
* @param {string} supplierCapId The ID of the supplier cap
|
|
127
|
+
* @returns A function that takes a Transaction object
|
|
128
|
+
*/
|
|
129
|
+
userSupplyShares: (coinKey: string, supplierCapId: string) => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
130
|
+
/**
|
|
131
|
+
* @description Get user supply amount for a supplier cap
|
|
132
|
+
* @param {string} coinKey The key to identify the pool
|
|
133
|
+
* @param {string} supplierCapId The ID of the supplier cap
|
|
134
|
+
* @returns A function that takes a Transaction object
|
|
135
|
+
*/
|
|
136
|
+
userSupplyAmount: (coinKey: string, supplierCapId: string) => (tx: Transaction) => _haneullabs_haneul_transactions29.TransactionResult;
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
export { MarginPoolContract };
|
|
140
|
+
//# sourceMappingURL=marginPool.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marginPool.d.mts","names":[],"sources":["../../src/transactions/marginPool.ts"],"mappings":";;;;;;;;cAWa,kBAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EA0BL;;;;EAlBf,eAAA,SAAyB,EAAA,EAAI,WAAA,KAAW,iCAAA,CAAA,iBAAA;EAiFO;;;;;;;;EAlE/C,kBAAA,GAEE,OAAA,UACA,WAAA,EAAa,yBAAA,EACb,eAAA,UACA,UAAA,eAEA,EAAA,EAAI,WAAA;EA6ImC;;;;;;;EA3GzC,sBAAA,GACE,OAAA,UAAiB,WAAA,EAAa,yBAAA,EAA2B,gBAAA,eACzD,EAAA,EAAI,WAAA,KAAW,iCAAA,CAAA,iBAAA;EAiKqB;;;;;EA1ItC,kBAAA,GAAsB,OAAA,cAAqB,EAAA,EAA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D;;;;;;EAuEA,gBAAA,GAAoB,OAAA,UAAiB,aAAA,cAA2B,EAAA,EAAI,WAAA,KAAW,iCAAA,CAAA,iBAAA;EAzDhC;;;;;;EAwE/C,gBAAA,GAAoB,OAAA,UAAiB,aAAA,cAA2B,EAAA,EAAI,WAAA,KAAW,iCAAA,CAAA,iBAAA;AAAA"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { convertQuantity } from "../utils/conversion.mjs";
|
|
2
|
+
import { coinWithBalance } from "@haneullabs/haneul/transactions";
|
|
3
|
+
|
|
4
|
+
//#region src/transactions/marginPool.ts
|
|
5
|
+
/**
|
|
6
|
+
* MarginPoolContract class for managing MarginPool operations.
|
|
7
|
+
*/
|
|
8
|
+
var MarginPoolContract = class {
|
|
9
|
+
#config;
|
|
10
|
+
/**
|
|
11
|
+
* @param {DeepBookConfig} config Configuration for MarginPoolContract
|
|
12
|
+
*/
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.mintSupplierCap = () => (tx) => {
|
|
15
|
+
return tx.moveCall({
|
|
16
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::mint_supplier_cap`,
|
|
17
|
+
arguments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.object.clock()]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
this.supplyToMarginPool = (coinKey, supplierCap, amountToDeposit, referralId) => (tx) => {
|
|
21
|
+
tx.setSenderIfNotSet(this.#config.address);
|
|
22
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
23
|
+
const coin = this.#config.getCoin(coinKey);
|
|
24
|
+
const depositInput = convertQuantity(amountToDeposit, coin.scalar);
|
|
25
|
+
const supply = coinWithBalance({
|
|
26
|
+
type: coin.type,
|
|
27
|
+
balance: depositInput
|
|
28
|
+
});
|
|
29
|
+
tx.moveCall({
|
|
30
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::supply`,
|
|
31
|
+
arguments: [
|
|
32
|
+
tx.object(marginPool.address),
|
|
33
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
34
|
+
supplierCap,
|
|
35
|
+
supply,
|
|
36
|
+
tx.object.option({
|
|
37
|
+
type: "0x2::object::ID",
|
|
38
|
+
value: referralId ? tx.pure.id(referralId) : null
|
|
39
|
+
}),
|
|
40
|
+
tx.object.clock()
|
|
41
|
+
],
|
|
42
|
+
typeArguments: [marginPool.type]
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
this.withdrawFromMarginPool = (coinKey, supplierCap, amountToWithdraw) => (tx) => {
|
|
46
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
47
|
+
const coin = this.#config.getCoin(coinKey);
|
|
48
|
+
const withdrawInput = amountToWithdraw !== void 0 ? convertQuantity(amountToWithdraw, coin.scalar) : null;
|
|
49
|
+
return tx.moveCall({
|
|
50
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::withdraw`,
|
|
51
|
+
arguments: [
|
|
52
|
+
tx.object(marginPool.address),
|
|
53
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
54
|
+
supplierCap,
|
|
55
|
+
tx.pure.option("u64", withdrawInput),
|
|
56
|
+
tx.object.clock()
|
|
57
|
+
],
|
|
58
|
+
typeArguments: [marginPool.type]
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
this.mintSupplyReferral = (coinKey) => (tx) => {
|
|
62
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
63
|
+
tx.moveCall({
|
|
64
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::mint_supply_referral`,
|
|
65
|
+
arguments: [
|
|
66
|
+
tx.object(marginPool.address),
|
|
67
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
68
|
+
tx.object.clock()
|
|
69
|
+
],
|
|
70
|
+
typeArguments: [marginPool.type]
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
this.withdrawReferralFees = (coinKey, referralId) => (tx) => {
|
|
74
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
75
|
+
return tx.moveCall({
|
|
76
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::withdraw_referral_fees`,
|
|
77
|
+
arguments: [
|
|
78
|
+
tx.object(marginPool.address),
|
|
79
|
+
tx.object(this.#config.MARGIN_REGISTRY_ID),
|
|
80
|
+
tx.object(referralId)
|
|
81
|
+
],
|
|
82
|
+
typeArguments: [marginPool.type]
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
this.getId = (coinKey) => (tx) => {
|
|
86
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
87
|
+
return tx.moveCall({
|
|
88
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::id`,
|
|
89
|
+
arguments: [tx.object(marginPool.address)],
|
|
90
|
+
typeArguments: [marginPool.type]
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
this.deepbookPoolAllowed = (coinKey, deepbookPoolId) => (tx) => {
|
|
94
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
95
|
+
return tx.moveCall({
|
|
96
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::deepbook_pool_allowed`,
|
|
97
|
+
arguments: [tx.object(marginPool.address), tx.pure.id(deepbookPoolId)],
|
|
98
|
+
typeArguments: [marginPool.type]
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
this.totalSupply = (coinKey) => (tx) => {
|
|
102
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
103
|
+
return tx.moveCall({
|
|
104
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::total_supply`,
|
|
105
|
+
arguments: [tx.object(marginPool.address)],
|
|
106
|
+
typeArguments: [marginPool.type]
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
this.supplyShares = (coinKey) => (tx) => {
|
|
110
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
111
|
+
return tx.moveCall({
|
|
112
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::supply_shares`,
|
|
113
|
+
arguments: [tx.object(marginPool.address)],
|
|
114
|
+
typeArguments: [marginPool.type]
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
this.totalBorrow = (coinKey) => (tx) => {
|
|
118
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
119
|
+
return tx.moveCall({
|
|
120
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::total_borrow`,
|
|
121
|
+
arguments: [tx.object(marginPool.address)],
|
|
122
|
+
typeArguments: [marginPool.type]
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
this.borrowShares = (coinKey) => (tx) => {
|
|
126
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
127
|
+
return tx.moveCall({
|
|
128
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::borrow_shares`,
|
|
129
|
+
arguments: [tx.object(marginPool.address)],
|
|
130
|
+
typeArguments: [marginPool.type]
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
this.lastUpdateTimestamp = (coinKey) => (tx) => {
|
|
134
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
135
|
+
return tx.moveCall({
|
|
136
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::last_update_timestamp`,
|
|
137
|
+
arguments: [tx.object(marginPool.address)],
|
|
138
|
+
typeArguments: [marginPool.type]
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
this.supplyCap = (coinKey) => (tx) => {
|
|
142
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
143
|
+
return tx.moveCall({
|
|
144
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::supply_cap`,
|
|
145
|
+
arguments: [tx.object(marginPool.address)],
|
|
146
|
+
typeArguments: [marginPool.type]
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
this.maxUtilizationRate = (coinKey) => (tx) => {
|
|
150
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
151
|
+
return tx.moveCall({
|
|
152
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::max_utilization_rate`,
|
|
153
|
+
arguments: [tx.object(marginPool.address)],
|
|
154
|
+
typeArguments: [marginPool.type]
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
this.protocolSpread = (coinKey) => (tx) => {
|
|
158
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
159
|
+
return tx.moveCall({
|
|
160
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::protocol_spread`,
|
|
161
|
+
arguments: [tx.object(marginPool.address)],
|
|
162
|
+
typeArguments: [marginPool.type]
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
this.minBorrow = (coinKey) => (tx) => {
|
|
166
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
167
|
+
return tx.moveCall({
|
|
168
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::min_borrow`,
|
|
169
|
+
arguments: [tx.object(marginPool.address)],
|
|
170
|
+
typeArguments: [marginPool.type]
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
this.interestRate = (coinKey) => (tx) => {
|
|
174
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
175
|
+
return tx.moveCall({
|
|
176
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::interest_rate`,
|
|
177
|
+
arguments: [tx.object(marginPool.address)],
|
|
178
|
+
typeArguments: [marginPool.type]
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
this.userSupplyShares = (coinKey, supplierCapId) => (tx) => {
|
|
182
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
183
|
+
return tx.moveCall({
|
|
184
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::user_supply_shares`,
|
|
185
|
+
arguments: [tx.object(marginPool.address), tx.pure.id(supplierCapId)],
|
|
186
|
+
typeArguments: [marginPool.type]
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
this.userSupplyAmount = (coinKey, supplierCapId) => (tx) => {
|
|
190
|
+
const marginPool = this.#config.getMarginPool(coinKey);
|
|
191
|
+
return tx.moveCall({
|
|
192
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::user_supply_amount`,
|
|
193
|
+
arguments: [
|
|
194
|
+
tx.object(marginPool.address),
|
|
195
|
+
tx.pure.id(supplierCapId),
|
|
196
|
+
tx.object.clock()
|
|
197
|
+
],
|
|
198
|
+
typeArguments: [marginPool.type]
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
this.#config = config;
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
//#endregion
|
|
206
|
+
export { MarginPoolContract };
|
|
207
|
+
//# sourceMappingURL=marginPool.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marginPool.mjs","names":["#config"],"sources":["../../src/transactions/marginPool.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport { coinWithBalance } from '@haneullabs/haneul/transactions';\nimport type { Transaction, TransactionObjectArgument } from '@haneullabs/haneul/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { convertQuantity } from '../utils/conversion.js';\n\n/**\n * MarginPoolContract class for managing MarginPool operations.\n */\nexport class MarginPoolContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginPoolContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @description Mint a supplier cap for margin pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintSupplierCap = () => (tx: Transaction) => {\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::mint_supplier_cap`,\n\t\t\targuments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.object.clock()],\n\t\t});\n\t};\n\n\t/**\n\t * @description Supply to a margin pool\n\t * @param {string} coinKey The key to identify the pool\n\t * @param {TransactionObjectArgument} supplierCap The supplier cap object\n\t * @param {number} amountToDeposit The amount to deposit\n\t * @param {string} referralId The ID of the referral\n\t * @returns A function that takes a Transaction object\n\t */\n\tsupplyToMarginPool =\n\t\t(\n\t\t\tcoinKey: string,\n\t\t\tsupplierCap: TransactionObjectArgument,\n\t\t\tamountToDeposit: number,\n\t\t\treferralId?: string,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst depositInput = convertQuantity(amountToDeposit, coin.scalar);\n\t\t\tconst supply = coinWithBalance({\n\t\t\t\ttype: coin.type,\n\t\t\t\tbalance: depositInput,\n\t\t\t});\n\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::supply`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\tsupplierCap,\n\t\t\t\t\tsupply,\n\t\t\t\t\ttx.object.option({\n\t\t\t\t\t\ttype: '0x2::object::ID',\n\t\t\t\t\t\tvalue: referralId ? tx.pure.id(referralId) : null,\n\t\t\t\t\t}),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Withdraw from a margin pool. If amountToWithdraw is not provided, withdraws all.\n\t * @param {string} coinKey The key to identify the pool\n\t * @param {TransactionObjectArgument} supplierCap The supplier cap object\n\t * @param {number} [amountToWithdraw] The amount to withdraw. If omitted, withdraws all.\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawFromMarginPool =\n\t\t(coinKey: string, supplierCap: TransactionObjectArgument, amountToWithdraw?: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst withdrawInput =\n\t\t\t\tamountToWithdraw !== undefined ? convertQuantity(amountToWithdraw, coin.scalar) : null;\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::withdraw`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\tsupplierCap,\n\t\t\t\t\ttx.pure.option('u64', withdrawInput),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Mint a referral for a margin pool\n\t * @param {string} coinKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintSupplyReferral = (coinKey: string) => (tx: Transaction) => {\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::mint_supply_referral`,\n\t\t\targuments: [\n\t\t\t\ttx.object(marginPool.address),\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: [marginPool.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Withdraw referral fees from a margin pool\n\t * @param {string} coinKey The key to identify the pool\n\t * @param {string} referralId The ID of the referral\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawReferralFees = (coinKey: string, referralId: string) => (tx: Transaction) => {\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::withdraw_referral_fees`,\n\t\t\targuments: [\n\t\t\t\ttx.object(marginPool.address),\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(referralId),\n\t\t\t],\n\t\t\ttypeArguments: [marginPool.type],\n\t\t});\n\t};\n\n\t// === Read-only/View Functions ===\n\n\t/**\n\t * @description Get the margin pool ID\n\t * @param {string} coinKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetId = (coinKey: string) => (tx: Transaction) => {\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::id`,\n\t\t\targuments: [tx.object(marginPool.address)],\n\t\t\ttypeArguments: [marginPool.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Check if a deepbook pool is allowed for borrowing\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {string} deepbookPoolId The ID of the deepbook pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tdeepbookPoolAllowed = (coinKey: string, deepbookPoolId: string) => (tx: Transaction) => {\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::deepbook_pool_allowed`,\n\t\t\targuments: [tx.object(marginPool.address), tx.pure.id(deepbookPoolId)],\n\t\t\ttypeArguments: [marginPool.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the total supply amount\n\t * @param {string} coinKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\ttotalSupply = (coinKey: string) => (tx: Transaction) => {\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::total_supply`,\n\t\t\targuments: [tx.object(marginPool.address)],\n\t\t\ttypeArguments: [marginPool.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the total supply shares\n\t * @param {string} coinKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tsupplyShares = (coinKey: string) => (tx: Transaction) => {\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::supply_shares`,\n\t\t\targuments: [tx.object(marginPool.address)],\n\t\t\ttypeArguments: [marginPool.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the total borrow amount\n\t * @param {string} coinKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\ttotalBorrow = (coinKey: string) => (tx: Transaction) => {\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::total_borrow`,\n\t\t\targuments: [tx.object(marginPool.address)],\n\t\t\ttypeArguments: [marginPool.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the total borrow shares\n\t * @param {string} coinKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tborrowShares = (coinKey: string) => (tx: Transaction) => {\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::borrow_shares`,\n\t\t\targuments: [tx.object(marginPool.address)],\n\t\t\ttypeArguments: [marginPool.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the last update timestamp\n\t * @param {string} coinKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tlastUpdateTimestamp = (coinKey: string) => (tx: Transaction) => {\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::last_update_timestamp`,\n\t\t\targuments: [tx.object(marginPool.address)],\n\t\t\ttypeArguments: [marginPool.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the supply cap\n\t * @param {string} coinKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tsupplyCap = (coinKey: string) => (tx: Transaction) => {\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::supply_cap`,\n\t\t\targuments: [tx.object(marginPool.address)],\n\t\t\ttypeArguments: [marginPool.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the max utilization rate\n\t * @param {string} coinKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tmaxUtilizationRate = (coinKey: string) => (tx: Transaction) => {\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::max_utilization_rate`,\n\t\t\targuments: [tx.object(marginPool.address)],\n\t\t\ttypeArguments: [marginPool.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the protocol spread\n\t * @param {string} coinKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tprotocolSpread = (coinKey: string) => (tx: Transaction) => {\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::protocol_spread`,\n\t\t\targuments: [tx.object(marginPool.address)],\n\t\t\ttypeArguments: [marginPool.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the minimum borrow amount\n\t * @param {string} coinKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tminBorrow = (coinKey: string) => (tx: Transaction) => {\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::min_borrow`,\n\t\t\targuments: [tx.object(marginPool.address)],\n\t\t\ttypeArguments: [marginPool.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the current interest rate\n\t * @param {string} coinKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tinterestRate = (coinKey: string) => (tx: Transaction) => {\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::interest_rate`,\n\t\t\targuments: [tx.object(marginPool.address)],\n\t\t\ttypeArguments: [marginPool.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get user supply shares for a supplier cap\n\t * @param {string} coinKey The key to identify the pool\n\t * @param {string} supplierCapId The ID of the supplier cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tuserSupplyShares = (coinKey: string, supplierCapId: string) => (tx: Transaction) => {\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::user_supply_shares`,\n\t\t\targuments: [tx.object(marginPool.address), tx.pure.id(supplierCapId)],\n\t\t\ttypeArguments: [marginPool.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get user supply amount for a supplier cap\n\t * @param {string} coinKey The key to identify the pool\n\t * @param {string} supplierCapId The ID of the supplier cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tuserSupplyAmount = (coinKey: string, supplierCapId: string) => (tx: Transaction) => {\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::user_supply_amount`,\n\t\t\targuments: [tx.object(marginPool.address), tx.pure.id(supplierCapId), tx.object.clock()],\n\t\t\ttypeArguments: [marginPool.type],\n\t\t});\n\t};\n}\n"],"mappings":";;;;;;;AAWA,IAAa,qBAAb,MAAgC;CAC/B;;;;CAKA,YAAY,QAAwB;gCAQX,OAAoB;AAC5C,UAAO,GAAG,SAAS;IAClB,QAAQ,GAAG,MAAKA,OAAQ,kB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AQ,GAAG,MAAKA,OAAQ,kBAAkB;IAC1C,WAAW;KAAC,GAAG,OAAO,WAAW,QAAQ;KAAE,GAAG,KAAK,GAAG,cAAc;KAAE,GAAG,OAAO,OAAO;KAAC;IACxF,eAAe,CAAC,WAAW,KAAK;IAChC,CAAC;;AA9TF,QAAKA,SAAU"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { DeepBookConfig } from "../utils/config.mjs";
|
|
2
|
+
import * as _haneullabs_haneul_transactions115 from "@haneullabs/haneul/transactions";
|
|
3
|
+
import { Transaction } from "@haneullabs/haneul/transactions";
|
|
4
|
+
|
|
5
|
+
//#region src/transactions/marginRegistry.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* MarginRegistryContract class for managing MarginRegistry read-only operations.
|
|
8
|
+
*/
|
|
9
|
+
declare class MarginRegistryContract {
|
|
10
|
+
#private;
|
|
11
|
+
/**
|
|
12
|
+
* @param {DeepBookConfig} config Configuration for MarginRegistryContract
|
|
13
|
+
*/
|
|
14
|
+
constructor(config: DeepBookConfig);
|
|
15
|
+
/**
|
|
16
|
+
* @description Check if a deepbook pool is enabled for margin trading
|
|
17
|
+
* @param {string} poolKey The key to identify the pool
|
|
18
|
+
* @returns A function that takes a Transaction object
|
|
19
|
+
*/
|
|
20
|
+
poolEnabled: (poolKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions115.TransactionResult;
|
|
21
|
+
/**
|
|
22
|
+
* @description Get the margin pool ID for a given asset
|
|
23
|
+
* @param {string} coinKey The key to identify the coin
|
|
24
|
+
* @returns A function that takes a Transaction object
|
|
25
|
+
*/
|
|
26
|
+
getMarginPoolId: (coinKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions115.TransactionResult;
|
|
27
|
+
/**
|
|
28
|
+
* @description Get the margin pool IDs (base and quote) for a deepbook pool
|
|
29
|
+
* @param {string} poolKey The key to identify the pool
|
|
30
|
+
* @returns A function that takes a Transaction object
|
|
31
|
+
*/
|
|
32
|
+
getDeepbookPoolMarginPoolIds: (poolKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions115.TransactionResult;
|
|
33
|
+
/**
|
|
34
|
+
* @description Get the margin manager IDs for a given owner
|
|
35
|
+
* @param {string} owner The owner address
|
|
36
|
+
* @returns A function that takes a Transaction object
|
|
37
|
+
*/
|
|
38
|
+
getMarginManagerIds: (owner: string) => (tx: Transaction) => _haneullabs_haneul_transactions115.TransactionResult;
|
|
39
|
+
/**
|
|
40
|
+
* @description Get the base margin pool ID for a deepbook pool
|
|
41
|
+
* @param {string} poolKey The key to identify the pool
|
|
42
|
+
* @returns A function that takes a Transaction object
|
|
43
|
+
*/
|
|
44
|
+
baseMarginPoolId: (poolKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions115.TransactionResult;
|
|
45
|
+
/**
|
|
46
|
+
* @description Get the quote margin pool ID for a deepbook pool
|
|
47
|
+
* @param {string} poolKey The key to identify the pool
|
|
48
|
+
* @returns A function that takes a Transaction object
|
|
49
|
+
*/
|
|
50
|
+
quoteMarginPoolId: (poolKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions115.TransactionResult;
|
|
51
|
+
/**
|
|
52
|
+
* @description Get the minimum withdraw risk ratio for a deepbook pool
|
|
53
|
+
* @param {string} poolKey The key to identify the pool
|
|
54
|
+
* @returns A function that takes a Transaction object
|
|
55
|
+
*/
|
|
56
|
+
minWithdrawRiskRatio: (poolKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions115.TransactionResult;
|
|
57
|
+
/**
|
|
58
|
+
* @description Get the minimum borrow risk ratio for a deepbook pool
|
|
59
|
+
* @param {string} poolKey The key to identify the pool
|
|
60
|
+
* @returns A function that takes a Transaction object
|
|
61
|
+
*/
|
|
62
|
+
minBorrowRiskRatio: (poolKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions115.TransactionResult;
|
|
63
|
+
/**
|
|
64
|
+
* @description Get the liquidation risk ratio for a deepbook pool
|
|
65
|
+
* @param {string} poolKey The key to identify the pool
|
|
66
|
+
* @returns A function that takes a Transaction object
|
|
67
|
+
*/
|
|
68
|
+
liquidationRiskRatio: (poolKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions115.TransactionResult;
|
|
69
|
+
/**
|
|
70
|
+
* @description Get the target liquidation risk ratio for a deepbook pool
|
|
71
|
+
* @param {string} poolKey The key to identify the pool
|
|
72
|
+
* @returns A function that takes a Transaction object
|
|
73
|
+
*/
|
|
74
|
+
targetLiquidationRiskRatio: (poolKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions115.TransactionResult;
|
|
75
|
+
/**
|
|
76
|
+
* @description Get the user liquidation reward for a deepbook pool
|
|
77
|
+
* @param {string} poolKey The key to identify the pool
|
|
78
|
+
* @returns A function that takes a Transaction object
|
|
79
|
+
*/
|
|
80
|
+
userLiquidationReward: (poolKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions115.TransactionResult;
|
|
81
|
+
/**
|
|
82
|
+
* @description Get the pool liquidation reward for a deepbook pool
|
|
83
|
+
* @param {string} poolKey The key to identify the pool
|
|
84
|
+
* @returns A function that takes a Transaction object
|
|
85
|
+
*/
|
|
86
|
+
poolLiquidationReward: (poolKey: string) => (tx: Transaction) => _haneullabs_haneul_transactions115.TransactionResult;
|
|
87
|
+
/**
|
|
88
|
+
* @description Get all allowed maintainer cap IDs
|
|
89
|
+
* @returns A function that takes a Transaction object
|
|
90
|
+
*/
|
|
91
|
+
allowedMaintainers: () => (tx: Transaction) => _haneullabs_haneul_transactions115.TransactionResult;
|
|
92
|
+
/**
|
|
93
|
+
* @description Get all allowed pause cap IDs
|
|
94
|
+
* @returns A function that takes a Transaction object
|
|
95
|
+
*/
|
|
96
|
+
allowedPauseCaps: () => (tx: Transaction) => _haneullabs_haneul_transactions115.TransactionResult;
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { MarginRegistryContract };
|
|
100
|
+
//# sourceMappingURL=marginRegistry.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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D;;;;EAuDA,kBAAA,SAA4B,EAAA,EAAI,WAAA,KAAW,kCAAA,CAAA,iBAAA;EAzC3C;;;;EAqDA,gBAAA,SAA0B,EAAA,EAAI,WAAA,KAAW,kCAAA,CAAA,iBAAA;AAAA"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
//#region src/transactions/marginRegistry.ts
|
|
2
|
+
/**
|
|
3
|
+
* MarginRegistryContract class for managing MarginRegistry read-only operations.
|
|
4
|
+
*/
|
|
5
|
+
var MarginRegistryContract = class {
|
|
6
|
+
#config;
|
|
7
|
+
/**
|
|
8
|
+
* @param {DeepBookConfig} config Configuration for MarginRegistryContract
|
|
9
|
+
*/
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.poolEnabled = (poolKey) => (tx) => {
|
|
12
|
+
const pool = this.#config.getPool(poolKey);
|
|
13
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
14
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
15
|
+
return tx.moveCall({
|
|
16
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::pool_enabled`,
|
|
17
|
+
arguments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.object(pool.address)],
|
|
18
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
this.getMarginPoolId = (coinKey) => (tx) => {
|
|
22
|
+
const coin = this.#config.getCoin(coinKey);
|
|
23
|
+
return tx.moveCall({
|
|
24
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::get_margin_pool_id`,
|
|
25
|
+
arguments: [tx.object(this.#config.MARGIN_REGISTRY_ID)],
|
|
26
|
+
typeArguments: [coin.type]
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
this.getDeepbookPoolMarginPoolIds = (poolKey) => (tx) => {
|
|
30
|
+
const pool = this.#config.getPool(poolKey);
|
|
31
|
+
return tx.moveCall({
|
|
32
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::get_deepbook_pool_margin_pool_ids`,
|
|
33
|
+
arguments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],
|
|
34
|
+
typeArguments: []
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
this.getMarginManagerIds = (owner) => (tx) => {
|
|
38
|
+
return tx.moveCall({
|
|
39
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::get_margin_manager_ids`,
|
|
40
|
+
arguments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.address(owner)],
|
|
41
|
+
typeArguments: []
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
this.baseMarginPoolId = (poolKey) => (tx) => {
|
|
45
|
+
const pool = this.#config.getPool(poolKey);
|
|
46
|
+
return tx.moveCall({
|
|
47
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::base_margin_pool_id`,
|
|
48
|
+
arguments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],
|
|
49
|
+
typeArguments: []
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
this.quoteMarginPoolId = (poolKey) => (tx) => {
|
|
53
|
+
const pool = this.#config.getPool(poolKey);
|
|
54
|
+
return tx.moveCall({
|
|
55
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::quote_margin_pool_id`,
|
|
56
|
+
arguments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],
|
|
57
|
+
typeArguments: []
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
this.minWithdrawRiskRatio = (poolKey) => (tx) => {
|
|
61
|
+
const pool = this.#config.getPool(poolKey);
|
|
62
|
+
return tx.moveCall({
|
|
63
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::min_withdraw_risk_ratio`,
|
|
64
|
+
arguments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],
|
|
65
|
+
typeArguments: []
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
this.minBorrowRiskRatio = (poolKey) => (tx) => {
|
|
69
|
+
const pool = this.#config.getPool(poolKey);
|
|
70
|
+
return tx.moveCall({
|
|
71
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::min_borrow_risk_ratio`,
|
|
72
|
+
arguments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],
|
|
73
|
+
typeArguments: []
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
this.liquidationRiskRatio = (poolKey) => (tx) => {
|
|
77
|
+
const pool = this.#config.getPool(poolKey);
|
|
78
|
+
return tx.moveCall({
|
|
79
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::liquidation_risk_ratio`,
|
|
80
|
+
arguments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],
|
|
81
|
+
typeArguments: []
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
this.targetLiquidationRiskRatio = (poolKey) => (tx) => {
|
|
85
|
+
const pool = this.#config.getPool(poolKey);
|
|
86
|
+
return tx.moveCall({
|
|
87
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::target_liquidation_risk_ratio`,
|
|
88
|
+
arguments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],
|
|
89
|
+
typeArguments: []
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
this.userLiquidationReward = (poolKey) => (tx) => {
|
|
93
|
+
const pool = this.#config.getPool(poolKey);
|
|
94
|
+
return tx.moveCall({
|
|
95
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::user_liquidation_reward`,
|
|
96
|
+
arguments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],
|
|
97
|
+
typeArguments: []
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
this.poolLiquidationReward = (poolKey) => (tx) => {
|
|
101
|
+
const pool = this.#config.getPool(poolKey);
|
|
102
|
+
return tx.moveCall({
|
|
103
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::pool_liquidation_reward`,
|
|
104
|
+
arguments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],
|
|
105
|
+
typeArguments: []
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
this.allowedMaintainers = () => (tx) => {
|
|
109
|
+
return tx.moveCall({
|
|
110
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::allowed_maintainers`,
|
|
111
|
+
arguments: [tx.object(this.#config.MARGIN_REGISTRY_ID)],
|
|
112
|
+
typeArguments: []
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
this.allowedPauseCaps = () => (tx) => {
|
|
116
|
+
return tx.moveCall({
|
|
117
|
+
target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::allowed_pause_caps`,
|
|
118
|
+
arguments: [tx.object(this.#config.MARGIN_REGISTRY_ID)],
|
|
119
|
+
typeArguments: []
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
this.#config = config;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
//#endregion
|
|
127
|
+
export { MarginRegistryContract };
|
|
128
|
+
//# sourceMappingURL=marginRegistry.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marginRegistry.mjs","names":["#config"],"sources":["../../src/transactions/marginRegistry.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport type { Transaction } from '@haneullabs/haneul/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\n\n/**\n * MarginRegistryContract class for managing MarginRegistry read-only operations.\n */\nexport class MarginRegistryContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginRegistryContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @description Check if a deepbook pool is enabled for margin trading\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tpoolEnabled = (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\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::pool_enabled`,\n\t\t\targuments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.object(pool.address)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the margin pool ID for a given asset\n\t * @param {string} coinKey The key to identify the coin\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetMarginPoolId = (coinKey: string) => (tx: Transaction) => {\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::get_margin_pool_id`,\n\t\t\targuments: [tx.object(this.#config.MARGIN_REGISTRY_ID)],\n\t\t\ttypeArguments: [coin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the margin pool IDs (base and quote) for a deepbook pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetDeepbookPoolMarginPoolIds = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::get_deepbook_pool_margin_pool_ids`,\n\t\t\targuments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],\n\t\t\ttypeArguments: [],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the margin manager IDs for a given owner\n\t * @param {string} owner The owner address\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetMarginManagerIds = (owner: string) => (tx: Transaction) => {\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::get_margin_manager_ids`,\n\t\t\targuments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.address(owner)],\n\t\t\ttypeArguments: [],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the base margin pool ID for a deepbook pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tbaseMarginPoolId = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::base_margin_pool_id`,\n\t\t\targuments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],\n\t\t\ttypeArguments: [],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the quote margin pool ID for a deepbook pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tquoteMarginPoolId = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::quote_margin_pool_id`,\n\t\t\targuments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],\n\t\t\ttypeArguments: [],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the minimum withdraw risk ratio for a deepbook pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tminWithdrawRiskRatio = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::min_withdraw_risk_ratio`,\n\t\t\targuments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],\n\t\t\ttypeArguments: [],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the minimum borrow risk ratio for a deepbook pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tminBorrowRiskRatio = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::min_borrow_risk_ratio`,\n\t\t\targuments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],\n\t\t\ttypeArguments: [],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the liquidation risk ratio for a deepbook pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tliquidationRiskRatio = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::liquidation_risk_ratio`,\n\t\t\targuments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],\n\t\t\ttypeArguments: [],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the target liquidation risk ratio for a deepbook pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\ttargetLiquidationRiskRatio = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::target_liquidation_risk_ratio`,\n\t\t\targuments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],\n\t\t\ttypeArguments: [],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the user liquidation reward for a deepbook pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tuserLiquidationReward = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::user_liquidation_reward`,\n\t\t\targuments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],\n\t\t\ttypeArguments: [],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the pool liquidation reward for a deepbook pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tpoolLiquidationReward = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::pool_liquidation_reward`,\n\t\t\targuments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.pure.id(pool.address)],\n\t\t\ttypeArguments: [],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get all allowed maintainer cap IDs\n\t * @returns A function that takes a Transaction object\n\t */\n\tallowedMaintainers = () => (tx: Transaction) => {\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::allowed_maintainers`,\n\t\t\targuments: [tx.object(this.#config.MARGIN_REGISTRY_ID)],\n\t\t\ttypeArguments: [],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get all allowed pause cap IDs\n\t * @returns A function that takes a Transaction object\n\t */\n\tallowedPauseCaps = () => (tx: Transaction) => {\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::allowed_pause_caps`,\n\t\t\targuments: [tx.object(this.#config.MARGIN_REGISTRY_ID)],\n\t\t\ttypeArguments: [],\n\t\t});\n\t};\n}\n"],"mappings":";;;;AASA,IAAa,yBAAb,MAAoC;CACnC;;;;CAKA,YAAY,QAAwB;sB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