From 3e6545c4338bdb66cf550f20676aab2ac8151ebd Mon Sep 17 00:00:00 2001 From: Tommy Johnson <32071703+tomjohn1028@users.noreply.github.com> Date: Tue, 21 Sep 2021 23:49:58 -0400 Subject: [PATCH] fix cancelOrder for proxies (#171) --- packages/serum/src/market-proxy/index.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/serum/src/market-proxy/index.ts b/packages/serum/src/market-proxy/index.ts index 9b003d88..355fb8af 100644 --- a/packages/serum/src/market-proxy/index.ts +++ b/packages/serum/src/market-proxy/index.ts @@ -120,12 +120,18 @@ export class MarketProxyInstruction { } public cancelOrder(owner: PublicKey, order: Order): TransactionInstruction { - const ix = this._market.makeCancelOrderInstruction( - // @ts-ignore - null, // Not used by the function. + const ix = DexInstructions.cancelOrderV2({ + market: this._market.address, owner, - order, - ); + openOrders: order.openOrdersAddress, + bids: this._market.decoded.bids, + asks: this._market.decoded.asks, + eventQueue: this._market.decoded.eventQueue, + side: order.side, + orderId: order.orderId, + openOrdersSlot: order.openOrdersSlot, + programId: this._proxyProgramId, + }) this._middlewares.forEach((mw) => mw.cancelOrderV2(ix)); return this.proxy(ix); }