@nadohq/engine-client 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EngineWebClient.cjs +16 -0
- package/dist/EngineWebClient.cjs.map +1 -1
- package/dist/EngineWebClient.d.cts +9 -1
- package/dist/EngineWebClient.d.ts +9 -1
- package/dist/EngineWebClient.js +16 -0
- package/dist/EngineWebClient.js.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/types/clientQueryTypes.cjs.map +1 -1
- package/dist/types/clientQueryTypes.d.cts +8 -1
- package/dist/types/clientQueryTypes.d.ts +8 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +3 -3
- package/src/EngineWebClient.ts +21 -1
- package/src/types/clientQueryTypes.ts +8 -0
package/dist/EngineWebClient.cjs
CHANGED
|
@@ -24,6 +24,7 @@ __export(EngineWebClient_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(EngineWebClient_exports);
|
|
26
26
|
var import_EngineBaseClient = require("./EngineBaseClient.cjs");
|
|
27
|
+
var COUNTRY_HEADER = "x-nado-country";
|
|
27
28
|
var EngineWebClient = class extends import_EngineBaseClient.EngineBaseClient {
|
|
28
29
|
/**
|
|
29
30
|
* Determines the IP block status for the current client
|
|
@@ -43,6 +44,21 @@ var EngineWebClient = class extends import_EngineBaseClient.EngineBaseClient {
|
|
|
43
44
|
return resData.reason === "ip_query_only" ? "query_only" : "blocked";
|
|
44
45
|
});
|
|
45
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves the caller's country code as detected by the gateway, sourced
|
|
49
|
+
* from the `x-nado-country` response header on `/ip`. Returns `null` when
|
|
50
|
+
* the gateway does not provide it (e.g. local environments).
|
|
51
|
+
*
|
|
52
|
+
* Useful for region-based UI gating such as geoblocking trading competitions.
|
|
53
|
+
*/
|
|
54
|
+
async getCountryCode() {
|
|
55
|
+
const res = await this.axiosInstance.get(`${this.opts.url}/ip`, {
|
|
56
|
+
// IP checks go through Cloudflare, which uses allow-origin as *, so withCredentials needs to be false
|
|
57
|
+
withCredentials: false
|
|
58
|
+
});
|
|
59
|
+
const rawCountry = res.headers?.[COUNTRY_HEADER];
|
|
60
|
+
return rawCountry ?? null;
|
|
61
|
+
}
|
|
46
62
|
/**
|
|
47
63
|
* Determines whether a client needs to complete the cloudflare JS challenge to interact with the API
|
|
48
64
|
*
|
|
@@ -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 /
|
|
1
|
+
{"version":3,"sources":["../src/EngineWebClient.ts"],"sourcesContent":["import { EngineBaseClient } from './EngineBaseClient';\nimport {\n EngineServerIpBlockResponse,\n GetEngineCountryCodeResponse,\n GetEngineIpBlockStatusResponse,\n GetEngineTimeResponse,\n} from './types';\n\nconst COUNTRY_HEADER = 'x-nado-country';\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 /ip 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 * Retrieves the caller's country code as detected by the gateway, sourced\n * from the `x-nado-country` response header on `/ip`. Returns `null` when\n * the gateway does not provide it (e.g. local environments).\n *\n * Useful for region-based UI gating such as geoblocking trading competitions.\n */\n async getCountryCode(): Promise<GetEngineCountryCodeResponse> {\n const res = await this.axiosInstance.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\n const rawCountry = res.headers?.[COUNTRY_HEADER] as string | undefined;\n return rawCountry ?? null;\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;AAQjC,IAAM,iBAAiB;AAMhB,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;AAAA;AAAA,EASA,MAAM,iBAAwD;AAC5D,UAAM,MAAM,MAAM,KAAK,cAAc,IAAI,GAAG,KAAK,KAAK,GAAG,OAAO;AAAA;AAAA,MAE9D,iBAAiB;AAAA,IACnB,CAAC;AAED,UAAM,aAAa,IAAI,UAAU,cAAc;AAC/C,WAAO,cAAc;AAAA,EACvB;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,5 +1,5 @@
|
|
|
1
1
|
import { EngineBaseClient } from './EngineBaseClient.cjs';
|
|
2
|
-
import { GetEngineIpBlockStatusResponse, GetEngineTimeResponse } from './types/clientQueryTypes.cjs';
|
|
2
|
+
import { GetEngineIpBlockStatusResponse, GetEngineCountryCodeResponse, GetEngineTimeResponse } from './types/clientQueryTypes.cjs';
|
|
3
3
|
import '@nadohq/shared';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import './types/serverExecuteTypes.cjs';
|
|
@@ -16,6 +16,14 @@ declare class EngineWebClient extends EngineBaseClient {
|
|
|
16
16
|
* Determines the IP block status for the current client
|
|
17
17
|
*/
|
|
18
18
|
getIpBlockStatus(): Promise<GetEngineIpBlockStatusResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves the caller's country code as detected by the gateway, sourced
|
|
21
|
+
* from the `x-nado-country` response header on `/ip`. Returns `null` when
|
|
22
|
+
* the gateway does not provide it (e.g. local environments).
|
|
23
|
+
*
|
|
24
|
+
* Useful for region-based UI gating such as geoblocking trading competitions.
|
|
25
|
+
*/
|
|
26
|
+
getCountryCode(): Promise<GetEngineCountryCodeResponse>;
|
|
19
27
|
/**
|
|
20
28
|
* Determines whether a client needs to complete the cloudflare JS challenge to interact with the API
|
|
21
29
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EngineBaseClient } from './EngineBaseClient.js';
|
|
2
|
-
import { GetEngineIpBlockStatusResponse, GetEngineTimeResponse } from './types/clientQueryTypes.js';
|
|
2
|
+
import { GetEngineIpBlockStatusResponse, GetEngineCountryCodeResponse, GetEngineTimeResponse } from './types/clientQueryTypes.js';
|
|
3
3
|
import '@nadohq/shared';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import './types/serverExecuteTypes.js';
|
|
@@ -16,6 +16,14 @@ declare class EngineWebClient extends EngineBaseClient {
|
|
|
16
16
|
* Determines the IP block status for the current client
|
|
17
17
|
*/
|
|
18
18
|
getIpBlockStatus(): Promise<GetEngineIpBlockStatusResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves the caller's country code as detected by the gateway, sourced
|
|
21
|
+
* from the `x-nado-country` response header on `/ip`. Returns `null` when
|
|
22
|
+
* the gateway does not provide it (e.g. local environments).
|
|
23
|
+
*
|
|
24
|
+
* Useful for region-based UI gating such as geoblocking trading competitions.
|
|
25
|
+
*/
|
|
26
|
+
getCountryCode(): Promise<GetEngineCountryCodeResponse>;
|
|
19
27
|
/**
|
|
20
28
|
* Determines whether a client needs to complete the cloudflare JS challenge to interact with the API
|
|
21
29
|
*
|
package/dist/EngineWebClient.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/EngineWebClient.ts
|
|
2
2
|
import { EngineBaseClient } from "./EngineBaseClient.js";
|
|
3
|
+
var COUNTRY_HEADER = "x-nado-country";
|
|
3
4
|
var EngineWebClient = class extends EngineBaseClient {
|
|
4
5
|
/**
|
|
5
6
|
* Determines the IP block status for the current client
|
|
@@ -19,6 +20,21 @@ var EngineWebClient = class extends EngineBaseClient {
|
|
|
19
20
|
return resData.reason === "ip_query_only" ? "query_only" : "blocked";
|
|
20
21
|
});
|
|
21
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves the caller's country code as detected by the gateway, sourced
|
|
25
|
+
* from the `x-nado-country` response header on `/ip`. Returns `null` when
|
|
26
|
+
* the gateway does not provide it (e.g. local environments).
|
|
27
|
+
*
|
|
28
|
+
* Useful for region-based UI gating such as geoblocking trading competitions.
|
|
29
|
+
*/
|
|
30
|
+
async getCountryCode() {
|
|
31
|
+
const res = await this.axiosInstance.get(`${this.opts.url}/ip`, {
|
|
32
|
+
// IP checks go through Cloudflare, which uses allow-origin as *, so withCredentials needs to be false
|
|
33
|
+
withCredentials: false
|
|
34
|
+
});
|
|
35
|
+
const rawCountry = res.headers?.[COUNTRY_HEADER];
|
|
36
|
+
return rawCountry ?? null;
|
|
37
|
+
}
|
|
22
38
|
/**
|
|
23
39
|
* Determines whether a client needs to complete the cloudflare JS challenge to interact with the API
|
|
24
40
|
*
|
|
@@ -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 /
|
|
1
|
+
{"version":3,"sources":["../src/EngineWebClient.ts"],"sourcesContent":["import { EngineBaseClient } from './EngineBaseClient';\nimport {\n EngineServerIpBlockResponse,\n GetEngineCountryCodeResponse,\n GetEngineIpBlockStatusResponse,\n GetEngineTimeResponse,\n} from './types';\n\nconst COUNTRY_HEADER = 'x-nado-country';\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 /ip 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 * Retrieves the caller's country code as detected by the gateway, sourced\n * from the `x-nado-country` response header on `/ip`. Returns `null` when\n * the gateway does not provide it (e.g. local environments).\n *\n * Useful for region-based UI gating such as geoblocking trading competitions.\n */\n async getCountryCode(): Promise<GetEngineCountryCodeResponse> {\n const res = await this.axiosInstance.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\n const rawCountry = res.headers?.[COUNTRY_HEADER] as string | undefined;\n return rawCountry ?? null;\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;AAQjC,IAAM,iBAAiB;AAMhB,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;AAAA;AAAA,EASA,MAAM,iBAAwD;AAC5D,UAAM,MAAM,MAAM,KAAK,cAAc,IAAI,GAAG,KAAK,KAAK,GAAG,OAAO;AAAA;AAAA,MAE9D,iBAAiB;AAAA,IACnB,CAAC;AAED,UAAM,aAAa,IAAI,UAAU,cAAc;AAC/C,WAAO,cAAc;AAAA,EACvB;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":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ENGINE_CLIENT_ENDPOINTS, ENGINE_WS_CLIENT_ENDPOINTS, ENGINE_WS_SUBSCRIPTION_CLIENT_ENDPOINTS } from './endpoints.cjs';
|
|
2
2
|
export { EngineClient } from './EngineClient.cjs';
|
|
3
3
|
export { EngineBurnNlpParams, EngineCancelAndPlaceParams, EngineCancelOrdersParams, EngineCancelProductOrdersParams, EngineExecuteRequestParamsByType, EngineLinkSignerParams, EngineLiquidateSubaccountParams, EngineMintNlpParams, EngineOrderParams, EnginePlaceOrderParams, EnginePlaceOrderResult, EnginePlaceOrdersParams, EngineTransferQuoteParams, EngineWithdrawCollateralParams, SignatureParams, WithBaseEngineExecuteParams, WithSignature } from './types/clientExecuteTypes.cjs';
|
|
4
|
-
export { EngineMarketPrice, EngineNlpBalance, EngineNlpLockedBalance, EngineOrder, EnginePriceTickLiquidity, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineContractsResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineHealthGroupsResponse, GetEngineInsuranceResponse, GetEngineIpBlockStatusResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxBurnNlpAmountParams, GetEngineMaxBurnNlpAmountResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineNlpLockedBalancesParams, GetEngineNlpLockedBalancesResponse, GetEngineNlpPoolInfoResponse, GetEngineNoncesParams, GetEngineNoncesResponse, GetEngineOrderParams, GetEngineOrderResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineSymbolsParams, GetEngineTimeResponse, NlpPool, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountSummaryState, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams } from './types/clientQueryTypes.cjs';
|
|
4
|
+
export { EngineMarketPrice, EngineNlpBalance, EngineNlpLockedBalance, EngineOrder, EnginePriceTickLiquidity, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineContractsResponse, GetEngineCountryCodeResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineHealthGroupsResponse, GetEngineInsuranceResponse, GetEngineIpBlockStatusResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxBurnNlpAmountParams, GetEngineMaxBurnNlpAmountResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineNlpLockedBalancesParams, GetEngineNlpLockedBalancesResponse, GetEngineNlpPoolInfoResponse, GetEngineNoncesParams, GetEngineNoncesResponse, GetEngineOrderParams, GetEngineOrderResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineSymbolsParams, GetEngineTimeResponse, NlpPool, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountSummaryState, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams } from './types/clientQueryTypes.cjs';
|
|
5
5
|
export { EngineServerFailureError } from './types/EngineServerFailureError.cjs';
|
|
6
6
|
export { EngineServerCancelOrdersParams, EngineServerCancelOrdersResponse, EngineServerExecuteFailureResult, EngineServerExecutePlaceOrderPayload, EngineServerExecuteRequestByType, EngineServerExecuteRequestType, EngineServerExecuteResponseDataByType, EngineServerExecuteResult, EngineServerExecuteSuccessResult, EngineServerPlaceOrderParams, EngineServerPlaceOrderResponse, EngineServerPlaceOrdersResponse, EngineServiceCancelAndPlaceParams } from './types/serverExecuteTypes.cjs';
|
|
7
7
|
export { EngineServerBookInfo, EngineServerHealthBreakdown, EngineServerNlpBalance, EngineServerNlpLockedBalance, EngineServerOrder, EngineServerPerpBalance, EngineServerPerpBalanceData, EngineServerPerpProduct, EngineServerPerpState, EngineServerProductType, EngineServerRisk, EngineServerSpotBalance, EngineServerSpotBalanceData, EngineServerSpotConfig, EngineServerSpotProduct, EngineServerSpotState } from './types/serverQueryModelTypes.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ENGINE_CLIENT_ENDPOINTS, ENGINE_WS_CLIENT_ENDPOINTS, ENGINE_WS_SUBSCRIPTION_CLIENT_ENDPOINTS } from './endpoints.js';
|
|
2
2
|
export { EngineClient } from './EngineClient.js';
|
|
3
3
|
export { EngineBurnNlpParams, EngineCancelAndPlaceParams, EngineCancelOrdersParams, EngineCancelProductOrdersParams, EngineExecuteRequestParamsByType, EngineLinkSignerParams, EngineLiquidateSubaccountParams, EngineMintNlpParams, EngineOrderParams, EnginePlaceOrderParams, EnginePlaceOrderResult, EnginePlaceOrdersParams, EngineTransferQuoteParams, EngineWithdrawCollateralParams, SignatureParams, WithBaseEngineExecuteParams, WithSignature } from './types/clientExecuteTypes.js';
|
|
4
|
-
export { EngineMarketPrice, EngineNlpBalance, EngineNlpLockedBalance, EngineOrder, EnginePriceTickLiquidity, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineContractsResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineHealthGroupsResponse, GetEngineInsuranceResponse, GetEngineIpBlockStatusResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxBurnNlpAmountParams, GetEngineMaxBurnNlpAmountResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineNlpLockedBalancesParams, GetEngineNlpLockedBalancesResponse, GetEngineNlpPoolInfoResponse, GetEngineNoncesParams, GetEngineNoncesResponse, GetEngineOrderParams, GetEngineOrderResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineSymbolsParams, GetEngineTimeResponse, NlpPool, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountSummaryState, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams } from './types/clientQueryTypes.js';
|
|
4
|
+
export { EngineMarketPrice, EngineNlpBalance, EngineNlpLockedBalance, EngineOrder, EnginePriceTickLiquidity, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineContractsResponse, GetEngineCountryCodeResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineHealthGroupsResponse, GetEngineInsuranceResponse, GetEngineIpBlockStatusResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxBurnNlpAmountParams, GetEngineMaxBurnNlpAmountResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineNlpLockedBalancesParams, GetEngineNlpLockedBalancesResponse, GetEngineNlpPoolInfoResponse, GetEngineNoncesParams, GetEngineNoncesResponse, GetEngineOrderParams, GetEngineOrderResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineSymbolsParams, GetEngineTimeResponse, NlpPool, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountSummaryState, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams } from './types/clientQueryTypes.js';
|
|
5
5
|
export { EngineServerFailureError } from './types/EngineServerFailureError.js';
|
|
6
6
|
export { EngineServerCancelOrdersParams, EngineServerCancelOrdersResponse, EngineServerExecuteFailureResult, EngineServerExecutePlaceOrderPayload, EngineServerExecuteRequestByType, EngineServerExecuteRequestType, EngineServerExecuteResponseDataByType, EngineServerExecuteResult, EngineServerExecuteSuccessResult, EngineServerPlaceOrderParams, EngineServerPlaceOrderResponse, EngineServerPlaceOrdersResponse, EngineServiceCancelAndPlaceParams } from './types/serverExecuteTypes.js';
|
|
7
7
|
export { EngineServerBookInfo, EngineServerHealthBreakdown, EngineServerNlpBalance, EngineServerNlpLockedBalance, EngineServerOrder, EngineServerPerpBalance, EngineServerPerpBalanceData, EngineServerPerpProduct, EngineServerPerpState, EngineServerProductType, EngineServerRisk, EngineServerSpotBalance, EngineServerSpotBalanceData, EngineServerSpotConfig, EngineServerSpotProduct, EngineServerSpotState } from './types/serverQueryModelTypes.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/clientQueryTypes.ts"],"sourcesContent":["import {\n BalanceHealthContributions,\n BalanceSide,\n BalanceWithProduct,\n EIP712OrderParams,\n HealthGroup,\n HealthStatusByType,\n MarketWithProduct,\n OrderAppendix,\n PerpBalanceWithProduct,\n ProductEngineType,\n SignedEIP712OrderParams,\n SpotBalanceWithProduct,\n Subaccount,\n} from '@nadohq/shared';\nimport BigNumber from 'bignumber.js';\nimport {\n EngineServerNoncesParams,\n EngineServerTimeResponse,\n} from './serverQueryTypes';\n\nexport interface GetEngineSubaccountSummaryResponse extends SubaccountSummaryState {\n exists: boolean;\n preState?: SubaccountSummaryState;\n}\n\nexport interface SubaccountSummaryState {\n balances: BalanceWithProduct[];\n health: HealthStatusByType;\n}\n\nexport type GetEngineSubaccountSummaryParams = Subaccount;\n\nexport type GetEngineIsolatedPositionsParams = Subaccount;\n\nexport interface SubaccountIsolatedPosition {\n subaccount: Subaccount;\n healths: BalanceHealthContributions;\n quoteBalance: SpotBalanceWithProduct;\n baseBalance: PerpBalanceWithProduct;\n}\n\nexport type GetEngineIsolatedPositionsResponse = SubaccountIsolatedPosition[];\n\nexport type SubaccountTx = {\n type: 'apply_delta';\n tx: SubaccountProductDeltaTx;\n};\n\nexport interface SubaccountProductDeltaTx {\n productId: number;\n amountDelta: BigNumber;\n vQuoteDelta: BigNumber;\n}\n\nexport interface GetEngineContractsResponse {\n chainId: number;\n endpointAddr: string;\n}\n\nexport type GetEngineEstimatedSubaccountSummaryParams = Subaccount & {\n txs: SubaccountTx[];\n preState?: boolean;\n};\n\nexport type GetEngineNoncesParams = EngineServerNoncesParams;\n\nexport interface GetEngineNoncesResponse {\n orderNonce: string;\n txNonce: string;\n}\n\nexport interface GetEngineSymbolsParams {\n productType?: ProductEngineType;\n productIds?: number[];\n}\n\nexport interface EngineSymbolsResponse {\n // mapping of product symbol to symbols info\n symbols: Record<string, EngineSymbol>;\n}\n\nexport interface EngineSymbol {\n type: ProductEngineType;\n productId: number;\n symbol: string;\n priceIncrement: BigNumber;\n sizeIncrement: BigNumber;\n minSize: BigNumber;\n makerFeeRate: BigNumber;\n takerFeeRate: BigNumber;\n longWeightInitial: BigNumber;\n longWeightMaintenance: BigNumber;\n // undefined when there is no max open interest limit (always undefined for spot products)\n maxOpenInterest: BigNumber | undefined;\n isolatedOnly: boolean;\n}\n\nexport type GetEngineAllMarketsResponse = MarketWithProduct[];\n\nexport interface GetEngineHealthGroupsResponse {\n healthGroups: HealthGroup[];\n}\n\nexport interface GetEngineOrderParams {\n productId: number;\n digest: string;\n}\n\nexport interface EngineOrder extends Subaccount {\n productId: number;\n price: BigNumber;\n // Amount initially requested\n totalAmount: BigNumber;\n // Amount still unfilled\n unfilledAmount: BigNumber;\n expiration: number;\n nonce: string;\n digest: string;\n placementTime: number;\n appendix: OrderAppendix;\n}\n\nexport type GetEngineOrderResponse = EngineOrder;\n\nexport interface ValidateSignedEngineOrderParams {\n productId: number;\n signedOrder: SignedEIP712OrderParams;\n}\n\nexport interface ValidateEngineOrderParams {\n productId: number;\n chainId: number;\n order: EIP712OrderParams;\n}\n\nexport interface ValidateEngineOrderResponse {\n productId: number;\n valid: boolean;\n}\n\nexport interface GetEngineSubaccountOrdersParams extends Subaccount {\n productId: number;\n}\n\nexport interface EngineSubaccountOrders {\n productId: number;\n orders: EngineOrder[];\n}\n\nexport type GetEngineSubaccountOrdersResponse = EngineSubaccountOrders;\n\nexport interface GetEngineSubaccountProductOrdersParams extends Subaccount {\n productIds: number[];\n}\n\nexport interface GetEngineSubaccountProductOrdersResponse {\n productOrders: EngineSubaccountOrders[];\n}\n\nexport type GetEngineSubaccountFeeRatesParams = Subaccount;\n\nexport interface SubaccountOrderFeeRates {\n maker: BigNumber;\n taker: BigNumber;\n}\n\nexport interface GetEngineSubaccountFeeRatesResponse {\n // By Product ID\n orders: Record<number, SubaccountOrderFeeRates>;\n withdrawal: Record<number, BigNumber>;\n liquidationSequencerFee: BigNumber;\n healthCheckSequencerFee: BigNumber;\n takerSequencerFee: BigNumber;\n feeTier: number;\n}\n\nexport interface EnginePriceTickLiquidity {\n price: BigNumber;\n liquidity: BigNumber;\n}\n\nexport interface GetEngineMarketLiquidityParams {\n productId: number;\n // The minimum depth in base price ticks (i.e. per side\n depth: number;\n}\n\nexport interface GetEngineMarketLiquidityResponse {\n bids: EnginePriceTickLiquidity[];\n asks: EnginePriceTickLiquidity[];\n}\n\nexport interface GetEngineMarketPriceParams {\n productId: number;\n}\n\nexport interface EngineMarketPrice {\n productId: number;\n bid: BigNumber;\n ask: BigNumber;\n}\n\nexport type GetEngineMarketPriceResponse = EngineMarketPrice;\n\nexport interface GetEngineMarketPricesParams {\n productIds: number[];\n}\n\nexport interface GetEngineMarketPricesResponse {\n marketPrices: EngineMarketPrice[];\n}\n\nexport interface GetEngineMaxOrderSizeParams extends Subaccount {\n price: BigNumber;\n productId: number;\n // Note: When `reduceOnly` is true, `side` must be opposite of the current position, otherwise it returns 0.\n side: BalanceSide;\n // If not given, engine defaults to true (leverage/borrow enabled) for spot\n // Do not pass this for perp products\n spotLeverage?: boolean;\n // If not given, engine defaults to false. If true, the max order size will be capped to the subaccount's current position size;\n // If no position exists, it will return 0.\n reduceOnly?: boolean;\n isolated?: boolean;\n // If not given, engine defaults to true (do not borrow margin for isolated orders)\n // Max order size query for `isolated` includes available transfer from the cross subaccount\n isoBorrowMargin?: boolean;\n}\n\nexport type GetEngineMaxOrderSizeResponse = BigNumber;\n\nexport interface GetEngineMaxWithdrawableParams extends Subaccount {\n productId: number;\n // If not given, engine defaults to true (leverage/borrow enabled)\n spotLeverage?: boolean;\n}\n\nexport type GetEngineMaxWithdrawableResponse = BigNumber;\n\nexport type GetEngineTimeResponse = EngineServerTimeResponse;\n\nexport type GetEngineLinkedSignerParams = Subaccount;\n\nexport interface GetEngineLinkedSignerResponse {\n signer: string;\n}\n\nexport type GetEngineInsuranceResponse = BigNumber;\n\n/**\n * Given an IP, backend will either:\n * - Allow queries only through archive / engine (query_only)\n * - Block all requests (blocked)\n * - Allow all requests (null)\n */\nexport type GetEngineIpBlockStatusResponse = 'query_only' | 'blocked' | null;\n\nexport interface GetEngineMaxMintNlpAmountParams extends Subaccount {\n // If not given, engine defaults to true (leverage/borrow enabled)\n spotLeverage?: boolean;\n}\n\nexport type GetEngineMaxMintNlpAmountResponse = BigNumber;\n\nexport type GetEngineMaxBurnNlpAmountParams = Subaccount;\n\nexport type GetEngineMaxBurnNlpAmountResponse = BigNumber;\n\nexport type GetEngineNlpLockedBalancesParams = Subaccount;\n\nexport interface EngineNlpBalance {\n productId: number;\n balance: BigNumber;\n}\n\nexport interface EngineNlpLockedBalance extends EngineNlpBalance {\n unlockedAt: number;\n}\n\nexport interface GetEngineNlpLockedBalancesResponse {\n lockedBalances: EngineNlpLockedBalance[];\n balanceLocked: EngineNlpBalance;\n balanceUnlocked: EngineNlpBalance;\n}\n\nexport interface NlpPool {\n poolId: number;\n subaccountHex: string;\n ownerAddress: string;\n balanceWeight: BigNumber;\n subaccountInfo: GetEngineSubaccountSummaryResponse;\n openOrders: EngineOrder[];\n}\n\nexport interface GetEngineNlpPoolInfoResponse {\n nlpPools: NlpPool[];\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/types/clientQueryTypes.ts"],"sourcesContent":["import {\n BalanceHealthContributions,\n BalanceSide,\n BalanceWithProduct,\n EIP712OrderParams,\n HealthGroup,\n HealthStatusByType,\n MarketWithProduct,\n OrderAppendix,\n PerpBalanceWithProduct,\n ProductEngineType,\n SignedEIP712OrderParams,\n SpotBalanceWithProduct,\n Subaccount,\n} from '@nadohq/shared';\nimport BigNumber from 'bignumber.js';\nimport {\n EngineServerNoncesParams,\n EngineServerTimeResponse,\n} from './serverQueryTypes';\n\nexport interface GetEngineSubaccountSummaryResponse extends SubaccountSummaryState {\n exists: boolean;\n preState?: SubaccountSummaryState;\n}\n\nexport interface SubaccountSummaryState {\n balances: BalanceWithProduct[];\n health: HealthStatusByType;\n}\n\nexport type GetEngineSubaccountSummaryParams = Subaccount;\n\nexport type GetEngineIsolatedPositionsParams = Subaccount;\n\nexport interface SubaccountIsolatedPosition {\n subaccount: Subaccount;\n healths: BalanceHealthContributions;\n quoteBalance: SpotBalanceWithProduct;\n baseBalance: PerpBalanceWithProduct;\n}\n\nexport type GetEngineIsolatedPositionsResponse = SubaccountIsolatedPosition[];\n\nexport type SubaccountTx = {\n type: 'apply_delta';\n tx: SubaccountProductDeltaTx;\n};\n\nexport interface SubaccountProductDeltaTx {\n productId: number;\n amountDelta: BigNumber;\n vQuoteDelta: BigNumber;\n}\n\nexport interface GetEngineContractsResponse {\n chainId: number;\n endpointAddr: string;\n}\n\nexport type GetEngineEstimatedSubaccountSummaryParams = Subaccount & {\n txs: SubaccountTx[];\n preState?: boolean;\n};\n\nexport type GetEngineNoncesParams = EngineServerNoncesParams;\n\nexport interface GetEngineNoncesResponse {\n orderNonce: string;\n txNonce: string;\n}\n\nexport interface GetEngineSymbolsParams {\n productType?: ProductEngineType;\n productIds?: number[];\n}\n\nexport interface EngineSymbolsResponse {\n // mapping of product symbol to symbols info\n symbols: Record<string, EngineSymbol>;\n}\n\nexport interface EngineSymbol {\n type: ProductEngineType;\n productId: number;\n symbol: string;\n priceIncrement: BigNumber;\n sizeIncrement: BigNumber;\n minSize: BigNumber;\n makerFeeRate: BigNumber;\n takerFeeRate: BigNumber;\n longWeightInitial: BigNumber;\n longWeightMaintenance: BigNumber;\n // undefined when there is no max open interest limit (always undefined for spot products)\n maxOpenInterest: BigNumber | undefined;\n isolatedOnly: boolean;\n}\n\nexport type GetEngineAllMarketsResponse = MarketWithProduct[];\n\nexport interface GetEngineHealthGroupsResponse {\n healthGroups: HealthGroup[];\n}\n\nexport interface GetEngineOrderParams {\n productId: number;\n digest: string;\n}\n\nexport interface EngineOrder extends Subaccount {\n productId: number;\n price: BigNumber;\n // Amount initially requested\n totalAmount: BigNumber;\n // Amount still unfilled\n unfilledAmount: BigNumber;\n expiration: number;\n nonce: string;\n digest: string;\n placementTime: number;\n appendix: OrderAppendix;\n}\n\nexport type GetEngineOrderResponse = EngineOrder;\n\nexport interface ValidateSignedEngineOrderParams {\n productId: number;\n signedOrder: SignedEIP712OrderParams;\n}\n\nexport interface ValidateEngineOrderParams {\n productId: number;\n chainId: number;\n order: EIP712OrderParams;\n}\n\nexport interface ValidateEngineOrderResponse {\n productId: number;\n valid: boolean;\n}\n\nexport interface GetEngineSubaccountOrdersParams extends Subaccount {\n productId: number;\n}\n\nexport interface EngineSubaccountOrders {\n productId: number;\n orders: EngineOrder[];\n}\n\nexport type GetEngineSubaccountOrdersResponse = EngineSubaccountOrders;\n\nexport interface GetEngineSubaccountProductOrdersParams extends Subaccount {\n productIds: number[];\n}\n\nexport interface GetEngineSubaccountProductOrdersResponse {\n productOrders: EngineSubaccountOrders[];\n}\n\nexport type GetEngineSubaccountFeeRatesParams = Subaccount;\n\nexport interface SubaccountOrderFeeRates {\n maker: BigNumber;\n taker: BigNumber;\n}\n\nexport interface GetEngineSubaccountFeeRatesResponse {\n // By Product ID\n orders: Record<number, SubaccountOrderFeeRates>;\n withdrawal: Record<number, BigNumber>;\n liquidationSequencerFee: BigNumber;\n healthCheckSequencerFee: BigNumber;\n takerSequencerFee: BigNumber;\n feeTier: number;\n}\n\nexport interface EnginePriceTickLiquidity {\n price: BigNumber;\n liquidity: BigNumber;\n}\n\nexport interface GetEngineMarketLiquidityParams {\n productId: number;\n // The minimum depth in base price ticks (i.e. per side\n depth: number;\n}\n\nexport interface GetEngineMarketLiquidityResponse {\n bids: EnginePriceTickLiquidity[];\n asks: EnginePriceTickLiquidity[];\n}\n\nexport interface GetEngineMarketPriceParams {\n productId: number;\n}\n\nexport interface EngineMarketPrice {\n productId: number;\n bid: BigNumber;\n ask: BigNumber;\n}\n\nexport type GetEngineMarketPriceResponse = EngineMarketPrice;\n\nexport interface GetEngineMarketPricesParams {\n productIds: number[];\n}\n\nexport interface GetEngineMarketPricesResponse {\n marketPrices: EngineMarketPrice[];\n}\n\nexport interface GetEngineMaxOrderSizeParams extends Subaccount {\n price: BigNumber;\n productId: number;\n // Note: When `reduceOnly` is true, `side` must be opposite of the current position, otherwise it returns 0.\n side: BalanceSide;\n // If not given, engine defaults to true (leverage/borrow enabled) for spot\n // Do not pass this for perp products\n spotLeverage?: boolean;\n // If not given, engine defaults to false. If true, the max order size will be capped to the subaccount's current position size;\n // If no position exists, it will return 0.\n reduceOnly?: boolean;\n isolated?: boolean;\n // If not given, engine defaults to true (do not borrow margin for isolated orders)\n // Max order size query for `isolated` includes available transfer from the cross subaccount\n isoBorrowMargin?: boolean;\n}\n\nexport type GetEngineMaxOrderSizeResponse = BigNumber;\n\nexport interface GetEngineMaxWithdrawableParams extends Subaccount {\n productId: number;\n // If not given, engine defaults to true (leverage/borrow enabled)\n spotLeverage?: boolean;\n}\n\nexport type GetEngineMaxWithdrawableResponse = BigNumber;\n\nexport type GetEngineTimeResponse = EngineServerTimeResponse;\n\nexport type GetEngineLinkedSignerParams = Subaccount;\n\nexport interface GetEngineLinkedSignerResponse {\n signer: string;\n}\n\nexport type GetEngineInsuranceResponse = BigNumber;\n\n/**\n * Given an IP, backend will either:\n * - Allow queries only through archive / engine (query_only)\n * - Block all requests (blocked)\n * - Allow all requests (null)\n */\nexport type GetEngineIpBlockStatusResponse = 'query_only' | 'blocked' | null;\n\n/**\n * ISO 3166-1 alpha-2 country code detected by the gateway (e.g. `'US'`, `'NO'`),\n * or `null` if the gateway did not provide one (e.g. local environments).\n *\n * Suitable for region-based UI gating such as geoblocking trading competitions.\n */\nexport type GetEngineCountryCodeResponse = string | null;\n\nexport interface GetEngineMaxMintNlpAmountParams extends Subaccount {\n // If not given, engine defaults to true (leverage/borrow enabled)\n spotLeverage?: boolean;\n}\n\nexport type GetEngineMaxMintNlpAmountResponse = BigNumber;\n\nexport type GetEngineMaxBurnNlpAmountParams = Subaccount;\n\nexport type GetEngineMaxBurnNlpAmountResponse = BigNumber;\n\nexport type GetEngineNlpLockedBalancesParams = Subaccount;\n\nexport interface EngineNlpBalance {\n productId: number;\n balance: BigNumber;\n}\n\nexport interface EngineNlpLockedBalance extends EngineNlpBalance {\n unlockedAt: number;\n}\n\nexport interface GetEngineNlpLockedBalancesResponse {\n lockedBalances: EngineNlpLockedBalance[];\n balanceLocked: EngineNlpBalance;\n balanceUnlocked: EngineNlpBalance;\n}\n\nexport interface NlpPool {\n poolId: number;\n subaccountHex: string;\n ownerAddress: string;\n balanceWeight: BigNumber;\n subaccountInfo: GetEngineSubaccountSummaryResponse;\n openOrders: EngineOrder[];\n}\n\nexport interface GetEngineNlpPoolInfoResponse {\n nlpPools: NlpPool[];\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -178,6 +178,13 @@ type GetEngineInsuranceResponse = BigNumber;
|
|
|
178
178
|
* - Allow all requests (null)
|
|
179
179
|
*/
|
|
180
180
|
type GetEngineIpBlockStatusResponse = 'query_only' | 'blocked' | null;
|
|
181
|
+
/**
|
|
182
|
+
* ISO 3166-1 alpha-2 country code detected by the gateway (e.g. `'US'`, `'NO'`),
|
|
183
|
+
* or `null` if the gateway did not provide one (e.g. local environments).
|
|
184
|
+
*
|
|
185
|
+
* Suitable for region-based UI gating such as geoblocking trading competitions.
|
|
186
|
+
*/
|
|
187
|
+
type GetEngineCountryCodeResponse = string | null;
|
|
181
188
|
interface GetEngineMaxMintNlpAmountParams extends Subaccount {
|
|
182
189
|
spotLeverage?: boolean;
|
|
183
190
|
}
|
|
@@ -209,4 +216,4 @@ interface GetEngineNlpPoolInfoResponse {
|
|
|
209
216
|
nlpPools: NlpPool[];
|
|
210
217
|
}
|
|
211
218
|
|
|
212
|
-
export type { EngineMarketPrice, EngineNlpBalance, EngineNlpLockedBalance, EngineOrder, EnginePriceTickLiquidity, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineContractsResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineHealthGroupsResponse, GetEngineInsuranceResponse, GetEngineIpBlockStatusResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxBurnNlpAmountParams, GetEngineMaxBurnNlpAmountResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineNlpLockedBalancesParams, GetEngineNlpLockedBalancesResponse, GetEngineNlpPoolInfoResponse, GetEngineNoncesParams, GetEngineNoncesResponse, GetEngineOrderParams, GetEngineOrderResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineSymbolsParams, GetEngineTimeResponse, NlpPool, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountSummaryState, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams };
|
|
219
|
+
export type { EngineMarketPrice, EngineNlpBalance, EngineNlpLockedBalance, EngineOrder, EnginePriceTickLiquidity, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineContractsResponse, GetEngineCountryCodeResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineHealthGroupsResponse, GetEngineInsuranceResponse, GetEngineIpBlockStatusResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxBurnNlpAmountParams, GetEngineMaxBurnNlpAmountResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineNlpLockedBalancesParams, GetEngineNlpLockedBalancesResponse, GetEngineNlpPoolInfoResponse, GetEngineNoncesParams, GetEngineNoncesResponse, GetEngineOrderParams, GetEngineOrderResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineSymbolsParams, GetEngineTimeResponse, NlpPool, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountSummaryState, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams };
|
|
@@ -178,6 +178,13 @@ type GetEngineInsuranceResponse = BigNumber;
|
|
|
178
178
|
* - Allow all requests (null)
|
|
179
179
|
*/
|
|
180
180
|
type GetEngineIpBlockStatusResponse = 'query_only' | 'blocked' | null;
|
|
181
|
+
/**
|
|
182
|
+
* ISO 3166-1 alpha-2 country code detected by the gateway (e.g. `'US'`, `'NO'`),
|
|
183
|
+
* or `null` if the gateway did not provide one (e.g. local environments).
|
|
184
|
+
*
|
|
185
|
+
* Suitable for region-based UI gating such as geoblocking trading competitions.
|
|
186
|
+
*/
|
|
187
|
+
type GetEngineCountryCodeResponse = string | null;
|
|
181
188
|
interface GetEngineMaxMintNlpAmountParams extends Subaccount {
|
|
182
189
|
spotLeverage?: boolean;
|
|
183
190
|
}
|
|
@@ -209,4 +216,4 @@ interface GetEngineNlpPoolInfoResponse {
|
|
|
209
216
|
nlpPools: NlpPool[];
|
|
210
217
|
}
|
|
211
218
|
|
|
212
|
-
export type { EngineMarketPrice, EngineNlpBalance, EngineNlpLockedBalance, EngineOrder, EnginePriceTickLiquidity, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineContractsResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineHealthGroupsResponse, GetEngineInsuranceResponse, GetEngineIpBlockStatusResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxBurnNlpAmountParams, GetEngineMaxBurnNlpAmountResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineNlpLockedBalancesParams, GetEngineNlpLockedBalancesResponse, GetEngineNlpPoolInfoResponse, GetEngineNoncesParams, GetEngineNoncesResponse, GetEngineOrderParams, GetEngineOrderResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineSymbolsParams, GetEngineTimeResponse, NlpPool, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountSummaryState, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams };
|
|
219
|
+
export type { EngineMarketPrice, EngineNlpBalance, EngineNlpLockedBalance, EngineOrder, EnginePriceTickLiquidity, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineContractsResponse, GetEngineCountryCodeResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineHealthGroupsResponse, GetEngineInsuranceResponse, GetEngineIpBlockStatusResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxBurnNlpAmountParams, GetEngineMaxBurnNlpAmountResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineNlpLockedBalancesParams, GetEngineNlpLockedBalancesResponse, GetEngineNlpPoolInfoResponse, GetEngineNoncesParams, GetEngineNoncesResponse, GetEngineOrderParams, GetEngineOrderResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineSymbolsParams, GetEngineTimeResponse, NlpPool, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountSummaryState, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams };
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { EngineBurnNlpParams, EngineCancelAndPlaceParams, EngineCancelOrdersParams, EngineCancelProductOrdersParams, EngineExecuteRequestParamsByType, EngineLinkSignerParams, EngineLiquidateSubaccountParams, EngineMintNlpParams, EngineOrderParams, EnginePlaceOrderParams, EnginePlaceOrderResult, EnginePlaceOrdersParams, EngineTransferQuoteParams, EngineWithdrawCollateralParams, SignatureParams, WithBaseEngineExecuteParams, WithSignature } from './clientExecuteTypes.cjs';
|
|
2
|
-
export { EngineMarketPrice, EngineNlpBalance, EngineNlpLockedBalance, EngineOrder, EnginePriceTickLiquidity, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineContractsResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineHealthGroupsResponse, GetEngineInsuranceResponse, GetEngineIpBlockStatusResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxBurnNlpAmountParams, GetEngineMaxBurnNlpAmountResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineNlpLockedBalancesParams, GetEngineNlpLockedBalancesResponse, GetEngineNlpPoolInfoResponse, GetEngineNoncesParams, GetEngineNoncesResponse, GetEngineOrderParams, GetEngineOrderResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineSymbolsParams, GetEngineTimeResponse, NlpPool, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountSummaryState, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams } from './clientQueryTypes.cjs';
|
|
2
|
+
export { EngineMarketPrice, EngineNlpBalance, EngineNlpLockedBalance, EngineOrder, EnginePriceTickLiquidity, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineContractsResponse, GetEngineCountryCodeResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineHealthGroupsResponse, GetEngineInsuranceResponse, GetEngineIpBlockStatusResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxBurnNlpAmountParams, GetEngineMaxBurnNlpAmountResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineNlpLockedBalancesParams, GetEngineNlpLockedBalancesResponse, GetEngineNlpPoolInfoResponse, GetEngineNoncesParams, GetEngineNoncesResponse, GetEngineOrderParams, GetEngineOrderResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineSymbolsParams, GetEngineTimeResponse, NlpPool, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountSummaryState, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams } from './clientQueryTypes.cjs';
|
|
3
3
|
export { EngineServerFailureError } from './EngineServerFailureError.cjs';
|
|
4
4
|
export { EngineServerCancelOrdersParams, EngineServerCancelOrdersResponse, EngineServerExecuteFailureResult, EngineServerExecutePlaceOrderPayload, EngineServerExecuteRequestByType, EngineServerExecuteRequestType, EngineServerExecuteResponseDataByType, EngineServerExecuteResult, EngineServerExecuteSuccessResult, EngineServerPlaceOrderParams, EngineServerPlaceOrderResponse, EngineServerPlaceOrdersResponse, EngineServiceCancelAndPlaceParams } from './serverExecuteTypes.cjs';
|
|
5
5
|
export { EngineServerBookInfo, EngineServerHealthBreakdown, EngineServerNlpBalance, EngineServerNlpLockedBalance, EngineServerOrder, EngineServerPerpBalance, EngineServerPerpBalanceData, EngineServerPerpProduct, EngineServerPerpState, EngineServerProductType, EngineServerRisk, EngineServerSpotBalance, EngineServerSpotBalanceData, EngineServerSpotConfig, EngineServerSpotProduct, EngineServerSpotState } from './serverQueryModelTypes.cjs';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { EngineBurnNlpParams, EngineCancelAndPlaceParams, EngineCancelOrdersParams, EngineCancelProductOrdersParams, EngineExecuteRequestParamsByType, EngineLinkSignerParams, EngineLiquidateSubaccountParams, EngineMintNlpParams, EngineOrderParams, EnginePlaceOrderParams, EnginePlaceOrderResult, EnginePlaceOrdersParams, EngineTransferQuoteParams, EngineWithdrawCollateralParams, SignatureParams, WithBaseEngineExecuteParams, WithSignature } from './clientExecuteTypes.js';
|
|
2
|
-
export { EngineMarketPrice, EngineNlpBalance, EngineNlpLockedBalance, EngineOrder, EnginePriceTickLiquidity, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineContractsResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineHealthGroupsResponse, GetEngineInsuranceResponse, GetEngineIpBlockStatusResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxBurnNlpAmountParams, GetEngineMaxBurnNlpAmountResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineNlpLockedBalancesParams, GetEngineNlpLockedBalancesResponse, GetEngineNlpPoolInfoResponse, GetEngineNoncesParams, GetEngineNoncesResponse, GetEngineOrderParams, GetEngineOrderResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineSymbolsParams, GetEngineTimeResponse, NlpPool, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountSummaryState, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams } from './clientQueryTypes.js';
|
|
2
|
+
export { EngineMarketPrice, EngineNlpBalance, EngineNlpLockedBalance, EngineOrder, EnginePriceTickLiquidity, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, GetEngineAllMarketsResponse, GetEngineContractsResponse, GetEngineCountryCodeResponse, GetEngineEstimatedSubaccountSummaryParams, GetEngineHealthGroupsResponse, GetEngineInsuranceResponse, GetEngineIpBlockStatusResponse, GetEngineIsolatedPositionsParams, GetEngineIsolatedPositionsResponse, GetEngineLinkedSignerParams, GetEngineLinkedSignerResponse, GetEngineMarketLiquidityParams, GetEngineMarketLiquidityResponse, GetEngineMarketPriceParams, GetEngineMarketPriceResponse, GetEngineMarketPricesParams, GetEngineMarketPricesResponse, GetEngineMaxBurnNlpAmountParams, GetEngineMaxBurnNlpAmountResponse, GetEngineMaxMintNlpAmountParams, GetEngineMaxMintNlpAmountResponse, GetEngineMaxOrderSizeParams, GetEngineMaxOrderSizeResponse, GetEngineMaxWithdrawableParams, GetEngineMaxWithdrawableResponse, GetEngineNlpLockedBalancesParams, GetEngineNlpLockedBalancesResponse, GetEngineNlpPoolInfoResponse, GetEngineNoncesParams, GetEngineNoncesResponse, GetEngineOrderParams, GetEngineOrderResponse, GetEngineSubaccountFeeRatesParams, GetEngineSubaccountFeeRatesResponse, GetEngineSubaccountOrdersParams, GetEngineSubaccountOrdersResponse, GetEngineSubaccountProductOrdersParams, GetEngineSubaccountProductOrdersResponse, GetEngineSubaccountSummaryParams, GetEngineSubaccountSummaryResponse, GetEngineSymbolsParams, GetEngineTimeResponse, NlpPool, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountSummaryState, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams } from './clientQueryTypes.js';
|
|
3
3
|
export { EngineServerFailureError } from './EngineServerFailureError.js';
|
|
4
4
|
export { EngineServerCancelOrdersParams, EngineServerCancelOrdersResponse, EngineServerExecuteFailureResult, EngineServerExecutePlaceOrderPayload, EngineServerExecuteRequestByType, EngineServerExecuteRequestType, EngineServerExecuteResponseDataByType, EngineServerExecuteResult, EngineServerExecuteSuccessResult, EngineServerPlaceOrderParams, EngineServerPlaceOrderResponse, EngineServerPlaceOrdersResponse, EngineServiceCancelAndPlaceParams } from './serverExecuteTypes.js';
|
|
5
5
|
export { EngineServerBookInfo, EngineServerHealthBreakdown, EngineServerNlpBalance, EngineServerNlpLockedBalance, EngineServerOrder, EngineServerPerpBalance, EngineServerPerpBalanceData, EngineServerPerpProduct, EngineServerPerpState, EngineServerProductType, EngineServerRisk, EngineServerSpotBalance, EngineServerSpotBalanceData, EngineServerSpotConfig, EngineServerSpotProduct, EngineServerSpotState } from './serverQueryModelTypes.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nadohq/engine-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "HTTP client for the Nado off-chain matching engine",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"module": "./dist/index.js",
|
|
42
42
|
"types": "./dist/index.d.ts",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@nadohq/shared": "^0.
|
|
44
|
+
"@nadohq/shared": "^0.14.0",
|
|
45
45
|
"axios": "1.14.0",
|
|
46
46
|
"ts-mixer": "6.0.4"
|
|
47
47
|
},
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"bignumber.js": "10.0.2",
|
|
54
54
|
"viem": "2.45.3"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "162e859a10cd0b9e4a14e435fec184f202746cf3"
|
|
57
57
|
}
|
package/src/EngineWebClient.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { EngineBaseClient } from './EngineBaseClient';
|
|
2
2
|
import {
|
|
3
3
|
EngineServerIpBlockResponse,
|
|
4
|
+
GetEngineCountryCodeResponse,
|
|
4
5
|
GetEngineIpBlockStatusResponse,
|
|
5
6
|
GetEngineTimeResponse,
|
|
6
7
|
} from './types';
|
|
7
8
|
|
|
9
|
+
const COUNTRY_HEADER = 'x-nado-country';
|
|
10
|
+
|
|
8
11
|
/**
|
|
9
12
|
* Queries that talk directly to web, _not_ the engine. Placing here in the `engine-client` as we don't have enough
|
|
10
13
|
* use cases to justify a separate package
|
|
@@ -16,7 +19,7 @@ export class EngineWebClient extends EngineBaseClient {
|
|
|
16
19
|
async getIpBlockStatus(): Promise<GetEngineIpBlockStatusResponse> {
|
|
17
20
|
return (
|
|
18
21
|
this.axiosInstance
|
|
19
|
-
// Use the /
|
|
22
|
+
// Use the /ip endpoint and listen to 403 responses
|
|
20
23
|
.get(`${this.opts.url}/ip`, {
|
|
21
24
|
// IP checks go through Cloudflare, which uses allow-origin as *, so withCredentials needs to be false
|
|
22
25
|
withCredentials: false,
|
|
@@ -36,6 +39,23 @@ export class EngineWebClient extends EngineBaseClient {
|
|
|
36
39
|
);
|
|
37
40
|
}
|
|
38
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Retrieves the caller's country code as detected by the gateway, sourced
|
|
44
|
+
* from the `x-nado-country` response header on `/ip`. Returns `null` when
|
|
45
|
+
* the gateway does not provide it (e.g. local environments).
|
|
46
|
+
*
|
|
47
|
+
* Useful for region-based UI gating such as geoblocking trading competitions.
|
|
48
|
+
*/
|
|
49
|
+
async getCountryCode(): Promise<GetEngineCountryCodeResponse> {
|
|
50
|
+
const res = await this.axiosInstance.get(`${this.opts.url}/ip`, {
|
|
51
|
+
// IP checks go through Cloudflare, which uses allow-origin as *, so withCredentials needs to be false
|
|
52
|
+
withCredentials: false,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const rawCountry = res.headers?.[COUNTRY_HEADER] as string | undefined;
|
|
56
|
+
return rawCountry ?? null;
|
|
57
|
+
}
|
|
58
|
+
|
|
39
59
|
/**
|
|
40
60
|
* Determines whether a client needs to complete the cloudflare JS challenge to interact with the API
|
|
41
61
|
*
|
|
@@ -256,6 +256,14 @@ export type GetEngineInsuranceResponse = BigNumber;
|
|
|
256
256
|
*/
|
|
257
257
|
export type GetEngineIpBlockStatusResponse = 'query_only' | 'blocked' | null;
|
|
258
258
|
|
|
259
|
+
/**
|
|
260
|
+
* ISO 3166-1 alpha-2 country code detected by the gateway (e.g. `'US'`, `'NO'`),
|
|
261
|
+
* or `null` if the gateway did not provide one (e.g. local environments).
|
|
262
|
+
*
|
|
263
|
+
* Suitable for region-based UI gating such as geoblocking trading competitions.
|
|
264
|
+
*/
|
|
265
|
+
export type GetEngineCountryCodeResponse = string | null;
|
|
266
|
+
|
|
259
267
|
export interface GetEngineMaxMintNlpAmountParams extends Subaccount {
|
|
260
268
|
// If not given, engine defaults to true (leverage/borrow enabled)
|
|
261
269
|
spotLeverage?: boolean;
|