aboutsummaryrefslogtreecommitdiffstats
path: root/packages/types
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-06-02 04:05:17 +0800
committerFabio Berger <me@fabioberger.com>2018-06-02 04:05:17 +0800
commitb7b45b69a66cfaf9c3737d1a8d95be21edccf527 (patch)
tree4337613836a8062bd73fc8ee1e4db444961df172 /packages/types
parentdf9cfe7840b99d72ed95058e47f2ffb6623d440e (diff)
parent9ca41b9536908dddfa51854abd41b7926e69bd09 (diff)
downloaddexon-sol-tools-b7b45b69a66cfaf9c3737d1a8d95be21edccf527.tar
dexon-sol-tools-b7b45b69a66cfaf9c3737d1a8d95be21edccf527.tar.gz
dexon-sol-tools-b7b45b69a66cfaf9c3737d1a8d95be21edccf527.tar.bz2
dexon-sol-tools-b7b45b69a66cfaf9c3737d1a8d95be21edccf527.tar.lz
dexon-sol-tools-b7b45b69a66cfaf9c3737d1a8d95be21edccf527.tar.xz
dexon-sol-tools-b7b45b69a66cfaf9c3737d1a8d95be21edccf527.tar.zst
dexon-sol-tools-b7b45b69a66cfaf9c3737d1a8d95be21edccf527.zip
Merge branch 'v2-prototype' into refactor/order-utils/for-v2
* v2-prototype: (33 commits) Only show ProviderDisplay in portal Improve sol-cov docs Remove old parse code Refactor order parser and add shared order support to new portal Add generate and fill order routes Address feedback Override ethereumjs-tx version Fix missing key Update placeholder param ordering Change userEtherBalanceInWei to optional so we can know if its loading Add loading state to ProviderDisplay Tweaks Add Placeholder component Add StandardIconRow Split render into loading and loaaded Fix linter errors Fix linter errors Add ethereum-types to extraFileIncludes Introduce ethereum-types package Remove merge conflicts from yarn.lock ... # Conflicts: # packages/contracts/src/utils/exchange_wrapper.ts # packages/contracts/src/utils/match_order_tester.ts # packages/contracts/src/utils/types.ts # packages/contracts/test/exchange/core.ts # packages/contracts/test/exchange/match_orders.ts # packages/contracts/test/libraries/lib_bytes.ts # packages/sol-cov/package.json
Diffstat (limited to 'packages/types')
-rw-r--r--packages/types/package.json3
-rw-r--r--packages/types/src/index.ts282
2 files changed, 3 insertions, 282 deletions
diff --git a/packages/types/package.json b/packages/types/package.json
index e70546bd3..95b7721d3 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 b1d6f97cb..8bd6e097e 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;