@mysten/deepbook-v3 1.6.7 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +69 -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/balance_manager.mjs.map +1 -1
  10. package/dist/contracts/deepbook/balances.d.mts +4 -4
  11. package/dist/contracts/deepbook/balances.d.mts.map +1 -1
  12. package/dist/contracts/deepbook/deep_price.d.mts +3 -3
  13. package/dist/contracts/deepbook/deep_price.d.mts.map +1 -1
  14. package/dist/contracts/deepbook/order.d.mts +12 -12
  15. package/dist/contracts/deepbook/pool.mjs.map +1 -1
  16. package/dist/contracts/deepbook/registry.mjs.map +1 -1
  17. package/dist/contracts/deepbook_margin/margin_manager.mjs +1 -319
  18. package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -1
  19. package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs +386 -0
  20. package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs.map +1 -0
  21. package/dist/contracts/deepbook_margin/margin_pool.mjs.map +1 -1
  22. package/dist/contracts/deepbook_margin/margin_registry.mjs.map +1 -1
  23. package/dist/contracts/deepbook_margin/oracle.mjs +9 -0
  24. package/dist/contracts/deepbook_margin/oracle.mjs.map +1 -1
  25. package/dist/contracts/deepbook_margin/pool_proxy.mjs +1 -383
  26. package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -1
  27. package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs +340 -0
  28. package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs.map +1 -0
  29. package/dist/contracts/deepbook_margin/protocol_config.mjs.map +1 -1
  30. package/dist/contracts/deepbook_margin/tpsl.mjs.map +1 -1
  31. package/dist/contracts/margin_liquidation/liquidation_vault.mjs +33 -17
  32. package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -1
  33. package/dist/index.d.mts +4 -3
  34. package/dist/index.mjs +2 -2
  35. package/dist/pyth/PriceServiceConnection.d.mts +18 -3
  36. package/dist/pyth/PriceServiceConnection.d.mts.map +1 -1
  37. package/dist/pyth/PriceServiceConnection.mjs +35 -4
  38. package/dist/pyth/PriceServiceConnection.mjs.map +1 -1
  39. package/dist/queries/priceFeedQueries.mjs +50 -18
  40. package/dist/queries/priceFeedQueries.mjs.map +1 -1
  41. package/dist/transactions/balanceManager.d.mts +12 -12
  42. package/dist/transactions/balanceManager.d.mts.map +1 -1
  43. package/dist/transactions/deepbook.d.mts +20 -20
  44. package/dist/transactions/deepbook.d.mts.map +1 -1
  45. package/dist/transactions/deepbookAdmin.d.mts +4 -4
  46. package/dist/transactions/marginAdmin.d.mts +7 -7
  47. package/dist/transactions/marginAdmin.d.mts.map +1 -1
  48. package/dist/transactions/marginAdmin.mjs +2 -2
  49. package/dist/transactions/marginAdmin.mjs.map +1 -1
  50. package/dist/transactions/marginLiquidations.d.mts.map +1 -1
  51. package/dist/transactions/marginLiquidations.mjs +19 -7
  52. package/dist/transactions/marginLiquidations.mjs.map +1 -1
  53. package/dist/transactions/marginMaintainer.d.mts +5 -5
  54. package/dist/transactions/marginManager.d.mts +32 -32
  55. package/dist/transactions/marginManager.d.mts.map +1 -1
  56. package/dist/transactions/marginManager.mjs +43 -34
  57. package/dist/transactions/marginManager.mjs.map +1 -1
  58. package/dist/transactions/marginPool.d.mts +18 -18
  59. package/dist/transactions/marginTPSL.d.mts +10 -10
  60. package/dist/transactions/marginTPSL.d.mts.map +1 -1
  61. package/dist/transactions/marginTPSL.mjs +19 -10
  62. package/dist/transactions/marginTPSL.mjs.map +1 -1
  63. package/dist/transactions/poolProxy.d.mts +8 -8
  64. package/dist/transactions/poolProxy.d.mts.map +1 -1
  65. package/dist/transactions/poolProxy.mjs +34 -27
  66. package/dist/transactions/poolProxy.mjs.map +1 -1
  67. package/dist/types/index.d.mts +16 -1
  68. package/dist/types/index.d.mts.map +1 -1
  69. package/dist/types/index.mjs.map +1 -1
  70. package/dist/utils/config.d.mts +30 -10
  71. package/dist/utils/config.d.mts.map +1 -1
  72. package/dist/utils/config.mjs +33 -4
  73. package/dist/utils/config.mjs.map +1 -1
  74. package/dist/utils/constants.d.mts +32 -1
  75. package/dist/utils/constants.d.mts.map +1 -1
  76. package/dist/utils/constants.mjs +55 -24
  77. package/dist/utils/constants.mjs.map +1 -1
  78. package/package.json +10 -10
  79. package/src/client.ts +9 -1
  80. package/src/contracts/deepbook/balance_manager.ts +1 -2
  81. package/src/contracts/deepbook/pool.ts +12 -24
  82. package/src/contracts/deepbook/registry.ts +1 -2
  83. package/src/contracts/deepbook_margin/margin_manager.ts +149 -28
  84. package/src/contracts/deepbook_margin/margin_manager_upgraded.ts +646 -0
  85. package/src/contracts/deepbook_margin/margin_pool.ts +2 -4
  86. package/src/contracts/deepbook_margin/margin_registry.ts +3 -6
  87. package/src/contracts/deepbook_margin/oracle.ts +59 -0
  88. package/src/contracts/deepbook_margin/pool_proxy.ts +597 -584
  89. package/src/contracts/deepbook_margin/pool_proxy_upgraded.ts +614 -0
  90. package/src/contracts/deepbook_margin/protocol_config.ts +1 -2
  91. package/src/contracts/deepbook_margin/tpsl.ts +1 -2
  92. package/src/contracts/margin_liquidation/liquidation_vault.ts +144 -4
  93. package/src/contracts/pyth/pyth.ts +2 -4
  94. package/src/index.ts +4 -0
  95. package/src/pyth/PriceServiceConnection.ts +69 -8
  96. package/src/queries/priceFeedQueries.ts +74 -24
  97. package/src/transactions/marginAdmin.ts +2 -4
  98. package/src/transactions/marginLiquidations.ts +20 -6
  99. package/src/transactions/marginManager.ts +43 -33
  100. package/src/transactions/marginTPSL.ts +19 -9
  101. package/src/transactions/poolProxy.ts +34 -30
  102. package/src/types/index.ts +17 -2
  103. package/src/utils/config.ts +69 -9
  104. package/src/utils/constants.ts +83 -26
