@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.
- package/CHANGELOG.md +69 -0
- package/dist/_virtual/rolldown_runtime.mjs +18 -0
- package/dist/client.d.mts +9 -6
- package/dist/client.d.mts.map +1 -1
- package/dist/client.mjs +3 -2
- package/dist/client.mjs.map +1 -1
- package/dist/contracts/deepbook/account.d.mts +18 -18
- package/dist/contracts/deepbook/account.d.mts.map +1 -1
- package/dist/contracts/deepbook/balance_manager.mjs.map +1 -1
- package/dist/contracts/deepbook/balances.d.mts +4 -4
- package/dist/contracts/deepbook/balances.d.mts.map +1 -1
- package/dist/contracts/deepbook/deep_price.d.mts +3 -3
- package/dist/contracts/deepbook/deep_price.d.mts.map +1 -1
- package/dist/contracts/deepbook/order.d.mts +12 -12
- package/dist/contracts/deepbook/pool.mjs.map +1 -1
- package/dist/contracts/deepbook/registry.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_manager.mjs +1 -319
- package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs +386 -0
- package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/margin_pool.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_registry.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/oracle.mjs +9 -0
- package/dist/contracts/deepbook_margin/oracle.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/pool_proxy.mjs +1 -383
- package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs +340 -0
- package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/protocol_config.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/tpsl.mjs.map +1 -1
- package/dist/contracts/margin_liquidation/liquidation_vault.mjs +33 -17
- package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +2 -2
- package/dist/pyth/PriceServiceConnection.d.mts +18 -3
- package/dist/pyth/PriceServiceConnection.d.mts.map +1 -1
- package/dist/pyth/PriceServiceConnection.mjs +35 -4
- package/dist/pyth/PriceServiceConnection.mjs.map +1 -1
- package/dist/queries/priceFeedQueries.mjs +50 -18
- package/dist/queries/priceFeedQueries.mjs.map +1 -1
- package/dist/transactions/balanceManager.d.mts +12 -12
- package/dist/transactions/balanceManager.d.mts.map +1 -1
- package/dist/transactions/deepbook.d.mts +20 -20
- package/dist/transactions/deepbook.d.mts.map +1 -1
- package/dist/transactions/deepbookAdmin.d.mts +4 -4
- package/dist/transactions/marginAdmin.d.mts +7 -7
- package/dist/transactions/marginAdmin.d.mts.map +1 -1
- package/dist/transactions/marginAdmin.mjs +2 -2
- package/dist/transactions/marginAdmin.mjs.map +1 -1
- package/dist/transactions/marginLiquidations.d.mts.map +1 -1
- package/dist/transactions/marginLiquidations.mjs +19 -7
- package/dist/transactions/marginLiquidations.mjs.map +1 -1
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginManager.d.mts.map +1 -1
- package/dist/transactions/marginManager.mjs +43 -34
- package/dist/transactions/marginManager.mjs.map +1 -1
- package/dist/transactions/marginPool.d.mts +18 -18
- package/dist/transactions/marginTPSL.d.mts +10 -10
- package/dist/transactions/marginTPSL.d.mts.map +1 -1
- package/dist/transactions/marginTPSL.mjs +19 -10
- package/dist/transactions/marginTPSL.mjs.map +1 -1
- package/dist/transactions/poolProxy.d.mts +8 -8
- package/dist/transactions/poolProxy.d.mts.map +1 -1
- package/dist/transactions/poolProxy.mjs +34 -27
- package/dist/transactions/poolProxy.mjs.map +1 -1
- package/dist/types/index.d.mts +16 -1
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/utils/config.d.mts +30 -10
- package/dist/utils/config.d.mts.map +1 -1
- package/dist/utils/config.mjs +33 -4
- package/dist/utils/config.mjs.map +1 -1
- package/dist/utils/constants.d.mts +32 -1
- package/dist/utils/constants.d.mts.map +1 -1
- package/dist/utils/constants.mjs +55 -24
- package/dist/utils/constants.mjs.map +1 -1
- package/package.json +10 -10
- package/src/client.ts +9 -1
- package/src/contracts/deepbook/balance_manager.ts +1 -2
- package/src/contracts/deepbook/pool.ts +12 -24
- package/src/contracts/deepbook/registry.ts +1 -2
- package/src/contracts/deepbook_margin/margin_manager.ts +149 -28
- package/src/contracts/deepbook_margin/margin_manager_upgraded.ts +646 -0
- package/src/contracts/deepbook_margin/margin_pool.ts +2 -4
- package/src/contracts/deepbook_margin/margin_registry.ts +3 -6
- package/src/contracts/deepbook_margin/oracle.ts +59 -0
- package/src/contracts/deepbook_margin/pool_proxy.ts +597 -584
- package/src/contracts/deepbook_margin/pool_proxy_upgraded.ts +614 -0
- package/src/contracts/deepbook_margin/protocol_config.ts +1 -2
- package/src/contracts/deepbook_margin/tpsl.ts +1 -2
- package/src/contracts/margin_liquidation/liquidation_vault.ts +144 -4
- package/src/contracts/pyth/pyth.ts +2 -4
- package/src/index.ts +4 -0
- package/src/pyth/PriceServiceConnection.ts +69 -8
- package/src/queries/priceFeedQueries.ts +74 -24
- package/src/transactions/marginAdmin.ts +2 -4
- package/src/transactions/marginLiquidations.ts +20 -6
- package/src/transactions/marginManager.ts +43 -33
- package/src/transactions/marginTPSL.ts +19 -9
- package/src/transactions/poolProxy.ts +34 -30
- package/src/types/index.ts +17 -2
- package/src/utils/config.ts +69 -9
- package/src/utils/constants.ts +83 -26
|
@@ -0,0 +1,646 @@
|
|
|
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 | null
|
|
220
|
+
)[];
|
|
221
|
+
const parameterNames = ['self', 'registry', 'baseOracle', 'quoteOracle', 'coin'];
|
|
222
|
+
return (tx: Transaction) =>
|
|
223
|
+
tx.moveCall({
|
|
224
|
+
package: packageAddress,
|
|
225
|
+
module: 'margin_manager_upgraded',
|
|
226
|
+
function: 'deposit',
|
|
227
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
228
|
+
typeArguments: options.typeArguments,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
export interface WithdrawArguments {
|
|
232
|
+
self: RawTransactionArgument<string>;
|
|
233
|
+
registry: RawTransactionArgument<string>;
|
|
234
|
+
baseMarginPool: RawTransactionArgument<string>;
|
|
235
|
+
quoteMarginPool: RawTransactionArgument<string>;
|
|
236
|
+
baseOracle: RawTransactionArgument<string>;
|
|
237
|
+
quoteOracle: RawTransactionArgument<string>;
|
|
238
|
+
pool: RawTransactionArgument<string>;
|
|
239
|
+
withdrawAmount: RawTransactionArgument<number | bigint>;
|
|
240
|
+
}
|
|
241
|
+
export interface WithdrawOptions {
|
|
242
|
+
package?: string;
|
|
243
|
+
arguments:
|
|
244
|
+
| WithdrawArguments
|
|
245
|
+
| [
|
|
246
|
+
self: RawTransactionArgument<string>,
|
|
247
|
+
registry: RawTransactionArgument<string>,
|
|
248
|
+
baseMarginPool: RawTransactionArgument<string>,
|
|
249
|
+
quoteMarginPool: RawTransactionArgument<string>,
|
|
250
|
+
baseOracle: RawTransactionArgument<string>,
|
|
251
|
+
quoteOracle: RawTransactionArgument<string>,
|
|
252
|
+
pool: RawTransactionArgument<string>,
|
|
253
|
+
withdrawAmount: RawTransactionArgument<number | bigint>,
|
|
254
|
+
];
|
|
255
|
+
typeArguments: [string, string, string];
|
|
256
|
+
}
|
|
257
|
+
/** Twin: `margin_manager::withdraw`. Edit both. */
|
|
258
|
+
export function withdraw(options: WithdrawOptions) {
|
|
259
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
260
|
+
const argumentsTypes = [
|
|
261
|
+
null,
|
|
262
|
+
null,
|
|
263
|
+
null,
|
|
264
|
+
null,
|
|
265
|
+
null,
|
|
266
|
+
null,
|
|
267
|
+
null,
|
|
268
|
+
'u64',
|
|
269
|
+
'0x2::clock::Clock',
|
|
270
|
+
] satisfies (string | null)[];
|
|
271
|
+
const parameterNames = [
|
|
272
|
+
'self',
|
|
273
|
+
'registry',
|
|
274
|
+
'baseMarginPool',
|
|
275
|
+
'quoteMarginPool',
|
|
276
|
+
'baseOracle',
|
|
277
|
+
'quoteOracle',
|
|
278
|
+
'pool',
|
|
279
|
+
'withdrawAmount',
|
|
280
|
+
];
|
|
281
|
+
return (tx: Transaction) =>
|
|
282
|
+
tx.moveCall({
|
|
283
|
+
package: packageAddress,
|
|
284
|
+
module: 'margin_manager_upgraded',
|
|
285
|
+
function: 'withdraw',
|
|
286
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
287
|
+
typeArguments: options.typeArguments,
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
export interface BorrowBaseArguments {
|
|
291
|
+
self: RawTransactionArgument<string>;
|
|
292
|
+
registry: RawTransactionArgument<string>;
|
|
293
|
+
baseMarginPool: RawTransactionArgument<string>;
|
|
294
|
+
baseOracle: RawTransactionArgument<string>;
|
|
295
|
+
quoteOracle: RawTransactionArgument<string>;
|
|
296
|
+
pool: RawTransactionArgument<string>;
|
|
297
|
+
loanAmount: RawTransactionArgument<number | bigint>;
|
|
298
|
+
}
|
|
299
|
+
export interface BorrowBaseOptions {
|
|
300
|
+
package?: string;
|
|
301
|
+
arguments:
|
|
302
|
+
| BorrowBaseArguments
|
|
303
|
+
| [
|
|
304
|
+
self: RawTransactionArgument<string>,
|
|
305
|
+
registry: RawTransactionArgument<string>,
|
|
306
|
+
baseMarginPool: RawTransactionArgument<string>,
|
|
307
|
+
baseOracle: RawTransactionArgument<string>,
|
|
308
|
+
quoteOracle: RawTransactionArgument<string>,
|
|
309
|
+
pool: RawTransactionArgument<string>,
|
|
310
|
+
loanAmount: RawTransactionArgument<number | bigint>,
|
|
311
|
+
];
|
|
312
|
+
typeArguments: [string, string];
|
|
313
|
+
}
|
|
314
|
+
/** Twin: `margin_manager::borrow_base`. Edit both. */
|
|
315
|
+
export function borrowBase(options: BorrowBaseOptions) {
|
|
316
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
317
|
+
const argumentsTypes = [
|
|
318
|
+
null,
|
|
319
|
+
null,
|
|
320
|
+
null,
|
|
321
|
+
null,
|
|
322
|
+
null,
|
|
323
|
+
null,
|
|
324
|
+
'u64',
|
|
325
|
+
'0x2::clock::Clock',
|
|
326
|
+
] satisfies (string | null)[];
|
|
327
|
+
const parameterNames = [
|
|
328
|
+
'self',
|
|
329
|
+
'registry',
|
|
330
|
+
'baseMarginPool',
|
|
331
|
+
'baseOracle',
|
|
332
|
+
'quoteOracle',
|
|
333
|
+
'pool',
|
|
334
|
+
'loanAmount',
|
|
335
|
+
];
|
|
336
|
+
return (tx: Transaction) =>
|
|
337
|
+
tx.moveCall({
|
|
338
|
+
package: packageAddress,
|
|
339
|
+
module: 'margin_manager_upgraded',
|
|
340
|
+
function: 'borrow_base',
|
|
341
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
342
|
+
typeArguments: options.typeArguments,
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
export interface BorrowQuoteArguments {
|
|
346
|
+
self: RawTransactionArgument<string>;
|
|
347
|
+
registry: RawTransactionArgument<string>;
|
|
348
|
+
quoteMarginPool: RawTransactionArgument<string>;
|
|
349
|
+
baseOracle: RawTransactionArgument<string>;
|
|
350
|
+
quoteOracle: RawTransactionArgument<string>;
|
|
351
|
+
pool: RawTransactionArgument<string>;
|
|
352
|
+
loanAmount: RawTransactionArgument<number | bigint>;
|
|
353
|
+
}
|
|
354
|
+
export interface BorrowQuoteOptions {
|
|
355
|
+
package?: string;
|
|
356
|
+
arguments:
|
|
357
|
+
| BorrowQuoteArguments
|
|
358
|
+
| [
|
|
359
|
+
self: RawTransactionArgument<string>,
|
|
360
|
+
registry: RawTransactionArgument<string>,
|
|
361
|
+
quoteMarginPool: RawTransactionArgument<string>,
|
|
362
|
+
baseOracle: RawTransactionArgument<string>,
|
|
363
|
+
quoteOracle: RawTransactionArgument<string>,
|
|
364
|
+
pool: RawTransactionArgument<string>,
|
|
365
|
+
loanAmount: RawTransactionArgument<number | bigint>,
|
|
366
|
+
];
|
|
367
|
+
typeArguments: [string, string];
|
|
368
|
+
}
|
|
369
|
+
/** Twin: `margin_manager::borrow_quote`. Edit both. */
|
|
370
|
+
export function borrowQuote(options: BorrowQuoteOptions) {
|
|
371
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
372
|
+
const argumentsTypes = [
|
|
373
|
+
null,
|
|
374
|
+
null,
|
|
375
|
+
null,
|
|
376
|
+
null,
|
|
377
|
+
null,
|
|
378
|
+
null,
|
|
379
|
+
'u64',
|
|
380
|
+
'0x2::clock::Clock',
|
|
381
|
+
] satisfies (string | null)[];
|
|
382
|
+
const parameterNames = [
|
|
383
|
+
'self',
|
|
384
|
+
'registry',
|
|
385
|
+
'quoteMarginPool',
|
|
386
|
+
'baseOracle',
|
|
387
|
+
'quoteOracle',
|
|
388
|
+
'pool',
|
|
389
|
+
'loanAmount',
|
|
390
|
+
];
|
|
391
|
+
return (tx: Transaction) =>
|
|
392
|
+
tx.moveCall({
|
|
393
|
+
package: packageAddress,
|
|
394
|
+
module: 'margin_manager_upgraded',
|
|
395
|
+
function: 'borrow_quote',
|
|
396
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
397
|
+
typeArguments: options.typeArguments,
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
export interface LiquidateArguments {
|
|
401
|
+
self: RawTransactionArgument<string>;
|
|
402
|
+
registry: RawTransactionArgument<string>;
|
|
403
|
+
baseOracle: RawTransactionArgument<string>;
|
|
404
|
+
quoteOracle: RawTransactionArgument<string>;
|
|
405
|
+
marginPool: RawTransactionArgument<string>;
|
|
406
|
+
pool: RawTransactionArgument<string>;
|
|
407
|
+
repayCoin: RawTransactionArgument<string>;
|
|
408
|
+
}
|
|
409
|
+
export interface LiquidateOptions {
|
|
410
|
+
package?: string;
|
|
411
|
+
arguments:
|
|
412
|
+
| LiquidateArguments
|
|
413
|
+
| [
|
|
414
|
+
self: RawTransactionArgument<string>,
|
|
415
|
+
registry: RawTransactionArgument<string>,
|
|
416
|
+
baseOracle: RawTransactionArgument<string>,
|
|
417
|
+
quoteOracle: RawTransactionArgument<string>,
|
|
418
|
+
marginPool: RawTransactionArgument<string>,
|
|
419
|
+
pool: RawTransactionArgument<string>,
|
|
420
|
+
repayCoin: RawTransactionArgument<string>,
|
|
421
|
+
];
|
|
422
|
+
typeArguments: [string, string, string];
|
|
423
|
+
}
|
|
424
|
+
/** Twin: `margin_manager::liquidate`. Edit both. */
|
|
425
|
+
export function liquidate(options: LiquidateOptions) {
|
|
426
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
427
|
+
const argumentsTypes = [null, null, null, null, null, null, null, '0x2::clock::Clock'] satisfies (
|
|
428
|
+
string | null
|
|
429
|
+
)[];
|
|
430
|
+
const parameterNames = [
|
|
431
|
+
'self',
|
|
432
|
+
'registry',
|
|
433
|
+
'baseOracle',
|
|
434
|
+
'quoteOracle',
|
|
435
|
+
'marginPool',
|
|
436
|
+
'pool',
|
|
437
|
+
'repayCoin',
|
|
438
|
+
];
|
|
439
|
+
return (tx: Transaction) =>
|
|
440
|
+
tx.moveCall({
|
|
441
|
+
package: packageAddress,
|
|
442
|
+
module: 'margin_manager_upgraded',
|
|
443
|
+
function: 'liquidate',
|
|
444
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
445
|
+
typeArguments: options.typeArguments,
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
export interface RiskRatioArguments {
|
|
449
|
+
self: RawTransactionArgument<string>;
|
|
450
|
+
registry: RawTransactionArgument<string>;
|
|
451
|
+
baseOracle: RawTransactionArgument<string>;
|
|
452
|
+
quoteOracle: RawTransactionArgument<string>;
|
|
453
|
+
pool: RawTransactionArgument<string>;
|
|
454
|
+
baseMarginPool: RawTransactionArgument<string>;
|
|
455
|
+
quoteMarginPool: RawTransactionArgument<string>;
|
|
456
|
+
}
|
|
457
|
+
export interface RiskRatioOptions {
|
|
458
|
+
package?: string;
|
|
459
|
+
arguments:
|
|
460
|
+
| RiskRatioArguments
|
|
461
|
+
| [
|
|
462
|
+
self: RawTransactionArgument<string>,
|
|
463
|
+
registry: RawTransactionArgument<string>,
|
|
464
|
+
baseOracle: RawTransactionArgument<string>,
|
|
465
|
+
quoteOracle: RawTransactionArgument<string>,
|
|
466
|
+
pool: RawTransactionArgument<string>,
|
|
467
|
+
baseMarginPool: RawTransactionArgument<string>,
|
|
468
|
+
quoteMarginPool: RawTransactionArgument<string>,
|
|
469
|
+
];
|
|
470
|
+
typeArguments: [string, string];
|
|
471
|
+
}
|
|
472
|
+
/** Twin: `margin_manager::risk_ratio`. Edit both. */
|
|
473
|
+
export function riskRatio(options: RiskRatioOptions) {
|
|
474
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
475
|
+
const argumentsTypes = [null, null, null, null, null, null, null, '0x2::clock::Clock'] satisfies (
|
|
476
|
+
string | null
|
|
477
|
+
)[];
|
|
478
|
+
const parameterNames = [
|
|
479
|
+
'self',
|
|
480
|
+
'registry',
|
|
481
|
+
'baseOracle',
|
|
482
|
+
'quoteOracle',
|
|
483
|
+
'pool',
|
|
484
|
+
'baseMarginPool',
|
|
485
|
+
'quoteMarginPool',
|
|
486
|
+
];
|
|
487
|
+
return (tx: Transaction) =>
|
|
488
|
+
tx.moveCall({
|
|
489
|
+
package: packageAddress,
|
|
490
|
+
module: 'margin_manager_upgraded',
|
|
491
|
+
function: 'risk_ratio',
|
|
492
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
493
|
+
typeArguments: options.typeArguments,
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
export interface RiskRatioUnsafeArguments {
|
|
497
|
+
self: RawTransactionArgument<string>;
|
|
498
|
+
registry: RawTransactionArgument<string>;
|
|
499
|
+
baseOracle: RawTransactionArgument<string>;
|
|
500
|
+
quoteOracle: RawTransactionArgument<string>;
|
|
501
|
+
pool: RawTransactionArgument<string>;
|
|
502
|
+
baseMarginPool: RawTransactionArgument<string>;
|
|
503
|
+
quoteMarginPool: RawTransactionArgument<string>;
|
|
504
|
+
}
|
|
505
|
+
export interface RiskRatioUnsafeOptions {
|
|
506
|
+
package?: string;
|
|
507
|
+
arguments:
|
|
508
|
+
| RiskRatioUnsafeArguments
|
|
509
|
+
| [
|
|
510
|
+
self: RawTransactionArgument<string>,
|
|
511
|
+
registry: RawTransactionArgument<string>,
|
|
512
|
+
baseOracle: RawTransactionArgument<string>,
|
|
513
|
+
quoteOracle: RawTransactionArgument<string>,
|
|
514
|
+
pool: RawTransactionArgument<string>,
|
|
515
|
+
baseMarginPool: RawTransactionArgument<string>,
|
|
516
|
+
quoteMarginPool: RawTransactionArgument<string>,
|
|
517
|
+
];
|
|
518
|
+
typeArguments: [string, string];
|
|
519
|
+
}
|
|
520
|
+
/** Twin: `margin_manager::risk_ratio_unsafe`. Edit both. */
|
|
521
|
+
export function riskRatioUnsafe(options: RiskRatioUnsafeOptions) {
|
|
522
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
523
|
+
const argumentsTypes = [null, null, null, null, null, null, null, '0x2::clock::Clock'] satisfies (
|
|
524
|
+
string | null
|
|
525
|
+
)[];
|
|
526
|
+
const parameterNames = [
|
|
527
|
+
'self',
|
|
528
|
+
'registry',
|
|
529
|
+
'baseOracle',
|
|
530
|
+
'quoteOracle',
|
|
531
|
+
'pool',
|
|
532
|
+
'baseMarginPool',
|
|
533
|
+
'quoteMarginPool',
|
|
534
|
+
];
|
|
535
|
+
return (tx: Transaction) =>
|
|
536
|
+
tx.moveCall({
|
|
537
|
+
package: packageAddress,
|
|
538
|
+
module: 'margin_manager_upgraded',
|
|
539
|
+
function: 'risk_ratio_unsafe',
|
|
540
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
541
|
+
typeArguments: options.typeArguments,
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
export interface ManagerStateArguments {
|
|
545
|
+
self: RawTransactionArgument<string>;
|
|
546
|
+
registry: RawTransactionArgument<string>;
|
|
547
|
+
baseOracle: RawTransactionArgument<string>;
|
|
548
|
+
quoteOracle: RawTransactionArgument<string>;
|
|
549
|
+
pool: RawTransactionArgument<string>;
|
|
550
|
+
baseMarginPool: RawTransactionArgument<string>;
|
|
551
|
+
quoteMarginPool: RawTransactionArgument<string>;
|
|
552
|
+
}
|
|
553
|
+
export interface ManagerStateOptions {
|
|
554
|
+
package?: string;
|
|
555
|
+
arguments:
|
|
556
|
+
| ManagerStateArguments
|
|
557
|
+
| [
|
|
558
|
+
self: RawTransactionArgument<string>,
|
|
559
|
+
registry: RawTransactionArgument<string>,
|
|
560
|
+
baseOracle: RawTransactionArgument<string>,
|
|
561
|
+
quoteOracle: RawTransactionArgument<string>,
|
|
562
|
+
pool: RawTransactionArgument<string>,
|
|
563
|
+
baseMarginPool: RawTransactionArgument<string>,
|
|
564
|
+
quoteMarginPool: RawTransactionArgument<string>,
|
|
565
|
+
];
|
|
566
|
+
typeArguments: [string, string];
|
|
567
|
+
}
|
|
568
|
+
/** Twin: `margin_manager::manager_state`. Edit both. */
|
|
569
|
+
export function managerState(options: ManagerStateOptions) {
|
|
570
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
571
|
+
const argumentsTypes = [null, null, null, null, null, null, null, '0x2::clock::Clock'] satisfies (
|
|
572
|
+
string | null
|
|
573
|
+
)[];
|
|
574
|
+
const parameterNames = [
|
|
575
|
+
'self',
|
|
576
|
+
'registry',
|
|
577
|
+
'baseOracle',
|
|
578
|
+
'quoteOracle',
|
|
579
|
+
'pool',
|
|
580
|
+
'baseMarginPool',
|
|
581
|
+
'quoteMarginPool',
|
|
582
|
+
];
|
|
583
|
+
return (tx: Transaction) =>
|
|
584
|
+
tx.moveCall({
|
|
585
|
+
package: packageAddress,
|
|
586
|
+
module: 'margin_manager_upgraded',
|
|
587
|
+
function: 'manager_state',
|
|
588
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
589
|
+
typeArguments: options.typeArguments,
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
export interface ManagerStatesArguments {
|
|
593
|
+
marginManagers: TransactionArgument;
|
|
594
|
+
registry: RawTransactionArgument<string>;
|
|
595
|
+
baseOracle: RawTransactionArgument<string>;
|
|
596
|
+
quoteOracle: RawTransactionArgument<string>;
|
|
597
|
+
pool: RawTransactionArgument<string>;
|
|
598
|
+
baseMarginPool: RawTransactionArgument<string>;
|
|
599
|
+
quoteMarginPool: RawTransactionArgument<string>;
|
|
600
|
+
}
|
|
601
|
+
export interface ManagerStatesOptions {
|
|
602
|
+
package?: string;
|
|
603
|
+
arguments:
|
|
604
|
+
| ManagerStatesArguments
|
|
605
|
+
| [
|
|
606
|
+
marginManagers: TransactionArgument,
|
|
607
|
+
registry: RawTransactionArgument<string>,
|
|
608
|
+
baseOracle: RawTransactionArgument<string>,
|
|
609
|
+
quoteOracle: RawTransactionArgument<string>,
|
|
610
|
+
pool: RawTransactionArgument<string>,
|
|
611
|
+
baseMarginPool: RawTransactionArgument<string>,
|
|
612
|
+
quoteMarginPool: RawTransactionArgument<string>,
|
|
613
|
+
];
|
|
614
|
+
typeArguments: [string, string];
|
|
615
|
+
}
|
|
616
|
+
/** Twin: `margin_manager::manager_states`. Edit both. */
|
|
617
|
+
export function managerStates(options: ManagerStatesOptions) {
|
|
618
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
619
|
+
const argumentsTypes = [
|
|
620
|
+
'vector<null>',
|
|
621
|
+
null,
|
|
622
|
+
null,
|
|
623
|
+
null,
|
|
624
|
+
null,
|
|
625
|
+
null,
|
|
626
|
+
null,
|
|
627
|
+
'0x2::clock::Clock',
|
|
628
|
+
] satisfies (string | null)[];
|
|
629
|
+
const parameterNames = [
|
|
630
|
+
'marginManagers',
|
|
631
|
+
'registry',
|
|
632
|
+
'baseOracle',
|
|
633
|
+
'quoteOracle',
|
|
634
|
+
'pool',
|
|
635
|
+
'baseMarginPool',
|
|
636
|
+
'quoteMarginPool',
|
|
637
|
+
];
|
|
638
|
+
return (tx: Transaction) =>
|
|
639
|
+
tx.moveCall({
|
|
640
|
+
package: packageAddress,
|
|
641
|
+
module: 'margin_manager_upgraded',
|
|
642
|
+
function: 'manager_states',
|
|
643
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
644
|
+
typeArguments: options.typeArguments,
|
|
645
|
+
});
|
|
646
|
+
}
|
|
@@ -183,8 +183,7 @@ export interface EnableDeepbookPoolForLoanOptions {
|
|
|
183
183
|
export function enableDeepbookPoolForLoan(options: EnableDeepbookPoolForLoanOptions) {
|
|
184
184
|
const packageAddress = options.package ?? '@deepbook/margin';
|
|
185
185
|
const argumentsTypes = [null, null, '0x2::object::ID', null, '0x2::clock::Clock'] satisfies (
|
|
186
|
-
|
|
|
187
|
-
| null
|
|
186
|
+
string | null
|
|
188
187
|
)[];
|
|
189
188
|
const parameterNames = ['self', 'registry', 'deepbookPoolId', 'marginPoolCap'];
|
|
190
189
|
return (tx: Transaction) =>
|
|
@@ -221,8 +220,7 @@ export interface DisableDeepbookPoolForLoanOptions {
|
|
|
221
220
|
export function disableDeepbookPoolForLoan(options: DisableDeepbookPoolForLoanOptions) {
|
|
222
221
|
const packageAddress = options.package ?? '@deepbook/margin';
|
|
223
222
|
const argumentsTypes = [null, null, '0x2::object::ID', null, '0x2::clock::Clock'] satisfies (
|
|
224
|
-
|
|
|
225
|
-
| null
|
|
223
|
+
string | null
|
|
226
224
|
)[];
|
|
227
225
|
const parameterNames = ['self', 'registry', 'deepbookPoolId', 'marginPoolCap'];
|
|
228
226
|
return (tx: Transaction) =>
|
|
@@ -245,8 +245,7 @@ export interface RevokeMaintainerCapOptions {
|
|
|
245
245
|
export function revokeMaintainerCap(options: RevokeMaintainerCapOptions) {
|
|
246
246
|
const packageAddress = options.package ?? '@deepbook/margin';
|
|
247
247
|
const argumentsTypes = [null, null, '0x2::object::ID', '0x2::clock::Clock'] satisfies (
|
|
248
|
-
|
|
|
249
|
-
| null
|
|
248
|
+
string | null
|
|
250
249
|
)[];
|
|
251
250
|
const parameterNames = ['self', 'AdminCap', 'maintainerCapId'];
|
|
252
251
|
return (tx: Transaction) =>
|
|
@@ -580,8 +579,7 @@ export interface RevokePauseCapOptions {
|
|
|
580
579
|
export function revokePauseCap(options: RevokePauseCapOptions) {
|
|
581
580
|
const packageAddress = options.package ?? '@deepbook/margin';
|
|
582
581
|
const argumentsTypes = [null, null, '0x2::clock::Clock', '0x2::object::ID'] satisfies (
|
|
583
|
-
|
|
|
584
|
-
| null
|
|
582
|
+
string | null
|
|
585
583
|
)[];
|
|
586
584
|
const parameterNames = ['self', 'AdminCap', 'pauseCapId'];
|
|
587
585
|
return (tx: Transaction) =>
|
|
@@ -771,8 +769,7 @@ export interface NewPoolConfigOptions {
|
|
|
771
769
|
export function newPoolConfig(options: NewPoolConfigOptions) {
|
|
772
770
|
const packageAddress = options.package ?? '@deepbook/margin';
|
|
773
771
|
const argumentsTypes = [null, 'u64', 'u64', 'u64', 'u64', 'u64', 'u64'] satisfies (
|
|
774
|
-
|
|
|
775
|
-
| null
|
|
772
|
+
string | null
|
|
776
773
|
)[];
|
|
777
774
|
const parameterNames = [
|
|
778
775
|
'self',
|