mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
[create-xpub] Add types
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import createXpub = require('create-xpub');
|
||||
|
||||
// $ExpectType string
|
||||
createXpub({
|
||||
depth: 3,
|
||||
childNumber: 2147483648,
|
||||
chainCode: '84cf7d9029cdd9fcadbb3717fd92ec0db7d7d9787c57c13c08fc887c389b566b',
|
||||
publicKey:
|
||||
'048bcdcf59f046b13f1eb35b608d1211265fde8cc44fc7a5a7f7107c5cf238095328a0e0d7be17c7d3e48490e8c6433af6d2c3dacc687f3fecaa98a3d05f17de97',
|
||||
});
|
||||
|
||||
// $ExpectType string
|
||||
createXpub({
|
||||
networkVersion: createXpub.testnet,
|
||||
depth: 3,
|
||||
childNumber: 2147483648,
|
||||
chainCode: '84cf7d9029cdd9fcadbb3717fd92ec0db7d7d9787c57c13c08fc887c389b566b',
|
||||
publicKey:
|
||||
'048bcdcf59f046b13f1eb35b608d1211265fde8cc44fc7a5a7f7107c5cf238095328a0e0d7be17c7d3e48490e8c6433af6d2c3dacc687f3fecaa98a3d05f17de97',
|
||||
});
|
||||
|
||||
createXpub.mainnet; // $ExpectType 76067358
|
||||
createXpub.testnet; // $ExpectType 70617039
|
||||
Vendored
+52
@@ -0,0 +1,52 @@
|
||||
// Type definitions for create-xpub 2.1
|
||||
// Project: https://github.com/lukechilds/create-xpub#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = createXpub;
|
||||
|
||||
/**
|
||||
* Creates a Base58 encoded extended public key (xpub) for use in a
|
||||
* [BIP32 hierarchical deterministic wallet](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki).
|
||||
*
|
||||
* Tip: If you're working with ledgerjs you can pass the output of
|
||||
* [`getWalletPublicKey()`](http://ledgerhq.github.io/ledgerjs/docs/#btcgetwalletpublickey) almost directly in.
|
||||
*
|
||||
* @returns A Base58 encoded extended public key.
|
||||
*/
|
||||
declare function createXpub(options: createXpub.Options): string;
|
||||
|
||||
declare namespace createXpub {
|
||||
/**
|
||||
* Mainnet (xpub) version bytes.
|
||||
*/
|
||||
const mainnet: 0x0488B21E;
|
||||
/**
|
||||
* Testnet (tpub) version bytes.
|
||||
*/
|
||||
const testnet: 0x043587CF;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Network version bytes.
|
||||
* @default 0x0488B21E
|
||||
*/
|
||||
networkVersion?: number;
|
||||
/**
|
||||
* The depth of the derived key.
|
||||
*/
|
||||
depth: number;
|
||||
/**
|
||||
* The child number.
|
||||
*/
|
||||
childNumber: number;
|
||||
/**
|
||||
* The chain code.
|
||||
*/
|
||||
chainCode: string;
|
||||
/**
|
||||
* The public key in compressed or uncompressed form.
|
||||
*/
|
||||
publicKey: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"create-xpub-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user