@@ -1 +1 @@
1
- {"version":3,"file":"registry.mjs","names":["versioned.Versioned","vec_set.VecSet","bag.Bag","type_name.TypeName"],"sources":["../../../src/contracts/deepbook/registry.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/** Registry holds all created pools. */\n\nimport {\n\tMoveStruct,\n\tMoveTuple,\n\tnormalizeMoveArguments,\n\ttype RawTransactionArgument,\n} from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';\nimport * as versioned from './deps/sui/versioned.js';\nimport * as vec_set from './deps/sui/vec_set.js';\nimport * as bag from './deps/sui/bag.js';\nimport * as type_name from './deps/std/type_name.js';\nconst $moduleName = '@deepbook/core::registry';\nexport const REGISTRY = new MoveStruct({\n\tname: `${$moduleName}::REGISTRY`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const DeepbookAdminCap = new MoveStruct({\n\tname: `${$moduleName}::DeepbookAdminCap`,\n\tfields: {\n\t\tid: bcs.Address,\n\t},\n});\nexport const DeepbookCorePauseCap = new MoveStruct({\n\tname: `${$moduleName}::DeepbookCorePauseCap`,\n\tfields: {\n\t\tid: bcs.Address,\n\t},\n});\nexport const Registry = new MoveStruct({\n\tname: `${$moduleName}::Registry`,\n\tfields: {\n\t\tid: bcs.Address,\n\t\tinner: versioned.Versioned,\n\t},\n});\nexport const RegistryInner = new MoveStruct({\n\tname: `${$moduleName}::RegistryInner`,\n\tfields: {\n\t\tallowed_versions: vec_set.VecSet(bcs.u64()),\n\t\tpools: bag.Bag,\n\t\ttreasury_address: bcs.Address,\n\t},\n});\nexport const PoolKey = new MoveStruct({\n\tname: `${$moduleName}::PoolKey`,\n\tfields: {\n\t\tbase: type_name.TypeName,\n\t\tquote: type_name.TypeName,\n\t},\n});\nexport const StableCoinKey = new MoveStruct({\n\tname: `${$moduleName}::StableCoinKey`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const BalanceManagerKey = new MoveStruct({\n\tname: `${$moduleName}::BalanceManagerKey`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const AllowedPauseCapsKey = new MoveTuple({\n\tname: `${$moduleName}::AllowedPauseCapsKey`,\n\tfields: [bcs.bool()],\n});\nexport const AppKey = new MoveStruct({\n\tname: `${$moduleName}::AppKey<phantom App>`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const AppKeyV2 = new MoveStruct({\n\tname: `${$moduleName}::AppKeyV2<phantom App>`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport interface AuthorizeAppArguments {\n\tself: RawTransactionArgument<string>;\n\tAdminCap: RawTransactionArgument<string>;\n}\nexport interface AuthorizeAppOptions {\n\tpackage?: string;\n\targuments:\n\t\t| AuthorizeAppArguments\n\t\t| [self: RawTransactionArgument<string>, AdminCap: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\n/** Authorize an application to access protected features of the DeepBook. */\nexport function authorizeApp(options: AuthorizeAppOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'AdminCap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'authorize_app',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface DeauthorizeAppArguments {\n\tself: RawTransactionArgument<string>;\n\tAdminCap: RawTransactionArgument<string>;\n}\nexport interface DeauthorizeAppOptions {\n\tpackage?: string;\n\targuments:\n\t\t| DeauthorizeAppArguments\n\t\t| [self: RawTransactionArgument<string>, AdminCap: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\n/** Deauthorize an application by removing its authorization key. */\nexport function deauthorizeApp(options: DeauthorizeAppOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'AdminCap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'deauthorize_app',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface AssertAppIsAuthorizedArguments {\n\tself: RawTransactionArgument<string>;\n}\nexport interface AssertAppIsAuthorizedOptions {\n\tpackage?: string;\n\targuments: AssertAppIsAuthorizedArguments | [self: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\n/**\n * Assert that an application is authorized to access protected features of\n * DeepBook.\n */\nexport function assertAppIsAuthorized(options: AssertAppIsAuthorizedOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['self'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'assert_app_is_authorized',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface SetTreasuryAddressArguments {\n\tself: RawTransactionArgument<string>;\n\ttreasuryAddress: RawTransactionArgument<string>;\n\tCap: RawTransactionArgument<string>;\n}\nexport interface SetTreasuryAddressOptions {\n\tpackage?: string;\n\targuments:\n\t\t| SetTreasuryAddressArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\ttreasuryAddress: RawTransactionArgument<string>,\n\t\t\t\tCap: RawTransactionArgument<string>,\n\t\t ];\n}\n/**\n * Sets the treasury address where the pool creation fees are sent By default, the\n * treasury address is the publisher of the deepbook package\n */\nexport function setTreasuryAddress(options: SetTreasuryAddressOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, 'address', null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'treasuryAddress', 'Cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'set_treasury_address',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface EnableVersionArguments {\n\tself: RawTransactionArgument<string>;\n\tversion: RawTransactionArgument<number | bigint>;\n\tCap: RawTransactionArgument<string>;\n}\nexport interface EnableVersionOptions {\n\tpackage?: string;\n\targuments:\n\t\t| EnableVersionArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tversion: RawTransactionArgument<number | bigint>,\n\t\t\t\tCap: RawTransactionArgument<string>,\n\t\t ];\n}\n/**\n * Enables a package version Only Admin can enable a package version This function\n * does not have version restrictions\n */\nexport function enableVersion(options: EnableVersionOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, 'u64', null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'version', 'Cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'enable_version',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface DisableVersionArguments {\n\tself: RawTransactionArgument<string>;\n\tversion: RawTransactionArgument<number | bigint>;\n\tCap: RawTransactionArgument<string>;\n}\nexport interface DisableVersionOptions {\n\tpackage?: string;\n\targuments:\n\t\t| DisableVersionArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tversion: RawTransactionArgument<number | bigint>,\n\t\t\t\tCap: RawTransactionArgument<string>,\n\t\t ];\n}\n/**\n * Disables a package version Only Admin can disable a package version This\n * function does not have version restrictions\n */\nexport function disableVersion(options: DisableVersionOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, 'u64', null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'version', 'Cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'disable_version',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface MintPauseCapArguments {\n\tself: RawTransactionArgument<string>;\n\tCap: RawTransactionArgument<string>;\n}\nexport interface MintPauseCapOptions {\n\tpackage?: string;\n\targuments:\n\t\t| MintPauseCapArguments\n\t\t| [self: RawTransactionArgument<string>, Cap: RawTransactionArgument<string>];\n}\n/**\n * Mint a `DeepbookCorePauseCap`. The new cap's ID is recorded so it can later\n * disable a version via `disable_version_pause_cap`. Only Admin can mint. This\n * function does not have version restrictions.\n */\nexport function mintPauseCap(options: MintPauseCapOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'Cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'mint_pause_cap',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface RevokePauseCapArguments {\n\tself: RawTransactionArgument<string>;\n\tCap: RawTransactionArgument<string>;\n\tpauseCapId: RawTransactionArgument<string>;\n}\nexport interface RevokePauseCapOptions {\n\tpackage?: string;\n\targuments:\n\t\t| RevokePauseCapArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tCap: RawTransactionArgument<string>,\n\t\t\t\tpauseCapId: RawTransactionArgument<string>,\n\t\t ];\n}\n/**\n * Revoke a previously minted pause cap by ID. Only Admin can revoke. This function\n * does not have version restrictions.\n */\nexport function revokePauseCap(options: RevokePauseCapOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, null, '0x2::object::ID'] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'Cap', 'pauseCapId'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'revoke_pause_cap',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface DisableVersionPauseCapArguments {\n\tself: RawTransactionArgument<string>;\n\tversion: RawTransactionArgument<number | bigint>;\n\tpauseCap: RawTransactionArgument<string>;\n}\nexport interface DisableVersionPauseCapOptions {\n\tpackage?: string;\n\targuments:\n\t\t| DisableVersionPauseCapArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tversion: RawTransactionArgument<number | bigint>,\n\t\t\t\tpauseCap: RawTransactionArgument<string>,\n\t\t ];\n}\n/**\n * Disable any allowed package version (including the current one) using a valid\n * `DeepbookCorePauseCap`. The pause cap must be in `allowed_pause_caps`. This\n * function is the emergency kill switch; admin can re-enable via `enable_version`.\n * This function does not have version restrictions.\n */\nexport function disableVersionPauseCap(options: DisableVersionPauseCapOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, 'u64', null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'version', 'pauseCap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'disable_version_pause_cap',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface AddStablecoinArguments {\n\tself: RawTransactionArgument<string>;\n\tCap: RawTransactionArgument<string>;\n}\nexport interface AddStablecoinOptions {\n\tpackage?: string;\n\targuments:\n\t\t| AddStablecoinArguments\n\t\t| [self: RawTransactionArgument<string>, Cap: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\n/** Adds a stablecoin to the whitelist Only Admin can add stablecoin */\nexport function addStablecoin(options: AddStablecoinOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'Cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'add_stablecoin',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface RemoveStablecoinArguments {\n\tself: RawTransactionArgument<string>;\n\tCap: RawTransactionArgument<string>;\n}\nexport interface RemoveStablecoinOptions {\n\tpackage?: string;\n\targuments:\n\t\t| RemoveStablecoinArguments\n\t\t| [self: RawTransactionArgument<string>, Cap: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\n/** Removes a stablecoin from the whitelist Only Admin can remove stablecoin */\nexport function removeStablecoin(options: RemoveStablecoinOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'Cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'remove_stablecoin',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface InitBalanceManagerMapArguments {\n\tself: RawTransactionArgument<string>;\n\tCap: RawTransactionArgument<string>;\n}\nexport interface InitBalanceManagerMapOptions {\n\tpackage?: string;\n\targuments:\n\t\t| InitBalanceManagerMapArguments\n\t\t| [self: RawTransactionArgument<string>, Cap: RawTransactionArgument<string>];\n}\n/** Adds the BalanceManagerKey dynamic field to the registry */\nexport function initBalanceManagerMap(options: InitBalanceManagerMapOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'Cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'init_balance_manager_map',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface GetBalanceManagerIdsArguments {\n\tself: RawTransactionArgument<string>;\n\towner: RawTransactionArgument<string>;\n}\nexport interface GetBalanceManagerIdsOptions {\n\tpackage?: string;\n\targuments:\n\t\t| GetBalanceManagerIdsArguments\n\t\t| [self: RawTransactionArgument<string>, owner: RawTransactionArgument<string>];\n}\n/** Get the balance manager IDs for a given owner */\nexport function getBalanceManagerIds(options: GetBalanceManagerIdsOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, 'address'] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'owner'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'get_balance_manager_ids',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface AllowedPauseCapsArguments {\n\tself: RawTransactionArgument<string>;\n}\nexport interface AllowedPauseCapsOptions {\n\tpackage?: string;\n\targuments: AllowedPauseCapsArguments | [self: RawTransactionArgument<string>];\n}\n/**\n * Get the set of pause cap IDs allowed to disable package versions. Returns an\n * empty set if no pause caps have been minted yet.\n */\nexport function allowedPauseCaps(options: AllowedPauseCapsOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['self'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'allowed_pause_caps',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface IsStablecoinArguments {\n\tself: RawTransactionArgument<string>;\n\tstableType: TransactionArgument;\n}\nexport interface IsStablecoinOptions {\n\tpackage?: string;\n\targuments:\n\t\t| IsStablecoinArguments\n\t\t| [self: RawTransactionArgument<string>, stableType: TransactionArgument];\n}\n/** Returns whether the given coin is whitelisted */\nexport function isStablecoin(options: IsStablecoinOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'stableType'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'is_stablecoin',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAM,cAAc;AACpB,MAAa,WAAW,IAAI,WAAW;CACtC,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,aAAa,IAAI,MAAM,EACvB;CACD,CAAC;AACF,MAAa,mBAAmB,IAAI,WAAW;CAC9C,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,IAAI,IAAI,SACR;CACD,CAAC;AACF,MAAa,uBAAuB,IAAI,WAAW;CAClD,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,IAAI,IAAI,SACR;CACD,CAAC;AACF,MAAa,WAAW,IAAI,WAAW;CACtC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,IAAI,IAAI;EACR,OAAOA;EACP;CACD,CAAC;AACF,MAAa,gBAAgB,IAA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;CAC1C,MAAM,iBAAiB,CAAC,MAAM,KAAK;CACnC,MAAM,iBAAiB,CAAC,QAAQ,MAAM;AACtC,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC;;;AAaJ,SAAgB,qBAAqB,SAAsC;CAC1E,MAAM,iBAAiB,QAAQ,WAAW;CAC1C,MAAM,iBAAiB,CAAC,MAAM,UAAU;CACxC,MAAM,iBAAiB,CAAC,QAAQ,QAAQ;AACxC,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC;;;;;;AAaJ,SAAgB,iBAAiB,SAAkC;CAClE,MAAM,iBAAiB,QAAQ,WAAW;CAC1C,MAAM,iBAAiB,CAAC,KAAK;CAC7B,MAAM,iBAAiB,CAAC,OAAO;AAC/B,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC"}
1
+ {"version":3,"file":"registry.mjs","names":["versioned.Versioned","vec_set.VecSet","bag.Bag","type_name.TypeName"],"sources":["../../../src/contracts/deepbook/registry.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/** Registry holds all created pools. */\n\nimport {\n\tMoveStruct,\n\tMoveTuple,\n\tnormalizeMoveArguments,\n\ttype RawTransactionArgument,\n} from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';\nimport * as versioned from './deps/sui/versioned.js';\nimport * as vec_set from './deps/sui/vec_set.js';\nimport * as bag from './deps/sui/bag.js';\nimport * as type_name from './deps/std/type_name.js';\nconst $moduleName = '@deepbook/core::registry';\nexport const REGISTRY = new MoveStruct({\n\tname: `${$moduleName}::REGISTRY`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const DeepbookAdminCap = new MoveStruct({\n\tname: `${$moduleName}::DeepbookAdminCap`,\n\tfields: {\n\t\tid: bcs.Address,\n\t},\n});\nexport const DeepbookCorePauseCap = new MoveStruct({\n\tname: `${$moduleName}::DeepbookCorePauseCap`,\n\tfields: {\n\t\tid: bcs.Address,\n\t},\n});\nexport const Registry = new MoveStruct({\n\tname: `${$moduleName}::Registry`,\n\tfields: {\n\t\tid: bcs.Address,\n\t\tinner: versioned.Versioned,\n\t},\n});\nexport const RegistryInner = new MoveStruct({\n\tname: `${$moduleName}::RegistryInner`,\n\tfields: {\n\t\tallowed_versions: vec_set.VecSet(bcs.u64()),\n\t\tpools: bag.Bag,\n\t\ttreasury_address: bcs.Address,\n\t},\n});\nexport const PoolKey = new MoveStruct({\n\tname: `${$moduleName}::PoolKey`,\n\tfields: {\n\t\tbase: type_name.TypeName,\n\t\tquote: type_name.TypeName,\n\t},\n});\nexport const StableCoinKey = new MoveStruct({\n\tname: `${$moduleName}::StableCoinKey`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const BalanceManagerKey = new MoveStruct({\n\tname: `${$moduleName}::BalanceManagerKey`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const AllowedPauseCapsKey = new MoveTuple({\n\tname: `${$moduleName}::AllowedPauseCapsKey`,\n\tfields: [bcs.bool()],\n});\nexport const AppKey = new MoveStruct({\n\tname: `${$moduleName}::AppKey<phantom App>`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const AppKeyV2 = new MoveStruct({\n\tname: `${$moduleName}::AppKeyV2<phantom App>`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport interface AuthorizeAppArguments {\n\tself: RawTransactionArgument<string>;\n\tAdminCap: RawTransactionArgument<string>;\n}\nexport interface AuthorizeAppOptions {\n\tpackage?: string;\n\targuments:\n\t\t| AuthorizeAppArguments\n\t\t| [self: RawTransactionArgument<string>, AdminCap: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\n/** Authorize an application to access protected features of the DeepBook. */\nexport function authorizeApp(options: AuthorizeAppOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'AdminCap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'authorize_app',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface DeauthorizeAppArguments {\n\tself: RawTransactionArgument<string>;\n\tAdminCap: RawTransactionArgument<string>;\n}\nexport interface DeauthorizeAppOptions {\n\tpackage?: string;\n\targuments:\n\t\t| DeauthorizeAppArguments\n\t\t| [self: RawTransactionArgument<string>, AdminCap: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\n/** Deauthorize an application by removing its authorization key. */\nexport function deauthorizeApp(options: DeauthorizeAppOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'AdminCap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'deauthorize_app',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface AssertAppIsAuthorizedArguments {\n\tself: RawTransactionArgument<string>;\n}\nexport interface AssertAppIsAuthorizedOptions {\n\tpackage?: string;\n\targuments: AssertAppIsAuthorizedArguments | [self: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\n/**\n * Assert that an application is authorized to access protected features of\n * DeepBook.\n */\nexport function assertAppIsAuthorized(options: AssertAppIsAuthorizedOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['self'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'assert_app_is_authorized',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface SetTreasuryAddressArguments {\n\tself: RawTransactionArgument<string>;\n\ttreasuryAddress: RawTransactionArgument<string>;\n\tCap: RawTransactionArgument<string>;\n}\nexport interface SetTreasuryAddressOptions {\n\tpackage?: string;\n\targuments:\n\t\t| SetTreasuryAddressArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\ttreasuryAddress: RawTransactionArgument<string>,\n\t\t\t\tCap: RawTransactionArgument<string>,\n\t\t ];\n}\n/**\n * Sets the treasury address where the pool creation fees are sent By default, the\n * treasury address is the publisher of the deepbook package\n */\nexport function setTreasuryAddress(options: SetTreasuryAddressOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, 'address', null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'treasuryAddress', 'Cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'set_treasury_address',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface EnableVersionArguments {\n\tself: RawTransactionArgument<string>;\n\tversion: RawTransactionArgument<number | bigint>;\n\tCap: RawTransactionArgument<string>;\n}\nexport interface EnableVersionOptions {\n\tpackage?: string;\n\targuments:\n\t\t| EnableVersionArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tversion: RawTransactionArgument<number | bigint>,\n\t\t\t\tCap: RawTransactionArgument<string>,\n\t\t ];\n}\n/**\n * Enables a package version Only Admin can enable a package version This function\n * does not have version restrictions\n */\nexport function enableVersion(options: EnableVersionOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, 'u64', null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'version', 'Cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'enable_version',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface DisableVersionArguments {\n\tself: RawTransactionArgument<string>;\n\tversion: RawTransactionArgument<number | bigint>;\n\tCap: RawTransactionArgument<string>;\n}\nexport interface DisableVersionOptions {\n\tpackage?: string;\n\targuments:\n\t\t| DisableVersionArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tversion: RawTransactionArgument<number | bigint>,\n\t\t\t\tCap: RawTransactionArgument<string>,\n\t\t ];\n}\n/**\n * Disables a package version Only Admin can disable a package version This\n * function does not have version restrictions\n */\nexport function disableVersion(options: DisableVersionOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, 'u64', null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'version', 'Cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'disable_version',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface MintPauseCapArguments {\n\tself: RawTransactionArgument<string>;\n\tCap: RawTransactionArgument<string>;\n}\nexport interface MintPauseCapOptions {\n\tpackage?: string;\n\targuments:\n\t\t| MintPauseCapArguments\n\t\t| [self: RawTransactionArgument<string>, Cap: RawTransactionArgument<string>];\n}\n/**\n * Mint a `DeepbookCorePauseCap`. The new cap's ID is recorded so it can later\n * disable a version via `disable_version_pause_cap`. Only Admin can mint. This\n * function does not have version restrictions.\n */\nexport function mintPauseCap(options: MintPauseCapOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'Cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'mint_pause_cap',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface RevokePauseCapArguments {\n\tself: RawTransactionArgument<string>;\n\tCap: RawTransactionArgument<string>;\n\tpauseCapId: RawTransactionArgument<string>;\n}\nexport interface RevokePauseCapOptions {\n\tpackage?: string;\n\targuments:\n\t\t| RevokePauseCapArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tCap: RawTransactionArgument<string>,\n\t\t\t\tpauseCapId: RawTransactionArgument<string>,\n\t\t ];\n}\n/**\n * Revoke a previously minted pause cap by ID. Only Admin can revoke. This function\n * does not have version restrictions.\n */\nexport function revokePauseCap(options: RevokePauseCapOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, null, '0x2::object::ID'] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'Cap', 'pauseCapId'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'revoke_pause_cap',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface DisableVersionPauseCapArguments {\n\tself: RawTransactionArgument<string>;\n\tversion: RawTransactionArgument<number | bigint>;\n\tpauseCap: RawTransactionArgument<string>;\n}\nexport interface DisableVersionPauseCapOptions {\n\tpackage?: string;\n\targuments:\n\t\t| DisableVersionPauseCapArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tversion: RawTransactionArgument<number | bigint>,\n\t\t\t\tpauseCap: RawTransactionArgument<string>,\n\t\t ];\n}\n/**\n * Disable any allowed package version (including the current one) using a valid\n * `DeepbookCorePauseCap`. The pause cap must be in `allowed_pause_caps`. This\n * function is the emergency kill switch; admin can re-enable via `enable_version`.\n * This function does not have version restrictions.\n */\nexport function disableVersionPauseCap(options: DisableVersionPauseCapOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, 'u64', null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'version', 'pauseCap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'disable_version_pause_cap',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface AddStablecoinArguments {\n\tself: RawTransactionArgument<string>;\n\tCap: RawTransactionArgument<string>;\n}\nexport interface AddStablecoinOptions {\n\tpackage?: string;\n\targuments:\n\t\t| AddStablecoinArguments\n\t\t| [self: RawTransactionArgument<string>, Cap: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\n/** Adds a stablecoin to the whitelist Only Admin can add stablecoin */\nexport function addStablecoin(options: AddStablecoinOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'Cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'add_stablecoin',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface RemoveStablecoinArguments {\n\tself: RawTransactionArgument<string>;\n\tCap: RawTransactionArgument<string>;\n}\nexport interface RemoveStablecoinOptions {\n\tpackage?: string;\n\targuments:\n\t\t| RemoveStablecoinArguments\n\t\t| [self: RawTransactionArgument<string>, Cap: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\n/** Removes a stablecoin from the whitelist Only Admin can remove stablecoin */\nexport function removeStablecoin(options: RemoveStablecoinOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'Cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'remove_stablecoin',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface InitBalanceManagerMapArguments {\n\tself: RawTransactionArgument<string>;\n\tCap: RawTransactionArgument<string>;\n}\nexport interface InitBalanceManagerMapOptions {\n\tpackage?: string;\n\targuments:\n\t\t| InitBalanceManagerMapArguments\n\t\t| [self: RawTransactionArgument<string>, Cap: RawTransactionArgument<string>];\n}\n/** Adds the BalanceManagerKey dynamic field to the registry */\nexport function initBalanceManagerMap(options: InitBalanceManagerMapOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'Cap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'init_balance_manager_map',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface GetBalanceManagerIdsArguments {\n\tself: RawTransactionArgument<string>;\n\towner: RawTransactionArgument<string>;\n}\nexport interface GetBalanceManagerIdsOptions {\n\tpackage?: string;\n\targuments:\n\t\t| GetBalanceManagerIdsArguments\n\t\t| [self: RawTransactionArgument<string>, owner: RawTransactionArgument<string>];\n}\n/** Get the balance manager IDs for a given owner */\nexport function getBalanceManagerIds(options: GetBalanceManagerIdsOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, 'address'] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'owner'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'get_balance_manager_ids',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface AllowedPauseCapsArguments {\n\tself: RawTransactionArgument<string>;\n}\nexport interface AllowedPauseCapsOptions {\n\tpackage?: string;\n\targuments: AllowedPauseCapsArguments | [self: RawTransactionArgument<string>];\n}\n/**\n * Get the set of pause cap IDs allowed to disable package versions. Returns an\n * empty set if no pause caps have been minted yet.\n */\nexport function allowedPauseCaps(options: AllowedPauseCapsOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['self'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'allowed_pause_caps',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface IsStablecoinArguments {\n\tself: RawTransactionArgument<string>;\n\tstableType: TransactionArgument;\n}\nexport interface IsStablecoinOptions {\n\tpackage?: string;\n\targuments:\n\t\tIsStablecoinArguments | [self: RawTransactionArgument<string>, stableType: TransactionArgument];\n}\n/** Returns whether the given coin is whitelisted */\nexport function isStablecoin(options: IsStablecoinOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/core';\n\tconst argumentsTypes = [null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'stableType'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'registry',\n\t\t\tfunction: 'is_stablecoin',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAM,cAAc;AACpB,MAAa,WAAW,IAAI,WAAW;CACtC,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,aAAa,IAAI,MAAM,EACvB;CACD,CAAC;AACF,MAAa,mBAAmB,IAAI,WAAW;CAC9C,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,IAAI,IAAI,SACR;CACD,CAAC;AACF,MAAa,uBAAuB,IAAI,WAAW;CAClD,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,IAAI,IAAI,SACR;CACD,CAAC;AACF,MAAa,WAAW,IAAI,WAAW;CACtC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,IAAI,IAAI;EACR,OAAOA;EACP;CACD,CAAC;AACF,MAAa,gBAAgB,IAAI,WAAW;CAC3C,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,kBAAkBC,OAAe,IAAI,KAAK,CAAC;EAC3C,OAAOC;EACP,kBAAkB,IAAI;EACtB;CACD,CAAC;AACF,MAAa,UAAU,IAAI,WAAW;CACrC,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,MAAMC;EACN,OAAOA;EACP;CACD,CAAC;AACF,MAAa,gBAAgB,IAAI,WAAW;CAC3C,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,aAAa,IAAI,MAAM,EACvB;CACD,CAAC;AACF,MAAa,oBAAoB,IAAI,WAAW;CAC/C,MAAM,GAAG,YAAY;CACrB,QAAQ,EACP,aAAa,IAAI,MAAM,EACvB;CACD,CAAC;AACF,MAAa,sBAAsB,IAAI,UAAU;CAChD,MAAM,GAAG,YAAY;CACrB,QAAQ,CAAC,IAAI,MAAM,CAAC;CACpB,CAAC;AACF,MAAa,SAAS,IAAI,WAAW;CACpC,MA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C,OAAO;AAC/B,SAAQ,OACP,GAAG,SAAS;EACX,SAAS;EACT,QAAQ;EACR,UAAU;EACV,WAAW,uBAAuB,QAAQ,WAAW,gBAAgB,eAAe;EACpF,CAAC"}
@@ -114,51 +114,6 @@ const WithdrawCollateralEvent = new MoveStruct({
114
114
  timestamp: bcs.u64()
115
115
  }
116
116
  });
117
- /**
118
- * Add a conditional order (take-profit / stop-loss). Specifies the condition under
119
- * which it triggers and the pending order to place when it does.
120
- *
121
- * Lifetime: the conditional order itself is never clamped — it rests in the queue
122
- * until it triggers or is cancelled. A _market_ pending order
123
- * (`tpsl::new_pending_market_order`) has no expiry, so it is the "until cancelled"
124
- * stop: it waits indefinitely and, when triggered, fires and deleverages via
125
- * `execute_conditional_orders_v3` (so it can protect even in the danger band). A
126
- * _limit_ pending order is intentionally transient — when it triggers, the resting
127
- * order it places is clamped to `max_order_ttl_ms` (default 3 days) by
128
- * `clamp_expire_timestamp`, the same stale-price guard as any margin limit order.
129
- * For a permanent stop, use a market pending order.
130
- */
131
- function addConditionalOrder(options) {
132
- const packageAddress = options.package ?? "@deepbook/margin";
133
- const argumentsTypes = [
134
- null,
135
- null,
136
- null,
137
- null,
138
- null,
139
- "u64",
140
- null,
141
- null,
142
- "0x2::clock::Clock"
143
- ];
144
- const parameterNames = [
145
- "self",
146
- "pool",
147
- "basePriceInfoObject",
148
- "quotePriceInfoObject",
149
- "registry",
150
- "conditionalOrderId",
151
- "condition",
152
- "pendingOrder"
153
- ];
154
- return (tx) => tx.moveCall({
155
- package: packageAddress,
156
- module: "margin_manager",
157
- function: "add_conditional_order",
158
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
159
- typeArguments: options.typeArguments
160
- });
161
- }
162
117
  /** Cancel all conditional orders. */
163
118
  function cancelAllConditionalOrders(options) {
164
119
  const packageAddress = options.package ?? "@deepbook/margin";
@@ -189,89 +144,6 @@ function cancelConditionalOrder(options) {
189
144
  typeArguments: options.typeArguments
190
145
  });
191
146
  }
