@mysten/deepbook-v3 1.5.8 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +73 -0
- package/dist/client.d.mts +5 -0
- package/dist/client.d.mts.map +1 -1
- package/dist/client.mjs +7 -0
- 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 +413 -0
- package/dist/contracts/deepbook/balance_manager.mjs.map +1 -0
- package/dist/contracts/deepbook/big_vector.mjs +43 -0
- package/dist/contracts/deepbook/big_vector.mjs.map +1 -0
- package/dist/contracts/deepbook/book.mjs +29 -0
- package/dist/contracts/deepbook/book.mjs.map +1 -0
- 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/deep_price.mjs +1 -1
- package/dist/contracts/deepbook/deps/std/type_name.mjs +17 -0
- package/dist/contracts/deepbook/deps/std/type_name.mjs.map +1 -0
- package/dist/contracts/deepbook/deps/sui/bag.mjs +43 -0
- package/dist/contracts/deepbook/deps/sui/bag.mjs.map +1 -0
- package/dist/contracts/deepbook/deps/sui/balance.mjs +21 -0
- package/dist/contracts/deepbook/deps/sui/balance.mjs.map +1 -0
- package/dist/contracts/deepbook/deps/sui/table.mjs +38 -0
- package/dist/contracts/deepbook/deps/sui/table.mjs.map +1 -0
- package/dist/contracts/deepbook/deps/sui/vec_map.mjs +37 -0
- package/dist/contracts/deepbook/deps/sui/vec_map.mjs.map +1 -0
- package/dist/contracts/deepbook/deps/sui/versioned.mjs +19 -0
- package/dist/contracts/deepbook/deps/sui/versioned.mjs.map +1 -0
- package/dist/contracts/deepbook/governance.mjs +49 -0
- package/dist/contracts/deepbook/governance.mjs.map +1 -0
- package/dist/contracts/deepbook/history.mjs +56 -0
- package/dist/contracts/deepbook/history.mjs.map +1 -0
- package/dist/contracts/deepbook/order.d.mts +12 -12
- package/dist/contracts/deepbook/pool.mjs +1739 -0
- package/dist/contracts/deepbook/pool.mjs.map +1 -0
- package/dist/contracts/deepbook/registry.mjs +295 -0
- package/dist/contracts/deepbook/registry.mjs.map +1 -0
- package/dist/contracts/deepbook/state.mjs +89 -0
- package/dist/contracts/deepbook/state.mjs.map +1 -0
- package/dist/contracts/deepbook/trade_params.mjs +21 -0
- package/dist/contracts/deepbook/trade_params.mjs.map +1 -0
- package/dist/contracts/deepbook/vault.mjs +42 -0
- package/dist/contracts/deepbook/vault.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/deepbook/balance_manager.mjs +53 -0
- package/dist/contracts/deepbook_margin/deps/deepbook/balance_manager.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/std/type_name.mjs +17 -0
- package/dist/contracts/deepbook_margin/deps/std/type_name.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/bag.mjs +43 -0
- package/dist/contracts/deepbook_margin/deps/sui/bag.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/balance.mjs +21 -0
- package/dist/contracts/deepbook_margin/deps/sui/balance.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/table.mjs +38 -0
- package/dist/contracts/deepbook_margin/deps/sui/table.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/vec_map.mjs +37 -0
- package/dist/contracts/deepbook_margin/deps/sui/vec_map.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/vec_set.mjs +26 -0
- package/dist/contracts/deepbook_margin/deps/sui/vec_set.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/versioned.mjs +19 -0
- package/dist/contracts/deepbook_margin/deps/sui/versioned.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/margin_manager.mjs +989 -0
- package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/margin_pool.mjs +550 -0
- package/dist/contracts/deepbook_margin/margin_pool.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/margin_registry.mjs +786 -0
- package/dist/contracts/deepbook_margin/margin_registry.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/margin_state.mjs +30 -0
- package/dist/contracts/deepbook_margin/margin_state.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/oracle.mjs +82 -0
- package/dist/contracts/deepbook_margin/oracle.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/pool_proxy.mjs +644 -0
- package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/position_manager.mjs +32 -0
- package/dist/contracts/deepbook_margin/position_manager.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/protocol_config.mjs +122 -0
- package/dist/contracts/deepbook_margin/protocol_config.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/protocol_fees.mjs +58 -0
- package/dist/contracts/deepbook_margin/protocol_fees.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/rate_limiter.mjs +26 -0
- package/dist/contracts/deepbook_margin/rate_limiter.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/tpsl.mjs +171 -0
- package/dist/contracts/deepbook_margin/tpsl.mjs.map +1 -0
- package/dist/contracts/margin_liquidation/deps/sui/bag.mjs +43 -0
- package/dist/contracts/margin_liquidation/deps/sui/bag.mjs.map +1 -0
- package/dist/contracts/margin_liquidation/liquidation_vault.mjs +179 -0
- package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -0
- package/dist/contracts/utils/index.d.mts +1 -1
- package/dist/contracts/utils/index.mjs +92 -3
- package/dist/contracts/utils/index.mjs.map +1 -1
- package/dist/queries/registryQueries.mjs +13 -0
- package/dist/queries/registryQueries.mjs.map +1 -1
- package/dist/transactions/balanceManager.d.mts.map +1 -1
- package/dist/transactions/balanceManager.mjs +119 -100
- package/dist/transactions/balanceManager.mjs.map +1 -1
- package/dist/transactions/deepbook.d.mts.map +1 -1
- package/dist/transactions/deepbook.mjs +464 -439
- package/dist/transactions/deepbook.mjs.map +1 -1
- package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
- package/dist/transactions/deepbookAdmin.mjs +151 -135
- package/dist/transactions/deepbookAdmin.mjs.map +1 -1
- package/dist/transactions/flashLoans.d.mts.map +1 -1
- package/dist/transactions/flashLoans.mjs +29 -22
- package/dist/transactions/flashLoans.mjs.map +1 -1
- package/dist/transactions/governance.d.mts.map +1 -1
- package/dist/transactions/governance.mjs +34 -33
- package/dist/transactions/governance.mjs.map +1 -1
- package/dist/transactions/marginAdmin.d.mts +17 -7
- package/dist/transactions/marginAdmin.d.mts.map +1 -1
- package/dist/transactions/marginAdmin.mjs +186 -169
- package/dist/transactions/marginAdmin.mjs.map +1 -1
- package/dist/transactions/marginLiquidations.d.mts +3 -3
- package/dist/transactions/marginLiquidations.d.mts.map +1 -1
- package/dist/transactions/marginLiquidations.mjs +53 -54
- package/dist/transactions/marginLiquidations.mjs.map +1 -1
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginMaintainer.d.mts.map +1 -1
- package/dist/transactions/marginMaintainer.mjs +83 -83
- package/dist/transactions/marginMaintainer.mjs.map +1 -1
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginManager.d.mts.map +1 -1
- package/dist/transactions/marginManager.mjs +330 -317
- package/dist/transactions/marginManager.mjs.map +1 -1
- package/dist/transactions/marginPool.d.mts +18 -18
- package/dist/transactions/marginPool.d.mts.map +1 -1
- package/dist/transactions/marginPool.mjs +93 -89
- package/dist/transactions/marginPool.mjs.map +1 -1
- package/dist/transactions/marginRegistry.d.mts +22 -15
- package/dist/transactions/marginRegistry.d.mts.map +1 -1
- package/dist/transactions/marginRegistry.mjs +101 -68
- package/dist/transactions/marginRegistry.mjs.map +1 -1
- package/dist/transactions/marginTPSL.d.mts +27 -9
- package/dist/transactions/marginTPSL.d.mts.map +1 -1
- package/dist/transactions/marginTPSL.mjs +108 -82
- package/dist/transactions/marginTPSL.mjs.map +1 -1
- package/dist/transactions/poolProxy.d.mts +37 -5
- package/dist/transactions/poolProxy.d.mts.map +1 -1
- package/dist/transactions/poolProxy.mjs +269 -189
- package/dist/transactions/poolProxy.mjs.map +1 -1
- package/dist/utils/constants.mjs +4 -4
- package/dist/utils/constants.mjs.map +1 -1
- package/package.json +3 -3
- package/src/client.ts +8 -0
- package/src/contracts/deepbook/balance_manager.ts +46 -5
- package/src/contracts/deepbook/constants.ts +13 -0
- package/src/contracts/deepbook/pool.ts +133 -0
- package/src/contracts/deepbook/registry.ts +136 -1
- package/src/contracts/deepbook_margin/deps/deepbook/balance_manager.ts +49 -0
- package/src/contracts/deepbook_margin/deps/std/type_name.ts +24 -0
- package/src/contracts/deepbook_margin/deps/sui/bag.ts +41 -0
- package/src/contracts/deepbook_margin/deps/sui/balance.ts +19 -0
- package/src/contracts/deepbook_margin/deps/sui/table.ts +36 -0
- package/src/contracts/deepbook_margin/deps/sui/vec_map.ts +33 -0
- package/src/contracts/deepbook_margin/deps/sui/vec_set.ts +22 -0
- package/src/contracts/deepbook_margin/deps/sui/versioned.ts +13 -0
- package/src/contracts/deepbook_margin/margin_constants.ts +329 -0
- package/src/contracts/deepbook_margin/margin_manager.ts +1772 -0
- package/src/contracts/deepbook_margin/margin_pool.ts +1129 -0
- package/src/contracts/deepbook_margin/margin_registry.ts +1207 -0
- package/src/contracts/deepbook_margin/margin_state.ts +26 -0
- package/src/contracts/deepbook_margin/oracle.ts +99 -0
- package/src/contracts/deepbook_margin/pool_proxy.ts +1298 -0
- package/src/contracts/deepbook_margin/position_manager.ts +28 -0
- package/src/contracts/deepbook_margin/protocol_config.ts +163 -0
- package/src/contracts/deepbook_margin/protocol_fees.ts +153 -0
- package/src/contracts/deepbook_margin/rate_limiter.ts +80 -0
- package/src/contracts/deepbook_margin/tpsl.ts +559 -0
- package/src/contracts/margin_liquidation/deps/sui/bag.ts +41 -0
- package/src/contracts/margin_liquidation/liquidation_vault.ts +401 -0
- package/src/queries/registryQueries.ts +15 -0
- package/src/transactions/balanceManager.ts +140 -90
- package/src/transactions/deepbook.ts +586 -494
- package/src/transactions/deepbookAdmin.ts +154 -146
- package/src/transactions/flashLoans.ts +29 -20
- package/src/transactions/governance.ts +50 -37
- package/src/transactions/marginAdmin.ts +247 -188
- package/src/transactions/marginLiquidations.ts +70 -55
- package/src/transactions/marginMaintainer.ts +106 -88
- package/src/transactions/marginManager.ts +414 -348
- package/src/transactions/marginPool.ts +140 -103
- package/src/transactions/marginRegistry.ts +103 -70
- package/src/transactions/marginTPSL.ts +151 -87
- package/src/transactions/poolProxy.ts +384 -205
- package/src/utils/constants.ts +4 -4
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
/** Registry holds all created pools. */
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
MoveStruct,
|
|
9
|
+
MoveTuple,
|
|
10
|
+
normalizeMoveArguments,
|
|
11
|
+
type RawTransactionArgument,
|
|
12
|
+
} from '../utils/index.js';
|
|
8
13
|
import { bcs } from '@mysten/sui/bcs';
|
|
9
14
|
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
10
15
|
import * as versioned from './deps/sui/versioned.js';
|
|
@@ -24,6 +29,12 @@ export const DeepbookAdminCap = new MoveStruct({
|
|
|
24
29
|
id: bcs.Address,
|
|
25
30
|
},
|
|
26
31
|
});
|
|
32
|
+
export const DeepbookCorePauseCap = new MoveStruct({
|
|
33
|
+
name: `${$moduleName}::DeepbookCorePauseCap`,
|
|
34
|
+
fields: {
|
|
35
|
+
id: bcs.Address,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
27
38
|
export const Registry = new MoveStruct({
|
|
28
39
|
name: `${$moduleName}::Registry`,
|
|
29
40
|
fields: {
|
|
@@ -58,12 +69,22 @@ export const BalanceManagerKey = new MoveStruct({
|
|
|
58
69
|
dummy_field: bcs.bool(),
|
|
59
70
|
},
|
|
60
71
|
});
|
|
72
|
+
export const AllowedPauseCapsKey = new MoveTuple({
|
|
73
|
+
name: `${$moduleName}::AllowedPauseCapsKey`,
|
|
74
|
+
fields: [bcs.bool()],
|
|
75
|
+
});
|
|
61
76
|
export const AppKey = new MoveStruct({
|
|
62
77
|
name: `${$moduleName}::AppKey<phantom App>`,
|
|
63
78
|
fields: {
|
|
64
79
|
dummy_field: bcs.bool(),
|
|
65
80
|
},
|
|
66
81
|
});
|
|
82
|
+
export const AppKeyV2 = new MoveStruct({
|
|
83
|
+
name: `${$moduleName}::AppKeyV2<phantom App>`,
|
|
84
|
+
fields: {
|
|
85
|
+
dummy_field: bcs.bool(),
|
|
86
|
+
},
|
|
87
|
+
});
|
|
67
88
|
export interface AuthorizeAppArguments {
|
|
68
89
|
self: RawTransactionArgument<string>;
|
|
69
90
|
AdminCap: RawTransactionArgument<string>;
|
|
@@ -232,6 +253,97 @@ export function disableVersion(options: DisableVersionOptions) {
|
|
|
232
253
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
233
254
|
});
|
|
234
255
|
}
|
|
256
|
+
export interface MintPauseCapArguments {
|
|
257
|
+
self: RawTransactionArgument<string>;
|
|
258
|
+
Cap: RawTransactionArgument<string>;
|
|
259
|
+
}
|
|
260
|
+
export interface MintPauseCapOptions {
|
|
261
|
+
package?: string;
|
|
262
|
+
arguments:
|
|
263
|
+
| MintPauseCapArguments
|
|
264
|
+
| [self: RawTransactionArgument<string>, Cap: RawTransactionArgument<string>];
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Mint a `DeepbookCorePauseCap`. The new cap's ID is recorded so it can later
|
|
268
|
+
* disable a version via `disable_version_pause_cap`. Only Admin can mint. This
|
|
269
|
+
* function does not have version restrictions.
|
|
270
|
+
*/
|
|
271
|
+
export function mintPauseCap(options: MintPauseCapOptions) {
|
|
272
|
+
const packageAddress = options.package ?? '@deepbook/core';
|
|
273
|
+
const argumentsTypes = [null, null] satisfies (string | null)[];
|
|
274
|
+
const parameterNames = ['self', 'Cap'];
|
|
275
|
+
return (tx: Transaction) =>
|
|
276
|
+
tx.moveCall({
|
|
277
|
+
package: packageAddress,
|
|
278
|
+
module: 'registry',
|
|
279
|
+
function: 'mint_pause_cap',
|
|
280
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
export interface RevokePauseCapArguments {
|
|
284
|
+
self: RawTransactionArgument<string>;
|
|
285
|
+
Cap: RawTransactionArgument<string>;
|
|
286
|
+
pauseCapId: RawTransactionArgument<string>;
|
|
287
|
+
}
|
|
288
|
+
export interface RevokePauseCapOptions {
|
|
289
|
+
package?: string;
|
|
290
|
+
arguments:
|
|
291
|
+
| RevokePauseCapArguments
|
|
292
|
+
| [
|
|
293
|
+
self: RawTransactionArgument<string>,
|
|
294
|
+
Cap: RawTransactionArgument<string>,
|
|
295
|
+
pauseCapId: RawTransactionArgument<string>,
|
|
296
|
+
];
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Revoke a previously minted pause cap by ID. Only Admin can revoke. This function
|
|
300
|
+
* does not have version restrictions.
|
|
301
|
+
*/
|
|
302
|
+
export function revokePauseCap(options: RevokePauseCapOptions) {
|
|
303
|
+
const packageAddress = options.package ?? '@deepbook/core';
|
|
304
|
+
const argumentsTypes = [null, null, '0x2::object::ID'] satisfies (string | null)[];
|
|
305
|
+
const parameterNames = ['self', 'Cap', 'pauseCapId'];
|
|
306
|
+
return (tx: Transaction) =>
|
|
307
|
+
tx.moveCall({
|
|
308
|
+
package: packageAddress,
|
|
309
|
+
module: 'registry',
|
|
310
|
+
function: 'revoke_pause_cap',
|
|
311
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
export interface DisableVersionPauseCapArguments {
|
|
315
|
+
self: RawTransactionArgument<string>;
|
|
316
|
+
version: RawTransactionArgument<number | bigint>;
|
|
317
|
+
pauseCap: RawTransactionArgument<string>;
|
|
318
|
+
}
|
|
319
|
+
export interface DisableVersionPauseCapOptions {
|
|
320
|
+
package?: string;
|
|
321
|
+
arguments:
|
|
322
|
+
| DisableVersionPauseCapArguments
|
|
323
|
+
| [
|
|
324
|
+
self: RawTransactionArgument<string>,
|
|
325
|
+
version: RawTransactionArgument<number | bigint>,
|
|
326
|
+
pauseCap: RawTransactionArgument<string>,
|
|
327
|
+
];
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Disable any allowed package version (including the current one) using a valid
|
|
331
|
+
* `DeepbookCorePauseCap`. The pause cap must be in `allowed_pause_caps`. This
|
|
332
|
+
* function is the emergency kill switch; admin can re-enable via `enable_version`.
|
|
333
|
+
* This function does not have version restrictions.
|
|
334
|
+
*/
|
|
335
|
+
export function disableVersionPauseCap(options: DisableVersionPauseCapOptions) {
|
|
336
|
+
const packageAddress = options.package ?? '@deepbook/core';
|
|
337
|
+
const argumentsTypes = [null, 'u64', null] satisfies (string | null)[];
|
|
338
|
+
const parameterNames = ['self', 'version', 'pauseCap'];
|
|
339
|
+
return (tx: Transaction) =>
|
|
340
|
+
tx.moveCall({
|
|
341
|
+
package: packageAddress,
|
|
342
|
+
module: 'registry',
|
|
343
|
+
function: 'disable_version_pause_cap',
|
|
344
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
345
|
+
});
|
|
346
|
+
}
|
|
235
347
|
export interface AddStablecoinArguments {
|
|
236
348
|
self: RawTransactionArgument<string>;
|
|
237
349
|
Cap: RawTransactionArgument<string>;
|
|
@@ -328,6 +440,29 @@ export function getBalanceManagerIds(options: GetBalanceManagerIdsOptions) {
|
|
|
328
440
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
329
441
|
});
|
|
330
442
|
}
|
|
443
|
+
export interface AllowedPauseCapsArguments {
|
|
444
|
+
self: RawTransactionArgument<string>;
|
|
445
|
+
}
|
|
446
|
+
export interface AllowedPauseCapsOptions {
|
|
447
|
+
package?: string;
|
|
448
|
+
arguments: AllowedPauseCapsArguments | [self: RawTransactionArgument<string>];
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Get the set of pause cap IDs allowed to disable package versions. Returns an
|
|
452
|
+
* empty set if no pause caps have been minted yet.
|
|
453
|
+
*/
|
|
454
|
+
export function allowedPauseCaps(options: AllowedPauseCapsOptions) {
|
|
455
|
+
const packageAddress = options.package ?? '@deepbook/core';
|
|
456
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
457
|
+
const parameterNames = ['self'];
|
|
458
|
+
return (tx: Transaction) =>
|
|
459
|
+
tx.moveCall({
|
|
460
|
+
package: packageAddress,
|
|
461
|
+
module: 'registry',
|
|
462
|
+
function: 'allowed_pause_caps',
|
|
463
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
464
|
+
});
|
|
465
|
+
}
|
|
331
466
|
export interface IsStablecoinArguments {
|
|
332
467
|
self: RawTransactionArgument<string>;
|
|
333
468
|
stableType: TransactionArgument;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The BalanceManager is a shared object that holds all of the balances for
|
|
7
|
+
* different assets. A combination of `BalanceManager` and `TradeProof` are passed
|
|
8
|
+
* into a pool to perform trades. A `TradeProof` can be generated in two ways: by
|
|
9
|
+
* the owner directly, or by any `TradeCap` owner. The owner can generate a
|
|
10
|
+
* `TradeProof` without the risk of equivocation. The `TradeCap` owner, due to it
|
|
11
|
+
* being an owned object, risks equivocation when generating a `TradeProof`.
|
|
12
|
+
* Generally, a high frequency trading engine will trade as the default owner.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
16
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
17
|
+
import * as bag from '../sui/bag.js';
|
|
18
|
+
import * as vec_set from '../sui/vec_set.js';
|
|
19
|
+
const $moduleName = 'deepbook::balance_manager';
|
|
20
|
+
export const BalanceManager = new MoveStruct({
|
|
21
|
+
name: `${$moduleName}::BalanceManager`,
|
|
22
|
+
fields: {
|
|
23
|
+
id: bcs.Address,
|
|
24
|
+
owner: bcs.Address,
|
|
25
|
+
balances: bag.Bag,
|
|
26
|
+
allow_listed: vec_set.VecSet(bcs.Address),
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
export const DepositCap = new MoveStruct({
|
|
30
|
+
name: `${$moduleName}::DepositCap`,
|
|
31
|
+
fields: {
|
|
32
|
+
id: bcs.Address,
|
|
33
|
+
balance_manager_id: bcs.Address,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
export const WithdrawCap = new MoveStruct({
|
|
37
|
+
name: `${$moduleName}::WithdrawCap`,
|
|
38
|
+
fields: {
|
|
39
|
+
id: bcs.Address,
|
|
40
|
+
balance_manager_id: bcs.Address,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
export const TradeCap = new MoveStruct({
|
|
44
|
+
name: `${$moduleName}::TradeCap`,
|
|
45
|
+
fields: {
|
|
46
|
+
id: bcs.Address,
|
|
47
|
+
balance_manager_id: bcs.Address,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/** Functionality for converting Move types into values. Use with care! */
|
|
6
|
+
|
|
7
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
8
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
9
|
+
const $moduleName = 'std::type_name';
|
|
10
|
+
export const TypeName = new MoveStruct({
|
|
11
|
+
name: `${$moduleName}::TypeName`,
|
|
12
|
+
fields: {
|
|
13
|
+
/**
|
|
14
|
+
* String representation of the type. All types are represented using their source
|
|
15
|
+
* syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
|
|
16
|
+
* Struct types are represented as fully qualified type names; e.g.
|
|
17
|
+
* `00000000000000000000000000000001::string::String` or
|
|
18
|
+
* `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
|
|
19
|
+
* Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
|
|
20
|
+
* 32 depending on the Move platform)
|
|
21
|
+
*/
|
|
22
|
+
name: bcs.string(),
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A bag is a heterogeneous map-like collection. The collection is similar to
|
|
7
|
+
* `sui::table` in that its keys and values are not stored within the `Bag` value,
|
|
8
|
+
* but instead are stored using Sui's object system. The `Bag` struct acts only as
|
|
9
|
+
* a handle into the object system to retrieve those keys and values. Note that
|
|
10
|
+
* this means that `Bag` values with exactly the same key-value mapping will not be
|
|
11
|
+
* equal, with `==`, at runtime. For example
|
|
12
|
+
*
|
|
13
|
+
* ```
|
|
14
|
+
* let bag1 = bag::new();
|
|
15
|
+
* let bag2 = bag::new();
|
|
16
|
+
* bag::add(&mut bag1, 0, false);
|
|
17
|
+
* bag::add(&mut bag1, 1, true);
|
|
18
|
+
* bag::add(&mut bag2, 0, false);
|
|
19
|
+
* bag::add(&mut bag2, 1, true);
|
|
20
|
+
* // bag1 does not equal bag2, despite having the same entries
|
|
21
|
+
* assert!(&bag1 != &bag2);
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* At it's core, `sui::bag` is a wrapper around `UID` that allows for access to
|
|
25
|
+
* `sui::dynamic_field` while preventing accidentally stranding field values. A
|
|
26
|
+
* `UID` can be deleted, even if it has dynamic fields associated with it, but a
|
|
27
|
+
* bag, on the other hand, must be empty to be destroyed.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
31
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
32
|
+
const $moduleName = '0x2::bag';
|
|
33
|
+
export const Bag = new MoveStruct({
|
|
34
|
+
name: `${$moduleName}::Bag`,
|
|
35
|
+
fields: {
|
|
36
|
+
/** the ID of this bag */
|
|
37
|
+
id: bcs.Address,
|
|
38
|
+
/** the number of key-value pairs in the bag */
|
|
39
|
+
size: bcs.u64(),
|
|
40
|
+
},
|
|
41
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A storable handler for Balances in general. Is used in the `Coin` module to
|
|
7
|
+
* allow balance operations and can be used to implement custom coins with `Supply`
|
|
8
|
+
* and `Balance`s.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
12
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
13
|
+
const $moduleName = '0x2::balance';
|
|
14
|
+
export const Balance = new MoveStruct({
|
|
15
|
+
name: `${$moduleName}::Balance<phantom T>`,
|
|
16
|
+
fields: {
|
|
17
|
+
value: bcs.u64(),
|
|
18
|
+
},
|
|
19
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A table is a map-like collection. But unlike a traditional collection, it's keys
|
|
7
|
+
* and values are not stored within the `Table` value, but instead are stored using
|
|
8
|
+
* Sui's object system. The `Table` struct acts only as a handle into the object
|
|
9
|
+
* system to retrieve those keys and values. Note that this means that `Table`
|
|
10
|
+
* values with exactly the same key-value mapping will not be equal, with `==`, at
|
|
11
|
+
* runtime. For example
|
|
12
|
+
*
|
|
13
|
+
* ```
|
|
14
|
+
* let table1 = table::new<u64, bool>();
|
|
15
|
+
* let table2 = table::new<u64, bool>();
|
|
16
|
+
* table::add(&mut table1, 0, false);
|
|
17
|
+
* table::add(&mut table1, 1, true);
|
|
18
|
+
* table::add(&mut table2, 0, false);
|
|
19
|
+
* table::add(&mut table2, 1, true);
|
|
20
|
+
* // table1 does not equal table2, despite having the same entries
|
|
21
|
+
* assert!(&table1 != &table2);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
26
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
27
|
+
const $moduleName = '0x2::table';
|
|
28
|
+
export const Table = new MoveStruct({
|
|
29
|
+
name: `${$moduleName}::Table<phantom K, phantom V>`,
|
|
30
|
+
fields: {
|
|
31
|
+
/** the ID of this table */
|
|
32
|
+
id: bcs.Address,
|
|
33
|
+
/** the number of key-value pairs in the table */
|
|
34
|
+
size: bcs.u64(),
|
|
35
|
+
},
|
|
36
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { type BcsType, bcs } from '@mysten/sui/bcs';
|
|
5
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
6
|
+
const $moduleName = '0x2::vec_map';
|
|
7
|
+
/** An entry in the map */
|
|
8
|
+
export function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]) {
|
|
9
|
+
return new MoveStruct({
|
|
10
|
+
name: `${$moduleName}::Entry<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`,
|
|
11
|
+
fields: {
|
|
12
|
+
key: typeParameters[0],
|
|
13
|
+
value: typeParameters[1],
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A map data structure backed by a vector. The map is guaranteed not to contain
|
|
19
|
+
* duplicate keys, but entries are _not_ sorted by key--entries are included in
|
|
20
|
+
* insertion order. All operations are O(N) in the size of the map--the intention
|
|
21
|
+
* of this data structure is only to provide the convenience of programming against
|
|
22
|
+
* a map API. Large maps should use handwritten parent/child relationships instead.
|
|
23
|
+
* Maps that need sorted iteration rather than insertion order iteration should
|
|
24
|
+
* also be handwritten.
|
|
25
|
+
*/
|
|
26
|
+
export function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]) {
|
|
27
|
+
return new MoveStruct({
|
|
28
|
+
name: `${$moduleName}::VecMap<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`,
|
|
29
|
+
fields: {
|
|
30
|
+
contents: bcs.vector(Entry(typeParameters[0], typeParameters[1])),
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { type BcsType, bcs } from '@mysten/sui/bcs';
|
|
5
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
6
|
+
const $moduleName = '0x2::vec_set';
|
|
7
|
+
/**
|
|
8
|
+
* A set data structure backed by a vector. The set is guaranteed not to contain
|
|
9
|
+
* duplicate keys. All operations are O(N) in the size of the set
|
|
10
|
+
*
|
|
11
|
+
* - the intention of this data structure is only to provide the convenience of
|
|
12
|
+
* programming against a set API. Sets that need sorted iteration rather than
|
|
13
|
+
* insertion order iteration should be handwritten.
|
|
14
|
+
*/
|
|
15
|
+
export function VecSet<K extends BcsType<any>>(...typeParameters: [K]) {
|
|
16
|
+
return new MoveStruct({
|
|
17
|
+
name: `${$moduleName}::VecSet<${typeParameters[0].name as K['name']}>`,
|
|
18
|
+
fields: {
|
|
19
|
+
contents: bcs.vector(typeParameters[0]),
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
5
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
6
|
+
const $moduleName = '0x2::versioned';
|
|
7
|
+
export const Versioned = new MoveStruct({
|
|
8
|
+
name: `${$moduleName}::Versioned`,
|
|
9
|
+
fields: {
|
|
10
|
+
id: bcs.Address,
|
|
11
|
+
version: bcs.u64(),
|
|
12
|
+
},
|
|
13
|
+
});
|