@mysten/deepbook-v3 0.0.0-experimental-20240730220552

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +201 -0
  3. package/README.md +1 -0
  4. package/dist/cjs/client.d.ts +177 -0
  5. package/dist/cjs/client.js +387 -0
  6. package/dist/cjs/client.js.map +7 -0
  7. package/dist/cjs/index.d.ts +7 -0
  8. package/dist/cjs/index.js +37 -0
  9. package/dist/cjs/index.js.map +7 -0
  10. package/dist/cjs/package.json +4 -0
  11. package/dist/cjs/transactions/balanceManager.d.ts +80 -0
  12. package/dist/cjs/transactions/balanceManager.js +185 -0
  13. package/dist/cjs/transactions/balanceManager.js.map +7 -0
  14. package/dist/cjs/transactions/deepbook.d.ts +183 -0
  15. package/dist/cjs/transactions/deepbook.js +545 -0
  16. package/dist/cjs/transactions/deepbook.js.map +7 -0
  17. package/dist/cjs/transactions/deepbookAdmin.d.ts +43 -0
  18. package/dist/cjs/transactions/deepbookAdmin.js +159 -0
  19. package/dist/cjs/transactions/deepbookAdmin.js.map +7 -0
  20. package/dist/cjs/transactions/flashLoans.d.ts +56 -0
  21. package/dist/cjs/transactions/flashLoans.js +122 -0
  22. package/dist/cjs/transactions/flashLoans.js.map +7 -0
  23. package/dist/cjs/transactions/governance.d.ts +42 -0
  24. package/dist/cjs/transactions/governance.js +131 -0
  25. package/dist/cjs/transactions/governance.js.map +7 -0
  26. package/dist/cjs/types/index.d.ts +80 -0
  27. package/dist/cjs/types/index.js +38 -0
  28. package/dist/cjs/types/index.js.map +7 -0
  29. package/dist/cjs/utils/config.d.ts +38 -0
  30. package/dist/cjs/utils/config.js +103 -0
  31. package/dist/cjs/utils/config.js.map +7 -0
  32. package/dist/cjs/utils/constants.d.ts +22 -0
  33. package/dist/cjs/utils/constants.js +117 -0
  34. package/dist/cjs/utils/constants.js.map +7 -0
  35. package/dist/esm/client.d.ts +177 -0
  36. package/dist/esm/client.js +367 -0
  37. package/dist/esm/client.js.map +7 -0
  38. package/dist/esm/index.d.ts +7 -0
  39. package/dist/esm/index.js +17 -0
  40. package/dist/esm/index.js.map +7 -0
  41. package/dist/esm/package.json +4 -0
  42. package/dist/esm/transactions/balanceManager.d.ts +80 -0
  43. package/dist/esm/transactions/balanceManager.js +165 -0
  44. package/dist/esm/transactions/balanceManager.js.map +7 -0
  45. package/dist/esm/transactions/deepbook.d.ts +183 -0
  46. package/dist/esm/transactions/deepbook.js +525 -0
  47. package/dist/esm/transactions/deepbook.js.map +7 -0
  48. package/dist/esm/transactions/deepbookAdmin.d.ts +43 -0
  49. package/dist/esm/transactions/deepbookAdmin.js +139 -0
  50. package/dist/esm/transactions/deepbookAdmin.js.map +7 -0
  51. package/dist/esm/transactions/flashLoans.d.ts +56 -0
  52. package/dist/esm/transactions/flashLoans.js +102 -0
  53. package/dist/esm/transactions/flashLoans.js.map +7 -0
  54. package/dist/esm/transactions/governance.d.ts +42 -0
  55. package/dist/esm/transactions/governance.js +111 -0
  56. package/dist/esm/transactions/governance.js.map +7 -0
  57. package/dist/esm/types/index.d.ts +80 -0
  58. package/dist/esm/types/index.js +18 -0
  59. package/dist/esm/types/index.js.map +7 -0
  60. package/dist/esm/utils/config.d.ts +38 -0
  61. package/dist/esm/utils/config.js +90 -0
  62. package/dist/esm/utils/config.js.map +7 -0
  63. package/dist/esm/utils/constants.d.ts +22 -0
  64. package/dist/esm/utils/constants.js +97 -0
  65. package/dist/esm/utils/constants.js.map +7 -0
  66. package/dist/tsconfig.esm.tsbuildinfo +1 -0
  67. package/dist/tsconfig.tsbuildinfo +1 -0
  68. package/package.json +52 -0
  69. package/src/client.ts +429 -0
  70. package/src/index.ts +10 -0
  71. package/src/transactions/balanceManager.ts +182 -0
  72. package/src/transactions/deepbook.ts +587 -0
  73. package/src/transactions/deepbookAdmin.ts +140 -0
  74. package/src/transactions/flashLoans.ts +121 -0
  75. package/src/transactions/governance.ts +119 -0
  76. package/src/types/index.ts +98 -0
  77. package/src/utils/config.ts +103 -0
  78. package/src/utils/constants.ts +106 -0
