diff options
Diffstat (limited to 'packages/0x.js/src')
-rw-r--r-- | packages/0x.js/src/0x.ts | 4 | ||||
-rw-r--r-- | packages/0x.js/src/contract_wrappers/exchange_wrapper.ts | 12 | ||||
-rw-r--r-- | packages/0x.js/src/index.ts | 6 | ||||
-rw-r--r-- | packages/0x.js/src/order_watcher/order_state_watcher.ts | 3 | ||||
-rw-r--r-- | packages/0x.js/src/order_watcher/remaining_fillable_calculator.ts | 3 | ||||
-rw-r--r-- | packages/0x.js/src/types.ts | 37 | ||||
-rw-r--r-- | packages/0x.js/src/utils/assert.ts | 2 | ||||
-rw-r--r-- | packages/0x.js/src/utils/order_state_utils.ts | 10 | ||||
-rw-r--r-- | packages/0x.js/src/utils/order_validation_utils.ts | 3 | ||||
-rw-r--r-- | packages/0x.js/src/utils/signature_utils.ts | 3 | ||||
-rw-r--r-- | packages/0x.js/src/utils/utils.ts | 4 |
11 files changed, 30 insertions, 57 deletions
diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts index 22a5fee10..09da4b046 100644 --- a/packages/0x.js/src/0x.ts +++ b/packages/0x.js/src/0x.ts @@ -1,5 +1,5 @@ import { schemas, SchemaValidator } from '@0xproject/json-schemas'; -import { TransactionReceiptWithDecodedLogs } from '@0xproject/types'; +import { ECSignature, Order, SignedOrder, TransactionReceiptWithDecodedLogs } from '@0xproject/types'; import { AbiDecoder, BigNumber, intervalUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as ethUtil from 'ethereumjs-util'; @@ -15,7 +15,7 @@ import { OrderStateWatcher } from './order_watcher/order_state_watcher'; import { zeroExConfigSchema } from './schemas/zero_ex_config_schema'; import { zeroExPrivateNetworkConfigSchema } from './schemas/zero_ex_private_network_config_schema'; import { zeroExPublicNetworkConfigSchema } from './schemas/zero_ex_public_network_config_schema'; -import { ECSignature, Order, SignedOrder, Web3Provider, ZeroExConfig, ZeroExError } from './types'; +import { Web3Provider, ZeroExConfig, ZeroExError } from './types'; import { assert } from './utils/assert'; import { constants } from './utils/constants'; import { decorators } from './utils/decorators'; diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts index 20b46c6bc..6414985e6 100644 --- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts @@ -1,5 +1,12 @@ import { schemas } from '@0xproject/json-schemas'; -import { BlockParamLiteral, DecodedLogArgs, LogWithDecodedArgs } from '@0xproject/types'; +import { + BlockParamLiteral, + DecodedLogArgs, + ECSignature, + LogWithDecodedArgs, + Order, + SignedOrder, +} from '@0xproject/types'; import { AbiDecoder, BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; @@ -8,19 +15,16 @@ import * as Web3 from 'web3'; import { artifacts } from '../artifacts'; import { BlockRange, - ECSignature, EventCallback, ExchangeContractErrCodes, ExchangeContractErrs, IndexedFilterValues, MethodOpts, - Order, OrderAddresses, OrderCancellationRequest, OrderFillRequest, OrderTransactionOpts, OrderValues, - SignedOrder, ValidateOrderFillableOpts, } from '../types'; import { assert } from '../utils/assert'; diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 9879bbb56..7885fb82a 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -1,9 +1,6 @@ export { ZeroEx } from './0x'; export { - Order, - SignedOrder, - ECSignature, ZeroExError, EventCallback, ExchangeContractErrs, @@ -34,6 +31,9 @@ export { BlockParam, ContractEventArg, LogWithDecodedArgs, + Order, + SignedOrder, + ECSignature, TransactionReceipt, TransactionReceiptWithDecodedLogs, } from '@0xproject/types'; diff --git a/packages/0x.js/src/order_watcher/order_state_watcher.ts b/packages/0x.js/src/order_watcher/order_state_watcher.ts index e489dd5cc..f7515e59e 100644 --- a/packages/0x.js/src/order_watcher/order_state_watcher.ts +++ b/packages/0x.js/src/order_watcher/order_state_watcher.ts @@ -1,5 +1,5 @@ import { schemas } from '@0xproject/json-schemas'; -import { BlockParamLiteral, LogWithDecodedArgs } from '@0xproject/types'; +import { BlockParamLiteral, LogWithDecodedArgs, SignedOrder } from '@0xproject/types'; import { AbiDecoder, intervalUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; @@ -31,7 +31,6 @@ import { OnOrderStateChangeCallback, OrderState, OrderStateWatcherConfig, - SignedOrder, ZeroExError, } from '../types'; import { assert } from '../utils/assert'; diff --git a/packages/0x.js/src/order_watcher/remaining_fillable_calculator.ts b/packages/0x.js/src/order_watcher/remaining_fillable_calculator.ts index 20b09d606..184c13aa4 100644 --- a/packages/0x.js/src/order_watcher/remaining_fillable_calculator.ts +++ b/packages/0x.js/src/order_watcher/remaining_fillable_calculator.ts @@ -1,7 +1,6 @@ +import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; -import { SignedOrder } from '../types'; - export class RemainingFillableCalculator { private _signedOrder: SignedOrder; private _isMakerTokenZRX: boolean; diff --git a/packages/0x.js/src/types.ts b/packages/0x.js/src/types.ts index 2f17e30c2..65342b694 100644 --- a/packages/0x.js/src/types.ts +++ b/packages/0x.js/src/types.ts @@ -1,6 +1,13 @@ import { BigNumber } from '@0xproject/utils'; -import { BlockParam, BlockParamLiteral, ContractEventArg, LogWithDecodedArgs } from '@0xproject/types'; +import { + BlockParam, + BlockParamLiteral, + ContractEventArg, + LogWithDecodedArgs, + Order, + SignedOrder, +} from '@0xproject/types'; import * as Web3 from 'web3'; @@ -37,15 +44,6 @@ export enum InternalZeroExError { WethNotInTokenRegistry = 'WETH_NOT_IN_TOKEN_REGISTRY', } -/** - * Elliptic Curve signature - */ -export interface ECSignature { - v: number; - r: string; - s: string; -} - export type OrderAddresses = [string, string, string, string, string]; export type OrderValues = [BigNumber, BigNumber, BigNumber, BigNumber, BigNumber, BigNumber]; @@ -107,25 +105,6 @@ export interface ContractEvent { export type ContractEventArgs = ExchangeContractEventArgs | TokenContractEventArgs | EtherTokenContractEventArgs; -export interface Order { - maker: string; - taker: string; - makerFee: BigNumber; - takerFee: BigNumber; - makerTokenAmount: BigNumber; - takerTokenAmount: BigNumber; - makerTokenAddress: string; - takerTokenAddress: string; - salt: BigNumber; - exchangeContractAddress: string; - feeRecipient: string; - expirationUnixTimestampSec: BigNumber; -} - -export interface SignedOrder extends Order { - ecSignature: ECSignature; -} - // [address, name, symbol, decimals, ipfsHash, swarmHash] export type TokenMetadata = [string, string, string, number, string, string]; diff --git a/packages/0x.js/src/utils/assert.ts b/packages/0x.js/src/utils/assert.ts index c21f2dbca..5e8004cd0 100644 --- a/packages/0x.js/src/utils/assert.ts +++ b/packages/0x.js/src/utils/assert.ts @@ -3,11 +3,11 @@ import { assert as sharedAssert } from '@0xproject/assert'; // tslint:disable-next-line:no-unused-variable import { Schema } from '@0xproject/json-schemas'; // tslint:disable-next-line:no-unused-variable +import { ECSignature } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; -import { ECSignature } from '../types'; import { signatureUtils } from '../utils/signature_utils'; export const assert = { diff --git a/packages/0x.js/src/utils/order_state_utils.ts b/packages/0x.js/src/utils/order_state_utils.ts index b7a55ff42..38189443b 100644 --- a/packages/0x.js/src/utils/order_state_utils.ts +++ b/packages/0x.js/src/utils/order_state_utils.ts @@ -1,3 +1,4 @@ +import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; @@ -6,14 +7,7 @@ import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper'; import { RemainingFillableCalculator } from '../order_watcher/remaining_fillable_calculator'; import { BalanceAndProxyAllowanceLazyStore } from '../stores/balance_proxy_allowance_lazy_store'; import { OrderFilledCancelledLazyStore } from '../stores/order_filled_cancelled_lazy_store'; -import { - ExchangeContractErrs, - OrderRelevantState, - OrderState, - OrderStateInvalid, - OrderStateValid, - SignedOrder, -} from '../types'; +import { ExchangeContractErrs, OrderRelevantState, OrderState, OrderStateInvalid, OrderStateValid } from '../types'; const ACCEPTABLE_RELATIVE_ROUNDING_ERROR = 0.0001; diff --git a/packages/0x.js/src/utils/order_validation_utils.ts b/packages/0x.js/src/utils/order_validation_utils.ts index 917d414c8..f32bf43d0 100644 --- a/packages/0x.js/src/utils/order_validation_utils.ts +++ b/packages/0x.js/src/utils/order_validation_utils.ts @@ -1,9 +1,10 @@ +import { Order, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { ZeroEx } from '../0x'; import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper'; -import { ExchangeContractErrs, Order, SignedOrder, TradeSide, TransferType, ZeroExError } from '../types'; +import { ExchangeContractErrs, TradeSide, TransferType, ZeroExError } from '../types'; import { constants } from '../utils/constants'; import { utils } from '../utils/utils'; diff --git a/packages/0x.js/src/utils/signature_utils.ts b/packages/0x.js/src/utils/signature_utils.ts index b0f1d61ef..46f167339 100644 --- a/packages/0x.js/src/utils/signature_utils.ts +++ b/packages/0x.js/src/utils/signature_utils.ts @@ -1,7 +1,6 @@ +import { ECSignature } from '@0xproject/types'; import * as ethUtil from 'ethereumjs-util'; -import { ECSignature } from '../types'; - export const signatureUtils = { isValidSignature(data: string, signature: ECSignature, signerAddress: string): boolean { const dataBuff = ethUtil.toBuffer(data); diff --git a/packages/0x.js/src/utils/utils.ts b/packages/0x.js/src/utils/utils.ts index 3e98de84f..c8bcd907e 100644 --- a/packages/0x.js/src/utils/utils.ts +++ b/packages/0x.js/src/utils/utils.ts @@ -1,12 +1,10 @@ -import { SolidityTypes } from '@0xproject/types'; +import { Order, SignedOrder, SolidityTypes } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import BN = require('bn.js'); import * as ethABI from 'ethereumjs-abi'; import * as ethUtil from 'ethereumjs-util'; import * as _ from 'lodash'; -import { Order, SignedOrder } from '../types'; - export const utils = { /** * Converts BigNumber instance to BN |