192
- /**
193
- * Execute conditional orders and return the order infos. This is a permissionless
194
- * function that can be called by anyone.
195
- *
196
- * v2 adds `base_margin_pool` + `quote_margin_pool` parameters and enforces a
197
- * post-fill `risk_ratio >= min_borrow_risk_ratio` invariant inside the inner loop.
198
- * If any single triggered fill would breach that floor, the entire txn aborts — no
199
- * partial-state landing.
200
- */
201
- function executeConditionalOrdersV2(options) {
202
- const packageAddress = options.package ?? "@deepbook/margin";
203
- const argumentsTypes = [
204
- null,
205
- null,
206
- null,
207
- null,
208
- null,
209
- null,
210
- null,
211
- "u64",
212
- "0x2::clock::Clock"
213
- ];
214
- const parameterNames = [
215
- "self",
216
- "pool",
217
- "baseMarginPool",
218
- "quoteMarginPool",
219
- "basePriceInfoObject",
220
- "quotePriceInfoObject",
221
- "registry",
222
- "maxOrdersToExecute"
223
- ];
224
- return (tx) => tx.moveCall({
225
- package: packageAddress,
226
- module: "margin_manager",
227
- function: "execute_conditional_orders_v2",
228
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
229
- typeArguments: options.typeArguments
230
- });
231
- }
232
- /**
233
- * Execute conditional orders, deleveraging on each market-type fill.
234
- * Permissionless, like `execute_conditional_orders_v2`, with the same trigger and
235
- * cancellation handling — but takes the margin pools as `&mut` and repays the loan
236
- * with the market proceeds before gating on the net (post-repay) `risk_ratio`
237
- * being at least the pre-fill ratio.
238
- *
239
- * This is what lets a stop-loss fire in the `liquidation..min_borrow` danger band:
240
- * a swap alone only lowers the oracle-valued ratio (so the v2 borrow-floor gate
241
- * rejects it), while repaying actually improves it. If a single triggered fill
242
- * would worsen net solvency the whole txn aborts — no partial-state landing.
243
- */
244
- function executeConditionalOrdersV3(options) {
245
- const packageAddress = options.package ?? "@deepbook/margin";
246
- const argumentsTypes = [
247
- null,
248
- null,
249
- null,
250
- null,
251
- null,
252
- null,
253
- null,
254
- "u64",
255
- "0x2::clock::Clock"
256
- ];
257
- const parameterNames = [
258
- "self",
259
- "pool",
260
- "baseMarginPool",
261
- "quoteMarginPool",
262
- "basePriceInfoObject",
263
- "quotePriceInfoObject",
264
- "registry",
265
- "maxOrdersToExecute"
266
- ];
267
- return (tx) => tx.moveCall({
268
- package: packageAddress,
269
- module: "margin_manager",
270
- function: "execute_conditional_orders_v3",
271
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
272
- typeArguments: options.typeArguments
273
- });
274
- }
275
147
  /** Creates a new margin manager and shares it. */
