@haneullabs/deepbook-v3 0.1.0
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 +984 -0
- package/README.md +1 -0
- package/dist/cjs/client.d.ts +861 -0
- package/dist/cjs/client.js +1982 -0
- package/dist/cjs/client.js.map +7 -0
- package/dist/cjs/contracts/deepbook/account.d.ts +105 -0
- package/dist/cjs/contracts/deepbook/account.js +163 -0
- package/dist/cjs/contracts/deepbook/account.js.map +7 -0
- package/dist/cjs/contracts/deepbook/balance_manager.d.ts +268 -0
- package/dist/cjs/contracts/deepbook/balance_manager.js +361 -0
- package/dist/cjs/contracts/deepbook/balance_manager.js.map +7 -0
- package/dist/cjs/contracts/deepbook/balances.d.ts +10 -0
- package/dist/cjs/contracts/deepbook/balances.js +35 -0
- package/dist/cjs/contracts/deepbook/balances.js.map +7 -0
- package/dist/cjs/contracts/deepbook/big_vector.d.ts +62 -0
- package/dist/cjs/contracts/deepbook/big_vector.js +80 -0
- package/dist/cjs/contracts/deepbook/big_vector.js.map +7 -0
- package/dist/cjs/contracts/deepbook/book.d.ts +34 -0
- package/dist/cjs/contracts/deepbook/book.js +50 -0
- package/dist/cjs/contracts/deepbook/book.js.map +7 -0
- package/dist/cjs/contracts/deepbook/constants.d.ts +176 -0
- package/dist/cjs/contracts/deepbook/constants.js +338 -0
- package/dist/cjs/contracts/deepbook/constants.js.map +7 -0
- package/dist/cjs/contracts/deepbook/deep_price.d.ts +60 -0
- package/dist/cjs/contracts/deepbook/deep_price.js +87 -0
- package/dist/cjs/contracts/deepbook/deep_price.js.map +7 -0
- package/dist/cjs/contracts/deepbook/deps/std/type_name.d.ts +14 -0
- package/dist/cjs/contracts/deepbook/deps/std/type_name.js +42 -0
- package/dist/cjs/contracts/deepbook/deps/std/type_name.js.map +7 -0
- package/dist/cjs/contracts/deepbook/deps/sui/bag.d.ts +33 -0
- package/dist/cjs/contracts/deepbook/deps/sui/bag.js +47 -0
- package/dist/cjs/contracts/deepbook/deps/sui/bag.js.map +7 -0
- package/dist/cjs/contracts/deepbook/deps/sui/balance.d.ts +9 -0
- package/dist/cjs/contracts/deepbook/deps/sui/balance.js +33 -0
- package/dist/cjs/contracts/deepbook/deps/sui/balance.js.map +7 -0
- package/dist/cjs/contracts/deepbook/deps/sui/object.d.ts +5 -0
- package/dist/cjs/contracts/deepbook/deps/sui/object.js +33 -0
- package/dist/cjs/contracts/deepbook/deps/sui/object.js.map +7 -0
- package/dist/cjs/contracts/deepbook/deps/sui/table.d.ts +28 -0
- package/dist/cjs/contracts/deepbook/deps/sui/table.js +47 -0
- package/dist/cjs/contracts/deepbook/deps/sui/table.js.map +7 -0
- package/dist/cjs/contracts/deepbook/deps/sui/vec_map.d.ts +27 -0
- package/dist/cjs/contracts/deepbook/deps/sui/vec_map.js +45 -0
- package/dist/cjs/contracts/deepbook/deps/sui/vec_map.js.map +7 -0
- package/dist/cjs/contracts/deepbook/deps/sui/vec_set.d.ts +15 -0
- package/dist/cjs/contracts/deepbook/deps/sui/vec_set.js +35 -0
- package/dist/cjs/contracts/deepbook/deps/sui/vec_set.js.map +7 -0
- package/dist/cjs/contracts/deepbook/deps/sui/versioned.d.ts +7 -0
- package/dist/cjs/contracts/deepbook/deps/sui/versioned.js +45 -0
- package/dist/cjs/contracts/deepbook/deps/sui/versioned.js.map +7 -0
- package/dist/cjs/contracts/deepbook/ewma.d.ts +17 -0
- package/dist/cjs/contracts/deepbook/ewma.js +39 -0
- package/dist/cjs/contracts/deepbook/ewma.js.map +7 -0
- package/dist/cjs/contracts/deepbook/fill.d.ts +153 -0
- package/dist/cjs/contracts/deepbook/fill.js +251 -0
- package/dist/cjs/contracts/deepbook/fill.js.map +7 -0
- package/dist/cjs/contracts/deepbook/governance.d.ts +63 -0
- package/dist/cjs/contracts/deepbook/governance.js +79 -0
- package/dist/cjs/contracts/deepbook/governance.js.map +7 -0
- package/dist/cjs/contracts/deepbook/history.d.ts +60 -0
- package/dist/cjs/contracts/deepbook/history.js +78 -0
- package/dist/cjs/contracts/deepbook/history.js.map +7 -0
- package/dist/cjs/contracts/deepbook/math.d.ts +94 -0
- package/dist/cjs/contracts/deepbook/math.js +132 -0
- package/dist/cjs/contracts/deepbook/math.js.map +7 -0
- package/dist/cjs/contracts/deepbook/order.d.ts +135 -0
- package/dist/cjs/contracts/deepbook/order.js +218 -0
- package/dist/cjs/contracts/deepbook/order.js.map +7 -0
- package/dist/cjs/contracts/deepbook/order_info.d.ts +296 -0
- package/dist/cjs/contracts/deepbook/order_info.js +386 -0
- package/dist/cjs/contracts/deepbook/order_info.js.map +7 -0
- package/dist/cjs/contracts/deepbook/order_query.d.ts +85 -0
- package/dist/cjs/contracts/deepbook/order_query.js +96 -0
- package/dist/cjs/contracts/deepbook/order_query.js.map +7 -0
- package/dist/cjs/contracts/deepbook/pool.d.ts +1218 -0
- package/dist/cjs/contracts/deepbook/pool.js +1236 -0
- package/dist/cjs/contracts/deepbook/pool.js.map +7 -0
- package/dist/cjs/contracts/deepbook/registry.d.ts +134 -0
- package/dist/cjs/contracts/deepbook/registry.js +182 -0
- package/dist/cjs/contracts/deepbook/registry.js.map +7 -0
- package/dist/cjs/contracts/deepbook/state.d.ts +117 -0
- package/dist/cjs/contracts/deepbook/state.js +104 -0
- package/dist/cjs/contracts/deepbook/state.js.map +7 -0
- package/dist/cjs/contracts/deepbook/trade_params.d.ts +7 -0
- package/dist/cjs/contracts/deepbook/trade_params.js +35 -0
- package/dist/cjs/contracts/deepbook/trade_params.js.map +7 -0
- package/dist/cjs/contracts/deepbook/vault.d.ts +30 -0
- package/dist/cjs/contracts/deepbook/vault.js +65 -0
- package/dist/cjs/contracts/deepbook/vault.js.map +7 -0
- package/dist/cjs/contracts/utils/index.d.ts +25 -0
- package/dist/cjs/contracts/utils/index.js +148 -0
- package/dist/cjs/contracts/utils/index.js.map +7 -0
- package/dist/cjs/index.d.ts +23 -0
- package/dist/cjs/index.js +81 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/package.json +4 -0
- package/dist/cjs/pyth/PriceServiceConnection.d.ts +26 -0
- package/dist/cjs/pyth/PriceServiceConnection.js +68 -0
- package/dist/cjs/pyth/PriceServiceConnection.js.map +7 -0
- package/dist/cjs/pyth/pyth-helpers.d.ts +7 -0
- package/dist/cjs/pyth/pyth-helpers.js +36 -0
- package/dist/cjs/pyth/pyth-helpers.js.map +7 -0
- package/dist/cjs/pyth/pyth.d.ts +65 -0
- package/dist/cjs/pyth/pyth.js +269 -0
- package/dist/cjs/pyth/pyth.js.map +7 -0
- package/dist/cjs/transactions/balanceManager.d.ts +168 -0
- package/dist/cjs/transactions/balanceManager.js +384 -0
- package/dist/cjs/transactions/balanceManager.js.map +7 -0
- package/dist/cjs/transactions/deepbook.d.ts +477 -0
- package/dist/cjs/transactions/deepbook.js +1335 -0
- package/dist/cjs/transactions/deepbook.js.map +7 -0
- package/dist/cjs/transactions/deepbookAdmin.d.ts +105 -0
- package/dist/cjs/transactions/deepbookAdmin.js +334 -0
- package/dist/cjs/transactions/deepbookAdmin.js.map +7 -0
- package/dist/cjs/transactions/flashLoans.d.ts +56 -0
- package/dist/cjs/transactions/flashLoans.js +124 -0
- package/dist/cjs/transactions/flashLoans.js.map +7 -0
- package/dist/cjs/transactions/governance.d.ts +42 -0
- package/dist/cjs/transactions/governance.js +135 -0
- package/dist/cjs/transactions/governance.js.map +7 -0
- package/dist/cjs/transactions/marginAdmin.d.ts +133 -0
- package/dist/cjs/transactions/marginAdmin.js +393 -0
- package/dist/cjs/transactions/marginAdmin.js.map +7 -0
- package/dist/cjs/transactions/marginLiquidations.d.ts +61 -0
- package/dist/cjs/transactions/marginLiquidations.js +173 -0
- package/dist/cjs/transactions/marginLiquidations.js.map +7 -0
- package/dist/cjs/transactions/marginMaintainer.d.ts +80 -0
- package/dist/cjs/transactions/marginMaintainer.js +251 -0
- package/dist/cjs/transactions/marginMaintainer.js.map +7 -0
- package/dist/cjs/transactions/marginManager.d.ts +236 -0
- package/dist/cjs/transactions/marginManager.js +688 -0
- package/dist/cjs/transactions/marginManager.js.map +7 -0
- package/dist/cjs/transactions/marginPool.d.ts +134 -0
- package/dist/cjs/transactions/marginPool.js +330 -0
- package/dist/cjs/transactions/marginPool.js.map +7 -0
- package/dist/cjs/transactions/marginRegistry.d.ts +94 -0
- package/dist/cjs/transactions/marginRegistry.js +221 -0
- package/dist/cjs/transactions/marginRegistry.js.map +7 -0
- package/dist/cjs/transactions/marginTPSL.d.ts +93 -0
- package/dist/cjs/transactions/marginTPSL.js +286 -0
- package/dist/cjs/transactions/marginTPSL.js.map +7 -0
- package/dist/cjs/transactions/poolProxy.d.ts +104 -0
- package/dist/cjs/transactions/poolProxy.js +435 -0
- package/dist/cjs/transactions/poolProxy.js.map +7 -0
- package/dist/cjs/types/bcs.d.ts +5 -0
- package/dist/cjs/types/bcs.js +33 -0
- package/dist/cjs/types/bcs.js.map +7 -0
- package/dist/cjs/types/index.d.ts +218 -0
- package/dist/cjs/types/index.js +38 -0
- package/dist/cjs/types/index.js.map +7 -0
- package/dist/cjs/utils/config.d.ts +65 -0
- package/dist/cjs/utils/config.js +144 -0
- package/dist/cjs/utils/config.js.map +7 -0
- package/dist/cjs/utils/constants.d.ts +76 -0
- package/dist/cjs/utils/constants.js +382 -0
- package/dist/cjs/utils/constants.js.map +7 -0
- package/dist/cjs/utils/errors.d.ts +42 -0
- package/dist/cjs/utils/errors.js +70 -0
- package/dist/cjs/utils/errors.js.map +7 -0
- package/dist/cjs/utils/validation.d.ts +50 -0
- package/dist/cjs/utils/validation.js +67 -0
- package/dist/cjs/utils/validation.js.map +7 -0
- package/dist/esm/client.d.ts +861 -0
- package/dist/esm/client.js +1967 -0
- package/dist/esm/client.js.map +7 -0
- package/dist/esm/contracts/deepbook/account.d.ts +105 -0
- package/dist/esm/contracts/deepbook/account.js +133 -0
- package/dist/esm/contracts/deepbook/account.js.map +7 -0
- package/dist/esm/contracts/deepbook/balance_manager.d.ts +268 -0
- package/dist/esm/contracts/deepbook/balance_manager.js +331 -0
- package/dist/esm/contracts/deepbook/balance_manager.js.map +7 -0
- package/dist/esm/contracts/deepbook/balances.d.ts +10 -0
- package/dist/esm/contracts/deepbook/balances.js +15 -0
- package/dist/esm/contracts/deepbook/balances.js.map +7 -0
- package/dist/esm/contracts/deepbook/big_vector.d.ts +62 -0
- package/dist/esm/contracts/deepbook/big_vector.js +50 -0
- package/dist/esm/contracts/deepbook/big_vector.js.map +7 -0
- package/dist/esm/contracts/deepbook/book.d.ts +34 -0
- package/dist/esm/contracts/deepbook/book.js +20 -0
- package/dist/esm/contracts/deepbook/book.js.map +7 -0
- package/dist/esm/contracts/deepbook/constants.d.ts +176 -0
- package/dist/esm/contracts/deepbook/constants.js +318 -0
- package/dist/esm/contracts/deepbook/constants.js.map +7 -0
- package/dist/esm/contracts/deepbook/deep_price.d.ts +60 -0
- package/dist/esm/contracts/deepbook/deep_price.js +67 -0
- package/dist/esm/contracts/deepbook/deep_price.js.map +7 -0
- package/dist/esm/contracts/deepbook/deps/std/type_name.d.ts +14 -0
- package/dist/esm/contracts/deepbook/deps/std/type_name.js +22 -0
- package/dist/esm/contracts/deepbook/deps/std/type_name.js.map +7 -0
- package/dist/esm/contracts/deepbook/deps/sui/bag.d.ts +33 -0
- package/dist/esm/contracts/deepbook/deps/sui/bag.js +17 -0
- package/dist/esm/contracts/deepbook/deps/sui/bag.js.map +7 -0
- package/dist/esm/contracts/deepbook/deps/sui/balance.d.ts +9 -0
- package/dist/esm/contracts/deepbook/deps/sui/balance.js +13 -0
- package/dist/esm/contracts/deepbook/deps/sui/balance.js.map +7 -0
- package/dist/esm/contracts/deepbook/deps/sui/object.d.ts +5 -0
- package/dist/esm/contracts/deepbook/deps/sui/object.js +13 -0
- package/dist/esm/contracts/deepbook/deps/sui/object.js.map +7 -0
- package/dist/esm/contracts/deepbook/deps/sui/table.d.ts +28 -0
- package/dist/esm/contracts/deepbook/deps/sui/table.js +17 -0
- package/dist/esm/contracts/deepbook/deps/sui/table.js.map +7 -0
- package/dist/esm/contracts/deepbook/deps/sui/vec_map.d.ts +27 -0
- package/dist/esm/contracts/deepbook/deps/sui/vec_map.js +25 -0
- package/dist/esm/contracts/deepbook/deps/sui/vec_map.js.map +7 -0
- package/dist/esm/contracts/deepbook/deps/sui/vec_set.d.ts +15 -0
- package/dist/esm/contracts/deepbook/deps/sui/vec_set.js +15 -0
- package/dist/esm/contracts/deepbook/deps/sui/vec_set.js.map +7 -0
- package/dist/esm/contracts/deepbook/deps/sui/versioned.d.ts +7 -0
- package/dist/esm/contracts/deepbook/deps/sui/versioned.js +15 -0
- package/dist/esm/contracts/deepbook/deps/sui/versioned.js.map +7 -0
- package/dist/esm/contracts/deepbook/ewma.d.ts +17 -0
- package/dist/esm/contracts/deepbook/ewma.js +19 -0
- package/dist/esm/contracts/deepbook/ewma.js.map +7 -0
- package/dist/esm/contracts/deepbook/fill.d.ts +153 -0
- package/dist/esm/contracts/deepbook/fill.js +221 -0
- package/dist/esm/contracts/deepbook/fill.js.map +7 -0
- package/dist/esm/contracts/deepbook/governance.d.ts +63 -0
- package/dist/esm/contracts/deepbook/governance.js +49 -0
- package/dist/esm/contracts/deepbook/governance.js.map +7 -0
- package/dist/esm/contracts/deepbook/history.d.ts +60 -0
- package/dist/esm/contracts/deepbook/history.js +48 -0
- package/dist/esm/contracts/deepbook/history.js.map +7 -0
- package/dist/esm/contracts/deepbook/math.d.ts +94 -0
- package/dist/esm/contracts/deepbook/math.js +112 -0
- package/dist/esm/contracts/deepbook/math.js.map +7 -0
- package/dist/esm/contracts/deepbook/order.d.ts +135 -0
- package/dist/esm/contracts/deepbook/order.js +188 -0
- package/dist/esm/contracts/deepbook/order.js.map +7 -0
- package/dist/esm/contracts/deepbook/order_info.d.ts +296 -0
- package/dist/esm/contracts/deepbook/order_info.js +356 -0
- package/dist/esm/contracts/deepbook/order_info.js.map +7 -0
- package/dist/esm/contracts/deepbook/order_query.d.ts +85 -0
- package/dist/esm/contracts/deepbook/order_query.js +66 -0
- package/dist/esm/contracts/deepbook/order_query.js.map +7 -0
- package/dist/esm/contracts/deepbook/pool.d.ts +1218 -0
- package/dist/esm/contracts/deepbook/pool.js +1206 -0
- package/dist/esm/contracts/deepbook/pool.js.map +7 -0
- package/dist/esm/contracts/deepbook/registry.d.ts +134 -0
- package/dist/esm/contracts/deepbook/registry.js +152 -0
- package/dist/esm/contracts/deepbook/registry.js.map +7 -0
- package/dist/esm/contracts/deepbook/state.d.ts +117 -0
- package/dist/esm/contracts/deepbook/state.js +74 -0
- package/dist/esm/contracts/deepbook/state.js.map +7 -0
- package/dist/esm/contracts/deepbook/trade_params.d.ts +7 -0
- package/dist/esm/contracts/deepbook/trade_params.js +15 -0
- package/dist/esm/contracts/deepbook/trade_params.js.map +7 -0
- package/dist/esm/contracts/deepbook/vault.d.ts +30 -0
- package/dist/esm/contracts/deepbook/vault.js +35 -0
- package/dist/esm/contracts/deepbook/vault.js.map +7 -0
- package/dist/esm/contracts/utils/index.d.ts +25 -0
- package/dist/esm/contracts/utils/index.js +128 -0
- package/dist/esm/contracts/utils/index.js.map +7 -0
- package/dist/esm/index.d.ts +23 -0
- package/dist/esm/index.js +81 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/package.json +4 -0
- package/dist/esm/pyth/PriceServiceConnection.d.ts +26 -0
- package/dist/esm/pyth/PriceServiceConnection.js +38 -0
- package/dist/esm/pyth/PriceServiceConnection.js.map +7 -0
- package/dist/esm/pyth/pyth-helpers.d.ts +7 -0
- package/dist/esm/pyth/pyth-helpers.js +16 -0
- package/dist/esm/pyth/pyth-helpers.js.map +7 -0
- package/dist/esm/pyth/pyth.d.ts +65 -0
- package/dist/esm/pyth/pyth.js +249 -0
- package/dist/esm/pyth/pyth.js.map +7 -0
- package/dist/esm/transactions/balanceManager.d.ts +168 -0
- package/dist/esm/transactions/balanceManager.js +364 -0
- package/dist/esm/transactions/balanceManager.js.map +7 -0
- package/dist/esm/transactions/deepbook.d.ts +477 -0
- package/dist/esm/transactions/deepbook.js +1321 -0
- package/dist/esm/transactions/deepbook.js.map +7 -0
- package/dist/esm/transactions/deepbookAdmin.d.ts +105 -0
- package/dist/esm/transactions/deepbookAdmin.js +314 -0
- package/dist/esm/transactions/deepbookAdmin.js.map +7 -0
- package/dist/esm/transactions/flashLoans.d.ts +56 -0
- package/dist/esm/transactions/flashLoans.js +104 -0
- package/dist/esm/transactions/flashLoans.js.map +7 -0
- package/dist/esm/transactions/governance.d.ts +42 -0
- package/dist/esm/transactions/governance.js +115 -0
- package/dist/esm/transactions/governance.js.map +7 -0
- package/dist/esm/transactions/marginAdmin.d.ts +133 -0
- package/dist/esm/transactions/marginAdmin.js +373 -0
- package/dist/esm/transactions/marginAdmin.js.map +7 -0
- package/dist/esm/transactions/marginLiquidations.d.ts +61 -0
- package/dist/esm/transactions/marginLiquidations.js +153 -0
- package/dist/esm/transactions/marginLiquidations.js.map +7 -0
- package/dist/esm/transactions/marginMaintainer.d.ts +80 -0
- package/dist/esm/transactions/marginMaintainer.js +231 -0
- package/dist/esm/transactions/marginMaintainer.js.map +7 -0
- package/dist/esm/transactions/marginManager.d.ts +236 -0
- package/dist/esm/transactions/marginManager.js +668 -0
- package/dist/esm/transactions/marginManager.js.map +7 -0
- package/dist/esm/transactions/marginPool.d.ts +134 -0
- package/dist/esm/transactions/marginPool.js +310 -0
- package/dist/esm/transactions/marginPool.js.map +7 -0
- package/dist/esm/transactions/marginRegistry.d.ts +94 -0
- package/dist/esm/transactions/marginRegistry.js +201 -0
- package/dist/esm/transactions/marginRegistry.js.map +7 -0
- package/dist/esm/transactions/marginTPSL.d.ts +93 -0
- package/dist/esm/transactions/marginTPSL.js +266 -0
- package/dist/esm/transactions/marginTPSL.js.map +7 -0
- package/dist/esm/transactions/poolProxy.d.ts +104 -0
- package/dist/esm/transactions/poolProxy.js +415 -0
- package/dist/esm/transactions/poolProxy.js.map +7 -0
- package/dist/esm/types/bcs.d.ts +5 -0
- package/dist/esm/types/bcs.js +13 -0
- package/dist/esm/types/bcs.js.map +7 -0
- package/dist/esm/types/index.d.ts +218 -0
- package/dist/esm/types/index.js +18 -0
- package/dist/esm/types/index.js.map +7 -0
- package/dist/esm/utils/config.d.ts +65 -0
- package/dist/esm/utils/config.js +135 -0
- package/dist/esm/utils/config.js.map +7 -0
- package/dist/esm/utils/constants.d.ts +76 -0
- package/dist/esm/utils/constants.js +362 -0
- package/dist/esm/utils/constants.js.map +7 -0
- package/dist/esm/utils/errors.d.ts +42 -0
- package/dist/esm/utils/errors.js +50 -0
- package/dist/esm/utils/errors.js.map +7 -0
- package/dist/esm/utils/validation.d.ts +50 -0
- package/dist/esm/utils/validation.js +47 -0
- package/dist/esm/utils/validation.js.map +7 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +63 -0
- package/src/client.ts +2451 -0
- package/src/contracts/deepbook/account.ts +199 -0
- package/src/contracts/deepbook/balance_manager.ts +532 -0
- package/src/contracts/deepbook/balances.ts +19 -0
- package/src/contracts/deepbook/big_vector.ts +74 -0
- package/src/contracts/deepbook/book.ts +24 -0
- package/src/contracts/deepbook/constants.ts +458 -0
- package/src/contracts/deepbook/deep_price.ts +84 -0
- package/src/contracts/deepbook/deps/std/type_name.ts +23 -0
- package/src/contracts/deepbook/deps/sui/bag.ts +41 -0
- package/src/contracts/deepbook/deps/sui/balance.ts +18 -0
- package/src/contracts/deepbook/deps/sui/object.ts +14 -0
- package/src/contracts/deepbook/deps/sui/table.ts +36 -0
- package/src/contracts/deepbook/deps/sui/vec_map.ts +33 -0
- package/src/contracts/deepbook/deps/sui/vec_set.ts +22 -0
- package/src/contracts/deepbook/deps/sui/versioned.ts +13 -0
- package/src/contracts/deepbook/ewma.ts +26 -0
- package/src/contracts/deepbook/fill.ts +336 -0
- package/src/contracts/deepbook/governance.ts +52 -0
- package/src/contracts/deepbook/history.ts +51 -0
- package/src/contracts/deepbook/math.ts +210 -0
- package/src/contracts/deepbook/order.ts +269 -0
- package/src/contracts/deepbook/order_info.ts +513 -0
- package/src/contracts/deepbook/order_query.ts +115 -0
- package/src/contracts/deepbook/pool.ts +2269 -0
- package/src/contracts/deepbook/registry.ts +242 -0
- package/src/contracts/deepbook/state.ts +74 -0
- package/src/contracts/deepbook/trade_params.ts +16 -0
- package/src/contracts/deepbook/vault.ts +37 -0
- package/src/contracts/utils/index.ts +184 -0
- package/src/index.ts +95 -0
- package/src/pyth/PriceServiceConnection.ts +48 -0
- package/src/pyth/pyth-helpers.ts +23 -0
- package/src/pyth/pyth.ts +305 -0
- package/src/transactions/balanceManager.ts +399 -0
- package/src/transactions/deepbook.ts +1519 -0
- package/src/transactions/deepbookAdmin.ts +332 -0
- package/src/transactions/flashLoans.ts +123 -0
- package/src/transactions/governance.ts +123 -0
- package/src/transactions/marginAdmin.ts +396 -0
- package/src/transactions/marginLiquidations.ts +175 -0
- package/src/transactions/marginMaintainer.ts +280 -0
- package/src/transactions/marginManager.ts +708 -0
- package/src/transactions/marginPool.ts +339 -0
- package/src/transactions/marginRegistry.ts +212 -0
- package/src/transactions/marginTPSL.ts +296 -0
- package/src/transactions/poolProxy.ts +438 -0
- package/src/types/bcs.ts +8 -0
- package/src/types/index.ts +255 -0
- package/src/utils/config.ts +177 -0
- package/src/utils/constants.ts +374 -0
- package/src/utils/errors.ts +67 -0
- package/src/utils/validation.ts +91 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/pyth/pyth.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bcs } from '@haneullabs/haneul/bcs';\nimport type { HaneulClient } from '@haneullabs/haneul/client';\nimport type { Transaction } from '@haneullabs/haneul/transactions';\nimport { coinWithBalance } from '@haneullabs/haneul/transactions';\nimport { fromBase64, fromHex, parseStructTag } from '@haneullabs/haneul/utils';\n\nimport type { HexString } from './PriceServiceConnection.js';\nimport { PriceServiceConnection } from './PriceServiceConnection.js';\nimport { extractVaaBytesFromAccumulatorMessage } from './pyth-helpers.js';\n\nconst MAX_ARGUMENT_SIZE = 16 * 1024;\nexport type ObjectId = string;\nexport class HaneulPriceServiceConnection extends PriceServiceConnection {\n\t/**\n\t * Fetch price feed update data.\n\t *\n\t * @param priceIds Array of hex-encoded price IDs.\n\t * @returns Array of buffers containing the price update data.\n\t */\n\tasync getPriceFeedsUpdateData(priceIds: HexString[]): Promise<Uint8Array[]> {\n\t\tconst latestVaas = await this.getLatestVaas(priceIds);\n\t\treturn latestVaas.map((vaa) => fromBase64(vaa));\n\t}\n}\nexport class HaneulPythClient {\n\t#pythPackageId?: Promise<ObjectId>;\n\t#wormholePackageId?: Promise<ObjectId>;\n\t#priceFeedObjectIdCache: Map<HexString, Promise<ObjectId>> = new Map();\n\t#priceTableInfo?: Promise<{ id: ObjectId; fieldType: ObjectId }>;\n\t#baseUpdateFee?: Promise<number>;\n\tprovider: HaneulClient;\n\tpythStateId: ObjectId;\n\twormholeStateId: ObjectId;\n\n\tconstructor(provider: HaneulClient, pythStateId: ObjectId, wormholeStateId: ObjectId) {\n\t\tthis.provider = provider;\n\t\tthis.pythStateId = pythStateId;\n\t\tthis.wormholeStateId = wormholeStateId;\n\t}\n\t/**\n\t * Verifies the VAAs using the Wormhole contract.\n\t *\n\t * @param vaas Array of VAA buffers to verify.\n\t * @param tx Transaction block to add commands to.\n\t * @returns Array of verified VAAs.\n\t */\n\tasync verifyVaas(vaas: Uint8Array[], tx: Transaction) {\n\t\tconst wormholePackageId = await this.getWormholePackageId();\n\t\tconst verifiedVaas = [];\n\t\tfor (const vaa of vaas) {\n\t\t\tconst [verifiedVaa] = tx.moveCall({\n\t\t\t\ttarget: `${wormholePackageId}::vaa::parse_and_verify`,\n\t\t\t\targuments: [tx.object(this.wormholeStateId), tx.pure.vector('u8', vaa), tx.object.clock()],\n\t\t\t});\n\t\t\tverifiedVaas.push(verifiedVaa);\n\t\t}\n\t\treturn verifiedVaas;\n\t}\n\t/**\n\t * Adds the necessary commands for updating the Pyth price feeds to the transaction block.\n\t *\n\t * @param tx Transaction block to add commands to.\n\t * @param updates Array of price feed updates received from the price service.\n\t * @param feedIds Array of feed IDs to update (in hex format).\n\t */\n\tasync updatePriceFeeds(\n\t\ttx: Transaction,\n\t\tupdates: Uint8Array[],\n\t\tfeedIds: HexString[],\n\t): Promise<ObjectId[]> {\n\t\tconst packageId = await this.getPythPackageId();\n\t\tlet priceUpdatesHotPotato;\n\t\tif (updates.length > 1) {\n\t\t\tthrow new Error(\n\t\t\t\t'SDK does not support sending multiple accumulator messages in a single transaction',\n\t\t\t);\n\t\t}\n\t\tconst vaa = extractVaaBytesFromAccumulatorMessage(updates[0]);\n\t\tconst verifiedVaas = await this.verifyVaas([vaa], tx);\n\t\t[priceUpdatesHotPotato] = tx.moveCall({\n\t\t\ttarget: `${packageId}::pyth::create_authenticated_price_infos_using_accumulator`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.pythStateId),\n\t\t\t\ttx.pure(\n\t\t\t\t\tbcs\n\t\t\t\t\t\t.vector(bcs.U8)\n\t\t\t\t\t\t.serialize(Array.from(updates[0]), {\n\t\t\t\t\t\t\tmaxSize: MAX_ARGUMENT_SIZE,\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.toBytes(),\n\t\t\t\t),\n\t\t\t\tverifiedVaas[0],\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t});\n\t\tconst priceInfoObjects: ObjectId[] = [];\n\t\tconst baseUpdateFee = await this.getBaseUpdateFee();\n\t\tfor (const feedId of feedIds) {\n\t\t\tconst priceInfoObjectId = await this.getPriceFeedObjectId(feedId);\n\t\t\tif (!priceInfoObjectId) {\n\t\t\t\tthrow new Error(`Price feed ${feedId} not found, please create it first`);\n\t\t\t}\n\t\t\tpriceInfoObjects.push(priceInfoObjectId);\n\t\t\t[priceUpdatesHotPotato] = tx.moveCall({\n\t\t\t\ttarget: `${packageId}::pyth::update_single_price_feed`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(this.pythStateId),\n\t\t\t\t\tpriceUpdatesHotPotato,\n\t\t\t\t\ttx.object(priceInfoObjectId),\n\t\t\t\t\tcoinWithBalance({ balance: baseUpdateFee }),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t});\n\t\t}\n\t\ttx.moveCall({\n\t\t\ttarget: `${packageId}::hot_potato_vector::destroy`,\n\t\t\targuments: [priceUpdatesHotPotato],\n\t\t\ttypeArguments: [`${packageId}::price_info::PriceInfo`],\n\t\t});\n\t\treturn priceInfoObjects;\n\t}\n\t/**\n\t * Get the price feed object ID for a given feed ID, caching the promise.\n\t * @param feedId\n\t */\n\tgetPriceFeedObjectId(feedId: HexString): Promise<ObjectId | undefined> {\n\t\tif (!this.#priceFeedObjectIdCache.has(feedId)) {\n\t\t\tthis.#priceFeedObjectIdCache.set(\n\t\t\t\tfeedId,\n\t\t\t\tthis.#fetchPriceFeedObjectId(feedId).catch((err) => {\n\t\t\t\t\t// Remove failed promises from the cache to allow retries\n\t\t\t\t\tthis.#priceFeedObjectIdCache.delete(feedId);\n\t\t\t\t\tthrow err;\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\treturn this.#priceFeedObjectIdCache.get(feedId)!;\n\t}\n\n\t/**\n\t * Fetches the price feed object ID for a given feed ID (no caching).\n\t * Throws an error if the object is not found.\n\t */\n\tasync #fetchPriceFeedObjectId(feedId: HexString): Promise<ObjectId> {\n\t\tconst { id: tableId, fieldType } = await this.getPriceTableInfo();\n\t\tconst result = await this.provider.getDynamicFieldObject({\n\t\t\tparentId: tableId,\n\t\t\tname: {\n\t\t\t\ttype: `${fieldType}::price_identifier::PriceIdentifier`,\n\t\t\t\tvalue: {\n\t\t\t\t\tbytes: Array.from(fromHex(feedId)),\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\t\tif (!result.data || !result.data.content) {\n\t\t\tthrow new Error(`Price feed object ID for feed ID ${feedId} not found.`);\n\t\t}\n\t\tif (result.data.content.dataType !== 'moveObject') {\n\t\t\tthrow new Error('Price feed type mismatch');\n\t\t}\n\n\t\tconst fields = result.data.content.fields as { value: string };\n\t\treturn fields.value;\n\t}\n\n\t/**\n\t * Fetches the price table object ID for the current state ID, caching the promise.\n\t * @returns Price table object ID and field type\n\t */\n\tgetPriceTableInfo(): Promise<{ id: ObjectId; fieldType: ObjectId }> {\n\t\tif (!this.#priceTableInfo) {\n\t\t\tconst promise = this.#fetchPriceTableInfo().catch((err) => {\n\t\t\t\t// Clear the cached promise on error\n\t\t\t\tthis.#priceTableInfo = undefined;\n\t\t\t\tthrow err;\n\t\t\t});\n\n\t\t\tthis.#priceTableInfo = promise;\n\t\t}\n\n\t\treturn this.#priceTableInfo;\n\t}\n\n\t/**\n\t * Fetches the price table object ID and field type (no caching).\n\t * @returns Price table object ID and field type\n\t */\n\tasync #fetchPriceTableInfo(): Promise<{ id: ObjectId; fieldType: ObjectId }> {\n\t\tconst result = await this.provider.getDynamicFieldObject({\n\t\t\tparentId: this.pythStateId,\n\t\t\tname: {\n\t\t\t\ttype: 'vector<u8>',\n\t\t\t\tvalue: 'price_info',\n\t\t\t},\n\t\t});\n\n\t\tif (!result.data || !result.data.type) {\n\t\t\tthrow new Error('Price Table not found, contract may not be initialized');\n\t\t}\n\n\t\tconst priceIdentifier = parseStructTag(result.data.type).typeParams[0];\n\t\tif (\n\t\t\ttypeof priceIdentifier === 'object' &&\n\t\t\tpriceIdentifier !== null &&\n\t\t\tpriceIdentifier.name === 'PriceIdentifier' &&\n\t\t\t'address' in priceIdentifier\n\t\t) {\n\t\t\treturn { id: result.data.objectId, fieldType: priceIdentifier.address };\n\t\t} else {\n\t\t\tthrow new Error('fieldType not found');\n\t\t}\n\t}\n\t/**\n\t * Fetches the package ID for the Wormhole contract, with caching.\n\t */\n\tgetWormholePackageId(): Promise<ObjectId> {\n\t\tif (!this.#wormholePackageId) {\n\t\t\tthis.#wormholePackageId = this.#fetchWormholePackageId();\n\t\t}\n\t\treturn this.#wormholePackageId;\n\t}\n\n\t/**\n\t * Fetches the package ID for the Wormhole contract (no caching).\n\t */\n\tasync #fetchWormholePackageId(): Promise<ObjectId> {\n\t\treturn await this.#getPackageId(this.wormholeStateId);\n\t}\n\n\t/**\n\t * Fetches the package ID for the Pyth contract, with caching.\n\t */\n\tgetPythPackageId(): Promise<ObjectId> {\n\t\tif (!this.#pythPackageId) {\n\t\t\tthis.#pythPackageId = this.#fetchPythPackageId();\n\t\t}\n\t\treturn this.#pythPackageId;\n\t}\n\n\t/**\n\t * Fetches the package ID for the Pyth contract (no caching).\n\t */\n\tasync #fetchPythPackageId(): Promise<ObjectId> {\n\t\treturn await this.#getPackageId(this.pythStateId);\n\t}\n\n\t/**\n\t * Fetches the package ID for a given object.\n\t *\n\t * @param objectId Object ID to fetch the package ID for.\n\t */\n\tasync #getPackageId(objectId: ObjectId): Promise<ObjectId> {\n\t\tconst result = await this.provider.getObject({\n\t\t\tid: objectId,\n\t\t\toptions: { showContent: true },\n\t\t});\n\n\t\tif (\n\t\t\tresult.data?.content?.dataType === 'moveObject' &&\n\t\t\t'upgrade_cap' in result.data.content.fields\n\t\t) {\n\t\t\tconst fields = result.data.content.fields as {\n\t\t\t\tupgrade_cap: {\n\t\t\t\t\tfields: {\n\t\t\t\t\t\tpackage: ObjectId;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\treturn fields.upgrade_cap.fields.package;\n\t\t}\n\n\t\tthrow new Error(`Cannot fetch package ID for object ${objectId}`);\n\t}\n\t/**\n\t * Gets the base update fee from the Pyth state object.\n\t */\n\tasync #fetchBaseUpdateFee(): Promise<number> {\n\t\tconst result = await this.provider.getObject({\n\t\t\tid: this.pythStateId,\n\t\t\toptions: { showContent: true },\n\t\t});\n\n\t\tif (!result.data || result.data.content?.dataType !== 'moveObject') {\n\t\t\tthrow new Error('Unable to fetch Pyth state object');\n\t\t}\n\n\t\tconst fields = result.data.content.fields as { base_update_fee: number };\n\t\treturn fields.base_update_fee;\n\t}\n\n\t/**\n\t * Returns the cached base update fee, fetching it if necessary.\n\t */\n\tgetBaseUpdateFee(): Promise<number> {\n\t\tif (!this.#baseUpdateFee) {\n\t\t\tthis.#baseUpdateFee = this.#fetchBaseUpdateFee();\n\t\t}\n\t\treturn this.#baseUpdateFee;\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iBAAoB;AAGpB,0BAAgC;AAChC,mBAAoD;AAGpD,oCAAuC;AACvC,0BAAsD;AAXtD;AAaA,MAAM,oBAAoB,KAAK;AAExB,MAAM,qCAAqC,qDAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOxE,MAAM,wBAAwB,UAA8C;AAC3E,UAAM,aAAa,MAAM,KAAK,cAAc,QAAQ;AACpD,WAAO,WAAW,IAAI,CAAC,YAAQ,yBAAW,GAAG,CAAC;AAAA,EAC/C;AACD;AACO,MAAM,iBAAiB;AAAA,EAU7B,YAAY,UAAwB,aAAuB,iBAA2B;AAVhF;AACN;AACA;AACA,gDAA6D,oBAAI,IAAI;AACrE;AACA;AAMC,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,kBAAkB;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,WAAW,MAAoB,IAAiB;AACrD,UAAM,oBAAoB,MAAM,KAAK,qBAAqB;AAC1D,UAAM,eAAe,CAAC;AACtB,eAAW,OAAO,MAAM;AACvB,YAAM,CAAC,WAAW,IAAI,GAAG,SAAS;AAAA,QACjC,QAAQ,GAAG,iBAAiB;AAAA,QAC5B,WAAW,CAAC,GAAG,OAAO,KAAK,eAAe,GAAG,GAAG,KAAK,OAAO,MAAM,GAAG,GAAG,GAAG,OAAO,MAAM,CAAC;AAAA,MAC1F,CAAC;AACD,mBAAa,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M,wBAAmB,iBAAsB;AAC9C,SAAO,MAAM,sBAAK,8CAAL,WAAmB,KAAK;AACtC;AAOM,kBAAa,eAAC,UAAuC;AAC1D,QAAM,SAAS,MAAM,KAAK,SAAS,UAAU;AAAA,IAC5C,IAAI;AAAA,IACJ,SAAS,EAAE,aAAa,KAAK;AAAA,EAC9B,CAAC;AAED,MACC,OAAO,MAAM,SAAS,aAAa,gBACnC,iBAAiB,OAAO,KAAK,QAAQ,QACpC;AACD,UAAM,SAAS,OAAO,KAAK,QAAQ;AAOnC,WAAO,OAAO,YAAY,OAAO;AAAA,EAClC;AAEA,QAAM,IAAI,MAAM,sCAAsC,QAAQ,EAAE;AACjE;AAIM,wBAAmB,iBAAoB;AAC5C,QAAM,SAAS,MAAM,KAAK,SAAS,UAAU;AAAA,IAC5C,IAAI,KAAK;AAAA,IACT,SAAS,EAAE,aAAa,KAAK;AAAA,EAC9B,CAAC;AAED,MAAI,CAAC,OAAO,QAAQ,OAAO,KAAK,SAAS,aAAa,cAAc;AACnE,UAAM,IAAI,MAAM,mCAAmC;AAAA,EACpD;AAEA,QAAM,SAAS,OAAO,KAAK,QAAQ;AACnC,SAAO,OAAO;AACf;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import type { Transaction, TransactionArgument } from '@haneullabs/haneul/transactions';
|
|
2
|
+
import type { DeepBookConfig } from '../utils/config.js';
|
|
3
|
+
/**
|
|
4
|
+
* BalanceManagerContract class for managing BalanceManager operations.
|
|
5
|
+
*/
|
|
6
|
+
export declare class BalanceManagerContract {
|
|
7
|
+
#private;
|
|
8
|
+
/**
|
|
9
|
+
* @param {DeepBookConfig} config Configuration for BalanceManagerContract
|
|
10
|
+
*/
|
|
11
|
+
constructor(config: DeepBookConfig);
|
|
12
|
+
/**
|
|
13
|
+
* @description Create and share a new BalanceManager
|
|
14
|
+
* @returns A function that takes a Transaction object
|
|
15
|
+
*/
|
|
16
|
+
createAndShareBalanceManager: () => (tx: Transaction) => void;
|
|
17
|
+
/**
|
|
18
|
+
* @description Create a new BalanceManager, manually set the owner. Returns the manager.
|
|
19
|
+
* @returns A function that takes a Transaction object
|
|
20
|
+
*/
|
|
21
|
+
createBalanceManagerWithOwner: (ownerAddress: string) => (tx: Transaction) => import("@haneullabs/haneul/transactions").TransactionResult;
|
|
22
|
+
/**
|
|
23
|
+
* @description Share the BalanceManager
|
|
24
|
+
* @param {TransactionArgument} manager The BalanceManager to share
|
|
25
|
+
* @returns A function that takes a Transaction object
|
|
26
|
+
*/
|
|
27
|
+
shareBalanceManager: (manager: TransactionArgument) => (tx: Transaction) => void;
|
|
28
|
+
/**
|
|
29
|
+
* @description Deposit funds into the BalanceManager
|
|
30
|
+
* @param {string} managerKey The key of the BalanceManager
|
|
31
|
+
* @param {string} coinKey The key of the coin to deposit
|
|
32
|
+
* @param {number} amountToDeposit The amount to deposit
|
|
33
|
+
* @returns A function that takes a Transaction object
|
|
34
|
+
*/
|
|
35
|
+
depositIntoManager: (managerKey: string, coinKey: string, amountToDeposit: number) => (tx: Transaction) => void;
|
|
36
|
+
/**
|
|
37
|
+
* @description Withdraw funds from the BalanceManager
|
|
38
|
+
* @param {string} managerKey The key of the BalanceManager
|
|
39
|
+
* @param {string} coinKey The key of the coin to withdraw
|
|
40
|
+
* @param {number} amountToWithdraw The amount to withdraw
|
|
41
|
+
* @param {string} recipient The recipient of the withdrawn funds
|
|
42
|
+
* @returns A function that takes a Transaction object
|
|
43
|
+
*/
|
|
44
|
+
withdrawFromManager: (managerKey: string, coinKey: string, amountToWithdraw: number, recipient: string) => (tx: Transaction) => void;
|
|
45
|
+
/**
|
|
46
|
+
* @description Withdraw all funds from the BalanceManager
|
|
47
|
+
* @param {string} managerKey The key of the BalanceManager
|
|
48
|
+
* @param {string} coinKey The key of the coin to withdraw
|
|
49
|
+
* @param {string} recipient The recipient of the withdrawn funds
|
|
50
|
+
* @returns A function that takes a Transaction object
|
|
51
|
+
*/
|
|
52
|
+
withdrawAllFromManager: (managerKey: string, coinKey: string, recipient: string) => (tx: Transaction) => void;
|
|
53
|
+
/**
|
|
54
|
+
* @description Check the balance of the BalanceManager
|
|
55
|
+
* @param {string} managerKey The key of the BalanceManager
|
|
56
|
+
* @param {string} coinKey The key of the coin to check the balance of
|
|
57
|
+
* @returns A function that takes a Transaction object
|
|
58
|
+
*/
|
|
59
|
+
checkManagerBalance: (managerKey: string, coinKey: string) => (tx: Transaction) => void;
|
|
60
|
+
/**
|
|
61
|
+
* @description Generate a trade proof for the BalanceManager. Calls the appropriate function based on whether tradeCap is set.
|
|
62
|
+
* @param {string} managerKey The key of the BalanceManager
|
|
63
|
+
* @returns A function that takes a Transaction object
|
|
64
|
+
*/
|
|
65
|
+
generateProof: (managerKey: string) => (tx: Transaction) => import("@haneullabs/haneul/transactions").TransactionResult;
|
|
66
|
+
/**
|
|
67
|
+
* @description Generate a trade proof as the owner
|
|
68
|
+
* @param {string} managerId The ID of the BalanceManager
|
|
69
|
+
* @returns A function that takes a Transaction object
|
|
70
|
+
*/
|
|
71
|
+
generateProofAsOwner: (managerId: string) => (tx: Transaction) => import("@haneullabs/haneul/transactions").TransactionResult;
|
|
72
|
+
/**
|
|
73
|
+
* @description Generate a trade proof as a trader
|
|
74
|
+
* @param {string} managerId The ID of the BalanceManager
|
|
75
|
+
* @param {string} tradeCapId The ID of the tradeCap
|
|
76
|
+
* @returns A function that takes a Transaction object
|
|
77
|
+
*/
|
|
78
|
+
generateProofAsTrader: (managerId: string, tradeCapId: string) => (tx: Transaction) => import("@haneullabs/haneul/transactions").TransactionResult;
|
|
79
|
+
/**
|
|
80
|
+
* @description Mint a TradeCap
|
|
81
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
82
|
+
* @returns A function that takes a Transaction object
|
|
83
|
+
*/
|
|
84
|
+
mintTradeCap: (managerKey: string) => (tx: Transaction) => import("@haneullabs/haneul/transactions").TransactionResult;
|
|
85
|
+
/**
|
|
86
|
+
* @description Mint a DepositCap
|
|
87
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
88
|
+
* @returns A function that takes a Transaction object
|
|
89
|
+
*/
|
|
90
|
+
mintDepositCap: (managerKey: string) => (tx: Transaction) => import("@haneullabs/haneul/transactions").TransactionResult;
|
|
91
|
+
/**
|
|
92
|
+
* @description Mint a WithdrawalCap
|
|
93
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
94
|
+
* @returns A function that takes a Transaction object
|
|
95
|
+
*/
|
|
96
|
+
mintWithdrawalCap: (managerKey: string) => (tx: Transaction) => import("@haneullabs/haneul/transactions").TransactionResult;
|
|
97
|
+
/**
|
|
98
|
+
* @description Deposit using the DepositCap
|
|
99
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
100
|
+
* @param {string} coinKey The name of the coin to deposit
|
|
101
|
+
* @param {number} amountToDeposit The amount to deposit
|
|
102
|
+
* @returns A function that takes a Transaction object
|
|
103
|
+
*/
|
|
104
|
+
depositWithCap: (managerKey: string, coinKey: string, amountToDeposit: number) => (tx: Transaction) => void;
|
|
105
|
+
/**
|
|
106
|
+
* @description Withdraw using the WithdrawCap
|
|
107
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
108
|
+
* @param {string} coinKey The name of the coin to withdraw
|
|
109
|
+
* @param {number} amountToWithdraw The amount to withdraw
|
|
110
|
+
* @returns A function that takes a Transaction object
|
|
111
|
+
*/
|
|
112
|
+
withdrawWithCap: (managerKey: string, coinKey: string, amountToWithdraw: number) => (tx: Transaction) => import("@haneullabs/haneul/transactions").TransactionResult;
|
|
113
|
+
/**
|
|
114
|
+
* @description Set the referral for the BalanceManager for a specific pool
|
|
115
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
116
|
+
* @param {string} referral The referral (DeepBookPoolReferral) to set the BalanceManager to
|
|
117
|
+
* @param {TransactionArgument} tradeCap The tradeCap for permission checking
|
|
118
|
+
* @returns A function that takes a Transaction object
|
|
119
|
+
*/
|
|
120
|
+
setBalanceManagerReferral: (managerKey: string, referral: string, tradeCap: TransactionArgument) => (tx: Transaction) => void;
|
|
121
|
+
/**
|
|
122
|
+
* @description Unset the referral for the BalanceManager for a specific pool
|
|
123
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
124
|
+
* @param {string} poolKey The key of the pool to unset the referral for
|
|
125
|
+
* @param {TransactionArgument} tradeCap The tradeCap for permission checking
|
|
126
|
+
* @returns A function that takes a Transaction object
|
|
127
|
+
*/
|
|
128
|
+
unsetBalanceManagerReferral: (managerKey: string, poolKey: string, tradeCap: TransactionArgument) => (tx: Transaction) => void;
|
|
129
|
+
registerBalanceManager: (managerKey: string) => (tx: Transaction) => void;
|
|
130
|
+
/**
|
|
131
|
+
* @description Get the owner of the BalanceManager
|
|
132
|
+
* @param {string} managerKey The key of the BalanceManager
|
|
133
|
+
* @returns A function that takes a Transaction object
|
|
134
|
+
*/
|
|
135
|
+
owner: (managerKey: string) => (tx: Transaction) => void;
|
|
136
|
+
/**
|
|
137
|
+
* @description Get the ID of the BalanceManager
|
|
138
|
+
* @param {string} managerKey The key of the BalanceManager
|
|
139
|
+
* @returns A function that takes a Transaction object
|
|
140
|
+
*/
|
|
141
|
+
id: (managerKey: string) => (tx: Transaction) => void;
|
|
142
|
+
/**
|
|
143
|
+
* @description Get the owner of the referral (DeepBookPoolReferral)
|
|
144
|
+
* @param {string} referralId The ID of the referral to get the owner of
|
|
145
|
+
* @returns A function that takes a Transaction object
|
|
146
|
+
*/
|
|
147
|
+
balanceManagerReferralOwner: (referralId: string) => (tx: Transaction) => import("@haneullabs/haneul/transactions").TransactionResult;
|
|
148
|
+
/**
|
|
149
|
+
* @description Get the pool ID associated with a referral (DeepBookPoolReferral)
|
|
150
|
+
* @param {string} referralId The ID of the referral to get the pool ID of
|
|
151
|
+
* @returns A function that takes a Transaction object
|
|
152
|
+
*/
|
|
153
|
+
balanceManagerReferralPoolId: (referralId: string) => (tx: Transaction) => import("@haneullabs/haneul/transactions").TransactionResult;
|
|
154
|
+
/**
|
|
155
|
+
* @description Get the referral ID from the balance manager for a specific pool
|
|
156
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
157
|
+
* @param {string} poolKey Key of the pool to get the referral for
|
|
158
|
+
* @returns A function that takes a Transaction object
|
|
159
|
+
*/
|
|
160
|
+
getBalanceManagerReferralId: (managerKey: string, poolKey: string) => (tx: Transaction) => import("@haneullabs/haneul/transactions").TransactionResult;
|
|
161
|
+
/**
|
|
162
|
+
* @description Revoke a TradeCap. This also revokes the associated DepositCap and WithdrawCap.
|
|
163
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
164
|
+
* @param {string} tradeCapId The ID of the TradeCap to revoke
|
|
165
|
+
* @returns A function that takes a Transaction object
|
|
166
|
+
*/
|
|
167
|
+
revokeTradeCap: (managerKey: string, tradeCapId: string) => (tx: Transaction) => void;
|
|
168
|
+
}
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __typeError = (msg) => {
|
|
7
|
+
throw TypeError(msg);
|
|
8
|
+
};
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
23
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
24
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
25
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
26
|
+
var balanceManager_exports = {};
|
|
27
|
+
__export(balanceManager_exports, {
|
|
28
|
+
BalanceManagerContract: () => BalanceManagerContract
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(balanceManager_exports);
|
|
31
|
+
var import_transactions = require("@haneullabs/haneul/transactions");
|
|
32
|
+
var _config;
|
|
33
|
+
class BalanceManagerContract {
|
|
34
|
+
/**
|
|
35
|
+
* @param {DeepBookConfig} config Configuration for BalanceManagerContract
|
|
36
|
+
*/
|
|
37
|
+
constructor(config) {
|
|
38
|
+
__privateAdd(this, _config);
|
|
39
|
+
/**
|
|
40
|
+
* @description Create and share a new BalanceManager
|
|
41
|
+
* @returns A function that takes a Transaction object
|
|
42
|
+
*/
|
|
43
|
+
this.createAndShareBalanceManager = () => (tx) => {
|
|
44
|
+
const manager = tx.moveCall({
|
|
45
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::new`
|
|
46
|
+
});
|
|
47
|
+
tx.moveCall({
|
|
48
|
+
target: "0x2::transfer::public_share_object",
|
|
49
|
+
arguments: [manager],
|
|
50
|
+
typeArguments: [`${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::BalanceManager`]
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* @description Create a new BalanceManager, manually set the owner. Returns the manager.
|
|
55
|
+
* @returns A function that takes a Transaction object
|
|
56
|
+
*/
|
|
57
|
+
this.createBalanceManagerWithOwner = (ownerAddress) => (tx) => {
|
|
58
|
+
return tx.moveCall({
|
|
59
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::new_with_custom_owner`,
|
|
60
|
+
arguments: [tx.pure.address(ownerAddress)]
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* @description Share the BalanceManager
|
|
65
|
+
* @param {TransactionArgument} manager The BalanceManager to share
|
|
66
|
+
* @returns A function that takes a Transaction object
|
|
67
|
+
*/
|
|
68
|
+
this.shareBalanceManager = (manager) => (tx) => {
|
|
69
|
+
tx.moveCall({
|
|
70
|
+
target: "0x2::transfer::public_share_object",
|
|
71
|
+
arguments: [manager],
|
|
72
|
+
typeArguments: [`${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::BalanceManager`]
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* @description Deposit funds into the BalanceManager
|
|
77
|
+
* @param {string} managerKey The key of the BalanceManager
|
|
78
|
+
* @param {string} coinKey The key of the coin to deposit
|
|
79
|
+
* @param {number} amountToDeposit The amount to deposit
|
|
80
|
+
* @returns A function that takes a Transaction object
|
|
81
|
+
*/
|
|
82
|
+
this.depositIntoManager = (managerKey, coinKey, amountToDeposit) => (tx) => {
|
|
83
|
+
tx.setSenderIfNotSet(__privateGet(this, _config).address);
|
|
84
|
+
const managerId = __privateGet(this, _config).getBalanceManager(managerKey).address;
|
|
85
|
+
const coin = __privateGet(this, _config).getCoin(coinKey);
|
|
86
|
+
const depositInput = Math.round(amountToDeposit * coin.scalar);
|
|
87
|
+
const deposit = (0, import_transactions.coinWithBalance)({
|
|
88
|
+
type: coin.type,
|
|
89
|
+
balance: depositInput
|
|
90
|
+
});
|
|
91
|
+
tx.moveCall({
|
|
92
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::deposit`,
|
|
93
|
+
arguments: [tx.object(managerId), deposit],
|
|
94
|
+
typeArguments: [coin.type]
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* @description Withdraw funds from the BalanceManager
|
|
99
|
+
* @param {string} managerKey The key of the BalanceManager
|
|
100
|
+
* @param {string} coinKey The key of the coin to withdraw
|
|
101
|
+
* @param {number} amountToWithdraw The amount to withdraw
|
|
102
|
+
* @param {string} recipient The recipient of the withdrawn funds
|
|
103
|
+
* @returns A function that takes a Transaction object
|
|
104
|
+
*/
|
|
105
|
+
this.withdrawFromManager = (managerKey, coinKey, amountToWithdraw, recipient) => (tx) => {
|
|
106
|
+
const managerId = __privateGet(this, _config).getBalanceManager(managerKey).address;
|
|
107
|
+
const coin = __privateGet(this, _config).getCoin(coinKey);
|
|
108
|
+
const withdrawInput = Math.round(amountToWithdraw * coin.scalar);
|
|
109
|
+
const coinObject = tx.moveCall({
|
|
110
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::withdraw`,
|
|
111
|
+
arguments: [tx.object(managerId), tx.pure.u64(withdrawInput)],
|
|
112
|
+
typeArguments: [coin.type]
|
|
113
|
+
});
|
|
114
|
+
tx.transferObjects([coinObject], recipient);
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* @description Withdraw all funds from the BalanceManager
|
|
118
|
+
* @param {string} managerKey The key of the BalanceManager
|
|
119
|
+
* @param {string} coinKey The key of the coin to withdraw
|
|
120
|
+
* @param {string} recipient The recipient of the withdrawn funds
|
|
121
|
+
* @returns A function that takes a Transaction object
|
|
122
|
+
*/
|
|
123
|
+
this.withdrawAllFromManager = (managerKey, coinKey, recipient) => (tx) => {
|
|
124
|
+
const managerId = __privateGet(this, _config).getBalanceManager(managerKey).address;
|
|
125
|
+
const coin = __privateGet(this, _config).getCoin(coinKey);
|
|
126
|
+
const withdrawalCoin = tx.moveCall({
|
|
127
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::withdraw_all`,
|
|
128
|
+
arguments: [tx.object(managerId)],
|
|
129
|
+
typeArguments: [coin.type]
|
|
130
|
+
});
|
|
131
|
+
tx.transferObjects([withdrawalCoin], recipient);
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* @description Check the balance of the BalanceManager
|
|
135
|
+
* @param {string} managerKey The key of the BalanceManager
|
|
136
|
+
* @param {string} coinKey The key of the coin to check the balance of
|
|
137
|
+
* @returns A function that takes a Transaction object
|
|
138
|
+
*/
|
|
139
|
+
this.checkManagerBalance = (managerKey, coinKey) => (tx) => {
|
|
140
|
+
const managerId = __privateGet(this, _config).getBalanceManager(managerKey).address;
|
|
141
|
+
const coin = __privateGet(this, _config).getCoin(coinKey);
|
|
142
|
+
tx.moveCall({
|
|
143
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::balance`,
|
|
144
|
+
arguments: [tx.object(managerId)],
|
|
145
|
+
typeArguments: [coin.type]
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* @description Generate a trade proof for the BalanceManager. Calls the appropriate function based on whether tradeCap is set.
|
|
150
|
+
* @param {string} managerKey The key of the BalanceManager
|
|
151
|
+
* @returns A function that takes a Transaction object
|
|
152
|
+
*/
|
|
153
|
+
this.generateProof = (managerKey) => (tx) => {
|
|
154
|
+
const balanceManager = __privateGet(this, _config).getBalanceManager(managerKey);
|
|
155
|
+
return tx.add(
|
|
156
|
+
balanceManager.tradeCap ? this.generateProofAsTrader(balanceManager.address, balanceManager.tradeCap) : this.generateProofAsOwner(balanceManager.address)
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* @description Generate a trade proof as the owner
|
|
161
|
+
* @param {string} managerId The ID of the BalanceManager
|
|
162
|
+
* @returns A function that takes a Transaction object
|
|
163
|
+
*/
|
|
164
|
+
this.generateProofAsOwner = (managerId) => (tx) => {
|
|
165
|
+
return tx.moveCall({
|
|
166
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::generate_proof_as_owner`,
|
|
167
|
+
arguments: [tx.object(managerId)]
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* @description Generate a trade proof as a trader
|
|
172
|
+
* @param {string} managerId The ID of the BalanceManager
|
|
173
|
+
* @param {string} tradeCapId The ID of the tradeCap
|
|
174
|
+
* @returns A function that takes a Transaction object
|
|
175
|
+
*/
|
|
176
|
+
this.generateProofAsTrader = (managerId, tradeCapId) => (tx) => {
|
|
177
|
+
return tx.moveCall({
|
|
178
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::generate_proof_as_trader`,
|
|
179
|
+
arguments: [tx.object(managerId), tx.object(tradeCapId)]
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* @description Mint a TradeCap
|
|
184
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
185
|
+
* @returns A function that takes a Transaction object
|
|
186
|
+
*/
|
|
187
|
+
this.mintTradeCap = (managerKey) => (tx) => {
|
|
188
|
+
const manager = __privateGet(this, _config).getBalanceManager(managerKey);
|
|
189
|
+
const managerId = manager.address;
|
|
190
|
+
return tx.moveCall({
|
|
191
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::mint_trade_cap`,
|
|
192
|
+
arguments: [tx.object(managerId)]
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* @description Mint a DepositCap
|
|
197
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
198
|
+
* @returns A function that takes a Transaction object
|
|
199
|
+
*/
|
|
200
|
+
this.mintDepositCap = (managerKey) => (tx) => {
|
|
201
|
+
const manager = __privateGet(this, _config).getBalanceManager(managerKey);
|
|
202
|
+
const managerId = manager.address;
|
|
203
|
+
return tx.moveCall({
|
|
204
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::mint_deposit_cap`,
|
|
205
|
+
arguments: [tx.object(managerId)]
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* @description Mint a WithdrawalCap
|
|
210
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
211
|
+
* @returns A function that takes a Transaction object
|
|
212
|
+
*/
|
|
213
|
+
this.mintWithdrawalCap = (managerKey) => (tx) => {
|
|
214
|
+
const manager = __privateGet(this, _config).getBalanceManager(managerKey);
|
|
215
|
+
const managerId = manager.address;
|
|
216
|
+
return tx.moveCall({
|
|
217
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::mint_withdraw_cap`,
|
|
218
|
+
arguments: [tx.object(managerId)]
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* @description Deposit using the DepositCap
|
|
223
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
224
|
+
* @param {string} coinKey The name of the coin to deposit
|
|
225
|
+
* @param {number} amountToDeposit The amount to deposit
|
|
226
|
+
* @returns A function that takes a Transaction object
|
|
227
|
+
*/
|
|
228
|
+
this.depositWithCap = (managerKey, coinKey, amountToDeposit) => (tx) => {
|
|
229
|
+
tx.setSenderIfNotSet(__privateGet(this, _config).address);
|
|
230
|
+
const manager = __privateGet(this, _config).getBalanceManager(managerKey);
|
|
231
|
+
const managerId = manager.address;
|
|
232
|
+
if (!manager.depositCap) {
|
|
233
|
+
throw new Error(`DepositCap not set for ${managerKey}`);
|
|
234
|
+
}
|
|
235
|
+
const depositCapId = manager.depositCap;
|
|
236
|
+
const coin = __privateGet(this, _config).getCoin(coinKey);
|
|
237
|
+
const depositInput = Math.round(amountToDeposit * coin.scalar);
|
|
238
|
+
const deposit = (0, import_transactions.coinWithBalance)({
|
|
239
|
+
type: coin.type,
|
|
240
|
+
balance: depositInput
|
|
241
|
+
});
|
|
242
|
+
tx.moveCall({
|
|
243
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::deposit_with_cap`,
|
|
244
|
+
arguments: [tx.object(managerId), tx.object(depositCapId), deposit],
|
|
245
|
+
typeArguments: [coin.type]
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* @description Withdraw using the WithdrawCap
|
|
250
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
251
|
+
* @param {string} coinKey The name of the coin to withdraw
|
|
252
|
+
* @param {number} amountToWithdraw The amount to withdraw
|
|
253
|
+
* @returns A function that takes a Transaction object
|
|
254
|
+
*/
|
|
255
|
+
this.withdrawWithCap = (managerKey, coinKey, amountToWithdraw) => (tx) => {
|
|
256
|
+
tx.setSenderIfNotSet(__privateGet(this, _config).address);
|
|
257
|
+
const manager = __privateGet(this, _config).getBalanceManager(managerKey);
|
|
258
|
+
const managerId = manager.address;
|
|
259
|
+
if (!manager.withdrawCap) {
|
|
260
|
+
throw new Error(`WithdrawCap not set for ${managerKey}`);
|
|
261
|
+
}
|
|
262
|
+
const withdrawCapId = manager.withdrawCap;
|
|
263
|
+
const coin = __privateGet(this, _config).getCoin(coinKey);
|
|
264
|
+
const withdrawAmount = Math.round(amountToWithdraw * coin.scalar);
|
|
265
|
+
return tx.moveCall({
|
|
266
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::withdraw_with_cap`,
|
|
267
|
+
arguments: [tx.object(managerId), tx.object(withdrawCapId), tx.pure.u64(withdrawAmount)],
|
|
268
|
+
typeArguments: [coin.type]
|
|
269
|
+
});
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* @description Set the referral for the BalanceManager for a specific pool
|
|
273
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
274
|
+
* @param {string} referral The referral (DeepBookPoolReferral) to set the BalanceManager to
|
|
275
|
+
* @param {TransactionArgument} tradeCap The tradeCap for permission checking
|
|
276
|
+
* @returns A function that takes a Transaction object
|
|
277
|
+
*/
|
|
278
|
+
this.setBalanceManagerReferral = (managerKey, referral, tradeCap) => (tx) => {
|
|
279
|
+
const managerId = __privateGet(this, _config).getBalanceManager(managerKey).address;
|
|
280
|
+
tx.moveCall({
|
|
281
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::set_balance_manager_referral`,
|
|
282
|
+
arguments: [tx.object(managerId), tx.object(referral), tradeCap]
|
|
283
|
+
});
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* @description Unset the referral for the BalanceManager for a specific pool
|
|
287
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
288
|
+
* @param {string} poolKey The key of the pool to unset the referral for
|
|
289
|
+
* @param {TransactionArgument} tradeCap The tradeCap for permission checking
|
|
290
|
+
* @returns A function that takes a Transaction object
|
|
291
|
+
*/
|
|
292
|
+
this.unsetBalanceManagerReferral = (managerKey, poolKey, tradeCap) => (tx) => {
|
|
293
|
+
const managerId = __privateGet(this, _config).getBalanceManager(managerKey).address;
|
|
294
|
+
const poolId = __privateGet(this, _config).getPool(poolKey).address;
|
|
295
|
+
tx.moveCall({
|
|
296
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::unset_balance_manager_referral`,
|
|
297
|
+
arguments: [tx.object(managerId), tx.pure.id(poolId), tradeCap]
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
this.registerBalanceManager = (managerKey) => (tx) => {
|
|
301
|
+
const managerId = __privateGet(this, _config).getBalanceManager(managerKey).address;
|
|
302
|
+
tx.moveCall({
|
|
303
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::register_balance_manager`,
|
|
304
|
+
arguments: [tx.object(managerId), tx.object(__privateGet(this, _config).REGISTRY_ID)]
|
|
305
|
+
});
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* @description Get the owner of the BalanceManager
|
|
309
|
+
* @param {string} managerKey The key of the BalanceManager
|
|
310
|
+
* @returns A function that takes a Transaction object
|
|
311
|
+
*/
|
|
312
|
+
this.owner = (managerKey) => (tx) => {
|
|
313
|
+
const managerId = __privateGet(this, _config).getBalanceManager(managerKey).address;
|
|
314
|
+
tx.moveCall({
|
|
315
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::owner`,
|
|
316
|
+
arguments: [tx.object(managerId)]
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* @description Get the ID of the BalanceManager
|
|
321
|
+
* @param {string} managerKey The key of the BalanceManager
|
|
322
|
+
* @returns A function that takes a Transaction object
|
|
323
|
+
*/
|
|
324
|
+
this.id = (managerKey) => (tx) => {
|
|
325
|
+
const managerId = __privateGet(this, _config).getBalanceManager(managerKey).address;
|
|
326
|
+
tx.moveCall({
|
|
327
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::id`,
|
|
328
|
+
arguments: [tx.object(managerId)]
|
|
329
|
+
});
|
|
330
|
+
};
|
|
331
|
+
/**
|
|
332
|
+
* @description Get the owner of the referral (DeepBookPoolReferral)
|
|
333
|
+
* @param {string} referralId The ID of the referral to get the owner of
|
|
334
|
+
* @returns A function that takes a Transaction object
|
|
335
|
+
*/
|
|
336
|
+
this.balanceManagerReferralOwner = (referralId) => (tx) => {
|
|
337
|
+
return tx.moveCall({
|
|
338
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::balance_manager_referral_owner`,
|
|
339
|
+
arguments: [tx.object(referralId)]
|
|
340
|
+
});
|
|
341
|
+
};
|
|
342
|
+
/**
|
|
343
|
+
* @description Get the pool ID associated with a referral (DeepBookPoolReferral)
|
|
344
|
+
* @param {string} referralId The ID of the referral to get the pool ID of
|
|
345
|
+
* @returns A function that takes a Transaction object
|
|
346
|
+
*/
|
|
347
|
+
this.balanceManagerReferralPoolId = (referralId) => (tx) => {
|
|
348
|
+
return tx.moveCall({
|
|
349
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::balance_manager_referral_pool_id`,
|
|
350
|
+
arguments: [tx.object(referralId)]
|
|
351
|
+
});
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* @description Get the referral ID from the balance manager for a specific pool
|
|
355
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
356
|
+
* @param {string} poolKey Key of the pool to get the referral for
|
|
357
|
+
* @returns A function that takes a Transaction object
|
|
358
|
+
*/
|
|
359
|
+
this.getBalanceManagerReferralId = (managerKey, poolKey) => (tx) => {
|
|
360
|
+
const managerId = __privateGet(this, _config).getBalanceManager(managerKey).address;
|
|
361
|
+
const poolId = __privateGet(this, _config).getPool(poolKey).address;
|
|
362
|
+
return tx.moveCall({
|
|
363
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::get_balance_manager_referral_id`,
|
|
364
|
+
arguments: [tx.object(managerId), tx.pure.id(poolId)]
|
|
365
|
+
});
|
|
366
|
+
};
|
|
367
|
+
/**
|
|
368
|
+
* @description Revoke a TradeCap. This also revokes the associated DepositCap and WithdrawCap.
|
|
369
|
+
* @param {string} managerKey The name of the BalanceManager
|
|
370
|
+
* @param {string} tradeCapId The ID of the TradeCap to revoke
|
|
371
|
+
* @returns A function that takes a Transaction object
|
|
372
|
+
*/
|
|
373
|
+
this.revokeTradeCap = (managerKey, tradeCapId) => (tx) => {
|
|
374
|
+
const managerId = __privateGet(this, _config).getBalanceManager(managerKey).address;
|
|
375
|
+
tx.moveCall({
|
|
376
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::balance_manager::revoke_trade_cap`,
|
|
377
|
+
arguments: [tx.object(managerId), tx.pure.id(tradeCapId)]
|
|
378
|
+
});
|
|
379
|
+
};
|
|
380
|
+
__privateSet(this, _config, config);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
_config = new WeakMap();
|
|
384
|
+
//# sourceMappingURL=balanceManager.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/transactions/balanceManager.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport { coinWithBalance } from '@haneullabs/haneul/transactions';\nimport type { Transaction, TransactionArgument } from '@haneullabs/haneul/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\n\n/**\n * BalanceManagerContract class for managing BalanceManager operations.\n */\nexport class BalanceManagerContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for BalanceManagerContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @description Create and share a new BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateAndShareBalanceManager = () => (tx: Transaction) => {\n\t\tconst manager = tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::new`,\n\t\t});\n\n\t\ttx.moveCall({\n\t\t\ttarget: '0x2::transfer::public_share_object',\n\t\t\targuments: [manager],\n\t\t\ttypeArguments: [`${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::BalanceManager`],\n\t\t});\n\t};\n\n\t/**\n\t * @description Create a new BalanceManager, manually set the owner. Returns the manager.\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateBalanceManagerWithOwner = (ownerAddress: string) => (tx: Transaction) => {\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::new_with_custom_owner`,\n\t\t\targuments: [tx.pure.address(ownerAddress)],\n\t\t});\n\t};\n\n\t/**\n\t * @description Share the BalanceManager\n\t * @param {TransactionArgument} manager The BalanceManager to share\n\t * @returns A function that takes a Transaction object\n\t */\n\tshareBalanceManager = (manager: TransactionArgument) => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: '0x2::transfer::public_share_object',\n\t\t\targuments: [manager],\n\t\t\ttypeArguments: [`${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::BalanceManager`],\n\t\t});\n\t};\n\n\t/**\n\t * @description Deposit funds into the BalanceManager\n\t * @param {string} managerKey The key of the BalanceManager\n\t * @param {string} coinKey The key of the coin to deposit\n\t * @param {number} amountToDeposit The amount to deposit\n\t * @returns A function that takes a Transaction object\n\t */\n\tdepositIntoManager =\n\t\t(managerKey: string, coinKey: string, amountToDeposit: number) => (tx: Transaction) => {\n\t\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst depositInput = Math.round(amountToDeposit * coin.scalar);\n\t\t\tconst deposit = 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.DEEPBOOK_PACKAGE_ID}::balance_manager::deposit`,\n\t\t\t\targuments: [tx.object(managerId), deposit],\n\t\t\t\ttypeArguments: [coin.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Withdraw funds from the BalanceManager\n\t * @param {string} managerKey The key of the BalanceManager\n\t * @param {string} coinKey The key of the coin to withdraw\n\t * @param {number} amountToWithdraw The amount to withdraw\n\t * @param {string} recipient The recipient of the withdrawn funds\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawFromManager =\n\t\t(managerKey: string, coinKey: string, amountToWithdraw: number, recipient: string) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst withdrawInput = Math.round(amountToWithdraw * coin.scalar);\n\t\t\tconst coinObject = tx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::withdraw`,\n\t\t\t\targuments: [tx.object(managerId), tx.pure.u64(withdrawInput)],\n\t\t\t\ttypeArguments: [coin.type],\n\t\t\t});\n\n\t\t\ttx.transferObjects([coinObject], recipient);\n\t\t};\n\n\t/**\n\t * @description Withdraw all funds from the BalanceManager\n\t * @param {string} managerKey The key of the BalanceManager\n\t * @param {string} coinKey The key of the coin to withdraw\n\t * @param {string} recipient The recipient of the withdrawn funds\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawAllFromManager =\n\t\t(managerKey: string, coinKey: string, recipient: string) => (tx: Transaction) => {\n\t\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst withdrawalCoin = tx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::withdraw_all`,\n\t\t\t\targuments: [tx.object(managerId)],\n\t\t\t\ttypeArguments: [coin.type],\n\t\t\t});\n\n\t\t\ttx.transferObjects([withdrawalCoin], recipient);\n\t\t};\n\n\t/**\n\t * @description Check the balance of the BalanceManager\n\t * @param {string} managerKey The key of the BalanceManager\n\t * @param {string} coinKey The key of the coin to check the balance of\n\t * @returns A function that takes a Transaction object\n\t */\n\tcheckManagerBalance = (managerKey: string, coinKey: string) => (tx: Transaction) => {\n\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::balance`,\n\t\t\targuments: [tx.object(managerId)],\n\t\t\ttypeArguments: [coin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Generate a trade proof for the BalanceManager. Calls the appropriate function based on whether tradeCap is set.\n\t * @param {string} managerKey The key of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tgenerateProof = (managerKey: string) => (tx: Transaction) => {\n\t\tconst balanceManager = this.#config.getBalanceManager(managerKey);\n\t\treturn tx.add(\n\t\t\tbalanceManager.tradeCap\n\t\t\t\t? this.generateProofAsTrader(balanceManager.address, balanceManager.tradeCap)\n\t\t\t\t: this.generateProofAsOwner(balanceManager.address),\n\t\t);\n\t};\n\n\t/**\n\t * @description Generate a trade proof as the owner\n\t * @param {string} managerId The ID of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tgenerateProofAsOwner = (managerId: string) => (tx: Transaction) => {\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::generate_proof_as_owner`,\n\t\t\targuments: [tx.object(managerId)],\n\t\t});\n\t};\n\n\t/**\n\t * @description Generate a trade proof as a trader\n\t * @param {string} managerId The ID of the BalanceManager\n\t * @param {string} tradeCapId The ID of the tradeCap\n\t * @returns A function that takes a Transaction object\n\t */\n\tgenerateProofAsTrader = (managerId: string, tradeCapId: string) => (tx: Transaction) => {\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::generate_proof_as_trader`,\n\t\t\targuments: [tx.object(managerId), tx.object(tradeCapId)],\n\t\t});\n\t};\n\n\t/**\n\t * @description Mint a TradeCap\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintTradeCap = (managerKey: string) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getBalanceManager(managerKey);\n\t\tconst managerId = manager.address;\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::mint_trade_cap`,\n\t\t\targuments: [tx.object(managerId)],\n\t\t});\n\t};\n\n\t/**\n\t * @description Mint a DepositCap\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintDepositCap = (managerKey: string) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getBalanceManager(managerKey);\n\t\tconst managerId = manager.address;\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::mint_deposit_cap`,\n\t\t\targuments: [tx.object(managerId)],\n\t\t});\n\t};\n\n\t/**\n\t * @description Mint a WithdrawalCap\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintWithdrawalCap = (managerKey: string) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getBalanceManager(managerKey);\n\t\tconst managerId = manager.address;\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::mint_withdraw_cap`,\n\t\t\targuments: [tx.object(managerId)],\n\t\t});\n\t};\n\n\t/**\n\t * @description Deposit using the DepositCap\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @param {string} coinKey The name of the coin to deposit\n\t * @param {number} amountToDeposit The amount to deposit\n\t * @returns A function that takes a Transaction object\n\t */\n\tdepositWithCap =\n\t\t(managerKey: string, coinKey: string, amountToDeposit: number) => (tx: Transaction) => {\n\t\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\t\tconst manager = this.#config.getBalanceManager(managerKey);\n\t\t\tconst managerId = manager.address;\n\t\t\tif (!manager.depositCap) {\n\t\t\t\tthrow new Error(`DepositCap not set for ${managerKey}`);\n\t\t\t}\n\t\t\tconst depositCapId = manager.depositCap;\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst depositInput = Math.round(amountToDeposit * coin.scalar);\n\t\t\tconst deposit = coinWithBalance({\n\t\t\t\ttype: coin.type,\n\t\t\t\tbalance: depositInput,\n\t\t\t});\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::deposit_with_cap`,\n\t\t\t\targuments: [tx.object(managerId), tx.object(depositCapId), deposit],\n\t\t\t\ttypeArguments: [coin.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Withdraw using the WithdrawCap\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @param {string} coinKey The name of the coin to withdraw\n\t * @param {number} amountToWithdraw The amount to withdraw\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawWithCap =\n\t\t(managerKey: string, coinKey: string, amountToWithdraw: number) => (tx: Transaction) => {\n\t\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\t\tconst manager = this.#config.getBalanceManager(managerKey);\n\t\t\tconst managerId = manager.address;\n\t\t\tif (!manager.withdrawCap) {\n\t\t\t\tthrow new Error(`WithdrawCap not set for ${managerKey}`);\n\t\t\t}\n\t\t\tconst withdrawCapId = manager.withdrawCap;\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst withdrawAmount = Math.round(amountToWithdraw * coin.scalar);\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::withdraw_with_cap`,\n\t\t\t\targuments: [tx.object(managerId), tx.object(withdrawCapId), tx.pure.u64(withdrawAmount)],\n\t\t\t\ttypeArguments: [coin.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Set the referral for the BalanceManager for a specific pool\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @param {string} referral The referral (DeepBookPoolReferral) to set the BalanceManager to\n\t * @param {TransactionArgument} tradeCap The tradeCap for permission checking\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetBalanceManagerReferral =\n\t\t(managerKey: string, referral: string, tradeCap: TransactionArgument) => (tx: Transaction) => {\n\t\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::set_balance_manager_referral`,\n\t\t\t\targuments: [tx.object(managerId), tx.object(referral), tradeCap],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Unset the referral for the BalanceManager for a specific pool\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @param {string} poolKey The key of the pool to unset the referral for\n\t * @param {TransactionArgument} tradeCap The tradeCap for permission checking\n\t * @returns A function that takes a Transaction object\n\t */\n\tunsetBalanceManagerReferral =\n\t\t(managerKey: string, poolKey: string, tradeCap: TransactionArgument) => (tx: Transaction) => {\n\t\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\t\tconst poolId = this.#config.getPool(poolKey).address;\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::unset_balance_manager_referral`,\n\t\t\t\targuments: [tx.object(managerId), tx.pure.id(poolId), tradeCap],\n\t\t\t});\n\t\t};\n\n\tregisterBalanceManager = (managerKey: string) => (tx: Transaction) => {\n\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::register_balance_manager`,\n\t\t\targuments: [tx.object(managerId), tx.object(this.#config.REGISTRY_ID)],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the owner of the BalanceManager\n\t * @param {string} managerKey The key of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\towner = (managerKey: string) => (tx: Transaction) => {\n\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::owner`,\n\t\t\targuments: [tx.object(managerId)],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the ID of the BalanceManager\n\t * @param {string} managerKey The key of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tid = (managerKey: string) => (tx: Transaction) => {\n\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::id`,\n\t\t\targuments: [tx.object(managerId)],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the owner of the referral (DeepBookPoolReferral)\n\t * @param {string} referralId The ID of the referral to get the owner of\n\t * @returns A function that takes a Transaction object\n\t */\n\tbalanceManagerReferralOwner = (referralId: string) => (tx: Transaction) => {\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::balance_manager_referral_owner`,\n\t\t\targuments: [tx.object(referralId)],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the pool ID associated with a referral (DeepBookPoolReferral)\n\t * @param {string} referralId The ID of the referral to get the pool ID of\n\t * @returns A function that takes a Transaction object\n\t */\n\tbalanceManagerReferralPoolId = (referralId: string) => (tx: Transaction) => {\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::balance_manager_referral_pool_id`,\n\t\t\targuments: [tx.object(referralId)],\n\t\t});\n\t};\n\n\t/**\n\t * @description Get the referral ID from the balance manager for a specific pool\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @param {string} poolKey Key of the pool to get the referral for\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetBalanceManagerReferralId = (managerKey: string, poolKey: string) => (tx: Transaction) => {\n\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\tconst poolId = this.#config.getPool(poolKey).address;\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::get_balance_manager_referral_id`,\n\t\t\targuments: [tx.object(managerId), tx.pure.id(poolId)],\n\t\t});\n\t};\n\n\t/**\n\t * @description Revoke a TradeCap. This also revokes the associated DepositCap and WithdrawCap.\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @param {string} tradeCapId The ID of the TradeCap to revoke\n\t * @returns A function that takes a Transaction object\n\t */\n\trevokeTradeCap = (managerKey: string, tradeCapId: string) => (tx: Transaction) => {\n\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::revoke_trade_cap`,\n\t\t\targuments: [tx.object(managerId), tx.pure.id(tradeCapId)],\n\t\t});\n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