diff --git a/packages/asset-swapper/src/utils/market_operation_utils/orders.ts b/packages/asset-swapper/src/utils/market_operation_utils/orders.ts index 30c2f16d8c..018055f5fc 100644 --- a/packages/asset-swapper/src/utils/market_operation_utils/orders.ts +++ b/packages/asset-swapper/src/utils/market_operation_utils/orders.ts @@ -169,7 +169,8 @@ export function createOrdersFromPath(path: Fill[], opts: CreateOrderFromPathOpts } contiguousBridgeFills.push(collapsedPath[j]); } - if (contiguousBridgeFills.length === 1 || !opts.shouldBatchBridgeOrders) { + // Always use DexForwarderBridge unless configured not to + if (!opts.shouldBatchBridgeOrders) { orders.push(createBridgeOrder(contiguousBridgeFills[0], opts)); i += 1; } else { diff --git a/packages/asset-swapper/test/market_operation_utils_test.ts b/packages/asset-swapper/test/market_operation_utils_test.ts index 05635af16c..1809363c24 100644 --- a/packages/asset-swapper/test/market_operation_utils_test.ts +++ b/packages/asset-swapper/test/market_operation_utils_test.ts @@ -69,7 +69,11 @@ describe('MarketOperationUtils tests', () => { if (assetData.length === 74) { return ERC20BridgeSource.Native; } - const bridgeAddress = hexUtils.slice(assetData, 48, 68).toLowerCase(); + const bridgeData = assetDataUtils.decodeAssetDataOrThrow(assetData); + if (!assetDataUtils.isERC20BridgeAssetData(bridgeData)) { + throw new Error('AssetData is not ERC20BridgeAssetData'); + } + const { bridgeAddress } = bridgeData; switch (bridgeAddress) { case KYBER_BRIDGE_ADDRESS.toLowerCase(): return ERC20BridgeSource.Kyber;