@nadohq/engine-client 0.1.0-alpha.3 → 0.1.0-alpha.31
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/EngineBaseClient.cjs +8 -7
- package/dist/EngineBaseClient.cjs.map +1 -1
- package/dist/EngineBaseClient.d.cts +2 -3
- package/dist/EngineBaseClient.d.ts +2 -3
- package/dist/EngineBaseClient.js +7 -5
- package/dist/EngineBaseClient.js.map +1 -1
- package/dist/EngineClient.d.cts +1 -2
- package/dist/EngineClient.d.ts +1 -2
- package/dist/EngineExecuteBuilder.cjs +25 -50
- package/dist/EngineExecuteBuilder.cjs.map +1 -1
- package/dist/EngineExecuteBuilder.d.cts +6 -17
- package/dist/EngineExecuteBuilder.d.ts +6 -17
- package/dist/EngineExecuteBuilder.js +15 -40
- package/dist/EngineExecuteBuilder.js.map +1 -1
- package/dist/EngineExecuteClient.cjs +5 -9
- package/dist/EngineExecuteClient.cjs.map +1 -1
- package/dist/EngineExecuteClient.d.cts +3 -4
- package/dist/EngineExecuteClient.d.ts +3 -4
- package/dist/EngineExecuteClient.js +5 -9
- package/dist/EngineExecuteClient.js.map +1 -1
- package/dist/EngineQueryClient.cjs +70 -53
- package/dist/EngineQueryClient.cjs.map +1 -1
- package/dist/EngineQueryClient.d.cts +17 -12
- package/dist/EngineQueryClient.d.ts +17 -12
- package/dist/EngineQueryClient.js +50 -31
- package/dist/EngineQueryClient.js.map +1 -1
- package/dist/EngineWebClient.cjs +0 -2
- package/dist/EngineWebClient.cjs.map +1 -1
- package/dist/EngineWebClient.d.cts +1 -2
- package/dist/EngineWebClient.d.ts +1 -2
- package/dist/EngineWebClient.js +0 -2
- package/dist/EngineWebClient.js.map +1 -1
- package/dist/endpoints.cjs +6 -6
- package/dist/endpoints.cjs.map +1 -1
- package/dist/endpoints.d.cts +1 -1
- package/dist/endpoints.d.ts +1 -1
- package/dist/endpoints.js +6 -6
- package/dist/endpoints.js.map +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -12
- package/dist/index.d.ts +11 -12
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/types/EngineServerFailureError.cjs +1 -1
- package/dist/types/EngineServerFailureError.cjs.map +1 -1
- package/dist/types/EngineServerFailureError.d.cts +2 -2
- package/dist/types/EngineServerFailureError.d.ts +2 -2
- package/dist/types/EngineServerFailureError.js +1 -1
- package/dist/types/EngineServerFailureError.js.map +1 -1
- package/dist/types/clientExecuteTypes.cjs.map +1 -1
- package/dist/types/clientExecuteTypes.d.cts +11 -12
- package/dist/types/clientExecuteTypes.d.ts +11 -12
- package/dist/types/clientQueryTypes.cjs.map +1 -1
- package/dist/types/clientQueryTypes.d.cts +41 -23
- package/dist/types/clientQueryTypes.d.ts +41 -23
- package/dist/types/index.cjs +10 -10
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +8 -9
- package/dist/types/index.d.ts +8 -9
- package/dist/types/index.js +5 -5
- package/dist/types/index.js.map +1 -1
- package/dist/types/serverExecuteTypes.cjs.map +1 -1
- package/dist/types/serverExecuteTypes.d.cts +13 -14
- package/dist/types/serverExecuteTypes.d.ts +13 -14
- package/dist/types/serverQueryModelTypes.cjs.map +1 -1
- package/dist/types/serverQueryModelTypes.d.cts +25 -2
- package/dist/types/serverQueryModelTypes.d.ts +25 -2
- package/dist/types/serverQueryTypes.cjs.map +1 -1
- package/dist/types/serverQueryTypes.d.cts +37 -26
- package/dist/types/serverQueryTypes.d.ts +37 -26
- package/dist/types/serverSubscriptionEventTypes.cjs.map +1 -1
- package/dist/types/serverSubscriptionEventTypes.d.cts +87 -23
- package/dist/types/serverSubscriptionEventTypes.d.ts +87 -23
- package/dist/types/serverSubscriptionTypes.cjs.map +1 -1
- package/dist/types/serverSubscriptionTypes.d.cts +21 -4
- package/dist/types/serverSubscriptionTypes.d.ts +21 -4
- package/dist/utils/index.d.cts +3 -4
- package/dist/utils/index.d.ts +3 -4
- package/dist/utils/productEngineTypeMappers.cjs +5 -5
- package/dist/utils/productEngineTypeMappers.cjs.map +1 -1
- package/dist/utils/productEngineTypeMappers.d.cts +1 -1
- package/dist/utils/productEngineTypeMappers.d.ts +1 -1
- package/dist/utils/productEngineTypeMappers.js +1 -1
- package/dist/utils/productEngineTypeMappers.js.map +1 -1
- package/dist/utils/queryDataMappers.cjs +113 -90
- package/dist/utils/queryDataMappers.cjs.map +1 -1
- package/dist/utils/queryDataMappers.d.cts +6 -5
- package/dist/utils/queryDataMappers.d.ts +6 -5
- package/dist/utils/queryDataMappers.js +39 -19
- package/dist/utils/queryDataMappers.js.map +1 -1
- package/package.json +3 -4
- package/src/EngineBaseClient.ts +5 -3
- package/src/EngineExecuteBuilder.ts +16 -53
- package/src/EngineExecuteClient.ts +5 -13
- package/src/EngineQueryClient.ts +62 -32
- package/src/EngineWebClient.ts +0 -2
- package/src/endpoints.ts +4 -5
- package/src/index.ts +2 -2
- package/src/types/EngineServerFailureError.ts +2 -2
- package/src/types/clientExecuteTypes.ts +12 -17
- package/src/types/clientQueryTypes.ts +57 -32
- package/src/types/index.ts +5 -5
- package/src/types/serverExecuteTypes.ts +14 -18
- package/src/types/serverQueryModelTypes.ts +26 -1
- package/src/types/serverQueryTypes.ts +46 -29
- package/src/types/serverSubscriptionEventTypes.ts +131 -21
- package/src/types/serverSubscriptionTypes.ts +23 -3
- package/src/utils/productEngineTypeMappers.ts +1 -1
- package/src/utils/queryDataMappers.ts +50 -20
|
@@ -2,14 +2,13 @@ import {
|
|
|
2
2
|
EIP712BurnNlpParams,
|
|
3
3
|
EIP712CancelOrdersParams,
|
|
4
4
|
EIP712CancelProductOrdersParams,
|
|
5
|
-
EIP712IsolatedOrderParams,
|
|
6
5
|
EIP712LinkSignerParams,
|
|
7
6
|
EIP712LiquidateSubaccountParams,
|
|
8
7
|
EIP712MintNlpParams,
|
|
9
8
|
EIP712OrderParams,
|
|
10
9
|
EIP712TransferQuoteParams,
|
|
11
10
|
EIP712WithdrawCollateralParams,
|
|
12
|
-
} from '@nadohq/
|
|
11
|
+
} from '@nadohq/shared';
|
|
13
12
|
import { EngineServerExecuteSuccessResult } from './serverExecuteTypes';
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -50,15 +49,7 @@ export type EnginePlaceOrderParams = WithBaseEngineExecuteParams<{
|
|
|
50
49
|
order: EngineOrderParams;
|
|
51
50
|
// If not given, engine defaults to true (leverage/borrow enabled)
|
|
52
51
|
spotLeverage?: boolean;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
export type EngineIsolatedOrderParams = WithoutNonce<EIP712IsolatedOrderParams>;
|
|
56
|
-
|
|
57
|
-
export type EnginePlaceIsolatedOrderParams = WithBaseEngineExecuteParams<{
|
|
58
|
-
id?: number;
|
|
59
|
-
productId: number;
|
|
60
|
-
order: EngineIsolatedOrderParams;
|
|
61
|
-
// Whether the cross subaccount can borrow quote for the margin transfer into the isolated subaccount. If not given, engine defaults to true.
|
|
52
|
+
// For isolated orders, this specifies whether margin can be borrowed (i.e. whether the cross account can have a negative USDT balance)
|
|
62
53
|
borrowMargin?: boolean;
|
|
63
54
|
}>;
|
|
64
55
|
|
|
@@ -93,6 +84,15 @@ export type EngineMintNlpParams = WithBaseEngineExecuteParams<
|
|
|
93
84
|
export type EngineBurnNlpParams =
|
|
94
85
|
WithBaseEngineExecuteParams<EIP712BurnNlpParams>;
|
|
95
86
|
|
|
87
|
+
export type EnginePlaceOrdersParams = {
|
|
88
|
+
orders: EnginePlaceOrderParams[];
|
|
89
|
+
/**
|
|
90
|
+
* If `true`, aborts the batch after the first failed order; if `false`, remaining orders continue to execute.
|
|
91
|
+
* If not provided, the default value is `false`.
|
|
92
|
+
*/
|
|
93
|
+
cancelOnFailure?: boolean;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
96
|
export interface EngineExecuteRequestParamsByType {
|
|
97
97
|
burn_nlp: EngineBurnNlpParams;
|
|
98
98
|
cancel_and_place: EngineCancelAndPlaceParams;
|
|
@@ -101,8 +101,8 @@ export interface EngineExecuteRequestParamsByType {
|
|
|
101
101
|
link_signer: EngineLinkSignerParams;
|
|
102
102
|
liquidate_subaccount: EngineLiquidateSubaccountParams;
|
|
103
103
|
mint_nlp: EngineMintNlpParams;
|
|
104
|
-
place_isolated_order: EnginePlaceIsolatedOrderParams;
|
|
105
104
|
place_order: EnginePlaceOrderParams;
|
|
105
|
+
place_orders: EnginePlaceOrdersParams;
|
|
106
106
|
transfer_quote: EngineTransferQuoteParams;
|
|
107
107
|
withdraw_collateral: EngineWithdrawCollateralParams;
|
|
108
108
|
}
|
|
@@ -111,8 +111,3 @@ export type EnginePlaceOrderResult =
|
|
|
111
111
|
EngineServerExecuteSuccessResult<'place_order'> & {
|
|
112
112
|
orderParams: EIP712OrderParams;
|
|
113
113
|
};
|
|
114
|
-
|
|
115
|
-
export type EnginePlaceIsolatedOrderResult =
|
|
116
|
-
EngineServerExecuteSuccessResult<'place_isolated_order'> & {
|
|
117
|
-
orderParams: EIP712IsolatedOrderParams;
|
|
118
|
-
};
|
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BalanceHealthContributions,
|
|
3
3
|
BalanceSide,
|
|
4
|
+
BalanceWithProduct,
|
|
5
|
+
BigDecimal,
|
|
4
6
|
EIP712OrderParams,
|
|
5
|
-
GetAllMarketsResponse,
|
|
6
|
-
GetSubaccountSummaryParams,
|
|
7
7
|
HealthGroup,
|
|
8
|
-
|
|
8
|
+
HealthStatusByType,
|
|
9
|
+
MarketWithProduct,
|
|
10
|
+
OrderAppendix,
|
|
9
11
|
PerpBalanceWithProduct,
|
|
10
12
|
ProductEngineType,
|
|
11
13
|
SignedEIP712OrderParams,
|
|
12
14
|
SpotBalanceWithProduct,
|
|
13
15
|
Subaccount,
|
|
14
|
-
|
|
15
|
-
} from '@nadohq/contracts';
|
|
16
|
-
import { BigDecimal } from '@nadohq/utils';
|
|
16
|
+
} from '@nadohq/shared';
|
|
17
17
|
import {
|
|
18
18
|
EngineServerNoncesParams,
|
|
19
19
|
EngineServerTimeResponse,
|
|
20
20
|
} from './serverQueryTypes';
|
|
21
21
|
|
|
22
|
-
export
|
|
22
|
+
export interface GetEngineSubaccountSummaryResponse {
|
|
23
|
+
exists: boolean;
|
|
24
|
+
balances: BalanceWithProduct[];
|
|
25
|
+
health: HealthStatusByType;
|
|
26
|
+
}
|
|
23
27
|
|
|
24
|
-
export type GetEngineSubaccountSummaryParams =
|
|
28
|
+
export type GetEngineSubaccountSummaryParams = Subaccount;
|
|
25
29
|
|
|
26
30
|
export type GetEngineIsolatedPositionsParams = Subaccount;
|
|
27
31
|
|
|
@@ -48,16 +52,11 @@ export interface SubaccountProductDeltaTx {
|
|
|
48
52
|
export interface GetEngineContractsResponse {
|
|
49
53
|
chainId: number;
|
|
50
54
|
endpointAddr: string;
|
|
51
|
-
/**
|
|
52
|
-
* Address for the orderbook contract, with the product ID being the index
|
|
53
|
-
*/
|
|
54
|
-
orderbookAddrs: string[];
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export type GetEngineEstimatedSubaccountSummaryParams =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
57
|
+
export type GetEngineEstimatedSubaccountSummaryParams = Subaccount & {
|
|
58
|
+
txs: SubaccountTx[];
|
|
59
|
+
};
|
|
61
60
|
|
|
62
61
|
export type GetEngineNoncesParams = EngineServerNoncesParams;
|
|
63
62
|
|
|
@@ -91,7 +90,7 @@ export interface EngineSymbol {
|
|
|
91
90
|
longWeightMaintenance: BigDecimal;
|
|
92
91
|
}
|
|
93
92
|
|
|
94
|
-
export type GetEngineAllMarketsResponse =
|
|
93
|
+
export type GetEngineAllMarketsResponse = MarketWithProduct[];
|
|
95
94
|
|
|
96
95
|
export interface GetEngineHealthGroupsResponse {
|
|
97
96
|
healthGroups: HealthGroup[];
|
|
@@ -109,14 +108,11 @@ export interface EngineOrder extends Subaccount {
|
|
|
109
108
|
totalAmount: BigDecimal;
|
|
110
109
|
// Amount still unfilled
|
|
111
110
|
unfilledAmount: BigDecimal;
|
|
112
|
-
expiration:
|
|
113
|
-
// Margin being transferred for the order, will be null if not an iso order
|
|
114
|
-
margin: BigDecimal | null;
|
|
111
|
+
expiration: number;
|
|
115
112
|
nonce: string;
|
|
116
113
|
digest: string;
|
|
117
|
-
orderParams: EIP712OrderParams;
|
|
118
114
|
placementTime: number;
|
|
119
|
-
|
|
115
|
+
appendix: OrderAppendix;
|
|
120
116
|
}
|
|
121
117
|
|
|
122
118
|
export type GetEngineOrderResponse = EngineOrder;
|
|
@@ -128,7 +124,6 @@ export interface ValidateSignedEngineOrderParams {
|
|
|
128
124
|
|
|
129
125
|
export interface ValidateEngineOrderParams {
|
|
130
126
|
productId: number;
|
|
131
|
-
orderbookAddr: string;
|
|
132
127
|
chainId: number;
|
|
133
128
|
order: EIP712OrderParams;
|
|
134
129
|
}
|
|
@@ -171,6 +166,7 @@ export interface GetEngineSubaccountFeeRatesResponse {
|
|
|
171
166
|
liquidationSequencerFee: BigDecimal;
|
|
172
167
|
healthCheckSequencerFee: BigDecimal;
|
|
173
168
|
takerSequencerFee: BigDecimal;
|
|
169
|
+
feeTier: number;
|
|
174
170
|
}
|
|
175
171
|
|
|
176
172
|
export interface EnginePriceTickLiquidity {
|
|
@@ -220,6 +216,10 @@ export interface GetEngineMaxOrderSizeParams extends Subaccount {
|
|
|
220
216
|
// If not given, engine defaults to false. If true, the max order size will be capped to the subaccount's current position size;
|
|
221
217
|
// If no position exists, it will return 0.
|
|
222
218
|
reduceOnly?: boolean;
|
|
219
|
+
isolated?: boolean;
|
|
220
|
+
// If not given, engine defaults to true (do not borrow margin for isolated orders)
|
|
221
|
+
// Max order size query for `isolated` includes available transfer from the cross subaccount
|
|
222
|
+
isoBorrowMargin?: boolean;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
export type GetEngineMaxOrderSizeResponse = BigDecimal;
|
|
@@ -242,15 +242,6 @@ export interface GetEngineLinkedSignerResponse {
|
|
|
242
242
|
|
|
243
243
|
export type GetEngineInsuranceResponse = BigDecimal;
|
|
244
244
|
|
|
245
|
-
export interface EngineMinDepositRate {
|
|
246
|
-
productId: number;
|
|
247
|
-
minDepositRate: BigDecimal;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
export interface GetEngineMinDepositRatesResponse {
|
|
251
|
-
minDepositRates: Record<number, EngineMinDepositRate>;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
245
|
/**
|
|
255
246
|
* Given an IP, backend will either:
|
|
256
247
|
* - Allow queries only through archive / engine (query_only)
|
|
@@ -265,3 +256,37 @@ export interface GetEngineMaxMintNlpAmountParams extends Subaccount {
|
|
|
265
256
|
}
|
|
266
257
|
|
|
267
258
|
export type GetEngineMaxMintNlpAmountResponse = BigDecimal;
|
|
259
|
+
|
|
260
|
+
export type GetEngineMaxBurnNlpAmountParams = Subaccount;
|
|
261
|
+
|
|
262
|
+
export type GetEngineMaxBurnNlpAmountResponse = BigDecimal;
|
|
263
|
+
|
|
264
|
+
export type GetEngineNlpLockedBalancesParams = Subaccount;
|
|
265
|
+
|
|
266
|
+
export interface EngineNlpBalance {
|
|
267
|
+
productId: number;
|
|
268
|
+
balance: BigDecimal;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export interface EngineNlpLockedBalance extends EngineNlpBalance {
|
|
272
|
+
unlockedAt: number;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export interface GetEngineNlpLockedBalancesResponse {
|
|
276
|
+
lockedBalances: EngineNlpLockedBalance[];
|
|
277
|
+
balanceLocked: EngineNlpBalance;
|
|
278
|
+
balanceUnlocked: EngineNlpBalance;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export interface NlpPool {
|
|
282
|
+
poolId: number;
|
|
283
|
+
subaccountHex: string;
|
|
284
|
+
ownerAddress: string;
|
|
285
|
+
balanceWeight: BigDecimal;
|
|
286
|
+
subaccountInfo: GetEngineSubaccountSummaryResponse;
|
|
287
|
+
openOrders: EngineOrder[];
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export interface GetEngineNlpPoolInfoResponse {
|
|
291
|
+
nlpPools: NlpPool[];
|
|
292
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './clientQueryTypes';
|
|
2
1
|
export * from './clientExecuteTypes';
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
2
|
+
export * from './clientQueryTypes';
|
|
3
|
+
export * from './EngineServerFailureError';
|
|
5
4
|
export * from './serverExecuteTypes';
|
|
6
|
-
export * from './
|
|
5
|
+
export * from './serverQueryModelTypes';
|
|
6
|
+
export * from './serverQueryTypes';
|
|
7
7
|
export * from './serverSubscriptionEventTypes';
|
|
8
|
-
export * from './
|
|
8
|
+
export * from './serverSubscriptionTypes';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EIP712BurnNlpValues,
|
|
3
|
-
EIP712IsolatedOrderParams,
|
|
4
3
|
EIP712LinkSignerValues,
|
|
5
4
|
EIP712LiquidateSubaccountValues,
|
|
6
5
|
EIP712MintNlpValues,
|
|
@@ -11,13 +10,16 @@ import {
|
|
|
11
10
|
EIP712TransferQuoteValues,
|
|
12
11
|
EIP712WithdrawCollateralValues,
|
|
13
12
|
SignedTx,
|
|
14
|
-
} from '@nadohq/
|
|
13
|
+
} from '@nadohq/shared';
|
|
15
14
|
import { EngineServerOrderResponse } from './serverQueryTypes';
|
|
16
15
|
|
|
17
16
|
export interface EngineServerPlaceOrderResponse {
|
|
18
17
|
digest: string;
|
|
18
|
+
error: string | null;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
export type EngineServerPlaceOrdersResponse = EngineServerPlaceOrderResponse[];
|
|
22
|
+
|
|
21
23
|
export interface EngineServerCancelOrdersResponse {
|
|
22
24
|
cancelled_orders: EngineServerOrderResponse[];
|
|
23
25
|
}
|
|
@@ -30,8 +32,8 @@ export interface EngineServerExecuteResponseDataByType {
|
|
|
30
32
|
link_signer: null;
|
|
31
33
|
liquidate_subaccount: null;
|
|
32
34
|
mint_nlp: null;
|
|
33
|
-
place_isolated_order: EngineServerPlaceOrderResponse;
|
|
34
35
|
place_order: EngineServerPlaceOrderResponse;
|
|
36
|
+
place_orders: EngineServerPlaceOrdersResponse;
|
|
35
37
|
transfer_quote: null;
|
|
36
38
|
withdraw_collateral: null;
|
|
37
39
|
}
|
|
@@ -71,15 +73,7 @@ export interface EngineServerPlaceOrderParams {
|
|
|
71
73
|
signature: string;
|
|
72
74
|
// Engine defaults this to true
|
|
73
75
|
spot_leverage: boolean | null;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
export interface EngineServerPlaceIsolatedOrderParams {
|
|
77
|
-
id: number | null;
|
|
78
|
-
product_id: number;
|
|
79
|
-
isolated_order: EIP712OrderValues;
|
|
80
|
-
// Bytes
|
|
81
|
-
signature: string;
|
|
82
|
-
// Engine defaults this to false
|
|
76
|
+
// For isolated orders, this specifies whether margin can be borrowed (i.e. whether the cross account can have a negative USDT balance)
|
|
83
77
|
borrow_margin: boolean | null;
|
|
84
78
|
}
|
|
85
79
|
|
|
@@ -116,8 +110,15 @@ export interface EngineServerExecuteRequestByType {
|
|
|
116
110
|
link_signer: SignedTx<EIP712LinkSignerValues>;
|
|
117
111
|
liquidate_subaccount: SignedTx<EIP712LiquidateSubaccountValues>;
|
|
118
112
|
mint_nlp: WithSpotLeverage<SignedTx<EIP712MintNlpValues>>;
|
|
119
|
-
place_isolated_order: EngineServerPlaceIsolatedOrderParams;
|
|
120
113
|
place_order: EngineServerPlaceOrderParams;
|
|
114
|
+
place_orders: {
|
|
115
|
+
orders: EngineServerPlaceOrderParams[];
|
|
116
|
+
/**
|
|
117
|
+
* If `true`, aborts the batch after the first failed order; if `false`, remaining orders continue to execute.
|
|
118
|
+
* If `null`, the default value is `false`.
|
|
119
|
+
*/
|
|
120
|
+
cancel_on_failure: boolean | null;
|
|
121
|
+
};
|
|
121
122
|
transfer_quote: SignedTx<EIP712TransferQuoteValues>;
|
|
122
123
|
withdraw_collateral: WithSpotLeverage<
|
|
123
124
|
SignedTx<EIP712WithdrawCollateralValues>
|
|
@@ -131,8 +132,3 @@ export interface EngineServerExecutePlaceOrderPayload {
|
|
|
131
132
|
payload: EngineServerExecuteRequestByType['place_order'];
|
|
132
133
|
orderParams: EIP712OrderParams;
|
|
133
134
|
}
|
|
134
|
-
|
|
135
|
-
export interface EngineServerExecutePlaceIsolatedOrderPayload {
|
|
136
|
-
payload: EngineServerExecuteRequestByType['place_isolated_order'];
|
|
137
|
-
orderParams: EIP712IsolatedOrderParams;
|
|
138
|
-
}
|
|
@@ -6,7 +6,6 @@ export interface EngineServerHealthBreakdown {
|
|
|
6
6
|
|
|
7
7
|
export interface EngineServerSpotBalanceData {
|
|
8
8
|
amount: string;
|
|
9
|
-
last_cumulative_multiplier_x18: string;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
export interface EngineServerPerpBalanceData {
|
|
@@ -36,6 +35,7 @@ export interface EngineServerSpotConfig {
|
|
|
36
35
|
interest_floor_x18: string;
|
|
37
36
|
interest_small_cap_x18: string;
|
|
38
37
|
interest_large_cap_x18: string;
|
|
38
|
+
min_deposit_rate_x18: string;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export interface EngineServerSpotState {
|
|
@@ -81,3 +81,28 @@ export interface EngineServerPerpBalance {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
export type EngineServerProductType = 'perp' | 'spot';
|
|
84
|
+
|
|
85
|
+
export interface EngineServerOrder {
|
|
86
|
+
product_id: number;
|
|
87
|
+
sender: string;
|
|
88
|
+
price_x18: string;
|
|
89
|
+
amount: string;
|
|
90
|
+
expiration: string;
|
|
91
|
+
nonce: string;
|
|
92
|
+
unfilled_amount: string;
|
|
93
|
+
digest: string;
|
|
94
|
+
placed_at: number;
|
|
95
|
+
order_type: string;
|
|
96
|
+
appendix: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface EngineServerNlpBalance {
|
|
100
|
+
product_id: number;
|
|
101
|
+
balance: {
|
|
102
|
+
amount: string;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export interface EngineServerNlpLockedBalance {
|
|
106
|
+
unlocked_at: number;
|
|
107
|
+
balance: EngineServerNlpBalance;
|
|
108
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { HealthStatus } from '@nadohq/
|
|
1
|
+
import { HealthStatus } from '@nadohq/shared';
|
|
2
2
|
import {
|
|
3
3
|
EngineServerHealthBreakdown,
|
|
4
|
+
EngineServerNlpBalance,
|
|
5
|
+
EngineServerNlpLockedBalance,
|
|
6
|
+
EngineServerOrder,
|
|
4
7
|
EngineServerPerpBalance,
|
|
5
8
|
EngineServerPerpProduct,
|
|
6
9
|
EngineServerProductType,
|
|
@@ -89,6 +92,10 @@ export interface EngineServerMaxOrderSizeQueryParams {
|
|
|
89
92
|
// If not given, engine defaults to false. If true, the max order size will be capped to the subaccount's current position size;
|
|
90
93
|
// If no position exists, it will return 0.
|
|
91
94
|
reduce_only: string | null;
|
|
95
|
+
isolated: string | null;
|
|
96
|
+
// For isolated, max order size includes available collateral to transfer from parent cross subaccount
|
|
97
|
+
// If not given, engine defaults to true (borrow enabled)
|
|
98
|
+
borrow_margin: string | null;
|
|
92
99
|
}
|
|
93
100
|
|
|
94
101
|
export interface EngineServerLinkedSignerParams {
|
|
@@ -101,6 +108,14 @@ export interface EngineServerMaxMintNlpQueryParams {
|
|
|
101
108
|
spot_leverage: string | null;
|
|
102
109
|
}
|
|
103
110
|
|
|
111
|
+
export interface EngineServerMaxBurnNlpQueryParams {
|
|
112
|
+
sender: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface EngineServerNlpLockedBalancesQueryParams {
|
|
116
|
+
subaccount: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
104
119
|
export interface EngineServerQueryRequestByType {
|
|
105
120
|
all_products: Record<string, never>;
|
|
106
121
|
contracts: Record<string, never>;
|
|
@@ -113,10 +128,12 @@ export interface EngineServerQueryRequestByType {
|
|
|
113
128
|
market_liquidity: EngineServerMarketLiquidityQueryParams;
|
|
114
129
|
market_price: EngineServerMarketPriceQueryParams;
|
|
115
130
|
market_prices: EngineServerMarketPricesQueryParams;
|
|
131
|
+
max_nlp_burnable: EngineServerMaxBurnNlpQueryParams;
|
|
116
132
|
max_nlp_mintable: EngineServerMaxMintNlpQueryParams;
|
|
117
133
|
max_order_size: EngineServerMaxOrderSizeQueryParams;
|
|
134
|
+
nlp_locked_balances: EngineServerNlpLockedBalancesQueryParams;
|
|
135
|
+
nlp_pool_info: Record<string, never>;
|
|
118
136
|
max_withdrawable: EngineServerMaxWithdrawableQueryParams;
|
|
119
|
-
min_deposit_rates: Record<string, never>;
|
|
120
137
|
nonces: EngineServerNoncesParams;
|
|
121
138
|
order: EngineServerGetOrderQueryParams;
|
|
122
139
|
orders: EngineServerOrdersQueryParams;
|
|
@@ -141,8 +158,6 @@ export type EngineServerQueryRequest<
|
|
|
141
158
|
export interface EngineServerContractsResponse {
|
|
142
159
|
chain_id: string;
|
|
143
160
|
endpoint_addr: string;
|
|
144
|
-
// Index is product ID
|
|
145
|
-
book_addrs: string[];
|
|
146
161
|
}
|
|
147
162
|
|
|
148
163
|
// Unless in active state, engine is not fully operational
|
|
@@ -256,6 +271,7 @@ export interface EngineServerFeeRatesResponse {
|
|
|
256
271
|
withdraw_sequencer_fees: string[];
|
|
257
272
|
taker_fee_rates_x18: string[];
|
|
258
273
|
maker_fee_rates_x18: string[];
|
|
274
|
+
fee_tier: number;
|
|
259
275
|
}
|
|
260
276
|
|
|
261
277
|
export interface EngineServerMarketPrice {
|
|
@@ -270,20 +286,6 @@ export interface EngineServerMarketPricesResponse {
|
|
|
270
286
|
market_prices: EngineServerMarketPrice[];
|
|
271
287
|
}
|
|
272
288
|
|
|
273
|
-
export interface EngineServerOrder {
|
|
274
|
-
product_id: number;
|
|
275
|
-
sender: string;
|
|
276
|
-
price_x18: string;
|
|
277
|
-
amount: string;
|
|
278
|
-
expiration: string;
|
|
279
|
-
nonce: string;
|
|
280
|
-
unfilled_amount: string;
|
|
281
|
-
digest: string;
|
|
282
|
-
placed_at: number;
|
|
283
|
-
order_type: string;
|
|
284
|
-
margin: string | null;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
289
|
export type EngineServerOrderResponse = EngineServerOrder;
|
|
288
290
|
|
|
289
291
|
export interface EngineServerValidateOrderResponse {
|
|
@@ -315,25 +317,38 @@ export interface EngineInsuranceResponse {
|
|
|
315
317
|
insurance: string;
|
|
316
318
|
}
|
|
317
319
|
|
|
318
|
-
export interface EngineServerMinDepositRate {
|
|
319
|
-
product_id: number;
|
|
320
|
-
min_deposit_rate_x18: string;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
export interface EngineServerMinDepositRatesResponse {
|
|
324
|
-
// product_id -> EngineServerMinDepositRate
|
|
325
|
-
min_deposit_rates: Record<number, EngineServerMinDepositRate>;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
320
|
export interface EngineServerEdgeAllProductsResponse {
|
|
329
321
|
// chain_id -> EngineServerAllProductsResponse
|
|
330
322
|
edge_all_products: Record<number, EngineServerAllProductsResponse>;
|
|
331
323
|
}
|
|
332
324
|
|
|
325
|
+
export interface EngineServerMaxBurnNlpResponse {
|
|
326
|
+
max_nlp_amount: string;
|
|
327
|
+
}
|
|
328
|
+
|
|
333
329
|
export interface EngineServerMaxMintNlpResponse {
|
|
334
330
|
max_quote_amount: string;
|
|
335
331
|
}
|
|
336
332
|
|
|
333
|
+
export interface EngineServerNlpLockedBalancesResponse {
|
|
334
|
+
balance_locked: EngineServerNlpBalance;
|
|
335
|
+
balance_unlocked: EngineServerNlpBalance;
|
|
336
|
+
locked_balances: EngineServerNlpLockedBalance[];
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export interface EngineServerNlpPool {
|
|
340
|
+
pool_id: number;
|
|
341
|
+
subaccount: string;
|
|
342
|
+
owner: string;
|
|
343
|
+
balance_weight_x18: string;
|
|
344
|
+
subaccount_info: EngineServerSubaccountInfoResponse;
|
|
345
|
+
open_orders: EngineServerOrder[];
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export interface EngineServerNlpPoolInfoResponse {
|
|
349
|
+
nlp_pools: EngineServerNlpPool[];
|
|
350
|
+
}
|
|
351
|
+
|
|
337
352
|
export interface EngineServerQueryResponseByType {
|
|
338
353
|
all_products: EngineServerAllProductsResponse;
|
|
339
354
|
contracts: EngineServerContractsResponse;
|
|
@@ -346,10 +361,12 @@ export interface EngineServerQueryResponseByType {
|
|
|
346
361
|
market_liquidity: EngineServerMarketLiquidityResponse;
|
|
347
362
|
market_price: EngineServerMarketPriceResponse;
|
|
348
363
|
market_prices: EngineServerMarketPricesResponse;
|
|
364
|
+
max_nlp_burnable: EngineServerMaxBurnNlpResponse;
|
|
349
365
|
max_nlp_mintable: EngineServerMaxMintNlpResponse;
|
|
350
366
|
max_order_size: EngineServerMaxOrderSizeResponse;
|
|
367
|
+
nlp_locked_balances: EngineServerNlpLockedBalancesResponse;
|
|
368
|
+
nlp_pool_info: EngineServerNlpPoolInfoResponse;
|
|
351
369
|
max_withdrawable: EngineServerMaxWithdrawableResponse;
|
|
352
|
-
min_deposit_rates: EngineServerMinDepositRatesResponse;
|
|
353
370
|
nonces: EngineServerNoncesResponse;
|
|
354
371
|
order: EngineServerOrderResponse;
|
|
355
372
|
orders: EngineServerProductOrdersResponse;
|