From fd7b55866ab88acbf67c9fed0c885ff5c4255b46 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 29 May 2018 15:22:57 -0700 Subject: [PATCH] Add types for hdkey --- types/hdkey/hdkey-tests.ts | 6 ++++++ types/hdkey/index.d.ts | 16 ++++++++++++++++ types/hdkey/tsconfig.json | 16 ++++++++++++++++ types/hdkey/tslint.json | 1 + 4 files changed, 39 insertions(+) create mode 100644 types/hdkey/hdkey-tests.ts create mode 100644 types/hdkey/index.d.ts create mode 100644 types/hdkey/tsconfig.json create mode 100644 types/hdkey/tslint.json diff --git a/types/hdkey/hdkey-tests.ts b/types/hdkey/hdkey-tests.ts new file mode 100644 index 0000000000..eda1e9e995 --- /dev/null +++ b/types/hdkey/hdkey-tests.ts @@ -0,0 +1,6 @@ +import HDKey = require('hdkey'); +const hdKey = new HDKey(); +hdKey.derive('m/1/42'); +hdKey.privateKey; +hdKey.publicKey; +hdKey.chainCode; diff --git a/types/hdkey/index.d.ts b/types/hdkey/index.d.ts new file mode 100644 index 0000000000..3cf798c15b --- /dev/null +++ b/types/hdkey/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for hdkey 0.7 +// Project: https://github.com/cryptocoinjs/hdkey +// Definitions by: Leonid Logvinov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare class HDNode { + static fromMasterSeed(seed: Buffer): HDNode; + publicKey: Buffer; + privateKey: Buffer; + chainCode: Buffer; + constructor(); + derive(path: string): HDNode; +} +export = HDNode; diff --git a/types/hdkey/tsconfig.json b/types/hdkey/tsconfig.json new file mode 100644 index 0000000000..f078912fe8 --- /dev/null +++ b/types/hdkey/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "hdkey-tests.ts"] +} diff --git a/types/hdkey/tslint.json b/types/hdkey/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/hdkey/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }