@mysten/deepbook-v3 1.5.8 → 1.6.2

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 (182) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/dist/client.d.mts +5 -0
  3. package/dist/client.d.mts.map +1 -1
  4. package/dist/client.mjs +7 -0
  5. package/dist/client.mjs.map +1 -1
  6. package/dist/contracts/deepbook/account.d.mts +18 -18
  7. package/dist/contracts/deepbook/account.d.mts.map +1 -1
  8. package/dist/contracts/deepbook/balance_manager.mjs +413 -0
  9. package/dist/contracts/deepbook/balance_manager.mjs.map +1 -0
  10. package/dist/contracts/deepbook/big_vector.mjs +43 -0
  11. package/dist/contracts/deepbook/big_vector.mjs.map +1 -0
  12. package/dist/contracts/deepbook/book.mjs +29 -0
  13. package/dist/contracts/deepbook/book.mjs.map +1 -0
  14. package/dist/contracts/deepbook/deep_price.d.mts +3 -3
  15. package/dist/contracts/deepbook/deep_price.d.mts.map +1 -1
  16. package/dist/contracts/deepbook/deep_price.mjs +1 -1
  17. package/dist/contracts/deepbook/deps/std/type_name.mjs +17 -0
  18. package/dist/contracts/deepbook/deps/std/type_name.mjs.map +1 -0
  19. package/dist/contracts/deepbook/deps/sui/bag.mjs +43 -0
  20. package/dist/contracts/deepbook/deps/sui/bag.mjs.map +1 -0
  21. package/dist/contracts/deepbook/deps/sui/balance.mjs +21 -0
  22. package/dist/contracts/deepbook/deps/sui/balance.mjs.map +1 -0
  23. package/dist/contracts/deepbook/deps/sui/table.mjs +38 -0
  24. package/dist/contracts/deepbook/deps/sui/table.mjs.map +1 -0
  25. package/dist/contracts/deepbook/deps/sui/vec_map.mjs +37 -0
  26. package/dist/contracts/deepbook/deps/sui/vec_map.mjs.map +1 -0
  27. package/dist/contracts/deepbook/deps/sui/versioned.mjs +19 -0
  28. package/dist/contracts/deepbook/deps/sui/versioned.mjs.map +1 -0
  29. package/dist/contracts/deepbook/governance.mjs +49 -0
  30. package/dist/contracts/deepbook/governance.mjs.map +1 -0
  31. package/dist/contracts/deepbook/history.mjs +56 -0
  32. package/dist/contracts/deepbook/history.mjs.map +1 -0
  33. package/dist/contracts/deepbook/order.d.mts +12 -12
  34. package/dist/contracts/deepbook/pool.mjs +1739 -0
  35. package/dist/contracts/deepbook/pool.mjs.map +1 -0
  36. package/dist/contracts/deepbook/registry.mjs +295 -0
  37. package/dist/contracts/deepbook/registry.mjs.map +1 -0
  38. package/dist/contracts/deepbook/state.mjs +89 -0
  39. package/dist/contracts/deepbook/state.mjs.map +1 -0
  40. package/dist/contracts/deepbook/trade_params.mjs +21 -0
  41. package/dist/contracts/deepbook/trade_params.mjs.map +1 -0
  42. package/dist/contracts/deepbook/vault.mjs +42 -0
  43. package/dist/contracts/deepbook/vault.mjs.map +1 -0
  44. package/dist/contracts/deepbook_margin/deps/deepbook/balance_manager.mjs +53 -0
  45. package/dist/contracts/deepbook_margin/deps/deepbook/balance_manager.mjs.map +1 -0
  46. package/dist/contracts/deepbook_margin/deps/std/type_name.mjs +17 -0
  47. package/dist/contracts/deepbook_margin/deps/std/type_name.mjs.map +1 -0
  48. package/dist/contracts/deepbook_margin/deps/sui/bag.mjs +43 -0
  49. package/dist/contracts/deepbook_margin/deps/sui/bag.mjs.map +1 -0
  50. package/dist/contracts/deepbook_margin/deps/sui/balance.mjs +21 -0
  51. package/dist/contracts/deepbook_margin/deps/sui/balance.mjs.map +1 -0
  52. package/dist/contracts/deepbook_margin/deps/sui/table.mjs +38 -0
  53. package/dist/contracts/deepbook_margin/deps/sui/table.mjs.map +1 -0
  54. package/dist/contracts/deepbook_margin/deps/sui/vec_map.mjs +37 -0
  55. package/dist/contracts/deepbook_margin/deps/sui/vec_map.mjs.map +1 -0
  56. package/dist/contracts/deepbook_margin/deps/sui/vec_set.mjs +26 -0
  57. package/dist/contracts/deepbook_margin/deps/sui/vec_set.mjs.map +1 -0
  58. package/dist/contracts/deepbook_margin/deps/sui/versioned.mjs +19 -0
  59. package/dist/contracts/deepbook_margin/deps/sui/versioned.mjs.map +1 -0
  60. package/dist/contracts/deepbook_margin/margin_manager.mjs +989 -0
  61. package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -0
  62. package/dist/contracts/deepbook_margin/margin_pool.mjs +550 -0
  63. package/dist/contracts/deepbook_margin/margin_pool.mjs.map +1 -0
  64. package/dist/contracts/deepbook_margin/margin_registry.mjs +786 -0
  65. package/dist/contracts/deepbook_margin/margin_registry.mjs.map +1 -0
  66. package/dist/contracts/deepbook_margin/margin_state.mjs +30 -0
  67. package/dist/contracts/deepbook_margin/margin_state.mjs.map +1 -0
  68. package/dist/contracts/deepbook_margin/oracle.mjs +82 -0
  69. package/dist/contracts/deepbook_margin/oracle.mjs.map +1 -0
  70. package/dist/contracts/deepbook_margin/pool_proxy.mjs +644 -0
  71. package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -0
  72. package/dist/contracts/deepbook_margin/position_manager.mjs +32 -0
  73. package/dist/contracts/deepbook_margin/position_manager.mjs.map +1 -0
  74. package/dist/contracts/deepbook_margin/protocol_config.mjs +122 -0
  75. package/dist/contracts/deepbook_margin/protocol_config.mjs.map +1 -0
  76. package/dist/contracts/deepbook_margin/protocol_fees.mjs +58 -0
  77. package/dist/contracts/deepbook_margin/protocol_fees.mjs.map +1 -0
  78. package/dist/contracts/deepbook_margin/rate_limiter.mjs +26 -0
  79. package/dist/contracts/deepbook_margin/rate_limiter.mjs.map +1 -0
  80. package/dist/contracts/deepbook_margin/tpsl.mjs +171 -0
  81. package/dist/contracts/deepbook_margin/tpsl.mjs.map +1 -0
  82. package/dist/contracts/margin_liquidation/deps/sui/bag.mjs +43 -0
  83. package/dist/contracts/margin_liquidation/deps/sui/bag.mjs.map +1 -0
  84. package/dist/contracts/margin_liquidation/liquidation_vault.mjs +179 -0
  85. package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -0
  86. package/dist/contracts/utils/index.d.mts +1 -1
  87. package/dist/contracts/utils/index.mjs +92 -3
  88. package/dist/contracts/utils/index.mjs.map +1 -1
  89. package/dist/queries/registryQueries.mjs +13 -0
  90. package/dist/queries/registryQueries.mjs.map +1 -1
  91. package/dist/transactions/balanceManager.d.mts.map +1 -1
  92. package/dist/transactions/balanceManager.mjs +119 -100
  93. package/dist/transactions/balanceManager.mjs.map +1 -1
  94. package/dist/transactions/deepbook.d.mts.map +1 -1
  95. package/dist/transactions/deepbook.mjs +464 -439
  96. package/dist/transactions/deepbook.mjs.map +1 -1
  97. package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
  98. package/dist/transactions/deepbookAdmin.mjs +151 -135
  99. package/dist/transactions/deepbookAdmin.mjs.map +1 -1
  100. package/dist/transactions/flashLoans.d.mts.map +1 -1
  101. package/dist/transactions/flashLoans.mjs +29 -22
  102. package/dist/transactions/flashLoans.mjs.map +1 -1
  103. package/dist/transactions/governance.d.mts.map +1 -1
  104. package/dist/transactions/governance.mjs +34 -33
  105. package/dist/transactions/governance.mjs.map +1 -1
  106. package/dist/transactions/marginAdmin.d.mts +17 -7
  107. package/dist/transactions/marginAdmin.d.mts.map +1 -1
  108. package/dist/transactions/marginAdmin.mjs +186 -169
  109. package/dist/transactions/marginAdmin.mjs.map +1 -1
  110. package/dist/transactions/marginLiquidations.d.mts +3 -3
  111. package/dist/transactions/marginLiquidations.d.mts.map +1 -1
  112. package/dist/transactions/marginLiquidations.mjs +53 -54
  113. package/dist/transactions/marginLiquidations.mjs.map +1 -1
  114. package/dist/transactions/marginMaintainer.d.mts +5 -5
  115. package/dist/transactions/marginMaintainer.d.mts.map +1 -1
  116. package/dist/transactions/marginMaintainer.mjs +83 -83
  117. package/dist/transactions/marginMaintainer.mjs.map +1 -1
  118. package/dist/transactions/marginManager.d.mts +32 -32
  119. package/dist/transactions/marginManager.d.mts.map +1 -1
  120. package/dist/transactions/marginManager.mjs +330 -317
  121. package/dist/transactions/marginManager.mjs.map +1 -1
  122. package/dist/transactions/marginPool.d.mts +18 -18
  123. package/dist/transactions/marginPool.d.mts.map +1 -1
  124. package/dist/transactions/marginPool.mjs +93 -89
  125. package/dist/transactions/marginPool.mjs.map +1 -1
  126. package/dist/transactions/marginRegistry.d.mts +22 -15
  127. package/dist/transactions/marginRegistry.d.mts.map +1 -1
  128. package/dist/transactions/marginRegistry.mjs +101 -68
  129. package/dist/transactions/marginRegistry.mjs.map +1 -1
  130. package/dist/transactions/marginTPSL.d.mts +27 -9
  131. package/dist/transactions/marginTPSL.d.mts.map +1 -1
  132. package/dist/transactions/marginTPSL.mjs +108 -82
  133. package/dist/transactions/marginTPSL.mjs.map +1 -1
  134. package/dist/transactions/poolProxy.d.mts +37 -5
  135. package/dist/transactions/poolProxy.d.mts.map +1 -1
  136. package/dist/transactions/poolProxy.mjs +269 -189
  137. package/dist/transactions/poolProxy.mjs.map +1 -1
  138. package/dist/utils/constants.mjs +4 -4
  139. package/dist/utils/constants.mjs.map +1 -1
  140. package/package.json +3 -3
  141. package/src/client.ts +8 -0
  142. package/src/contracts/deepbook/balance_manager.ts +46 -5
  143. package/src/contracts/deepbook/constants.ts +13 -0
  144. package/src/contracts/deepbook/pool.ts +133 -0
  145. package/src/contracts/deepbook/registry.ts +136 -1
  146. package/src/contracts/deepbook_margin/deps/deepbook/balance_manager.ts +49 -0
  147. package/src/contracts/deepbook_margin/deps/std/type_name.ts +24 -0
  148. package/src/contracts/deepbook_margin/deps/sui/bag.ts +41 -0
  149. package/src/contracts/deepbook_margin/deps/sui/balance.ts +19 -0
  150. package/src/contracts/deepbook_margin/deps/sui/table.ts +36 -0
  151. package/src/contracts/deepbook_margin/deps/sui/vec_map.ts +33 -0
  152. package/src/contracts/deepbook_margin/deps/sui/vec_set.ts +22 -0
  153. package/src/contracts/deepbook_margin/deps/sui/versioned.ts +13 -0
  154. package/src/contracts/deepbook_margin/margin_constants.ts +329 -0
  155. package/src/contracts/deepbook_margin/margin_manager.ts +1772 -0
  156. package/src/contracts/deepbook_margin/margin_pool.ts +1129 -0
  157. package/src/contracts/deepbook_margin/margin_registry.ts +1207 -0
  158. package/src/contracts/deepbook_margin/margin_state.ts +26 -0
  159. package/src/contracts/deepbook_margin/oracle.ts +99 -0
  160. package/src/contracts/deepbook_margin/pool_proxy.ts +1298 -0
  161. package/src/contracts/deepbook_margin/position_manager.ts +28 -0
  162. package/src/contracts/deepbook_margin/protocol_config.ts +163 -0
  163. package/src/contracts/deepbook_margin/protocol_fees.ts +153 -0
  164. package/src/contracts/deepbook_margin/rate_limiter.ts +80 -0
  165. package/src/contracts/deepbook_margin/tpsl.ts +559 -0
  166. package/src/contracts/margin_liquidation/deps/sui/bag.ts +41 -0
  167. package/src/contracts/margin_liquidation/liquidation_vault.ts +401 -0
  168. package/src/queries/registryQueries.ts +15 -0
  169. package/src/transactions/balanceManager.ts +140 -90
  170. package/src/transactions/deepbook.ts +586 -494
  171. package/src/transactions/deepbookAdmin.ts +154 -146
  172. package/src/transactions/flashLoans.ts +29 -20
  173. package/src/transactions/governance.ts +50 -37
  174. package/src/transactions/marginAdmin.ts +247 -188
  175. package/src/transactions/marginLiquidations.ts +70 -55
  176. package/src/transactions/marginMaintainer.ts +106 -88
  177. package/src/transactions/marginManager.ts +414 -348
  178. package/src/transactions/marginPool.ts +140 -103
  179. package/src/transactions/marginRegistry.ts +103 -70
  180. package/src/transactions/marginTPSL.ts +151 -87
  181. package/src/transactions/poolProxy.ts +384 -205
  182. package/src/utils/constants.ts +4 -4
