From 2ef5e2f003f85cf8aa17129964d635f271ca2aac Mon Sep 17 00:00:00 2001 From: "Ryan X. Charles" Date: Thu, 28 Aug 2014 17:55:33 -0700 Subject: [PATCH] network -> networkstr --- lib/bip32.js | 16 ++++++++-------- lib/key.js | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/bip32.js b/lib/bip32.js index 4025c93..a88b654 100644 --- a/lib/bip32.js +++ b/lib/bip32.js @@ -13,10 +13,10 @@ var BIP32 = function BIP32() { return new BIP32(); } -BIP32.prototype.fromRandom = function(network) { - if (!network) - network = 'mainnet'; - this.version = constants[network].bip32privkey; +BIP32.prototype.fromRandom = function(networkstr) { + if (!networkstr) + networkstr = 'mainnet'; + this.version = constants[networkstr].bip32privkey; this.depth = 0x00; this.parentFingerprint = new Buffer([0, 0, 0, 0]); this.childIndex = new Buffer([0, 0, 0, 0]); @@ -46,9 +46,9 @@ BIP32.prototype.fromString = function(str) { return this; }; -BIP32.prototype.fromSeed = function(bytes, network) { - if (!network) - network = 'mainnet'; +BIP32.prototype.fromSeed = function(bytes, networkstr) { + if (!networkstr) + networkstr = 'mainnet'; if (!Buffer.isBuffer(bytes)) throw new Error('gcbytes must be a buffer'); @@ -62,7 +62,7 @@ BIP32.prototype.fromSeed = function(bytes, network) { this.parentFingerprint = new Buffer([0, 0, 0, 0]); this.childIndex = new Buffer([0, 0, 0, 0]); this.chainCode = hash.slice(32, 64); - this.version = constants[network].bip32privkey; + this.version = constants[networkstr].bip32privkey; this.key = new Key(); this.key.privkey = new Privkey({bn: bn.fromBuffer(hash.slice(0, 32))}); this.key.privkey2pubkey(); diff --git a/lib/key.js b/lib/key.js index 2616ba3..bec7295 100644 --- a/lib/key.js +++ b/lib/key.js @@ -40,8 +40,8 @@ Key.prototype.fromString = function(str) { } }; -Key.prototype.getAddress = function(network) { - return Address().fromPubkey(this.pubkey, network); +Key.prototype.getAddress = function(networkstr) { + return Address().fromPubkey(this.pubkey, networkstr); }; Key.prototype.privkey2pubkey = function() {