From 0fc6333bba6ebb810c5cead46ca6ee8111dc6982 Mon Sep 17 00:00:00 2001 From: Vladimir Borovik Date: Thu, 9 May 2024 20:53:12 +0300 Subject: [PATCH] feat(limit-order): validate maker/taker assets --- src/limit-order/limit-order.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/limit-order/limit-order.ts b/src/limit-order/limit-order.ts index 9f4a19b..63e8c1c 100644 --- a/src/limit-order/limit-order.ts +++ b/src/limit-order/limit-order.ts @@ -46,6 +46,17 @@ export class LimitOrder { makerTraits = new MakerTraits(0n), public readonly extension: Extension = Extension.default() ) { + assert( + !orderInfo.takerAsset.isNative(), + // eslint-disable-next-line max-len + `${orderInfo.takerAsset} can not be 'takerAsset'. Use wrapper address as 'takerAsset' and 'makerTraits.enableNativeUnwrap' to swap to NATIVE currency` + ) + + assert( + !orderInfo.makerAsset.isNative(), + 'Maker asset can not be NATIVE, use wrapper' + ) + this.makerAsset = orderInfo.makerAsset this.takerAsset = orderInfo.takerAsset this.makingAmount = orderInfo.makingAmount