diff --git a/sdk/js/src/index.ts b/sdk/js/src/index.ts index 1ab7f696..7736fdbe 100644 --- a/sdk/js/src/index.ts +++ b/sdk/js/src/index.ts @@ -379,12 +379,12 @@ export class Client { encoded_order, Order.discriminator.length ); - const remainingOutputAmount = anchor.BN.max( + const remainingOutputAmount = opportunity.order.state.expectedOutputAmount.sub( opportunity.order.state.filledOutputAmount - ), - new anchor.BN(0) - ); + ); + // new anchor.BN(0) + body = { chain_id: opportunity.chainId, version: "v1" as const, @@ -434,7 +434,7 @@ export class Client { }); if (response.error) { throw ClientError.newHttpError( - response.error.error, + response.error.toString(), response.response.status ); }