@mysten/deepbook-v3 1.6.7 → 2.0.1
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 +69 -0
- package/dist/_virtual/rolldown_runtime.mjs +18 -0
- package/dist/client.d.mts +9 -6
- package/dist/client.d.mts.map +1 -1
- package/dist/client.mjs +3 -2
- package/dist/client.mjs.map +1 -1
- package/dist/contracts/deepbook/account.d.mts +18 -18
- package/dist/contracts/deepbook/account.d.mts.map +1 -1
- package/dist/contracts/deepbook/balance_manager.mjs.map +1 -1
- package/dist/contracts/deepbook/balances.d.mts +4 -4
- package/dist/contracts/deepbook/balances.d.mts.map +1 -1
- package/dist/contracts/deepbook/deep_price.d.mts +3 -3
- package/dist/contracts/deepbook/deep_price.d.mts.map +1 -1
- package/dist/contracts/deepbook/order.d.mts +12 -12
- package/dist/contracts/deepbook/pool.mjs.map +1 -1
- package/dist/contracts/deepbook/registry.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_manager.mjs +1 -319
- package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs +386 -0
- package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/margin_pool.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_registry.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/oracle.mjs +9 -0
- package/dist/contracts/deepbook_margin/oracle.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/pool_proxy.mjs +1 -383
- package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs +340 -0
- package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/protocol_config.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/tpsl.mjs.map +1 -1
- package/dist/contracts/margin_liquidation/liquidation_vault.mjs +33 -17
- package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +2 -2
- package/dist/pyth/PriceServiceConnection.d.mts +18 -3
- package/dist/pyth/PriceServiceConnection.d.mts.map +1 -1
- package/dist/pyth/PriceServiceConnection.mjs +35 -4
- package/dist/pyth/PriceServiceConnection.mjs.map +1 -1
- package/dist/queries/priceFeedQueries.mjs +50 -18
- package/dist/queries/priceFeedQueries.mjs.map +1 -1
- package/dist/transactions/balanceManager.d.mts +12 -12
- package/dist/transactions/balanceManager.d.mts.map +1 -1
- package/dist/transactions/deepbook.d.mts +20 -20
- package/dist/transactions/deepbook.d.mts.map +1 -1
- package/dist/transactions/deepbookAdmin.d.mts +4 -4
- package/dist/transactions/marginAdmin.d.mts +7 -7
- package/dist/transactions/marginAdmin.d.mts.map +1 -1
- package/dist/transactions/marginAdmin.mjs +2 -2
- package/dist/transactions/marginAdmin.mjs.map +1 -1
- package/dist/transactions/marginLiquidations.d.mts.map +1 -1
- package/dist/transactions/marginLiquidations.mjs +19 -7
- package/dist/transactions/marginLiquidations.mjs.map +1 -1
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginManager.d.mts.map +1 -1
- package/dist/transactions/marginManager.mjs +43 -34
- package/dist/transactions/marginManager.mjs.map +1 -1
- package/dist/transactions/marginPool.d.mts +18 -18
- package/dist/transactions/marginTPSL.d.mts +10 -10
- package/dist/transactions/marginTPSL.d.mts.map +1 -1
- package/dist/transactions/marginTPSL.mjs +19 -10
- package/dist/transactions/marginTPSL.mjs.map +1 -1
- package/dist/transactions/poolProxy.d.mts +8 -8
- package/dist/transactions/poolProxy.d.mts.map +1 -1
- package/dist/transactions/poolProxy.mjs +34 -27
- package/dist/transactions/poolProxy.mjs.map +1 -1
- package/dist/types/index.d.mts +16 -1
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/utils/config.d.mts +30 -10
- package/dist/utils/config.d.mts.map +1 -1
- package/dist/utils/config.mjs +33 -4
- package/dist/utils/config.mjs.map +1 -1
- package/dist/utils/constants.d.mts +32 -1
- package/dist/utils/constants.d.mts.map +1 -1
- package/dist/utils/constants.mjs +55 -24
- package/dist/utils/constants.mjs.map +1 -1
- package/package.json +10 -10
- package/src/client.ts +9 -1
- package/src/contracts/deepbook/balance_manager.ts +1 -2
- package/src/contracts/deepbook/pool.ts +12 -24
- package/src/contracts/deepbook/registry.ts +1 -2
- package/src/contracts/deepbook_margin/margin_manager.ts +149 -28
- package/src/contracts/deepbook_margin/margin_manager_upgraded.ts +646 -0
- package/src/contracts/deepbook_margin/margin_pool.ts +2 -4
- package/src/contracts/deepbook_margin/margin_registry.ts +3 -6
- package/src/contracts/deepbook_margin/oracle.ts +59 -0
- package/src/contracts/deepbook_margin/pool_proxy.ts +597 -584
- package/src/contracts/deepbook_margin/pool_proxy_upgraded.ts +614 -0
- package/src/contracts/deepbook_margin/protocol_config.ts +1 -2
- package/src/contracts/deepbook_margin/tpsl.ts +1 -2
- package/src/contracts/margin_liquidation/liquidation_vault.ts +144 -4
- package/src/contracts/pyth/pyth.ts +2 -4
- package/src/index.ts +4 -0
- package/src/pyth/PriceServiceConnection.ts +69 -8
- package/src/queries/priceFeedQueries.ts +74 -24
- package/src/transactions/marginAdmin.ts +2 -4
- package/src/transactions/marginLiquidations.ts +20 -6
- package/src/transactions/marginManager.ts +43 -33
- package/src/transactions/marginTPSL.ts +19 -9
- package/src/transactions/poolProxy.ts +34 -30
- package/src/types/index.ts +17 -2
- package/src/utils/config.ts +69 -9
- package/src/utils/constants.ts +83 -26
|
@@ -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_transactions0 from "@mysten/sui/transactions";
|
|
4
4
|
import { Transaction } from "@mysten/sui/transactions";
|
|
5
5
|
|
|
6
6
|
//#region src/transactions/deepbook.d.ts
|
|
@@ -380,40 +380,40 @@ declare class DeepBookContract {
|
|
|
380
380
|
* @param {string} referral The referral (DeepBookPoolReferral) to get the balances for
|
|
381
381
|
* @returns A function that takes a Transaction object
|
|
382
382
|
*/
|
|
383
|
-
getPoolReferralBalances: (poolKey: string, referral: string) => (tx: Transaction) =>
|
|
383
|
+
getPoolReferralBalances: (poolKey: string, referral: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
384
384
|
/**
|
|
385
385
|
* @description Get the multiplier for a referral (DeepBookPoolReferral)
|
|
386
386
|
* @param {string} poolKey The key to identify the pool
|
|
387
387
|
* @param {string} referral The referral (DeepBookPoolReferral) to get the multiplier for
|
|
388
388
|
* @returns A function that takes a Transaction object
|
|
389
389
|
*/
|
|
390
|
-
poolReferralMultiplier: (poolKey: string, referral: string) => (tx: Transaction) =>
|
|
390
|
+
poolReferralMultiplier: (poolKey: string, referral: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
391
391
|
/**
|
|
392
392
|
* @description Check if a pool is a stable pool
|
|
393
393
|
* @param {string} poolKey The key to identify the pool
|
|
394
394
|
* @returns A function that takes a Transaction object
|
|
395
395
|
*/
|
|
396
|
-
stablePool: (poolKey: string) => (tx: Transaction) =>
|
|
396
|
+
stablePool: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
397
397
|
/**
|
|
398
398
|
* @description Check if a pool is registered
|
|
399
399
|
* @param {string} poolKey The key to identify the pool
|
|
400
400
|
* @returns A function that takes a Transaction object
|
|
401
401
|
*/
|
|
402
|
-
registeredPool: (poolKey: string) => (tx: Transaction) =>
|
|
402
|
+
registeredPool: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
403
403
|
/**
|
|
404
404
|
* @description Get the quote quantity out for a given base quantity using input token as fee
|
|
405
405
|
* @param {string} poolKey The key to identify the pool
|
|
406
406
|
* @param {number} baseQuantity Base quantity to convert
|
|
407
407
|
* @returns A function that takes a Transaction object
|
|
408
408
|
*/
|
|
409
|
-
getQuoteQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint) => (tx: Transaction) =>
|
|
409
|
+
getQuoteQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
410
410
|
/**
|
|
411
411
|
* @description Get the base quantity out for a given quote quantity using input token as fee
|
|
412
412
|
* @param {string} poolKey The key to identify the pool
|
|
413
413
|
* @param {number} quoteQuantity Quote quantity to convert
|
|
414
414
|
* @returns A function that takes a Transaction object
|
|
415
415
|
*/
|
|
416
|
-
getBaseQuantityOutInputFee: (poolKey: string, quoteQuantity: number | bigint) => (tx: Transaction) =>
|
|
416
|
+
getBaseQuantityOutInputFee: (poolKey: string, quoteQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
417
417
|
/**
|
|
418
418
|
* @description Get the quantity out for a given base or quote quantity using input token as fee
|
|
419
419
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -421,7 +421,7 @@ declare class DeepBookContract {
|
|
|
421
421
|
* @param {number} quoteQuantity Quote quantity to convert
|
|
422
422
|
* @returns A function that takes a Transaction object
|
|
423
423
|
*/
|
|
424
|
-
getQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint, quoteQuantity: number | bigint) => (tx: Transaction) =>
|
|
424
|
+
getQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint, quoteQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
425
425
|
/**
|
|
426
426
|
* @description Get the base quantity needed to receive a target quote quantity
|
|
427
427
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -429,7 +429,7 @@ declare class DeepBookContract {
|
|
|
429
429
|
* @param {boolean} payWithDeep Whether to pay fees with DEEP
|
|
430
430
|
* @returns A function that takes a Transaction object
|
|
431
431
|
*/
|
|
432
|
-
getBaseQuantityIn: (poolKey: string, targetQuoteQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) =>
|
|
432
|
+
getBaseQuantityIn: (poolKey: string, targetQuoteQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
433
433
|
/**
|
|
434
434
|
* @description Get the quote quantity needed to receive a target base quantity
|
|
435
435
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -437,14 +437,14 @@ declare class DeepBookContract {
|
|
|
437
437
|
* @param {boolean} payWithDeep Whether to pay fees with DEEP
|
|
438
438
|
* @returns A function that takes a Transaction object
|
|
439
439
|
*/
|
|
440
|
-
getQuoteQuantityIn: (poolKey: string, targetBaseQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) =>
|
|
440
|
+
getQuoteQuantityIn: (poolKey: string, targetBaseQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
441
441
|
/**
|
|
442
442
|
* @description Get account order details for a balance manager
|
|
443
443
|
* @param {string} poolKey The key to identify the pool
|
|
444
444
|
* @param {string} managerKey Key of the balance manager
|
|
445
445
|
* @returns A function that takes a Transaction object
|
|
446
446
|
*/
|
|
447
|
-
getAccountOrderDetails: (poolKey: string, managerKey: string) => (tx: Transaction) =>
|
|
447
|
+
getAccountOrderDetails: (poolKey: string, managerKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
448
448
|
/**
|
|
449
449
|
* @description Get the DEEP required for an order
|
|
450
450
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -452,51 +452,51 @@ declare class DeepBookContract {
|
|
|
452
452
|
* @param {number} price Price
|
|
453
453
|
* @returns A function that takes a Transaction object
|
|
454
454
|
*/
|
|
455
|
-
getOrderDeepRequired: (poolKey: string, baseQuantity: number | bigint, price: number | bigint) => (tx: Transaction) =>
|
|
455
|
+
getOrderDeepRequired: (poolKey: string, baseQuantity: number | bigint, price: number | bigint) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
456
456
|
/**
|
|
457
457
|
* @description Check if account exists for a balance manager
|
|
458
458
|
* @param {string} poolKey The key to identify the pool
|
|
459
459
|
* @param {string} managerKey Key of the balance manager
|
|
460
460
|
* @returns A function that takes a Transaction object
|
|
461
461
|
*/
|
|
462
|
-
accountExists: (poolKey: string, managerKey: string) => (tx: Transaction) =>
|
|
462
|
+
accountExists: (poolKey: string, managerKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
463
463
|
/**
|
|
464
464
|
* @description Get the next epoch trade parameters for a pool
|
|
465
465
|
* @param {string} poolKey The key to identify the pool
|
|
466
466
|
* @returns A function that takes a Transaction object
|
|
467
467
|
*/
|
|
468
|
-
poolTradeParamsNext: (poolKey: string) => (tx: Transaction) =>
|
|
468
|
+
poolTradeParamsNext: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
469
469
|
/**
|
|
470
470
|
* @description Get the quorum for a pool
|
|
471
471
|
* @param {string} poolKey The key to identify the pool
|
|
472
472
|
* @returns A function that takes a Transaction object
|
|
473
473
|
*/
|
|
474
|
-
quorum: (poolKey: string) => (tx: Transaction) =>
|
|
474
|
+
quorum: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
475
475
|
/**
|
|
476
476
|
* @description Get the pool ID
|
|
477
477
|
* @param {string} poolKey The key to identify the pool
|
|
478
478
|
* @returns A function that takes a Transaction object
|
|
479
479
|
*/
|
|
480
|
-
poolId: (poolKey: string) => (tx: Transaction) =>
|
|
480
|
+
poolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
481
481
|
/**
|
|
482
482
|
* @description Check if a limit order can be placed
|
|
483
483
|
* @param {CanPlaceLimitOrderParams} params Parameters for checking limit order validity
|
|
484
484
|
* @returns A function that takes a Transaction object
|
|
485
485
|
*/
|
|
486
|
-
canPlaceLimitOrder: (params: CanPlaceLimitOrderParams) => (tx: Transaction) =>
|
|
486
|
+
canPlaceLimitOrder: (params: CanPlaceLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
487
487
|
/**
|
|
488
488
|
* @description Check if a market order can be placed
|
|
489
489
|
* @param {CanPlaceMarketOrderParams} params Parameters for checking market order validity
|
|
490
490
|
* @returns A function that takes a Transaction object
|
|
491
491
|
*/
|
|
492
|
-
canPlaceMarketOrder: (params: CanPlaceMarketOrderParams) => (tx: Transaction) =>
|
|
492
|
+
canPlaceMarketOrder: (params: CanPlaceMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
493
493
|
/**
|
|
494
494
|
* @description Check if market order params are valid
|
|
495
495
|
* @param {string} poolKey The key to identify the pool
|
|
496
496
|
* @param {number} quantity Quantity
|
|
497
497
|
* @returns A function that takes a Transaction object
|
|
498
498
|
*/
|
|
499
|
-
checkMarketOrderParams: (poolKey: string, quantity: number | bigint) => (tx: Transaction) =>
|
|
499
|
+
checkMarketOrderParams: (poolKey: string, quantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
500
500
|
/**
|
|
501
501
|
* @description Check if limit order params are valid
|
|
502
502
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -505,7 +505,7 @@ declare class DeepBookContract {
|
|
|
505
505
|
* @param {number} expireTimestamp Expiration timestamp
|
|
506
506
|
* @returns A function that takes a Transaction object
|
|
507
507
|
*/
|
|
508
|
-
checkLimitOrderParams: (poolKey: string, price: number | bigint, quantity: number | bigint, expireTimestamp: number) => (tx: Transaction) =>
|
|
508
|
+
checkLimitOrderParams: (poolKey: string, price: number | bigint, quantity: number | bigint, expireTimestamp: number) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
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A,CAAA,iBAAA;EAqFlF;;;;;;;EA/DA,oBAAA,GACE,OAAA,UAAiB,YAAA,mBAA+B,KAAA,uBAChD,EAAA,EAAI,WAAA,KAAW,yBAAA,CAAA,iBAAA;EAgFc;;;;;;EA1D/B,aAAA,GAAiB,OAAA,UAAiB,UAAA,cAAwB,EAAA,EAAI,WAAA,KAAW,yBAAA,CAAA,iBAAA;EA6EE;;;;;EAzD3E,mBAAA,GAAuB,OAAA,cAAqB,EAAA,EAAI,WAAA,KAAW,yBAAA,CAAA,iBAAA;EA0FkB;;;;;EAvE7E,MAAA,GAAU,OAAA,cAAqB,EAAA,EAAI,WAAA,KAAW,yBAAA,CAAA,iBAAA;EAqG2C;;;;;EAlFzF,MAAA,GAAU,OAAA,cAAqB,EAAA,EAAI,WAAA,KAAW,yBAAA,CAAA,iBAAA;EA2GxC;;;;;EAxFN,kBAAA,GAAsB,MAAA,EAAQ,wBAAA,MAA8B,EAAA,EAAI,WAAA,KAAW,yBAAA,CAAA,iBAAA;;;;;;EAiC3E,mBAAA,GAAuB,MAAA,EAAQ,yBAAA,MAA+B,EAAA,EAAI,WAAA,KAAW,yBAAA,CAAA,iBAAA;;;;;;;EA8B7E,sBAAA,GAA0B,OAAA,UAAiB,QAAA,uBAA+B,EAAA,EAAI,WAAA,KAAW,yBAAA,CAAA,iBAAA;;;;;;;;;EAuBzF,qBAAA,GACE,OAAA,UAAiB,KAAA,mBAAwB,QAAA,mBAA2B,eAAA,cACpE,EAAA,EAAI,WAAA,KAAW,yBAAA,CAAA,iBAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CreatePoolAdminParams, SetEwmaParams } from "../types/index.mjs";
|
|
2
2
|
import { DeepBookConfig } from "../utils/config.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _mysten_sui_transactions42 from "@mysten/sui/transactions";
|
|
4
4
|
import { Transaction } from "@mysten/sui/transactions";
|
|
5
5
|
|
|
6
6
|
//#region src/transactions/deepbookAdmin.d.ts
|
|
@@ -104,7 +104,7 @@ declare class DeepBookAdminContract {
|
|
|
104
104
|
* @description Deauthorize the MarginApp by removing its authorization key
|
|
105
105
|
* @returns A function that takes a Transaction object and returns a bool
|
|
106
106
|
*/
|
|
107
|
-
deauthorizeMarginApp: () => (tx: Transaction) =>
|
|
107
|
+
deauthorizeMarginApp: () => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
|
|
108
108
|
/**
|
|
109
109
|
* @description Mint a `DeepbookCorePauseCap`. The new cap's ID is recorded
|
|
110
110
|
* in the core registry so it can later disable any allowed package version
|
|
@@ -112,7 +112,7 @@ declare class DeepBookAdminContract {
|
|
|
112
112
|
* `MarginAdminContract.mintPauseCap`.
|
|
113
113
|
* @returns A function that takes a Transaction object and returns the new pause cap
|
|
114
114
|
*/
|
|
115
|
-
mintCorePauseCap: () => (tx: Transaction) =>
|
|
115
|
+
mintCorePauseCap: () => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
|
|
116
116
|
/**
|
|
117
117
|
* @description Revoke a previously minted `DeepbookCorePauseCap` by ID.
|
|
118
118
|
* @param {string} pauseCapId The ID of the core pause cap to revoke
|
|
@@ -133,7 +133,7 @@ declare class DeepBookAdminContract {
|
|
|
133
133
|
* core registry.
|
|
134
134
|
* @returns A function that takes a Transaction object and returns a `VecSet<ID>`
|
|
135
135
|
*/
|
|
136
|
-
corePauseCaps: () => (tx: Transaction) =>
|
|
136
|
+
corePauseCaps: () => (tx: Transaction) => _mysten_sui_transactions42.TransactionResult;
|
|
137
137
|
}
|
|
138
138
|
//#endregion
|
|
139
139
|
export { DeepBookAdminContract };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PoolConfigParams } from "../types/index.mjs";
|
|
2
2
|
import { DeepBookConfig } from "../utils/config.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _mysten_sui_transactions93 from "@mysten/sui/transactions";
|
|
4
4
|
import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
|
|
5
5
|
|
|
6
6
|
//#region src/transactions/marginAdmin.d.ts
|
|
@@ -17,7 +17,7 @@ declare class MarginAdminContract {
|
|
|
17
17
|
* @description Mint a maintainer cap
|
|
18
18
|
* @returns A function that takes a Transaction object
|
|
19
19
|
*/
|
|
20
|
-
mintMaintainerCap: () => (tx: Transaction) =>
|
|
20
|
+
mintMaintainerCap: () => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
|
|
21
21
|
/**
|
|
22
22
|
* @description Revoke a maintainer cap
|
|
23
23
|
* @returns A function that takes a Transaction object
|
|
@@ -121,7 +121,7 @@ declare class MarginAdminContract {
|
|
|
121
121
|
* @param {PoolConfigParams} poolConfigParams The parameters for the pool config
|
|
122
122
|
* @returns A function that takes a Transaction object
|
|
123
123
|
*/
|
|
124
|
-
newPoolConfig: (poolKey: string, poolConfigParams: PoolConfigParams) => (tx: Transaction) =>
|
|
124
|
+
newPoolConfig: (poolKey: string, poolConfigParams: PoolConfigParams) => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
|
|
125
125
|
/**
|
|
126
126
|
* @description Create a new pool config with leverage
|
|
127
127
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -136,7 +136,7 @@ declare class MarginAdminContract {
|
|
|
136
136
|
* @param {number} maxEwmaDifferenceBps The maximum EWMA difference in basis points
|
|
137
137
|
* @returns A function that takes a Transaction object
|
|
138
138
|
*/
|
|
139
|
-
newCoinTypeData: (coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number) => (tx: Transaction) =>
|
|
139
|
+
newCoinTypeData: (coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number) => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
|
|
140
140
|
/**
|
|
141
141
|
* @description Create a new Pyth config
|
|
142
142
|
* @param {Array<{coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number}>} coinSetups The coins with their oracle config to be added to the Pyth config
|
|
@@ -147,12 +147,12 @@ declare class MarginAdminContract {
|
|
|
147
147
|
coinKey: string;
|
|
148
148
|
maxConfBps: number;
|
|
149
149
|
maxEwmaDifferenceBps: number;
|
|
150
|
-
}>, maxAgeSeconds: number) => (tx: Transaction) =>
|
|
150
|
+
}>, maxAgeSeconds: number) => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
|
|
151
151
|
/**
|
|
152
152
|
* @description Mint a pause cap
|
|
153
153
|
* @returns A function that takes a Transaction object
|
|
154
154
|
*/
|
|
155
|
-
mintPauseCap: () => (tx: Transaction) =>
|
|
155
|
+
mintPauseCap: () => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
|
|
156
156
|
/**
|
|
157
157
|
* @description Revoke a pause cap
|
|
158
158
|
* @param {string} pauseCapId The ID of the pause cap to revoke
|
|
@@ -172,7 +172,7 @@ declare class MarginAdminContract {
|
|
|
172
172
|
* @param {string} coinKey The key to identify the margin pool
|
|
173
173
|
* @returns A function that takes a Transaction object and returns a Coin<Asset>
|
|
174
174
|
*/
|
|
175
|
-
adminWithdrawDefaultReferralFees: (coinKey: string) => (tx: Transaction) =>
|
|
175
|
+
adminWithdrawDefaultReferralFees: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
|
|
176
176
|
}
|
|
177
177
|
//#endregion
|
|
178
178
|
export { MarginAdminContract };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marginAdmin.d.mts","names":[],"sources":["../../src/transactions/marginAdmin.ts"],"mappings":";;;;;;;;AAkBA;cAAa,mBAAA;EAAA;EAMQ;;;cAAR,MAAA,EAAQ,cAAA;EAwDW;;;;EApC/B,iBAAA,SAA2B,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAwGoC;;;;EA3F9E,mBAAA,GAAuB,eAAA,cAA6B,EAAA,EAAI,WAAA;EAiOnC;;;;;;EA3MrB,oBAAA,GACE,OAAA,UAAiB,UAAA,EAAY,mBAAA,MAAyB,EAAA,EAAI,WAAA;EAiR6B;;;;;EA1PzF,kBAAA,G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,EAAA,EAAI,WAAA;EAmBS;;;;;;EAApD,aAAA,GAAiB,OAAA,UAAiB,gBAAA,EAAkB,gBAAA,MAAsB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAmC3C;;;;;;EAA9C,yBAAA,GAA6B,OAAA,UAAiB,QAAA,cAAsB,EAAA,EAAI,WAAA;EAwBK;;;;;;;EAD7E,eAAA,GACE,OAAA,UAAiB,UAAA,UAAoB,oBAAA,cAAkC,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EA4BtF;;;;;;EAFF,aAAA,GAEE,UAAA,EAAY,KAAA;IAAQ,OAAA;IAAiB,UAAA;IAAoB,oBAAA;EAAA,IACzD,aAAA,cAEA,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAuC6B;;;;EAd9C,YAAA,SAAsB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAiCkC;;;;;EAnBvE,cAAA,GAAkB,UAAA,cAAwB,EAAA,EAAI,WAAA;EAsC0B;;;;;;EAnBxE,sBAAA,GAA0B,OAAA,UAAiB,UAAA,cAAwB,EAAA,EAAI,WAAA;;;;;;;EAmBvE,gCAAA,GAAoC,OAAA,cAAqB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;AAAA"}
|
|
@@ -228,8 +228,8 @@ var MarginAdminContract = class {
|
|
|
228
228
|
};
|
|
229
229
|
this.newCoinTypeData = (coinKey, maxConfBps, maxEwmaDifferenceBps) => (tx) => {
|
|
230
230
|
const coin = this.#config.getCoin(coinKey);
|
|
231
|
-
|
|
232
|
-
const priceFeedInput = new Uint8Array(hexToBytes(
|
|
231
|
+
const feed = this.#config.getFeedId(coinKey);
|
|
232
|
+
const priceFeedInput = new Uint8Array(hexToBytes(feed.startsWith("0x") ? feed.slice(2) : feed));
|
|
233
233
|
return tx.add(newCoinTypeDataFromCurrency({
|
|
234
234
|
package: this.#config.MARGIN_PACKAGE_ID,
|
|
235
235
|
arguments: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marginAdmin.mjs","names":["marginRegistryMoveCalls.mintMaintainerCap","#config","#marginAdminCap","marginRegistryMoveCalls.registerDeepbookPool","marginRegistryMoveCalls.enableDeepbookPool","marginRegistryMoveCalls.disableDeepbookPool","marginRegistryMoveCalls.updateRiskParams","marginRegistryMoveCalls.setPriceTolerance","marginRegistryMoveCalls.setMaxPriceAge","marginRegistryMoveCalls.setMaxOrderTtl","marginRegistryMoveCalls.setMinOpenRiskRatio","marginRegistryMoveCalls.addConfig","marginRegistryMoveCalls.removeConfig","marginRegistryMoveCalls.enableVersion","marginRegistryMoveCalls.disableVersion","marginRegistryMoveCalls.newPoolConfig","marginRegistryMoveCalls.newPoolConfigWithLeverage","oracleMoveCalls.newCoinTypeDataFromCurrency","oracleMoveCalls.newPythConfig","marginRegistryMoveCalls.mintPauseCap","marginRegistryMoveCalls.revokePauseCap","marginRegistryMoveCalls.disableVersionPauseCap","marginPoolMoveCalls.adminWithdrawDefaultReferralFees"],"sources":["../../src/transactions/marginAdmin.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport type { TransactionArgument } from '@mysten/sui/transactions';\nimport type { PoolConfigParams } from '../types/index.js';\nimport { FLOAT_SCALAR } from '../utils/config.js';\nimport { convertRate } from '../utils/conversion.js';\nimport { hexToBytes } from '@noble/hashes/utils.js';\nimport * as marginRegistryMoveCalls from '../contracts/deepbook_margin/margin_registry.js';\nimport * as marginPoolMoveCalls from '../contracts/deepbook_margin/margin_pool.js';\nimport * as oracleMoveCalls from '../contracts/deepbook_margin/oracle.js';\n\n/**\n * MarginAdminContract class for managing admin actions.\n */\nexport class MarginAdminContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginAdminContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @returns The admin capability required for admin operations\n\t * @throws Error if the admin capability is not set\n\t */\n\t#marginAdminCap() {\n\t\tconst marginAdminCap = this.#config.marginAdminCap;\n\t\tif (!marginAdminCap) {\n\t\t\tthrow new Error('MARGIN_ADMIN_CAP environment variable not set');\n\t\t}\n\t\treturn marginAdminCap;\n\t}\n\n\t/**\n\t * @description Mint a maintainer cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintMaintainerCap = () => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tmarginRegistryMoveCalls.mintMaintainerCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.MARGIN_REGISTRY_ID, AdminCap: this.#marginAdminCap() },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Revoke a maintainer cap\n\t * @returns A function that takes a Transaction object\n\t */\n\trevokeMaintainerCap = (maintainerCapId: string) => (tx: Transaction) => {\n\t\t// NOTE: left as a positional moveCall (not codegen). The original passes\n\t\t// `maintainerCapId` as an object reference (`tx.object`), whereas the\n\t\t// generated binding encodes it as a pure `ID` value — migrating would change\n\t\t// the emitted PTB. Kept verbatim to stay byte-identical.\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::revoke_maintainer_cap`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\ttx.object(maintainerCapId),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Register a deepbook pool\n\t * @param {string} poolKey The key of the pool to be registered\n\t * @param {TransactionArgument} poolConfig The configuration of the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tregisterDeepbookPool =\n\t\t(poolKey: string, poolConfig: TransactionArgument) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\ttx.add(\n\t\t\t\tmarginRegistryMoveCalls.registerDeepbookPool({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tpoolConfig,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Enable a deepbook pool for margin trading\n\t * @param {string} poolKey The key of the pool to be enabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableDeepbookPool = (poolKey: string) => (tx: 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\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.enableDeepbookPool({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Disable a deepbook pool from margin trading\n\t * @param {string} poolKey The key of the pool to be disabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableDeepbookPool = (poolKey: string) => (tx: 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\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.disableDeepbookPool({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Update the risk parameters for a margin\n\t * @param {string} poolKey The key of the pool to be updated\n\t * @param {TransactionArgument} poolConfig The configuration of the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateRiskParams = (poolKey: string, poolConfig: TransactionArgument) => (tx: 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\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.updateRiskParams({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tpoolConfig,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the price deviation tolerance for a pool. `tolerance` is\n\t * in 9-decimal float scaling (1.0 = `FLOAT_SCALAR`); the SDK applies the\n\t * scaling, so callers pass a human-readable fraction (e.g. `0.1` for 10%).\n\t * Requires the pool's current price to have been initialized via\n\t * `PoolProxyContract.updateCurrentPrice` first.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} tolerance Tolerance as a fraction (e.g. 0.1 for 10%)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetPriceTolerance = (poolKey: string, tolerance: number | bigint) => (tx: 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\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.setPriceTolerance({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\ttolerance: convertRate(tolerance, FLOAT_SCALAR),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the maximum acceptable Pyth price age (in milliseconds)\n\t * for a pool. Requires the pool's current price to have been initialized\n\t * via `PoolProxyContract.updateCurrentPrice` first.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} maxAgeMs Max age in milliseconds (raw u64)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMaxPriceAge = (poolKey: string, maxAgeMs: number | bigint) => (tx: 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\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.setMaxPriceAge({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tmaxAgeMs,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the maximum lifetime (in milliseconds) of margin limit\n\t * orders for a pool. `pool_proxy::place_limit_order_v2` and\n\t * `place_reduce_only_limit_order_v2` clamp the user-supplied\n\t * `expire_timestamp` to at most `now + max_order_ttl_ms`, bounding margin\n\t * orders' exposure to stale-price exploitation.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} maxOrderTtlMs Max order TTL in milliseconds (raw u64)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMaxOrderTtl = (poolKey: string, maxOrderTtlMs: number | bigint) => (tx: 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\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.setMaxOrderTtl({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tmaxOrderTtlMs,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the minimum risk ratio required to open a new position on\n\t * a pool. Distinct from the borrow floor: this gates position opening, not\n\t * borrowing. Stored in 9-decimal float scaling (1.0 = `FLOAT_SCALAR`); the SDK\n\t * applies the scaling, so callers pass a human-readable ratio (e.g. `1.25`).\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} minOpenRiskRatio Minimum open risk ratio (e.g. 1.25)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMinOpenRiskRatio =\n\t\t(poolKey: string, minOpenRiskRatio: number | bigint) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\ttx.add(\n\t\t\t\tmarginRegistryMoveCalls.setMinOpenRiskRatio({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tminOpenRiskRatio: convertRate(minOpenRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Add the PythConfig to the margin registry\n\t * @param {Transaction} tx The transaction object\n\t * @param {TransactionArgument} config The config to be added\n\t * @returns A function that takes a Transaction object\n\t */\n\taddConfig = (config: TransactionArgument) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.addConfig({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tconfig,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::oracle::PythConfig`],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Remove the PythConfig from the margin registry\n\t * @param {Transaction} tx The transaction object\n\t * @returns A function that takes a Transaction object\n\t */\n\tremoveConfig = () => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.removeConfig({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.MARGIN_REGISTRY_ID, AdminCap: this.#marginAdminCap() },\n\t\t\t\ttypeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::oracle::PythConfig`],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Enable a specific version\n\t * @param {number} version The version to be enabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.enableVersion({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tversion,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Disable a specific version\n\t * @param {number} version The version to be disabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.disableVersion({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tversion,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Create a new pool config\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {PoolConfigParams} poolConfigParams The parameters for the pool config\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPoolConfig = (poolKey: string, poolConfigParams: PoolConfigParams) => (tx: 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\t\tconst {\n\t\t\tminWithdrawRiskRatio,\n\t\t\tminBorrowRiskRatio,\n\t\t\tliquidationRiskRatio,\n\t\t\ttargetLiquidationRiskRatio,\n\t\t\tuserLiquidationReward,\n\t\t\tpoolLiquidationReward,\n\t\t} = poolConfigParams;\n\t\treturn tx.add(\n\t\t\tmarginRegistryMoveCalls.newPoolConfig({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tminWithdrawRiskRatio: convertRate(minWithdrawRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\tminBorrowRiskRatio: convertRate(minBorrowRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\tliquidationRiskRatio: convertRate(liquidationRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\ttargetLiquidationRiskRatio: convertRate(targetLiquidationRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\tuserLiquidationReward: convertRate(userLiquidationReward, FLOAT_SCALAR),\n\t\t\t\t\tpoolLiquidationReward: convertRate(poolLiquidationReward, FLOAT_SCALAR),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Create a new pool config with leverage\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} leverage The leverage for the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPoolConfigWithLeverage = (poolKey: string, leverage: number) => (tx: 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\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.newPoolConfigWithLeverage({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tleverage: convertRate(leverage, FLOAT_SCALAR),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Create a new coin type data\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {number} maxConfBps The maximum confidence interval in basis points\n\t * @param {number} maxEwmaDifferenceBps The maximum EWMA difference in basis points\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewCoinTypeData =\n\t\t(coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number) => (tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tif (!coin.feed) {\n\t\t\t\tthrow new Error('Coin feed not found');\n\t\t\t}\n\t\t\tconst priceFeedInput = new Uint8Array(\n\t\t\t\thexToBytes(coin['feed']!.startsWith('0x') ? coin.feed!.slice(2) : coin['feed']),\n\t\t\t);\n\t\t\treturn tx.add(\n\t\t\t\toracleMoveCalls.newCoinTypeDataFromCurrency({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tcurrency: coin.currencyId!,\n\t\t\t\t\t\tpriceFeedId: Array.from(priceFeedInput),\n\t\t\t\t\t\tmaxConfBps,\n\t\t\t\t\t\tmaxEwmaDifferenceBps,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Create a new Pyth config\n\t * @param {Array<{coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number}>} coinSetups The coins with their oracle config to be added to the Pyth config\n\t * @param {number} maxAgeSeconds The max age in seconds for the Pyth config\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPythConfig =\n\t\t(\n\t\t\tcoinSetups: Array<{ coinKey: string; maxConfBps: number; maxEwmaDifferenceBps: number }>,\n\t\t\tmaxAgeSeconds: number,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst coinTypeDataList = [];\n\t\t\tfor (const setup of coinSetups) {\n\t\t\t\tcoinTypeDataList.push(\n\t\t\t\t\tthis.newCoinTypeData(setup.coinKey, setup.maxConfBps, setup.maxEwmaDifferenceBps)(tx),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn tx.add(\n\t\t\t\toracleMoveCalls.newPythConfig({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tsetups: tx.makeMoveVec({\n\t\t\t\t\t\t\telements: coinTypeDataList,\n\t\t\t\t\t\t\ttype: `${this.#config.MARGIN_PACKAGE_ID}::oracle::CoinTypeData`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tmaxAgeSecs: maxAgeSeconds,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Mint a pause cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintPauseCap = () => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tmarginRegistryMoveCalls.mintPauseCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.MARGIN_REGISTRY_ID, AdminCap: this.#marginAdminCap() },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Revoke a pause cap\n\t * @param {string} pauseCapId The ID of the pause cap to revoke\n\t * @returns A function that takes a Transaction object\n\t */\n\trevokePauseCap = (pauseCapId: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.revokePauseCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpauseCapId,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Disable a version using pause cap\n\t * @param {number} version The version to disable\n\t * @param {string} pauseCapId The ID of the pause cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersionPauseCap = (version: number, pauseCapId: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.disableVersionPauseCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tversion,\n\t\t\t\t\tpauseCap: pauseCapId,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Withdraw the default referral fees (admin only)\n\t * The default referral at 0x0 doesn't have a SupplyReferral object\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @returns A function that takes a Transaction object and returns a Coin<Asset>\n\t */\n\tadminWithdrawDefaultReferralFees = (coinKey: string) => (tx: Transaction) => {\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.add(\n\t\t\tmarginPoolMoveCalls.adminWithdrawDefaultReferralFees({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: marginPool.address,\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [coin.type],\n\t\t\t}),\n\t\t);\n\t};\n}\n"],"mappings":";;;;;;;;;;;AAkBA,IAAa,sBAAb,MAAiC;CAChC;;;;CAKA,YAAY,QAAwB;kCAoBT,OAAoB;AAC9C,UAAO,GAAG,IACTA,kBAA0C;IACzC,SAAS,MAAKC,OAAQ;IACtB,WAAW;KAAE,MAAM,MAAKA,OAAQ;KAAoB,UAAU,MAAKC,gBAAiB;KAAE;IACtF,CAAC,CACF;;8BAOqB,qBAA6B,OAAoB;AAKvE,MAAG,SAAS;IACX,QAAQ,GAAG,MAAKD,OAAQ,kBAAkB;IAC1C,WAAW;KACV,GAAG,OAAO,MAAKA,OAAQ,mBAAmB;KAC1C,GAAG,OAAO,MAAKC,gBAAiB,CAAC;KACjC,GAAG,OAAO,gBAAgB;KAC1B,GAAG,OAAO,OAAO;KACjB;IACD,CAAC;;+BAUD,SAAiB,gBAAqC,OAAoB;GAC1E,MAAM,OAAO,MAAKD,O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AoB;GAC5E,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;GAC1C,MAAM,aAAa,MAAKA,OAAQ,cAAc,QAAQ;AACtD,UAAO,GAAG,IACTqB,iCAAqD;IACpD,SAAS,MAAKrB,OAAQ;IACtB,WAAW;KACV,MAAM,WAAW;KACjB,UAAU,MAAKA,OAAQ;KACvB,UAAU,MAAKC,gBAAiB;KAChC;IACD,eAAe,CAAC,KAAK,KAAK;IAC1B,CAAC,CACF;;AA9fD,QAAKD,SAAU;;;;;;CAOhB,kBAAkB;EACjB,MAAM,iBAAiB,MAAKA,OAAQ;AACpC,MAAI,CAAC,eACJ,OAAM,IAAI,MAAM,gDAAgD;AAEjE,SAAO"}
|
|
1
|
+
{"version":3,"file":"marginAdmin.mjs","names":["marginRegistryMoveCalls.mintMaintainerCap","#config","#marginAdminCap","marginRegistryMoveCalls.registerDeepbookPool","marginRegistryMoveCalls.enableDeepbookPool","marginRegistryMoveCalls.disableDeepbookPool","marginRegistryMoveCalls.updateRiskParams","marginRegistryMoveCalls.setPriceTolerance","marginRegistryMoveCalls.setMaxPriceAge","marginRegistryMoveCalls.setMaxOrderTtl","marginRegistryMoveCalls.setMinOpenRiskRatio","marginRegistryMoveCalls.addConfig","marginRegistryMoveCalls.removeConfig","marginRegistryMoveCalls.enableVersion","marginRegistryMoveCalls.disableVersion","marginRegistryMoveCalls.newPoolConfig","marginRegistryMoveCalls.newPoolConfigWithLeverage","oracleMoveCalls.newCoinTypeDataFromCurrency","oracleMoveCalls.newPythConfig","marginRegistryMoveCalls.mintPauseCap","marginRegistryMoveCalls.revokePauseCap","marginRegistryMoveCalls.disableVersionPauseCap","marginPoolMoveCalls.adminWithdrawDefaultReferralFees"],"sources":["../../src/transactions/marginAdmin.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport type { TransactionArgument } from '@mysten/sui/transactions';\nimport type { PoolConfigParams } from '../types/index.js';\nimport { FLOAT_SCALAR } from '../utils/config.js';\nimport { convertRate } from '../utils/conversion.js';\nimport { hexToBytes } from '@noble/hashes/utils.js';\nimport * as marginRegistryMoveCalls from '../contracts/deepbook_margin/margin_registry.js';\nimport * as marginPoolMoveCalls from '../contracts/deepbook_margin/margin_pool.js';\nimport * as oracleMoveCalls from '../contracts/deepbook_margin/oracle.js';\n\n/**\n * MarginAdminContract class for managing admin actions.\n */\nexport class MarginAdminContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginAdminContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @returns The admin capability required for admin operations\n\t * @throws Error if the admin capability is not set\n\t */\n\t#marginAdminCap() {\n\t\tconst marginAdminCap = this.#config.marginAdminCap;\n\t\tif (!marginAdminCap) {\n\t\t\tthrow new Error('MARGIN_ADMIN_CAP environment variable not set');\n\t\t}\n\t\treturn marginAdminCap;\n\t}\n\n\t/**\n\t * @description Mint a maintainer cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintMaintainerCap = () => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tmarginRegistryMoveCalls.mintMaintainerCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.MARGIN_REGISTRY_ID, AdminCap: this.#marginAdminCap() },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Revoke a maintainer cap\n\t * @returns A function that takes a Transaction object\n\t */\n\trevokeMaintainerCap = (maintainerCapId: string) => (tx: Transaction) => {\n\t\t// NOTE: left as a positional moveCall (not codegen). The original passes\n\t\t// `maintainerCapId` as an object reference (`tx.object`), whereas the\n\t\t// generated binding encodes it as a pure `ID` value — migrating would change\n\t\t// the emitted PTB. Kept verbatim to stay byte-identical.\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::revoke_maintainer_cap`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\ttx.object(maintainerCapId),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Register a deepbook pool\n\t * @param {string} poolKey The key of the pool to be registered\n\t * @param {TransactionArgument} poolConfig The configuration of the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tregisterDeepbookPool =\n\t\t(poolKey: string, poolConfig: TransactionArgument) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\ttx.add(\n\t\t\t\tmarginRegistryMoveCalls.registerDeepbookPool({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tpoolConfig,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Enable a deepbook pool for margin trading\n\t * @param {string} poolKey The key of the pool to be enabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableDeepbookPool = (poolKey: string) => (tx: 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\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.enableDeepbookPool({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Disable a deepbook pool from margin trading\n\t * @param {string} poolKey The key of the pool to be disabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableDeepbookPool = (poolKey: string) => (tx: 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\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.disableDeepbookPool({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Update the risk parameters for a margin\n\t * @param {string} poolKey The key of the pool to be updated\n\t * @param {TransactionArgument} poolConfig The configuration of the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateRiskParams = (poolKey: string, poolConfig: TransactionArgument) => (tx: 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\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.updateRiskParams({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tpoolConfig,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the price deviation tolerance for a pool. `tolerance` is\n\t * in 9-decimal float scaling (1.0 = `FLOAT_SCALAR`); the SDK applies the\n\t * scaling, so callers pass a human-readable fraction (e.g. `0.1` for 10%).\n\t * Requires the pool's current price to have been initialized via\n\t * `PoolProxyContract.updateCurrentPrice` first.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} tolerance Tolerance as a fraction (e.g. 0.1 for 10%)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetPriceTolerance = (poolKey: string, tolerance: number | bigint) => (tx: 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\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.setPriceTolerance({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\ttolerance: convertRate(tolerance, FLOAT_SCALAR),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the maximum acceptable Pyth price age (in milliseconds)\n\t * for a pool. Requires the pool's current price to have been initialized\n\t * via `PoolProxyContract.updateCurrentPrice` first.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} maxAgeMs Max age in milliseconds (raw u64)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMaxPriceAge = (poolKey: string, maxAgeMs: number | bigint) => (tx: 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\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.setMaxPriceAge({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tmaxAgeMs,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the maximum lifetime (in milliseconds) of margin limit\n\t * orders for a pool. `pool_proxy::place_limit_order_v2` and\n\t * `place_reduce_only_limit_order_v2` clamp the user-supplied\n\t * `expire_timestamp` to at most `now + max_order_ttl_ms`, bounding margin\n\t * orders' exposure to stale-price exploitation.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} maxOrderTtlMs Max order TTL in milliseconds (raw u64)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMaxOrderTtl = (poolKey: string, maxOrderTtlMs: number | bigint) => (tx: 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\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.setMaxOrderTtl({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tmaxOrderTtlMs,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the minimum risk ratio required to open a new position on\n\t * a pool. Distinct from the borrow floor: this gates position opening, not\n\t * borrowing. Stored in 9-decimal float scaling (1.0 = `FLOAT_SCALAR`); the SDK\n\t * applies the scaling, so callers pass a human-readable ratio (e.g. `1.25`).\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} minOpenRiskRatio Minimum open risk ratio (e.g. 1.25)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMinOpenRiskRatio =\n\t\t(poolKey: string, minOpenRiskRatio: number | bigint) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\ttx.add(\n\t\t\t\tmarginRegistryMoveCalls.setMinOpenRiskRatio({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tminOpenRiskRatio: convertRate(minOpenRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Add the PythConfig to the margin registry\n\t * @param {Transaction} tx The transaction object\n\t * @param {TransactionArgument} config The config to be added\n\t * @returns A function that takes a Transaction object\n\t */\n\taddConfig = (config: TransactionArgument) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.addConfig({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tconfig,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::oracle::PythConfig`],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Remove the PythConfig from the margin registry\n\t * @param {Transaction} tx The transaction object\n\t * @returns A function that takes a Transaction object\n\t */\n\tremoveConfig = () => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.removeConfig({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.MARGIN_REGISTRY_ID, AdminCap: this.#marginAdminCap() },\n\t\t\t\ttypeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::oracle::PythConfig`],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Enable a specific version\n\t * @param {number} version The version to be enabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.enableVersion({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tversion,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Disable a specific version\n\t * @param {number} version The version to be disabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.disableVersion({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tversion,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Create a new pool config\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {PoolConfigParams} poolConfigParams The parameters for the pool config\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPoolConfig = (poolKey: string, poolConfigParams: PoolConfigParams) => (tx: 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\t\tconst {\n\t\t\tminWithdrawRiskRatio,\n\t\t\tminBorrowRiskRatio,\n\t\t\tliquidationRiskRatio,\n\t\t\ttargetLiquidationRiskRatio,\n\t\t\tuserLiquidationReward,\n\t\t\tpoolLiquidationReward,\n\t\t} = poolConfigParams;\n\t\treturn tx.add(\n\t\t\tmarginRegistryMoveCalls.newPoolConfig({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tminWithdrawRiskRatio: convertRate(minWithdrawRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\tminBorrowRiskRatio: convertRate(minBorrowRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\tliquidationRiskRatio: convertRate(liquidationRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\ttargetLiquidationRiskRatio: convertRate(targetLiquidationRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\tuserLiquidationReward: convertRate(userLiquidationReward, FLOAT_SCALAR),\n\t\t\t\t\tpoolLiquidationReward: convertRate(poolLiquidationReward, FLOAT_SCALAR),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Create a new pool config with leverage\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} leverage The leverage for the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPoolConfigWithLeverage = (poolKey: string, leverage: number) => (tx: 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\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.newPoolConfigWithLeverage({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tleverage: convertRate(leverage, FLOAT_SCALAR),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Create a new coin type data\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {number} maxConfBps The maximum confidence interval in basis points\n\t * @param {number} maxEwmaDifferenceBps The maximum EWMA difference in basis points\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewCoinTypeData =\n\t\t(coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number) => (tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst feed = this.#config.getFeedId(coinKey);\n\t\t\tconst priceFeedInput = new Uint8Array(\n\t\t\t\thexToBytes(feed.startsWith('0x') ? feed.slice(2) : feed),\n\t\t\t);\n\t\t\treturn tx.add(\n\t\t\t\toracleMoveCalls.newCoinTypeDataFromCurrency({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tcurrency: coin.currencyId!,\n\t\t\t\t\t\tpriceFeedId: Array.from(priceFeedInput),\n\t\t\t\t\t\tmaxConfBps,\n\t\t\t\t\t\tmaxEwmaDifferenceBps,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Create a new Pyth config\n\t * @param {Array<{coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number}>} coinSetups The coins with their oracle config to be added to the Pyth config\n\t * @param {number} maxAgeSeconds The max age in seconds for the Pyth config\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPythConfig =\n\t\t(\n\t\t\tcoinSetups: Array<{ coinKey: string; maxConfBps: number; maxEwmaDifferenceBps: number }>,\n\t\t\tmaxAgeSeconds: number,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst coinTypeDataList = [];\n\t\t\tfor (const setup of coinSetups) {\n\t\t\t\tcoinTypeDataList.push(\n\t\t\t\t\tthis.newCoinTypeData(setup.coinKey, setup.maxConfBps, setup.maxEwmaDifferenceBps)(tx),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn tx.add(\n\t\t\t\toracleMoveCalls.newPythConfig({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tsetups: tx.makeMoveVec({\n\t\t\t\t\t\t\telements: coinTypeDataList,\n\t\t\t\t\t\t\ttype: `${this.#config.MARGIN_PACKAGE_ID}::oracle::CoinTypeData`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tmaxAgeSecs: maxAgeSeconds,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Mint a pause cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintPauseCap = () => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tmarginRegistryMoveCalls.mintPauseCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.MARGIN_REGISTRY_ID, AdminCap: this.#marginAdminCap() },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Revoke a pause cap\n\t * @param {string} pauseCapId The ID of the pause cap to revoke\n\t * @returns A function that takes a Transaction object\n\t */\n\trevokePauseCap = (pauseCapId: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.revokePauseCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpauseCapId,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Disable a version using pause cap\n\t * @param {number} version The version to disable\n\t * @param {string} pauseCapId The ID of the pause cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersionPauseCap = (version: number, pauseCapId: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.disableVersionPauseCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tversion,\n\t\t\t\t\tpauseCap: pauseCapId,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Withdraw the default referral fees (admin only)\n\t * The default referral at 0x0 doesn't have a SupplyReferral object\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @returns A function that takes a Transaction object and returns a Coin<Asset>\n\t */\n\tadminWithdrawDefaultReferralFees = (coinKey: string) => (tx: Transaction) => {\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.add(\n\t\t\tmarginPoolMoveCalls.adminWithdrawDefaultReferralFees({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: marginPool.address,\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [coin.type],\n\t\t\t}),\n\t\t);\n\t};\n}\n"],"mappings":";;;;;;;;;;;AAkBA,IAAa,sBAAb,MAAiC;CAChC;;;;CAKA,YAAY,QAAwB;kCAoBT,OAAoB;AAC9C,UAAO,GAAG,IACTA,kBAA0C;IACzC,SAAS,MAAKC,OAAQ;IACtB,WAAW;KAAE,MAAM,MAAKA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B,OAAoB;AAC7D,MAAG,IACFkB,eAAuC;IACtC,SAAS,MAAKnB,OAAQ;IACtB,WAAW;KACV,MAAM,MAAKA,OAAQ;KACnB,UAAU,MAAKC,gBAAiB;KAChC;KACA;IACD,CAAC,CACF;;iCASwB,SAAiB,gBAAwB,OAAoB;AACtF,MAAG,IACFmB,uBAA+C;IAC9C,SAAS,MAAKpB,OAAQ;IACtB,WAAW;KACV,MAAM,MAAKA,OAAQ;KACnB;KACA,UAAU;KACV;IACD,CAAC,CACF;;2CASkC,aAAqB,OAAoB;GAC5E,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;GAC1C,MAAM,aAAa,MAAKA,OAAQ,cAAc,QAAQ;AACtD,UAAO,GAAG,IACTqB,iCAAqD;IACpD,SAAS,MAAKrB,OAAQ;IACtB,WAAW;KACV,MAAM,WAAW;KACjB,UAAU,MAAKA,OAAQ;KACvB,UAAU,MAAKC,gBAAiB;KAChC;IACD,eAAe,CAAC,KAAK,KAAK;IAC1B,CAAC,CACF;;AA5fD,QAAKD,SAAU;;;;;;CAOhB,kBAAkB;EACjB,MAAM,iBAAiB,MAAKA,OAAQ;AACpC,MAAI,CAAC,eACJ,OAAM,IAAI,MAAM,gDAAgD;AAEjE,SAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marginLiquidations.d.mts","names":[],"sources":["../../src/transactions/marginLiquidations.ts"],"mappings":";;;;;;;;cAYa,0BAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;
|
|
1
|
+
{"version":3,"file":"marginLiquidations.d.mts","names":[],"sources":["../../src/transactions/marginLiquidations.ts"],"mappings":";;;;;;;;cAYa,0BAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EAmEd;;;;;EA5CN,sBAAA,GAA0B,mBAAA,cAAiC,EAAA,EAAI,WAAA;EAyJC;;;;;;;;EAxIhE,OAAA,GACE,OAAA,UAAiB,mBAAA,UAA6B,OAAA,UAAiB,MAAA,cAC/D,EAAA,EAAI,WAAA;EAnBqD;;;;;;;;EA0C3D,QAAA,GACE,OAAA,UAAiB,mBAAA,UAA6B,OAAA,UAAiB,MAAA,cAC/D,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;EADf;;;;;;;;EAwBF,aAAA,GACE,OAAA,UAAiB,cAAA,UAAwB,OAAA,UAAiB,WAAA,eAC1D,EAAA,EAAI,WAAA;EADa;;;;;;;;EA0CnB,cAAA,GACE,OAAA,UAAiB,cAAA,UAAwB,OAAA,UAAiB,WAAA,eAC1D,EAAA,EAAI,WAAA;EADsD;;;;;;EA0C5D,OAAA,GAAW,OAAA,UAAiB,OAAA,cAAqB,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { convertQuantity } from "../utils/conversion.mjs";
|
|
2
|
-
import { balance, createLiquidationVault, deposit,
|
|
2
|
+
import { balance, createLiquidationVault, deposit, liquidateBaseUpgraded, liquidateQuoteUpgraded, withdraw } from "../contracts/margin_liquidation/liquidation_vault.mjs";
|
|
3
3
|
import { coinWithBalance } from "@mysten/sui/transactions";
|
|
4
4
|
|
|
5
5
|
//#region src/transactions/marginLiquidations.ts
|
|
@@ -53,14 +53,14 @@ var MarginLiquidationsContract = class {
|
|
|
53
53
|
const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
|
|
54
54
|
const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
|
|
55
55
|
const repayAmountArg = repayAmount !== void 0 ? tx.pure.option("u64", convertQuantity(repayAmount, baseCoin.scalar)) : tx.pure.option("u64", null);
|
|
56
|
-
tx.add(
|
|
56
|
+
tx.add(this.#liquidateBaseCall({
|
|
57
57
|
package: this.#config.LIQUIDATION_PACKAGE_ID,
|
|
58
58
|
arguments: {
|
|
59
59
|
self: vaultId,
|
|
60
60
|
marginManager: managerAddress,
|
|
61
61
|
registry: this.#config.MARGIN_REGISTRY_ID,
|
|
62
|
-
baseOracle: baseCoin
|
|
63
|
-
quoteOracle: quoteCoin
|
|
62
|
+
baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
|
|
63
|
+
quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
|
|
64
64
|
baseMarginPool: baseMarginPool.address,
|
|
65
65
|
quoteMarginPool: quoteMarginPool.address,
|
|
66
66
|
pool: pool.address,
|
|
@@ -76,14 +76,14 @@ var MarginLiquidationsContract = class {
|
|
|
76
76
|
const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
|
|
77
77
|
const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
|
|
78
78
|
const repayAmountArg = repayAmount !== void 0 ? tx.pure.option("u64", convertQuantity(repayAmount, quoteCoin.scalar)) : tx.pure.option("u64", null);
|
|
79
|
-
tx.add(
|
|
79
|
+
tx.add(this.#liquidateQuoteCall({
|
|
80
80
|
package: this.#config.LIQUIDATION_PACKAGE_ID,
|
|
81
81
|
arguments: {
|
|
82
82
|
self: vaultId,
|
|
83
83
|
marginManager: managerAddress,
|
|
84
84
|
registry: this.#config.MARGIN_REGISTRY_ID,
|
|
85
|
-
baseOracle: baseCoin
|
|
86
|
-
quoteOracle: quoteCoin
|
|
85
|
+
baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
|
|
86
|
+
quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
|
|
87
87
|
baseMarginPool: baseMarginPool.address,
|
|
88
88
|
quoteMarginPool: quoteMarginPool.address,
|
|
89
89
|
pool: pool.address,
|
|
@@ -102,6 +102,18 @@ var MarginLiquidationsContract = class {
|
|
|
102
102
|
};
|
|
103
103
|
this.#config = config;
|
|
104
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* The oracle-taking liquidation entrypoints. Unlike the margin package,
|
|
107
|
+
* `margin_liquidation` puts the upgraded entries in the same module as parallel
|
|
108
|
+
* functions rather than in a parallel module, so these name a function rather than a
|
|
109
|
+
* namespace. The vault's own deposit/withdraw/balance take no oracle and are unchanged.
|
|
110
|
+
*/
|
|
111
|
+
get #liquidateBaseCall() {
|
|
112
|
+
return liquidateBaseUpgraded;
|
|
113
|
+
}
|
|
114
|
+
get #liquidateQuoteCall() {
|
|
115
|
+
return liquidateQuoteUpgraded;
|
|
116
|
+
}
|
|
105
117
|
};
|
|
106
118
|
|
|
107
119
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marginLiquidations.mjs","names":["liquidationVaultMoveCalls.createLiquidationVault","#config","liquidationVaultMoveCalls.deposit","liquidationVaultMoveCalls.withdraw","liquidationVaultMoveCalls.liquidateBase","liquidationVaultMoveCalls.liquidateQuote","liquidationVaultMoveCalls.balance"],"sources":["../../src/transactions/marginLiquidations.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport type { Transaction } from '@mysten/sui/transactions';\nimport { coinWithBalance } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { convertQuantity } from '../utils/conversion.js';\nimport * as liquidationVaultMoveCalls from '../contracts/margin_liquidation/liquidation_vault.js';\n\n/**\n * MarginLiquidationsContract class for managing LiquidationVault operations.\n */\nexport class MarginLiquidationsContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginLiquidationsContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @description Create a new liquidation vault\n\t * @param {string} liquidationAdminCap The liquidation admin cap object ID\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateLiquidationVault = (liquidationAdminCap: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tliquidationVaultMoveCalls.createLiquidationVault({\n\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\targuments: { LiquidationCap: liquidationAdminCap },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Deposit coins into a liquidation vault\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} liquidationAdminCap The liquidation admin cap object ID\n\t * @param {string} coinKey The key to identify the coin type\n\t * @param {number} amount The amount to deposit\n\t * @returns A function that takes a Transaction object\n\t */\n\tdeposit =\n\t\t(vaultId: string, liquidationAdminCap: string, coinKey: string, amount: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst depositCoin = coinWithBalance({\n\t\t\t\ttype: coin.type,\n\t\t\t\tbalance: convertQuantity(amount, coin.scalar),\n\t\t\t});\n\t\t\ttx.add(\n\t\t\t\tliquidationVaultMoveCalls.deposit({\n\t\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\t\targuments: { self: vaultId, LiquidationCap: liquidationAdminCap, coin: depositCoin },\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Withdraw coins from a liquidation vault\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} liquidationAdminCap The liquidation admin cap object ID\n\t * @param {string} coinKey The key to identify the coin type\n\t * @param {number} amount The amount to withdraw\n\t * @returns A function that takes a Transaction object and returns the withdrawn coin\n\t */\n\twithdraw =\n\t\t(vaultId: string, liquidationAdminCap: string, coinKey: string, amount: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\treturn tx.add(\n\t\t\t\tliquidationVaultMoveCalls.withdraw({\n\t\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: vaultId,\n\t\t\t\t\t\tLiquidationCap: liquidationAdminCap,\n\t\t\t\t\t\tamount: convertQuantity(amount, coin.scalar),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Liquidate a margin manager by repaying base debt\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} managerAddress The margin manager address to liquidate\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} [repayAmount] The amount to repay (in base asset units), or undefined for full liquidation\n\t * @returns A function that takes a Transaction object\n\t */\n\tliquidateBase =\n\t\t(vaultId: string, managerAddress: string, poolKey: string, repayAmount?: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\n\t\t\t// Build the Option arg first so its pure input registers ahead of the\n\t\t\t// object inputs (matches the original positional ordering — byte-identical).\n\t\t\tconst repayAmountArg =\n\t\t\t\trepayAmount !== undefined\n\t\t\t\t\t? tx.pure.option('u64', convertQuantity(repayAmount, baseCoin.scalar))\n\t\t\t\t\t: tx.pure.option('u64', null);\n\n\t\t\ttx.add(\n\t\t\t\tliquidationVaultMoveCalls.liquidateBase({\n\t\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: vaultId,\n\t\t\t\t\t\tmarginManager: managerAddress,\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tbaseOracle: baseCoin.priceInfoObjectId!,\n\t\t\t\t\t\tquoteOracle: quoteCoin.priceInfoObjectId!,\n\t\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\trepayAmount: repayAmountArg,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Liquidate a margin manager by repaying quote debt\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} managerAddress The margin manager address to liquidate\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} [repayAmount] The amount to repay (in quote asset units), or undefined for full liquidation\n\t * @returns A function that takes a Transaction object\n\t */\n\tliquidateQuote =\n\t\t(vaultId: string, managerAddress: string, poolKey: string, repayAmount?: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\n\t\t\t// Build the Option arg first so its pure input registers ahead of the\n\t\t\t// object inputs (matches the original positional ordering — byte-identical).\n\t\t\tconst repayAmountArg =\n\t\t\t\trepayAmount !== undefined\n\t\t\t\t\t? tx.pure.option('u64', convertQuantity(repayAmount, quoteCoin.scalar))\n\t\t\t\t\t: tx.pure.option('u64', null);\n\n\t\t\ttx.add(\n\t\t\t\tliquidationVaultMoveCalls.liquidateQuote({\n\t\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: vaultId,\n\t\t\t\t\t\tmarginManager: managerAddress,\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tbaseOracle: baseCoin.priceInfoObjectId!,\n\t\t\t\t\t\tquoteOracle: quoteCoin.priceInfoObjectId!,\n\t\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\trepayAmount: repayAmountArg,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t// === Read-Only Functions ===\n\n\t/**\n\t * @description Get the balance of a specific coin type in the liquidation vault\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} coinKey The key to identify the coin type\n\t * @returns A function that takes a Transaction object\n\t */\n\tbalance = (vaultId: string, coinKey: string) => (tx: Transaction) => {\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\treturn tx.add(\n\t\t\tliquidationVaultMoveCalls.balance({\n\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\targuments: { self: vaultId },\n\t\t\t\ttypeArguments: [coin.type],\n\t\t\t}),\n\t\t);\n\t};\n}\n"],"mappings":";;;;;;;;AAYA,IAAa,6BAAb,MAAwC;CACvC;;;;CAKA,YAAY,QAAwB;iCASV,yBAAiC,OAAoB;AAC9E,MAAG,IACFA,uBAAiD;IAChD,SAAS,MAAKC,OAAQ;IACtB,WAAW,EAAE,gBAAgB,qBAAqB;IAClD,CAAC,CACF;;kBAYA,SAAiB,qBAA6B,SAAiB,YAC/D,OAAoB;GACpB,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;GAC1C,MAAM,cAAc,gBAAgB;IACnC,MAAM,KAAK;IACX,SAAS,gBAAgB,QAAQ,KAAK,OAAO;IAC7C,CAAC;AACF,MAAG,IACFC,QAAkC;IACjC,SAAS,MAAKD,OAAQ;IACtB,WAAW;KAAE,MAAM;KAAS,gBAAgB;KAAqB,MAAM;KAAa;IACpF,eAAe,CAAC,KAAK,KAAK;IAC1B,CAAC,CACF;;mBAYD,SAAiB,qBAA6B,SAAiB,YAC/D,OAAoB;GACpB,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;AAC1C,UAAO,GAAG,IACTE,SAAmC;IAClC,SAAS,MAAKF,OAAQ;IACtB,WAAW;KACV,MAAM;KACN,gBAAgB;KAChB,QAAQ,gBAAgB,QAAQ,KAAK,OAAO;KAC5C;IACD,eAAe,CAA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ACtB,WAAW;KACV,MAAM;KACN,eAAe;KACf,UAAU,MAAKA,OAAQ;KACvB,YAAY,SAAS;KACrB,aAAa,UAAU;KACvB,gBAAgB,eAAe;KAC/B,iBAAiB,gBAAgB;KACjC,MAAM,KAAK;KACX,aAAa;KACb;IACD,eAAe,CAAC,SAAS,MAAM,UAAU,KAAK;IAC9C,CAAC,CACF;;kBAWQ,SAAiB,aAAqB,OAAoB;GACpE,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;AAC1C,UAAO,GAAG,IACTK,QAAkC;IACjC,SAAS,MAAKL,OAAQ;IACtB,WAAW,EAAE,MAAM,SAAS;IAC5B,eAAe,CAAC,KAAK,KAAK;IAC1B,CAAC,CACF;;AAzKD,QAAKA,SAAU"}
|
|
1
|
+
{"version":3,"file":"marginLiquidations.mjs","names":["liquidationVaultMoveCalls.createLiquidationVault","#config","liquidationVaultMoveCalls.deposit","liquidationVaultMoveCalls.withdraw","#liquidateBaseCall","#liquidateQuoteCall","liquidationVaultMoveCalls.balance","liquidationVaultMoveCalls.liquidateBaseUpgraded","liquidationVaultMoveCalls.liquidateQuoteUpgraded"],"sources":["../../src/transactions/marginLiquidations.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport type { Transaction } from '@mysten/sui/transactions';\nimport { coinWithBalance } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { convertQuantity } from '../utils/conversion.js';\nimport * as liquidationVaultMoveCalls from '../contracts/margin_liquidation/liquidation_vault.js';\n\n/**\n * MarginLiquidationsContract class for managing LiquidationVault operations.\n */\nexport class MarginLiquidationsContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginLiquidationsContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * The oracle-taking liquidation entrypoints. Unlike the margin package,\n\t * `margin_liquidation` puts the upgraded entries in the same module as parallel\n\t * functions rather than in a parallel module, so these name a function rather than a\n\t * namespace. The vault's own deposit/withdraw/balance take no oracle and are unchanged.\n\t */\n\tget #liquidateBaseCall() {\n\t\treturn liquidationVaultMoveCalls.liquidateBaseUpgraded;\n\t}\n\n\tget #liquidateQuoteCall() {\n\t\treturn liquidationVaultMoveCalls.liquidateQuoteUpgraded;\n\t}\n\n\t/**\n\t * @description Create a new liquidation vault\n\t * @param {string} liquidationAdminCap The liquidation admin cap object ID\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateLiquidationVault = (liquidationAdminCap: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tliquidationVaultMoveCalls.createLiquidationVault({\n\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\targuments: { LiquidationCap: liquidationAdminCap },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Deposit coins into a liquidation vault\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} liquidationAdminCap The liquidation admin cap object ID\n\t * @param {string} coinKey The key to identify the coin type\n\t * @param {number} amount The amount to deposit\n\t * @returns A function that takes a Transaction object\n\t */\n\tdeposit =\n\t\t(vaultId: string, liquidationAdminCap: string, coinKey: string, amount: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst depositCoin = coinWithBalance({\n\t\t\t\ttype: coin.type,\n\t\t\t\tbalance: convertQuantity(amount, coin.scalar),\n\t\t\t});\n\t\t\ttx.add(\n\t\t\t\tliquidationVaultMoveCalls.deposit({\n\t\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\t\targuments: { self: vaultId, LiquidationCap: liquidationAdminCap, coin: depositCoin },\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Withdraw coins from a liquidation vault\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} liquidationAdminCap The liquidation admin cap object ID\n\t * @param {string} coinKey The key to identify the coin type\n\t * @param {number} amount The amount to withdraw\n\t * @returns A function that takes a Transaction object and returns the withdrawn coin\n\t */\n\twithdraw =\n\t\t(vaultId: string, liquidationAdminCap: string, coinKey: string, amount: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\treturn tx.add(\n\t\t\t\tliquidationVaultMoveCalls.withdraw({\n\t\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: vaultId,\n\t\t\t\t\t\tLiquidationCap: liquidationAdminCap,\n\t\t\t\t\t\tamount: convertQuantity(amount, coin.scalar),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Liquidate a margin manager by repaying base debt\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} managerAddress The margin manager address to liquidate\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} [repayAmount] The amount to repay (in base asset units), or undefined for full liquidation\n\t * @returns A function that takes a Transaction object\n\t */\n\tliquidateBase =\n\t\t(vaultId: string, managerAddress: string, poolKey: string, repayAmount?: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\n\t\t\t// Build the Option arg first so its pure input registers ahead of the\n\t\t\t// object inputs (matches the original positional ordering — byte-identical).\n\t\t\tconst repayAmountArg =\n\t\t\t\trepayAmount !== undefined\n\t\t\t\t\t? tx.pure.option('u64', convertQuantity(repayAmount, baseCoin.scalar))\n\t\t\t\t\t: tx.pure.option('u64', null);\n\n\t\t\ttx.add(\n\t\t\t\tthis.#liquidateBaseCall({\n\t\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: vaultId,\n\t\t\t\t\t\tmarginManager: managerAddress,\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tbaseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),\n\t\t\t\t\t\tquoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),\n\t\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\trepayAmount: repayAmountArg,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Liquidate a margin manager by repaying quote debt\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} managerAddress The margin manager address to liquidate\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} [repayAmount] The amount to repay (in quote asset units), or undefined for full liquidation\n\t * @returns A function that takes a Transaction object\n\t */\n\tliquidateQuote =\n\t\t(vaultId: string, managerAddress: string, poolKey: string, repayAmount?: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\n\t\t\t// Build the Option arg first so its pure input registers ahead of the\n\t\t\t// object inputs (matches the original positional ordering — byte-identical).\n\t\t\tconst repayAmountArg =\n\t\t\t\trepayAmount !== undefined\n\t\t\t\t\t? tx.pure.option('u64', convertQuantity(repayAmount, quoteCoin.scalar))\n\t\t\t\t\t: tx.pure.option('u64', null);\n\n\t\t\ttx.add(\n\t\t\t\tthis.#liquidateQuoteCall({\n\t\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: vaultId,\n\t\t\t\t\t\tmarginManager: managerAddress,\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tbaseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),\n\t\t\t\t\t\tquoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),\n\t\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\trepayAmount: repayAmountArg,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t// === Read-Only Functions ===\n\n\t/**\n\t * @description Get the balance of a specific coin type in the liquidation vault\n\t * @param {string} vaultId The liquidation vault object ID\n\t * @param {string} coinKey The key to identify the coin type\n\t * @returns A function that takes a Transaction object\n\t */\n\tbalance = (vaultId: string, coinKey: string) => (tx: Transaction) => {\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\treturn tx.add(\n\t\t\tliquidationVaultMoveCalls.balance({\n\t\t\t\tpackage: this.#config.LIQUIDATION_PACKAGE_ID,\n\t\t\t\targuments: { self: vaultId },\n\t\t\t\ttypeArguments: [coin.type],\n\t\t\t}),\n\t\t);\n\t};\n}\n"],"mappings":";;;;;;;;AAYA,IAAa,6BAAb,MAAwC;CACvC;;;;CAKA,YAAY,QAAwB;iCAuBV,yBAAiC,OAAoB;AAC9E,MAAG,IACFA,uBAAiD;IAChD,SAAS,MAAKC,OAAQ;IACtB,WAAW,EAAE,gBAAgB,qBAAqB;IAClD,CAAC,CACF;;k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B,SAAOG;;CAGR,KAAIF,qBAAsB;AACzB,SAAOG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InterestConfigParams, MarginPoolConfigParams } from "../types/index.mjs";
|
|
2
2
|
import { DeepBookConfig } from "../utils/config.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _mysten_sui_transactions29 from "@mysten/sui/transactions";
|
|
4
4
|
import { Transaction, TransactionArgument, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
5
5
|
|
|
6
6
|
//#region src/transactions/marginMaintainer.d.ts
|
|
@@ -27,27 +27,27 @@ declare class MarginMaintainerContract {
|
|
|
27
27
|
* @param {InterestConfigParams} interestConfig The configuration for the interest
|
|
28
28
|
* @returns A function that takes a Transaction object
|
|
29
29
|
*/
|
|
30
|
-
newProtocolConfig: (coinKey: string, marginPoolConfig: MarginPoolConfigParams, interestConfig: InterestConfigParams) => (tx: Transaction) =>
|
|
30
|
+
newProtocolConfig: (coinKey: string, marginPoolConfig: MarginPoolConfigParams, interestConfig: InterestConfigParams) => (tx: Transaction) => _mysten_sui_transactions29.TransactionResult;
|
|
31
31
|
/**
|
|
32
32
|
* @description Create a new margin pool config
|
|
33
33
|
* @param {string} coinKey The key to identify the coin
|
|
34
34
|
* @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool
|
|
35
35
|
* @returns A function that takes a Transaction object
|
|
36
36
|
*/
|
|
37
|
-
newMarginPoolConfig: (coinKey: string, marginPoolConfig: MarginPoolConfigParams) => (tx: Transaction) =>
|
|
37
|
+
newMarginPoolConfig: (coinKey: string, marginPoolConfig: MarginPoolConfigParams) => (tx: Transaction) => _mysten_sui_transactions29.TransactionResult;
|
|
38
38
|
/**
|
|
39
39
|
* @description Create a new margin pool config with rate limit
|
|
40
40
|
* @param {string} coinKey The key to identify the coin
|
|
41
41
|
* @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool with rate limit
|
|
42
42
|
* @returns A function that takes a Transaction object
|
|
43
43
|
*/
|
|
44
|
-
newMarginPoolConfigWithRateLimit: (coinKey: string, marginPoolConfig: Required<Pick<MarginPoolConfigParams, "rateLimitCapacity" | "rateLimitRefillRatePerMs" | "rateLimitEnabled">> & MarginPoolConfigParams) => (tx: Transaction) =>
|
|
44
|
+
newMarginPoolConfigWithRateLimit: (coinKey: string, marginPoolConfig: Required<Pick<MarginPoolConfigParams, "rateLimitCapacity" | "rateLimitRefillRatePerMs" | "rateLimitEnabled">> & MarginPoolConfigParams) => (tx: Transaction) => _mysten_sui_transactions29.TransactionResult;
|
|
45
45
|
/**
|
|
46
46
|
* @description Create a new interest config
|
|
47
47
|
* @param {InterestConfigParams} interestConfig The configuration for the interest
|
|
48
48
|
* @returns A function that takes a Transaction object
|
|
49
49
|
*/
|
|
50
|
-
newInterestConfig: (interestConfig: InterestConfigParams) => (tx: Transaction) =>
|
|
50
|
+
newInterestConfig: (interestConfig: InterestConfigParams) => (tx: Transaction) => _mysten_sui_transactions29.TransactionResult;
|
|
51
51
|
/**
|
|
52
52
|
* @description Enable a deepbook pool for loan
|
|
53
53
|
* @param {string} deepbookPoolKey The key to identify the deepbook pool
|