@nadohq/engine-client 0.22.0 → 0.22.2
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-D4T3zroY.d.cts.map +1 -1
- package/dist/{EngineBaseClient-zgQmbhJv.cjs → EngineBaseClient-J3nMzK0q.cjs} +5 -2
- package/dist/{EngineBaseClient-zgQmbhJv.cjs.map → EngineBaseClient-J3nMzK0q.cjs.map} +1 -1
- package/dist/EngineBaseClient-whwZCdGv.d.ts.map +1 -1
- package/dist/EngineBaseClient.cjs +1 -1
- package/dist/EngineBaseClient.js +4 -1
- package/dist/EngineBaseClient.js.map +1 -1
- package/dist/EngineClient.cjs +1 -1
- package/dist/EngineEdgeQueryClient.cjs +1 -1
- package/dist/EngineExecuteBuilder.cjs +1 -1
- package/dist/EngineExecuteClient.cjs +1 -1
- package/dist/EngineQueryClient.cjs +1 -1
- package/dist/EngineWebClient.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{serverSubscriptionEventTypes-Co3utjCs.d.ts → serverSubscriptionEventTypes-C5GFcEZc.d.ts} +2 -2
- package/dist/{serverSubscriptionEventTypes-Co3utjCs.d.ts.map → serverSubscriptionEventTypes-C5GFcEZc.d.ts.map} +1 -1
- package/dist/{serverSubscriptionEventTypes-CpmdNk1G.d.cts → serverSubscriptionEventTypes-CQFY_NIZ.d.cts} +2 -2
- package/dist/{serverSubscriptionEventTypes-CpmdNk1G.d.cts.map → serverSubscriptionEventTypes-CQFY_NIZ.d.cts.map} +1 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/serverSubscriptionEventTypes.d.cts +1 -1
- package/dist/types/serverSubscriptionEventTypes.d.ts +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 +8 -2
- package/src/types/serverSub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CAErB,WAAA,EAAa,YAAA,EACb,MAAA,EAAQ,oCAAA,CAAqC,YAAA,IAC5C,OAAA,CAAQ,qCAAA,CAAsC,YAAA;EADvC;;;;;;;;EAqBG,OAAA,sBAA6B,8BAAA,CAAA,CACxC,WAAA,EAAa,YAAA,EACb,MAAA,EAAQ,gCAAA,CAAiC,YAAA,IACxC,OAAA,CAAQ,gCAAA,CAAiC,YAAA;EAAA;;;;;;;;EAqBrC,eAAA,qDAAA,CACL,WAAA,EAAa,YAAA,EACb,MAAA,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"}
|
|
@@ -150,7 +150,10 @@ var EngineBaseClient = class {
|
|
|
150
150
|
* @public
|
|
151
151
|
*/
|
|
152
152
|
async sign(requestType, verifyingContract, chainId, params) {
|
|
153
|
-
const walletClient =
|
|
153
|
+
const walletClient = (() => {
|
|
154
|
+
if (requestType === "withdraw_collateral_v2") return this.opts.walletClient;
|
|
155
|
+
return this.opts.linkedSignerWalletClient ?? this.opts.walletClient;
|
|
156
|
+
})();
|
|
154
157
|
if (!walletClient) throw new _nadohq_shared.WalletNotProvidedError();
|
|
155
158
|
return (0, _nadohq_shared.getSignedTransactionRequest)({
|
|
156
159
|
chainId,
|
|
@@ -181,4 +184,4 @@ Object.defineProperty(exports, "__toESM", {
|
|
|
181
184
|
}
|
|
182
185
|
});
|
|
183
186
|
|
|
184
|
-
//# sourceMappingURL=EngineBaseClient-
|
|
187
|
+
//# sourceMappingURL=EngineBaseClient-J3nMzK0q.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineBaseClient-zgQmbhJv.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 const walletClient =\n this.opts.linkedSignerWalletClient ?? this.opts.walletClient;\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,OAAO;GAChC,iBAAiB;GAEjB,sBAAsB;EACxB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C1D,MAAM,WAAW,MAAM,KAAK,cAAc,KAExC,GAAG,KAAK,KAAK,IAAI,WAAW,OAAO;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;EAEA,MAAM,eACJ,KAAK,KAAK,4BAA4B,KAAK,KAAK;EAElD,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"}
|
|
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,OAAO;GAChC,iBAAiB;GAEjB,sBAAsB;EACxB,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,IAAIA,eAAAA,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;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|
2
|
-
const require_EngineBaseClient = require("./EngineBaseClient-
|
|
2
|
+
const require_EngineBaseClient = require("./EngineBaseClient-J3nMzK0q.cjs");
|
|
3
3
|
exports.EngineBaseClient = require_EngineBaseClient.EngineBaseClient;
|
package/dist/EngineBaseClient.js
CHANGED
|
@@ -127,7 +127,10 @@ var EngineBaseClient = class {
|
|
|
127
127
|
* @public
|
|
128
128
|
*/
|
|
129
129
|
async sign(requestType, verifyingContract, chainId, params) {
|
|
130
|
-
const walletClient =
|
|
130
|
+
const walletClient = (() => {
|
|
131
|
+
if (requestType === "withdraw_collateral_v2") return this.opts.walletClient;
|
|
132
|
+
return this.opts.linkedSignerWalletClient ?? this.opts.walletClient;
|
|
133
|
+
})();
|
|
131
134
|
if (!walletClient) throw new WalletNotProvidedError();
|
|
132
135
|
return getSignedTransactionRequest({
|
|
133
136
|
chainId,
|
|
@@ -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 const walletClient =\n this.opts.linkedSignerWalletClient ?? this.opts.walletClient;\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,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;;;;;;;;CASA,MAAa,MACX,aACA,QACwD;EACxD,MAAM,UAAU,KAAK,gBAAgB,aAAa,MAAM;EACxD,MAAM,WAAW,MAAM,KAAK,cAAc,KACxC,GAAG,KAAK,KAAK,IAAI,SACjB,OACF;EAEA,KAAK,oBAAoB,QAAQ;EACjC,KAAK,kBAAkB,QAAQ;EAO/B,OAAOA,SAAgB,KAAK;CAC9B;;;;;;;;;;CAWA,MAAa,UAGX,aACA,QAC8D;EAC9D,MAAM,UAAU,KAAK,gBAAgB,aAAa,MAAM;EACxD,MAAM,WACJ,MAAM,KAAK,cAAc,KACvB,GAAG,KAAK,KAAK,IAAI,cACjB,OACF;EAEF,KAA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aseClient.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;CAE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oB,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"}
|
package/dist/EngineClient.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("./EngineBaseClient-
|
|
2
|
+
require("./EngineBaseClient-J3nMzK0q.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");
|
|
@@ -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-J3nMzK0q.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,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_EngineBaseClient = require("./EngineBaseClient-
|
|
2
|
+
const require_EngineBaseClient = require("./EngineBaseClient-J3nMzK0q.cjs");
|
|
3
3
|
const require_EngineExecuteBuilder = require("./EngineExecuteBuilder.cjs");
|
|
4
4
|
let _nadohq_shared = require("@nadohq/shared");
|
|
5
5
|
//#region src/EngineExecuteClient.ts
|
|
@@ -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-J3nMzK0q.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");
|
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-J3nMzK0q.cjs");
|
|
3
3
|
//#region src/EngineWebClient.ts
|
|
4
4
|
const COUNTRY_HEADER = "x-nado-country";
|
|
5
5
|
/**
|
package/dist/index.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ import { _ as WithBaseEngineExecuteParams, a as EngineExecuteRequestParamsByType
|
|
|
5
5
|
import { $ as GetEngineSubaccountProductOrdersResponse, A as GetEngineMarketPriceResponse, B as GetEngineMaxWithdrawableResponse, C as GetEngineIsolatedPositionsParams, D as GetEngineMarketLiquidityParams, E as GetEngineLinkedSignerResponse, F as GetEngineMaxMintNlpAmountParams, G as GetEngineNoncesResponse, 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, S as GetEngineIpBlockStatusResponse, T as GetEngineLinkedSignerParams, U as GetEngineNlpPoolInfoResponse, V as GetEngineNlpLockedBalancesParams, W as GetEngineNoncesParams, X as GetEngineSubaccountOrdersParams, Y as GetEngineSubaccountFeeRatesResponse, Z as GetEngineSubaccountOrdersResponse, _ as GetEngineContractsResponse, a as EngineNlpLockedBalance, at as SubaccountIsolatedPosition, b as GetEngineHealthGroupsResponse, c as EnginePingResponse, ct as SubaccountSummaryState, d as EngineSymbol, dt as ValidateEngineOrderResponse, et as GetEngineSubaccountSummaryParams, f as EngineSymbolsResponse, ft as ValidateSignedEngineOrderParams, g as GetEngineCachedMarketPricesParams, h as GetEngineCachedBboHistoryResponse, i as EngineNlpBalance, it as NlpPool, j as GetEngineMarketPricesParams, k as GetEngineMarketPriceParams, l as EnginePriceTickLiquidity, lt as SubaccountTx, m as GetEngineCachedBboHistoryParams, n as EngineCachedTimeParams, nt as GetEngineSymbolsParams, o as EngineOrder, ot as SubaccountOrderFeeRates, p as GetEngineAllMarketsResponse, q as GetEngineOrderResponse, r as EngineMarketPrice, rt as GetEngineTimeResponse, s as EnginePingParams, st as SubaccountProductDeltaTx, t as EngineBboHistorySample, tt as GetEngineSubaccountSummaryResponse, u as EngineSubaccountOrders, ut as ValidateEngineOrderParams, v as GetEngineCountryCodeResponse, w as GetEngineIsolatedPositionsResponse, x as GetEngineInsuranceResponse, y as GetEngineEstimatedSubaccountSummaryParams, z as GetEngineMaxWithdrawableParams } from "./clientQueryTypes-BTKfuoGI.cjs";
|
|
6
6
|
import { t as EngineServerFailureError } from "./EngineServerFailureError-DXzDAMoK.cjs";
|
|
7
7
|
import { a as EngineServerCachedQueryRequestByType, c as EngineServerCachedQueryResponseByType, d as EngineServerEdgeControlRequestByType, f as EngineServerEdgeControlRequestType, g as EngineServerTimeQueryParams, h as EngineServerPingResponse, i as EngineServerCachedQueryRequest, l as EngineServerCachedQuerySuccessResponse, m as EngineServerPingQueryParams, n as EngineServerCachedBboHistoryResponse, o as EngineServerCachedQueryRequestType, p as EngineServerEdgeControlResponseByType, r as EngineServerCachedBboHistorySample, s as EngineServerCachedQueryResponse, t as EngineServerCachedBboHistoryQueryParams, u as EngineServerControlTimeResponse } from "./serverEdgeQueryTypes-BpMlbsCD.cjs";
|
|
8
|
-
import { _ as PositionChangeReason, a as EngineServerSubscriptionBookDepthEvent, c as EngineServerSubscriptionFillEvent, d as EngineServerSubscriptionLatestCandlestickEvent, f as EngineServerSubscriptionLiquidationEvent, g as OrderUpdateReason, h as EngineServerSubscriptionTradeEvent, i as EngineServerSubscriptionBestBidOfferEvent, l as EngineServerSubscriptionFundingPaymentEvent, m as EngineServerSubscriptionPositionChangeEvent, n as EngineServerSubscriptionAllBboEvent, o as EngineServerSubscriptionEvent, p as EngineServerSubscriptionOrderUpdateEvent, r as EngineServerSubscriptionBaseEvent, s as EngineServerSubscriptionEventType, t as EngineServerAllBboEntry, u as EngineServerSubscriptionFundingRateEvent } from "./serverSubscriptionEventTypes-
|
|
8
|
+
import { _ as PositionChangeReason, a as EngineServerSubscriptionBookDepthEvent, c as EngineServerSubscriptionFillEvent, d as EngineServerSubscriptionLatestCandlestickEvent, f as EngineServerSubscriptionLiquidationEvent, g as OrderUpdateReason, h as EngineServerSubscriptionTradeEvent, i as EngineServerSubscriptionBestBidOfferEvent, l as EngineServerSubscriptionFundingPaymentEvent, m as EngineServerSubscriptionPositionChangeEvent, n as EngineServerSubscriptionAllBboEvent, o as EngineServerSubscriptionEvent, p as EngineServerSubscriptionOrderUpdateEvent, r as EngineServerSubscriptionBaseEvent, s as EngineServerSubscriptionEventType, t as EngineServerAllBboEntry, u as EngineServerSubscriptionFundingRateEvent } from "./serverSubscriptionEventTypes-CQFY_NIZ.cjs";
|
|
9
9
|
import { _ as EngineServerSubscriptionStream, a as EngineServerFundingPaymentStreamParams, b as EngineServerSubscriptionTimeResponse, c as EngineServerLiquidationStreamParams, d as EngineServerPositionChangeStreamParams, f as EngineServerSubscriptionParams, g as EngineServerSubscriptionRequestType, h as EngineServerSubscriptionRequestByType, i as EngineServerFillStreamParams, l as EngineServerOrderUpdateStreamParams, m as EngineServerSubscriptionRequest, n as EngineServerBestBidOfferStreamParams, o as EngineServerFundingRateStreamParams, p as EngineServerSubscriptionPingResponse, r as EngineServerBookDepthStreamParams, s as EngineServerLatestCandlestickStreamParams, t as EngineServerAllBboStreamParams, u as EngineServerPingParams, v as EngineServerSubscriptionStreamParamsByType, x as EngineServerTradeStreamParams, y as EngineServerSubscriptionStreamParamsType } from "./serverSubscriptionTypes-BA92bWic.cjs";
|
|
10
10
|
import { EngineClient } from "./EngineClient.cjs";
|
|
11
11
|
import { ENGINE_CLIENT_ENDPOINTS, ENGINE_WS_CLIENT_ENDPOINTS, ENGINE_WS_SUBSCRIPTION_CLIENT_ENDPOINTS } from "./endpoints.cjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { _ as WithBaseEngineExecuteParams, a as EngineExecuteRequestParamsByType
|
|
|
5
5
|
import { $ as GetEngineSubaccountProductOrdersResponse, A as GetEngineMarketPriceResponse, B as GetEngineMaxWithdrawableResponse, C as GetEngineIsolatedPositionsParams, D as GetEngineMarketLiquidityParams, E as GetEngineLinkedSignerResponse, F as GetEngineMaxMintNlpAmountParams, G as GetEngineNoncesResponse, 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, S as GetEngineIpBlockStatusResponse, T as GetEngineLinkedSignerParams, U as GetEngineNlpPoolInfoResponse, V as GetEngineNlpLockedBalancesParams, W as GetEngineNoncesParams, X as GetEngineSubaccountOrdersParams, Y as GetEngineSubaccountFeeRatesResponse, Z as GetEngineSubaccountOrdersResponse, _ as GetEngineContractsResponse, a as EngineNlpLockedBalance, at as SubaccountIsolatedPosition, b as GetEngineHealthGroupsResponse, c as EnginePingResponse, ct as SubaccountSummaryState, d as EngineSymbol, dt as ValidateEngineOrderResponse, et as GetEngineSubaccountSummaryParams, f as EngineSymbolsResponse, ft as ValidateSignedEngineOrderParams, g as GetEngineCachedMarketPricesParams, h as GetEngineCachedBboHistoryResponse, i as EngineNlpBalance, it as NlpPool, j as GetEngineMarketPricesParams, k as GetEngineMarketPriceParams, l as EnginePriceTickLiquidity, lt as SubaccountTx, m as GetEngineCachedBboHistoryParams, n as EngineCachedTimeParams, nt as GetEngineSymbolsParams, o as EngineOrder, ot as SubaccountOrderFeeRates, p as GetEngineAllMarketsResponse, q as GetEngineOrderResponse, r as EngineMarketPrice, rt as GetEngineTimeResponse, s as EnginePingParams, st as SubaccountProductDeltaTx, t as EngineBboHistorySample, tt as GetEngineSubaccountSummaryResponse, u as EngineSubaccountOrders, ut as ValidateEngineOrderParams, v as GetEngineCountryCodeResponse, w as GetEngineIsolatedPositionsResponse, x as GetEngineInsuranceResponse, y as GetEngineEstimatedSubaccountSummaryParams, z as GetEngineMaxWithdrawableParams } from "./clientQueryTypes-BaYOTnpm.js";
|
|
6
6
|
import { t as EngineServerFailureError } from "./EngineServerFailureError-CoxR__4r.js";
|
|
7
7
|
import { a as EngineServerCachedQueryRequestByType, c as EngineServerCachedQueryResponseByType, d as EngineServerEdgeControlRequestByType, f as EngineServerEdgeControlRequestType, g as EngineServerTimeQueryParams, h as EngineServerPingResponse, i as EngineServerCachedQueryRequest, l as EngineServerCachedQuerySuccessResponse, m as EngineServerPingQueryParams, n as EngineServerCachedBboHistoryResponse, o as EngineServerCachedQueryRequestType, p as EngineServerEdgeControlResponseByType, r as EngineServerCachedBboHistorySample, s as EngineServerCachedQueryResponse, t as EngineServerCachedBboHistoryQueryParams, u as EngineServerControlTimeResponse } from "./serverEdgeQueryTypes-DbSUWFzo.js";
|
|
8
|
-
import { _ as PositionChangeReason, a as EngineServerSubscriptionBookDepthEvent, c as EngineServerSubscriptionFillEvent, d as EngineServerSubscriptionLatestCandlestickEvent, f as EngineServerSubscriptionLiquidationEvent, g as OrderUpdateReason, h as EngineServerSubscriptionTradeEvent, i as EngineServerSubscriptionBestBidOfferEvent, l as EngineServerSubscriptionFundingPaymentEvent, m as EngineServerSubscriptionPositionChangeEvent, n as EngineServerSubscriptionAllBboEvent, o as EngineServerSubscriptionEvent, p as EngineServerSubscriptionOrderUpdateEvent, r as EngineServerSubscriptionBaseEvent, s as EngineServerSubscriptionEventType, t as EngineServerAllBboEntry, u as EngineServerSubscriptionFundingRateEvent } from "./serverSubscriptionEventTypes-
|
|
8
|
+
import { _ as PositionChangeReason, a as EngineServerSubscriptionBookDepthEvent, c as EngineServerSubscriptionFillEvent, d as EngineServerSubscriptionLatestCandlestickEvent, f as EngineServerSubscriptionLiquidationEvent, g as OrderUpdateReason, h as EngineServerSubscriptionTradeEvent, i as EngineServerSubscriptionBestBidOfferEvent, l as EngineServerSubscriptionFundingPaymentEvent, m as EngineServerSubscriptionPositionChangeEvent, n as EngineServerSubscriptionAllBboEvent, o as EngineServerSubscriptionEvent, p as EngineServerSubscriptionOrderUpdateEvent, r as EngineServerSubscriptionBaseEvent, s as EngineServerSubscriptionEventType, t as EngineServerAllBboEntry, u as EngineServerSubscriptionFundingRateEvent } from "./serverSubscriptionEventTypes-C5GFcEZc.js";
|
|
9
9
|
import { _ as EngineServerSubscriptionStream, a as EngineServerFundingPaymentStreamParams, b as EngineServerSubscriptionTimeResponse, c as EngineServerLiquidationStreamParams, d as EngineServerPositionChangeStreamParams, f as EngineServerSubscriptionParams, g as EngineServerSubscriptionRequestType, h as EngineServerSubscriptionRequestByType, i as EngineServerFillStreamParams, l as EngineServerOrderUpdateStreamParams, m as EngineServerSubscriptionRequest, n as EngineServerBestBidOfferStreamParams, o as EngineServerFundingRateStreamParams, p as EngineServerSubscriptionPingResponse, r as EngineServerBookDepthStreamParams, s as EngineServerLatestCandlestickStreamParams, t as EngineServerAllBboStreamParams, u as EngineServerPingParams, v as EngineServerSubscriptionStreamParamsByType, x as EngineServerTradeStreamParams, y as EngineServerSubscriptionStreamParamsType } from "./serverSubscriptionTypes-CEis5IgT.js";
|
|
10
10
|
import { EngineClient } from "./EngineClient.js";
|
|
11
11
|
import { ENGINE_CLIENT_ENDPOINTS, ENGINE_WS_CLIENT_ENDPOINTS, ENGINE_WS_SUBSCRIPTION_CLIENT_ENDPOINTS } from "./endpoints.js";
|
|
@@ -4,7 +4,7 @@ import { R as EngineServerPriceTickLiquidity } from "./serverQueryTypes-B3vC8vxT
|
|
|
4
4
|
/**
|
|
5
5
|
* Reasons that can trigger position change events.
|
|
6
6
|
*/
|
|
7
|
-
type PositionChangeReason = 'deposit_collateral' | 'match_orders' | 'withdraw_collateral' | 'transfer_quote' | 'settle_pnl' | 'mint_nlp' | 'burn_nlp' | 'liquidate_subaccount';
|
|
7
|
+
type PositionChangeReason = 'deposit_collateral' | 'match_orders' | 'withdraw_collateral' | 'withdraw_collateral_v2' | 'transfer_quote' | 'settle_pnl' | 'mint_nlp' | 'burn_nlp' | 'liquidate_subaccount';
|
|
8
8
|
/**
|
|
9
9
|
* Possible reasons for order updates.
|
|
10
10
|
*/
|
|
@@ -177,4 +177,4 @@ interface EngineServerSubscriptionAllBboEvent extends Omit<EngineServerSubscript
|
|
|
177
177
|
type EngineServerSubscriptionEvent = EngineServerSubscriptionTradeEvent | EngineServerSubscriptionBestBidOfferEvent | EngineServerSubscriptionBookDepthEvent | EngineServerSubscriptionFillEvent | EngineServerSubscriptionPositionChangeEvent | EngineServerSubscriptionOrderUpdateEvent | EngineServerSubscriptionLiquidationEvent | EngineServerSubscriptionLatestCandlestickEvent | EngineServerSubscriptionFundingPaymentEvent | EngineServerSubscriptionFundingRateEvent | EngineServerSubscriptionAllBboEvent;
|
|
178
178
|
//#endregion
|
|
179
179
|
export { PositionChangeReason as _, EngineServerSubscriptionBookDepthEvent as a, EngineServerSubscriptionFillEvent as c, EngineServerSubscriptionLatestCandlestickEvent as d, EngineServerSubscriptionLiquidationEvent as f, OrderUpdateReason as g, EngineServerSubscriptionTradeEvent as h, EngineServerSubscriptionBestBidOfferEvent as i, EngineServerSubscriptionFundingPaymentEvent as l, EngineServerSubscriptionPositionChangeEvent as m, EngineServerSubscriptionAllBboEvent as n, EngineServerSubscriptionEvent as o, EngineServerSubscriptionOrderUpdateEvent as p, EngineServerSubscriptionBaseEvent as r, EngineServerSubscriptionEventType as s, EngineServerAllBboEntry as t, EngineServerSubscriptionFundingRateEvent as u };
|
|
180
|
-
//# sourceMappingURL=serverSubscriptionEventTypes-
|
|
180
|
+
//# sourceMappingURL=serverSubscriptionEventTypes-C5GFcEZc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverSubscriptionEventTypes-
|
|
1
|
+
{"version":3,"file":"serverSubscriptionEventTypes-C5GFcEZc.d.ts","names":[],"sources":["../src/types/src/types/serverSubscriptionEventTypes.ts"],"mappings":";;;;;AAKA;KAAY,oBAAA;;;AAAoB;KAcpB,iBAAA;AAAA,KAEA,iCAAA;AAAA,UAaK,iCAAA,WACL,iCAAA,GACR,iCAAA;EAEF,IAAA,EAAM,CAAA;EACN,UAAA;AAAA;;;;UAMe,kCAAA,SAA2C,iCA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AA;AAAA;;;;UAMe,uBAAA;EAtCf;EAwCA,GAAA;EAvCM;EAyCN,GAAG;AAAA;;;;;;;UASY,mCAAA,SAA4C,IAAA,CAC3D,iCAAA;EAtCA;;;;AAGE;EA2CF,UAAA;EArCwD;EAuCxD,IAAA;EAvCiG;;;;;EA6CjG,IAAA,EAAM,MAAA,SAAe,uBAAA;AAAA;AA9BvB;;;AAAA,KAoCY,6BAAA,GACR,kCAAA,GACA,yCAAA,GACA,sCAAA,GACA,iCAAA,GACA,2CAAA,GACA,wCAAA,GACA,wCAAA,GACA,8CAAA,GACA,2CAAA,GACA,wCAAA,GACA,mCAAA"}
|
|
@@ -4,7 +4,7 @@ import { R as EngineServerPriceTickLiquidity } from "./serverQueryTypes-Dva9R2tV
|
|
|
4
4
|
/**
|
|
5
5
|
* Reasons that can trigger position change events.
|
|
6
6
|
*/
|
|
7
|
-
type PositionChangeReason = 'deposit_collateral' | 'match_orders' | 'withdraw_collateral' | 'transfer_quote' | 'settle_pnl' | 'mint_nlp' | 'burn_nlp' | 'liquidate_subaccount';
|
|
7
|
+
type PositionChangeReason = 'deposit_collateral' | 'match_orders' | 'withdraw_collateral' | 'withdraw_collateral_v2' | 'transfer_quote' | 'settle_pnl' | 'mint_nlp' | 'burn_nlp' | 'liquidate_subaccount';
|
|
8
8
|
/**
|
|
9
9
|
* Possible reasons for order updates.
|
|
10
10
|
*/
|
|
@@ -177,4 +177,4 @@ interface EngineServerSubscriptionAllBboEvent extends Omit<EngineServerSubscript
|
|
|
177
177
|
type EngineServerSubscriptionEvent = EngineServerSubscriptionTradeEvent | EngineServerSubscriptionBestBidOfferEvent | EngineServerSubscriptionBookDepthEvent | EngineServerSubscriptionFillEvent | EngineServerSubscriptionPositionChangeEvent | EngineServerSubscriptionOrderUpdateEvent | EngineServerSubscriptionLiquidationEvent | EngineServerSubscriptionLatestCandlestickEvent | EngineServerSubscriptionFundingPaymentEvent | EngineServerSubscriptionFundingRateEvent | EngineServerSubscriptionAllBboEvent;
|
|
178
178
|
//#endregion
|
|
179
179
|
export { PositionChangeReason as _, EngineServerSubscriptionBookDepthEvent as a, EngineServerSubscriptionFillEvent as c, EngineServerSubscriptionLatestCandlestickEvent as d, EngineServerSubscriptionLiquidationEvent as f, OrderUpdateReason as g, EngineServerSubscriptionTradeEvent as h, EngineServerSubscriptionBestBidOfferEvent as i, EngineServerSubscriptionFundingPaymentEvent as l, EngineServerSubscriptionPositionChangeEvent as m, EngineServerSubscriptionAllBboEvent as n, EngineServerSubscriptionEvent as o, EngineServerSubscriptionOrderUpdateEvent as p, EngineServerSubscriptionBaseEvent as r, EngineServerSubscriptionEventType as s, EngineServerAllBboEntry as t, EngineServerSubscriptionFundingRateEvent as u };
|
|
180
|
-
//# sourceMappingURL=serverSubscriptionEventTypes-
|
|
180
|
+
//# sourceMappingURL=serverSubscriptionEventTypes-CQFY_NIZ.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverSubscriptionEventTypes-
|
|
1
|
+
{"version":3,"file":"serverSubscriptionEventTypes-CQFY_NIZ.d.cts","names":[],"sources":["../src/types/src/types/serverSubscriptionEventTypes.ts"],"mappings":";;;;;AAKA;KAAY,oBAAA;;;AAAoB;KAcpB,iBAAA;AAAA,KAEA,iCAAA;AAAA,UAaK,iCAAA,WACL,iCAAA,GACR,iCAAA;EAEF,IAAA,EAAM,CAAA;EACN,UAAA;AAAA;;;;UAMe,kCAAA,SAA2C,iCAAiC;EAC3F,SAAA;EACA,KAAA;EACA,SAAA;EACA,SAAA;EACA,cAAA;AAAA;;;;UAMe,yCAAA,SAAkD,iCAAiC;EAClG,SAAA;EACA,SAAA;EACA,OAAA;EACA,SAAA;EACA,OAAA;AAAA;AAhBF;;;AAAA,UAsBiB,sCAAA,SAA+C,iCAAA;EAC9D,kBAAA;EACA,aAAA;EACA,aAAA;EACA,IAAA,EAAM,8BAAA;EACN,IAAA,EAAM,8BAAA;AAAA;;AAtBQ;AAMhB;UAsBiB,iCAAA,S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AA,GACA,wCAAA,GACA,8CAAA,GACA,2CAAA,GACA,wCAAA,GACA,mCAAA"}
|
package/dist/types/index.d.cts
CHANGED
|
@@ -5,6 +5,6 @@ import { _ as WithBaseEngineExecuteParams, a as EngineExecuteRequestParamsByType
|
|
|
5
5
|
import { $ as GetEngineSubaccountProductOrdersResponse, A as GetEngineMarketPriceResponse, B as GetEngineMaxWithdrawableResponse, C as GetEngineIsolatedPositionsParams, D as GetEngineMarketLiquidityParams, E as GetEngineLinkedSignerResponse, F as GetEngineMaxMintNlpAmountParams, G as GetEngineNoncesResponse, 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, S as GetEngineIpBlockStatusResponse, T as GetEngineLinkedSignerParams, U as GetEngineNlpPoolInfoResponse, V as GetEngineNlpLockedBalancesParams, W as GetEngineNoncesParams, X as GetEngineSubaccountOrdersParams, Y as GetEngineSubaccountFeeRatesResponse, Z as GetEngineSubaccountOrdersResponse, _ as GetEngineContractsResponse, a as EngineNlpLockedBalance, at as SubaccountIsolatedPosition, b as GetEngineHealthGroupsResponse, c as EnginePingResponse, ct as SubaccountSummaryState, d as EngineSymbol, dt as ValidateEngineOrderResponse, et as GetEngineSubaccountSummaryParams, f as EngineSymbolsResponse, ft as ValidateSignedEngineOrderParams, g as GetEngineCachedMarketPricesParams, h as GetEngineCachedBboHistoryResponse, i as EngineNlpBalance, it as NlpPool, j as GetEngineMarketPricesParams, k as GetEngineMarketPriceParams, l as EnginePriceTickLiquidity, lt as SubaccountTx, m as GetEngineCachedBboHistoryParams, n as EngineCachedTimeParams, nt as GetEngineSymbolsParams, o as EngineOrder, ot as SubaccountOrderFeeRates, p as GetEngineAllMarketsResponse, q as GetEngineOrderResponse, r as EngineMarketPrice, rt as GetEngineTimeResponse, s as EnginePingParams, st as SubaccountProductDeltaTx, t as EngineBboHistorySample, tt as GetEngineSubaccountSummaryResponse, u as EngineSubaccountOrders, ut as ValidateEngineOrderParams, v as GetEngineCountryCodeResponse, w as GetEngineIsolatedPositionsResponse, x as GetEngineInsuranceResponse, y as GetEngineEstimatedSubaccountSummaryParams, z as GetEngineMaxWithdrawableParams } from "../clientQueryTypes-BTKfuoGI.cjs";
|
|
6
6
|
import { t as EngineServerFailureError } from "../EngineServerFailureError-DXzDAMoK.cjs";
|
|
7
7
|
import { a as EngineServerCachedQueryRequestByType, c as EngineServerCachedQueryResponseByType, d as EngineServerEdgeControlRequestByType, f as EngineServerEdgeControlRequestType, g as EngineServerTimeQueryParams, h as EngineServerPingResponse, i as EngineServerCachedQueryRequest, l as EngineServerCachedQuerySuccessResponse, m as EngineServerPingQueryParams, n as EngineServerCachedBboHistoryResponse, o as EngineServerCachedQueryRequestType, p as EngineServerEdgeControlResponseByType, r as EngineServerCachedBboHistorySample, s as EngineServerCachedQueryResponse, t as EngineServerCachedBboHistoryQueryParams, u as EngineServerControlTimeResponse } from "../serverEdgeQueryTypes-BpMlbsCD.cjs";
|
|
8
|
-
import { _ as PositionChangeReason, a as EngineServerSubscriptionBookDepthEvent, c as EngineServerSubscriptionFillEvent, d as EngineServerSubscriptionLatestCandlestickEvent, f as EngineServerSubscriptionLiquidationEvent, g as OrderUpdateReason, h as EngineServerSubscriptionTradeEvent, i as EngineServerSubscriptionBestBidOfferEvent, l as EngineServerSubscriptionFundingPaymentEvent, m as EngineServerSubscriptionPositionChangeEvent, n as EngineServerSubscriptionAllBboEvent, o as EngineServerSubscriptionEvent, p as EngineServerSubscriptionOrderUpdateEvent, r as EngineServerSubscriptionBaseEvent, s as EngineServerSubscriptionEventType, t as EngineServerAllBboEntry, u as EngineServerSubscriptionFundingRateEvent } from "../serverSubscriptionEventTypes-
|
|
8
|
+
import { _ as PositionChangeReason, a as EngineServerSubscriptionBookDepthEvent, c as EngineServerSubscriptionFillEvent, d as EngineServerSubscriptionLatestCandlestickEvent, f as EngineServerSubscriptionLiquidationEvent, g as OrderUpdateReason, h as EngineServerSubscriptionTradeEvent, i as EngineServerSubscriptionBestBidOfferEvent, l as EngineServerSubscriptionFundingPaymentEvent, m as EngineServerSubscriptionPositionChangeEvent, n as EngineServerSubscriptionAllBboEvent, o as EngineServerSubscriptionEvent, p as EngineServerSubscriptionOrderUpdateEvent, r as EngineServerSubscriptionBaseEvent, s as EngineServerSubscriptionEventType, t as EngineServerAllBboEntry, u as EngineServerSubscriptionFundingRateEvent } from "../serverSubscriptionEventTypes-CQFY_NIZ.cjs";
|
|
9
9
|
import { _ as EngineServerSubscriptionStream, a as EngineServerFundingPaymentStreamParams, b as EngineServerSubscriptionTimeResponse, c as EngineServerLiquidationStreamParams, d as EngineServerPositionChangeStreamParams, f as EngineServerSubscriptionParams, g as EngineServerSubscriptionRequestType, h as EngineServerSubscriptionRequestByType, i as EngineServerFillStreamParams, l as EngineServerOrderUpdateStreamParams, m as EngineServerSubscriptionRequest, n as EngineServerBestBidOfferStreamParams, o as EngineServerFundingRateStreamParams, p as EngineServerSubscriptionPingResponse, r as EngineServerBookDepthStreamParams, s as EngineServerLatestCandlestickStreamParams, t as EngineServerAllBboStreamParams, u as EngineServerPingParams, v as EngineServerSubscriptionStreamParamsByType, x as EngineServerTradeStreamParams, y as EngineServerSubscriptionStreamParamsType } from "../serverSubscriptionTypes-BA92bWic.cjs";
|
|
10
10
|
export { ENGINE_SERVER_STATUS_VALUES, EngineBboHistorySample, EngineBurnNlpParams, EngineCachedTimeParams, EngineCancelAndPlaceParams, EngineCancelOrdersParams, EngineCancelProductOrdersParams, EngineExecuteRequestParamsByType, EngineInsuranceResponse, EngineLinkSignerParams, EngineLiquidateSubaccountParams, EngineMarketPrice, EngineMintNlpParams, EngineNlpBalance, EngineNlpLockedBalance, EngineOrder, EngineOrderParams, EnginePingParams, EnginePingResponse, EnginePlaceOrderParams, EnginePlaceOrderResult, EnginePlaceOrdersParams, EnginePriceTickLiquidity, EngineServerAllBboEntry, EngineServerAllBboStreamParams, EngineServerAllProductsResponse, EngineServerBestBidOfferStreamParams, EngineServerBookDepthStreamParams, EngineServerBookInfo, EngineServerCachedBboHistoryQueryParams, EngineServerCachedBboHistoryResponse, EngineServerCachedBboHistorySample, EngineServerCachedQueryRequest, EngineServerCachedQueryRequestByType, EngineServerCachedQueryRequestType, EngineServerCachedQueryResponse, EngineServerCachedQueryResponseByType, EngineServerCachedQuerySuccessResponse, EngineServerCancelOrdersParams, EngineServerCancelOrdersResponse, EngineServerContractsResponse, EngineServerControlTimeResponse, EngineServerEdgeAllProductsResponse, EngineServerEdgeControlRequestByType, EngineServerEdgeControlRequestType, EngineServerEdgeControlResponseByType, EngineServerExecuteFailureResult, EngineServerExecutePlaceOrderPayload, EngineServerExecuteRequestByType, EngineServerExecuteRequestType, EngineServerExecuteResponseDataByType, EngineServerExecuteResult, EngineServerExecuteSuccessResult, EngineServerFailureError, EngineServerFeeRatesResponse, EngineServerFillStreamParams, EngineServerFundingPaymentStreamParams, EngineServerFundingRateStreamParams, EngineServerGetOrderQueryParams, EngineServerHealthBreakdown, EngineServerHealthGroupsResponse, EngineServerIpBlockResponse, EngineServerIsolatedPosition, EngineServerIsolatedPositionsQueryParams, EngineServerIsolatedPositionsResponse, EngineServerLatestCandlestickStreamParams, EngineServerLinkedSignerParams, EngineServerLinkedSignerResponse, EngineServerLiquidationStreamParams, EngineServerMarketLiquidityQueryParams, EngineServerMarketLiquidityResponse, EngineServerMarketPrice, EngineServerMarketPriceQueryParams, EngineServerMarketPriceResponse, EngineServerMarketPricesQueryParams, EngineServerMarketPricesResponse, EngineServerMaxBurnNlpQueryParams, EngineServerMaxBurnNlpResponse, EngineServerMaxMintNlpQueryParams, EngineServerMaxMintNlpResponse, EngineServerMaxOrderSizeQueryParams, EngineServerMaxOrderSizeResponse, EngineServerMaxWithdrawableQueryParams, EngineServerMaxWithdrawableResponse, EngineServerNlpBalance, EngineServerNlpLockedBalance, EngineServerNlpLockedBalancesQueryParams, EngineServerNlpLockedBalancesResponse, EngineServerNlpPool, EngineServerNlpPoolInfoResponse, EngineServerNoncesParams, EngineServerNoncesResponse, EngineServerOrder, EngineServerOrderResponse, EngineServerOrderUpdateStreamParams, EngineServerOrdersQueryParams, EngineServerPerpBalance, EngineServerPerpBalanceData, EngineServerPerpProduct, EngineServerPerpState, EngineServerPingParams, EngineServerPingQueryParams, EngineServerPingResponse, EngineServerPlaceOrderParams, EngineServerPlaceOrderResponse, EngineServerPlaceOrdersResponse, EngineServerPositionChangeStreamParams, EngineServerPriceTickLiquidity, EngineServerProductOrdersResponse, EngineServerProductType, EngineServerQueryFailureResponse, EngineServerQueryRequest, EngineServerQueryRequestByType, EngineServerQueryRequestType, EngineServerQueryResponse, EngineServerQueryResponseByType, EngineServerQuerySuccessResponse, EngineServerRisk, EngineServerSpotBalance, EngineServerSpotBalanceData, EngineServerSpotConfig, EngineServerSpotProduct, EngineServerSpotState, EngineServerStatusResponse, EngineServerSubaccountFeeRatesParams, EngineServerSubaccountInfoQueryParams, EngineServerSubaccountInfoResponse, EngineServerSubaccountInfoState, EngineServerSubaccountOrders, EngineServerSubaccountOrdersQueryParams, EngineServerSubaccountOrdersResponse, EngineServerSubscriptionAllBboEvent, EngineServerSubscriptionBaseEvent, EngineServerSubscriptionBestBidOfferEvent, EngineServerSubscriptionBookDepthEvent, EngineServerSubscriptionEvent, EngineServerSubscriptionEventType, EngineServerSubscriptionFillEvent, EngineServerSubscriptionFundingPaymentEvent, EngineServerSubscriptionFundingRateEvent, EngineServerSubscriptionLatestCandlestickEvent, EngineServerSubscriptionLiquidationEvent, EngineServerSubscriptionOrderUpdateEvent, EngineServerSubscriptionParams, EngineServerSubscriptionPingResponse, EngineServerSubscriptionPositionChangeEvent, EngineServerSubscriptionRequest, EngineServerSubscriptionRequestByType, EngineServerSubscriptionRequestType, EngineServerSubscriptionStream, EngineServerSubscriptionStreamParamsByType, EngineServerSubscriptionStreamParamsType, EngineServerSubscriptionTimeResponse, EngineServerSubscriptionTradeEvent, EngineServerSymbol, EngineServerSymbolsQueryParams, EngineServerSymbolsResponse, EngineServerTimeQueryParams, EngineServerTimeResponse, EngineServerTradeStreamParams, EngineServerValidateOrderQueryParams, EngineServerValidateOrderResponse, EngineServiceCancelAndPlaceParams, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, EngineTransferQuoteParams, EngineWithdrawCollateralParams, EngineWithdrawCollateralV2Params, GetEngineAllMarketsResponse, GetEngineCachedBboHistoryParams, GetEngineCachedBboHistoryResponse, GetEngineCachedMarketPricesParams, 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, OrderUpdateReason, PositionChangeReason, SignatureParams, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountSummaryState, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams, WithBaseEngineExecuteParams, WithSignature };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ import { _ as WithBaseEngineExecuteParams, a as EngineExecuteRequestParamsByType
|
|
|
5
5
|
import { $ as GetEngineSubaccountProductOrdersResponse, A as GetEngineMarketPriceResponse, B as GetEngineMaxWithdrawableResponse, C as GetEngineIsolatedPositionsParams, D as GetEngineMarketLiquidityParams, E as GetEngineLinkedSignerResponse, F as GetEngineMaxMintNlpAmountParams, G as GetEngineNoncesResponse, 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, S as GetEngineIpBlockStatusResponse, T as GetEngineLinkedSignerParams, U as GetEngineNlpPoolInfoResponse, V as GetEngineNlpLockedBalancesParams, W as GetEngineNoncesParams, X as GetEngineSubaccountOrdersParams, Y as GetEngineSubaccountFeeRatesResponse, Z as GetEngineSubaccountOrdersResponse, _ as GetEngineContractsResponse, a as EngineNlpLockedBalance, at as SubaccountIsolatedPosition, b as GetEngineHealthGroupsResponse, c as EnginePingResponse, ct as SubaccountSummaryState, d as EngineSymbol, dt as ValidateEngineOrderResponse, et as GetEngineSubaccountSummaryParams, f as EngineSymbolsResponse, ft as ValidateSignedEngineOrderParams, g as GetEngineCachedMarketPricesParams, h as GetEngineCachedBboHistoryResponse, i as EngineNlpBalance, it as NlpPool, j as GetEngineMarketPricesParams, k as GetEngineMarketPriceParams, l as EnginePriceTickLiquidity, lt as SubaccountTx, m as GetEngineCachedBboHistoryParams, n as EngineCachedTimeParams, nt as GetEngineSymbolsParams, o as EngineOrder, ot as SubaccountOrderFeeRates, p as GetEngineAllMarketsResponse, q as GetEngineOrderResponse, r as EngineMarketPrice, rt as GetEngineTimeResponse, s as EnginePingParams, st as SubaccountProductDeltaTx, t as EngineBboHistorySample, tt as GetEngineSubaccountSummaryResponse, u as EngineSubaccountOrders, ut as ValidateEngineOrderParams, v as GetEngineCountryCodeResponse, w as GetEngineIsolatedPositionsResponse, x as GetEngineInsuranceResponse, y as GetEngineEstimatedSubaccountSummaryParams, z as GetEngineMaxWithdrawableParams } from "../clientQueryTypes-BaYOTnpm.js";
|
|
6
6
|
import { t as EngineServerFailureError } from "../EngineServerFailureError-CoxR__4r.js";
|
|
7
7
|
import { a as EngineServerCachedQueryRequestByType, c as EngineServerCachedQueryResponseByType, d as EngineServerEdgeControlRequestByType, f as EngineServerEdgeControlRequestType, g as EngineServerTimeQueryParams, h as EngineServerPingResponse, i as EngineServerCachedQueryRequest, l as EngineServerCachedQuerySuccessResponse, m as EngineServerPingQueryParams, n as EngineServerCachedBboHistoryResponse, o as EngineServerCachedQueryRequestType, p as EngineServerEdgeControlResponseByType, r as EngineServerCachedBboHistorySample, s as EngineServerCachedQueryResponse, t as EngineServerCachedBboHistoryQueryParams, u as EngineServerControlTimeResponse } from "../serverEdgeQueryTypes-DbSUWFzo.js";
|
|
8
|
-
import { _ as PositionChangeReason, a as EngineServerSubscriptionBookDepthEvent, c as EngineServerSubscriptionFillEvent, d as EngineServerSubscriptionLatestCandlestickEvent, f as EngineServerSubscriptionLiquidationEvent, g as OrderUpdateReason, h as EngineServerSubscriptionTradeEvent, i as EngineServerSubscriptionBestBidOfferEvent, l as EngineServerSubscriptionFundingPaymentEvent, m as EngineServerSubscriptionPositionChangeEvent, n as EngineServerSubscriptionAllBboEvent, o as EngineServerSubscriptionEvent, p as EngineServerSubscriptionOrderUpdateEvent, r as EngineServerSubscriptionBaseEvent, s as EngineServerSubscriptionEventType, t as EngineServerAllBboEntry, u as EngineServerSubscriptionFundingRateEvent } from "../serverSubscriptionEventTypes-
|
|
8
|
+
import { _ as PositionChangeReason, a as EngineServerSubscriptionBookDepthEvent, c as EngineServerSubscriptionFillEvent, d as EngineServerSubscriptionLatestCandlestickEvent, f as EngineServerSubscriptionLiquidationEvent, g as OrderUpdateReason, h as EngineServerSubscriptionTradeEvent, i as EngineServerSubscriptionBestBidOfferEvent, l as EngineServerSubscriptionFundingPaymentEvent, m as EngineServerSubscriptionPositionChangeEvent, n as EngineServerSubscriptionAllBboEvent, o as EngineServerSubscriptionEvent, p as EngineServerSubscriptionOrderUpdateEvent, r as EngineServerSubscriptionBaseEvent, s as EngineServerSubscriptionEventType, t as EngineServerAllBboEntry, u as EngineServerSubscriptionFundingRateEvent } from "../serverSubscriptionEventTypes-C5GFcEZc.js";
|
|
9
9
|
import { _ as EngineServerSubscriptionStream, a as EngineServerFundingPaymentStreamParams, b as EngineServerSubscriptionTimeResponse, c as EngineServerLiquidationStreamParams, d as EngineServerPositionChangeStreamParams, f as EngineServerSubscriptionParams, g as EngineServerSubscriptionRequestType, h as EngineServerSubscriptionRequestByType, i as EngineServerFillStreamParams, l as EngineServerOrderUpdateStreamParams, m as EngineServerSubscriptionRequest, n as EngineServerBestBidOfferStreamParams, o as EngineServerFundingRateStreamParams, p as EngineServerSubscriptionPingResponse, r as EngineServerBookDepthStreamParams, s as EngineServerLatestCandlestickStreamParams, t as EngineServerAllBboStreamParams, u as EngineServerPingParams, v as EngineServerSubscriptionStreamParamsByType, x as EngineServerTradeStreamParams, y as EngineServerSubscriptionStreamParamsType } from "../serverSubscriptionTypes-CEis5IgT.js";
|
|
10
10
|
export { ENGINE_SERVER_STATUS_VALUES, EngineBboHistorySample, EngineBurnNlpParams, EngineCachedTimeParams, EngineCancelAndPlaceParams, EngineCancelOrdersParams, EngineCancelProductOrdersParams, EngineExecuteRequestParamsByType, EngineInsuranceResponse, EngineLinkSignerParams, EngineLiquidateSubaccountParams, EngineMarketPrice, EngineMintNlpParams, EngineNlpBalance, EngineNlpLockedBalance, EngineOrder, EngineOrderParams, EnginePingParams, EnginePingResponse, EnginePlaceOrderParams, EnginePlaceOrderResult, EnginePlaceOrdersParams, EnginePriceTickLiquidity, EngineServerAllBboEntry, EngineServerAllBboStreamParams, EngineServerAllProductsResponse, EngineServerBestBidOfferStreamParams, EngineServerBookDepthStreamParams, EngineServerBookInfo, EngineServerCachedBboHistoryQueryParams, EngineServerCachedBboHistoryResponse, EngineServerCachedBboHistorySample, EngineServerCachedQueryRequest, EngineServerCachedQueryRequestByType, EngineServerCachedQueryRequestType, EngineServerCachedQueryResponse, EngineServerCachedQueryResponseByType, EngineServerCachedQuerySuccessResponse, EngineServerCancelOrdersParams, EngineServerCancelOrdersResponse, EngineServerContractsResponse, EngineServerControlTimeResponse, EngineServerEdgeAllProductsResponse, EngineServerEdgeControlRequestByType, EngineServerEdgeControlRequestType, EngineServerEdgeControlResponseByType, EngineServerExecuteFailureResult, EngineServerExecutePlaceOrderPayload, EngineServerExecuteRequestByType, EngineServerExecuteRequestType, EngineServerExecuteResponseDataByType, EngineServerExecuteResult, EngineServerExecuteSuccessResult, EngineServerFailureError, EngineServerFeeRatesResponse, EngineServerFillStreamParams, EngineServerFundingPaymentStreamParams, EngineServerFundingRateStreamParams, EngineServerGetOrderQueryParams, EngineServerHealthBreakdown, EngineServerHealthGroupsResponse, EngineServerIpBlockResponse, EngineServerIsolatedPosition, EngineServerIsolatedPositionsQueryParams, EngineServerIsolatedPositionsResponse, EngineServerLatestCandlestickStreamParams, EngineServerLinkedSignerParams, EngineServerLinkedSignerResponse, EngineServerLiquidationStreamParams, EngineServerMarketLiquidityQueryParams, EngineServerMarketLiquidityResponse, EngineServerMarketPrice, EngineServerMarketPriceQueryParams, EngineServerMarketPriceResponse, EngineServerMarketPricesQueryParams, EngineServerMarketPricesResponse, EngineServerMaxBurnNlpQueryParams, EngineServerMaxBurnNlpResponse, EngineServerMaxMintNlpQueryParams, EngineServerMaxMintNlpResponse, EngineServerMaxOrderSizeQueryParams, EngineServerMaxOrderSizeResponse, EngineServerMaxWithdrawableQueryParams, EngineServerMaxWithdrawableResponse, EngineServerNlpBalance, EngineServerNlpLockedBalance, EngineServerNlpLockedBalancesQueryParams, EngineServerNlpLockedBalancesResponse, EngineServerNlpPool, EngineServerNlpPoolInfoResponse, EngineServerNoncesParams, EngineServerNoncesResponse, EngineServerOrder, EngineServerOrderResponse, EngineServerOrderUpdateStreamParams, EngineServerOrdersQueryParams, EngineServerPerpBalance, EngineServerPerpBalanceData, EngineServerPerpProduct, EngineServerPerpState, EngineServerPingParams, EngineServerPingQueryParams, EngineServerPingResponse, EngineServerPlaceOrderParams, EngineServerPlaceOrderResponse, EngineServerPlaceOrdersResponse, EngineServerPositionChangeStreamParams, EngineServerPriceTickLiquidity, EngineServerProductOrdersResponse, EngineServerProductType, EngineServerQueryFailureResponse, EngineServerQueryRequest, EngineServerQueryRequestByType, EngineServerQueryRequestType, EngineServerQueryResponse, EngineServerQueryResponseByType, EngineServerQuerySuccessResponse, EngineServerRisk, EngineServerSpotBalance, EngineServerSpotBalanceData, EngineServerSpotConfig, EngineServerSpotProduct, EngineServerSpotState, EngineServerStatusResponse, EngineServerSubaccountFeeRatesParams, EngineServerSubaccountInfoQueryParams, EngineServerSubaccountInfoResponse, EngineServerSubaccountInfoState, EngineServerSubaccountOrders, EngineServerSubaccountOrdersQueryParams, EngineServerSubaccountOrdersResponse, EngineServerSubscriptionAllBboEvent, EngineServerSubscriptionBaseEvent, EngineServerSubscriptionBestBidOfferEvent, EngineServerSubscriptionBookDepthEvent, EngineServerSubscriptionEvent, EngineServerSubscriptionEventType, EngineServerSubscriptionFillEvent, EngineServerSubscriptionFundingPaymentEvent, EngineServerSubscriptionFundingRateEvent, EngineServerSubscriptionLatestCandlestickEvent, EngineServerSubscriptionLiquidationEvent, EngineServerSubscriptionOrderUpdateEvent, EngineServerSubscriptionParams, EngineServerSubscriptionPingResponse, EngineServerSubscriptionPositionChangeEvent, EngineServerSubscriptionRequest, EngineServerSubscriptionRequestByType, EngineServerSubscriptionRequestType, EngineServerSubscriptionStream, EngineServerSubscriptionStreamParamsByType, EngineServerSubscriptionStreamParamsType, EngineServerSubscriptionTimeResponse, EngineServerSubscriptionTradeEvent, EngineServerSymbol, EngineServerSymbolsQueryParams, EngineServerSymbolsResponse, EngineServerTimeQueryParams, EngineServerTimeResponse, EngineServerTradeStreamParams, EngineServerValidateOrderQueryParams, EngineServerValidateOrderResponse, EngineServiceCancelAndPlaceParams, EngineSubaccountOrders, EngineSymbol, EngineSymbolsResponse, EngineTransferQuoteParams, EngineWithdrawCollateralParams, EngineWithdrawCollateralV2Params, GetEngineAllMarketsResponse, GetEngineCachedBboHistoryParams, GetEngineCachedBboHistoryResponse, GetEngineCachedMarketPricesParams, 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, OrderUpdateReason, PositionChangeReason, SignatureParams, SubaccountIsolatedPosition, SubaccountOrderFeeRates, SubaccountProductDeltaTx, SubaccountSummaryState, SubaccountTx, ValidateEngineOrderParams, ValidateEngineOrderResponse, ValidateSignedEngineOrderParams, WithBaseEngineExecuteParams, WithSignature };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as PositionChangeReason, a as EngineServerSubscriptionBookDepthEvent, c as EngineServerSubscriptionFillEvent, d as EngineServerSubscriptionLatestCandlestickEvent, f as EngineServerSubscriptionLiquidationEvent, g as OrderUpdateReason, h as EngineServerSubscriptionTradeEvent, i as EngineServerSubscriptionBestBidOfferEvent, l as EngineServerSubscriptionFundingPaymentEvent, m as EngineServerSubscriptionPositionChangeEvent, n as EngineServerSubscriptionAllBboEvent, o as EngineServerSubscriptionEvent, p as EngineServerSubscriptionOrderUpdateEvent, r as EngineServerSubscriptionBaseEvent, s as EngineServerSubscriptionEventType, t as EngineServerAllBboEntry, u as EngineServerSubscriptionFundingRateEvent } from "../serverSubscriptionEventTypes-
|
|
1
|
+
import { _ as PositionChangeReason, a as EngineServerSubscriptionBookDepthEvent, c as EngineServerSubscriptionFillEvent, d as EngineServerSubscriptionLatestCandlestickEvent, f as EngineServerSubscriptionLiquidationEvent, g as OrderUpdateReason, h as EngineServerSubscriptionTradeEvent, i as EngineServerSubscriptionBestBidOfferEvent, l as EngineServerSubscriptionFundingPaymentEvent, m as EngineServerSubscriptionPositionChangeEvent, n as EngineServerSubscriptionAllBboEvent, o as EngineServerSubscriptionEvent, p as EngineServerSubscriptionOrderUpdateEvent, r as EngineServerSubscriptionBaseEvent, s as EngineServerSubscriptionEventType, t as EngineServerAllBboEntry, u as EngineServerSubscriptionFundingRateEvent } from "../serverSubscriptionEventTypes-CQFY_NIZ.cjs";
|
|
2
2
|
export { EngineServerAllBboEntry, EngineServerSubscriptionAllBboEvent, EngineServerSubscriptionBaseEvent, EngineServerSubscriptionBestBidOfferEvent, EngineServerSubscriptionBookDepthEvent, EngineServerSubscriptionEvent, EngineServerSubscriptionEventType, EngineServerSubscriptionFillEvent, EngineServerSubscriptionFundingPaymentEvent, EngineServerSubscriptionFundingRateEvent, EngineServerSubscriptionLatestCandlestickEvent, EngineServerSubscriptionLiquidationEvent, EngineServerSubscriptionOrderUpdateEvent, EngineServerSubscriptionPositionChangeEvent, EngineServerSubscriptionTradeEvent, OrderUpdateReason, PositionChangeReason };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as PositionChangeReason, a as EngineServerSubscriptionBookDepthEvent, c as EngineServerSubscriptionFillEvent, d as EngineServerSubscriptionLatestCandlestickEvent, f as EngineServerSubscriptionLiquidationEvent, g as OrderUpdateReason, h as EngineServerSubscriptionTradeEvent, i as EngineServerSubscriptionBestBidOfferEvent, l as EngineServerSubscriptionFundingPaymentEvent, m as EngineServerSubscriptionPositionChangeEvent, n as EngineServerSubscriptionAllBboEvent, o as EngineServerSubscriptionEvent, p as EngineServerSubscriptionOrderUpdateEvent, r as EngineServerSubscriptionBaseEvent, s as EngineServerSubscriptionEventType, t as EngineServerAllBboEntry, u as EngineServerSubscriptionFundingRateEvent } from "../serverSubscriptionEventTypes-
|
|
1
|
+
import { _ as PositionChangeReason, a as EngineServerSubscriptionBookDepthEvent, c as EngineServerSubscriptionFillEvent, d as EngineServerSubscriptionLatestCandlestickEvent, f as EngineServerSubscriptionLiquidationEvent, g as OrderUpdateReason, h as EngineServerSubscriptionTradeEvent, i as EngineServerSubscriptionBestBidOfferEvent, l as EngineServerSubscriptionFundingPaymentEvent, m as EngineServerSubscriptionPositionChangeEvent, n as EngineServerSubscriptionAllBboEvent, o as EngineServerSubscriptionEvent, p as EngineServerSubscriptionOrderUpdateEvent, r as EngineServerSubscriptionBaseEvent, s as EngineServerSubscriptionEventType, t as EngineServerAllBboEntry, u as EngineServerSubscriptionFundingRateEvent } from "../serverSubscriptionEventTypes-C5GFcEZc.js";
|
|
2
2
|
export { EngineServerAllBboEntry, EngineServerSubscriptionAllBboEvent, EngineServerSubscriptionBaseEvent, EngineServerSubscriptionBestBidOfferEvent, EngineServerSubscriptionBookDepthEvent, EngineServerSubscriptionEvent, EngineServerSubscriptionEventType, EngineServerSubscriptionFillEvent, EngineServerSubscriptionFundingPaymentEvent, EngineServerSubscriptionFundingRateEvent, EngineServerSubscriptionLatestCandlestickEvent, EngineServerSubscriptionLiquidationEvent, EngineServerSubscriptionOrderUpdateEvent, EngineServerSubscriptionPositionChangeEvent, EngineServerSubscriptionTradeEvent, OrderUpdateReason, PositionChangeReason };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../EngineBaseClient-
|
|
2
|
+
require("../EngineBaseClient-J3nMzK0q.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-J3nMzK0q.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.22.
|
|
3
|
+
"version": "0.22.2",
|
|
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.22.
|
|
44
|
+
"@nadohq/shared": "^0.22.2",
|
|
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": "5b7d715aec5098a24f44b801924c12d657142ee0"
|
|
57
57
|
}
|
package/src/EngineBaseClient.ts
CHANGED
|
@@ -262,8 +262,14 @@ export class EngineBaseClient {
|
|
|
262
262
|
params: SignableRequestTypeToParams[T],
|
|
263
263
|
) {
|
|
264
264
|
// Use the linked signer if provided, otherwise use the default signer provided to the engine
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
// However, always use wallet signer for withdraw_collateral_v2 as linked signers are not allowed for different
|
|
266
|
+
// withdrawal addresses
|
|
267
|
+
const walletClient = (() => {
|
|
268
|
+
if (requestType === 'withdraw_collateral_v2') {
|
|
269
|
+
return this.opts.walletClient;
|
|
270
|
+
}
|
|
271
|
+
return this.opts.linkedSignerWalletClient ?? this.opts.walletClient;
|
|
272
|
+
})();
|
|
267
273
|
|
|
268
274
|
if (!walletClient) {
|
|
269
275
|
throw new WalletNotProvidedError();
|