tabs -> spaces
This commit is contained in:
parent
eca20ad297
commit
9358a40500
3 changed files with 60 additions and 60 deletions
|
@ -190,6 +190,6 @@ ECKey.prototype.verify = function (hash, sig) {
|
||||||
* Parse an exported private key contained in a string.
|
* Parse an exported private key contained in a string.
|
||||||
*/
|
*/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
ECKey: ECKey,
|
ECKey: ECKey,
|
||||||
ECPubKey: ECPubKey
|
ECPubKey: ECPubKey
|
||||||
};
|
};
|
||||||
|
|
106
test/eckey.js
106
test/eckey.js
|
@ -70,72 +70,72 @@ describe('ECKey', function() {
|
||||||
|
|
||||||
describe('toAddress', function() {
|
describe('toAddress', function() {
|
||||||
var privkeys = [
|
var privkeys = [
|
||||||
'CA48EC9783CF3AD0DFEFF1FC254395A2E403CBBC666477B61B45E31D3B8AB458',
|
'CA48EC9783CF3AD0DFEFF1FC254395A2E403CBBC666477B61B45E31D3B8AB458',
|
||||||
'1111111111111111111111111111111111111111111111111111111111111111',
|
'1111111111111111111111111111111111111111111111111111111111111111',
|
||||||
'18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725'
|
'18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725'
|
||||||
];
|
];
|
||||||
|
|
||||||
// compressed pubkeys
|
// compressed pubkeys
|
||||||
var cpubkeys = [
|
var cpubkeys = [
|
||||||
'024B12D9D7C77DB68388B6FF7C89046174C871546436806BCD80D07C28EA811992',
|
'024B12D9D7C77DB68388B6FF7C89046174C871546436806BCD80D07C28EA811992',
|
||||||
'034F355BDCB7CC0AF728EF3CCEB9615D90684BB5B2CA5F859AB0F0B704075871AA',
|
'034F355BDCB7CC0AF728EF3CCEB9615D90684BB5B2CA5F859AB0F0B704075871AA',
|
||||||
'0250863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B2352'
|
'0250863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B2352'
|
||||||
];
|
];
|
||||||
|
|
||||||
var pubkeys = cpubkeys.map(function(x) {
|
var pubkeys = cpubkeys.map(function(x) {
|
||||||
return new ECPubKey(x).pub.getEncoded(false);
|
return new ECPubKey(x).pub.getEncoded(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('mainnet', function() {
|
it('mainnet', function() {
|
||||||
var addresses = [
|
var addresses = [
|
||||||
'19SgmoUj4xowEjwtXvNAtYTAgbvR9iBCui',
|
'19SgmoUj4xowEjwtXvNAtYTAgbvR9iBCui',
|
||||||
'1MsHWS1BnwMc3tLE8G35UXsS58fKipzB7a',
|
'1MsHWS1BnwMc3tLE8G35UXsS58fKipzB7a',
|
||||||
'16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM'
|
'16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM'
|
||||||
];
|
];
|
||||||
var compressedAddresses = [
|
var compressedAddresses = [
|
||||||
'1AA4sjKW2aUmbtN3MtegdvhYtDBbDEke1q',
|
'1AA4sjKW2aUmbtN3MtegdvhYtDBbDEke1q',
|
||||||
'1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9',
|
'1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9',
|
||||||
'1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs',
|
'1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs',
|
||||||
];
|
];
|
||||||
|
|
||||||
for (var i = 0; i < addresses.length; ++i) {
|
for (var i = 0; i < addresses.length; ++i) {
|
||||||
var priv = new ECKey(privkeys[i], false);
|
var priv = new ECKey(privkeys[i], false);
|
||||||
var pubcomp = new ECPubKey(cpubkeys[i], true);
|
var pubcomp = new ECPubKey(cpubkeys[i], true);
|
||||||
var pub = new ECPubKey(pubkeys[i], false);
|
var pub = new ECPubKey(pubkeys[i], false);
|
||||||
|
|
||||||
var addr = addresses[i];
|
var addr = addresses[i];
|
||||||
var caddr = compressedAddresses[i];
|
var caddr = compressedAddresses[i];
|
||||||
|
|
||||||
assert.equal(priv.getAddress().toString(), addr);
|
assert.equal(priv.getAddress().toString(), addr);
|
||||||
assert.equal(pub.getAddress().toString(), addr);
|
assert.equal(pub.getAddress().toString(), addr);
|
||||||
assert.equal(pubcomp.getAddress().toString(), caddr);
|
assert.equal(pubcomp.getAddress().toString(), caddr);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
it('testnet', function() {
|
it('testnet', function() {
|
||||||
var addresses = [
|
var addresses = [
|
||||||
'19SgmoUj4xowEjwtXvNAtYTAgbvR9iBCui',
|
'19SgmoUj4xowEjwtXvNAtYTAgbvR9iBCui',
|
||||||
'1MsHWS1BnwMc3tLE8G35UXsS58fKipzB7a',
|
'1MsHWS1BnwMc3tLE8G35UXsS58fKipzB7a',
|
||||||
'16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM'
|
'16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM'
|
||||||
];
|
];
|
||||||
var compressedAddresses = [
|
var compressedAddresses = [
|
||||||
'1AA4sjKW2aUmbtN3MtegdvhYtDBbDEke1q',
|
'1AA4sjKW2aUmbtN3MtegdvhYtDBbDEke1q',
|
||||||
'1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9',
|
'1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9',
|
||||||
'1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs',
|
'1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs',
|
||||||
];
|
];
|
||||||
|
|
||||||
for (var i = 0; i < addresses.length; ++i) {
|
for (var i = 0; i < addresses.length; ++i) {
|
||||||
var priv = new ECKey(privkeys[i], false);
|
var priv = new ECKey(privkeys[i], false);
|
||||||
var pubcomp = new ECPubKey(cpubkeys[i], true);
|
var pubcomp = new ECPubKey(cpubkeys[i], true);
|
||||||
var pub = new ECPubKey(pubkeys[i], false);
|
var pub = new ECPubKey(pubkeys[i], false);
|
||||||
|
|
||||||
var addr = addresses[i];
|
var addr = addresses[i];
|
||||||
var caddr = compressedAddresses[i];
|
var caddr = compressedAddresses[i];
|
||||||
|
|
||||||
assert.equal(priv.getAddress().toString(), addr);
|
assert.equal(priv.getAddress().toString(), addr);
|
||||||
assert.equal(pub.getAddress().toString(), addr);
|
assert.equal(pub.getAddress().toString(), addr);
|
||||||
assert.equal(pubcomp.getAddress().toString(), caddr);
|
assert.equal(pubcomp.getAddress().toString(), caddr);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
|
@ -33,10 +33,10 @@ describe('HDWallet', function() {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('constructor & seed deserialization', function() {
|
describe('constructor & seed deserialization', function() {
|
||||||
var expectedPrivateKey = '0fd71c652e847ba7ea7956e3cf3fc0a0985871846b1b2c23b9c6a29a38cee86001';
|
var expectedPrivateKey = '0fd71c652e847ba7ea7956e3cf3fc0a0985871846b1b2c23b9c6a29a38cee86001';
|
||||||
var seed = [
|
var seed = [
|
||||||
99, 114, 97, 122, 121, 32, 104, 111, 114, 115, 101, 32, 98,
|
99, 114, 97, 122, 121, 32, 104, 111, 114, 115, 101, 32, 98,
|
||||||
97, 116, 116, 101, 114, 121, 32, 115, 116, 97, 112, 108, 101
|
97, 116, 116, 101, 114, 121, 32, 115, 116, 97, 112, 108, 101
|
||||||
];
|
];
|
||||||
|
|
||||||
it('creates from binary seed', function() {
|
it('creates from binary seed', function() {
|
||||||
|
@ -244,12 +244,12 @@ describe('HDWallet', function() {
|
||||||
describe('network types', function() {
|
describe('network types', function() {
|
||||||
it('ensures that a mainnet Wallet generates mainnet addresses', function() {
|
it('ensures that a mainnet Wallet generates mainnet addresses', function() {
|
||||||
var wallet = new HDWallet('foobar', 'mainnet')
|
var wallet = new HDWallet('foobar', 'mainnet')
|
||||||
assert.equal(wallet.getAddress().toString(), '1JNymexJHEr5u1BndiChMStFkCgPm4EQ6o');
|
assert.equal(wallet.getAddress().toString(), '1JNymexJHEr5u1BndiChMStFkCgPm4EQ6o');
|
||||||
})
|
})
|
||||||
|
|
||||||
it('ensures that a testnet Wallet generates testnet addresses', function() {
|
it('ensures that a testnet Wallet generates testnet addresses', function() {
|
||||||
var wallet = new HDWallet('foobar', 'testnet')
|
var wallet = new HDWallet('foobar', 'testnet')
|
||||||
assert.equal(wallet.getAddress().toString(), 'mxtw4i3H6GHLg7fQMHB5BN6acCH6kQ7aoY');
|
assert.equal(wallet.getAddress().toString(), 'mxtw4i3H6GHLg7fQMHB5BN6acCH6kQ7aoY');
|
||||||
})
|
})
|
||||||
|
|
||||||
it('throws an excption when unknown network type is passed in', function() {
|
it('throws an excption when unknown network type is passed in', function() {
|
||||||
|
|
Loading…
Reference in a new issue