@mysten/deepbook-v3 1.5.9 → 1.6.3
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 +62 -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/balance_manager.mjs +413 -0
- package/dist/contracts/deepbook/balance_manager.mjs.map +1 -0
- package/dist/contracts/deepbook/balances.d.mts +4 -4
- package/dist/contracts/deepbook/balances.d.mts.map +1 -1
- 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.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/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 +12 -12
- 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 +20 -20
- 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 +4 -4
- 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 -311
- 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 +2 -2
- 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
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
5
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
6
|
+
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
7
|
+
const $moduleName = '@deepbook/margin::tpsl';
|
|
8
|
+
export const Condition = new MoveStruct({
|
|
9
|
+
name: `${$moduleName}::Condition`,
|
|
10
|
+
fields: {
|
|
11
|
+
trigger_below_price: bcs.bool(),
|
|
12
|
+
trigger_price: bcs.u64(),
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
export const PendingOrder = new MoveStruct({
|
|
16
|
+
name: `${$moduleName}::PendingOrder`,
|
|
17
|
+
fields: {
|
|
18
|
+
is_limit_order: bcs.bool(),
|
|
19
|
+
client_order_id: bcs.u64(),
|
|
20
|
+
order_type: bcs.option(bcs.u8()),
|
|
21
|
+
self_matching_option: bcs.u8(),
|
|
22
|
+
price: bcs.option(bcs.u64()),
|
|
23
|
+
quantity: bcs.u64(),
|
|
24
|
+
is_bid: bcs.bool(),
|
|
25
|
+
pay_with_deep: bcs.bool(),
|
|
26
|
+
expire_timestamp: bcs.option(bcs.u64()),
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
export const ConditionalOrder = new MoveStruct({
|
|
30
|
+
name: `${$moduleName}::ConditionalOrder`,
|
|
31
|
+
fields: {
|
|
32
|
+
conditional_order_id: bcs.u64(),
|
|
33
|
+
condition: Condition,
|
|
34
|
+
pending_order: PendingOrder,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
export const TakeProfitStopLoss = new MoveStruct({
|
|
38
|
+
name: `${$moduleName}::TakeProfitStopLoss`,
|
|
39
|
+
fields: {
|
|
40
|
+
trigger_below: bcs.vector(ConditionalOrder),
|
|
41
|
+
trigger_above: bcs.vector(ConditionalOrder),
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
export const ConditionalOrderAdded = new MoveStruct({
|
|
45
|
+
name: `${$moduleName}::ConditionalOrderAdded`,
|
|
46
|
+
fields: {
|
|
47
|
+
manager_id: bcs.Address,
|
|
48
|
+
conditional_order_id: bcs.u64(),
|
|
49
|
+
conditional_order: ConditionalOrder,
|
|
50
|
+
timestamp: bcs.u64(),
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
export const ConditionalOrderCancelled = new MoveStruct({
|
|
54
|
+
name: `${$moduleName}::ConditionalOrderCancelled`,
|
|
55
|
+
fields: {
|
|
56
|
+
manager_id: bcs.Address,
|
|
57
|
+
conditional_order_id: bcs.u64(),
|
|
58
|
+
conditional_order: ConditionalOrder,
|
|
59
|
+
timestamp: bcs.u64(),
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
export const ConditionalOrderExecuted = new MoveStruct({
|
|
63
|
+
name: `${$moduleName}::ConditionalOrderExecuted`,
|
|
64
|
+
fields: {
|
|
65
|
+
manager_id: bcs.Address,
|
|
66
|
+
pool_id: bcs.Address,
|
|
67
|
+
conditional_order_id: bcs.u64(),
|
|
68
|
+
conditional_order: ConditionalOrder,
|
|
69
|
+
timestamp: bcs.u64(),
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
export const ConditionalOrderInsufficientFunds = new MoveStruct({
|
|
73
|
+
name: `${$moduleName}::ConditionalOrderInsufficientFunds`,
|
|
74
|
+
fields: {
|
|
75
|
+
manager_id: bcs.Address,
|
|
76
|
+
conditional_order_id: bcs.u64(),
|
|
77
|
+
conditional_order: ConditionalOrder,
|
|
78
|
+
timestamp: bcs.u64(),
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
export const ConditionalOrderPriceOutOfBounds = new MoveStruct({
|
|
82
|
+
name: `${$moduleName}::ConditionalOrderPriceOutOfBounds`,
|
|
83
|
+
fields: {
|
|
84
|
+
manager_id: bcs.Address,
|
|
85
|
+
conditional_order_id: bcs.u64(),
|
|
86
|
+
conditional_order: ConditionalOrder,
|
|
87
|
+
timestamp: bcs.u64(),
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
export const ConditionalOrderBelowLiquidation = new MoveStruct({
|
|
91
|
+
name: `${$moduleName}::ConditionalOrderBelowLiquidation`,
|
|
92
|
+
fields: {
|
|
93
|
+
manager_id: bcs.Address,
|
|
94
|
+
conditional_order_id: bcs.u64(),
|
|
95
|
+
conditional_order: ConditionalOrder,
|
|
96
|
+
timestamp: bcs.u64(),
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
export interface NewConditionArguments {
|
|
100
|
+
triggerBelowPrice: RawTransactionArgument<boolean>;
|
|
101
|
+
triggerPrice: RawTransactionArgument<number | bigint>;
|
|
102
|
+
}
|
|
103
|
+
export interface NewConditionOptions {
|
|
104
|
+
package?: string;
|
|
105
|
+
arguments:
|
|
106
|
+
| NewConditionArguments
|
|
107
|
+
| [
|
|
108
|
+
triggerBelowPrice: RawTransactionArgument<boolean>,
|
|
109
|
+
triggerPrice: RawTransactionArgument<number | bigint>,
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
export function newCondition(options: NewConditionOptions) {
|
|
113
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
114
|
+
const argumentsTypes = ['bool', 'u64'] satisfies (string | null)[];
|
|
115
|
+
const parameterNames = ['triggerBelowPrice', 'triggerPrice'];
|
|
116
|
+
return (tx: Transaction) =>
|
|
117
|
+
tx.moveCall({
|
|
118
|
+
package: packageAddress,
|
|
119
|
+
module: 'tpsl',
|
|
120
|
+
function: 'new_condition',
|
|
121
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
export interface NewPendingLimitOrderArguments {
|
|
125
|
+
clientOrderId: RawTransactionArgument<number | bigint>;
|
|
126
|
+
orderType: RawTransactionArgument<number>;
|
|
127
|
+
selfMatchingOption: RawTransactionArgument<number>;
|
|
128
|
+
price: RawTransactionArgument<number | bigint>;
|
|
129
|
+
quantity: RawTransactionArgument<number | bigint>;
|
|
130
|
+
isBid: RawTransactionArgument<boolean>;
|
|
131
|
+
payWithDeep: RawTransactionArgument<boolean>;
|
|
132
|
+
expireTimestamp: RawTransactionArgument<number | bigint>;
|
|
133
|
+
}
|
|
134
|
+
export interface NewPendingLimitOrderOptions {
|
|
135
|
+
package?: string;
|
|
136
|
+
arguments:
|
|
137
|
+
| NewPendingLimitOrderArguments
|
|
138
|
+
| [
|
|
139
|
+
clientOrderId: RawTransactionArgument<number | bigint>,
|
|
140
|
+
orderType: RawTransactionArgument<number>,
|
|
141
|
+
selfMatchingOption: RawTransactionArgument<number>,
|
|
142
|
+
price: RawTransactionArgument<number | bigint>,
|
|
143
|
+
quantity: RawTransactionArgument<number | bigint>,
|
|
144
|
+
isBid: RawTransactionArgument<boolean>,
|
|
145
|
+
payWithDeep: RawTransactionArgument<boolean>,
|
|
146
|
+
expireTimestamp: RawTransactionArgument<number | bigint>,
|
|
147
|
+
];
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Creates a new pending limit order. Order type must be no restriction or
|
|
151
|
+
* immediate or cancel.
|
|
152
|
+
*/
|
|
153
|
+
export function newPendingLimitOrder(options: NewPendingLimitOrderOptions) {
|
|
154
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
155
|
+
const argumentsTypes = ['u64', 'u8', 'u8', 'u64', 'u64', 'bool', 'bool', 'u64'] satisfies (
|
|
156
|
+
| string
|
|
157
|
+
| null
|
|
158
|
+
)[];
|
|
159
|
+
const parameterNames = [
|
|
160
|
+
'clientOrderId',
|
|
161
|
+
'orderType',
|
|
162
|
+
'selfMatchingOption',
|
|
163
|
+
'price',
|
|
164
|
+
'quantity',
|
|
165
|
+
'isBid',
|
|
166
|
+
'payWithDeep',
|
|
167
|
+
'expireTimestamp',
|
|
168
|
+
];
|
|
169
|
+
return (tx: Transaction) =>
|
|
170
|
+
tx.moveCall({
|
|
171
|
+
package: packageAddress,
|
|
172
|
+
module: 'tpsl',
|
|
173
|
+
function: 'new_pending_limit_order',
|
|
174
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
export interface NewPendingMarketOrderArguments {
|
|
178
|
+
clientOrderId: RawTransactionArgument<number | bigint>;
|
|
179
|
+
selfMatchingOption: RawTransactionArgument<number>;
|
|
180
|
+
quantity: RawTransactionArgument<number | bigint>;
|
|
181
|
+
isBid: RawTransactionArgument<boolean>;
|
|
182
|
+
payWithDeep: RawTransactionArgument<boolean>;
|
|
183
|
+
}
|
|
184
|
+
export interface NewPendingMarketOrderOptions {
|
|
185
|
+
package?: string;
|
|
186
|
+
arguments:
|
|
187
|
+
| NewPendingMarketOrderArguments
|
|
188
|
+
| [
|
|
189
|
+
clientOrderId: RawTransactionArgument<number | bigint>,
|
|
190
|
+
selfMatchingOption: RawTransactionArgument<number>,
|
|
191
|
+
quantity: RawTransactionArgument<number | bigint>,
|
|
192
|
+
isBid: RawTransactionArgument<boolean>,
|
|
193
|
+
payWithDeep: RawTransactionArgument<boolean>,
|
|
194
|
+
];
|
|
195
|
+
}
|
|
196
|
+
/** Creates a new pending market order. */
|
|
197
|
+
export function newPendingMarketOrder(options: NewPendingMarketOrderOptions) {
|
|
198
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
199
|
+
const argumentsTypes = ['u64', 'u8', 'u64', 'bool', 'bool'] satisfies (string | null)[];
|
|
200
|
+
const parameterNames = [
|
|
201
|
+
'clientOrderId',
|
|
202
|
+
'selfMatchingOption',
|
|
203
|
+
'quantity',
|
|
204
|
+
'isBid',
|
|
205
|
+
'payWithDeep',
|
|
206
|
+
];
|
|
207
|
+
return (tx: Transaction) =>
|
|
208
|
+
tx.moveCall({
|
|
209
|
+
package: packageAddress,
|
|
210
|
+
module: 'tpsl',
|
|
211
|
+
function: 'new_pending_market_order',
|
|
212
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
export interface TriggerBelowOrdersArguments {
|
|
216
|
+
self: TransactionArgument;
|
|
217
|
+
}
|
|
218
|
+
export interface TriggerBelowOrdersOptions {
|
|
219
|
+
package?: string;
|
|
220
|
+
arguments: TriggerBelowOrdersArguments | [self: TransactionArgument];
|
|
221
|
+
}
|
|
222
|
+
export function triggerBelowOrders(options: TriggerBelowOrdersOptions) {
|
|
223
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
224
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
225
|
+
const parameterNames = ['self'];
|
|
226
|
+
return (tx: Transaction) =>
|
|
227
|
+
tx.moveCall({
|
|
228
|
+
package: packageAddress,
|
|
229
|
+
module: 'tpsl',
|
|
230
|
+
function: 'trigger_below_orders',
|
|
231
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
export interface TriggerAboveOrdersArguments {
|
|
235
|
+
self: TransactionArgument;
|
|
236
|
+
}
|
|
237
|
+
export interface TriggerAboveOrdersOptions {
|
|
238
|
+
package?: string;
|
|
239
|
+
arguments: TriggerAboveOrdersArguments | [self: TransactionArgument];
|
|
240
|
+
}
|
|
241
|
+
export function triggerAboveOrders(options: TriggerAboveOrdersOptions) {
|
|
242
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
243
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
244
|
+
const parameterNames = ['self'];
|
|
245
|
+
return (tx: Transaction) =>
|
|
246
|
+
tx.moveCall({
|
|
247
|
+
package: packageAddress,
|
|
248
|
+
module: 'tpsl',
|
|
249
|
+
function: 'trigger_above_orders',
|
|
250
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
export interface NumConditionalOrdersArguments {
|
|
254
|
+
self: TransactionArgument;
|
|
255
|
+
}
|
|
256
|
+
export interface NumConditionalOrdersOptions {
|
|
257
|
+
package?: string;
|
|
258
|
+
arguments: NumConditionalOrdersArguments | [self: TransactionArgument];
|
|
259
|
+
}
|
|
260
|
+
export function numConditionalOrders(options: NumConditionalOrdersOptions) {
|
|
261
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
262
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
263
|
+
const parameterNames = ['self'];
|
|
264
|
+
return (tx: Transaction) =>
|
|
265
|
+
tx.moveCall({
|
|
266
|
+
package: packageAddress,
|
|
267
|
+
module: 'tpsl',
|
|
268
|
+
function: 'num_conditional_orders',
|
|
269
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
export interface ConditionalOrderIdArguments {
|
|
273
|
+
conditionalOrder: TransactionArgument;
|
|
274
|
+
}
|
|
275
|
+
export interface ConditionalOrderIdOptions {
|
|
276
|
+
package?: string;
|
|
277
|
+
arguments: ConditionalOrderIdArguments | [conditionalOrder: TransactionArgument];
|
|
278
|
+
}
|
|
279
|
+
export function conditionalOrderId(options: ConditionalOrderIdOptions) {
|
|
280
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
281
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
282
|
+
const parameterNames = ['conditionalOrder'];
|
|
283
|
+
return (tx: Transaction) =>
|
|
284
|
+
tx.moveCall({
|
|
285
|
+
package: packageAddress,
|
|
286
|
+
module: 'tpsl',
|
|
287
|
+
function: 'conditional_order_id',
|
|
288
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
export interface GetConditionalOrderArguments {
|
|
292
|
+
self: TransactionArgument;
|
|
293
|
+
conditionalOrderId: RawTransactionArgument<number | bigint>;
|
|
294
|
+
}
|
|
295
|
+
export interface GetConditionalOrderOptions {
|
|
296
|
+
package?: string;
|
|
297
|
+
arguments:
|
|
298
|
+
| GetConditionalOrderArguments
|
|
299
|
+
| [self: TransactionArgument, conditionalOrderId: RawTransactionArgument<number | bigint>];
|
|
300
|
+
}
|
|
301
|
+
export function getConditionalOrder(options: GetConditionalOrderOptions) {
|
|
302
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
303
|
+
const argumentsTypes = [null, 'u64'] satisfies (string | null)[];
|
|
304
|
+
const parameterNames = ['self', 'conditionalOrderId'];
|
|
305
|
+
return (tx: Transaction) =>
|
|
306
|
+
tx.moveCall({
|
|
307
|
+
package: packageAddress,
|
|
308
|
+
module: 'tpsl',
|
|
309
|
+
function: 'get_conditional_order',
|
|
310
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
export interface ConditionArguments {
|
|
314
|
+
conditionalOrder: TransactionArgument;
|
|
315
|
+
}
|
|
316
|
+
export interface ConditionOptions {
|
|
317
|
+
package?: string;
|
|
318
|
+
arguments: ConditionArguments | [conditionalOrder: TransactionArgument];
|
|
319
|
+
}
|
|
320
|
+
export function condition(options: ConditionOptions) {
|
|
321
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
322
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
323
|
+
const parameterNames = ['conditionalOrder'];
|
|
324
|
+
return (tx: Transaction) =>
|
|
325
|
+
tx.moveCall({
|
|
326
|
+
package: packageAddress,
|
|
327
|
+
module: 'tpsl',
|
|
328
|
+
function: 'condition',
|
|
329
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
export interface PendingOrderArguments {
|
|
333
|
+
conditionalOrder: TransactionArgument;
|
|
334
|
+
}
|
|
335
|
+
export interface PendingOrderOptions {
|
|
336
|
+
package?: string;
|
|
337
|
+
arguments: PendingOrderArguments | [conditionalOrder: TransactionArgument];
|
|
338
|
+
}
|
|
339
|
+
export function pendingOrder(options: PendingOrderOptions) {
|
|
340
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
341
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
342
|
+
const parameterNames = ['conditionalOrder'];
|
|
343
|
+
return (tx: Transaction) =>
|
|
344
|
+
tx.moveCall({
|
|
345
|
+
package: packageAddress,
|
|
346
|
+
module: 'tpsl',
|
|
347
|
+
function: 'pending_order',
|
|
348
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
export interface TriggerBelowPriceArguments {
|
|
352
|
+
condition: TransactionArgument;
|
|
353
|
+
}
|
|
354
|
+
export interface TriggerBelowPriceOptions {
|
|
355
|
+
package?: string;
|
|
356
|
+
arguments: TriggerBelowPriceArguments | [condition: TransactionArgument];
|
|
357
|
+
}
|
|
358
|
+
export function triggerBelowPrice(options: TriggerBelowPriceOptions) {
|
|
359
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
360
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
361
|
+
const parameterNames = ['condition'];
|
|
362
|
+
return (tx: Transaction) =>
|
|
363
|
+
tx.moveCall({
|
|
364
|
+
package: packageAddress,
|
|
365
|
+
module: 'tpsl',
|
|
366
|
+
function: 'trigger_below_price',
|
|
367
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
export interface TriggerPriceArguments {
|
|
371
|
+
condition: TransactionArgument;
|
|
372
|
+
}
|
|
373
|
+
export interface TriggerPriceOptions {
|
|
374
|
+
package?: string;
|
|
375
|
+
arguments: TriggerPriceArguments | [condition: TransactionArgument];
|
|
376
|
+
}
|
|
377
|
+
export function triggerPrice(options: TriggerPriceOptions) {
|
|
378
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
379
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
380
|
+
const parameterNames = ['condition'];
|
|
381
|
+
return (tx: Transaction) =>
|
|
382
|
+
tx.moveCall({
|
|
383
|
+
package: packageAddress,
|
|
384
|
+
module: 'tpsl',
|
|
385
|
+
function: 'trigger_price',
|
|
386
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
export interface ClientOrderIdArguments {
|
|
390
|
+
pendingOrder: TransactionArgument;
|
|
391
|
+
}
|
|
392
|
+
export interface ClientOrderIdOptions {
|
|
393
|
+
package?: string;
|
|
394
|
+
arguments: ClientOrderIdArguments | [pendingOrder: TransactionArgument];
|
|
395
|
+
}
|
|
396
|
+
export function clientOrderId(options: ClientOrderIdOptions) {
|
|
397
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
398
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
399
|
+
const parameterNames = ['pendingOrder'];
|
|
400
|
+
return (tx: Transaction) =>
|
|
401
|
+
tx.moveCall({
|
|
402
|
+
package: packageAddress,
|
|
403
|
+
module: 'tpsl',
|
|
404
|
+
function: 'client_order_id',
|
|
405
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
export interface OrderTypeArguments {
|
|
409
|
+
pendingOrder: TransactionArgument;
|
|
410
|
+
}
|
|
411
|
+
export interface OrderTypeOptions {
|
|
412
|
+
package?: string;
|
|
413
|
+
arguments: OrderTypeArguments | [pendingOrder: TransactionArgument];
|
|
414
|
+
}
|
|
415
|
+
export function orderType(options: OrderTypeOptions) {
|
|
416
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
417
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
418
|
+
const parameterNames = ['pendingOrder'];
|
|
419
|
+
return (tx: Transaction) =>
|
|
420
|
+
tx.moveCall({
|
|
421
|
+
package: packageAddress,
|
|
422
|
+
module: 'tpsl',
|
|
423
|
+
function: 'order_type',
|
|
424
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
export interface SelfMatchingOptionArguments {
|
|
428
|
+
pendingOrder: TransactionArgument;
|
|
429
|
+
}
|
|
430
|
+
export interface SelfMatchingOptionOptions {
|
|
431
|
+
package?: string;
|
|
432
|
+
arguments: SelfMatchingOptionArguments | [pendingOrder: TransactionArgument];
|
|
433
|
+
}
|
|
434
|
+
export function selfMatchingOption(options: SelfMatchingOptionOptions) {
|
|
435
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
436
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
437
|
+
const parameterNames = ['pendingOrder'];
|
|
438
|
+
return (tx: Transaction) =>
|
|
439
|
+
tx.moveCall({
|
|
440
|
+
package: packageAddress,
|
|
441
|
+
module: 'tpsl',
|
|
442
|
+
function: 'self_matching_option',
|
|
443
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
export interface PriceArguments {
|
|
447
|
+
pendingOrder: TransactionArgument;
|
|
448
|
+
}
|
|
449
|
+
export interface PriceOptions {
|
|
450
|
+
package?: string;
|
|
451
|
+
arguments: PriceArguments | [pendingOrder: TransactionArgument];
|
|
452
|
+
}
|
|
453
|
+
export function price(options: PriceOptions) {
|
|
454
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
455
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
456
|
+
const parameterNames = ['pendingOrder'];
|
|
457
|
+
return (tx: Transaction) =>
|
|
458
|
+
tx.moveCall({
|
|
459
|
+
package: packageAddress,
|
|
460
|
+
module: 'tpsl',
|
|
461
|
+
function: 'price',
|
|
462
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
export interface QuantityArguments {
|
|
466
|
+
pendingOrder: TransactionArgument;
|
|
467
|
+
}
|
|
468
|
+
export interface QuantityOptions {
|
|
469
|
+
package?: string;
|
|
470
|
+
arguments: QuantityArguments | [pendingOrder: TransactionArgument];
|
|
471
|
+
}
|
|
472
|
+
export function quantity(options: QuantityOptions) {
|
|
473
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
474
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
475
|
+
const parameterNames = ['pendingOrder'];
|
|
476
|
+
return (tx: Transaction) =>
|
|
477
|
+
tx.moveCall({
|
|
478
|
+
package: packageAddress,
|
|
479
|
+
module: 'tpsl',
|
|
480
|
+
function: 'quantity',
|
|
481
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
export interface IsBidArguments {
|
|
485
|
+
pendingOrder: TransactionArgument;
|
|
486
|
+
}
|
|
487
|
+
export interface IsBidOptions {
|
|
488
|
+
package?: string;
|
|
489
|
+
arguments: IsBidArguments | [pendingOrder: TransactionArgument];
|
|
490
|
+
}
|
|
491
|
+
export function isBid(options: IsBidOptions) {
|
|
492
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
493
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
494
|
+
const parameterNames = ['pendingOrder'];
|
|
495
|
+
return (tx: Transaction) =>
|
|
496
|
+
tx.moveCall({
|
|
497
|
+
package: packageAddress,
|
|
498
|
+
module: 'tpsl',
|
|
499
|
+
function: 'is_bid',
|
|
500
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
export interface PayWithDeepArguments {
|
|
504
|
+
pendingOrder: TransactionArgument;
|
|
505
|
+
}
|
|
506
|
+
export interface PayWithDeepOptions {
|
|
507
|
+
package?: string;
|
|
508
|
+
arguments: PayWithDeepArguments | [pendingOrder: TransactionArgument];
|
|
509
|
+
}
|
|
510
|
+
export function payWithDeep(options: PayWithDeepOptions) {
|
|
511
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
512
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
513
|
+
const parameterNames = ['pendingOrder'];
|
|
514
|
+
return (tx: Transaction) =>
|
|
515
|
+
tx.moveCall({
|
|
516
|
+
package: packageAddress,
|
|
517
|
+
module: 'tpsl',
|
|
518
|
+
function: 'pay_with_deep',
|
|
519
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
export interface ExpireTimestampArguments {
|
|
523
|
+
pendingOrder: TransactionArgument;
|
|
524
|
+
}
|
|
525
|
+
export interface ExpireTimestampOptions {
|
|
526
|
+
package?: string;
|
|
527
|
+
arguments: ExpireTimestampArguments | [pendingOrder: TransactionArgument];
|
|
528
|
+
}
|
|
529
|
+
export function expireTimestamp(options: ExpireTimestampOptions) {
|
|
530
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
531
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
532
|
+
const parameterNames = ['pendingOrder'];
|
|
533
|
+
return (tx: Transaction) =>
|
|
534
|
+
tx.moveCall({
|
|
535
|
+
package: packageAddress,
|
|
536
|
+
module: 'tpsl',
|
|
537
|
+
function: 'expire_timestamp',
|
|
538
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
export interface IsLimitOrderArguments {
|
|
542
|
+
pendingOrder: TransactionArgument;
|
|
543
|
+
}
|
|
544
|
+
export interface IsLimitOrderOptions {
|
|
545
|
+
package?: string;
|
|
546
|
+
arguments: IsLimitOrderArguments | [pendingOrder: TransactionArgument];
|
|
547
|
+
}
|
|
548
|
+
export function isLimitOrder(options: IsLimitOrderOptions) {
|
|
549
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
550
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
551
|
+
const parameterNames = ['pendingOrder'];
|
|
552
|
+
return (tx: Transaction) =>
|
|
553
|
+
tx.moveCall({
|
|
554
|
+
package: packageAddress,
|
|
555
|
+
module: 'tpsl',
|
|
556
|
+
function: 'is_limit_order',
|
|
557
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
558
|
+
});
|
|
559
|
+
}
|
|
@@ -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
|
+
});
|