Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions v4-client-js/src/clients/composite-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1053,14 +1053,17 @@ export class CompositeClient {
type: OrderType,
side: OrderSide,
price: number,
// trigger_price: number, // not used for MARKET and LIMIT
size: number,
clientId: number,
timeInForce: OrderTimeInForce,
goodTilTimeInSeconds: number,
execution: OrderExecution,
postOnly: boolean,
reduceOnly: boolean,
// trigger_price: number, // not used for MARKET and LIMIT
marketInfo?: MarketInfo,
currentHeight?: number,
goodTilBlock?: number,
): Promise<string> {
const msgs: Promise<EncodeObject[]> = new Promise((resolve) => {
const msg = this.placeOrderMessage(
Expand All @@ -1077,14 +1080,18 @@ export class CompositeClient {
execution,
postOnly,
reduceOnly,
undefined,
marketInfo,
currentHeight,
goodTilBlock,
);
msg
.then((it) => resolve([it]))
.catch((err) => {
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');
}
Expand Down
14 changes: 7 additions & 7 deletions v4-client-js/src/clients/lib/axios/axiosRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
async function axiosRequest(options: AxiosRequestConfig): Promise<Response> {
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;

Check failure on line 19 in v4-client-js/src/clients/lib/axios/axiosRequest.ts

View workflow job for this annotation

GitHub Actions / CI

Unexpected any. Specify a different type
if (axiosErr.response) {

Check failure on line 20 in v4-client-js/src/clients/lib/axios/axiosRequest.ts

View workflow job for this annotation

GitHub Actions / CI

Unexpected any value in conditional. An explicit comparison or type cast is required
throw new AxiosServerError(axiosErr.response, axiosErr);
}
throw new AxiosError(`Axios: ${error.message}`, error);
throw new AxiosError(`Axios: ${axiosErr.message}`, axiosErr);
}
throw error;
}
Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/src/lib/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading