changes to order utils
This commit is contained in:
@@ -9,10 +9,20 @@ import {
|
||||
FeeOrdersAndRemainingFeeAmount,
|
||||
FindFeeOrdersThatCoverFeesForTargetOrdersOpts,
|
||||
FindOrdersThatCoverMakerAssetFillAmountOpts,
|
||||
FindOrdersThatCoverTakerAssetFillAmountOpts,
|
||||
OrdersAndRemainingFillAmount,
|
||||
} from './types';
|
||||
|
||||
export const marketUtils = {
|
||||
findOrdersThatCoverTakerAssetFillAmount<T extends Order>(
|
||||
orders: T[],
|
||||
takerAssetFillAmount: BigNumber,
|
||||
opts?: FindOrdersThatCoverTakerAssetFillAmountOpts,
|
||||
): OrdersAndRemainingFillAmount<T> {
|
||||
assert.doesConformToSchema('orders', orders, schemas.ordersSchema);
|
||||
assert.isValidBaseUnitAmount('takerAssetFillAmount', takerAssetFillAmount);
|
||||
|
||||
},
|
||||
/**
|
||||
* Takes an array of orders and returns a subset of those orders that has enough makerAssetAmount
|
||||
* in order to fill the input makerAssetFillAmount plus slippageBufferAmount. Iterates from first order to last order.
|
||||
|
@@ -33,6 +33,19 @@ export interface CreateOrderOpts {
|
||||
* Defaults to 0
|
||||
*/
|
||||
export interface FindOrdersThatCoverMakerAssetFillAmountOpts {
|
||||
remainingFillableMakerAssetAmounts?: BigNumber[];
|
||||
remainingFillableTakerAssetAmounts?: BigNumber[];
|
||||
slippageBufferAmount?: BigNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* remainingFillableTakerAssetAmount: An array of BigNumbers corresponding to the `orders` parameter.
|
||||
* You can use `OrderStateUtils` `@0x/order-utils` to perform blockchain lookups for these values.
|
||||
* Defaults to `makerAssetAmount` values from the orders param.
|
||||
* slippageBufferAmount: An additional amount of makerAsset to be covered by the result in case of trade collisions or partial fills.
|
||||
* Defaults to 0
|
||||
*/
|
||||
export interface FindOrdersThatCoverTakerAssetFillAmountOpts {
|
||||
remainingFillableMakerAssetAmounts?: BigNumber[];
|
||||
slippageBufferAmount?: BigNumber;
|
||||
}
|
||||
|
Reference in New Issue
Block a user