Create ethers-typescript-typings

This commit is contained in:
Leonid Logvinov 2018-02-26 17:03:09 -08:00
parent a5ef1db0c5
commit 34c1134b55
No known key found for this signature in database
GPG Key ID: 0DD294BFDE8C95D4
9 changed files with 94 additions and 58 deletions

View File

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

View File

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

View File

@ -0,0 +1,3 @@
.*
yarn-error.log
/scripts/

View File

@ -0,0 +1,5 @@
# CHANGELOG
## v0.0.1 - _TBD, 2018_
* Initial types (#413)

View File

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

View File

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

View File

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

View File

@ -0,0 +1,5 @@
const postpublish_utils = require('../../../scripts/postpublish_utils');
const packageJSON = require('../package.json');
const subPackageName = packageJSON.name;
postpublish_utils.standardPostPublishAsync(subPackageName);

View File

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