@mysten/deepbook-v3 1.6.7 → 2.0.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.
Files changed (85) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/_virtual/rolldown_runtime.mjs +18 -0
  3. package/dist/client.d.mts +9 -6
  4. package/dist/client.d.mts.map +1 -1
  5. package/dist/client.mjs +3 -2
  6. package/dist/client.mjs.map +1 -1
  7. package/dist/contracts/deepbook/account.d.mts +18 -18
  8. package/dist/contracts/deepbook/account.d.mts.map +1 -1
  9. package/dist/contracts/deepbook/deep_price.d.mts +3 -3
  10. package/dist/contracts/deepbook/deep_price.d.mts.map +1 -1
  11. package/dist/contracts/deepbook_margin/margin_manager.mjs +1 -319
  12. package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -1
  13. package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs +386 -0
  14. package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs.map +1 -0
  15. package/dist/contracts/deepbook_margin/oracle.mjs +9 -0
  16. package/dist/contracts/deepbook_margin/oracle.mjs.map +1 -1
  17. package/dist/contracts/deepbook_margin/pool_proxy.mjs +1 -383
  18. package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -1
  19. package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs +340 -0
  20. package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs.map +1 -0
  21. package/dist/contracts/margin_liquidation/liquidation_vault.mjs +33 -17
  22. package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -1
  23. package/dist/index.d.mts +4 -3
  24. package/dist/index.mjs +2 -2
  25. package/dist/pyth/PriceServiceConnection.d.mts +18 -3
  26. package/dist/pyth/PriceServiceConnection.d.mts.map +1 -1
  27. package/dist/pyth/PriceServiceConnection.mjs +35 -4
  28. package/dist/pyth/PriceServiceConnection.mjs.map +1 -1
  29. package/dist/queries/priceFeedQueries.mjs +50 -18
  30. package/dist/queries/priceFeedQueries.mjs.map +1 -1
  31. package/dist/transactions/balanceManager.d.mts +12 -12
  32. package/dist/transactions/deepbook.d.mts +20 -20
  33. package/dist/transactions/deepbookAdmin.d.mts +4 -4
  34. package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
  35. package/dist/transactions/marginAdmin.d.mts +7 -7
  36. package/dist/transactions/marginAdmin.d.mts.map +1 -1
  37. package/dist/transactions/marginAdmin.mjs +2 -2
  38. package/dist/transactions/marginAdmin.mjs.map +1 -1
  39. package/dist/transactions/marginLiquidations.d.mts.map +1 -1
  40. package/dist/transactions/marginLiquidations.mjs +19 -7
  41. package/dist/transactions/marginLiquidations.mjs.map +1 -1
  42. package/dist/transactions/marginMaintainer.d.mts +5 -5
  43. package/dist/transactions/marginManager.d.mts +32 -32
  44. package/dist/transactions/marginManager.d.mts.map +1 -1
  45. package/dist/transactions/marginManager.mjs +43 -34
  46. package/dist/transactions/marginManager.mjs.map +1 -1
  47. package/dist/transactions/marginPool.d.mts +18 -18
  48. package/dist/transactions/marginTPSL.d.mts +10 -10
  49. package/dist/transactions/marginTPSL.d.mts.map +1 -1
  50. package/dist/transactions/marginTPSL.mjs +19 -10
  51. package/dist/transactions/marginTPSL.mjs.map +1 -1
  52. package/dist/transactions/poolProxy.d.mts +8 -8
  53. package/dist/transactions/poolProxy.d.mts.map +1 -1
  54. package/dist/transactions/poolProxy.mjs +34 -27
  55. package/dist/transactions/poolProxy.mjs.map +1 -1
  56. package/dist/types/index.d.mts +16 -1
  57. package/dist/types/index.d.mts.map +1 -1
  58. package/dist/types/index.mjs.map +1 -1
  59. package/dist/utils/config.d.mts +30 -10
  60. package/dist/utils/config.d.mts.map +1 -1
  61. package/dist/utils/config.mjs +33 -4
  62. package/dist/utils/config.mjs.map +1 -1
  63. package/dist/utils/constants.d.mts +32 -1
  64. package/dist/utils/constants.d.mts.map +1 -1
  65. package/dist/utils/constants.mjs +54 -23
  66. package/dist/utils/constants.mjs.map +1 -1
  67. package/package.json +1 -1
  68. package/src/client.ts +9 -1
  69. package/src/contracts/deepbook_margin/margin_manager.ts +140 -10
  70. package/src/contracts/deepbook_margin/margin_manager_upgraded.ts +651 -0
  71. package/src/contracts/deepbook_margin/oracle.ts +59 -0
  72. package/src/contracts/deepbook_margin/pool_proxy.ts +600 -584
  73. package/src/contracts/deepbook_margin/pool_proxy_upgraded.ts +614 -0
  74. package/src/contracts/margin_liquidation/liquidation_vault.ts +142 -0
  75. package/src/index.ts +4 -0
  76. package/src/pyth/PriceServiceConnection.ts +69 -8
  77. package/src/queries/priceFeedQueries.ts +74 -24
  78. package/src/transactions/marginAdmin.ts +2 -4
  79. package/src/transactions/marginLiquidations.ts +20 -6
  80. package/src/transactions/marginManager.ts +43 -33
  81. package/src/transactions/marginTPSL.ts +19 -9
  82. package/src/transactions/poolProxy.ts +34 -30
  83. package/src/types/index.ts +16 -0
  84. package/src/utils/config.ts +69 -9
  85. package/src/utils/constants.ts +88 -25
@@ -1 +1 @@
1
- {"version":3,"file":"marginAdmin.d.mts","names":[],"sources":["../../src/transactions/marginAdmin.ts"],"mappings":";;;;;;;;AAkBA;cAAa,mBAAA;EAAA;EAMQ;;;cAAR,MAAA,EAAQ,cAAA;EAwDW;;;;EApC/B,iBAAA,SAA2B,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAwGoC;;;;EA3F9E,mBAAA,GAAuB,eAAA,cAA6B,EAAA,EAAI,WAAA;EAiOnC;;;;;;EA3MrB,oBAAA,GACE,OAAA,UAAiB,UAAA,EAAY,mBAAA,MAAyB,EAAA,EAAI,WAAA;EAiR6B;;;;;EA1PzF,kBAAA,GAAsB,OAAA,cAAqB,EAAA,EAAI,WAAA;EAsV9B;;;;;EAhUjB,mBAAA,GAAuB,OAAA,cAAqB,EAAA,EAAI,WAAA;EA6YwB;;;;;;EAtXxE,gBAAA,GAAoB,OAAA,UAAiB,UAAA,EAAY,mBAAA,MAAyB,EAAA,EAAI,WAAA;EAxG9E;;;;;;;;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A;;;;;EAe1B,aAAA,GAAiB,OAAA,cAAqB,EAAA,EAAI,WAAA;EAkB1C;;;;;EAAA,cAAA,GAAkB,OAAA,cAAqB,EAAA,EAAI,WAAA;EAmBS;;;;;;EAApD,aAAA,GAAiB,OAAA,UAAiB,gBAAA,EAAkB,gBAAA,MAAsB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAmC3C;;;;;;EAA9C,yBAAA,GAA6B,OAAA,UAAiB,QAAA,cAAsB,EAAA,EAAI,WAAA;EAwBK;;;;;;;EAD7E,eAAA,GACE,OAAA,UAAiB,UAAA,UAAoB,oBAAA,cAAkC,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EA4BtF;;;;;;EAFF,aAAA,GAEE,UAAA,EAAY,KAAA;IAAQ,OAAA;IAAiB,UAAA;IAAoB,oBAAA;EAAA,IACzD,aAAA,cAEA,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAuC6B;;;;EAd9C,YAAA,SAAsB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAiCkC;;;;;EAnBvE,cAAA,GAAkB,UAAA,cAAwB,EAAA,EAAI,WAAA;EAsC0B;;;;;;EAnBxE,sBAAA,GAA0B,OAAA,UAAiB,UAAA,cAAwB,EAAA,EAAI,WAAA;;;;;;;EAmBvE,gCAAA,GAAoC,OAAA,cAAqB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;AAAA"}
@@ -228,8 +228,8 @@ var MarginAdminContract = class {
228
228
  };
229
229
  this.newCoinTypeData = (coinKey, maxConfBps, maxEwmaDifferenceBps) => (tx) => {
230
230
  const coin = this.#config.getCoin(coinKey);
231
- if (!coin.feed) throw new Error("Coin feed not found");
232
- const priceFeedInput = new Uint8Array(hexToBytes(coin["feed"].startsWith("0x") ? coin.feed.slice(2) : coin["feed"]));
231
+ const feed = this.#config.getFeedId(coinKey);
232
+ const priceFeedInput = new Uint8Array(hexToBytes(feed.startsWith("0x") ? feed.slice(2) : feed));
233
233
  return tx.add(newCoinTypeDataFromCurrency({
234
234
  package: this.#config.MARGIN_PACKAGE_ID,
235
235
  arguments: {
@@ -1 +1 @@
1
- {"version":3,"file":"marginAdmin.mjs","names":["marginRegistryMoveCalls.mintMaintainerCap","#config","#marginAdminCap","marginRegistryMoveCalls.registerDeepbookPool","marginRegistryMoveCalls.enableDeepbookPool","marginRegistryMoveCalls.disableDeepbookPool","marginRegistryMoveCalls.updateRiskParams","marginRegistryMoveCalls.setPriceTolerance","marginRegistryMoveCalls.setMaxPriceAge","marginRegistryMoveCalls.setMaxOrderTtl","marginRegistryMoveCalls.setMinOpenRiskRatio","marginRegistryMoveCalls.addConfig","marginRegistryMoveCalls.removeConfig","marginRegistryMoveCalls.enableVersion","marginRegistryMoveCalls.disableVersion","marginRegistryMoveCalls.newPoolConfig","marginRegistryMoveCalls.newPoolConfigWithLeverage","oracleMoveCalls.newCoinTypeDataFromCurrency","oracleMoveCalls.newPythConfig","marginRegistryMoveCalls.mintPauseCap","marginRegistryMoveCalls.revokePauseCap","marginRegistryMoveCalls.disableVersionPauseCap","marginPoolMoveCalls.adminWithdrawDefaultReferralFees"],"sources":["../../src/transactions/marginAdmin.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport type { TransactionArgument } from '@mysten/sui/transactions';\nimport type { PoolConfigParams } from '../types/index.js';\nimport { FLOAT_SCALAR } from '../utils/config.js';\nimport { convertRate } from '../utils/conversion.js';\nimport { hexToBytes } from '@noble/hashes/utils.js';\nimport * as marginRegistryMoveCalls from '../contracts/deepbook_margin/margin_registry.js';\nimport * as marginPoolMoveCalls from '../contracts/deepbook_margin/margin_pool.js';\nimport * as oracleMoveCalls from '../contracts/deepbook_margin/oracle.js';\n\n/**\n * MarginAdminContract class for managing admin actions.\n */\nexport class MarginAdminContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginAdminContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @returns The admin capability required for admin operations\n\t * @throws Error if the admin capability is not set\n\t */\n\t#marginAdminCap() {\n\t\tconst marginAdminCap = this.#config.marginAdminCap;\n\t\tif (!marginAdminCap) {\n\t\t\tthrow new Error('MARGIN_ADMIN_CAP environment variable not set');\n\t\t}\n\t\treturn marginAdminCap;\n\t}\n\n\t/**\n\t * @description Mint a maintainer cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintMaintainerCap = () => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tmarginRegistryMoveCalls.mintMaintainerCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.MARGIN_REGISTRY_ID, AdminCap: this.#marginAdminCap() },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Revoke a maintainer cap\n\t * @returns A function that takes a Transaction object\n\t */\n\trevokeMaintainerCap = (maintainerCapId: string) => (tx: Transaction) => {\n\t\t// NOTE: left as a positional moveCall (not codegen). The original passes\n\t\t// `maintainerCapId` as an object reference (`tx.object`), whereas the\n\t\t// generated binding encodes it as a pure `ID` value — migrating would change\n\t\t// the emitted PTB. Kept verbatim to stay byte-identical.\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::revoke_maintainer_cap`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\ttx.object(maintainerCapId),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Register a deepbook pool\n\t * @param {string} poolKey The key of the pool to be registered\n\t * @param {TransactionArgument} poolConfig The configuration of the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tregisterDeepbookPool =\n\t\t(poolKey: string, poolConfig: TransactionArgument) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\ttx.add(\n\t\t\t\tmarginRegistryMoveCalls.registerDeepbookPool({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tpoolConfig,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Enable a deepbook pool for margin trading\n\t * @param {string} poolKey The key of the pool to be enabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableDeepbookPool = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.enableDeepbookPool({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Disable a deepbook pool from margin trading\n\t * @param {string} poolKey The key of the pool to be disabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableDeepbookPool = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.disableDeepbookPool({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Update the risk parameters for a margin\n\t * @param {string} poolKey The key of the pool to be updated\n\t * @param {TransactionArgument} poolConfig The configuration of the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateRiskParams = (poolKey: string, poolConfig: TransactionArgument) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.updateRiskParams({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tpoolConfig,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the price deviation tolerance for a pool. `tolerance` is\n\t * in 9-decimal float scaling (1.0 = `FLOAT_SCALAR`); the SDK applies the\n\t * scaling, so callers pass a human-readable fraction (e.g. `0.1` for 10%).\n\t * Requires the pool's current price to have been initialized via\n\t * `PoolProxyContract.updateCurrentPrice` first.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} tolerance Tolerance as a fraction (e.g. 0.1 for 10%)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetPriceTolerance = (poolKey: string, tolerance: number | bigint) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.setPriceTolerance({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\ttolerance: convertRate(tolerance, FLOAT_SCALAR),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the maximum acceptable Pyth price age (in milliseconds)\n\t * for a pool. Requires the pool's current price to have been initialized\n\t * via `PoolProxyContract.updateCurrentPrice` first.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} maxAgeMs Max age in milliseconds (raw u64)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMaxPriceAge = (poolKey: string, maxAgeMs: number | bigint) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.setMaxPriceAge({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tmaxAgeMs,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the maximum lifetime (in milliseconds) of margin limit\n\t * orders for a pool. `pool_proxy::place_limit_order_v2` and\n\t * `place_reduce_only_limit_order_v2` clamp the user-supplied\n\t * `expire_timestamp` to at most `now + max_order_ttl_ms`, bounding margin\n\t * orders' exposure to stale-price exploitation.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} maxOrderTtlMs Max order TTL in milliseconds (raw u64)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMaxOrderTtl = (poolKey: string, maxOrderTtlMs: number | bigint) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.setMaxOrderTtl({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tmaxOrderTtlMs,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the minimum risk ratio required to open a new position on\n\t * a pool. Distinct from the borrow floor: this gates position opening, not\n\t * borrowing. Stored in 9-decimal float scaling (1.0 = `FLOAT_SCALAR`); the SDK\n\t * applies the scaling, so callers pass a human-readable ratio (e.g. `1.25`).\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} minOpenRiskRatio Minimum open risk ratio (e.g. 1.25)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMinOpenRiskRatio =\n\t\t(poolKey: string, minOpenRiskRatio: number | bigint) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\ttx.add(\n\t\t\t\tmarginRegistryMoveCalls.setMinOpenRiskRatio({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tminOpenRiskRatio: convertRate(minOpenRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Add the PythConfig to the margin registry\n\t * @param {Transaction} tx The transaction object\n\t * @param {TransactionArgument} config The config to be added\n\t * @returns A function that takes a Transaction object\n\t */\n\taddConfig = (config: TransactionArgument) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.addConfig({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tconfig,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::oracle::PythConfig`],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Remove the PythConfig from the margin registry\n\t * @param {Transaction} tx The transaction object\n\t * @returns A function that takes a Transaction object\n\t */\n\tremoveConfig = () => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.removeConfig({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.MARGIN_REGISTRY_ID, AdminCap: this.#marginAdminCap() },\n\t\t\t\ttypeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::oracle::PythConfig`],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Enable a specific version\n\t * @param {number} version The version to be enabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.enableVersion({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tversion,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Disable a specific version\n\t * @param {number} version The version to be disabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.disableVersion({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tversion,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Create a new pool config\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {PoolConfigParams} poolConfigParams The parameters for the pool config\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPoolConfig = (poolKey: string, poolConfigParams: PoolConfigParams) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst {\n\t\t\tminWithdrawRiskRatio,\n\t\t\tminBorrowRiskRatio,\n\t\t\tliquidationRiskRatio,\n\t\t\ttargetLiquidationRiskRatio,\n\t\t\tuserLiquidationReward,\n\t\t\tpoolLiquidationReward,\n\t\t} = poolConfigParams;\n\t\treturn tx.add(\n\t\t\tmarginRegistryMoveCalls.newPoolConfig({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tminWithdrawRiskRatio: convertRate(minWithdrawRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\tminBorrowRiskRatio: convertRate(minBorrowRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\tliquidationRiskRatio: convertRate(liquidationRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\ttargetLiquidationRiskRatio: convertRate(targetLiquidationRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\tuserLiquidationReward: convertRate(userLiquidationReward, FLOAT_SCALAR),\n\t\t\t\t\tpoolLiquidationReward: convertRate(poolLiquidationReward, FLOAT_SCALAR),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Create a new pool config with leverage\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} leverage The leverage for the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPoolConfigWithLeverage = (poolKey: string, leverage: number) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.newPoolConfigWithLeverage({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tleverage: convertRate(leverage, FLOAT_SCALAR),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Create a new coin type data\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {number} maxConfBps The maximum confidence interval in basis points\n\t * @param {number} maxEwmaDifferenceBps The maximum EWMA difference in basis points\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewCoinTypeData =\n\t\t(coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number) => (tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tif (!coin.feed) {\n\t\t\t\tthrow new Error('Coin feed not found');\n\t\t\t}\n\t\t\tconst priceFeedInput = new Uint8Array(\n\t\t\t\thexToBytes(coin['feed']!.startsWith('0x') ? coin.feed!.slice(2) : coin['feed']),\n\t\t\t);\n\t\t\treturn tx.add(\n\t\t\t\toracleMoveCalls.newCoinTypeDataFromCurrency({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tcurrency: coin.currencyId!,\n\t\t\t\t\t\tpriceFeedId: Array.from(priceFeedInput),\n\t\t\t\t\t\tmaxConfBps,\n\t\t\t\t\t\tmaxEwmaDifferenceBps,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Create a new Pyth config\n\t * @param {Array<{coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number}>} coinSetups The coins with their oracle config to be added to the Pyth config\n\t * @param {number} maxAgeSeconds The max age in seconds for the Pyth config\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPythConfig =\n\t\t(\n\t\t\tcoinSetups: Array<{ coinKey: string; maxConfBps: number; maxEwmaDifferenceBps: number }>,\n\t\t\tmaxAgeSeconds: number,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst coinTypeDataList = [];\n\t\t\tfor (const setup of coinSetups) {\n\t\t\t\tcoinTypeDataList.push(\n\t\t\t\t\tthis.newCoinTypeData(setup.coinKey, setup.maxConfBps, setup.maxEwmaDifferenceBps)(tx),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn tx.add(\n\t\t\t\toracleMoveCalls.newPythConfig({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tsetups: tx.makeMoveVec({\n\t\t\t\t\t\t\telements: coinTypeDataList,\n\t\t\t\t\t\t\ttype: `${this.#config.MARGIN_PACKAGE_ID}::oracle::CoinTypeData`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tmaxAgeSecs: maxAgeSeconds,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Mint a pause cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintPauseCap = () => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tmarginRegistryMoveCalls.mintPauseCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.MARGIN_REGISTRY_ID, AdminCap: this.#marginAdminCap() },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Revoke a pause cap\n\t * @param {string} pauseCapId The ID of the pause cap to revoke\n\t * @returns A function that takes a Transaction object\n\t */\n\trevokePauseCap = (pauseCapId: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.revokePauseCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpauseCapId,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Disable a version using pause cap\n\t * @param {number} version The version to disable\n\t * @param {string} pauseCapId The ID of the pause cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersionPauseCap = (version: number, pauseCapId: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.disableVersionPauseCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tversion,\n\t\t\t\t\tpauseCap: pauseCapId,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Withdraw the default referral fees (admin only)\n\t * The default referral at 0x0 doesn't have a SupplyReferral object\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @returns A function that takes a Transaction object and returns a Coin<Asset>\n\t */\n\tadminWithdrawDefaultReferralFees = (coinKey: string) => (tx: Transaction) => {\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.add(\n\t\t\tmarginPoolMoveCalls.adminWithdrawDefaultReferralFees({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: marginPool.address,\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [coin.type],\n\t\t\t}),\n\t\t);\n\t};\n}\n"],"mappings":";;;;;;;;;;;AAkBA,IAAa,sBAAb,MAAiC;CAChC;;;;CAKA,YAAY,QAAwB;kCAoBT,OAAoB;AAC9C,UAAO,GAAG,IACTA,kBAA0C;IACzC,SAAS,MAAKC,OAAQ;IACtB,WAAW;KAAE,MAAM,MAAKA,OAAQ;KAAoB,UAAU,MAAKC,gBAAiB;KAAE;IACtF,CAAC,CACF;;8BAOqB,qBAA6B,OAAoB;AAKvE,MAAG,SAAS;IACX,QAAQ,GAAG,MAAKD,OAAQ,kBAAkB;IAC1C,WAAW;KACV,GAAG,OAAO,MAAKA,OAAQ,mBAAmB;KAC1C,GAAG,OAAO,MAAKC,gBAAiB,CAAC;KACjC,GAAG,OAAO,gBAAgB;KAC1B,GAAG,O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WAAW;KACV,MAAM,MAAKA,OAAQ;KACnB;KACA,UAAU;KACV;IACD,CAAC,CACF;;2CASkC,aAAqB,OAAoB;GAC5E,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;GAC1C,MAAM,aAAa,MAAKA,OAAQ,cAAc,QAAQ;AACtD,UAAO,GAAG,IACTqB,iCAAqD;IACpD,SAAS,MAAKrB,OAAQ;IACtB,WAAW;KACV,MAAM,WAAW;KACjB,UAAU,MAAKA,OAAQ;KACvB,UAAU,MAAKC,gBAAiB;KAChC;IACD,eAAe,CAAC,KAAK,KAAK;IAC1B,CAAC,CACF;;AA9fD,QAAKD,SAAU;;;;;;CAOhB,kBAAkB;EACjB,MAAM,iBAAiB,MAAKA,OAAQ;AACpC,MAAI,CAAC,eACJ,OAAM,IAAI,MAAM,gDAAgD;AAEjE,SAAO"}
1
+ {"version":3,"file":"marginAdmin.mjs","names":["marginRegistryMoveCalls.mintMaintainerCap","#config","#marginAdminCap","marginRegistryMoveCalls.registerDeepbookPool","marginRegistryMoveCalls.enableDeepbookPool","marginRegistryMoveCalls.disableDeepbookPool","marginRegistryMoveCalls.updateRiskParams","marginRegistryMoveCalls.setPriceTolerance","marginRegistryMoveCalls.setMaxPriceAge","marginRegistryMoveCalls.setMaxOrderTtl","marginRegistryMoveCalls.setMinOpenRiskRatio","marginRegistryMoveCalls.addConfig","marginRegistryMoveCalls.removeConfig","marginRegistryMoveCalls.enableVersion","marginRegistryMoveCalls.disableVersion","marginRegistryMoveCalls.newPoolConfig","marginRegistryMoveCalls.newPoolConfigWithLeverage","oracleMoveCalls.newCoinTypeDataFromCurrency","oracleMoveCalls.newPythConfig","marginRegistryMoveCalls.mintPauseCap","marginRegistryMoveCalls.revokePauseCap","marginRegistryMoveCalls.disableVersionPauseCap","marginPoolMoveCalls.adminWithdrawDefaultReferralFees"],"sources":["../../src/transactions/marginAdmin.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport type { TransactionArgument } from '@mysten/sui/transactions';\nimport type { PoolConfigParams } from '../types/index.js';\nimport { FLOAT_SCALAR } from '../utils/config.js';\nimport { convertRate } from '../utils/conversion.js';\nimport { hexToBytes } from '@noble/hashes/utils.js';\nimport * as marginRegistryMoveCalls from '../contracts/deepbook_margin/margin_registry.js';\nimport * as marginPoolMoveCalls from '../contracts/deepbook_margin/margin_pool.js';\nimport * as oracleMoveCalls from '../contracts/deepbook_margin/oracle.js';\n\n/**\n * MarginAdminContract class for managing admin actions.\n */\nexport class MarginAdminContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginAdminContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @returns The admin capability required for admin operations\n\t * @throws Error if the admin capability is not set\n\t */\n\t#marginAdminCap() {\n\t\tconst marginAdminCap = this.#config.marginAdminCap;\n\t\tif (!marginAdminCap) {\n\t\t\tthrow new Error('MARGIN_ADMIN_CAP environment variable not set');\n\t\t}\n\t\treturn marginAdminCap;\n\t}\n\n\t/**\n\t * @description Mint a maintainer cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintMaintainerCap = () => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tmarginRegistryMoveCalls.mintMaintainerCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.MARGIN_REGISTRY_ID, AdminCap: this.#marginAdminCap() },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Revoke a maintainer cap\n\t * @returns A function that takes a Transaction object\n\t */\n\trevokeMaintainerCap = (maintainerCapId: string) => (tx: Transaction) => {\n\t\t// NOTE: left as a positional moveCall (not codegen). The original passes\n\t\t// `maintainerCapId` as an object reference (`tx.object`), whereas the\n\t\t// generated binding encodes it as a pure `ID` value — migrating would change\n\t\t// the emitted PTB. Kept verbatim to stay byte-identical.\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::revoke_maintainer_cap`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\ttx.object(maintainerCapId),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Register a deepbook pool\n\t * @param {string} poolKey The key of the pool to be registered\n\t * @param {TransactionArgument} poolConfig The configuration of the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tregisterDeepbookPool =\n\t\t(poolKey: string, poolConfig: TransactionArgument) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\ttx.add(\n\t\t\t\tmarginRegistryMoveCalls.registerDeepbookPool({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tpoolConfig,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Enable a deepbook pool for margin trading\n\t * @param {string} poolKey The key of the pool to be enabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableDeepbookPool = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.enableDeepbookPool({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Disable a deepbook pool from margin trading\n\t * @param {string} poolKey The key of the pool to be disabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableDeepbookPool = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.disableDeepbookPool({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Update the risk parameters for a margin\n\t * @param {string} poolKey The key of the pool to be updated\n\t * @param {TransactionArgument} poolConfig The configuration of the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateRiskParams = (poolKey: string, poolConfig: TransactionArgument) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.updateRiskParams({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tpoolConfig,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the price deviation tolerance for a pool. `tolerance` is\n\t * in 9-decimal float scaling (1.0 = `FLOAT_SCALAR`); the SDK applies the\n\t * scaling, so callers pass a human-readable fraction (e.g. `0.1` for 10%).\n\t * Requires the pool's current price to have been initialized via\n\t * `PoolProxyContract.updateCurrentPrice` first.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} tolerance Tolerance as a fraction (e.g. 0.1 for 10%)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetPriceTolerance = (poolKey: string, tolerance: number | bigint) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.setPriceTolerance({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\ttolerance: convertRate(tolerance, FLOAT_SCALAR),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the maximum acceptable Pyth price age (in milliseconds)\n\t * for a pool. Requires the pool's current price to have been initialized\n\t * via `PoolProxyContract.updateCurrentPrice` first.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} maxAgeMs Max age in milliseconds (raw u64)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMaxPriceAge = (poolKey: string, maxAgeMs: number | bigint) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.setMaxPriceAge({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tmaxAgeMs,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the maximum lifetime (in milliseconds) of margin limit\n\t * orders for a pool. `pool_proxy::place_limit_order_v2` and\n\t * `place_reduce_only_limit_order_v2` clamp the user-supplied\n\t * `expire_timestamp` to at most `now + max_order_ttl_ms`, bounding margin\n\t * orders' exposure to stale-price exploitation.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} maxOrderTtlMs Max order TTL in milliseconds (raw u64)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMaxOrderTtl = (poolKey: string, maxOrderTtlMs: number | bigint) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.setMaxOrderTtl({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tmaxOrderTtlMs,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the minimum risk ratio required to open a new position on\n\t * a pool. Distinct from the borrow floor: this gates position opening, not\n\t * borrowing. Stored in 9-decimal float scaling (1.0 = `FLOAT_SCALAR`); the SDK\n\t * applies the scaling, so callers pass a human-readable ratio (e.g. `1.25`).\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} minOpenRiskRatio Minimum open risk ratio (e.g. 1.25)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMinOpenRiskRatio =\n\t\t(poolKey: string, minOpenRiskRatio: number | bigint) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\ttx.add(\n\t\t\t\tmarginRegistryMoveCalls.setMinOpenRiskRatio({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tminOpenRiskRatio: convertRate(minOpenRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Add the PythConfig to the margin registry\n\t * @param {Transaction} tx The transaction object\n\t * @param {TransactionArgument} config The config to be added\n\t * @returns A function that takes a Transaction object\n\t */\n\taddConfig = (config: TransactionArgument) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.addConfig({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tconfig,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::oracle::PythConfig`],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Remove the PythConfig from the margin registry\n\t * @param {Transaction} tx The transaction object\n\t * @returns A function that takes a Transaction object\n\t */\n\tremoveConfig = () => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.removeConfig({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.MARGIN_REGISTRY_ID, AdminCap: this.#marginAdminCap() },\n\t\t\t\ttypeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::oracle::PythConfig`],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Enable a specific version\n\t * @param {number} version The version to be enabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.enableVersion({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tversion,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Disable a specific version\n\t * @param {number} version The version to be disabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.disableVersion({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tversion,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Create a new pool config\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {PoolConfigParams} poolConfigParams The parameters for the pool config\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPoolConfig = (poolKey: string, poolConfigParams: PoolConfigParams) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst {\n\t\t\tminWithdrawRiskRatio,\n\t\t\tminBorrowRiskRatio,\n\t\t\tliquidationRiskRatio,\n\t\t\ttargetLiquidationRiskRatio,\n\t\t\tuserLiquidationReward,\n\t\t\tpoolLiquidationReward,\n\t\t} = poolConfigParams;\n\t\treturn tx.add(\n\t\t\tmarginRegistryMoveCalls.newPoolConfig({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tminWithdrawRiskRatio: convertRate(minWithdrawRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\tminBorrowRiskRatio: convertRate(minBorrowRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\tliquidationRiskRatio: convertRate(liquidationRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\ttargetLiquidationRiskRatio: convertRate(targetLiquidationRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\tuserLiquidationReward: convertRate(userLiquidationReward, FLOAT_SCALAR),\n\t\t\t\t\tpoolLiquidationReward: convertRate(poolLiquidationReward, FLOAT_SCALAR),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Create a new pool config with leverage\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} leverage The leverage for the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPoolConfigWithLeverage = (poolKey: string, leverage: number) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.newPoolConfigWithLeverage({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tleverage: convertRate(leverage, FLOAT_SCALAR),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Create a new coin type data\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {number} maxConfBps The maximum confidence interval in basis points\n\t * @param {number} maxEwmaDifferenceBps The maximum EWMA difference in basis points\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewCoinTypeData =\n\t\t(coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number) => (tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst feed = this.#config.getFeedId(coinKey);\n\t\t\tconst priceFeedInput = new Uint8Array(\n\t\t\t\thexToBytes(feed.startsWith('0x') ? feed.slice(2) : feed),\n\t\t\t);\n\t\t\treturn tx.add(\n\t\t\t\toracleMoveCalls.newCoinTypeDataFromCurrency({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tcurrency: coin.currencyId!,\n\t\t\t\t\t\tpriceFeedId: Array.from(priceFeedInput),\n\t\t\t\t\t\tmaxConfBps,\n\t\t\t\t\t\tmaxEwmaDifferenceBps,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Create a new Pyth config\n\t * @param {Array<{coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number}>} coinSetups The coins with their oracle config to be added to the Pyth config\n\t * @param {number} maxAgeSeconds The max age in seconds for the Pyth config\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPythConfig =\n\t\t(\n\t\t\tcoinSetups: Array<{ coinKey: string; maxConfBps: number; maxEwmaDifferenceBps: number }>,\n\t\t\tmaxAgeSeconds: number,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst coinTypeDataList = [];\n\t\t\tfor (const setup of coinSetups) {\n\t\t\t\tcoinTypeDataList.push(\n\t\t\t\t\tthis.newCoinTypeData(setup.coinKey, setup.maxConfBps, setup.maxEwmaDifferenceBps)(tx),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn tx.add(\n\t\t\t\toracleMoveCalls.newPythConfig({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tsetups: tx.makeMoveVec({\n\t\t\t\t\t\t\telements: coinTypeDataList,\n\t\t\t\t\t\t\ttype: `${this.#config.MARGIN_PACKAGE_ID}::oracle::CoinTypeData`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tmaxAgeSecs: maxAgeSeconds,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Mint a pause cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintPauseCap = () => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tmarginRegistryMoveCalls.mintPauseCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.MARGIN_REGISTRY_ID, AdminCap: this.#marginAdminCap() },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Revoke a pause cap\n\t * @param {string} pauseCapId The ID of the pause cap to revoke\n\t * @returns A function that takes a Transaction object\n\t */\n\trevokePauseCap = (pauseCapId: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.revokePauseCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpauseCapId,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Disable a version using pause cap\n\t * @param {number} version The version to disable\n\t * @param {string} pauseCapId The ID of the pause cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersionPauseCap = (version: number, pauseCapId: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.disableVersionPauseCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tversion,\n\t\t\t\t\tpauseCap: pauseCapId,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Withdraw the default referral fees (admin only)\n\t * The default referral at 0x0 doesn't have a SupplyReferral object\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @returns A function that takes a Transaction object and returns a Coin<Asset>\n\t */\n\tadminWithdrawDefaultReferralFees = (coinKey: string) => (tx: Transaction) => {\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.add(\n\t\t\tmarginPoolMoveCalls.adminWithdrawDefaultReferralFees({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: marginPool.address,\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [coin.type],\n\t\t\t}),\n\t\t);\n\t};\n}\n"],"mappings":";;;;;;;;;;;AAkBA,IAAa,sBAAb,MAAiC;CAChC;;;;CAKA,YAAY,QAAwB;kCAoBT,OAAoB;AAC9C,UAA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UAA6B,OAAA,UAAiB,MAAA,cAC/D,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;EADf;;;;;;;;EAwBF,aAAA,GACE,OAAA,UAAiB,cAAA,UAAwB,OAAA,UAAiB,WAAA,eAC1D,EAAA,EAAI,WAAA;EADa;;;;;;;;EA0CnB,cAAA,GACE,OAAA,UAAiB,cAAA,UAAwB,OAAA,UAAiB,WAAA,eAC1D,EAAA,EAAI,WAAA;EADsD;;;;;;EA0C5D,OAAA,GAAW,OAAA,UAAiB,OAAA,cAAqB,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;AAAA"}
1
+ {"version":3,"file":"marginLiquidations.d.mts","names":[],"sources":["../../src/transactions/marginLiquidations.ts"],"mappings":";;;;;;;;cAYa,0BAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EAmEd;;;;;EA5CN,sBAAA,GAA0B,mBAAA,cAAiC,EAAA,EAAI,WAAA;EAyJC;;;;;;;;EAxIhE,OAAA,GACE,OAAA,UAAiB,mBAAA,UAA6B,OAAA,UAAiB,MAAA,cAC/D,EAAA,EAAI,WAAA;EAnBqD;;;;;;;;EA0C3D,QAAA,GACE,OAAA,UAAiB,mBAAA,UAA6B,OAAA,UAAiB,MAAA,cAC/D,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;EADf;;;;;;;;EAwBF,aAAA,GACE,OAAA,UAAiB,cAAA,UAAwB,OAAA,UAAiB,WAAA,eAC1D,EAAA,EAAI,WAAA;EADa;;;;;;;;EA0CnB,cAAA,GACE,OAAA,UAAiB,cAAA,UAAwB,OAAA,UAAiB,WAAA,eAC1D,EAAA,EAAI,WAAA;EADsD;;;;;;EA0C5D,OAAA,GAAW,OAAA,UAAiB,OAAA,cAAqB,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;AAAA"}
@@ -1,5 +1,5 @@
1
1
  import { convertQuantity } from "../utils/conversion.mjs";
2
- import { balance, createLiquidationVault, deposit, liquidateBase, liquidateQuote, withdraw } from "../contracts/margin_liquidation/liquidation_vault.mjs";
2
+ import { balance, createLiquidationVault, deposit, liquidateBaseUpgraded, liquidateQuoteUpgraded, withdraw } from "../contracts/margin_liquidation/liquidation_vault.mjs";
3
3
  import { coinWithBalance } from "@mysten/sui/transactions";
4
4
 
5
5
  //#region src/transactions/marginLiquidations.ts
@@ -53,14 +53,14 @@ var MarginLiquidationsContract = class {
53
53
  const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
54
54
  const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
55
55
  const repayAmountArg = repayAmount !== void 0 ? tx.pure.option("u64", convertQuantity(repayAmount, baseCoin.scalar)) : tx.pure.option("u64", null);
56
- tx.add(liquidateBase({
56
+ tx.add(this.#liquidateBaseCall({
57
57
  package: this.#config.LIQUIDATION_PACKAGE_ID,
58
58
  arguments: {
59
59
  self: vaultId,
60
60
  marginManager: managerAddress,
61
61
  registry: this.#config.MARGIN_REGISTRY_ID,
62
- baseOracle: baseCoin.priceInfoObjectId,
63
- quoteOracle: quoteCoin.priceInfoObjectId,
62
+ baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
63
+ quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
64
64
  baseMarginPool: baseMarginPool.address,
65
65
  quoteMarginPool: quoteMarginPool.address,
66
66
  pool: pool.address,
@@ -76,14 +76,14 @@ var MarginLiquidationsContract = class {
76
76
  const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
77
77
  const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
78
78
  const repayAmountArg = repayAmount !== void 0 ? tx.pure.option("u64", convertQuantity(repayAmount, quoteCoin.scalar)) : tx.pure.option("u64", null);
79
- tx.add(liquidateQuote({
79
+ tx.add(this.#liquidateQuoteCall({
80
80
  package: this.#config.LIQUIDATION_PACKAGE_ID,
81
81
  arguments: {
82
82
  self: vaultId,
83
83
  marginManager: managerAddress,
84
84
  registry: this.#config.MARGIN_REGISTRY_ID,
85
- baseOracle: baseCoin.priceInfoObjectId,
86
- quoteOracle: quoteCoin.priceInfoObjectId,
85
+ baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
86
+ quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
87
87
  baseMarginPool: baseMarginPool.address,
88
88
  quoteMarginPool: quoteMarginPool.address,
89
89
  pool: pool.address,
@@ -102,6 +102,18 @@ var MarginLiquidationsContract = class {
102
102
  };
103
103
  this.#config = config;
104
104
  }
105
+ /**
106
+ * The oracle-taking liquidation entrypoints. Unlike the margin package,
107
+ * `margin_liquidation` puts the upgraded entries in the same module as parallel
108
+ * functions rather than in a parallel module, so these name a function rather than a
109
+ * namespace. The vault's own deposit/withdraw/balance take no oracle and are unchanged.
110
+ */
111
+ get #liquidateBaseCall() {
112
+ return liquidateBaseUpgraded;
113
+ }
114
+ get #liquidateQuoteCall() {
115
+ return liquidateQuoteUpgraded;
116
+ }
105
117
  };
106
118
 
107
119
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"marginLiquidations.mjs","names":["liquidationVaultMoveCalls.createLiquidationVault","#config","liquidationVaultMoveCalls.deposit","liquidationVaultMoveCalls.withdraw","liquidationVaultMoveCalls.liquidateBase","liquidationVaultMoveCalls.liquidateQuote","liquidationVaultMoveCalls.balance"],"sources":["../../src/transactions/marginLiquidations.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport type { Transaction } from '@mysten/sui/transactions';\nimport { coinWithBalance } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { convertQuantity } from '../utils/conversion.js';\nimport * as liquidationVaultMoveCalls from '../contracts/margin_liquidation/liquidation_vault.js';\n\n/**\n * MarginLiquidationsContract class for managing LiquidationVault operations.\n */\nexport class MarginLiquidationsContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginLiquidationsContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @description Create a new liquidation vault\n\t * @param {string} liquidationAdminCap The liquidation admin cap object ID\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateLiquidationVault = (liquidationAdminCap: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tliquidationVaultMoveCalls.createLiquidationVault({\n\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\targuments: { LiquidationCap: liquidationAdminCap },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Deposit coins into a liquidation vault\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} liquidationAdminCap The liquidation admin cap object ID\n\t * @param {string} coinKey The key to identify the coin type\n\t * @param {number} amount The amount to deposit\n\t * @returns A function that takes a Transaction object\n\t */\n\tdeposit =\n\t\t(vaultId: string, liquidationAdminCap: string, coinKey: string, amount: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst depositCoin = coinWithBalance({\n\t\t\t\ttype: coin.type,\n\t\t\t\tbalance: convertQuantity(amount, coin.scalar),\n\t\t\t});\n\t\t\ttx.add(\n\t\t\t\tliquidationVaultMoveCalls.deposit({\n\t\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\t\targuments: { self: vaultId, LiquidationCap: liquidationAdminCap, coin: depositCoin },\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Withdraw coins from a liquidation vault\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} liquidationAdminCap The liquidation admin cap object ID\n\t * @param {string} coinKey The key to identify the coin type\n\t * @param {number} amount The amount to withdraw\n\t * @returns A function that takes a Transaction object and returns the withdrawn coin\n\t */\n\twithdraw =\n\t\t(vaultId: string, liquidationAdminCap: string, coinKey: string, amount: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\treturn tx.add(\n\t\t\t\tliquidationVaultMoveCalls.withdraw({\n\t\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: vaultId,\n\t\t\t\t\t\tLiquidationCap: liquidationAdminCap,\n\t\t\t\t\t\tamount: convertQuantity(amount, coin.scalar),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Liquidate a margin manager by repaying base debt\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} managerAddress The margin manager address to liquidate\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} [repayAmount] The amount to repay (in base asset units), or undefined for full liquidation\n\t * @returns A function that takes a Transaction object\n\t */\n\tliquidateBase =\n\t\t(vaultId: string, managerAddress: string, poolKey: string, repayAmount?: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\n\t\t\t// Build the Option arg first so its pure input registers ahead of the\n\t\t\t// object inputs (matches the original positional ordering — byte-identical).\n\t\t\tconst repayAmountArg =\n\t\t\t\trepayAmount !== undefined\n\t\t\t\t\t? tx.pure.option('u64', convertQuantity(repayAmount, baseCoin.scalar))\n\t\t\t\t\t: tx.pure.option('u64', null);\n\n\t\t\ttx.add(\n\t\t\t\tliquidationVaultMoveCalls.liquidateBase({\n\t\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: vaultId,\n\t\t\t\t\t\tmarginManager: managerAddress,\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tbaseOracle: baseCoin.priceInfoObjectId!,\n\t\t\t\t\t\tquoteOracle: quoteCoin.priceInfoObjectId!,\n\t\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\trepayAmount: repayAmountArg,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Liquidate a margin manager by repaying quote debt\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} managerAddress The margin manager address to liquidate\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} [repayAmount] The amount to repay (in quote asset units), or undefined for full liquidation\n\t * @returns A function that takes a Transaction object\n\t */\n\tliquidateQuote =\n\t\t(vaultId: string, managerAddress: string, poolKey: string, repayAmount?: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\n\t\t\t// Build the Option arg first so its pure input registers ahead of the\n\t\t\t// object inputs (matches the original positional ordering — byte-identical).\n\t\t\tconst repayAmountArg =\n\t\t\t\trepayAmount !== undefined\n\t\t\t\t\t? tx.pure.option('u64', convertQuantity(repayAmount, quoteCoin.scalar))\n\t\t\t\t\t: tx.pure.option('u64', null);\n\n\t\t\ttx.add(\n\t\t\t\tliquidationVaultMoveCalls.liquidateQuote({\n\t\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: vaultId,\n\t\t\t\t\t\tmarginManager: managerAddress,\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tbaseOracle: baseCoin.priceInfoObjectId!,\n\t\t\t\t\t\tquoteOracle: quoteCoin.priceInfoObjectId!,\n\t\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\trepayAmount: repayAmountArg,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t// === Read-Only Functions ===\n\n\t/**\n\t * @description Get the balance of a specific coin type in the liquidation vault\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} coinKey The key to identify the coin type\n\t * @returns A function that takes a Transaction object\n\t */\n\tbalance = (vaultId: string, coinKey: string) => (tx: Transaction) => {\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\treturn tx.add(\n\t\t\tliquidationVaultMoveCalls.balance({\n\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\targuments: { self: vaultId },\n\t\t\t\ttypeArguments: [coin.type],\n\t\t\t}),\n\t\t);\n\t};\n}\n"],"mappings":";;;;;;;;AAYA,IAAa,6BAAb,MAAwC;CACvC;;;;CAKA,YAAY,QAAwB;iCASV,yBAAiC,OAAoB;AAC9E,MAAG,IACFA,uBAAiD;IAChD,SAAS,MAAKC,OAAQ;IACtB,WAAW,EAAE,gBAAgB,qBAAqB;IAClD,CAAC,CACF;;kBAYA,SAAiB,qBAA6B,SAAiB,YAC/D,OAAoB;GACpB,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;GAC1C,MAAM,cAAc,gBAAgB;IACnC,MAAM,KAAK;IACX,SAAS,gBAAgB,QAAQ,KAAK,OAAO;IAC7C,CAAC;AACF,MAAG,IACFC,QAAkC;IACjC,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AAW,MAAKA,OAAQ,QAAQ,KAAK,SAAS;GACpD,MAAM,YAAY,MAAKA,OAAQ,QAAQ,KAAK,UAAU;GACtD,MAAM,iBAAiB,MAAKA,OAAQ,cAAc,KAAK,SAAS;GAChE,MAAM,kBAAkB,MAAKA,OAAQ,cAAc,KAAK,UAAU;GAIlE,MAAM,iBACL,gBAAgB,SACb,GAAG,KAAK,OAAO,OAAO,gBAAgB,aAAa,UAAU,OAAO,CAAC,GACrE,GAAG,KAAK,OAAO,OAAO,KAAK;AAE/B,MAAG,IACFI,eAAyC;IACxC,SAAS,MAAKJ,OAAQ;IACtB,WAAW;KACV,MAAM;KACN,eAAe;KACf,UAAU,MAAKA,OAAQ;KACvB,YAAY,SAAS;KACrB,aAAa,UAAU;KACvB,gBAAgB,eAAe;KAC/B,iBAAiB,gBAAgB;KACjC,MAAM,KAAK;KACX,aAAa;KACb;IACD,eAAe,CAAC,SAAS,MAAM,UAAU,KAAK;IAC9C,CAAC,CACF;;kBAWQ,SAAiB,aAAqB,OAAoB;GACpE,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;AAC1C,UAAO,GAAG,IACTK,QAAkC;IACjC,SAAS,MAAKL,OAAQ;IACtB,WAAW,EAAE,MAAM,SAAS;IAC5B,eAAe,CAAC,KAAK,KAAK;IAC1B,CAAC,CACF;;AAzKD,QAAKA,SAAU"}
1
+ {"version":3,"file":"marginLiquidations.mjs","names":["liquidationVaultMoveCalls.createLiquidationVault","#config","liquidationVaultMoveCalls.deposit","liquidationVaultMoveCalls.withdraw","#liquidateBaseCall","#liquidateQuoteCall","liquidationVaultMoveCalls.balance","liquidationVaultMoveCalls.liquidateBaseUpgraded","liquidationVaultMoveCalls.liquidateQuoteUpgraded"],"sources":["../../src/transactions/marginLiquidations.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport type { Transaction } from '@mysten/sui/transactions';\nimport { coinWithBalance } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { convertQuantity } from '../utils/conversion.js';\nimport * as liquidationVaultMoveCalls from '../contracts/margin_liquidation/liquidation_vault.js';\n\n/**\n * MarginLiquidationsContract class for managing LiquidationVault operations.\n */\nexport class MarginLiquidationsContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginLiquidationsContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * The oracle-taking liquidation entrypoints. Unlike the margin package,\n\t * `margin_liquidation` puts the upgraded entries in the same module as parallel\n\t * functions rather than in a parallel module, so these name a function rather than a\n\t * namespace. The vault's own deposit/withdraw/balance take no oracle and are unchanged.\n\t */\n\tget #liquidateBaseCall() {\n\t\treturn liquidationVaultMoveCalls.liquidateBaseUpgraded;\n\t}\n\n\tget #liquidateQuoteCall() {\n\t\treturn liquidationVaultMoveCalls.liquidateQuoteUpgraded;\n\t}\n\n\t/**\n\t * @description Create a new liquidation vault\n\t * @param {string} liquidationAdminCap The liquidation admin cap object ID\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateLiquidationVault = (liquidationAdminCap: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tliquidationVaultMoveCalls.createLiquidationVault({\n\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\targuments: { LiquidationCap: liquidationAdminCap },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Deposit coins into a liquidation vault\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} liquidationAdminCap The liquidation admin cap object ID\n\t * @param {string} coinKey The key to identify the coin type\n\t * @param {number} amount The amount to deposit\n\t * @returns A function that takes a Transaction object\n\t */\n\tdeposit =\n\t\t(vaultId: string, liquidationAdminCap: string, coinKey: string, amount: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst depositCoin = coinWithBalance({\n\t\t\t\ttype: coin.type,\n\t\t\t\tbalance: convertQuantity(amount, coin.scalar),\n\t\t\t});\n\t\t\ttx.add(\n\t\t\t\tliquidationVaultMoveCalls.deposit({\n\t\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\t\targuments: { self: vaultId, LiquidationCap: liquidationAdminCap, coin: depositCoin },\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Withdraw coins from a liquidation vault\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} liquidationAdminCap The liquidation admin cap object ID\n\t * @param {string} coinKey The key to identify the coin type\n\t * @param {number} amount The amount to withdraw\n\t * @returns A function that takes a Transaction object and returns the withdrawn coin\n\t */\n\twithdraw =\n\t\t(vaultId: string, liquidationAdminCap: string, coinKey: string, amount: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\treturn tx.add(\n\t\t\t\tliquidationVaultMoveCalls.withdraw({\n\t\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: vaultId,\n\t\t\t\t\t\tLiquidationCap: liquidationAdminCap,\n\t\t\t\t\t\tamount: convertQuantity(amount, coin.scalar),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Liquidate a margin manager by repaying base debt\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} managerAddress The margin manager address to liquidate\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} [repayAmount] The amount to repay (in base asset units), or undefined for full liquidation\n\t * @returns A function that takes a Transaction object\n\t */\n\tliquidateBase =\n\t\t(vaultId: string, managerAddress: string, poolKey: string, repayAmount?: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\n\t\t\t// Build the Option arg first so its pure input registers ahead of the\n\t\t\t// object inputs (matches the original positional ordering — byte-identical).\n\t\t\tconst repayAmountArg =\n\t\t\t\trepayAmount !== undefined\n\t\t\t\t\t? tx.pure.option('u64', convertQuantity(repayAmount, baseCoin.scalar))\n\t\t\t\t\t: tx.pure.option('u64', null);\n\n\t\t\ttx.add(\n\t\t\t\tthis.#liquidateBaseCall({\n\t\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: vaultId,\n\t\t\t\t\t\tmarginManager: managerAddress,\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tbaseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),\n\t\t\t\t\t\tquoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),\n\t\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\trepayAmount: repayAmountArg,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Liquidate a margin manager by repaying quote debt\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} managerAddress The margin manager address to liquidate\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} [repayAmount] The amount to repay (in quote asset units), or undefined for full liquidation\n\t * @returns A function that takes a Transaction object\n\t */\n\tliquidateQuote =\n\t\t(vaultId: string, managerAddress: string, poolKey: string, repayAmount?: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\n\t\t\t// Build the Option arg first so its pure input registers ahead of the\n\t\t\t// object inputs (matches the original positional ordering — byte-identical).\n\t\t\tconst repayAmountArg =\n\t\t\t\trepayAmount !== undefined\n\t\t\t\t\t? tx.pure.option('u64', convertQuantity(repayAmount, quoteCoin.scalar))\n\t\t\t\t\t: tx.pure.option('u64', null);\n\n\t\t\ttx.add(\n\t\t\t\tthis.#liquidateQuoteCall({\n\t\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: vaultId,\n\t\t\t\t\t\tmarginManager: managerAddress,\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tbaseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),\n\t\t\t\t\t\tquoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),\n\t\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\trepayAmount: repayAmountArg,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t// === Read-Only Functions ===\n\n\t/**\n\t * @description Get the balance of a specific coin type in the liquidation vault\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} coinKey The key to identify the coin type\n\t * @returns A function that takes a Transaction object\n\t */\n\tbalance = (vaultId: string, coinKey: string) => (tx: Transaction) => {\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\treturn tx.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AgB;KACjC,MAAM,KAAK;KACX,aAAa;KACb;IACD,eAAe,CAAC,SAAS,MAAM,UAAU,KAAK;IAC9C,CAAC,CACF;;kBAWQ,SAAiB,aAAqB,OAAoB;GACpE,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;AAC1C,UAAO,GAAG,IACTK,QAAkC;IACjC,SAAS,MAAKL,OAAQ;IACtB,WAAW,EAAE,MAAM,SAAS;IAC5B,eAAe,CAAC,KAAK,KAAK;IAC1B,CAAC,CACF;;AAvLD,QAAKA,SAAU;;;;;;;;CAShB,KAAIG,oBAAqB;AACxB,SAAOG;;CAGR,KAAIF,qBAAsB;AACzB,SAAOG"}
@@ -1,6 +1,6 @@
1
1
  import { InterestConfigParams, MarginPoolConfigParams } from "../types/index.mjs";
2
2
  import { DeepBookConfig } from "../utils/config.mjs";
3
- import * as _mysten_sui_transactions38 from "@mysten/sui/transactions";
3
+ import * as _mysten_sui_transactions32 from "@mysten/sui/transactions";
4
4
  import { Transaction, TransactionArgument, TransactionObjectArgument } from "@mysten/sui/transactions";
5
5
 
6
6
  //#region src/transactions/marginMaintainer.d.ts
@@ -27,27 +27,27 @@ declare class MarginMaintainerContract {
27
27
  * @param {InterestConfigParams} interestConfig The configuration for the interest
28
28
  * @returns A function that takes a Transaction object
29
29
  */
30
- newProtocolConfig: (coinKey: string, marginPoolConfig: MarginPoolConfigParams, interestConfig: InterestConfigParams) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
30
+ newProtocolConfig: (coinKey: string, marginPoolConfig: MarginPoolConfigParams, interestConfig: InterestConfigParams) => (tx: Transaction) => _mysten_sui_transactions32.TransactionResult;
31
31
  /**
32
32
  * @description Create a new margin pool config
33
33
  * @param {string} coinKey The key to identify the coin
34
34
  * @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool
35
35
  * @returns A function that takes a Transaction object
36
36
  */
37
- newMarginPoolConfig: (coinKey: string, marginPoolConfig: MarginPoolConfigParams) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
37
+ newMarginPoolConfig: (coinKey: string, marginPoolConfig: MarginPoolConfigParams) => (tx: Transaction) => _mysten_sui_transactions32.TransactionResult;
38
38
  /**
39
39
  * @description Create a new margin pool config with rate limit
40
40
  * @param {string} coinKey The key to identify the coin
41
41
  * @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool with rate limit
42
42
  * @returns A function that takes a Transaction object
43
43
  */
44
- newMarginPoolConfigWithRateLimit: (coinKey: string, marginPoolConfig: Required<Pick<MarginPoolConfigParams, "rateLimitCapacity" | "rateLimitRefillRatePerMs" | "rateLimitEnabled">> & MarginPoolConfigParams) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
44
+ newMarginPoolConfigWithRateLimit: (coinKey: string, marginPoolConfig: Required<Pick<MarginPoolConfigParams, "rateLimitCapacity" | "rateLimitRefillRatePerMs" | "rateLimitEnabled">> & MarginPoolConfigParams) => (tx: Transaction) => _mysten_sui_transactions32.TransactionResult;
45
45
  /**
46
46
  * @description Create a new interest config
47
47
  * @param {InterestConfigParams} interestConfig The configuration for the interest
48
48
  * @returns A function that takes a Transaction object
49
49
  */
50
- newInterestConfig: (interestConfig: InterestConfigParams) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
50
+ newInterestConfig: (interestConfig: InterestConfigParams) => (tx: Transaction) => _mysten_sui_transactions32.TransactionResult;
51
51
  /**
52
52
  * @description Enable a deepbook pool for loan
53
53
  * @param {string} deepbookPoolKey The key to identify the deepbook pool
@@ -1,6 +1,6 @@
1
1
  import { DepositDuringInitParams, DepositParams } from "../types/index.mjs";
2
2
  import { DeepBookConfig } from "../utils/config.mjs";
3
- import * as _mysten_sui_transactions42 from "@mysten/sui/transactions";
3
+ import * as _mysten_sui_transactions45 from "@mysten/sui/transactions";
4
4
  import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
5
5
 
6
6
  //#region src/transactions/marginManager.d.ts
@@ -88,49 +88,49 @@ declare class MarginManagerContract {
88
88
  * @param {number} amount The amount to withdraw
89
89
  * @returns A function that takes a Transaction object
90
90
  */
91
- withdrawBase: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
91
+ withdrawBase: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
92
92
  /**
93
93
  * @description Withdraw quote from a margin manager
94
94
  * @param {string} managerKey The key to identify the manager
95
95
  * @param {number} amount The amount to withdraw
96
96
  * @returns A function that takes a Transaction object
97
97
  */
98
- withdrawQuote: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
98
+ withdrawQuote: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
99
99
  /**
100
100
  * @description Withdraw deep from a margin manager
101
101
  * @param {string} managerKey The key to identify the manager
102
102
  * @param {number} amount The amount to withdraw
103
103
  * @returns A function that takes a Transaction object
104
104
  */
105
- withdrawDeep: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
105
+ withdrawDeep: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
106
106
  /**
107
107
  * @description Borrow base from a margin manager
108
108
  * @param {string} managerKey The key to identify the manager
109
109
  * @param {number} amount The amount to borrow
110
110
  * @returns A function that takes a Transaction object
111
111
  */
112
- borrowBase: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
112
+ borrowBase: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
113
113
  /**
114
114
  * @description Borrow quote from a margin manager
115
115
  * @param {string} managerKey The key to identify the manager
116
116
  * @param {number} amount The amount to borrow
117
117
  * @returns A function that takes a Transaction object
118
118
  */
119
- borrowQuote: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
119
+ borrowQuote: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
120
120
  /**
121
121
  * @description Repay base from a margin manager
122
122
  * @param {string} managerKey The key to identify the manager
123
123
  * @param {number} amount The amount to repay
124
124
  * @returns A function that takes a Transaction object
125
125
  */
126
- repayBase: (managerKey: string, amount?: number) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
126
+ repayBase: (managerKey: string, amount?: number) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
127
127
  /**
128
128
  * @description Repay quote from a margin manager
129
129
  * @param {string} managerKey The key to identify the manager
130
130
  * @param {number} amount The amount to repay
131
131
  * @returns A function that takes a Transaction object
132
132
  */
133
- repayQuote: (managerKey: string, amount?: number) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
133
+ repayQuote: (managerKey: string, amount?: number) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
134
134
  /**
135
135
  * @description Liquidate a margin manager
136
136
  * @param {string} managerAddress The address of the manager to liquidate
@@ -139,7 +139,7 @@ declare class MarginManagerContract {
139
139
  * @param {TransactionArgument} repayCoin The coin to repay
140
140
  * @returns A function that takes a Transaction object
141
141
  */
142
- liquidate: (managerAddress: string, poolKey: string, debtIsBase: boolean, repayCoin: TransactionArgument) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
142
+ liquidate: (managerAddress: string, poolKey: string, debtIsBase: boolean, repayCoin: TransactionArgument) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
143
143
  /**
144
144
  * @description Set the referral for a margin manager (DeepBookPoolReferral)
145
145
  * @param {string} managerKey The key to identify the margin manager
@@ -160,63 +160,63 @@ declare class MarginManagerContract {
160
160
  * @param {string} marginManagerId The ID of the margin manager
161
161
  * @returns A function that takes a Transaction object
162
162
  */
163
- ownerByPoolKey: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
163
+ ownerByPoolKey: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
164
164
  /**
165
165
  * @description Get the DeepBook pool ID associated with a margin manager
166
166
  * @param {string} poolKey The key to identify the pool
167
167
  * @param {string} marginManagerId The ID of the margin manager
168
168
  * @returns A function that takes a Transaction object
169
169
  */
170
- deepbookPool: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
170
+ deepbookPool: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
171
171
  /**
172
172
  * @description Get the margin pool ID (if any) associated with a margin manager
173
173
  * @param {string} poolKey The key to identify the pool
174
174
  * @param {string} marginManagerId The ID of the margin manager
175
175
  * @returns A function that takes a Transaction object
176
176
  */
177
- marginPoolId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
177
+ marginPoolId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
178
178
  /**
179
179
  * @description Get borrowed shares for both base and quote assets
180
180
  * @param {string} poolKey The key to identify the pool
181
181
  * @param {string} marginManagerId The ID of the margin manager
182
182
  * @returns A function that takes a Transaction object
183
183
  */
184
- borrowedShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
184
+ borrowedShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
185
185
  /**
186
186
  * @description Get borrowed base shares
187
187
  * @param {string} poolKey The key to identify the pool
188
188
  * @param {string} marginManagerId The ID of the margin manager
189
189
  * @returns A function that takes a Transaction object
190
190
  */
191
- borrowedBaseShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
191
+ borrowedBaseShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
192
192
  /**
193
193
  * @description Get borrowed quote shares
194
194
  * @param {string} poolKey The key to identify the pool
195
195
  * @param {string} marginManagerId The ID of the margin manager
196
196
  * @returns A function that takes a Transaction object
197
197
  */
198
- borrowedQuoteShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
198
+ borrowedQuoteShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
199
199
  /**
200
200
  * @description Check if margin manager has base asset debt
201
201
  * @param {string} poolKey The key to identify the pool
202
202
  * @param {string} marginManagerId The ID of the margin manager
203
203
  * @returns A function that takes a Transaction object
204
204
  */
205
- hasBaseDebt: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
205
+ hasBaseDebt: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
206
206
  /**
207
207
  * @description Get the balance manager ID for a margin manager
208
208
  * @param {string} poolKey The key to identify the pool
209
209
  * @param {string} marginManagerId The ID of the margin manager
210
210
  * @returns A function that takes a Transaction object
211
211
  */
212
- balanceManager: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
212
+ balanceManager: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
213
213
  /**
214
214
  * @description Calculate assets (base and quote) for a margin manager
215
215
  * @param {string} poolKey The key to identify the pool
216
216
  * @param {string} marginManagerId The ID of the margin manager
217
217
  * @returns A function that takes a Transaction object
218
218
  */
219
- calculateAssets: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
219
+ calculateAssets: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
220
220
  /**
221
221
  * @description Calculate debts (base and quote) for a margin manager
222
222
  * @param {string} poolKey The key to identify the pool
@@ -224,7 +224,7 @@ declare class MarginManagerContract {
224
224
  * @param {string} marginManagerId The ID of the margin manager
225
225
  * @returns A function that takes a Transaction object
226
226
  */
227
- calculateDebts: (poolKey: string, coinKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
227
+ calculateDebts: (poolKey: string, coinKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
228
228
  /**
229
229
  * @description Get comprehensive state information for a margin manager
230
230
  * @param {string} poolKey The key to identify the pool
@@ -234,28 +234,28 @@ declare class MarginManagerContract {
234
234
  * base_debt, quote_debt, base_pyth_price, base_pyth_decimals,
235
235
  * quote_pyth_price, quote_pyth_decimals)
236
236
  */
237
- managerState: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
237
+ managerState: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
238
238
  /**
239
239
  * @description Get the base asset balance of a margin manager
240
240
  * @param {string} poolKey The key to identify the pool
241
241
  * @param {string} marginManagerId The ID of the margin manager
242
242
  * @returns A function that takes a Transaction object
243
243
  */
244
- baseBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
244
+ baseBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
245
245
  /**
246
246
  * @description Get the quote asset balance of a margin manager
247
247
  * @param {string} poolKey The key to identify the pool
248
248
  * @param {string} marginManagerId The ID of the margin manager
249
249
  * @returns A function that takes a Transaction object
250
250
  */
251
- quoteBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
251
+ quoteBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
252
252
  /**
253
253
  * @description Get the DEEP token balance of a margin manager
254
254
  * @param {string} poolKey The key to identify the pool
255
255
  * @param {string} marginManagerId The ID of the margin manager
256
256
  * @returns A function that takes a Transaction object
257
257
  */
258
- deepBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
258
+ deepBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
259
259
  /**
260
260
  * @description Get the underlying BalanceManager ID for a margin manager.
261
261
  * Returns an ID (not a `&BalanceManager`), so it composes in PTBs unlike
@@ -264,28 +264,28 @@ declare class MarginManagerContract {
264
264
  * @param {string} marginManagerId The ID of the margin manager
265
265
  * @returns A function that takes a Transaction object
266
266
  */
267
- balanceManagerId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
267
+ balanceManagerId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
268
268
  /**
269
269
  * @description Get the BalanceManager referral ID for a pool (Option<ID>).
270
270
  * @param {string} poolKey The key to identify the pool
271
271
  * @param {string} marginManagerId The ID of the margin manager
272
272
  * @returns A function that takes a Transaction object
273
273
  */
274
- getBalanceManagerReferralId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
274
+ getBalanceManagerReferralId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
275
275
  /**
276
276
  * @description Check if the margin manager's account exists in the pool.
277
277
  * @param {string} poolKey The key to identify the pool
278
278
  * @param {string} marginManagerId The ID of the margin manager
279
279
  * @returns A function that takes a Transaction object
280
280
  */
281
- accountExists: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
281
+ accountExists: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
282
282
  /**
283
283
  * @description Get the pool account data for the margin manager.
284
284
  * @param {string} poolKey The key to identify the pool
285
285
  * @param {string} marginManagerId The ID of the margin manager
286
286
  * @returns A function that takes a Transaction object
287
287
  */
288
- account: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
288
+ account: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
289
289
  /**
290
290
  * @description Get the open order IDs for the margin manager's account in
291
291
  * the pool.
@@ -293,7 +293,7 @@ declare class MarginManagerContract {
293
293
  * @param {string} marginManagerId The ID of the margin manager
294
294
  * @returns A function that takes a Transaction object
295
295
  */
296
- accountOpenOrders: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
296
+ accountOpenOrders: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
297
297
  /**
298
298
  * @description Get full order details for the margin manager's account in
299
299
  * the pool.
@@ -301,7 +301,7 @@ declare class MarginManagerContract {
301
301
  * @param {string} marginManagerId The ID of the margin manager
302
302
  * @returns A function that takes a Transaction object
303
303
  */
304
- getAccountOrderDetails: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
304
+ getAccountOrderDetails: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
305
305
  /**
306
306
  * @description Get locked balances (base, quote, deep) for the margin
307
307
  * manager's account in the pool.
@@ -309,7 +309,7 @@ declare class MarginManagerContract {
309
309
  * @param {string} marginManagerId The ID of the margin manager
310
310
  * @returns A function that takes a Transaction object
311
311
  */
312
- lockedBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
312
+ lockedBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
313
313
  /**
314
314
  * @description Check whether a limit order can be placed given the
315
315
  * manager's current state.
@@ -322,7 +322,7 @@ declare class MarginManagerContract {
322
322
  * @param {number | bigint} expireTimestamp Order expiration timestamp (ms)
323
323
  * @returns A function that takes a Transaction object
324
324
  */
325
- canPlaceLimitOrder: (poolKey: string, marginManagerId: string, price: number | bigint, quantity: number | bigint, isBid: boolean, payWithDeep: boolean, expireTimestamp: number | bigint) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
325
+ canPlaceLimitOrder: (poolKey: string, marginManagerId: string, price: number | bigint, quantity: number | bigint, isBid: boolean, payWithDeep: boolean, expireTimestamp: number | bigint) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
326
326
  /**
327
327
  * @description Check whether a market order can be placed given the
328
328
  * manager's current state.
@@ -333,7 +333,7 @@ declare class MarginManagerContract {
333
333
  * @param {boolean} payWithDeep Whether to pay fees in DEEP
334
334
  * @returns A function that takes a Transaction object
335
335
  */
336
- canPlaceMarketOrder: (poolKey: string, marginManagerId: string, quantity: number | bigint, isBid: boolean, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
336
+ canPlaceMarketOrder: (poolKey: string, marginManagerId: string, quantity: number | bigint, isBid: boolean, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
337
337
  }
338
338
  //#endregion
339
339
  export { MarginManagerContract };
@@ -1 +1 @@
1
- {"version":3,"file":"marginManager.d.mts","names":[],"sources":["../../src/transactions/marginManager.ts"],"mappings":";;;;;;;;;cAca,qBAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EAyDQ;;;;;EAhD5B,gBAAA,GAAoB,OAAA,cAAqB,EAAA,EAAI,WAAA;EA6G2B;;;;;EAvFxE,+BAAA,GAAmC,OAAA,cAAqB,EAAA,EAAI,WAAA;;;;;;;;;;EA6VD;;;;;;;EApU3D,kBAAA,GACE,OAAA,UAAiB,OAAA,EAAS,mBAAA,EAAqB,WAAA,EAAa,mBAAA,MAC5D,EAAA,EAAI,WAAA;EA4ZW;;;;;;;EAxYjB,qBAAA,GAAyB,UAAA,cAAwB,EAAA,EAAI,WAAA;EA4fwB;;;;;;EAxe7E,uBAAA,GAA2B,UAAA,cAAwB,EAAA,EAAI,WAAA;EAojBU;;;;;;EAhiBjE,2BAAA,GAA+B,MAAA,EAAQ,uBAAA,MAA6B,EAAA,EAAI,WAAA;EA2lBQ;;;;;EArjBhF,WAAA,GAAe,MAAA,EAAQ,aAAA,MAAmB,EAAA,EAAI,WAAA;EA6nB+B;;;;;EA5lB7E,YAAA,GAAgB,MAAA,EAAQ,aAAA,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