diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-06-01 05:33:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-01 05:33:28 +0800 |
commit | 384c05ccc70f839f4098e375237514784253197d (patch) | |
tree | 10e850e1e1cf17edb1a24df970ba97974d56acf0 /packages | |
parent | 6fd87568e738c114dbba9be85cf470c11117ec0a (diff) | |
parent | 193e4f327523ca7f718c1091af0b7192f4e0bcbb (diff) | |
download | dexon-0x-contracts-384c05ccc70f839f4098e375237514784253197d.tar.gz dexon-0x-contracts-384c05ccc70f839f4098e375237514784253197d.tar.zst dexon-0x-contracts-384c05ccc70f839f4098e375237514784253197d.zip |
Merge pull request #642 from 0xProject/feature/ethereum-types
Introduce ethereum-types package
Diffstat (limited to 'packages')
90 files changed, 538 insertions, 366 deletions
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index e4f7a1d03..63e9997ff 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -44,6 +44,7 @@ "docPublishConfigs": { "extraFileIncludes": [ "../types/src/index.ts", + "../ethereum-types/src/index.ts", "../contract-wrappers/src/types.ts", "../contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts", "../contract-wrappers/src/contract_wrappers/exchange_wrapper.ts", @@ -108,6 +109,7 @@ "@0xproject/typescript-typings": "^0.3.2", "@0xproject/utils": "^0.6.2", "@0xproject/web3-wrapper": "^0.6.4", + "ethereum-types": "^0.0.1", "ethers": "^3.0.15", "lodash": "^4.17.4" }, diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index d3af33fdf..e02b930ed 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -27,9 +27,9 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md", "dependencies": { - "@0xproject/types": "^0.7.0", "@0xproject/typescript-typings": "^0.3.2", "@0xproject/utils": "^0.6.2", + "ethereum-types": "^0.0.1", "chalk": "^2.3.0", "glob": "^7.1.2", "handlebars": "^4.0.11", diff --git a/packages/abi-gen/src/index.ts b/packages/abi-gen/src/index.ts index ef5710f53..b7e6722ea 100644 --- a/packages/abi-gen/src/index.ts +++ b/packages/abi-gen/src/index.ts @@ -1,8 +1,8 @@ #!/usr/bin/env node -import { AbiDefinition, ConstructorAbi, EventAbi, MethodAbi } from '@0xproject/types'; import { abiUtils, logUtils } from '@0xproject/utils'; import chalk from 'chalk'; +import { AbiDefinition, ConstructorAbi, EventAbi, MethodAbi } from 'ethereum-types'; import * as fs from 'fs'; import { sync as globSync } from 'glob'; import * as Handlebars from 'handlebars'; diff --git a/packages/abi-gen/src/types.ts b/packages/abi-gen/src/types.ts index 648281774..68765b04d 100644 --- a/packages/abi-gen/src/types.ts +++ b/packages/abi-gen/src/types.ts @@ -1,4 +1,4 @@ -import { EventAbi, MethodAbi } from '@0xproject/types'; +import { EventAbi, MethodAbi } from 'ethereum-types'; export enum ParamKind { Input = 'input', diff --git a/packages/abi-gen/src/utils.ts b/packages/abi-gen/src/utils.ts index 20b734959..a46209dad 100644 --- a/packages/abi-gen/src/utils.ts +++ b/packages/abi-gen/src/utils.ts @@ -1,4 +1,4 @@ -import { AbiType, ConstructorAbi, DataItem } from '@0xproject/types'; +import { AbiType, ConstructorAbi, DataItem } from 'ethereum-types'; import * as fs from 'fs'; import * as _ from 'lodash'; import * as path from 'path'; diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index f79d3ebf6..c01a133e4 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -42,7 +42,7 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/types": "^0.7.0", + "ethereum-types": "^0.0.1", "@0xproject/typescript-typings": "^0.3.2", "@0xproject/utils": "^0.6.2", "@0xproject/web3-wrapper": "^0.6.4", diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts index f9298f413..d9e28f9f2 100644 --- a/packages/base-contract/src/index.ts +++ b/packages/base-contract/src/index.ts @@ -1,3 +1,5 @@ +import { abiUtils, BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { AbiDefinition, AbiType, @@ -8,9 +10,7 @@ import { Provider, TxData, TxDataPayable, -} from '@0xproject/types'; -import { abiUtils, BigNumber } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; +} from 'ethereum-types'; import * as ethers from 'ethers'; import * as _ from 'lodash'; diff --git a/packages/base-contract/src/utils.ts b/packages/base-contract/src/utils.ts index 4b86bb1ad..61f176df5 100644 --- a/packages/base-contract/src/utils.ts +++ b/packages/base-contract/src/utils.ts @@ -1,4 +1,4 @@ -import { DataItem } from '@0xproject/types'; +import { DataItem } from 'ethereum-types'; import * as _ from 'lodash'; // tslint:disable-next-line:completed-docs diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index 9185ab46f..8680613a3 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -85,6 +85,7 @@ "@0xproject/typescript-typings": "^0.3.2", "@0xproject/utils": "^0.6.2", "@0xproject/web3-wrapper": "^0.6.4", + "ethereum-types": "^0.0.1", "ethereumjs-blockstream": "^2.0.6", "ethereumjs-util": "^5.1.1", "ethers": "^3.0.15", diff --git a/packages/contract_templates/contract.handlebars b/packages/contract_templates/contract.handlebars index b2765b1a5..5fb19af11 100644 --- a/packages/contract_templates/contract.handlebars +++ b/packages/contract_templates/contract.handlebars @@ -2,11 +2,11 @@ * This file is auto-generated using abi-gen. Don't edit directly. * Templates can be found at https://github.com/0xProject/0x-monorepo/tree/development/packages/contract_templates. */ -// tslint:disable:no-consecutive-blank-lines +// tslint:disable:no-consecutive-blank-lines ordered-imports // tslint:disable-next-line:no-unused-variable import { BaseContract } from '@0xproject/base-contract'; import { ContractArtifact } from '@0xproject/sol-compiler'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, DataItem, MethodAbi, Provider, TxData, TxDataPayable } from '@0xproject/types'; +import { BlockParam, BlockParamLiteral, CallData, ContractAbi, DataItem, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, promisify } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as ethers from 'ethers'; diff --git a/packages/contract_templates/partials/event.handlebars b/packages/contract_templates/partials/event.handlebars index 3c6100e4f..69a99d937 100644 --- a/packages/contract_templates/partials/event.handlebars +++ b/packages/contract_templates/partials/event.handlebars @@ -1,4 +1,4 @@ -export interface {{name}}ContractEventArgs { +export interface {{name}}ContractEventArgs extends DecodedLogArgs { {{#each inputs}} {{name}}: {{#returnType type components}}{{/returnType}}; {{/each}} diff --git a/packages/contracts/package.json b/packages/contracts/package.json index d7fd9b056..300a5331a 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -75,6 +75,7 @@ "@0xproject/typescript-typings": "^0.3.2", "@0xproject/utils": "^0.6.2", "@0xproject/web3-wrapper": "^0.6.4", + "ethereum-types": "^0.0.1", "bn.js": "^4.11.8", "ethereumjs-abi": "^0.6.4", "ethereumjs-util": "^5.1.1", diff --git a/packages/contracts/src/utils/erc20_wrapper.ts b/packages/contracts/src/utils/erc20_wrapper.ts index 92cf01cc2..0f45fb1e6 100644 --- a/packages/contracts/src/utils/erc20_wrapper.ts +++ b/packages/contracts/src/utils/erc20_wrapper.ts @@ -1,6 +1,6 @@ -import { Provider } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { Provider } from 'ethereum-types'; import * as _ from 'lodash'; import { DummyERC20TokenContract } from '../contract_wrappers/generated/dummy_e_r_c20_token'; diff --git a/packages/contracts/src/utils/erc721_wrapper.ts b/packages/contracts/src/utils/erc721_wrapper.ts index bea801f3d..11a012602 100644 --- a/packages/contracts/src/utils/erc721_wrapper.ts +++ b/packages/contracts/src/utils/erc721_wrapper.ts @@ -1,7 +1,7 @@ import { generatePseudoRandomSalt } from '@0xproject/order-utils'; -import { Provider } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { Provider } from 'ethereum-types'; import * as _ from 'lodash'; import { DummyERC721TokenContract } from '../contract_wrappers/generated/dummy_e_r_c721_token'; diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts index ca587f220..14d183b09 100644 --- a/packages/contracts/src/utils/exchange_wrapper.ts +++ b/packages/contracts/src/utils/exchange_wrapper.ts @@ -1,6 +1,7 @@ -import { Provider, SignedOrder, TransactionReceiptWithDecodedLogs } from '@0xproject/types'; +import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { LogEntry, Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import * as _ from 'lodash'; import { ExchangeContract } from '../contract_wrappers/generated/exchange'; diff --git a/packages/contracts/src/utils/log_decoder.ts b/packages/contracts/src/utils/log_decoder.ts index 32819b657..07d10e69d 100644 --- a/packages/contracts/src/utils/log_decoder.ts +++ b/packages/contracts/src/utils/log_decoder.ts @@ -1,13 +1,14 @@ import { ContractArtifact } from '@0xproject/sol-compiler'; +import { AbiDecoder, BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { AbiDefinition, + DecodedLogArgs, LogEntry, LogWithDecodedArgs, RawLog, TransactionReceiptWithDecodedLogs, -} from '@0xproject/types'; -import { AbiDecoder, BigNumber } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; +} from 'ethereum-types'; import * as _ from 'lodash'; import { artifacts } from './artifacts'; @@ -36,7 +37,7 @@ export class LogDecoder { }); this._abiDecoder = new AbiDecoder(abiArrays); } - public decodeLogOrThrow<ArgsType>(log: LogEntry): LogWithDecodedArgs<ArgsType> | RawLog { + public decodeLogOrThrow<ArgsType extends DecodedLogArgs>(log: LogEntry): LogWithDecodedArgs<ArgsType> | RawLog { const logWithDecodedArgsOrLog = this._abiDecoder.tryToDecodeLogOrNoop(log); if (_.isUndefined((logWithDecodedArgsOrLog as LogWithDecodedArgs<ArgsType>).args)) { throw new Error(`Unable to decode log: ${JSON.stringify(log)}`); diff --git a/packages/contracts/src/utils/match_order_tester.ts b/packages/contracts/src/utils/match_order_tester.ts index 87399b9f6..ec8931a20 100644 --- a/packages/contracts/src/utils/match_order_tester.ts +++ b/packages/contracts/src/utils/match_order_tester.ts @@ -1,7 +1,8 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { LogWithDecodedArgs, SignedOrder } from '@0xproject/types'; +import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; +import { LogWithDecodedArgs } from 'ethereum-types'; import ethUtil = require('ethereumjs-util'); import * as _ from 'lodash'; diff --git a/packages/contracts/src/utils/multi_sig_wrapper.ts b/packages/contracts/src/utils/multi_sig_wrapper.ts index d67692194..9971e8f6e 100644 --- a/packages/contracts/src/utils/multi_sig_wrapper.ts +++ b/packages/contracts/src/utils/multi_sig_wrapper.ts @@ -1,6 +1,6 @@ -import { Provider, TransactionReceiptWithDecodedLogs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import * as _ from 'lodash'; import { AssetProxyOwnerContract } from '../contract_wrappers/generated/asset_proxy_owner'; diff --git a/packages/contracts/src/utils/token_registry_wrapper.ts b/packages/contracts/src/utils/token_registry_wrapper.ts index 6e3abb26b..240c06fdc 100644 --- a/packages/contracts/src/utils/token_registry_wrapper.ts +++ b/packages/contracts/src/utils/token_registry_wrapper.ts @@ -1,5 +1,5 @@ -import { Provider } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { Provider } from 'ethereum-types'; import { TokenRegistryContract } from '../contract_wrappers/generated/token_registry'; diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts index 1eeffc70e..d68a81b51 100644 --- a/packages/contracts/src/utils/types.ts +++ b/packages/contracts/src/utils/types.ts @@ -1,5 +1,6 @@ -import { AbiDefinition, ContractAbi, Order } from '@0xproject/types'; +import { Order } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; +import { AbiDefinition, ContractAbi } from 'ethereum-types'; export interface ERC20BalancesByOwner { [ownerAddress: string]: { diff --git a/packages/contracts/src/utils/web3_wrapper.ts b/packages/contracts/src/utils/web3_wrapper.ts index 4b8512222..1049ab967 100644 --- a/packages/contracts/src/utils/web3_wrapper.ts +++ b/packages/contracts/src/utils/web3_wrapper.ts @@ -1,7 +1,7 @@ import { devConstants, env, EnvVars, web3Factory } from '@0xproject/dev-utils'; import { prependSubprovider } from '@0xproject/subproviders'; -import { Provider } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { Provider } from 'ethereum-types'; import { coverage } from './coverage'; diff --git a/packages/contracts/test/asset_proxy_owner.ts b/packages/contracts/test/asset_proxy_owner.ts index f95679e20..4c16b5cff 100644 --- a/packages/contracts/test/asset_proxy_owner.ts +++ b/packages/contracts/test/asset_proxy_owner.ts @@ -1,7 +1,7 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { LogWithDecodedArgs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; +import { LogWithDecodedArgs } from 'ethereum-types'; import * as _ from 'lodash'; import 'make-promises-safe'; import * as Web3 from 'web3'; diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index bc476a5ee..6282a51ea 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -1,8 +1,9 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { LogWithDecodedArgs, SignedOrder } from '@0xproject/types'; +import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; +import { LogWithDecodedArgs } from 'ethereum-types'; import ethUtil = require('ethereumjs-util'); import 'make-promises-safe'; diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index 0da0287bc..c901c29b9 100644 --- a/packages/contracts/test/exchange/match_orders.ts +++ b/packages/contracts/test/exchange/match_orders.ts @@ -1,8 +1,9 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { LogWithDecodedArgs, SignedOrder } from '@0xproject/types'; +import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; +import { LogWithDecodedArgs } from 'ethereum-types'; import ethUtil = require('ethereumjs-util'); import * as _ from 'lodash'; diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index e817951ab..f8d75080a 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -1,9 +1,9 @@ import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils'; -import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import BN = require('bn.js'); import * as chai from 'chai'; +import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import ethUtil = require('ethereumjs-util'); import * as Web3 from 'web3'; diff --git a/packages/contracts/test/multi_sig_with_time_lock.ts b/packages/contracts/test/multi_sig_with_time_lock.ts index 7b7885a00..1302d0fa0 100644 --- a/packages/contracts/test/multi_sig_with_time_lock.ts +++ b/packages/contracts/test/multi_sig_with_time_lock.ts @@ -1,8 +1,8 @@ import { BlockchainLifecycle, web3Factory } from '@0xproject/dev-utils'; -import { LogWithDecodedArgs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; +import { LogWithDecodedArgs } from 'ethereum-types'; import * as _ from 'lodash'; import 'make-promises-safe'; import * as Web3 from 'web3'; diff --git a/packages/contracts/test/tutorials/arbitrage.ts b/packages/contracts/test/tutorials/arbitrage.ts index e5787d5b8..df01f31bb 100644 --- a/packages/contracts/test/tutorials/arbitrage.ts +++ b/packages/contracts/test/tutorials/arbitrage.ts @@ -1,6 +1,6 @@ // import { ECSignature, SignedOrder, ZeroEx } from '0x.js'; // import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils'; -// import { ExchangeContractErrs } from '@0xproject/types'; +// import { ExchangeContractErrs } from 'ethereum-types'; // import { BigNumber } from '@0xproject/utils'; // import { Web3Wrapper } from '@0xproject/web3-wrapper'; // import * as chai from 'chai'; diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 0b11029f6..47a13733b 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -46,6 +46,7 @@ "dependencies": { "@0xproject/subproviders": "^0.10.2", "@0xproject/types": "^0.7.0", + "ethereum-types": "^0.0.1", "@0xproject/typescript-typings": "^0.3.2", "@0xproject/web3-wrapper": "^0.6.4", "lodash": "^4.17.4", diff --git a/packages/dev-utils/src/web3_factory.ts b/packages/dev-utils/src/web3_factory.ts index c273035da..12872c122 100644 --- a/packages/dev-utils/src/web3_factory.ts +++ b/packages/dev-utils/src/web3_factory.ts @@ -7,7 +7,7 @@ import ProviderEngine = require('web3-provider-engine'); import RpcSubprovider = require('web3-provider-engine/subproviders/rpc'); import { EmptyWalletSubprovider, FakeGasEstimateSubprovider, GanacheSubprovider } from '@0xproject/subproviders'; -import { Provider } from '@0xproject/types'; +import { Provider } from 'ethereum-types'; import * as fs from 'fs'; import * as _ from 'lodash'; import * as process from 'process'; diff --git a/packages/dev-utils/test/blockchain_lifecycle_test.ts b/packages/dev-utils/test/blockchain_lifecycle_test.ts index 857a6b50e..3d7d2e0ef 100644 --- a/packages/dev-utils/test/blockchain_lifecycle_test.ts +++ b/packages/dev-utils/test/blockchain_lifecycle_test.ts @@ -1,6 +1,6 @@ -import { BlockParamLiteral } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; +import { BlockParamLiteral } from 'ethereum-types'; import 'make-promises-safe'; import 'mocha'; diff --git a/packages/dev-utils/test/rpc_test.ts b/packages/dev-utils/test/rpc_test.ts index 45d1226c2..cff946e23 100644 --- a/packages/dev-utils/test/rpc_test.ts +++ b/packages/dev-utils/test/rpc_test.ts @@ -1,6 +1,6 @@ -import { BlockParamLiteral } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; +import { BlockParamLiteral } from 'ethereum-types'; import 'make-promises-safe'; import 'mocha'; diff --git a/packages/ethereum-types/.npmignore b/packages/ethereum-types/.npmignore new file mode 100644 index 000000000..24e65ad5b --- /dev/null +++ b/packages/ethereum-types/.npmignore @@ -0,0 +1,6 @@ +.* +yarn-error.log +/scripts/ +/src/ +tsconfig.json +/lib/monorepo_scripts/ diff --git a/packages/ethereum-types/CHANGELOG.json b/packages/ethereum-types/CHANGELOG.json new file mode 100644 index 000000000..ed0526ee0 --- /dev/null +++ b/packages/ethereum-types/CHANGELOG.json @@ -0,0 +1,11 @@ +[ + { + "version": "0.0.1", + "changes": [ + { + "note": "Initial publish", + "pr": "642" + } + ] + } +] diff --git a/packages/ethereum-types/README.md b/packages/ethereum-types/README.md new file mode 100644 index 000000000..817e22d15 --- /dev/null +++ b/packages/ethereum-types/README.md @@ -0,0 +1,61 @@ +## ethereum-types + +Typescript types shared across Ethereum-related packages/libraries/tools. + +## Installation + +```bash +yarn add -D ethereum-types +``` + +## Usage + +```javascript +import { TransactionReceipt, TxData, TxDataPayable } from 'ethereum-types'; +``` + +## Contributing + +We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository. + +Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started. + +### Install dependencies + +If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them: + +```bash +yarn config set workspaces-experimental true +``` + +Then install dependencies + +```bash +yarn install +``` + +### Build + +To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory: + +```bash +PKG=ethereum-types yarn build +``` + +Or continuously rebuild on change: + +```bash +PKG=ethereum-types yarn watch +``` + +### Clean + +```bash +yarn clean +``` + +### Lint + +```bash +yarn lint +``` diff --git a/packages/ethereum-types/package.json b/packages/ethereum-types/package.json new file mode 100644 index 000000000..0c9519994 --- /dev/null +++ b/packages/ethereum-types/package.json @@ -0,0 +1,42 @@ +{ + "name": "ethereum-types", + "version": "0.0.1", + "engines": { + "node": ">=6.12" + }, + "description": "Ethereum types", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "scripts": { + "watch": "tsc -w", + "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", + "clean": "shx rm -rf lib scripts", + "lint": "tslint --project .", + "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + }, + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "https://github.com/0xProject/0x-monorepo.git" + }, + "bugs": { + "url": "https://github.com/0xProject/0x-monorepo/issues" + }, + "homepage": "https://github.com/0xProject/0x-monorepo/packages/ethereum-types/README.md", + "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", + "copyfiles": "^1.2.0", + "make-promises-safe": "^1.1.0", + "shx": "^0.2.2", + "tslint": "5.8.0", + "typescript": "2.7.1" + }, + "dependencies": { + "@types/node": "^8.0.53", + "bignumber.js": "~4.1.0" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/ethereum-types/src/globals.d.ts b/packages/ethereum-types/src/globals.d.ts new file mode 100644 index 000000000..94e63a32d --- /dev/null +++ b/packages/ethereum-types/src/globals.d.ts @@ -0,0 +1,6 @@ +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts new file mode 100644 index 000000000..f00ae963a --- /dev/null +++ b/packages/ethereum-types/src/index.ts @@ -0,0 +1,281 @@ +import { BigNumber } from 'bignumber.js'; + +export type JSONRPCErrorCallback = (err: Error | null, result?: JSONRPCResponsePayload) => void; + +/** + * Do not create your own provider. Use an existing provider from a Web3 or ProviderEngine library + * Read more about Providers in the 0x wiki. + */ +export interface Provider { + sendAsync(payload: JSONRPCRequestPayload, callback: JSONRPCErrorCallback): void; +} + +export type ContractAbi = AbiDefinition[]; + +export type AbiDefinition = FunctionAbi | EventAbi; + +export type FunctionAbi = MethodAbi | ConstructorAbi | FallbackAbi; + +export type ConstructorStateMutability = 'nonpayable' | 'payable'; +export type StateMutability = 'pure' | 'view' | ConstructorStateMutability; + +export interface MethodAbi { + type: AbiType.Function; + name: string; + inputs: DataItem[]; + outputs: DataItem[]; + constant: boolean; + stateMutability: StateMutability; + payable: boolean; +} + +export interface ConstructorAbi { + type: AbiType.Constructor; + inputs: DataItem[]; + payable: boolean; + stateMutability: ConstructorStateMutability; +} + +export interface FallbackAbi { + type: AbiType.Fallback; + payable: boolean; +} + +export interface EventParameter extends DataItem { + indexed: boolean; +} + +export interface EventAbi { + type: AbiType.Event; + name: string; + inputs: EventParameter[]; + anonymous: boolean; +} + +export interface DataItem { + name: string; + type: string; + components?: DataItem[]; +} + +export enum OpCode { + DelegateCall = 'DELEGATECALL', + Revert = 'REVERT', + Create = 'CREATE', + Stop = 'STOP', + Invalid = 'INVALID', + CallCode = 'CALLCODE', + StaticCall = 'STATICCALL', + Return = 'RETURN', + Call = 'CALL', + SelfDestruct = 'SELFDESTRUCT', +} + +export interface StructLog { + depth: number; + error: string; + gas: number; + gasCost: number; + memory: string[]; + op: OpCode; + pc: number; + stack: string[]; + storage: { [location: string]: string }; +} + +export interface TransactionTrace { + gas: number; + returnValue: any; + structLogs: StructLog[]; +} + +export type Unit = + | 'kwei' + | 'ada' + | 'mwei' + | 'babbage' + | 'gwei' + | 'shannon' + | 'szabo' + | 'finney' + | 'ether' + | 'kether' + | 'grand' + | 'einstein' + | 'mether' + | 'gether' + | 'tether'; + +export interface JSONRPCRequestPayload { + params: any[]; + method: string; + id: number; + jsonrpc: string; +} + +export interface JSONRPCResponsePayload { + result: any; + id: number; + jsonrpc: string; +} + +export interface AbstractBlock { + number: number | null; + hash: string | null; + parentHash: string; + nonce: string | null; + sha3Uncles: string; + logsBloom: string | null; + transactionsRoot: string; + stateRoot: string; + miner: string; + difficulty: BigNumber; + totalDifficulty: BigNumber; + extraData: string; + size: number; + gasLimit: number; + gasUsed: number; + timestamp: number; + uncles: string[]; +} + +export interface BlockWithoutTransactionData extends AbstractBlock { + transactions: string[]; +} + +export interface BlockWithTransactionData extends AbstractBlock { + transactions: Transaction[]; +} + +export interface Transaction { + hash: string; + nonce: number; + blockHash: string | null; + blockNumber: number | null; + transactionIndex: number | null; + from: string; + to: string | null; + value: BigNumber; + gasPrice: BigNumber; + gas: number; + input: string; +} + +export interface CallTxDataBase { + to?: string; + value?: number | string | BigNumber; + gas?: number | string | BigNumber; + gasPrice?: number | string | BigNumber; + data?: string; + nonce?: number; +} + +export interface TxData extends CallTxDataBase { + from: string; +} + +export interface CallData extends CallTxDataBase { + from?: string; +} + +export interface FilterObject { + fromBlock?: number | string; + toBlock?: number | string; + address?: string; + topics?: LogTopic[]; +} + +export type LogTopic = null | string | string[]; + +export interface DecodedLogEntry<A> extends LogEntry { + event: string; + args: A; +} + +export interface DecodedLogEntryEvent<A> extends DecodedLogEntry<A> { + removed: boolean; +} + +export interface LogEntryEvent extends LogEntry { + removed: boolean; +} + +export interface LogEntry { + logIndex: number | null; + transactionIndex: number | null; + transactionHash: string; + blockHash: string | null; + blockNumber: number | null; + address: string; + data: string; + topics: string[]; +} + +export interface TxDataPayable extends TxData { + value?: BigNumber; +} + +export interface TransactionReceipt { + blockHash: string; + blockNumber: number; + transactionHash: string; + transactionIndex: number; + from: string; + to: string; + status: null | string | 0 | 1; + cumulativeGasUsed: number; + gasUsed: number; + contractAddress: string | null; + logs: LogEntry[]; +} + +export enum AbiType { + Function = 'function', + Constructor = 'constructor', + Event = 'event', + Fallback = 'fallback', +} + +export type ContractEventArg = string | BigNumber | number | boolean; + +export interface DecodedLogArgs { + [argName: string]: ContractEventArg; +} + +export interface LogWithDecodedArgs<ArgsType extends DecodedLogArgs> extends DecodedLogEntry<ArgsType> {} +export type RawLog = LogEntry; + +export enum BlockParamLiteral { + Earliest = 'earliest', + Latest = 'latest', + Pending = 'pending', +} + +export type BlockParam = BlockParamLiteral | number; + +export interface RawLogEntry { + logIndex: string | null; + transactionIndex: string | null; + transactionHash: string; + blockHash: string | null; + blockNumber: string | null; + address: string; + data: string; + topics: string[]; +} + +export enum SolidityTypes { + Address = 'address', + Uint256 = 'uint256', + Uint8 = 'uint8', + Uint = 'uint', +} + +/** + * Contains the logs returned by a TransactionReceipt. We attempt to decode the + * logs using AbiDecoder. If we have the logs corresponding ABI, we decode it, + * otherwise we don't. + */ +export interface TransactionReceiptWithDecodedLogs extends TransactionReceipt { + logs: Array<LogWithDecodedArgs<DecodedLogArgs> | LogEntry>; +} diff --git a/packages/ethereum-types/src/monorepo_scripts/postpublish.ts b/packages/ethereum-types/src/monorepo_scripts/postpublish.ts new file mode 100644 index 000000000..dcb99d0f7 --- /dev/null +++ b/packages/ethereum-types/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,8 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; + +const cwd = `${__dirname}/..`; +// tslint:disable-next-line:no-floating-promises +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/ethereum-types/tsconfig.json b/packages/ethereum-types/tsconfig.json new file mode 100644 index 000000000..82a45ea94 --- /dev/null +++ b/packages/ethereum-types/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "typeRoots": ["../../node_modules/@types"], + "outDir": "lib" + }, + "include": ["src/**/*"] +} diff --git a/packages/ethereum-types/tslint.json b/packages/ethereum-types/tslint.json new file mode 100644 index 000000000..ffaefe83a --- /dev/null +++ b/packages/ethereum-types/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": ["@0xproject/tslint-config"] +} diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json index f74c2672d..6d47fe534 100644 --- a/packages/fill-scenarios/package.json +++ b/packages/fill-scenarios/package.json @@ -39,6 +39,7 @@ "@0xproject/base-contract": "^0.3.2", "@0xproject/order-utils": "^0.0.5", "@0xproject/types": "0.7.0", + "ethereum-types": "^0.0.1", "@0xproject/typescript-typings": "^0.3.2", "@0xproject/utils": "^0.6.2", "@0xproject/web3-wrapper": "^0.6.4", diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 1612bbc0a..60a79d165 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -27,7 +27,8 @@ "assets": [], "docPublishConfigs": { "extraFileIncludes": [ - "../types/src/index.ts" + "../types/src/index.ts", + "../ethereum-types/src/index.ts" ], "s3BucketPath": "s3://doc-jsons/json-schemas/", "s3StagingBucketPath": "s3://staging-doc-jsons/json-schemas/" diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index 312aa0819..a85bf8f77 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -35,6 +35,7 @@ "@0xproject/types": "^0.7.0", "@0xproject/utils": "^0.6.2", "@0xproject/web3-wrapper": "^0.6.4", + "ethereum-types": "^0.0.1", "ethers": "^3.0.15", "lodash": "^4.17.4", "web3-provider-engine": "^14.0.4" diff --git a/packages/metacoin/test/metacoin_test.ts b/packages/metacoin/test/metacoin_test.ts index 034c1265e..3436fb49e 100644 --- a/packages/metacoin/test/metacoin_test.ts +++ b/packages/metacoin/test/metacoin_test.ts @@ -1,9 +1,9 @@ import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils'; import { ContractArtifact } from '@0xproject/sol-compiler'; -import { LogWithDecodedArgs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; +import { LogWithDecodedArgs } from 'ethereum-types'; import 'make-promises-safe'; import * as MetacoinArtifact from '../artifacts/Metacoin.json'; diff --git a/packages/migrations/package.json b/packages/migrations/package.json index 54866110e..a3f9ca501 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -53,6 +53,7 @@ "@0xproject/typescript-typings": "^0.3.2", "@0xproject/utils": "^0.6.2", "@0xproject/web3-wrapper": "^0.6.4", + "ethereum-types": "^0.0.1", "ethers": "^3.0.15", "lodash": "^4.17.4" }, diff --git a/packages/migrations/src/migrate.ts b/packages/migrations/src/migrate.ts index 49b4e897c..a6fd86e5a 100644 --- a/packages/migrations/src/migrate.ts +++ b/packages/migrations/src/migrate.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node import { devConstants, web3Factory } from '@0xproject/dev-utils'; -import { Provider } from '@0xproject/types'; import { logUtils } from '@0xproject/utils'; +import { Provider } from 'ethereum-types'; import * as path from 'path'; import * as yargs from 'yargs'; diff --git a/packages/migrations/src/v1/migration.ts b/packages/migrations/src/v1/migration.ts index 233339244..baa776537 100644 --- a/packages/migrations/src/v1/migration.ts +++ b/packages/migrations/src/v1/migration.ts @@ -1,6 +1,6 @@ -import { Provider, TxData } from '@0xproject/types'; import { BigNumber, NULL_BYTES } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { Provider, TxData } from 'ethereum-types'; import * as _ from 'lodash'; import { ArtifactWriter } from '../artifact_writer'; diff --git a/packages/migrations/src/v2/migration.ts b/packages/migrations/src/v2/migration.ts index fd7223252..08a8ad2a7 100644 --- a/packages/migrations/src/v2/migration.ts +++ b/packages/migrations/src/v2/migration.ts @@ -1,6 +1,6 @@ -import { Provider, TxData } from '@0xproject/types'; import { BigNumber, NULL_BYTES } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { Provider, TxData } from 'ethereum-types'; import * as _ from 'lodash'; import { ArtifactWriter } from '../artifact_writer'; diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index ec8074b9d..ddb95ba3f 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -26,7 +26,8 @@ "postpublish": { "docPublishConfigs": { "extraFileIncludes": [ - "../types/src/index.ts" + "../types/src/index.ts", + "../ethereum-types/src/index.ts" ], "s3BucketPath": "s3://doc-jsons/order-utils/", "s3StagingBucketPath": "s3://staging-doc-jsons/order-utils/" diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index a1aed439b..8d9283978 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -86,6 +86,7 @@ "@0xproject/typescript-typings": "^0.3.2", "@0xproject/utils": "^0.6.2", "@0xproject/web3-wrapper": "^0.6.4", + "ethereum-types": "^0.0.1", "bintrees": "^1.0.2", "ethers": "^3.0.15", "lodash": "^4.17.4" diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json index a74e4ae3e..60ed3655f 100644 --- a/packages/sol-compiler/package.json +++ b/packages/sol-compiler/package.json @@ -28,7 +28,8 @@ "assets": [], "docPublishConfigs": { "extraFileIncludes": [ - "../types/src/index.ts" + "../types/src/index.ts", + "../ethereum-types/src/index.ts" ], "s3BucketPath": "s3://doc-jsons/sol-compiler/", "s3StagingBucketPath": "s3://staging-doc-jsons/sol-compiler/" @@ -80,6 +81,7 @@ "@0xproject/utils": "^0.6.2", "@0xproject/web3-wrapper": "^0.6.4", "@types/yargs": "^11.0.0", + "ethereum-types": "^0.0.1", "chalk": "^2.3.0", "ethereumjs-util": "^5.1.1", "isomorphic-fetch": "^2.2.1", diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index 1d5bdb940..d2dda75ea 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -11,9 +11,9 @@ import { Resolver, URLResolver, } from '@0xproject/sol-resolver'; -import { ContractAbi } from '@0xproject/types'; import { logUtils, promisify } from '@0xproject/utils'; import chalk from 'chalk'; +import { ContractAbi } from 'ethereum-types'; import * as ethUtil from 'ethereumjs-util'; import * as fs from 'fs'; import 'isomorphic-fetch'; diff --git a/packages/sol-compiler/src/utils/encoder.ts b/packages/sol-compiler/src/utils/encoder.ts index 806efbbca..0f2d75691 100644 --- a/packages/sol-compiler/src/utils/encoder.ts +++ b/packages/sol-compiler/src/utils/encoder.ts @@ -1,4 +1,4 @@ -import { AbiDefinition, AbiType, ContractAbi, DataItem } from '@0xproject/types'; +import { AbiDefinition, AbiType, ContractAbi, DataItem } from 'ethereum-types'; import * as _ from 'lodash'; import * as web3Abi from 'web3-eth-abi'; diff --git a/packages/sol-compiler/src/utils/types.ts b/packages/sol-compiler/src/utils/types.ts index d43347fa6..759a7a555 100644 --- a/packages/sol-compiler/src/utils/types.ts +++ b/packages/sol-compiler/src/utils/types.ts @@ -1,4 +1,4 @@ -import { ContractAbi, Provider, TxData } from '@0xproject/types'; +import { ContractAbi, Provider, TxData } from 'ethereum-types'; import * as solc from 'solc'; import * as Web3 from 'web3'; import * as yargs from 'yargs'; diff --git a/packages/sol-compiler/test/util/provider.ts b/packages/sol-compiler/test/util/provider.ts index 2bd178129..7215ffae7 100644 --- a/packages/sol-compiler/test/util/provider.ts +++ b/packages/sol-compiler/test/util/provider.ts @@ -1,5 +1,5 @@ import { web3Factory } from '@0xproject/dev-utils'; -import { Provider } from '@0xproject/types'; +import { Provider } from 'ethereum-types'; import * as Web3 from 'web3'; const providerConfigs = { shouldUseInProcessGanache: true }; diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index 67c570bd4..4d92a610b 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -29,7 +29,8 @@ "docPublishConfigs": { "extraFileIncludes": [ "../subproviders/src/types.ts", - "../types/src/index.ts" + "../types/src/index.ts", + "../ethereum-types/src/index.ts" ], "s3BucketPath": "s3://doc-jsons/sol-cov/", "s3StagingBucketPath": "s3://staging-doc-jsons/sol-cov/" @@ -48,9 +49,9 @@ "dependencies": { "@0xproject/sol-compiler": "^0.5.0", "@0xproject/subproviders": "^0.10.2", - "@0xproject/types": "^0.7.0", "@0xproject/typescript-typings": "^0.3.2", "@0xproject/utils": "^0.6.2", + "ethereum-types": "^0.0.1", "ethereumjs-util": "^5.1.1", "glob": "^7.1.2", "istanbul": "^0.4.5", diff --git a/packages/sol-cov/src/coverage_subprovider.ts b/packages/sol-cov/src/coverage_subprovider.ts index 438339a3f..ca7f4aed2 100644 --- a/packages/sol-cov/src/coverage_subprovider.ts +++ b/packages/sol-cov/src/coverage_subprovider.ts @@ -1,5 +1,5 @@ import { Callback, ErrorCallback, NextCallback, Subprovider } from '@0xproject/subproviders'; -import { BlockParam, CallData, JSONRPCRequestPayload, TransactionTrace, TxData } from '@0xproject/types'; +import { BlockParam, CallData, JSONRPCRequestPayload, TransactionTrace, TxData } from 'ethereum-types'; import * as fs from 'fs'; import * as _ from 'lodash'; import { Lock } from 'semaphore-async-await'; diff --git a/packages/sol-cov/src/trace.ts b/packages/sol-cov/src/trace.ts index 6caea1610..1c21c8e5c 100644 --- a/packages/sol-cov/src/trace.ts +++ b/packages/sol-cov/src/trace.ts @@ -1,5 +1,5 @@ -import { OpCode, StructLog, TransactionTrace } from '@0xproject/types'; import { addressUtils, BigNumber, logUtils } from '@0xproject/utils'; +import { OpCode, StructLog, TransactionTrace } from 'ethereum-types'; import { addHexPrefix, stripHexPrefix } from 'ethereumjs-util'; import * as fs from 'fs'; import * as _ from 'lodash'; diff --git a/packages/sol-cov/test/trace_test.ts b/packages/sol-cov/test/trace_test.ts index c140cba0d..07e270b71 100644 --- a/packages/sol-cov/test/trace_test.ts +++ b/packages/sol-cov/test/trace_test.ts @@ -1,5 +1,5 @@ -import { OpCode, StructLog } from '@0xproject/types'; import * as chai from 'chai'; +import { OpCode, StructLog } from 'ethereum-types'; import * as fs from 'fs'; import * as _ from 'lodash'; import 'mocha'; diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 67f0edb4b..3a28e5e8d 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -31,7 +31,8 @@ "assets": [], "docPublishConfigs": { "extraFileIncludes": [ - "../types/src/index.ts" + "../types/src/index.ts", + "../ethereum-types/src/index.ts" ], "s3BucketPath": "s3://doc-jsons/subproviders/", "s3StagingBucketPath": "s3://staging-doc-jsons/subproviders/" @@ -45,6 +46,7 @@ "@0xproject/utils": "^0.6.2", "@ledgerhq/hw-app-eth": "^4.3.0", "@ledgerhq/hw-transport-u2f": "^4.3.0", + "ethereum-types": "^0.0.1", "bip39": "^2.5.0", "bn.js": "^4.11.8", "ethereumjs-tx": "^1.3.3", diff --git a/packages/subproviders/src/subproviders/base_wallet_subprovider.ts b/packages/subproviders/src/subproviders/base_wallet_subprovider.ts index a04be68e1..c4b344e3b 100644 --- a/packages/subproviders/src/subproviders/base_wallet_subprovider.ts +++ b/packages/subproviders/src/subproviders/base_wallet_subprovider.ts @@ -1,6 +1,6 @@ import { assert } from '@0xproject/assert'; -import { JSONRPCRequestPayload, JSONRPCResponsePayload } from '@0xproject/types'; import { addressUtils } from '@0xproject/utils'; +import { JSONRPCRequestPayload, JSONRPCResponsePayload } from 'ethereum-types'; import * as _ from 'lodash'; import { Callback, ErrorCallback, PartialTxParams, ResponseWithTxParams, WalletSubproviderErrors } from '../types'; diff --git a/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts b/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts index bd7a4b6d9..4268c67bd 100644 --- a/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts +++ b/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts @@ -1,4 +1,4 @@ -import { JSONRPCRequestPayload } from '@0xproject/types'; +import { JSONRPCRequestPayload } from 'ethereum-types'; import { Callback, ErrorCallback } from '../types'; diff --git a/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts b/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts index 6c49f20cf..d750505e7 100644 --- a/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts +++ b/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts @@ -1,4 +1,4 @@ -import { JSONRPCRequestPayload } from '@0xproject/types'; +import { JSONRPCRequestPayload } from 'ethereum-types'; import { Callback, ErrorCallback } from '../types'; diff --git a/packages/subproviders/src/subproviders/ganache.ts b/packages/subproviders/src/subproviders/ganache.ts index 9ab764048..73d0513cc 100644 --- a/packages/subproviders/src/subproviders/ganache.ts +++ b/packages/subproviders/src/subproviders/ganache.ts @@ -1,4 +1,4 @@ -import { JSONRPCRequestPayload, Provider } from '@0xproject/types'; +import { JSONRPCRequestPayload, Provider } from 'ethereum-types'; import * as Ganache from 'ganache-core'; import { Callback, ErrorCallback } from '../types'; diff --git a/packages/subproviders/src/subproviders/injected_web3.ts b/packages/subproviders/src/subproviders/injected_web3.ts index 73b870cd5..165c66d62 100644 --- a/packages/subproviders/src/subproviders/injected_web3.ts +++ b/packages/subproviders/src/subproviders/injected_web3.ts @@ -1,4 +1,4 @@ -import { JSONRPCRequestPayload, Provider } from '@0xproject/types'; +import { JSONRPCRequestPayload, Provider } from 'ethereum-types'; import * as _ from 'lodash'; import * as Web3 from 'web3'; diff --git a/packages/subproviders/src/subproviders/nonce_tracker.ts b/packages/subproviders/src/subproviders/nonce_tracker.ts index 345e5e975..98773e79c 100644 --- a/packages/subproviders/src/subproviders/nonce_tracker.ts +++ b/packages/subproviders/src/subproviders/nonce_tracker.ts @@ -1,6 +1,6 @@ import * as _ from 'lodash'; -import { BlockParamLiteral, JSONRPCRequestPayload } from '@0xproject/types'; +import { BlockParamLiteral, JSONRPCRequestPayload } from 'ethereum-types'; import EthereumTx = require('ethereumjs-tx'); import ethUtil = require('ethereumjs-util'); import providerEngineUtils = require('web3-provider-engine/util/rpc-cache-utils'); diff --git a/packages/subproviders/src/subproviders/redundant_subprovider.ts b/packages/subproviders/src/subproviders/redundant_subprovider.ts index 37c8bba5a..a60d6706e 100644 --- a/packages/subproviders/src/subproviders/redundant_subprovider.ts +++ b/packages/subproviders/src/subproviders/redundant_subprovider.ts @@ -1,5 +1,5 @@ -import { JSONRPCRequestPayload } from '@0xproject/types'; import { promisify } from '@0xproject/utils'; +import { JSONRPCRequestPayload } from 'ethereum-types'; import * as _ from 'lodash'; import { Callback } from '../types'; diff --git a/packages/subproviders/src/subproviders/subprovider.ts b/packages/subproviders/src/subproviders/subprovider.ts index cb6dffc4a..f9491707e 100644 --- a/packages/subproviders/src/subproviders/subprovider.ts +++ b/packages/subproviders/src/subproviders/subprovider.ts @@ -1,5 +1,5 @@ -import { JSONRPCRequestPayload, JSONRPCResponsePayload } from '@0xproject/types'; import { promisify } from '@0xproject/utils'; +import { JSONRPCRequestPayload, JSONRPCResponsePayload } from 'ethereum-types'; import * as Web3 from 'web3'; import { Callback, ErrorCallback, JSONRPCRequestPayloadWithMethod } from '../types'; diff --git a/packages/subproviders/src/types.ts b/packages/subproviders/src/types.ts index 30a3b4a4e..7a8413305 100644 --- a/packages/subproviders/src/types.ts +++ b/packages/subproviders/src/types.ts @@ -1,4 +1,5 @@ -import { ECSignature, JSONRPCRequestPayload } from '@0xproject/types'; +import { ECSignature } from '@0xproject/types'; +import { JSONRPCRequestPayload } from 'ethereum-types'; import HDNode = require('hdkey'); import * as _ from 'lodash'; diff --git a/packages/subproviders/test/integration/ledger_subprovider_test.ts b/packages/subproviders/test/integration/ledger_subprovider_test.ts index d3e9d0fde..315dfa894 100644 --- a/packages/subproviders/test/integration/ledger_subprovider_test.ts +++ b/packages/subproviders/test/integration/ledger_subprovider_test.ts @@ -1,10 +1,11 @@ -import { DoneCallback, JSONRPCResponsePayload } from '@0xproject/types'; +import { DoneCallback } from '@0xproject/types'; import { promisify } from '@0xproject/utils'; import Eth from '@ledgerhq/hw-app-eth'; // HACK: This dependency is optional and tslint skips optional dependencies // tslint:disable-next-line:no-implicit-dependencies import TransportNodeHid from '@ledgerhq/hw-transport-node-hid'; import * as chai from 'chai'; +import { JSONRPCResponsePayload } from 'ethereum-types'; import * as ethUtils from 'ethereumjs-util'; import * as _ from 'lodash'; import 'make-promises-safe'; diff --git a/packages/subproviders/test/unit/ledger_subprovider_test.ts b/packages/subproviders/test/unit/ledger_subprovider_test.ts index 8571f7d11..17e72a694 100644 --- a/packages/subproviders/test/unit/ledger_subprovider_test.ts +++ b/packages/subproviders/test/unit/ledger_subprovider_test.ts @@ -1,5 +1,5 @@ -import { JSONRPCResponsePayload } from '@0xproject/types'; import * as chai from 'chai'; +import { JSONRPCResponsePayload } from 'ethereum-types'; import * as ethUtils from 'ethereumjs-util'; import * as _ from 'lodash'; import 'make-promises-safe'; diff --git a/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts b/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts index 90565181e..fba221af0 100644 --- a/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts +++ b/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts @@ -1,5 +1,5 @@ -import { JSONRPCResponsePayload } from '@0xproject/types'; import * as chai from 'chai'; +import { JSONRPCResponsePayload } from 'ethereum-types'; import * as ethUtils from 'ethereumjs-util'; import * as _ from 'lodash'; import 'make-promises-safe'; diff --git a/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts b/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts index 864f977ea..ac88d8cac 100644 --- a/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts +++ b/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts @@ -1,5 +1,5 @@ -import { JSONRPCResponsePayload } from '@0xproject/types'; import * as chai from 'chai'; +import { JSONRPCResponsePayload } from 'ethereum-types'; import * as ethUtils from 'ethereumjs-util'; import * as _ from 'lodash'; import 'make-promises-safe'; diff --git a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts index fdbbb332c..fcfec1367 100644 --- a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts +++ b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts @@ -1,5 +1,6 @@ -import { DoneCallback, JSONRPCResponsePayload } from '@0xproject/types'; +import { DoneCallback } from '@0xproject/types'; import * as chai from 'chai'; +import { JSONRPCResponsePayload } from 'ethereum-types'; import * as _ from 'lodash'; import 'make-promises-safe'; import Web3 = require('web3'); diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index c565d5b7d..06f8d3e84 100644 --- a/packages/testnet-faucets/package.json +++ b/packages/testnet-faucets/package.json @@ -20,7 +20,6 @@ "dependencies": { "0x.js": "^0.38.0", "@0xproject/subproviders": "^0.10.2", - "@0xproject/types": "^0.7.0", "@0xproject/typescript-typings": "^0.3.2", "@0xproject/utils": "^0.6.2", "body-parser": "^1.17.1", @@ -37,6 +36,7 @@ "@types/body-parser": "^1.16.1", "@types/express": "^4.0.35", "@types/lodash": "4.14.104", + "ethereum-types": "^0.0.1", "awesome-typescript-loader": "^3.1.3", "gulp": "^3.9.1", "make-promises-safe": "^1.1.0", diff --git a/packages/testnet-faucets/src/ts/handler.ts b/packages/testnet-faucets/src/ts/handler.ts index d5f0dc2f9..3a105742e 100644 --- a/packages/testnet-faucets/src/ts/handler.ts +++ b/packages/testnet-faucets/src/ts/handler.ts @@ -1,6 +1,6 @@ import { Order, SignedOrder, ZeroEx } from '0x.js'; -import { Provider } from '@0xproject/types'; import { BigNumber, logUtils } from '@0xproject/utils'; +import { Provider } from 'ethereum-types'; import * as express from 'express'; import * as _ from 'lodash'; import * as Web3 from 'web3'; diff --git a/packages/types/package.json b/packages/types/package.json index d9afe5afc..376eb1d68 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -34,7 +34,8 @@ }, "dependencies": { "@types/node": "^8.0.53", - "bignumber.js": "~4.1.0" + "bignumber.js": "~4.1.0", + "ethereum-types": "^0.0.1" }, "publishConfig": { "access": "public" diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 7831f580e..47f3e3239 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -1,285 +1,5 @@ import { BigNumber } from 'bignumber.js'; - -export type JSONRPCErrorCallback = (err: Error | null, result?: JSONRPCResponsePayload) => void; - -/** - * Do not create your own provider. Use an existing provider from a Web3 or ProviderEngine library - * Read more about Providers in the 0x wiki. - */ -export interface Provider { - sendAsync(payload: JSONRPCRequestPayload, callback: JSONRPCErrorCallback): void; -} - -export type ContractAbi = AbiDefinition[]; - -export type AbiDefinition = FunctionAbi | EventAbi; - -export type FunctionAbi = MethodAbi | ConstructorAbi | FallbackAbi; - -export type ConstructorStateMutability = 'nonpayable' | 'payable'; -export type StateMutability = 'pure' | 'view' | ConstructorStateMutability; - -export interface MethodAbi { - type: AbiType.Function; - name: string; - inputs: DataItem[]; - outputs: DataItem[]; - constant: boolean; - stateMutability: StateMutability; - payable: boolean; -} - -export interface ConstructorAbi { - type: AbiType.Constructor; - inputs: DataItem[]; - payable: boolean; - stateMutability: ConstructorStateMutability; -} - -export interface FallbackAbi { - type: AbiType.Fallback; - payable: boolean; -} - -export interface EventParameter extends DataItem { - indexed: boolean; -} - -export interface EventAbi { - type: AbiType.Event; - name: string; - inputs: EventParameter[]; - anonymous: boolean; -} - -export interface DataItem { - name: string; - type: string; - components?: DataItem[]; -} - -export enum OpCode { - DelegateCall = 'DELEGATECALL', - Revert = 'REVERT', - Create = 'CREATE', - Stop = 'STOP', - Invalid = 'INVALID', - CallCode = 'CALLCODE', - StaticCall = 'STATICCALL', - Return = 'RETURN', - Call = 'CALL', - SelfDestruct = 'SELFDESTRUCT', -} - -export interface StructLog { - depth: number; - error: string; - gas: number; - gasCost: number; - memory: string[]; - op: OpCode; - pc: number; - stack: string[]; - storage: { [location: string]: string }; -} - -export interface TransactionTrace { - gas: number; - returnValue: any; - structLogs: StructLog[]; -} - -export type Unit = - | 'kwei' - | 'ada' - | 'mwei' - | 'babbage' - | 'gwei' - | 'shannon' - | 'szabo' - | 'finney' - | 'ether' - | 'kether' - | 'grand' - | 'einstein' - | 'mether' - | 'gether' - | 'tether'; - -export interface JSONRPCRequestPayload { - params: any[]; - method: string; - id: number; - jsonrpc: string; -} - -export interface JSONRPCResponsePayload { - result: any; - id: number; - jsonrpc: string; -} - -export interface AbstractBlock { - number: number | null; - hash: string | null; - parentHash: string; - nonce: string | null; - sha3Uncles: string; - logsBloom: string | null; - transactionsRoot: string; - stateRoot: string; - miner: string; - difficulty: BigNumber; - totalDifficulty: BigNumber; - extraData: string; - size: number; - gasLimit: number; - gasUsed: number; - timestamp: number; - uncles: string[]; -} - -export interface BlockWithoutTransactionData extends AbstractBlock { - transactions: string[]; -} - -export interface BlockWithTransactionData extends AbstractBlock { - transactions: Transaction[]; -} - -export interface Transaction { - hash: string; - nonce: number; - blockHash: string | null; - blockNumber: number | null; - transactionIndex: number | null; - from: string; - to: string | null; - value: BigNumber; - gasPrice: BigNumber; - gas: number; - input: string; -} - -export interface CallTxDataBase { - to?: string; - value?: number | string | BigNumber; - gas?: number | string | BigNumber; - gasPrice?: number | string | BigNumber; - data?: string; - nonce?: number; -} - -export interface TxData extends CallTxDataBase { - from: string; -} - -export interface CallData extends CallTxDataBase { - from?: string; -} - -export interface FilterObject { - fromBlock?: number | string; - toBlock?: number | string; - address?: string; - topics?: LogTopic[]; -} - -export type LogTopic = null | string | string[]; - -export interface DecodedLogEntry<A> extends LogEntry { - event: string; - args: A; -} - -export interface DecodedLogEntryEvent<A> extends DecodedLogEntry<A> { - removed: boolean; -} - -export interface LogEntryEvent extends LogEntry { - removed: boolean; -} - -export interface LogEntry { - logIndex: number | null; - transactionIndex: number | null; - transactionHash: string; - blockHash: string | null; - blockNumber: number | null; - address: string; - data: string; - topics: string[]; -} - -export interface TxDataPayable extends TxData { - value?: BigNumber; -} - -export interface TransactionReceipt { - blockHash: string; - blockNumber: number; - transactionHash: string; - transactionIndex: number; - from: string; - to: string; - status: null | string | 0 | 1; - cumulativeGasUsed: number; - gasUsed: number; - contractAddress: string | null; - logs: LogEntry[]; -} - -export enum AbiType { - Function = 'function', - Constructor = 'constructor', - Event = 'event', - Fallback = 'fallback', -} - -export type ContractEventArg = string | BigNumber | number; - -export interface DecodedLogArgs { - [argName: string]: ContractEventArg; -} - -export interface LogWithDecodedArgs<ArgsType> extends DecodedLogEntry<ArgsType> {} -export type RawLog = LogEntry; -export enum SolidityTypes { - Address = 'address', - Uint256 = 'uint256', - Uint8 = 'uint8', - Uint = 'uint', -} - -/** - * Contains the logs returned by a TransactionReceipt. We attempt to decode the - * logs using AbiDecoder. If we have the logs corresponding ABI, we decode it, - * otherwise we don't. - */ -export interface TransactionReceiptWithDecodedLogs extends TransactionReceipt { - logs: Array<LogWithDecodedArgs<DecodedLogArgs> | LogEntry>; -} - -// Earliest is omitted by design. It is simply an alias for the `0` constant and -// is thus not very helpful. Moreover, this type is used in places that only accept -// `latest` or `pending`. -export enum BlockParamLiteral { - Latest = 'latest', - Pending = 'pending', -} - -export type BlockParam = BlockParamLiteral | number; - -export interface RawLogEntry { - logIndex: string | null; - transactionIndex: string | null; - transactionHash: string; - blockHash: string | null; - blockNumber: string | null; - address: string; - data: string; - topics: string[]; -} +import { ContractAbi, DecodedLogArgs, LogEntry, LogWithDecodedArgs, TransactionReceipt } from 'ethereum-types'; export interface Order { senderAddress: string; diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json index 932f89ec5..4bae1f437 100644 --- a/packages/typescript-typings/package.json +++ b/packages/typescript-typings/package.json @@ -25,13 +25,12 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/typescript-typings#readme", "dependencies": { - "@0xproject/types": "^0.7.0", + "ethereum-types": "^0.0.1", "bignumber.js": "~4.1.0" }, "devDependencies": { "@0xproject/monorepo-scripts": "^0.1.20", "copyfiles": "^1.2.0", - "make-promises-safe": "^1.1.0", "shx": "^0.2.2" }, "publishConfig": { diff --git a/packages/typescript-typings/types/ethers/index.d.ts b/packages/typescript-typings/types/ethers/index.d.ts index addf85613..d40428a9b 100644 --- a/packages/typescript-typings/types/ethers/index.d.ts +++ b/packages/typescript-typings/types/ethers/index.d.ts @@ -1,5 +1,5 @@ declare module 'ethers' { - import { TxData } from '@0xproject/types'; + import { TxData } from 'ethereum-types'; export interface TransactionDescription { name: string; diff --git a/packages/typescript-typings/types/ganache-core/index.d.ts b/packages/typescript-typings/types/ganache-core/index.d.ts index feeb5721e..84635038f 100644 --- a/packages/typescript-typings/types/ganache-core/index.d.ts +++ b/packages/typescript-typings/types/ganache-core/index.d.ts @@ -1,5 +1,5 @@ declare module 'ganache-core' { - import { Provider } from '@0xproject/types'; + import { Provider } from 'ethereum-types'; export interface GanacheOpts { verbose?: boolean; logger?: { diff --git a/packages/typescript-typings/types/solc/index.d.ts b/packages/typescript-typings/types/solc/index.d.ts index 5a87ac267..571bae101 100644 --- a/packages/typescript-typings/types/solc/index.d.ts +++ b/packages/typescript-typings/types/solc/index.d.ts @@ -114,7 +114,7 @@ declare module 'solc' { message: string; formattedMessage?: string; } - import { ContractAbi } from '@0xproject/types'; + import { ContractAbi } from 'ethereum-types'; export interface StandardContractOutput { abi: ContractAbi; evm: { diff --git a/packages/typescript-typings/types/truffle-hdwalet-provider/index.d.ts b/packages/typescript-typings/types/truffle-hdwalet-provider/index.d.ts index af82557cb..007df61e0 100644 --- a/packages/typescript-typings/types/truffle-hdwalet-provider/index.d.ts +++ b/packages/typescript-typings/types/truffle-hdwalet-provider/index.d.ts @@ -1,5 +1,5 @@ declare module 'truffle-hdwallet-provider' { - import { JSONRPCRequestPayload, JSONRPCResponsePayload, Provider } from '@0xproject/types'; + import { JSONRPCRequestPayload, JSONRPCResponsePayload, Provider } from 'ethereum-types'; class HDWalletProvider implements Provider { constructor(mnemonic: string, rpcUrl: string); public sendAsync( diff --git a/packages/typescript-typings/types/web3-provider-engine/index.d.ts b/packages/typescript-typings/types/web3-provider-engine/index.d.ts index 8d5aef749..1733f2731 100644 --- a/packages/typescript-typings/types/web3-provider-engine/index.d.ts +++ b/packages/typescript-typings/types/web3-provider-engine/index.d.ts @@ -1,5 +1,5 @@ declare module 'web3-provider-engine' { - import { Provider, JSONRPCRequestPayload, JSONRPCResponsePayload } from '@0xproject/types'; + import { Provider, JSONRPCRequestPayload, JSONRPCResponsePayload } from 'ethereum-types'; class Web3ProviderEngine implements Provider { public on(event: string, handler: () => void): void; public send(payload: JSONRPCRequestPayload): void; @@ -23,7 +23,7 @@ declare module 'web3-provider-engine/subproviders/subprovider' { export = Subprovider; } declare module 'web3-provider-engine/subproviders/rpc' { - import { JSONRPCRequestPayload, JSONRPCResponsePayload } from '@0xproject/types'; + import { JSONRPCRequestPayload, JSONRPCResponsePayload } from 'ethereum-types'; class RpcSubprovider { constructor(options: { rpcUrl: string }); public handleRequest( @@ -41,7 +41,7 @@ declare module 'web3-provider-engine/util/rpc-cache-utils' { export = ProviderEngineRpcUtils; } declare module 'web3-provider-engine/subproviders/fixture' { - import { JSONRPCRequestPayload, JSONRPCResponsePayload } from '@0xproject/types'; + import { JSONRPCRequestPayload, JSONRPCResponsePayload } from 'ethereum-types'; class FixtureSubprovider { constructor(staticResponses: any); public handleRequest( diff --git a/packages/typescript-typings/types/web3/index.d.ts b/packages/typescript-typings/types/web3/index.d.ts index 15e7575a8..4085c71a7 100644 --- a/packages/typescript-typings/types/web3/index.d.ts +++ b/packages/typescript-typings/types/web3/index.d.ts @@ -16,7 +16,7 @@ declare module 'web3' { LogEntryEvent, JSONRPCRequestPayload, JSONRPCResponsePayload, - } from '@0xproject/types'; + } from 'ethereum-types'; type MixedData = string | number | object | any[] | BigNumber.BigNumber; diff --git a/packages/utils/package.json b/packages/utils/package.json index 24551dd93..89daadbec 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -35,7 +35,7 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/types": "^0.7.0", + "ethereum-types": "^0.0.1", "@0xproject/typescript-typings": "^0.3.2", "@types/node": "^8.0.53", "ethereumjs-util": "^5.1.1", diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts index d2d8364ca..ed3297ee1 100644 --- a/packages/utils/src/abi_decoder.ts +++ b/packages/utils/src/abi_decoder.ts @@ -8,7 +8,7 @@ import { LogWithDecodedArgs, RawLog, SolidityTypes, -} from '@0xproject/types'; +} from 'ethereum-types'; import * as ethers from 'ethers'; import * as _ from 'lodash'; @@ -22,7 +22,7 @@ export class AbiDecoder { _.forEach(abiArrays, this.addABI.bind(this)); } // This method can only decode logs from the 0x & ERC20 smart contracts - public tryToDecodeLogOrNoop<ArgsType>(log: LogEntry): LogWithDecodedArgs<ArgsType> | RawLog { + public tryToDecodeLogOrNoop<ArgsType extends DecodedLogArgs>(log: LogEntry): LogWithDecodedArgs<ArgsType> | RawLog { const methodId = log.topics[0]; const event = this._methodIds[methodId]; if (_.isUndefined(event)) { diff --git a/packages/utils/src/abi_utils.ts b/packages/utils/src/abi_utils.ts index c4533d42e..b5822425c 100644 --- a/packages/utils/src/abi_utils.ts +++ b/packages/utils/src/abi_utils.ts @@ -1,4 +1,4 @@ -import { AbiDefinition, AbiType, ConstructorAbi, ContractAbi, DataItem, MethodAbi } from '@0xproject/types'; +import { AbiDefinition, AbiType, ConstructorAbi, ContractAbi, DataItem, MethodAbi } from 'ethereum-types'; import * as _ from 'lodash'; export const abiUtils = { diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index 18bbf14a0..9baaba391 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -26,7 +26,8 @@ "postpublish": { "docPublishConfigs": { "extraFileIncludes": [ - "../types/src/index.ts" + "../types/src/index.ts", + "../ethereum-types/src/index.ts" ], "s3BucketPath": "s3://doc-jsons/web3-wrapper/", "s3StagingBucketPath": "s3://staging-doc-jsons/web3-wrapper/" @@ -62,9 +63,9 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/types": "^0.7.0", "@0xproject/typescript-typings": "^0.3.2", "@0xproject/utils": "^0.6.2", + "ethereum-types": "^0.0.1", "ethers": "^3.0.15", "lodash": "^4.17.4", "web3": "^0.20.0" diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index 40a554522..3de152df1 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -1,3 +1,4 @@ +import { AbiDecoder, addressUtils, BigNumber, intervalUtils, promisify } from '@0xproject/utils'; import { BlockParam, BlockWithoutTransactionData, @@ -12,8 +13,7 @@ import { TransactionReceipt, TransactionReceiptWithDecodedLogs, TxData, -} from '@0xproject/types'; -import { AbiDecoder, addressUtils, BigNumber, intervalUtils, promisify } from '@0xproject/utils'; +} from 'ethereum-types'; import * as _ from 'lodash'; import * as Web3 from 'web3'; |