@mysten/deepbook-v3 1.3.5 → 1.4.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 (54) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/contracts/deepbook/account.d.mts +18 -18
  3. package/dist/contracts/deepbook/balances.d.mts +4 -4
  4. package/dist/contracts/deepbook/balances.d.mts.map +1 -1
  5. package/dist/transactions/balanceManager.d.mts +12 -12
  6. package/dist/transactions/deepbook.d.mts +20 -20
  7. package/dist/transactions/deepbookAdmin.d.mts +31 -2
  8. package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
  9. package/dist/transactions/deepbookAdmin.mjs +34 -2
  10. package/dist/transactions/deepbookAdmin.mjs.map +1 -1
  11. package/dist/transactions/marginAdmin.d.mts +38 -7
  12. package/dist/transactions/marginAdmin.d.mts.map +1 -1
  13. package/dist/transactions/marginAdmin.mjs +48 -0
  14. package/dist/transactions/marginAdmin.mjs.map +1 -1
  15. package/dist/transactions/marginLiquidations.d.mts +3 -3
  16. package/dist/transactions/marginMaintainer.d.mts +5 -5
  17. package/dist/transactions/marginMaintainer.d.mts.map +1 -1
  18. package/dist/transactions/marginMaintainer.mjs +4 -4
  19. package/dist/transactions/marginMaintainer.mjs.map +1 -1
  20. package/dist/transactions/marginManager.d.mts +116 -23
  21. package/dist/transactions/marginManager.d.mts.map +1 -1
  22. package/dist/transactions/marginManager.mjs +133 -1
  23. package/dist/transactions/marginManager.mjs.map +1 -1
  24. package/dist/transactions/marginPool.d.mts +18 -18
  25. package/dist/transactions/marginRegistry.d.mts +15 -15
  26. package/dist/transactions/marginRegistry.d.mts.map +1 -1
  27. package/dist/transactions/marginTPSL.d.mts +14 -11
  28. package/dist/transactions/marginTPSL.d.mts.map +1 -1
  29. package/dist/transactions/marginTPSL.mjs +5 -1
  30. package/dist/transactions/marginTPSL.mjs.map +1 -1
  31. package/dist/transactions/poolProxy.d.mts +19 -9
  32. package/dist/transactions/poolProxy.d.mts.map +1 -1
  33. package/dist/transactions/poolProxy.mjs +31 -21
  34. package/dist/transactions/poolProxy.mjs.map +1 -1
  35. package/dist/types/index.d.mts +1 -1
  36. package/dist/types/index.mjs.map +1 -1
  37. package/dist/utils/config.d.mts +1 -0
  38. package/dist/utils/config.d.mts.map +1 -1
  39. package/dist/utils/config.mjs +3 -0
  40. package/dist/utils/config.mjs.map +1 -1
  41. package/dist/utils/constants.d.mts +3 -0
  42. package/dist/utils/constants.d.mts.map +1 -1
  43. package/dist/utils/constants.mjs +4 -2
  44. package/dist/utils/constants.mjs.map +1 -1
  45. package/package.json +3 -3
  46. package/src/transactions/deepbookAdmin.ts +64 -2
  47. package/src/transactions/marginAdmin.ts +79 -0
  48. package/src/transactions/marginMaintainer.ts +4 -4
  49. package/src/transactions/marginManager.ts +244 -1
  50. package/src/transactions/marginTPSL.ts +10 -3
  51. package/src/transactions/poolProxy.ts +45 -21
  52. package/src/types/index.ts +1 -1
  53. package/src/utils/config.ts +4 -0
  54. package/src/utils/constants.ts +5 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # @mysten/deepbook-v3
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e68bd36: Align margin SDK with `deepbook_margin` v5 on-chain source:
8
+ - Switch `pool_proxy` order placement builders (`placeLimitOrder`, `placeMarketOrder`,
9
+ `placeReduceOnlyLimitOrder`, `placeReduceOnlyMarketOrder`) to the `_v2` Move entries. The v1
10
+ entries are deprecated in the v5 package and abort with `EDeprecatedUseV2`. The v2 variants take
11
+ additional `base_margin_pool`, `quote_margin_pool`, `base_oracle`, and `quote_oracle` arguments
12
+ so the chain can enforce a post-trade `risk_ratio` invariant (borrow-floor for normal orders,
13
+ monotonic improvement for reduce-only).
14
+ - The reduce-only v2 entries dropped the `DebtAsset` generic and the explicit
15
+ `MarginPool<DebtAsset>` parameter; the package now dispatches on
16
+ `margin_manager.has_base_debt()` to pick the typed pool from the
17
+ `(base_margin_pool, quote_margin_pool)` pair. The SDK builders no longer take a debt-side margin
18
+ pool or third type argument.
19
+ - Switch `executeConditionalOrders` to `margin_manager::execute_conditional_orders_v2`, which adds
20
+ `base_margin_pool`/`quote_margin_pool` arguments and enforces the same post-fill solvency check.
21
+ - Fix `claimRebate` to target the actual Move entry name `pool_proxy::claim_rebates`. The previous
22
+ target did not exist on-chain.
23
+ - Rename `MarginPoolConfigParams.referralSpread` to `protocolSpread`. The Move field was renamed
24
+ upstream in the `protocol_config` module; the old SDK name was positionally correct but
25
+ misleading.
26
+ - Add `registerMarginManager` and `unregisterMarginManager` builders.
27
+ - Add read-only margin_manager builders exposed in newer source: `balanceManagerId`,
28
+ `getBalanceManagerReferralId`, `accountExists`, `account`, `accountOpenOrders`,
29
+ `getAccountOrderDetails`, `lockedBalance`, `canPlaceLimitOrder`, `canPlaceMarketOrder`.
30
+ - Add `MarginAdminContract.setPriceTolerance`, `setMaxPriceAge`, and `setMaxOrderTtl` builders for
31
+ the per-pool oracle and order-TTL admin entries on `margin_registry`. The `setMaxOrderTtl` entry
32
+ configures the per-pool `max_order_ttl_ms` cap that `pool_proxy::place_limit_order_v2` and
33
+ `place_reduce_only_limit_order_v2` use to clamp `expire_timestamp`.
34
+ - Add `DeepBookAdminContract.mintCorePauseCap`, `revokeCorePauseCap`,
35
+ `disableVersionWithCorePauseCap`, and `corePauseCaps` builders for the new
36
+ `DeepbookCorePauseCap` emergency-pause flow in the core spot `registry`. These mirror the
37
+ existing margin-side pause-cap builders.
38
+ - Bump mainnet `MARGIN_PACKAGE_ID` to
39
+ `0x124bb3d8105d6d301c0d40feaa54d65df6b301e4d8ddd5eb8475b0f8a18cff2e` to track the latest margin
40
+ package upgrade on mainnet.
41
+ - Bump mainnet `DEEPBOOK_PACKAGE_ID` to
42
+ `0x0e735f8c93a95722efd73521aca7a7652c0bb71ed1daf41b26dfd7d1ff71f748` to track the latest core
43
+ deepbook package upgrade on mainnet.
44
+
45
+ ## 1.3.6
46
+
47
+ ### Patch Changes
48
+
49
+ - f7de3e5: Restore docs in published tarballs.
50
+ - Updated dependencies [f7de3e5]
51
+ - @mysten/bcs@2.0.5
52
+ - @mysten/sui@2.16.2
53
+
3
54
  ## 1.3.5
