Fix up order-utils
This commit is contained in:
parent
c52c94214f
commit
7553411fb2
@ -9,14 +9,16 @@ export { sortingUtils } from './sorting_utils';
|
|||||||
|
|
||||||
export { OrderStateUtils } from './order_state_utils';
|
export { OrderStateUtils } from './order_state_utils';
|
||||||
export { AbstractBalanceAndProxyAllowanceFetcher } from './abstract/abstract_balance_and_proxy_allowance_fetcher';
|
export { AbstractBalanceAndProxyAllowanceFetcher } from './abstract/abstract_balance_and_proxy_allowance_fetcher';
|
||||||
|
export { AbstractBalanceAndProxyAllowanceLazyStore } from './abstract/abstract_balance_and_proxy_allowance_lazy_store';
|
||||||
export { AbstractOrderFilledCancelledFetcher } from './abstract/abstract_order_filled_cancelled_fetcher';
|
export { AbstractOrderFilledCancelledFetcher } from './abstract/abstract_order_filled_cancelled_fetcher';
|
||||||
|
export { AbstractOrderFilledCancelledLazyStore } from './abstract/abstract_order_filled_cancelled_lazy_store';
|
||||||
|
|
||||||
export { OrderValidationUtils } from './order_validation_utils';
|
export { OrderValidationUtils } from './order_validation_utils';
|
||||||
export { ExchangeTransferSimulator } from './exchange_transfer_simulator';
|
export { ExchangeTransferSimulator } from './exchange_transfer_simulator';
|
||||||
export { BalanceAndProxyAllowanceLazyStore } from './store/balance_and_proxy_allowance_lazy_store';
|
export { BalanceAndProxyAllowanceLazyStore } from './store/balance_and_proxy_allowance_lazy_store';
|
||||||
export { OrderFilledCancelledLazyStore } from './store/order_filled_cancelled_lazy_store';
|
export { OrderFilledCancelledLazyStore } from './store/order_filled_cancelled_lazy_store';
|
||||||
|
|
||||||
export { Provider } from 'ethereum-types';
|
export { Provider, JSONRPCRequestPayload, JSONRPCErrorCallback, JSONRPCResponsePayload } from 'ethereum-types';
|
||||||
export {
|
export {
|
||||||
SignedOrder,
|
SignedOrder,
|
||||||
Order,
|
Order,
|
||||||
@ -26,13 +28,21 @@ export {
|
|||||||
ERC20AssetData,
|
ERC20AssetData,
|
||||||
ERC721AssetData,
|
ERC721AssetData,
|
||||||
AssetProxyId,
|
AssetProxyId,
|
||||||
|
SignerType,
|
||||||
|
SignatureType,
|
||||||
|
OrderStateValid,
|
||||||
|
OrderStateInvalid,
|
||||||
|
ExchangeContractErrs,
|
||||||
} from '@0xproject/types';
|
} from '@0xproject/types';
|
||||||
export {
|
export {
|
||||||
CreateOrderOpts,
|
|
||||||
OrderError,
|
OrderError,
|
||||||
EIP712Parameter,
|
EIP712Parameter,
|
||||||
EIP712Schema,
|
EIP712Schema,
|
||||||
EIP712Types,
|
EIP712Types,
|
||||||
TradeSide,
|
TradeSide,
|
||||||
TransferType,
|
TransferType,
|
||||||
|
FindFeeOrdersThatCoverFeesForTargetOrdersOpts,
|
||||||
|
FindOrdersThatCoverMakerAssetFillAmountOpts,
|
||||||
|
FeeOrdersAndRemainingFeeAmount,
|
||||||
|
OrdersAndRemainingFillAmount,
|
||||||
} from './types';
|
} from './types';
|
||||||
|
@ -5,7 +5,12 @@ import * as _ from 'lodash';
|
|||||||
|
|
||||||
import { assert } from './assert';
|
import { assert } from './assert';
|
||||||
import { constants } from './constants';
|
import { constants } from './constants';
|
||||||
import { FindFeeOrdersThatCoverFeesForTargetOrdersOpts, FindOrdersThatCoverMakerAssetFillAmountOpts } from './types';
|
import {
|
||||||
|
FindFeeOrdersThatCoverFeesForTargetOrdersOpts,
|
||||||
|
FindOrdersThatCoverMakerAssetFillAmountOpts,
|
||||||
|
FeeOrdersAndRemainingFeeAmount,
|
||||||
|
OrdersAndRemainingFillAmount,
|
||||||
|
} from './types';
|
||||||
|
|
||||||
export const marketUtils = {
|
export const marketUtils = {
|
||||||
/**
|
/**
|
||||||
@ -22,7 +27,7 @@ export const marketUtils = {
|
|||||||
orders: T[],
|
orders: T[],
|
||||||
makerAssetFillAmount: BigNumber,
|
makerAssetFillAmount: BigNumber,
|
||||||
opts?: FindOrdersThatCoverMakerAssetFillAmountOpts,
|
opts?: FindOrdersThatCoverMakerAssetFillAmountOpts,
|
||||||
): { resultOrders: T[]; remainingFillAmount: BigNumber } {
|
): OrdersAndRemainingFillAmount<T> {
|
||||||
assert.doesConformToSchema('orders', orders, schemas.ordersSchema);
|
assert.doesConformToSchema('orders', orders, schemas.ordersSchema);
|
||||||
assert.isValidBaseUnitAmount('makerAssetFillAmount', makerAssetFillAmount);
|
assert.isValidBaseUnitAmount('makerAssetFillAmount', makerAssetFillAmount);
|
||||||
// try to get remainingFillableMakerAssetAmounts from opts, if it's not there, use makerAssetAmount values from orders
|
// try to get remainingFillableMakerAssetAmounts from opts, if it's not there, use makerAssetAmount values from orders
|
||||||
@ -84,7 +89,7 @@ export const marketUtils = {
|
|||||||
orders: T[],
|
orders: T[],
|
||||||
feeOrders: T[],
|
feeOrders: T[],
|
||||||
opts?: FindFeeOrdersThatCoverFeesForTargetOrdersOpts,
|
opts?: FindFeeOrdersThatCoverFeesForTargetOrdersOpts,
|
||||||
): { resultOrders: T[]; remainingFeeAmount: BigNumber } {
|
): FeeOrdersAndRemainingFeeAmount<T> {
|
||||||
assert.doesConformToSchema('orders', orders, schemas.ordersSchema);
|
assert.doesConformToSchema('orders', orders, schemas.ordersSchema);
|
||||||
assert.doesConformToSchema('feeOrders', feeOrders, schemas.ordersSchema);
|
assert.doesConformToSchema('feeOrders', feeOrders, schemas.ordersSchema);
|
||||||
// try to get remainingFillableMakerAssetAmounts from opts, if it's not there, use makerAssetAmount values from orders
|
// try to get remainingFillableMakerAssetAmounts from opts, if it's not there, use makerAssetAmount values from orders
|
||||||
|
@ -69,3 +69,13 @@ export interface FindFeeOrdersThatCoverFeesForTargetOrdersOpts {
|
|||||||
remainingFillableFeeAmounts?: BigNumber[];
|
remainingFillableFeeAmounts?: BigNumber[];
|
||||||
slippageBufferAmount?: BigNumber;
|
slippageBufferAmount?: BigNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface FeeOrdersAndRemainingFeeAmount<T> {
|
||||||
|
resultOrders: T[];
|
||||||
|
remainingFeeAmount: BigNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OrdersAndRemainingFillAmount<T> {
|
||||||
|
resultOrders: T[];
|
||||||
|
remainingFillAmount: BigNumber;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user