276
148
  function _new(options) {
277
149
  const packageAddress = options.package ?? "@deepbook/margin";
@@ -385,131 +257,6 @@ function unsetMarginManagerReferral(options) {
385
257
  });
386
258
  }
387
259
  /**
388
- * Deposit a coin into the margin manager. The coin must be of the same type as
389
- * either the base, quote, or DEEP.
390
- */
391
- function deposit(options) {
392
- const packageAddress = options.package ?? "@deepbook/margin";
393
- const argumentsTypes = [
394
- null,
395
- null,
396
- null,
397
- null,
398
- null,
399
- "0x2::clock::Clock"
400
- ];
401
- const parameterNames = [
402
- "self",
403
- "registry",
404
- "baseOracle",
405
- "quoteOracle",
406
- "coin"
407
- ];
408
- return (tx) => tx.moveCall({
409
- package: packageAddress,
410
- module: "margin_manager",
411
- function: "deposit",
412
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
413
- typeArguments: options.typeArguments
414
- });
415
- }
416
- /**
417
- * Withdraw a specified amount of an asset from the margin manager. The asset must
418
- * be of the same type as either the base, quote, or DEEP. The withdrawal is
419
- * subject to the risk ratio limit.
420
- */
421
- function withdraw(options) {
422
- const packageAddress = options.package ?? "@deepbook/margin";
423
- const argumentsTypes = [
424
- null,
425
- null,
426
- null,
427
- null,
428
- null,
429
- null,
430
- null,
431
- "u64",
432
- "0x2::clock::Clock"
433
- ];
434
- const parameterNames = [
435
- "self",
436
- "registry",
437
- "baseMarginPool",
438
- "quoteMarginPool",
439
- "baseOracle",
440
- "quoteOracle",
441
- "pool",
442
- "withdrawAmount"
443
- ];
444
- return (tx) => tx.moveCall({
445
- package: packageAddress,
446
- module: "margin_manager",
447
- function: "withdraw",
448
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
449
- typeArguments: options.typeArguments
450
- });
451
- }
452
- /** Borrow the base asset using the margin manager. */
453
- function borrowBase(options) {
454
- const packageAddress = options.package ?? "@deepbook/margin";
455
- const argumentsTypes = [
456
- null,
457
- null,
458
- null,
459
- null,
460
- null,
461
- null,
462
- "u64",
463
- "0x2::clock::Clock"
464
- ];
465
- const parameterNames = [
466
- "self",
467
- "registry",
468
- "baseMarginPool",
469
- "baseOracle",
470
- "quoteOracle",
471
- "pool",
472
- "loanAmount"
473
- ];
474
- return (tx) => tx.moveCall({
475
- package: packageAddress,
476
- module: "margin_manager",
477
- function: "borrow_base",
478
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
479
- typeArguments: options.typeArguments
480
- });
481
- }
482
- /** Borrow the quote asset using the margin manager. */
483
- function borrowQuote(options) {
484
- const packageAddress = options.package ?? "@deepbook/margin";
485
- const argumentsTypes = [
486
- null,
487
- null,
488
- null,
489
- null,
490
- null,
491
- null,
492
- "u64",
493
- "0x2::clock::Clock"
494
- ];
495
- const parameterNames = [
496
- "self",
497
- "registry",
498
- "quoteMarginPool",
499
- "baseOracle",
500
- "quoteOracle",
501
- "pool",
502
- "loanAmount"
503
- ];
504
- return (tx) => tx.moveCall({
505
- package: packageAddress,
506
- module: "margin_manager",
507
- function: "borrow_quote",
508
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
509
- typeArguments: options.typeArguments
510
- });
511
- }
512
- /**
513
260
  * Repay the base asset loan using the margin manager. Returns the total amount
514
261
  * repaid
515
262
  */
