From 2a260edbdb07615f6563ce607d6b286dd786df52 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 29 May 2018 15:42:43 -0700 Subject: [PATCH] Add types for ethereumjs-tx (#26118) --- types/ethereumjs-tx/ethereumjs-tx-tests.ts | 4 ++++ types/ethereumjs-tx/index.d.ts | 19 +++++++++++++++++++ types/ethereumjs-tx/tsconfig.json | 16 ++++++++++++++++ types/ethereumjs-tx/tslint.json | 1 + 4 files changed, 40 insertions(+) create mode 100644 types/ethereumjs-tx/ethereumjs-tx-tests.ts create mode 100644 types/ethereumjs-tx/index.d.ts create mode 100644 types/ethereumjs-tx/tsconfig.json create mode 100644 types/ethereumjs-tx/tslint.json diff --git a/types/ethereumjs-tx/ethereumjs-tx-tests.ts b/types/ethereumjs-tx/ethereumjs-tx-tests.ts new file mode 100644 index 0000000000..393dfd81d7 --- /dev/null +++ b/types/ethereumjs-tx/ethereumjs-tx-tests.ts @@ -0,0 +1,4 @@ +import EthereumjsTx = require('ethereumjs-tx'); + +const txParams = {}; +const tx = new EthereumjsTx(txParams); diff --git a/types/ethereumjs-tx/index.d.ts b/types/ethereumjs-tx/index.d.ts new file mode 100644 index 0000000000..1d52f5f8a4 --- /dev/null +++ b/types/ethereumjs-tx/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for ethereumjs-tx 1.0 +// Project: https://github.com/ethereumjs/ethereumjs-tx +// Definitions by: Leonid Logvinov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare class EthereumTx { + raw: Buffer[]; + r: Buffer; + s: Buffer; + v: Buffer; + nonce: Buffer; + serialize(): Buffer; + sign(buffer: Buffer): void; + getSenderAddress(): Buffer; + constructor(txParams: any); +} +export = EthereumTx; diff --git a/types/ethereumjs-tx/tsconfig.json b/types/ethereumjs-tx/tsconfig.json new file mode 100644 index 0000000000..8909d40844 --- /dev/null +++ b/types/ethereumjs-tx/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "ethereumjs-tx-tests.ts"] +} diff --git a/types/ethereumjs-tx/tslint.json b/types/ethereumjs-tx/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ethereumjs-tx/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }