@mysten/deepbook-v3 1.6.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -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/deep_price.d.mts +3 -3
- package/dist/contracts/deepbook/deep_price.d.mts.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/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/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/deepbook.d.mts +20 -20
- package/dist/transactions/deepbookAdmin.d.mts +4 -4
- package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
- package/dist/transactions/marginAdmin.d.mts +7 -7
- package/dist/transactions/marginAdmin.d.mts.map +1 -1
- package/dist/transactions/marginAdmin.mjs +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 +54 -23
- package/dist/utils/constants.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +9 -1
- package/src/contracts/deepbook_margin/margin_manager.ts +140 -10
- package/src/contracts/deepbook_margin/margin_manager_upgraded.ts +651 -0
- package/src/contracts/deepbook_margin/oracle.ts +59 -0
- package/src/contracts/deepbook_margin/pool_proxy.ts +600 -584
- package/src/contracts/deepbook_margin/pool_proxy_upgraded.ts +614 -0
- package/src/contracts/margin_liquidation/liquidation_vault.ts +142 -0
- 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 +16 -0
- package/src/utils/config.ts +69 -9
- package/src/utils/constants.ts +88 -25
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { convertPrice, convertQuantity, convertRate } from "../utils/conversion.mjs";
|
|
2
2
|
import { FLOAT_SCALAR, MAX_TIMESTAMP } from "../utils/config.mjs";
|
|
3
3
|
import { OrderType, SelfMatchingOptions } from "../types/index.mjs";
|
|
4
|
-
import { cancelAllOrders, cancelOrder, cancelOrders, claimRebates, modifyOrder,
|
|
4
|
+
import { cancelAllOrders, cancelOrder, cancelOrders, claimRebates, modifyOrder, stake, submitProposal, unstake, vote, withdrawSettledAmounts, withdrawSettledAmountsPermissionless } from "../contracts/deepbook_margin/pool_proxy.mjs";
|
|
5
|
+
import { pool_proxy_upgraded_exports } from "../contracts/deepbook_margin/pool_proxy_upgraded.mjs";
|
|
5
6
|
|
|
6
7
|
//#region src/transactions/poolProxy.ts
|
|
7
8
|
/**
|
|
@@ -23,7 +24,7 @@ var PoolProxyContract = class {
|
|
|
23
24
|
const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
|
|
24
25
|
const inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);
|
|
25
26
|
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
26
|
-
return tx.add(placeLimitOrderV2({
|
|
27
|
+
return tx.add(this.#oracleCalls.placeLimitOrderV2({
|
|
27
28
|
package: this.#config.MARGIN_PACKAGE_ID,
|
|
28
29
|
arguments: {
|
|
29
30
|
registry: this.#config.MARGIN_REGISTRY_ID,
|
|
@@ -31,8 +32,8 @@ var PoolProxyContract = class {
|
|
|
31
32
|
pool: pool.address,
|
|
32
33
|
baseMarginPool: baseMarginPool.address,
|
|
33
34
|
quoteMarginPool: quoteMarginPool.address,
|
|
34
|
-
baseOracle: baseCoin
|
|
35
|
-
quoteOracle: quoteCoin
|
|
35
|
+
baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
|
|
36
|
+
quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
|
|
36
37
|
clientOrderId: BigInt(clientOrderId),
|
|
37
38
|
orderType,
|
|
38
39
|
selfMatchingOption,
|
|
@@ -54,7 +55,7 @@ var PoolProxyContract = class {
|
|
|
54
55
|
const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
|
|
55
56
|
const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
|
|
56
57
|
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
57
|
-
return tx.add(placeMarketOrderV2({
|
|
58
|
+
return tx.add(this.#oracleCalls.placeMarketOrderV2({
|
|
58
59
|
package: this.#config.MARGIN_PACKAGE_ID,
|
|
59
60
|
arguments: {
|
|
60
61
|
registry: this.#config.MARGIN_REGISTRY_ID,
|
|
@@ -62,8 +63,8 @@ var PoolProxyContract = class {
|
|
|
62
63
|
pool: pool.address,
|
|
63
64
|
baseMarginPool: baseMarginPool.address,
|
|
64
65
|
quoteMarginPool: quoteMarginPool.address,
|
|
65
|
-
baseOracle: baseCoin
|
|
66
|
-
quoteOracle: quoteCoin
|
|
66
|
+
baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
|
|
67
|
+
quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
|
|
67
68
|
clientOrderId: BigInt(clientOrderId),
|
|
68
69
|
selfMatchingOption,
|
|
69
70
|
quantity: inputQuantity,
|
|
@@ -83,7 +84,7 @@ var PoolProxyContract = class {
|
|
|
83
84
|
const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
|
|
84
85
|
const inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);
|
|
85
86
|
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
86
|
-
return tx.add(placeReduceOnlyLimitOrderV2({
|
|
87
|
+
return tx.add(this.#oracleCalls.placeReduceOnlyLimitOrderV2({
|
|
87
88
|
package: this.#config.MARGIN_PACKAGE_ID,
|
|
88
89
|
arguments: {
|
|
89
90
|
registry: this.#config.MARGIN_REGISTRY_ID,
|
|
@@ -91,8 +92,8 @@ var PoolProxyContract = class {
|
|
|
91
92
|
pool: pool.address,
|
|
92
93
|
baseMarginPool: baseMarginPool.address,
|
|
93
94
|
quoteMarginPool: quoteMarginPool.address,
|
|
94
|
-
baseOracle: baseCoin
|
|
95
|
-
quoteOracle: quoteCoin
|
|
95
|
+
baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
|
|
96
|
+
quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
|
|
96
97
|
clientOrderId: BigInt(clientOrderId),
|
|
97
98
|
orderType,
|
|
98
99
|
selfMatchingOption,
|
|
@@ -114,7 +115,7 @@ var PoolProxyContract = class {
|
|
|
114
115
|
const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
|
|
115
116
|
const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
|
|
116
117
|
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
117
|
-
return tx.add(placeReduceOnlyMarketOrderV2({
|
|
118
|
+
return tx.add(this.#oracleCalls.placeReduceOnlyMarketOrderV2({
|
|
118
119
|
package: this.#config.MARGIN_PACKAGE_ID,
|
|
119
120
|
arguments: {
|
|
120
121
|
registry: this.#config.MARGIN_REGISTRY_ID,
|
|
@@ -122,8 +123,8 @@ var PoolProxyContract = class {
|
|
|
122
123
|
pool: pool.address,
|
|
123
124
|
baseMarginPool: baseMarginPool.address,
|
|
124
125
|
quoteMarginPool: quoteMarginPool.address,
|
|
125
|
-
baseOracle: baseCoin
|
|
126
|
-
quoteOracle: quoteCoin
|
|
126
|
+
baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
|
|
127
|
+
quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
|
|
127
128
|
clientOrderId: BigInt(clientOrderId),
|
|
128
129
|
selfMatchingOption,
|
|
129
130
|
quantity: inputQuantity,
|
|
@@ -142,7 +143,7 @@ var PoolProxyContract = class {
|
|
|
142
143
|
const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
|
|
143
144
|
const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
|
|
144
145
|
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
145
|
-
return tx.add(placeMarketOrderAndRepayLoan({
|
|
146
|
+
return tx.add(this.#oracleCalls.placeMarketOrderAndRepayLoan({
|
|
146
147
|
package: this.#config.MARGIN_PACKAGE_ID,
|
|
147
148
|
arguments: {
|
|
148
149
|
registry: this.#config.MARGIN_REGISTRY_ID,
|
|
@@ -150,8 +151,8 @@ var PoolProxyContract = class {
|
|
|
150
151
|
pool: pool.address,
|
|
151
152
|
baseMarginPool: baseMarginPool.address,
|
|
152
153
|
quoteMarginPool: quoteMarginPool.address,
|
|
153
|
-
baseOracle: baseCoin
|
|
154
|
-
quoteOracle: quoteCoin
|
|
154
|
+
baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
|
|
155
|
+
quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
|
|
155
156
|
clientOrderId: BigInt(clientOrderId),
|
|
156
157
|
selfMatchingOption,
|
|
157
158
|
quantity: inputQuantity,
|
|
@@ -171,7 +172,7 @@ var PoolProxyContract = class {
|
|
|
171
172
|
const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
|
|
172
173
|
const inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);
|
|
173
174
|
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
174
|
-
return tx.add(placeReduceOnlyLimitOrderAndRepayLoan({
|
|
175
|
+
return tx.add(this.#oracleCalls.placeReduceOnlyLimitOrderAndRepayLoan({
|
|
175
176
|
package: this.#config.MARGIN_PACKAGE_ID,
|
|
176
177
|
arguments: {
|
|
177
178
|
registry: this.#config.MARGIN_REGISTRY_ID,
|
|
@@ -179,8 +180,8 @@ var PoolProxyContract = class {
|
|
|
179
180
|
pool: pool.address,
|
|
180
181
|
baseMarginPool: baseMarginPool.address,
|
|
181
182
|
quoteMarginPool: quoteMarginPool.address,
|
|
182
|
-
baseOracle: baseCoin
|
|
183
|
-
quoteOracle: quoteCoin
|
|
183
|
+
baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
|
|
184
|
+
quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
|
|
184
185
|
clientOrderId: BigInt(clientOrderId),
|
|
185
186
|
orderType,
|
|
186
187
|
selfMatchingOption,
|
|
@@ -202,7 +203,7 @@ var PoolProxyContract = class {
|
|
|
202
203
|
const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
|
|
203
204
|
const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
|
|
204
205
|
const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
|
|
205
|
-
return tx.add(placeReduceOnlyMarketOrderAndRepayLoan({
|
|
206
|
+
return tx.add(this.#oracleCalls.placeReduceOnlyMarketOrderAndRepayLoan({
|
|
206
207
|
package: this.#config.MARGIN_PACKAGE_ID,
|
|
207
208
|
arguments: {
|
|
208
209
|
registry: this.#config.MARGIN_REGISTRY_ID,
|
|
@@ -210,8 +211,8 @@ var PoolProxyContract = class {
|
|
|
210
211
|
pool: pool.address,
|
|
211
212
|
baseMarginPool: baseMarginPool.address,
|
|
212
213
|
quoteMarginPool: quoteMarginPool.address,
|
|
213
|
-
baseOracle: baseCoin
|
|
214
|
-
quoteOracle: quoteCoin
|
|
214
|
+
baseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),
|
|
215
|
+
quoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),
|
|
215
216
|
clientOrderId: BigInt(clientOrderId),
|
|
216
217
|
selfMatchingOption,
|
|
217
218
|
quantity: inputQuantity,
|
|
@@ -404,21 +405,27 @@ var PoolProxyContract = class {
|
|
|
404
405
|
const pool = this.#config.getPool(poolKey);
|
|
405
406
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
406
407
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
407
|
-
|
|
408
|
-
if (!quoteCoin.priceInfoObjectId) throw new Error(`Missing priceInfoObjectId for ${pool.quoteCoin}`);
|
|
409
|
-
tx.add(updateCurrentPrice({
|
|
408
|
+
tx.add(this.#oracleCalls.updateCurrentPrice({
|
|
410
409
|
package: this.#config.MARGIN_PACKAGE_ID,
|
|
411
410
|
arguments: {
|
|
412
411
|
registry: this.#config.MARGIN_REGISTRY_ID,
|
|
413
412
|
pool: pool.address,
|
|
414
|
-
basePriceInfoObject: baseCoin
|
|
415
|
-
quotePriceInfoObject: quoteCoin
|
|
413
|
+
basePriceInfoObject: this.#config.getPriceInfoObjectId(pool.baseCoin),
|
|
414
|
+
quotePriceInfoObject: this.#config.getPriceInfoObjectId(pool.quoteCoin)
|
|
416
415
|
},
|
|
417
416
|
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
418
417
|
}));
|
|
419
418
|
};
|
|
420
419
|
this.#config = config;
|
|
421
420
|
}
|
|
421
|
+
/**
|
|
422
|
+
* Oracle-taking entrypoints live in the parallel `_upgraded` module, which takes Pyth's
|
|
423
|
+
* upgraded-Core `PriceInfoObject`. Entrypoints with no oracle argument stay on the base
|
|
424
|
+
* module, which is the only place they exist.
|
|
425
|
+
*/
|
|
426
|
+
get #oracleCalls() {
|
|
427
|
+
return pool_proxy_upgraded_exports;
|
|
428
|
+
}
|
|
422
429
|
};
|
|
423
430
|
|
|
424
431
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poolProxy.mjs","names":["#config","poolProxyMoveCalls.placeLimitOrderV2","poolProxyMoveCalls.placeMarketOrderV2","poolProxyMoveCalls.placeReduceOnlyLimitOrderV2","poolProxyMoveCalls.placeReduceOnlyMarketOrderV2","poolProxyMoveCalls.placeMarketOrderAndRepayLoan","poolProxyMoveCalls.placeReduceOnlyLimitOrderAndRepayLoan","poolProxyMoveCalls.placeReduceOnlyMarketOrderAndRepayLoan","poolProxyMoveCalls.modifyOrder","poolProxyMoveCalls.cancelOrder","poolProxyMoveCalls.cancelOrders","poolProxyMoveCalls.cancelAllOrders","poolProxyMoveCalls.withdrawSettledAmounts","poolProxyMoveCalls.stake","poolProxyMoveCalls.unstake","poolProxyMoveCalls.submitProposal","poolProxyMoveCalls.vote","poolProxyMoveCalls.claimRebates","poolProxyMoveCalls.withdrawSettledAmountsPermissionless","poolProxyMoveCalls.updateCurrentPrice"],"sources":["../../src/transactions/poolProxy.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport type { Transaction } from '@mysten/sui/transactions';\nimport type {\n\tPlaceMarginLimitOrderParams,\n\tPlaceMarginMarketOrderParams,\n\tMarginProposalParams,\n} from '../types/index.js';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { OrderType, SelfMatchingOptions } from '../types/index.js';\nimport { MAX_TIMESTAMP, FLOAT_SCALAR } from '../utils/config.js';\nimport { convertQuantity, convertPrice, convertRate } from '../utils/conversion.js';\nimport * as poolProxyMoveCalls from '../contracts/deepbook_margin/pool_proxy.js';\n\n/**\n * PoolProxyContract class for managing PoolProxy operations.\n */\nexport class PoolProxyContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for PoolProxyContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @description Place a limit order. Enforces a post-trade `risk_ratio >=\n\t * min_borrow_risk_ratio` invariant on the manager (skipped when the manager\n\t * has no debt).\n\t * @param {PlaceMarginLimitOrderParams} params Parameters for placing a limit order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceLimitOrder = (params: PlaceMarginLimitOrderParams) => (tx: Transaction) => {\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tmarginManagerKey,\n\t\t\tclientOrderId,\n\t\t\tprice,\n\t\t\tquantity,\n\t\t\tisBid,\n\t\t\texpiration = MAX_TIMESTAMP,\n\t\t\torderType = OrderType.NO_RESTRICTION,\n\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\tpayWithDeep = true,\n\t\t} = params;\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\tconst inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);\n\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\treturn tx.add(\n\t\t\tpoolProxyMoveCalls.placeLimitOrderV2({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: manager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\tbaseOracle: baseCoin.priceInfoObjectId!,\n\t\t\t\t\tquoteOracle: quoteCoin.priceInfoObjectId!,\n\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\torderType,\n\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\tprice: inputPrice,\n\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\tisBid,\n\t\t\t\t\tpayWithDeep,\n\t\t\t\t\texpireTimestamp: expiration,\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 Place a market order. Enforces a post-trade `risk_ratio >=\n\t * min_borrow_risk_ratio` invariant on the manager (skipped when the manager\n\t * has no debt).\n\t * @param {PlaceMarginMarketOrderParams} params Parameters for placing a market order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceMarketOrder = (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => {\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tmarginManagerKey,\n\t\t\tclientOrderId,\n\t\t\tquantity,\n\t\t\tisBid,\n\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\tpayWithDeep = true,\n\t\t} = params;\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\treturn tx.add(\n\t\t\tpoolProxyMoveCalls.placeMarketOrderV2({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: manager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\tbaseOracle: baseCoin.priceInfoObjectId!,\n\t\t\t\t\tquoteOracle: quoteCoin.priceInfoObjectId!,\n\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\tisBid,\n\t\t\t\t\tpayWithDeep,\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 Place a reduce only limit order. Requires the manager to have\n\t * debt on the relevant side; enforces a monotonic `risk_ratio_after >=\n\t * risk_ratio_before` invariant so the fill cannot leak value to the\n\t * counterparty.\n\t * @param {PlaceMarginLimitOrderParams} params Parameters for placing a reduce only limit order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceReduceOnlyLimitOrder = (params: PlaceMarginLimitOrderParams) => (tx: Transaction) => {\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tmarginManagerKey,\n\t\t\tclientOrderId,\n\t\t\tprice,\n\t\t\tquantity,\n\t\t\tisBid,\n\t\t\texpiration = MAX_TIMESTAMP,\n\t\t\torderType = OrderType.NO_RESTRICTION,\n\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\tpayWithDeep = true,\n\t\t} = params;\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\tconst inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);\n\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\treturn tx.add(\n\t\t\tpoolProxyMoveCalls.placeReduceOnlyLimitOrderV2({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: manager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\tbaseOracle: baseCoin.priceInfoObjectId!,\n\t\t\t\t\tquoteOracle: quoteCoin.priceInfoObjectId!,\n\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\torderType,\n\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\tprice: inputPrice,\n\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\tisBid,\n\t\t\t\t\tpayWithDeep,\n\t\t\t\t\texpireTimestamp: expiration,\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 Place a reduce only market order. Requires the manager to\n\t * have debt on the relevant side; enforces a monotonic `risk_ratio_after >=\n\t * risk_ratio_before` invariant so the fill cannot leak value to the\n\t * counterparty.\n\t * @param {PlaceMarginMarketOrderParams} params Parameters for placing a reduce only market order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceReduceOnlyMarketOrder = (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => {\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tmarginManagerKey,\n\t\t\tclientOrderId,\n\t\t\tquantity,\n\t\t\tisBid,\n\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\tpayWithDeep = true,\n\t\t} = params;\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\treturn tx.add(\n\t\t\tpoolProxyMoveCalls.placeReduceOnlyMarketOrderV2({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: manager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\tbaseOracle: baseCoin.priceInfoObjectId!,\n\t\t\t\t\tquoteOracle: quoteCoin.priceInfoObjectId!,\n\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\tisBid,\n\t\t\t\t\tpayWithDeep,\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 Place a market order and repay the loan from the fill proceeds.\n\t * The taker fill settles into the manager's balance, so the proceeds (plus any\n\t * idle balance) are repaid into the debt side before the risk check; the gate\n\t * is then the *net* post-repay `risk_ratio` being at least the pre-fill ratio.\n\t * Unlike {@link placeMarketOrder}, which checks the post-trade ratio against\n\t * `min_borrow_risk_ratio`, this lets a deleveraging fill go through in the\n\t * `liquidation..min_borrow` band, where a swap alone would be rejected.\n\t * @param {PlaceMarginMarketOrderParams} params Parameters for placing a market order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceMarketOrderAndRepayLoan = (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => {\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tmarginManagerKey,\n\t\t\tclientOrderId,\n\t\t\tquantity,\n\t\t\tisBid,\n\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\tpayWithDeep = true,\n\t\t} = params;\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\treturn tx.add(\n\t\t\tpoolProxyMoveCalls.placeMarketOrderAndRepayLoan({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: manager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\tbaseOracle: baseCoin.priceInfoObjectId!,\n\t\t\t\t\tquoteOracle: quoteCoin.priceInfoObjectId!,\n\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\tisBid,\n\t\t\t\t\tpayWithDeep,\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 Place a reduce only limit order and repay the loan from the\n\t * fill proceeds. Requires debt on the relevant side (a bid needs base debt; an\n\t * ask needs quote debt and sells at most the gross base held); the repay\n\t * happens before the monotonic `risk_ratio` gate, so the check is on the net\n\t * post-repay ratio.\n\t * @param {PlaceMarginLimitOrderParams} params Parameters for placing a reduce only limit order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceReduceOnlyLimitOrderAndRepayLoan =\n\t\t(params: PlaceMarginLimitOrderParams) => (tx: Transaction) => {\n\t\t\tconst {\n\t\t\t\tpoolKey,\n\t\t\t\tmarginManagerKey,\n\t\t\t\tclientOrderId,\n\t\t\t\tprice,\n\t\t\t\tquantity,\n\t\t\t\tisBid,\n\t\t\t\texpiration = MAX_TIMESTAMP,\n\t\t\t\torderType = OrderType.NO_RESTRICTION,\n\t\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\t\tpayWithDeep = true,\n\t\t\t} = params;\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\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\t\t\tconst inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);\n\t\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\t\treturn tx.add(\n\t\t\t\tpoolProxyMoveCalls.placeReduceOnlyLimitOrderAndRepayLoan({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tmarginManager: manager.address,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\t\tbaseOracle: baseCoin.priceInfoObjectId!,\n\t\t\t\t\t\tquoteOracle: quoteCoin.priceInfoObjectId!,\n\t\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\t\torderType,\n\t\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\t\tprice: inputPrice,\n\t\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\t\tisBid,\n\t\t\t\t\t\tpayWithDeep,\n\t\t\t\t\t\texpireTimestamp: expiration,\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 Place a reduce only market order and repay the loan from the\n\t * fill proceeds. Same reduce-only direction guard as\n\t * {@link placeReduceOnlyMarketOrder}, but the settled proceeds are repaid into\n\t * the debt side before the monotonic `risk_ratio` gate, so the check is on the\n\t * net post-repay ratio.\n\t * @param {PlaceMarginMarketOrderParams} params Parameters for placing a reduce only market order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceReduceOnlyMarketOrderAndRepayLoan =\n\t\t(params: PlaceMarginMarketOrderParams) => (tx: Transaction) => {\n\t\t\tconst {\n\t\t\t\tpoolKey,\n\t\t\t\tmarginManagerKey,\n\t\t\t\tclientOrderId,\n\t\t\t\tquantity,\n\t\t\t\tisBid,\n\t\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\t\tpayWithDeep = true,\n\t\t\t} = params;\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\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\t\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\t\treturn tx.add(\n\t\t\t\tpoolProxyMoveCalls.placeReduceOnlyMarketOrderAndRepayLoan({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tmarginManager: manager.address,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\t\tbaseOracle: baseCoin.priceInfoObjectId!,\n\t\t\t\t\t\tquoteOracle: quoteCoin.priceInfoObjectId!,\n\t\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\t\tisBid,\n\t\t\t\t\t\tpayWithDeep,\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 Modify an existing order\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @param {string} orderId Order ID to modify\n\t * @param {number} newQuantity New quantity for the order\n\t * @returns A function that takes a Transaction object\n\t */\n\tmodifyOrder =\n\t\t(marginManagerKey: string, orderId: string, newQuantity: number) => (tx: Transaction) => {\n\t\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\t\tconst pool = this.#config.getPool(marginManager.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 inputQuantity = convertQuantity(newQuantity, baseCoin.scalar);\n\n\t\t\ttx.add(\n\t\t\t\tpoolProxyMoveCalls.modifyOrder({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tmarginManager: marginManager.address,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\torderId: BigInt(orderId),\n\t\t\t\t\t\tnewQuantity: inputQuantity,\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 Cancel an existing order\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @param {string} orderId Order ID to cancel\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelOrder = (marginManagerKey: string, orderId: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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\tpoolProxyMoveCalls.cancelOrder({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: marginManager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\torderId: BigInt(orderId),\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 Cancel multiple existing orders\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @param {string[]} orderIds Order IDs to cancel\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelOrders = (marginManagerKey: string, orderIds: string[]) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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\tpoolProxyMoveCalls.cancelOrders({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: marginManager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\torderIds: orderIds.map(BigInt),\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 Cancel all existing orders\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelAllOrders = (marginManagerKey: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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\tpoolProxyMoveCalls.cancelAllOrders({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: marginManager.address,\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 Withdraw settled amounts\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawSettledAmounts = (marginManagerKey: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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\tpoolProxyMoveCalls.withdrawSettledAmounts({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: marginManager.address,\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 Stake in the pool\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @param {number} stakeAmount The amount to stake\n\t * @returns A function that takes a Transaction object\n\t */\n\tstake = (marginManagerKey: string, stakeAmount: number) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst deepCoin = this.#config.getCoin('DEEP');\n\t\tconst stakeInput = convertQuantity(stakeAmount, deepCoin.scalar);\n\t\ttx.add(\n\t\t\tpoolProxyMoveCalls.stake({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: marginManager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tamount: stakeInput,\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 Unstake from the pool\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tunstake = (marginManagerKey: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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\tpoolProxyMoveCalls.unstake({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: marginManager.address,\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 Submit a proposal\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @param {MarginProposalParams} params Parameters for the proposal\n\t * @returns A function that takes a Transaction object\n\t */\n\tsubmitProposal =\n\t\t(marginManagerKey: string, params: MarginProposalParams) => (tx: Transaction) => {\n\t\t\tconst { takerFee, makerFee, stakeRequired } = params;\n\t\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\t\tconst pool = this.#config.getPool(marginManager.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 stakeInput = convertRate(stakeRequired, FLOAT_SCALAR);\n\t\t\tconst takerFeeInput = convertRate(takerFee, FLOAT_SCALAR);\n\t\t\tconst makerFeeInput = convertRate(makerFee, FLOAT_SCALAR);\n\t\t\ttx.add(\n\t\t\t\tpoolProxyMoveCalls.submitProposal({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tmarginManager: marginManager.address,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\ttakerFee: takerFeeInput,\n\t\t\t\t\t\tmakerFee: makerFeeInput,\n\t\t\t\t\t\tstakeRequired: stakeInput,\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 Vote on a proposal\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @param {string} proposalId The ID of the proposal to vote on\n\t * @returns A function that takes a Transaction object\n\t */\n\tvote = (marginManagerKey: string, proposalId: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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\tpoolProxyMoveCalls.vote({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: marginManager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tproposalId,\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 Claim a rebate from a pool\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tclaimRebate = (marginManagerKey: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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\tpoolProxyMoveCalls.claimRebates({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: marginManager.address,\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 Withdraw settled amounts permissionlessly for a margin manager by ID\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The object ID of the MarginManager\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawMarginSettledAmounts =\n\t\t(poolKey: string, marginManagerId: string) => (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\tpoolProxyMoveCalls.withdrawSettledAmountsPermissionless({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tmarginManager: marginManagerId,\n\t\t\t\t\t\tpool: pool.address,\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 Update the current price for a pool using Pyth oracle\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateCurrentPrice = (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\tif (!baseCoin.priceInfoObjectId) {\n\t\t\tthrow new Error(`Missing priceInfoObjectId for ${pool.baseCoin}`);\n\t\t}\n\t\tif (!quoteCoin.priceInfoObjectId) {\n\t\t\tthrow new Error(`Missing priceInfoObjectId for ${pool.quoteCoin}`);\n\t\t}\n\t\ttx.add(\n\t\t\tpoolProxyMoveCalls.updateCurrentPrice({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tbasePriceInfoObject: baseCoin.priceInfoObjectId,\n\t\t\t\t\tquotePriceInfoObject: quoteCoin.priceInfoObjectId,\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"],"mappings":";;;;;;;;;AAkBA,IAAa,oBAAb,MAA+B;CAC9B;;;;CAKA,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pD,MAAM,YAAY,MAAKA,OAAQ,QAAQ,KAAK,UAAU;AACtD,OAAI,CAAC,SAAS,kBACb,OAAM,IAAI,MAAM,iCAAiC,KAAK,WAAW;AAElE,OAAI,CAAC,UAAU,kBACd,OAAM,IAAI,MAAM,iCAAiC,KAAK,YAAY;AAEnE,MAAG,IACFmB,mBAAsC;IACrC,SAAS,MAAKnB,OAAQ;IACtB,WAAW;KACV,UAAU,MAAKA,OAAQ;KACvB,MAAM,KAAK;KACX,qBAAqB,SAAS;KAC9B,sBAAsB,UAAU;KAChC;IACD,eAAe,CAAC,SAAS,MAAM,UAAU,KAAK;IAC9C,CAAC,CACF;;AAxpBD,QAAKA,SAAU"}
|
|
1
|
+
{"version":3,"file":"poolProxy.mjs","names":["#config","#oracleCalls","poolProxyMoveCalls.modifyOrder","poolProxyMoveCalls.cancelOrder","poolProxyMoveCalls.cancelOrders","poolProxyMoveCalls.cancelAllOrders","poolProxyMoveCalls.withdrawSettledAmounts","poolProxyMoveCalls.stake","poolProxyMoveCalls.unstake","poolProxyMoveCalls.submitProposal","poolProxyMoveCalls.vote","poolProxyMoveCalls.claimRebates","poolProxyMoveCalls.withdrawSettledAmountsPermissionless","poolProxyUpgradedMoveCalls"],"sources":["../../src/transactions/poolProxy.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport type { Transaction } from '@mysten/sui/transactions';\nimport type {\n\tPlaceMarginLimitOrderParams,\n\tPlaceMarginMarketOrderParams,\n\tMarginProposalParams,\n} from '../types/index.js';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { OrderType, SelfMatchingOptions } from '../types/index.js';\nimport { MAX_TIMESTAMP, FLOAT_SCALAR } from '../utils/config.js';\nimport { convertQuantity, convertPrice, convertRate } from '../utils/conversion.js';\nimport * as poolProxyMoveCalls from '../contracts/deepbook_margin/pool_proxy.js';\nimport * as poolProxyUpgradedMoveCalls from '../contracts/deepbook_margin/pool_proxy_upgraded.js';\n\n/**\n * PoolProxyContract class for managing PoolProxy operations.\n */\nexport class PoolProxyContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for PoolProxyContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * Oracle-taking entrypoints live in the parallel `_upgraded` module, which takes Pyth's\n\t * upgraded-Core `PriceInfoObject`. Entrypoints with no oracle argument stay on the base\n\t * module, which is the only place they exist.\n\t */\n\tget #oracleCalls() {\n\t\treturn poolProxyUpgradedMoveCalls;\n\t}\n\n\t/**\n\t * @description Place a limit order. Enforces a post-trade `risk_ratio >=\n\t * min_borrow_risk_ratio` invariant on the manager (skipped when the manager\n\t * has no debt).\n\t * @param {PlaceMarginLimitOrderParams} params Parameters for placing a limit order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceLimitOrder = (params: PlaceMarginLimitOrderParams) => (tx: Transaction) => {\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tmarginManagerKey,\n\t\t\tclientOrderId,\n\t\t\tprice,\n\t\t\tquantity,\n\t\t\tisBid,\n\t\t\texpiration = MAX_TIMESTAMP,\n\t\t\torderType = OrderType.NO_RESTRICTION,\n\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\tpayWithDeep = true,\n\t\t} = params;\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\tconst inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);\n\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\treturn tx.add(\n\t\t\tthis.#oracleCalls.placeLimitOrderV2({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: manager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\tbaseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),\n\t\t\t\t\tquoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),\n\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\torderType,\n\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\tprice: inputPrice,\n\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\tisBid,\n\t\t\t\t\tpayWithDeep,\n\t\t\t\t\texpireTimestamp: expiration,\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 Place a market order. Enforces a post-trade `risk_ratio >=\n\t * min_borrow_risk_ratio` invariant on the manager (skipped when the manager\n\t * has no debt).\n\t * @param {PlaceMarginMarketOrderParams} params Parameters for placing a market order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceMarketOrder = (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => {\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tmarginManagerKey,\n\t\t\tclientOrderId,\n\t\t\tquantity,\n\t\t\tisBid,\n\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\tpayWithDeep = true,\n\t\t} = params;\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\treturn tx.add(\n\t\t\tthis.#oracleCalls.placeMarketOrderV2({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: manager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\tbaseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),\n\t\t\t\t\tquoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),\n\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\tisBid,\n\t\t\t\t\tpayWithDeep,\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 Place a reduce only limit order. Requires the manager to have\n\t * debt on the relevant side; enforces a monotonic `risk_ratio_after >=\n\t * risk_ratio_before` invariant so the fill cannot leak value to the\n\t * counterparty.\n\t * @param {PlaceMarginLimitOrderParams} params Parameters for placing a reduce only limit order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceReduceOnlyLimitOrder = (params: PlaceMarginLimitOrderParams) => (tx: Transaction) => {\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tmarginManagerKey,\n\t\t\tclientOrderId,\n\t\t\tprice,\n\t\t\tquantity,\n\t\t\tisBid,\n\t\t\texpiration = MAX_TIMESTAMP,\n\t\t\torderType = OrderType.NO_RESTRICTION,\n\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\tpayWithDeep = true,\n\t\t} = params;\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\tconst inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);\n\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\treturn tx.add(\n\t\t\tthis.#oracleCalls.placeReduceOnlyLimitOrderV2({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: manager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\tbaseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),\n\t\t\t\t\tquoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),\n\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\torderType,\n\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\tprice: inputPrice,\n\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\tisBid,\n\t\t\t\t\tpayWithDeep,\n\t\t\t\t\texpireTimestamp: expiration,\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 Place a reduce only market order. Requires the manager to\n\t * have debt on the relevant side; enforces a monotonic `risk_ratio_after >=\n\t * risk_ratio_before` invariant so the fill cannot leak value to the\n\t * counterparty.\n\t * @param {PlaceMarginMarketOrderParams} params Parameters for placing a reduce only market order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceReduceOnlyMarketOrder = (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => {\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tmarginManagerKey,\n\t\t\tclientOrderId,\n\t\t\tquantity,\n\t\t\tisBid,\n\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\tpayWithDeep = true,\n\t\t} = params;\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\treturn tx.add(\n\t\t\tthis.#oracleCalls.placeReduceOnlyMarketOrderV2({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: manager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\tbaseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),\n\t\t\t\t\tquoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),\n\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\tisBid,\n\t\t\t\t\tpayWithDeep,\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 Place a market order and repay the loan from the fill proceeds.\n\t * The taker fill settles into the manager's balance, so the proceeds (plus any\n\t * idle balance) are repaid into the debt side before the risk check; the gate\n\t * is then the *net* post-repay `risk_ratio` being at least the pre-fill ratio.\n\t * Unlike {@link placeMarketOrder}, which checks the post-trade ratio against\n\t * `min_borrow_risk_ratio`, this lets a deleveraging fill go through in the\n\t * `liquidation..min_borrow` band, where a swap alone would be rejected.\n\t * @param {PlaceMarginMarketOrderParams} params Parameters for placing a market order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceMarketOrderAndRepayLoan = (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => {\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tmarginManagerKey,\n\t\t\tclientOrderId,\n\t\t\tquantity,\n\t\t\tisBid,\n\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\tpayWithDeep = true,\n\t\t} = params;\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\treturn tx.add(\n\t\t\tthis.#oracleCalls.placeMarketOrderAndRepayLoan({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: manager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\tbaseOracle: this.#config.getPriceInfoObjectId(pool.baseCoin),\n\t\t\t\t\tquoteOracle: this.#config.getPriceInfoObjectId(pool.quoteCoin),\n\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\tisBid,\n\t\t\t\t\tpayWithDeep,\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 Place a reduce only limit order and repay the loan from the\n\t * fill proceeds. Requires debt on the relevant side (a bid needs base debt; an\n\t * ask needs quote debt and sells at most the gross base held); the repay\n\t * happens before the monotonic `risk_ratio` gate, so the check is on the net\n\t * post-repay ratio.\n\t * @param {PlaceMarginLimitOrderParams} params Parameters for placing a reduce only limit order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceReduceOnlyLimitOrderAndRepayLoan =\n\t\t(params: PlaceMarginLimitOrderParams) => (tx: Transaction) => {\n\t\t\tconst {\n\t\t\t\tpoolKey,\n\t\t\t\tmarginManagerKey,\n\t\t\t\tclientOrderId,\n\t\t\t\tprice,\n\t\t\t\tquantity,\n\t\t\t\tisBid,\n\t\t\t\texpiration = MAX_TIMESTAMP,\n\t\t\t\torderType = OrderType.NO_RESTRICTION,\n\t\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\t\tpayWithDeep = true,\n\t\t\t} = params;\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\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\t\t\tconst inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);\n\t\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\t\treturn tx.add(\n\t\t\t\tthis.#oracleCalls.placeReduceOnlyLimitOrderAndRepayLoan({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tmarginManager: manager.address,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\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\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\t\torderType,\n\t\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\t\tprice: inputPrice,\n\t\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\t\tisBid,\n\t\t\t\t\t\tpayWithDeep,\n\t\t\t\t\t\texpireTimestamp: expiration,\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 Place a reduce only market order and repay the loan from the\n\t * fill proceeds. Same reduce-only direction guard as\n\t * {@link placeReduceOnlyMarketOrder}, but the settled proceeds are repaid into\n\t * the debt side before the monotonic `risk_ratio` gate, so the check is on the\n\t * net post-repay ratio.\n\t * @param {PlaceMarginMarketOrderParams} params Parameters for placing a reduce only market order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceReduceOnlyMarketOrderAndRepayLoan =\n\t\t(params: PlaceMarginMarketOrderParams) => (tx: Transaction) => {\n\t\t\tconst {\n\t\t\t\tpoolKey,\n\t\t\t\tmarginManagerKey,\n\t\t\t\tclientOrderId,\n\t\t\t\tquantity,\n\t\t\t\tisBid,\n\t\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\t\tpayWithDeep = true,\n\t\t\t} = params;\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\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\t\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\t\treturn tx.add(\n\t\t\t\tthis.#oracleCalls.placeReduceOnlyMarketOrderAndRepayLoan({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tmarginManager: manager.address,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\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\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\t\tisBid,\n\t\t\t\t\t\tpayWithDeep,\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 Modify an existing order\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @param {string} orderId Order ID to modify\n\t * @param {number} newQuantity New quantity for the order\n\t * @returns A function that takes a Transaction object\n\t */\n\tmodifyOrder =\n\t\t(marginManagerKey: string, orderId: string, newQuantity: number) => (tx: Transaction) => {\n\t\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\t\tconst pool = this.#config.getPool(marginManager.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 inputQuantity = convertQuantity(newQuantity, baseCoin.scalar);\n\n\t\t\ttx.add(\n\t\t\t\tpoolProxyMoveCalls.modifyOrder({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tmarginManager: marginManager.address,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\torderId: BigInt(orderId),\n\t\t\t\t\t\tnewQuantity: inputQuantity,\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 Cancel an existing order\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @param {string} orderId Order ID to cancel\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelOrder = (marginManagerKey: string, orderId: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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\tpoolProxyMoveCalls.cancelOrder({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: marginManager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\torderId: BigInt(orderId),\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 Cancel multiple existing orders\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @param {string[]} orderIds Order IDs to cancel\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelOrders = (marginManagerKey: string, orderIds: string[]) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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\tpoolProxyMoveCalls.cancelOrders({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: marginManager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\torderIds: orderIds.map(BigInt),\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 Cancel all existing orders\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelAllOrders = (marginManagerKey: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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\tpoolProxyMoveCalls.cancelAllOrders({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: marginManager.address,\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 Withdraw settled amounts\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawSettledAmounts = (marginManagerKey: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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\tpoolProxyMoveCalls.withdrawSettledAmounts({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: marginManager.address,\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 Stake in the pool\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @param {number} stakeAmount The amount to stake\n\t * @returns A function that takes a Transaction object\n\t */\n\tstake = (marginManagerKey: string, stakeAmount: number) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst deepCoin = this.#config.getCoin('DEEP');\n\t\tconst stakeInput = convertQuantity(stakeAmount, deepCoin.scalar);\n\t\ttx.add(\n\t\t\tpoolProxyMoveCalls.stake({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: marginManager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tamount: stakeInput,\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 Unstake from the pool\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tunstake = (marginManagerKey: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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\tpoolProxyMoveCalls.unstake({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: marginManager.address,\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 Submit a proposal\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @param {MarginProposalParams} params Parameters for the proposal\n\t * @returns A function that takes a Transaction object\n\t */\n\tsubmitProposal =\n\t\t(marginManagerKey: string, params: MarginProposalParams) => (tx: Transaction) => {\n\t\t\tconst { takerFee, makerFee, stakeRequired } = params;\n\t\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\t\tconst pool = this.#config.getPool(marginManager.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 stakeInput = convertRate(stakeRequired, FLOAT_SCALAR);\n\t\t\tconst takerFeeInput = convertRate(takerFee, FLOAT_SCALAR);\n\t\t\tconst makerFeeInput = convertRate(makerFee, FLOAT_SCALAR);\n\t\t\ttx.add(\n\t\t\t\tpoolProxyMoveCalls.submitProposal({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tmarginManager: marginManager.address,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\ttakerFee: takerFeeInput,\n\t\t\t\t\t\tmakerFee: makerFeeInput,\n\t\t\t\t\t\tstakeRequired: stakeInput,\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 Vote on a proposal\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @param {string} proposalId The ID of the proposal to vote on\n\t * @returns A function that takes a Transaction object\n\t */\n\tvote = (marginManagerKey: string, proposalId: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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\tpoolProxyMoveCalls.vote({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: marginManager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tproposalId,\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 Claim a rebate from a pool\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tclaimRebate = (marginManagerKey: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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\tpoolProxyMoveCalls.claimRebates({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tmarginManager: marginManager.address,\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 Withdraw settled amounts permissionlessly for a margin manager by ID\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The object ID of the MarginManager\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawMarginSettledAmounts =\n\t\t(poolKey: string, marginManagerId: string) => (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\tpoolProxyMoveCalls.withdrawSettledAmountsPermissionless({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tmarginManager: marginManagerId,\n\t\t\t\t\t\tpool: pool.address,\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 Update the current price for a pool using Pyth oracle\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateCurrentPrice = (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\tthis.#oracleCalls.updateCurrentPrice({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tbasePriceInfoObject: this.#config.getPriceInfoObjectId(pool.baseCoin),\n\t\t\t\t\tquotePriceInfoObject: this.#config.getPriceInfoObjectId(pool.quoteCoin),\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"],"mappings":";;;;;;;;;;AAmBA,IAAa,oBAAb,MAA+B;CAC9B;;;;CAKA,YAAY,QAAwB;0BAoBjB,YAAyC,OAAoB;GAC/E,MAAM,EACL,SACA,kBACA,eACA,OACA,UACA,OACA,aAAa,eACb,YAAY,UAAU,gBACtB,qBAAqB,oBAAoB,uBACzC,cAAc,SACX;GACJ,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;GAC1C,MAAM,UAAU,MAAKA,OAAQ,iBAAiB,iBAAiB;GAC/D,MAAM,WAAW,MAAKA,OAAQ,QAAQ,KAAK,SAAS;GACpD,MAAM,YAAY,MAAKA,OAAQ,QAAQ,KAAK,UAAU;GACtD,MAAM,iBAAiB,MAAKA,OAAQ,cAAc,KAAK,SAAS;GAChE,MAAM,kBAAkB,MAAKA,OAAQ,cAAc,KAAK,UAAU;GAClE,MAAM,aAAa,aAAa,OAAO,cAAc,UAAU,QAAQ,SAAS,OAAO;GACvF,MAAM,gBAAgB,gBAAgB,UAAU,SAAS,OAAO;AAChE,UAAO,GAAG,IACT,MAAKC,YAAa,kBAAkB;IACnC,SAAS,MAAKD,OAAQ;IACtB,WAAW;KACV,UAAU,MAAKA,OAAQ;KACvB,eAAe,QAAQ;KACvB,MAAM,KAAK;KACX,gBAAgB,eAAe;KAC/B,iBAAiB,gBAAgB;KACjC,YAAY,MAAKA,OAAQ,qBAAqB,KAAK,SAAS;KAC5D,aAAa,MAAKA,OAAQ,qBAAqB,KAAK,UAAU;KAC9D,eAAe,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QhB,KAAIC,cAAe;AAClB,SAAOY"}
|
package/dist/types/index.d.mts
CHANGED
|
@@ -19,6 +19,21 @@ interface Coin {
|
|
|
19
19
|
currencyId?: string;
|
|
20
20
|
priceInfoObjectId?: string;
|
|
21
21
|
}
|
|
22
|
+
/** State objects identifying the Pyth deployment margin prices against. */
|
|
23
|
+
interface PythConfig {
|
|
24
|
+
pythStateId: string;
|
|
25
|
+
wormholeStateId: string;
|
|
26
|
+
/** Hermes endpoint serving update data for this deployment. */
|
|
27
|
+
hermesEndpoint?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Bearer token for the Hermes endpoint. The one serving Pyth's upgraded Core answers
|
|
30
|
+
* 401 without it, so pushing price updates needs this set.
|
|
31
|
+
*
|
|
32
|
+
* Prefer the client-level `pythAccessToken` option, which sets this without having to
|
|
33
|
+
* restate the state object ids. Supply the token at runtime — do not commit it.
|
|
34
|
+
*/
|
|
35
|
+
accessToken?: string;
|
|
36
|
+
}
|
|
22
37
|
interface Pool {
|
|
23
38
|
address: string;
|
|
24
39
|
baseCoin: string;
|
|
@@ -370,5 +385,5 @@ type DepositDuringInitParams = {
|
|
|
370
385
|
coin: TransactionArgument;
|
|
371
386
|
});
|
|
372
387
|
//#endregion
|
|
373
|
-
export { AccountBalances, AccountInfo, AddConditionalOrderParams, BalanceManager, BaseQuantityIn, BaseQuantityOut, BorrowedShares, CanPlaceLimitOrderParams, CanPlaceMarketOrderParams, Coin, Config, CreatePermissionlessPoolParams, CreatePoolAdminParams, DecodedOrderId, DepositDuringInitParams, DepositParams, InterestConfigParams, Level2Range, Level2TicksFromMid, LockedBalances, ManagerBalance, MarginManager, MarginManagerAssets, MarginManagerBalancesResult, MarginManagerDebts, MarginManagerState, MarginPool, MarginPoolConfigParams, MarginProposalParams, OrderDeepRequiredResult, OrderType, PendingLimitOrderParams, PendingMarketOrderParams, PlaceLimitOrderParams, PlaceMarginLimitOrderParams, PlaceMarginMarketOrderParams, PlaceMarketOrderParams, Pool, PoolBookParams, PoolConfigParams, PoolDeepPrice, PoolTradeParams, ProposalParams, QuantityOut, QuoteQuantityIn, QuoteQuantityOut, ReferralBalances, SelfMatchingOptions, SetEwmaParams, SwapParams, SwapWithManagerParams, VaultBalances };
|
|
388
|
+
export { AccountBalances, AccountInfo, AddConditionalOrderParams, BalanceManager, BaseQuantityIn, BaseQuantityOut, BorrowedShares, CanPlaceLimitOrderParams, CanPlaceMarketOrderParams, Coin, Config, CreatePermissionlessPoolParams, CreatePoolAdminParams, DecodedOrderId, DepositDuringInitParams, DepositParams, InterestConfigParams, Level2Range, Level2TicksFromMid, LockedBalances, ManagerBalance, MarginManager, MarginManagerAssets, MarginManagerBalancesResult, MarginManagerDebts, MarginManagerState, MarginPool, MarginPoolConfigParams, MarginProposalParams, OrderDeepRequiredResult, OrderType, PendingLimitOrderParams, PendingMarketOrderParams, PlaceLimitOrderParams, PlaceMarginLimitOrderParams, PlaceMarginMarketOrderParams, PlaceMarketOrderParams, Pool, PoolBookParams, PoolConfigParams, PoolDeepPrice, PoolTradeParams, ProposalParams, PythConfig, QuantityOut, QuoteQuantityIn, QuoteQuantityOut, ReferralBalances, SelfMatchingOptions, SetEwmaParams, SwapParams, SwapWithManagerParams, VaultBalances };
|
|
374
389
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/types/index.ts"],"mappings":";;;UAMiB,cAAA;EAChB,OAAA;EACA,QAAA;EACA,UAAA;EACA,WAAA;AAAA;AAAA,UAGgB,aAAA;EAChB,OAAA;EACA,OAAA;AAAA;AAAA,UAGgB,IAAA;EAChB,OAAA;EACA,IAAA;EACA,MAAA;EACA,IAAA;EACA,UAAA;EACA,iBAAA;AAAA;AAAA,UAGgB,IAAA;EAChB,OAAA;EACA,QAAA;EACA,SAAA;AAAA;AAAA,UAGgB,UAAA;EAChB,OAAA;EACA,IAAA;AAAA;AAAA,aAIW,SAAA;EACX,cAAA;EACA,mB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AA;AAAA,UAEgB,mBAAA;EAChB,SAAA;EACA,UAAA;AAAA;AAAA,UAEgB,kBAAA;EAChB,QAAA;EACA,SAAA;AAAA;AAAA,UAEgB,2BAAA;EAChB,IAAA;EACA,KAAA;EACA,IAAA;AAAA;AAAA,UAEgB,cAAA;EAChB,UAAA;EACA,WAAA;AAAA
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/types/index.ts"],"mappings":";;;UAMiB,cAAA;EAChB,OAAA;EACA,QAAA;EACA,UAAA;EACA,WAAA;AAAA;AAAA,UAGgB,aAAA;EAChB,OAAA;EACA,OAAA;AAAA;AAAA,UAGgB,IAAA;EAChB,OAAA;EACA,IAAA;EACA,MAAA;EACA,IAAA;EACA,UAAA;EACA,iBAAA;AAAA;;UAIgB,UAAA;EAChB,WAAA;EACA,eAAA;EAVA;EAYA,cAAA;EAVA;;;;;AAMD;;EAYC,WAAA;AAAA;AAAA,UAGgB,IAAA;EAChB,OAAA;EACA,QAAA;EACA,SAAA;AAAA;AAAA,UAGgB,UAAA;EAChB,OAAA;EACA,IAAA;AAAA;AAAA,aAIW,SAAA;EACX,cAAA;EACA,mBAAA;EACA,YAAA;EACA,SAAA;AAAA;AAAA,aAIW,mBAAA;EACX,qBAAA;EACA,YAAA;EACA,YAAA;AAAA;AAAA,UAGgB,qBAAA;EAChB,OAAA;EACA,iBAAA;EACA,aAAA;EACA,KAAA;EACA,QAAA;EACA,KAAA;EACA,UAAA;EACA,SAAA,GAAY,SAAA;EACZ,kBAAA,GAAqB,mBAAA;EACrB,WAAA;AAAA;AAAA,UAGgB,sBAAA;EAChB,OAAA;EACA,iBAAA;EACA,aAAA;EACA,QAAA;EACA,KAAA;EACA,kBAAA,GAAqB,mBAAA;EACrB,WAAA;AAAA;AAAA,UAGgB,wBAAA;EAChB,OAAA;EACA,iBAAA;EACA,KAAA;EACA,QAAA;EACA,KAAA;EACA,WAAA;EACA,eAAA;AAAA;AAAA,UAGgB,yBAAA;EAChB,OAA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+1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { TransactionArgument, TransactionObjectArgument } from '@mysten/sui/transactions';\n\n// SPDX-License-Identifier: Apache-2.0\nexport interface BalanceManager {\n\taddress: string;\n\ttradeCap?: string;\n\tdepositCap?: string;\n\twithdrawCap?: string;\n}\n\nexport interface MarginManager {\n\taddress: string;\n\tpoolKey: string;\n}\n\nexport interface Coin {\n\taddress: string;\n\ttype: string;\n\tscalar: number;\n\tfeed?: string;\n\tcurrencyId?: string;\n\tpriceInfoObjectId?: string;\n}\n\nexport interface Pool {\n\taddress: string;\n\tbaseCoin: string;\n\tquoteCoin: string;\n}\n\nexport interface MarginPool {\n\taddress: string;\n\ttype: string;\n}\n\n// Trading constants\nexport enum OrderType {\n\tNO_RESTRICTION,\n\tIMMEDIATE_OR_CANCEL,\n\tFILL_OR_KILL,\n\tPOST_ONLY,\n}\n\n// Self matching options\nexport enum SelfMatchingOptions {\n\tSELF_MATCHING_ALLOWED,\n\tCANCEL_TAKER,\n\tCANCEL_MAKER,\n}\n\nexport interface PlaceLimitOrderParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tclientOrderId: string;\n\tprice: number | bigint;\n\tquantity: number | bigint;\n\tisBid: boolean;\n\texpiration?: number | bigint;\n\torderType?: OrderType;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tpayWithDeep?: boolean;\n}\n\nexport interface PlaceMarketOrderParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tclientOrderId: string;\n\tquantity: number | bigint;\n\tisBid: boolean;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tpayWithDeep?: boolean;\n}\n\nexport interface CanPlaceLimitOrderParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tprice: number | bigint;\n\tquantity: number | bigint;\n\tisBid: boolean;\n\tpayWithDeep: boolean;\n\texpireTimestamp: number;\n}\n\nexport interface CanPlaceMarketOrderParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tquantity: number | bigint;\n\tisBid: boolean;\n\tpayWithDeep: boolean;\n}\n\nexport interface PlaceMarginLimitOrderParams {\n\tpoolKey: string;\n\tmarginManagerKey: string;\n\tclientOrderId: string;\n\tprice: number | bigint;\n\tquantity: number | bigint;\n\tisBid: boolean;\n\texpiration?: number | bigint;\n\torderType?: OrderType;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tpayWithDeep?: boolean;\n}\n\nexport interface PlaceMarginMarketOrderParams {\n\tpoolKey: string;\n\tmarginManagerKey: string;\n\tclientOrderId: string;\n\tquantity: number | bigint;\n\tisBid: boolean;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tpayWithDeep?: boolean;\n}\n\nexport interface PendingLimitOrderParams {\n\tclientOrderId: string;\n\torderType?: OrderType;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tprice: number | bigint;\n\tquantity: number | bigint;\n\tisBid: boolean;\n\tpayWithDeep?: boolean;\n\texpireTimestamp?: number | bigint;\n}\n\nexport interface PendingMarketOrderParams {\n\tclientOrderId: string;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tquantity: number | bigint;\n\tisBid: boolean;\n\tpayWithDeep?: boolean;\n}\n\nexport interface AddConditionalOrderParams {\n\tmarginManagerKey: string;\n\tconditionalOrderId: string;\n\ttriggerBelowPrice: boolean;\n\ttriggerPrice: number | bigint;\n\tpendingOrder: PendingLimitOrderParams | PendingMarketOrderParams;\n}\n\nexport interface ProposalParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\ttakerFee: number | bigint;\n\tmakerFee: number | bigint;\n\tstakeRequired: number | bigint;\n}\n\nexport interface MarginProposalParams {\n\ttakerFee: number | bigint;\n\tmakerFee: number | bigint;\n\tstakeRequired: number | bigint;\n}\n\nexport interface SwapParams {\n\tpoolKey: string;\n\tamount: number | bigint;\n\tdeepAmount: number | bigint;\n\tminOut: number | bigint;\n\tdeepCoin?: TransactionObjectArgument;\n\tbaseCoin?: TransactionObjectArgument;\n\tquoteCoin?: TransactionObjectArgument;\n}\n\nexport interface SwapWithManagerParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\ttradeCap: string;\n\tdepositCap: string;\n\twithdrawCap: string;\n\tamount: number | bigint;\n\tminOut: number | bigint;\n\tbaseCoin?: TransactionObjectArgument;\n\tquoteCoin?: TransactionObjectArgument;\n}\n\nexport interface StakeParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tamount: number | bigint;\n}\n\nexport interface VoteParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tproposalId: string;\n}\n\nexport interface FlashLoanParams {\n\tpoolKey: string;\n\tamount: number | bigint;\n}\n\nexport interface CreatePoolAdminParams {\n\tbaseCoinKey: string;\n\tquoteCoinKey: string;\n\ttickSize: number | bigint;\n\tlotSize: number | bigint;\n\tminSize: number | bigint;\n\twhitelisted: boolean;\n\tstablePool: boolean;\n}\n\nexport interface CreatePermissionlessPoolParams {\n\tbaseCoinKey: string;\n\tquoteCoinKey: string;\n\ttickSize: number | bigint;\n\tlotSize: number | bigint;\n\tminSize: number | bigint;\n\tdeepCoin?: TransactionObjectArgument;\n}\n\nexport interface SetEwmaParams {\n\talpha: number | bigint;\n\tzScoreThreshold: number | bigint;\n\tadditionalTakerFee: number | bigint;\n}\n\nexport interface PoolConfigParams {\n\tminWithdrawRiskRatio: number | bigint;\n\tminBorrowRiskRatio: number | bigint;\n\tliquidationRiskRatio: number | bigint;\n\ttargetLiquidationRiskRatio: number | bigint;\n\tuserLiquidationReward: number | bigint;\n\tpoolLiquidationReward: number | bigint;\n}\n\nexport interface MarginPoolConfigParams {\n\tsupplyCap: number | bigint;\n\tmaxUtilizationRate: number | bigint;\n\tprotocolSpread: number | bigint;\n\tminBorrow: number | bigint;\n\trateLimitCapacity?: number | bigint;\n\trateLimitRefillRatePerMs?: number | bigint;\n\trateLimitEnabled?: boolean;\n}\n\nexport interface InterestConfigParams {\n\tbaseRate: number | bigint;\n\tbaseSlope: number | bigint;\n\toptimalUtilization: number | bigint;\n\texcessSlope: number | bigint;\n}\n\nexport interface Config {\n\tDEEPBOOK_PACKAGE_ID: string;\n\tREGISTRY_ID: string;\n\tDEEP_TREASURY_ID: string;\n}\n\n// === Named Return Types ===\n\n// Balance\nexport interface ManagerBalance {\n\tcoinType: string;\n\tbalance: number;\n}\nexport interface VaultBalances {\n\tbase: number;\n\tquote: number;\n\tdeep: number;\n}\nexport interface LockedBalances {\n\tbase: number;\n\tquote: number;\n\tdeep: number;\n}\nexport interface ReferralBalances {\n\tbase: number;\n\tquote: number;\n\tdeep: number;\n}\n\n// Pool\nexport interface PoolTradeParams {\n\ttakerFee: number;\n\tmakerFee: number;\n\tstakeRequired: number;\n}\nexport interface PoolBookParams {\n\ttickSize: number;\n\tlotSize: number;\n\tminSize: number;\n}\nexport type PoolDeepPrice =\n\t| { asset_is_base: true; deep_per_base: number }\n\t| { asset_is_base: false; deep_per_quote: number };\n\n// Quantity calculations\nexport interface QuoteQuantityOut {\n\tbaseQuantity: number;\n\tbaseOut: number;\n\tquoteOut: number;\n\tdeepRequired: number;\n}\nexport interface BaseQuantityOut {\n\tquoteQuantity: number;\n\tbaseOut: number;\n\tquoteOut: number;\n\tdeepRequired: number;\n}\nexport interface QuantityOut {\n\tbaseQuantity: number;\n\tquoteQuantity: number;\n\tbaseOut: number;\n\tquoteOut: number;\n\tdeepRequired: number;\n}\nexport interface BaseQuantityIn {\n\tbaseIn: number;\n\tquoteOut: number;\n\tdeepRequired: number;\n}\nexport interface QuoteQuantityIn {\n\tbaseOut: number;\n\tquoteIn: number;\n\tdeepRequired: number;\n}\nexport interface OrderDeepRequiredResult {\n\tdeepRequiredTaker: number;\n\tdeepRequiredMaker: number;\n}\n\n// Order book\nexport interface Level2Range {\n\tprices: number[];\n\tquantities: number[];\n}\nexport interface Level2TicksFromMid {\n\tbid_prices: number[];\n\tbid_quantities: number[];\n\task_prices: number[];\n\task_quantities: number[];\n}\n\n// Account\nexport interface AccountBalances {\n\tbase: number;\n\tquote: number;\n\tdeep: number;\n}\nexport interface AccountInfo {\n\tepoch: string;\n\topen_orders: { contents: string[] };\n\ttaker_volume: number;\n\tmaker_volume: number;\n\tactive_stake: number;\n\tinactive_stake: number;\n\tcreated_proposal: boolean;\n\tvoted_proposal: string | null;\n\tunclaimed_rebates: AccountBalances;\n\tsettled_balances: AccountBalances;\n\towed_balances: AccountBalances;\n}\n\n// Order\nexport interface DecodedOrderId {\n\tisBid: boolean;\n\tprice: number;\n\torderId: number;\n}\n\n// Margin\nexport interface MarginManagerState {\n\tmanagerId: string;\n\tdeepbookPoolId: string;\n\triskRatio: number;\n\tbaseAsset: string;\n\tquoteAsset: string;\n\tbaseDebt: string;\n\tquoteDebt: string;\n\tbasePythPrice: string;\n\tbasePythDecimals: number;\n\tquotePythPrice: string;\n\tquotePythDecimals: number;\n\tcurrentPrice: bigint;\n\tlowestTriggerAbovePrice: bigint;\n\thighestTriggerBelowPrice: bigint;\n}\nexport interface MarginManagerAssets {\n\tbaseAsset: string;\n\tquoteAsset: string;\n}\nexport interface MarginManagerDebts {\n\tbaseDebt: string;\n\tquoteDebt: string;\n}\nexport interface MarginManagerBalancesResult {\n\tbase: string;\n\tquote: string;\n\tdeep: string;\n}\nexport interface BorrowedShares {\n\tbaseShares: string;\n\tquoteShares: string;\n}\n\n/**\n * Parameters for depositing into a margin manager.\n * Either `amount` (number) or `coin` (TransactionArgument) must be provided, but not both.\n */\nexport type DepositParams = {\n\tmanagerKey: string;\n} & ({ amount: number | bigint; coin?: never } | { amount?: never; coin: TransactionArgument });\n\n/**\n * Parameters for depositing during margin manager initialization.\n * Either (`coinType` + `amount`) or (`coinType` + `coin`) must be provided.\n * `coinType` should be a coin key from config (e.g., 'SUI', 'DBUSDC', 'DEEP').\n */\nexport type DepositDuringInitParams = {\n\tmanager: TransactionArgument;\n\tpoolKey: string;\n\tcoinType: string;\n} & ({ amount: number | bigint; coin?: never } | { amount?: never; coin: TransactionArgument });\n"],"mappings":";AAuCA,IAAY,kDAAL;AACN;AACA;AACA;AACA;;;AAID,IAAY,sEAAL;AACN;AACA;AACA"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { TransactionArgument, TransactionObjectArgument } from '@mysten/sui/transactions';\n\n// SPDX-License-Identifier: Apache-2.0\nexport interface BalanceManager {\n\taddress: string;\n\ttradeCap?: string;\n\tdepositCap?: string;\n\twithdrawCap?: string;\n}\n\nexport interface MarginManager {\n\taddress: string;\n\tpoolKey: string;\n}\n\nexport interface Coin {\n\taddress: string;\n\ttype: string;\n\tscalar: number;\n\tfeed?: string;\n\tcurrencyId?: string;\n\tpriceInfoObjectId?: string;\n}\n\n/** State objects identifying the Pyth deployment margin prices against. */\nexport interface PythConfig {\n\tpythStateId: string;\n\twormholeStateId: string;\n\t/** Hermes endpoint serving update data for this deployment. */\n\thermesEndpoint?: string;\n\t/**\n\t * Bearer token for the Hermes endpoint. The one serving Pyth's upgraded Core answers\n\t * 401 without it, so pushing price updates needs this set.\n\t *\n\t * Prefer the client-level `pythAccessToken` option, which sets this without having to\n\t * restate the state object ids. Supply the token at runtime — do not commit it.\n\t */\n\taccessToken?: string;\n}\n\nexport interface Pool {\n\taddress: string;\n\tbaseCoin: string;\n\tquoteCoin: string;\n}\n\nexport interface MarginPool {\n\taddress: string;\n\ttype: string;\n}\n\n// Trading constants\nexport enum OrderType {\n\tNO_RESTRICTION,\n\tIMMEDIATE_OR_CANCEL,\n\tFILL_OR_KILL,\n\tPOST_ONLY,\n}\n\n// Self matching options\nexport enum SelfMatchingOptions {\n\tSELF_MATCHING_ALLOWED,\n\tCANCEL_TAKER,\n\tCANCEL_MAKER,\n}\n\nexport interface PlaceLimitOrderParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tclientOrderId: string;\n\tprice: number | bigint;\n\tquantity: number | bigint;\n\tisBid: boolean;\n\texpiration?: number | bigint;\n\torderType?: OrderType;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tpayWithDeep?: boolean;\n}\n\nexport interface PlaceMarketOrderParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tclientOrderId: string;\n\tquantity: number | bigint;\n\tisBid: boolean;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tpayWithDeep?: boolean;\n}\n\nexport interface CanPlaceLimitOrderParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tprice: number | bigint;\n\tquantity: number | bigint;\n\tisBid: boolean;\n\tpayWithDeep: boolean;\n\texpireTimestamp: number;\n}\n\nexport interface CanPlaceMarketOrderParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tquantity: number | bigint;\n\tisBid: boolean;\n\tpayWithDeep: boolean;\n}\n\nexport interface PlaceMarginLimitOrderParams {\n\tpoolKey: string;\n\tmarginManagerKey: string;\n\tclientOrderId: string;\n\tprice: number | bigint;\n\tquantity: number | bigint;\n\tisBid: boolean;\n\texpiration?: number | bigint;\n\torderType?: OrderType;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tpayWithDeep?: boolean;\n}\n\nexport interface PlaceMarginMarketOrderParams {\n\tpoolKey: string;\n\tmarginManagerKey: string;\n\tclientOrderId: string;\n\tquantity: number | bigint;\n\tisBid: boolean;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tpayWithDeep?: boolean;\n}\n\nexport interface PendingLimitOrderParams {\n\tclientOrderId: string;\n\torderType?: OrderType;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tprice: number | bigint;\n\tquantity: number | bigint;\n\tisBid: boolean;\n\tpayWithDeep?: boolean;\n\texpireTimestamp?: number | bigint;\n}\n\nexport interface PendingMarketOrderParams {\n\tclientOrderId: string;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tquantity: number | bigint;\n\tisBid: boolean;\n\tpayWithDeep?: boolean;\n}\n\nexport interface AddConditionalOrderParams {\n\tmarginManagerKey: string;\n\tconditionalOrderId: string;\n\ttriggerBelowPrice: boolean;\n\ttriggerPrice: number | bigint;\n\tpendingOrder: PendingLimitOrderParams | PendingMarketOrderParams;\n}\n\nexport interface ProposalParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\ttakerFee: number | bigint;\n\tmakerFee: number | bigint;\n\tstakeRequired: number | bigint;\n}\n\nexport interface MarginProposalParams {\n\ttakerFee: number | bigint;\n\tmakerFee: number | bigint;\n\tstakeRequired: number | bigint;\n}\n\nexport interface SwapParams {\n\tpoolKey: string;\n\tamount: number | bigint;\n\tdeepAmount: number | bigint;\n\tminOut: number | bigint;\n\tdeepCoin?: TransactionObjectArgument;\n\tbaseCoin?: TransactionObjectArgument;\n\tquoteCoin?: TransactionObjectArgument;\n}\n\nexport interface SwapWithManagerParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\ttradeCap: string;\n\tdepositCap: string;\n\twithdrawCap: string;\n\tamount: number | bigint;\n\tminOut: number | bigint;\n\tbaseCoin?: TransactionObjectArgument;\n\tquoteCoin?: TransactionObjectArgument;\n}\n\nexport interface StakeParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tamount: number | bigint;\n}\n\nexport interface VoteParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tproposalId: string;\n}\n\nexport interface FlashLoanParams {\n\tpoolKey: string;\n\tamount: number | bigint;\n}\n\nexport interface CreatePoolAdminParams {\n\tbaseCoinKey: string;\n\tquoteCoinKey: string;\n\ttickSize: number | bigint;\n\tlotSize: number | bigint;\n\tminSize: number | bigint;\n\twhitelisted: boolean;\n\tstablePool: boolean;\n}\n\nexport interface CreatePermissionlessPoolParams {\n\tbaseCoinKey: string;\n\tquoteCoinKey: string;\n\ttickSize: number | bigint;\n\tlotSize: number | bigint;\n\tminSize: number | bigint;\n\tdeepCoin?: TransactionObjectArgument;\n}\n\nexport interface SetEwmaParams {\n\talpha: number | bigint;\n\tzScoreThreshold: number | bigint;\n\tadditionalTakerFee: number | bigint;\n}\n\nexport interface PoolConfigParams {\n\tminWithdrawRiskRatio: number | bigint;\n\tminBorrowRiskRatio: number | bigint;\n\tliquidationRiskRatio: number | bigint;\n\ttargetLiquidationRiskRatio: number | bigint;\n\tuserLiquidationReward: number | bigint;\n\tpoolLiquidationReward: number | bigint;\n}\n\nexport interface MarginPoolConfigParams {\n\tsupplyCap: number | bigint;\n\tmaxUtilizationRate: number | bigint;\n\tprotocolSpread: number | bigint;\n\tminBorrow: number | bigint;\n\trateLimitCapacity?: number | bigint;\n\trateLimitRefillRatePerMs?: number | bigint;\n\trateLimitEnabled?: boolean;\n}\n\nexport interface InterestConfigParams {\n\tbaseRate: number | bigint;\n\tbaseSlope: number | bigint;\n\toptimalUtilization: number | bigint;\n\texcessSlope: number | bigint;\n}\n\nexport interface Config {\n\tDEEPBOOK_PACKAGE_ID: string;\n\tREGISTRY_ID: string;\n\tDEEP_TREASURY_ID: string;\n}\n\n// === Named Return Types ===\n\n// Balance\nexport interface ManagerBalance {\n\tcoinType: string;\n\tbalance: number;\n}\nexport interface VaultBalances {\n\tbase: number;\n\tquote: number;\n\tdeep: number;\n}\nexport interface LockedBalances {\n\tbase: number;\n\tquote: number;\n\tdeep: number;\n}\nexport interface ReferralBalances {\n\tbase: number;\n\tquote: number;\n\tdeep: number;\n}\n\n// Pool\nexport interface PoolTradeParams {\n\ttakerFee: number;\n\tmakerFee: number;\n\tstakeRequired: number;\n}\nexport interface PoolBookParams {\n\ttickSize: number;\n\tlotSize: number;\n\tminSize: number;\n}\nexport type PoolDeepPrice =\n\t| { asset_is_base: true; deep_per_base: number }\n\t| { asset_is_base: false; deep_per_quote: number };\n\n// Quantity calculations\nexport interface QuoteQuantityOut {\n\tbaseQuantity: number;\n\tbaseOut: number;\n\tquoteOut: number;\n\tdeepRequired: number;\n}\nexport interface BaseQuantityOut {\n\tquoteQuantity: number;\n\tbaseOut: number;\n\tquoteOut: number;\n\tdeepRequired: number;\n}\nexport interface QuantityOut {\n\tbaseQuantity: number;\n\tquoteQuantity: number;\n\tbaseOut: number;\n\tquoteOut: number;\n\tdeepRequired: number;\n}\nexport interface BaseQuantityIn {\n\tbaseIn: number;\n\tquoteOut: number;\n\tdeepRequired: number;\n}\nexport interface QuoteQuantityIn {\n\tbaseOut: number;\n\tquoteIn: number;\n\tdeepRequired: number;\n}\nexport interface OrderDeepRequiredResult {\n\tdeepRequiredTaker: number;\n\tdeepRequiredMaker: number;\n}\n\n// Order book\nexport interface Level2Range {\n\tprices: number[];\n\tquantities: number[];\n}\nexport interface Level2TicksFromMid {\n\tbid_prices: number[];\n\tbid_quantities: number[];\n\task_prices: number[];\n\task_quantities: number[];\n}\n\n// Account\nexport interface AccountBalances {\n\tbase: number;\n\tquote: number;\n\tdeep: number;\n}\nexport interface AccountInfo {\n\tepoch: string;\n\topen_orders: { contents: string[] };\n\ttaker_volume: number;\n\tmaker_volume: number;\n\tactive_stake: number;\n\tinactive_stake: number;\n\tcreated_proposal: boolean;\n\tvoted_proposal: string | null;\n\tunclaimed_rebates: AccountBalances;\n\tsettled_balances: AccountBalances;\n\towed_balances: AccountBalances;\n}\n\n// Order\nexport interface DecodedOrderId {\n\tisBid: boolean;\n\tprice: number;\n\torderId: number;\n}\n\n// Margin\nexport interface MarginManagerState {\n\tmanagerId: string;\n\tdeepbookPoolId: string;\n\triskRatio: number;\n\tbaseAsset: string;\n\tquoteAsset: string;\n\tbaseDebt: string;\n\tquoteDebt: string;\n\tbasePythPrice: string;\n\tbasePythDecimals: number;\n\tquotePythPrice: string;\n\tquotePythDecimals: number;\n\tcurrentPrice: bigint;\n\tlowestTriggerAbovePrice: bigint;\n\thighestTriggerBelowPrice: bigint;\n}\nexport interface MarginManagerAssets {\n\tbaseAsset: string;\n\tquoteAsset: string;\n}\nexport interface MarginManagerDebts {\n\tbaseDebt: string;\n\tquoteDebt: string;\n}\nexport interface MarginManagerBalancesResult {\n\tbase: string;\n\tquote: string;\n\tdeep: string;\n}\nexport interface BorrowedShares {\n\tbaseShares: string;\n\tquoteShares: string;\n}\n\n/**\n * Parameters for depositing into a margin manager.\n * Either `amount` (number) or `coin` (TransactionArgument) must be provided, but not both.\n */\nexport type DepositParams = {\n\tmanagerKey: string;\n} & ({ amount: number | bigint; coin?: never } | { amount?: never; coin: TransactionArgument });\n\n/**\n * Parameters for depositing during margin manager initialization.\n * Either (`coinType` + `amount`) or (`coinType` + `coin`) must be provided.\n * `coinType` should be a coin key from config (e.g., 'SUI', 'DBUSDC', 'DEEP').\n */\nexport type DepositDuringInitParams = {\n\tmanager: TransactionArgument;\n\tpoolKey: string;\n\tcoinType: string;\n} & ({ amount: number | bigint; coin?: never } | { amount?: never; coin: TransactionArgument });\n"],"mappings":";AAuDA,IAAY,kDAAL;AACN;AACA;AACA;AACA;;;AAID,IAAY,sEAAL;AACN;AACA;AACA"}
|
package/dist/utils/config.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BalanceManager, Coin, MarginManager, MarginPool, Pool } from "../types/index.mjs";
|
|
1
|
+
import { BalanceManager, Coin, MarginManager, MarginPool, Pool, PythConfig } from "../types/index.mjs";
|
|
2
2
|
import { CoinMap, DeepbookPackageIds, MarginPoolMap, PoolMap } from "./constants.mjs";
|
|
3
3
|
import { BalanceManagerContract } from "../transactions/balanceManager.mjs";
|
|
4
4
|
import { SuiClientTypes } from "@mysten/sui/client";
|
|
@@ -20,10 +20,7 @@ declare class DeepBookConfig {
|
|
|
20
20
|
[key: string]: MarginManager;
|
|
21
21
|
};
|
|
22
22
|
address: string;
|
|
23
|
-
pyth:
|
|
24
|
-
pythStateId: string;
|
|
25
|
-
wormholeStateId: string;
|
|
26
|
-
};
|
|
23
|
+
pyth: PythConfig;
|
|
27
24
|
DEEPBOOK_PACKAGE_ID: string;
|
|
28
25
|
REGISTRY_ID: string;
|
|
29
26
|
DEEP_TREASURY_ID: string;
|
|
@@ -47,7 +44,8 @@ declare class DeepBookConfig {
|
|
|
47
44
|
pools,
|
|
48
45
|
marginPools,
|
|
49
46
|
packageIds,
|
|
50
|
-
pyth
|
|
47
|
+
pyth,
|
|
48
|
+
pythAccessToken
|
|
51
49
|
}: {
|
|
52
50
|
network: SuiClientTypes.Network;
|
|
53
51
|
address: string;
|
|
@@ -64,12 +62,34 @@ declare class DeepBookConfig {
|
|
|
64
62
|
pools?: PoolMap;
|
|
65
63
|
marginPools?: MarginPoolMap;
|
|
66
64
|
packageIds?: DeepbookPackageIds;
|
|
67
|
-
pyth?:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
pyth?: PythConfig;
|
|
66
|
+
/**
|
|
67
|
+
* Bearer token for the Hermes serving Pyth's upgraded Core, which answers 401
|
|
68
|
+
* without one. Set this rather than `pyth` when the built-in state objects are
|
|
69
|
+
* correct and only the credential is missing — `pyth` replaces the whole config,
|
|
70
|
+
* so setting a token through it means restating the state object ids.
|
|
71
|
+
*
|
|
72
|
+
* Applied after `pyth`, so if both carry a token this one wins.
|
|
73
|
+
*/
|
|
74
|
+
pythAccessToken?: string;
|
|
71
75
|
});
|
|
72
76
|
requirePyth(): void;
|
|
77
|
+
/**
|
|
78
|
+
* The Pyth feed id for a coin under the active deployment.
|
|
79
|
+
*
|
|
80
|
+
* Pairs with {@link getPriceInfoObjectId}: Hermes is queried by feed id and the Move
|
|
81
|
+
* call takes the object, so the two must come from the same deployment or the update
|
|
82
|
+
* lands on an object the on-chain feed-id check then rejects.
|
|
83
|
+
*/
|
|
84
|
+
getFeedId(coinKey: string): string;
|
|
85
|
+
/**
|
|
86
|
+
* The `PriceInfoObject` id for a coin on Pyth's upgraded Core.
|
|
87
|
+
*
|
|
88
|
+
* Throws rather than passing `undefined` into a move call: a feed may simply have no
|
|
89
|
+
* object on the upgraded deployment yet, and the resulting on-chain abort
|
|
90
|
+
* (`EPriceFeedIdMismatch`) does not say which coin was at fault.
|
|
91
|
+
*/
|
|
92
|
+
getPriceInfoObjectId(coinKey: string): string;
|
|
73
93
|
getCoin(key: string): Coin;
|
|
74
94
|
getPool(key: string): Pool;
|
|
75
95
|
getMarginPool(key: string): MarginPool;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","names":[],"sources":["../../src/utils/config.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"config.d.mts","names":[],"sources":["../../src/utils/config.ts"],"mappings":";;;;;;cA8Ba,YAAA;AAAA,cACA,WAAA;AAAA,cAGA,aAAA;AAAA,cACA,4BAAA;AAAA,cAGA,UAAA;AAAA,cACA,sBAAA;AAAA,cAEA,cAAA;EAAA;EAIZ,OAAA,EAAS,cAAA,CAAe,OAAA;EACxB,eAAA;IAAA,CAAoB,GAAA,WAAc,cAAA;EAAA;EAClC,cAAA;IAAA,CAAmB,GAAA,WAAc,aAAA;EAAA;EACjC,OAAA;EACA,IAAA,EAAM,UAAA;EAEN,mBAAA;EACA,WAAA;EACA,gBAAA;EACA,iBAAA;EACA,SAAA;EACA,kBAAA;EACA,sBAAA;EACA,QAAA;EACA,cAAA;EACA,mBAAA;EAEA,cAAA,EAAgB,sBAAA;;IAGf,OAAA;IACA,OAAA;IACA,QAAA;IACA,cAAA;IACA,mBAAA;IACA,eAAA;IACA,cAAA;IACA,KAAA;IACA,KAAA;IACA,WAAA;IACA,UAAA;IACA,IAAA;IACA;EAAA;IAEA,OAAA,EAAS,cAAA,CAAe,OAAA;IACxB,OAAA;IACA,QAAA;IACA,cAAA;IACA,mBAAA;IACA,eAAA;MAAA,CAAqB,GAAA,WAAc,cAAA;IAAA;IACnC,cAAA;MAAA,CAAoB,GAAA,WAAc,aAAA;IAAA;IAClC,KAAA,GAAQ,OAAA;IACR,KAAA,GAAQ,OAAA;IACR,WAAA,GAAc,aAAA;IACd,UAAA,GAAa,kBAAA;IACb,IAAA,GAAO,UAAA;IApBP;;;;;;;;IA6BA,eAAA;EAAA;EAgED,WAAA,CAAA;EA7ES;;;;;;;EA6FT,SAAA,CAAU,OAAA;EA8D6B;;;;;;;EA7CvC,oBAAA,CAAqB,OAAA;EAarB,OAAA,CAAQ,GAAA,WAAc,IAAA;EAStB,OAAA,CAAQ,GAAA,WAAc,IAAA;EAStB,aAAA,CAAc,GAAA,WAAc,UAAA;EApL5B;;;;;EAkMA,iBAAA,CAAkB,UAAA,WAAqB,cAAA;EA9LvC;;;;;EA2MA,gBAAA,CAAiB,UAAA,WAAqB,aAAA;AAAA"}
|
package/dist/utils/config.mjs
CHANGED
|
@@ -14,7 +14,7 @@ var DeepBookConfig = class {
|
|
|
14
14
|
#coins;
|
|
15
15
|
#pools;
|
|
16
16
|
#marginPools;
|
|
17
|
-
constructor({ network, address, adminCap, marginAdminCap, marginMaintainerCap, balanceManagers, marginManagers, coins, pools, marginPools, packageIds, pyth }) {
|
|
17
|
+
constructor({ network, address, adminCap, marginAdminCap, marginMaintainerCap, balanceManagers, marginManagers, coins, pools, marginPools, packageIds, pyth, pythAccessToken }) {
|
|
18
18
|
this.network = network;
|
|
19
19
|
this.address = normalizeSuiAddress(address);
|
|
20
20
|
this.adminCap = adminCap;
|
|
@@ -48,7 +48,7 @@ var DeepBookConfig = class {
|
|
|
48
48
|
this.MARGIN_V1 = mainnetPackageIds.MARGIN_V1;
|
|
49
49
|
this.MARGIN_REGISTRY_ID = mainnetPackageIds.MARGIN_REGISTRY_ID;
|
|
50
50
|
this.LIQUIDATION_PACKAGE_ID = mainnetPackageIds.LIQUIDATION_PACKAGE_ID;
|
|
51
|
-
this.pyth = mainnetPythConfigs;
|
|
51
|
+
this.pyth = pyth || mainnetPythConfigs;
|
|
52
52
|
} else if (network === "testnet") {
|
|
53
53
|
this.#coins = coins || testnetCoins;
|
|
54
54
|
this.#pools = pools || testnetPools;
|
|
@@ -60,12 +60,41 @@ var DeepBookConfig = class {
|
|
|
60
60
|
this.MARGIN_V1 = testnetPackageIds.MARGIN_V1;
|
|
61
61
|
this.MARGIN_REGISTRY_ID = testnetPackageIds.MARGIN_REGISTRY_ID;
|
|
62
62
|
this.LIQUIDATION_PACKAGE_ID = testnetPackageIds.LIQUIDATION_PACKAGE_ID;
|
|
63
|
-
this.pyth = testnetPythConfigs;
|
|
63
|
+
this.pyth = pyth || testnetPythConfigs;
|
|
64
64
|
} else throw new Error(`Network '${network}' is not supported by default. Provide custom 'packageIds' for non-standard networks.`);
|
|
65
|
+
if (pythAccessToken) this.pyth = {
|
|
66
|
+
...this.pyth,
|
|
67
|
+
accessToken: pythAccessToken
|
|
68
|
+
};
|
|
65
69
|
this.balanceManager = new BalanceManagerContract(this);
|
|
66
70
|
}
|
|
67
71
|
requirePyth() {
|
|
68
|
-
|
|
72
|
+
const { pythStateId, wormholeStateId } = this.pyth;
|
|
73
|
+
if (!pythStateId || !wormholeStateId) throw new ConfigurationError("Pyth configuration is required for price feed operations. Provide 'pyth' when using custom packageIds.");
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The Pyth feed id for a coin under the active deployment.
|
|
77
|
+
*
|
|
78
|
+
* Pairs with {@link getPriceInfoObjectId}: Hermes is queried by feed id and the Move
|
|
79
|
+
* call takes the object, so the two must come from the same deployment or the update
|
|
80
|
+
* lands on an object the on-chain feed-id check then rejects.
|
|
81
|
+
*/
|
|
82
|
+
getFeedId(coinKey) {
|
|
83
|
+
const { feed } = this.getCoin(coinKey);
|
|
84
|
+
if (!feed) throw new ConfigurationError(`Coin '${coinKey}' has no Pyth feed id configured.`);
|
|
85
|
+
return feed;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The `PriceInfoObject` id for a coin on Pyth's upgraded Core.
|
|
89
|
+
*
|
|
90
|
+
* Throws rather than passing `undefined` into a move call: a feed may simply have no
|
|
91
|
+
* object on the upgraded deployment yet, and the resulting on-chain abort
|
|
92
|
+
* (`EPriceFeedIdMismatch`) does not say which coin was at fault.
|
|
93
|
+
*/
|
|
94
|
+
getPriceInfoObjectId(coinKey) {
|
|
95
|
+
const { priceInfoObjectId } = this.getCoin(coinKey);
|
|
96
|
+
if (!priceInfoObjectId) throw new ConfigurationError(`Coin '${coinKey}' has no priceInfoObjectId. Pyth's upgraded Core has no price feed object for it on ${this.network}, or the id is missing from your coin config.`);
|
|
97
|
+
return priceInfoObjectId;
|
|
69
98
|
}
|
|
70
99
|
getCoin(key) {
|
|
71
100
|
const coin = this.#coins[key];
|