@nadohq/engine-client 0.1.0-alpha.3 → 0.1.0-alpha.5

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 (94) hide show
  1. package/dist/EngineBaseClient.cjs +8 -7
  2. package/dist/EngineBaseClient.cjs.map +1 -1
  3. package/dist/EngineBaseClient.d.cts +1 -2
  4. package/dist/EngineBaseClient.d.ts +1 -2
  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 +23 -51
  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 +13 -41
  14. package/dist/EngineExecuteBuilder.js.map +1 -1
  15. package/dist/EngineExecuteClient.cjs +6 -10
  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 +6 -10
  20. package/dist/EngineExecuteClient.js.map +1 -1
  21. package/dist/EngineQueryClient.cjs +28 -53
  22. package/dist/EngineQueryClient.cjs.map +1 -1
  23. package/dist/EngineQueryClient.d.cts +2 -13
  24. package/dist/EngineQueryClient.d.ts +2 -13
  25. package/dist/EngineQueryClient.js +6 -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.d.cts +5 -6
  40. package/dist/index.d.ts +5 -6
  41. package/dist/types/EngineServerFailureError.cjs +1 -1
  42. package/dist/types/EngineServerFailureError.cjs.map +1 -1
  43. package/dist/types/EngineServerFailureError.d.cts +2 -2
  44. package/dist/types/EngineServerFailureError.d.ts +2 -2
  45. package/dist/types/EngineServerFailureError.js +1 -1
  46. package/dist/types/EngineServerFailureError.js.map +1 -1
  47. package/dist/types/clientExecuteTypes.cjs.map +1 -1
  48. package/dist/types/clientExecuteTypes.d.cts +4 -12
  49. package/dist/types/clientExecuteTypes.d.ts +4 -12
  50. package/dist/types/clientQueryTypes.cjs.map +1 -1
  51. package/dist/types/clientQueryTypes.d.cts +12 -23
  52. package/dist/types/clientQueryTypes.d.ts +12 -23
  53. package/dist/types/index.d.cts +5 -6
  54. package/dist/types/index.d.ts +5 -6
  55. package/dist/types/serverExecuteTypes.cjs.map +1 -1
  56. package/dist/types/serverExecuteTypes.d.cts +6 -14
  57. package/dist/types/serverExecuteTypes.d.ts +6 -14
  58. package/dist/types/serverQueryModelTypes.cjs.map +1 -1
  59. package/dist/types/serverQueryModelTypes.d.cts +1 -1
  60. package/dist/types/serverQueryModelTypes.d.ts +1 -1
  61. package/dist/types/serverQueryTypes.cjs.map +1 -1
  62. package/dist/types/serverQueryTypes.d.cts +3 -13
  63. package/dist/types/serverQueryTypes.d.ts +3 -13
  64. package/dist/types/serverSubscriptionEventTypes.d.cts +1 -1
  65. package/dist/types/serverSubscriptionEventTypes.d.ts +1 -1
  66. package/dist/utils/index.d.cts +1 -2
  67. package/dist/utils/index.d.ts +1 -2
  68. package/dist/utils/productEngineTypeMappers.cjs +5 -5
  69. package/dist/utils/productEngineTypeMappers.cjs.map +1 -1
  70. package/dist/utils/productEngineTypeMappers.d.cts +1 -1
  71. package/dist/utils/productEngineTypeMappers.d.ts +1 -1
  72. package/dist/utils/productEngineTypeMappers.js +1 -1
  73. package/dist/utils/productEngineTypeMappers.js.map +1 -1
  74. package/dist/utils/queryDataMappers.cjs +79 -90
  75. package/dist/utils/queryDataMappers.cjs.map +1 -1
  76. package/dist/utils/queryDataMappers.d.cts +1 -2
  77. package/dist/utils/queryDataMappers.d.ts +1 -2
  78. package/dist/utils/queryDataMappers.js +7 -19
  79. package/dist/utils/queryDataMappers.js.map +1 -1
  80. package/package.json +3 -4
  81. package/src/EngineBaseClient.ts +5 -3
  82. package/src/EngineExecuteBuilder.ts +14 -54
  83. package/src/EngineExecuteClient.ts +7 -15
  84. package/src/EngineQueryClient.ts +6 -35
  85. package/src/EngineWebClient.ts +0 -2
  86. package/src/endpoints.ts +4 -5
  87. package/src/types/EngineServerFailureError.ts +2 -2
  88. package/src/types/clientExecuteTypes.ts +5 -17
  89. package/src/types/clientQueryTypes.ts +18 -32
  90. package/src/types/serverExecuteTypes.ts +7 -18
  91. package/src/types/serverQueryModelTypes.ts +1 -1
  92. package/src/types/serverQueryTypes.ts +2 -16
  93. package/src/utils/productEngineTypeMappers.ts +1 -1
  94. package/src/utils/queryDataMappers.ts +7 -20
@@ -1,10 +1,9 @@
1
- import { MarketWithProduct } from '@nadohq/contracts';
1
+ import { MarketWithProduct } from '@nadohq/shared';
2
2
  import { EngineBaseClient } from './EngineBaseClient.cjs';
3
- import { GetEngineContractsResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineSymbolsParams, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineHealthGroupsResponse, GetEngineMinDepositRatesResponse, GetEngineOrderParams, GetEngineOrderResponse, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineInsuranceResponse } from './types/clientQueryTypes.cjs';
3
+ import { GetEngineContractsResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineSymbolsParams, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineHealthGroupsResponse, GetEngineOrderParams, GetEngineOrderResponse, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineInsuranceResponse } from './types/clientQueryTypes.cjs';
4
4
  import { EngineServerStatusResponse } from './types/serverQueryTypes.cjs';
5
5
  import 'axios';
6
6
  import './types/serverExecuteTypes.cjs';
7
- import '@nadohq/utils';
8
7
  import './types/serverQueryModelTypes.cjs';
9
8
 
