Comparing version 3.0.5 to 3.0.6
@@ -251,3 +251,4 @@ /** | ||
// Bitcoin hardcoded by default, can use package `coininfo` for others | ||
// Bitcoin defaults hard-coded by default. | ||
// Use package `coininfo` for others. | ||
DashHd.MAINNET = { private: 0x0488ade4, public: 0x0488b21e }; | ||
@@ -310,3 +311,5 @@ DashHd.TESTNET = { private: 0x043587cf, public: 0x04358394 }; | ||
// TODO - missing custom version | ||
DashHd.toXPrvBytes = function (hdkey) { | ||
DashHd.toXPrvBytes = function (hdkey, opts) { | ||
let version = opts?.version || DashHd.MAINNET.private; | ||
//@ts-ignore - will throw if null | ||
@@ -316,3 +319,3 @@ let xprvPart = DashHd._toXBytes(hdkey, hdkey.privateKey); | ||
let xkeyDv = new DataView(xprvBytes.buffer); | ||
xkeyDv.setUint32(0, DashHd.MAINNET.private, BUFFER_BE); | ||
xkeyDv.setUint32(0, version, BUFFER_BE); | ||
xprvBytes.set(xprvPart, 4); | ||
@@ -328,8 +331,9 @@ return xprvBytes; | ||
// TODO - missing custom version | ||
DashHd.toXPubBytes = function (hdkey) { | ||
DashHd.toXPubBytes = function (hdkey, opts) { | ||
let version = opts?.version || DashHd.MAINNET.public; | ||
let xpubPart = DashHd._toXBytes(hdkey, hdkey.publicKey); | ||
let xpubBytes = new Uint8Array(xpubPart.length + 4); | ||
let xkeyDv = new DataView(xpubBytes.buffer); | ||
xkeyDv.setUint32(0, DashHd.MAINNET.private, BUFFER_BE); | ||
xkeyDv.setUint32(0, version, BUFFER_BE); | ||
xpubBytes.set(xpubPart, 4); | ||
@@ -828,2 +832,3 @@ return xpubBytes; | ||
* @param {HDKey} hdkey | ||
* @param {HDToXKeyBytesOpts} [opts] | ||
* @returns {Uint8Array} | ||
@@ -833,2 +838,7 @@ */ | ||
/** | ||
* @typedef HDToXKeyBytesOpts | ||
* @prop {Number} [version] | ||
*/ | ||
/** | ||
* @callback HDToXBytes | ||
@@ -835,0 +845,0 @@ * @param {HDKey} hdkey |
{ | ||
"name": "dashhd", | ||
"version": "3.0.5", | ||
"version": "3.0.6", | ||
"description": "Manage HD Keys from HD Wallet Seed and Extended (xprv, xpub) Key Paths. Part of $DASH Tools.", | ||
@@ -5,0 +5,0 @@ "main": "dashhd.js", |
@@ -102,3 +102,3 @@ # [DashHD.js](https://github.com/dashhive/dashhd.js) | ||
```html | ||
<script src="https://unpkg.com/@dashincubator/secp256k1.js"></script> | ||
<script src="https://unpkg.com/@dashincubator/secp256k1@1.7.1-5/secp256k1.js"></script> | ||
<script src="https://unpkg.com/dashkeys@1.x/dashkeys.js"></script> | ||
@@ -129,3 +129,3 @@ <script src="https://unpkg.com/dashhd@3.x/dashhd.js"></script> | ||
let hdpath = `m/44'/5'/0'/0/0`; | ||
let key = await DashHd.derivePath(hdpath); | ||
let key = await DashHd.derivePath(walletKey, hdpath); | ||
@@ -132,0 +132,0 @@ let wif = await DashHd.toWif(key.privateKey); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73557
880