@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.
Files changed (110) hide show
  1. package/dist/EngineBaseClient.cjs +8 -7
  2. package/dist/EngineBaseClient.cjs.map +1 -1
  3. package/dist/EngineBaseClient.d.cts +2 -3
  4. package/dist/EngineBaseClient.d.ts +2 -3
  5. package/dist/EngineBaseClient.js +7 -5
  6. package/dist/EngineBaseClient.js.map +1 -1
  7. package/dist/EngineClient.d.cts +1 -2
  8. package/dist/EngineClient.d.ts +1 -2
  9. package/dist/EngineExecuteBuilder.cjs +25 -50
  10. package/dist/EngineExecuteBuilder.cjs.map +1 -1
  11. package/dist/EngineExecuteBuilder.d.cts +6 -17
  12. package/dist/EngineExecuteBuilder.d.ts +6 -17
  13. package/dist/EngineExecuteBuilder.js +15 -40
  14. package/dist/EngineExecuteBuilder.js.map +1 -1
  15. package/dist/EngineExecuteClient.cjs +5 -9
  16. package/dist/EngineExecuteClient.cjs.map +1 -1
  17. package/dist/EngineExecuteClient.d.cts +3 -4
  18. package/dist/EngineExecuteClient.d.ts +3 -4
  19. package/dist/EngineExecuteClient.js +5 -9
  20. package/dist/EngineExecuteClient.js.map +1 -1
  21. package/dist/EngineQueryClient.cjs +70 -53
  22. package/dist/EngineQueryClient.cjs.map +1 -1
  23. package/dist/EngineQueryClient.d.cts +17 -12
  24. package/dist/EngineQueryClient.d.ts +17 -12
  25. package/dist/EngineQueryClient.js +50 -31
  26. package/dist/EngineQueryClient.js.map +1 -1
  27. package/dist/EngineWebClient.cjs +0 -2
  28. package/dist/EngineWebClient.cjs.map +1 -1
  29. package/dist/EngineWebClient.d.cts +1 -2
  30. package/dist/EngineWebClient.d.ts +1 -2
  31. package/dist/EngineWebClient.js +0 -2
  32. package/dist/EngineWebClient.js.map +1 -1
  33. package/dist/endpoints.cjs +6 -6
  34. package/dist/endpoints.cjs.map +1 -1
  35. package/dist/endpoints.d.cts +1 -1
  36. package/dist/endpoints.d.ts +1 -1
  37. package/dist/endpoints.js +6 -6
  38. package/dist/endpoints.js.map +1 -1
  39. package/dist/index.cjs +4 -4
  40. package/dist/index.cjs.map +1 -1
  41. package/dist/index.d.cts +11 -12
  42. package/dist/index.d.ts +11 -12
  43. package/dist/index.js +2 -2
  44. package/dist/index.js.map +1 -1
  45. package/dist/types/EngineServerFailureError.cjs +1 -1
  46. package/dist/types/EngineServerFailureError.cjs.map +1 -1
  47. package/dist/types/EngineServerFailureError.d.cts +2 -2
  48. package/dist/types/EngineServerFailureError.d.ts +2 -2
  49. package/dist/types/EngineServerFailureError.js +1 -1
  50. package/dist/types/EngineServerFailureError.js.map +1 -1
  51. package/dist/types/clientExecuteTypes.cjs.map +1 -1
  52. package/dist/types/clientExecuteTypes.d.cts +11 -12
  53. package/dist/types/clientExecuteTypes.d.ts +11 -12
  54. package/dist/types/clientQueryTypes.cjs.map +1 -1
  55. package/dist/types/clientQueryTypes.d.cts +41 -23
  56. package/dist/types/clientQueryTypes.d.ts +41 -23
  57. package/dist/types/index.cjs +10 -10
  58. package/dist/types/index.cjs.map +1 -1
  59. package/dist/types/index.d.cts +8 -9
  60. package/dist/types/index.d.ts +8 -9
  61. package/dist/types/index.js +5 -5
  62. package/dist/types/index.js.map +1 -1
  63. package/dist/types/serverExecuteTypes.cjs.map +1 -1
  64. package/dist/types/serverExecuteTypes.d.cts +13 -14
  65. package/dist/types/serverExecuteTypes.d.ts +13 -14
  66. package/dist/types/serverQueryModelTypes.cjs.map +1 -1
  67. package/dist/types/serverQueryModelTypes.d.cts +25 -2
  68. package/dist/types/serverQueryModelTypes.d.ts +25 -2
  69. package/dist/types/serverQueryTypes.cjs.map +1 -1
  70. package/dist/types/serverQueryTypes.d.cts +37 -26
  71. package/dist/types/serverQueryTypes.d.ts +37 -26
  72. package/dist/types/serverSubscriptionEventTypes.cjs.map +1 -1
  73. package/dist/types/serverSubscriptionEventTypes.d.cts +87 -23
  74. package/dist/types/serverSubscriptionEventTypes.d.ts +87 -23
  75. package/dist/types/serverSubscriptionTypes.cjs.map +1 -1
  76. package/dist/types/serverSubscriptionTypes.d.cts +21 -4
  77. package/dist/types/serverSubscriptionTypes.d.ts +21 -4
  78. package/dist/utils/index.d.cts +3 -4
  79. package/dist/utils/index.d.ts +3 -4
  80. package/dist/utils/productEngineTypeMappers.cjs +5 -5
  81. package/dist/utils/productEngineTypeMappers.cjs.map +1 -1
  82. package/dist/utils/productEngineTypeMappers.d.cts +1 -1
  83. package/dist/utils/productEngineTypeMappers.d.ts +1 -1
  84. package/dist/utils/productEngineTypeMappers.js +1 -1
  85. package/dist/utils/productEngineTypeMappers.js.map +1 -1
  86. package/dist/utils/queryDataMappers.cjs +113 -90
  87. package/dist/utils/queryDataMappers.cjs.map +1 -1
  88. package/dist/utils/queryDataMappers.d.cts +6 -5
  89. package/dist/utils/queryDataMappers.d.ts +6 -5
  90. package/dist/utils/queryDataMappers.js +39 -19
  91. package/dist/utils/queryDataMappers.js.map +1 -1
  92. package/package.json +3 -4
  93. package/src/EngineBaseClient.ts +5 -3
  94. package/src/EngineExecuteBuilder.ts +16 -53
  95. package/src/EngineExecuteClient.ts +5 -13
  96. package/src/EngineQueryClient.ts +62 -32
  97. package/src/EngineWebClient.ts +0 -2
  98. package/src/endpoints.ts +4 -5
  99. package/src/index.ts +2 -2
  100. package/src/types/EngineServerFailureError.ts +2 -2
  101. package/src/types/clientExecuteTypes.ts +12 -17
  102. package/src/types/clientQueryTypes.ts +57 -32
  103. package/src/types/index.ts +5 -5
  104. package/src/types/serverExecuteTypes.ts +14 -18
  105. package/src/types/serverQueryModelTypes.ts +26 -1
  106. package/src/types/serverQueryTypes.ts +46 -29
  107. package/src/types/serverSubscriptionEventTypes.ts +131 -21
  108. package/src/types/serverSubscriptionTypes.ts +23 -3
  109. package/src/utils/productEngineTypeMappers.ts +1 -1
  110. 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/contracts';
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
- OrderExpirationType,
8
+ HealthStatusByType,
9
+ MarketWithProduct,
10
+ OrderAppendix,
9
11
  PerpBalanceWithProduct,