4
55
 
5
56
  ### Patch Changes
@@ -1,35 +1,35 @@
1
1
  import { MoveStruct } from "../utils/index.mjs";
2
- import * as _mysten_sui_bcs0 from "@mysten/sui/bcs";
2
+ import * as _mysten_sui_bcs2 from "@mysten/sui/bcs";
3
3
  import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
4
4
 
5
5
  //#region src/contracts/deepbook/account.d.ts
6
6
  declare const Account: MoveStruct<{
7
- epoch: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
7
+ epoch: _mysten_sui_bcs2.BcsType<string, string | number | bigint, "u64">;
8
8
  open_orders: MoveStruct<{
9
- contents: _mysten_sui_bcs0.BcsType<string[], Iterable<string | number | bigint> & {
9
+ contents: _mysten_sui_bcs2.BcsType<string[], Iterable<string | number | bigint> & {
10
10
  length: number;
11
11
  }, string>;
12
12
  }, "0x2::vec_set::VecSet<u128>">;
13
- taker_volume: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u128">;
14
- maker_volume: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u128">;
15
- active_stake: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
16
- inactive_stake: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
17
- created_proposal: _mysten_sui_bcs0.BcsType<boolean, boolean, "bool">;
18
- voted_proposal: _mysten_sui_bcs0.BcsType<string | null, string | Uint8Array<ArrayBufferLike> | null | undefined, "Option<bytes[32]>">;
13
+ taker_volume: _mysten_sui_bcs2.BcsType<string, string | number | bigint, "u128">;
14
+ maker_volume: _mysten_sui_bcs2.BcsType<string, string | number | bigint, "u128">;
15
+ active_stake: _mysten_sui_bcs2.BcsType<string, string | number | bigint, "u64">;
16
+ inactive_stake: _mysten_sui_bcs2.BcsType<string, string | number | bigint, "u64">;
17
+ created_proposal: _mysten_sui_bcs2.BcsType<boolean, boolean, "bool">;
18
+ voted_proposal: _mysten_sui_bcs2.BcsType<string | null, string | Uint8Array<ArrayBufferLike> | null | undefined, "Option<bytes[32]>">;
19
19
  unclaimed_rebates: MoveStruct<{
20
- base: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
21
- quote: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
22
- deep: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
20
+ base: _mysten_sui_bcs2.BcsType<string, string | number | bigint, "u64">;
21
+ quote: _mysten_sui_bcs2.BcsType<string, string | number | bigint, "u64">;
22
+ deep: _mysten_sui_bcs2.BcsType<string, string | number | bigint, "u64">;
23
23
  }, "@deepbook/core::balances::Balances">;
24
24
  settled_balances: MoveStruct<{
25
- base: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
26
- quote: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
27
- deep: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
25
+ base: _mysten_sui_bcs2.BcsType<string, string | number | bigint, "u64">;
26
+ quote: _mysten_sui_bcs2.BcsType<string, string | number | bigint, "u64">;
27
+ deep: _mysten_sui_bcs2.BcsType<string, string | number | bigint, "u64">;
28
28
  }, "@deepbook/core::balances::Balances">;
29
29
  owed_balances: MoveStruct<{
30
- base: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
31
- quote: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
32
- deep: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
30
+ base: _mysten_sui_bcs2.BcsType<string, string | number | bigint, "u64">;
31
+ quote: _mysten_sui_bcs2.BcsType<string, string | number | bigint, "u64">;
32
+ deep: _mysten_sui_bcs2.BcsType<string, string | number | bigint, "u64">;
33
33
  }, "@deepbook/core::balances::Balances">;
34
34
  }, "@deepbook/core::account::Account">;
35
35
  //#endregion
@@ -1,11 +1,11 @@
1
1
  import { MoveStruct } from "../utils/index.mjs";
2
- import * as _mysten_sui_bcs16 from "@mysten/sui/bcs";
2
+ import * as _mysten_sui_bcs0 from "@mysten/sui/bcs";
3
3
 
4
4
  //#region src/contracts/deepbook/balances.d.ts
5
5
  declare const Balances: MoveStruct<{
6
- base: _mysten_sui_bcs16.BcsType<string, string | number | bigint, "u64">;
7
- quote: _mysten_sui_bcs16.BcsType<string, string | number | bigint, "u64">;
8
- deep: _mysten_sui_bcs16.BcsType<string, string | number | bigint, "u64">;
6
+ base: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
7
+ quote: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
8
+ deep: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
9
9
  }, "@deepbook/core::balances::Balances">;
10
10
  //#endregion
11
11
  export { Balances };
@@ -1 +1 @@
1
- {"version":3,"file":"balances.d.mts","names":[],"sources":["../../../src/contracts/deepbook/balances.ts"],"mappings":";;;;cAYa,QAAA,EAAQ,UAAA;QAOnB,iBAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"balances.d.mts","names":[],"sources":["../../../src/contracts/deepbook/balances.ts"],"mappings":";;;;cAYa,QAAA,EAAQ,UAAA;QAOnB,gBAAA,CAAA,OAAA"}
@@ -1,5 +1,5 @@
1
1
  import { DeepBookConfig } from "../utils/config.mjs";
2
- import * as _mysten_sui_transactions3 from "@mysten/sui/transactions";
2
+ import * as _mysten_sui_transactions0 from "@mysten/sui/transactions";
3
3
  import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
4
4
 
5
5
  //#region src/transactions/balanceManager.d.ts
@@ -21,7 +21,7 @@ declare class BalanceManagerContract {
21
21
  * @description Create a new BalanceManager, manually set the owner. Returns the manager.
22
22
  * @returns A function that takes a Transaction object
23
23
  */
24
- createBalanceManagerWithOwner: (ownerAddress: string) => (tx: Transaction) => _mysten_sui_transactions3.TransactionResult;
24
+ createBalanceManagerWithOwner: (ownerAddress: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
25
25
  /**
26
26
  * @description Share the BalanceManager
27
27
  * @param {TransactionArgument} manager The BalanceManager to share
@@ -65,38 +65,38 @@ declare class BalanceManagerContract {
65
65
  * @param {string} managerKey The key of the BalanceManager
66
66
  * @returns A function that takes a Transaction object
67
67
  */
68
- generateProof: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions3.TransactionResult;
68
+ generateProof: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
69
69
  /**
70
70
  * @description Generate a trade proof as the owner
71
71
  * @param {string} managerId The ID of the BalanceManager
72
72
  * @returns A function that takes a Transaction object
73
73
  */
74
- generateProofAsOwner: (managerId: string) => (tx: Transaction) => _mysten_sui_transactions3.TransactionResult;
74
+ generateProofAsOwner: (managerId: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
75
75
  /**
76
76
  * @description Generate a trade proof as a trader
77
77
  * @param {string} managerId The ID of the BalanceManager
78
78
  * @param {string} tradeCapId The ID of the tradeCap
79
79
  * @returns A function that takes a Transaction object
80
80
  */
81
- generateProofAsTrader: (managerId: string, tradeCapId: string) => (tx: Transaction) => _mysten_sui_transactions3.TransactionResult;
81
+ generateProofAsTrader: (managerId: string, tradeCapId: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
82
82
  /**
83
83
  * @description Mint a TradeCap
84
84
  * @param {string} managerKey The name of the BalanceManager
85
85
  * @returns A function that takes a Transaction object
86
86
  */
87
- mintTradeCap: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions3.TransactionResult;
87
+ mintTradeCap: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
88
88
  /**
89
89
  * @description Mint a DepositCap
90
90
  * @param {string} managerKey The name of the BalanceManager
91
91
  * @returns A function that takes a Transaction object
92
92
  */
93
- mintDepositCap: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions3.TransactionResult;
93
+ mintDepositCap: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
94
94
  /**
95
95
  * @description Mint a WithdrawalCap
96
96
  * @param {string} managerKey The name of the BalanceManager
97
97
  * @returns A function that takes a Transaction object
98
98
  */
99
- mintWithdrawalCap: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions3.TransactionResult;
99
+ mintWithdrawalCap: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
100
100
  /**
101
101
  * @description Deposit using the DepositCap
102
102
  * @param {string} managerKey The name of the BalanceManager
@@ -112,7 +112,7 @@ declare class BalanceManagerContract {
112
112
  * @param {number} amountToWithdraw The amount to withdraw
113
113
  * @returns A function that takes a Transaction object
114
114
  */
115
- withdrawWithCap: (managerKey: string, coinKey: string, amountToWithdraw: number) => (tx: Transaction) => _mysten_sui_transactions3.TransactionResult;
115
+ withdrawWithCap: (managerKey: string, coinKey: string, amountToWithdraw: number) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
116
116
  /**
117
117
  * @description Set the referral for the BalanceManager for a specific pool
118
118
  * @param {string} managerKey The name of the BalanceManager
@@ -147,20 +147,20 @@ declare class BalanceManagerContract {
147
147
  * @param {string} referralId The ID of the referral to get the owner of
148
148
  * @returns A function that takes a Transaction object
149
149
  */
150
- balanceManagerReferralOwner: (referralId: string) => (tx: Transaction) => _mysten_sui_transactions3.TransactionResult;
150
+ balanceManagerReferralOwner: (referralId: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
151
151
  /**
152
152
  * @description Get the pool ID associated with a referral (DeepBookPoolReferral)
153
153
  * @param {string} referralId The ID of the referral to get the pool ID of
154
154
  * @returns A function that takes a Transaction object
155
155
  */
156
- balanceManagerReferralPoolId: (referralId: string) => (tx: Transaction) => _mysten_sui_transactions3.TransactionResult;
156
+ balanceManagerReferralPoolId: (referralId: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
157
157
  /**
158
158
  * @description Get the referral ID from the balance manager for a specific pool
159
159
  * @param {string} managerKey The name of the BalanceManager
160
160
  * @param {string} poolKey Key of the pool to get the referral for
161
161
  * @returns A function that takes a Transaction object
162
162
  */
163
- getBalanceManagerReferralId: (managerKey: string, poolKey: string) => (tx: Transaction) => _mysten_sui_transactions3.TransactionResult;
163
+ getBalanceManagerReferralId: (managerKey: string, poolKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
164
164
  /**
165
165
  * @description Revoke a TradeCap. This also revokes the associated DepositCap and WithdrawCap.
166
166
  * @param {string} managerKey The name of the BalanceManager
@@ -1,6 +1,6 @@
1
1
  import { CanPlaceLimitOrderParams, CanPlaceMarketOrderParams, CreatePermissionlessPoolParams, PlaceLimitOrderParams, PlaceMarketOrderParams, SwapParams, SwapWithManagerParams } from "../types/index.mjs";
2
2
  import { DeepBookConfig } from "../utils/config.mjs";
3
- import * as _mysten_sui_transactions14 from "@mysten/sui/transactions";
3
+ import * as _mysten_sui_transactions10 from "@mysten/sui/transactions";
4
4
  import { Transaction } from "@mysten/sui/transactions";
5
5
 
6
6
  //#region src/transactions/deepbook.d.ts
@@ -380,40 +380,40 @@ declare class DeepBookContract {
380
380
  * @param {string} referral The referral (DeepBookPoolReferral) to get the balances for
381
381
  * @returns A function that takes a Transaction object
382
382
  */
383
- getPoolReferralBalances: (poolKey: string, referral: string) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
383
+ getPoolReferralBalances: (poolKey: string, referral: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
384
384
  /**
385
385
  * @description Get the multiplier for a referral (DeepBookPoolReferral)
386
386
  * @param {string} poolKey The key to identify the pool
387
387
  * @param {string} referral The referral (DeepBookPoolReferral) to get the multiplier for
388
388
  * @returns A function that takes a Transaction object
389
389
  */
390
- poolReferralMultiplier: (poolKey: string, referral: string) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
390
+ poolReferralMultiplier: (poolKey: string, referral: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
391
391
  /**
392
392
  * @description Check if a pool is a stable pool
393
393
  * @param {string} poolKey The key to identify the pool
394
394
  * @returns A function that takes a Transaction object
395
395
  */
396
- stablePool: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
396
+ stablePool: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
397
397
  /**
398
398
  * @description Check if a pool is registered
399
399
  * @param {string} poolKey The key to identify the pool
400
400
  * @returns A function that takes a Transaction object
401
401
  */
402
- registeredPool: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
402
+ registeredPool: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
403
403
  /**
404
404
  * @description Get the quote quantity out for a given base quantity using input token as fee
405
405
  * @param {string} poolKey The key to identify the pool
406
406
  * @param {number} baseQuantity Base quantity to convert
407
407
  * @returns A function that takes a Transaction object
408
408
  */
409
- getQuoteQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
409
+ getQuoteQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
410
410
  /**
411
411
  * @description Get the base quantity out for a given quote quantity using input token as fee
412
412
  * @param {string} poolKey The key to identify the pool
413
413
  * @param {number} quoteQuantity Quote quantity to convert
414
414
  * @returns A function that takes a Transaction object
415
415
  */
416
- getBaseQuantityOutInputFee: (poolKey: string, quoteQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
416
+ getBaseQuantityOutInputFee: (poolKey: string, quoteQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
417
417
  /**
418
418
  * @description Get the quantity out for a given base or quote quantity using input token as fee
419
419
  * @param {string} poolKey The key to identify the pool
@@ -421,7 +421,7 @@ declare class DeepBookContract {
421
421
  * @param {number} quoteQuantity Quote quantity to convert
422
422
  * @returns A function that takes a Transaction object
423
423
  */
424
- getQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint, quoteQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
424
+ getQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint, quoteQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
425
425
  /**
426
426
  * @description Get the base quantity needed to receive a target quote quantity
427
427
  * @param {string} poolKey The key to identify the pool
@@ -429,7 +429,7 @@ declare class DeepBookContract {
429
429
  * @param {boolean} payWithDeep Whether to pay fees with DEEP
430
430
  * @returns A function that takes a Transaction object
431
431
  */
432
- getBaseQuantityIn: (poolKey: string, targetQuoteQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
432
+ getBaseQuantityIn: (poolKey: string, targetQuoteQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
433
433
  /**
434
434
  * @description Get the quote quantity needed to receive a target base quantity
435
435
  * @param {string} poolKey The key to identify the pool
@@ -437,14 +437,14 @@ declare class DeepBookContract {
437
437
  * @param {boolean} payWithDeep Whether to pay fees with DEEP
438
438
  * @returns A function that takes a Transaction object
439
439
  */
440
- getQuoteQuantityIn: (poolKey: string, targetBaseQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
440
+ getQuoteQuantityIn: (poolKey: string, targetBaseQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
441
441
  /**
442
442
  * @description Get account order details for a balance manager
443
443
  * @param {string} poolKey The key to identify the pool
444
444
  * @param {string} managerKey Key of the balance manager
445
445
  * @returns A function that takes a Transaction object
446
446
  */
447
- getAccountOrderDetails: (poolKey: string, managerKey: string) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
447
+ getAccountOrderDetails: (poolKey: string, managerKey: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
448
448
  /**
449
449
  * @description Get the DEEP required for an order
450
450
  * @param {string} poolKey The key to identify the pool
@@ -452,51 +452,51 @@ declare class DeepBookContract {
452
452
  * @param {number} price Price
453
453
  * @returns A function that takes a Transaction object
454
454
  */
455
- getOrderDeepRequired: (poolKey: string, baseQuantity: number | bigint, price: number | bigint) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
455
+ getOrderDeepRequired: (poolKey: string, baseQuantity: number | bigint, price: number | bigint) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
456
456
  /**
457
457
  * @description Check if account exists for a balance manager
458
458
  * @param {string} poolKey The key to identify the pool
459
459
  * @param {string} managerKey Key of the balance manager
460
460
  * @returns A function that takes a Transaction object
461
461
  */
462
- accountExists: (poolKey: string, managerKey: string) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
462
+ accountExists: (poolKey: string, managerKey: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
463
463
  /**
464
464
  * @description Get the next epoch trade parameters for a pool
465
465
  * @param {string} poolKey The key to identify the pool
466
466
  * @returns A function that takes a Transaction object
467
467
  */
468
- poolTradeParamsNext: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
468
+ poolTradeParamsNext: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
469
469
  /**
470
470
  * @description Get the quorum for a pool
471
471
  * @param {string} poolKey The key to identify the pool
472
472
  * @returns A function that takes a Transaction object
473
473
  */
474
- quorum: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
474
+ quorum: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
475
475
  /**
476
476
  * @description Get the pool ID
477
477
  * @param {string} poolKey The key to identify the pool
478
478
  * @returns A function that takes a Transaction object
479
479
  */
480
- poolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
480
+ poolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
481
481
  /**
482
482
  * @description Check if a limit order can be placed
483
483
  * @param {CanPlaceLimitOrderParams} params Parameters for checking limit order validity
484
484
  * @returns A function that takes a Transaction object
485
485
  */
486
- canPlaceLimitOrder: (params: CanPlaceLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
486
+ canPlaceLimitOrder: (params: CanPlaceLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
487
487
  /**
488
488
  * @description Check if a market order can be placed
489
489
  * @param {CanPlaceMarketOrderParams} params Parameters for checking market order validity
490
490
  * @returns A function that takes a Transaction object
491
491
  */
492
- canPlaceMarketOrder: (params: CanPlaceMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
492
+ canPlaceMarketOrder: (params: CanPlaceMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
493
493
  /**
494
494
  * @description Check if market order params are valid
495
495
  * @param {string} poolKey The key to identify the pool
496
496
  * @param {number} quantity Quantity
497
497
  * @returns A function that takes a Transaction object
498
498
  */
499
- checkMarketOrderParams: (poolKey: string, quantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
499
+ checkMarketOrderParams: (poolKey: string, quantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
500
500
  /**
501
501
  * @description Check if limit order params are valid
502
502
  * @param {string} poolKey The key to identify the pool
@@ -505,7 +505,7 @@ declare class DeepBookContract {
505
505
  * @param {number} expireTimestamp Expiration timestamp
506
506
  * @returns A function that takes a Transaction object
507
507
  */
508
- checkLimitOrderParams: (poolKey: string, price: number | bigint, quantity: number | bigint, expireTimestamp: number) => (tx: Transaction) => _mysten_sui_transactions14.TransactionResult;
508
+ checkLimitOrderParams: (poolKey: string, price: number | bigint, quantity: number | bigint, expireTimestamp: number) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
509
509
  }
510
510
  //#endregion
511
511
  export { DeepBookContract };
@@ -1,6 +1,6 @@
1
1
  import { CreatePoolAdminParams, SetEwmaParams } from "../types/index.mjs";
2
2
  import { DeepBookConfig } from "../utils/config.mjs";
3
- import * as _mysten_sui_transactions33 from "@mysten/sui/transactions";
3
+ import * as _mysten_sui_transactions29 from "@mysten/sui/transactions";
4
4
  import { Transaction } from "@mysten/sui/transactions";
5
5
 
6
6
  //#region src/transactions/deepbookAdmin.d.ts
@@ -104,7 +104,36 @@ declare class DeepBookAdminContract {
104
104
  * @description Deauthorize the MarginApp by removing its authorization key
105
105
  * @returns A function that takes a Transaction object and returns a bool
106
106
  */
107
- deauthorizeMarginApp: () => (tx: Transaction) => _mysten_sui_transactions33.TransactionResult;
107
+ deauthorizeMarginApp: () => (tx: Transaction) => _mysten_sui_transactions29.TransactionResult;
108
+ /**
109
+ * @description Mint a `DeepbookCorePauseCap`. The new cap's ID is recorded
110
+ * in the core registry so it can later disable any allowed package version
111
+ * via `disableVersionWithCorePauseCap`. Companion to the margin-side
112
+ * `MarginAdminContract.mintPauseCap`.
113
+ * @returns A function that takes a Transaction object and returns the new pause cap
114
+ */
115
+ mintCorePauseCap: () => (tx: Transaction) => _mysten_sui_transactions29.TransactionResult;
116
+ /**
117
+ * @description Revoke a previously minted `DeepbookCorePauseCap` by ID.
118
+ * @param {string} pauseCapId The ID of the core pause cap to revoke
119
+ * @returns A function that takes a Transaction object
120
+ */
121
+ revokeCorePauseCap: (pauseCapId: string) => (tx: Transaction) => void;
122
+ /**
123
+ * @description Emergency kill switch — disable any allowed core package
124
+ * version (including the current one) using a held `DeepbookCorePauseCap`.
125
+ * Re-enable later via `enableVersion`.
126
+ * @param {number | bigint} version The version to disable
127
+ * @param {string} pauseCapId The ID of the core pause cap to authorize the disable
128
+ * @returns A function that takes a Transaction object
129
+ */
130
+ disableVersionWithCorePauseCap: (version: number | bigint, pauseCapId: string) => (tx: Transaction) => void;
131
+ /**
132
+ * @description Get the set of allowed `DeepbookCorePauseCap` IDs from the
133
+ * core registry.
134
+ * @returns A function that takes a Transaction object and returns a `VecSet<ID>`
135
+ */
136
+ corePauseCaps: () => (tx: Transaction) => _mysten_sui_transactions29.TransactionResult;
108
137
  }
109
138
  //#endregion
110
139
  export { DeepBookAdminContract };
@@ -1 +1 @@
1
- {"version":3,"file":"deepbookAdmin.d.mts","names":[],"sources":["../../src/transactions/deepbookAdmin.ts"],"mappings":";;;;;;;;;cAaa,qBAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EAuD4B;;;;;EAlChD,eAAA,GAAmB,MAAA,EAAQ,qBAAA,MAA2B,EAAA,EAAI,WAAA;EAwIP;;;;;EAtGnD,mBAAA,GAAuB,OAAA,cAAqB,EAAA,EAAI,WAAA;EA0Na;;;;;EAtM7D,qBAAA,GAAyB,OAAA,cAAqB,EAAA,EAAI,WAAA;;;;;;EAoBlD,aAAA,GAAiB,OAAA,cAAqB,EAAA,EAAI,WAAA;EA1EvB;;;;;EA0FnB,cAAA,GAAkB,OAAA,cAAqB,EAAA,EAAI,WAAA;EAxDC;;;;;EAwE5C,kBAAA,GAAsB,eAAA,cAA6B,EAAA,EAAI,WAAA;EAhCtC;;;;;EAgDjB,aAAA,GAAiB,aAAA,cAA2B,EAAA,EAAI,WAAA;EAhCT;;;;;EA8CvC,gBAAA,GAAoB,aAAA,cAA2B,EAAA,EAAI,WAAA;EAdlC;;;;;;EA6BjB,cAAA,GAAkB,OAAA,UAAiB,WAAA,cAAyB,EAAA,EAAI,WAAA;EAAhE;;;;;;;EA8BA,gBAAA,GACE,OAAA,UAAiB,UAAA,UAAoB,UAAA,cAAwB,EAAA,EAAI,WAAA;EAA5B;;;;EA4BvC,qBAAA,SAA+B,EAAA,EAAI,WAAA;EAAJ;;;;;;EAa/B,aAAA,GAAiB,OAAA,UAAiB,MAAA,EAAQ,aAAA,MAAmB,EAAA,EAAI,WAAA;EA6BjE;;;;;;EAAA,eAAA,GAAmB,OAAA,UAAiB,MAAA,eAAqB,EAAA,EAAI,WAAA;EAqBjC;;;;EAA5B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,WAAA;EAAA;;;;EAYhC,oBAAA,SAA8B,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAAA;;;;;;;EAe7C,gBAAA,SAA0B,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAYK;;;;;EAA9C,kBAAA,GAAsB,UAAA,cAAwB,EAAA,EAAI,WAAA;EAoClD;;;;;;;;EAjBA,8BAAA,GACE,OAAA,mBAA0B,UAAA,cAAwB,EAAA,EAAI,WAAA;;;;;;EAgBxD,aAAA,SAAuB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;AAAA"}
@@ -194,14 +194,46 @@ var DeepBookAdminContract = class {
194
194
  tx.moveCall({
195
195
  target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::authorize_app`,
196
196
  arguments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],
197
- typeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::margin_manager::MarginApp`]
197
+ typeArguments: [`${this.#config.MARGIN_V1}::margin_manager::MarginApp`]
198
198
  });
199
199
  };
200
200
  this.deauthorizeMarginApp = () => (tx) => {
201
201
  return tx.moveCall({
202
202
  target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::deauthorize_app`,
203
203
  arguments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],
204
- typeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::margin_manager::MarginApp`]
204
+ typeArguments: [`${this.#config.MARGIN_V1}::margin_manager::MarginApp`]
205
+ });
206
+ };
207
+ this.mintCorePauseCap = () => (tx) => {
208
+ return tx.moveCall({
209
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::mint_pause_cap`,
210
+ arguments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())]
211
+ });
212
+ };
213
+ this.revokeCorePauseCap = (pauseCapId) => (tx) => {
214
+ tx.moveCall({
215
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::revoke_pause_cap`,
216
+ arguments: [
217
+ tx.object(this.#config.REGISTRY_ID),
218
+ tx.object(this.#adminCap()),
219
+ tx.pure.id(pauseCapId)
220
+ ]
221
+ });
222
+ };
223
+ this.disableVersionWithCorePauseCap = (version, pauseCapId) => (tx) => {
224
+ tx.moveCall({
225
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::disable_version_pause_cap`,
226
+ arguments: [
227
+ tx.object(this.#config.REGISTRY_ID),
228
+ tx.pure.u64(version),
229
+ tx.object(pauseCapId)
230
+ ]
231
+ });
232
+ };
233
+ this.corePauseCaps = () => (tx) => {
234
+ return tx.moveCall({
235
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::allowed_pause_caps`,
236
+ arguments: [tx.object(this.#config.REGISTRY_ID)]
205
237
  });
206
238
  };
207
239
  this.#config = config;
@@ -1 +1 @@
1
- {"version":3,"file":"deepbookAdmin.mjs","names":["#config","#adminCap"],"sources":["../../src/transactions/deepbookAdmin.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 { CreatePoolAdminParams, SetEwmaParams } from '../types/index.js';\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { FLOAT_SCALAR } from '../utils/config.js';\nimport { convertQuantity, convertPrice, convertRate } from '../utils/conversion.js';\n\n/**\n * DeepBookAdminContract class for managing admin actions.\n */\nexport class DeepBookAdminContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for DeepBookAdminContract\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#adminCap() {\n\t\tconst adminCap = this.#config.adminCap;\n\t\tif (!adminCap) {\n\t\t\tthrow new Error('ADMIN_CAP environment variable not set');\n\t\t}\n\t\treturn adminCap;\n\t}\n\n\t/**\n\t * @description Create a new pool as admin\n\t * @param {CreatePoolAdminParams} params Parameters for creating pool as admin\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreatePoolAdmin = (params: CreatePoolAdminParams) => (tx: Transaction) => {\n\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\tconst { baseCoinKey, quoteCoinKey, tickSize, lotSize, minSize, whitelisted, stablePool } =\n\t\t\tparams;\n\t\tconst baseCoin = this.#config.getCoin(baseCoinKey);\n\t\tconst quoteCoin = this.#config.getCoin(quoteCoinKey);\n\n\t\tconst baseScalar = baseCoin.scalar;\n\t\tconst quoteScalar = quoteCoin.scalar;\n\n\t\tconst adjustedTickSize = convertPrice(tickSize, FLOAT_SCALAR, quoteScalar, baseScalar);\n\t\tconst adjustedLotSize = convertQuantity(lotSize, baseScalar);\n\t\tconst adjustedMinSize = convertQuantity(minSize, baseScalar);\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::create_pool_admin`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.REGISTRY_ID), // registry_id\n\t\t\t\ttx.pure.u64(adjustedTickSize), // adjusted tick_size\n\t\t\t\ttx.pure.u64(adjustedLotSize), // adjusted lot_size\n\t\t\t\ttx.pure.u64(adjustedMinSize), // adjusted min_size\n\t\t\t\ttx.pure.bool(whitelisted),\n\t\t\t\ttx.pure.bool(stablePool),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Unregister a pool as admin\n\t * @param {string} poolKey The key of the pool to be unregistered by admin\n\t * @returns A function that takes a Transaction object\n\t */\n\tunregisterPoolAdmin = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::unregister_pool_admin`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Update the allowed versions for a pool\n\t * @param {string} poolKey The key of the pool to be updated\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateAllowedVersions = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::update_allowed_versions`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::enable_version`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.pure.u64(version),\n\t\t\t\ttx.object(this.#adminCap()),\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::disable_version`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.pure.u64(version),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Sets the treasury address where pool creation fees will be sent\n\t * @param {string} treasuryAddress The treasury address\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetTreasuryAddress = (treasuryAddress: string) => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::set_treasury_address`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.pure.address(treasuryAddress),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Add a coin to whitelist of stable coins\n\t * @param {string} stableCoinKey The name of the stable coin to be added\n\t * @returns A function that takes a Transaction object\n\t */\n\taddStableCoin = (stableCoinKey: string) => (tx: Transaction) => {\n\t\tconst stableCoinType = this.#config.getCoin(stableCoinKey).type;\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::add_stablecoin`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],\n\t\t\ttypeArguments: [stableCoinType],\n\t\t});\n\t};\n\n\t/**\n\t * @description Remove a coin from whitelist of stable coins\n\t * @param {string} stableCoinKey The name of the stable coin to be removed\n\t * @returns A function that takes a Transaction object\n\t */\n\tremoveStableCoin = (stableCoinKey: string) => (tx: Transaction) => {\n\t\tconst stableCoinType = this.#config.getCoin(stableCoinKey).type;\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::remove_stablecoin`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],\n\t\t\ttypeArguments: [stableCoinType],\n\t\t});\n\t};\n\n\t/**\n\t * @description Adjust the tick size of a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} newTickSize The new tick size\n\t * @returns A function that takes a Transaction object\n\t */\n\tadjustTickSize = (poolKey: string, newTickSize: number) => (tx: Transaction) => {\n\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\tconst baseScalar = baseCoin.scalar;\n\t\tconst quoteScalar = quoteCoin.scalar;\n\n\t\tconst adjustedTickSize = convertPrice(newTickSize, FLOAT_SCALAR, quoteScalar, baseScalar);\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::adjust_tick_size_admin`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address), // pool address\n\t\t\t\ttx.pure.u64(adjustedTickSize), // adjusted tick_size\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Adjust the lot size and min size of a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} newLotSize The new lot size\n\t * @param {number} newMinSize The new min size\n\t * @returns A function that takes a Transaction object\n\t */\n\tadjustMinLotSize =\n\t\t(poolKey: string, newLotSize: number, newMinSize: number) => (tx: Transaction) => {\n\t\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\t\tconst baseScalar = baseCoin.scalar;\n\n\t\t\tconst adjustedLotSize = convertQuantity(newLotSize, baseScalar);\n\t\t\tconst adjustedMinSize = convertQuantity(newMinSize, baseScalar);\n\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::adjust_min_lot_size_admin`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(pool.address), // pool address\n\t\t\t\t\ttx.pure.u64(adjustedLotSize),\n\t\t\t\t\ttx.pure.u64(adjustedMinSize),\n\t\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Initialize the balance manager map\n\t * @returns A function that takes a Transaction object\n\t */\n\tinitBalanceManagerMap = () => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::init_balance_manager_map`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],\n\t\t});\n\t};\n\n\t/**\n\t * @description Set the EWMA parameters for a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {SetEwmaParamsParams} params The parameters to set\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetEwmaParams = (poolKey: string, params: SetEwmaParams) => (tx: Transaction) => {\n\t\tconst { alpha, zScoreThreshold, additionalTakerFee } = params;\n\t\tconst adjustedAlpha = convertRate(alpha, FLOAT_SCALAR);\n\t\tconst adjustedZScoreThreshold = convertRate(zScoreThreshold, FLOAT_SCALAR);\n\t\tconst adjustedAdditionalTakerFee = convertRate(additionalTakerFee, FLOAT_SCALAR);\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::set_ewma_params`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t\ttx.pure.u64(adjustedAlpha),\n\t\t\t\ttx.pure.u64(adjustedZScoreThreshold),\n\t\t\t\ttx.pure.u64(adjustedAdditionalTakerFee),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Enable or disable the EWMA state for a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {boolean} enable Whether to enable or disable the EWMA state\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableEwmaState = (poolKey: string, enable: boolean) => (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\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::enable_ewma_state`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t\ttx.pure.bool(enable),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Authorize the MarginApp to access protected features of DeepBook\n\t * @returns A function that takes a Transaction object\n\t */\n\tauthorizeMarginApp = () => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::authorize_app`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],\n\t\t\ttypeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::margin_manager::MarginApp`],\n\t\t});\n\t};\n\n\t/**\n\t * @description Deauthorize the MarginApp by removing its authorization key\n\t * @returns A function that takes a Transaction object and returns a bool\n\t */\n\tdeauthorizeMarginApp = () => (tx: Transaction) => {\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::deauthorize_app`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY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min.mjs","names":["#config","#adminCap"],"sources":["../../src/transactions/deepbookAdmin.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 { CreatePoolAdminParams, SetEwmaParams } from '../types/index.js';\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { FLOAT_SCALAR } from '../utils/config.js';\nimport { convertQuantity, convertPrice, convertRate } from '../utils/conversion.js';\n\n/**\n * DeepBookAdminContract class for managing admin actions.\n */\nexport class DeepBookAdminContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for DeepBookAdminContract\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#adminCap() {\n\t\tconst adminCap = this.#config.adminCap;\n\t\tif (!adminCap) {\n\t\t\tthrow new Error('ADMIN_CAP environment variable not set');\n\t\t}\n\t\treturn adminCap;\n\t}\n\n\t/**\n\t * @description Create a new pool as admin\n\t * @param {CreatePoolAdminParams} params Parameters for creating pool as admin\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreatePoolAdmin = (params: CreatePoolAdminParams) => (tx: Transaction) => {\n\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\tconst { baseCoinKey, quoteCoinKey, tickSize, lotSize, minSize, whitelisted, stablePool } =\n\t\t\tparams;\n\t\tconst baseCoin = this.#config.getCoin(baseCoinKey);\n\t\tconst quoteCoin = this.#config.getCoin(quoteCoinKey);\n\n\t\tconst baseScalar = baseCoin.scalar;\n\t\tconst quoteScalar = quoteCoin.scalar;\n\n\t\tconst adjustedTickSize = convertPrice(tickSize, FLOAT_SCALAR, quoteScalar, baseScalar);\n\t\tconst adjustedLotSize = convertQuantity(lotSize, baseScalar);\n\t\tconst adjustedMinSize = convertQuantity(minSize, baseScalar);\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::create_pool_admin`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.REGISTRY_ID), // registry_id\n\t\t\t\ttx.pure.u64(adjustedTickSize), // adjusted tick_size\n\t\t\t\ttx.pure.u64(adjustedLotSize), // adjusted lot_size\n\t\t\t\ttx.pure.u64(adjustedMinSize), // adjusted min_size\n\t\t\t\ttx.pure.bool(whitelisted),\n\t\t\t\ttx.pure.bool(stablePool),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Unregister a pool as admin\n\t * @param {string} poolKey The key of the pool to be unregistered by admin\n\t * @returns A function that takes a Transaction object\n\t */\n\tunregisterPoolAdmin = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::unregister_pool_admin`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Update the allowed versions for a pool\n\t * @param {string} poolKey The key of the pool to be updated\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateAllowedVersions = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::update_allowed_versions`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::enable_version`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.pure.u64(version),\n\t\t\t\ttx.object(this.#adminCap()),\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::disable_version`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.pure.u64(version),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Sets the treasury address where pool creation fees will be sent\n\t * @param {string} treasuryAddress The treasury address\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetTreasuryAddress = (treasuryAddress: string) => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::set_treasury_address`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.pure.address(treasuryAddress),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Add a coin to whitelist of stable coins\n\t * @param {string} stableCoinKey The name of the stable coin to be added\n\t * @returns A function that takes a Transaction object\n\t */\n\taddStableCoin = (stableCoinKey: string) => (tx: Transaction) => {\n\t\tconst stableCoinType = this.#config.getCoin(stableCoinKey).type;\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::add_stablecoin`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],\n\t\t\ttypeArguments: [stableCoinType],\n\t\t});\n\t};\n\n\t/**\n\t * @description Remove a coin from whitelist of stable coins\n\t * @param {string} stableCoinKey The name of the stable coin to be removed\n\t * @returns A function that takes a Transaction object\n\t */\n\tremoveStableCoin = (stableCoinKey: string) => (tx: Transaction) => {\n\t\tconst stableCoinType = this.#config.getCoin(stableCoinKey).type;\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::remove_stablecoin`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],\n\t\t\ttypeArguments: [stableCoinType],\n\t\t});\n\t};\n\n\t/**\n\t * @description Adjust the tick size of a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} newTickSize The new tick size\n\t * @returns A function that takes a Transaction object\n\t */\n\tadjustTickSize = (poolKey: string, newTickSize: number) => (tx: Transaction) => {\n\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\tconst baseScalar = baseCoin.scalar;\n\t\tconst quoteScalar = quoteCoin.scalar;\n\n\t\tconst adjustedTickSize = convertPrice(newTickSize, FLOAT_SCALAR, quoteScalar, baseScalar);\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::adjust_tick_size_admin`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address), // pool address\n\t\t\t\ttx.pure.u64(adjustedTickSize), // adjusted tick_size\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Adjust the lot size and min size of a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} newLotSize The new lot size\n\t * @param {number} newMinSize The new min size\n\t * @returns A function that takes a Transaction object\n\t */\n\tadjustMinLotSize =\n\t\t(poolKey: string, newLotSize: number, newMinSize: number) => (tx: Transaction) => {\n\t\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\t\tconst baseScalar = baseCoin.scalar;\n\n\t\t\tconst adjustedLotSize = convertQuantity(newLotSize, baseScalar);\n\t\t\tconst adjustedMinSize = convertQuantity(newMinSize, baseScalar);\n\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::adjust_min_lot_size_admin`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(pool.address), // pool address\n\t\t\t\t\ttx.pure.u64(adjustedLotSize),\n\t\t\t\t\ttx.pure.u64(adjustedMinSize),\n\t\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Initialize the balance manager map\n\t * @returns A function that takes a Transaction object\n\t */\n\tinitBalanceManagerMap = () => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::init_balance_manager_map`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],\n\t\t});\n\t};\n\n\t/**\n\t * @description Set the EWMA parameters for a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {SetEwmaParamsParams} params The parameters to set\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetEwmaParams = (poolKey: string, params: SetEwmaParams) => (tx: Transaction) => {\n\t\tconst { alpha, zScoreThreshold, additionalTakerFee } = params;\n\t\tconst adjustedAlpha = convertRate(alpha, FLOAT_SCALAR);\n\t\tconst adjustedZScoreThreshold = convertRate(zScoreThreshold, FLOAT_SCALAR);\n\t\tconst adjustedAdditionalTakerFee = convertRate(additionalTakerFee, FLOAT_SCALAR);\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::set_ewma_params`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t\ttx.pure.u64(adjustedAlpha),\n\t\t\t\ttx.pure.u64(adjustedZScoreThreshold),\n\t\t\t\ttx.pure.u64(adjustedAdditionalTakerFee),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Enable or disable the EWMA state for a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {boolean} enable Whether to enable or disable the EWMA state\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableEwmaState = (poolKey: string, enable: boolean) => (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\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::enable_ewma_state`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t\ttx.pure.bool(enable),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Authorize the MarginApp to access protected features of DeepBook\n\t * @returns A function that takes a Transaction object\n\t */\n\tauthorizeMarginApp = () => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::authorize_app`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],\n\t\t\ttypeArguments: [`${this.#config.MARGIN_V1}::margin_manager::MarginApp`],\n\t\t});\n\t};\n\n\t/**\n\t * @description Deauthorize the MarginApp by removing its authorization key\n\t * @returns A function that takes a Transaction object and returns a bool\n\t */\n\tdeauthorizeMarginApp = () => (tx: Transaction) => {\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::deauthorize_app`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],\n\t\t\ttypeArguments: [`${this.#config.MARGIN_V1}::margin_manager::MarginApp`],\n\t\t});\n\t};\n\n\t/**\n\t * @description Mint a `DeepbookCorePauseCap`. The new cap's ID is recorded\n\t * in the core registry so it can later disable any allowed package version\n\t * via `disableVersionWithCorePauseCap`. Companion to the margin-side\n\t * `MarginAdminContract.mintPauseCap`.\n\t * @returns A function that takes a Transaction object and returns the new pause cap\n\t */\n\tmintCorePauseCap = () => (tx: Transaction) => {\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::mint_pause_cap`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],\n\t\t});\n\t};\n\n\t/**\n\t * @description Revoke a previously minted `DeepbookCorePauseCap` by ID.\n\t * @param {string} pauseCapId The ID of the core pause cap to revoke\n\t * @returns A function that takes a Transaction object\n\t */\n\trevokeCorePauseCap = (pauseCapId: string) => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::revoke_pause_cap`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t\ttx.pure.id(pauseCapId),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Emergency kill switch — disable any allowed core package\n\t * version (including the current one) using a held `DeepbookCorePauseCap`.\n\t * Re-enable later via `enableVersion`.\n\t * @param {number | bigint} version The version to disable\n\t * @param {string} pauseCapId The ID of the core pause cap to authorize the disable\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersionWithCorePauseCap =\n\t\t(version: number | bigint, pauseCapId: string) => (tx: Transaction) => {\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::disable_version_pause_cap`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\t\ttx.pure.u64(version),\n\t\t\t\t\ttx.object(pauseCapId),\n\t\t\t\t],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Get the set of allowed `DeepbookCorePauseCap` IDs from the\n\t * core registry.\n\t * @returns A function that takes a Transaction object and returns a `VecSet<ID>`\n\t */\n\tcorePauseCaps = () => (tx: Transaction) => {\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::allowed_pause_caps`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID)],\n\t\t});\n\t};\n}\n"],"mappings":";;;;;;;AAaA,IAAa,wBAAb,MAAmC;CAClC;;;;CAKA,YAAY,QAAwB;0BAqBjB,YAAmC,OAAoB;AACzE,MAAG,kBAAkB,MAAKA,OAAQ,QAAQ;GAC1C,MAAM,EAAE,aAAa,cAAc,UAAU,SAAS,SAAS,aA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