@nadohq/engine-client 0.33.0 → 0.35.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/{EngineBaseClient-J3nMzK0q.cjs → EngineBaseClient-0oxXtif-.cjs} +3 -2
- package/dist/EngineBaseClient-0oxXtif-.cjs.map +1 -0
- package/dist/{EngineBaseClient-iMKgPJD5.d.cts → EngineBaseClient-BnFoL1j3.d.cts} +2 -1
- package/dist/EngineBaseClient-BnFoL1j3.d.cts.map +1 -0
- package/dist/{EngineBaseClient-TSSMP2CP.d.ts → EngineBaseClient-DMVQl1Gl.d.ts} +2 -1
- package/dist/EngineBaseClient-DMVQl1Gl.d.ts.map +1 -0
- package/dist/EngineBaseClient.cjs +1 -1
- package/dist/EngineBaseClient.d.cts +1 -1
- package/dist/EngineBaseClient.d.ts +1 -1
- package/dist/EngineBaseClient.js +3 -2
- package/dist/EngineBaseClient.js.map +1 -1
- package/dist/EngineClient.cjs +1 -1
- package/dist/EngineClient.d.cts +4 -4
- package/dist/EngineClient.d.ts +4 -4
- package/dist/{EngineEdgeQueryClient-DDO69X3M.d.ts → EngineEdgeQueryClient-Clhdad07.d.ts} +2 -2
- package/dist/{EngineEdgeQueryClient-DDO69X3M.d.ts.map → EngineEdgeQueryClient-Clhdad07.d.ts.map} +1 -1
- package/dist/{EngineEdgeQueryClient-CdITc0f9.d.cts → EngineEdgeQueryClient-DF_FVcUP.d.cts} +2 -2
- package/dist/{EngineEdgeQueryClient-CdITc0f9.d.cts.map → EngineEdgeQueryClient-DF_FVcUP.d.cts.map} +1 -1
- package/dist/EngineEdgeQueryClient.cjs +1 -1
- package/dist/EngineEdgeQueryClient.d.cts +1 -1
- package/dist/EngineEdgeQueryClient.d.ts +1 -1
- package/dist/{EngineExecuteBuilder-BxmeHvue.d.ts → EngineExecuteBuilder-0SYliOEi.d.ts} +2 -2
- package/dist/{EngineExecuteBuilder-BxmeHvue.d.ts.map → EngineExecuteBuilder-0SYliOEi.d.ts.map} +1 -1
- package/dist/{EngineExecuteBuilder-C8DZXfEE.d.cts → EngineExecuteBuilder-Cl1kBugs.d.cts} +2 -2
- package/dist/{EngineExecuteBuilder-C8DZXfEE.d.cts.map → EngineExecuteBuilder-Cl1kBugs.d.cts.map} +1 -1
- package/dist/EngineExecuteBuilder.cjs +1 -1
- package/dist/EngineExecuteBuilder.d.cts +1 -1
- package/dist/EngineExecuteBuilder.d.ts +1 -1
- package/dist/{EngineExecuteClient-Cm-DpHa_.d.cts → EngineExecuteClient-D-a5ZLvc.d.cts} +3 -3
- package/dist/{EngineExecuteClient-Cm-DpHa_.d.cts.map → EngineExecuteClient-D-a5ZLvc.d.cts.map} +1 -1
- package/dist/{EngineExecuteClient-BgPbR6A9.d.ts → EngineExecuteClient-JouJpl62.d.ts} +3 -3
- package/dist/{EngineExecuteClient-BgPbR6A9.d.ts.map → EngineExecuteClient-JouJpl62.d.ts.map} +1 -1
- package/dist/EngineExecuteClient.cjs +1 -1
- package/dist/EngineExecuteClient.d.cts +1 -1
- package/dist/EngineExecuteClient.d.ts +1 -1
- package/dist/{EngineQueryClient-DZ4yx4rP.d.cts → EngineQueryClient-0KRiawOi.d.cts} +2 -2
- package/dist/{EngineQueryClient-DZ4yx4rP.d.cts.map → EngineQueryClient-0KRiawOi.d.cts.map} +1 -1
- package/dist/{EngineQueryClient-m9Z1A-fK.d.ts → EngineQueryClient-CYPBkrRj.d.ts} +2 -2
- package/dist/{EngineQueryClient-m9Z1A-fK.d.ts.map → EngineQueryClient-CYPBkrRj.d.ts.map} +1 -1
- package/dist/EngineQueryClient.cjs +1 -1
- package/dist/EngineQueryClient.d.cts +1 -1
- package/dist/EngineQueryClient.d.ts +1 -1
- package/dist/{EngineWebClient-OSMrINW_.d.cts → EngineWebClient-Bl7-3nYi.d.cts} +2 -2
- package/dist/{EngineWebClient-OSMrINW_.d.cts.map → EngineWebClient-Bl7-3nYi.d.cts.map} +1 -1
- package/dist/{EngineWebClient-DjFeRd5S.d.ts → EngineWebClient-CPFci7kt.d.ts} +2 -2
- package/dist/{EngineWebClient-DjFeRd5S.d.ts.map → EngineWebClient-CPFci7kt.d.ts.map} +1 -1
- package/dist/EngineWebClient.cjs +1 -1
- package/dist/EngineWebClient.d.cts +1 -1
- package/dist/EngineWebClient.d.ts +1 -1
- package/dist/types/EngineServerFailureError.cjs +1 -1
- package/dist/types/engineErrorCodes.cjs +1 -1
- package/dist/utils/productEngineTypeMappers.cjs +1 -1
- package/dist/utils/queryDataMappers.cjs +1 -1
- package/package.json +3 -3
- package/src/EngineBaseClient.ts +4 -0
- package/dist/EngineBaseClient-J3nMzK0q.cjs.map +0 -1
- package/dist/EngineBaseClient-TSSMP2CP.d.ts.map +0 -1
- package/dist/EngineBaseClient-iMKgPJD5.d.cts.map +0 -1
|
@@ -33,7 +33,8 @@ var EngineBaseClient = class {
|
|
|
33
33
|
this.opts = opts;
|
|
34
34
|
this.axiosInstance = axios.default.create({
|
|
35
35
|
withCredentials: true,
|
|
36
|
-
validateStatus: () => true
|
|
36
|
+
validateStatus: () => true,
|
|
37
|
+
headers: (0, _nadohq_shared.getNadoClientTypeHeaders)(opts.clientType)
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
@@ -184,4 +185,4 @@ Object.defineProperty(exports, "__toESM", {
|
|
|
184
185
|
}
|
|
185
186
|
});
|
|
186
187
|
|
|
187
|
-
//# sourceMappingURL=EngineBaseClient-
|
|
188
|
+
//# sourceMappingURL=EngineBaseClient-0oxXtif-.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EngineBaseClient-0oxXtif-.cjs","names":["WalletNotProvidedError","successResponse","EngineServerFailureError"],"sources":["../src/EngineBaseClient.ts"],"sourcesContent":["import {\n getNadoClientTypeHeaders,\n getSignedTransactionRequest,\n SignableRequestType,\n SignableRequestTypeToParams,\n WalletClientWithAccount,\n WalletNotProvidedError,\n} from '@nadohq/shared';\nimport axios, { AxiosInstance, AxiosResponse } from 'axios';\nimport {\n EngineServerCachedQueryRequestByType,\n EngineServerCachedQueryRequestType,\n EngineServerCachedQueryResponse,\n EngineServerCachedQueryResponseByType,\n EngineServerCachedQuerySuccessResponse,\n EngineServerEdgeControlRequestByType,\n EngineServerEdgeControlRequestType,\n EngineServerEdgeControlResponseByType,\n EngineServerExecuteRequestByType,\n EngineServerExecuteRequestType,\n EngineServerExecuteResult,\n EngineServerExecuteSuccessResult,\n EngineServerQueryRequestByType,\n EngineServerQueryRequestType,\n EngineServerQueryResponse,\n EngineServerQueryResponseByType,\n EngineServerQuerySuccessResponse,\n GetEngineNoncesParams,\n GetEngineNoncesResponse,\n} from './types';\nimport { EngineServerFailureError } from './types/EngineServerFailureError';\n\nexport interface EngineClientOpts {\n // Server URL\n url: string;\n // Wallet client for EIP712 signing\n walletClient?: WalletClientWithAccount;\n // Linked signer registered through the engine, if provided, execute requests will use this signer\n linkedSignerWalletClient?: WalletClientWithAccount;\n // If provided, identifies the calling client, sent as a header with every request\n clientType?: string;\n}\n\n// Only 1 key can be defined per execute request\ntype EngineExecuteRequestBody = Partial<EngineServerExecuteRequestByType>;\n\ntype EngineQueryRequestResponse<\n T extends EngineServerQueryRequestType = EngineServerQueryRequestType,\n> = EngineServerQueryResponse<T>;\n\ntype EngineCachedQueryRequestResponse<\n T extends EngineServerCachedQueryRequestType =\n EngineServerCachedQueryRequestType,\n> = EngineServerCachedQueryResponse<T>;\n\n/**\n * Base client for all engine requests\n */\nexport class EngineBaseClient {\n readonly opts: EngineClientOpts;\n readonly axiosInstance: AxiosInstance;\n\n constructor(opts: EngineClientOpts) {\n this.opts = opts;\n this.axiosInstance = axios.create({\n withCredentials: true,\n // We have custom logic to validate response status and create an appropriate error\n validateStatus: () => true,\n headers: getNadoClientTypeHeaders(opts.clientType),\n });\n }\n\n /**\n * Sets the linked signer for execute requests\n *\n * @param linkedSignerWalletClient The linkedSigner to use for all signatures. Set to null to revert to the chain signer\n */\n public setLinkedSigner(\n linkedSignerWalletClient: WalletClientWithAccount | null,\n ) {\n this.opts.linkedSignerWalletClient = linkedSignerWalletClient ?? undefined;\n }\n\n public async getTxNonce(address?: string): Promise<string> {\n const addr = address ?? this.opts.walletClient?.account.address;\n\n if (!addr) {\n throw new WalletNotProvidedError();\n }\n\n return (\n await this.getNonces({\n address: addr,\n })\n ).txNonce;\n }\n\n public async getNonces(\n params: GetEngineNoncesParams,\n ): Promise<GetEngineNoncesResponse> {\n const baseResp = await this.query('nonces', params);\n\n return {\n orderNonce: baseResp.order_nonce,\n txNonce: baseResp.tx_nonce,\n };\n }\n\n /**\n * Queries the engine, all query params are stringified into the query string\n *\n * @param requestType\n * @param params\n * @public\n */\n public async query<TRequestType extends EngineServerQueryRequestType>(\n requestType: TRequestType,\n params: EngineServerQueryRequestByType[TRequestType],\n ): Promise<EngineServerQueryResponseByType[TRequestType]> {\n const request = this.getQueryRequest(requestType, params);\n const response = await this.axiosInstance.post<EngineQueryRequestResponse>(\n `${this.opts.url}/query`,\n request,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus throws on failure responses so the cast to the success response is acceptable here\n const successResponse = response as AxiosResponse<\n EngineServerQuerySuccessResponse<TRequestType>\n >;\n\n return successResponse.data.data;\n }\n\n /**\n * Queries the gateway's in-memory cache via the `/edge/query` endpoint. Lower latency than\n * {@link query} at the cost of eventual consistency — do not use for order, margin, or\n * settlement decisions.\n *\n * @param requestType\n * @param params\n * @public\n */\n public async edgeQuery<\n TRequestType extends EngineServerCachedQueryRequestType,\n >(\n requestType: TRequestType,\n params: EngineServerCachedQueryRequestByType[TRequestType],\n ): Promise<EngineServerCachedQueryResponseByType[TRequestType]> {\n const request = this.getQueryRequest(requestType, params);\n const response =\n await this.axiosInstance.post<EngineCachedQueryRequestResponse>(\n `${this.opts.url}/edge/query`,\n request,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus throws on failure responses so the cast to the success response is acceptable here\n const successResponse = response as AxiosResponse<\n EngineServerCachedQuerySuccessResponse<TRequestType>\n >;\n\n return successResponse.data.data;\n }\n\n /**\n * Sends an edge control message (`ping` / `time`) via the `/edge/query` endpoint. These\n * return immediately from the server clock and use a different envelope than the cached data\n * queries (no `data` field), so the whole response body is returned.\n *\n * @param requestType\n * @param params\n * @public\n */\n public async edgeControlQuery<\n TRequestType extends EngineServerEdgeControlRequestType,\n >(\n requestType: TRequestType,\n params: EngineServerEdgeControlRequestByType[TRequestType],\n ): Promise<EngineServerEdgeControlResponseByType[TRequestType]> {\n const request = this.getQueryRequest(requestType, params);\n const response = await this.axiosInstance.post<\n EngineServerEdgeControlResponseByType[TRequestType]\n >(`${this.opts.url}/edge/query`, request);\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n return response.data;\n }\n\n /**\n * POSTs an execute message to the engine and returns the successful response. Throws the failure response wrapped\n * in an EngineServerFailureError on failure.\n *\n * @param requestType\n * @param params\n * @public\n */\n public async execute<TRequestType extends EngineServerExecuteRequestType>(\n requestType: TRequestType,\n params: EngineServerExecuteRequestByType[TRequestType],\n ): Promise<EngineServerExecuteSuccessResult<TRequestType>> {\n const reqBody = this.getExecuteRequest(requestType, params);\n const response = await this.axiosInstance.post<\n EngineServerExecuteResult<TRequestType>\n >(`${this.opts.url}/execute`, reqBody);\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus catches the failure result and throws the error, so the cast to the success response is acceptable here\n return response.data as EngineServerExecuteSuccessResult<TRequestType>;\n }\n\n /**\n * A simple, typechecked fn for constructing a `type`-tagged request body in the format expected\n * by the server. Generic over the request type / params pair so it can build live query, edge\n * (cached) query, and edge control request bodies alike.\n *\n * @param requestType\n * @param params\n */\n public getQueryRequest<TRequestType extends string, TParams extends object>(\n requestType: TRequestType,\n params: TParams,\n ): { type: TRequestType } & TParams {\n return {\n type: requestType,\n ...params,\n };\n }\n\n /**\n * A simple, typechecked fn for constructing an execute request in the format expected by the server.\n *\n * @param requestType\n * @param params\n */\n public getExecuteRequest<TRequestType extends EngineServerExecuteRequestType>(\n requestType: TRequestType,\n params: EngineServerExecuteRequestByType[TRequestType],\n ): EngineExecuteRequestBody {\n return {\n [requestType]: params,\n };\n }\n\n /**\n * Signs a given request with the signer provided to the engine\n *\n * @param requestType\n * @param verifyingContract\n * @param chainId\n * @param params\n * @public\n */\n public async sign<T extends SignableRequestType>(\n requestType: T,\n verifyingContract: string,\n chainId: number,\n params: SignableRequestTypeToParams[T],\n ) {\n // Use the linked signer if provided, otherwise use the default signer provided to the engine\n // However, always use wallet signer for withdraw_collateral_v2 as linked signers are not allowed for different\n // withdrawal addresses\n const walletClient = (() => {\n if (requestType === 'withdraw_collateral_v2') {\n return this.opts.walletClient;\n }\n return this.opts.linkedSignerWalletClient ?? this.opts.walletClient;\n })();\n\n if (!walletClient) {\n throw new WalletNotProvidedError();\n }\n\n return getSignedTransactionRequest({\n chainId,\n requestParams: params,\n requestType,\n walletClient,\n verifyingContract,\n });\n }\n\n private checkResponseStatus(response: AxiosResponse) {\n if (response.status !== 200 || !response.data) {\n throw Error(\n `Unexpected response from server: ${response.status} ${response.statusText}. Data: ${response.data}`,\n );\n }\n }\n\n private checkServerStatus(\n response: AxiosResponse<\n | EngineServerExecuteResult\n | EngineQueryRequestResponse\n | EngineCachedQueryRequestResponse\n | EngineServerEdgeControlResponseByType[EngineServerEdgeControlRequestType]\n >,\n ) {\n if (response.data.status !== 'success') {\n throw new EngineServerFailureError(response.data);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,IAAa,mBAAb,MAA8B;CAI5B,YAAY,MAAwB;EAClC,KAAK,OAAO;EACZ,KAAK,gBAAgB,MAAA,QAAM,OAAO;GAChC,iBAAiB;GAEjB,sBAAsB;GACtB,UAAA,GAAA,eAAA,0BAAkC,KAAK,UAAU;EACnD,CAAC;CACH;;;;;;CAOA,gBACE,0BACA;EACA,KAAK,KAAK,2BAA2B,4BAA4B,KAA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AO;EAErC,KAAK,oBAAoB,QAAQ;EACjC,KAAK,kBAAkB,QAAQ;EAG/B,OAAO,SAAS;CAClB;;;;;;;;;CAUA,gBACE,aACA,QACkC;EAClC,OAAO;GACL,MAAM;GACN,GAAG;EACL;CACF;;;;;;;CAQA,kBACE,aACA,QAC0B;EAC1B,OAAO,GACJ,cAAc,OACjB;CACF;;;;;;;;;;CAWA,MAAa,KACX,aACA,mBACA,SACA,QACA;EAIA,MAAM,sBAAsB;GAC1B,IAAI,gBAAgB,0BAClB,OAAO,KAAK,KAAK;GAEnB,OAAO,KAAK,KAAK,4BAA4B,KAAK,KAAK;EACzD,GAAG;EAEH,IAAI,CAAC,cACH,MAAM,IAAID,eAAAA,uBAAuB;EAGnC,QAAA,GAAA,eAAA,6BAAmC;GACjC;GACA,eAAe;GACf;GACA;GACA;EACF,CAAC;CACH;CAEA,oBAA4B,UAAyB;EACnD,IAAI,SAAS,WAAW,OAAO,CAAC,SAAS,MACvC,MAAM,MACJ,oCAAoC,SAAS,OAAO,GAAG,SAAS,WAAW,UAAU,SAAS,MAChG;CAEJ;CAEA,kBACE,UAMA;EACA,IAAI,SAAS,KAAK,WAAW,WAC3B,MAAM,IAAIE,uCAAAA,yBAAyB,SAAS,IAAI;CAEpD;AACF"}
|
|
@@ -10,6 +10,7 @@ interface EngineClientOpts {
|
|
|
10
10
|
url: string;
|
|
11
11
|
walletClient?: WalletClientWithAccount;
|
|
12
12
|
linkedSignerWalletClient?: WalletClientWithAccount;
|
|
13
|
+
clientType?: string;
|
|
13
14
|
}
|
|
14
15
|
type EngineExecuteRequestBody = Partial<EngineServerExecuteRequestByType>;
|
|
15
16
|
/**
|
|
@@ -97,4 +98,4 @@ declare class EngineBaseClient {
|
|
|
97
98
|
}
|
|
98
99
|
//#endregion
|
|
99
100
|
export { EngineClientOpts as n, EngineBaseClient as t };
|
|
100
|
-
//# sourceMappingURL=EngineBaseClient-
|
|
101
|
+
//# sourceMappingURL=EngineBaseClient-BnFoL1j3.d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,EAAQ,OAAA;IACL,IAAA,EAAM,YAAA;EAAA,IAAiB,OAAA;EAgBzB;;;;;;EAHI,iBAAA,sBAAuC,8BAAA,CAAA,CAC5C,WAAA,EAAa,YAAA,EACb,MAAA,EAAQ,gCAAA,CAAiC,YAAA,IACxC,wBAAA;EAmBqC;;;;;;;;;EAJ3B,IAAA,WAAe,mBAAA,CAAA,CAC1B,WAAA,EAAa,CAAA,EACb,iBAAA,UACA,OAAA,UACA,MAAA,EAAQ,2BAAA,CAA4B,CAAA,IAAE,OAAA;EAAA,QAyBhC,mBAAA;EAAA,QAQA,iBAAA;AAAA"}
|
|
@@ -10,6 +10,7 @@ interface EngineClientOpts {
|
|
|
10
10
|
url: string;
|
|
11
11
|
walletClient?: WalletClientWithAccount;
|
|
12
12
|
linkedSignerWalletClient?: WalletClientWithAccount;
|
|
13
|
+
clientType?: string;
|
|
13
14
|
}
|
|
14
15
|
type EngineExecuteRequestBody = Partial<EngineServerExecuteRequestByType>;
|
|
15
16
|
/**
|
|
@@ -97,4 +98,4 @@ declare class EngineBaseClient {
|
|
|
97
98
|
}
|
|
98
99
|
//#endregion
|
|
99
100
|
export { EngineClientOpts as n, EngineBaseClient as t };
|
|
100
|
-
//# sourceMappingURL=EngineBaseClient-
|
|
101
|
+
//# sourceMappingURL=EngineBaseClient-DMVQl1Gl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EngineBaseClient-DMVQl1Gl.d.ts","names":[],"sources":["../src/src/EngineBaseClient.ts"],"mappings":";;;;;;;;UAgCiB,gBAAA;EAEf,GAAA;EAEA,YAAA,GAAe,uBAAA;EAEf,wBAAA,GAA2B,uBAAuB;EAElD,UAAA;AAAA;AAAA,KAIG,wBAAA,GAA2B,OAAO,CAAC,gCAAA;;;;cAc3B,gBAAA;EAAA,SACF,IAAA,EAAM,gBAAA;EAAA,SACN,aAAA,EAAe,aAAA;cAEZ,IAAA,EAAM,gBAAA;EAxBS;;;AAEjB;AACX;E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@@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_EngineBaseClient = require("./EngineBaseClient-
|
|
2
|
+
const require_EngineBaseClient = require("./EngineBaseClient-0oxXtif-.cjs");
|
|
3
3
|
exports.EngineBaseClient = require_EngineBaseClient.EngineBaseClient;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as EngineClientOpts, t as EngineBaseClient } from "./EngineBaseClient-
|
|
1
|
+
import { n as EngineClientOpts, t as EngineBaseClient } from "./EngineBaseClient-BnFoL1j3.cjs";
|
|
2
2
|
export { EngineBaseClient, EngineClientOpts };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as EngineClientOpts, t as EngineBaseClient } from "./EngineBaseClient-
|
|
1
|
+
import { n as EngineClientOpts, t as EngineBaseClient } from "./EngineBaseClient-DMVQl1Gl.js";
|
|
2
2
|
export { EngineBaseClient, EngineClientOpts };
|
package/dist/EngineBaseClient.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EngineServerFailureError } from "./types/EngineServerFailureError.js";
|
|
2
|
-
import { WalletNotProvidedError, getSignedTransactionRequest } from "@nadohq/shared";
|
|
2
|
+
import { WalletNotProvidedError, getNadoClientTypeHeaders, getSignedTransactionRequest } from "@nadohq/shared";
|
|
3
3
|
import axios from "axios";
|
|
4
4
|
//#region src/EngineBaseClient.ts
|
|
5
5
|
/**
|
|
@@ -10,7 +10,8 @@ var EngineBaseClient = class {
|
|
|
10
10
|
this.opts = opts;
|
|
11
11
|
this.axiosInstance = axios.create({
|
|
12
12
|
withCredentials: true,
|
|
13
|
-
validateStatus: () => true
|
|
13
|
+
validateStatus: () => true,
|
|
14
|
+
headers: getNadoClientTypeHeaders(opts.clientType)
|
|
14
15
|
});
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineBaseClient.js","names":["successResponse"],"sources":["../src/EngineBaseClient.ts"],"sourcesContent":["import {\n getSignedTransactionRequest,\n SignableRequestType,\n SignableRequestTypeToParams,\n WalletClientWithAccount,\n WalletNotProvidedError,\n} from '@nadohq/shared';\nimport axios, { AxiosInstance, AxiosResponse } from 'axios';\nimport {\n EngineServerCachedQueryRequestByType,\n EngineServerCachedQueryRequestType,\n EngineServerCachedQueryResponse,\n EngineServerCachedQueryResponseByType,\n EngineServerCachedQuerySuccessResponse,\n EngineServerEdgeControlRequestByType,\n EngineServerEdgeControlRequestType,\n EngineServerEdgeControlResponseByType,\n EngineServerExecuteRequestByType,\n EngineServerExecuteRequestType,\n EngineServerExecuteResult,\n EngineServerExecuteSuccessResult,\n EngineServerQueryRequestByType,\n EngineServerQueryRequestType,\n EngineServerQueryResponse,\n EngineServerQueryResponseByType,\n EngineServerQuerySuccessResponse,\n GetEngineNoncesParams,\n GetEngineNoncesResponse,\n} from './types';\nimport { EngineServerFailureError } from './types/EngineServerFailureError';\n\nexport interface EngineClientOpts {\n // Server URL\n url: string;\n // Wallet client for EIP712 signing\n walletClient?: WalletClientWithAccount;\n // Linked signer registered through the engine, if provided, execute requests will use this signer\n linkedSignerWalletClient?: WalletClientWithAccount;\n}\n\n// Only 1 key can be defined per execute request\ntype EngineExecuteRequestBody = Partial<EngineServerExecuteRequestByType>;\n\ntype EngineQueryRequestResponse<\n T extends EngineServerQueryRequestType = EngineServerQueryRequestType,\n> = EngineServerQueryResponse<T>;\n\ntype EngineCachedQueryRequestResponse<\n T extends EngineServerCachedQueryRequestType =\n EngineServerCachedQueryRequestType,\n> = EngineServerCachedQueryResponse<T>;\n\n/**\n * Base client for all engine requests\n */\nexport class EngineBaseClient {\n readonly opts: EngineClientOpts;\n readonly axiosInstance: AxiosInstance;\n\n constructor(opts: EngineClientOpts) {\n this.opts = opts;\n this.axiosInstance = axios.create({\n withCredentials: true,\n // We have custom logic to validate response status and create an appropriate error\n validateStatus: () => true,\n });\n }\n\n /**\n * Sets the linked signer for execute requests\n *\n * @param linkedSignerWalletClient The linkedSigner to use for all signatures. Set to null to revert to the chain signer\n */\n public setLinkedSigner(\n linkedSignerWalletClient: WalletClientWithAccount | null,\n ) {\n this.opts.linkedSignerWalletClient = linkedSignerWalletClient ?? undefined;\n }\n\n public async getTxNonce(address?: string): Promise<string> {\n const addr = address ?? this.opts.walletClient?.account.address;\n\n if (!addr) {\n throw new WalletNotProvidedError();\n }\n\n return (\n await this.getNonces({\n address: addr,\n })\n ).txNonce;\n }\n\n public async getNonces(\n params: GetEngineNoncesParams,\n ): Promise<GetEngineNoncesResponse> {\n const baseResp = await this.query('nonces', params);\n\n return {\n orderNonce: baseResp.order_nonce,\n txNonce: baseResp.tx_nonce,\n };\n }\n\n /**\n * Queries the engine, all query params are stringified into the query string\n *\n * @param requestType\n * @param params\n * @public\n */\n public async query<TRequestType extends EngineServerQueryRequestType>(\n requestType: TRequestType,\n params: EngineServerQueryRequestByType[TRequestType],\n ): Promise<EngineServerQueryResponseByType[TRequestType]> {\n const request = this.getQueryRequest(requestType, params);\n const response = await this.axiosInstance.post<EngineQueryRequestResponse>(\n `${this.opts.url}/query`,\n request,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus throws on failure responses so the cast to the success response is acceptable here\n const successResponse = response as AxiosResponse<\n EngineServerQuerySuccessResponse<TRequestType>\n >;\n\n return successResponse.data.data;\n }\n\n /**\n * Queries the gateway's in-memory cache via the `/edge/query` endpoint. Lower latency than\n * {@link query} at the cost of eventual consistency — do not use for order, margin, or\n * settlement decisions.\n *\n * @param requestType\n * @param params\n * @public\n */\n public async edgeQuery<\n TRequestType extends EngineServerCachedQueryRequestType,\n >(\n requestType: TRequestType,\n params: EngineServerCachedQueryRequestByType[TRequestType],\n ): Promise<EngineServerCachedQueryResponseByType[TRequestType]> {\n const request = this.getQueryRequest(requestType, params);\n const response =\n await this.axiosInstance.post<EngineCachedQueryRequestResponse>(\n `${this.opts.url}/edge/query`,\n request,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus throws on failure responses so the cast to the success response is acceptable here\n const successResponse = response as AxiosResponse<\n EngineServerCachedQuerySuccessResponse<TRequestType>\n >;\n\n return successResponse.data.data;\n }\n\n /**\n * Sends an edge control message (`ping` / `time`) via the `/edge/query` endpoint. These\n * return immediately from the server clock and use a different envelope than the cached data\n * queries (no `data` field), so the whole response body is returned.\n *\n * @param requestType\n * @param params\n * @public\n */\n public async edgeControlQuery<\n TRequestType extends EngineServerEdgeControlRequestType,\n >(\n requestType: TRequestType,\n params: EngineServerEdgeControlRequestByType[TRequestType],\n ): Promise<EngineServerEdgeControlResponseByType[TRequestType]> {\n const request = this.getQueryRequest(requestType, params);\n const response = await this.axiosInstance.post<\n EngineServerEdgeControlResponseByType[TRequestType]\n >(`${this.opts.url}/edge/query`, request);\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n return response.data;\n }\n\n /**\n * POSTs an execute message to the engine and returns the successful response. Throws the failure response wrapped\n * in an EngineServerFailureError on failure.\n *\n * @param requestType\n * @param params\n * @public\n */\n public async execute<TRequestType extends EngineServerExecuteRequestType>(\n requestType: TRequestType,\n params: EngineServerExecuteRequestByType[TRequestType],\n ): Promise<EngineServerExecuteSuccessResult<TRequestType>> {\n const reqBody = this.getExecuteRequest(requestType, params);\n const response = await this.axiosInstance.post<\n EngineServerExecuteResult<TRequestType>\n >(`${this.opts.url}/execute`, reqBody);\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus catches the failure result and throws the error, so the cast to the success response is acceptable here\n return response.data as EngineServerExecuteSuccessResult<TRequestType>;\n }\n\n /**\n * A simple, typechecked fn for constructing a `type`-tagged request body in the format expected\n * by the server. Generic over the request type / params pair so it can build live query, edge\n * (cached) query, and edge control request bodies alike.\n *\n * @param requestType\n * @param params\n */\n public getQueryRequest<TRequestType extends string, TParams extends object>(\n requestType: TRequestType,\n params: TParams,\n ): { type: TRequestType } & TParams {\n return {\n type: requestType,\n ...params,\n };\n }\n\n /**\n * A simple, typechecked fn for constructing an execute request in the format expected by the server.\n *\n * @param requestType\n * @param params\n */\n public getExecuteRequest<TRequestType extends EngineServerExecuteRequestType>(\n requestType: TRequestType,\n params: EngineServerExecuteRequestByType[TRequestType],\n ): EngineExecuteRequestBody {\n return {\n [requestType]: params,\n };\n }\n\n /**\n * Signs a given request with the signer provided to the engine\n *\n * @param requestType\n * @param verifyingContract\n * @param chainId\n * @param params\n * @public\n */\n public async sign<T extends SignableRequestType>(\n requestType: T,\n verifyingContract: string,\n chainId: number,\n params: SignableRequestTypeToParams[T],\n ) {\n // Use the linked signer if provided, otherwise use the default signer provided to the engine\n // However, always use wallet signer for withdraw_collateral_v2 as linked signers are not allowed for different\n // withdrawal addresses\n const walletClient = (() => {\n if (requestType === 'withdraw_collateral_v2') {\n return this.opts.walletClient;\n }\n return this.opts.linkedSignerWalletClient ?? this.opts.walletClient;\n })();\n\n if (!walletClient) {\n throw new WalletNotProvidedError();\n }\n\n return getSignedTransactionRequest({\n chainId,\n requestParams: params,\n requestType,\n walletClient,\n verifyingContract,\n });\n }\n\n private checkResponseStatus(response: AxiosResponse) {\n if (response.status !== 200 || !response.data) {\n throw Error(\n `Unexpected response from server: ${response.status} ${response.statusText}. Data: ${response.data}`,\n );\n }\n }\n\n private checkServerStatus(\n response: AxiosResponse<\n | EngineServerExecuteResult\n | EngineQueryRequestResponse\n | EngineCachedQueryRequestResponse\n | EngineServerEdgeControlResponseByType[EngineServerEdgeControlRequestType]\n >,\n ) {\n if (response.data.status !== 'success') {\n throw new EngineServerFailureError(response.data);\n }\n }\n}\n"],"mappings":";;;;;;;AAuDA,IAAa,mBAAb,MAA8B;CAI5B,YAAY,MAAwB;EAClC,KAAK,OAAO;EACZ,KAAK,gBAAgB,MAAM,OAAO;GAChC,iBAAiB;GAEjB,sBAAsB;EACxB,CAAC;CACH;;;;;;CAOA,gBACE,0BACA;EACA,KAAK,KAAK,2BAA2B,4BAA4B,KAAA;CACnE;CAEA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B,QAAQ;EACjC,KAAK,kBAAkB,QAAQ;EAG/B,OAAO,SAAS;CAClB;;;;;;;;;CAUA,gBACE,aACA,QACkC;EAClC,OAAO;GACL,MAAM;GACN,GAAG;EACL;CACF;;;;;;;CAQA,kBACE,aACA,QAC0B;EAC1B,OAAO,GACJ,cAAc,OACjB;CACF;;;;;;;;;;CAWA,MAAa,KACX,aACA,mBACA,SACA,QACA;EAIA,MAAM,sBAAsB;GAC1B,IAAI,gBAAgB,0BAClB,OAAO,KAAK,KAAK;GAEnB,OAAO,KAAK,KAAK,4BAA4B,KAAK,KAAK;EACzD,GAAG;EAEH,IAAI,CAAC,cACH,MAAM,IAAI,uBAAuB;EAGnC,OAAO,4BAA4B;GACjC;GACA,eAAe;GACf;GACA;GACA;EACF,CAAC;CACH;CAEA,oBAA4B,UAAyB;EACnD,IAAI,SAAS,WAAW,OAAO,CAAC,SAAS,MACvC,MAAM,MACJ,oCAAoC,SAAS,OAAO,GAAG,SAAS,WAAW,UAAU,SAAS,MAChG;CAEJ;CAEA,kBACE,UAMA;EACA,IAAI,SAAS,KAAK,WAAW,WAC3B,MAAM,IAAI,yBAAyB,SAAS,IAAI;CAEpD;AACF"}
|
|
1
|
+
{"version":3,"file":"EngineBaseClient.js","names":["successResponse"],"sources":["../src/EngineBaseClient.ts"],"sourcesContent":["import {\n getNadoClientTypeHeaders,\n getSignedTransactionRequest,\n SignableRequestType,\n SignableRequestTypeToParams,\n WalletClientWithAccount,\n WalletNotProvidedError,\n} from '@nadohq/shared';\nimport axios, { AxiosInstance, AxiosResponse } from 'axios';\nimport {\n EngineServerCachedQueryRequestByType,\n EngineServerCachedQueryRequestType,\n EngineServerCachedQueryResponse,\n EngineServerCachedQueryResponseByType,\n EngineServerCachedQuerySuccessResponse,\n EngineServerEdgeControlRequestByType,\n EngineServerEdgeControlRequestType,\n EngineServerEdgeControlResponseByType,\n EngineServerExecuteRequestByType,\n EngineServerExecuteRequestType,\n EngineServerExecuteResult,\n EngineServerExecuteSuccessResult,\n EngineServerQueryRequestByType,\n EngineServerQueryRequestType,\n EngineServerQueryResponse,\n EngineServerQueryResponseByType,\n EngineServerQuerySuccessResponse,\n GetEngineNoncesParams,\n GetEngineNoncesResponse,\n} from './types';\nimport { EngineServerFailureError } from './types/EngineServerFailureError';\n\nexport interface EngineClientOpts {\n // Server URL\n url: string;\n // Wallet client for EIP712 signing\n walletClient?: WalletClientWithAccount;\n // Linked signer registered through the engine, if provided, execute requests will use this signer\n linkedSignerWalletClient?: WalletClientWithAccount;\n // If provided, identifies the calling client, sent as a header with every request\n clientType?: string;\n}\n\n// Only 1 key can be defined per execute request\ntype EngineExecuteRequestBody = Partial<EngineServerExecuteRequestByType>;\n\ntype EngineQueryRequestResponse<\n T extends EngineServerQueryRequestType = EngineServerQueryRequestType,\n> = EngineServerQueryResponse<T>;\n\ntype EngineCachedQueryRequestResponse<\n T extends EngineServerCachedQueryRequestType =\n EngineServerCachedQueryRequestType,\n> = EngineServerCachedQueryResponse<T>;\n\n/**\n * Base client for all engine requests\n */\nexport class EngineBaseClient {\n readonly opts: EngineClientOpts;\n readonly axiosInstance: AxiosInstance;\n\n constructor(opts: EngineClientOpts) {\n this.opts = opts;\n this.axiosInstance = axios.create({\n withCredentials: true,\n // We have custom logic to validate response status and create an appropriate error\n validateStatus: () => true,\n headers: getNadoClientTypeHeaders(opts.clientType),\n });\n }\n\n /**\n * Sets the linked signer for execute requests\n *\n * @param linkedSignerWalletClient The linkedSigner to use for all signatures. Set to null to revert to the chain signer\n */\n public setLinkedSigner(\n linkedSignerWalletClient: WalletClientWithAccount | null,\n ) {\n this.opts.linkedSignerWalletClient = linkedSignerWalletClient ?? undefined;\n }\n\n public async getTxNonce(address?: string): Promise<string> {\n const addr = address ?? this.opts.walletClient?.account.address;\n\n if (!addr) {\n throw new WalletNotProvidedError();\n }\n\n return (\n await this.getNonces({\n address: addr,\n })\n ).txNonce;\n }\n\n public async getNonces(\n params: GetEngineNoncesParams,\n ): Promise<GetEngineNoncesResponse> {\n const baseResp = await this.query('nonces', params);\n\n return {\n orderNonce: baseResp.order_nonce,\n txNonce: baseResp.tx_nonce,\n };\n }\n\n /**\n * Queries the engine, all query params are stringified into the query string\n *\n * @param requestType\n * @param params\n * @public\n */\n public async query<TRequestType extends EngineServerQueryRequestType>(\n requestType: TRequestType,\n params: EngineServerQueryRequestByType[TRequestType],\n ): Promise<EngineServerQueryResponseByType[TRequestType]> {\n const request = this.getQueryRequest(requestType, params);\n const response = await this.axiosInstance.post<EngineQueryRequestResponse>(\n `${this.opts.url}/query`,\n request,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus throws on failure responses so the cast to the success response is acceptable here\n const successResponse = response as AxiosResponse<\n EngineServerQuerySuccessResponse<TRequestType>\n >;\n\n return successResponse.data.data;\n }\n\n /**\n * Queries the gateway's in-memory cache via the `/edge/query` endpoint. Lower latency than\n * {@link query} at the cost of eventual consistency — do not use for order, margin, or\n * settlement decisions.\n *\n * @param requestType\n * @param params\n * @public\n */\n public async edgeQuery<\n TRequestType extends EngineServerCachedQueryRequestType,\n >(\n requestType: TRequestType,\n params: EngineServerCachedQueryRequestByType[TRequestType],\n ): Promise<EngineServerCachedQueryResponseByType[TRequestType]> {\n const request = this.getQueryRequest(requestType, params);\n const response =\n await this.axiosInstance.post<EngineCachedQueryRequestResponse>(\n `${this.opts.url}/edge/query`,\n request,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus throws on failure responses so the cast to the success response is acceptable here\n const successResponse = response as AxiosResponse<\n EngineServerCachedQuerySuccessResponse<TRequestType>\n >;\n\n return successResponse.data.data;\n }\n\n /**\n * Sends an edge control message (`ping` / `time`) via the `/edge/query` endpoint. These\n * return immediately from the server clock and use a different envelope than the cached data\n * queries (no `data` field), so the whole response body is returned.\n *\n * @param requestType\n * @param params\n * @public\n */\n public async edgeControlQuery<\n TRequestType extends EngineServerEdgeControlRequestType,\n >(\n requestType: TRequestType,\n params: EngineServerEdgeControlRequestByType[TRequestType],\n ): Promise<EngineServerEdgeControlResponseByType[TRequestType]> {\n const request = this.getQueryRequest(requestType, params);\n const response = await this.axiosInstance.post<\n EngineServerEdgeControlResponseByType[TRequestType]\n >(`${this.opts.url}/edge/query`, request);\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n return response.data;\n }\n\n /**\n * POSTs an execute message to the engine and returns the successful response. Throws the failure response wrapped\n * in an EngineServerFailureError on failure.\n *\n * @param requestType\n * @param params\n * @public\n */\n public async execute<TRequestType extends EngineServerExecuteRequestType>(\n requestType: TRequestType,\n params: EngineServerExecuteRequestByType[TRequestType],\n ): Promise<EngineServerExecuteSuccessResult<TRequestType>> {\n const reqBody = this.getExecuteRequest(requestType, params);\n const response = await this.axiosInstance.post<\n EngineServerExecuteResult<TRequestType>\n >(`${this.opts.url}/execute`, reqBody);\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus catches the failure result and throws the error, so the cast to the success response is acceptable here\n return response.data as EngineServerExecuteSuccessResult<TRequestType>;\n }\n\n /**\n * A simple, typechecked fn for constructing a `type`-tagged request body in the format expected\n * by the server. Generic over the request type / params pair so it can build live query, edge\n * (cached) query, and edge control request bodies alike.\n *\n * @param requestType\n * @param params\n */\n public getQueryRequest<TRequestType extends string, TParams extends object>(\n requestType: TRequestType,\n params: TParams,\n ): { type: TRequestType } & TParams {\n return {\n type: requestType,\n ...params,\n };\n }\n\n /**\n * A simple, typechecked fn for constructing an execute request in the format expected by the server.\n *\n * @param requestType\n * @param params\n */\n public getExecuteRequest<TRequestType extends EngineServerExecuteRequestType>(\n requestType: TRequestType,\n params: EngineServerExecuteRequestByType[TRequestType],\n ): EngineExecuteRequestBody {\n return {\n [requestType]: params,\n };\n }\n\n /**\n * Signs a given request with the signer provided to the engine\n *\n * @param requestType\n * @param verifyingContract\n * @param chainId\n * @param params\n * @public\n */\n public async sign<T extends SignableRequestType>(\n requestType: T,\n verifyingContract: string,\n chainId: number,\n params: SignableRequestTypeToParams[T],\n ) {\n // Use the linked signer if provided, otherwise use the default signer provided to the engine\n // However, always use wallet signer for withdraw_collateral_v2 as linked signers are not allowed for different\n // withdrawal addresses\n const walletClient = (() => {\n if (requestType === 'withdraw_collateral_v2') {\n return this.opts.walletClient;\n }\n return this.opts.linkedSignerWalletClient ?? this.opts.walletClient;\n })();\n\n if (!walletClient) {\n throw new WalletNotProvidedError();\n }\n\n return getSignedTransactionRequest({\n chainId,\n requestParams: params,\n requestType,\n walletClient,\n verifyingContract,\n });\n }\n\n private checkResponseStatus(response: AxiosResponse) {\n if (response.status !== 200 || !response.data) {\n throw Error(\n `Unexpected response from server: ${response.status} ${response.statusText}. Data: ${response.data}`,\n );\n }\n }\n\n private checkServerStatus(\n response: AxiosResponse<\n | EngineServerExecuteResult\n | EngineQueryRequestResponse\n | EngineCachedQueryRequestResponse\n | EngineServerEdgeControlResponseByType[EngineServerEdgeControlRequestType]\n >,\n ) {\n if (response.data.status !== 'success') {\n throw new EngineServerFailureError(response.data);\n }\n }\n}\n"],"mappings":";;;;;;;AA0DA,IAAa,mBAAb,MAA8B;CAI5B,YAAY,MAAwB;EAClC,KAAK,OAAO;EACZ,KAAK,gBAAgB,MAAM,OAAO;GAChC,iBAAiB;GAEjB,sBAAsB;GACtB,SAAS,yBAAyB,KAAK,UAAU;EACnD,CAAC;CACH;;;;;;CAOA,gBACE,0BACA;EACA,KAAK,KAAK,2BAA2B,4BAA4B,KAAA;CACnE;CAEA,MAAa,WAAW,SAAmC;EACzD,MAAM,OAAO,WAAW,KAAK,KAAK,cAAc,QAAQ;EAExD,IAAI,CAAC,MACH,MAAM,IAAI,uBAAuB;EAGnC,QACE,MAAM,KAAK,UAAU,EACnB,SAAS,KACX,CAAC,GACD;CACJ;CAEA,MAAa,UACX,QACkC;EAClC,MAAM,WAAW,MAAM,KAAK,MAAM,UAAU,MAAM;EAElD,OAAO;GACL,YAAY,SAAS;GACrB,SAAS,SAAS;EACpB;CACF;;;;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KAAK,KAAK;GAEnB,OAAO,KAAK,KAAK,4BAA4B,KAAK,KAAK;EACzD,GAAG;EAEH,IAAI,CAAC,cACH,MAAM,IAAI,uBAAuB;EAGnC,OAAO,4BAA4B;GACjC;GACA,eAAe;GACf;GACA;GACA;EACF,CAAC;CACH;CAEA,oBAA4B,UAAyB;EACnD,IAAI,SAAS,WAAW,OAAO,CAAC,SAAS,MACvC,MAAM,MACJ,oCAAoC,SAAS,OAAO,GAAG,SAAS,WAAW,UAAU,SAAS,MAChG;CAEJ;CAEA,kBACE,UAMA;EACA,IAAI,SAAS,KAAK,WAAW,WAC3B,MAAM,IAAI,yBAAyB,SAAS,IAAI;CAEpD;AACF"}
|
package/dist/EngineClient.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("./EngineBaseClient-
|
|
2
|
+
require("./EngineBaseClient-0oxXtif-.cjs");
|
|
3
3
|
const require_EngineEdgeQueryClient = require("./EngineEdgeQueryClient.cjs");
|
|
4
4
|
const require_EngineExecuteClient = require("./EngineExecuteClient.cjs");
|
|
5
5
|
const require_EngineQueryClient = require("./EngineQueryClient.cjs");
|
package/dist/EngineClient.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as EngineEdgeQueryClient } from "./EngineEdgeQueryClient-
|
|
2
|
-
import { t as EngineExecuteClient } from "./EngineExecuteClient-
|
|
3
|
-
import { t as EngineQueryClient } from "./EngineQueryClient-
|
|
4
|
-
import { t as EngineWebClient } from "./EngineWebClient-
|
|
1
|
+
import { t as EngineEdgeQueryClient } from "./EngineEdgeQueryClient-DF_FVcUP.cjs";
|
|
2
|
+
import { t as EngineExecuteClient } from "./EngineExecuteClient-D-a5ZLvc.cjs";
|
|
3
|
+
import { t as EngineQueryClient } from "./EngineQueryClient-0KRiawOi.cjs";
|
|
4
|
+
import { t as EngineWebClient } from "./EngineWebClient-Bl7-3nYi.cjs";
|
|
5
5
|
|
|
6
6
|
//#region src/EngineClient.d.ts
|
|
7
7
|
declare const EngineClient_base: import("ts-mixer/dist/types/types").Class<any[], EngineQueryClient & EngineEdgeQueryClient & EngineExecuteClient & EngineWebClient, typeof EngineQueryClient & typeof EngineEdgeQueryClient & typeof EngineExecuteClient & typeof EngineWebClient>;
|
package/dist/EngineClient.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as EngineEdgeQueryClient } from "./EngineEdgeQueryClient-
|
|
2
|
-
import { t as EngineExecuteClient } from "./EngineExecuteClient-
|
|
3
|
-
import { t as EngineQueryClient } from "./EngineQueryClient-
|
|
4
|
-
import { t as EngineWebClient } from "./EngineWebClient-
|
|
1
|
+
import { t as EngineEdgeQueryClient } from "./EngineEdgeQueryClient-Clhdad07.js";
|
|
2
|
+
import { t as EngineExecuteClient } from "./EngineExecuteClient-JouJpl62.js";
|
|
3
|
+
import { t as EngineQueryClient } from "./EngineQueryClient-CYPBkrRj.js";
|
|
4
|
+
import { t as EngineWebClient } from "./EngineWebClient-CPFci7kt.js";
|
|
5
5
|
|
|
6
6
|
//#region src/EngineClient.d.ts
|
|
7
7
|
declare const EngineClient_base: import("ts-mixer/dist/types/types").Class<any[], EngineQueryClient & EngineEdgeQueryClient & EngineExecuteClient & EngineWebClient, typeof EngineQueryClient & typeof EngineEdgeQueryClient & typeof EngineExecuteClient & typeof EngineWebClient>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { q as EngineServerStatusResponse } from "./serverQueryTypes-B3vC8vxT.js";
|
|
2
2
|
import { M as GetEngineMarketPricesResponse, U as GetEngineNlpPoolInfoResponse, _ as GetEngineContractsResponse, b as GetEngineHealthGroupsResponse, c as EnginePingResponse, f as EngineSymbolsResponse, g as GetEngineCachedMarketPricesParams, h as GetEngineCachedBboHistoryResponse, m as GetEngineCachedBboHistoryParams, n as EngineCachedTimeParams, nt as GetEngineSymbolsParams, p as GetEngineAllMarketsResponse, s as EnginePingParams } from "./clientQueryTypes-BaYOTnpm.js";
|
|
3
|
-
import { t as EngineBaseClient } from "./EngineBaseClient-
|
|
3
|
+
import { t as EngineBaseClient } from "./EngineBaseClient-DMVQl1Gl.js";
|
|
4
4
|
import { MarketWithProduct } from "@nadohq/shared";
|
|
5
5
|
|
|
6
6
|
//#region src/EngineEdgeQueryClient.d.ts
|
|
@@ -76,4 +76,4 @@ declare class EngineEdgeQueryClient extends EngineBaseClient {
|
|
|
76
76
|
}
|
|
77
77
|
//#endregion
|
|
78
78
|
export { EngineEdgeQueryClient as t };
|
|
79
|
-
//# sourceMappingURL=EngineEdgeQueryClient-
|
|
79
|
+
//# sourceMappingURL=EngineEdgeQueryClient-Clhdad07.d.ts.map
|
package/dist/{EngineEdgeQueryClient-DDO69X3M.d.ts.map → EngineEdgeQueryClient-Clhdad07.d.ts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineEdgeQueryClient-
|
|
1
|
+
{"version":3,"file":"EngineEdgeQueryClient-Clhdad07.d.ts","names":[],"sources":["../src/src/EngineEdgeQueryClient.ts"],"mappings":";;;;;;;;;;AAsCA;;;;;;cAAa,qBAAA,SAA8B,gBAAA;EAyB9B;;;;;;EAlBL,qBAAA,CACJ,MAAA,GAAQ,iCAAA,GACP,OAAA,CAAQ,6BAAA;EAiDkB;;;;;EAnCvB,gBAAA,CACJ,MAAA,GAAQ,sBAAA,GACP,OAAA,CAAQ,qBAAA;EAyF2B;;;;EA1EhC,kBAAA,CAAA,GAAsB,OAAA,CAAQ,0BAAA;EAuGjB;;;EA5Fb,eAAA,CAAA,GAAmB,OAAA,CAAQ,0BAAA;EAmH9B;;;EA5GG,mBAAA,CAAA,GAAuB,OAAA,CAAQ,2BAAA;EA1DI;;;EA2EnC,uBAAA,CAAA,GAA2B,OAAA,CAC/B,MAAA,SAAe,iBAAA;EAnEd;;;EAyFG,qBAAA,CAAA,GAAyB,OAAA,CAAQ,6BAAA;EA1ErC;;;EA0FI,oBAAA,CAAA,GAAwB,OAAA,CAAQ,4BAAA;EA1EV;;;;;;EAqFtB,mBAAA,CACJ,MAAA,GAAQ,+BAAA,GACP,OAAA,CAAQ,iCAAA;EArE0B;;;;;;EAqF/B,IAAA,CAAK,MAAA,GAAQ,gBAAA,GAAwB,OAAA,CAAQ,kBAAA;EA7CZ;;;;;EAkEjC,kBAAA,CACJ,MAAA,GAAQ,sBAAA,GACP,OAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { q as EngineServerStatusResponse } from "./serverQueryTypes-Dva9R2tV.cjs";
|
|
2
2
|
import { M as GetEngineMarketPricesResponse, U as GetEngineNlpPoolInfoResponse, _ as GetEngineContractsResponse, b as GetEngineHealthGroupsResponse, c as EnginePingResponse, f as EngineSymbolsResponse, g as GetEngineCachedMarketPricesParams, h as GetEngineCachedBboHistoryResponse, m as GetEngineCachedBboHistoryParams, n as EngineCachedTimeParams, nt as GetEngineSymbolsParams, p as GetEngineAllMarketsResponse, s as EnginePingParams } from "./clientQueryTypes-BTKfuoGI.cjs";
|
|
3
|
-
import { t as EngineBaseClient } from "./EngineBaseClient-
|
|
3
|
+
import { t as EngineBaseClient } from "./EngineBaseClient-BnFoL1j3.cjs";
|
|
4
4
|
import { MarketWithProduct } from "@nadohq/shared";
|
|
5
5
|
|
|
6
6
|
//#region src/EngineEdgeQueryClient.d.ts
|
|
@@ -76,4 +76,4 @@ declare class EngineEdgeQueryClient extends EngineBaseClient {
|
|
|
76
76
|
}
|
|
77
77
|
//#endregion
|
|
78
78
|
export { EngineEdgeQueryClient as t };
|
|
79
|
-
//# sourceMappingURL=EngineEdgeQueryClient-
|
|
79
|
+
//# sourceMappingURL=EngineEdgeQueryClient-DF_FVcUP.d.cts.map
|
package/dist/{EngineEdgeQueryClient-CdITc0f9.d.cts.map → EngineEdgeQueryClient-DF_FVcUP.d.cts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineEdgeQueryClient-
|
|
1
|
+
{"version":3,"file":"EngineEdgeQueryClient-DF_FVcUP.d.cts","names":[],"sources":["../src/src/EngineEdgeQueryClient.ts"],"mappings":";;;;;;;;;;AAsCA;;;;;;cAAa,qBAAA,SAA8B,gBAAA;EAyB9B;;;;;;EAlBL,qBAAA,CACJ,MAAA,GAAQ,iCAAA,GACP,OAAA,CAAQ,6BAAA;EAiDkB;;;;;EAnCvB,gBAAA,CACJ,MAAA,GAAQ,sBAAA,GACP,OAAA,CAAQ,qBAAA;EAyF2B;;;;EA1EhC,kBAAA,CAAA,GAAsB,OAAA,CAAQ,0BAAA;EAuGjB;;;EA5Fb,eAAA,CAAA,GAAmB,OAAA,CAAQ,0BAAA;EAmH9B;;;EA5GG,mBAAA,CAAA,GAAuB,OAAA,CAAQ,2BAAA;EA1DI;;;EA2EnC,uBAAA,CAAA,GAA2B,OAAA,CAC/B,MAAA,SAAe,iBAAA;EAnEd;;;EAyFG,qBAAA,CAAA,GAAyB,OAAA,CAAQ,6BAAA;EA1ErC;;;EA0FI,oBAAA,CAAA,GAAwB,OAAA,CAAQ,4BAAA;EA1EV;;;;;;EAqFtB,mBAAA,CACJ,MAAA,GAAQ,+BAAA,GACP,OAAA,CAAQ,iCAAA;EArE0B;;;;;;EAqF/B,IAAA,CAAK,MAAA,GAAQ,gBAAA,GAAwB,OAAA,CAAQ,kBAAA;EA7CZ;;;;;EAkEjC,kBAAA,CACJ,MAAA,GAAQ,sBAAA,GACP,OAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_EngineBaseClient = require("./EngineBaseClient-
|
|
2
|
+
const require_EngineBaseClient = require("./EngineBaseClient-0oxXtif-.cjs");
|
|
3
3
|
const require_utils_productEngineTypeMappers = require("./utils/productEngineTypeMappers.cjs");
|
|
4
4
|
const require_utils_queryDataMappers = require("./utils/queryDataMappers.cjs");
|
|
5
5
|
let _nadohq_shared = require("@nadohq/shared");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as EngineEdgeQueryClient } from "./EngineEdgeQueryClient-
|
|
1
|
+
import { t as EngineEdgeQueryClient } from "./EngineEdgeQueryClient-DF_FVcUP.cjs";
|
|
2
2
|
export { EngineEdgeQueryClient };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as EngineEdgeQueryClient } from "./EngineEdgeQueryClient-
|
|
1
|
+
import { t as EngineEdgeQueryClient } from "./EngineEdgeQueryClient-Clhdad07.js";
|
|
2
2
|
export { EngineEdgeQueryClient };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as EngineServerExecuteRequestByType, i as EngineServerExecutePlaceOrderPayload } from "./serverExecuteTypes-C8uIe8Kz.js";
|
|
2
2
|
import { _ as WithBaseEngineExecuteParams, a as EngineExecuteRequestParamsByType, g as SignatureParamsOrSignature, v as WithSignature } from "./clientExecuteTypes-C6Ih6CGp.js";
|
|
3
|
-
import { t as EngineBaseClient } from "./EngineBaseClient-
|
|
3
|
+
import { t as EngineBaseClient } from "./EngineBaseClient-DMVQl1Gl.js";
|
|
4
4
|
import { EIP712OrderParams, SignableRequestType, SignableRequestTypeToParams } from "@nadohq/shared";
|
|
5
5
|
|
|
6
6
|
//#region src/EngineExecuteBuilder.d.ts
|
|
@@ -108,4 +108,4 @@ declare class EngineExecuteBuilder {
|
|
|
108
108
|
}
|
|
109
109
|
//#endregion
|
|
110
110
|
export { EngineExecuteBuilder as t };
|
|
111
|
-
//# sourceMappingURL=EngineExecuteBuilder-
|
|
111
|
+
//# sourceMappingURL=EngineExecuteBuilder-0SYliOEi.d.ts.map
|
package/dist/{EngineExecuteBuilder-BxmeHvue.d.ts.map → EngineExecuteBuilder-0SYliOEi.d.ts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineExecuteBuilder-
|
|
1
|
+
{"version":3,"file":"EngineExecuteBuilder-0SYliOEi.d.ts","names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CAC7C,WAAA,EAAa,CAAA,EACb,eAAA,EAAiB,0BAAA,GACf,2BAAA,CAA4B,CAAA,IAAE,OAAA;EAAA,UAclB,kBAAA,CACd,MAAA,EAAQ,2BAAA;IAA8B,eAAA;EAAA,KAA0B,OAAA;EAAA,UAQxD,qBAAA,CACR,MAAA,EAAQ,2BAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as EngineServerExecuteRequestByType, i as EngineServerExecutePlaceOrderPayload } from "./serverExecuteTypes-WltMT-zz.cjs";
|
|
2
2
|
import { _ as WithBaseEngineExecuteParams, a as EngineExecuteRequestParamsByType, g as SignatureParamsOrSignature, v as WithSignature } from "./clientExecuteTypes-BABishPC.cjs";
|
|
3
|
-
import { t as EngineBaseClient } from "./EngineBaseClient-
|
|
3
|
+
import { t as EngineBaseClient } from "./EngineBaseClient-BnFoL1j3.cjs";
|
|
4
4
|
import { EIP712OrderParams, SignableRequestType, SignableRequestTypeToParams } from "@nadohq/shared";
|
|
5
5
|
|
|
6
6
|
//#region src/EngineExecuteBuilder.d.ts
|
|
@@ -108,4 +108,4 @@ declare class EngineExecuteBuilder {
|
|
|
108
108
|
}
|
|
109
109
|
//#endregion
|
|
110
110
|
export { EngineExecuteBuilder as t };
|
|
111
|
-
//# sourceMappingURL=EngineExecuteBuilder-
|
|
111
|
+
//# sourceMappingURL=EngineExecuteBuilder-Cl1kBugs.d.cts.map
|
package/dist/{EngineExecuteBuilder-C8DZXfEE.d.cts.map → EngineExecuteBuilder-Cl1kBugs.d.cts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineExecuteBuilder-
|
|
1
|
+
{"version":3,"file":"EngineExecuteBuilder-Cl1kBugs.d.cts","names":[],"sources":["../src/src/EngineExecuteBuilder.ts"],"mappings":";;;;;;;;;;AAuBA;cAAa,oBAAA;EAAA,SACF,YAAA,EAAc,gBAAA;cAEX,YAAA,EAAc,gBAAA;EAAA;;;;;EASpB,+BA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A,KAA0B,OAAA;EAAA,UAQxD,qBAAA,CACR,MAAA,EAAQ,2BAAA;AAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as EngineExecuteBuilder } from "./EngineExecuteBuilder-
|
|
1
|
+
import { t as EngineExecuteBuilder } from "./EngineExecuteBuilder-Cl1kBugs.cjs";
|
|
2
2
|
export { EngineExecuteBuilder };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as EngineExecuteBuilder } from "./EngineExecuteBuilder-
|
|
1
|
+
import { t as EngineExecuteBuilder } from "./EngineExecuteBuilder-0SYliOEi.js";
|
|
2
2
|
export { EngineExecuteBuilder };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { l as EngineServerExecuteSuccessResult } from "./serverExecuteTypes-WltMT-zz.cjs";
|
|
2
2
|
import { a as EngineExecuteRequestParamsByType, d as EnginePlaceOrderResult } from "./clientExecuteTypes-BABishPC.cjs";
|
|
3
|
-
import { n as EngineClientOpts, t as EngineBaseClient } from "./EngineBaseClient-
|
|
4
|
-
import { t as EngineExecuteBuilder } from "./EngineExecuteBuilder-
|
|
3
|
+
import { n as EngineClientOpts, t as EngineBaseClient } from "./EngineBaseClient-BnFoL1j3.cjs";
|
|
4
|
+
import { t as EngineExecuteBuilder } from "./EngineExecuteBuilder-Cl1kBugs.cjs";
|
|
5
5
|
|
|
6
6
|
//#region src/EngineExecuteClient.d.ts
|
|
7
7
|
declare class EngineExecuteClient extends EngineBaseClient {
|
|
@@ -22,4 +22,4 @@ declare class EngineExecuteClient extends EngineBaseClient {
|
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
24
|
export { EngineExecuteClient as t };
|
|
25
|
-
//# sourceMappingURL=EngineExecuteClient-
|
|
25
|
+
//# sourceMappingURL=EngineExecuteClient-D-a5ZLvc.d.cts.map
|
package/dist/{EngineExecuteClient-Cm-DpHa_.d.cts.map → EngineExecuteClient-D-a5ZLvc.d.cts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineExecuteClient-
|
|
1
|
+
{"version":3,"file":"EngineExecuteClient-D-a5ZLvc.d.cts","names":[],"sources":["../src/src/EngineExecuteClient.ts"],"mappings":";;;;;;cAQa,mBAAA,SAA4B,gBAAA;EAAA,SAC9B,cAAA,EAAgB,oBAAA;cAEb,IAAA,EAAM,gBAAA;EAKZ,mBAAA,CACJ,MAAA,EAAQ,gCAAA,2BAAwD,OAAA,CAAxB,gCAAA;EAQpC,kBAAA,CACJ,MAAA,EAAQ,gCAAA,0BAAuD,OAAA,CAAvB,gCAAA;EAQpC,oBAAA,CACJ,MAAA,EAAQ,gCAAA,6BAA0D,OAAA,CAA1B,gCAAA;EAQpC,UAAA,CACJ,MAAA,EAAQ,gCAAA,kBACP,OAAA,CAAQ,sBAAA;EASL,WAAA,CAAY,MAAA,EAAQ,gCAAA,mBAAgD,OAAA,CAAhB,gCAAA;EAOpD,YAAA,CACJ,MAAA,EAAQ,gCAAA,oBAAiD,OAAA,CAAjB,gCAAA;EAQpC,cAAA,CACJ,MAAA,EAAQ,gCAAA,uBAAoD,OAAA,CAApB,gCAAA;EAkBpC,mBAAA,CACJ,MAAA,EAAQ,gCAAA,4BAAyD,OAAA,CAAzB,gCAAA;EAQpC,UAAA,CAAW,MAAA,EAAQ,gCAAA,kBAA+C,OAAA,CAAf,gCAAA;EAOnD,aAAA,CACJ,MAAA,EAAQ,gCAAA,qBAAkD,OAAA,CAAlB,gCAAA;EAQpC,OAAA,CAAQ,MAAA,EAAQ,gCAAA,eAA4C,OAAA,CAAZ,gCAAA;EAOhD,OAAA,CAAQ,MAAA,EAAQ,gCAAA,eAA4C,OAAA,CAAZ,gCAAA;AAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { l as EngineServerExecuteSuccessResult } from "./serverExecuteTypes-C8uIe8Kz.js";
|
|
2
2
|
import { a as EngineExecuteRequestParamsByType, d as EnginePlaceOrderResult } from "./clientExecuteTypes-C6Ih6CGp.js";
|
|
3
|
-
import { n as EngineClientOpts, t as EngineBaseClient } from "./EngineBaseClient-
|
|
4
|
-
import { t as EngineExecuteBuilder } from "./EngineExecuteBuilder-
|
|
3
|
+
import { n as EngineClientOpts, t as EngineBaseClient } from "./EngineBaseClient-DMVQl1Gl.js";
|
|
4
|
+
import { t as EngineExecuteBuilder } from "./EngineExecuteBuilder-0SYliOEi.js";
|
|
5
5
|
|
|
6
6
|
//#region src/EngineExecuteClient.d.ts
|
|
7
7
|
declare class EngineExecuteClient extends EngineBaseClient {
|
|
@@ -22,4 +22,4 @@ declare class EngineExecuteClient extends EngineBaseClient {
|
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
24
|
export { EngineExecuteClient as t };
|
|
25
|
-
//# sourceMappingURL=EngineExecuteClient-
|
|
25
|
+
//# sourceMappingURL=EngineExecuteClient-JouJpl62.d.ts.map
|
package/dist/{EngineExecuteClient-BgPbR6A9.d.ts.map → EngineExecuteClient-JouJpl62.d.ts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineExecuteClient-
|
|
1
|
+
{"version":3,"file":"EngineExecuteClient-JouJpl62.d.ts","names":[],"sources":["../src/src/EngineExecuteClient.ts"],"mappings":";;;;;;cAQa,mBAAA,SAA4B,gBAAA;EAAA,SAC9B,cAAA,EAAgB,oBAAA;cAEb,IAAA,EAAM,gBAAA;EAKZ,mBAAA,CACJ,MAAA,EAAQ,gCAAA,2BAAwD,OAAA,CAAxB,gCAAA;EAQpC,kBAAA,CACJ,MAAA,EAAQ,gCAAA,0BAAuD,OAAA,CAAvB,gCAAA;EAQpC,oBAAA,CACJ,MAAA,EAAQ,gCAAA,6BAA0D,OAAA,CAA1B,gCAAA;EAQpC,UAAA,CACJ,MAAA,EAAQ,gCAAA,kBACP,OAAA,CAAQ,sBAAA;EASL,WAAA,CAAY,MAAA,EAAQ,gCAAA,mBAAgD,OAAA,CAAhB,gCAAA;EAOpD,YAAA,CACJ,MAAA,EAAQ,gCAAA,oBAAiD,OAAA,CAAjB,gCAAA;EAQpC,cAAA,CACJ,MAAA,EAAQ,gCAAA,uBAAoD,OAAA,CAApB,gCAAA;EAkBpC,mBAAA,CACJ,MAAA,EAAQ,gCAAA,4BAAyD,OAAA,CAAzB,gCAAA;EAQpC,UAAA,CAAW,MAAA,EAAQ,gCAAA,kBAA+C,OAAA,CAAf,gCAAA;EAOnD,aAAA,CACJ,MAAA,EAAQ,gCAAA,qBAAkD,OAAA,CAAlB,gCAAA;EAQpC,OAAA,CAAQ,MAAA,EAAQ,gCAAA,eAA4C,OAAA,CAAZ,gCAAA;EAOhD,OAAA,CAAQ,MAAA,EAAQ,gCAAA,eAA4C,OAAA,CAAZ,gCAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_EngineBaseClient = require("./EngineBaseClient-
|
|
2
|
+
const require_EngineBaseClient = require("./EngineBaseClient-0oxXtif-.cjs");
|
|
3
3
|
const require_EngineExecuteBuilder = require("./EngineExecuteBuilder.cjs");
|
|
4
4
|
let _nadohq_shared = require("@nadohq/shared");
|
|
5
5
|
//#region src/EngineExecuteClient.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as EngineExecuteClient } from "./EngineExecuteClient-
|
|
1
|
+
import { t as EngineExecuteClient } from "./EngineExecuteClient-D-a5ZLvc.cjs";
|
|
2
2
|
export { EngineExecuteClient };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as EngineExecuteClient } from "./EngineExecuteClient-
|
|
1
|
+
import { t as EngineExecuteClient } from "./EngineExecuteClient-JouJpl62.js";
|
|
2
2
|
export { EngineExecuteClient };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { q as EngineServerStatusResponse } from "./serverQueryTypes-Dva9R2tV.cjs";
|
|
2
2
|
import { $ as GetEngineSubaccountProductOrdersResponse, A as GetEngineMarketPriceResponse, B as GetEngineMaxWithdrawableResponse, C as GetEngineIsolatedPositionsParams, D as GetEngineMarketLiquidityParams, E as GetEngineLinkedSignerResponse, F as GetEngineMaxMintNlpAmountParams, H as GetEngineNlpLockedBalancesResponse, I as GetEngineMaxMintNlpAmountResponse, J as GetEngineSubaccountFeeRatesParams, K as GetEngineOrderParams, L as GetEngineMaxOrderSizeParams, M as GetEngineMarketPricesResponse, N as GetEngineMaxBurnNlpAmountParams, O as GetEngineMarketLiquidityResponse, P as GetEngineMaxBurnNlpAmountResponse, Q as GetEngineSubaccountProductOrdersParams, R as GetEngineMaxOrderSizeResponse, T as GetEngineLinkedSignerParams, U as GetEngineNlpPoolInfoResponse, V as GetEngineNlpLockedBalancesParams, X as GetEngineSubaccountOrdersParams, Y as GetEngineSubaccountFeeRatesResponse, Z as GetEngineSubaccountOrdersResponse, _ as GetEngineContractsResponse, b as GetEngineHealthGroupsResponse, dt as ValidateEngineOrderResponse, et as GetEngineSubaccountSummaryParams, f as EngineSymbolsResponse, ft as ValidateSignedEngineOrderParams, j as GetEngineMarketPricesParams, k as GetEngineMarketPriceParams, nt as GetEngineSymbolsParams, p as GetEngineAllMarketsResponse, q as GetEngineOrderResponse, tt as GetEngineSubaccountSummaryResponse, ut as ValidateEngineOrderParams, w as GetEngineIsolatedPositionsResponse, x as GetEngineInsuranceResponse, y as GetEngineEstimatedSubaccountSummaryParams, z as GetEngineMaxWithdrawableParams } from "./clientQueryTypes-BTKfuoGI.cjs";
|
|
3
|
-
import { t as EngineBaseClient } from "./EngineBaseClient-
|
|
3
|
+
import { t as EngineBaseClient } from "./EngineBaseClient-BnFoL1j3.cjs";
|
|
4
4
|
import { MarketWithProduct } from "@nadohq/shared";
|
|
5
5
|
|
|
6
6
|
//#region src/EngineQueryClient.d.ts
|
|
@@ -144,4 +144,4 @@ declare class EngineQueryClient extends EngineBaseClient {
|
|
|
144
144
|
}
|
|
145
145
|
//#endregion
|
|
146
146
|
export { EngineQueryClient as t };
|
|
147
|
-
//# sourceMappingURL=EngineQueryClient-
|
|
147
|
+
//# sourceMappingURL=EngineQueryClient-0KRiawOi.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineQueryClient-
|
|
1
|
+
{"version":3,"file":"EngineQueryClient-0KRiawOi.d.cts","names":[],"sources":["../src/src/EngineQueryClient.ts"],"mappings":";;;;;;cAyEa,iBAAA,SAA0B,gBAAA;;;;EAI/B,YAAA,CAAA,GAAgB,OAAA,CAAQ,0BAAA;EAJD;;;EAevB,SAAA,CAAA,GAAa,OAAA,CAAQ,0BAAA;EAAA;;;;;;EAUrB,oBAAA,CACJ,MAAA,EAAQ,gCAAA,GACP,OAAA,CAAQ,kCAAA;EAmBR;;;;;EAFG,oBAAA,CACJ,MAAA,EAAQ,gCAAA,GACP,OAAA,CAAQ,kCAAA;EAgER;;;;;EA/CG,6BAAA,CACJ,MAAA,EAAQ,yCAAA,GACP,OAAA,CAAQ,kCAAA;EAiGsB;;;;;EAtD3B,UAAA,CACJ,MAAA,EAAQ,sBAAA,GACP,OAAA,CAAQ,qBAAA;EA0FA;;;EA5EL,aAAA,CAAA,GAAiB,OAAA,CAAQ,2BAAA;EAmG5B;;;EAlFG,iBAAA,CAAA,GAAqB,OAAA,CAAQ,MAAA,SAAe,iBAAA;EAwHxC;;;EAnGJ,eAAA,CAAA,GAAmB,OAAA,CAAQ,6BAAA;EA6HtB;;;;;EAzGL,QAAA,CACJ,MAAA,EAAQ,oBAAA,GACP,OAAA,CAAQ,sBAAA;EAmKA;;;;;EArJL,mBAAA,CACJ,MAAA,EAAQ,yBAAA,GACP,OAAA,CAAQ,2BAAA;EA+KA;;;;;EA1JL,yBAAA,CACJ,MAAA,EAAQ,+BAAA,GACP,OAAA,CAAQ,2BAAA;EA+MA;;;;EA/LL,mBAAA,CACJ,MAAA,EAAQ,+BAAA,GACP,OAAA,CAAQ,iCAAA;EAkOD;;;;EA/MJ,+BAAA,CACJ,MAAA,EAAQ,sCAAA,GACP,OAAA,CAAQ,wCAAA;EA2OD;;;;EApNJ,qBAAA,CACJ,MAAA,EAAQ,iCAAA,GACP,OAAA,CAAQ,mCAAA;EA/R0B;;;;EAwU/B,kBAAA,CACJ,MAAA,EAAQ,8BAAA,GACP,OAAA,CAAQ,gCAAA;EAtUW;;;;EAqVhB,cAAA,CACJ,MAAA,EAAQ,0BAAA,GACP,OAAA,CAAQ,4BAAA;EAlUL;;;;EA6UA,eAAA,CACJ,MAAA,EAAQ,2BAAA,GACP,OAAA,CAAQ,6BAAA;EA5TL;;;;EAyUA,eAAA,CACJ,MAAA,EAAQ,2BAAA,GACP,OAAA,CAAQ,6BAAA;EAxTL;;;;EAwVA,kBAAA,CACJ,MAAA,EAAQ,8BAAA,GACP,OAAA,CAAQ,gCAAA;EA7SL;;;;;EAgUA,mBAAA,CACJ,MAAA,EAAQ,+BAAA,GACP,OAAA,CAAQ,iCAAA;EAlTY;;;;;EAoUjB,mBAAA,CACJ,MAAA,EAAQ,+BAAA,GACP,OAAA,CAAQ,iCAAA;EAhSL;;;;;EAgTO,eAAA,CACX,MAAA,EAAQ,2BAAA,GACP,OAAA,CAAQ,6BAAA;EA5RR;;;;EA6SU,YAAA,CAAA,GAAgB,OAAA,CAAQ,0BAAA;EA7RlC;;;;;EAwSG,oBAAA,CACJ,MAAA,EAAQ,gCAAA,GACP,OAAA,CAAQ,kCAAA;EAnRA;;;EAiSL,cAAA,CAAA,GAAkB,OAAA,CAAQ,4BAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { q as EngineServerStatusResponse } from "./serverQueryTypes-B3vC8vxT.js";
|
|
2
2
|
import { $ as GetEngineSubaccountProductOrdersResponse, A as GetEngineMarketPriceResponse, B as GetEngineMaxWithdrawableResponse, C as GetEngineIsolatedPositionsParams, D as GetEngineMarketLiquidityParams, E as GetEngineLinkedSignerResponse, F as GetEngineMaxMintNlpAmountParams, H as GetEngineNlpLockedBalancesResponse, I as GetEngineMaxMintNlpAmountResponse, J as GetEngineSubaccountFeeRatesParams, K as GetEngineOrderParams, L as GetEngineMaxOrderSizeParams, M as GetEngineMarketPricesResponse, N as GetEngineMaxBurnNlpAmountParams, O as GetEngineMarketLiquidityResponse, P as GetEngineMaxBurnNlpAmountResponse, Q as GetEngineSubaccountProductOrdersParams, R as GetEngineMaxOrderSizeResponse, T as GetEngineLinkedSignerParams, U as GetEngineNlpPoolInfoResponse, V as GetEngineNlpLockedBalancesParams, X as GetEngineSubaccountOrdersParams, Y as GetEngineSubaccountFeeRatesResponse, Z as GetEngineSubaccountOrdersResponse, _ as GetEngineContractsResponse, b as GetEngineHealthGroupsResponse, dt as ValidateEngineOrderResponse, et as GetEngineSubaccountSummaryParams, f as EngineSymbolsResponse, ft as ValidateSignedEngineOrderParams, j as GetEngineMarketPricesParams, k as GetEngineMarketPriceParams, nt as GetEngineSymbolsParams, p as GetEngineAllMarketsResponse, q as GetEngineOrderResponse, tt as GetEngineSubaccountSummaryResponse, ut as ValidateEngineOrderParams, w as GetEngineIsolatedPositionsResponse, x as GetEngineInsuranceResponse, y as GetEngineEstimatedSubaccountSummaryParams, z as GetEngineMaxWithdrawableParams } from "./clientQueryTypes-BaYOTnpm.js";
|
|
3
|
-
import { t as EngineBaseClient } from "./EngineBaseClient-
|
|
3
|
+
import { t as EngineBaseClient } from "./EngineBaseClient-DMVQl1Gl.js";
|
|
4
4
|
import { MarketWithProduct } from "@nadohq/shared";
|
|
5
5
|
|
|
6
6
|
//#region src/EngineQueryClient.d.ts
|
|
@@ -144,4 +144,4 @@ declare class EngineQueryClient extends EngineBaseClient {
|
|
|
144
144
|
}
|
|
145
145
|
//#endregion
|
|
146
146
|
export { EngineQueryClient as t };
|
|
147
|
-
//# sourceMappingURL=EngineQueryClient-
|
|
147
|
+
//# sourceMappingURL=EngineQueryClient-CYPBkrRj.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineQueryClient-
|
|
1
|
+
{"version":3,"file":"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A,CAAQ,gCAAA;EAtUW;;;;EAqVhB,cAAA,CACJ,MAAA,EAAQ,0BAAA,GACP,OAAA,CAAQ,4BAAA;EAlUL;;;;EA6UA,eAAA,CACJ,MAAA,EAAQ,2BAAA,GACP,OAAA,CAAQ,6BAAA;EA5TL;;;;EAyUA,eAAA,CACJ,MAAA,EAAQ,2BAAA,GACP,OAAA,CAAQ,6BAAA;EAxTL;;;;EAwVA,kBAAA,CACJ,MAAA,EAAQ,8BAAA,GACP,OAAA,CAAQ,gCAAA;EA7SL;;;;;EAgUA,mBAAA,CACJ,MAAA,EAAQ,+BAAA,GACP,OAAA,CAAQ,iCAAA;EAlTY;;;;;EAoUjB,mBAAA,CACJ,MAAA,EAAQ,+BAAA,GACP,OAAA,CAAQ,iCAAA;EAhSL;;;;;EAgTO,eAAA,CACX,MAAA,EAAQ,2BAAA,GACP,OAAA,CAAQ,6BAAA;EA5RR;;;;EA6SU,YAAA,CAAA,GAAgB,OAAA,CAAQ,0BAAA;EA7RlC;;;;;EAwSG,oBAAA,CACJ,MAAA,EAAQ,gCAAA,GACP,OAAA,CAAQ,kCAAA;EAnRA;;;EAiSL,cAAA,CAAA,GAAkB,OAAA,CAAQ,4BAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_EngineBaseClient = require("./EngineBaseClient-
|
|
2
|
+
const require_EngineBaseClient = require("./EngineBaseClient-0oxXtif-.cjs");
|
|
3
3
|
const require_utils_productEngineTypeMappers = require("./utils/productEngineTypeMappers.cjs");
|
|
4
4
|
const require_utils_queryDataMappers = require("./utils/queryDataMappers.cjs");
|
|
5
5
|
let _nadohq_shared = require("@nadohq/shared");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as EngineQueryClient } from "./EngineQueryClient-
|
|
1
|
+
import { t as EngineQueryClient } from "./EngineQueryClient-0KRiawOi.cjs";
|
|
2
2
|
export { EngineQueryClient };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as EngineQueryClient } from "./EngineQueryClient-
|
|
1
|
+
import { t as EngineQueryClient } from "./EngineQueryClient-CYPBkrRj.js";
|
|
2
2
|
export { EngineQueryClient };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as GetEngineIpBlockStatusResponse, rt as GetEngineTimeResponse, v as GetEngineCountryCodeResponse } from "./clientQueryTypes-BTKfuoGI.cjs";
|
|
2
|
-
import { t as EngineBaseClient } from "./EngineBaseClient-
|
|
2
|
+
import { t as EngineBaseClient } from "./EngineBaseClient-BnFoL1j3.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/EngineWebClient.d.ts
|
|
5
5
|
/**
|
|
@@ -32,4 +32,4 @@ declare class EngineWebClient extends EngineBaseClient {
|
|
|
32
32
|
}
|
|
33
33
|
//#endregion
|
|
34
34
|
export { EngineWebClient as t };
|
|
35
|
-
//# sourceMappingURL=EngineWebClient-
|
|
35
|
+
//# sourceMappingURL=EngineWebClient-Bl7-3nYi.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineWebClient-
|
|
1
|
+
{"version":3,"file":"EngineWebClient-Bl7-3nYi.d.cts","names":[],"sources":["../src/src/EngineWebClient.ts"],"mappings":";;;;;;;AAcA;cAAa,eAAA,SAAwB,gBAAA;;;;EAI7B,gBAAA,CAAA,GAAoB,OAAA,CAAQ,8BAAA;EA8BV;;;;;;;EAAlB,cAAA,CAAA,GAAkB,OAAA,CAAQ,4BAAA;EA9B1B;;;;;EA6CA,yBAAA,CAAA,GAA6B,OAAA;EAA7B;;;EAqBA,OAAA,CAAA,GAAW,OAAA,CAAQ,qBAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as GetEngineIpBlockStatusResponse, rt as GetEngineTimeResponse, v as GetEngineCountryCodeResponse } from "./clientQueryTypes-BaYOTnpm.js";
|
|
2
|
-
import { t as EngineBaseClient } from "./EngineBaseClient-
|
|
2
|
+
import { t as EngineBaseClient } from "./EngineBaseClient-DMVQl1Gl.js";
|
|
3
3
|
|
|
4
4
|
//#region src/EngineWebClient.d.ts
|
|
5
5
|
/**
|
|
@@ -32,4 +32,4 @@ declare class EngineWebClient extends EngineBaseClient {
|
|
|
32
32
|
}
|
|
33
33
|
//#endregion
|
|
34
34
|
export { EngineWebClient as t };
|
|
35
|
-
//# sourceMappingURL=EngineWebClient-
|
|
35
|
+
//# sourceMappingURL=EngineWebClient-CPFci7kt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineWebClient-
|
|
1
|
+
{"version":3,"file":"EngineWebClient-CPFci7kt.d.ts","names":[],"sources":["../src/src/EngineWebClient.ts"],"mappings":";;;;;;;AAcA;cAAa,eAAA,SAAwB,gBAAA;;;;EAI7B,gBAAA,CAAA,GAAoB,OAAA,CAAQ,8BAAA;EA8BV;;;;;;;EAAlB,cAAA,CAAA,GAAkB,OAAA,CAAQ,4BAAA;EA9B1B;;;;;EA6CA,yBAAA,CAAA,GAA6B,OAAA;EAA7B;;;EAqBA,OAAA,CAAA,GAAW,OAAA,CAAQ,qBAAA;AAAA"}
|
package/dist/EngineWebClient.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_EngineBaseClient = require("./EngineBaseClient-
|
|
2
|
+
const require_EngineBaseClient = require("./EngineBaseClient-0oxXtif-.cjs");
|
|
3
3
|
//#region src/EngineWebClient.ts
|
|
4
4
|
const COUNTRY_HEADER = "x-nado-country";
|
|
5
5
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as EngineWebClient } from "./EngineWebClient-
|
|
1
|
+
import { t as EngineWebClient } from "./EngineWebClient-Bl7-3nYi.cjs";
|
|
2
2
|
export { EngineWebClient };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as EngineWebClient } from "./EngineWebClient-
|
|
1
|
+
import { t as EngineWebClient } from "./EngineWebClient-CPFci7kt.js";
|
|
2
2
|
export { EngineWebClient };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../EngineBaseClient-
|
|
2
|
+
require("../EngineBaseClient-0oxXtif-.cjs");
|
|
3
3
|
let _nadohq_shared = require("@nadohq/shared");
|
|
4
4
|
//#region src/types/EngineServerFailureError.ts
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../EngineBaseClient-
|
|
2
|
+
require("../EngineBaseClient-0oxXtif-.cjs");
|
|
3
3
|
//#region src/types/engineErrorCodes.ts
|
|
4
4
|
/**
|
|
5
5
|
* Numeric error codes returned by the engine service API. Codes shared across all Nado backend
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../EngineBaseClient-
|
|
2
|
+
require("../EngineBaseClient-0oxXtif-.cjs");
|
|
3
3
|
let _nadohq_shared = require("@nadohq/shared");
|
|
4
4
|
//#region src/utils/productEngineTypeMappers.ts
|
|
5
5
|
function mapProductEngineType(productEngineType) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../EngineBaseClient-
|
|
2
|
+
require("../EngineBaseClient-0oxXtif-.cjs");
|
|
3
3
|
const require_utils_productEngineTypeMappers = require("./productEngineTypeMappers.cjs");
|
|
4
4
|
let _nadohq_shared = require("@nadohq/shared");
|
|
5
5
|
//#region src/utils/queryDataMappers.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nadohq/engine-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.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.35.0",
|
|
45
45
|
"axios": "1.16.1",
|
|
46
46
|
"ts-mixer": "6.0.4"
|
|
47
47
|
},
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"bignumber.js": "11.1.1",
|
|
54
54
|
"viem": "2.52.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "232349cb0f432b024dab1b1c623e8ad3b74b8f85"
|
|
57
57
|
}
|
package/src/EngineBaseClient.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
getNadoClientTypeHeaders,
|
|
2
3
|
getSignedTransactionRequest,
|
|
3
4
|
SignableRequestType,
|
|
4
5
|
SignableRequestTypeToParams,
|
|
@@ -36,6 +37,8 @@ export interface EngineClientOpts {
|
|
|
36
37
|
walletClient?: WalletClientWithAccount;
|
|
37
38
|
// Linked signer registered through the engine, if provided, execute requests will use this signer
|
|
38
39
|
linkedSignerWalletClient?: WalletClientWithAccount;
|
|
40
|
+
// If provided, identifies the calling client, sent as a header with every request
|
|
41
|
+
clientType?: string;
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
// Only 1 key can be defined per execute request
|
|
@@ -63,6 +66,7 @@ export class EngineBaseClient {
|
|
|
63
66
|
withCredentials: true,
|
|
64
67
|
// We have custom logic to validate response status and create an appropriate error
|
|
65
68
|
validateStatus: () => true,
|
|
69
|
+
headers: getNadoClientTypeHeaders(opts.clientType),
|
|
66
70
|
});
|
|
67
71
|
}
|
|
68
72
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EngineBaseClient-J3nMzK0q.cjs","names":["WalletNotProvidedError","successResponse","EngineServerFailureError"],"sources":["../src/EngineBaseClient.ts"],"sourcesContent":["import {\n getSignedTransactionRequest,\n SignableRequestType,\n SignableRequestTypeToParams,\n WalletClientWithAccount,\n WalletNotProvidedError,\n} from '@nadohq/shared';\nimport axios, { AxiosInstance, AxiosResponse } from 'axios';\nimport {\n EngineServerCachedQueryRequestByType,\n EngineServerCachedQueryRequestType,\n EngineServerCachedQueryResponse,\n EngineServerCachedQueryResponseByType,\n EngineServerCachedQuerySuccessResponse,\n EngineServerEdgeControlRequestByType,\n EngineServerEdgeControlRequestType,\n EngineServerEdgeControlResponseByType,\n EngineServerExecuteRequestByType,\n EngineServerExecuteRequestType,\n EngineServerExecuteResult,\n EngineServerExecuteSuccessResult,\n EngineServerQueryRequestByType,\n EngineServerQueryRequestType,\n EngineServerQueryResponse,\n EngineServerQueryResponseByType,\n EngineServerQuerySuccessResponse,\n GetEngineNoncesParams,\n GetEngineNoncesResponse,\n} from './types';\nimport { EngineServerFailureError } from './types/EngineServerFailureError';\n\nexport interface EngineClientOpts {\n // Server URL\n url: string;\n // Wallet client for EIP712 signing\n walletClient?: WalletClientWithAccount;\n // Linked signer registered through the engine, if provided, execute requests will use this signer\n linkedSignerWalletClient?: WalletClientWithAccount;\n}\n\n// Only 1 key can be defined per execute request\ntype EngineExecuteRequestBody = Partial<EngineServerExecuteRequestByType>;\n\ntype EngineQueryRequestResponse<\n T extends EngineServerQueryRequestType = EngineServerQueryRequestType,\n> = EngineServerQueryResponse<T>;\n\ntype EngineCachedQueryRequestResponse<\n T extends EngineServerCachedQueryRequestType =\n EngineServerCachedQueryRequestType,\n> = EngineServerCachedQueryResponse<T>;\n\n/**\n * Base client for all engine requests\n */\nexport class EngineBaseClient {\n readonly opts: EngineClientOpts;\n readonly axiosInstance: AxiosInstance;\n\n constructor(opts: EngineClientOpts) {\n this.opts = opts;\n this.axiosInstance = axios.create({\n withCredentials: true,\n // We have custom logic to validate response status and create an appropriate error\n validateStatus: () => true,\n });\n }\n\n /**\n * Sets the linked signer for execute requests\n *\n * @param linkedSignerWalletClient The linkedSigner to use for all signatures. Set to null to revert to the chain signer\n */\n public setLinkedSigner(\n linkedSignerWalletClient: WalletClientWithAccount | null,\n ) {\n this.opts.linkedSignerWalletClient = linkedSignerWalletClient ?? undefined;\n }\n\n public async getTxNonce(address?: string): Promise<string> {\n const addr = address ?? this.opts.walletClient?.account.address;\n\n if (!addr) {\n throw new WalletNotProvidedError();\n }\n\n return (\n await this.getNonces({\n address: addr,\n })\n ).txNonce;\n }\n\n public async getNonces(\n params: GetEngineNoncesParams,\n ): Promise<GetEngineNoncesResponse> {\n const baseResp = await this.query('nonces', params);\n\n return {\n orderNonce: baseResp.order_nonce,\n txNonce: baseResp.tx_nonce,\n };\n }\n\n /**\n * Queries the engine, all query params are stringified into the query string\n *\n * @param requestType\n * @param params\n * @public\n */\n public async query<TRequestType extends EngineServerQueryRequestType>(\n requestType: TRequestType,\n params: EngineServerQueryRequestByType[TRequestType],\n ): Promise<EngineServerQueryResponseByType[TRequestType]> {\n const request = this.getQueryRequest(requestType, params);\n const response = await this.axiosInstance.post<EngineQueryRequestResponse>(\n `${this.opts.url}/query`,\n request,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus throws on failure responses so the cast to the success response is acceptable here\n const successResponse = response as AxiosResponse<\n EngineServerQuerySuccessResponse<TRequestType>\n >;\n\n return successResponse.data.data;\n }\n\n /**\n * Queries the gateway's in-memory cache via the `/edge/query` endpoint. Lower latency than\n * {@link query} at the cost of eventual consistency — do not use for order, margin, or\n * settlement decisions.\n *\n * @param requestType\n * @param params\n * @public\n */\n public async edgeQuery<\n TRequestType extends EngineServerCachedQueryRequestType,\n >(\n requestType: TRequestType,\n params: EngineServerCachedQueryRequestByType[TRequestType],\n ): Promise<EngineServerCachedQueryResponseByType[TRequestType]> {\n const request = this.getQueryRequest(requestType, params);\n const response =\n await this.axiosInstance.post<EngineCachedQueryRequestResponse>(\n `${this.opts.url}/edge/query`,\n request,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus throws on failure responses so the cast to the success response is acceptable here\n const successResponse = response as AxiosResponse<\n EngineServerCachedQuerySuccessResponse<TRequestType>\n >;\n\n return successResponse.data.data;\n }\n\n /**\n * Sends an edge control message (`ping` / `time`) via the `/edge/query` endpoint. These\n * return immediately from the server clock and use a different envelope than the cached data\n * queries (no `data` field), so the whole response body is returned.\n *\n * @param requestType\n * @param params\n * @public\n */\n public async edgeControlQuery<\n TRequestType extends EngineServerEdgeControlRequestType,\n >(\n requestType: TRequestType,\n params: EngineServerEdgeControlRequestByType[TRequestType],\n ): Promise<EngineServerEdgeControlResponseByType[TRequestType]> {\n const request = this.getQueryRequest(requestType, params);\n const response = await this.axiosInstance.post<\n EngineServerEdgeControlResponseByType[TRequestType]\n >(`${this.opts.url}/edge/query`, request);\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n return response.data;\n }\n\n /**\n * POSTs an execute message to the engine and returns the successful response. Throws the failure response wrapped\n * in an EngineServerFailureError on failure.\n *\n * @param requestType\n * @param params\n * @public\n */\n public async execute<TRequestType extends EngineServerExecuteRequestType>(\n requestType: TRequestType,\n params: EngineServerExecuteRequestByType[TRequestType],\n ): Promise<EngineServerExecuteSuccessResult<TRequestType>> {\n const reqBody = this.getExecuteRequest(requestType, params);\n const response = await this.axiosInstance.post<\n EngineServerExecuteResult<TRequestType>\n >(`${this.opts.url}/execute`, reqBody);\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus catches the failure result and throws the error, so the cast to the success response is acceptable here\n return response.data as EngineServerExecuteSuccessResult<TRequestType>;\n }\n\n /**\n * A simple, typechecked fn for constructing a `type`-tagged request body in the format expected\n * by the server. Generic over the request type / params pair so it can build live query, edge\n * (cached) query, and edge control request bodies alike.\n *\n * @param requestType\n * @param params\n */\n public getQueryRequest<TRequestType extends string, TParams extends object>(\n requestType: TRequestType,\n params: TParams,\n ): { type: TRequestType } & TParams {\n return {\n type: requestType,\n ...params,\n };\n }\n\n /**\n * A simple, typechecked fn for constructing an execute request in the format expected by the server.\n *\n * @param requestType\n * @param params\n */\n public getExecuteRequest<TRequestType extends EngineServerExecuteRequestType>(\n requestType: TRequestType,\n params: EngineServerExecuteRequestByType[TRequestType],\n ): EngineExecuteRequestBody {\n return {\n [requestType]: params,\n };\n }\n\n /**\n * Signs a given request with the signer provided to the engine\n *\n * @param requestType\n * @param verifyingContract\n * @param chainId\n * @param params\n * @public\n */\n public async sign<T extends SignableRequestType>(\n requestType: T,\n verifyingContract: string,\n chainId: number,\n params: SignableRequestTypeToParams[T],\n ) {\n // Use the linked signer if provided, otherwise use the default signer provided to the engine\n // However, always use wallet signer for withdraw_collateral_v2 as linked signers are not allowed for different\n // withdrawal addresses\n const walletClient = (() => {\n if (requestType === 'withdraw_collateral_v2') {\n return this.opts.walletClient;\n }\n return this.opts.linkedSignerWalletClient ?? this.opts.walletClient;\n })();\n\n if (!walletClient) {\n throw new WalletNotProvidedError();\n }\n\n return getSignedTransactionRequest({\n chainId,\n requestParams: params,\n requestType,\n walletClient,\n verifyingContract,\n });\n }\n\n private checkResponseStatus(response: AxiosResponse) {\n if (response.status !== 200 || !response.data) {\n throw Error(\n `Unexpected response from server: ${response.status} ${response.statusText}. Data: ${response.data}`,\n );\n }\n }\n\n private checkServerStatus(\n response: AxiosResponse<\n | EngineServerExecuteResult\n | EngineQueryRequestResponse\n | EngineCachedQueryRequestResponse\n | EngineServerEdgeControlResponseByType[EngineServerEdgeControlRequestType]\n >,\n ) {\n if (response.data.status !== 'success') {\n throw new EngineServerFailureError(response.data);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,IAAa,mBAAb,MAA8B;CAI5B,YAAY,MAAwB;EAClC,KAAK,OAAO;EACZ,KAAK,gBAAgB,MAAA,QAAM,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