@mysten/deepbook-v3 1.6.7 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/_virtual/rolldown_runtime.mjs +18 -0
  3. package/dist/client.d.mts +9 -6
  4. package/dist/client.d.mts.map +1 -1
  5. package/dist/client.mjs +3 -2
  6. package/dist/client.mjs.map +1 -1
  7. package/dist/contracts/deepbook/account.d.mts +18 -18
  8. package/dist/contracts/deepbook/account.d.mts.map +1 -1
  9. package/dist/contracts/deepbook/balance_manager.mjs.map +1 -1
  10. package/dist/contracts/deepbook/balances.d.mts +4 -4
  11. package/dist/contracts/deepbook/balances.d.mts.map +1 -1
  12. package/dist/contracts/deepbook/deep_price.d.mts +3 -3
  13. package/dist/contracts/deepbook/deep_price.d.mts.map +1 -1
  14. package/dist/contracts/deepbook/order.d.mts +12 -12
  15. package/dist/contracts/deepbook/pool.mjs.map +1 -1
  16. package/dist/contracts/deepbook/registry.mjs.map +1 -1
  17. package/dist/contracts/deepbook_margin/margin_manager.mjs +1 -319
  18. package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -1
  19. package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs +386 -0
  20. package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs.map +1 -0
  21. package/dist/contracts/deepbook_margin/margin_pool.mjs.map +1 -1
  22. package/dist/contracts/deepbook_margin/margin_registry.mjs.map +1 -1
  23. package/dist/contracts/deepbook_margin/oracle.mjs +9 -0
  24. package/dist/contracts/deepbook_margin/oracle.mjs.map +1 -1
  25. package/dist/contracts/deepbook_margin/pool_proxy.mjs +1 -383
  26. package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -1
  27. package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs +340 -0
  28. package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs.map +1 -0
  29. package/dist/contracts/deepbook_margin/protocol_config.mjs.map +1 -1
  30. package/dist/contracts/deepbook_margin/tpsl.mjs.map +1 -1
  31. package/dist/contracts/margin_liquidation/liquidation_vault.mjs +33 -17
  32. package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -1
  33. package/dist/index.d.mts +4 -3
  34. package/dist/index.mjs +2 -2
  35. package/dist/pyth/PriceServiceConnection.d.mts +18 -3
  36. package/dist/pyth/PriceServiceConnection.d.mts.map +1 -1
  37. package/dist/pyth/PriceServiceConnection.mjs +35 -4
  38. package/dist/pyth/PriceServiceConnection.mjs.map +1 -1
  39. package/dist/queries/priceFeedQueries.mjs +50 -18
  40. package/dist/queries/priceFeedQueries.mjs.map +1 -1
  41. package/dist/transactions/balanceManager.d.mts +12 -12
  42. package/dist/transactions/balanceManager.d.mts.map +1 -1
  43. package/dist/transactions/deepbook.d.mts +20 -20
  44. package/dist/transactions/deepbook.d.mts.map +1 -1
  45. package/dist/transactions/deepbookAdmin.d.mts +4 -4
  46. package/dist/transactions/marginAdmin.d.mts +7 -7
  47. package/dist/transactions/marginAdmin.d.mts.map +1 -1
  48. package/dist/transactions/marginAdmin.mjs +2 -2
  49. package/dist/transactions/marginAdmin.mjs.map +1 -1
  50. package/dist/transactions/marginLiquidations.d.mts.map +1 -1
  51. package/dist/transactions/marginLiquidations.mjs +19 -7
  52. package/dist/transactions/marginLiquidations.mjs.map +1 -1
  53. package/dist/transactions/marginMaintainer.d.mts +5 -5
  54. package/dist/transactions/marginManager.d.mts +32 -32
  55. package/dist/transactions/marginManager.d.mts.map +1 -1
  56. package/dist/transactions/marginManager.mjs +43 -34
  57. package/dist/transactions/marginManager.mjs.map +1 -1
  58. package/dist/transactions/marginPool.d.mts +18 -18
  59. package/dist/transactions/marginTPSL.d.mts +10 -10
  60. package/dist/transactions/marginTPSL.d.mts.map +1 -1
  61. package/dist/transactions/marginTPSL.mjs +19 -10
  62. package/dist/transactions/marginTPSL.mjs.map +1 -1
  63. package/dist/transactions/poolProxy.d.mts +8 -8
  64. package/dist/transactions/poolProxy.d.mts.map +1 -1
  65. package/dist/transactions/poolProxy.mjs +34 -27
  66. package/dist/transactions/poolProxy.mjs.map +1 -1
  67. package/dist/types/index.d.mts +16 -1
  68. package/dist/types/index.d.mts.map +1 -1
  69. package/dist/types/index.mjs.map +1 -1
  70. package/dist/utils/config.d.mts +30 -10
  71. package/dist/utils/config.d.mts.map +1 -1
  72. package/dist/utils/config.mjs +33 -4
  73. package/dist/utils/config.mjs.map +1 -1
  74. package/dist/utils/constants.d.mts +32 -1
  75. package/dist/utils/constants.d.mts.map +1 -1
  76. package/dist/utils/constants.mjs +55 -24
  77. package/dist/utils/constants.mjs.map +1 -1
  78. package/package.json +10 -10
  79. package/src/client.ts +9 -1
  80. package/src/contracts/deepbook/balance_manager.ts +1 -2
  81. package/src/contracts/deepbook/pool.ts +12 -24
  82. package/src/contracts/deepbook/registry.ts +1 -2
  83. package/src/contracts/deepbook_margin/margin_manager.ts +149 -28
  84. package/src/contracts/deepbook_margin/margin_manager_upgraded.ts +646 -0
  85. package/src/contracts/deepbook_margin/margin_pool.ts +2 -4
  86. package/src/contracts/deepbook_margin/margin_registry.ts +3 -6
  87. package/src/contracts/deepbook_margin/oracle.ts +59 -0
  88. package/src/contracts/deepbook_margin/pool_proxy.ts +597 -584
  89. package/src/contracts/deepbook_margin/pool_proxy_upgraded.ts +614 -0
  90. package/src/contracts/deepbook_margin/protocol_config.ts +1 -2
  91. package/src/contracts/deepbook_margin/tpsl.ts +1 -2
  92. package/src/contracts/margin_liquidation/liquidation_vault.ts +144 -4
  93. package/src/contracts/pyth/pyth.ts +2 -4
  94. package/src/index.ts +4 -0
  95. package/src/pyth/PriceServiceConnection.ts +69 -8
  96. package/src/queries/priceFeedQueries.ts +74 -24
  97. package/src/transactions/marginAdmin.ts +2 -4
  98. package/src/transactions/marginLiquidations.ts +20 -6
  99. package/src/transactions/marginManager.ts +43 -33
  100. package/src/transactions/marginTPSL.ts +19 -9
  101. package/src/transactions/poolProxy.ts +34 -30
  102. package/src/types/index.ts +17 -2
  103. package/src/utils/config.ts +69 -9
  104. package/src/utils/constants.ts +83 -26
