From 61b2232336f805550de501c26c0c4654926e3dbd Mon Sep 17 00:00:00 2001 From: Matthew Weeks Date: Fri, 25 Jul 2025 14:14:11 -0400 Subject: [PATCH 1/3] fix(composite-client): use of undefined variable --- v4-client-js/src/clients/composite-client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v4-client-js/src/clients/composite-client.ts b/v4-client-js/src/clients/composite-client.ts index 3ec84c76..cf9a4037 100644 --- a/v4-client-js/src/clients/composite-client.ts +++ b/v4-client-js/src/clients/composite-client.ts @@ -1084,7 +1084,7 @@ export class CompositeClient { console.log(err); }); }); - const signature = await this.sign(wallet, () => msgs, true); + const signature = await this.sign(subaccount.wallet, () => msgs, true); return Buffer.from(signature).toString('base64'); } From 05b42a162c087e017b3976d85d27df45c3c32596 Mon Sep 17 00:00:00 2001 From: Matthew Weeks Date: Fri, 25 Jul 2025 14:28:00 -0400 Subject: [PATCH 2/3] fix(composite-client): align signPlaceOrder API with placeOrder placeOrder exposes parameters for marketInfo and blockHeight, to avoid querying indexer and validator add parameters to signPlaceOrder to permit avoiding these queries if the information is available --- v4-client-js/src/clients/composite-client.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/v4-client-js/src/clients/composite-client.ts b/v4-client-js/src/clients/composite-client.ts index cf9a4037..25425e34 100644 --- a/v4-client-js/src/clients/composite-client.ts +++ b/v4-client-js/src/clients/composite-client.ts @@ -1053,7 +1053,6 @@ export class CompositeClient { type: OrderType, side: OrderSide, price: number, - // trigger_price: number, // not used for MARKET and LIMIT size: number, clientId: number, timeInForce: OrderTimeInForce, @@ -1061,6 +1060,10 @@ export class CompositeClient { execution: OrderExecution, postOnly: boolean, reduceOnly: boolean, + // trigger_price: number, // not used for MARKET and LIMIT + marketInfo?: MarketInfo, + currentHeight?: number, + goodTilBlock?: number, ): Promise { const msgs: Promise = new Promise((resolve) => { const msg = this.placeOrderMessage( @@ -1077,6 +1080,10 @@ export class CompositeClient { execution, postOnly, reduceOnly, + undefined, + marketInfo, + currentHeight, + goodTilBlock, ); msg .then((it) => resolve([it])) From 7f8bbb30ae3931337e9b87df3cb97a7a2cda22c2 Mon Sep 17 00:00:00 2001 From: Matthew Weeks Date: Fri, 25 Jul 2025 17:01:17 -0400 Subject: [PATCH 3/3] fix(axiosRequest): cast error and check properties --- v4-client-js/src/clients/lib/axios/axiosRequest.ts | 14 +++++++------- v4-client-js/src/lib/validation.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/v4-client-js/src/clients/lib/axios/axiosRequest.ts b/v4-client-js/src/clients/lib/axios/axiosRequest.ts index 51113740..4f8ced05 100644 --- a/v4-client-js/src/clients/lib/axios/axiosRequest.ts +++ b/v4-client-js/src/clients/lib/axios/axiosRequest.ts @@ -13,14 +13,14 @@ export interface Response { async function axiosRequest(options: AxiosRequestConfig): Promise { try { return await axios(options); - } catch (error) { - // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions - if (error.isAxiosError) { - // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions - if (error.response) { - throw new AxiosServerError(error.response, error); + } catch (error: unknown) { + if (typeof error === 'object' && error !== null && 'isAxiosError' in error) { + // @eslint-disable-next-line @typescript-eslint/no-explicit-any + const axiosErr = error as any; + if (axiosErr.response) { + throw new AxiosServerError(axiosErr.response, axiosErr); } - throw new AxiosError(`Axios: ${error.message}`, error); + throw new AxiosError(`Axios: ${axiosErr.message}`, axiosErr); } throw error; } diff --git a/v4-client-js/src/lib/validation.ts b/v4-client-js/src/lib/validation.ts index 55480ff9..ea9c8452 100644 --- a/v4-client-js/src/lib/validation.ts +++ b/v4-client-js/src/lib/validation.ts @@ -185,7 +185,7 @@ function verifyIsBech32(address: string): Error | undefined { try { decode(address); } catch (error) { - return error; + return error instanceof Error ? error : new Error(String(error)); } return undefined;