@mysten/deepbook-v3 1.6.7 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/_virtual/rolldown_runtime.mjs +18 -0
  3. package/dist/client.d.mts +9 -6
  4. package/dist/client.d.mts.map +1 -1
  5. package/dist/client.mjs +3 -2
  6. package/dist/client.mjs.map +1 -1
  7. package/dist/contracts/deepbook/account.d.mts +18 -18
  8. package/dist/contracts/deepbook/account.d.mts.map +1 -1
  9. package/dist/contracts/deepbook/deep_price.d.mts +3 -3
  10. package/dist/contracts/deepbook/deep_price.d.mts.map +1 -1
  11. package/dist/contracts/deepbook_margin/margin_manager.mjs +1 -319
  12. package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -1
  13. package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs +386 -0
  14. package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs.map +1 -0
  15. package/dist/contracts/deepbook_margin/oracle.mjs +9 -0
  16. package/dist/contracts/deepbook_margin/oracle.mjs.map +1 -1
  17. package/dist/contracts/deepbook_margin/pool_proxy.mjs +1 -383
  18. package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -1
  19. package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs +340 -0
  20. package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs.map +1 -0
  21. package/dist/contracts/margin_liquidation/liquidation_vault.mjs +33 -17
  22. package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -1
  23. package/dist/index.d.mts +4 -3
  24. package/dist/index.mjs +2 -2
  25. package/dist/pyth/PriceServiceConnection.d.mts +18 -3
  26. package/dist/pyth/PriceServiceConnection.d.mts.map +1 -1
  27. package/dist/pyth/PriceServiceConnection.mjs +35 -4
  28. package/dist/pyth/PriceServiceConnection.mjs.map +1 -1
  29. package/dist/queries/priceFeedQueries.mjs +50 -18
  30. package/dist/queries/priceFeedQueries.mjs.map +1 -1
  31. package/dist/transactions/balanceManager.d.mts +12 -12
  32. package/dist/transactions/deepbook.d.mts +20 -20
  33. package/dist/transactions/deepbookAdmin.d.mts +4 -4
  34. package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
  35. package/dist/transactions/marginAdmin.d.mts +7 -7
  36. package/dist/transactions/marginAdmin.d.mts.map +1 -1
  37. package/dist/transactions/marginAdmin.mjs +2 -2
  38. package/dist/transactions/marginAdmin.mjs.map +1 -1
  39. package/dist/transactions/marginLiquidations.d.mts.map +1 -1
  40. package/dist/transactions/marginLiquidations.mjs +19 -7
  41. package/dist/transactions/marginLiquidations.mjs.map +1 -1
  42. package/dist/transactions/marginMaintainer.d.mts +5 -5
  43. package/dist/transactions/marginManager.d.mts +32 -32
  44. package/dist/transactions/marginManager.d.mts.map +1 -1
  45. package/dist/transactions/marginManager.mjs +43 -34
  46. package/dist/transactions/marginManager.mjs.map +1 -1
  47. package/dist/transactions/marginPool.d.mts +18 -18
  48. package/dist/transactions/marginTPSL.d.mts +10 -10
  49. package/dist/transactions/marginTPSL.d.mts.map +1 -1
  50. package/dist/transactions/marginTPSL.mjs +19 -10
  51. package/dist/transactions/marginTPSL.mjs.map +1 -1
  52. package/dist/transactions/poolProxy.d.mts +8 -8
  53. package/dist/transactions/poolProxy.d.mts.map +1 -1
  54. package/dist/transactions/poolProxy.mjs +34 -27
  55. package/dist/transactions/poolProxy.mjs.map +1 -1
  56. package/dist/types/index.d.mts +16 -1
  57. package/dist/types/index.d.mts.map +1 -1
  58. package/dist/types/index.mjs.map +1 -1
  59. package/dist/utils/config.d.mts +30 -10
  60. package/dist/utils/config.d.mts.map +1 -1
  61. package/dist/utils/config.mjs +33 -4
  62. package/dist/utils/config.mjs.map +1 -1
  63. package/dist/utils/constants.d.mts +32 -1
  64. package/dist/utils/constants.d.mts.map +1 -1
  65. package/dist/utils/constants.mjs +54 -23
  66. package/dist/utils/constants.mjs.map +1 -1
  67. package/package.json +1 -1
  68. package/src/client.ts +9 -1
  69. package/src/contracts/deepbook_margin/margin_manager.ts +140 -10
  70. package/src/contracts/deepbook_margin/margin_manager_upgraded.ts +651 -0
  71. package/src/contracts/deepbook_margin/oracle.ts +59 -0
  72. package/src/contracts/deepbook_margin/pool_proxy.ts +600 -584
  73. package/src/contracts/deepbook_margin/pool_proxy_upgraded.ts +614 -0
  74. package/src/contracts/margin_liquidation/liquidation_vault.ts +142 -0
  75. package/src/index.ts +4 -0
  76. package/src/pyth/PriceServiceConnection.ts +69 -8
  77. package/src/queries/priceFeedQueries.ts +74 -24
  78. package/src/transactions/marginAdmin.ts +2 -4
  79. package/src/transactions/marginLiquidations.ts +20 -6
  80. package/src/transactions/marginManager.ts +43 -33
  81. package/src/transactions/marginTPSL.ts +19 -9
  82. package/src/transactions/poolProxy.ts +34 -30
  83. package/src/types/index.ts +16 -0
  84. package/src/utils/config.ts +69 -9
  85. package/src/utils/constants.ts +88 -25
