Socket
Socket
Sign inDemoInstall

eth-hd-keyring

Package Overview
Dependencies
54
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.2.0

4

index.js

@@ -25,2 +25,3 @@ const EventEmitter = require('events').EventEmitter

numberOfAccounts: this.wallets.length,
hdPath: this.hdPath,
})

@@ -34,2 +35,3 @@ }

this.root = null
this.hdPath = opts.hdPath || hdPathString

@@ -119,3 +121,3 @@ if (opts.mnemonic) {

this.hdWallet = hdkey.fromMasterSeed(seed)
this.root = this.hdWallet.derivePath(hdPathString)
this.root = this.hdWallet.derivePath(this.hdPath)
}

@@ -122,0 +124,0 @@

{
"name": "eth-hd-keyring",
"version": "1.1.1",
"version": "1.2.0",
"description": "A simple standard interface for a seed phrase generated set of Ethereum accounts.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -154,2 +154,55 @@ const assert = require('assert')

.catch((reason) => {
console.error('failed because', reason)
})
})
})
describe('custom hd paths', function () {
it('can deserialize with an hdPath param and generate the same accounts.', function (done) {
const hdPathString = `m/44'/60'/0'/0`
const sampleMnemonic = 'finish oppose decorate face calm tragic certain desk hour urge dinosaur mango'
keyring.deserialize({
mnemonic: sampleMnemonic,
numberOfAccounts: 1,
hdPath: hdPathString,
})
.then(() => {
return keyring.getAccounts()
})
.then((addresses) => {
assert.equal(addresses[0], firstAcct)
return keyring.serialize()
})
.then((serialized) => {
assert.equal(serialized.hdPath, hdPathString)
done()
})
.catch((reason) => {
console.error('failed because', reason)
})
})
it('can deserialize with an hdPath param and generate different accounts.', function (done) {
const hdPathString = `m/44'/60'/0'/1`
const sampleMnemonic = 'finish oppose decorate face calm tragic certain desk hour urge dinosaur mango'
keyring.deserialize({
mnemonic: sampleMnemonic,
numberOfAccounts: 1,
hdPath: hdPathString,
})
.then(() => {
return keyring.getAccounts()
})
.then((addresses) => {
assert.notEqual(addresses[0], firstAcct)
return keyring.serialize()
})
.then((serialized) => {
assert.equal(serialized.hdPath, hdPathString)
done()
})
.catch((reason) => {
console.log('failed because', reason)

@@ -156,0 +209,0 @@ })

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc