@mysten/deepbook-v3 1.5.9 → 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 +60 -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/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/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.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 +10 -0
- 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.map +1 -1
- package/dist/transactions/marginMaintainer.mjs +83 -83
- package/dist/transactions/marginMaintainer.mjs.map +1 -1
- 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.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 +32 -0
- 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
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
POOL_CREATION_FEE_DEEP,
|
|
23
23
|
} from '../utils/config.js';
|
|
24
24
|
import { convertQuantity, convertPrice, convertRate } from '../utils/conversion.js';
|
|
25
|
+
import * as poolMoveCalls from '../contracts/deepbook/pool.js';
|
|
26
|
+
import * as registryMoveCalls from '../contracts/deepbook/registry.js';
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* DeepBookContract class for managing DeepBook operations.
|
|
@@ -65,24 +67,25 @@ export class DeepBookContract {
|
|
|
65
67
|
|
|
66
68
|
const tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));
|
|
67
69
|
|
|
68
|
-
tx.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
70
|
+
tx.add(
|
|
71
|
+
poolMoveCalls.placeLimitOrder({
|
|
72
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
73
|
+
arguments: {
|
|
74
|
+
self: pool.address,
|
|
75
|
+
balanceManager: balanceManager.address,
|
|
76
|
+
tradeProof,
|
|
77
|
+
clientOrderId: BigInt(clientOrderId),
|
|
78
|
+
orderType,
|
|
79
|
+
selfMatchingOption,
|
|
80
|
+
price: inputPrice,
|
|
81
|
+
quantity: inputQuantity,
|
|
82
|
+
isBid,
|
|
83
|
+
payWithDeep,
|
|
84
|
+
expireTimestamp: expiration,
|
|
85
|
+
},
|
|
86
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
87
|
+
}),
|
|
88
|
+
);
|
|
86
89
|
};
|
|
87
90
|
|
|
88
91
|
/**
|
|
@@ -109,21 +112,22 @@ export class DeepBookContract {
|
|
|
109
112
|
const tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));
|
|
110
113
|
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
111
114
|
|
|
112
|
-
tx.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
115
|
+
tx.add(
|
|
116
|
+
poolMoveCalls.placeMarketOrder({
|
|
117
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
118
|
+
arguments: {
|
|
119
|
+
self: pool.address,
|
|
120
|
+
balanceManager: balanceManager.address,
|
|
121
|
+
tradeProof,
|
|
122
|
+
clientOrderId: BigInt(clientOrderId),
|
|
123
|
+
selfMatchingOption,
|
|
124
|
+
quantity: inputQuantity,
|
|
125
|
+
isBid,
|
|
126
|
+
payWithDeep,
|
|
127
|
+
},
|
|
128
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
129
|
+
}),
|
|
130
|
+
);
|
|
127
131
|
};
|
|
128
132
|
|
|
129
133
|
/**
|
|
@@ -144,18 +148,19 @@ export class DeepBookContract {
|
|
|
144
148
|
const tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));
|
|
145
149
|
const inputQuantity = convertQuantity(newQuantity, baseCoin.scalar);
|
|
146
150
|
|
|
147
|
-
tx.
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
151
|
+
tx.add(
|
|
152
|
+
poolMoveCalls.modifyOrder({
|
|
153
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
154
|
+
arguments: {
|
|
155
|
+
self: pool.address,
|
|
156
|
+
balanceManager: balanceManager.address,
|
|
157
|
+
tradeProof,
|
|
158
|
+
orderId: BigInt(orderId),
|
|
159
|
+
newQuantity: inputQuantity,
|
|
160
|
+
},
|
|
161
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
162
|
+
}),
|
|
163
|
+
);
|
|
159
164
|
};
|
|
160
165
|
|
|
161
166
|
/**
|
|
@@ -174,17 +179,18 @@ export class DeepBookContract {
|
|
|
174
179
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
175
180
|
const tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));
|
|
176
181
|
|
|
177
|
-
tx.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
182
|
+
tx.add(
|
|
183
|
+
poolMoveCalls.cancelOrder({
|
|
184
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
185
|
+
arguments: {
|
|
186
|
+
self: pool.address,
|
|
187
|
+
balanceManager: balanceManager.address,
|
|
188
|
+
tradeProof,
|
|
189
|
+
orderId: BigInt(orderId),
|
|
190
|
+
},
|
|
191
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
192
|
+
}),
|
|
193
|
+
);
|
|
188
194
|
};
|
|
189
195
|
|
|
190
196
|
/**
|
|
@@ -203,17 +209,18 @@ export class DeepBookContract {
|
|
|
203
209
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
204
210
|
const tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));
|
|
205
211
|
|
|
206
|
-
tx.
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
212
|
+
tx.add(
|
|
213
|
+
poolMoveCalls.cancelOrders({
|
|
214
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
215
|
+
arguments: {
|
|
216
|
+
self: pool.address,
|
|
217
|
+
balanceManager: balanceManager.address,
|
|
218
|
+
tradeProof,
|
|
219
|
+
orderIds: orderIds.map(BigInt),
|
|
220
|
+
},
|
|
221
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
222
|
+
}),
|
|
223
|
+
);
|
|
217
224
|
};
|
|
218
225
|
|
|
219
226
|
/**
|
|
@@ -235,17 +242,18 @@ export class DeepBookContract {
|
|
|
235
242
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
236
243
|
const tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));
|
|
237
244
|
|
|
238
|
-
tx.
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
245
|
+
tx.add(
|
|
246
|
+
poolMoveCalls.cancelLiveOrder({
|
|
247
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
248
|
+
arguments: {
|
|
249
|
+
self: pool.address,
|
|
250
|
+
balanceManager: balanceManager.address,
|
|
251
|
+
tradeProof,
|
|
252
|
+
orderId: BigInt(orderId),
|
|
253
|
+
},
|
|
254
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
255
|
+
}),
|
|
256
|
+
);
|
|
249
257
|
};
|
|
250
258
|
|
|
251
259
|
/**
|
|
@@ -267,17 +275,18 @@ export class DeepBookContract {
|
|
|
267
275
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
268
276
|
const tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));
|
|
269
277
|
|
|
270
|
-
tx.
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
278
|
+
tx.add(
|
|
279
|
+
poolMoveCalls.cancelLiveOrders({
|
|
280
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
281
|
+
arguments: {
|
|
282
|
+
self: pool.address,
|
|
283
|
+
balanceManager: balanceManager.address,
|
|
284
|
+
tradeProof,
|
|
285
|
+
orderIds: orderIds.map(BigInt),
|
|
286
|
+
},
|
|
287
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
288
|
+
}),
|
|
289
|
+
);
|
|
281
290
|
};
|
|
282
291
|
|
|
283
292
|
/**
|
|
@@ -294,16 +303,13 @@ export class DeepBookContract {
|
|
|
294
303
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
295
304
|
const tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));
|
|
296
305
|
|
|
297
|
-
tx.
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
],
|
|
305
|
-
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
306
|
-
});
|
|
306
|
+
tx.add(
|
|
307
|
+
poolMoveCalls.cancelAllOrders({
|
|
308
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
309
|
+
arguments: { self: pool.address, balanceManager: balanceManager.address, tradeProof },
|
|
310
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
311
|
+
}),
|
|
312
|
+
);
|
|
307
313
|
};
|
|
308
314
|
|
|
309
315
|
/**
|
|
@@ -319,11 +325,13 @@ export class DeepBookContract {
|
|
|
319
325
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
320
326
|
const tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));
|
|
321
327
|
|
|
322
|
-
tx.
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
328
|
+
tx.add(
|
|
329
|
+
poolMoveCalls.withdrawSettledAmounts({
|
|
330
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
331
|
+
arguments: { self: pool.address, balanceManager: balanceManager.address, tradeProof },
|
|
332
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
333
|
+
}),
|
|
334
|
+
);
|
|
327
335
|
};
|
|
328
336
|
|
|
329
337
|
/**
|
|
@@ -339,11 +347,13 @@ export class DeepBookContract {
|
|
|
339
347
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
340
348
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
341
349
|
|
|
342
|
-
tx.
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
350
|
+
tx.add(
|
|
351
|
+
poolMoveCalls.withdrawSettledAmountsPermissionless({
|
|
352
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
353
|
+
arguments: { self: pool.address, balanceManager: balanceManager.address },
|
|
354
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
355
|
+
}),
|
|
356
|
+
);
|
|
347
357
|
};
|
|
348
358
|
|
|
349
359
|
/**
|
|
@@ -358,11 +368,13 @@ export class DeepBookContract {
|
|
|
358
368
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
359
369
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
360
370
|
|
|
361
|
-
tx.
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
371
|
+
tx.add(
|
|
372
|
+
poolMoveCalls.withdrawSettledAmountsPermissionless({
|
|
373
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
374
|
+
arguments: { self: pool.address, balanceManager: balanceManagerId },
|
|
375
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
376
|
+
}),
|
|
377
|
+
);
|
|
366
378
|
};
|
|
367
379
|
|
|
368
380
|
/**
|
|
@@ -378,20 +390,18 @@ export class DeepBookContract {
|
|
|
378
390
|
const targetQuoteCoin = this.#config.getCoin(targetPool.quoteCoin);
|
|
379
391
|
const referenceBaseCoin = this.#config.getCoin(referencePool.baseCoin);
|
|
380
392
|
const referenceQuoteCoin = this.#config.getCoin(referencePool.quoteCoin);
|
|
381
|
-
tx.
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
],
|
|
394
|
-
});
|
|
393
|
+
tx.add(
|
|
394
|
+
poolMoveCalls.addDeepPricePoint({
|
|
395
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
396
|
+
arguments: { targetPool: targetPool.address, referencePool: referencePool.address },
|
|
397
|
+
typeArguments: [
|
|
398
|
+
targetBaseCoin.type,
|
|
399
|
+
targetQuoteCoin.type,
|
|
400
|
+
referenceBaseCoin.type,
|
|
401
|
+
referenceQuoteCoin.type,
|
|
402
|
+
],
|
|
403
|
+
}),
|
|
404
|
+
);
|
|
395
405
|
};
|
|
396
406
|
|
|
397
407
|
/**
|
|
@@ -407,11 +417,13 @@ export class DeepBookContract {
|
|
|
407
417
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
408
418
|
const tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));
|
|
409
419
|
|
|
410
|
-
tx.
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
420
|
+
tx.add(
|
|
421
|
+
poolMoveCalls.claimRebates({
|
|
422
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
423
|
+
arguments: { self: pool.address, balanceManager: balanceManager.address, tradeProof },
|
|
424
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
425
|
+
}),
|
|
426
|
+
);
|
|
415
427
|
};
|
|
416
428
|
|
|
417
429
|
/**
|
|
@@ -426,11 +438,13 @@ export class DeepBookContract {
|
|
|
426
438
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
427
439
|
const adjustedNumber = convertRate(multiplier, FLOAT_SCALAR);
|
|
428
440
|
|
|
429
|
-
tx.
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
441
|
+
tx.add(
|
|
442
|
+
poolMoveCalls.mintReferral({
|
|
443
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
444
|
+
arguments: { self: pool.address, multiplier: adjustedNumber },
|
|
445
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
446
|
+
}),
|
|
447
|
+
);
|
|
434
448
|
};
|
|
435
449
|
|
|
436
450
|
/**
|
|
@@ -447,11 +461,13 @@ export class DeepBookContract {
|
|
|
447
461
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
448
462
|
const adjustedNumber = convertRate(multiplier, FLOAT_SCALAR);
|
|
449
463
|
|
|
450
|
-
tx.
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
464
|
+
tx.add(
|
|
465
|
+
poolMoveCalls.updatePoolReferralMultiplier({
|
|
466
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
467
|
+
arguments: { self: pool.address, referral, multiplier: adjustedNumber },
|
|
468
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
469
|
+
}),
|
|
470
|
+
);
|
|
455
471
|
};
|
|
456
472
|
|
|
457
473
|
/**
|
|
@@ -465,11 +481,13 @@ export class DeepBookContract {
|
|
|
465
481
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
466
482
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
467
483
|
|
|
468
|
-
const [baseRewards, quoteRewards, deepRewards] = tx.
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
484
|
+
const [baseRewards, quoteRewards, deepRewards] = tx.add(
|
|
485
|
+
poolMoveCalls.claimPoolReferralRewards({
|
|
486
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
487
|
+
arguments: { self: pool.address, referral },
|
|
488
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
489
|
+
}),
|
|
490
|
+
);
|
|
473
491
|
|
|
474
492
|
return { baseRewards, quoteRewards, deepRewards };
|
|
475
493
|
};
|
|
@@ -483,11 +501,13 @@ export class DeepBookContract {
|
|
|
483
501
|
const pool = this.#config.getPool(poolKey);
|
|
484
502
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
485
503
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
486
|
-
tx.
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
504
|
+
tx.add(
|
|
505
|
+
poolMoveCalls.updatePoolAllowedVersions({
|
|
506
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
507
|
+
arguments: { self: pool.address, registry: this.#config.REGISTRY_ID },
|
|
508
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
509
|
+
}),
|
|
510
|
+
);
|
|
491
511
|
};
|
|
492
512
|
|
|
493
513
|
/**
|
|
@@ -501,11 +521,13 @@ export class DeepBookContract {
|
|
|
501
521
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
502
522
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
503
523
|
|
|
504
|
-
tx.
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
524
|
+
tx.add(
|
|
525
|
+
poolMoveCalls.getOrder({
|
|
526
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
527
|
+
arguments: { self: pool.address, orderId: BigInt(orderId) },
|
|
528
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
529
|
+
}),
|
|
530
|
+
);
|
|
509
531
|
};
|
|
510
532
|
|
|
511
533
|
/**
|
|
@@ -519,11 +541,13 @@ export class DeepBookContract {
|
|
|
519
541
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
520
542
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
521
543
|
|
|
522
|
-
tx.
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
544
|
+
tx.add(
|
|
545
|
+
poolMoveCalls.getOrders({
|
|
546
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
547
|
+
arguments: { self: pool.address, orderIds: orderIds.map(BigInt) },
|
|
548
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
549
|
+
}),
|
|
550
|
+
);
|
|
527
551
|
};
|
|
528
552
|
|
|
529
553
|
/**
|
|
@@ -535,11 +559,13 @@ export class DeepBookContract {
|
|
|
535
559
|
const pool = this.#config.getPool(poolKey);
|
|
536
560
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
537
561
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
538
|
-
tx.
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
562
|
+
tx.add(
|
|
563
|
+
poolMoveCalls.burnDeep({
|
|
564
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
565
|
+
arguments: { self: pool.address, treasuryCap: this.#config.DEEP_TREASURY_ID },
|
|
566
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
567
|
+
}),
|
|
568
|
+
);
|
|
543
569
|
};
|
|
544
570
|
|
|
545
571
|
/**
|
|
@@ -552,11 +578,13 @@ export class DeepBookContract {
|
|
|
552
578
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
553
579
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
554
580
|
|
|
555
|
-
tx.
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
581
|
+
tx.add(
|
|
582
|
+
poolMoveCalls.midPrice({
|
|
583
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
584
|
+
arguments: { self: pool.address },
|
|
585
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
586
|
+
}),
|
|
587
|
+
);
|
|
560
588
|
};
|
|
561
589
|
|
|
562
590
|
/**
|
|
@@ -568,11 +596,13 @@ export class DeepBookContract {
|
|
|
568
596
|
const pool = this.#config.getPool(poolKey);
|
|
569
597
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
570
598
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
571
|
-
tx.
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
599
|
+
tx.add(
|
|
600
|
+
poolMoveCalls.whitelisted({
|
|
601
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
602
|
+
arguments: { self: pool.address },
|
|
603
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
604
|
+
}),
|
|
605
|
+
);
|
|
576
606
|
};
|
|
577
607
|
|
|
578
608
|
/**
|
|
@@ -586,15 +616,16 @@ export class DeepBookContract {
|
|
|
586
616
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
587
617
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
588
618
|
|
|
589
|
-
tx.
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
619
|
+
tx.add(
|
|
620
|
+
poolMoveCalls.getQuoteQuantityOut({
|
|
621
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
622
|
+
arguments: {
|
|
623
|
+
self: pool.address,
|
|
624
|
+
baseQuantity: convertQuantity(baseQuantity, baseCoin.scalar),
|
|
625
|
+
},
|
|
626
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
627
|
+
}),
|
|
628
|
+
);
|
|
598
629
|
};
|
|
599
630
|
|
|
600
631
|
/**
|
|
@@ -609,15 +640,16 @@ export class DeepBookContract {
|
|
|
609
640
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
610
641
|
const quoteScalar = quoteCoin.scalar;
|
|
611
642
|
|
|
612
|
-
tx.
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
643
|
+
tx.add(
|
|
644
|
+
poolMoveCalls.getBaseQuantityOut({
|
|
645
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
646
|
+
arguments: {
|
|
647
|
+
self: pool.address,
|
|
648
|
+
quoteQuantity: convertQuantity(quoteQuantity, quoteScalar),
|
|
649
|
+
},
|
|
650
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
651
|
+
}),
|
|
652
|
+
);
|
|
621
653
|
};
|
|
622
654
|
|
|
623
655
|
/**
|
|
@@ -635,16 +667,17 @@ export class DeepBookContract {
|
|
|
635
667
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
636
668
|
const quoteScalar = quoteCoin.scalar;
|
|
637
669
|
|
|
638
|
-
tx.
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
670
|
+
tx.add(
|
|
671
|
+
poolMoveCalls.getQuantityOut({
|
|
672
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
673
|
+
arguments: {
|
|
674
|
+
self: pool.address,
|
|
675
|
+
baseQuantity: convertQuantity(baseQuantity, baseCoin.scalar),
|
|
676
|
+
quoteQuantity: convertQuantity(quoteQuantity, quoteScalar),
|
|
677
|
+
},
|
|
678
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
679
|
+
}),
|
|
680
|
+
);
|
|
648
681
|
};
|
|
649
682
|
|
|
650
683
|
/**
|
|
@@ -659,11 +692,13 @@ export class DeepBookContract {
|
|
|
659
692
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
660
693
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
661
694
|
|
|
662
|
-
tx.
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
695
|
+
tx.add(
|
|
696
|
+
poolMoveCalls.accountOpenOrders({
|
|
697
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
698
|
+
arguments: { self: pool.address, balanceManager: manager.address },
|
|
699
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
700
|
+
}),
|
|
701
|
+
);
|
|
667
702
|
};
|
|
668
703
|
|
|
669
704
|
/**
|
|
@@ -681,17 +716,18 @@ export class DeepBookContract {
|
|
|
681
716
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
682
717
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
683
718
|
|
|
684
|
-
tx.
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
719
|
+
tx.add(
|
|
720
|
+
poolMoveCalls.getLevel2Range({
|
|
721
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
722
|
+
arguments: {
|
|
723
|
+
self: pool.address,
|
|
724
|
+
priceLow: convertPrice(priceLow, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar),
|
|
725
|
+
priceHigh: convertPrice(priceHigh, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar),
|
|
726
|
+
isBid,
|
|
727
|
+
},
|
|
728
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
729
|
+
}),
|
|
730
|
+
);
|
|
695
731
|
};
|
|
696
732
|
|
|
697
733
|
/**
|
|
@@ -705,11 +741,13 @@ export class DeepBookContract {
|
|
|
705
741
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
706
742
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
707
743
|
|
|
708
|
-
tx.
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
744
|
+
tx.add(
|
|
745
|
+
poolMoveCalls.getLevel2TicksFromMid({
|
|
746
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
747
|
+
arguments: { self: pool.address, ticks: tickFromMid },
|
|
748
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
749
|
+
}),
|
|
750
|
+
);
|
|
713
751
|
};
|
|
714
752
|
|
|
715
753
|
/**
|
|
@@ -722,11 +760,13 @@ export class DeepBookContract {
|
|
|
722
760
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
723
761
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
724
762
|
|
|
725
|
-
tx.
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
763
|
+
tx.add(
|
|
764
|
+
poolMoveCalls.vaultBalances({
|
|
765
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
766
|
+
arguments: { self: pool.address },
|
|
767
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
768
|
+
}),
|
|
769
|
+
);
|
|
730
770
|
};
|
|
731
771
|
|
|
732
772
|
/**
|
|
@@ -736,11 +776,13 @@ export class DeepBookContract {
|
|
|
736
776
|
* @returns A function that takes a Transaction object
|
|
737
777
|
*/
|
|
738
778
|
getPoolIdByAssets = (baseType: string, quoteType: string) => (tx: Transaction) => {
|
|
739
|
-
tx.
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
779
|
+
tx.add(
|
|
780
|
+
poolMoveCalls.getPoolIdByAsset({
|
|
781
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
782
|
+
arguments: { registry: this.#config.REGISTRY_ID },
|
|
783
|
+
typeArguments: [baseType, quoteType],
|
|
784
|
+
}),
|
|
785
|
+
);
|
|
744
786
|
};
|
|
745
787
|
|
|
746
788
|
/**
|
|
@@ -775,17 +817,18 @@ export class DeepBookContract {
|
|
|
775
817
|
|
|
776
818
|
const minQuoteInput = convertQuantity(minQuote, quoteCoin.scalar);
|
|
777
819
|
|
|
778
|
-
const [baseCoinResult, quoteCoinResult, deepCoinResult] = tx.
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
820
|
+
const [baseCoinResult, quoteCoinResult, deepCoinResult] = tx.add(
|
|
821
|
+
poolMoveCalls.swapExactBaseForQuote({
|
|
822
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
823
|
+
arguments: {
|
|
824
|
+
self: pool.address,
|
|
825
|
+
baseIn: baseCoinInput,
|
|
826
|
+
deepIn: deepCoin,
|
|
827
|
+
minQuoteOut: minQuoteInput,
|
|
828
|
+
},
|
|
829
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
830
|
+
}),
|
|
831
|
+
);
|
|
789
832
|
|
|
790
833
|
return [baseCoinResult, quoteCoinResult, deepCoinResult] as const;
|
|
791
834
|
};
|
|
@@ -822,17 +865,18 @@ export class DeepBookContract {
|
|
|
822
865
|
|
|
823
866
|
const minBaseInput = convertQuantity(minBase, baseCoin.scalar);
|
|
824
867
|
|
|
825
|
-
const [baseCoinResult, quoteCoinResult, deepCoinResult] = tx.
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
868
|
+
const [baseCoinResult, quoteCoinResult, deepCoinResult] = tx.add(
|
|
869
|
+
poolMoveCalls.swapExactQuoteForBase({
|
|
870
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
871
|
+
arguments: {
|
|
872
|
+
self: pool.address,
|
|
873
|
+
quoteIn: quoteCoinInput,
|
|
874
|
+
deepIn: deepCoin,
|
|
875
|
+
minBaseOut: minBaseInput,
|
|
876
|
+
},
|
|
877
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
878
|
+
}),
|
|
879
|
+
);
|
|
836
880
|
|
|
837
881
|
return [baseCoinResult, quoteCoinResult, deepCoinResult] as const;
|
|
838
882
|
};
|
|
@@ -879,18 +923,19 @@ export class DeepBookContract {
|
|
|
879
923
|
isBaseToCoin ? quoteCoinType.scalar : baseCoinType.scalar,
|
|
880
924
|
);
|
|
881
925
|
|
|
882
|
-
const [baseCoinResult, quoteCoinResult, deepCoinResult] = tx.
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
926
|
+
const [baseCoinResult, quoteCoinResult, deepCoinResult] = tx.add(
|
|
927
|
+
poolMoveCalls.swapExactQuantity({
|
|
928
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
929
|
+
arguments: {
|
|
930
|
+
self: pool.address,
|
|
931
|
+
baseIn: baseCoinInput,
|
|
932
|
+
quoteIn: quoteCoinInput,
|
|
933
|
+
deepIn: deepCoinInput,
|
|
934
|
+
minOut: minOutInput,
|
|
935
|
+
},
|
|
936
|
+
typeArguments: [baseCoinType.type, quoteCoinType.type],
|
|
937
|
+
}),
|
|
938
|
+
);
|
|
894
939
|
|
|
895
940
|
return [baseCoinResult, quoteCoinResult, deepCoinResult] as const;
|
|
896
941
|
};
|
|
@@ -926,20 +971,21 @@ export class DeepBookContract {
|
|
|
926
971
|
});
|
|
927
972
|
const minQuoteInput = convertQuantity(minQuote, quoteCoinType.scalar);
|
|
928
973
|
|
|
929
|
-
const [baseCoinResult, quoteCoinResult] = tx.
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
974
|
+
const [baseCoinResult, quoteCoinResult] = tx.add(
|
|
975
|
+
poolMoveCalls.swapExactBaseForQuoteWithManager({
|
|
976
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
977
|
+
arguments: {
|
|
978
|
+
self: pool.address,
|
|
979
|
+
balanceManager: balanceManager.address,
|
|
980
|
+
tradeCap,
|
|
981
|
+
depositCap,
|
|
982
|
+
withdrawCap,
|
|
983
|
+
baseIn: baseCoinInput,
|
|
984
|
+
minQuoteOut: minQuoteInput,
|
|
985
|
+
},
|
|
986
|
+
typeArguments: [baseCoinType.type, quoteCoinType.type],
|
|
987
|
+
}),
|
|
988
|
+
);
|
|
943
989
|
|
|
944
990
|
return [baseCoinResult, quoteCoinResult] as const;
|
|
945
991
|
};
|
|
@@ -975,20 +1021,21 @@ export class DeepBookContract {
|
|
|
975
1021
|
});
|
|
976
1022
|
const minBaseInput = convertQuantity(minBase, baseCoinType.scalar);
|
|
977
1023
|
|
|
978
|
-
const [baseCoinResult, quoteCoinResult] = tx.
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1024
|
+
const [baseCoinResult, quoteCoinResult] = tx.add(
|
|
1025
|
+
poolMoveCalls.swapExactQuoteForBaseWithManager({
|
|
1026
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1027
|
+
arguments: {
|
|
1028
|
+
self: pool.address,
|
|
1029
|
+
balanceManager: balanceManager.address,
|
|
1030
|
+
tradeCap,
|
|
1031
|
+
depositCap,
|
|
1032
|
+
withdrawCap,
|
|
1033
|
+
quoteIn: quoteCoinInput,
|
|
1034
|
+
minBaseOut: minBaseInput,
|
|
1035
|
+
},
|
|
1036
|
+
typeArguments: [baseCoinType.type, quoteCoinType.type],
|
|
1037
|
+
}),
|
|
1038
|
+
);
|
|
992
1039
|
|
|
993
1040
|
return [baseCoinResult, quoteCoinResult] as const;
|
|
994
1041
|
};
|
|
@@ -1040,21 +1087,22 @@ export class DeepBookContract {
|
|
|
1040
1087
|
isBaseToCoin ? quoteCoinType.scalar : baseCoinType.scalar,
|
|
1041
1088
|
);
|
|
1042
1089
|
|
|
1043
|
-
const [baseCoinResult, quoteCoinResult] = tx.
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1090
|
+
const [baseCoinResult, quoteCoinResult] = tx.add(
|
|
1091
|
+
poolMoveCalls.swapExactQuantityWithManager({
|
|
1092
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1093
|
+
arguments: {
|
|
1094
|
+
self: pool.address,
|
|
1095
|
+
balanceManager: balanceManager.address,
|
|
1096
|
+
tradeCap,
|
|
1097
|
+
depositCap,
|
|
1098
|
+
withdrawCap,
|
|
1099
|
+
baseIn: baseCoinInput,
|
|
1100
|
+
quoteIn: quoteCoinInput,
|
|
1101
|
+
minOut: minOutInput,
|
|
1102
|
+
},
|
|
1103
|
+
typeArguments: [baseCoinType.type, quoteCoinType.type],
|
|
1104
|
+
}),
|
|
1105
|
+
);
|
|
1058
1106
|
|
|
1059
1107
|
return [baseCoinResult, quoteCoinResult] as const;
|
|
1060
1108
|
};
|
|
@@ -1085,17 +1133,19 @@ export class DeepBookContract {
|
|
|
1085
1133
|
balance: POOL_CREATION_FEE_DEEP,
|
|
1086
1134
|
});
|
|
1087
1135
|
|
|
1088
|
-
tx.
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1136
|
+
tx.add(
|
|
1137
|
+
poolMoveCalls.createPermissionlessPool({
|
|
1138
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1139
|
+
arguments: {
|
|
1140
|
+
registry: this.#config.REGISTRY_ID,
|
|
1141
|
+
tickSize: adjustedTickSize,
|
|
1142
|
+
lotSize: adjustedLotSize,
|
|
1143
|
+
minSize: adjustedMinSize,
|
|
1144
|
+
creationFee: deepCoinInput,
|
|
1145
|
+
},
|
|
1146
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1147
|
+
}),
|
|
1148
|
+
);
|
|
1099
1149
|
};
|
|
1100
1150
|
|
|
1101
1151
|
/**
|
|
@@ -1108,11 +1158,13 @@ export class DeepBookContract {
|
|
|
1108
1158
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1109
1159
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1110
1160
|
|
|
1111
|
-
tx.
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1161
|
+
tx.add(
|
|
1162
|
+
poolMoveCalls.poolTradeParams({
|
|
1163
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1164
|
+
arguments: { self: pool.address },
|
|
1165
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1166
|
+
}),
|
|
1167
|
+
);
|
|
1116
1168
|
};
|
|
1117
1169
|
|
|
1118
1170
|
/**
|
|
@@ -1125,11 +1177,13 @@ export class DeepBookContract {
|
|
|
1125
1177
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1126
1178
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1127
1179
|
|
|
1128
|
-
tx.
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1180
|
+
tx.add(
|
|
1181
|
+
poolMoveCalls.poolBookParams({
|
|
1182
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1183
|
+
arguments: { self: pool.address },
|
|
1184
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1185
|
+
}),
|
|
1186
|
+
);
|
|
1133
1187
|
};
|
|
1134
1188
|
|
|
1135
1189
|
/**
|
|
@@ -1144,11 +1198,13 @@ export class DeepBookContract {
|
|
|
1144
1198
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1145
1199
|
const managerId = this.#config.getBalanceManager(managerKey).address;
|
|
1146
1200
|
|
|
1147
|
-
tx.
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1201
|
+
tx.add(
|
|
1202
|
+
poolMoveCalls.account({
|
|
1203
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1204
|
+
arguments: { self: pool.address, balanceManager: managerId },
|
|
1205
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1206
|
+
}),
|
|
1207
|
+
);
|
|
1152
1208
|
};
|
|
1153
1209
|
|
|
1154
1210
|
/**
|
|
@@ -1163,11 +1219,13 @@ export class DeepBookContract {
|
|
|
1163
1219
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1164
1220
|
const managerId = this.#config.getBalanceManager(managerKey).address;
|
|
1165
1221
|
|
|
1166
|
-
tx.
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1222
|
+
tx.add(
|
|
1223
|
+
poolMoveCalls.lockedBalance({
|
|
1224
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1225
|
+
arguments: { self: pool.address, balanceManager: managerId },
|
|
1226
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1227
|
+
}),
|
|
1228
|
+
);
|
|
1171
1229
|
};
|
|
1172
1230
|
|
|
1173
1231
|
/**
|
|
@@ -1180,11 +1238,13 @@ export class DeepBookContract {
|
|
|
1180
1238
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1181
1239
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1182
1240
|
|
|
1183
|
-
tx.
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1241
|
+
tx.add(
|
|
1242
|
+
poolMoveCalls.getOrderDeepPrice({
|
|
1243
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1244
|
+
arguments: { self: pool.address },
|
|
1245
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1246
|
+
}),
|
|
1247
|
+
);
|
|
1188
1248
|
};
|
|
1189
1249
|
|
|
1190
1250
|
/**
|
|
@@ -1193,10 +1253,12 @@ export class DeepBookContract {
|
|
|
1193
1253
|
* @returns A function that takes a Transaction object
|
|
1194
1254
|
*/
|
|
1195
1255
|
getBalanceManagerIds = (owner: string) => (tx: Transaction) => {
|
|
1196
|
-
tx.
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1256
|
+
tx.add(
|
|
1257
|
+
registryMoveCalls.getBalanceManagerIds({
|
|
1258
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1259
|
+
arguments: { self: this.#config.REGISTRY_ID, owner },
|
|
1260
|
+
}),
|
|
1261
|
+
);
|
|
1200
1262
|
};
|
|
1201
1263
|
|
|
1202
1264
|
/**
|
|
@@ -1210,11 +1272,13 @@ export class DeepBookContract {
|
|
|
1210
1272
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1211
1273
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1212
1274
|
|
|
1213
|
-
return tx.
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1275
|
+
return tx.add(
|
|
1276
|
+
poolMoveCalls.getPoolReferralBalances({
|
|
1277
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1278
|
+
arguments: { self: pool.address, referral },
|
|
1279
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1280
|
+
}),
|
|
1281
|
+
);
|
|
1218
1282
|
};
|
|
1219
1283
|
|
|
1220
1284
|
/**
|
|
@@ -1228,11 +1292,13 @@ export class DeepBookContract {
|
|
|
1228
1292
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1229
1293
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1230
1294
|
|
|
1231
|
-
return tx.
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1295
|
+
return tx.add(
|
|
1296
|
+
poolMoveCalls.poolReferralMultiplier({
|
|
1297
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1298
|
+
arguments: { self: pool.address, referral },
|
|
1299
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1300
|
+
}),
|
|
1301
|
+
);
|
|
1236
1302
|
};
|
|
1237
1303
|
|
|
1238
1304
|
/**
|
|
@@ -1245,11 +1311,13 @@ export class DeepBookContract {
|
|
|
1245
1311
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1246
1312
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1247
1313
|
|
|
1248
|
-
return tx.
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1314
|
+
return tx.add(
|
|
1315
|
+
poolMoveCalls.stablePool({
|
|
1316
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1317
|
+
arguments: { self: pool.address },
|
|
1318
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1319
|
+
}),
|
|
1320
|
+
);
|
|
1253
1321
|
};
|
|
1254
1322
|
|
|
1255
1323
|
/**
|
|
@@ -1262,11 +1330,13 @@ export class DeepBookContract {
|
|
|
1262
1330
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1263
1331
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1264
1332
|
|
|
1265
|
-
return tx.
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1333
|
+
return tx.add(
|
|
1334
|
+
poolMoveCalls.registeredPool({
|
|
1335
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1336
|
+
arguments: { self: pool.address },
|
|
1337
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1338
|
+
}),
|
|
1339
|
+
);
|
|
1270
1340
|
};
|
|
1271
1341
|
|
|
1272
1342
|
/**
|
|
@@ -1281,15 +1351,16 @@ export class DeepBookContract {
|
|
|
1281
1351
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1282
1352
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1283
1353
|
|
|
1284
|
-
return tx.
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1354
|
+
return tx.add(
|
|
1355
|
+
poolMoveCalls.getQuoteQuantityOutInputFee({
|
|
1356
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1357
|
+
arguments: {
|
|
1358
|
+
self: pool.address,
|
|
1359
|
+
baseQuantity: convertQuantity(baseQuantity, baseCoin.scalar),
|
|
1360
|
+
},
|
|
1361
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1362
|
+
}),
|
|
1363
|
+
);
|
|
1293
1364
|
};
|
|
1294
1365
|
|
|
1295
1366
|
/**
|
|
@@ -1304,15 +1375,16 @@ export class DeepBookContract {
|
|
|
1304
1375
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1305
1376
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1306
1377
|
|
|
1307
|
-
return tx.
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1378
|
+
return tx.add(
|
|
1379
|
+
poolMoveCalls.getBaseQuantityOutInputFee({
|
|
1380
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1381
|
+
arguments: {
|
|
1382
|
+
self: pool.address,
|
|
1383
|
+
quoteQuantity: convertQuantity(quoteQuantity, quoteCoin.scalar),
|
|
1384
|
+
},
|
|
1385
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1386
|
+
}),
|
|
1387
|
+
);
|
|
1316
1388
|
};
|
|
1317
1389
|
|
|
1318
1390
|
/**
|
|
@@ -1329,16 +1401,17 @@ export class DeepBookContract {
|
|
|
1329
1401
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1330
1402
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1331
1403
|
|
|
1332
|
-
return tx.
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1404
|
+
return tx.add(
|
|
1405
|
+
poolMoveCalls.getQuantityOutInputFee({
|
|
1406
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1407
|
+
arguments: {
|
|
1408
|
+
self: pool.address,
|
|
1409
|
+
baseQuantity: convertQuantity(baseQuantity, baseCoin.scalar),
|
|
1410
|
+
quoteQuantity: convertQuantity(quoteQuantity, quoteCoin.scalar),
|
|
1411
|
+
},
|
|
1412
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1413
|
+
}),
|
|
1414
|
+
);
|
|
1342
1415
|
};
|
|
1343
1416
|
|
|
1344
1417
|
/**
|
|
@@ -1355,16 +1428,17 @@ export class DeepBookContract {
|
|
|
1355
1428
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1356
1429
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1357
1430
|
|
|
1358
|
-
return tx.
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1431
|
+
return tx.add(
|
|
1432
|
+
poolMoveCalls.getBaseQuantityIn({
|
|
1433
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1434
|
+
arguments: {
|
|
1435
|
+
self: pool.address,
|
|
1436
|
+
targetQuoteQuantity: convertQuantity(targetQuoteQuantity, quoteCoin.scalar),
|
|
1437
|
+
payWithDeep,
|
|
1438
|
+
},
|
|
1439
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1440
|
+
}),
|
|
1441
|
+
);
|
|
1368
1442
|
};
|
|
1369
1443
|
|
|
1370
1444
|
/**
|
|
@@ -1381,16 +1455,17 @@ export class DeepBookContract {
|
|
|
1381
1455
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1382
1456
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1383
1457
|
|
|
1384
|
-
return tx.
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1458
|
+
return tx.add(
|
|
1459
|
+
poolMoveCalls.getQuoteQuantityIn({
|
|
1460
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1461
|
+
arguments: {
|
|
1462
|
+
self: pool.address,
|
|
1463
|
+
targetBaseQuantity: convertQuantity(targetBaseQuantity, baseCoin.scalar),
|
|
1464
|
+
payWithDeep,
|
|
1465
|
+
},
|
|
1466
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1467
|
+
}),
|
|
1468
|
+
);
|
|
1394
1469
|
};
|
|
1395
1470
|
|
|
1396
1471
|
/**
|
|
@@ -1405,11 +1480,13 @@ export class DeepBookContract {
|
|
|
1405
1480
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1406
1481
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1407
1482
|
|
|
1408
|
-
return tx.
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1483
|
+
return tx.add(
|
|
1484
|
+
poolMoveCalls.getAccountOrderDetails({
|
|
1485
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1486
|
+
arguments: { self: pool.address, balanceManager: manager.address },
|
|
1487
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1488
|
+
}),
|
|
1489
|
+
);
|
|
1413
1490
|
};
|
|
1414
1491
|
|
|
1415
1492
|
/**
|
|
@@ -1428,11 +1505,13 @@ export class DeepBookContract {
|
|
|
1428
1505
|
const inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);
|
|
1429
1506
|
const inputQuantity = convertQuantity(baseQuantity, baseCoin.scalar);
|
|
1430
1507
|
|
|
1431
|
-
return tx.
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1508
|
+
return tx.add(
|
|
1509
|
+
poolMoveCalls.getOrderDeepRequired({
|
|
1510
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1511
|
+
arguments: { self: pool.address, baseQuantity: inputQuantity, price: inputPrice },
|
|
1512
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1513
|
+
}),
|
|
1514
|
+
);
|
|
1436
1515
|
};
|
|
1437
1516
|
|
|
1438
1517
|
/**
|
|
@@ -1447,11 +1526,13 @@ export class DeepBookContract {
|
|
|
1447
1526
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1448
1527
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1449
1528
|
|
|
1450
|
-
return tx.
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1529
|
+
return tx.add(
|
|
1530
|
+
poolMoveCalls.accountExists({
|
|
1531
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1532
|
+
arguments: { self: pool.address, balanceManager: manager.address },
|
|
1533
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1534
|
+
}),
|
|
1535
|
+
);
|
|
1455
1536
|
};
|
|
1456
1537
|
|
|
1457
1538
|
/**
|
|
@@ -1464,11 +1545,13 @@ export class DeepBookContract {
|
|
|
1464
1545
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1465
1546
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1466
1547
|
|
|
1467
|
-
return tx.
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1548
|
+
return tx.add(
|
|
1549
|
+
poolMoveCalls.poolTradeParamsNext({
|
|
1550
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1551
|
+
arguments: { self: pool.address },
|
|
1552
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1553
|
+
}),
|
|
1554
|
+
);
|
|
1472
1555
|
};
|
|
1473
1556
|
|
|
1474
1557
|
/**
|
|
@@ -1481,11 +1564,13 @@ export class DeepBookContract {
|
|
|
1481
1564
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1482
1565
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1483
1566
|
|
|
1484
|
-
return tx.
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1567
|
+
return tx.add(
|
|
1568
|
+
poolMoveCalls.quorum({
|
|
1569
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1570
|
+
arguments: { self: pool.address },
|
|
1571
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1572
|
+
}),
|
|
1573
|
+
);
|
|
1489
1574
|
};
|
|
1490
1575
|
|
|
1491
1576
|
/**
|
|
@@ -1498,11 +1583,13 @@ export class DeepBookContract {
|
|
|
1498
1583
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
1499
1584
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1500
1585
|
|
|
1501
|
-
return tx.
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1586
|
+
return tx.add(
|
|
1587
|
+
poolMoveCalls.id({
|
|
1588
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1589
|
+
arguments: { self: pool.address },
|
|
1590
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1591
|
+
}),
|
|
1592
|
+
);
|
|
1506
1593
|
};
|
|
1507
1594
|
|
|
1508
1595
|
/**
|
|
@@ -1521,20 +1608,21 @@ export class DeepBookContract {
|
|
|
1521
1608
|
const inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);
|
|
1522
1609
|
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
1523
1610
|
|
|
1524
|
-
return tx.
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1611
|
+
return tx.add(
|
|
1612
|
+
poolMoveCalls.canPlaceLimitOrder({
|
|
1613
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1614
|
+
arguments: {
|
|
1615
|
+
self: pool.address,
|
|
1616
|
+
balanceManager: manager.address,
|
|
1617
|
+
price: inputPrice,
|
|
1618
|
+
quantity: inputQuantity,
|
|
1619
|
+
isBid,
|
|
1620
|
+
payWithDeep,
|
|
1621
|
+
expireTimestamp,
|
|
1622
|
+
},
|
|
1623
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1624
|
+
}),
|
|
1625
|
+
);
|
|
1538
1626
|
};
|
|
1539
1627
|
|
|
1540
1628
|
/**
|
|
@@ -1551,18 +1639,19 @@ export class DeepBookContract {
|
|
|
1551
1639
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1552
1640
|
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
1553
1641
|
|
|
1554
|
-
return tx.
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1642
|
+
return tx.add(
|
|
1643
|
+
poolMoveCalls.canPlaceMarketOrder({
|
|
1644
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1645
|
+
arguments: {
|
|
1646
|
+
self: pool.address,
|
|
1647
|
+
balanceManager: manager.address,
|
|
1648
|
+
quantity: inputQuantity,
|
|
1649
|
+
isBid,
|
|
1650
|
+
payWithDeep,
|
|
1651
|
+
},
|
|
1652
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1653
|
+
}),
|
|
1654
|
+
);
|
|
1566
1655
|
};
|
|
1567
1656
|
|
|
1568
1657
|
/**
|
|
@@ -1577,11 +1666,13 @@ export class DeepBookContract {
|
|
|
1577
1666
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
1578
1667
|
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
1579
1668
|
|
|
1580
|
-
return tx.
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1669
|
+
return tx.add(
|
|
1670
|
+
poolMoveCalls.checkMarketOrderParams({
|
|
1671
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1672
|
+
arguments: { self: pool.address, quantity: inputQuantity },
|
|
1673
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1674
|
+
}),
|
|
1675
|
+
);
|
|
1585
1676
|
};
|
|
1586
1677
|
|
|
1587
1678
|
/**
|
|
@@ -1601,16 +1692,17 @@ export class DeepBookContract {
|
|
|
1601
1692
|
const inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);
|
|
1602
1693
|
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
1603
1694
|
|
|
1604
|
-
return tx.
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1695
|
+
return tx.add(
|
|
1696
|
+
poolMoveCalls.checkLimitOrderParams({
|
|
1697
|
+
package: this.#config.DEEPBOOK_PACKAGE_ID,
|
|
1698
|
+
arguments: {
|
|
1699
|
+
self: pool.address,
|
|
1700
|
+
price: inputPrice,
|
|
1701
|
+
quantity: inputQuantity,
|
|
1702
|
+
expireTimestamp,
|
|
1703
|
+
},
|
|
1704
|
+
typeArguments: [baseCoin.type, quoteCoin.type],
|
|
1705
|
+
}),
|
|
1706
|
+
);
|
|
1615
1707
|
};
|
|
1616
1708
|
}
|