Add liquidity source breakdown to asset-swapper (#2465)

* add liquidity source breakdown to asset-swapper

* remove debug line

* use OptimizedMarketOrder metadata

* updated change-log

* prettier + lint

* bug fixes

* fixes

* Prettier

* Fix types

Co-authored-by: Jacob Evans <dekz@dekz.net>
This commit is contained in:
David Sun
2020-02-04 04:03:28 -05:00
committed by GitHub
parent 919fc66b9d
commit 74d3b9334c
6 changed files with 71 additions and 19 deletions

View File

@@ -1,6 +1,7 @@
import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
import { ERC20BridgeSource } from '../../src';
import { constants } from '../../src/constants';
import { MarketOperation, SignedOrderWithFillableAmounts, SwapQuote } from '../../src/types';
import { ProtocolFeeUtils } from '../../src/utils/protocol_fee_utils';
@@ -26,6 +27,10 @@ export async function getFullyFillableSwapQuoteWithNoFeesAsync(
protocolFeeInWeiAmount: await protocolFeeUtils.calculateWorstCaseProtocolFeeAsync(orders, gasPrice),
};
const breakdown = {
[ERC20BridgeSource.Native]: new BigNumber(1),
};
const quoteBase = {
makerAssetData,
takerAssetData,
@@ -33,6 +38,7 @@ export async function getFullyFillableSwapQuoteWithNoFeesAsync(
gasPrice,
bestCaseQuoteInfo: quoteInfo,
worstCaseQuoteInfo: quoteInfo,
sourceBreakdown: breakdown,
};
if (operation === MarketOperation.Buy) {