Merge pull request #2583 from 0xProject/feat/estimated-gas-token-refund
Expose fills object in asset-swapper quote orders
This commit is contained in:
commit
b23f1eb145
@ -90,7 +90,7 @@ class LibDummy:
|
|||||||
try:
|
try:
|
||||||
for middleware in MIDDLEWARE:
|
for middleware in MIDDLEWARE:
|
||||||
web3.middleware_onion.inject(
|
web3.middleware_onion.inject(
|
||||||
middleware["function"], layer=middleware["layer"],
|
middleware["function"], layer=middleware["layer"]
|
||||||
)
|
)
|
||||||
except ValueError as value_error:
|
except ValueError as value_error:
|
||||||
if value_error.args == (
|
if value_error.args == (
|
||||||
|
@ -69,6 +69,10 @@
|
|||||||
{
|
{
|
||||||
"note": "Remove Kyber exclusion when Uniswap/Eth2Dai is present",
|
"note": "Remove Kyber exclusion when Uniswap/Eth2Dai is present",
|
||||||
"pr": 2575
|
"pr": 2575
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Expose fills object in asset-swapper quote orders",
|
||||||
|
"pr": 2583
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -2,7 +2,7 @@ import { ContractAddresses } from '@0x/contract-wrappers';
|
|||||||
import { SignedOrder } from '@0x/types';
|
import { SignedOrder } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
|
|
||||||
import { GetMarketOrdersOpts } from './utils/market_operation_utils/types';
|
import { GetMarketOrdersOpts, OptimizedMarketOrder } from './utils/market_operation_utils/types';
|
||||||
import { LogFunction } from './utils/quote_requestor';
|
import { LogFunction } from './utils/quote_requestor';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,7 +132,7 @@ export interface GetExtensionContractTypeOpts {
|
|||||||
* takerAssetData: String that represents a specific taker asset (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
|
* takerAssetData: String that represents a specific taker asset (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
|
||||||
* makerAssetData: String that represents a specific maker asset (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
|
* makerAssetData: String that represents a specific maker asset (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
|
||||||
* gasPrice: gas price used to determine protocolFee amount, default to ethGasStation fast amount.
|
* gasPrice: gas price used to determine protocolFee amount, default to ethGasStation fast amount.
|
||||||
* orders: An array of objects conforming to SignedOrder. These orders can be used to cover the requested assetBuyAmount plus slippage.
|
* orders: An array of objects conforming to OptimizedMarketOrder. These orders can be used to cover the requested assetBuyAmount plus slippage.
|
||||||
* bestCaseQuoteInfo: Info about the best case price for the asset.
|
* bestCaseQuoteInfo: Info about the best case price for the asset.
|
||||||
* worstCaseQuoteInfo: Info about the worst case price for the asset.
|
* worstCaseQuoteInfo: Info about the worst case price for the asset.
|
||||||
*/
|
*/
|
||||||
@ -140,7 +140,7 @@ export interface SwapQuoteBase {
|
|||||||
takerAssetData: string;
|
takerAssetData: string;
|
||||||
makerAssetData: string;
|
makerAssetData: string;
|
||||||
gasPrice: BigNumber;
|
gasPrice: BigNumber;
|
||||||
orders: SignedOrder[];
|
orders: OptimizedMarketOrder[];
|
||||||
bestCaseQuoteInfo: SwapQuoteInfo;
|
bestCaseQuoteInfo: SwapQuoteInfo;
|
||||||
worstCaseQuoteInfo: SwapQuoteInfo;
|
worstCaseQuoteInfo: SwapQuoteInfo;
|
||||||
sourceBreakdown: SwapQuoteOrdersBreakdown;
|
sourceBreakdown: SwapQuoteOrdersBreakdown;
|
||||||
|
@ -8,7 +8,6 @@ import {
|
|||||||
MarketBuySwapQuote,
|
MarketBuySwapQuote,
|
||||||
MarketOperation,
|
MarketOperation,
|
||||||
MarketSellSwapQuote,
|
MarketSellSwapQuote,
|
||||||
SignedOrderWithFillableAmounts,
|
|
||||||
SwapQuote,
|
SwapQuote,
|
||||||
SwapQuoteBase,
|
SwapQuoteBase,
|
||||||
SwapQuoteInfo,
|
SwapQuoteInfo,
|
||||||
@ -200,8 +199,7 @@ function createSwapQuote(
|
|||||||
bestCaseQuoteInfo: fillResultsToQuoteInfo(bestCaseFillResult),
|
bestCaseQuoteInfo: fillResultsToQuoteInfo(bestCaseFillResult),
|
||||||
worstCaseQuoteInfo: fillResultsToQuoteInfo(worstCaseFillResult),
|
worstCaseQuoteInfo: fillResultsToQuoteInfo(worstCaseFillResult),
|
||||||
sourceBreakdown: getSwapQuoteOrdersBreakdown(bestCaseFillResult.fillAmountBySource),
|
sourceBreakdown: getSwapQuoteOrdersBreakdown(bestCaseFillResult.fillAmountBySource),
|
||||||
// Remove fill metadata.
|
orders: resultOrders,
|
||||||
orders: resultOrders.map(o => _.omit(o, 'fills')) as SignedOrderWithFillableAmounts[],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (operation === MarketOperation.Buy) {
|
if (operation === MarketOperation.Buy) {
|
||||||
|
@ -34,7 +34,7 @@ export async function getFullyFillableSwapQuoteWithNoFeesAsync(
|
|||||||
const quoteBase = {
|
const quoteBase = {
|
||||||
makerAssetData,
|
makerAssetData,
|
||||||
takerAssetData,
|
takerAssetData,
|
||||||
orders,
|
orders: orders.map(order => ({ ...order, fills: [] })),
|
||||||
gasPrice,
|
gasPrice,
|
||||||
bestCaseQuoteInfo: quoteInfo,
|
bestCaseQuoteInfo: quoteInfo,
|
||||||
worstCaseQuoteInfo: quoteInfo,
|
worstCaseQuoteInfo: quoteInfo,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user