diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-18 21:01:18 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-18 21:01:18 +0800 |
commit | 4948551703fb3cb9f8470d9f4a61a9a5473e5afa (patch) | |
tree | 2e7d4d2e9c98cb6bebf7bdd17444d4b351220018 /packages/0x.js | |
parent | d7bf003d511321ec6cb8814cb1549c46b4efba86 (diff) | |
parent | d4c1b3b0bd26e730ce6687469cdf7283877543e1 (diff) | |
download | dexon-sol-tools-4948551703fb3cb9f8470d9f4a61a9a5473e5afa.tar dexon-sol-tools-4948551703fb3cb9f8470d9f4a61a9a5473e5afa.tar.gz dexon-sol-tools-4948551703fb3cb9f8470d9f4a61a9a5473e5afa.tar.bz2 dexon-sol-tools-4948551703fb3cb9f8470d9f4a61a9a5473e5afa.tar.lz dexon-sol-tools-4948551703fb3cb9f8470d9f4a61a9a5473e5afa.tar.xz dexon-sol-tools-4948551703fb3cb9f8470d9f4a61a9a5473e5afa.tar.zst dexon-sol-tools-4948551703fb3cb9f8470d9f4a61a9a5473e5afa.zip |
merge development
Diffstat (limited to 'packages/0x.js')
-rw-r--r-- | packages/0x.js/CHANGELOG.md | 1 | ||||
-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 | ||||
-rw-r--r-- | packages/0x.js/test/remaining_fillable_calculator_test.ts | 2 |
13 files changed, 32 insertions, 58 deletions
diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index 78368d89b..c834d549b 100644 --- a/packages/0x.js/CHANGELOG.md +++ b/packages/0x.js/CHANGELOG.md @@ -3,6 +3,7 @@ ## v0.33.2 - _TBD, 2018_ * Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452) + * Consolidate `Order`, `SignedOrder`, and `ECSignature` into the `@0xproject/types` package (#456) ## v0.33.1 - _March 8, 2018_ 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 diff --git a/packages/0x.js/test/remaining_fillable_calculator_test.ts b/packages/0x.js/test/remaining_fillable_calculator_test.ts index 4c6b8f3ac..d97402ef6 100644 --- a/packages/0x.js/test/remaining_fillable_calculator_test.ts +++ b/packages/0x.js/test/remaining_fillable_calculator_test.ts @@ -1,10 +1,10 @@ +import { ECSignature, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import 'mocha'; import { ZeroEx } from '../src/0x'; import { RemainingFillableCalculator } from '../src/order_watcher/remaining_fillable_calculator'; -import { ECSignature, SignedOrder } from '../src/types'; import { chaiSetup } from './utils/chai_setup'; |