@nadohq/engine-client 0.1.0-alpha.15 → 0.1.0-alpha.17
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/dist/EngineQueryClient.cjs +19 -1
- package/dist/EngineQueryClient.cjs.map +1 -1
- package/dist/EngineQueryClient.d.cts +7 -1
- package/dist/EngineQueryClient.d.ts +7 -1
- package/dist/EngineQueryClient.js +20 -1
- package/dist/EngineQueryClient.js.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/types/clientQueryTypes.cjs.map +1 -1
- package/dist/types/clientQueryTypes.d.cts +15 -1
- package/dist/types/clientQueryTypes.d.ts +15 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/serverQueryTypes.cjs.map +1 -1
- package/dist/types/serverQueryTypes.d.cts +21 -1
- package/dist/types/serverQueryTypes.d.ts +21 -1
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/queryDataMappers.cjs +20 -0
- package/dist/utils/queryDataMappers.cjs.map +1 -1
- package/dist/utils/queryDataMappers.d.cts +4 -3
- package/dist/utils/queryDataMappers.d.ts +4 -3
- package/dist/utils/queryDataMappers.js +19 -0
- package/dist/utils/queryDataMappers.js.map +1 -1
- package/package.json +3 -3
- package/src/EngineQueryClient.ts +26 -0
- package/src/types/clientQueryTypes.ts +20 -0
- package/src/types/serverQueryTypes.ts +26 -0
- package/src/utils/queryDataMappers.ts +26 -0
|
@@ -90,6 +90,9 @@ export interface EngineServerMaxOrderSizeQueryParams {
|
|
|
90
90
|
// If no position exists, it will return 0.
|
|
91
91
|
reduce_only: string | null;
|
|
92
92
|
isolated: string | null;
|
|
93
|
+
// For isolated, max order size includes available collateral to transfer from parent cross subaccount
|
|
94
|
+
// If not given, engine defaults to true (borrow enabled)
|
|
95
|
+
borrow_margin: string | null;
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
export interface EngineServerLinkedSignerParams {
|
|
@@ -106,6 +109,10 @@ export interface EngineServerMaxBurnNlpQueryParams {
|
|
|
106
109
|
sender: string;
|
|
107
110
|
}
|
|
108
111
|
|
|
112
|
+
export interface EngineServerNlpLockedBalancesQueryParams {
|
|
113
|
+
subaccount: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
109
116
|
export interface EngineServerQueryRequestByType {
|
|
110
117
|
all_products: Record<string, never>;
|
|
111
118
|
contracts: Record<string, never>;
|
|
@@ -121,6 +128,7 @@ export interface EngineServerQueryRequestByType {
|
|
|
121
128
|
max_nlp_burnable: EngineServerMaxBurnNlpQueryParams;
|
|
122
129
|
max_nlp_mintable: EngineServerMaxMintNlpQueryParams;
|
|
123
130
|
max_order_size: EngineServerMaxOrderSizeQueryParams;
|
|
131
|
+
nlp_locked_balances: EngineServerNlpLockedBalancesQueryParams;
|
|
124
132
|
max_withdrawable: EngineServerMaxWithdrawableQueryParams;
|
|
125
133
|
nonces: EngineServerNoncesParams;
|
|
126
134
|
order: EngineServerGetOrderQueryParams;
|
|
@@ -332,6 +340,23 @@ export interface EngineServerMaxMintNlpResponse {
|
|
|
332
340
|
max_quote_amount: string;
|
|
333
341
|
}
|
|
334
342
|
|
|
343
|
+
export interface EngineServerNlpBalance {
|
|
344
|
+
product_id: number;
|
|
345
|
+
balance: {
|
|
346
|
+
amount: string;
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export interface EngineServerNlpLockedBalance extends EngineServerNlpBalance {
|
|
351
|
+
unlocked_at: number;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export interface EngineServerNlpLockedBalancesResponse {
|
|
355
|
+
balance_locked: EngineServerNlpBalance;
|
|
356
|
+
balance_unlocked: EngineServerNlpBalance;
|
|
357
|
+
locked_balances: EngineServerNlpLockedBalance[];
|
|
358
|
+
}
|
|
359
|
+
|
|
335
360
|
export interface EngineServerQueryResponseByType {
|
|
336
361
|
all_products: EngineServerAllProductsResponse;
|
|
337
362
|
contracts: EngineServerContractsResponse;
|
|
@@ -347,6 +372,7 @@ export interface EngineServerQueryResponseByType {
|
|
|
347
372
|
max_nlp_burnable: EngineServerMaxBurnNlpResponse;
|
|
348
373
|
max_nlp_mintable: EngineServerMaxMintNlpResponse;
|
|
349
374
|
max_order_size: EngineServerMaxOrderSizeResponse;
|
|
375
|
+
nlp_locked_balances: EngineServerNlpLockedBalancesResponse;
|
|
350
376
|
max_withdrawable: EngineServerMaxWithdrawableResponse;
|
|
351
377
|
nonces: EngineServerNoncesResponse;
|
|
352
378
|
order: EngineServerOrderResponse;
|
|
@@ -13,10 +13,12 @@ import {
|
|
|
13
13
|
} from '@nadohq/shared';
|
|
14
14
|
import {
|
|
15
15
|
EngineMarketPrice,
|
|
16
|
+
EngineNlpLockedBalance,
|
|
16
17
|
EngineOrder,
|
|
17
18
|
EnginePriceTickLiquidity,
|
|
18
19
|
EngineServerIsolatedPositionsResponse,
|
|
19
20
|
EngineServerMarketPrice,
|
|
21
|
+
EngineServerNlpLockedBalancesResponse,
|
|
20
22
|
EngineServerOrderResponse,
|
|
21
23
|
EngineServerPerpProduct,
|
|
22
24
|
EngineServerPriceTickLiquidity,
|
|
@@ -27,6 +29,7 @@ import {
|
|
|
27
29
|
EngineSymbol,
|
|
28
30
|
EngineSymbolsResponse,
|
|
29
31
|
GetEngineIsolatedPositionsResponse,
|
|
32
|
+
GetEngineNlpLockedBalancesResponse,
|
|
30
33
|
GetEngineSubaccountSummaryResponse,
|
|
31
34
|
} from '../types';
|
|
32
35
|
import { mapEngineServerProductType } from './productEngineTypeMappers';
|
|
@@ -288,3 +291,26 @@ export function mapEngineMarketPrice(
|
|
|
288
291
|
productId: baseResponse.product_id,
|
|
289
292
|
};
|
|
290
293
|
}
|
|
294
|
+
|
|
295
|
+
export function mapEngineServerNlpLockedBalances(
|
|
296
|
+
baseResponse: EngineServerNlpLockedBalancesResponse,
|
|
297
|
+
): GetEngineNlpLockedBalancesResponse {
|
|
298
|
+
const lockedBalances: EngineNlpLockedBalance[] =
|
|
299
|
+
baseResponse.locked_balances.map((lockedBalance) => ({
|
|
300
|
+
productId: lockedBalance.product_id,
|
|
301
|
+
balance: toBigDecimal(lockedBalance.balance.amount),
|
|
302
|
+
unlockedAt: lockedBalance.unlocked_at,
|
|
303
|
+
}));
|
|
304
|
+
|
|
305
|
+
return {
|
|
306
|
+
lockedBalances,
|
|
307
|
+
balanceLocked: {
|
|
308
|
+
productId: baseResponse.balance_locked.product_id,
|
|
309
|
+
balance: toBigDecimal(baseResponse.balance_locked.balance.amount),
|
|
310
|
+
},
|
|
311
|
+
balanceUnlocked: {
|
|
312
|
+
productId: baseResponse.balance_unlocked.product_id,
|
|
313
|
+
balance: toBigDecimal(baseResponse.balance_unlocked.balance.amount),
|
|
314
|
+
},
|
|
315
|
+
};
|
|
316
|
+
}
|