10
12
  ProductEngineType,
11
13
  SignedEIP712OrderParams,
12
14
  SpotBalanceWithProduct,
13
15
  Subaccount,
14
- SubaccountSummaryResponse,
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 type GetEngineSubaccountSummaryResponse = SubaccountSummaryResponse;
22
+ export interface GetEngineSubaccountSummaryResponse {
23
+ exists: boolean;
24
+ balances: BalanceWithProduct[];
25
+ health: HealthStatusByType;
26
+ }
23
27
 
24
- export type GetEngineSubaccountSummaryParams = GetSubaccountSummaryParams;
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
- GetSubaccountSummaryParams & {
59
- txs: SubaccountTx[];
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 = GetAllMarketsResponse;
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: BigDecimal;
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
- orderType: OrderExpirationType;
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
+ }
@@ -1,8 +1,8 @@
1
- export * from './clientQueryTypes';
2
1
  export * from './clientExecuteTypes';
3
- export * from './serverQueryTypes';
4
- export * from './serverQueryModelTypes';
2
+ export * from './clientQueryTypes';
3
+ export * from './EngineServerFailureError';
5
4
  export * from './serverExecuteTypes';
6
- export * from './serverSubscriptionTypes';
5
+ export * from './serverQueryModelTypes';
6
+ export * from './serverQueryTypes';
7
7
  export * from './serverSubscriptionEventTypes';
8
- export * from './EngineServerFailureError';
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/contracts';
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/contracts';
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;