diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-27 09:03:09 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-28 04:06:02 +0800 |
commit | 34c1134b55c202b47ac4672a4c9025e4be9e21b4 (patch) | |
tree | 2a4f75240fc3a085ea4f91e8fb462cb7ba618125 | |
parent | a5ef1db0c56e4166641c19b46641921a3b1e509f (diff) | |
download | dexon-sol-tools-34c1134b55c202b47ac4672a4c9025e4be9e21b4.tar.gz dexon-sol-tools-34c1134b55c202b47ac4672a4c9025e4be9e21b4.tar.zst dexon-sol-tools-34c1134b55c202b47ac4672a4c9025e4be9e21b4.zip |
Create ethers-typescript-typings
-rw-r--r-- | packages/0x.js/src/globals.d.ts | 29 | ||||
-rw-r--r-- | packages/contracts/globals.d.ts | 29 | ||||
-rw-r--r-- | packages/ethers-typescript-typings/.npmignore | 3 | ||||
-rw-r--r-- | packages/ethers-typescript-typings/CHANGELOG.md | 5 | ||||
-rw-r--r-- | packages/ethers-typescript-typings/README.md | 49 | ||||
-rw-r--r-- | packages/ethers-typescript-typings/index.d.ts (renamed from packages/utils/src/globals.d.ts) | 1 | ||||
-rw-r--r-- | packages/ethers-typescript-typings/package.json | 28 | ||||
-rw-r--r-- | packages/ethers-typescript-typings/scripts/postpublish.js | 5 | ||||
-rw-r--r-- | packages/ethers-typescript-typings/tslint.json | 3 |
9 files changed, 94 insertions, 58 deletions
diff --git a/packages/0x.js/src/globals.d.ts b/packages/0x.js/src/globals.d.ts index 505f9b933..0e103d057 100644 --- a/packages/0x.js/src/globals.d.ts +++ b/packages/0x.js/src/globals.d.ts @@ -41,32 +41,3 @@ declare module 'truffle-hdwallet-provider' { } export = HDWalletProvider; } - -declare module 'ethers-contracts' { - export interface TransactionDescription { - name: string; - signature: string; - sighash: string; - data: string; - } - export interface CallDescription extends TransactionDescription { - parse: (...args: any[]) => any; - } - export interface FunctionDescription { - (...params: any[]): TransactionDescription | CallDescription; - inputs: { names: string[]; types: string[] }; - outputs: { names: string[]; types: string[] }; - } - export interface EventDescription { - inputs: { names: string[]; types: string[] }; - signature: string; - topic: string; - } - // tslint:disable-next-line:max-classes-per-file - export class Interface { - public functions: { [functionName: string]: FunctionDescription }; - public events: { [eventName: string]: EventDescription }; - public static decodeParams(types: string[], data: string): any[]; - constructor(abi: any); - } -} diff --git a/packages/contracts/globals.d.ts b/packages/contracts/globals.d.ts index beb3bfd8c..0e6586a4b 100644 --- a/packages/contracts/globals.d.ts +++ b/packages/contracts/globals.d.ts @@ -32,32 +32,3 @@ declare module 'ethereumjs-abi' { const soliditySHA3: (argTypes: string[], args: any[]) => Buffer; const methodID: (name: string, types: string[]) => Buffer; } - -declare module 'ethers-contracts' { - export interface TransactionDescription { - name: string; - signature: string; - sighash: string; - data: string; - } - export interface CallDescription extends TransactionDescription { - parse: (...args: any[]) => any; - } - export interface FunctionDescription { - (...params: any[]): TransactionDescription | CallDescription; - inputs: { names: string[]; types: string[] }; - outputs: { names: string[]; types: string[] }; - } - export interface EventDescription { - inputs: { names: string[]; types: string[] }; - signature: string; - topic: string; - } - // tslint:disable-next-line:max-classes-per-file - export class Interface { - public functions: { [functionName: string]: FunctionDescription }; - public events: { [eventName: string]: EventDescription }; - public static decodeParams(types: string[], data: string): any[]; - constructor(abi: any); - } -} diff --git a/packages/ethers-typescript-typings/.npmignore b/packages/ethers-typescript-typings/.npmignore new file mode 100644 index 000000000..104d718ed --- /dev/null +++ b/packages/ethers-typescript-typings/.npmignore @@ -0,0 +1,3 @@ +.* +yarn-error.log +/scripts/ diff --git a/packages/ethers-typescript-typings/CHANGELOG.md b/packages/ethers-typescript-typings/CHANGELOG.md new file mode 100644 index 000000000..d67d5c73d --- /dev/null +++ b/packages/ethers-typescript-typings/CHANGELOG.md @@ -0,0 +1,5 @@ +# CHANGELOG + +## v0.0.1 - _TBD, 2018_ + + * Initial types (#413) diff --git a/packages/ethers-typescript-typings/README.md b/packages/ethers-typescript-typings/README.md new file mode 100644 index 000000000..56ce5f138 --- /dev/null +++ b/packages/ethers-typescript-typings/README.md @@ -0,0 +1,49 @@ +## ethers-typescript-typings + +There currently isn't an official [Ethers][ethers] +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]. + +[ethers]: https://github.com/ethers-io/ethers.js +[definitelytyped]: https://github.com/DefinitelyTyped/DefinitelyTyped + +## Installation + +```bash +yarn add -D ethers-typescript-typings +``` + +## Usage + +Add the following line within an `include` section of your `tsconfig.json` + +```json +"./node_modules/ethers-typescript-typings/index.d.ts" +``` + +## 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 +``` + +Then install dependencies + +```bash +yarn install +``` + +### Lint + +```bash +yarn lint +``` diff --git a/packages/utils/src/globals.d.ts b/packages/ethers-typescript-typings/index.d.ts index 951ef6ea2..f4f99b890 100644 --- a/packages/utils/src/globals.d.ts +++ b/packages/ethers-typescript-typings/index.d.ts @@ -23,6 +23,7 @@ declare module 'ethers-contracts' { export class Interface { public functions: { [functionName: string]: FunctionDescription }; public events: { [eventName: string]: EventDescription }; + public static decodeParams(types: string[], data: string): any[]; constructor(abi: any); } } diff --git a/packages/ethers-typescript-typings/package.json b/packages/ethers-typescript-typings/package.json new file mode 100644 index 000000000..0e6f517c8 --- /dev/null +++ b/packages/ethers-typescript-typings/package.json @@ -0,0 +1,28 @@ +{ + "name": "ethers-typescript-typings", + "version": "0.0.1", + "description": "Typescript type definitions for ethers.js", + "main": "index.d.ts", + "types": "index.d.ts", + "scripts": { + "lint": "tslint index.d.ts" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/0xProject/0x.js.git" + }, + "author": "Fabio Berger", + "contributors": [ + "Leonid Logvinov <logvinov.leon@gmail.com>" + ], + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/0xProject/0x.js/issues" + }, + "homepage": "https://github.com/0xProject/0x.js/packages/ethers-typescript-typings#readme", + "devDependencies": { + "tslint": "5.8.0", + "tslint-config-0xproject": "^0.0.2", + "typescript": "2.7.1" + } +} diff --git a/packages/ethers-typescript-typings/scripts/postpublish.js b/packages/ethers-typescript-typings/scripts/postpublish.js new file mode 100644 index 000000000..b3e5407c8 --- /dev/null +++ b/packages/ethers-typescript-typings/scripts/postpublish.js @@ -0,0 +1,5 @@ +const postpublish_utils = require('../../../scripts/postpublish_utils'); +const packageJSON = require('../package.json'); + +const subPackageName = packageJSON.name; +postpublish_utils.standardPostPublishAsync(subPackageName);
\ No newline at end of file diff --git a/packages/ethers-typescript-typings/tslint.json b/packages/ethers-typescript-typings/tslint.json new file mode 100644 index 000000000..9a93a1f74 --- /dev/null +++ b/packages/ethers-typescript-typings/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": ["tslint-config-0xproject"] +} |