fix: [asset-swapper] prevent error when multihop data is not present (#80)
* fix: [asset-swapper] prevent error when multihop is not present for a route * Update changelog Co-authored-by: Michael Zhu <mchl.zhu.96@gmail.com>
This commit is contained in:
parent
e544a804c2
commit
d6bc0a3368
@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "5.8.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Fix error when Multihop data is not present",
|
||||
"pr": 80
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1611648096,
|
||||
"version": "5.8.1",
|
||||
|
@ -204,12 +204,15 @@ export class MarketOperationUtils {
|
||||
: Promise.resolve([]);
|
||||
|
||||
const [
|
||||
[tokenDecimals, orderFillableAmounts, ethToMakerAssetRate, ethToTakerAssetRate, dexQuotes, twoHopQuotes],
|
||||
[tokenDecimals, orderFillableAmounts, ethToMakerAssetRate, ethToTakerAssetRate, dexQuotes, rawTwoHopQuotes],
|
||||
rfqtIndicativeQuotes,
|
||||
offChainBalancerQuotes,
|
||||
offChainCreamQuotes,
|
||||
] = await Promise.all([samplerPromise, rfqtPromise, offChainBalancerPromise, offChainCreamPromise]);
|
||||
|
||||
// Filter out any invalid two hop quotes where we couldn't find a route
|
||||
const twoHopQuotes = rawTwoHopQuotes.filter(q => q && q.fillData && q.fillData.firstHopSource);
|
||||
|
||||
const [makerTokenDecimals, takerTokenDecimals] = tokenDecimals;
|
||||
return {
|
||||
side: MarketOperation.Sell,
|
||||
@ -321,11 +324,15 @@ export class MarketOperationUtils {
|
||||
: Promise.resolve([]);
|
||||
|
||||
const [
|
||||
[tokenDecimals, orderFillableAmounts, ethToMakerAssetRate, ethToTakerAssetRate, dexQuotes, twoHopQuotes],
|
||||
[tokenDecimals, orderFillableAmounts, ethToMakerAssetRate, ethToTakerAssetRate, dexQuotes, rawTwoHopQuotes],
|
||||
rfqtIndicativeQuotes,
|
||||
offChainBalancerQuotes,
|
||||
offChainCreamQuotes,
|
||||
] = await Promise.all([samplerPromise, rfqtPromise, offChainBalancerPromise, offChainCreamPromise]);
|
||||
|
||||
// Filter out any invalid two hop quotes where we couldn't find a route
|
||||
const twoHopQuotes = rawTwoHopQuotes.filter(q => q && q.fillData && q.fillData.firstHopSource);
|
||||
|
||||
const [makerTokenDecimals, takerTokenDecimals] = tokenDecimals;
|
||||
return {
|
||||
side: MarketOperation.Buy,
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { SignedOrder } from '@0x/types';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { MarketOperation } from '../types';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user