|
|
@ -22,19 +22,19 @@ describe('Wallet', function() { |
|
|
|
}) |
|
|
|
|
|
|
|
it("generates m/0' as the main account", function() { |
|
|
|
var mainAccount = wallet.accountZero |
|
|
|
var mainAccount = wallet.getAccountZero() |
|
|
|
assert.equal(mainAccount.index, 0 + HDNode.HIGHEST_BIT) |
|
|
|
assert.equal(mainAccount.depth, 1) |
|
|
|
}) |
|
|
|
|
|
|
|
it("generates m/0'/0 as the external account", function() { |
|
|
|
var account = wallet.externalAccount |
|
|
|
var account = wallet.getExternalAccount() |
|
|
|
assert.equal(account.index, 0) |
|
|
|
assert.equal(account.depth, 2) |
|
|
|
}) |
|
|
|
|
|
|
|
it("generates m/0'/1 as the internal account", function() { |
|
|
|
var account = wallet.internalAccount |
|
|
|
var account = wallet.getInternalAccount() |
|
|
|
assert.equal(account.index, 1) |
|
|
|
assert.equal(account.depth, 2) |
|
|
|
}) |
|
|
@ -79,8 +79,8 @@ describe('Wallet', function() { |
|
|
|
it('returns the private key at the given index of external account', function(){ |
|
|
|
var wallet = new Wallet(seed, {network: 'testnet'}) |
|
|
|
|
|
|
|
assertPrivateKeyEqual(wallet.getPrivateKey(0), wallet.externalAccount.derive(0).priv) |
|
|
|
assertPrivateKeyEqual(wallet.getPrivateKey(1), wallet.externalAccount.derive(1).priv) |
|
|
|
assertPrivateKeyEqual(wallet.getPrivateKey(0), wallet.getExternalAccount().derive(0).priv) |
|
|
|
assertPrivateKeyEqual(wallet.getPrivateKey(1), wallet.getExternalAccount().derive(1).priv) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
@ -88,8 +88,8 @@ describe('Wallet', function() { |
|
|
|
it('returns the private key at the given index of internal account', function(){ |
|
|
|
var wallet = new Wallet(seed, {network: 'testnet'}) |
|
|
|
|
|
|
|
assertPrivateKeyEqual(wallet.getInternalPrivateKey(0), wallet.internalAccount.derive(0).priv) |
|
|
|
assertPrivateKeyEqual(wallet.getInternalPrivateKey(1), wallet.internalAccount.derive(1).priv) |
|
|
|
assertPrivateKeyEqual(wallet.getInternalPrivateKey(0), wallet.getInternalAccount().derive(0).priv) |
|
|
|
assertPrivateKeyEqual(wallet.getInternalPrivateKey(1), wallet.getInternalAccount().derive(1).priv) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
@ -101,9 +101,9 @@ describe('Wallet', function() { |
|
|
|
wallet.generateAddress() |
|
|
|
|
|
|
|
assertPrivateKeyEqual(wallet.getPrivateKeyForAddress("n2fiWrHqD6GM5GiEqkbWAc6aaZQp3ba93X"), |
|
|
|
wallet.externalAccount.derive(1).priv) |
|
|
|
wallet.getExternalAccount().derive(1).priv) |
|
|
|
assertPrivateKeyEqual(wallet.getPrivateKeyForAddress("mnXiDR4MKsFxcKJEZjx4353oXvo55iuptn"), |
|
|
|
wallet.internalAccount.derive(0).priv) |
|
|
|
wallet.getInternalAccount().derive(0).priv) |
|
|
|
}) |
|
|
|
|
|
|
|
it('raises an error when address is not found', function(){ |
|
|
|