10
9
  declare class EngineQueryClient extends EngineBaseClient {
@@ -53,10 +52,6 @@ declare class EngineQueryClient extends EngineBaseClient {
53
52
  * Retrieves all health groups (linked spot & perp products) from the engine
54
53
  */
55
54
  getHealthGroups(): Promise<GetEngineHealthGroupsResponse>;
56
- /**
57
- * Retrieves min deposit rates for all spot products from the engine
58
- */
59
- getMinDepositRates(): Promise<GetEngineMinDepositRatesResponse>;
60
55
  /**
61
56
  * Retrieves an order from the offchain engine
62
57
  *
@@ -132,12 +127,6 @@ declare class EngineQueryClient extends EngineBaseClient {
132
127
  * @returns
133
128
  */
134
129
  getInsurance(): Promise<GetEngineInsuranceResponse>;
135
- /**
136
- * Gets the orderbook contract address for a given product
137
- * @param productId
138
- * @returns
139
- */
140
- getOrderbookAddress(productId: number): Promise<string>;
141
130
  }
142
131
 
143
132
  export { EngineQueryClient };
@@ -1,10 +1,9 @@
1
- import { MarketWithProduct } from '@nadohq/contracts';
1
+ import { MarketWithProduct } from '@nadohq/shared';
2
2
  import { EngineBaseClient } from './EngineBaseClient.js';
3
- import { GetEngineContractsResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineSymbolsParams, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineHealthGroupsResponse, GetEngineMinDepositRatesResponse, GetEngineOrderParams, GetEngineOrderResponse, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineInsuranceResponse } from './types/clientQueryTypes.js';
3
+ import { GetEngineContractsResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineSymbolsParams, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineHealthGroupsResponse, GetEngineOrderParams, GetEngineOrderResponse, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineInsuranceResponse } from './types/clientQueryTypes.js';
4
4
  import { EngineServerStatusResponse } from './types/serverQueryTypes.js';
5
5
  import 'axios';
6
6
  import './types/serverExecuteTypes.js';
7
- import '@nadohq/utils';
8
7
  import './types/serverQueryModelTypes.js';
9
8
 
10
9
  declare class EngineQueryClient extends EngineBaseClient {
@@ -53,10 +52,6 @@ declare class EngineQueryClient extends EngineBaseClient {
53
52
  * Retrieves all health groups (linked spot & perp products) from the engine
54
53
  */
55
54
  getHealthGroups(): Promise<GetEngineHealthGroupsResponse>;
56
- /**
57
- * Retrieves min deposit rates for all spot products from the engine
58
- */
59
- getMinDepositRates(): Promise<GetEngineMinDepositRatesResponse>;
60
55
  /**
61
56
  * Retrieves an order from the offchain engine
62
57
  *
@@ -132,12 +127,6 @@ declare class EngineQueryClient extends EngineBaseClient {
132
127
  * @returns
133
128
  */
134
129
  getInsurance(): Promise<GetEngineInsuranceResponse>;
135
- /**
136
- * Gets the orderbook contract address for a given product
137
- * @param productId
138
- * @returns
139
- */
140
- getOrderbookAddress(productId: number): Promise<string>;
141
130
  }
142
131
 
143
132
  export { EngineQueryClient };
@@ -1,15 +1,14 @@
1
1
  // src/EngineQueryClient.ts
2
- import {
3
- encodeSignedOrder,
4
- subaccountToHex
5
- } from "@nadohq/contracts";
6
2
  import {
7
3
  addDecimals,
4
+ encodeSignedOrder,
5
+ getOrderVerifyingAddress,
8
6
  mapValues,
9
7
  removeDecimals,
8
+ subaccountToHex,
10
9
  toBigDecimal,
11
10
  toIntegerString
12
- } from "@nadohq/utils";
11
+ } from "@nadohq/shared";
13
12
  import { EngineBaseClient } from "./EngineBaseClient.js";
14
13
  import { mapProductEngineType } from "./utils/productEngineTypeMappers.js";
15
14
  import {
@@ -30,8 +29,7 @@ var EngineQueryClient = class extends EngineBaseClient {
30
29
  const baseResponse = await this.query("contracts", {});
31
30
  return {
32
31
  chainId: Number(baseResponse.chain_id),
33
- endpointAddr: baseResponse.endpoint_addr,
34
- orderbookAddrs: baseResponse.book_addrs
32
+ endpointAddr: baseResponse.endpoint_addr
35
33
  };
36
34
  }
37
35
  /**
@@ -163,20 +161,6 @@ var EngineQueryClient = class extends EngineBaseClient {
163
161
  )
164
162
  };
165
163
  }
166
- /**
167
- * Retrieves min deposit rates for all spot products from the engine
168
- */
169
- async getMinDepositRates() {
170
- const baseResponse = await this.query("min_deposit_rates", {});
171
- return {
172
- minDepositRates: mapValues(baseResponse.min_deposit_rates, (m) => {
173
- return {
174
- productId: m.product_id,
175
- minDepositRate: removeDecimals(m.min_deposit_rate_x18)
176
- };
177
- })
178
- };
179
- }
180
164
  /**
181
165
  * Retrieves an order from the offchain engine
182
166
  *
@@ -199,7 +183,7 @@ var EngineQueryClient = class extends EngineBaseClient {
199
183
  order: params.order,
200
184
  signature: await this.sign(
201
185
  "place_order",
202
- params.orderbookAddr,
186
+ getOrderVerifyingAddress(params.productId),
203
187
  params.chainId,
204
188
  params.order
205
189
  )
@@ -408,15 +392,6 @@ var EngineQueryClient = class extends EngineBaseClient {
408
392
  const baseResponse = await this.query("insurance", {});
409
393
  return toBigDecimal(baseResponse.insurance);
410
394
  }
411
- /**
412
- * Gets the orderbook contract address for a given product
413
- * @param productId
414
- * @returns
415
- */
416
- async getOrderbookAddress(productId) {
417
- const contracts = await this.getContracts();
418
- return contracts.orderbookAddrs[productId];
419
- }
420
395
  };
421
396
  export {
422
397
  EngineQueryClient
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/EngineQueryClient.ts"],"sourcesContent":["import {\n encodeSignedOrder,\n MarketWithProduct,\n subaccountToHex,\n} from '@nadohq/contracts';\nimport {\n addDecimals,\n BigDecimal,\n mapValues,\n removeDecimals,\n toBigDecimal,\n toIntegerString,\n} from '@nadohq/utils';\nimport { EngineBaseClient } from './EngineBaseClient';\nimport {\n EngineServerStatusResponse,\n EngineServerSubaccountInfoQueryParams,\n EngineSymbolsResponse,\n GetEngineAllMarketsResponse,\n GetEngineContractsResponse,\n GetEngineEstimatedSubaccountSummaryParams,\n GetEngineHealthGroupsResponse,\n GetEngineInsuranceResponse,\n GetEngineIsolatedPositionsParams,\n GetEngineIsolatedPositionsResponse,\n GetEngineLinkedSignerParams,\n GetEngineLinkedSignerResponse,\n GetEngineMarketLiquidityParams,\n GetEngineMarketLiquidityResponse,\n GetEngineMarketPriceParams,\n GetEngineMarketPriceResponse,\n GetEngineMarketPricesParams,\n GetEngineMarketPricesResponse,\n GetEngineMaxMintNlpAmountParams,\n GetEngineMaxMintNlpAmountResponse,\n GetEngineMaxOrderSizeParams,\n GetEngineMaxOrderSizeResponse,\n GetEngineMaxWithdrawableParams,\n GetEngineMaxWithdrawableResponse,\n GetEngineMinDepositRatesResponse,\n GetEngineOrderParams,\n GetEngineOrderResponse,\n GetEngineSubaccountFeeRatesParams,\n GetEngineSubaccountFeeRatesResponse,\n GetEngineSubaccountOrdersParams,\n GetEngineSubaccountOrdersResponse,\n GetEngineSubaccountProductOrdersParams,\n GetEngineSubaccountProductOrdersResponse,\n GetEngineSubaccountSummaryParams,\n GetEngineSubaccountSummaryResponse,\n GetEngineSymbolsParams,\n SubaccountOrderFeeRates,\n ValidateEngineOrderParams,\n ValidateEngineOrderResponse,\n ValidateSignedEngineOrderParams,\n} from './types';\nimport { mapProductEngineType } from './utils/productEngineTypeMappers';\nimport {\n mapEngineMarketPrice,\n mapEngineServerIsolatedPositions,\n mapEngineServerOrder,\n mapEngineServerPerpProduct,\n mapEngineServerSpotProduct,\n mapEngineServerSymbols,\n mapEngineServerTickLiquidity,\n mapSubaccountSummary,\n} from './utils/queryDataMappers';\n\nexport class EngineQueryClient extends EngineBaseClient {\n /**\n * Retrieves the set of contracts that the engine is interfacing with\n */\n async getContracts(): Promise<GetEngineContractsResponse> {\n const baseResponse = await this.query('contracts', {});\n return {\n chainId: Number(baseResponse.chain_id),\n endpointAddr: baseResponse.endpoint_addr,\n orderbookAddrs: baseResponse.book_addrs,\n };\n }\n\n /**\n * Retrieves current engine status\n */\n async getStatus(): Promise<EngineServerStatusResponse> {\n return this.query('status', {});\n }\n\n /**\n * Retrieves a subaccount summary reflective of the state within the offchain engine. This adheres to the\n * same return interface as the contract version\n *\n * @param params\n */\n async getSubaccountSummary(\n params: GetEngineSubaccountSummaryParams,\n ): Promise<GetEngineSubaccountSummaryResponse> {\n const subaccount = subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n });\n const baseResponse = await this.query('subaccount_info', {\n subaccount,\n });\n\n return mapSubaccountSummary(baseResponse);\n }\n\n /**\n * Retrieves a list of isolated positions\n *\n * @param params\n */\n async getIsolatedPositions(\n params: GetEngineIsolatedPositionsParams,\n ): Promise<GetEngineIsolatedPositionsResponse> {\n const subaccount = subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n });\n const baseResponse = await this.query('isolated_positions', {\n subaccount,\n });\n\n return mapEngineServerIsolatedPositions(baseResponse);\n }\n\n /**\n * Retrieves an estimated subaccount summary with the applied transactions\n *\n * @param params\n */\n async getEstimatedSubaccountSummary(\n params: GetEngineEstimatedSubaccountSummaryParams,\n ): Promise<GetEngineSubaccountSummaryResponse> {\n const subaccount = subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n });\n const queryParams: EngineServerSubaccountInfoQueryParams = {\n subaccount: subaccount,\n txns: params.txs.map(\n (\n tx,\n ): NonNullable<\n EngineServerSubaccountInfoQueryParams['txns']\n >[number] => {\n switch (tx.type) {\n case 'apply_delta':\n return {\n apply_delta: {\n product_id: tx.tx.productId,\n subaccount,\n amount_delta: toIntegerString(tx.tx.amountDelta),\n v_quote_delta: toIntegerString(tx.tx.vQuoteDelta),\n },\n };\n }\n },\n ),\n };\n const baseResponse = await this.query('subaccount_info', {\n subaccount: queryParams.subaccount,\n txns: JSON.stringify(queryParams.txns),\n });\n\n return mapSubaccountSummary(baseResponse);\n }\n\n /**\n * Retrieves symbols and product info\n *\n * @param params\n */\n async getSymbols(\n params: GetEngineSymbolsParams,\n ): Promise<EngineSymbolsResponse> {\n const baseResponse = await this.query('symbols', {\n product_ids: params.productIds,\n product_type:\n params.productType != null\n ? mapProductEngineType(params.productType)\n : undefined,\n });\n return mapEngineServerSymbols(baseResponse);\n }\n\n /**\n * Retrieves all market states as per the offchain engine. Same return interface as contracts\n */\n async getAllMarkets(): Promise<GetEngineAllMarketsResponse> {\n const markets: MarketWithProduct[] = [];\n\n const baseResponse = await this.query('all_products', {});\n baseResponse.spot_products.forEach((spotProduct) => {\n markets.push(mapEngineServerSpotProduct(spotProduct));\n });\n baseResponse.perp_products.forEach((perpProduct) => {\n markets.push(mapEngineServerPerpProduct(perpProduct));\n });\n\n return markets;\n }\n\n /**\n * Retrieves all markets by chain id.\n */\n async getEdgeAllMarkets(): Promise<Record<number, MarketWithProduct[]>> {\n const baseResponse = await this.query('edge_all_products', {});\n\n return mapValues(baseResponse.edge_all_products, (allProducts) => {\n const markets: MarketWithProduct[] = [];\n\n allProducts.spot_products.forEach((spotProduct) => {\n markets.push(mapEngineServerSpotProduct(spotProduct));\n });\n\n allProducts.perp_products.forEach((perpProduct) => {\n markets.push(mapEngineServerPerpProduct(perpProduct));\n });\n\n return markets;\n });\n }\n\n /**\n * Retrieves all health groups (linked spot & perp products) from the engine\n */\n async getHealthGroups(): Promise<GetEngineHealthGroupsResponse> {\n const baseResponse = await this.query('health_groups', {});\n\n return {\n healthGroups: baseResponse.health_groups.map(\n ([spotProductId, perpProductId]) => {\n return {\n spotProductId,\n perpProductId,\n };\n },\n ),\n };\n }\n\n /**\n * Retrieves min deposit rates for all spot products from the engine\n */\n async getMinDepositRates(): Promise<GetEngineMinDepositRatesResponse> {\n const baseResponse = await this.query('min_deposit_rates', {});\n\n return {\n minDepositRates: mapValues(baseResponse.min_deposit_rates, (m) => {\n return {\n productId: m.product_id,\n minDepositRate: removeDecimals(m.min_deposit_rate_x18),\n };\n }),\n };\n }\n\n /**\n * Retrieves an order from the offchain engine\n *\n * @param params\n */\n async getOrder(\n params: GetEngineOrderParams,\n ): Promise<GetEngineOrderResponse> {\n const baseResponse = await this.query('order', {\n digest: params.digest,\n product_id: params.productId,\n });\n\n return mapEngineServerOrder(baseResponse);\n }\n\n /**\n * Signs and validates with the engine that the order is valid to be submitted (i.e. does not violate health reqs)\n *\n * @param params\n */\n async validateOrderParams(\n params: ValidateEngineOrderParams,\n ): Promise<ValidateEngineOrderResponse> {\n const signedOrder = {\n order: params.order,\n signature: await this.sign(\n 'place_order',\n params.orderbookAddr,\n params.chainId,\n params.order,\n ),\n };\n return this.validateSignedOrderParams({\n signedOrder,\n productId: params.productId,\n });\n }\n\n /**\n * Validates an existing signed order with the engine as a pre-check for health\n *\n * @param params\n */\n async validateSignedOrderParams(\n params: ValidateSignedEngineOrderParams,\n ): Promise<ValidateEngineOrderResponse> {\n const baseResponse = await this.query('validate_order', {\n product_id: params.productId,\n order: encodeSignedOrder(params.signedOrder),\n });\n\n return {\n productId: baseResponse.product_id,\n valid: baseResponse.valid,\n };\n }\n\n /**\n * Get all subaccount orders from the engine, per product ID\n * @param params\n */\n async getSubaccountOrders(\n params: GetEngineSubaccountOrdersParams,\n ): Promise<GetEngineSubaccountOrdersResponse> {\n const baseResponse = await this.query('subaccount_orders', {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n product_id: params.productId,\n });\n\n return {\n orders: baseResponse.orders.map(mapEngineServerOrder),\n productId: params.productId,\n };\n }\n\n /**\n * Get all subaccount orders from the engine, for multiple products\n * @param params\n */\n async getSubaccountMultiProductOrders(\n params: GetEngineSubaccountProductOrdersParams,\n ): Promise<GetEngineSubaccountProductOrdersResponse> {\n const baseResponse = await this.query('orders', {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n product_ids: params.productIds,\n });\n\n return {\n productOrders: baseResponse.product_orders.map((orders) => {\n return {\n orders: orders.orders.map(mapEngineServerOrder),\n productId: orders.product_id,\n };\n }),\n };\n }\n\n /**\n * Gets maker & taker fee rates for order fees\n * @param params\n */\n async getSubaccountFeeRates(\n params: GetEngineSubaccountFeeRatesParams,\n ): Promise<GetEngineSubaccountFeeRatesResponse> {\n const baseResponse = await this.query('fee_rates', {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n });\n\n return {\n healthCheckSequencerFee: toBigDecimal(\n baseResponse.health_check_sequencer_fee,\n ),\n liquidationSequencerFee: toBigDecimal(\n baseResponse.liquidation_sequencer_fee,\n ),\n takerSequencerFee: toBigDecimal(baseResponse.taker_sequencer_fee),\n orders: baseResponse.taker_fee_rates_x18.reduce(\n (acc, takerRateX18, currIndex) => {\n acc[currIndex] = {\n taker: removeDecimals(takerRateX18),\n maker: removeDecimals(baseResponse.maker_fee_rates_x18[currIndex]),\n };\n return acc;\n },\n {} as Record<number, SubaccountOrderFeeRates>,\n ),\n withdrawal: baseResponse.withdraw_sequencer_fees.reduce(\n (acc, productFee, currIndex) => {\n acc[currIndex] = toBigDecimal(productFee);\n return acc;\n },\n {} as Record<number, BigDecimal>,\n ),\n };\n }\n\n /**\n * Gets \"price ticks\" for a given market, useful for constructing liquidity levels at each price\n * @param params\n */\n async getMarketLiquidity(\n params: GetEngineMarketLiquidityParams,\n ): Promise<GetEngineMarketLiquidityResponse> {\n const baseResponse = await this.query('market_liquidity', {\n product_id: params.productId,\n depth: params.depth,\n });\n return {\n asks: baseResponse.asks.map(mapEngineServerTickLiquidity),\n bids: baseResponse.bids.map(mapEngineServerTickLiquidity),\n };\n }\n\n /**\n * Retrieves the latest price for a given market\n * @param params\n */\n async getMarketPrice(\n params: GetEngineMarketPriceParams,\n ): Promise<GetEngineMarketPriceResponse> {\n const baseResponse = await this.query('market_price', {\n product_id: params.productId,\n });\n return mapEngineMarketPrice(baseResponse);\n }\n\n /**\n * Retrieves the latest prices for provided markets\n * @param params\n */\n async getMarketPrices(\n params: GetEngineMarketPricesParams,\n ): Promise<GetEngineMarketPricesResponse> {\n const baseResponse = await this.query('market_prices', {\n product_ids: params.productIds,\n });\n return {\n marketPrices: baseResponse.market_prices.map(mapEngineMarketPrice),\n };\n }\n\n /**\n * Retrieves the estimated max order size for a product\n * @param params\n */\n async getMaxOrderSize(\n params: GetEngineMaxOrderSizeParams,\n ): Promise<GetEngineMaxOrderSizeResponse> {\n const baseResponse = await this.query('max_order_size', {\n direction: params.side,\n price_x18: toIntegerString(addDecimals(params.price)),\n product_id: params.productId,\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n spot_leverage:\n params.spotLeverage != null ? String(params.spotLeverage) : null,\n reduce_only: params.reduceOnly != null ? String(params.reduceOnly) : null,\n });\n\n return toBigDecimal(baseResponse.max_order_size);\n }\n\n /**\n * Retrieves the estimated max withdrawal size for a product\n * @param params\n */\n async getMaxWithdrawable(\n params: GetEngineMaxWithdrawableParams,\n ): Promise<GetEngineMaxWithdrawableResponse> {\n const baseResponse = await this.query('max_withdrawable', {\n product_id: params.productId,\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n spot_leverage:\n params.spotLeverage != null ? String(params.spotLeverage) : null,\n });\n\n return toBigDecimal(baseResponse.max_withdrawable);\n }\n\n /**\n * Retrieves the estimated max quote amount for minting NLP.\n *\n * @param params\n */\n async getMaxMintNlpAmount(\n params: GetEngineMaxMintNlpAmountParams,\n ): Promise<GetEngineMaxMintNlpAmountResponse> {\n const baseResponse = await this.query('max_nlp_mintable', {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n spot_leverage:\n params.spotLeverage != null ? String(params.spotLeverage) : null,\n });\n\n return toBigDecimal(baseResponse.max_quote_amount);\n }\n\n /**\n * Gets the currently linked signer for the subaccount\n * @param params\n * @returns\n */\n public async getLinkedSigner(\n params: GetEngineLinkedSignerParams,\n ): Promise<GetEngineLinkedSignerResponse> {\n const baseResponse = await this.query('linked_signer', {\n subaccount: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n });\n\n return {\n signer: baseResponse.linked_signer,\n };\n }\n\n /**\n * Gets the insurance funds in USDC.\n * @returns\n */\n public async getInsurance(): Promise<GetEngineInsuranceResponse> {\n const baseResponse = await this.query('insurance', {});\n\n return toBigDecimal(baseResponse.insurance);\n }\n\n /**\n * Gets the orderbook contract address for a given product\n * @param productId\n * @returns\n */\n public async getOrderbookAddress(productId: number): Promise<string> {\n const contracts = await this.getContracts();\n return contracts.orderbook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oB;AAAA,MACxD,QAAQ,gBAAgB;AAAA,QACtB,iBAAiB,OAAO;AAAA,QACxB,gBAAgB,OAAO;AAAA,MACzB,CAAC;AAAA,MACD,eACE,OAAO,gBAAgB,OAAO,OAAO,OAAO,YAAY,IAAI;AAAA,IAChE,CAAC;AAED,WAAO,aAAa,aAAa,gBAAgB;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAa,gBACX,QACwC;AACxC,UAAM,eAAe,MAAM,KAAK,MAAM,iBAAiB;AAAA,MACrD,YAAY,gBAAgB;AAAA,QAC1B,iBAAiB,OAAO;AAAA,QACxB,gBAAgB,OAAO;AAAA,MACzB,CAAC;AAAA,IACH,CAAC;AAED,WAAO;AAAA,MACL,QAAQ,aAAa;AAAA,IACvB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAa,eAAoD;AAC/D,UAAM,eAAe,MAAM,KAAK,MAAM,aAAa,CAAC,CAAC;AAErD,WAAO,aAAa,aAAa,SAAS;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAa,oBAAoB,WAAoC;AACnE,UAAM,YAAY,MAAM,KAAK,aAAa;AAC1C,WAAO,UAAU,eAAe,SAAS;AAAA,EAC3C;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/EngineQueryClient.ts"],"sourcesContent":["import {\n addDecimals,\n BigDecimal,\n encodeSignedOrder,\n getOrderVerifyingAddress,\n mapValues,\n MarketWithProduct,\n removeDecimals,\n subaccountToHex,\n toBigDecimal,\n toIntegerString,\n} from '@nadohq/shared';\nimport { EngineBaseClient } from './EngineBaseClient';\nimport {\n EngineServerStatusResponse,\n EngineServerSubaccountInfoQueryParams,\n EngineSymbolsResponse,\n GetEngineAllMarketsResponse,\n GetEngineContractsResponse,\n GetEngineEstimatedSubaccountSummaryParams,\n GetEngineHealthGroupsResponse,\n GetEngineInsuranceResponse,\n GetEngineIsolatedPositionsParams,\n GetEngineIsolatedPositionsResponse,\n GetEngineLinkedSignerParams,\n GetEngineLinkedSignerResponse,\n GetEngineMarketLiquidityParams,\n GetEngineMarketLiquidityResponse,\n GetEngineMarketPriceParams,\n GetEngineMarketPriceResponse,\n GetEngineMarketPricesParams,\n GetEngineMarketPricesResponse,\n GetEngineMaxMintNlpAmountParams,\n GetEngineMaxMintNlpAmountResponse,\n GetEngineMaxOrderSizeParams,\n GetEngineMaxOrderSizeResponse,\n GetEngineMaxWithdrawableParams,\n GetEngineMaxWithdrawableResponse,\n GetEngineOrderParams,\n GetEngineOrderResponse,\n GetEngineSubaccountFeeRatesParams,\n GetEngineSubaccountFeeRatesResponse,\n GetEngineSubaccountOrdersParams,\n GetEngineSubaccountOrdersResponse,\n GetEngineSubaccountProductOrdersParams,\n GetEngineSubaccountProductOrdersResponse,\n GetEngineSubaccountSummaryParams,\n GetEngineSubaccountSummaryResponse,\n GetEngineSymbolsParams,\n SubaccountOrderFeeRates,\n ValidateEngineOrderParams,\n ValidateEngineOrderResponse,\n ValidateSignedEngineOrderParams,\n} from './types';\nimport { mapProductEngineType } from './utils/productEngineTypeMappers';\nimport {\n mapEngineMarketPrice,\n mapEngineServerIsolatedPositions,\n mapEngineServerOrder,\n mapEngineServerPerpProduct,\n mapEngineServerSpotProduct,\n mapEngineServerSymbols,\n mapEngineServerTickLiquidity,\n mapSubaccountSummary,\n} from './utils/queryDataMappers';\n\nexport class EngineQueryClient extends EngineBaseClient {\n /**\n * Retrieves the set of contracts that the engine is interfacing with\n */\n async getContracts(): Promise<GetEngineContractsResponse> {\n const baseResponse = await this.query('contracts', {});\n return {\n chainId: Number(baseResponse.chain_id),\n endpointAddr: baseResponse.endpoint_addr,\n };\n }\n\n /**\n * Retrieves current engine status\n */\n async getStatus(): Promise<EngineServerStatusResponse> {\n return this.query('status', {});\n }\n\n /**\n * Retrieves a subaccount summary reflective of the state within the offchain engine. This adheres to the\n * same return interface as the contract version\n *\n * @param params\n */\n async getSubaccountSummary(\n params: GetEngineSubaccountSummaryParams,\n ): Promise<GetEngineSubaccountSummaryResponse> {\n const subaccount = subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n });\n const baseResponse = await this.query('subaccount_info', {\n subaccount,\n });\n\n return mapSubaccountSummary(baseResponse);\n }\n\n /**\n * Retrieves a list of isolated positions\n *\n * @param params\n */\n async getIsolatedPositions(\n params: GetEngineIsolatedPositionsParams,\n ): Promise<GetEngineIsolatedPositionsResponse> {\n const subaccount = subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n });\n const baseResponse = await this.query('isolated_positions', {\n subaccount,\n });\n\n return mapEngineServerIsolatedPositions(baseResponse);\n }\n\n /**\n * Retrieves an estimated subaccount summary with the applied transactions\n *\n * @param params\n */\n async getEstimatedSubaccountSummary(\n params: GetEngineEstimatedSubaccountSummaryParams,\n ): Promise<GetEngineSubaccountSummaryResponse> {\n const subaccount = subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n });\n const queryParams: EngineServerSubaccountInfoQueryParams = {\n subaccount: subaccount,\n txns: params.txs.map(\n (\n tx,\n ): NonNullable<\n EngineServerSubaccountInfoQueryParams['txns']\n >[number] => {\n switch (tx.type) {\n case 'apply_delta':\n return {\n apply_delta: {\n product_id: tx.tx.productId,\n subaccount,\n amount_delta: toIntegerString(tx.tx.amountDelta),\n v_quote_delta: toIntegerString(tx.tx.vQuoteDelta),\n },\n };\n }\n },\n ),\n };\n const baseResponse = await this.query('subaccount_info', {\n subaccount: queryParams.subaccount,\n txns: JSON.stringify(queryParams.txns),\n });\n\n return mapSubaccountSummary(baseResponse);\n }\n\n /**\n * Retrieves symbols and product info\n *\n * @param params\n */\n async getSymbols(\n params: GetEngineSymbolsParams,\n ): Promise<EngineSymbolsResponse> {\n const baseResponse = await this.query('symbols', {\n product_ids: params.productIds,\n product_type:\n params.productType != null\n ? mapProductEngineType(params.productType)\n : undefined,\n });\n return mapEngineServerSymbols(baseResponse);\n }\n\n /**\n * Retrieves all market states as per the offchain engine. Same return interface as contracts\n */\n async getAllMarkets(): Promise<GetEngineAllMarketsResponse> {\n const markets: MarketWithProduct[] = [];\n\n const baseResponse = await this.query('all_products', {});\n baseResponse.spot_products.forEach((spotProduct) => {\n markets.push(mapEngineServerSpotProduct(spotProduct));\n });\n baseResponse.perp_products.forEach((perpProduct) => {\n markets.push(mapEngineServerPerpProduct(perpProduct));\n });\n\n return markets;\n }\n\n /**\n * Retrieves all markets by chain id.\n */\n async getEdgeAllMarkets(): Promise<Record<number, MarketWithProduct[]>> {\n const baseResponse = await this.query('edge_all_products', {});\n\n return mapValues(baseResponse.edge_all_products, (allProducts) => {\n const markets: MarketWithProduct[] = [];\n\n allProducts.spot_products.forEach((spotProduct) => {\n markets.push(mapEngineServerSpotProduct(spotProduct));\n });\n\n allProducts.perp_products.forEach((perpProduct) => {\n markets.push(mapEngineServerPerpProduct(perpProduct));\n });\n\n return markets;\n });\n }\n\n /**\n * Retrieves all health groups (linked spot & perp products) from the engine\n */\n async getHealthGroups(): Promise<GetEngineHealthGroupsResponse> {\n const baseResponse = await this.query('health_groups', {});\n\n return {\n healthGroups: baseResponse.health_groups.map(\n ([spotProductId, perpProductId]) => {\n return {\n spotProductId,\n perpProductId,\n };\n },\n ),\n };\n }\n\n /**\n * Retrieves an order from the offchain engine\n *\n * @param params\n */\n async getOrder(\n params: GetEngineOrderParams,\n ): Promise<GetEngineOrderResponse> {\n const baseResponse = await this.query('order', {\n digest: params.digest,\n product_id: params.productId,\n });\n\n return mapEngineServerOrder(baseResponse);\n }\n\n /**\n * Signs and validates with the engine that the order is valid to be submitted (i.e. does not violate health reqs)\n *\n * @param params\n */\n async validateOrderParams(\n params: ValidateEngineOrderParams,\n ): Promise<ValidateEngineOrderResponse> {\n const signedOrder = {\n order: params.order,\n signature: await this.sign(\n 'place_order',\n getOrderVerifyingAddress(params.productId),\n params.chainId,\n params.order,\n ),\n };\n return this.validateSignedOrderParams({\n signedOrder,\n productId: params.productId,\n });\n }\n\n /**\n * Validates an existing signed order with the engine as a pre-check for health\n *\n * @param params\n */\n async validateSignedOrderParams(\n params: ValidateSignedEngineOrderParams,\n ): Promise<ValidateEngineOrderResponse> {\n const baseResponse = await this.query('validate_order', {\n product_id: params.productId,\n order: encodeSignedOrder(params.signedOrder),\n });\n\n return {\n productId: baseResponse.product_id,\n valid: baseResponse.valid,\n };\n }\n\n /**\n * Get all subaccount orders from the engine, per product ID\n * @param params\n */\n async getSubaccountOrders(\n params: GetEngineSubaccountOrdersParams,\n ): Promise<GetEngineSubaccountOrdersResponse> {\n const baseResponse = await this.query('subaccount_orders', {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n product_id: params.productId,\n });\n\n return {\n orders: baseResponse.orders.map(mapEngineServerOrder),\n productId: params.productId,\n };\n }\n\n /**\n * Get all subaccount orders from the engine, for multiple products\n * @param params\n */\n async getSubaccountMultiProductOrders(\n params: GetEngineSubaccountProductOrdersParams,\n ): Promise<GetEngineSubaccountProductOrdersResponse> {\n const baseResponse = await this.query('orders', {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n product_ids: params.productIds,\n });\n\n return {\n productOrders: baseResponse.product_orders.map((orders) => {\n return {\n orders: orders.orders.map(mapEngineServerOrder),\n productId: orders.product_id,\n };\n }),\n };\n }\n\n /**\n * Gets maker & taker fee rates for order fees\n * @param params\n */\n async getSubaccountFeeRates(\n params: GetEngineSubaccountFeeRatesParams,\n ): Promise<GetEngineSubaccountFeeRatesResponse> {\n const baseResponse = await this.query('fee_rates', {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n });\n\n return {\n healthCheckSequencerFee: toBigDecimal(\n baseResponse.health_check_sequencer_fee,\n ),\n liquidationSequencerFee: toBigDecimal(\n baseResponse.liquidation_sequencer_fee,\n ),\n takerSequencerFee: toBigDecimal(baseResponse.taker_sequencer_fee),\n orders: baseResponse.taker_fee_rates_x18.reduce(\n (acc, takerRateX18, currIndex) => {\n acc[currIndex] = {\n taker: removeDecimals(takerRateX18),\n maker: removeDecimals(baseResponse.maker_fee_rates_x18[currIndex]),\n };\n return acc;\n },\n {} as Record<number, SubaccountOrderFeeRates>,\n ),\n withdrawal: baseResponse.withdraw_sequencer_fees.reduce(\n (acc, productFee, currIndex) => {\n acc[currIndex] = toBigDecimal(productFee);\n return acc;\n },\n {} as Record<number, BigDecimal>,\n ),\n };\n }\n\n /**\n * Gets \"price ticks\" for a given market, useful for constructing liquidity levels at each price\n * @param params\n */\n async getMarketLiquidity(\n params: GetEngineMarketLiquidityParams,\n ): Promise<GetEngineMarketLiquidityResponse> {\n const baseResponse = await this.query('market_liquidity', {\n product_id: params.productId,\n depth: params.depth,\n });\n return {\n asks: baseResponse.asks.map(mapEngineServerTickLiquidity),\n bids: baseResponse.bids.map(mapEngineServerTickLiquidity),\n };\n }\n\n /**\n * Retrieves the latest price for a given market\n * @param params\n */\n async getMarketPrice(\n params: GetEngineMarketPriceParams,\n ): Promise<GetEngineMarketPriceResponse> {\n const baseResponse = await this.query('market_price', {\n product_id: params.productId,\n });\n return mapEngineMarketPrice(baseResponse);\n }\n\n /**\n * Retrieves the latest prices for provided markets\n * @param params\n */\n async getMarketPrices(\n params: GetEngineMarketPricesParams,\n ): Promise<GetEngineMarketPricesResponse> {\n const baseResponse = await this.query('market_prices', {\n product_ids: params.productIds,\n });\n return {\n marketPrices: baseResponse.market_prices.map(mapEngineMarketPrice),\n };\n }\n\n /**\n * Retrieves the estimated max order size for a product\n * @param params\n */\n async getMaxOrderSize(\n params: GetEngineMaxOrderSizeParams,\n ): Promise<GetEngineMaxOrderSizeResponse> {\n const baseResponse = await this.query('max_order_size', {\n direction: params.side,\n price_x18: toIntegerString(addDecimals(params.price)),\n product_id: params.productId,\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n spot_leverage:\n params.spotLeverage != null ? String(params.spotLeverage) : null,\n reduce_only: params.reduceOnly != null ? String(params.reduceOnly) : null,\n });\n\n return toBigDecimal(baseResponse.max_order_size);\n }\n\n /**\n * Retrieves the estimated max withdrawal size for a product\n * @param params\n */\n async getMaxWithdrawable(\n params: GetEngineMaxWithdrawableParams,\n ): Promise<GetEngineMaxWithdrawableResponse> {\n const baseResponse = await this.query('max_withdrawable', {\n product_id: params.productId,\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n spot_leverage:\n params.spotLeverage != null ? String(params.spotLeverage) : null,\n });\n\n return toBigDecimal(baseResponse.max_withdrawable);\n }\n\n /**\n * Retrieves the estimated max quote amount for minting NLP.\n *\n * @param params\n */\n async getMaxMintNlpAmount(\n params: GetEngineMaxMintNlpAmountParams,\n ): Promise<GetEngineMaxMintNlpAmountResponse> {\n const baseResponse = await this.query('max_nlp_mintable', {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n spot_leverage:\n params.spotLeverage != null ? String(params.spotLeverage) : null,\n });\n\n return toBigDecimal(baseResponse.max_quote_amount);\n }\n\n /**\n * Gets the currently linked signer for the subaccount\n * @param params\n * @returns\n */\n public async getLinkedSigner(\n params: GetEngineLinkedSignerParams,\n ): Promise<GetEngineLinkedSignerResponse> {\n const baseResponse = await this.query('linked_signer', {\n subaccount: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n });\n\n return {\n signer: baseResponse.linked_signer,\n };\n }\n\n /**\n * Gets the insurance funds in USDC.\n * @returns\n */\n public async getInsurance(): Promise<GetEngineInsuranceResponse> {\n const baseResponse = await this.query('insurance', {});\n\n return toBigDecimal(baseResponse.insurance);\n }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;A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IACH,CAAC;AAED,WAAO;AAAA,MACL,QAAQ,aAAa;AAAA,IACvB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAa,eAAoD;AAC/D,UAAM,eAAe,MAAM,KAAK,MAAM,aAAa,CAAC,CAAC;AAErD,WAAO,aAAa,aAAa,SAAS;AAAA,EAC5C;AACF;","names":[]}
@@ -30,8 +30,6 @@ var EngineWebClient = class extends import_EngineBaseClient.EngineBaseClient {
30
30
  */
31
31
  async getIpBlockStatus() {
32
32
  return this.axiosInstance.get(`${this.opts.url}/ip`, {
33
- // Allow all statuses
34
- validateStatus: () => true,
35
33
  // IP checks go through Cloudflare, which uses allow-origin as *, so withCredentials needs to be false
36
34
  withCredentials: false
37
35
  }).then((res) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/EngineWebClient.ts"],"sourcesContent":["import { EngineBaseClient } from './EngineBaseClient';\nimport {\n EngineServerIpBlockResponse,\n GetEngineIpBlockStatusResponse,\n GetEngineTimeResponse,\n} from './types';\n\n/**\n * Queries that talk directly to web, _not_ the engine. Placing here in the `engine-client` as we don't have enough\n * use cases to justify a separate package\n */\nexport class EngineWebClient extends EngineBaseClient {\n /**\n * Determines the IP block status for the current client\n */\n async getIpBlockStatus(): Promise<GetEngineIpBlockStatusResponse> {\n return (\n this.axiosInstance\n // Use the /time endpoint and listen to 403 responses\n .get(`${this.opts.url}/ip`, {\n // Allow all statuses\n validateStatus: () => true,\n // IP checks go through Cloudflare, which uses allow-origin as *, so withCredentials needs to be false\n withCredentials: false,\n })\n .then((res) => {\n if (res.status !== 403) {\n return null;\n }\n const resData = res.data as EngineServerIpBlockResponse;\n\n if (!resData.blocked) {\n return null;\n }\n\n return resData.reason === 'ip_query_only' ? 'query_only' : 'blocked';\n })\n );\n }\n\n /**\n * Determines whether a client needs to complete the cloudflare JS challenge to interact with the API\n *\n * @return true if the client needs to complete the JS challenge at '/challenge', false otherwise\n */\n async getRequiresCloudflareAuth(): Promise<boolean> {\n // We use a generic endpoint and check for the CF challenge header\n // Note: this uses a CORS set to the relevant frontend endpoint (ex. testnet.vertexprotocol.com) so it will NOT\n // work from other domains\n return this.axiosInstance\n .get(`${this.opts.url}/cf-check`, {\n // Allow all statuses\n validateStatus: () => true,\n })\n .then((res) => {\n if (res.status !== 403) {\n return false;\n }\n\n return res.headers['cf-mitigated'] === 'challenge';\n });\n }\n\n /**\n * Retrieves current server epoch in milliseconds\n */\n async getTime(): Promise<GetEngineTimeResponse> {\n return this.axiosInstance\n .get(`${this.opts.url}/time`)\n .then((res) => res.data as GetEngineTimeResponse);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAiC;AAW1B,IAAM,kBAAN,cAA8B,yCAAiB;AAAA;AAAA;AAAA;AAAA,EAIpD,MAAM,mBAA4D;AAChE,WACE,KAAK,cAEF,IAAI,GAAG,KAAK,KAAK,GAAG,OAAO;AAAA;AAAA,MAE1B,gBAAgB,MAAM;AAAA;AAAA,MAEtB,iBAAiB;AAAA,IACnB,CAAC,EACA,KAAK,CAAC,QAAQ;AACb,UAAI,IAAI,WAAW,KAAK;AACtB,eAAO;AAAA,MACT;AACA,YAAM,UAAU,IAAI;AAEpB,UAAI,CAAC,QAAQ,SAAS;AACpB,eAAO;AAAA,MACT;AAEA,aAAO,QAAQ,WAAW,kBAAkB,eAAe;AAAA,IAC7D,CAAC;AAAA,EAEP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,4BAA8C;AAIlD,WAAO,KAAK,cACT,IAAI,GAAG,KAAK,KAAK,GAAG,aAAa;AAAA;AAAA,MAEhC,gBAAgB,MAAM;AAAA,IACxB,CAAC,EACA,KAAK,CAAC,QAAQ;AACb,UAAI,IAAI,WAAW,KAAK;AACtB,eAAO;AAAA,MACT;AAEA,aAAO,IAAI,QAAQ,cAAc,MAAM;AAAA,IACzC,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,UAA0C;AAC9C,WAAO,KAAK,cACT,IAAI,GAAG,KAAK,KAAK,GAAG,OAAO,EAC3B,KAAK,CAAC,QAAQ,IAAI,IAA6B;AAAA,EACpD;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/EngineWebClient.ts"],"sourcesContent":["import { EngineBaseClient } from './EngineBaseClient';\nimport {\n EngineServerIpBlockResponse,\n GetEngineIpBlockStatusResponse,\n GetEngineTimeResponse,\n} from './types';\n\n/**\n * Queries that talk directly to web, _not_ the engine. Placing here in the `engine-client` as we don't have enough\n * use cases to justify a separate package\n */\nexport class EngineWebClient extends EngineBaseClient {\n /**\n * Determines the IP block status for the current client\n */\n async getIpBlockStatus(): Promise<GetEngineIpBlockStatusResponse> {\n return (\n this.axiosInstance\n // Use the /time endpoint and listen to 403 responses\n .get(`${this.opts.url}/ip`, {\n // IP checks go through Cloudflare, which uses allow-origin as *, so withCredentials needs to be false\n withCredentials: false,\n })\n .then((res) => {\n if (res.status !== 403) {\n return null;\n }\n const resData = res.data as EngineServerIpBlockResponse;\n\n if (!resData.blocked) {\n return null;\n }\n\n return resData.reason === 'ip_query_only' ? 'query_only' : 'blocked';\n })\n );\n }\n\n /**\n * Determines whether a client needs to complete the cloudflare JS challenge to interact with the API\n *\n * @return true if the client needs to complete the JS challenge at '/challenge', false otherwise\n */\n async getRequiresCloudflareAuth(): Promise<boolean> {\n // We use a generic endpoint and check for the CF challenge header\n // Note: this uses a CORS set to the relevant frontend endpoint (ex. testnet.vertexprotocol.com) so it will NOT\n // work from other domains\n return this.axiosInstance\n .get(`${this.opts.url}/cf-check`, {\n // Allow all statuses\n validateStatus: () => true,\n })\n .then((res) => {\n if (res.status !== 403) {\n return false;\n }\n\n return res.headers['cf-mitigated'] === 'challenge';\n });\n }\n\n /**\n * Retrieves current server epoch in milliseconds\n */\n async getTime(): Promise<GetEngineTimeResponse> {\n return this.axiosInstance\n .get(`${this.opts.url}/time`)\n .then((res) => res.data as GetEngineTimeResponse);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAiC;AAW1B,IAAM,kBAAN,cAA8B,yCAAiB;AAAA;AAAA;AAAA;AAAA,EAIpD,MAAM,mBAA4D;AAChE,WACE,KAAK,cAEF,IAAI,GAAG,KAAK,KAAK,GAAG,OAAO;AAAA;AAAA,MAE1B,iBAAiB;AAAA,IACnB,CAAC,EACA,KAAK,CAAC,QAAQ;AACb,UAAI,IAAI,WAAW,KAAK;AACtB,eAAO;AAAA,MACT;AACA,YAAM,UAAU,IAAI;AAEpB,UAAI,CAAC,QAAQ,SAAS;AACpB,eAAO;AAAA,MACT;AAEA,aAAO,QAAQ,WAAW,kBAAkB,eAAe;AAAA,IAC7D,CAAC;AAAA,EAEP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,4BAA8C;AAIlD,WAAO,KAAK,cACT,IAAI,GAAG,KAAK,KAAK,GAAG,aAAa;AAAA;AAAA,MAEhC,gBAAgB,MAAM;AAAA,IACxB,CAAC,EACA,KAAK,CAAC,QAAQ;AACb,UAAI,IAAI,WAAW,KAAK;AACtB,eAAO;AAAA,MACT;AAEA,aAAO,IAAI,QAAQ,cAAc,MAAM;AAAA,IACzC,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,UAA0C;AAC9C,WAAO,KAAK,cACT,IAAI,GAAG,KAAK,KAAK,GAAG,OAAO,EAC3B,KAAK,CAAC,QAAQ,IAAI,IAA6B;AAAA,EACpD;AACF;","names":[]}
@@ -1,11 +1,10 @@
1
1
  import { EngineBaseClient } from './EngineBaseClient.cjs';
2
2
  import { GetEngineIpBlockStatusResponse, GetEngineTimeResponse } from './types/clientQueryTypes.cjs';
3
- import '@nadohq/contracts';
3
+ import '@nadohq/shared';
4
4
  import 'axios';
5
5
  import './types/serverExecuteTypes.cjs';
6
6
  import './types/serverQueryTypes.cjs';
7
7
  import './types/serverQueryModelTypes.cjs';
8
- import '@nadohq/utils';
9
8
 
10
9
  /**
11
10
  * Queries that talk directly to web, _not_ the engine. Placing here in the `engine-client` as we don't have enough
@@ -1,11 +1,10 @@
1
1
  import { EngineBaseClient } from './EngineBaseClient.js';
2
2
  import { GetEngineIpBlockStatusResponse, GetEngineTimeResponse } from './types/clientQueryTypes.js';
3
- import '@nadohq/contracts';
3
+ import '@nadohq/shared';
4
4
  import 'axios';
5
5
  import './types/serverExecuteTypes.js';
6
6
  import './types/serverQueryTypes.js';
7
7
  import './types/serverQueryModelTypes.js';
8
- import '@nadohq/utils';
9
8
 
10
9
  /**
11
10
  * Queries that talk directly to web, _not_ the engine. Placing here in the `engine-client` as we don't have enough
@@ -6,8 +6,6 @@ var EngineWebClient = class extends EngineBaseClient {
6
6
  */
7
7
  async getIpBlockStatus() {
8
8
  return this.axiosInstance.get(`${this.opts.url}/ip`, {
9
- // Allow all statuses
10
- validateStatus: () => true,
11
9
  // IP checks go through Cloudflare, which uses allow-origin as *, so withCredentials needs to be false
12
10
  withCredentials: false
13
11
  }).then((res) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/EngineWebClient.ts"],"sourcesContent":["import { EngineBaseClient } from './EngineBaseClient';\nimport {\n EngineServerIpBlockResponse,\n GetEngineIpBlockStatusResponse,\n GetEngineTimeResponse,\n} from './types';\n\n/**\n * Queries that talk directly to web, _not_ the engine. Placing here in the `engine-client` as we don't have enough\n * use cases to justify a separate package\n */\nexport class EngineWebClient extends EngineBaseClient {\n /**\n * Determines the IP block status for the current client\n */\n async getIpBlockStatus(): Promise<GetEngineIpBlockStatusResponse> {\n return (\n this.axiosInstance\n // Use the /time endpoint and listen to 403 responses\n .get(`${this.opts.url}/ip`, {\n // Allow all statuses\n validateStatus: () => true,\n // IP checks go through Cloudflare, which uses allow-origin as *, so withCredentials needs to be false\n withCredentials: false,\n })\n .then((res) => {\n if (res.status !== 403) {\n return null;\n }\n const resData = res.data as EngineServerIpBlockResponse;\n\n if (!resData.blocked) {\n return null;\n }\n\n return resData.reason === 'ip_query_only' ? 'query_only' : 'blocked';\n })\n );\n }\n\n /**\n * Determines whether a client needs to complete the cloudflare JS challenge to interact with the API\n *\n * @return true if the client needs to complete the JS challenge at '/challenge', false otherwise\n */\n async getRequiresCloudflareAuth(): Promise<boolean> {\n // We use a generic endpoint and check for the CF challenge header\n // Note: this uses a CORS set to the relevant frontend endpoint (ex. testnet.vertexprotocol.com) so it will NOT\n // work from other domains\n return this.axiosInstance\n .get(`${this.opts.url}/cf-check`, {\n // Allow all statuses\n validateStatus: () => true,\n })\n .then((res) => {\n if (res.status !== 403) {\n return false;\n }\n\n return res.headers['cf-mitigated'] === 'challenge';\n });\n }\n\n /**\n * Retrieves current server epoch in milliseconds\n */\n async getTime(): Promise<GetEngineTimeResponse> {\n return this.axiosInstance\n .get(`${this.opts.url}/time`)\n .then((res) => res.data as GetEngineTimeResponse);\n }\n}\n"],"mappings":";AAAA,SAAS,wBAAwB;AAW1B,IAAM,kBAAN,cAA8B,iBAAiB;AAAA;AAAA;AAAA;AAAA,EAIpD,MAAM,mBAA4D;AAChE,WACE,KAAK,cAEF,IAAI,GAAG,KAAK,KAAK,GAAG,OAAO;AAAA;AAAA,MAE1B,gBAAgB,MAAM;AAAA;AAAA,MAEtB,iBAAiB;AAAA,IACnB,CAAC,EACA,KAAK,CAAC,QAAQ;AACb,UAAI,IAAI,WAAW,KAAK;AACtB,eAAO;AAAA,MACT;AACA,YAAM,UAAU,IAAI;AAEpB,UAAI,CAAC,QAAQ,SAAS;AACpB,eAAO;AAAA,MACT;AAEA,aAAO,QAAQ,WAAW,kBAAkB,eAAe;AAAA,IAC7D,CAAC;AAAA,EAEP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,4BAA8C;AAIlD,WAAO,KAAK,cACT,IAAI,GAAG,KAAK,KAAK,GAAG,aAAa;AAAA;AAAA,MAEhC,gBAAgB,MAAM;AAAA,IACxB,CAAC,EACA,KAAK,CAAC,QAAQ;AACb,UAAI,IAAI,WAAW,KAAK;AACtB,eAAO;AAAA,MACT;AAEA,aAAO,IAAI,QAAQ,cAAc,MAAM;AAAA,IACzC,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,UAA0C;AAC9C,WAAO,KAAK,cACT,IAAI,GAAG,KAAK,KAAK,GAAG,OAAO,EAC3B,KAAK,CAAC,QAAQ,IAAI,IAA6B;AAAA,EACpD;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/EngineWebClient.ts"],"sourcesContent":["import { EngineBaseClient } from './EngineBaseClient';\nimport {\n EngineServerIpBlockResponse,\n GetEngineIpBlockStatusResponse,\n GetEngineTimeResponse,\n} from './types';\n\n/**\n * Queries that talk directly to web, _not_ the engine. Placing here in the `engine-client` as we don't have enough\n * use cases to justify a separate package\n */\nexport class EngineWebClient extends EngineBaseClient {\n /**\n * Determines the IP block status for the current client\n */\n async getIpBlockStatus(): Promise<GetEngineIpBlockStatusResponse> {\n return (\n this.axiosInstance\n // Use the /time endpoint and listen to 403 responses\n .get(`${this.opts.url}/ip`, {\n // IP checks go through Cloudflare, which uses allow-origin as *, so withCredentials needs to be false\n withCredentials: false,\n })\n .then((res) => {\n if (res.status !== 403) {\n return null;\n }\n const resData = res.data as EngineServerIpBlockResponse;\n\n if (!resData.blocked) {\n return null;\n }\n\n return resData.reason === 'ip_query_only' ? 'query_only' : 'blocked';\n })\n );\n }\n\n /**\n * Determines whether a client needs to complete the cloudflare JS challenge to interact with the API\n *\n * @return true if the client needs to complete the JS challenge at '/challenge', false otherwise\n */\n async getRequiresCloudflareAuth(): Promise<boolean> {\n // We use a generic endpoint and check for the CF challenge header\n // Note: this uses a CORS set to the relevant frontend endpoint (ex. testnet.vertexprotocol.com) so it will NOT\n // work from other domains\n return this.axiosInstance\n .get(`${this.opts.url}/cf-check`, {\n // Allow all statuses\n validateStatus: () => true,\n })\n .then((res) => {\n if (res.status !== 403) {\n return false;\n }\n\n return res.headers['cf-mitigated'] === 'challenge';\n });\n }\n\n /**\n * Retrieves current server epoch in milliseconds\n */\n async getTime(): Promise<GetEngineTimeResponse> {\n return this.axiosInstance\n .get(`${this.opts.url}/time`)\n .then((res) => res.data as GetEngineTimeResponse);\n }\n}\n"],"mappings":";AAAA,SAAS,wBAAwB;AAW1B,IAAM,kBAAN,cAA8B,iBAAiB;AAAA;AAAA;AAAA;AAAA,EAIpD,MAAM,mBAA4D;AAChE,WACE,KAAK,cAEF,IAAI,GAAG,KAAK,KAAK,GAAG,OAAO;AAAA;AAAA,MAE1B,iBAAiB;AAAA,IACnB,CAAC,EACA,KAAK,CAAC,QAAQ;AACb,UAAI,IAAI,WAAW,KAAK;AACtB,eAAO;AAAA,MACT;AACA,YAAM,UAAU,IAAI;AAEpB,UAAI,CAAC,QAAQ,SAAS;AACpB,eAAO;AAAA,MACT;AAEA,aAAO,QAAQ,WAAW,kBAAkB,eAAe;AAAA,IAC7D,CAAC;AAAA,EAEP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,4BAA8C;AAIlD,WAAO,KAAK,cACT,IAAI,GAAG,KAAK,KAAK,GAAG,aAAa;AAAA;AAAA,MAEhC,gBAAgB,MAAM;AAAA,IACxB,CAAC,EACA,KAAK,CAAC,QAAQ;AACb,UAAI,IAAI,WAAW,KAAK;AACtB,eAAO;AAAA,MACT;AAEA,aAAO,IAAI,QAAQ,cAAc,MAAM;AAAA,IACzC,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,UAA0C;AAC9C,WAAO,KAAK,cACT,IAAI,GAAG,KAAK,KAAK,GAAG,OAAO,EAC3B,KAAK,CAAC,QAAQ,IAAI,IAA6B;AAAA,EACpD;AACF;","names":[]}
@@ -27,18 +27,18 @@ __export(endpoints_exports, {
27
27
  module.exports = __toCommonJS(endpoints_exports);
28
28
  var ENGINE_CLIENT_ENDPOINTS = {
29
29
  local: "http://localhost:80",
30
- arbitrumTestnet: "https://gateway.sepolia-test.vertexprotocol.com/v1",
31
- arbitrum: "https://gateway.prod.vertexprotocol.com/v1"
30
+ arbitrum: "https://gateway.prod.vertexprotocol.com/v1",
31
+ inkTestnet: "https://gateway.test.nado-backend.xyz/v1"
32
32
  };
33
33
  var ENGINE_WS_CLIENT_ENDPOINTS = {
34
34
  local: "ws://localhost:80",
35
- arbitrumTestnet: "wss://gateway.sepolia-test.vertexprotocol.com/v1/ws",
36
- arbitrum: "wss://gateway.prod.vertexprotocol.com/v1/ws"
35
+ arbitrum: "wss://gateway.prod.vertexprotocol.com/v1/ws",
36
+ inkTestnet: "wss://gateway.test.nado-backend.xyz/v1/ws"
37
37
  };
38
38
  var ENGINE_WS_SUBSCRIPTION_CLIENT_ENDPOINTS = {
39
39
  local: "ws://localhost:80",
40
- arbitrumTestnet: "wss://gateway.sepolia-test.vertexprotocol.com/v1/subscribe",
41
- arbitrum: "wss://gateway.prod.vertexprotocol.com/v1/subscribe"
40
+ arbitrum: "wss://gateway.prod.vertexprotocol.com/v1/subscribe",
41
+ inkTestnet: "wss://gateway.test.nado-backend.xyz/v1/subscribe"
42
42
  };
43
43
  // Annotate the CommonJS export names for ESM import in node:
44
44
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/endpoints.ts"],"sourcesContent":["import { ChainEnv } from '@nadohq/contracts';\n\nexport const ENGINE_CLIENT_ENDPOINTS: Record<ChainEnv, string> = {\n local: 'http://localhost:80',\n arbitrumTestnet: 'https://gateway.sepolia-test.vertexprotocol.com/v1',\n arbitrum: 'https://gateway.prod.vertexprotocol.com/v1',\n};\n\nexport const ENGINE_WS_CLIENT_ENDPOINTS: Record<ChainEnv, string> = {\n local: 'ws://localhost:80',\n arbitrumTestnet: 'wss://gateway.sepolia-test.vertexprotocol.com/v1/ws',\n arbitrum: 'wss://gateway.prod.vertexprotocol.com/v1/ws',\n};\n\nexport const ENGINE_WS_SUBSCRIPTION_CLIENT_ENDPOINTS: Record<ChainEnv, string> =\n {\n local: 'ws://localhost:80',\n arbitrumTestnet:\n 'wss://gateway.sepolia-test.vertexprotocol.com/v1/subscribe',\n arbitrum: 'wss://gateway.prod.vertexprotocol.com/v1/subscribe',\n };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAM,0BAAoD;AAAA,EAC/D,OAAO;AAAA,EACP,iBAAiB;AAAA,EACjB,UAAU;AACZ;AAEO,IAAM,6BAAuD;AAAA,EAClE,OAAO;AAAA,EACP,iBAAiB;AAAA,EACjB,UAAU;AACZ;AAEO,IAAM,0CACX;AAAA,EACE,OAAO;AAAA,EACP,iBACE;AAAA,EACF,UAAU;AACZ;","names":[]}
1
+ {"version":3,"sources":["../src/endpoints.ts"],"sourcesContent":["import { ChainEnv } from '@nadohq/shared';\n\nexport const ENGINE_CLIENT_ENDPOINTS: Record<ChainEnv, string> = {\n local: 'http://localhost:80',\n arbitrum: 'https://gateway.prod.vertexprotocol.com/v1',\n inkTestnet: 'https://gateway.test.nado-backend.xyz/v1',\n};\n\nexport const ENGINE_WS_CLIENT_ENDPOINTS: Record<ChainEnv, string> = {\n local: 'ws://localhost:80',\n arbitrum: 'wss://gateway.prod.vertexprotocol.com/v1/ws',\n inkTestnet: 'wss://gateway.test.nado-backend.xyz/v1/ws',\n};\n\nexport const ENGINE_WS_SUBSCRIPTION_CLIENT_ENDPOINTS: Record<ChainEnv, string> =\n {\n local: 'ws://localhost:80',\n arbitrum: 'wss://gateway.prod.vertexprotocol.com/v1/subscribe',\n inkTestnet: 'wss://gateway.test.nado-backend.xyz/v1/subscribe',\n };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAM,0BAAoD;AAAA,EAC/D,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AACd;AAEO,IAAM,6BAAuD;AAAA,EAClE,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AACd;AAEO,IAAM,0CACX;AAAA,EACE,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AACd;","names":[]}
@@ -1,4 +1,4 @@
1
- import { ChainEnv } from '@nadohq/contracts';
1
+ import { ChainEnv } from '@nadohq/shared';
2
2
 
3
3
  declare const ENGINE_CLIENT_ENDPOINTS: Record<ChainEnv, string>;
4
4
  declare const ENGINE_WS_CLIENT_ENDPOINTS: Record<ChainEnv, string>;
@@ -1,4 +1,4 @@
1
- import { ChainEnv } from '@nadohq/contracts';
1
+ import { ChainEnv } from '@nadohq/shared';
2
2
 
3
3
  declare const ENGINE_CLIENT_ENDPOINTS: Record<ChainEnv, string>;
4
4
  declare const ENGINE_WS_CLIENT_ENDPOINTS: Record<ChainEnv, string>;
package/dist/endpoints.js CHANGED
@@ -1,18 +1,18 @@
1
1
  // src/endpoints.ts
2
2
  var ENGINE_CLIENT_ENDPOINTS = {
3
3
  local: "http://localhost:80",
4
- arbitrumTestnet: "https://gateway.sepolia-test.vertexprotocol.com/v1",
5
- arbitrum: "https://gateway.prod.vertexprotocol.com/v1"
4
+ arbitrum: "https://gateway.prod.vertexprotocol.com/v1",
5
+ inkTestnet: "https://gateway.test.nado-backend.xyz/v1"
6
6
  };
7
7
  var ENGINE_WS_CLIENT_ENDPOINTS = {
8
8
  local: "ws://localhost:80",
9
- arbitrumTestnet: "wss://gateway.sepolia-test.vertexprotocol.com/v1/ws",
10
- arbitrum: "wss://gateway.prod.vertexprotocol.com/v1/ws"
9
+ arbitrum: "wss://gateway.prod.vertexprotocol.com/v1/ws",
10
+ inkTestnet: "wss://gateway.test.nado-backend.xyz/v1/ws"
11
11
  };
12
12
  var ENGINE_WS_SUBSCRIPTION_CLIENT_ENDPOINTS = {
13
13
  local: "ws://localhost:80",
14
- arbitrumTestnet: "wss://gateway.sepolia-test.vertexprotocol.com/v1/subscribe",
15
- arbitrum: "wss://gateway.prod.vertexprotocol.com/v1/subscribe"
14
+ arbitrum: "wss://gateway.prod.vertexprotocol.com/v1/subscribe",
15
+ inkTestnet: "wss://gateway.test.nado-backend.xyz/v1/subscribe"
16
16
  };
17
17
  export {
18
18
  ENGINE_CLIENT_ENDPOINTS,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/endpoints.ts"],"sourcesContent":["import { ChainEnv } from '@nadohq/contracts';\n\nexport const ENGINE_CLIENT_ENDPOINTS: Record<ChainEnv, string> = {\n local: 'http://localhost:80',\n arbitrumTestnet: 'https://gateway.sepolia-test.vertexprotocol.com/v1',\n arbitrum: 'https://gateway.prod.vertexprotocol.com/v1',\n};\n\nexport const ENGINE_WS_CLIENT_ENDPOINTS: Record<ChainEnv, string> = {\n local: 'ws://localhost:80',\n arbitrumTestnet: 'wss://gateway.sepolia-test.vertexprotocol.com/v1/ws',\n arbitrum: 'wss://gateway.prod.vertexprotocol.com/v1/ws',\n};\n\nexport const ENGINE_WS_SUBSCRIPTION_CLIENT_ENDPOINTS: Record<ChainEnv, string> =\n {\n local: 'ws://localhost:80',\n arbitrumTestnet:\n 'wss://gateway.sepolia-test.vertexprotocol.com/v1/subscribe',\n arbitrum: 'wss://gateway.prod.vertexprotocol.com/v1/subscribe',\n };\n"],"mappings":";AAEO,IAAM,0BAAoD;AAAA,EAC/D,OAAO;AAAA,EACP,iBAAiB;AAAA,EACjB,UAAU;AACZ;AAEO,IAAM,6BAAuD;AAAA,EAClE,OAAO;AAAA,EACP,iBAAiB;AAAA,EACjB,UAAU;AACZ;AAEO,IAAM,0CACX;AAAA,EACE,OAAO;AAAA,EACP,iBACE;AAAA,EACF,UAAU;AACZ;","names":[]}
1
+ {"version":3,"sources":["../src/endpoints.ts"],"sourcesContent":["import { ChainEnv } from '@nadohq/shared';\n\nexport const ENGINE_CLIENT_ENDPOINTS: Record<ChainEnv, string> = {\n local: 'http://localhost:80',\n arbitrum: 'https://gateway.prod.vertexprotocol.com/v1',\n inkTestnet: 'https://gateway.test.nado-backend.xyz/v1',\n};\n\nexport const ENGINE_WS_CLIENT_ENDPOINTS: Record<ChainEnv, string> = {\n local: 'ws://localhost:80',\n arbitrum: 'wss://gateway.prod.vertexprotocol.com/v1/ws',\n inkTestnet: 'wss://gateway.test.nado-backend.xyz/v1/ws',\n};\n\nexport const ENGINE_WS_SUBSCRIPTION_CLIENT_ENDPOINTS: Record<ChainEnv, string> =\n {\n local: 'ws://localhost:80',\n arbitrum: 'wss://gateway.prod.vertexprotocol.com/v1/subscribe',\n inkTestnet: 'wss://gateway.test.nado-backend.xyz/v1/subscribe',\n };\n"],"mappings":";AAEO,IAAM,0BAAoD;AAAA,EAC/D,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AACd;AAEO,IAAM,6BAAuD;AAAA,EAClE,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AACd;AAEO,IAAM,0CACX;AAAA,EACE,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AACd;","names":[]}
package/dist/index.d.cts CHANGED
@@ -1,16 +1,15 @@
1
- export { EngineMarketPrice, EngineMinDepositRate, EngineOrder, EnginePriceTickLiquidity, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineContractsResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineHealthGroupsResponse, GetEngineInsuranceResponse, GetEngineIpBlockStatusResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineMinDepositRatesResponse, GetEngineNoncesParams, GetEngineNoncesResponse, GetEngineOrderParams, GetEngineOrderResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineSymbolsParams, GetEngineTimeResponse, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams } from './types/clientQueryTypes.cjs';
2
- export { EngineBurnNlpParams, EngineCancelAndPlaceParams, EngineCancelOrdersParams, EngineCancelProductOrdersParams, EngineExecuteRequestParamsByType, EngineIsolatedOrderParams, EngineLinkSignerParams, EngineLiquidateSubaccountParams, EngineMintNlpParams, EngineOrderParams, EnginePlaceIsolatedOrderParams, EnginePlaceIsolatedOrderResult, EnginePlaceOrderParams, EnginePlaceOrderResult, EngineTransferQuoteParams, EngineWithdrawCollateralParams, SignatureParams, WithBaseEngineExecuteParams, WithSignature } from './types/clientExecuteTypes.cjs';
3
- export { EngineInsuranceResponse, EngineServerAllProductsResponse, EngineServerContractsResponse, EngineServerEdgeAllProductsResponse, EngineServerFeeRatesResponse, EngineServerGetOrderQueryParams, EngineServerHealthGroupsResponse, EngineServerIpBlockResponse, EngineServerIsolatedPosition, EngineServerIsolatedPositionsQueryParams, EngineServerIsolatedPositionsResponse, EngineServerLinkedSignerParams, EngineServerLinkedSignerResponse, EngineServerMarketLiquidityQueryParams, EngineServerMarketLiquidityResponse, EngineServerMarketPrice, EngineServerMarketPriceQueryParams, EngineServerMarketPriceResponse, EngineServerMarketPricesQueryParams, EngineServerMarketPricesResponse, EngineServerMaxMintNlpQueryParams, EngineServerMaxMintNlpResponse, EngineServerMaxOrderSizeQueryParams, EngineServerMaxOrderSizeResponse, EngineServerMaxWithdrawableQueryParams, EngineServerMaxWithdrawableResponse, EngineServerMinDepositRate, EngineServerMinDepositRatesResponse, EngineServerNoncesParams, EngineServerNoncesResponse, EngineServerOrder, EngineServerOrderResponse, EngineServerOrdersQueryParams, EngineServerPriceTickLiquidity, EngineServerProductOrdersResponse, EngineServerQueryFailureResponse, EngineServerQueryRequest, EngineServerQueryRequestByType, EngineServerQueryRequestType, EngineServerQueryResponse, EngineServerQueryResponseByType, EngineServerQuerySuccessResponse, EngineServerStatusResponse, EngineServerSubaccountFeeRatesParams, EngineServerSubaccountInfoQueryParams, EngineServerSubaccountInfoResponse, EngineServerSubaccountOrders, EngineServerSubaccountOrdersQueryParams, EngineServerSubaccountOrdersResponse, EngineServerSymbol, EngineServerSymbolsQueryParams, EngineServerSymbolsResponse, EngineServerTimeResponse, EngineServerValidateOrderQueryParams, EngineServerValidateOrderResponse } from './types/serverQueryTypes.cjs';
1
+ export { EngineMarketPrice, EngineOrder, EnginePriceTickLiquidity, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineContractsResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineHealthGroupsResponse, GetEngineInsuranceResponse, GetEngineIpBlockStatusResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineNoncesParams, GetEngineNoncesResponse, GetEngineOrderParams, GetEngineOrderResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineSymbolsParams, GetEngineTimeResponse, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams } from './types/clientQueryTypes.cjs';
2
+ export { EngineBurnNlpParams, EngineCancelAndPlaceParams, EngineCancelOrdersParams, EngineCancelProductOrdersParams, EngineExecuteRequestParamsByType, EngineLinkSignerParams, EngineLiquidateSubaccountParams, EngineMintNlpParams, EngineOrderParams, EnginePlaceOrderParams, EnginePlaceOrderResult, EnginePlaceOrdersParams, EngineTransferQuoteParams, EngineWithdrawCollateralParams, SignatureParams, WithBaseEngineExecuteParams, WithSignature } from './types/clientExecuteTypes.cjs';
3
+ export { EngineInsuranceResponse, EngineServerAllProductsResponse, EngineServerContractsResponse, EngineServerEdgeAllProductsResponse, EngineServerFeeRatesResponse, EngineServerGetOrderQueryParams, EngineServerHealthGroupsResponse, EngineServerIpBlockResponse, EngineServerIsolatedPosition, EngineServerIsolatedPositionsQueryParams, EngineServerIsolatedPositionsResponse, EngineServerLinkedSignerParams, EngineServerLinkedSignerResponse, EngineServerMarketLiquidityQueryParams, EngineServerMarketLiquidityResponse, EngineServerMarketPrice, EngineServerMarketPriceQueryParams, EngineServerMarketPriceResponse, EngineServerMarketPricesQueryParams, EngineServerMarketPricesResponse, EngineServerMaxMintNlpQueryParams, EngineServerMaxMintNlpResponse, EngineServerMaxOrderSizeQueryParams, EngineServerMaxOrderSizeResponse, EngineServerMaxWithdrawableQueryParams, EngineServerMaxWithdrawableResponse, EngineServerNoncesParams, EngineServerNoncesResponse, EngineServerOrder, EngineServerOrderResponse, EngineServerOrdersQueryParams, EngineServerPriceTickLiquidity, EngineServerProductOrdersResponse, EngineServerQueryFailureResponse, EngineServerQueryRequest, EngineServerQueryRequestByType, EngineServerQueryRequestType, EngineServerQueryResponse, EngineServerQueryResponseByType, EngineServerQuerySuccessResponse, EngineServerStatusResponse, EngineServerSubaccountFeeRatesParams, EngineServerSubaccountInfoQueryParams, EngineServerSubaccountInfoResponse, EngineServerSubaccountOrders, EngineServerSubaccountOrdersQueryParams, EngineServerSubaccountOrdersResponse, EngineServerSymbol, EngineServerSymbolsQueryParams, EngineServerSymbolsResponse, EngineServerTimeResponse, EngineServerValidateOrderQueryParams, EngineServerValidateOrderResponse } from './types/serverQueryTypes.cjs';
4
4
  export { EngineServerBookInfo, EngineServerHealthBreakdown, EngineServerPerpBalance, EngineServerPerpBalanceData, EngineServerPerpProduct, EngineServerPerpState, EngineServerProductType, EngineServerRisk, EngineServerSpotBalance, EngineServerSpotBalanceData, EngineServerSpotConfig, EngineServerSpotProduct, EngineServerSpotState } from './types/serverQueryModelTypes.cjs';
5
- export { EngineServerCancelOrdersParams, EngineServerCancelOrdersResponse, EngineServerExecuteFailureResult, EngineServerExecutePlaceIsolatedOrderPayload, EngineServerExecutePlaceOrderPayload, EngineServerExecuteRequestByType, EngineServerExecuteRequestType, EngineServerExecuteResponseDataByType, EngineServerExecuteResult, EngineServerExecuteSuccessResult, EngineServerPlaceIsolatedOrderParams, EngineServerPlaceOrderParams, EngineServerPlaceOrderResponse, EngineServiceCancelAndPlaceParams } from './types/serverExecuteTypes.cjs';
5
+ export { EngineServerCancelOrdersParams, EngineServerCancelOrdersResponse, EngineServerExecuteFailureResult, EngineServerExecutePlaceOrderPayload, EngineServerExecuteRequestByType, EngineServerExecuteRequestType, EngineServerExecuteResponseDataByType, EngineServerExecuteResult, EngineServerExecuteSuccessResult, EngineServerPlaceOrderParams, EngineServerPlaceOrderResponse, EngineServerPlaceOrdersResponse, EngineServiceCancelAndPlaceParams } from './types/serverExecuteTypes.cjs';
6
6
  export { EngineServerBestBidOfferStreamParams, EngineServerBookDepthStreamParams, EngineServerFillStreamParams, EngineServerOrderUpdateStreamParams, EngineServerPositionChangeStreamParams, EngineServerSubscriptionParams, EngineServerSubscriptionRequest, EngineServerSubscriptionRequestByType, EngineServerSubscriptionRequestType, EngineServerSubscriptionStream, EngineServerSubscriptionStreamParamsByType, EngineServerSubscriptionStreamParamsType, EngineServerTradeStreamParams } from './types/serverSubscriptionTypes.cjs';
7
7
  export { EngineServerSubscriptionBestBidOfferEvent, EngineServerSubscriptionBookDepthEvent, EngineServerSubscriptionFillEvent, EngineServerSubscriptionOrderUpdateEvent, EngineServerSubscriptionPositionChangeEvent, EngineServerSubscriptionTradeEvent } from './types/serverSubscriptionEventTypes.cjs';
8
8
  export { EngineServerFailureError } from './types/EngineServerFailureError.cjs';
9
9
  export { EngineClient } from './EngineClient.cjs';
10
10
  export { ENGINE_CLIENT_ENDPOINTS, ENGINE_WS_CLIENT_ENDPOINTS, ENGINE_WS_SUBSCRIPTION_CLIENT_ENDPOINTS } from './endpoints.cjs';
11
11
  export { mapEngineMarketPrice, mapEngineServerBalanceHealthContributions, mapEngineServerIsolatedPositions, mapEngineServerOrder, mapEngineServerPerpProduct, mapEngineServerSpotProduct, mapEngineServerSymbol, mapEngineServerSymbols, mapEngineServerTickLiquidity, mapSubaccountSummary } from './utils/queryDataMappers.cjs';
12
- import '@nadohq/contracts';
13
- import '@nadohq/utils';
12
+ import '@nadohq/shared';
14
13
  import 'ts-mixer/dist/types/types';
15
14
  import './EngineExecuteClient.cjs';
16
15
  import './EngineBaseClient.cjs';
package/dist/index.d.ts CHANGED
@@ -1,16 +1,15 @@
1
- export { EngineMarketPrice, EngineMinDepositRate, EngineOrder, EnginePriceTickLiquidity, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineContractsResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineHealthGroupsResponse, GetEngineInsuranceResponse, GetEngineIpBlockStatusResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineMinDepositRatesResponse, GetEngineNoncesParams, GetEngineNoncesResponse, GetEngineOrderParams, GetEngineOrderResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineSymbolsParams, GetEngineTimeResponse, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams } from './types/clientQueryTypes.js';
2
- export { EngineBurnNlpParams, EngineCancelAndPlaceParams, EngineCancelOrdersParams, EngineCancelProductOrdersParams, EngineExecuteRequestParamsByType, EngineIsolatedOrderParams, EngineLinkSignerParams, EngineLiquidateSubaccountParams, EngineMintNlpParams, EngineOrderParams, EnginePlaceIsolatedOrderParams, EnginePlaceIsolatedOrderResult, EnginePlaceOrderParams, EnginePlaceOrderResult, EngineTransferQuoteParams, EngineWithdrawCollateralParams, SignatureParams, WithBaseEngineExecuteParams, WithSignature } from './types/clientExecuteTypes.js';
3
- export { EngineInsuranceResponse, EngineServerAllProductsResponse, EngineServerContractsResponse, EngineServerEdgeAllProductsResponse, EngineServerFeeRatesResponse, EngineServerGetOrderQueryParams, EngineServerHealthGroupsResponse, EngineServerIpBlockResponse, EngineServerIsolatedPosition, EngineServerIsolatedPositionsQueryParams, EngineServerIsolatedPositionsResponse, EngineServerLinkedSignerParams, EngineServerLinkedSignerResponse, EngineServerMarketLiquidityQueryParams, EngineServerMarketLiquidityResponse, EngineServerMarketPrice, EngineServerMarketPriceQueryParams, EngineServerMarketPriceResponse, EngineServerMarketPricesQueryParams, EngineServerMarketPricesResponse, EngineServerMaxMintNlpQueryParams, EngineServerMaxMintNlpResponse, EngineServerMaxOrderSizeQueryParams, EngineServerMaxOrderSizeResponse, EngineServerMaxWithdrawableQueryParams, EngineServerMaxWithdrawableResponse, EngineServerMinDepositRate, EngineServerMinDepositRatesResponse, EngineServerNoncesParams, EngineServerNoncesResponse, EngineServerOrder, EngineServerOrderResponse, EngineServerOrdersQueryParams, EngineServerPriceTickLiquidity, EngineServerProductOrdersResponse, EngineServerQueryFailureResponse, EngineServerQueryRequest, EngineServerQueryRequestByType, EngineServerQueryRequestType, EngineServerQueryResponse, EngineServerQueryResponseByType, EngineServerQuerySuccessResponse, EngineServerStatusResponse, EngineServerSubaccountFeeRatesParams, EngineServerSubaccountInfoQueryParams, EngineServerSubaccountInfoResponse, EngineServerSubaccountOrders, EngineServerSubaccountOrdersQueryParams, EngineServerSubaccountOrdersResponse, EngineServerSymbol, EngineServerSymbolsQueryParams, EngineServerSymbolsResponse, EngineServerTimeResponse, EngineServerValidateOrderQueryParams, EngineServerValidateOrderResponse } from './types/serverQueryTypes.js';
1
+ export { EngineMarketPrice, EngineOrder, EnginePriceTickLiquidity, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineContractsResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineHealthGroupsResponse, GetEngineInsuranceResponse, GetEngineIpBlockStatusResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineNoncesParams, GetEngineNoncesResponse, GetEngineOrderParams, GetEngineOrderResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineSymbolsParams, GetEngineTimeResponse, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams } from './types/clientQueryTypes.js';
2
+ export { EngineBurnNlpParams, EngineCancelAndPlaceParams, EngineCancelOrdersParams, EngineCancelProductOrdersParams, EngineExecuteRequestParamsByType, EngineLinkSignerParams, EngineLiquidateSubaccountParams, EngineMintNlpParams, EngineOrderParams, EnginePlaceOrderParams, EnginePlaceOrderResult, EnginePlaceOrdersParams, EngineTransferQuoteParams, EngineWithdrawCollateralParams, SignatureParams, WithBaseEngineExecuteParams, WithSignature } from './types/clientExecuteTypes.js';
3
+ export { EngineInsuranceResponse, EngineServerAllProductsResponse, EngineServerContractsResponse, EngineServerEdgeAllProductsResponse, EngineServerFeeRatesResponse, EngineServerGetOrderQueryParams, EngineServerHealthGroupsResponse, EngineServerIpBlockResponse, EngineServerIsolatedPosition, EngineServerIsolatedPositionsQueryParams, EngineServerIsolatedPositionsResponse, EngineServerLinkedSignerParams, EngineServerLinkedSignerResponse, EngineServerMarketLiquidityQueryParams, EngineServerMarketLiquidityResponse, EngineServerMarketPrice, EngineServerMarketPriceQueryParams, EngineServerMarketPriceResponse, EngineServerMarketPricesQueryParams, EngineServerMarketPricesResponse, EngineServerMaxMintNlpQueryParams, EngineServerMaxMintNlpResponse, EngineServerMaxOrderSizeQueryParams, EngineServerMaxOrderSizeResponse, EngineServerMaxWithdrawableQueryParams, EngineServerMaxWithdrawableResponse, EngineServerNoncesParams, EngineServerNoncesResponse, EngineServerOrder, EngineServerOrderResponse, EngineServerOrdersQueryParams, EngineServerPriceTickLiquidity, EngineServerProductOrdersResponse, EngineServerQueryFailureResponse, EngineServerQueryRequest, EngineServerQueryRequestByType, EngineServerQueryRequestType, EngineServerQueryResponse, EngineServerQueryResponseByType, EngineServerQuerySuccessResponse, EngineServerStatusResponse, EngineServerSubaccountFeeRatesParams, EngineServerSubaccountInfoQueryParams, EngineServerSubaccountInfoResponse, EngineServerSubaccountOrders, EngineServerSubaccountOrdersQueryParams, EngineServerSubaccountOrdersResponse, EngineServerSymbol, EngineServerSymbolsQueryParams, EngineServerSymbolsResponse, EngineServerTimeResponse, EngineServerValidateOrderQueryParams, EngineServerValidateOrderResponse } from './types/serverQueryTypes.js';
4
4
  export { EngineServerBookInfo, EngineServerHealthBreakdown, EngineServerPerpBalance, EngineServerPerpBalanceData, EngineServerPerpProduct, EngineServerPerpState, EngineServerProductType, EngineServerRisk, EngineServerSpotBalance, EngineServerSpotBalanceData, EngineServerSpotConfig, EngineServerSpotProduct, EngineServerSpotState } from './types/serverQueryModelTypes.js';
5
- export { EngineServerCancelOrdersParams, EngineServerCancelOrdersResponse, EngineServerExecuteFailureResult, EngineServerExecutePlaceIsolatedOrderPayload, EngineServerExecutePlaceOrderPayload, EngineServerExecuteRequestByType, EngineServerExecuteRequestType, EngineServerExecuteResponseDataByType, EngineServerExecuteResult, EngineServerExecuteSuccessResult, EngineServerPlaceIsolatedOrderParams, EngineServerPlaceOrderParams, EngineServerPlaceOrderResponse, EngineServiceCancelAndPlaceParams } from './types/serverExecuteTypes.js';
5
+ export { EngineServerCancelOrdersParams, EngineServerCancelOrdersResponse, EngineServerExecuteFailureResult, EngineServerExecutePlaceOrderPayload, EngineServerExecuteRequestByType, EngineServerExecuteRequestType, EngineServerExecuteResponseDataByType, EngineServerExecuteResult, EngineServerExecuteSuccessResult, EngineServerPlaceOrderParams, EngineServerPlaceOrderResponse, EngineServerPlaceOrdersResponse, EngineServiceCancelAndPlaceParams } from './types/serverExecuteTypes.js';
6
6
  export { EngineServerBestBidOfferStreamParams, EngineServerBookDepthStreamParams, EngineServerFillStreamParams, EngineServerOrderUpdateStreamParams, EngineServerPositionChangeStreamParams, EngineServerSubscriptionParams, EngineServerSubscriptionRequest, EngineServerSubscriptionRequestByType, EngineServerSubscriptionRequestType, EngineServerSubscriptionStream, EngineServerSubscriptionStreamParamsByType, EngineServerSubscriptionStreamParamsType, EngineServerTradeStreamParams } from './types/serverSubscriptionTypes.js';
7
7
  export { EngineServerSubscriptionBestBidOfferEvent, EngineServerSubscriptionBookDepthEvent, EngineServerSubscriptionFillEvent, EngineServerSubscriptionOrderUpdateEvent, EngineServerSubscriptionPositionChangeEvent, EngineServerSubscriptionTradeEvent } from './types/serverSubscriptionEventTypes.js';
8
8
  export { EngineServerFailureError } from './types/EngineServerFailureError.js';
9
9
  export { EngineClient } from './EngineClient.js';
10
10
  export { ENGINE_CLIENT_ENDPOINTS, ENGINE_WS_CLIENT_ENDPOINTS, ENGINE_WS_SUBSCRIPTION_CLIENT_ENDPOINTS } from './endpoints.js';
11
11
  export { mapEngineMarketPrice, mapEngineServerBalanceHealthContributions, mapEngineServerIsolatedPositions, mapEngineServerOrder, mapEngineServerPerpProduct, mapEngineServerSpotProduct, mapEngineServerSymbol, mapEngineServerSymbols, mapEngineServerTickLiquidity, mapSubaccountSummary } from './utils/queryDataMappers.js';
12
- import '@nadohq/contracts';
13
- import '@nadohq/utils';
12
+ import '@nadohq/shared';
14
13
  import 'ts-mixer/dist/types/types';
15
14
  import './EngineExecuteClient.js';
16
15
  import './EngineBaseClient.js';
@@ -25,7 +25,7 @@ __export(EngineServerFailureError_exports, {
25
25
  module.exports = __toCommonJS(EngineServerFailureError_exports);
26
26
  var EngineServerFailureError = class extends Error {
27
27
  constructor(responseData) {
28
- super();
28
+ super(`${responseData.error_code}: ${responseData.error}`);
29
29
  this.responseData = responseData;
30
30
  }
31
31
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/EngineServerFailureError.ts"],"sourcesContent":["import { EngineServerQueryFailureResponse } from './serverQueryTypes';\nimport { EngineServerExecuteFailureResult } from './serverExecuteTypes';\n\nexport class EngineServerFailureError extends Error {\n constructor(\n readonly responseData:\n | EngineServerQueryFailureResponse\n | EngineServerExecuteFailureResult,\n ) {\n super();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,IAAM,2BAAN,cAAuC,MAAM;AAAA,EAClD,YACW,cAGT;AACA,UAAM;AAJG;AAAA,EAKX;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/types/EngineServerFailureError.ts"],"sourcesContent":["import { EngineServerExecuteFailureResult } from './serverExecuteTypes';\nimport { EngineServerQueryFailureResponse } from './serverQueryTypes';\n\nexport class EngineServerFailureError extends Error {\n constructor(\n readonly responseData:\n | EngineServerQueryFailureResponse\n | EngineServerExecuteFailureResult,\n ) {\n super(`${responseData.error_code}: ${responseData.error}`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,IAAM,2BAAN,cAAuC,MAAM;AAAA,EAClD,YACW,cAGT;AACA,UAAM,GAAG,aAAa,UAAU,KAAK,aAAa,KAAK,EAAE;AAJhD;AAAA,EAKX;AACF;","names":[]}
@@ -1,6 +1,6 @@
1
- import { EngineServerQueryFailureResponse } from './serverQueryTypes.cjs';
2
1
  import { EngineServerExecuteFailureResult } from './serverExecuteTypes.cjs';
3
- import '@nadohq/contracts';
2
+ import { EngineServerQueryFailureResponse } from './serverQueryTypes.cjs';
3
+ import '@nadohq/shared';
4
4
  import './serverQueryModelTypes.cjs';
5
5
 
6
6
  declare class EngineServerFailureError extends Error {
@@ -1,6 +1,6 @@
1
- import { EngineServerQueryFailureResponse } from './serverQueryTypes.js';
2
1
  import { EngineServerExecuteFailureResult } from './serverExecuteTypes.js';
3
- import '@nadohq/contracts';
2
+ import { EngineServerQueryFailureResponse } from './serverQueryTypes.js';
3
+ import '@nadohq/shared';
4
4
  import './serverQueryModelTypes.js';
5
5
 
6
6
  declare class EngineServerFailureError extends Error {
@@ -1,7 +1,7 @@
1
1
  // src/types/EngineServerFailureError.ts
2
2
  var EngineServerFailureError = class extends Error {
3
3
  constructor(responseData) {
4
- super();
4
+ super(`${responseData.error_code}: ${responseData.error}`);
5
5
  this.responseData = responseData;
6
6
  }
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/EngineServerFailureError.ts"],"sourcesContent":["import { EngineServerQueryFailureResponse } from './serverQueryTypes';\nimport { EngineServerExecuteFailureResult } from './serverExecuteTypes';\n\nexport class EngineServerFailureError extends Error {\n constructor(\n readonly responseData:\n | EngineServerQueryFailureResponse\n | EngineServerExecuteFailureResult,\n ) {\n super();\n }\n}\n"],"mappings":";AAGO,IAAM,2BAAN,cAAuC,MAAM;AAAA,EAClD,YACW,cAGT;AACA,UAAM;AAJG;AAAA,EAKX;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/types/EngineServerFailureError.ts"],"sourcesContent":["import { EngineServerExecuteFailureResult } from './serverExecuteTypes';\nimport { EngineServerQueryFailureResponse } from './serverQueryTypes';\n\nexport class EngineServerFailureError extends Error {\n constructor(\n readonly responseData:\n | EngineServerQueryFailureResponse\n | EngineServerExecuteFailureResult,\n ) {\n super(`${responseData.error_code}: ${responseData.error}`);\n }\n}\n"],"mappings":";AAGO,IAAM,2BAAN,cAAuC,MAAM;AAAA,EAClD,YACW,cAGT;AACA,UAAM,GAAG,aAAa,UAAU,KAAK,aAAa,KAAK,EAAE;AAJhD;AAAA,EAKX;AACF;","names":[]}