@@ -1,6 +1,6 @@
1
1
  import { DepositDuringInitParams, DepositParams } from "../types/index.mjs";
2
2
  import { DeepBookConfig } from "../utils/config.mjs";
3
- import * as _mysten_sui_transactions42 from "@mysten/sui/transactions";
3
+ import * as _mysten_sui_transactions45 from "@mysten/sui/transactions";
4
4
  import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
5
5
 
6
6
  //#region src/transactions/marginManager.d.ts
@@ -88,49 +88,49 @@ declare class MarginManagerContract {
88
88
  * @param {number} amount The amount to withdraw
89
89
  * @returns A function that takes a Transaction object
90
90
  */
91
- withdrawBase: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
91
+ withdrawBase: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
92
92
  /**
93
93
  * @description Withdraw quote from a margin manager
94
94
  * @param {string} managerKey The key to identify the manager
95
95
  * @param {number} amount The amount to withdraw
96
96
  * @returns A function that takes a Transaction object
97
97
  */
98
- withdrawQuote: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
98
+ withdrawQuote: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
99
99
  /**
100
100
  * @description Withdraw deep from a margin manager
101
101
  * @param {string} managerKey The key to identify the manager
102
102
  * @param {number} amount The amount to withdraw
103
103
  * @returns A function that takes a Transaction object
104
104
  */
105
- withdrawDeep: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
105
+ withdrawDeep: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
106
106
  /**
107
107
  * @description Borrow base from a margin manager
108
108
  * @param {string} managerKey The key to identify the manager
109
109
  * @param {number} amount The amount to borrow
110
110
  * @returns A function that takes a Transaction object
111
111
  */
112
- borrowBase: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
112
+ borrowBase: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
113
113
  /**
114
114
  * @description Borrow quote from a margin manager
115
115
  * @param {string} managerKey The key to identify the manager
116
116
  * @param {number} amount The amount to borrow
117
117
  * @returns A function that takes a Transaction object
118
118
  */
119
- borrowQuote: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
119
+ borrowQuote: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
120
120
  /**
121
121
  * @description Repay base from a margin manager
122
122
  * @param {string} managerKey The key to identify the manager
123
123
  * @param {number} amount The amount to repay
124
124
  * @returns A function that takes a Transaction object
125
125
  */
126
- repayBase: (managerKey: string, amount?: number) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
126
+ repayBase: (managerKey: string, amount?: number) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
127
127
  /**
128
128
  * @description Repay quote from a margin manager
129
129
  * @param {string} managerKey The key to identify the manager
130
130
  * @param {number} amount The amount to repay
131
131
  * @returns A function that takes a Transaction object
132
132
  */
133
- repayQuote: (managerKey: string, amount?: number) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
133
+ repayQuote: (managerKey: string, amount?: number) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
134
134
  /**
135
135
  * @description Liquidate a margin manager
136
136
  * @param {string} managerAddress The address of the manager to liquidate
@@ -139,7 +139,7 @@ declare class MarginManagerContract {
139
139
  * @param {TransactionArgument} repayCoin The coin to repay
140
140
  * @returns A function that takes a Transaction object
141
141
  */
142
- liquidate: (managerAddress: string, poolKey: string, debtIsBase: boolean, repayCoin: TransactionArgument) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
142
+ liquidate: (managerAddress: string, poolKey: string, debtIsBase: boolean, repayCoin: TransactionArgument) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
143
143
  /**
144
144
  * @description Set the referral for a margin manager (DeepBookPoolReferral)
145
145
  * @param {string} managerKey The key to identify the margin manager
@@ -160,63 +160,63 @@ declare class MarginManagerContract {
160
160
  * @param {string} marginManagerId The ID of the margin manager
161
161
  * @returns A function that takes a Transaction object
162
162
  */
163
- ownerByPoolKey: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
163
+ ownerByPoolKey: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
164
164
  /**
165
165
  * @description Get the DeepBook pool ID associated with a margin manager
166
166
  * @param {string} poolKey The key to identify the pool
167
167
  * @param {string} marginManagerId The ID of the margin manager
168
168
  * @returns A function that takes a Transaction object
169
169
  */
170
- deepbookPool: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
170
+ deepbookPool: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
171
171
  /**
172
172
  * @description Get the margin pool ID (if any) associated with a margin manager
173
173
  * @param {string} poolKey The key to identify the pool
174
174
  * @param {string} marginManagerId The ID of the margin manager
175
175
  * @returns A function that takes a Transaction object
176
176
  */
177
- marginPoolId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
177
+ marginPoolId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
178
178
  /**
179
179
  * @description Get borrowed shares for both base and quote assets
180
180
  * @param {string} poolKey The key to identify the pool
181
181
  * @param {string} marginManagerId The ID of the margin manager
182
182
  * @returns A function that takes a Transaction object
183
183
  */
184
- borrowedShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
184
+ borrowedShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
185
185
  /**
186
186
  * @description Get borrowed base shares
187
187
  * @param {string} poolKey The key to identify the pool
188
188
  * @param {string} marginManagerId The ID of the margin manager
189
189
  * @returns A function that takes a Transaction object
190
190
  */
191
- borrowedBaseShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
191
+ borrowedBaseShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
192
192
  /**
193
193
  * @description Get borrowed quote shares
194
194
  * @param {string} poolKey The key to identify the pool
195
195
  * @param {string} marginManagerId The ID of the margin manager
196
196
  * @returns A function that takes a Transaction object
197
197
  */
198
- borrowedQuoteShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
198
+ borrowedQuoteShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
199
199
  /**
200
200
  * @description Check if margin manager has base asset debt
201
201
  * @param {string} poolKey The key to identify the pool
202
202
  * @param {string} marginManagerId The ID of the margin manager
203
203
  * @returns A function that takes a Transaction object
204
204
  */
205
- hasBaseDebt: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
205
+ hasBaseDebt: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
206
206
  /**
207
207
  * @description Get the balance manager ID for a margin manager
208
208
  * @param {string} poolKey The key to identify the pool
209
209
  * @param {string} marginManagerId The ID of the margin manager
210
210
  * @returns A function that takes a Transaction object
211
211
  */
212
- balanceManager: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
212
+ balanceManager: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
213
213
  /**
214
214
  * @description Calculate assets (base and quote) for a margin manager
215
215
  * @param {string} poolKey The key to identify the pool
216
216
  * @param {string} marginManagerId The ID of the margin manager
217
217
  * @returns A function that takes a Transaction object
218
218
  */
219
- calculateAssets: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
219
+ calculateAssets: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
220
220
  /**
221
221
  * @description Calculate debts (base and quote) for a margin manager
222
222
  * @param {string} poolKey The key to identify the pool
@@ -224,7 +224,7 @@ declare class MarginManagerContract {
224
224
  * @param {string} marginManagerId The ID of the margin manager
225
225
  * @returns A function that takes a Transaction object
226
226
  */
227
- calculateDebts: (poolKey: string, coinKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
227
+ calculateDebts: (poolKey: string, coinKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
228
228
  /**
229
229
  * @description Get comprehensive state information for a margin manager
230
230
  * @param {string} poolKey The key to identify the pool
@@ -234,28 +234,28 @@ declare class MarginManagerContract {
234
234
  * base_debt, quote_debt, base_pyth_price, base_pyth_decimals,
235
235
  * quote_pyth_price, quote_pyth_decimals)
236
236
  */
237
- managerState: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
237
+ managerState: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
238
238
  /**
239
239
  * @description Get the base asset balance of a margin manager
240
240
  * @param {string} poolKey The key to identify the pool
241
241
  * @param {string} marginManagerId The ID of the margin manager
242
242
  * @returns A function that takes a Transaction object
243
243
  */
244
- baseBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
244
+ baseBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
245
245
  /**
246
246
  * @description Get the quote asset balance of a margin manager
247
247
  * @param {string} poolKey The key to identify the pool
248
248
  * @param {string} marginManagerId The ID of the margin manager
249
249
  * @returns A function that takes a Transaction object
250
250
  */
251
- quoteBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
251
+ quoteBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
252
252
  /**
253
253
  * @description Get the DEEP token balance of a margin manager
254
254
  * @param {string} poolKey The key to identify the pool
255
255
  * @param {string} marginManagerId The ID of the margin manager
256
256
  * @returns A function that takes a Transaction object
257
257
  */
258
- deepBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
258
+ deepBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
259
259
  /**
260
260
  * @description Get the underlying BalanceManager ID for a margin manager.
261
261
  * Returns an ID (not a `&BalanceManager`), so it composes in PTBs unlike
@@ -264,28 +264,28 @@ declare class MarginManagerContract {
264
264
  * @param {string} marginManagerId The ID of the margin manager
265
265
  * @returns A function that takes a Transaction object
266
266
  */
267
- balanceManagerId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
267
+ balanceManagerId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
268
268
  /**
269
269
  * @description Get the BalanceManager referral ID for a pool (Option<ID>).
270
270
  * @param {string} poolKey The key to identify the pool
271
271
  * @param {string} marginManagerId The ID of the margin manager
272
272
  * @returns A function that takes a Transaction object
273
273
  */
274
- getBalanceManagerReferralId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
274
+ getBalanceManagerReferralId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
275
275
  /**
276
276
  * @description Check if the margin manager's account exists in the pool.
277
277
  * @param {string} poolKey The key to identify the pool
278
278
  * @param {string} marginManagerId The ID of the margin manager
279
279
  * @returns A function that takes a Transaction object
280
280
  */
281
- accountExists: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
281
+ accountExists: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
282
282
  /**
283
283
  * @description Get the pool account data for the margin manager.
284
284
  * @param {string} poolKey The key to identify the pool
285
285
  * @param {string} marginManagerId The ID of the margin manager
286
286
  * @returns A function that takes a Transaction object
287
287
  */
288
- account: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
288
+ account: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
289
289
  /**
290
290
  * @description Get the open order IDs for the margin manager's account in
291
291
  * the pool.
@@ -293,7 +293,7 @@ declare class MarginManagerContract {
293
293
  * @param {string} marginManagerId The ID of the margin manager
294
294
  * @returns A function that takes a Transaction object
295
295
  */
296
- accountOpenOrders: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
296
+ accountOpenOrders: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
297
297
  /**
298
298
  * @description Get full order details for the margin manager's account in
299
299
  * the pool.
@@ -301,7 +301,7 @@ declare class MarginManagerContract {
301
301
  * @param {string} marginManagerId The ID of the margin manager
302
302
  * @returns A function that takes a Transaction object
303
303
  */
304
- getAccountOrderDetails: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
304
+ getAccountOrderDetails: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
305
305
  /**
306
306
  * @description Get locked balances (base, quote, deep) for the margin
307
307
  * manager's account in the pool.
@@ -309,7 +309,7 @@ declare class MarginManagerContract {
309
309
  * @param {string} marginManagerId The ID of the margin manager
310
310
  * @returns A function that takes a Transaction object
311
311
  */
312
- lockedBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
312
+ lockedBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
313
313
  /**
314
314
  * @description Check whether a limit order can be placed given the
315
315
  * manager's current state.
@@ -322,7 +322,7 @@ declare class MarginManagerContract {
322
322
  * @param {number | bigint} expireTimestamp Order expiration timestamp (ms)
323
323
  * @returns A function that takes a Transaction object
324
324
  */
325
- canPlaceLimitOrder: (poolKey: string, marginManagerId: string, price: number | bigint, quantity: number | bigint, isBid: boolean, payWithDeep: boolean, expireTimestamp: number | bigint) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
325
+ canPlaceLimitOrder: (poolKey: string, marginManagerId: string, price: number | bigint, quantity: number | bigint, isBid: boolean, payWithDeep: boolean, expireTimestamp: number | bigint) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
326
326
  /**
327
327
  * @description Check whether a market order can be placed given the
328
328
  * manager's current state.
@@ -333,7 +333,7 @@ declare class MarginManagerContract {
333
333
  * @param {boolean} payWithDeep Whether to pay fees in DEEP
334
334
  * @returns A function that takes a Transaction object
335
335
  */
336
- canPlaceMarketOrder: (poolKey: string, marginManagerId: string, quantity: number | bigint, isBid: boolean, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
336
+ canPlaceMarketOrder: (poolKey: string, marginManagerId: string, quantity: number | bigint, isBid: boolean, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions45.TransactionResult;
337
337
  }
338
338
  //#endregion
339
339
  export { MarginManagerContract };
@@ -1 +1 @@
1
- {"version":3,"file":"marginManager.d.mts","names":[],"sources":["../../src/transactions/marginManager.ts"],"mappings":";;;;;;;;;cAca,qBAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EAyDQ;;;;;EAhD5B,gBAAA,GAAoB,OAAA,cAAqB,EAAA,EAAI,WAAA;EA6G2B;;;;;EAvFxE,+BAAA,GAAmC,OAAA,cAAqB,EAAA,EAAI,WAAA;;;;;;;;;;EA6VD;;;;;;;EApU3D,kBAAA,GACE,OAAA,UAAiB,OAAA,EAAS,mBAAA,EAAqB,WAAA,EAAa,mB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{ FLOAT_SCALAR } from "../utils/config.mjs";
3
- import { _new, account, accountExists, accountOpenOrders, balanceManager, balanceManagerId, baseBalance, borrowBase, borrowQuote, borrowedBaseShares, borrowedQuoteShares, borrowedShares, calculateAssets, calculateDebts, canPlaceLimitOrder, canPlaceMarketOrder, deepBalance, deepbookPool, deposit, getAccountOrderDetails, getBalanceManagerReferralId, hasBaseDebt, liquidate, lockedBalance, managerState, marginPoolId, newWithInitializer, owner, quoteBalance, registerMarginManager, repayBase, repayQuote, setMarginManagerReferral, share, unregisterMarginManager, unsetMarginManagerReferral, withdraw } from "../contracts/deepbook_margin/margin_manager.mjs";
3
+ import { _new, account, accountExists, accountOpenOrders, balanceManager, balanceManagerId, baseBalance, borrowedBaseShares, borrowedQuoteShares, borrowedShares, calculateAssets, calculateDebts, canPlaceLimitOrder, canPlaceMarketOrder, deepBalance, deepbookPool, getAccountOrderDetails, getBalanceManagerReferralId, hasBaseDebt, lockedBalance, marginPoolId, newWithInitializer, owner, quoteBalance, registerMarginManager, repayBase, repayQuote, setMarginManagerReferral, share, unregisterMarginManager, unsetMarginManagerReferral } from "../contracts/deepbook_margin/margin_manager.mjs";
4
+ import { margin_manager_upgraded_exports } from "../contracts/deepbook_margin/margin_manager_upgraded.mjs";
4
5
  import { coinWithBalance } from "@mysten/sui/transactions";
5
6
 
6
7
  //#region src/transactions/marginManager.ts
@@ -96,13 +97,13 @@ var MarginManagerContract = class {
96
97
  type: depositCoin.type,
97
98
  balance: convertQuantity(params.amount, depositCoin.scalar)
98
99
  }) : params.coin;
99
- tx.add(deposit({
100
+ tx.add(this.#oracleCalls.deposit({
100
101
  package: this.#config.MARGIN_PACKAGE_ID,
101
102
  arguments: {
102
103
  self: manager,
103
104
  registry: this.#config.MARGIN_REGISTRY_ID,
104
- baseOracle: baseCoin.priceInfoObjectId,
105
- quoteOracle: quoteCoin.priceInfoObjectId,
105
+ baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
106
+ quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
106
107
  coin
107
108
  },
108
109
  typeArguments: [
@@ -122,13 +123,13 @@ var MarginManagerContract = class {
122
123
  type: baseCoin.type,
123
124
  balance: convertQuantity(params.amount, baseCoin.scalar)
124
125
  }) : params.coin;
125
- tx.add(deposit({
126
+ tx.add(this.#oracleCalls.deposit({
126
127
  package: this.#config.MARGIN_PACKAGE_ID,
127
128
  arguments: {
128
129
  self: manager.address,
129
130
  registry: this.#config.MARGIN_REGISTRY_ID,
130
- baseOracle: baseCoin.priceInfoObjectId,
131
- quoteOracle: quoteCoin.priceInfoObjectId,
131
+ baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
132
+ quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
132
133
  coin
133
134
  },
134
135
  typeArguments: [
@@ -148,13 +149,13 @@ var MarginManagerContract = class {
148
149
  type: quoteCoin.type,
149
150
  balance: convertQuantity(params.amount, quoteCoin.scalar)
150
151
  }) : params.coin;
151
- tx.add(deposit({
152
+ tx.add(this.#oracleCalls.deposit({
152
153
  package: this.#config.MARGIN_PACKAGE_ID,
153
154
  arguments: {
154
155
  self: manager.address,
155
156
  registry: this.#config.MARGIN_REGISTRY_ID,
156
- baseOracle: baseCoin.priceInfoObjectId,
157
- quoteOracle: quoteCoin.priceInfoObjectId,
157
+ baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
158
+ quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
158
159
  coin
159
160
  },
160
161
  typeArguments: [
@@ -175,13 +176,13 @@ var MarginManagerContract = class {
175
176
  type: deepCoin.type,
176
177
  balance: convertQuantity(params.amount, deepCoin.scalar)
177
178
  }) : params.coin;
178
- tx.add(deposit({
179
+ tx.add(this.#oracleCalls.deposit({
179
180
  package: this.#config.MARGIN_PACKAGE_ID,
180
181
  arguments: {
181
182
  self: manager.address,
182
183
  registry: this.#config.MARGIN_REGISTRY_ID,
183
- baseOracle: baseCoin.priceInfoObjectId,
184
- quoteOracle: quoteCoin.priceInfoObjectId,
184
+ baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
185
+ quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
185
186
  coin
186
187
  },
187
188
  typeArguments: [
@@ -198,15 +199,15 @@ var MarginManagerContract = class {
198
199
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
199
200
  const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
200
201
  const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
201
- return tx.add(withdraw({
202
+ return tx.add(this.#oracleCalls.withdraw({
202
203
  package: this.#config.MARGIN_PACKAGE_ID,
203
204
  arguments: {
204
205
  self: manager.address,
205
206
  registry: this.#config.MARGIN_REGISTRY_ID,
206
207
  baseMarginPool: baseMarginPool.address,
207
208
  quoteMarginPool: quoteMarginPool.address,
208
- baseOracle: baseCoin.priceInfoObjectId,
209
- quoteOracle: quoteCoin.priceInfoObjectId,
209
+ baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
210
+ quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
210
211
  pool: pool.address,
211
212
  withdrawAmount: convertQuantity(amount, baseCoin.scalar)
212
213
  },
@@ -224,15 +225,15 @@ var MarginManagerContract = class {
224
225
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
225
226
  const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
226
227
  const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
227
- return tx.add(withdraw({
228
+ return tx.add(this.#oracleCalls.withdraw({
228
229
  package: this.#config.MARGIN_PACKAGE_ID,
229
230
  arguments: {
230
231
  self: manager.address,
231
232
  registry: this.#config.MARGIN_REGISTRY_ID,
232
233
  baseMarginPool: baseMarginPool.address,
233
234
  quoteMarginPool: quoteMarginPool.address,
234
- baseOracle: baseCoin.priceInfoObjectId,
235
- quoteOracle: quoteCoin.priceInfoObjectId,
235
+ baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
236
+ quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
236
237
  pool: pool.address,
237
238
  withdrawAmount: convertQuantity(amount, quoteCoin.scalar)
238
239
  },
@@ -251,15 +252,15 @@ var MarginManagerContract = class {
251
252
  const deepCoin = this.#config.getCoin("DEEP");
252
253
  const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
253
254
  const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
254
- return tx.add(withdraw({
255
+ return tx.add(this.#oracleCalls.withdraw({
255
256
  package: this.#config.MARGIN_PACKAGE_ID,
256
257
  arguments: {
257
258
  self: manager.address,
258
259
  registry: this.#config.MARGIN_REGISTRY_ID,
259
260
  baseMarginPool: baseMarginPool.address,
260
261
  quoteMarginPool: quoteMarginPool.address,
261
- baseOracle: baseCoin.priceInfoObjectId,
262
- quoteOracle: quoteCoin.priceInfoObjectId,
262
+ baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
263
+ quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
263
264
  pool: pool.address,
264
265
  withdrawAmount: convertQuantity(amount, deepCoin.scalar)
265
266
  },
@@ -276,14 +277,14 @@ var MarginManagerContract = class {
276
277
  const baseCoin = this.#config.getCoin(pool.baseCoin);
277
278
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
278
279
  const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
279
- return tx.add(borrowBase({
280
+ return tx.add(this.#oracleCalls.borrowBase({
280
281
  package: this.#config.MARGIN_PACKAGE_ID,
281
282
  arguments: {
282
283
  self: manager.address,
283
284
  registry: this.#config.MARGIN_REGISTRY_ID,
284
285
  baseMarginPool: baseMarginPool.address,
285
- baseOracle: baseCoin.priceInfoObjectId,
286
- quoteOracle: quoteCoin.priceInfoObjectId,
286
+ baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
287
+ quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
287
288
  pool: pool.address,
288
289
  loanAmount: convertQuantity(amount, baseCoin.scalar)
289
290
  },
@@ -296,14 +297,14 @@ var MarginManagerContract = class {
296
297
  const baseCoin = this.#config.getCoin(pool.baseCoin);
297
298
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
298
299
  const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
299
- return tx.add(borrowQuote({
300
+ return tx.add(this.#oracleCalls.borrowQuote({
300
301
  package: this.#config.MARGIN_PACKAGE_ID,
301
302
  arguments: {
302
303
  self: manager.address,
303
304
  registry: this.#config.MARGIN_REGISTRY_ID,
304
305
  quoteMarginPool: quoteMarginPool.address,
305
- baseOracle: baseCoin.priceInfoObjectId,
306
- quoteOracle: quoteCoin.priceInfoObjectId,
306
+ baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
307
+ quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
307
308
  pool: pool.address,
308
309
  loanAmount: convertQuantity(amount, quoteCoin.scalar)
309
310
  },
@@ -351,13 +352,13 @@ var MarginManagerContract = class {
351
352
  const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
352
353
  const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
353
354
  const marginPool = debtIsBase ? baseMarginPool : quoteMarginPool;
354
- return tx.add(liquidate({
355
+ return tx.add(this.#oracleCalls.liquidate({
355
356
  package: this.#config.MARGIN_PACKAGE_ID,
356
357
  arguments: {
357
358
  self: managerAddress,
358
359
  registry: this.#config.MARGIN_REGISTRY_ID,
359
- baseOracle: baseCoin.priceInfoObjectId,
360
- quoteOracle: quoteCoin.priceInfoObjectId,
360
+ baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
361
+ quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
361
362
  marginPool: marginPool.address,
362
363
  pool: pool.address,
363
364
  repayCoin
@@ -515,13 +516,13 @@ var MarginManagerContract = class {
515
516
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
516
517
  const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
517
518
  const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
518
- return tx.add(managerState({
519
+ return tx.add(this.#oracleCalls.managerState({
519
520
  package: this.#config.MARGIN_PACKAGE_ID,
520
521
  arguments: {
521
522
  self: marginManagerId,
522
523
  registry: this.#config.MARGIN_REGISTRY_ID,
523
- baseOracle: baseCoin.priceInfoObjectId,
524
- quoteOracle: quoteCoin.priceInfoObjectId,
524
+ baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
525
+ quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
525
526
  pool: pool.address,
526
527
  baseMarginPool: baseMarginPool.address,
527
528
  quoteMarginPool: quoteMarginPool.address
@@ -686,6 +687,14 @@ var MarginManagerContract = class {
686
687
  };
687
688
  this.#config = config;
688
689
  }
690
+ /**
691
+ * Oracle-taking entrypoints live in the parallel `_upgraded` module, which takes Pyth's
692
+ * upgraded-Core `PriceInfoObject`. Entrypoints with no oracle argument stay on the base
693
+ * module, which is the only place they exist.
694
+ */
695
+ get #oracleCalls() {
696
+ return margin_manager_upgraded_exports;
697
+ }
689
698
  };
690
699
 
691
700
  //#endregion