@mysten/deepbook-v3 1.1.4 → 1.2.0
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 +20 -0
- package/dist/client.d.mts +58 -763
- package/dist/client.d.mts.map +1 -1
- package/dist/client.mjs +253 -2127
- package/dist/client.mjs.map +1 -1
- package/dist/contracts/utils/index.mjs +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/pyth/pyth.mjs +1 -1
- package/dist/queries/accountQueries.mjs +104 -0
- package/dist/queries/accountQueries.mjs.map +1 -0
- package/dist/queries/balanceManagerQueries.mjs +113 -0
- package/dist/queries/balanceManagerQueries.mjs.map +1 -0
- package/dist/queries/context.mjs +15 -0
- package/dist/queries/context.mjs.map +1 -0
- package/dist/queries/marginManagerQueries.mjs +365 -0
- package/dist/queries/marginManagerQueries.mjs.map +1 -0
- package/dist/queries/marginPoolQueries.mjs +184 -0
- package/dist/queries/marginPoolQueries.mjs.map +1 -0
- package/dist/queries/orderQueries.mjs +165 -0
- package/dist/queries/orderQueries.mjs.map +1 -0
- package/dist/queries/poolQueries.mjs +234 -0
- package/dist/queries/poolQueries.mjs.map +1 -0
- package/dist/queries/priceFeedQueries.mjs +83 -0
- package/dist/queries/priceFeedQueries.mjs.map +1 -0
- package/dist/queries/quantityQueries.mjs +216 -0
- package/dist/queries/quantityQueries.mjs.map +1 -0
- package/dist/queries/referralQueries.mjs +96 -0
- package/dist/queries/referralQueries.mjs.map +1 -0
- package/dist/queries/registryQueries.mjs +162 -0
- package/dist/queries/registryQueries.mjs.map +1 -0
- package/dist/queries/tpslQueries.mjs +62 -0
- package/dist/queries/tpslQueries.mjs.map +1 -0
- package/dist/transactions/balanceManager.d.mts.map +1 -1
- package/dist/transactions/balanceManager.mjs +5 -4
- package/dist/transactions/balanceManager.mjs.map +1 -1
- package/dist/transactions/deepbook.d.mts +24 -24
- package/dist/transactions/deepbook.d.mts.map +1 -1
- package/dist/transactions/deepbook.mjs +48 -47
- package/dist/transactions/deepbook.mjs.map +1 -1
- package/dist/transactions/deepbookAdmin.d.mts +2 -2
- package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
- package/dist/transactions/deepbookAdmin.mjs +10 -9
- package/dist/transactions/deepbookAdmin.mjs.map +1 -1
- package/dist/transactions/flashLoans.d.mts.map +1 -1
- package/dist/transactions/flashLoans.mjs +6 -4
- package/dist/transactions/flashLoans.mjs.map +1 -1
- package/dist/transactions/governance.d.mts.map +1 -1
- package/dist/transactions/governance.mjs +5 -4
- package/dist/transactions/governance.mjs.map +1 -1
- package/dist/transactions/marginAdmin.d.mts +7 -7
- package/dist/transactions/marginAdmin.d.mts.map +1 -1
- package/dist/transactions/marginAdmin.mjs +8 -7
- 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 +5 -4
- package/dist/transactions/marginLiquidations.mjs.map +1 -1
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginMaintainer.d.mts.map +1 -1
- package/dist/transactions/marginMaintainer.mjs +15 -14
- package/dist/transactions/marginMaintainer.mjs.map +1 -1
- package/dist/transactions/marginManager.d.mts +23 -23
- package/dist/transactions/marginManager.d.mts.map +1 -1
- package/dist/transactions/marginManager.mjs +12 -11
- package/dist/transactions/marginManager.mjs.map +1 -1
- package/dist/transactions/marginPool.d.mts.map +1 -1
- package/dist/transactions/marginPool.mjs +3 -2
- package/dist/transactions/marginPool.mjs.map +1 -1
- package/dist/transactions/marginRegistry.d.mts +15 -15
- package/dist/transactions/marginTPSL.d.mts +1 -1
- package/dist/transactions/marginTPSL.d.mts.map +1 -1
- package/dist/transactions/marginTPSL.mjs +6 -8
- package/dist/transactions/marginTPSL.mjs.map +1 -1
- package/dist/transactions/poolProxy.d.mts.map +1 -1
- package/dist/transactions/poolProxy.mjs +13 -13
- package/dist/transactions/poolProxy.mjs.map +1 -1
- package/dist/types/index.d.mts +189 -52
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/utils/constants.d.mts.map +1 -1
- package/dist/utils/constants.mjs +10 -0
- package/dist/utils/constants.mjs.map +1 -1
- package/dist/utils/conversion.mjs +26 -0
- package/dist/utils/conversion.mjs.map +1 -0
- package/package.json +5 -4
- package/src/client.ts +421 -2662
- package/src/index.ts +27 -0
- package/src/queries/accountQueries.ts +117 -0
- package/src/queries/balanceManagerQueries.ts +156 -0
- package/src/queries/context.ts +44 -0
- package/src/queries/index.ts +16 -0
- package/src/queries/marginManagerQueries.ts +575 -0
- package/src/queries/marginPoolQueries.ts +226 -0
- package/src/queries/orderQueries.ts +202 -0
- package/src/queries/poolQueries.ts +266 -0
- package/src/queries/priceFeedQueries.ts +141 -0
- package/src/queries/quantityQueries.ts +266 -0
- package/src/queries/referralQueries.ts +112 -0
- package/src/queries/registryQueries.ts +185 -0
- package/src/queries/tpslQueries.ts +88 -0
- package/src/transactions/balanceManager.ts +5 -4
- package/src/transactions/deepbook.ts +98 -84
- package/src/transactions/deepbookAdmin.ts +10 -9
- package/src/transactions/flashLoans.ts +5 -4
- package/src/transactions/governance.ts +5 -4
- package/src/transactions/marginAdmin.ts +8 -7
- package/src/transactions/marginLiquidations.ts +5 -4
- package/src/transactions/marginMaintainer.ts +15 -14
- package/src/transactions/marginManager.ts +12 -11
- package/src/transactions/marginPool.ts +3 -2
- package/src/transactions/marginTPSL.ts +11 -6
- package/src/transactions/poolProxy.ts +12 -11
- package/src/types/index.ts +200 -53
- package/src/utils/constants.ts +10 -0
- package/src/utils/conversion.ts +33 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CanPlaceLimitOrderParams, CanPlaceMarketOrderParams, CreatePermissionlessPoolParams, PlaceLimitOrderParams, PlaceMarketOrderParams, SwapParams, SwapWithManagerParams } from "../types/index.mjs";
|
|
2
2
|
import { DeepBookConfig } from "../utils/config.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _mysten_sui_transactions11 from "@mysten/sui/transactions";
|
|
4
4
|
import { Transaction } from "@mysten/sui/transactions";
|
|
5
5
|
|
|
6
6
|
//#region src/transactions/deepbook.d.ts
|
|
@@ -171,14 +171,14 @@ declare class DeepBookContract {
|
|
|
171
171
|
* @param {number} baseQuantity Base quantity to convert
|
|
172
172
|
* @returns A function that takes a Transaction object
|
|
173
173
|
*/
|
|
174
|
-
getQuoteQuantityOut: (poolKey: string, baseQuantity: number) => (tx: Transaction) => void;
|
|
174
|
+
getQuoteQuantityOut: (poolKey: string, baseQuantity: number | bigint) => (tx: Transaction) => void;
|
|
175
175
|
/**
|
|
176
176
|
* @description Get the base quantity out for a given quote quantity in
|
|
177
177
|
* @param {string} poolKey The key to identify the pool
|
|
178
178
|
* @param {number} quoteQuantity Quote quantity to convert
|
|
179
179
|
* @returns A function that takes a Transaction object
|
|
180
180
|
*/
|
|
181
|
-
getBaseQuantityOut: (poolKey: string, quoteQuantity: number) => (tx: Transaction) => void;
|
|
181
|
+
getBaseQuantityOut: (poolKey: string, quoteQuantity: number | bigint) => (tx: Transaction) => void;
|
|
182
182
|
/**
|
|
183
183
|
* @description Get the quantity out for a given base or quote quantity
|
|
184
184
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -186,7 +186,7 @@ declare class DeepBookContract {
|
|
|
186
186
|
* @param {number} quoteQuantity Quote quantity to convert
|
|
187
187
|
* @returns A function that takes a Transaction object
|
|
188
188
|
*/
|
|
189
|
-
getQuantityOut: (poolKey: string, baseQuantity: number, quoteQuantity: number) => (tx: Transaction) => void;
|
|
189
|
+
getQuantityOut: (poolKey: string, baseQuantity: number | bigint, quoteQuantity: number | bigint) => (tx: Transaction) => void;
|
|
190
190
|
/**
|
|
191
191
|
* @description Get open orders for a balance manager in a pool
|
|
192
192
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -202,7 +202,7 @@ declare class DeepBookContract {
|
|
|
202
202
|
* @param {boolean} isBid Whether to get bid or ask orders
|
|
203
203
|
* @returns A function that takes a Transaction object
|
|
204
204
|
*/
|
|
205
|
-
getLevel2Range: (poolKey: string, priceLow: number, priceHigh: number, isBid: boolean) => (tx: Transaction) => void;
|
|
205
|
+
getLevel2Range: (poolKey: string, priceLow: number | bigint, priceHigh: number | bigint, isBid: boolean) => (tx: Transaction) => void;
|
|
206
206
|
/**
|
|
207
207
|
* @description Get level 2 order book ticks from mid-price for a pool
|
|
208
208
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -358,40 +358,40 @@ declare class DeepBookContract {
|
|
|
358
358
|
* @param {string} referral The referral (DeepBookPoolReferral) to get the balances for
|
|
359
359
|
* @returns A function that takes a Transaction object
|
|
360
360
|
*/
|
|
361
|
-
getPoolReferralBalances: (poolKey: string, referral: string) => (tx: Transaction) =>
|
|
361
|
+
getPoolReferralBalances: (poolKey: string, referral: string) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
362
362
|
/**
|
|
363
363
|
* @description Get the multiplier for a referral (DeepBookPoolReferral)
|
|
364
364
|
* @param {string} poolKey The key to identify the pool
|
|
365
365
|
* @param {string} referral The referral (DeepBookPoolReferral) to get the multiplier for
|
|
366
366
|
* @returns A function that takes a Transaction object
|
|
367
367
|
*/
|
|
368
|
-
poolReferralMultiplier: (poolKey: string, referral: string) => (tx: Transaction) =>
|
|
368
|
+
poolReferralMultiplier: (poolKey: string, referral: string) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
369
369
|
/**
|
|
370
370
|
* @description Check if a pool is a stable pool
|
|
371
371
|
* @param {string} poolKey The key to identify the pool
|
|
372
372
|
* @returns A function that takes a Transaction object
|
|
373
373
|
*/
|
|
374
|
-
stablePool: (poolKey: string) => (tx: Transaction) =>
|
|
374
|
+
stablePool: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
375
375
|
/**
|
|
376
376
|
* @description Check if a pool is registered
|
|
377
377
|
* @param {string} poolKey The key to identify the pool
|
|
378
378
|
* @returns A function that takes a Transaction object
|
|
379
379
|
*/
|
|
380
|
-
registeredPool: (poolKey: string) => (tx: Transaction) =>
|
|
380
|
+
registeredPool: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
381
381
|
/**
|
|
382
382
|
* @description Get the quote quantity out for a given base quantity using input token as fee
|
|
383
383
|
* @param {string} poolKey The key to identify the pool
|
|
384
384
|
* @param {number} baseQuantity Base quantity to convert
|
|
385
385
|
* @returns A function that takes a Transaction object
|
|
386
386
|
*/
|
|
387
|
-
getQuoteQuantityOutInputFee: (poolKey: string, baseQuantity: number) => (tx: Transaction) =>
|
|
387
|
+
getQuoteQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
388
388
|
/**
|
|
389
389
|
* @description Get the base quantity out for a given quote quantity using input token as fee
|
|
390
390
|
* @param {string} poolKey The key to identify the pool
|
|
391
391
|
* @param {number} quoteQuantity Quote quantity to convert
|
|
392
392
|
* @returns A function that takes a Transaction object
|
|
393
393
|
*/
|
|
394
|
-
getBaseQuantityOutInputFee: (poolKey: string, quoteQuantity: number) => (tx: Transaction) =>
|
|
394
|
+
getBaseQuantityOutInputFee: (poolKey: string, quoteQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
395
395
|
/**
|
|
396
396
|
* @description Get the quantity out for a given base or quote quantity using input token as fee
|
|
397
397
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -399,7 +399,7 @@ declare class DeepBookContract {
|
|
|
399
399
|
* @param {number} quoteQuantity Quote quantity to convert
|
|
400
400
|
* @returns A function that takes a Transaction object
|
|
401
401
|
*/
|
|
402
|
-
getQuantityOutInputFee: (poolKey: string, baseQuantity: number, quoteQuantity: number) => (tx: Transaction) =>
|
|
402
|
+
getQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint, quoteQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
403
403
|
/**
|
|
404
404
|
* @description Get the base quantity needed to receive a target quote quantity
|
|
405
405
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -407,7 +407,7 @@ declare class DeepBookContract {
|
|
|
407
407
|
* @param {boolean} payWithDeep Whether to pay fees with DEEP
|
|
408
408
|
* @returns A function that takes a Transaction object
|
|
409
409
|
*/
|
|
410
|
-
getBaseQuantityIn: (poolKey: string, targetQuoteQuantity: number, payWithDeep: boolean) => (tx: Transaction) =>
|
|
410
|
+
getBaseQuantityIn: (poolKey: string, targetQuoteQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
411
411
|
/**
|
|
412
412
|
* @description Get the quote quantity needed to receive a target base quantity
|
|
413
413
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -415,14 +415,14 @@ declare class DeepBookContract {
|
|
|
415
415
|
* @param {boolean} payWithDeep Whether to pay fees with DEEP
|
|
416
416
|
* @returns A function that takes a Transaction object
|
|
417
417
|
*/
|
|
418
|
-
getQuoteQuantityIn: (poolKey: string, targetBaseQuantity: number, payWithDeep: boolean) => (tx: Transaction) =>
|
|
418
|
+
getQuoteQuantityIn: (poolKey: string, targetBaseQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
419
419
|
/**
|
|
420
420
|
* @description Get account order details for a balance manager
|
|
421
421
|
* @param {string} poolKey The key to identify the pool
|
|
422
422
|
* @param {string} managerKey Key of the balance manager
|
|
423
423
|
* @returns A function that takes a Transaction object
|
|
424
424
|
*/
|
|
425
|
-
getAccountOrderDetails: (poolKey: string, managerKey: string) => (tx: Transaction) =>
|
|
425
|
+
getAccountOrderDetails: (poolKey: string, managerKey: string) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
426
426
|
/**
|
|
427
427
|
* @description Get the DEEP required for an order
|
|
428
428
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -430,51 +430,51 @@ declare class DeepBookContract {
|
|
|
430
430
|
* @param {number} price Price
|
|
431
431
|
* @returns A function that takes a Transaction object
|
|
432
432
|
*/
|
|
433
|
-
getOrderDeepRequired: (poolKey: string, baseQuantity: number, price: number) => (tx: Transaction) =>
|
|
433
|
+
getOrderDeepRequired: (poolKey: string, baseQuantity: number | bigint, price: number | bigint) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
434
434
|
/**
|
|
435
435
|
* @description Check if account exists for a balance manager
|
|
436
436
|
* @param {string} poolKey The key to identify the pool
|
|
437
437
|
* @param {string} managerKey Key of the balance manager
|
|
438
438
|
* @returns A function that takes a Transaction object
|
|
439
439
|
*/
|
|
440
|
-
accountExists: (poolKey: string, managerKey: string) => (tx: Transaction) =>
|
|
440
|
+
accountExists: (poolKey: string, managerKey: string) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
441
441
|
/**
|
|
442
442
|
* @description Get the next epoch trade parameters for a pool
|
|
443
443
|
* @param {string} poolKey The key to identify the pool
|
|
444
444
|
* @returns A function that takes a Transaction object
|
|
445
445
|
*/
|
|
446
|
-
poolTradeParamsNext: (poolKey: string) => (tx: Transaction) =>
|
|
446
|
+
poolTradeParamsNext: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
447
447
|
/**
|
|
448
448
|
* @description Get the quorum for a pool
|
|
449
449
|
* @param {string} poolKey The key to identify the pool
|
|
450
450
|
* @returns A function that takes a Transaction object
|
|
451
451
|
*/
|
|
452
|
-
quorum: (poolKey: string) => (tx: Transaction) =>
|
|
452
|
+
quorum: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
453
453
|
/**
|
|
454
454
|
* @description Get the pool ID
|
|
455
455
|
* @param {string} poolKey The key to identify the pool
|
|
456
456
|
* @returns A function that takes a Transaction object
|
|
457
457
|
*/
|
|
458
|
-
poolId: (poolKey: string) => (tx: Transaction) =>
|
|
458
|
+
poolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
459
459
|
/**
|
|
460
460
|
* @description Check if a limit order can be placed
|
|
461
461
|
* @param {CanPlaceLimitOrderParams} params Parameters for checking limit order validity
|
|
462
462
|
* @returns A function that takes a Transaction object
|
|
463
463
|
*/
|
|
464
|
-
canPlaceLimitOrder: (params: CanPlaceLimitOrderParams) => (tx: Transaction) =>
|
|
464
|
+
canPlaceLimitOrder: (params: CanPlaceLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
465
465
|
/**
|
|
466
466
|
* @description Check if a market order can be placed
|
|
467
467
|
* @param {CanPlaceMarketOrderParams} params Parameters for checking market order validity
|
|
468
468
|
* @returns A function that takes a Transaction object
|
|
469
469
|
*/
|
|
470
|
-
canPlaceMarketOrder: (params: CanPlaceMarketOrderParams) => (tx: Transaction) =>
|
|
470
|
+
canPlaceMarketOrder: (params: CanPlaceMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
471
471
|
/**
|
|
472
472
|
* @description Check if market order params are valid
|
|
473
473
|
* @param {string} poolKey The key to identify the pool
|
|
474
474
|
* @param {number} quantity Quantity
|
|
475
475
|
* @returns A function that takes a Transaction object
|
|
476
476
|
*/
|
|
477
|
-
checkMarketOrderParams: (poolKey: string, quantity: number) => (tx: Transaction) =>
|
|
477
|
+
checkMarketOrderParams: (poolKey: string, quantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
478
478
|
/**
|
|
479
479
|
* @description Check if limit order params are valid
|
|
480
480
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -483,7 +483,7 @@ declare class DeepBookContract {
|
|
|
483
483
|
* @param {number} expireTimestamp Expiration timestamp
|
|
484
484
|
* @returns A function that takes a Transaction object
|
|
485
485
|
*/
|
|
486
|
-
checkLimitOrderParams: (poolKey: string, price: number, quantity: number, expireTimestamp: number) => (tx: Transaction) =>
|
|
486
|
+
checkLimitOrderParams: (poolKey: string, price: number | bigint, quantity: number | bigint, expireTimestamp: number) => (tx: Transaction) => _mysten_sui_transactions11.TransactionResult;
|
|
487
487
|
}
|
|
488
488
|
//#endregion
|
|
489
489
|
export { DeepBookContract };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepbook.d.mts","names":[],"sources":["../../src/transactions/deepbook.ts"],"sourcesContent":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"deepbook.d.mts","names":[],"sources":["../../src/transactions/deepbook.ts"],"sourcesContent":[],"mappings":"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"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { convertPrice, convertQuantity, convertRate } from "../utils/conversion.mjs";
|
|
2
2
|
import { DEEP_SCALAR, FLOAT_SCALAR, GAS_BUDGET, MAX_TIMESTAMP, POOL_CREATION_FEE_DEEP } from "../utils/config.mjs";
|
|
3
|
+
import { OrderType, SelfMatchingOptions } from "../types/index.mjs";
|
|
3
4
|
import { coinWithBalance } from "@mysten/sui/transactions";
|
|
4
5
|
|
|
5
6
|
//#region src/transactions/deepbook.ts
|
|
@@ -19,8 +20,8 @@ var DeepBookContract = class {
|
|
|
19
20
|
const balanceManager = this.#config.getBalanceManager(balanceManagerKey);
|
|
20
21
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
21
22
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
22
|
-
const inputPrice =
|
|
23
|
-
const inputQuantity =
|
|
23
|
+
const inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);
|
|
24
|
+
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
24
25
|
const tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));
|
|
25
26
|
tx.moveCall({
|
|
26
27
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::place_limit_order`,
|
|
@@ -49,7 +50,7 @@ var DeepBookContract = class {
|
|
|
49
50
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
50
51
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
51
52
|
const tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));
|
|
52
|
-
const inputQuantity =
|
|
53
|
+
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
53
54
|
tx.moveCall({
|
|
54
55
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::place_market_order`,
|
|
55
56
|
arguments: [
|
|
@@ -72,7 +73,7 @@ var DeepBookContract = class {
|
|
|
72
73
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
73
74
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
74
75
|
const tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));
|
|
75
|
-
const inputQuantity =
|
|
76
|
+
const inputQuantity = convertQuantity(newQuantity, baseCoin.scalar);
|
|
76
77
|
tx.moveCall({
|
|
77
78
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::modify_order`,
|
|
78
79
|
arguments: [
|
|
@@ -221,7 +222,7 @@ var DeepBookContract = class {
|
|
|
221
222
|
const pool = this.#config.getPool(poolKey);
|
|
222
223
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
223
224
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
224
|
-
const adjustedNumber =
|
|
225
|
+
const adjustedNumber = convertRate(multiplier, FLOAT_SCALAR);
|
|
225
226
|
tx.moveCall({
|
|
226
227
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::mint_referral`,
|
|
227
228
|
arguments: [tx.object(pool.address), tx.pure.u64(adjustedNumber)],
|
|
@@ -232,7 +233,7 @@ var DeepBookContract = class {
|
|
|
232
233
|
const pool = this.#config.getPool(poolKey);
|
|
233
234
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
234
235
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
235
|
-
const adjustedNumber =
|
|
236
|
+
const adjustedNumber = convertRate(multiplier, FLOAT_SCALAR);
|
|
236
237
|
tx.moveCall({
|
|
237
238
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::update_pool_referral_multiplier`,
|
|
238
239
|
arguments: [
|
|
@@ -326,7 +327,7 @@ var DeepBookContract = class {
|
|
|
326
327
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_quote_quantity_out`,
|
|
327
328
|
arguments: [
|
|
328
329
|
tx.object(pool.address),
|
|
329
|
-
tx.pure.u64(
|
|
330
|
+
tx.pure.u64(convertQuantity(baseQuantity, baseCoin.scalar)),
|
|
330
331
|
tx.object.clock()
|
|
331
332
|
],
|
|
332
333
|
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
@@ -341,7 +342,7 @@ var DeepBookContract = class {
|
|
|
341
342
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_base_quantity_out`,
|
|
342
343
|
arguments: [
|
|
343
344
|
tx.object(pool.address),
|
|
344
|
-
tx.pure.u64(
|
|
345
|
+
tx.pure.u64(convertQuantity(quoteQuantity, quoteScalar)),
|
|
345
346
|
tx.object.clock()
|
|
346
347
|
],
|
|
347
348
|
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
@@ -356,8 +357,8 @@ var DeepBookContract = class {
|
|
|
356
357
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_quantity_out`,
|
|
357
358
|
arguments: [
|
|
358
359
|
tx.object(pool.address),
|
|
359
|
-
tx.pure.u64(
|
|
360
|
-
tx.pure.u64(
|
|
360
|
+
tx.pure.u64(convertQuantity(baseQuantity, baseCoin.scalar)),
|
|
361
|
+
tx.pure.u64(convertQuantity(quoteQuantity, quoteScalar)),
|
|
361
362
|
tx.object.clock()
|
|
362
363
|
],
|
|
363
364
|
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
@@ -382,8 +383,8 @@ var DeepBookContract = class {
|
|
|
382
383
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_level2_range`,
|
|
383
384
|
arguments: [
|
|
384
385
|
tx.object(pool.address),
|
|
385
|
-
tx.pure.u64(
|
|
386
|
-
tx.pure.u64(
|
|
386
|
+
tx.pure.u64(convertPrice(priceLow, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar)),
|
|
387
|
+
tx.pure.u64(convertPrice(priceHigh, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar)),
|
|
387
388
|
tx.pure.bool(isBid),
|
|
388
389
|
tx.object.clock()
|
|
389
390
|
],
|
|
@@ -432,13 +433,13 @@ var DeepBookContract = class {
|
|
|
432
433
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
433
434
|
const baseCoinInput = params.baseCoin ?? coinWithBalance({
|
|
434
435
|
type: baseCoin.type,
|
|
435
|
-
balance:
|
|
436
|
+
balance: convertQuantity(baseAmount, baseCoin.scalar)
|
|
436
437
|
});
|
|
437
438
|
const deepCoin = params.deepCoin ?? coinWithBalance({
|
|
438
439
|
type: deepCoinType,
|
|
439
|
-
balance:
|
|
440
|
+
balance: convertQuantity(deepAmount, DEEP_SCALAR)
|
|
440
441
|
});
|
|
441
|
-
const minQuoteInput =
|
|
442
|
+
const minQuoteInput = convertQuantity(minQuote, quoteCoin.scalar);
|
|
442
443
|
const [baseCoinResult, quoteCoinResult, deepCoinResult] = tx.moveCall({
|
|
443
444
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::swap_exact_base_for_quote`,
|
|
444
445
|
arguments: [
|
|
@@ -467,13 +468,13 @@ var DeepBookContract = class {
|
|
|
467
468
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
468
469
|
const quoteCoinInput = params.quoteCoin ?? coinWithBalance({
|
|
469
470
|
type: quoteCoin.type,
|
|
470
|
-
balance:
|
|
471
|
+
balance: convertQuantity(quoteAmount, quoteCoin.scalar)
|
|
471
472
|
});
|
|
472
473
|
const deepCoin = params.deepCoin ?? coinWithBalance({
|
|
473
474
|
type: deepCoinType,
|
|
474
|
-
balance:
|
|
475
|
+
balance: convertQuantity(deepAmount, DEEP_SCALAR)
|
|
475
476
|
});
|
|
476
|
-
const minBaseInput =
|
|
477
|
+
const minBaseInput = convertQuantity(minBase, baseCoin.scalar);
|
|
477
478
|
const [baseCoinResult, quoteCoinResult, deepCoinResult] = tx.moveCall({
|
|
478
479
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::swap_exact_quote_for_base`,
|
|
479
480
|
arguments: [
|
|
@@ -501,7 +502,7 @@ var DeepBookContract = class {
|
|
|
501
502
|
const quoteCoinType = this.#config.getCoin(pool.quoteCoin);
|
|
502
503
|
const baseCoinInput = isBaseToCoin ? baseCoin ?? coinWithBalance({
|
|
503
504
|
type: baseCoinType.type,
|
|
504
|
-
balance:
|
|
505
|
+
balance: convertQuantity(amount, baseCoinType.scalar)
|
|
505
506
|
}) : coinWithBalance({
|
|
506
507
|
type: baseCoinType.type,
|
|
507
508
|
balance: 0
|
|
@@ -511,13 +512,13 @@ var DeepBookContract = class {
|
|
|
511
512
|
balance: 0
|
|
512
513
|
}) : quoteCoin ?? coinWithBalance({
|
|
513
514
|
type: quoteCoinType.type,
|
|
514
|
-
balance:
|
|
515
|
+
balance: convertQuantity(amount, quoteCoinType.scalar)
|
|
515
516
|
});
|
|
516
517
|
const deepCoinInput = deepCoin ?? coinWithBalance({
|
|
517
518
|
type: deepCoinType,
|
|
518
|
-
balance:
|
|
519
|
+
balance: convertQuantity(deepAmount, DEEP_SCALAR)
|
|
519
520
|
});
|
|
520
|
-
const minOutInput =
|
|
521
|
+
const minOutInput = convertQuantity(minOut, isBaseToCoin ? quoteCoinType.scalar : baseCoinType.scalar);
|
|
521
522
|
const [baseCoinResult, quoteCoinResult, deepCoinResult] = tx.moveCall({
|
|
522
523
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::swap_exact_quantity`,
|
|
523
524
|
arguments: [
|
|
@@ -545,9 +546,9 @@ var DeepBookContract = class {
|
|
|
545
546
|
const quoteCoinType = this.#config.getCoin(pool.quoteCoin);
|
|
546
547
|
const baseCoinInput = baseCoin ?? coinWithBalance({
|
|
547
548
|
type: baseCoinType.type,
|
|
548
|
-
balance:
|
|
549
|
+
balance: convertQuantity(baseAmount, baseCoinType.scalar)
|
|
549
550
|
});
|
|
550
|
-
const minQuoteInput =
|
|
551
|
+
const minQuoteInput = convertQuantity(minQuote, quoteCoinType.scalar);
|
|
551
552
|
const [baseCoinResult, quoteCoinResult] = tx.moveCall({
|
|
552
553
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::swap_exact_base_for_quote_with_manager`,
|
|
553
554
|
arguments: [
|
|
@@ -573,9 +574,9 @@ var DeepBookContract = class {
|
|
|
573
574
|
const quoteCoinType = this.#config.getCoin(pool.quoteCoin);
|
|
574
575
|
const quoteCoinInput = quoteCoin ?? coinWithBalance({
|
|
575
576
|
type: quoteCoinType.type,
|
|
576
|
-
balance:
|
|
577
|
+
balance: convertQuantity(quoteAmount, quoteCoinType.scalar)
|
|
577
578
|
});
|
|
578
|
-
const minBaseInput =
|
|
579
|
+
const minBaseInput = convertQuantity(minBase, baseCoinType.scalar);
|
|
579
580
|
const [baseCoinResult, quoteCoinResult] = tx.moveCall({
|
|
580
581
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::swap_exact_quote_for_base_with_manager`,
|
|
581
582
|
arguments: [
|
|
@@ -601,7 +602,7 @@ var DeepBookContract = class {
|
|
|
601
602
|
const quoteCoinType = this.#config.getCoin(pool.quoteCoin);
|
|
602
603
|
const baseCoinInput = isBaseToCoin ? baseCoin ?? coinWithBalance({
|
|
603
604
|
type: baseCoinType.type,
|
|
604
|
-
balance:
|
|
605
|
+
balance: convertQuantity(amount, baseCoinType.scalar)
|
|
605
606
|
}) : coinWithBalance({
|
|
606
607
|
type: baseCoinType.type,
|
|
607
608
|
balance: 0
|
|
@@ -611,9 +612,9 @@ var DeepBookContract = class {
|
|
|
611
612
|
balance: 0
|
|
612
613
|
}) : quoteCoin ?? coinWithBalance({
|
|
613
614
|
type: quoteCoinType.type,
|
|
614
|
-
balance:
|
|
615
|
+
balance: convertQuantity(amount, quoteCoinType.scalar)
|
|
615
616
|
});
|
|
616
|
-
const minOutInput =
|
|
617
|
+
const minOutInput = convertQuantity(minOut, isBaseToCoin ? quoteCoinType.scalar : baseCoinType.scalar);
|
|
617
618
|
const [baseCoinResult, quoteCoinResult] = tx.moveCall({
|
|
618
619
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::swap_exact_quantity_with_manager`,
|
|
619
620
|
arguments: [
|
|
@@ -639,9 +640,9 @@ var DeepBookContract = class {
|
|
|
639
640
|
const deepCoinType = this.#config.getCoin("DEEP").type;
|
|
640
641
|
const baseScalar = baseCoin.scalar;
|
|
641
642
|
const quoteScalar = quoteCoin.scalar;
|
|
642
|
-
const adjustedTickSize =
|
|
643
|
-
const adjustedLotSize =
|
|
644
|
-
const adjustedMinSize =
|
|
643
|
+
const adjustedTickSize = convertPrice(tickSize, FLOAT_SCALAR, quoteScalar, baseScalar);
|
|
644
|
+
const adjustedLotSize = convertQuantity(lotSize, baseScalar);
|
|
645
|
+
const adjustedMinSize = convertQuantity(minSize, baseScalar);
|
|
645
646
|
const deepCoinInput = deepCoin ?? coinWithBalance({
|
|
646
647
|
type: deepCoinType,
|
|
647
648
|
balance: POOL_CREATION_FEE_DEEP
|
|
@@ -764,7 +765,7 @@ var DeepBookContract = class {
|
|
|
764
765
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_quote_quantity_out_input_fee`,
|
|
765
766
|
arguments: [
|
|
766
767
|
tx.object(pool.address),
|
|
767
|
-
tx.pure.u64(
|
|
768
|
+
tx.pure.u64(convertQuantity(baseQuantity, baseCoin.scalar)),
|
|
768
769
|
tx.object.clock()
|
|
769
770
|
],
|
|
770
771
|
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
@@ -778,7 +779,7 @@ var DeepBookContract = class {
|
|
|
778
779
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_base_quantity_out_input_fee`,
|
|
779
780
|
arguments: [
|
|
780
781
|
tx.object(pool.address),
|
|
781
|
-
tx.pure.u64(
|
|
782
|
+
tx.pure.u64(convertQuantity(quoteQuantity, quoteCoin.scalar)),
|
|
782
783
|
tx.object.clock()
|
|
783
784
|
],
|
|
784
785
|
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
@@ -792,8 +793,8 @@ var DeepBookContract = class {
|
|
|
792
793
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_quantity_out_input_fee`,
|
|
793
794
|
arguments: [
|
|
794
795
|
tx.object(pool.address),
|
|
795
|
-
tx.pure.u64(
|
|
796
|
-
tx.pure.u64(
|
|
796
|
+
tx.pure.u64(convertQuantity(baseQuantity, baseCoin.scalar)),
|
|
797
|
+
tx.pure.u64(convertQuantity(quoteQuantity, quoteCoin.scalar)),
|
|
797
798
|
tx.object.clock()
|
|
798
799
|
],
|
|
799
800
|
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
@@ -807,7 +808,7 @@ var DeepBookContract = class {
|
|
|
807
808
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_base_quantity_in`,
|
|
808
809
|
arguments: [
|
|
809
810
|
tx.object(pool.address),
|
|
810
|
-
tx.pure.u64(
|
|
811
|
+
tx.pure.u64(convertQuantity(targetQuoteQuantity, quoteCoin.scalar)),
|
|
811
812
|
tx.pure.bool(payWithDeep),
|
|
812
813
|
tx.object.clock()
|
|
813
814
|
],
|
|
@@ -822,7 +823,7 @@ var DeepBookContract = class {
|
|
|
822
823
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_quote_quantity_in`,
|
|
823
824
|
arguments: [
|
|
824
825
|
tx.object(pool.address),
|
|
825
|
-
tx.pure.u64(
|
|
826
|
+
tx.pure.u64(convertQuantity(targetBaseQuantity, baseCoin.scalar)),
|
|
826
827
|
tx.pure.bool(payWithDeep),
|
|
827
828
|
tx.object.clock()
|
|
828
829
|
],
|
|
@@ -844,8 +845,8 @@ var DeepBookContract = class {
|
|
|
844
845
|
const pool = this.#config.getPool(poolKey);
|
|
845
846
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
846
847
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
847
|
-
const inputPrice =
|
|
848
|
-
const inputQuantity =
|
|
848
|
+
const inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);
|
|
849
|
+
const inputQuantity = convertQuantity(baseQuantity, baseCoin.scalar);
|
|
849
850
|
return tx.moveCall({
|
|
850
851
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_order_deep_required`,
|
|
851
852
|
arguments: [
|
|
@@ -903,8 +904,8 @@ var DeepBookContract = class {
|
|
|
903
904
|
const manager = this.#config.getBalanceManager(balanceManagerKey);
|
|
904
905
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
905
906
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
906
|
-
const inputPrice =
|
|
907
|
-
const inputQuantity =
|
|
907
|
+
const inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);
|
|
908
|
+
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
908
909
|
return tx.moveCall({
|
|
909
910
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::can_place_limit_order`,
|
|
910
911
|
arguments: [
|
|
@@ -926,7 +927,7 @@ var DeepBookContract = class {
|
|
|
926
927
|
const manager = this.#config.getBalanceManager(balanceManagerKey);
|
|
927
928
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
928
929
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
929
|
-
const inputQuantity =
|
|
930
|
+
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
930
931
|
return tx.moveCall({
|
|
931
932
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::can_place_market_order`,
|
|
932
933
|
arguments: [
|
|
@@ -944,7 +945,7 @@ var DeepBookContract = class {
|
|
|
944
945
|
const pool = this.#config.getPool(poolKey);
|
|
945
946
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
946
947
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
947
|
-
const inputQuantity =
|
|
948
|
+
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
948
949
|
return tx.moveCall({
|
|
949
950
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::check_market_order_params`,
|
|
950
951
|
arguments: [tx.object(pool.address), tx.pure.u64(inputQuantity)],
|
|
@@ -955,8 +956,8 @@ var DeepBookContract = class {
|
|
|
955
956
|
const pool = this.#config.getPool(poolKey);
|
|
956
957
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
957
958
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
958
|
-
const inputPrice =
|
|
959
|
-
const inputQuantity =
|
|
959
|
+
const inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);
|
|
960
|
+
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
960
961
|
return tx.moveCall({
|
|
961
962
|
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::check_limit_order_params`,
|
|
962
963
|
arguments: [
|