@mysten/deepbook-v3 1.1.4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/client.d.mts +58 -763
- package/dist/client.d.mts.map +1 -1
- package/dist/client.mjs +253 -2127
- package/dist/client.mjs.map +1 -1
- package/dist/contracts/utils/index.mjs +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/pyth/pyth.mjs +1 -1
- package/dist/queries/accountQueries.mjs +104 -0
- package/dist/queries/accountQueries.mjs.map +1 -0
- package/dist/queries/balanceManagerQueries.mjs +113 -0
- package/dist/queries/balanceManagerQueries.mjs.map +1 -0
- package/dist/queries/context.mjs +15 -0
- package/dist/queries/context.mjs.map +1 -0
- package/dist/queries/marginManagerQueries.mjs +365 -0
- package/dist/queries/marginManagerQueries.mjs.map +1 -0
- package/dist/queries/marginPoolQueries.mjs +184 -0
- package/dist/queries/marginPoolQueries.mjs.map +1 -0
- package/dist/queries/orderQueries.mjs +165 -0
- package/dist/queries/orderQueries.mjs.map +1 -0
- package/dist/queries/poolQueries.mjs +234 -0
- package/dist/queries/poolQueries.mjs.map +1 -0
- package/dist/queries/priceFeedQueries.mjs +83 -0
- package/dist/queries/priceFeedQueries.mjs.map +1 -0
- package/dist/queries/quantityQueries.mjs +216 -0
- package/dist/queries/quantityQueries.mjs.map +1 -0
- package/dist/queries/referralQueries.mjs +96 -0
- package/dist/queries/referralQueries.mjs.map +1 -0
- package/dist/queries/registryQueries.mjs +162 -0
- package/dist/queries/registryQueries.mjs.map +1 -0
- package/dist/queries/tpslQueries.mjs +62 -0
- package/dist/queries/tpslQueries.mjs.map +1 -0
- package/dist/transactions/balanceManager.d.mts.map +1 -1
- package/dist/transactions/balanceManager.mjs +5 -4
- package/dist/transactions/balanceManager.mjs.map +1 -1
- package/dist/transactions/deepbook.d.mts +24 -24
- package/dist/transactions/deepbook.d.mts.map +1 -1
- package/dist/transactions/deepbook.mjs +48 -47
- package/dist/transactions/deepbook.mjs.map +1 -1
- package/dist/transactions/deepbookAdmin.d.mts +2 -2
- package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
- package/dist/transactions/deepbookAdmin.mjs +10 -9
- package/dist/transactions/deepbookAdmin.mjs.map +1 -1
- package/dist/transactions/flashLoans.d.mts.map +1 -1
- package/dist/transactions/flashLoans.mjs +6 -4
- package/dist/transactions/flashLoans.mjs.map +1 -1
- package/dist/transactions/governance.d.mts.map +1 -1
- package/dist/transactions/governance.mjs +5 -4
- package/dist/transactions/governance.mjs.map +1 -1
- package/dist/transactions/marginAdmin.d.mts +7 -7
- package/dist/transactions/marginAdmin.d.mts.map +1 -1
- package/dist/transactions/marginAdmin.mjs +8 -7
- package/dist/transactions/marginAdmin.mjs.map +1 -1
- package/dist/transactions/marginLiquidations.d.mts +3 -3
- package/dist/transactions/marginLiquidations.d.mts.map +1 -1
- package/dist/transactions/marginLiquidations.mjs +5 -4
- package/dist/transactions/marginLiquidations.mjs.map +1 -1
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginMaintainer.d.mts.map +1 -1
- package/dist/transactions/marginMaintainer.mjs +15 -14
- package/dist/transactions/marginMaintainer.mjs.map +1 -1
- package/dist/transactions/marginManager.d.mts +23 -23
- package/dist/transactions/marginManager.d.mts.map +1 -1
- package/dist/transactions/marginManager.mjs +12 -11
- package/dist/transactions/marginManager.mjs.map +1 -1
- package/dist/transactions/marginPool.d.mts.map +1 -1
- package/dist/transactions/marginPool.mjs +3 -2
- package/dist/transactions/marginPool.mjs.map +1 -1
- package/dist/transactions/marginRegistry.d.mts +15 -15
- package/dist/transactions/marginTPSL.d.mts +1 -1
- package/dist/transactions/marginTPSL.d.mts.map +1 -1
- package/dist/transactions/marginTPSL.mjs +6 -8
- package/dist/transactions/marginTPSL.mjs.map +1 -1
- package/dist/transactions/poolProxy.d.mts.map +1 -1
- package/dist/transactions/poolProxy.mjs +13 -13
- package/dist/transactions/poolProxy.mjs.map +1 -1
- package/dist/types/index.d.mts +189 -52
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/utils/constants.d.mts.map +1 -1
- package/dist/utils/constants.mjs +10 -0
- package/dist/utils/constants.mjs.map +1 -1
- package/dist/utils/conversion.mjs +26 -0
- package/dist/utils/conversion.mjs.map +1 -0
- package/package.json +5 -4
- package/src/client.ts +421 -2662
- package/src/index.ts +27 -0
- package/src/queries/accountQueries.ts +117 -0
- package/src/queries/balanceManagerQueries.ts +156 -0
- package/src/queries/context.ts +44 -0
- package/src/queries/index.ts +16 -0
- package/src/queries/marginManagerQueries.ts +575 -0
- package/src/queries/marginPoolQueries.ts +226 -0
- package/src/queries/orderQueries.ts +202 -0
- package/src/queries/poolQueries.ts +266 -0
- package/src/queries/priceFeedQueries.ts +141 -0
- package/src/queries/quantityQueries.ts +266 -0
- package/src/queries/referralQueries.ts +112 -0
- package/src/queries/registryQueries.ts +185 -0
- package/src/queries/tpslQueries.ts +88 -0
- package/src/transactions/balanceManager.ts +5 -4
- package/src/transactions/deepbook.ts +98 -84
- package/src/transactions/deepbookAdmin.ts +10 -9
- package/src/transactions/flashLoans.ts +5 -4
- package/src/transactions/governance.ts +5 -4
- package/src/transactions/marginAdmin.ts +8 -7
- package/src/transactions/marginLiquidations.ts +5 -4
- package/src/transactions/marginMaintainer.ts +15 -14
- package/src/transactions/marginManager.ts +12 -11
- package/src/transactions/marginPool.ts +3 -2
- package/src/transactions/marginTPSL.ts +11 -6
- package/src/transactions/poolProxy.ts +12 -11
- package/src/types/index.ts +200 -53
- package/src/utils/constants.ts +10 -0
- package/src/utils/conversion.ts +33 -0
package/dist/client.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BalanceManager, CanPlaceLimitOrderParams, CanPlaceMarketOrderParams, MarginManager } from "./types/index.mjs";
|
|
1
|
+
import { AccountInfo, BalanceManager, BaseQuantityIn, BaseQuantityOut, BorrowedShares, CanPlaceLimitOrderParams, CanPlaceMarketOrderParams, DecodedOrderId, Level2Range, Level2TicksFromMid, LockedBalances, ManagerBalance, MarginManager, MarginManagerAssets, MarginManagerBalancesResult, MarginManagerDebts, MarginManagerState, OrderDeepRequiredResult, PoolBookParams, PoolDeepPrice, PoolTradeParams, QuantityOut, QuoteQuantityIn, QuoteQuantityOut, ReferralBalances, VaultBalances } from "./types/index.mjs";
|
|
2
2
|
import { CoinMap, DeepbookPackageIds, PoolMap } from "./utils/constants.mjs";
|
|
3
3
|
import { BalanceManagerContract } from "./transactions/balanceManager.mjs";
|
|
4
4
|
import { DeepBookContract } from "./transactions/deepbook.mjs";
|
|
@@ -6,13 +6,13 @@ import { DeepBookAdminContract } from "./transactions/deepbookAdmin.mjs";
|
|
|
6
6
|
import { FlashLoanContract } from "./transactions/flashLoans.mjs";
|
|
7
7
|
import { GovernanceContract } from "./transactions/governance.mjs";
|
|
8
8
|
import { MarginAdminContract } from "./transactions/marginAdmin.mjs";
|
|
9
|
+
import { MarginLiquidationsContract } from "./transactions/marginLiquidations.mjs";
|
|
9
10
|
import { MarginMaintainerContract } from "./transactions/marginMaintainer.mjs";
|
|
10
|
-
import { MarginPoolContract } from "./transactions/marginPool.mjs";
|
|
11
11
|
import { MarginManagerContract } from "./transactions/marginManager.mjs";
|
|
12
|
+
import { MarginPoolContract } from "./transactions/marginPool.mjs";
|
|
12
13
|
import { MarginRegistryContract } from "./transactions/marginRegistry.mjs";
|
|
13
|
-
import { MarginLiquidationsContract } from "./transactions/marginLiquidations.mjs";
|
|
14
|
-
import { PoolProxyContract } from "./transactions/poolProxy.mjs";
|
|
15
14
|
import { MarginTPSLContract } from "./transactions/marginTPSL.mjs";
|
|
15
|
+
import { PoolProxyContract } from "./transactions/poolProxy.mjs";
|
|
16
16
|
import { Transaction } from "@mysten/sui/transactions";
|
|
17
17
|
import { ClientWithCoreApi, SuiClientRegistration, SuiClientTypes } from "@mysten/sui/client";
|
|
18
18
|
|
|
@@ -81,93 +81,36 @@ declare class DeepBookClient {
|
|
|
81
81
|
packageIds,
|
|
82
82
|
pyth
|
|
83
83
|
}: DeepBookClientOptions);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
* @param {string} managerKey Key of the balance manager
|
|
87
|
-
* @param {string} coinKey Key of the coin
|
|
88
|
-
* @returns {Promise<{ coinType: string, balance: number }>} An object with coin type and balance
|
|
89
|
-
*/
|
|
90
|
-
checkManagerBalance(managerKey: string, coinKey: string): Promise<{
|
|
91
|
-
coinType: string;
|
|
92
|
-
balance: number;
|
|
93
|
-
}>;
|
|
94
|
-
/**
|
|
95
|
-
* @description Check the balance of a BalanceManager by its address directly
|
|
96
|
-
* @param {string} managerAddress The on-chain address of the BalanceManager
|
|
97
|
-
* @param {string} coinKey Key of the coin
|
|
98
|
-
* @returns {Promise<{ coinType: string, balance: number }>} An object with coin type and balance
|
|
99
|
-
*/
|
|
100
|
-
checkManagerBalanceWithAddress(managerAddress: string, coinKey: string): Promise<{
|
|
101
|
-
coinType: string;
|
|
102
|
-
balance: number;
|
|
103
|
-
}>;
|
|
104
|
-
/**
|
|
105
|
-
* @description Check multiple coin balances for multiple balance managers by address in a single dry run call
|
|
106
|
-
* @param {string[]} managerAddresses The on-chain addresses of the BalanceManagers
|
|
107
|
-
* @param {string[]} coinKeys Keys of the coins to check balances for
|
|
108
|
-
* @returns {Promise<Record<string, Record<string, number>>>} Object keyed by manager address, mapping coinType to balance
|
|
109
|
-
*/
|
|
84
|
+
checkManagerBalance(managerKey: string, coinKey: string): Promise<ManagerBalance>;
|
|
85
|
+
checkManagerBalanceWithAddress(managerAddress: string, coinKey: string): Promise<ManagerBalance>;
|
|
110
86
|
checkManagerBalancesWithAddress(managerAddresses: string[], coinKeys: string[]): Promise<Record<string, Record<string, number>>>;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
* @param {string} poolKey Key of the pool
|
|
114
|
-
* @returns {Promise<boolean>} Boolean indicating if the pool is whitelisted
|
|
115
|
-
*/
|
|
87
|
+
getBalanceManagerIds(owner: string): Promise<string[]>;
|
|
88
|
+
accountExists(poolKey: string, managerKey: string): Promise<boolean>;
|
|
116
89
|
whitelisted(poolKey: string): Promise<boolean>;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
quoteOut: number;
|
|
141
|
-
deepRequired: number;
|
|
142
|
-
}>;
|
|
143
|
-
/**
|
|
144
|
-
* @description Get the output quantities for given base and quote quantities. Only one quantity can be non-zero
|
|
145
|
-
* @param {string} poolKey Key of the pool
|
|
146
|
-
* @param {number} baseQuantity Base quantity to convert
|
|
147
|
-
* @param {number} quoteQuantity Quote quantity to convert
|
|
148
|
-
* @returns {Promise<{ baseQuantity: number, quoteQuantity: number, baseOut: number, quoteOut: number, deepRequired: number }>}
|
|
149
|
-
* An object with base quantity, quote quantity, base out, quote out, and deep required for the dry run
|
|
150
|
-
*/
|
|
151
|
-
getQuantityOut(poolKey: string, baseQuantity: number, quoteQuantity: number): Promise<{
|
|
152
|
-
baseQuantity: number;
|
|
153
|
-
quoteQuantity: number;
|
|
154
|
-
baseOut: number;
|
|
155
|
-
quoteOut: number;
|
|
156
|
-
deepRequired: number;
|
|
157
|
-
}>;
|
|
158
|
-
/**
|
|
159
|
-
* @description Get open orders for a balance manager in a pool
|
|
160
|
-
* @param {string} poolKey Key of the pool
|
|
161
|
-
* @param {string} managerKey Key of the balance manager
|
|
162
|
-
* @returns {Promise<Array>} An array of open order IDs
|
|
163
|
-
*/
|
|
90
|
+
vaultBalances(poolKey: string): Promise<VaultBalances>;
|
|
91
|
+
getPoolIdByAssets(baseType: string, quoteType: string): Promise<string>;
|
|
92
|
+
midPrice(poolKey: string): Promise<number>;
|
|
93
|
+
poolTradeParams(poolKey: string): Promise<PoolTradeParams>;
|
|
94
|
+
poolBookParams(poolKey: string): Promise<PoolBookParams>;
|
|
95
|
+
stablePool(poolKey: string): Promise<boolean>;
|
|
96
|
+
registeredPool(poolKey: string): Promise<boolean>;
|
|
97
|
+
poolTradeParamsNext(poolKey: string): Promise<PoolTradeParams>;
|
|
98
|
+
quorum(poolKey: string): Promise<number>;
|
|
99
|
+
poolId(poolKey: string): Promise<string>;
|
|
100
|
+
canPlaceLimitOrder(params: CanPlaceLimitOrderParams): Promise<boolean>;
|
|
101
|
+
canPlaceMarketOrder(params: CanPlaceMarketOrderParams): Promise<boolean>;
|
|
102
|
+
checkMarketOrderParams(poolKey: string, quantity: number | bigint): Promise<boolean>;
|
|
103
|
+
checkLimitOrderParams(poolKey: string, price: number | bigint, quantity: number | bigint, expireTimestamp: number): Promise<boolean>;
|
|
104
|
+
getQuoteQuantityOut(poolKey: string, baseQuantity: number | bigint): Promise<QuoteQuantityOut>;
|
|
105
|
+
getBaseQuantityOut(poolKey: string, quoteQuantity: number | bigint): Promise<BaseQuantityOut>;
|
|
106
|
+
getQuantityOut(poolKey: string, baseQuantity: number | bigint, quoteQuantity: number | bigint): Promise<QuantityOut>;
|
|
107
|
+
getQuoteQuantityOutInputFee(poolKey: string, baseQuantity: number | bigint): Promise<QuoteQuantityOut>;
|
|
108
|
+
getBaseQuantityOutInputFee(poolKey: string, quoteQuantity: number | bigint): Promise<BaseQuantityOut>;
|
|
109
|
+
getQuantityOutInputFee(poolKey: string, baseQuantity: number | bigint, quoteQuantity: number | bigint): Promise<QuantityOut>;
|
|
110
|
+
getBaseQuantityIn(poolKey: string, targetQuoteQuantity: number | bigint, payWithDeep: boolean): Promise<BaseQuantityIn>;
|
|
111
|
+
getQuoteQuantityIn(poolKey: string, targetBaseQuantity: number | bigint, payWithDeep: boolean): Promise<QuoteQuantityIn>;
|
|
112
|
+
getOrderDeepRequired(poolKey: string, baseQuantity: number | bigint, price: number | bigint): Promise<OrderDeepRequiredResult>;
|
|
164
113
|
accountOpenOrders(poolKey: string, managerKey: string): Promise<string[]>;
|
|
165
|
-
/**
|
|
166
|
-
* @description Get the order information for a specific order in a pool
|
|
167
|
-
* @param {string} poolKey Key of the pool
|
|
168
|
-
* @param {string} orderId Order ID
|
|
169
|
-
* @returns {Promise<Object>} A promise that resolves to an object containing the order information
|
|
170
|
-
*/
|
|
171
114
|
getOrder(poolKey: string, orderId: string): Promise<{
|
|
172
115
|
balance_manager_id: string;
|
|
173
116
|
order_id: string;
|
|
@@ -183,12 +126,6 @@ declare class DeepBookClient {
|
|
|
183
126
|
status: number;
|
|
184
127
|
expire_timestamp: string;
|
|
185
128
|
} | null>;
|
|
186
|
-
/**
|
|
187
|
-
* @description Get the order information for a specific order in a pool, with normalized price
|
|
188
|
-
* @param {string} poolKey Key of the pool
|
|
189
|
-
* @param {string} orderId Order ID
|
|
190
|
-
* @returns {Promise<Object>} A promise that resolves to an object containing the order information with normalized price
|
|
191
|
-
*/
|
|
192
129
|
getOrderNormalized(poolKey: string, orderId: string): Promise<{
|
|
193
130
|
quantity: string;
|
|
194
131
|
filled_quantity: string;
|
|
@@ -206,14 +143,6 @@ declare class DeepBookClient {
|
|
|
206
143
|
status: number;
|
|
207
144
|
expire_timestamp: string;
|
|
208
145
|
} | null>;
|
|
209
|
-
/**
|
|
210
|
-
* @description Retrieves information for multiple specific orders in a pool.
|
|
211
|
-
* @param {string} poolKey - The key identifying the pool from which to retrieve order information.
|
|
212
|
-
* @param {string[]} orderIds - List of order IDs to retrieve information for.
|
|
213
|
-
* @returns {Promise<Object[] | null>} A promise that resolves to an array of order objects, each containing details such as
|
|
214
|
-
* balance manager ID, order ID, client order ID, quantity, filled quantity, fee information, order price, epoch, status,
|
|
215
|
-
* and expiration timestamp. Returns `null` if the retrieval fails.
|
|
216
|
-
*/
|
|
217
146
|
getOrders(poolKey: string, orderIds: string[]): Promise<{
|
|
218
147
|
balance_manager_id: string;
|
|
219
148
|
order_id: string;
|
|
@@ -229,714 +158,80 @@ declare class DeepBookClient {
|
|
|
229
158
|
status: number;
|
|
230
159
|
expire_timestamp: string;
|
|
231
160
|
}[] | null>;
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}>;
|
|
245
|
-
/**
|
|
246
|
-
* @description Get level 2 order book ticks from mid-price for a pool
|
|
247
|
-
* @param {string} poolKey Key of the pool
|
|
248
|
-
* @param {number} ticks Number of ticks from mid-price
|
|
249
|
-
* @returns {Promise<{ bid_prices: Array<number>, bid_quantities: Array<number>, ask_prices: Array<number>, ask_quantities: Array<number> }>}
|
|
250
|
-
* An object with arrays of prices and quantities
|
|
251
|
-
*/
|
|
252
|
-
getLevel2TicksFromMid(poolKey: string, ticks: number): Promise<{
|
|
253
|
-
bid_prices: number[];
|
|
254
|
-
bid_quantities: number[];
|
|
255
|
-
ask_prices: number[];
|
|
256
|
-
ask_quantities: number[];
|
|
257
|
-
}>;
|
|
258
|
-
/**
|
|
259
|
-
* @description Get the vault balances for a pool
|
|
260
|
-
* @param {string} poolKey Key of the pool
|
|
261
|
-
* @returns {Promise<{ base: number, quote: number, deep: number }>}
|
|
262
|
-
* An object with base, quote, and deep balances in the vault
|
|
263
|
-
*/
|
|
264
|
-
vaultBalances(poolKey: string): Promise<{
|
|
265
|
-
base: number;
|
|
266
|
-
quote: number;
|
|
267
|
-
deep: number;
|
|
268
|
-
}>;
|
|
269
|
-
/**
|
|
270
|
-
* @description Get the pool ID by asset types
|
|
271
|
-
* @param {string} baseType Type of the base asset
|
|
272
|
-
* @param {string} quoteType Type of the quote asset
|
|
273
|
-
* @returns {Promise<string>} The address of the pool
|
|
274
|
-
*/
|
|
275
|
-
getPoolIdByAssets(baseType: string, quoteType: string): Promise<string>;
|
|
276
|
-
/**
|
|
277
|
-
* @description Get the mid price for a pool
|
|
278
|
-
* @param {string} poolKey Key of the pool
|
|
279
|
-
* @returns {Promise<number>} The mid price
|
|
280
|
-
*/
|
|
281
|
-
midPrice(poolKey: string): Promise<number>;
|
|
282
|
-
/**
|
|
283
|
-
* @description Get the trade parameters for a given pool, including taker fee, maker fee, and stake required.
|
|
284
|
-
* @param {string} poolKey Key of the pool
|
|
285
|
-
* @returns {Promise<{ takerFee: number, makerFee: number, stakeRequired: number }>}
|
|
286
|
-
*/
|
|
287
|
-
poolTradeParams(poolKey: string): Promise<{
|
|
288
|
-
takerFee: number;
|
|
289
|
-
makerFee: number;
|
|
290
|
-
stakeRequired: number;
|
|
291
|
-
}>;
|
|
292
|
-
/**
|
|
293
|
-
* @description Get the trade parameters for a given pool, including tick size, lot size, and min size.
|
|
294
|
-
* @param {string} poolKey Key of the pool
|
|
295
|
-
* @returns {Promise<{ tickSize: number, lotSize: number, minSize: number }>}
|
|
296
|
-
*/
|
|
297
|
-
poolBookParams(poolKey: string): Promise<{
|
|
298
|
-
tickSize: number;
|
|
299
|
-
lotSize: number;
|
|
300
|
-
minSize: number;
|
|
301
|
-
}>;
|
|
302
|
-
/**
|
|
303
|
-
* @description Get the account information for a given pool and balance manager
|
|
304
|
-
* @param {string} poolKey Key of the pool
|
|
305
|
-
* @param {string} managerKey The key of the BalanceManager
|
|
306
|
-
* @returns {Promise<Object>} A promise that resolves to an object containing the account information
|
|
307
|
-
*/
|
|
308
|
-
account(poolKey: string, managerKey: string): Promise<{
|
|
309
|
-
epoch: string;
|
|
310
|
-
open_orders: {
|
|
311
|
-
contents: string[];
|
|
312
|
-
};
|
|
313
|
-
taker_volume: number;
|
|
314
|
-
maker_volume: number;
|
|
315
|
-
active_stake: number;
|
|
316
|
-
inactive_stake: number;
|
|
317
|
-
created_proposal: boolean;
|
|
318
|
-
voted_proposal: string | null;
|
|
319
|
-
unclaimed_rebates: {
|
|
320
|
-
base: number;
|
|
321
|
-
quote: number;
|
|
322
|
-
deep: number;
|
|
323
|
-
};
|
|
324
|
-
settled_balances: {
|
|
325
|
-
base: number;
|
|
326
|
-
quote: number;
|
|
327
|
-
deep: number;
|
|
328
|
-
};
|
|
329
|
-
owed_balances: {
|
|
330
|
-
base: number;
|
|
331
|
-
quote: number;
|
|
332
|
-
deep: number;
|
|
161
|
+
getLevel2Range(poolKey: string, priceLow: number | bigint, priceHigh: number | bigint, isBid: boolean): Promise<Level2Range>;
|
|
162
|
+
getLevel2TicksFromMid(poolKey: string, ticks: number): Promise<Level2TicksFromMid>;
|
|
163
|
+
getAccountOrderDetails(poolKey: string, managerKey: string): Promise<{
|
|
164
|
+
balance_manager_id: string;
|
|
165
|
+
order_id: string;
|
|
166
|
+
client_order_id: string;
|
|
167
|
+
quantity: string;
|
|
168
|
+
filled_quantity: string;
|
|
169
|
+
fee_is_deep: boolean;
|
|
170
|
+
order_deep_price: {
|
|
171
|
+
asset_is_base: boolean;
|
|
172
|
+
deep_per_asset: string;
|
|
333
173
|
};
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
*/
|
|
342
|
-
lockedBalance(poolKey: string, balanceManagerKey: string): Promise<{
|
|
343
|
-
base: number;
|
|
344
|
-
quote: number;
|
|
345
|
-
deep: number;
|
|
346
|
-
}>;
|
|
347
|
-
/**
|
|
348
|
-
* @description Get the DEEP price conversion for a pool
|
|
349
|
-
* @param {string} poolKey Key of the pool
|
|
350
|
-
* @returns {Promise<{ asset_is_base: bool, deep_per_quote: number }>} Deep price conversion
|
|
351
|
-
*/
|
|
352
|
-
getPoolDeepPrice(poolKey: string): Promise<{
|
|
353
|
-
asset_is_base: true;
|
|
354
|
-
deep_per_base: number;
|
|
355
|
-
deep_per_quote?: undefined;
|
|
356
|
-
} | {
|
|
357
|
-
asset_is_base: false;
|
|
358
|
-
deep_per_quote: number;
|
|
359
|
-
deep_per_base?: undefined;
|
|
360
|
-
}>;
|
|
361
|
-
/**
|
|
362
|
-
* @description Decode the order ID to get bid/ask status, price, and orderId
|
|
363
|
-
* @param {bigint} encodedOrderId Encoded order ID
|
|
364
|
-
* @returns {Object} Object containing isBid, price, and orderId
|
|
365
|
-
*/
|
|
366
|
-
decodeOrderId(encodedOrderId: bigint): {
|
|
367
|
-
isBid: boolean;
|
|
368
|
-
price: number;
|
|
369
|
-
orderId: number;
|
|
370
|
-
};
|
|
371
|
-
/**
|
|
372
|
-
* @description Get all balance manager IDs for a given owner
|
|
373
|
-
* @param {string} owner The owner address to get balance manager IDs for
|
|
374
|
-
* @returns {Promise<string[]>} Array of balance manager ID strings
|
|
375
|
-
*/
|
|
376
|
-
getBalanceManagerIds(owner: string): Promise<string[]>;
|
|
377
|
-
/**
|
|
378
|
-
* @description Get the owner of the referral (DeepBookPoolReferral)
|
|
379
|
-
* @param {string} referral The ID of the referral to get the owner of
|
|
380
|
-
* @returns {Promise<string>} The owner of the referral
|
|
381
|
-
*/
|
|
174
|
+
epoch: string;
|
|
175
|
+
status: number;
|
|
176
|
+
expire_timestamp: string;
|
|
177
|
+
}[] | []>;
|
|
178
|
+
account(poolKey: string, managerKey: string): Promise<AccountInfo>;
|
|
179
|
+
lockedBalance(poolKey: string, balanceManagerKey: string): Promise<LockedBalances>;
|
|
180
|
+
getPoolDeepPrice(poolKey: string): Promise<PoolDeepPrice>;
|
|
382
181
|
balanceManagerReferralOwner(referral: string): Promise<string>;
|
|
383
|
-
|
|
384
|
-
* @description Get the referral balances for a pool and referral (DeepBookPoolReferral)
|
|
385
|
-
* @param {string} poolKey Key of the pool
|
|
386
|
-
* @param {string} referral The referral ID to get balances for
|
|
387
|
-
* @returns {Promise<{ base: number, quote: number, deep: number }>} Object with base, quote, and deep balances
|
|
388
|
-
*/
|
|
389
|
-
getPoolReferralBalances(poolKey: string, referral: string): Promise<{
|
|
390
|
-
base: number;
|
|
391
|
-
quote: number;
|
|
392
|
-
deep: number;
|
|
393
|
-
}>;
|
|
394
|
-
/**
|
|
395
|
-
* @description Get the pool ID associated with a referral (DeepBookPoolReferral)
|
|
396
|
-
* @param {string} referral The referral (DeepBookPoolReferral) to get the pool ID for
|
|
397
|
-
* @returns {Promise<string>} The pool ID
|
|
398
|
-
*/
|
|
182
|
+
getPoolReferralBalances(poolKey: string, referral: string): Promise<ReferralBalances>;
|
|
399
183
|
balanceManagerReferralPoolId(referral: string): Promise<string>;
|
|
400
|
-
/**
|
|
401
|
-
* @description Get the multiplier for a referral (DeepBookPoolReferral)
|
|
402
|
-
* @param {string} poolKey Key of the pool
|
|
403
|
-
* @param {string} referral The referral (DeepBookPoolReferral) to get the multiplier for
|
|
404
|
-
* @returns {Promise<number>} The multiplier value
|
|
405
|
-
*/
|
|
406
184
|
poolReferralMultiplier(poolKey: string, referral: string): Promise<number>;
|
|
407
|
-
/**
|
|
408
|
-
* @description Get the referral ID from a balance manager for a specific pool
|
|
409
|
-
* @param {string} managerKey Key of the balance manager
|
|
410
|
-
* @param {string} poolKey Key of the pool to get the referral for
|
|
411
|
-
* @returns {Promise<string | null>} The referral ID or null if not set
|
|
412
|
-
*/
|
|
413
185
|
getBalanceManagerReferralId(managerKey: string, poolKey: string): Promise<string | null>;
|
|
414
186
|
getPriceInfoObject(tx: Transaction, coinKey: string): Promise<string>;
|
|
415
|
-
/**
|
|
416
|
-
* @description Batch update price info objects for multiple coins. Only updates stale feeds.
|
|
417
|
-
* This is more efficient than calling getPriceInfoObject multiple times as it:
|
|
418
|
-
* 1. Batch fetches all price info object ages in one RPC call
|
|
419
|
-
* 2. Fetches all stale price updates from Pyth in a single API call
|
|
420
|
-
* @param {Transaction} tx Transaction to add price update commands to
|
|
421
|
-
* @param {string[]} coinKeys Array of coin keys to update prices for
|
|
422
|
-
* @returns {Promise<Record<string, string>>} Map of coinKey -> priceInfoObjectId
|
|
423
|
-
*/
|
|
424
187
|
getPriceInfoObjects(tx: Transaction, coinKeys: string[]): Promise<Record<string, string>>;
|
|
425
|
-
/**
|
|
426
|
-
* @description Get the age of the price info object for a specific coin
|
|
427
|
-
* @param {string} coinKey Key of the coin
|
|
428
|
-
* @returns {Promise<number>} The arrival time of the price info object
|
|
429
|
-
*/
|
|
430
188
|
getPriceInfoObjectAge(coinKey: string): Promise<number>;
|
|
431
|
-
/**
|
|
432
|
-
* @description Get the margin pool ID
|
|
433
|
-
* @param {string} coinKey The key to identify the margin pool
|
|
434
|
-
* @returns {Promise<string>} The margin pool ID
|
|
435
|
-
*/
|
|
436
189
|
getMarginPoolId(coinKey: string): Promise<string>;
|
|
437
|
-
/**
|
|
438
|
-
* @description Check if a deepbook pool is allowed for borrowing from margin pool
|
|
439
|
-
* @param {string} coinKey The key to identify the margin pool
|
|
440
|
-
* @param {string} deepbookPoolId The ID of the deepbook pool
|
|
441
|
-
* @returns {Promise<boolean>} Whether the deepbook pool is allowed
|
|
442
|
-
*/
|
|
443
190
|
isDeepbookPoolAllowed(coinKey: string, deepbookPoolId: string): Promise<boolean>;
|
|
444
|
-
/**
|
|
445
|
-
* @description Get the total supply amount in the margin pool
|
|
446
|
-
* @param {string} coinKey The key to identify the margin pool
|
|
447
|
-
* @param {number} decimals Number of decimal places to show (default: 6)
|
|
448
|
-
* @returns {Promise<string>} The total supply amount as a string
|
|
449
|
-
*/
|
|
450
191
|
getMarginPoolTotalSupply(coinKey: string, decimals?: number): Promise<string>;
|
|
451
|
-
/**
|
|
452
|
-
* @description Get the total supply shares in the margin pool
|
|
453
|
-
* @param {string} coinKey The key to identify the margin pool
|
|
454
|
-
* @param {number} decimals Number of decimal places to show (default: 6)
|
|
455
|
-
* @returns {Promise<string>} The total supply shares as a string
|
|
456
|
-
*/
|
|
457
192
|
getMarginPoolSupplyShares(coinKey: string, decimals?: number): Promise<string>;
|
|
458
|
-
/**
|
|
459
|
-
* @description Get the total borrow amount in the margin pool
|
|
460
|
-
* @param {string} coinKey The key to identify the margin pool
|
|
461
|
-
* @param {number} decimals Number of decimal places to show (default: 6)
|
|
462
|
-
* @returns {Promise<string>} The total borrow amount as a string
|
|
463
|
-
*/
|
|
464
193
|
getMarginPoolTotalBorrow(coinKey: string, decimals?: number): Promise<string>;
|
|
465
|
-
/**
|
|
466
|
-
* @description Get the total borrow shares in the margin pool
|
|
467
|
-
* @param {string} coinKey The key to identify the margin pool
|
|
468
|
-
* @param {number} decimals Number of decimal places to show (default: 6)
|
|
469
|
-
* @returns {Promise<string>} The total borrow shares as a string
|
|
470
|
-
*/
|
|
471
194
|
getMarginPoolBorrowShares(coinKey: string, decimals?: number): Promise<string>;
|
|
472
|
-
/**
|
|
473
|
-
* @description Get the last update timestamp of the margin pool
|
|
474
|
-
* @param {string} coinKey The key to identify the margin pool
|
|
475
|
-
* @returns {Promise<number>} The last update timestamp in milliseconds
|
|
476
|
-
*/
|
|
477
195
|
getMarginPoolLastUpdateTimestamp(coinKey: string): Promise<number>;
|
|
478
|
-
/**
|
|
479
|
-
* @description Get the supply cap of the margin pool
|
|
480
|
-
* @param {string} coinKey The key to identify the margin pool
|
|
481
|
-
* @param {number} decimals Number of decimal places to show (default: 6)
|
|
482
|
-
* @returns {Promise<string>} The supply cap as a string
|
|
483
|
-
*/
|
|
484
196
|
getMarginPoolSupplyCap(coinKey: string, decimals?: number): Promise<string>;
|
|
485
|
-
/**
|
|
486
|
-
* @description Get the max utilization rate of the margin pool
|
|
487
|
-
* @param {string} coinKey The key to identify the margin pool
|
|
488
|
-
* @returns {Promise<number>} The max utilization rate (as a decimal, e.g., 0.95 for 95%)
|
|
489
|
-
*/
|
|
490
197
|
getMarginPoolMaxUtilizationRate(coinKey: string): Promise<number>;
|
|
491
|
-
/**
|
|
492
|
-
* @description Get the protocol spread of the margin pool
|
|
493
|
-
* @param {string} coinKey The key to identify the margin pool
|
|
494
|
-
* @returns {Promise<number>} The protocol spread (as a decimal)
|
|
495
|
-
*/
|
|
496
198
|
getMarginPoolProtocolSpread(coinKey: string): Promise<number>;
|
|
497
|
-
/**
|
|
498
|
-
* @description Get the minimum borrow amount for the margin pool
|
|
499
|
-
* @param {string} coinKey The key to identify the margin pool
|
|
500
|
-
* @param {number} decimals Number of decimal places to show (default: 6)
|
|
501
|
-
* @returns {Promise<string>} The minimum borrow amount as a string
|
|
502
|
-
*/
|
|
503
199
|
getMarginPoolMinBorrow(coinKey: string, decimals?: number): Promise<string>;
|
|
504
|
-
/**
|
|
505
|
-
* @description Get the current interest rate of the margin pool
|
|
506
|
-
* @param {string} coinKey The key to identify the margin pool
|
|
507
|
-
* @returns {Promise<number>} The current interest rate (as a decimal)
|
|
508
|
-
*/
|
|
509
200
|
getMarginPoolInterestRate(coinKey: string): Promise<number>;
|
|
510
|
-
/**
|
|
511
|
-
* @description Get user supply shares for a supplier cap
|
|
512
|
-
* @param {string} coinKey The key to identify the margin pool
|
|
513
|
-
* @param {string} supplierCapId The ID of the supplier cap
|
|
514
|
-
* @param {number} decimals Number of decimal places to show (default: 6)
|
|
515
|
-
* @returns {Promise<string>} The user's supply shares as a string
|
|
516
|
-
*/
|
|
517
201
|
getUserSupplyShares(coinKey: string, supplierCapId: string, decimals?: number): Promise<string>;
|
|
518
|
-
/**
|
|
519
|
-
* @description Get user supply amount for a supplier cap
|
|
520
|
-
* @param {string} coinKey The key to identify the margin pool
|
|
521
|
-
* @param {string} supplierCapId The ID of the supplier cap
|
|
522
|
-
* @param {number} decimals Number of decimal places to show (default: 6)
|
|
523
|
-
* @returns {Promise<string>} The user's supply amount as a string
|
|
524
|
-
*/
|
|
525
202
|
getUserSupplyAmount(coinKey: string, supplierCapId: string, decimals?: number): Promise<string>;
|
|
526
|
-
/**
|
|
527
|
-
* @description Get the owner address of a margin manager
|
|
528
|
-
* @param {string} marginManagerKey The key to identify the margin manager
|
|
529
|
-
* @returns {Promise<string>} The owner address
|
|
530
|
-
*/
|
|
531
203
|
getMarginManagerOwner(marginManagerKey: string): Promise<string>;
|
|
532
|
-
/**
|
|
533
|
-
* @description Get the DeepBook pool ID associated with a margin manager
|
|
534
|
-
* @param {string} marginManagerKey The key to identify the margin manager
|
|
535
|
-
* @returns {Promise<string>} The DeepBook pool ID
|
|
536
|
-
*/
|
|
537
204
|
getMarginManagerDeepbookPool(marginManagerKey: string): Promise<string>;
|
|
538
|
-
/**
|
|
539
|
-
* @description Get the margin pool ID (if any) associated with a margin manager
|
|
540
|
-
* @param {string} marginManagerKey The key to identify the margin manager
|
|
541
|
-
* @returns {Promise<string | null>} The margin pool ID or null if no active loan
|
|
542
|
-
*/
|
|
543
205
|
getMarginManagerMarginPoolId(marginManagerKey: string): Promise<string | null>;
|
|
544
|
-
|
|
545
|
-
* @description Get borrowed shares for both base and quote assets
|
|
546
|
-
* @param {string} marginManagerKey The key to identify the margin manager
|
|
547
|
-
* @returns {Promise<{baseShares: string, quoteShares: string}>} The borrowed shares
|
|
548
|
-
*/
|
|
549
|
-
getMarginManagerBorrowedShares(marginManagerKey: string): Promise<{
|
|
550
|
-
baseShares: string;
|
|
551
|
-
quoteShares: string;
|
|
552
|
-
}>;
|
|
553
|
-
/**
|
|
554
|
-
* @description Get borrowed base shares
|
|
555
|
-
* @param {string} marginManagerKey The key to identify the margin manager
|
|
556
|
-
* @returns {Promise<string>} The borrowed base shares
|
|
557
|
-
*/
|
|
206
|
+
getMarginManagerBorrowedShares(marginManagerKey: string): Promise<BorrowedShares>;
|
|
558
207
|
getMarginManagerBorrowedBaseShares(marginManagerKey: string): Promise<string>;
|
|
559
|
-
/**
|
|
560
|
-
* @description Get borrowed quote shares
|
|
561
|
-
* @param {string} marginManagerKey The key to identify the margin manager
|
|
562
|
-
* @returns {Promise<string>} The borrowed quote shares
|
|
563
|
-
*/
|
|
564
208
|
getMarginManagerBorrowedQuoteShares(marginManagerKey: string): Promise<string>;
|
|
565
|
-
/**
|
|
566
|
-
* @description Check if margin manager has base asset debt
|
|
567
|
-
* @param {string} marginManagerKey The key to identify the margin manager
|
|
568
|
-
* @returns {Promise<boolean>} True if has base debt, false otherwise
|
|
569
|
-
*/
|
|
570
209
|
getMarginManagerHasBaseDebt(marginManagerKey: string): Promise<boolean>;
|
|
571
|
-
/**
|
|
572
|
-
* @description Get the balance manager ID for a margin manager
|
|
573
|
-
* @param {string} marginManagerAddress The object ID of the margin manager
|
|
574
|
-
* @returns {Promise<string>} The balance manager ID
|
|
575
|
-
*/
|
|
576
210
|
getMarginManagerBalanceManagerId(marginManagerAddress: string): Promise<string>;
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
* @returns {Promise<{baseAsset: string, quoteAsset: string}>} The base and quote assets
|
|
582
|
-
*/
|
|
583
|
-
getMarginManagerAssets(marginManagerKey: string, decimals?: number): Promise<{
|
|
584
|
-
baseAsset: string;
|
|
585
|
-
quoteAsset: string;
|
|
586
|
-
}>;
|
|
587
|
-
/**
|
|
588
|
-
* @description Calculate debts (base and quote) for a margin manager
|
|
589
|
-
* NOTE: This function automatically determines whether to use base or quote margin pool
|
|
590
|
-
* based on hasBaseDebt. You don't need to specify the debt coin type.
|
|
591
|
-
* @param {string} marginManagerKey The key to identify the margin manager
|
|
592
|
-
* @param {number} decimals Number of decimal places to show (default: 6)
|
|
593
|
-
* @returns {Promise<{baseDebt: string, quoteDebt: string}>} The base and quote debts
|
|
594
|
-
*/
|
|
595
|
-
getMarginManagerDebts(marginManagerKey: string, decimals?: number): Promise<{
|
|
596
|
-
baseDebt: string;
|
|
597
|
-
quoteDebt: string;
|
|
598
|
-
}>;
|
|
599
|
-
/**
|
|
600
|
-
* @description Get comprehensive state information for a margin manager
|
|
601
|
-
* @param {string} marginManagerKey The key to identify the margin manager
|
|
602
|
-
* @param {number} decimals Number of decimal places to show (default: 6)
|
|
603
|
-
* @returns {Promise<{
|
|
604
|
-
* managerId: string,
|
|
605
|
-
* deepbookPoolId: string,
|
|
606
|
-
* riskRatio: number,
|
|
607
|
-
* baseAsset: string,
|
|
608
|
-
* quoteAsset: string,
|
|
609
|
-
* baseDebt: string,
|
|
610
|
-
* quoteDebt: string,
|
|
611
|
-
* basePythPrice: string,
|
|
612
|
-
* basePythDecimals: number,
|
|
613
|
-
* quotePythPrice: string,
|
|
614
|
-
* quotePythDecimals: number
|
|
615
|
-
* }>} Comprehensive margin manager state
|
|
616
|
-
*/
|
|
617
|
-
getMarginManagerState(marginManagerKey: string, decimals?: number): Promise<{
|
|
618
|
-
managerId: string;
|
|
619
|
-
deepbookPoolId: string;
|
|
620
|
-
riskRatio: number;
|
|
621
|
-
baseAsset: string;
|
|
622
|
-
quoteAsset: string;
|
|
623
|
-
baseDebt: string;
|
|
624
|
-
quoteDebt: string;
|
|
625
|
-
basePythPrice: string;
|
|
626
|
-
basePythDecimals: number;
|
|
627
|
-
quotePythPrice: string;
|
|
628
|
-
quotePythDecimals: number;
|
|
629
|
-
currentPrice: bigint;
|
|
630
|
-
lowestTriggerAbovePrice: bigint;
|
|
631
|
-
highestTriggerBelowPrice: bigint;
|
|
632
|
-
}>;
|
|
633
|
-
/**
|
|
634
|
-
* @description Get comprehensive state information for multiple margin managers.
|
|
635
|
-
* @param {Record<string, string>} marginManagers Map of marginManagerId -> poolKey
|
|
636
|
-
* @param {number} decimals Number of decimal places for formatting (default: 6)
|
|
637
|
-
* @returns {Promise<Record<string, {...}>>} Object keyed by managerId with state data
|
|
638
|
-
*/
|
|
639
|
-
getMarginManagerStates(marginManagers: Record<string, string>, decimals?: number): Promise<Record<string, {
|
|
640
|
-
managerId: string;
|
|
641
|
-
deepbookPoolId: string;
|
|
642
|
-
riskRatio: number;
|
|
643
|
-
baseAsset: string;
|
|
644
|
-
quoteAsset: string;
|
|
645
|
-
baseDebt: string;
|
|
646
|
-
quoteDebt: string;
|
|
647
|
-
basePythPrice: string;
|
|
648
|
-
basePythDecimals: number;
|
|
649
|
-
quotePythPrice: string;
|
|
650
|
-
quotePythDecimals: number;
|
|
651
|
-
currentPrice: bigint;
|
|
652
|
-
lowestTriggerAbovePrice: bigint;
|
|
653
|
-
highestTriggerBelowPrice: bigint;
|
|
654
|
-
}>>;
|
|
655
|
-
/**
|
|
656
|
-
* @description Get the base asset balance of a margin manager
|
|
657
|
-
* @param {string} marginManagerKey The key to identify the margin manager
|
|
658
|
-
* @param {number} decimals Number of decimal places to show (default: 6)
|
|
659
|
-
* @returns {Promise<string>} The base asset balance
|
|
660
|
-
*/
|
|
211
|
+
getMarginManagerAssets(marginManagerKey: string, decimals?: number): Promise<MarginManagerAssets>;
|
|
212
|
+
getMarginManagerDebts(marginManagerKey: string, decimals?: number): Promise<MarginManagerDebts>;
|
|
213
|
+
getMarginManagerState(marginManagerKey: string, decimals?: number): Promise<MarginManagerState>;
|
|
214
|
+
getMarginManagerStates(marginManagers: Record<string, string>, decimals?: number): Promise<Record<string, MarginManagerState>>;
|
|
661
215
|
getMarginManagerBaseBalance(marginManagerKey: string, decimals?: number): Promise<string>;
|
|
662
|
-
/**
|
|
663
|
-
* @description Get the quote asset balance of a margin manager
|
|
664
|
-
* @param {string} marginManagerKey The key to identify the margin manager
|
|
665
|
-
* @param {number} decimals Number of decimal places to show (default: 6)
|
|
666
|
-
* @returns {Promise<string>} The quote asset balance
|
|
667
|
-
*/
|
|
668
216
|
getMarginManagerQuoteBalance(marginManagerKey: string, decimals?: number): Promise<string>;
|
|
669
|
-
/**
|
|
670
|
-
* @description Get the DEEP token balance of a margin manager
|
|
671
|
-
* @param {string} marginManagerKey The key to identify the margin manager
|
|
672
|
-
* @param {number} decimals Number of decimal places to show (default: 6)
|
|
673
|
-
* @returns {Promise<string>} The DEEP token balance
|
|
674
|
-
*/
|
|
675
217
|
getMarginManagerDeepBalance(marginManagerKey: string, decimals?: number): Promise<string>;
|
|
676
|
-
|
|
677
|
-
* @description Get base, quote, and DEEP balances for multiple margin managers in a single dry run call
|
|
678
|
-
* @param {Record<string, string>} marginManagers Map of marginManagerId -> poolKey
|
|
679
|
-
* @param {number} decimals Number of decimal places for formatting (default: 9)
|
|
680
|
-
* @returns {Promise<Record<string, { base: string, quote: string, deep: string }>>} Object keyed by managerId
|
|
681
|
-
*/
|
|
682
|
-
getMarginManagerBalances(marginManagers: Record<string, string>, decimals?: number): Promise<Record<string, {
|
|
683
|
-
base: string;
|
|
684
|
-
quote: string;
|
|
685
|
-
deep: string;
|
|
686
|
-
}>>;
|
|
687
|
-
/**
|
|
688
|
-
* @description Get all conditional order IDs for a margin manager
|
|
689
|
-
* @param {string} marginManagerKey The key to identify the margin manager
|
|
690
|
-
* @returns {Promise<string[]>} Array of conditional order IDs
|
|
691
|
-
*/
|
|
218
|
+
getMarginManagerBalances(marginManagers: Record<string, string>, decimals?: number): Promise<Record<string, MarginManagerBalancesResult>>;
|
|
692
219
|
getConditionalOrderIds(marginManagerKey: string): Promise<string[]>;
|
|
693
|
-
/**
|
|
694
|
-
* @description Get the lowest trigger price for trigger_above orders
|
|
695
|
-
* Returns MAX_U64 if there are no trigger_above orders
|
|
696
|
-
* @param {string} marginManagerKey The key to identify the margin manager
|
|
697
|
-
* @returns {Promise<bigint>} The lowest trigger above price
|
|
698
|
-
*/
|
|
699
220
|
getLowestTriggerAbovePrice(marginManagerKey: string): Promise<bigint>;
|
|
700
|
-
/**
|
|
701
|
-
* @description Get the highest trigger price for trigger_below orders
|
|
702
|
-
* Returns 0 if there are no trigger_below orders
|
|
703
|
-
* @param {string} marginManagerKey The key to identify the margin manager
|
|
704
|
-
* @returns {Promise<bigint>} The highest trigger below price
|
|
705
|
-
*/
|
|
706
221
|
getHighestTriggerBelowPrice(marginManagerKey: string): Promise<bigint>;
|
|
707
|
-
/**
|
|
708
|
-
* @description Check if a deepbook pool is enabled for margin trading
|
|
709
|
-
* @param {string} poolKey The key to identify the pool
|
|
710
|
-
* @returns {Promise<boolean>} True if the pool is enabled for margin trading
|
|
711
|
-
*/
|
|
712
222
|
isPoolEnabledForMargin(poolKey: string): Promise<boolean>;
|
|
713
|
-
/**
|
|
714
|
-
* @description Get the margin manager IDs for a given owner address
|
|
715
|
-
* @param {string} owner The owner address
|
|
716
|
-
* @returns {Promise<string[]>} Array of margin manager IDs
|
|
717
|
-
*/
|
|
718
223
|
getMarginManagerIdsForOwner(owner: string): Promise<string[]>;
|
|
719
|
-
/**
|
|
720
|
-
* @description Get the base margin pool ID for a deepbook pool
|
|
721
|
-
* @param {string} poolKey The key to identify the pool
|
|
722
|
-
* @returns {Promise<string>} The base margin pool ID
|
|
723
|
-
*/
|
|
724
224
|
getBaseMarginPoolId(poolKey: string): Promise<string>;
|
|
725
|
-
/**
|
|
726
|
-
* @description Get the quote margin pool ID for a deepbook pool
|
|
727
|
-
* @param {string} poolKey The key to identify the pool
|
|
728
|
-
* @returns {Promise<string>} The quote margin pool ID
|
|
729
|
-
*/
|
|
730
225
|
getQuoteMarginPoolId(poolKey: string): Promise<string>;
|
|
731
|
-
/**
|
|
732
|
-
* @description Get the minimum withdraw risk ratio for a deepbook pool
|
|
733
|
-
* @param {string} poolKey The key to identify the pool
|
|
734
|
-
* @returns {Promise<number>} The minimum withdraw risk ratio as a decimal (e.g., 1.5 for 150%)
|
|
735
|
-
*/
|
|
736
226
|
getMinWithdrawRiskRatio(poolKey: string): Promise<number>;
|
|
737
|
-
/**
|
|
738
|
-
* @description Get the minimum borrow risk ratio for a deepbook pool
|
|
739
|
-
* @param {string} poolKey The key to identify the pool
|
|
740
|
-
* @returns {Promise<number>} The minimum borrow risk ratio as a decimal (e.g., 1.25 for 125%)
|
|
741
|
-
*/
|
|
742
227
|
getMinBorrowRiskRatio(poolKey: string): Promise<number>;
|
|
743
|
-
/**
|
|
744
|
-
* @description Get the liquidation risk ratio for a deepbook pool
|
|
745
|
-
* @param {string} poolKey The key to identify the pool
|
|
746
|
-
* @returns {Promise<number>} The liquidation risk ratio as a decimal (e.g., 1.125 for 112.5%)
|
|
747
|
-
*/
|
|
748
228
|
getLiquidationRiskRatio(poolKey: string): Promise<number>;
|
|
749
|
-
/**
|
|
750
|
-
* @description Get the target liquidation risk ratio for a deepbook pool
|
|
751
|
-
* @param {string} poolKey The key to identify the pool
|
|
752
|
-
* @returns {Promise<number>} The target liquidation risk ratio as a decimal (e.g., 1.25 for 125%)
|
|
753
|
-
*/
|
|
754
229
|
getTargetLiquidationRiskRatio(poolKey: string): Promise<number>;
|
|
755
|
-
/**
|
|
756
|
-
* @description Get the user liquidation reward for a deepbook pool
|
|
757
|
-
* @param {string} poolKey The key to identify the pool
|
|
758
|
-
* @returns {Promise<number>} The user liquidation reward as a decimal (e.g., 0.05 for 5%)
|
|
759
|
-
*/
|
|
760
230
|
getUserLiquidationReward(poolKey: string): Promise<number>;
|
|
761
|
-
/**
|
|
762
|
-
* @description Get the pool liquidation reward for a deepbook pool
|
|
763
|
-
* @param {string} poolKey The key to identify the pool
|
|
764
|
-
* @returns {Promise<number>} The pool liquidation reward as a decimal (e.g., 0.05 for 5%)
|
|
765
|
-
*/
|
|
766
231
|
getPoolLiquidationReward(poolKey: string): Promise<number>;
|
|
767
|
-
/**
|
|
768
|
-
* @description Get all allowed maintainer cap IDs
|
|
769
|
-
* @returns {Promise<string[]>} Array of allowed maintainer cap IDs
|
|
770
|
-
*/
|
|
771
232
|
getAllowedMaintainers(): Promise<string[]>;
|
|
772
|
-
/**
|
|
773
|
-
* @description Get all allowed pause cap IDs
|
|
774
|
-
* @returns {Promise<string[]>} Array of allowed pause cap IDs
|
|
775
|
-
*/
|
|
776
233
|
getAllowedPauseCaps(): Promise<string[]>;
|
|
777
|
-
|
|
778
|
-
* @description Check if a pool is a stable pool
|
|
779
|
-
* @param {string} poolKey Key of the pool
|
|
780
|
-
* @returns {Promise<boolean>} Whether the pool is a stable pool
|
|
781
|
-
*/
|
|
782
|
-
stablePool(poolKey: string): Promise<boolean>;
|
|
783
|
-
/**
|
|
784
|
-
* @description Check if a pool is registered
|
|
785
|
-
* @param {string} poolKey Key of the pool
|
|
786
|
-
* @returns {Promise<boolean>} Whether the pool is registered
|
|
787
|
-
*/
|
|
788
|
-
registeredPool(poolKey: string): Promise<boolean>;
|
|
789
|
-
/**
|
|
790
|
-
* @description Get the quote quantity out using input token as fee
|
|
791
|
-
* @param {string} poolKey Key of the pool
|
|
792
|
-
* @param {number} baseQuantity Base quantity
|
|
793
|
-
* @returns {Promise<{baseQuantity: number, baseOut: number, quoteOut: number, deepRequired: number}>}
|
|
794
|
-
*/
|
|
795
|
-
getQuoteQuantityOutInputFee(poolKey: string, baseQuantity: number): Promise<{
|
|
796
|
-
baseQuantity: number;
|
|
797
|
-
baseOut: number;
|
|
798
|
-
quoteOut: number;
|
|
799
|
-
deepRequired: number;
|
|
800
|
-
}>;
|
|
801
|
-
/**
|
|
802
|
-
* @description Get the base quantity out using input token as fee
|
|
803
|
-
* @param {string} poolKey Key of the pool
|
|
804
|
-
* @param {number} quoteQuantity Quote quantity
|
|
805
|
-
* @returns {Promise<{quoteQuantity: number, baseOut: number, quoteOut: number, deepRequired: number}>}
|
|
806
|
-
*/
|
|
807
|
-
getBaseQuantityOutInputFee(poolKey: string, quoteQuantity: number): Promise<{
|
|
808
|
-
quoteQuantity: number;
|
|
809
|
-
baseOut: number;
|
|
810
|
-
quoteOut: number;
|
|
811
|
-
deepRequired: number;
|
|
812
|
-
}>;
|
|
813
|
-
/**
|
|
814
|
-
* @description Get the quantity out using input token as fee
|
|
815
|
-
* @param {string} poolKey Key of the pool
|
|
816
|
-
* @param {number} baseQuantity Base quantity
|
|
817
|
-
* @param {number} quoteQuantity Quote quantity
|
|
818
|
-
* @returns {Promise<{baseQuantity: number, quoteQuantity: number, baseOut: number, quoteOut: number, deepRequired: number}>}
|
|
819
|
-
*/
|
|
820
|
-
getQuantityOutInputFee(poolKey: string, baseQuantity: number, quoteQuantity: number): Promise<{
|
|
821
|
-
baseQuantity: number;
|
|
822
|
-
quoteQuantity: number;
|
|
823
|
-
baseOut: number;
|
|
824
|
-
quoteOut: number;
|
|
825
|
-
deepRequired: number;
|
|
826
|
-
}>;
|
|
827
|
-
/**
|
|
828
|
-
* @description Get the base quantity needed to receive target quote quantity
|
|
829
|
-
* @param {string} poolKey Key of the pool
|
|
830
|
-
* @param {number} targetQuoteQuantity Target quote quantity
|
|
831
|
-
* @param {boolean} payWithDeep Whether to pay fees with DEEP
|
|
832
|
-
* @returns {Promise<{baseIn: number, quoteOut: number, deepRequired: number}>}
|
|
833
|
-
*/
|
|
834
|
-
getBaseQuantityIn(poolKey: string, targetQuoteQuantity: number, payWithDeep: boolean): Promise<{
|
|
835
|
-
baseIn: number;
|
|
836
|
-
quoteOut: number;
|
|
837
|
-
deepRequired: number;
|
|
838
|
-
}>;
|
|
839
|
-
/**
|
|
840
|
-
* @description Get the quote quantity needed to receive target base quantity
|
|
841
|
-
* @param {string} poolKey Key of the pool
|
|
842
|
-
* @param {number} targetBaseQuantity Target base quantity
|
|
843
|
-
* @param {boolean} payWithDeep Whether to pay fees with DEEP
|
|
844
|
-
* @returns {Promise<{baseOut: number, quoteIn: number, deepRequired: number}>}
|
|
845
|
-
*/
|
|
846
|
-
getQuoteQuantityIn(poolKey: string, targetBaseQuantity: number, payWithDeep: boolean): Promise<{
|
|
847
|
-
baseOut: number;
|
|
848
|
-
quoteIn: number;
|
|
849
|
-
deepRequired: number;
|
|
850
|
-
}>;
|
|
851
|
-
/**
|
|
852
|
-
* @description Get account order details for a balance manager
|
|
853
|
-
* @param {string} poolKey Key of the pool
|
|
854
|
-
* @param {string} managerKey Key of the balance manager
|
|
855
|
-
* @returns {Promise<Array>} Array of order details
|
|
856
|
-
*/
|
|
857
|
-
getAccountOrderDetails(poolKey: string, managerKey: string): Promise<{
|
|
858
|
-
balance_manager_id: string;
|
|
859
|
-
order_id: string;
|
|
860
|
-
client_order_id: string;
|
|
861
|
-
quantity: string;
|
|
862
|
-
filled_quantity: string;
|
|
863
|
-
fee_is_deep: boolean;
|
|
864
|
-
order_deep_price: {
|
|
865
|
-
asset_is_base: boolean;
|
|
866
|
-
deep_per_asset: string;
|
|
867
|
-
};
|
|
868
|
-
epoch: string;
|
|
869
|
-
status: number;
|
|
870
|
-
expire_timestamp: string;
|
|
871
|
-
}[]>;
|
|
872
|
-
/**
|
|
873
|
-
* @description Get the DEEP required for an order
|
|
874
|
-
* @param {string} poolKey Key of the pool
|
|
875
|
-
* @param {number} baseQuantity Base quantity
|
|
876
|
-
* @param {number} price Price
|
|
877
|
-
* @returns {Promise<{deepRequiredTaker: number, deepRequiredMaker: number}>}
|
|
878
|
-
*/
|
|
879
|
-
getOrderDeepRequired(poolKey: string, baseQuantity: number, price: number): Promise<{
|
|
880
|
-
deepRequiredTaker: number;
|
|
881
|
-
deepRequiredMaker: number;
|
|
882
|
-
}>;
|
|
883
|
-
/**
|
|
884
|
-
* @description Check if account exists for a balance manager
|
|
885
|
-
* @param {string} poolKey Key of the pool
|
|
886
|
-
* @param {string} managerKey Key of the balance manager
|
|
887
|
-
* @returns {Promise<boolean>} Whether account exists
|
|
888
|
-
*/
|
|
889
|
-
accountExists(poolKey: string, managerKey: string): Promise<boolean>;
|
|
890
|
-
/**
|
|
891
|
-
* @description Get the next epoch trade parameters
|
|
892
|
-
* @param {string} poolKey Key of the pool
|
|
893
|
-
* @returns {Promise<{takerFee: number, makerFee: number, stakeRequired: number}>}
|
|
894
|
-
*/
|
|
895
|
-
poolTradeParamsNext(poolKey: string): Promise<{
|
|
896
|
-
takerFee: number;
|
|
897
|
-
makerFee: number;
|
|
898
|
-
stakeRequired: number;
|
|
899
|
-
}>;
|
|
900
|
-
/**
|
|
901
|
-
* @description Get the quorum for a pool
|
|
902
|
-
* @param {string} poolKey Key of the pool
|
|
903
|
-
* @returns {Promise<number>} The quorum amount in DEEP
|
|
904
|
-
*/
|
|
905
|
-
quorum(poolKey: string): Promise<number>;
|
|
906
|
-
/**
|
|
907
|
-
* @description Get the pool ID
|
|
908
|
-
* @param {string} poolKey Key of the pool
|
|
909
|
-
* @returns {Promise<string>} The pool ID
|
|
910
|
-
*/
|
|
911
|
-
poolId(poolKey: string): Promise<string>;
|
|
912
|
-
/**
|
|
913
|
-
* @description Check if a limit order can be placed
|
|
914
|
-
* @param {CanPlaceLimitOrderParams} params Parameters for checking limit order placement
|
|
915
|
-
* @returns {Promise<boolean>} Whether order can be placed
|
|
916
|
-
*/
|
|
917
|
-
canPlaceLimitOrder(params: CanPlaceLimitOrderParams): Promise<boolean>;
|
|
918
|
-
/**
|
|
919
|
-
* @description Check if a market order can be placed
|
|
920
|
-
* @param {CanPlaceMarketOrderParams} params Parameters for checking market order placement
|
|
921
|
-
* @returns {Promise<boolean>} Whether order can be placed
|
|
922
|
-
*/
|
|
923
|
-
canPlaceMarketOrder(params: CanPlaceMarketOrderParams): Promise<boolean>;
|
|
924
|
-
/**
|
|
925
|
-
* @description Check if market order params are valid
|
|
926
|
-
* @param {string} poolKey Key of the pool
|
|
927
|
-
* @param {number} quantity Quantity
|
|
928
|
-
* @returns {Promise<boolean>} Whether params are valid
|
|
929
|
-
*/
|
|
930
|
-
checkMarketOrderParams(poolKey: string, quantity: number): Promise<boolean>;
|
|
931
|
-
/**
|
|
932
|
-
* @description Check if limit order params are valid
|
|
933
|
-
* @param {string} poolKey Key of the pool
|
|
934
|
-
* @param {number} price Price
|
|
935
|
-
* @param {number} quantity Quantity
|
|
936
|
-
* @param {number} expireTimestamp Expiration timestamp
|
|
937
|
-
* @returns {Promise<boolean>} Whether params are valid
|
|
938
|
-
*/
|
|
939
|
-
checkLimitOrderParams(poolKey: string, price: number, quantity: number, expireTimestamp: number): Promise<boolean>;
|
|
234
|
+
decodeOrderId(encodedOrderId: bigint): DecodedOrderId;
|
|
940
235
|
}
|
|
941
236
|
//#endregion
|
|
942
237
|
export { DeepBookClient, DeepBookClientOptions, DeepBookCompatibleClient, DeepBookOptions, deepbook };
|