Introduce ethereum-types package

This commit is contained in:
Leonid Logvinov 2018-05-30 14:41:36 -07:00
parent c284f6dcd4
commit a7fc9caacb
No known key found for this signature in database
GPG Key ID: 0DD294BFDE8C95D4
81 changed files with 511 additions and 361 deletions

View File

@ -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",

View File

@ -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';

View File

@ -1,4 +1,4 @@
import { EventAbi, MethodAbi } from '@0xproject/types';
import { EventAbi, MethodAbi } from 'ethereum-types';
export enum ParamKind {
Input = 'input',

View File

@ -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';

View File

@ -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",

View File

@ -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';

View File

@ -1,4 +1,4 @@
import { DataItem } from '@0xproject/types';
import { DataItem } from 'ethereum-types';
import * as _ from 'lodash';
// tslint:disable-next-line:completed-docs

View File

@ -6,7 +6,7 @@
// 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';

View File

@ -1,4 +1,4 @@
export interface {{name}}ContractEventArgs {
export interface {{name}}ContractEventArgs extends DecodedLogArgs {
{{#each inputs}}
{{name}}: {{#returnType type components}}{{/returnType}};
{{/each}}

View File

@ -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",

View File

@ -1,4 +1,4 @@
import { Provider } from '@0xproject/types';
import { Provider } from 'ethereum-types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';

View File

@ -1,5 +1,5 @@
import { generatePseudoRandomSalt } from '@0xproject/order-utils';
import { Provider } from '@0xproject/types';
import { Provider } from 'ethereum-types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';

View File

@ -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';

View File

@ -1,13 +1,7 @@
import { ContractArtifact } from '@0xproject/sol-compiler';
import {
AbiDefinition,
LogEntry,
LogWithDecodedArgs,
RawLog,
TransactionReceiptWithDecodedLogs,
} from '@0xproject/types';
import { AbiDecoder, BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { AbiDefinition, LogEntry, LogWithDecodedArgs, RawLog, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import { artifacts } from './artifacts';

View File

@ -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';

View File

@ -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';

View File

@ -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]: {

View File

@ -1,6 +1,6 @@
import { devConstants, env, EnvVars, web3Factory } from '@0xproject/dev-utils';
import { prependSubprovider } from '@0xproject/subproviders';
import { Provider } from '@0xproject/types';
import { Provider } from 'ethereum-types';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { coverage } from './coverage';

View File

@ -1,5 +1,5 @@
import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { LogWithDecodedArgs } from '@0xproject/types';
import { LogWithDecodedArgs } from 'ethereum-types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import * as _ from 'lodash';

View File

@ -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';

View File

@ -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';

View File

@ -1,5 +1,5 @@
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from '@0xproject/types';
import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import BN = require('bn.js');

View File

@ -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';

View File

@ -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';

View File

@ -45,7 +45,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",

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -0,0 +1,6 @@
.*
yarn-error.log
/scripts/
/src/
tsconfig.json
/lib/monorepo_scripts/

View File

@ -0,0 +1,10 @@
[
{
"version": "0.0.1",
"changes": [
{
"note": "Initial publish"
}
]
}
]

View File

@ -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
```

View File

@ -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/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"
}
}

View File

@ -0,0 +1,6 @@
declare module '*.json' {
const json: any;
/* tslint:disable */
export default json;
/* tslint:enable */
}

View File

@ -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>;
}

View File

@ -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);

View File

@ -0,0 +1,8 @@
{
"extends": "../../tsconfig",
"compilerOptions": {
"typeRoots": ["../../node_modules/@types"],
"outDir": "lib"
},
"include": ["src/**/*"]
}

View File

@ -0,0 +1,3 @@
{
"extends": ["@0xproject/tslint-config"]
}

View File

@ -1,6 +1,6 @@
import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils';
import { ContractArtifact } from '@0xproject/sol-compiler';
import { LogWithDecodedArgs } from '@0xproject/types';
import { LogWithDecodedArgs } from 'ethereum-types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';

View File

@ -1,6 +1,6 @@
#!/usr/bin/env node
import { devConstants, web3Factory } from '@0xproject/dev-utils';
import { Provider } from '@0xproject/types';
import { Provider } from 'ethereum-types';
import { logUtils } from '@0xproject/utils';
import * as path from 'path';
import * as yargs from 'yargs';

View File

@ -1,4 +1,4 @@
import { Provider, TxData } from '@0xproject/types';
import { Provider, TxData } from 'ethereum-types';
import { BigNumber, NULL_BYTES } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';

View File

@ -1,4 +1,4 @@
import { Provider, TxData } from '@0xproject/types';
import { Provider, TxData } from 'ethereum-types';
import { BigNumber, NULL_BYTES } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';

View File

@ -80,6 +80,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",

View File

@ -11,7 +11,7 @@ import {
Resolver,
URLResolver,
} from '@0xproject/sol-resolver';
import { ContractAbi } from '@0xproject/types';
import { ContractAbi } from 'ethereum-types';
import { logUtils, promisify } from '@0xproject/utils';
import chalk from 'chalk';
import * as ethUtil from 'ethereumjs-util';

View File

@ -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';

View File

@ -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';

View File

@ -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 };

View File

@ -48,9 +48,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",

View File

@ -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';

View File

@ -1,4 +1,4 @@
import { OpCode, StructLog, TransactionTrace } from '@0xproject/types';
import { OpCode, StructLog, TransactionTrace } from 'ethereum-types';
import { addressUtils, BigNumber, logUtils } from '@0xproject/utils';
import { addHexPrefix, stripHexPrefix } from 'ethereumjs-util';
import * as fs from 'fs';

View File

@ -1,4 +1,4 @@
import { OpCode, StructLog } from '@0xproject/types';
import { OpCode, StructLog } from 'ethereum-types';
import * as chai from 'chai';
import * as fs from 'fs';
import * as _ from 'lodash';

View File

@ -45,6 +45,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",

View File

@ -1,5 +1,5 @@
import { assert } from '@0xproject/assert';
import { JSONRPCRequestPayload, JSONRPCResponsePayload } from '@0xproject/types';
import { JSONRPCRequestPayload, JSONRPCResponsePayload } from 'ethereum-types';
import { addressUtils } from '@0xproject/utils';
import * as _ from 'lodash';

View File

@ -1,4 +1,4 @@
import { JSONRPCRequestPayload } from '@0xproject/types';
import { JSONRPCRequestPayload } from 'ethereum-types';
import { Callback, ErrorCallback } from '../types';

View File

@ -1,4 +1,4 @@
import { JSONRPCRequestPayload } from '@0xproject/types';
import { JSONRPCRequestPayload } from 'ethereum-types';
import { Callback, ErrorCallback } from '../types';

View File

@ -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';

View File

@ -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';

View File

@ -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');

View File

@ -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';

View File

@ -1,4 +1,4 @@
import { JSONRPCRequestPayload, JSONRPCResponsePayload } from '@0xproject/types';
import { JSONRPCRequestPayload, JSONRPCResponsePayload } from 'ethereum-types';
import { promisify } from '@0xproject/utils';
import * as Web3 from 'web3';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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');

View File

@ -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",

View File

@ -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';

View File

@ -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"

View File

@ -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;

View File

@ -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": {

View File

@ -1,5 +1,5 @@
declare module 'ethers' {
import { TxData } from '@0xproject/types';
import { TxData } from 'ethereum-types';
export interface TransactionDescription {
name: string;

View File

@ -1,5 +1,5 @@
declare module 'ganache-core' {
import { Provider } from '@0xproject/types';
import { Provider } from 'ethereum-types';
export interface GanacheOpts {
verbose?: boolean;
logger?: {

View File

@ -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: {

View File

@ -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(

View File

@ -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(

View File

@ -16,7 +16,7 @@ declare module 'web3' {
LogEntryEvent,
JSONRPCRequestPayload,
JSONRPCResponsePayload,
} from '@0xproject/types';
} from 'ethereum-types';
type MixedData = string | number | object | any[] | BigNumber.BigNumber;

View File

@ -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",

View File

@ -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)) {

View File

@ -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 = {

View File

@ -62,9 +62,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"

View File

@ -12,7 +12,7 @@ import {
TransactionReceipt,
TransactionReceiptWithDecodedLogs,
TxData,
} from '@0xproject/types';
} from 'ethereum-types';
import { AbiDecoder, addressUtils, BigNumber, intervalUtils, promisify } from '@0xproject/utils';
import * as _ from 'lodash';
import * as Web3 from 'web3';