@@ -563,35 +310,6 @@ function repayQuote(options) {
563
310
  typeArguments: options.typeArguments
564
311
  });
565
312
  }
566
- function liquidate(options) {
567
- const packageAddress = options.package ?? "@deepbook/margin";
568
- const argumentsTypes = [
569
- null,
570
- null,
571
- null,
572
- null,
573
- null,
574
- null,
575
- null,
576
- "0x2::clock::Clock"
577
- ];
578
- const parameterNames = [
579
- "self",
580
- "registry",
581
- "baseOracle",
582
- "quoteOracle",
583
- "marginPool",
584
- "pool",
585
- "repayCoin"
586
- ];
587
- return (tx) => tx.moveCall({
588
- package: packageAddress,
589
- module: "margin_manager",
590
- function: "liquidate",
591
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
592
- typeArguments: options.typeArguments
593
- });
594
- }
595
313
  function balanceManager(options) {
596
314
  const packageAddress = options.package ?? "@deepbook/margin";
597
315
  const argumentsTypes = [null];
@@ -669,42 +387,6 @@ function calculateDebts(options) {
669
387
  typeArguments: options.typeArguments
670
388
  });
671
389
  }
672
- /**
673
- * Returns comprehensive state information for a margin manager. Returns
674
- * (manager_id, deepbook_pool_id, risk_ratio, base_asset, quote_asset, base_debt,
675
- * quote_debt, base_pyth_price, base_pyth_decimals, quote_pyth_price,
676
- * quote_pyth_decimals, current_price, lowest_trigger_above_price,
677
- * highest_trigger_below_price)
678
- */
679
- function managerState(options) {
680
- const packageAddress = options.package ?? "@deepbook/margin";
681
- const argumentsTypes = [
682
- null,
683
- null,
684
- null,
685
- null,
686
- null,
687
- null,
688
- null,
689
- "0x2::clock::Clock"
690
- ];
691
- const parameterNames = [
692
- "self",
693
- "registry",
694
- "baseOracle",
695
- "quoteOracle",
696
- "pool",
697
- "baseMarginPool",
698
- "quoteMarginPool"
699
- ];
700
- return (tx) => tx.moveCall({
701
- package: packageAddress,
702
- module: "margin_manager",
703
- function: "manager_state",
704
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
705
- typeArguments: options.typeArguments
706
- });
707
- }
708
390
  function owner(options) {
709
391
  const packageAddress = options.package ?? "@deepbook/margin";
710
392
  const argumentsTypes = [null];
@@ -985,5 +667,5 @@ function canPlaceMarketOrder(options) {
985
667
  }
986
668
 
987
669
  //#endregion
988
- export { _new, account, accountExists, accountOpenOrders, addConditionalOrder, balanceManager, balanceManagerId, baseBalance, borrowBase, borrowQuote, borrowedBaseShares, borrowedQuoteShares, borrowedShares, calculateAssets, calculateDebts, canPlaceLimitOrder, canPlaceMarketOrder, cancelAllConditionalOrders, cancelConditionalOrder, conditionalOrder, conditionalOrderIds, deepBalance, deepbookPool, deposit, executeConditionalOrdersV2, executeConditionalOrdersV3, getAccountOrderDetails, getBalanceManagerReferralId, hasBaseDebt, highestTriggerBelowPrice, liquidate, lockedBalance, lowestTriggerAbovePrice, managerState, marginPoolId, newWithInitializer, owner, quoteBalance, registerMarginManager, repayBase, repayQuote, setMarginManagerReferral, share, unregisterMarginManager, unsetMarginManagerReferral, withdraw };
670
+ export { _new, account, accountExists, accountOpenOrders, balanceManager, balanceManagerId, baseBalance, borrowedBaseShares, borrowedQuoteShares, borrowedShares, calculateAssets, calculateDebts, canPlaceLimitOrder, canPlaceMarketOrder, cancelAllConditionalOrders, cancelConditionalOrder, conditionalOrder, conditionalOrderIds, deepBalance, deepbookPool, getAccountOrderDetails, getBalanceManagerReferralId, hasBaseDebt, highestTriggerBelowPrice, lockedBalance, lowestTriggerAbovePrice, marginPoolId, newWithInitializer, owner, quoteBalance, registerMarginManager, repayBase, repayQuote, setMarginManagerReferral, share, unregisterMarginManager, unsetMarginManagerReferral };
989
671
  //# sourceMappingURL=margin_manager.mjs.map