@@ -0,0 +1,651 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+ /**
6
+ * Pyth's upgraded Core entrypoints for `margin_manager`.
7
+ *
8
+ * Pyth Core is being replaced by a separately published package, so its
9
+ * `PriceInfoObject` is a distinct Move type from the legacy one and the frozen
10
+ * signatures in `margin_manager` can never accept it. The upgraded surface
11
+ * therefore lives here, under the same function names. Each entry reads the
12
+ * upgraded feed and delegates to the shared core in `margin_manager`, so both
13
+ * feeds run identical logic.
14
+ */
15
+
16
+ import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
17
+ import { normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
18
+ export interface AddConditionalOrderArguments {
19
+ self: RawTransactionArgument<string>;
20
+ pool: RawTransactionArgument<string>;
21
+ basePriceInfoObject: RawTransactionArgument<string>;
22
+ quotePriceInfoObject: RawTransactionArgument<string>;
23
+ registry: RawTransactionArgument<string>;
24
+ conditionalOrderId: RawTransactionArgument<number | bigint>;
25
+ condition: TransactionArgument;
26
+ pendingOrder: TransactionArgument;
27
+ }
28
+ export interface AddConditionalOrderOptions {
29
+ package?: string;
30
+ arguments:
31
+ | AddConditionalOrderArguments
32
+ | [
33
+ self: RawTransactionArgument<string>,
34
+ pool: RawTransactionArgument<string>,
35
+ basePriceInfoObject: RawTransactionArgument<string>,
36
+ quotePriceInfoObject: RawTransactionArgument<string>,
37
+ registry: RawTransactionArgument<string>,
38
+ conditionalOrderId: RawTransactionArgument<number | bigint>,
39
+ condition: TransactionArgument,
40
+ pendingOrder: TransactionArgument,
41
+ ];
42
+ typeArguments: [string, string];
43
+ }
44
+ /** Twin: `margin_manager::add_conditional_order`. Edit both. */
45
+ export function addConditionalOrder(options: AddConditionalOrderOptions) {
46
+ const packageAddress = options.package ?? '@deepbook/margin';
47
+ const argumentsTypes = [
48
+ null,
49
+ null,
50
+ null,
51
+ null,
52
+ null,
53
+ 'u64',
54
+ null,
55
+ null,
56
+ '0x2::clock::Clock',
57
+ ] satisfies (string | null)[];
58
+ const parameterNames = [
59
+ 'self',
60
+ 'pool',
61
+ 'basePriceInfoObject',
62
+ 'quotePriceInfoObject',
63
+ 'registry',
64
+ 'conditionalOrderId',
65
+ 'condition',
66
+ 'pendingOrder',
67
+ ];
68
+ return (tx: Transaction) =>
69
+ tx.moveCall({
70
+ package: packageAddress,
71
+ module: 'margin_manager_upgraded',
72
+ function: 'add_conditional_order',
73
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
74
+ typeArguments: options.typeArguments,
75
+ });
76
+ }
77
+ export interface ExecuteConditionalOrdersV2Arguments {
78
+ self: RawTransactionArgument<string>;
79
+ pool: RawTransactionArgument<string>;
80
+ baseMarginPool: RawTransactionArgument<string>;
81
+ quoteMarginPool: RawTransactionArgument<string>;
82
+ basePriceInfoObject: RawTransactionArgument<string>;
83
+ quotePriceInfoObject: RawTransactionArgument<string>;
84
+ registry: RawTransactionArgument<string>;
85
+ maxOrdersToExecute: RawTransactionArgument<number | bigint>;
86
+ }
87
+ export interface ExecuteConditionalOrdersV2Options {
88
+ package?: string;
89
+ arguments:
90
+ | ExecuteConditionalOrdersV2Arguments
91
+ | [
92
+ self: RawTransactionArgument<string>,
93
+ pool: RawTransactionArgument<string>,
94
+ baseMarginPool: RawTransactionArgument<string>,
95
+ quoteMarginPool: RawTransactionArgument<string>,
96
+ basePriceInfoObject: RawTransactionArgument<string>,
97
+ quotePriceInfoObject: RawTransactionArgument<string>,
98
+ registry: RawTransactionArgument<string>,
99
+ maxOrdersToExecute: RawTransactionArgument<number | bigint>,
100
+ ];
101
+ typeArguments: [string, string];
102
+ }
103
+ /** Twin: `margin_manager::execute_conditional_orders_v2`. Edit both. */
104
+ export function executeConditionalOrdersV2(options: ExecuteConditionalOrdersV2Options) {
105
+ const packageAddress = options.package ?? '@deepbook/margin';
106
+ const argumentsTypes = [
107
+ null,
108
+ null,
109
+ null,
110
+ null,
111
+ null,
112
+ null,
113
+ null,
114
+ 'u64',
115
+ '0x2::clock::Clock',
116
+ ] satisfies (string | null)[];
117
+ const parameterNames = [
118
+ 'self',
119
+ 'pool',
120
+ 'baseMarginPool',
121
+ 'quoteMarginPool',
122
+ 'basePriceInfoObject',
123
+ 'quotePriceInfoObject',
124
+ 'registry',
125
+ 'maxOrdersToExecute',
126
+ ];
127
+ return (tx: Transaction) =>
128
+ tx.moveCall({
129
+ package: packageAddress,
130
+ module: 'margin_manager_upgraded',
131
+ function: 'execute_conditional_orders_v2',
132
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
133
+ typeArguments: options.typeArguments,
134
+ });
135
+ }
136
+ export interface ExecuteConditionalOrdersV3Arguments {
137
+ self: RawTransactionArgument<string>;
138
+ pool: RawTransactionArgument<string>;
139
+ baseMarginPool: RawTransactionArgument<string>;
140
+ quoteMarginPool: RawTransactionArgument<string>;
141
+ basePriceInfoObject: RawTransactionArgument<string>;
142
+ quotePriceInfoObject: RawTransactionArgument<string>;
143
+ registry: RawTransactionArgument<string>;
144
+ maxOrdersToExecute: RawTransactionArgument<number | bigint>;
145
+ }
146
+ export interface ExecuteConditionalOrdersV3Options {
147
+ package?: string;
148
+ arguments:
149
+ | ExecuteConditionalOrdersV3Arguments
150
+ | [
151
+ self: RawTransactionArgument<string>,
152
+ pool: RawTransactionArgument<string>,
153
+ baseMarginPool: RawTransactionArgument<string>,
154
+ quoteMarginPool: RawTransactionArgument<string>,
155
+ basePriceInfoObject: RawTransactionArgument<string>,
156
+ quotePriceInfoObject: RawTransactionArgument<string>,
157
+ registry: RawTransactionArgument<string>,
158
+ maxOrdersToExecute: RawTransactionArgument<number | bigint>,
159
+ ];
160
+ typeArguments: [string, string];
161
+ }
162
+ /** Twin: `margin_manager::execute_conditional_orders_v3`. Edit both. */
163
+ export function executeConditionalOrdersV3(options: ExecuteConditionalOrdersV3Options) {
164
+ const packageAddress = options.package ?? '@deepbook/margin';
165
+ const argumentsTypes = [
166
+ null,
167
+ null,
168
+ null,
169
+ null,
170
+ null,
171
+ null,
172
+ null,
173
+ 'u64',
174
+ '0x2::clock::Clock',
175
+ ] satisfies (string | null)[];
176
+ const parameterNames = [
177
+ 'self',
178
+ 'pool',
179
+ 'baseMarginPool',
180
+ 'quoteMarginPool',
181
+ 'basePriceInfoObject',
182
+ 'quotePriceInfoObject',
183
+ 'registry',
184
+ 'maxOrdersToExecute',
185
+ ];
186
+ return (tx: Transaction) =>
187
+ tx.moveCall({
188
+ package: packageAddress,
189
+ module: 'margin_manager_upgraded',
190
+ function: 'execute_conditional_orders_v3',
191
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
192
+ typeArguments: options.typeArguments,
193
+ });
194
+ }
195
+ export interface DepositArguments {
196
+ self: RawTransactionArgument<string>;
197
+ registry: RawTransactionArgument<string>;
198
+ baseOracle: RawTransactionArgument<string>;
199
+ quoteOracle: RawTransactionArgument<string>;
200
+ coin: RawTransactionArgument<string>;
201
+ }
202
+ export interface DepositOptions {
203
+ package?: string;
204
+ arguments:
205
+ | DepositArguments
206
+ | [
207
+ self: RawTransactionArgument<string>,
208
+ registry: RawTransactionArgument<string>,
209
+ baseOracle: RawTransactionArgument<string>,
210
+ quoteOracle: RawTransactionArgument<string>,
211
+ coin: RawTransactionArgument<string>,
212
+ ];
213
+ typeArguments: [string, string, string];
214
+ }
215
+ /** Twin: `margin_manager::deposit`. Edit both. */
216
+ export function deposit(options: DepositOptions) {
217
+ const packageAddress = options.package ?? '@deepbook/margin';
218
+ const argumentsTypes = [null, null, null, null, null, '0x2::clock::Clock'] satisfies (
219
+ | string
220
+ | null
221
+ )[];
222
+ const parameterNames = ['self', 'registry', 'baseOracle', 'quoteOracle', 'coin'];
223
+ return (tx: Transaction) =>
224
+ tx.moveCall({
225
+ package: packageAddress,
226
+ module: 'margin_manager_upgraded',
227
+ function: 'deposit',
228
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
229
+ typeArguments: options.typeArguments,
230
+ });
231
+ }
232
+ export interface WithdrawArguments {
233
+ self: RawTransactionArgument<string>;
234
+ registry: RawTransactionArgument<string>;
235
+ baseMarginPool: RawTransactionArgument<string>;
236
+ quoteMarginPool: RawTransactionArgument<string>;
237
+ baseOracle: RawTransactionArgument<string>;
238
+ quoteOracle: RawTransactionArgument<string>;
239
+ pool: RawTransactionArgument<string>;
240
+ withdrawAmount: RawTransactionArgument<number | bigint>;
241
+ }
242
+ export interface WithdrawOptions {
243
+ package?: string;
244
+ arguments:
245
+ | WithdrawArguments
246
+ | [
247
+ self: RawTransactionArgument<string>,
248
+ registry: RawTransactionArgument<string>,
249
+ baseMarginPool: RawTransactionArgument<string>,
250
+ quoteMarginPool: RawTransactionArgument<string>,
251
+ baseOracle: RawTransactionArgument<string>,
252
+ quoteOracle: RawTransactionArgument<string>,
253
+ pool: RawTransactionArgument<string>,
254
+ withdrawAmount: RawTransactionArgument<number | bigint>,
255
+ ];
256
+ typeArguments: [string, string, string];
257
+ }
258
+ /** Twin: `margin_manager::withdraw`. Edit both. */
259
+ export function withdraw(options: WithdrawOptions) {
260
+ const packageAddress = options.package ?? '@deepbook/margin';
261
+ const argumentsTypes = [
262
+ null,
263
+ null,
264
+ null,
265
+ null,
266
+ null,
267
+ null,
268
+ null,
269
+ 'u64',
270
+ '0x2::clock::Clock',
271
+ ] satisfies (string | null)[];
272
+ const parameterNames = [
273
+ 'self',
274
+ 'registry',
275
+ 'baseMarginPool',
276
+ 'quoteMarginPool',
277
+ 'baseOracle',
278
+ 'quoteOracle',
279
+ 'pool',
280
+ 'withdrawAmount',
281
+ ];
282
+ return (tx: Transaction) =>
283
+ tx.moveCall({
284
+ package: packageAddress,
285
+ module: 'margin_manager_upgraded',
286
+ function: 'withdraw',
287
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
288
+ typeArguments: options.typeArguments,
289
+ });
290
+ }
291
+ export interface BorrowBaseArguments {
292
+ self: RawTransactionArgument<string>;
293
+ registry: RawTransactionArgument<string>;
294
+ baseMarginPool: RawTransactionArgument<string>;
295
+ baseOracle: RawTransactionArgument<string>;
296
+ quoteOracle: RawTransactionArgument<string>;
297
+ pool: RawTransactionArgument<string>;
298
+ loanAmount: RawTransactionArgument<number | bigint>;
299
+ }
300
+ export interface BorrowBaseOptions {
301
+ package?: string;
302
+ arguments:
303
+ | BorrowBaseArguments
304
+ | [
305
+ self: RawTransactionArgument<string>,
306
+ registry: RawTransactionArgument<string>,
307
+ baseMarginPool: RawTransactionArgument<string>,
308
+ baseOracle: RawTransactionArgument<string>,
309
+ quoteOracle: RawTransactionArgument<string>,
310
+ pool: RawTransactionArgument<string>,
311
+ loanAmount: RawTransactionArgument<number | bigint>,
312
+ ];
313
+ typeArguments: [string, string];
314
+ }
315
+ /** Twin: `margin_manager::borrow_base`. Edit both. */
316
+ export function borrowBase(options: BorrowBaseOptions) {
317
+ const packageAddress = options.package ?? '@deepbook/margin';
318
+ const argumentsTypes = [
319
+ null,
320
+ null,
321
+ null,
322
+ null,
323
+ null,
324
+ null,
325
+ 'u64',
326
+ '0x2::clock::Clock',
327
+ ] satisfies (string | null)[];
328
+ const parameterNames = [
329
+ 'self',
330
+ 'registry',
331
+ 'baseMarginPool',
332
+ 'baseOracle',
333
+ 'quoteOracle',
334
+ 'pool',
335
+ 'loanAmount',
336
+ ];
337
+ return (tx: Transaction) =>
338
+ tx.moveCall({
339
+ package: packageAddress,
340
+ module: 'margin_manager_upgraded',
341
+ function: 'borrow_base',
342
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
343
+ typeArguments: options.typeArguments,
344
+ });
345
+ }
346
+ export interface BorrowQuoteArguments {
347
+ self: RawTransactionArgument<string>;
348
+ registry: RawTransactionArgument<string>;
349
+ quoteMarginPool: RawTransactionArgument<string>;
350
+ baseOracle: RawTransactionArgument<string>;
351
+ quoteOracle: RawTransactionArgument<string>;
352
+ pool: RawTransactionArgument<string>;
353
+ loanAmount: RawTransactionArgument<number | bigint>;
354
+ }
355
+ export interface BorrowQuoteOptions {
356
+ package?: string;
357
+ arguments:
358
+ | BorrowQuoteArguments
359
+ | [
360
+ self: RawTransactionArgument<string>,
361
+ registry: RawTransactionArgument<string>,
362
+ quoteMarginPool: RawTransactionArgument<string>,
363
+ baseOracle: RawTransactionArgument<string>,
364
+ quoteOracle: RawTransactionArgument<string>,
365
+ pool: RawTransactionArgument<string>,
366
+ loanAmount: RawTransactionArgument<number | bigint>,
367
+ ];
368
+ typeArguments: [string, string];
369
+ }
370
+ /** Twin: `margin_manager::borrow_quote`. Edit both. */
371
+ export function borrowQuote(options: BorrowQuoteOptions) {
372
+ const packageAddress = options.package ?? '@deepbook/margin';
373
+ const argumentsTypes = [
374
+ null,
375
+ null,
376
+ null,
377
+ null,
378
+ null,
379
+ null,
380
+ 'u64',
381
+ '0x2::clock::Clock',
382
+ ] satisfies (string | null)[];
383
+ const parameterNames = [
384
+ 'self',
385
+ 'registry',
386
+ 'quoteMarginPool',
387
+ 'baseOracle',
388
+ 'quoteOracle',
389
+ 'pool',
390
+ 'loanAmount',
391
+ ];
392
+ return (tx: Transaction) =>
393
+ tx.moveCall({
394
+ package: packageAddress,
395
+ module: 'margin_manager_upgraded',
396
+ function: 'borrow_quote',
397
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
398
+ typeArguments: options.typeArguments,
399
+ });
400
+ }
401
+ export interface LiquidateArguments {
402
+ self: RawTransactionArgument<string>;
403
+ registry: RawTransactionArgument<string>;
404
+ baseOracle: RawTransactionArgument<string>;
405
+ quoteOracle: RawTransactionArgument<string>;
406
+ marginPool: RawTransactionArgument<string>;
407
+ pool: RawTransactionArgument<string>;
408
+ repayCoin: RawTransactionArgument<string>;
409
+ }
410
+ export interface LiquidateOptions {
411
+ package?: string;
412
+ arguments:
413
+ | LiquidateArguments
414
+ | [
415
+ self: RawTransactionArgument<string>,
416
+ registry: RawTransactionArgument<string>,
417
+ baseOracle: RawTransactionArgument<string>,
418
+ quoteOracle: RawTransactionArgument<string>,
419
+ marginPool: RawTransactionArgument<string>,
420
+ pool: RawTransactionArgument<string>,
421
+ repayCoin: RawTransactionArgument<string>,
422
+ ];
423
+ typeArguments: [string, string, string];
424
+ }
425
+ /** Twin: `margin_manager::liquidate`. Edit both. */
426
+ export function liquidate(options: LiquidateOptions) {
427
+ const packageAddress = options.package ?? '@deepbook/margin';
428
+ const argumentsTypes = [null, null, null, null, null, null, null, '0x2::clock::Clock'] satisfies (
429
+ | string
430
+ | null
431
+ )[];
432
+ const parameterNames = [
433
+ 'self',
434
+ 'registry',
435
+ 'baseOracle',
436
+ 'quoteOracle',
437
+ 'marginPool',
438
+ 'pool',
439
+ 'repayCoin',
440
+ ];
441
+ return (tx: Transaction) =>
442
+ tx.moveCall({
443
+ package: packageAddress,
444
+ module: 'margin_manager_upgraded',
445
+ function: 'liquidate',
446
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
447
+ typeArguments: options.typeArguments,
448
+ });
449
+ }
450
+ export interface RiskRatioArguments {
451
+ self: RawTransactionArgument<string>;
452
+ registry: RawTransactionArgument<string>;
453
+ baseOracle: RawTransactionArgument<string>;
454
+ quoteOracle: RawTransactionArgument<string>;
455
+ pool: RawTransactionArgument<string>;
456
+ baseMarginPool: RawTransactionArgument<string>;
457
+ quoteMarginPool: RawTransactionArgument<string>;
458
+ }
459
+ export interface RiskRatioOptions {
460
+ package?: string;
461
+ arguments:
462
+ | RiskRatioArguments
463
+ | [
464
+ self: RawTransactionArgument<string>,
465
+ registry: RawTransactionArgument<string>,
466
+ baseOracle: RawTransactionArgument<string>,
467
+ quoteOracle: RawTransactionArgument<string>,
468
+ pool: RawTransactionArgument<string>,
469
+ baseMarginPool: RawTransactionArgument<string>,
470
+ quoteMarginPool: RawTransactionArgument<string>,
471
+ ];
472
+ typeArguments: [string, string];
473
+ }
474
+ /** Twin: `margin_manager::risk_ratio`. Edit both. */
475
+ export function riskRatio(options: RiskRatioOptions) {
476
+ const packageAddress = options.package ?? '@deepbook/margin';
477
+ const argumentsTypes = [null, null, null, null, null, null, null, '0x2::clock::Clock'] satisfies (
478
+ | string
479
+ | null
480
+ )[];
481
+ const parameterNames = [
482
+ 'self',
483
+ 'registry',
484
+ 'baseOracle',
485
+ 'quoteOracle',
486
+ 'pool',
487
+ 'baseMarginPool',
488
+ 'quoteMarginPool',
489
+ ];
490
+ return (tx: Transaction) =>
491
+ tx.moveCall({
492
+ package: packageAddress,
493
+ module: 'margin_manager_upgraded',
494
+ function: 'risk_ratio',
495
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
496
+ typeArguments: options.typeArguments,
497
+ });
498
+ }
499
+ export interface RiskRatioUnsafeArguments {
500
+ self: RawTransactionArgument<string>;
501
+ registry: RawTransactionArgument<string>;
502
+ baseOracle: RawTransactionArgument<string>;
503
+ quoteOracle: RawTransactionArgument<string>;
504
+ pool: RawTransactionArgument<string>;
505
+ baseMarginPool: RawTransactionArgument<string>;
506
+ quoteMarginPool: RawTransactionArgument<string>;
507
+ }
508
+ export interface RiskRatioUnsafeOptions {
509
+ package?: string;
510
+ arguments:
511
+ | RiskRatioUnsafeArguments
512
+ | [
513
+ self: RawTransactionArgument<string>,
514
+ registry: RawTransactionArgument<string>,
515
+ baseOracle: RawTransactionArgument<string>,
516
+ quoteOracle: RawTransactionArgument<string>,
517
+ pool: RawTransactionArgument<string>,
518
+ baseMarginPool: RawTransactionArgument<string>,
519
+ quoteMarginPool: RawTransactionArgument<string>,
520
+ ];
521
+ typeArguments: [string, string];
522
+ }
523
+ /** Twin: `margin_manager::risk_ratio_unsafe`. Edit both. */
524
+ export function riskRatioUnsafe(options: RiskRatioUnsafeOptions) {
525
+ const packageAddress = options.package ?? '@deepbook/margin';
526
+ const argumentsTypes = [null, null, null, null, null, null, null, '0x2::clock::Clock'] satisfies (
527
+ | string
528
+ | null
529
+ )[];
530
+ const parameterNames = [
531
+ 'self',
532
+ 'registry',
533
+ 'baseOracle',
534
+ 'quoteOracle',
535
+ 'pool',
536
+ 'baseMarginPool',
537
+ 'quoteMarginPool',
538
+ ];
539
+ return (tx: Transaction) =>
540
+ tx.moveCall({
541
+ package: packageAddress,
542
+ module: 'margin_manager_upgraded',
543
+ function: 'risk_ratio_unsafe',
544
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
545
+ typeArguments: options.typeArguments,
546
+ });
547
+ }
548
+ export interface ManagerStateArguments {
549
+ self: RawTransactionArgument<string>;
550
+ registry: RawTransactionArgument<string>;
551
+ baseOracle: RawTransactionArgument<string>;
552
+ quoteOracle: RawTransactionArgument<string>;
553
+ pool: RawTransactionArgument<string>;
554
+ baseMarginPool: RawTransactionArgument<string>;
555
+ quoteMarginPool: RawTransactionArgument<string>;
556
+ }
557
+ export interface ManagerStateOptions {
558
+ package?: string;
559
+ arguments:
560
+ | ManagerStateArguments
561
+ | [
562
+ self: RawTransactionArgument<string>,
563
+ registry: RawTransactionArgument<string>,
564
+ baseOracle: RawTransactionArgument<string>,
565
+ quoteOracle: RawTransactionArgument<string>,
566
+ pool: RawTransactionArgument<string>,
567
+ baseMarginPool: RawTransactionArgument<string>,
568
+ quoteMarginPool: RawTransactionArgument<string>,
569
+ ];
570
+ typeArguments: [string, string];
571
+ }
572
+ /** Twin: `margin_manager::manager_state`. Edit both. */
573
+ export function managerState(options: ManagerStateOptions) {
574
+ const packageAddress = options.package ?? '@deepbook/margin';
575
+ const argumentsTypes = [null, null, null, null, null, null, null, '0x2::clock::Clock'] satisfies (
576
+ | string
577
+ | null
578
+ )[];
579
+ const parameterNames = [
580
+ 'self',
581
+ 'registry',
582
+ 'baseOracle',
583
+ 'quoteOracle',
584
+ 'pool',
585
+ 'baseMarginPool',
586
+ 'quoteMarginPool',
587
+ ];
588
+ return (tx: Transaction) =>
589
+ tx.moveCall({
590
+ package: packageAddress,
591
+ module: 'margin_manager_upgraded',
592
+ function: 'manager_state',
593
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
594
+ typeArguments: options.typeArguments,
595
+ });
596
+ }
597
+ export interface ManagerStatesArguments {
598
+ marginManagers: TransactionArgument;
599
+ registry: RawTransactionArgument<string>;
600
+ baseOracle: RawTransactionArgument<string>;
601
+ quoteOracle: RawTransactionArgument<string>;
602
+ pool: RawTransactionArgument<string>;
603
+ baseMarginPool: RawTransactionArgument<string>;
604
+ quoteMarginPool: RawTransactionArgument<string>;
605
+ }
606
+ export interface ManagerStatesOptions {
607
+ package?: string;
608
+ arguments:
609
+ | ManagerStatesArguments
610
+ | [
611
+ marginManagers: TransactionArgument,
612
+ registry: RawTransactionArgument<string>,
613
+ baseOracle: RawTransactionArgument<string>,
614
+ quoteOracle: RawTransactionArgument<string>,
615
+ pool: RawTransactionArgument<string>,
616
+ baseMarginPool: RawTransactionArgument<string>,
617
+ quoteMarginPool: RawTransactionArgument<string>,
618
+ ];
619
+ typeArguments: [string, string];
620
+ }
621
+ /** Twin: `margin_manager::manager_states`. Edit both. */
622
+ export function managerStates(options: ManagerStatesOptions) {
623
+ const packageAddress = options.package ?? '@deepbook/margin';
624
+ const argumentsTypes = [
625
+ 'vector<null>',
626
+ null,
627
+ null,
628
+ null,
629
+ null,
630
+ null,
631
+ null,
632
+ '0x2::clock::Clock',
633
+ ] satisfies (string | null)[];
634
+ const parameterNames = [
635
+ 'marginManagers',
636
+ 'registry',
637
+ 'baseOracle',
638
+ 'quoteOracle',
639
+ 'pool',
640
+ 'baseMarginPool',
641
+ 'quoteMarginPool',
642
+ ];
643
+ return (tx: Transaction) =>
644
+ tx.moveCall({
645
+ package: packageAddress,
646
+ module: 'margin_manager_upgraded',
647
+ function: 'manager_states',
648
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
649
+ typeArguments: options.typeArguments,
650
+ });
651
+ }