network -> networkstr

This commit is contained in:
Ryan X. Charles 2014-08-28 17:55:33 -07:00
parent 280578d641
commit 2ef5e2f003
2 changed files with 10 additions and 10 deletions

View File

@ -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();

View File

@ -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() {