@@ -0,0 +1,367 @@
1
+ var __typeError = (msg) => {
2
+ throw TypeError(msg);
3
+ };
4
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
+ var _config, _address;
9
+ import { bcs } from "@mysten/sui/bcs";
10
+ import { Transaction } from "@mysten/sui/transactions";
11
+ import { normalizeSuiAddress } from "@mysten/sui/utils";
12
+ import { BalanceManagerContract } from "./transactions/balanceManager.js";
13
+ import { DeepBookContract } from "./transactions/deepbook.js";
14
+ import { DeepBookAdminContract } from "./transactions/deepbookAdmin.js";
15
+ import { FlashLoanContract } from "./transactions/flashLoans.js";
16
+ import { GovernanceContract } from "./transactions/governance.js";
17
+ import { DEEP_SCALAR, DeepBookConfig, FLOAT_SCALAR } from "./utils/config.js";
18
+ class DeepBookClient {
19
+ /**
20
+ * @param {SuiClient} client SuiClient instance
21
+ * @param {string} address Address of the client
22
+ * @param {Environment} env Environment configuration
23
+ * @param {Object.<string, BalanceManager>} [balanceManagers] Optional initial BalanceManager map
24
+ * @param {CoinMap} [coins] Optional initial CoinMap
25
+ * @param {PoolMap} [pools] Optional initial PoolMap
26
+ * @param {string} [adminCap] Optional admin capability
27
+ */
28
+ constructor({
29
+ client,
30
+ address,
31
+ env,
32
+ balanceManagers,
33
+ coins,
34
+ pools,
35
+ adminCap
36
+ }) {
37
+ __privateAdd(this, _config);
38
+ __privateAdd(this, _address);
39
+ this.client = client;
40
+ __privateSet(this, _address, normalizeSuiAddress(address));
41
+ __privateSet(this, _config, new DeepBookConfig({
42
+ address: __privateGet(this, _address),
43
+ env,
44
+ balanceManagers,
45
+ coins,
46
+ pools,
47
+ adminCap
48
+ }));
49
+ this.balanceManager = new BalanceManagerContract(__privateGet(this, _config));
50
+ this.deepBook = new DeepBookContract(__privateGet(this, _config));
51
+ this.deepBookAdmin = new DeepBookAdminContract(__privateGet(this, _config));
52
+ this.flashLoans = new FlashLoanContract(__privateGet(this, _config));
53
+ this.governance = new GovernanceContract(__privateGet(this, _config));
54
+ }
55
+ /**
56
+ * @description Check the balance of a balance manager for a specific coin
57
+ * @param {string} managerKey Key of the balance manager
58
+ * @param {string} coinKey Key of the coin
59
+ * @returns {Promise<{ coinType: string, balance: number }>} An object with coin type and balance
60
+ */
61
+ async checkManagerBalance(managerKey, coinKey) {
62
+ const tx = new Transaction();
63
+ const coin = __privateGet(this, _config).getCoin(coinKey);
64
+ tx.add(this.balanceManager.checkManagerBalance(managerKey, coinKey));
65
+ const res = await this.client.devInspectTransactionBlock({
66
+ sender: __privateGet(this, _address),
67
+ transactionBlock: tx
68
+ });
69
+ const bytes = res.results[0].returnValues[0][0];
70
+ const parsed_balance = bcs.U64.parse(new Uint8Array(bytes));
71
+ const balanceNumber = Number(parsed_balance);
72
+ const adjusted_balance = balanceNumber / coin.scalar;
73
+ return {
74
+ coinType: coin.type,
75
+ balance: adjusted_balance
76
+ };
77
+ }
78
+ /**
79
+ * @description Check if a pool is whitelisted
80
+ * @param {string} poolKey Key of the pool
81
+ * @returns {Promise<boolean>} Boolean indicating if the pool is whitelisted
82
+ */
83
+ async whitelisted(poolKey) {
84
+ const tx = new Transaction();
85
+ tx.add(this.deepBook.whitelisted(poolKey));
86
+ const res = await this.client.devInspectTransactionBlock({
87
+ sender: normalizeSuiAddress(__privateGet(this, _address)),
88
+ transactionBlock: tx
89
+ });
90
+ const bytes = res.results[0].returnValues[0][0];
91
+ const whitelisted = bcs.Bool.parse(new Uint8Array(bytes));
92
+ return whitelisted;
93
+ }
94
+ /**
95
+ * @description Get the quote quantity out for a given base quantity
96
+ * @param {string} poolKey Key of the pool
97
+ * @param {number} baseQuantity Base quantity to convert
98
+ * @returns {Promise<{ baseQuantity: number, baseOut: number, quoteOut: number, deepRequired: number }>}
99
+ * An object with base quantity, base out, quote out, and deep required for the dry run
100
+ */
101
+ async getQuoteQuantityOut(poolKey, baseQuantity) {
102
+ const tx = new Transaction();
103
+ const pool = __privateGet(this, _config).getPool(poolKey);
104
+ const baseScalar = __privateGet(this, _config).getCoin(pool.baseCoin).scalar;
105
+ const quoteScalar = __privateGet(this, _config).getCoin(pool.quoteCoin).scalar;
106
+ tx.add(this.deepBook.getQuoteQuantityOut(poolKey, baseQuantity));
107
+ const res = await this.client.devInspectTransactionBlock({
108
+ sender: normalizeSuiAddress(__privateGet(this, _address)),
109
+ transactionBlock: tx
110
+ });
111
+ const baseOut = Number(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[0][0])));
112
+ const quoteOut = Number(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[1][0])));
113
+ const deepRequired = Number(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[2][0])));
114
+ return {
115
+ baseQuantity,
116
+ baseOut: baseOut / baseScalar,
117
+ quoteOut: quoteOut / quoteScalar,
118
+ deepRequired: deepRequired / DEEP_SCALAR
119
+ };
120
+ }
121
+ /**
122
+ * @description Get the base quantity out for a given quote quantity
123
+ * @param {string} poolKey Key of the pool
124
+ * @param {number} quoteQuantity Quote quantity to convert
125
+ * @returns {Promise<{ quoteQuantity: number, baseOut: number, quoteOut: number, deepRequired: number }>}
126
+ * An object with quote quantity, base out, quote out, and deep required for the dry run
127
+ */
128
+ async getBaseQuantityOut(poolKey, quoteQuantity) {
129
+ const tx = new Transaction();
130
+ const pool = __privateGet(this, _config).getPool(poolKey);
131
+ const baseScalar = __privateGet(this, _config).getCoin(pool.baseCoin).scalar;
132
+ const quoteScalar = __privateGet(this, _config).getCoin(pool.quoteCoin).scalar;
133
+ tx.add(this.deepBook.getBaseQuantityOut(poolKey, quoteQuantity));
134
+ const res = await this.client.devInspectTransactionBlock({
135
+ sender: normalizeSuiAddress(__privateGet(this, _address)),
136
+ transactionBlock: tx
137
+ });
138
+ const baseOut = Number(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[0][0])));
139
+ const quoteOut = Number(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[1][0])));
140
+ const deepRequired = Number(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[2][0])));
141
+ return {
142
+ quoteQuantity,
143
+ baseOut: baseOut / baseScalar,
144
+ quoteOut: quoteOut / quoteScalar,
145
+ deepRequired: deepRequired / DEEP_SCALAR
146
+ };
147
+ }
148
+ /**
149
+ * @description Get the output quantities for given base and quote quantities. Only one quantity can be non-zero
150
+ * @param {string} poolKey Key of the pool
151
+ * @param {number} baseQuantity Base quantity to convert
152
+ * @param {number} quoteQuantity Quote quantity to convert
153
+ * @returns {Promise<{ baseQuantity: number, quoteQuantity: number, baseOut: number, quoteOut: number, deepRequired: number }>}
154
+ * An object with base quantity, quote quantity, base out, quote out, and deep required for the dry run
155
+ */
156
+ async getQuantityOut(poolKey, baseQuantity, quoteQuantity) {
157
+ const tx = new Transaction();
158
+ const pool = __privateGet(this, _config).getPool(poolKey);
159
+ const baseScalar = __privateGet(this, _config).getCoin(pool.baseCoin).scalar;
160
+ const quoteScalar = __privateGet(this, _config).getCoin(pool.quoteCoin).scalar;
161
+ tx.add(this.deepBook.getQuantityOut(poolKey, baseQuantity, quoteQuantity));
162
+ const res = await this.client.devInspectTransactionBlock({
163
+ sender: normalizeSuiAddress(__privateGet(this, _address)),
164
+ transactionBlock: tx
165
+ });
166
+ const baseOut = Number(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[0][0])));
167
+ const quoteOut = Number(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[1][0])));
168
+ const deepRequired = Number(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[2][0])));
169
+ return {
170
+ baseQuantity,
171
+ quoteQuantity,
172
+ baseOut: baseOut / baseScalar,
173
+ quoteOut: quoteOut / quoteScalar,
174
+ deepRequired: deepRequired / DEEP_SCALAR
175
+ };
176
+ }
177
+ /**
178
+ * @description Get open orders for a balance manager in a pool
179
+ * @param {string} poolKey Key of the pool
180
+ * @param {string} managerKey Key of the balance manager
181
+ * @returns {Promise<Array>} An array of open order IDs
182
+ */
183
+ async accountOpenOrders(poolKey, managerKey) {
184
+ const tx = new Transaction();
185
+ tx.add(this.deepBook.accountOpenOrders(poolKey, managerKey));
186
+ const res = await this.client.devInspectTransactionBlock({
187
+ sender: normalizeSuiAddress(__privateGet(this, _address)),
188
+ transactionBlock: tx
189
+ });
190
+ const order_ids = res.results[0].returnValues[0][0];
191
+ const VecSet = bcs.struct("VecSet", {
192
+ constants: bcs.vector(bcs.U128)
193
+ });
194
+ return VecSet.parse(new Uint8Array(order_ids)).constants;
195
+ }
196
+ /**
197
+ * @description Get the order information for a specific order in a pool
198
+ * @param {string} poolKey Key of the pool
199
+ * @param {string} orderId Order ID
200
+ * @returns {Promise<Object>} A promise that resolves to an object containing the order information
201
+ */
202
+ async getOrder(poolKey, orderId) {
203
+ const tx = new Transaction();
204
+ tx.add(this.deepBook.getOrder(poolKey, orderId));
205
+ const res = await this.client.devInspectTransactionBlock({
206
+ sender: normalizeSuiAddress(__privateGet(this, _address)),
207
+ transactionBlock: tx
208
+ });
209
+ const ID = bcs.struct("ID", {
210
+ bytes: bcs.Address
211
+ });
212
+ const OrderDeepPrice = bcs.struct("OrderDeepPrice", {
213
+ asset_is_base: bcs.bool(),
214
+ deep_per_asset: bcs.u64()
215
+ });
216
+ const Order = bcs.struct("Order", {
217
+ balance_manager_id: ID,
218
+ order_id: bcs.u128(),
219
+ client_order_id: bcs.u64(),
220
+ quantity: bcs.u64(),
221
+ filled_quantity: bcs.u64(),
222
+ fee_is_deep: bcs.bool(),
223
+ order_deep_price: OrderDeepPrice,
224
+ epoch: bcs.u64(),
225
+ status: bcs.u8(),
226
+ expire_timestamp: bcs.u64()
227
+ });
228
+ const orderInformation = res.results[0].returnValues[0][0];
229
+ return Order.parse(new Uint8Array(orderInformation));
230
+ }
231
+ /**
232
+ * @description Get level 2 order book specifying range of price
233
+ * @param {string} poolKey Key of the pool
234
+ * @param {number} priceLow Lower bound of the price range
235
+ * @param {number} priceHigh Upper bound of the price range
236
+ * @param {boolean} isBid Whether to get bid or ask orders
237
+ * @returns {Promise<{ prices: Array<number>, quantities: Array<number> }>}
238
+ * An object with arrays of prices and quantities
239
+ */
240
+ async getLevel2Range(poolKey, priceLow, priceHigh, isBid) {
241
+ const tx = new Transaction();
242
+ const pool = __privateGet(this, _config).getPool(poolKey);
243
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
244
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
245
+ tx.add(this.deepBook.getLevel2Range(poolKey, priceLow, priceHigh, isBid));
246
+ const res = await this.client.devInspectTransactionBlock({
247
+ sender: normalizeSuiAddress(__privateGet(this, _address)),
248
+ transactionBlock: tx
249
+ });
250
+ const prices = res.results[0].returnValues[0][0];
251
+ const parsed_prices = bcs.vector(bcs.u64()).parse(new Uint8Array(prices));
252
+ const quantities = res.results[0].returnValues[1][0];
253
+ const parsed_quantities = bcs.vector(bcs.u64()).parse(new Uint8Array(quantities));
254
+ return {
255
+ prices: parsed_prices.map(
256
+ (price) => Number(price) / FLOAT_SCALAR / quoteCoin.scalar * baseCoin.scalar
257
+ ),
258
+ quantities: parsed_quantities.map((price) => Number(price) / baseCoin.scalar)
259
+ };
260
+ }
261
+ /**
262
+ * @description Get level 2 order book ticks from mid-price for a pool
263
+ * @param {string} poolKey Key of the pool
264
+ * @param {number} ticks Number of ticks from mid-price
265
+ * @returns {Promise<{ bid_prices: Array<number>, bid_quantities: Array<number>, ask_prices: Array<number>, ask_quantities: Array<number> }>}
266
+ * An object with arrays of prices and quantities
267
+ */
268
+ async getLevel2TicksFromMid(poolKey, ticks) {
269
+ const tx = new Transaction();
270
+ const pool = __privateGet(this, _config).getPool(poolKey);
271
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
272
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
273
+ tx.add(this.deepBook.getLevel2TicksFromMid(poolKey, ticks));
274
+ const res = await this.client.devInspectTransactionBlock({
275
+ sender: normalizeSuiAddress(__privateGet(this, _address)),
276
+ transactionBlock: tx
277
+ });
278
+ const bid_prices = res.results[0].returnValues[0][0];
279
+ const bid_parsed_prices = bcs.vector(bcs.u64()).parse(new Uint8Array(bid_prices));
280
+ const bid_quantities = res.results[0].returnValues[1][0];
281
+ const bid_parsed_quantities = bcs.vector(bcs.u64()).parse(new Uint8Array(bid_quantities));
282
+ const ask_prices = res.results[0].returnValues[2][0];
283
+ const ask_parsed_prices = bcs.vector(bcs.u64()).parse(new Uint8Array(ask_prices));
284
+ const ask_quantities = res.results[0].returnValues[3][0];
285
+ const ask_parsed_quantities = bcs.vector(bcs.u64()).parse(new Uint8Array(ask_quantities));
286
+ return {
287
+ bid_prices: bid_parsed_prices.map(
288
+ (price) => Number(price) / FLOAT_SCALAR / quoteCoin.scalar * baseCoin.scalar
289
+ ),
290
+ bid_quantities: bid_parsed_quantities.map((quantity) => Number(quantity) / baseCoin.scalar),
291
+ ask_prices: ask_parsed_prices.map(
292
+ (price) => Number(price) / FLOAT_SCALAR / quoteCoin.scalar * baseCoin.scalar
293
+ ),
294
+ ask_quantities: ask_parsed_quantities.map((quantity) => Number(quantity) / baseCoin.scalar)
295
+ };
296
+ }
297
+ /**
298
+ * @description Get the vault balances for a pool
299
+ * @param {string} poolKey Key of the pool
300
+ * @returns {Promise<{ base: number, quote: number, deep: number }>}
301
+ * An object with base, quote, and deep balances in the vault
302
+ */
303
+ async vaultBalances(poolKey) {
304
+ const tx = new Transaction();
305
+ const pool = __privateGet(this, _config).getPool(poolKey);
306
+ const baseScalar = __privateGet(this, _config).getCoin(pool.baseCoin).scalar;
307
+ const quoteScalar = __privateGet(this, _config).getCoin(pool.quoteCoin).scalar;
308
+ tx.add(this.deepBook.vaultBalances(poolKey));
309
+ const res = await this.client.devInspectTransactionBlock({
310
+ sender: normalizeSuiAddress(__privateGet(this, _address)),
311
+ transactionBlock: tx
312
+ });
313
+ const baseInVault = Number(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[0][0])));
314
+ const quoteInVault = Number(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[1][0])));
315
+ const deepInVault = Number(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[2][0])));
316
+ return {
317
+ base: baseInVault / baseScalar,
318
+ quote: quoteInVault / quoteScalar,
319
+ deep: deepInVault / DEEP_SCALAR
320
+ };
321
+ }
322
+ /**
323
+ * @description Get the pool ID by asset types
324
+ * @param {string} baseType Type of the base asset
325
+ * @param {string} quoteType Type of the quote asset
326
+ * @returns {Promise<string>} The address of the pool
327
+ */
328
+ async getPoolIdByAssets(baseType, quoteType) {
329
+ const tx = new Transaction();
330
+ tx.add(this.deepBook.getPoolIdByAssets(baseType, quoteType));
331
+ const res = await this.client.devInspectTransactionBlock({
332
+ sender: normalizeSuiAddress(__privateGet(this, _address)),
333
+ transactionBlock: tx
334
+ });
335
+ const ID = bcs.struct("ID", {
336
+ bytes: bcs.Address
337
+ });
338
+ const address = ID.parse(new Uint8Array(res.results[0].returnValues[0][0]))["bytes"];
339
+ return address;
340
+ }
341
+ /**
342
+ * @description Get the mid price for a pool
343
+ * @param {string} poolKey Key of the pool
344
+ * @returns {Promise<number>} The mid price
345
+ */
346
+ async midPrice(poolKey) {
347
+ const tx = new Transaction();
348
+ const pool = __privateGet(this, _config).getPool(poolKey);
349
+ tx.add(this.deepBook.midPrice(poolKey));
350
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
351
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
352
+ const res = await this.client.devInspectTransactionBlock({
353
+ sender: normalizeSuiAddress(__privateGet(this, _address)),
354
+ transactionBlock: tx
355
+ });
356
+ const bytes = res.results[0].returnValues[0][0];
357
+ const parsed_mid_price = Number(bcs.U64.parse(new Uint8Array(bytes)));
358
+ const adjusted_mid_price = parsed_mid_price * baseCoin.scalar / quoteCoin.scalar / FLOAT_SCALAR;
359
+ return adjusted_mid_price;
360
+ }
361
+ }
362
+ _config = new WeakMap();
363
+ _address = new WeakMap();
364
+ export {
365
+ DeepBookClient
366
+ };
367
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/client.ts"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport { bcs } from '@mysten/sui/bcs';\nimport type { SuiClient } from '@mysten/sui/client';\nimport { Transaction } from '@mysten/sui/transactions';\nimport { normalizeSuiAddress } from '@mysten/sui/utils';\n\nimport { BalanceManagerContract } from './transactions/balanceManager.js';\nimport { DeepBookContract } from './transactions/deepbook.js';\nimport { DeepBookAdminContract } from './transactions/deepbookAdmin.js';\nimport { FlashLoanContract } from './transactions/flashLoans.js';\nimport { GovernanceContract } from './transactions/governance.js';\nimport type { BalanceManager, Environment } from './types/index.js';\nimport { DEEP_SCALAR, DeepBookConfig, FLOAT_SCALAR } from './utils/config.js';\nimport type { CoinMap, PoolMap } from './utils/constants.js';\n\n/**\n * DeepBookClient class for managing DeepBook operations.\n */\nexport class DeepBookClient {\n\tclient: SuiClient;\n\t#config: DeepBookConfig;\n\t#address: string;\n\tbalanceManager: BalanceManagerContract;\n\tdeepBook: DeepBookContract;\n\tdeepBookAdmin: DeepBookAdminContract;\n\tflashLoans: FlashLoanContract;\n\tgovernance: GovernanceContract;\n\n\t/**\n\t * @param {SuiClient} client SuiClient instance\n\t * @param {string} address Address of the client\n\t * @param {Environment} env Environment configuration\n\t * @param {Object.<string, BalanceManager>} [balanceManagers] Optional initial BalanceManager map\n\t * @param {CoinMap} [coins] Optional initial CoinMap\n\t * @param {PoolMap} [pools] Optional initial PoolMap\n\t * @param {string} [adminCap] Optional admin capability\n\t */\n\tconstructor({\n\t\tclient,\n\t\taddress,\n\t\tenv,\n\t\tbalanceManagers,\n\t\tcoins,\n\t\tpools,\n\t\tadminCap,\n\t}: {\n\t\tclient: SuiClient;\n\t\taddress: string;\n\t\tenv: Environment;\n\t\tbalanceManagers?: { [key: string]: BalanceManager };\n\t\tcoins?: CoinMap;\n\t\tpools?: PoolMap;\n\t\tadminCap?: string;\n\t}) {\n\t\tthis.client = client;\n\t\tthis.#address = normalizeSuiAddress(address);\n\t\tthis.#config = new DeepBookConfig({\n\t\t\taddress: this.#address,\n\t\t\tenv,\n\t\t\tbalanceManagers,\n\t\t\tcoins,\n\t\t\tpools,\n\t\t\tadminCap,\n\t\t});\n\t\tthis.balanceManager = new BalanceManagerContract(this.#config);\n\t\tthis.deepBook = new DeepBookContract(this.#config);\n\t\tthis.deepBookAdmin = new DeepBookAdminContract(this.#config);\n\t\tthis.flashLoans = new FlashLoanContract(this.#config);\n\t\tthis.governance = new GovernanceContract(this.#config);\n\t}\n\n\t/**\n\t * @description Check the balance of a balance manager for a specific coin\n\t * @param {string} managerKey Key of the balance manager\n\t * @param {string} coinKey Key of the coin\n\t * @returns {Promise<{ coinType: string, balance: number }>} An object with coin type and balance\n\t */\n\tasync checkManagerBalance(managerKey: string, coinKey: string) {\n\t\tconst tx = new Transaction();\n\t\tconst coin = this.#config.getCoin(coinKey);\n\n\t\ttx.add(this.balanceManager.checkManagerBalance(managerKey, coinKey));\n\t\tconst res = await this.client.devInspectTransactionBlock({\n\t\t\tsender: this.#address,\n\t\t\ttransactionBlock: tx,\n\t\t});\n\n\t\tconst bytes = res.results![0].returnValues![0][0];\n\t\tconst parsed_balance = bcs.U64.parse(new Uint8Array(bytes));\n\t\tconst balanceNumber = Number(parsed_balance);\n\t\tconst adjusted_balance = balanceNumber / coin.scalar;\n\n\t\treturn {\n\t\t\tcoinType: coin.type,\n\t\t\tbalance: adjusted_balance,\n\t\t};\n\t}\n\n\t/**\n\t * @description Check if a pool is whitelisted\n\t * @param {string} poolKey Key of the pool\n\t * @returns {Promise<boolean>} Boolean indicating if the pool is whitelisted\n\t */\n\tasync whitelisted(poolKey: string) {\n\t\tconst tx = new Transaction();\n\n\t\ttx.add(this.deepBook.whitelisted(poolKey));\n\t\tconst res = await this.client.devInspectTransactionBlock({\n\t\t\tsender: normalizeSuiAddress(this.#address),\n\t\t\ttransactionBlock: tx,\n\t\t});\n\n\t\tconst bytes = res.results![0].returnValues![0][0];\n\t\tconst whitelisted = bcs.Bool.parse(new Uint8Array(bytes));\n\n\t\treturn whitelisted;\n\t}\n\n\t/**\n\t * @description Get the quote quantity out for a given base quantity\n\t * @param {string} poolKey Key of the pool\n\t * @param {number} baseQuantity Base quantity to convert\n\t * @returns {Promise<{ baseQuantity: number, baseOut: number, quoteOut: number, deepRequired: number }>}\n\t * An object with base quantity, base out, quote out, and deep required for the dry run\n\t */\n\tasync getQuoteQuantityOut(poolKey: string, baseQuantity: number) {\n\t\tconst tx = new Transaction();\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseScalar = this.#config.getCoin(pool.baseCoin).scalar;\n\t\tconst quoteScalar = this.#config.getCoin(pool.quoteCoin).scalar;\n\n\t\ttx.add(this.deepBook.getQuoteQuantityOut(poolKey, baseQuantity));\n\t\tconst res = await this.client.devInspectTransactionBlock({\n\t\t\tsender: normalizeSuiAddress(this.#address),\n\t\t\ttransactionBlock: tx,\n\t\t});\n\n\t\tconst baseOut = Number(bcs.U64.parse(new Uint8Array(res.results![0].returnValues![0][0])));\n\t\tconst quoteOut = Number(bcs.U64.parse(new Uint8Array(res.results![0].returnValues![1][0])));\n\t\tconst deepRequired = Number(bcs.U64.parse(new Uint8Array(res.results![0].returnValues![2][0])));\n\n\t\treturn {\n\t\t\tbaseQuantity,\n\t\t\tbaseOut: baseOut / baseScalar,\n\t\t\tquoteOut: quoteOut / quoteScalar,\n\t\t\tdeepRequired: deepRequired / DEEP_SCALAR,\n\t\t};\n\t}\n\n\t/**\n\t * @description Get the base quantity out for a given quote quantity\n\t * @param {string} poolKey Key of the pool\n\t * @param {number} quoteQuantity Quote quantity to convert\n\t * @returns {Promise<{ quoteQuantity: number, baseOut: number, quoteOut: number, deepRequired: number }>}\n\t * An object with quote quantity, base out, quote out, and deep required for the dry run\n\t */\n\tasync getBaseQuantityOut(poolKey: string, quoteQuantity: number) {\n\t\tconst tx = new Transaction();\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseScalar = this.#config.getCoin(pool.baseCoin).scalar;\n\t\tconst quoteScalar = this.#config.getCoin(pool.quoteCoin).scalar;\n\n\t\ttx.add(this.deepBook.getBaseQuantityOut(poolKey, quoteQuantity));\n\t\tconst res = await this.client.devInspectTransactionBlock({\n\t\t\tsender: normalizeSuiAddress(this.#address),\n\t\t\ttransactionBlock: tx,\n\t\t});\n\n\t\tconst baseOut = Number(bcs.U64.parse(new Uint8Array(res.results![0].returnValues![0][0])));\n\t\tconst quoteOut = Number(bcs.U64.parse(new Uint8Array(res.results![0].returnValues![1][0])));\n\t\tconst deepRequired = Number(bcs.U64.parse(new Uint8Array(res.results![0].returnValues![2][0])));\n\n\t\treturn {\n\t\t\tquoteQuantity: quoteQuantity,\n\t\t\tbaseOut: baseOut / baseScalar,\n\t\t\tquoteOut: quoteOut / quoteScalar,\n\t\t\tdeepRequired: deepRequired / DEEP_SCALAR,\n\t\t};\n\t}\n\n\t/**\n\t * @description Get the output quantities for given base and quote quantities. Only one quantity can be non-zero\n\t * @param {string} poolKey Key of the pool\n\t * @param {number} baseQuantity Base quantity to convert\n\t * @param {number} quoteQuantity Quote quantity to convert\n\t * @returns {Promise<{ baseQuantity: number, quoteQuantity: number, baseOut: number, quoteOut: number, deepRequired: number }>}\n\t * An object with base quantity, quote quantity, base out, quote out, and deep required for the dry run\n\t */\n\tasync getQuantityOut(poolKey: string, baseQuantity: number, quoteQuantity: number) {\n\t\tconst tx = new Transaction();\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseScalar = this.#config.getCoin(pool.baseCoin).scalar;\n\t\tconst quoteScalar = this.#config.getCoin(pool.quoteCoin).scalar;\n\n\t\ttx.add(this.deepBook.getQuantityOut(poolKey, baseQuantity, quoteQuantity));\n\t\tconst res = await this.client.devInspectTransactionBlock({\n\t\t\tsender: normalizeSuiAddress(this.#address),\n\t\t\ttransactionBlock: tx,\n\t\t});\n\n\t\tconst baseOut = Number(bcs.U64.parse(new Uint8Array(res.results![0].returnValues![0][0])));\n\t\tconst quoteOut = Number(bcs.U64.parse(new Uint8Array(res.results![0].returnValues![1][0])));\n\t\tconst deepRequired = Number(bcs.U64.parse(new Uint8Array(res.results![0].returnValues![2][0])));\n\n\t\treturn {\n\t\t\tbaseQuantity,\n\t\t\tquoteQuantity,\n\t\t\tbaseOut: baseOut / baseScalar,\n\t\t\tquoteOut: quoteOut / quoteScalar,\n\t\t\tdeepRequired: deepRequired / DEEP_SCALAR,\n\t\t};\n\t}\n\n\t/**\n\t * @description Get open orders for a balance manager in a pool\n\t * @param {string} poolKey Key of the pool\n\t * @param {string} managerKey Key of the balance manager\n\t * @returns {Promise<Array>} An array of open order IDs\n\t */\n\tasync accountOpenOrders(poolKey: string, managerKey: string) {\n\t\tconst tx = new Transaction();\n\n\t\ttx.add(this.deepBook.accountOpenOrders(poolKey, managerKey));\n\t\tconst res = await this.client.devInspectTransactionBlock({\n\t\t\tsender: normalizeSuiAddress(this.#address),\n\t\t\ttransactionBlock: tx,\n\t\t});\n\n\t\tconst order_ids = res.results![0].returnValues![0][0];\n\t\tconst VecSet = bcs.struct('VecSet', {\n\t\t\tconstants: bcs.vector(bcs.U128),\n\t\t});\n\n\t\treturn VecSet.parse(new Uint8Array(order_ids)).constants;\n\t}\n\n\t/**\n\t * @description Get the order information for a specific order in a pool\n\t * @param {string} poolKey Key of the pool\n\t * @param {string} orderId Order ID\n\t * @returns {Promise<Object>} A promise that resolves to an object containing the order information\n\t */\n\tasync getOrder(poolKey: string, orderId: string) {\n\t\tconst tx = new Transaction();\n\n\t\ttx.add(this.deepBook.getOrder(poolKey, orderId));\n\t\tconst res = await this.client.devInspectTransactionBlock({\n\t\t\tsender: normalizeSuiAddress(this.#address),\n\t\t\ttransactionBlock: tx,\n\t\t});\n\n\t\tconst ID = bcs.struct('ID', {\n\t\t\tbytes: bcs.Address,\n\t\t});\n\t\tconst OrderDeepPrice = bcs.struct('OrderDeepPrice', {\n\t\t\tasset_is_base: bcs.bool(),\n\t\t\tdeep_per_asset: bcs.u64(),\n\t\t});\n\t\tconst Order = bcs.struct('Order', {\n\t\t\tbalance_manager_id: ID,\n\t\t\torder_id: bcs.u128(),\n\t\t\tclient_order_id: bcs.u64(),\n\t\t\tquantity: bcs.u64(),\n\t\t\tfilled_quantity: bcs.u64(),\n\t\t\tfee_is_deep: bcs.bool(),\n\t\t\torder_deep_price: OrderDeepPrice,\n\t\t\tepoch: bcs.u64(),\n\t\t\tstatus: bcs.u8(),\n\t\t\texpire_timestamp: bcs.u64(),\n\t\t});\n\n\t\tconst orderInformation = res.results![0].returnValues![0][0];\n\t\treturn Order.parse(new Uint8Array(orderInformation));\n\t}\n\n\t/**\n\t * @description Get level 2 order book specifying range of price\n\t * @param {string} poolKey Key of the pool\n\t * @param {number} priceLow Lower bound of the price range\n\t * @param {number} priceHigh Upper bound of the price range\n\t * @param {boolean} isBid Whether to get bid or ask orders\n\t * @returns {Promise<{ prices: Array<number>, quantities: Array<number> }>}\n\t * An object with arrays of prices and quantities\n\t */\n\tasync getLevel2Range(poolKey: string, priceLow: number, priceHigh: number, isBid: boolean) {\n\t\tconst tx = new Transaction();\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.add(this.deepBook.getLevel2Range(poolKey, priceLow, priceHigh, isBid));\n\t\tconst res = await this.client.devInspectTransactionBlock({\n\t\t\tsender: normalizeSuiAddress(this.#address),\n\t\t\ttransactionBlock: tx,\n\t\t});\n\n\t\tconst prices = res.results![0].returnValues![0][0];\n\t\tconst parsed_prices = bcs.vector(bcs.u64()).parse(new Uint8Array(prices));\n\t\tconst quantities = res.results![0].returnValues![1][0];\n\t\tconst parsed_quantities = bcs.vector(bcs.u64()).parse(new Uint8Array(quantities));\n\n\t\treturn {\n\t\t\tprices: parsed_prices.map(\n\t\t\t\t(price) => (Number(price) / FLOAT_SCALAR / quoteCoin.scalar) * baseCoin.scalar,\n\t\t\t),\n\t\t\tquantities: parsed_quantities.map((price) => Number(price) / baseCoin.scalar),\n\t\t};\n\t}\n\n\t/**\n\t * @description Get level 2 order book ticks from mid-price for a pool\n\t * @param {string} poolKey Key of the pool\n\t * @param {number} ticks Number of ticks from mid-price\n\t * @returns {Promise<{ bid_prices: Array<number>, bid_quantities: Array<number>, ask_prices: Array<number>, ask_quantities: Array<number> }>}\n\t * An object with arrays of prices and quantities\n\t */\n\tasync getLevel2TicksFromMid(poolKey: string, ticks: number) {\n\t\tconst tx = new Transaction();\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.add(this.deepBook.getLevel2TicksFromMid(poolKey, ticks));\n\t\tconst res = await this.client.devInspectTransactionBlock({\n\t\t\tsender: normalizeSuiAddress(this.#address),\n\t\t\ttransactionBlock: tx,\n\t\t});\n\n\t\tconst bid_prices = res.results![0].returnValues![0][0];\n\t\tconst bid_parsed_prices = bcs.vector(bcs.u64()).parse(new Uint8Array(bid_prices));\n\t\tconst bid_quantities = res.results![0].returnValues![1][0];\n\t\tconst bid_parsed_quantities = bcs.vector(bcs.u64()).parse(new Uint8Array(bid_quantities));\n\n\t\tconst ask_prices = res.results![0].returnValues![2][0];\n\t\tconst ask_parsed_prices = bcs.vector(bcs.u64()).parse(new Uint8Array(ask_prices));\n\t\tconst ask_quantities = res.results![0].returnValues![3][0];\n\t\tconst ask_parsed_quantities = bcs.vector(bcs.u64()).parse(new Uint8Array(ask_quantities));\n\n\t\treturn {\n\t\t\tbid_prices: bid_parsed_prices.map(\n\t\t\t\t(price) => (Number(price) / FLOAT_SCALAR / quoteCoin.scalar) * baseCoin.scalar,\n\t\t\t),\n\t\t\tbid_quantities: bid_parsed_quantities.map((quantity) => Number(quantity) / baseCoin.scalar),\n\t\t\task_prices: ask_parsed_prices.map(\n\t\t\t\t(price) => (Number(price) / FLOAT_SCALAR / quoteCoin.scalar) * baseCoin.scalar,\n\t\t\t),\n\t\t\task_quantities: ask_parsed_quantities.map((quantity) => Number(quantity) / baseCoin.scalar),\n\t\t};\n\t}\n\n\t/**\n\t * @description Get the vault balances for a pool\n\t * @param {string} poolKey Key of the pool\n\t * @returns {Promise<{ base: number, quote: number, deep: number }>}\n\t * An object with base, quote, and deep balances in the vault\n\t */\n\tasync vaultBalances(poolKey: string) {\n\t\tconst tx = new Transaction();\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseScalar = this.#config.getCoin(pool.baseCoin).scalar;\n\t\tconst quoteScalar = this.#config.getCoin(pool.quoteCoin).scalar;\n\n\t\ttx.add(this.deepBook.vaultBalances(poolKey));\n\t\tconst res = await this.client.devInspectTransactionBlock({\n\t\t\tsender: normalizeSuiAddress(this.#address),\n\t\t\ttransactionBlock: tx,\n\t\t});\n\n\t\tconst baseInVault = Number(bcs.U64.parse(new Uint8Array(res.results![0].returnValues![0][0])));\n\t\tconst quoteInVault = Number(bcs.U64.parse(new Uint8Array(res.results![0].returnValues![1][0])));\n\t\tconst deepInVault = Number(bcs.U64.parse(new Uint8Array(res.results![0].returnValues![2][0])));\n\n\t\treturn {\n\t\t\tbase: baseInVault / baseScalar,\n\t\t\tquote: quoteInVault / quoteScalar,\n\t\t\tdeep: deepInVault / DEEP_SCALAR,\n\t\t};\n\t}\n\n\t/**\n\t * @description Get the pool ID by asset types\n\t * @param {string} baseType Type of the base asset\n\t * @param {string} quoteType Type of the quote asset\n\t * @returns {Promise<string>} The address of the pool\n\t */\n\tasync getPoolIdByAssets(baseType: string, quoteType: string) {\n\t\tconst tx = new Transaction();\n\t\ttx.add(this.deepBook.getPoolIdByAssets(baseType, quoteType));\n\n\t\tconst res = await this.client.devInspectTransactionBlock({\n\t\t\tsender: normalizeSuiAddress(this.#address),\n\t\t\ttransactionBlock: tx,\n\t\t});\n\n\t\tconst ID = bcs.struct('ID', {\n\t\t\tbytes: bcs.Address,\n\t\t});\n\t\tconst address = ID.parse(new Uint8Array(res.results![0].returnValues![0][0]))['bytes'];\n\n\t\treturn address;\n\t}\n\n\t/**\n\t * @description Get the mid price for a pool\n\t * @param {string} poolKey Key of the pool\n\t * @returns {Promise<number>} The mid price\n\t */\n\tasync midPrice(poolKey: string) {\n\t\tconst tx = new Transaction();\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\ttx.add(this.deepBook.midPrice(poolKey));\n\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\tconst res = await this.client.devInspectTransactionBlock({\n\t\t\tsender: normalizeSuiAddress(this.#address),\n\t\t\ttransactionBlock: tx,\n\t\t});\n\n\t\tconst bytes = res.results![0].returnValues![0][0];\n\t\tconst parsed_mid_price = Number(bcs.U64.parse(new Uint8Array(bytes)));\n\t\tconst adjusted_mid_price =\n\t\t\t(parsed_mid_price * baseCoin.scalar) / quoteCoin.scalar / FLOAT_SCALAR;\n\n\t\treturn adjusted_mid_price;\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;AAAA;AAEA,SAAS,WAAW;AAEpB,SAAS,mBAAmB;AAC5B,SAAS,2BAA2B;AAEpC,SAAS,8BAA8B;AACvC,SAAS,wBAAwB;AACjC,SAAS,6BAA6B;AACtC,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AAEnC,SAAS,aAAa,gBAAgB,oBAAoB;AAMnD,MA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A,EAOA,MAAM,SAAS,SAAiB;AAC/B,UAAM,KAAK,IAAI,YAAY;AAC3B,UAAM,OAAO,mBAAK,SAAQ,QAAQ,OAAO;AACzC,OAAG,IAAI,KAAK,SAAS,SAAS,OAAO,CAAC;AAEtC,UAAM,WAAW,mBAAK,SAAQ,QAAQ,KAAK,QAAQ;AACnD,UAAM,YAAY,mBAAK,SAAQ,QAAQ,KAAK,SAAS;AAErD,UAAM,MAAM,MAAM,KAAK,OAAO,2BAA2B;AAAA,MACxD,QAAQ,oBAAoB,mBAAK,SAAQ;AAAA,MACzC,kBAAkB;AAAA,IACnB,CAAC;AAED,UAAM,QAAQ,IAAI,QAAS,CAAC,EAAE,aAAc,CAAC,EAAE,CAAC;AAChD,UAAM,mBAAmB,OAAO,IAAI,IAAI,MAAM,IAAI,WAAW,KAAK,CAAC,CAAC;AACpE,UAAM,qBACJ,mBAAmB,SAAS,SAAU,UAAU,SAAS;AAE3D,WAAO;AAAA,EACR;AACD;AAvZC;AACA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ export { DeepBookClient } from './client.js';
2
+ export { BalanceManagerContract } from './transactions/balanceManager.js';
3
+ export { DeepBookContract } from './transactions/deepbook.js';
4
+ export { DeepBookAdminContract } from './transactions/deepbookAdmin.js';
5
+ export { FlashLoanContract } from './transactions/flashLoans.js';
6
+ export { GovernanceContract } from './transactions/governance.js';
7
+ export { DeepBookConfig } from './utils/config.js';
@@ -0,0 +1,17 @@
1
+ import { DeepBookClient } from "./client.js";
2
+ import { BalanceManagerContract } from "./transactions/balanceManager.js";
3
+ import { DeepBookContract } from "./transactions/deepbook.js";
4
+ import { DeepBookAdminContract } from "./transactions/deepbookAdmin.js";
5
+ import { FlashLoanContract } from "./transactions/flashLoans.js";
6
+ import { GovernanceContract } from "./transactions/governance.js";
7
+ import { DeepBookConfig } from "./utils/config.js";
8
+ export {
9
+ BalanceManagerContract,
10
+ DeepBookAdminContract,
11
+ DeepBookClient,
12
+ DeepBookConfig,
13
+ DeepBookContract,
14
+ FlashLoanContract,
15
+ GovernanceContract
16
+ };
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nexport { DeepBookClient } from './client.js';\nexport { BalanceManagerContract } from './transactions/balanceManager.js';\nexport { DeepBookContract } from './transactions/deepbook.js';\nexport { DeepBookAdminContract } from './transactions/deepbookAdmin.js';\nexport { FlashLoanContract } from './transactions/flashLoans.js';\nexport { GovernanceContract } from './transactions/governance.js';\nexport { DeepBookConfig } from './utils/config.js';\n"],
5
+ "mappings": "AAGA,SAAS,sBAAsB;AAC/B,SAAS,8BAA8B;AACvC,SAAS,wBAAwB;AACjC,SAAS,6BAA6B;AACtC,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "private": true,
3
+ "type": "module"
4
+ }
@@ -0,0 +1,80 @@
1
+ import type { Transaction } from '@mysten/sui/transactions';
2
+ import type { DeepBookConfig } from '../utils/config.js';
3
+ /**
4
+ * BalanceManagerContract class for managing BalanceManager operations.
5
+ */
6
+ export declare class BalanceManagerContract {
7
+ #private;
8
+ /**
9
+ * @param {DeepBookConfig} config Configuration for BalanceManagerContract
10
+ */
11
+ constructor(config: DeepBookConfig);
12
+ /**
13
+ * @description Create and share a new BalanceManager
14
+ * @returns A function that takes a Transaction object
15
+ */
16
+ createAndShareBalanceManager: () => (tx: Transaction) => void;
17
+ /**
18
+ * @description Deposit funds into the BalanceManager
19
+ * @param {string} managerKey The key of the BalanceManager
20
+ * @param {string} coinKey The key of the coin to deposit
21
+ * @param {number} amountToDeposit The amount to deposit
22
+ * @returns A function that takes a Transaction object
23
+ */
24
+ depositIntoManager: (managerKey: string, coinKey: string, amountToDeposit: number) => (tx: Transaction) => void;
25
+ /**
26
+ * @description Withdraw funds from the BalanceManager
27
+ * @param {string} managerKey The key of the BalanceManager
28
+ * @param {string} coinKey The key of the coin to withdraw
29
+ * @param {number} amountToWithdraw The amount to withdraw
30
+ * @param {string} recipient The recipient of the withdrawn funds
31
+ * @returns A function that takes a Transaction object
32
+ */
33
+ withdrawFromManager: (managerKey: string, coinKey: string, amountToWithdraw: number, recipient: string) => (tx: Transaction) => void;
34
+ /**
35
+ * @description Withdraw all funds from the BalanceManager
36
+ * @param {string} managerKey The key of the BalanceManager
37
+ * @param {string} coinKey The key of the coin to withdraw
38
+ * @param {string} recipient The recipient of the withdrawn funds
39
+ * @returns A function that takes a Transaction object
40
+ */
41
+ withdrawAllFromManager: (managerKey: string, coinKey: string, recipient: string) => (tx: Transaction) => void;
42
+ /**
43
+ * @description Check the balance of the BalanceManager
44
+ * @param {string} managerKey The key of the BalanceManager
45
+ * @param {string} coinKey The key of the coin to check the balance of
46
+ * @returns A function that takes a Transaction object
47
+ */
48
+ checkManagerBalance: (managerKey: string, coinKey: string) => (tx: Transaction) => void;
49
+ /**
50
+ * @description Generate a trade proof for the BalanceManager. Calls the appropriate function based on whether tradeCap is set.
51
+ * @param {string} managerKey The key of the BalanceManager
52
+ * @returns A function that takes a Transaction object
53
+ */
54
+ generateProof: (managerKey: string) => (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
55
+ /**
56
+ * @description Generate a trade proof as the owner
57
+ * @param {string} managerId The ID of the BalanceManager
58
+ * @returns A function that takes a Transaction object
59
+ */
60
+ generateProofAsOwner: (managerId: string) => (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
61
+ /**
62
+ * @description Generate a trade proof as a trader
63
+ * @param {string} managerId The ID of the BalanceManager
64
+ * @param {string} tradeCapId The ID of the tradeCap
65
+ * @returns A function that takes a Transaction object
66
+ */
67
+ generateProofAsTrader: (managerId: string, tradeCapId: string) => (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
68
+ /**
69
+ * @description Get the owner of the BalanceManager
70
+ * @param {string} managerKey The key of the BalanceManager
71
+ * @returns A function that takes a Transaction object
72
+ */
73
+ owner: (managerKey: string) => (tx: Transaction) => void;
74
+ /**
75
+ * @description Get the ID of the BalanceManager
76
+ * @param {string} managerKey The key of the BalanceManager
77
+ * @returns A function that takes a Transaction object
78
+ */
79
+ id: (managerKey: string) => (tx: Transaction) => void;
80
+ }