diff options
Diffstat (limited to 'packages/0x.js')
-rw-r--r-- | packages/0x.js/CHANGELOG.md | 3 | ||||
-rw-r--r-- | packages/0x.js/package.json | 41 | ||||
-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 |
14 files changed, 56 insertions, 77 deletions
diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index 78368d89b..b01f3541f 100644 --- a/packages/0x.js/CHANGELOG.md +++ b/packages/0x.js/CHANGELOG.md @@ -1,8 +1,9 @@ # CHANGELOG -## v0.33.2 - _TBD, 2018_ +## v0.33.2 - _March 18, 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/package.json b/packages/0x.js/package.json index 0cb01d352..9c85fe74d 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -1,6 +1,6 @@ { "name": "0x.js", - "version": "0.33.1", + "version": "0.33.6", "description": "A javascript library for interacting with the 0x protocol", "keywords": [ "0x.js", @@ -33,9 +33,14 @@ "config": { "artifacts": "TokenTransferProxy Exchange TokenRegistry Token EtherToken", "postpublish": { - "assets": ["_bundles/index.js", "_bundles/index.min.js"], + "assets": [ + "packages/0x.js/_bundles/index.js", + "packages/0x.js/_bundles/index.min.js" + ], "docPublishConfigs": { - "extraFileIncludes": ["../types/src/index.ts"], + "extraFileIncludes": [ + "../types/src/index.ts" + ], "s3BucketPath": "s3://0xjs-docs-jsons/", "s3StagingBucketPath": "s3://staging-0xjs-docs-jsons/" } @@ -50,10 +55,10 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0xproject/abi-gen": "^0.2.5", - "@0xproject/dev-utils": "^0.2.1", - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.10", + "@0xproject/abi-gen": "^0.2.7", + "@0xproject/dev-utils": "^0.3.2", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", "@types/bintrees": "^1.0.2", "@types/jsonschema": "^1.1.1", "@types/lodash": "^4.14.86", @@ -64,9 +69,9 @@ "awesome-typescript-loader": "^3.1.3", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", - "chai-as-promised-typescript-typings": "^0.0.10", + "chai-as-promised-typescript-typings": "^0.0.12", "chai-bignumber": "^2.0.1", - "chai-typescript-typings": "^0.0.4", + "chai-typescript-typings": "^0.0.6", "copyfiles": "^1.2.0", "dirty-chai": "^2.0.1", "json-loader": "^0.5.4", @@ -89,26 +94,26 @@ "webpack": "^3.1.0" }, "dependencies": { - "@0xproject/assert": "^0.2.0", - "@0xproject/base-contract": "^0.0.3", - "@0xproject/json-schemas": "^0.7.14", - "@0xproject/types": "^0.3.1", - "@0xproject/utils": "^0.4.1", - "@0xproject/web3-wrapper": "^0.2.1", + "@0xproject/assert": "^0.2.3", + "@0xproject/base-contract": "^0.0.5", + "@0xproject/json-schemas": "^0.7.17", + "@0xproject/types": "^0.4.1", + "@0xproject/utils": "^0.4.3", + "@0xproject/web3-wrapper": "^0.3.1", "bintrees": "^1.0.2", "bn.js": "^4.11.8", "ethereumjs-abi": "^0.6.4", "ethereumjs-blockstream": "^2.0.6", "ethereumjs-util": "^5.1.1", "ethers-contracts": "^2.2.1", - "ethers-typescript-typings": "^0.0.2", + "ethers-typescript-typings": "^0.0.4", "js-sha3": "^0.7.0", "lodash": "^4.17.4", "uuid": "^3.1.0", "web3": "^0.20.0", - "web3-typescript-typings": "^0.10.0" + "web3-typescript-typings": "^0.10.2" }, "publishConfig": { - "access": "public" + "access": "public" } } 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'; |