aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-08-21 23:37:03 +0800
committerFabio Berger <me@fabioberger.com>2018-08-21 23:37:03 +0800
commit7553411fb2c0483e08046a85cc3b694e2063cbfd (patch)
treecc8151247ae1933340dcffbcc8aaa47ba0b4b512
parentc52c94214f9eb9ba25edc5e4599048663cd9cfa1 (diff)
downloaddexon-0x-contracts-7553411fb2c0483e08046a85cc3b694e2063cbfd.tar.gz
dexon-0x-contracts-7553411fb2c0483e08046a85cc3b694e2063cbfd.tar.zst
dexon-0x-contracts-7553411fb2c0483e08046a85cc3b694e2063cbfd.zip
Fix up order-utils
-rw-r--r--packages/order-utils/src/index.ts14
-rw-r--r--packages/order-utils/src/market_utils.ts11
-rw-r--r--packages/order-utils/src/types.ts10
3 files changed, 30 insertions, 5 deletions
diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts
index 1f393b0c4..354299304 100644
--- a/packages/order-utils/src/index.ts
+++ b/packages/order-utils/src/index.ts
@@ -9,14 +9,16 @@ export { sortingUtils } from './sorting_utils';
export { OrderStateUtils } from './order_state_utils';
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 { AbstractOrderFilledCancelledLazyStore } from './abstract/abstract_order_filled_cancelled_lazy_store';
export { OrderValidationUtils } from './order_validation_utils';
export { ExchangeTransferSimulator } from './exchange_transfer_simulator';
export { BalanceAndProxyAllowanceLazyStore } from './store/balance_and_proxy_allowance_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 {
SignedOrder,
Order,
@@ -26,13 +28,21 @@ export {
ERC20AssetData,
ERC721AssetData,
AssetProxyId,
+ SignerType,
+ SignatureType,
+ OrderStateValid,
+ OrderStateInvalid,
+ ExchangeContractErrs,
} from '@0xproject/types';
export {
- CreateOrderOpts,
OrderError,
EIP712Parameter,
EIP712Schema,
EIP712Types,
TradeSide,
TransferType,
+ FindFeeOrdersThatCoverFeesForTargetOrdersOpts,
+ FindOrdersThatCoverMakerAssetFillAmountOpts,
+ FeeOrdersAndRemainingFeeAmount,
+ OrdersAndRemainingFillAmount,
} from './types';
diff --git a/packages/order-utils/src/market_utils.ts b/packages/order-utils/src/market_utils.ts
index a0a827546..b3f302dd2 100644
--- a/packages/order-utils/src/market_utils.ts
+++ b/packages/order-utils/src/market_utils.ts
@@ -5,7 +5,12 @@ import * as _ from 'lodash';
import { assert } from './assert';
import { constants } from './constants';
-import { FindFeeOrdersThatCoverFeesForTargetOrdersOpts, FindOrdersThatCoverMakerAssetFillAmountOpts } from './types';
+import {
+ FindFeeOrdersThatCoverFeesForTargetOrdersOpts,
+ FindOrdersThatCoverMakerAssetFillAmountOpts,
+ FeeOrdersAndRemainingFeeAmount,
+ OrdersAndRemainingFillAmount,
+} from './types';
export const marketUtils = {
/**
@@ -22,7 +27,7 @@ export const marketUtils = {
orders: T[],
makerAssetFillAmount: BigNumber,
opts?: FindOrdersThatCoverMakerAssetFillAmountOpts,
- ): { resultOrders: T[]; remainingFillAmount: BigNumber } {
+ ): OrdersAndRemainingFillAmount<T> {
assert.doesConformToSchema('orders', orders, schemas.ordersSchema);
assert.isValidBaseUnitAmount('makerAssetFillAmount', makerAssetFillAmount);
// 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[],
feeOrders: T[],
opts?: FindFeeOrdersThatCoverFeesForTargetOrdersOpts,
- ): { resultOrders: T[]; remainingFeeAmount: BigNumber } {
+ ): FeeOrdersAndRemainingFeeAmount<T> {
assert.doesConformToSchema('orders', orders, schemas.ordersSchema);
assert.doesConformToSchema('feeOrders', feeOrders, schemas.ordersSchema);
// try to get remainingFillableMakerAssetAmounts from opts, if it's not there, use makerAssetAmount values from orders
diff --git a/packages/order-utils/src/types.ts b/packages/order-utils/src/types.ts
index 2e9c79d80..4088805dc 100644
--- a/packages/order-utils/src/types.ts
+++ b/packages/order-utils/src/types.ts
@@ -69,3 +69,13 @@ export interface FindFeeOrdersThatCoverFeesForTargetOrdersOpts {
remainingFillableFeeAmounts?: BigNumber[];
slippageBufferAmount?: BigNumber;
}
+
+export interface FeeOrdersAndRemainingFeeAmount<T> {
+ resultOrders: T[];
+ remainingFeeAmount: BigNumber;
+}
+
+export interface OrdersAndRemainingFillAmount<T> {
+ resultOrders: T[];
+ remainingFillAmount: BigNumber;
+}