@opcat-labs/opcat 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cjs2esm.json +18 -0
- package/.mocharc.yaml +1 -1
- package/CHANGELOG.md +12 -0
- package/README.md +6 -0
- package/{lib/address.js → cjs/address.cjs} +77 -72
- package/cjs/block/block.cjs +332 -0
- package/{lib/block/blockheader.js → cjs/block/blockheader.cjs} +8 -7
- package/cjs/block/index.cjs +2 -0
- package/{lib/block/merkleblock.js → cjs/block/merkleblock.cjs} +23 -15
- package/cjs/bn.cjs +3411 -0
- package/{lib/crypto/bn.js → cjs/crypto/bn.cjs} +3 -3
- package/{lib/crypto/ecdsa.js → cjs/crypto/ecdsa.cjs} +150 -14
- package/{lib/crypto/hash.node.js → cjs/crypto/hash.cjs} +13 -2
- package/cjs/crypto/index.cjs +16 -0
- package/{lib/crypto/point.js → cjs/crypto/point.cjs} +11 -4
- package/cjs/crypto/random.cjs +18 -0
- package/{lib/crypto/signature.js → cjs/crypto/signature.cjs} +158 -8
- package/{lib/encoding/base58.js → cjs/encoding/base58.cjs} +58 -2
- package/cjs/encoding/base58check.cjs +192 -0
- package/cjs/encoding/bufferreader.cjs +333 -0
- package/cjs/encoding/bufferwriter.cjs +244 -0
- package/{lib/encoding/decode-asm.js → cjs/encoding/decode-asm.cjs} +4 -4
- package/{lib/encoding/decode-hex.js → cjs/encoding/decode-hex.cjs} +1 -1
- package/cjs/encoding/index.cjs +14 -0
- package/cjs/encoding/varint.cjs +116 -0
- package/{lib/errors/index.js → cjs/errors/index.cjs} +9 -9
- package/{lib/errors/spec.js → cjs/errors/spec.cjs} +2 -2
- package/cjs/hash-cache.cjs +98 -0
- package/{lib/hdprivatekey.js → cjs/hdprivatekey.cjs} +232 -140
- package/{lib/hdpublickey.js → cjs/hdpublickey.cjs} +120 -93
- package/cjs/index.cjs +94 -0
- package/cjs/interpreter/index.cjs +2 -0
- package/cjs/interpreter/interpreter.cjs +1988 -0
- package/{lib/script/stack.js → cjs/interpreter/stack.cjs} +9 -2
- package/{lib/message/message.js → cjs/message/message.cjs} +62 -25
- package/cjs/mnemonic/index.cjs +3 -0
- package/{lib/mnemonic/mnemonic.js → cjs/mnemonic/mnemonic.cjs} +44 -13
- package/{lib/mnemonic/pbkdf2.node.js → cjs/mnemonic/pbkdf2.cjs} +9 -2
- package/cjs/mnemonic/words/index.cjs +66 -0
- package/cjs/network.cjs +13 -0
- package/cjs/networks.cjs +321 -0
- package/{lib/opcode.js → cjs/opcode.cjs} +69 -5
- package/cjs/privatekey.cjs +422 -0
- package/{lib/publickey.js → cjs/publickey.cjs} +14 -16
- package/cjs/script/index.cjs +2 -0
- package/{lib/script/script.js → cjs/script/script.cjs} +322 -67
- package/cjs/transaction/index.cjs +5 -0
- package/cjs/transaction/input/index.cjs +34 -0
- package/cjs/transaction/input/input.cjs +396 -0
- package/{lib/transaction/input/multisig.js → cjs/transaction/input/multisig.cjs} +112 -18
- package/{lib/transaction/input/publickey.js → cjs/transaction/input/publickey.cjs} +29 -19
- package/{lib/transaction/input/publickeyhash.js → cjs/transaction/input/publickeyhash.cjs} +25 -17
- package/{lib/transaction/output.js → cjs/transaction/output.cjs} +100 -15
- package/cjs/transaction/sighash.cjs +187 -0
- package/{lib/transaction/signature.js → cjs/transaction/signature.cjs} +30 -6
- package/cjs/transaction/transaction.cjs +2000 -0
- package/{lib/transaction/unspentoutput.js → cjs/transaction/unspentoutput.cjs} +5 -5
- package/cjs/util/derivation.cjs +53 -0
- package/cjs/util/index.cjs +11 -0
- package/cjs/util/js.cjs +95 -0
- package/{lib/util/preconditions.js → cjs/util/preconditions.cjs} +2 -2
- package/esm/address.js +483 -0
- package/{lib → esm}/block/block.js +82 -27
- package/esm/block/blockheader.js +296 -0
- package/esm/block/index.js +2 -0
- package/esm/block/merkleblock.js +331 -0
- package/esm/bn.js +3411 -0
- package/esm/crypto/bn.js +278 -0
- package/esm/crypto/ecdsa.js +475 -0
- package/{lib/crypto/hash.browser.js → esm/crypto/hash.js} +18 -7
- package/esm/crypto/index.js +16 -0
- package/esm/crypto/point.js +228 -0
- package/esm/crypto/random.js +18 -0
- package/esm/crypto/signature.js +475 -0
- package/esm/encoding/base58.js +167 -0
- package/esm/encoding/base58check.js +192 -0
- package/esm/encoding/bufferreader.js +333 -0
- package/esm/encoding/bufferwriter.js +243 -0
- package/esm/encoding/decode-asm.js +24 -0
- package/esm/encoding/decode-hex.js +32 -0
- package/esm/encoding/decode-script-chunks.js +43 -0
- package/esm/encoding/encode-hex.js +284 -0
- package/esm/encoding/index.js +14 -0
- package/esm/encoding/is-hex.js +7 -0
- package/esm/encoding/varint.js +116 -0
- package/esm/errors/index.js +54 -0
- package/esm/errors/spec.js +314 -0
- package/esm/hash-cache.js +98 -0
- package/esm/hdprivatekey.js +768 -0
- package/esm/hdpublickey.js +549 -0
- package/esm/index.js +66 -0
- package/esm/interpreter/index.js +2 -0
- package/{lib/script → esm/interpreter}/interpreter.js +219 -66
- package/esm/interpreter/stack.js +116 -0
- package/esm/message/message.js +228 -0
- package/esm/mnemonic/index.js +3 -0
- package/esm/mnemonic/mnemonic.js +332 -0
- package/{lib/mnemonic/pbkdf2.browser.js → esm/mnemonic/pbkdf2.js} +13 -6
- package/esm/mnemonic/words/chinese.js +2054 -0
- package/esm/mnemonic/words/english.js +2054 -0
- package/esm/mnemonic/words/french.js +2054 -0
- package/esm/mnemonic/words/index.js +66 -0
- package/esm/mnemonic/words/italian.js +2054 -0
- package/esm/mnemonic/words/japanese.js +2054 -0
- package/esm/mnemonic/words/spanish.js +2054 -0
- package/esm/network.js +13 -0
- package/{lib → esm}/networks.js +61 -120
- package/esm/opcode.js +319 -0
- package/{lib → esm}/privatekey.js +76 -28
- package/esm/publickey.js +384 -0
- package/esm/script/index.js +2 -0
- package/esm/script/script.js +1329 -0
- package/esm/script/write-i32-le.js +17 -0
- package/esm/script/write-push-data.js +35 -0
- package/esm/script/write-u16-le.js +12 -0
- package/esm/script/write-u32-le.js +16 -0
- package/esm/script/write-u64-le.js +24 -0
- package/esm/script/write-u8-le.js +8 -0
- package/esm/script/write-varint.js +46 -0
- package/esm/transaction/index.js +5 -0
- package/esm/transaction/input/index.js +33 -0
- package/{lib → esm}/transaction/input/input.js +132 -90
- package/esm/transaction/input/multisig.js +335 -0
- package/esm/transaction/input/publickey.js +108 -0
- package/esm/transaction/input/publickeyhash.js +124 -0
- package/esm/transaction/output.js +316 -0
- package/{lib → esm}/transaction/sighash.js +42 -22
- package/esm/transaction/signature.js +120 -0
- package/{lib → esm}/transaction/transaction.js +522 -163
- package/esm/transaction/unspentoutput.js +112 -0
- package/esm/util/_.js +47 -0
- package/esm/util/derivation.js +53 -0
- package/esm/util/index.js +12 -0
- package/esm/util/js.js +95 -0
- package/esm/util/preconditions.js +33 -0
- package/fixup.cjs +17 -0
- package/package.json +18 -4
- package/test/{address.js → address.cjs} +14 -43
- package/test/block/{block.js → block.cjs} +3 -5
- package/test/block/{blockheader.js → blockheader.cjs} +2 -2
- package/test/block/{merklebloack.js → merklebloack.cjs} +2 -2
- package/test/crypto/{ecdsa.js → ecdsa.cjs} +9 -9
- package/test/crypto/{hash.browser.js → hash.browser.cjs} +2 -1
- package/test/crypto/{signature.js → signature.cjs} +2 -2
- package/test/data/bitcoind/script_tests.json +5 -5
- package/test/{hashCache.js → hashCache.cjs} +2 -1
- package/test/{hdkeys.js → hdkeys.cjs} +4 -2
- package/test/{hdprivatekey.js → hdprivatekey.cjs} +7 -6
- package/test/{hdpublickey.js → hdpublickey.cjs} +2 -7
- package/test/mnemonic/{pbkdf2.test.js → pbkdf2.test.cjs} +2 -2
- package/test/{networks.js → networks.cjs} +12 -31
- package/test/{publickey.js → publickey.cjs} +2 -2
- package/test/script/{interpreter.js → interpreter.cjs} +5 -5
- package/test/script/{script.js → script.cjs} +8 -2
- package/test/transaction/{deserialize.js → deserialize.cjs} +2 -2
- package/test/transaction/input/{input.js → input.cjs} +1 -1
- package/test/transaction/input/{multisig.js → multisig.cjs} +2 -1
- package/test/transaction/input/{publickeyhash.js → publickeyhash.cjs} +1 -1
- package/test/transaction/{sighash.js → sighash.cjs} +1 -1
- package/test/transaction/{transaction.js → transaction.cjs} +2 -2
- package/tsconfig.json +13 -0
- package/types/address.d.cts +252 -0
- package/types/block/block.d.cts +139 -0
- package/types/block/blockheader.d.cts +125 -0
- package/types/block/index.d.cts +2 -0
- package/types/block/merkleblock.d.cts +95 -0
- package/types/bn.d.cts +202 -0
- package/types/crypto/bn.d.cts +2 -0
- package/types/crypto/ecdsa.d.cts +187 -0
- package/types/crypto/hash.d.cts +118 -0
- package/types/crypto/index.d.cts +7 -0
- package/types/crypto/point.d.cts +134 -0
- package/types/crypto/random.d.cts +13 -0
- package/types/crypto/signature.d.cts +160 -0
- package/types/encoding/base58.d.cts +106 -0
- package/types/encoding/base58check.d.cts +107 -0
- package/types/encoding/bufferreader.d.cts +164 -0
- package/types/encoding/bufferwriter.d.cts +126 -0
- package/types/encoding/decode-asm.d.cts +2 -0
- package/types/encoding/decode-hex.d.cts +2 -0
- package/types/encoding/decode-script-chunks.d.cts +14 -0
- package/types/encoding/encode-hex.d.cts +2 -0
- package/types/encoding/index.d.cts +6 -0
- package/types/encoding/is-hex.d.cts +2 -0
- package/types/encoding/varint.d.cts +66 -0
- package/types/errors/index.d.cts +4 -0
- package/types/errors/spec.d.cts +22 -0
- package/types/hash-cache.d.cts +65 -0
- package/types/hdprivatekey.d.cts +281 -0
- package/types/hdpublickey.d.cts +240 -0
- package/types/index.d.cts +26 -0
- package/types/interpreter/index.d.cts +2 -0
- package/types/interpreter/interpreter.d.cts +228 -0
- package/types/interpreter/stack.d.cts +35 -0
- package/types/message/message.d.cts +110 -0
- package/types/mnemonic/index.d.cts +2 -0
- package/types/mnemonic/mnemonic.d.cts +171 -0
- package/types/mnemonic/pbkdf2.d.cts +14 -0
- package/types/mnemonic/words/chinese.d.cts +2 -0
- package/types/mnemonic/words/english.d.cts +2 -0
- package/types/mnemonic/words/french.d.cts +2 -0
- package/types/mnemonic/words/index.d.cts +22 -0
- package/types/mnemonic/words/italian.d.cts +2 -0
- package/types/mnemonic/words/japanese.d.cts +2 -0
- package/types/mnemonic/words/spanish.d.cts +2 -0
- package/types/network.d.cts +11 -0
- package/types/networks.d.cts +76 -0
- package/types/opcode.d.cts +93 -0
- package/types/privatekey.d.cts +169 -0
- package/types/publickey.d.cts +202 -0
- package/types/script/index.d.cts +2 -0
- package/types/script/script.d.cts +449 -0
- package/types/script/write-i32-le.d.cts +2 -0
- package/types/script/write-push-data.d.cts +2 -0
- package/types/script/write-u16-le.d.cts +2 -0
- package/types/script/write-u32-le.d.cts +2 -0
- package/types/script/write-u64-le.d.cts +2 -0
- package/types/script/write-u8-le.d.cts +2 -0
- package/types/script/write-varint.d.cts +2 -0
- package/types/transaction/index.d.cts +2 -0
- package/types/transaction/input/index.d.cts +2 -0
- package/types/transaction/input/input.d.cts +178 -0
- package/types/transaction/input/multisig.d.cts +127 -0
- package/types/transaction/input/publickey.d.cts +44 -0
- package/types/transaction/input/publickeyhash.d.cts +45 -0
- package/types/transaction/output.d.cts +118 -0
- package/types/transaction/sighash.d.cts +61 -0
- package/types/transaction/signature.d.cts +43 -0
- package/types/transaction/transaction.d.cts +716 -0
- package/types/transaction/unspentoutput.d.cts +83 -0
- package/types/util/_.d.cts +26 -0
- package/types/util/derivation.d.cts +21 -0
- package/types/util/index.d.cts +5 -0
- package/types/util/js.d.cts +50 -0
- package/types/util/preconditions.d.cts +3 -0
- package/index.d.ts +0 -1541
- package/index.js +0 -74
- package/lib/block/index.js +0 -4
- package/lib/bn.js +0 -3423
- package/lib/crypto/hash.js +0 -2
- package/lib/crypto/random.browser.js +0 -28
- package/lib/crypto/random.js +0 -2
- package/lib/crypto/random.node.js +0 -11
- package/lib/encoding/base58check.js +0 -121
- package/lib/encoding/bufferreader.js +0 -212
- package/lib/encoding/bufferwriter.js +0 -140
- package/lib/encoding/varint.js +0 -75
- package/lib/hash-cache.js +0 -50
- package/lib/mnemonic/pbkdf2.js +0 -2
- package/lib/mnemonic/words/index.js +0 -8
- package/lib/script/index.js +0 -5
- package/lib/transaction/index.js +0 -7
- package/lib/transaction/input/index.js +0 -5
- package/lib/util/js.js +0 -90
- /package/{lib/encoding/decode-script-chunks.js → cjs/encoding/decode-script-chunks.cjs} +0 -0
- /package/{lib/encoding/encode-hex.js → cjs/encoding/encode-hex.cjs} +0 -0
- /package/{lib/encoding/is-hex.js → cjs/encoding/is-hex.cjs} +0 -0
- /package/{lib/mnemonic/words/chinese.js → cjs/mnemonic/words/chinese.cjs} +0 -0
- /package/{lib/mnemonic/words/english.js → cjs/mnemonic/words/english.cjs} +0 -0
- /package/{lib/mnemonic/words/french.js → cjs/mnemonic/words/french.cjs} +0 -0
- /package/{lib/mnemonic/words/italian.js → cjs/mnemonic/words/italian.cjs} +0 -0
- /package/{lib/mnemonic/words/japanese.js → cjs/mnemonic/words/japanese.cjs} +0 -0
- /package/{lib/mnemonic/words/spanish.js → cjs/mnemonic/words/spanish.cjs} +0 -0
- /package/{lib/script/write-i32-le.js → cjs/script/write-i32-le.cjs} +0 -0
- /package/{lib/script/write-push-data.js → cjs/script/write-push-data.cjs} +0 -0
- /package/{lib/script/write-u16-le.js → cjs/script/write-u16-le.cjs} +0 -0
- /package/{lib/script/write-u32-le.js → cjs/script/write-u32-le.cjs} +0 -0
- /package/{lib/script/write-u64-le.js → cjs/script/write-u64-le.cjs} +0 -0
- /package/{lib/script/write-u8-le.js → cjs/script/write-u8-le.cjs} +0 -0
- /package/{lib/script/write-varint.js → cjs/script/write-varint.cjs} +0 -0
- /package/{lib/util/_.js → cjs/util/_.cjs} +0 -0
- /package/test/crypto/{bn.js → bn.cjs} +0 -0
- /package/test/crypto/{hash.js → hash.cjs} +0 -0
- /package/test/crypto/{point.js → point.cjs} +0 -0
- /package/test/crypto/{random.js → random.cjs} +0 -0
- /package/test/data/{blk86756-testnet.js → blk86756-testnet.cjs} +0 -0
- /package/test/data/{merkleblocks.js → merkleblocks.cjs} +0 -0
- /package/test/encoding/{base58.js → base58.cjs} +0 -0
- /package/test/encoding/{base58check.js → base58check.cjs} +0 -0
- /package/test/encoding/{bufferreader.js → bufferreader.cjs} +0 -0
- /package/test/encoding/{bufferwriter.js → bufferwriter.cjs} +0 -0
- /package/test/encoding/{varint.js → varint.cjs} +0 -0
- /package/test/{index.js → index.cjs} +0 -0
- /package/test/message/{message.js → message.cjs} +0 -0
- /package/test/mnemonic/{mnemonic.js → mnemonic.cjs} +0 -0
- /package/test/{opcode.js → opcode.cjs} +0 -0
- /package/test/{privatekey.js → privatekey.cjs} +0 -0
- /package/test/transaction/input/{publickey.js → publickey.cjs} +0 -0
- /package/test/transaction/{output.js → output.cjs} +0 -0
- /package/test/transaction/{signature.js → signature.cjs} +0 -0
- /package/test/transaction/{unspentoutput.js → unspentoutput.cjs} +0 -0
- /package/test/util/{js.js → js.cjs} +0 -0
- /package/test/util/{preconditions.js → preconditions.cjs} +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export = HashCache;
|
|
2
|
+
/**
|
|
3
|
+
* A class representing a cache for transaction hash buffers.
|
|
4
|
+
* Provides methods for serialization/deserialization between Buffer, JSON, and hex formats.
|
|
5
|
+
*
|
|
6
|
+
* @class
|
|
7
|
+
* @property {Buffer} prevoutsHashBuf - Hash buffer for transaction prevouts
|
|
8
|
+
* @property {Buffer} sequenceHashBuf - Hash buffer for transaction sequence
|
|
9
|
+
* @property {Buffer} outputsHashBuf - Hash buffer for transaction outputs
|
|
10
|
+
*/
|
|
11
|
+
declare class HashCache {
|
|
12
|
+
/**
|
|
13
|
+
* Creates a HashCache instance from a buffer by parsing it as JSON.
|
|
14
|
+
* @param {Buffer} buf - The input buffer containing JSON data.
|
|
15
|
+
* @returns {HashCache} A new HashCache instance created from the parsed JSON.
|
|
16
|
+
*/
|
|
17
|
+
static fromBuffer(buf: Buffer): HashCache;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a HashCache instance from a JSON object.
|
|
20
|
+
* @param {Object} json - The JSON object containing hash buffers in hex format.
|
|
21
|
+
* @param {string} [json.prevoutsHashBuf] - Hex string for prevouts hash buffer.
|
|
22
|
+
* @param {string} [json.sequenceHashBuf] - Hex string for sequence hash buffer.
|
|
23
|
+
* @param {string} [json.outputsHashBuf] - Hex string for outputs hash buffer.
|
|
24
|
+
* @returns {HashCache} A new HashCache instance with converted Buffer values.
|
|
25
|
+
*/
|
|
26
|
+
static fromJSON(json: {
|
|
27
|
+
prevoutsHashBuf?: string;
|
|
28
|
+
sequenceHashBuf?: string;
|
|
29
|
+
outputsHashBuf?: string;
|
|
30
|
+
}): HashCache;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a HashCache instance from a hex string.
|
|
33
|
+
* @param {string} hex - The hex string to convert to a buffer.
|
|
34
|
+
* @returns {HashCache} A HashCache instance created from the hex string buffer.
|
|
35
|
+
*/
|
|
36
|
+
static fromHex(hex: string): HashCache;
|
|
37
|
+
/**
|
|
38
|
+
* Constructs a new hash cache instance with the provided hash buffers.
|
|
39
|
+
* @param {Buffer} prevoutsHashBuf - Hash buffer for prevouts
|
|
40
|
+
* @param {Buffer} sequenceHashBuf - Hash buffer for sequence
|
|
41
|
+
* @param {Buffer} outputsHashBuf - Hash buffer for outputs
|
|
42
|
+
*/
|
|
43
|
+
constructor(prevoutsHashBuf: Buffer, sequenceHashBuf: Buffer, outputsHashBuf: Buffer);
|
|
44
|
+
prevoutsHashBuf: Buffer;
|
|
45
|
+
sequenceHashBuf: Buffer;
|
|
46
|
+
outputsHashBuf: Buffer;
|
|
47
|
+
/**
|
|
48
|
+
* Converts the object to a Buffer containing its JSON string representation.
|
|
49
|
+
* @returns {Buffer} A Buffer containing the JSON string of the object.
|
|
50
|
+
*/
|
|
51
|
+
toBuffer(): Buffer;
|
|
52
|
+
/**
|
|
53
|
+
* Converts the hash cache object to a JSON representation.
|
|
54
|
+
* @returns {Object} An object containing hex string representations of the hash buffers:
|
|
55
|
+
* - prevoutsHashBuf: Hex string of prevouts hash buffer (if exists)
|
|
56
|
+
* - sequenceHashBuf: Hex string of sequence hash buffer (if exists)
|
|
57
|
+
* - outputsHashBuf: Hex string of outputs hash buffer (if exists)
|
|
58
|
+
*/
|
|
59
|
+
toJSON(): any;
|
|
60
|
+
/**
|
|
61
|
+
* Converts the object's buffer representation to a hexadecimal string.
|
|
62
|
+
* @returns {string} Hexadecimal string representation of the buffer.
|
|
63
|
+
*/
|
|
64
|
+
toHex(): string;
|
|
65
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
export = HDPrivateKey;
|
|
2
|
+
/**
|
|
3
|
+
* Creates a new HDPrivateKey instance from various input formats.
|
|
4
|
+
* More info on https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
|
|
5
|
+
* @constructor
|
|
6
|
+
* @param {HDPrivateKey|string|Buffer|Object} arg - Input can be:
|
|
7
|
+
* - Existing HDPrivateKey instance (returns same instance)
|
|
8
|
+
* - Network name (generates random key for that network)
|
|
9
|
+
* - Serialized string/Buffer (base58 encoded)
|
|
10
|
+
* - JSON string
|
|
11
|
+
* - Object with key properties
|
|
12
|
+
* @throws {hdErrors.UnrecognizedArgument} If input format is not recognized
|
|
13
|
+
* @throws {Error} If serialized input is invalid
|
|
14
|
+
*/
|
|
15
|
+
declare function HDPrivateKey(arg: HDPrivateKey | string | Buffer | any): HDPrivateKey;
|
|
16
|
+
declare class HDPrivateKey {
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new HDPrivateKey instance from various input formats.
|
|
19
|
+
* More info on https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
|
|
20
|
+
* @constructor
|
|
21
|
+
* @param {HDPrivateKey|string|Buffer|Object} arg - Input can be:
|
|
22
|
+
* - Existing HDPrivateKey instance (returns same instance)
|
|
23
|
+
* - Network name (generates random key for that network)
|
|
24
|
+
* - Serialized string/Buffer (base58 encoded)
|
|
25
|
+
* - JSON string
|
|
26
|
+
* - Object with key properties
|
|
27
|
+
* @throws {hdErrors.UnrecognizedArgument} If input format is not recognized
|
|
28
|
+
* @throws {Error} If serialized input is invalid
|
|
29
|
+
*/
|
|
30
|
+
constructor(arg: HDPrivateKey | string | Buffer | any);
|
|
31
|
+
get hdPublicKey(): HDPublicKey;
|
|
32
|
+
get xpubkey(): any;
|
|
33
|
+
/**
|
|
34
|
+
* WARNING: This method will not be officially supported until v1.0.0.
|
|
35
|
+
*
|
|
36
|
+
*
|
|
37
|
+
* Get a derived child based on a string or number.
|
|
38
|
+
*
|
|
39
|
+
* If the first argument is a string, it's parsed as the full path of
|
|
40
|
+
* derivation. Valid values for this argument include "m" (which returns the
|
|
41
|
+
* same private key), "m/0/1/40/2'/1000", where the ' quote means a hardened
|
|
42
|
+
* derivation.
|
|
43
|
+
*
|
|
44
|
+
* If the first argument is a number, the child with that index will be
|
|
45
|
+
* derived. If the second argument is truthy, the hardened version will be
|
|
46
|
+
* derived. See the example usage for clarification.
|
|
47
|
+
*
|
|
48
|
+
* WARNING: The `nonCompliant` option should NOT be used, except for older implementation
|
|
49
|
+
* that used a derivation strategy that used a non-zero padded private key.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```javascript
|
|
53
|
+
* var parent = new HDPrivateKey('xprv...');
|
|
54
|
+
* var child_0_1_2h = parent.deriveChild(0).deriveChild(1).deriveChild(2, true);
|
|
55
|
+
* var copy_of_child_0_1_2h = parent.deriveChild("m/0/1/2'");
|
|
56
|
+
* assert(child_0_1_2h.xprivkey === copy_of_child_0_1_2h);
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @param {string|number} arg
|
|
60
|
+
* @param {boolean} [hardened]
|
|
61
|
+
*/
|
|
62
|
+
deriveChild(arg: string | number, hardened?: boolean): HDPrivateKey;
|
|
63
|
+
/**
|
|
64
|
+
* WARNING: This method will not be officially supported until v1.0.0
|
|
65
|
+
*
|
|
66
|
+
*
|
|
67
|
+
* WARNING: If this is a new implementation you should NOT use this method, you should be using
|
|
68
|
+
* `derive` instead.
|
|
69
|
+
*
|
|
70
|
+
* This method is explicitly for use and compatibility with an implementation that
|
|
71
|
+
* was not compliant with BIP32 regarding the derivation algorithm. The private key
|
|
72
|
+
* must be 32 bytes hashing, and this implementation will use the non-zero padded
|
|
73
|
+
* serialization of a private key, such that it's still possible to derive the privateKey
|
|
74
|
+
* to recover those funds.
|
|
75
|
+
*
|
|
76
|
+
* @param {number|string} arg - Either a child index number or derivation path string
|
|
77
|
+
* @param {boolean} [hardened] - Whether to create hardened derivation (only used with number arg)
|
|
78
|
+
* @returns {HDPrivateKey} The derived child private key
|
|
79
|
+
* @throws {hdErrors.InvalidDerivationArgument} If argument type is invalid
|
|
80
|
+
*/
|
|
81
|
+
deriveNonCompliantChild(arg: number | string, hardened?: boolean): HDPrivateKey;
|
|
82
|
+
private _deriveWithNumber;
|
|
83
|
+
private _deriveFromString;
|
|
84
|
+
private _buildFromJSON;
|
|
85
|
+
private _buildFromObject;
|
|
86
|
+
private _buildFromSerialized;
|
|
87
|
+
private _generateRandomly;
|
|
88
|
+
private _calcHDPublicKey;
|
|
89
|
+
_hdPublicKey: HDPublicKey;
|
|
90
|
+
/**
|
|
91
|
+
* Converts the HDPrivateKey instance to its corresponding HDPublicKey.
|
|
92
|
+
* @returns {HDPublicKey} The derived HD public key.
|
|
93
|
+
*/
|
|
94
|
+
toHDPublicKey(): HDPublicKey;
|
|
95
|
+
/**
|
|
96
|
+
* Returns the private key associated with this HD private key.
|
|
97
|
+
* @returns {PrivateKey} The private key instance.
|
|
98
|
+
*/
|
|
99
|
+
toPrivateKey(): PrivateKey;
|
|
100
|
+
private _buildFromBuffers;
|
|
101
|
+
/**
|
|
102
|
+
* Returns the extended private key string representation of this HDPrivateKey.
|
|
103
|
+
* (a string starting with "xprv...")
|
|
104
|
+
* @returns {string} The extended private key in base58 string format.
|
|
105
|
+
*/
|
|
106
|
+
toString(): string;
|
|
107
|
+
/**
|
|
108
|
+
* Returns the console representation of this extended private key.
|
|
109
|
+
* @return string
|
|
110
|
+
*/
|
|
111
|
+
inspect(): string;
|
|
112
|
+
/**
|
|
113
|
+
* Returns a plain object with a representation of this private key.
|
|
114
|
+
*
|
|
115
|
+
* Fields include:
|
|
116
|
+
* <ul>
|
|
117
|
+
* <li> network: either 'livenet' or 'testnet' </li>
|
|
118
|
+
* <li> depth: a number ranging from 0 to 255 </li>
|
|
119
|
+
* <li> fingerPrint: a number ranging from 0 to 2^32-1, taken from the hash of the associated public key </li>
|
|
120
|
+
* <li> parentFingerPrint: a number ranging from 0 to 2^32-1, taken from the hash of this parent's associated public key or zero. </li>
|
|
121
|
+
* <li> childIndex: the index from which this child was derived (or zero) </li>
|
|
122
|
+
* <li> chainCode: an hexa string representing a number used in the derivation </li>
|
|
123
|
+
* <li> privateKey: the private key associated, in hexa representation </li>
|
|
124
|
+
* <li> xprivkey: the representation of this extended private key in checksum base58 format </li>
|
|
125
|
+
* <li> checksum: the base58 checksum of xprivkey </li>
|
|
126
|
+
* </ul>
|
|
127
|
+
* @return {Object}
|
|
128
|
+
*/
|
|
129
|
+
toObject: () => any;
|
|
130
|
+
toJSON(): any;
|
|
131
|
+
/**
|
|
132
|
+
* Returns a buffer representation of the HDPrivateKey
|
|
133
|
+
*
|
|
134
|
+
* @return {string}
|
|
135
|
+
*/
|
|
136
|
+
toBuffer(): string;
|
|
137
|
+
/**
|
|
138
|
+
* Returns a hex string representation of the HDPrivateKey
|
|
139
|
+
*
|
|
140
|
+
* @return {string}
|
|
141
|
+
*/
|
|
142
|
+
toHex(): string;
|
|
143
|
+
}
|
|
144
|
+
declare namespace HDPrivateKey {
|
|
145
|
+
/**
|
|
146
|
+
* Creates a new HDPrivateKey instance with random values.
|
|
147
|
+
* @returns {HDPrivateKey} A new HDPrivateKey object with randomly generated properties.
|
|
148
|
+
*/
|
|
149
|
+
export function fromRandom(): HDPrivateKey;
|
|
150
|
+
/**
|
|
151
|
+
* Verifies that a given path is valid.
|
|
152
|
+
*
|
|
153
|
+
* @param {string|number} arg
|
|
154
|
+
* @param {boolean} [hardened]
|
|
155
|
+
* @return {boolean}
|
|
156
|
+
*/
|
|
157
|
+
export function isValidPath(arg: string | number, hardened?: boolean): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Verifies that a given serialized private key in base58 with checksum format
|
|
160
|
+
* is valid.
|
|
161
|
+
*
|
|
162
|
+
* @param {string|Buffer} data - the serialized private key
|
|
163
|
+
* @param {string|Network} network - optional, if present, checks that the
|
|
164
|
+
* network provided matches the network serialized.
|
|
165
|
+
* @return {boolean}
|
|
166
|
+
*/
|
|
167
|
+
export function isValidSerialized(data: string | Buffer, network: any): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Checks what's the error that causes the validation of a serialized private key
|
|
170
|
+
* in base58 with checksum to fail.
|
|
171
|
+
*
|
|
172
|
+
* @param {string|Buffer} data - the serialized private key
|
|
173
|
+
* @param {string|Network} network - optional, if present, checks that the
|
|
174
|
+
* network provided matches the network serialized.
|
|
175
|
+
* @return {errors.InvalidArgument|null}
|
|
176
|
+
*/
|
|
177
|
+
export function getSerializedError(data: string | Buffer, network: any): any;
|
|
178
|
+
/**
|
|
179
|
+
* Validates if the provided data matches the expected network's extended private key version.
|
|
180
|
+
* @param {Buffer} data - The data buffer to validate (must include version bytes).
|
|
181
|
+
* @param {string|Network} networkArg - Network identifier or Network object to validate against.
|
|
182
|
+
* @returns {Error|null} Returns error if validation fails, otherwise null.
|
|
183
|
+
* @private
|
|
184
|
+
*/
|
|
185
|
+
export function _validateNetwork(data: Buffer, networkArg: any): Error;
|
|
186
|
+
/**
|
|
187
|
+
* Creates an HDPrivateKey instance from a string representation.
|
|
188
|
+
* @param {string} arg - The string to convert to an HDPrivateKey
|
|
189
|
+
* @returns {HDPrivateKey} A new HDPrivateKey instance
|
|
190
|
+
* @throws {Error} If the input is not a valid string
|
|
191
|
+
*/
|
|
192
|
+
export function fromString(arg: string): HDPrivateKey;
|
|
193
|
+
/**
|
|
194
|
+
* Creates an HDPrivateKey instance from a plain object.
|
|
195
|
+
* @param {Object} arg - The object containing HDPrivateKey properties.
|
|
196
|
+
* @throws {Error} Throws if argument is not a valid object.
|
|
197
|
+
* @returns {HDPrivateKey} A new HDPrivateKey instance.
|
|
198
|
+
*/
|
|
199
|
+
export function fromObject(arg: any): HDPrivateKey;
|
|
200
|
+
/**
|
|
201
|
+
* Generate a private key from a seed, as described in BIP32
|
|
202
|
+
*
|
|
203
|
+
* @param {string|Buffer} hexa
|
|
204
|
+
* @param {Network} [network]
|
|
205
|
+
* @return HDPrivateKey
|
|
206
|
+
* @static
|
|
207
|
+
*/
|
|
208
|
+
export function fromSeed(hexa: string | Buffer, network?: Network): HDPrivateKey;
|
|
209
|
+
/**
|
|
210
|
+
* Validates buffer arguments for HDPrivateKey.
|
|
211
|
+
* Checks that each required buffer field exists and has the correct size.
|
|
212
|
+
* @private
|
|
213
|
+
* @param {Object} arg - Object containing buffer fields to validate
|
|
214
|
+
* @param {Buffer} arg.version - Version buffer
|
|
215
|
+
* @param {Buffer} arg.depth - Depth buffer
|
|
216
|
+
* @param {Buffer} arg.parentFingerPrint - Parent fingerprint buffer
|
|
217
|
+
* @param {Buffer} arg.childIndex - Child index buffer
|
|
218
|
+
* @param {Buffer} arg.chainCode - Chain code buffer
|
|
219
|
+
* @param {Buffer} arg.privateKey - Private key buffer
|
|
220
|
+
* @param {Buffer} [arg.checksum] - Optional checksum buffer
|
|
221
|
+
*/
|
|
222
|
+
export function _validateBufferArguments(arg: {
|
|
223
|
+
version: Buffer;
|
|
224
|
+
depth: Buffer;
|
|
225
|
+
parentFingerPrint: Buffer;
|
|
226
|
+
childIndex: Buffer;
|
|
227
|
+
chainCode: Buffer;
|
|
228
|
+
privateKey: Buffer;
|
|
229
|
+
checksum?: Buffer;
|
|
230
|
+
}): void;
|
|
231
|
+
/**
|
|
232
|
+
* Build a HDPrivateKey from a buffer
|
|
233
|
+
*
|
|
234
|
+
* @param {Buffer} arg
|
|
235
|
+
* @return {HDPrivateKey}
|
|
236
|
+
*/
|
|
237
|
+
export function fromBuffer(buf: any): HDPrivateKey;
|
|
238
|
+
/**
|
|
239
|
+
* Build a HDPrivateKey from a hex string
|
|
240
|
+
*
|
|
241
|
+
* @param {string} hex
|
|
242
|
+
* @return {HDPrivateKey}
|
|
243
|
+
*/
|
|
244
|
+
export function fromHex(hex: string): HDPrivateKey;
|
|
245
|
+
export let DefaultDepth: number;
|
|
246
|
+
export let DefaultFingerprint: number;
|
|
247
|
+
export let DefaultChildIndex: number;
|
|
248
|
+
export let Hardened: number;
|
|
249
|
+
export let MaxIndex: number;
|
|
250
|
+
export let RootElementAlias: string;
|
|
251
|
+
export let VersionSize: number;
|
|
252
|
+
export let DepthSize: number;
|
|
253
|
+
export let ParentFingerPrintSize: number;
|
|
254
|
+
export let ChildIndexSize: number;
|
|
255
|
+
export let ChainCodeSize: number;
|
|
256
|
+
export let PrivateKeySize: number;
|
|
257
|
+
export let CheckSumSize: number;
|
|
258
|
+
export let DataLength: number;
|
|
259
|
+
export let SerializedByteSize: number;
|
|
260
|
+
export let VersionStart: number;
|
|
261
|
+
export let VersionEnd: number;
|
|
262
|
+
import DepthStart = VersionEnd;
|
|
263
|
+
export { DepthStart };
|
|
264
|
+
export let DepthEnd: number;
|
|
265
|
+
import ParentFingerPrintStart = DepthEnd;
|
|
266
|
+
export { ParentFingerPrintStart };
|
|
267
|
+
export let ParentFingerPrintEnd: number;
|
|
268
|
+
import ChildIndexStart = ParentFingerPrintEnd;
|
|
269
|
+
export { ChildIndexStart };
|
|
270
|
+
export let ChildIndexEnd: number;
|
|
271
|
+
import ChainCodeStart = ChildIndexEnd;
|
|
272
|
+
export { ChainCodeStart };
|
|
273
|
+
export let ChainCodeEnd: number;
|
|
274
|
+
export let PrivateKeyStart: number;
|
|
275
|
+
export let PrivateKeyEnd: number;
|
|
276
|
+
import ChecksumStart = PrivateKeyEnd;
|
|
277
|
+
export { ChecksumStart };
|
|
278
|
+
export let ChecksumEnd: number;
|
|
279
|
+
}
|
|
280
|
+
import HDPublicKey = require("./hdpublickey.cjs");
|
|
281
|
+
import PrivateKey = require("./privatekey.cjs");
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
export = HDPublicKey;
|
|
2
|
+
/**
|
|
3
|
+
* The representation of an hierarchically derived public key.
|
|
4
|
+
*
|
|
5
|
+
* See https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
|
|
6
|
+
*
|
|
7
|
+
* @constructor
|
|
8
|
+
* @param {Object|string|Buffer} arg
|
|
9
|
+
*/
|
|
10
|
+
declare function HDPublicKey(arg: any | string | Buffer): HDPublicKey;
|
|
11
|
+
declare class HDPublicKey {
|
|
12
|
+
/**
|
|
13
|
+
* The representation of an hierarchically derived public key.
|
|
14
|
+
*
|
|
15
|
+
* See https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
|
|
16
|
+
*
|
|
17
|
+
* @constructor
|
|
18
|
+
* @param {Object|string|Buffer} arg
|
|
19
|
+
*/
|
|
20
|
+
constructor(arg: any | string | Buffer);
|
|
21
|
+
/**
|
|
22
|
+
* WARNING: This method will not be officially supported until v1.0.0.
|
|
23
|
+
*
|
|
24
|
+
*
|
|
25
|
+
* Get a derivated child based on a string or number.
|
|
26
|
+
*
|
|
27
|
+
* If the first argument is a string, it's parsed as the full path of
|
|
28
|
+
* derivation. Valid values for this argument include "m" (which returns the
|
|
29
|
+
* same public key), "m/0/1/40/2/1000".
|
|
30
|
+
*
|
|
31
|
+
* Note that hardened keys can't be derived from a public extended key.
|
|
32
|
+
*
|
|
33
|
+
* If the first argument is a number, the child with that index will be
|
|
34
|
+
* derived. See the example usage for clarification.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```javascript
|
|
38
|
+
* var parent = new HDPublicKey('xpub...');
|
|
39
|
+
* var child_0_1_2 = parent.deriveChild(0).deriveChild(1).deriveChild(2);
|
|
40
|
+
* var copy_of_child_0_1_2 = parent.deriveChild("m/0/1/2");
|
|
41
|
+
* assert(child_0_1_2.xprivkey === copy_of_child_0_1_2);
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @param {string|number} arg - The index or path to derive
|
|
45
|
+
* @param {boolean} [hardened=false] - Whether to use hardened derivation
|
|
46
|
+
* @returns {HDPublicKey} The derived child public key
|
|
47
|
+
*/
|
|
48
|
+
deriveChild(arg: string | number, hardened?: boolean): HDPublicKey;
|
|
49
|
+
private _deriveWithNumber;
|
|
50
|
+
private _deriveFromString;
|
|
51
|
+
private _buildFromObject;
|
|
52
|
+
private _buildFromSerialized;
|
|
53
|
+
private _buildFromBuffers;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the base58 checked representation of the public key
|
|
56
|
+
* @return {string} a string starting with "xpub..." in livenet
|
|
57
|
+
*/
|
|
58
|
+
toString(): string;
|
|
59
|
+
/**
|
|
60
|
+
* Returns the console representation of this extended public key.
|
|
61
|
+
* @return string
|
|
62
|
+
*/
|
|
63
|
+
inspect(): string;
|
|
64
|
+
/**
|
|
65
|
+
* Returns a plain JavaScript object with information to reconstruct a key.
|
|
66
|
+
*
|
|
67
|
+
* Fields are:
|
|
68
|
+
* <ul>
|
|
69
|
+
* <li> network: 'livenet' or 'testnet' </li>
|
|
70
|
+
* <li> depth: a number from 0 to 255, the depth to the master extended key </li>
|
|
71
|
+
* <li> fingerPrint: a number of 32 bits taken from the hash of the public key </li>
|
|
72
|
+
* <li> fingerPrint: a number of 32 bits taken from the hash of this key's parent's public key </li>
|
|
73
|
+
* <li> childIndex: index with which this key was derived </li>
|
|
74
|
+
* <li> chainCode: string in hexa encoding used for derivation </li>
|
|
75
|
+
* <li> publicKey: string, hexa encoded, in compressed key format </li>
|
|
76
|
+
* <li> checksum: this._buffers.checksum.readUInt32BE(0) </li>
|
|
77
|
+
* <li> xpubkey: the string with the base58 representation of this extended key </li>
|
|
78
|
+
* <li> checksum: the base58 checksum of xpubkey </li>
|
|
79
|
+
* </ul>
|
|
80
|
+
*/
|
|
81
|
+
toObject: () => {
|
|
82
|
+
network: any;
|
|
83
|
+
depth: any;
|
|
84
|
+
fingerPrint: any;
|
|
85
|
+
parentFingerPrint: any;
|
|
86
|
+
childIndex: any;
|
|
87
|
+
chainCode: any;
|
|
88
|
+
publicKey: any;
|
|
89
|
+
checksum: any;
|
|
90
|
+
xpubkey: any;
|
|
91
|
+
};
|
|
92
|
+
toJSON(): {
|
|
93
|
+
network: any;
|
|
94
|
+
depth: any;
|
|
95
|
+
fingerPrint: any;
|
|
96
|
+
parentFingerPrint: any;
|
|
97
|
+
childIndex: any;
|
|
98
|
+
chainCode: any;
|
|
99
|
+
publicKey: any;
|
|
100
|
+
checksum: any;
|
|
101
|
+
xpubkey: any;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Return a buffer representation of the xpubkey
|
|
105
|
+
*
|
|
106
|
+
* @return {Buffer}
|
|
107
|
+
*/
|
|
108
|
+
toBuffer(): Buffer;
|
|
109
|
+
/**
|
|
110
|
+
* Return a hex string representation of the xpubkey
|
|
111
|
+
*
|
|
112
|
+
* @return {Buffer}
|
|
113
|
+
*/
|
|
114
|
+
toHex(): Buffer;
|
|
115
|
+
}
|
|
116
|
+
declare namespace HDPublicKey {
|
|
117
|
+
/**
|
|
118
|
+
* Converts an HDPrivateKey to an HDPublicKey.
|
|
119
|
+
* @param {HDPrivateKey} hdPrivateKey - The HD private key to convert.
|
|
120
|
+
* @returns {HDPublicKey} The corresponding HD public key.
|
|
121
|
+
*/
|
|
122
|
+
export function fromHDPrivateKey(hdPrivateKey: HDPrivateKey): HDPublicKey;
|
|
123
|
+
/**
|
|
124
|
+
* Checks if a given argument is a valid HD public key derivation path.
|
|
125
|
+
* @param {string|number} arg - The path to validate (either as string like "m/0/1" or as a single index number).
|
|
126
|
+
* @returns {boolean} True if the path is valid, false otherwise.
|
|
127
|
+
* @description Validates both string paths (e.g., "m/0/1") and individual derivation indexes.
|
|
128
|
+
* String paths must contain valid indexes separated by '/', and each index must be a non-negative number less than HDPublicKey.Hardened.
|
|
129
|
+
*/
|
|
130
|
+
export function isValidPath(arg: string | number): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Verifies that a given serialized public key in base58 with checksum format
|
|
133
|
+
* is valid.
|
|
134
|
+
*
|
|
135
|
+
* @param {string|Buffer} data - the serialized public key
|
|
136
|
+
* @param {string|Network} [network] - optional, if present, checks that the
|
|
137
|
+
* network provided matches the network serialized.
|
|
138
|
+
* @return {boolean}
|
|
139
|
+
*/
|
|
140
|
+
export function isValidSerialized(data: string | Buffer, network?: any): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Checks what's the error that causes the validation of a serialized public key
|
|
143
|
+
* in base58 with checksum to fail.
|
|
144
|
+
*
|
|
145
|
+
* @param {string|Buffer} data - the serialized public key
|
|
146
|
+
* @param {string|Network} [network] - optional, if present, checks that the
|
|
147
|
+
* network provided matches the network serialized.
|
|
148
|
+
* @return {Error|null}
|
|
149
|
+
*/
|
|
150
|
+
export function getSerializedError(data: string | Buffer, network?: any): Error;
|
|
151
|
+
/**
|
|
152
|
+
* Validates if the provided data matches the expected network version.
|
|
153
|
+
* @param {Buffer} data - The data containing the version to validate.
|
|
154
|
+
* @param {string|Network} networkArg - The network or network identifier to validate against.
|
|
155
|
+
* @returns {InvalidNetworkArgument|InvalidNetwork|null} Returns an error if validation fails, otherwise null.
|
|
156
|
+
* @private
|
|
157
|
+
*/
|
|
158
|
+
export function _validateNetwork(data: Buffer, networkArg: any): any;
|
|
159
|
+
/**
|
|
160
|
+
* Validates buffer arguments for HDPublicKey.
|
|
161
|
+
* @private
|
|
162
|
+
* @param {Object} arg - The argument object containing buffer fields to validate
|
|
163
|
+
* @param {Buffer} arg.version - Version buffer (must be HDPublicKey.VersionSize bytes)
|
|
164
|
+
* @param {Buffer} arg.depth - Depth buffer (must be HDPublicKey.DepthSize bytes)
|
|
165
|
+
* @param {Buffer} arg.parentFingerPrint - Parent fingerprint buffer (must be HDPublicKey.ParentFingerPrintSize bytes)
|
|
166
|
+
* @param {Buffer} arg.childIndex - Child index buffer (must be HDPublicKey.ChildIndexSize bytes)
|
|
167
|
+
* @param {Buffer} arg.chainCode - Chain code buffer (must be HDPublicKey.ChainCodeSize bytes)
|
|
168
|
+
* @param {Buffer} arg.publicKey - Public key buffer (must be HDPublicKey.PublicKeySize bytes)
|
|
169
|
+
* @param {Buffer} [arg.checksum] - Optional checksum buffer (must be HDPublicKey.CheckSumSize bytes if provided)
|
|
170
|
+
* @throws {Error} If any buffer is invalid or has incorrect size
|
|
171
|
+
*/
|
|
172
|
+
export function _validateBufferArguments(arg: {
|
|
173
|
+
version: Buffer;
|
|
174
|
+
depth: Buffer;
|
|
175
|
+
parentFingerPrint: Buffer;
|
|
176
|
+
childIndex: Buffer;
|
|
177
|
+
chainCode: Buffer;
|
|
178
|
+
publicKey: Buffer;
|
|
179
|
+
checksum?: Buffer;
|
|
180
|
+
}): void;
|
|
181
|
+
/**
|
|
182
|
+
* Creates an HDPublicKey instance from a string representation.
|
|
183
|
+
* @param {string} arg - The string to convert to an HDPublicKey.
|
|
184
|
+
* @returns {HDPublicKey} A new HDPublicKey instance.
|
|
185
|
+
* @throws {Error} Throws if the input is not a valid string.
|
|
186
|
+
*/
|
|
187
|
+
export function fromString(arg: string): HDPublicKey;
|
|
188
|
+
/**
|
|
189
|
+
* Creates an HDPublicKey instance from an object.
|
|
190
|
+
* @param {Object} arg - The object containing public key data
|
|
191
|
+
* @returns {HDPublicKey} A new HDPublicKey instance
|
|
192
|
+
* @throws {Error} Will throw if no valid object argument is provided
|
|
193
|
+
*/
|
|
194
|
+
export function fromObject(arg: any): HDPublicKey;
|
|
195
|
+
/**
|
|
196
|
+
* Create a HDPublicKey from a buffer argument
|
|
197
|
+
*
|
|
198
|
+
* @param {Buffer} arg
|
|
199
|
+
* @return {HDPublicKey}
|
|
200
|
+
*/
|
|
201
|
+
export function fromBuffer(arg: Buffer): HDPublicKey;
|
|
202
|
+
/**
|
|
203
|
+
* Create a HDPublicKey from a hex string argument
|
|
204
|
+
*
|
|
205
|
+
* @param {Buffer} arg
|
|
206
|
+
* @return {HDPublicKey}
|
|
207
|
+
*/
|
|
208
|
+
export function fromHex(hex: any): HDPublicKey;
|
|
209
|
+
export let Hardened: number;
|
|
210
|
+
export let RootElementAlias: string[];
|
|
211
|
+
export let VersionSize: number;
|
|
212
|
+
export let DepthSize: number;
|
|
213
|
+
export let ParentFingerPrintSize: number;
|
|
214
|
+
export let ChildIndexSize: number;
|
|
215
|
+
export let ChainCodeSize: number;
|
|
216
|
+
export let PublicKeySize: number;
|
|
217
|
+
export let CheckSumSize: number;
|
|
218
|
+
export let DataSize: number;
|
|
219
|
+
export let SerializedByteSize: number;
|
|
220
|
+
export let VersionStart: number;
|
|
221
|
+
export let VersionEnd: number;
|
|
222
|
+
import DepthStart = VersionEnd;
|
|
223
|
+
export { DepthStart };
|
|
224
|
+
export let DepthEnd: number;
|
|
225
|
+
import ParentFingerPrintStart = DepthEnd;
|
|
226
|
+
export { ParentFingerPrintStart };
|
|
227
|
+
export let ParentFingerPrintEnd: number;
|
|
228
|
+
import ChildIndexStart = ParentFingerPrintEnd;
|
|
229
|
+
export { ChildIndexStart };
|
|
230
|
+
export let ChildIndexEnd: number;
|
|
231
|
+
import ChainCodeStart = ChildIndexEnd;
|
|
232
|
+
export { ChainCodeStart };
|
|
233
|
+
export let ChainCodeEnd: number;
|
|
234
|
+
import PublicKeyStart = ChainCodeEnd;
|
|
235
|
+
export { PublicKeyStart };
|
|
236
|
+
export let PublicKeyEnd: number;
|
|
237
|
+
import ChecksumStart = PublicKeyEnd;
|
|
238
|
+
export { ChecksumStart };
|
|
239
|
+
export let ChecksumEnd: number;
|
|
240
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Address = require("./address.cjs");
|
|
2
|
+
import Block = require("./block/block.cjs");
|
|
3
|
+
import MerkleBlock = require("./block/merkleblock.cjs");
|
|
4
|
+
import BlockHeader = require("./block/blockheader.cjs");
|
|
5
|
+
import HDPrivateKey = require("./hdprivatekey.cjs");
|
|
6
|
+
import HDPublicKey = require("./hdpublickey.cjs");
|
|
7
|
+
import Sighash = require("./transaction/sighash.cjs");
|
|
8
|
+
import TransactionSignature = require("./transaction/signature.cjs");
|
|
9
|
+
import Output = require("./transaction/output.cjs");
|
|
10
|
+
import Input = require("./transaction/input/input.cjs");
|
|
11
|
+
import Networks = require("./networks.cjs");
|
|
12
|
+
import Network = require("./network.cjs");
|
|
13
|
+
import Opcode = require("./opcode.cjs");
|
|
14
|
+
import PrivateKey = require("./privatekey.cjs");
|
|
15
|
+
import PublicKey = require("./publickey.cjs");
|
|
16
|
+
import Script = require("./script/script.cjs");
|
|
17
|
+
import Interpreter = require("./interpreter/interpreter.cjs");
|
|
18
|
+
import Transaction = require("./transaction/transaction.cjs");
|
|
19
|
+
import HashCache = require("./hash-cache.cjs");
|
|
20
|
+
import Message = require("./message/message.cjs");
|
|
21
|
+
import Mnemonic = require("./mnemonic/mnemonic.cjs");
|
|
22
|
+
import errors = require("./errors/index.cjs");
|
|
23
|
+
import util = require("./util/index.cjs");
|
|
24
|
+
import encoding = require("./encoding/index.cjs");
|
|
25
|
+
import crypto = require("./crypto/index.cjs");
|
|
26
|
+
export { Address, Block, MerkleBlock, BlockHeader, HDPrivateKey, HDPublicKey, Sighash, TransactionSignature, Output, Input, Networks, Network, Opcode, PrivateKey, PublicKey, Script, Interpreter, Transaction, HashCache, Message, Mnemonic, errors, util, encoding, crypto };
|