@@ -1,5 +1,7 @@
1
1
  import { convertPrice, convertQuantity, convertRate } from "../utils/conversion.mjs";
2
2
  import { FLOAT_SCALAR } from "../utils/config.mjs";
3
+ import { adjustMinLotSizeAdmin, adjustTickSizeAdmin, createPoolAdmin, enableEwmaState, setEwmaParams, unregisterPoolAdmin, updateAllowedVersions } from "../contracts/deepbook/pool.mjs";
4
+ import { addStablecoin, allowedPauseCaps, authorizeApp, deauthorizeApp, disableVersion, disableVersionPauseCap, enableVersion, initBalanceManagerMap, mintPauseCap, removeStablecoin, revokePauseCap, setTreasuryAddress } from "../contracts/deepbook/registry.mjs";
3
5
 
4
6
  //#region src/transactions/deepbookAdmin.ts
5
7
  /**
@@ -21,93 +23,99 @@ var DeepBookAdminContract = class {
21
23
  const adjustedTickSize = convertPrice(tickSize, FLOAT_SCALAR, quoteScalar, baseScalar);
22
24
  const adjustedLotSize = convertQuantity(lotSize, baseScalar);
23
25
  const adjustedMinSize = convertQuantity(minSize, baseScalar);
24
- tx.moveCall({
25
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::create_pool_admin`,
26
- arguments: [
27
- tx.object(this.#config.REGISTRY_ID),
28
- tx.pure.u64(adjustedTickSize),
29
- tx.pure.u64(adjustedLotSize),
30
- tx.pure.u64(adjustedMinSize),
31
- tx.pure.bool(whitelisted),
32
- tx.pure.bool(stablePool),
33
- tx.object(this.#adminCap())
34
- ],
26
+ tx.add(createPoolAdmin({
27
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
28
+ arguments: {
29
+ registry: this.#config.REGISTRY_ID,
30
+ tickSize: adjustedTickSize,
31
+ lotSize: adjustedLotSize,
32
+ minSize: adjustedMinSize,
33
+ whitelistedPool: whitelisted,
34
+ stablePool,
35
+ Cap: this.#adminCap()
36
+ },
35
37
  typeArguments: [baseCoin.type, quoteCoin.type]
36
- });
38
+ }));
37
39
  };
38
40
  this.unregisterPoolAdmin = (poolKey) => (tx) => {
39
41
  const pool = this.#config.getPool(poolKey);
40
42
  const baseCoin = this.#config.getCoin(pool.baseCoin);
41
43
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
42
- tx.moveCall({
43
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::unregister_pool_admin`,
44
- arguments: [
45
- tx.object(pool.address),
46
- tx.object(this.#config.REGISTRY_ID),
47
- tx.object(this.#adminCap())
48
- ],
44
+ tx.add(unregisterPoolAdmin({
45
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
46
+ arguments: {
47
+ self: pool.address,
48
+ registry: this.#config.REGISTRY_ID,
49
+ Cap: this.#adminCap()
50
+ },
49
51
  typeArguments: [baseCoin.type, quoteCoin.type]
50
- });
52
+ }));
51
53
  };
52
54
  this.updateAllowedVersions = (poolKey) => (tx) => {
53
55
  const pool = this.#config.getPool(poolKey);
54
56
  const baseCoin = this.#config.getCoin(pool.baseCoin);
55
57
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
56
- tx.moveCall({
57
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::update_allowed_versions`,
58
- arguments: [
59
- tx.object(pool.address),
60
- tx.object(this.#config.REGISTRY_ID),
61
- tx.object(this.#adminCap())
62
- ],
58
+ tx.add(updateAllowedVersions({
59
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
60
+ arguments: {
61
+ self: pool.address,
62
+ registry: this.#config.REGISTRY_ID,
63
+ Cap: this.#adminCap()
64
+ },
63
65
  typeArguments: [baseCoin.type, quoteCoin.type]
64
- });
66
+ }));
65
67
  };
66
68
  this.enableVersion = (version) => (tx) => {
67
- tx.moveCall({
68
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::enable_version`,
69
- arguments: [
70
- tx.object(this.#config.REGISTRY_ID),
71
- tx.pure.u64(version),
72
- tx.object(this.#adminCap())
73
- ]
74
- });
69
+ tx.add(enableVersion({
70
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
71
+ arguments: {
72
+ self: this.#config.REGISTRY_ID,
73
+ version,
74
+ Cap: this.#adminCap()
75
+ }
76
+ }));
75
77
  };
76
78
  this.disableVersion = (version) => (tx) => {
77
- tx.moveCall({
78
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::disable_version`,
79
- arguments: [
80
- tx.object(this.#config.REGISTRY_ID),
81
- tx.pure.u64(version),
82
- tx.object(this.#adminCap())
83
- ]
84
- });
79
+ tx.add(disableVersion({
80
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
81
+ arguments: {
82
+ self: this.#config.REGISTRY_ID,
83
+ version,
84
+ Cap: this.#adminCap()
85
+ }
86
+ }));
85
87
  };
86
88
  this.setTreasuryAddress = (treasuryAddress) => (tx) => {
87
- tx.moveCall({
88
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::set_treasury_address`,
89
- arguments: [
90
- tx.object(this.#config.REGISTRY_ID),
91
- tx.pure.address(treasuryAddress),
92
- tx.object(this.#adminCap())
93
- ]
94
- });
89
+ tx.add(setTreasuryAddress({
90
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
91
+ arguments: {
92
+ self: this.#config.REGISTRY_ID,
93
+ treasuryAddress,
94
+ Cap: this.#adminCap()
95
+ }
96
+ }));
95
97
  };
96
98
  this.addStableCoin = (stableCoinKey) => (tx) => {
97
99
  const stableCoinType = this.#config.getCoin(stableCoinKey).type;
98
- tx.moveCall({
99
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::add_stablecoin`,
100
- arguments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],
100
+ tx.add(addStablecoin({
101
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
102
+ arguments: {
103
+ self: this.#config.REGISTRY_ID,
104
+ Cap: this.#adminCap()
105
+ },
101
106
  typeArguments: [stableCoinType]
102
- });
107
+ }));
103
108
  };
104
109
  this.removeStableCoin = (stableCoinKey) => (tx) => {
105
110
  const stableCoinType = this.#config.getCoin(stableCoinKey).type;
106
- tx.moveCall({
107
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::remove_stablecoin`,
108
- arguments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],
111
+ tx.add(removeStablecoin({
112
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
113
+ arguments: {
114
+ self: this.#config.REGISTRY_ID,
115
+ Cap: this.#adminCap()
116
+ },
109
117
  typeArguments: [stableCoinType]
110
- });
118
+ }));
111
119
  };
112
120
  this.adjustTickSize = (poolKey, newTickSize) => (tx) => {
113
121
  tx.setSenderIfNotSet(this.#config.address);
@@ -117,16 +125,15 @@ var DeepBookAdminContract = class {
117
125
  const baseScalar = baseCoin.scalar;
118
126
  const quoteScalar = quoteCoin.scalar;
119
127
  const adjustedTickSize = convertPrice(newTickSize, FLOAT_SCALAR, quoteScalar, baseScalar);
120
- tx.moveCall({
121
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::adjust_tick_size_admin`,
122
- arguments: [
123
- tx.object(pool.address),
124
- tx.pure.u64(adjustedTickSize),
125
- tx.object(this.#adminCap()),
126
- tx.object.clock()
127
- ],
128
+ tx.add(adjustTickSizeAdmin({
129
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
130
+ arguments: {
131
+ self: pool.address,
132
+ newTickSize: adjustedTickSize,
133
+ Cap: this.#adminCap()
134
+ },
128
135
  typeArguments: [baseCoin.type, quoteCoin.type]
129
- });
136
+ }));
130
137
  };
131
138
  this.adjustMinLotSize = (poolKey, newLotSize, newMinSize) => (tx) => {
132
139
  tx.setSenderIfNotSet(this.#config.address);
@@ -136,23 +143,25 @@ var DeepBookAdminContract = class {
136
143
  const baseScalar = baseCoin.scalar;
137
144
  const adjustedLotSize = convertQuantity(newLotSize, baseScalar);
138
145
  const adjustedMinSize = convertQuantity(newMinSize, baseScalar);
139
- tx.moveCall({
140
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::adjust_min_lot_size_admin`,
141
- arguments: [
142
- tx.object(pool.address),
143
- tx.pure.u64(adjustedLotSize),
144
- tx.pure.u64(adjustedMinSize),
145
- tx.object(this.#adminCap()),
146
- tx.object.clock()
147
- ],
146
+ tx.add(adjustMinLotSizeAdmin({
147
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
148
+ arguments: {
149
+ self: pool.address,
150
+ newLotSize: adjustedLotSize,
151
+ newMinSize: adjustedMinSize,
152
+ Cap: this.#adminCap()
153
+ },
148
154
  typeArguments: [baseCoin.type, quoteCoin.type]
149
- });
155
+ }));
150
156
  };
151
157
  this.initBalanceManagerMap = () => (tx) => {
152
- tx.moveCall({
153
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::init_balance_manager_map`,
154
- arguments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())]
155
- });
158
+ tx.add(initBalanceManagerMap({
159
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
160
+ arguments: {
161
+ self: this.#config.REGISTRY_ID,
162
+ Cap: this.#adminCap()
163
+ }
164
+ }));
156
165
  };
157
166
  this.setEwmaParams = (poolKey, params) => (tx) => {
158
167
  const { alpha, zScoreThreshold, additionalTakerFee } = params;
@@ -162,79 +171,86 @@ var DeepBookAdminContract = class {
162
171
  const pool = this.#config.getPool(poolKey);
163
172
  const baseCoin = this.#config.getCoin(pool.baseCoin);
164
173
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
165
- tx.moveCall({
166
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::set_ewma_params`,
167
- arguments: [
168
- tx.object(pool.address),
169
- tx.object(this.#adminCap()),
170
- tx.pure.u64(adjustedAlpha),
171
- tx.pure.u64(adjustedZScoreThreshold),
172
- tx.pure.u64(adjustedAdditionalTakerFee),
173
- tx.object.clock()
174
- ],
174
+ tx.add(setEwmaParams({
175
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
176
+ arguments: {
177
+ self: pool.address,
178
+ Cap: this.#adminCap(),
179
+ alpha: adjustedAlpha,
180
+ zScoreThreshold: adjustedZScoreThreshold,
181
+ additionalTakerFee: adjustedAdditionalTakerFee
182
+ },
175
183
  typeArguments: [baseCoin.type, quoteCoin.type]
176
- });
184
+ }));
177
185
  };
178
186
  this.enableEwmaState = (poolKey, enable) => (tx) => {
179
187
  const pool = this.#config.getPool(poolKey);
180
188
  const baseCoin = this.#config.getCoin(pool.baseCoin);
181
189
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
182
- tx.moveCall({
183
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::enable_ewma_state`,
184
- arguments: [
185
- tx.object(pool.address),
186
- tx.object(this.#adminCap()),
187
- tx.pure.bool(enable),
188
- tx.object.clock()
189
- ],
190
+ tx.add(enableEwmaState({
191
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
192
+ arguments: {
193
+ self: pool.address,
194
+ Cap: this.#adminCap(),
195
+ enable
196
+ },
190
197
  typeArguments: [baseCoin.type, quoteCoin.type]
191
- });
198
+ }));
192
199
  };
193
200
  this.authorizeMarginApp = () => (tx) => {
194
- tx.moveCall({
195
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::authorize_app`,
196
- arguments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],
201
+ tx.add(authorizeApp({
202
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
203
+ arguments: {
204
+ self: this.#config.REGISTRY_ID,
205
+ AdminCap: this.#adminCap()
206
+ },
197
207
  typeArguments: [`${this.#config.MARGIN_V1}::margin_manager::MarginApp`]
198
- });
208
+ }));
199
209
  };
200
210
  this.deauthorizeMarginApp = () => (tx) => {
201
- return tx.moveCall({
202
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::deauthorize_app`,
203
- arguments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],
211
+ return tx.add(deauthorizeApp({
212
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
213
+ arguments: {
214
+ self: this.#config.REGISTRY_ID,
215
+ AdminCap: this.#adminCap()
216
+ },
204
217
  typeArguments: [`${this.#config.MARGIN_V1}::margin_manager::MarginApp`]
205
- });
218
+ }));
206
219
  };
207
220
  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
- });
221
+ return tx.add(mintPauseCap({
222
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
223
+ arguments: {
224
+ self: this.#config.REGISTRY_ID,
225
+ Cap: this.#adminCap()
226
+ }
227
+ }));
212
228
  };
213
229
  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
- });
230
+ tx.add(revokePauseCap({
231
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
232
+ arguments: {
233
+ self: this.#config.REGISTRY_ID,
234
+ Cap: this.#adminCap(),
235
+ pauseCapId
236
+ }
237
+ }));
222
238
  };
223
239
  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
- });
240
+ tx.add(disableVersionPauseCap({
241
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
242
+ arguments: {
243
+ self: this.#config.REGISTRY_ID,
244
+ version,
245
+ pauseCap: pauseCapId
246
+ }
247
+ }));
232
248
  };
233
249
  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)]
237
- });
250
+ return tx.add(allowedPauseCaps({
251
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
252
+ arguments: { self: this.#config.REGISTRY_ID }
253
+ }));
238
254
  };
239
255
  this.#config = config;
240
256
  }
@@ -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_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,aAAa,eAC3E;GACD,MAAM,WAAW,MAAKA,OAAQ,QAAQ,YAAY;GAClD,MAAM,YAAY,MAAKA,OAAQ,QAAQ,aAAa;GAEpD,MAAM,aAAa,SAAS;GAC5B,MAAM,cAAc,UAAU;GAE9B,MAAM,mBAAmB,aAAa,UAAU,cAAc,aAAa,WA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;IAClB,QAAQ,GAAG,MAAKA,OAAQ,oBAAoB;IAC5C,WAAW,CAAC,GAAG,OAAO,MAAKA,OAAQ,YAAY,CAAC;IAChD,CAAC;;AApXF,QAAKA,SAAU;;;;;;CAOhB,YAAY;EACX,MAAM,WAAW,MAAKA,OAAQ;AAC9B,MAAI,CAAC,SACJ,OAAM,IAAI,MAAM,yCAAyC;AAE1D,SAAO"}
1
+ {"version":3,"file":"deepbookAdmin.mjs","names":["#config","poolMoveCalls.createPoolAdmin","#adminCap","poolMoveCalls.unregisterPoolAdmin","poolMoveCalls.updateAllowedVersions","registryMoveCalls.enableVersion","registryMoveCalls.disableVersion","registryMoveCalls.setTreasuryAddress","registryMoveCalls.addStablecoin","registryMoveCalls.removeStablecoin","poolMoveCalls.adjustTickSizeAdmin","poolMoveCalls.adjustMinLotSizeAdmin","registryMoveCalls.initBalanceManagerMap","poolMoveCalls.setEwmaParams","poolMoveCalls.enableEwmaState","registryMoveCalls.authorizeApp","registryMoveCalls.deauthorizeApp","registryMoveCalls.mintPauseCap","registryMoveCalls.revokePauseCap","registryMoveCalls.disableVersionPauseCap","registryMoveCalls.allowedPauseCaps"],"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';\nimport * as poolMoveCalls from '../contracts/deepbook/pool.js';\nimport * as registryMoveCalls from '../contracts/deepbook/registry.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.add(\n\t\t\tpoolMoveCalls.createPoolAdmin({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.REGISTRY_ID,\n\t\t\t\t\ttickSize: adjustedTickSize,\n\t\t\t\t\tlotSize: adjustedLotSize,\n\t\t\t\t\tminSize: adjustedMinSize,\n\t\t\t\t\twhitelistedPool: whitelisted,\n\t\t\t\t\tstablePool,\n\t\t\t\t\tCap: this.#adminCap(),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description 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.add(\n\t\t\tpoolMoveCalls.unregisterPoolAdmin({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tregistry: this.#config.REGISTRY_ID,\n\t\t\t\t\tCap: this.#adminCap(),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Update the 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.add(\n\t\t\tpoolMoveCalls.updateAllowedVersions({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tregistry: this.#config.REGISTRY_ID,\n\t\t\t\t\tCap: this.#adminCap(),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Enable a specific version\n\t * @param {number} version The version to be enabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tregistryMoveCalls.enableVersion({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, version, Cap: 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.add(\n\t\t\tregistryMoveCalls.disableVersion({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, version, Cap: 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.add(\n\t\t\tregistryMoveCalls.setTreasuryAddress({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, treasuryAddress, Cap: 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.add(\n\t\t\tregistryMoveCalls.addStablecoin({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, Cap: this.#adminCap() },\n\t\t\t\ttypeArguments: [stableCoinType],\n\t\t\t}),\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.add(\n\t\t\tregistryMoveCalls.removeStablecoin({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, Cap: this.#adminCap() },\n\t\t\t\ttypeArguments: [stableCoinType],\n\t\t\t}),\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.add(\n\t\t\tpoolMoveCalls.adjustTickSizeAdmin({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, newTickSize: adjustedTickSize, Cap: this.#adminCap() },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\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.add(\n\t\t\t\tpoolMoveCalls.adjustMinLotSizeAdmin({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: pool.address,\n\t\t\t\t\t\tnewLotSize: adjustedLotSize,\n\t\t\t\t\t\tnewMinSize: adjustedMinSize,\n\t\t\t\t\t\tCap: this.#adminCap(),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Initialize the balance manager map\n\t * @returns A function that takes a Transaction object\n\t */\n\tinitBalanceManagerMap = () => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tregistryMoveCalls.initBalanceManagerMap({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, Cap: this.#adminCap() },\n\t\t\t}),\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.add(\n\t\t\tpoolMoveCalls.setEwmaParams({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tCap: this.#adminCap(),\n\t\t\t\t\talpha: adjustedAlpha,\n\t\t\t\t\tzScoreThreshold: adjustedZScoreThreshold,\n\t\t\t\t\tadditionalTakerFee: adjustedAdditionalTakerFee,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description 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.add(\n\t\t\tpoolMoveCalls.enableEwmaState({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, Cap: this.#adminCap(), enable },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\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.add(\n\t\t\tregistryMoveCalls.authorizeApp({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, AdminCap: this.#adminCap() },\n\t\t\t\ttypeArguments: [`${this.#config.MARGIN_V1}::margin_manager::MarginApp`],\n\t\t\t}),\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.add(\n\t\t\tregistryMoveCalls.deauthorizeApp({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, AdminCap: this.#adminCap() },\n\t\t\t\ttypeArguments: [`${this.#config.MARGIN_V1}::margin_manager::MarginApp`],\n\t\t\t}),\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.add(\n\t\t\tregistryMoveCalls.mintPauseCap({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, Cap: this.#adminCap() },\n\t\t\t}),\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.add(\n\t\t\tregistryMoveCalls.revokePauseCap({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, Cap: this.#adminCap(), 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.add(\n\t\t\t\tregistryMoveCalls.disableVersionPauseCap({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: { self: this.#config.REGISTRY_ID, version, pauseCap: 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.add(\n\t\t\tregistryMoveCalls.allowedPauseCaps({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID },\n\t\t\t}),\n\t\t);\n\t};\n}\n"],"mappings":";;;;;;;;;AAeA,IAAa,wBAAb,MAAmC;CAClC;;;;CAKA,YAAY,QAAwB;0BAqBjB,YAAmC,OAAoB;AACzE,MAAG,kBAAkB,MAAKA,OAAQ,QAAQ;GAC1C,MAAM,EAAE,aAAa,cAAc,UAAU,SAAS,SAAS,aAAa,eAC3E;GACD,MAAM,WAAW,MAAKA,OAAQ,QAAQ,YAAY;GAClD,MAAM,YAAY,MAAKA,OAAQ,QAAQ,aAAa;GAEpD,MAAM,aAAa,SAAS;GAC5B,MAAM,cAAc,UAAU;GAE9B,MAAM,mBAAmB,aAAa,UAAU,cAAc,aAAa,WAAW;GACtF,MAAM,kBAAkB,gBAAgB,SAAS,WAAW;GAC5D,MAAM,kBAAkB,gBAAgB,SAAS,WAAW;AAE5D,MAAG,IACFC,gBAA8B;IAC7B,SAAS,MAAKD,OAAQ;IACtB,WAAW;KACV,UAAU,MAAKA,OAAQ;KACvB,UAAU;KACV,SAAS;KACT,SAAS;KACT,iBAAiB;KACjB;KACA,KAAK,MAAKE,UAAW;KACrB;IACD,eAAe,CAAC,SAAS,MAAM,UAAU,KAAK;IAC9C,CAAC,CACF;;8BAQqB,aAA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Aa;IAC7C,CAAC,CACF;;AA1XD,QAAKA,SAAU;;;;;;CAOhB,YAAY;EACX,MAAM,WAAW,MAAKA,OAAQ;AAC9B,MAAI,CAAC,SACJ,OAAM,IAAI,MAAM,yCAAyC;AAE1D,SAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"flashLoans.d.mts","names":[],"sources":["../../src/transactions/flashLoans.ts"],"mappings":";;;;;;AAUA;cAAa,iBAAA;EAAA;EAMQ;;;cAAR,MAAA,EAAQ,cAAA;EAsCd;;;;;;EA5BN,eAAA,GAAmB,OAAA,UAAiB,YAAA,cAA0B,EAAA,EAAI,WAAA;;;;;;;EAAlE;;;;;;;;EAqBA,eAAA,GAEE,OAAA,UACA,YAAA,UACA,aAAA,EAAe,yBAAA,EACf,SAAA,EAAW,yBAAA,MAEX,EAAA,EAAI,WAAA,KAAW,yBAAA;EAPjB;;;;;;EA+BA,gBAAA,GAAoB,OAAA,UAAiB,YAAA,cAA0B,EAAA,EAAI,WAAA;;;;;;;EAAA;;;;;;;;EAqBnE,gBAAA,GAEE,OAAA,UACA,YAAA,UACA,cAAA,EAAgB,yBAAA,EAChB,SAAA,EAAW,yBAAA,MAEX,EAAA,EAAI,WAAA,KAAW,yBAAA;AAAA"}
1
+ {"version":3,"file":"flashLoans.d.mts","names":[],"sources":["../../src/transactions/flashLoans.ts"],"mappings":";;;;;;AAWA;cAAa,iBAAA;EAAA;EAMQ;;;cAAR,MAAA,EAAQ,cAAA;EAwCd;;;;;;EA9BN,eAAA,GAAmB,OAAA,UAAiB,YAAA,cAA0B,EAAA,EAAI,WAAA;;;;;;;EAAlE;;;;;;;;EAuBA,eAAA,GAEE,OAAA,UACA,YAAA,UACA,aAAA,EAAe,yBAAA,EACf,SAAA,EAAW,yBAAA,MAEX,EAAA,EAAI,WAAA,KAAW,yBAAA;EAPjB;;;;;;EAiCA,gBAAA,GAAoB,OAAA,UAAiB,YAAA,cAA0B,EAAA,EAAI,WAAA;;;;;;;EAAA;;;;;;;;EAuBnE,gBAAA,GAEE,OAAA,UACA,YAAA,UACA,cAAA,EAAgB,yBAAA,EAChB,SAAA,EAAW,yBAAA,MAEX,EAAA,EAAI,WAAA,KAAW,yBAAA;AAAA"}
@@ -1,4 +1,5 @@
1
1
  import { convertQuantity } from "../utils/conversion.mjs";
2
+ import { borrowFlashloanBase, borrowFlashloanQuote, returnFlashloanBase, returnFlashloanQuote } from "../contracts/deepbook/pool.mjs";
2
3
 
3
4
  //#region src/transactions/flashLoans.ts
4
5
  /**
@@ -15,11 +16,14 @@ var FlashLoanContract = class {
15
16
  const baseCoin = this.#config.getCoin(pool.baseCoin);
16
17
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
17
18
  const inputQuantity = convertQuantity(borrowAmount, baseCoin.scalar);
18
- const [baseCoinResult, flashLoan] = tx.moveCall({
19
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::borrow_flashloan_base`,
20
- arguments: [tx.object(pool.address), tx.pure.u64(inputQuantity)],
19
+ const [baseCoinResult, flashLoan] = tx.add(borrowFlashloanBase({
20
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
21
+ arguments: {
22
+ self: pool.address,
23
+ baseAmount: inputQuantity
24
+ },
21
25
  typeArguments: [baseCoin.type, quoteCoin.type]
22
- });
26
+ }));
23
27
  return [baseCoinResult, flashLoan];
24
28
  };
25
29
  this.returnBaseAsset = (poolKey, borrowAmount, baseCoinInput, flashLoan) => (tx) => {
@@ -28,15 +32,15 @@ var FlashLoanContract = class {
28
32
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
29
33
  const borrowScalar = baseCoin.scalar;
30
34
  const [baseCoinReturn] = tx.splitCoins(baseCoinInput, [tx.pure.u64(convertQuantity(borrowAmount, borrowScalar))]);
31
- tx.moveCall({
32
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::return_flashloan_base`,
33
- arguments: [
34
- tx.object(pool.address),
35
- baseCoinReturn,
35
+ tx.add(returnFlashloanBase({
36
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
37
+ arguments: {
38
+ self: pool.address,
39
+ coin: baseCoinReturn,
36
40
  flashLoan
37
- ],
41
+ },
38
42
  typeArguments: [baseCoin.type, quoteCoin.type]
39
- });
43
+ }));
40
44
  return baseCoinInput;
41
45
  };
42
46
  this.borrowQuoteAsset = (poolKey, borrowAmount) => (tx) => {
@@ -44,11 +48,14 @@ var FlashLoanContract = class {
44
48
  const baseCoin = this.#config.getCoin(pool.baseCoin);
45
49
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
46
50
  const inputQuantity = convertQuantity(borrowAmount, quoteCoin.scalar);
47
- const [quoteCoinResult, flashLoan] = tx.moveCall({
48
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::borrow_flashloan_quote`,
49
- arguments: [tx.object(pool.address), tx.pure.u64(inputQuantity)],
51
+ const [quoteCoinResult, flashLoan] = tx.add(borrowFlashloanQuote({
52
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
53
+ arguments: {
54
+ self: pool.address,
55
+ quoteAmount: inputQuantity
56
+ },
50
57
  typeArguments: [baseCoin.type, quoteCoin.type]
51
- });
58
+ }));
52
59
  return [quoteCoinResult, flashLoan];
53
60
  };
54
61
  this.returnQuoteAsset = (poolKey, borrowAmount, quoteCoinInput, flashLoan) => (tx) => {
@@ -57,15 +64,15 @@ var FlashLoanContract = class {
57
64
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
58
65
  const borrowScalar = quoteCoin.scalar;
59
66
  const [quoteCoinReturn] = tx.splitCoins(quoteCoinInput, [tx.pure.u64(convertQuantity(borrowAmount, borrowScalar))]);
60
- tx.moveCall({
61
- target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::return_flashloan_quote`,
62
- arguments: [
63
- tx.object(pool.address),
64
- quoteCoinReturn,
67
+ tx.add(returnFlashloanQuote({
68
+ package: this.#config.DEEPBOOK_PACKAGE_ID,
69
+ arguments: {
70
+ self: pool.address,
71
+ coin: quoteCoinReturn,
65
72
  flashLoan
66
- ],
73
+ },
67
74
  typeArguments: [baseCoin.type, quoteCoin.type]
68
- });
75
+ }));
69
76
  return quoteCoinInput;
70
77
  };
71
78
  this.#config = config;
@@ -1 +1 @@
1
- {"version":3,"file":"flashLoans.mjs","names":["#config"],"sources":["../../src/transactions/flashLoans.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport type { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { convertQuantity } from '../utils/conversion.js';\n\n/**\n * FlashLoanContract class for managing flash loans.\n */\nexport class FlashLoanContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration object for DeepBook\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @description Borrow base asset from the pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} borrowAmount The amount to borrow\n\t * @returns A function that takes a Transaction object\n\t */\n\tborrowBaseAsset = (poolKey: string, borrowAmount: number) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst inputQuantity = convertQuantity(borrowAmount, baseCoin.scalar);\n\t\tconst [baseCoinResult, flashLoan] = tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::borrow_flashloan_base`,\n\t\t\targuments: [tx.object(pool.address), tx.pure.u64(inputQuantity)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t\treturn [baseCoinResult, flashLoan] as const;\n\t};\n\n\t/**\n\t * @description Return base asset to the pool after a flash loan.\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} borrowAmount The amount of the base asset to return\n\t * @param {TransactionObjectArgument} baseCoinInput Coin object representing the base asset to be returned\n\t * @param {TransactionObjectArgument} flashLoan FlashLoan object representing the loan to be settled\n\t * @returns A function that takes a Transaction object\n\t */\n\treturnBaseAsset =\n\t\t(\n\t\t\tpoolKey: string,\n\t\t\tborrowAmount: number,\n\t\t\tbaseCoinInput: TransactionObjectArgument,\n\t\t\tflashLoan: TransactionObjectArgument,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst borrowScalar = baseCoin.scalar;\n\n\t\t\tconst [baseCoinReturn] = tx.splitCoins(baseCoinInput, [\n\t\t\t\ttx.pure.u64(convertQuantity(borrowAmount, borrowScalar)),\n\t\t\t]);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::return_flashloan_base`,\n\t\t\t\targuments: [tx.object(pool.address), baseCoinReturn, flashLoan],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t});\n\n\t\t\treturn baseCoinInput;\n\t\t};\n\n\t/**\n\t * @description Borrow quote asset from the pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} borrowAmount The amount to borrow\n\t * @returns A function that takes a Transaction object\n\t */\n\tborrowQuoteAsset = (poolKey: string, borrowAmount: number) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst inputQuantity = convertQuantity(borrowAmount, quoteCoin.scalar);\n\t\tconst [quoteCoinResult, flashLoan] = tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::borrow_flashloan_quote`,\n\t\t\targuments: [tx.object(pool.address), tx.pure.u64(inputQuantity)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t\treturn [quoteCoinResult, flashLoan] as const;\n\t};\n\n\t/**\n\t * @description Return quote asset to the pool after a flash loan.\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} borrowAmount The amount of the quote asset to return\n\t * @param {TransactionObjectArgument} quoteCoinInput Coin object representing the quote asset to be returned\n\t * @param {TransactionObjectArgument} flashLoan FlashLoan object representing the loan to be settled\n\t * @returns A function that takes a Transaction object\n\t */\n\treturnQuoteAsset =\n\t\t(\n\t\t\tpoolKey: string,\n\t\t\tborrowAmount: number,\n\t\t\tquoteCoinInput: TransactionObjectArgument,\n\t\t\tflashLoan: TransactionObjectArgument,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst borrowScalar = quoteCoin.scalar;\n\n\t\t\tconst [quoteCoinReturn] = tx.splitCoins(quoteCoinInput, [\n\t\t\t\ttx.pure.u64(convertQuantity(borrowAmount, borrowScalar)),\n\t\t\t]);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::return_flashloan_quote`,\n\t\t\t\targuments: [tx.object(pool.address), quoteCoinReturn, flashLoan],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t});\n\n\t\t\treturn quoteCoinInput;\n\t\t};\n}\n"],"mappings":";;;;;;AAUA,IAAa,oBAAb,MAA+B;CAC9B;;;;CAKA,YAAY,QAAwB;0BAUjB,SAAiB,kBAA0B,OAAoB;GACjF,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;GAC1C,MAAM,WAAW,MAAKA,OAAQ,QAAQ,KAAK,SAAS;GACpD,MAAM,YAAY,MAAKA,OAAQ,QAAQ,KAAK,UAAU;GACtD,MAAM,gBAAgB,gBAAgB,cAAc,SAAS,OAAO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C,iBAAiB,UAAU;;2BAalC,SACA,cACA,gBACA,eAEA,OAAoB;GACpB,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;GAC1C,MAAM,WAAW,MAAKA,OAAQ,QAAQ,KAAK,SAAS;GACpD,MAAM,YAAY,MAAKA,OAAQ,QAAQ,KAAK,UAAU;GACtD,MAAM,eAAe,UAAU;GAE/B,MAAM,CAAC,mBAAmB,GAAG,WAAW,gBAAgB,CACvD,GAAG,KAAK,IAAI,gBAAgB,cAAc,aAAa,CAAC,CACxD,CAAC;AACF,MAAG,SAAS;IACX,QAAQ,GAAG,MAAKA,OAAQ,oBAAoB;IAC5C,WAAW;KAAC,GAAG,OAAO,KAAK,QAAQ;KAAE;KAAiB;KAAU;IAChE,eAAe,CAAC,SAAS,MAAM,UAAU,KAAK;IAC9C,CAAC;AAEF,UAAO;;AAxGR,QAAKA,SAAU"}
1
+ {"version":3,"file":"flashLoans.mjs","names":["#config","poolMoveCalls.borrowFlashloanBase","poolMoveCalls.returnFlashloanBase","poolMoveCalls.borrowFlashloanQuote","poolMoveCalls.returnFlashloanQuote"],"sources":["../../src/transactions/flashLoans.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport type { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { convertQuantity } from '../utils/conversion.js';\nimport * as poolMoveCalls from '../contracts/deepbook/pool.js';\n\n/**\n * FlashLoanContract class for managing flash loans.\n */\nexport class FlashLoanContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration object for DeepBook\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @description Borrow base asset from the pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} borrowAmount The amount to borrow\n\t * @returns A function that takes a Transaction object\n\t */\n\tborrowBaseAsset = (poolKey: string, borrowAmount: number) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst inputQuantity = convertQuantity(borrowAmount, baseCoin.scalar);\n\t\tconst [baseCoinResult, flashLoan] = tx.add(\n\t\t\tpoolMoveCalls.borrowFlashloanBase({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, baseAmount: inputQuantity },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t\treturn [baseCoinResult, flashLoan] as const;\n\t};\n\n\t/**\n\t * @description Return base asset to the pool after a flash loan.\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} borrowAmount The amount of the base asset to return\n\t * @param {TransactionObjectArgument} baseCoinInput Coin object representing the base asset to be returned\n\t * @param {TransactionObjectArgument} flashLoan FlashLoan object representing the loan to be settled\n\t * @returns A function that takes a Transaction object\n\t */\n\treturnBaseAsset =\n\t\t(\n\t\t\tpoolKey: string,\n\t\t\tborrowAmount: number,\n\t\t\tbaseCoinInput: TransactionObjectArgument,\n\t\t\tflashLoan: TransactionObjectArgument,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst borrowScalar = baseCoin.scalar;\n\n\t\t\tconst [baseCoinReturn] = tx.splitCoins(baseCoinInput, [\n\t\t\t\ttx.pure.u64(convertQuantity(borrowAmount, borrowScalar)),\n\t\t\t]);\n\t\t\ttx.add(\n\t\t\t\tpoolMoveCalls.returnFlashloanBase({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: { self: pool.address, coin: baseCoinReturn, flashLoan },\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\n\t\t\treturn baseCoinInput;\n\t\t};\n\n\t/**\n\t * @description Borrow quote asset from the pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} borrowAmount The amount to borrow\n\t * @returns A function that takes a Transaction object\n\t */\n\tborrowQuoteAsset = (poolKey: string, borrowAmount: number) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst inputQuantity = convertQuantity(borrowAmount, quoteCoin.scalar);\n\t\tconst [quoteCoinResult, flashLoan] = tx.add(\n\t\t\tpoolMoveCalls.borrowFlashloanQuote({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, quoteAmount: inputQuantity },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t\treturn [quoteCoinResult, flashLoan] as const;\n\t};\n\n\t/**\n\t * @description Return quote asset to the pool after a flash loan.\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} borrowAmount The amount of the quote asset to return\n\t * @param {TransactionObjectArgument} quoteCoinInput Coin object representing the quote asset to be returned\n\t * @param {TransactionObjectArgument} flashLoan FlashLoan object representing the loan to be settled\n\t * @returns A function that takes a Transaction object\n\t */\n\treturnQuoteAsset =\n\t\t(\n\t\t\tpoolKey: string,\n\t\t\tborrowAmount: number,\n\t\t\tquoteCoinInput: TransactionObjectArgument,\n\t\t\tflashLoan: TransactionObjectArgument,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst borrowScalar = quoteCoin.scalar;\n\n\t\t\tconst [quoteCoinReturn] = tx.splitCoins(quoteCoinInput, [\n\t\t\t\ttx.pure.u64(convertQuantity(borrowAmount, borrowScalar)),\n\t\t\t]);\n\t\t\ttx.add(\n\t\t\t\tpoolMoveCalls.returnFlashloanQuote({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: { self: pool.address, coin: quoteCoinReturn, flashLoan },\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\n\t\t\treturn quoteCoinInput;\n\t\t};\n}\n"],"mappings":";;;;;;;AAWA,IAAa,oBAAb,MAA+B;CAC9B;;;;CAKA,YAAY,QAAwB;0BAUjB,SAAiB,kBAA0B,OAAoB;GACjF,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;GAC1C,MAAM,WAAW,MAAKA,OAAQ,QAAQ,KAAK,SAAS;GACpD,MAAM,YAAY,MAAKA,OAAQ,QAAQ,KAAK,UAAU;GACtD,MAAM,gBAAgB,gBAAgB,cAAc,SAAS,OAAO;GACpE,MAAM,CAAC,gBAAgB,aAAa,GAAG,IACtCC,oBAAkC;IACjC,SAAS,MAAKD,OAAQ;IACtB,WAAW;KAAE,MAAM,KAAK;KAAS,YAAY;KAAe;IAC5D,eAAe,CAAC,SAAS,MAAM,UAAU,KAAK;IAC9C,CAAC,CACF;AACD,UAAO,CAAC,gBAAgB,UAAU;;0BAajC,SACA,cACA,eACA,eAEA,OAAoB;GACpB,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;GAC1C,MAAM,WAAW,MAAKA,OAAQ,QAAQ,KAAK,SAAS;GACpD,MAAM,YAAY,MAAKA,OAAQ,QAAQ,KAAK,UAAU;GACtD,MAAM,eAAe,SAAS;GAE9B,MAAM,CAAC,kBAAkB,GAAG,WAAW,eAAe,CACrD,GAAG,KAAK,IAAI,gBAAgB,cAAc,aAAa,CAAC,CACxD,CAAC;AACF,MAAG,IACFE,oBA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AAA;EAAA;EAMQ;;;cAAR,MAAA,EAAQ,cAAA;EAyD8B;;;;;;;EA9ClD,KAAA,GACE,OAAA,UAAiB,iBAAA,UAA2B,WAAA,cAAyB,EAAA,EAAI,WAAA;EAD3E;;;;;;EA2BA,OAAA,GAAW,OAAA,UAAiB,iBAAA,cAA+B,EAAA,EAAI,WAAA;EAApD;;;;;EAmBX,cAAA,GAAkB,MAAA,EAAQ,cAAA,MAAoB,EAAA,EAAI,WAAA;EAAhC;;;;;;;EA8BlB,IAAA,GAAQ,OAAA,UAAiB,iBAAA,UAA2B,WAAA,cAAyB,EAAA,EAAI,WAAA;AAAA"}
1
+ {"version":3,"file":"governance.d.mts","names":[],"sources":["../../src/transactions/governance.ts"],"mappings":";;;;;;;AAaA;cAAa,kBAAA;EAAA;EAMQ;;;cAAR,MAAA,EAAQ,cAAA;EAiE8B;;;;;;;EAtDlD,KAAA,GACE,OAAA,UAAiB,iBAAA,UAA2B,WAAA,cAAyB,EAAA,EAAI,WAAA;EAD3E;;;;;;EA6BA,OAAA,GAAW,OAAA,UAAiB,iBAAA,cAA+B,EAAA,EAAI,WAAA;EAApD;;;;;EAyBX,cAAA,GAAkB,MAAA,EAAQ,cAAA,MAAoB,EAAA,EAAI,WAAA;EAAhC;;;;;;;EAgClB,IAAA,GAAQ,OAAA,UAAiB,iBAAA,UAA2B,WAAA,cAAyB,EAAA,EAAI,WAAA;AAAA"}