aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-01-05 02:08:20 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-01-10 18:24:37 +0800
commita3274ac9b1f972f58f9e3b7ca5fc45829c4a1cd2 (patch)
tree53c9193bbd976ca1aefd23486d9e54074c405af1 /packages
parent2e67d69434e5e3ddedb6f889cf960038965a2812 (diff)
downloaddexon-0x-contracts-a3274ac9b1f972f58f9e3b7ca5fc45829c4a1cd2.tar
dexon-0x-contracts-a3274ac9b1f972f58f9e3b7ca5fc45829c4a1cd2.tar.gz
dexon-0x-contracts-a3274ac9b1f972f58f9e3b7ca5fc45829c4a1cd2.tar.bz2
dexon-0x-contracts-a3274ac9b1f972f58f9e3b7ca5fc45829c4a1cd2.tar.lz
dexon-0x-contracts-a3274ac9b1f972f58f9e3b7ca5fc45829c4a1cd2.tar.xz
dexon-0x-contracts-a3274ac9b1f972f58f9e3b7ca5fc45829c4a1cd2.tar.zst
dexon-0x-contracts-a3274ac9b1f972f58f9e3b7ca5fc45829c4a1cd2.zip
Import web3-typescript-typings to monorepo
Diffstat (limited to 'packages')
-rw-r--r--packages/web3-typescript-typings/LICENSE13
-rw-r--r--packages/web3-typescript-typings/README.md56
-rw-r--r--packages/web3-typescript-typings/package.json58
-rw-r--r--packages/web3-typescript-typings/tslint.json4
-rw-r--r--packages/web3-typescript-typings/web3/index.d.ts150
5 files changed, 162 insertions, 119 deletions
diff --git a/packages/web3-typescript-typings/LICENSE b/packages/web3-typescript-typings/LICENSE
deleted file mode 100644
index fcdd2b880..000000000
--- a/packages/web3-typescript-typings/LICENSE
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright 2017 ZeroEx Inc.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/packages/web3-typescript-typings/README.md b/packages/web3-typescript-typings/README.md
index 8d92aa681..e26bf87e4 100644
--- a/packages/web3-typescript-typings/README.md
+++ b/packages/web3-typescript-typings/README.md
@@ -1,25 +1,49 @@
-Web3 Typescript Type Definition
--------------------------------
+## web3-typescript-typings
-There currently isn't an official [Web3][Web3]
-type definition included in the [DefinitelyTyped][DefinitelyTyped] project.
+There currently isn't an official [Web3][web3]
+type definition included in the [DefinitelyTyped][definitelytyped] project.
Until that happens, we will continue to improve our own type definition.
-If it get's close to comprehensive, we'll add it to [DefinitelyTyped][DefinitelyTyped].
+If it get's close to comprehensive, we'll add it to [DefinitelyTyped][definitelytyped].
-[Web3]: https://github.com/ethereum/web3.js/
-[DefinitelyTyped]: https://github.com/DefinitelyTyped/DefinitelyTyped
+[web3]: https://github.com/ethereum/web3.js/
+[definitelytyped]: https://github.com/DefinitelyTyped/DefinitelyTyped
-# Installation
-Using npm:
-```
-npm install --save-dev web3-typescript-typings
+## Installation
+
+```bash
+yarn add -D web3-typescript-typings
```
-Using yarn:
+
+## Usage
+
+Add the following lines to compilerOptions section of your `tsconfig.json`
+
+```json
+"typeRoots": ["node_modules/@types", "node_modules/web3-typescript-typings"]
```
-yarn add web3-typescript-typings -D
+
+## Contributing
+
+We strongly encourage that the community help us make improvements and determine the future direction of the protocol. 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
```
-Also don't forget to manually include the definitions within the `typeRoots` section of your `tsconfig.json`
+
+Then install dependencies
+
+```bash
+yarn install
```
-"typeRoots": ["node_modules/@types", "node_modules/web3-typescript-typings"]
+
+### Lint
+
+```bash
+yarn lint
```
-And you're ready to go to a bright type-safe and distributed future!
diff --git a/packages/web3-typescript-typings/package.json b/packages/web3-typescript-typings/package.json
index 29bcb964c..f93382fc7 100644
--- a/packages/web3-typescript-typings/package.json
+++ b/packages/web3-typescript-typings/package.json
@@ -1,32 +1,30 @@
{
- "name": "web3-typescript-typings",
- "version": "0.9.0",
- "description": "Typescript type definitions for web3",
- "main": "web3/index.d.ts",
- "types": "web3/index.d.ts",
- "scripts": {
- "lint": "tslint web3/index.d.ts"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/0xProject/web3-typescript-typings.git"
- },
- "author": "Fabio Berger",
- "contributors": [
- "Leonid Logvinov <logvinov.leon@gmail.com>"
- ],
- "license": "Apache-2.0",
- "bugs": {
- "url": "https://github.com/0xProject/web3-typescript-typings/issues"
- },
- "homepage": "https://github.com/0xProject/web3-typescript-typings#readme",
- "devDependencies": {
- "@types/bignumber.js": "^4.0.2",
- "tslint": "^5.5.0",
- "tslint-config-0xproject": "^0.0.2",
- "typescript": "^2.4.2"
- },
- "dependencies": {
- "bignumber.js": "^4.0.2"
- }
+ "name": "web3-typescript-typings",
+ "version": "0.9.0",
+ "description": "Typescript type definitions for web3",
+ "main": "web3/index.d.ts",
+ "types": "web3/index.d.ts",
+ "scripts": {
+ "lint": "tslint web3/index.d.ts"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/0xProject/web3-typescript-typings.git"
+ },
+ "author": "Fabio Berger",
+ "contributors": ["Leonid Logvinov <logvinov.leon@gmail.com>"],
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/web3-typescript-typings/issues"
+ },
+ "homepage": "https://github.com/0xProject/web3-typescript-typings#readme",
+ "devDependencies": {
+ "@types/bignumber.js": "^4.0.2",
+ "tslint": "^5.5.0",
+ "tslint-config-0xproject": "^0.0.2",
+ "typescript": "^2.4.2"
+ },
+ "dependencies": {
+ "bignumber.js": "~4.1.0"
+ }
}
diff --git a/packages/web3-typescript-typings/tslint.json b/packages/web3-typescript-typings/tslint.json
index 5842a872a..9a93a1f74 100644
--- a/packages/web3-typescript-typings/tslint.json
+++ b/packages/web3-typescript-typings/tslint.json
@@ -1,5 +1,3 @@
{
- "extends": [
- "tslint-config-0xproject"
- ]
+ "extends": ["tslint-config-0xproject"]
}
diff --git a/packages/web3-typescript-typings/web3/index.d.ts b/packages/web3-typescript-typings/web3/index.d.ts
index 8ecb8420f..6fd126d2a 100644
--- a/packages/web3-typescript-typings/web3/index.d.ts
+++ b/packages/web3-typescript-typings/web3/index.d.ts
@@ -1,8 +1,7 @@
declare module 'web3' {
-
import * as BigNumber from 'bignumber.js';
- type MixedData = string|number|object|any[]|BigNumber.BigNumber;
+ type MixedData = string | number | object | any[] | BigNumber.BigNumber;
class Web3 {
public static providers: typeof providers;
@@ -22,12 +21,12 @@ declare module 'web3' {
public toAscii(hex: string): string;
public fromAscii(ascii: string, padding?: number): string;
public toDecimal(hex: string): number;
- public fromDecimal(value: number|string): string;
- public fromWei(value: number|string, unit: Web3.Unit): string;
+ public fromDecimal(value: number | string): string;
+ public fromWei(value: number | string, unit: Web3.Unit): string;
public fromWei(value: BigNumber.BigNumber, unit: Web3.Unit): BigNumber.BigNumber;
- public toWei(amount: number|string, unit: Web3.Unit): string;
+ public toWei(amount: number | string, unit: Web3.Unit): string;
public toWei(amount: BigNumber.BigNumber, unit: Web3.Unit): BigNumber.BigNumber;
- public toBigNumber(value: number|string): BigNumber.BigNumber;
+ public toBigNumber(value: number | string): BigNumber.BigNumber;
public isAddress(address: string): boolean;
public isChecksumAddress(address: string): boolean;
public sha3(value: string, options?: Web3.Sha3Options): string;
@@ -46,9 +45,9 @@ declare module 'web3' {
namespace Web3 {
type ContractAbi = AbiDefinition[];
- type AbiDefinition = FunctionAbi|EventAbi;
+ type AbiDefinition = FunctionAbi | EventAbi;
- type FunctionAbi = MethodAbi|ConstructorAbi|FallbackAbi;
+ type FunctionAbi = MethodAbi | ConstructorAbi | FallbackAbi;
enum AbiType {
Function = 'function',
@@ -112,13 +111,13 @@ declare module 'web3' {
}
interface FilterObject {
- fromBlock?: number|string;
- toBlock?: number|string;
+ fromBlock?: number | string;
+ toBlock?: number | string;
address?: string;
topics?: LogTopic[];
}
- type LogTopic = null|string|string[];
+ type LogTopic = null | string | string[];
interface DecodedLogEntry<A> extends LogEntry {
event: string;
@@ -174,7 +173,7 @@ declare module 'web3' {
defaultBlock: Web3.BlockParam;
syncing: Web3.SyncingResult;
compile: {
- solidity(sourceString: string, cb?: (err: Error, result: any) => void): object,
+ solidity(sourceString: string, cb?: (err: Error, result: any) => void): object;
};
getMining(cd: (err: Error, mining: boolean) => void): void;
getHashrate(cd: (err: Error, hashrate: number) => void): void;
@@ -184,32 +183,53 @@ declare module 'web3' {
getSyncing(cd: (err: Error, syncing: Web3.SyncingResult) => void): void;
isSyncing(cb: (err: Error, isSyncing: boolean, syncingState: Web3.SyncingState) => void): Web3.IsSyncing;
- getBlock(hashStringOrBlockNumber: string|Web3.BlockParam): Web3.BlockWithoutTransactionData;
- getBlock(hashStringOrBlockNumber: string|Web3.BlockParam,
- callback: (err: Error, blockObj: Web3.BlockWithoutTransactionData) => void): void;
- getBlock(hashStringOrBlockNumber: string|Web3.BlockParam,
- returnTransactionObjects: true): Web3.BlockWithTransactionData;
- getBlock(hashStringOrBlockNumber: string|Web3.BlockParam, returnTransactionObjects: true,
- callback: (err: Error, blockObj: Web3.BlockWithTransactionData) => void): void;
+ getBlock(hashStringOrBlockNumber: string | Web3.BlockParam): Web3.BlockWithoutTransactionData;
+ getBlock(
+ hashStringOrBlockNumber: string | Web3.BlockParam,
+ callback: (err: Error, blockObj: Web3.BlockWithoutTransactionData) => void,
+ ): void;
+ getBlock(
+ hashStringOrBlockNumber: string | Web3.BlockParam,
+ returnTransactionObjects: true,
+ ): Web3.BlockWithTransactionData;
+ getBlock(
+ hashStringOrBlockNumber: string | Web3.BlockParam,
+ returnTransactionObjects: true,
+ callback: (err: Error, blockObj: Web3.BlockWithTransactionData) => void,
+ ): void;
- getBlockTransactionCount(hashStringOrBlockNumber: string|Web3.BlockParam): number;
- getBlockTransactionCount(hashStringOrBlockNumber: string|Web3.BlockParam,
- callback: (err: Error, blockTransactionCount: number) => void): void;
+ getBlockTransactionCount(hashStringOrBlockNumber: string | Web3.BlockParam): number;
+ getBlockTransactionCount(
+ hashStringOrBlockNumber: string | Web3.BlockParam,
+ callback: (err: Error, blockTransactionCount: number) => void,
+ ): void;
// TODO returnTransactionObjects
- getUncle(hashStringOrBlockNumber: string|Web3.BlockParam,
- uncleNumber: number): Web3.BlockWithoutTransactionData;
- getUncle(hashStringOrBlockNumber: string|Web3.BlockParam, uncleNumber: number,
- callback: (err: Error, uncle: Web3.BlockWithoutTransactionData) => void): void;
+ getUncle(
+ hashStringOrBlockNumber: string | Web3.BlockParam,
+ uncleNumber: number,
+ ): Web3.BlockWithoutTransactionData;
+ getUncle(
+ hashStringOrBlockNumber: string | Web3.BlockParam,
+ uncleNumber: number,
+ callback: (err: Error, uncle: Web3.BlockWithoutTransactionData) => void,
+ ): void;
getTransaction(transactionHash: string): Web3.Transaction;
- getTransaction(transactionHash: string,
- callback: (err: Error, transaction: Web3.Transaction) => void): void;
+ getTransaction(
+ transactionHash: string,
+ callback: (err: Error, transaction: Web3.Transaction) => void,
+ ): void;
- getTransactionFromBlock(hashStringOrBlockNumber: string|Web3.BlockParam,
- indexNumber: number): Web3.Transaction;
- getTransactionFromBlock(hashStringOrBlockNumber: string|Web3.BlockParam, indexNumber: number,
- callback: (err: Error, transaction: Web3.Transaction) => void): void;
+ getTransactionFromBlock(
+ hashStringOrBlockNumber: string | Web3.BlockParam,
+ indexNumber: number,
+ ): Web3.Transaction;
+ getTransactionFromBlock(
+ hashStringOrBlockNumber: string | Web3.BlockParam,
+ indexNumber: number,
+ callback: (err: Error, transaction: Web3.Transaction) => void,
+ ): void;
contract(abi: Web3.AbiDefinition[]): Web3.Contract<any>;
@@ -225,7 +245,7 @@ declare module 'web3' {
getCode(addressHexString: string): string;
getCode(addressHexString: string, callback: (err: Error, code: string) => void): void;
- filter(value: string|Web3.FilterObject): Web3.FilterResult;
+ filter(value: string | Web3.FilterObject): Web3.FilterResult;
sendTransaction(txData: Web3.TxData): string;
sendTransaction(txData: Web3.TxData, callback: (err: Error, value: string) => void): void;
@@ -237,8 +257,10 @@ declare module 'web3' {
sign(address: string, data: string, callback: (err: Error, signature: string) => void): void;
getTransactionReceipt(txHash: string): Web3.TransactionReceipt;
- getTransactionReceipt(txHash: string,
- callback: (err: Error, receipt: Web3.TransactionReceipt) => void): void;
+ getTransactionReceipt(
+ txHash: string,
+ callback: (err: Error, receipt: Web3.TransactionReceipt) => void,
+ ): void;
// TODO block param
call(callData: Web3.CallData): string;
@@ -280,17 +302,31 @@ declare module 'web3' {
getPeerCount(cd: (err: Error, peerCount: number) => void): void;
}
- type BlockParam = number|'earliest'|'latest'|'pending';
-
- type Unit = 'kwei'|'ada'|'mwei'|'babbage'|'gwei'|'shannon'|'szabo'|'finney'|
- 'ether'|'kether'|'grand'|'einstein'|'mether'|'gether'|'tether';
+ type BlockParam = number | 'earliest' | 'latest' | 'pending';
+
+ type Unit =
+ | 'kwei'
+ | 'ada'
+ | 'mwei'
+ | 'babbage'
+ | 'gwei'
+ | 'shannon'
+ | 'szabo'
+ | 'finney'
+ | 'ether'
+ | 'kether'
+ | 'grand'
+ | 'einstein'
+ | 'mether'
+ | 'gether'
+ | 'tether';
interface SyncingState {
startingBlock: number;
currentBlock: number;
highestBlock: number;
}
- type SyncingResult = false|SyncingState;
+ type SyncingResult = false | SyncingState;
interface IsSyncing {
addCallback(cb: (err: Error, isSyncing: boolean, syncingState: SyncingState) => void): void;
@@ -298,12 +334,12 @@ declare module 'web3' {
}
interface AbstractBlock {
- number: number|null;
- hash: string|null;
+ number: number | null;
+ hash: string | null;
parentHash: string;
- nonce: string|null;
+ nonce: string | null;
sha3Uncles: string;
- logsBloom: string|null;
+ logsBloom: string | null;
transactionsRoot: string;
stateRoot: string;
miner: string;
@@ -326,11 +362,11 @@ declare module 'web3' {
interface Transaction {
hash: string;
nonce: number;
- blockHash: string|null;
- blockNumber: number|null;
- transactionIndex: number|null;
+ blockHash: string | null;
+ blockNumber: number | null;
+ transactionIndex: number | null;
from: string;
- to: string|null;
+ to: string | null;
value: BigNumber.BigNumber;
gasPrice: BigNumber.BigNumber;
gas: number;
@@ -339,9 +375,9 @@ declare module 'web3' {
interface CallTxDataBase {
to?: string;
- value?: number|string|BigNumber.BigNumber;
- gas?: number|string|BigNumber.BigNumber;
- gasPrice?: number|string|BigNumber.BigNumber;
+ value?: number | string | BigNumber.BigNumber;
+ gas?: number | string | BigNumber.BigNumber;
+ gasPrice?: number | string | BigNumber.BigNumber;
data?: string;
nonce?: number;
}
@@ -361,19 +397,19 @@ declare module 'web3' {
transactionIndex: number;
from: string;
to: string;
- status: null|string|0|1;
+ status: null | string | 0 | 1;
cumulativeGasUsed: number;
gasUsed: number;
- contractAddress: string|null;
+ contractAddress: string | null;
logs: LogEntry[];
}
interface LogEntry {
- logIndex: number|null;
- transactionIndex: number|null;
+ logIndex: number | null;
+ transactionIndex: number | null;
transactionHash: string;
- blockHash: string|null;
- blockNumber: number|null;
+ blockHash: string | null;
+ blockNumber: number | null;
address: string;
data: string;
topics: string[];