Merge pull request #564 from maraoz/ref/dirs

Refactor dirs, part 2
This commit is contained in:
Esteban Ordano 2014-11-21 13:39:45 -03:00
commit 1dce3d6ad9
33 changed files with 108 additions and 103 deletions

View File

@ -1,19 +1,21 @@
var bitcore = module.exports; var bitcore = module.exports;
// protocol
bitcore.Constants = require('./lib/protocol/constants');
bitcore.Base58 = require('./lib/protocol/base58');
bitcore.Base58Check = require('./lib/protocol/base58check');
bitcore.BufferReader = require('./lib/protocol/bufferreader');
bitcore.BufferWriter = require('./lib/protocol/bufferwriter');
bitcore.Varint = require('./lib/protocol/varint');
// crypto // crypto
bitcore.BN = require('./lib/crypto/bn'); bitcore.crypto = {};
bitcore.ECDSA = require('./lib/crypto/ecdsa'); bitcore.crypto.BN = require('./lib/crypto/bn');
bitcore.Hash = require('./lib/crypto/hash'); bitcore.crypto.ECDSA = require('./lib/crypto/ecdsa');
bitcore.Random = require('./lib/crypto/random'); bitcore.crypto.Hash = require('./lib/crypto/hash');
bitcore.Point = require('./lib/crypto/point'); bitcore.crypto.Random = require('./lib/crypto/random');
bitcore.crypto.Point = require('./lib/crypto/point');
// encoding
bitcore.encoding = {};
bitcore.encoding.Base58 = require('./lib/encoding/base58');
bitcore.encoding.Base58Check = require('./lib/encoding/base58check');
bitcore.encoding.BufferReader = require('./lib/encoding/bufferreader');
bitcore.encoding.BufferWriter = require('./lib/encoding/bufferwriter');
bitcore.encoding.Varint = require('./lib/encoding/varint');
// main bitcoin library // main bitcoin library
bitcore.Address = require('./lib/address'); bitcore.Address = require('./lib/address');
@ -21,6 +23,7 @@ bitcore.BIP32 = require('./lib/bip32');
bitcore.Block = require('./lib/block'); bitcore.Block = require('./lib/block');
bitcore.Blockheader = require('./lib/blockheader'); bitcore.Blockheader = require('./lib/blockheader');
bitcore.Keypair = require('./lib/keypair'); bitcore.Keypair = require('./lib/keypair');
bitcore.Networks = require('./lib/networks');
bitcore.Opcode = require('./lib/opcode'); bitcore.Opcode = require('./lib/opcode');
bitcore.Privkey = require('./lib/privkey'); bitcore.Privkey = require('./lib/privkey');
bitcore.Pubkey = require('./lib/pubkey'); bitcore.Pubkey = require('./lib/pubkey');

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
var base58check = require('./protocol/base58check'); var base58check = require('./encoding/base58check');
var constants = require('./protocol/constants'); var networks = require('./networks');
var Hash = require('./crypto/hash'); var Hash = require('./crypto/hash');
function Address(buf) { function Address(buf) {
@ -29,16 +29,16 @@ Address.prototype.fromBuffer = function(buf) {
if (buf.length !== 1 + 20) if (buf.length !== 1 + 20)
throw new Error('Address buffers must be exactly 21 bytes'); throw new Error('Address buffers must be exactly 21 bytes');
var version = buf[0]; var version = buf[0];
if (version === constants['mainnet']['pubkeyhash']) { if (version === networks['mainnet']['pubkeyhash']) {
this.networkstr = 'mainnet'; this.networkstr = 'mainnet';
this.typestr = 'pubkeyhash'; this.typestr = 'pubkeyhash';
} else if (version === constants['mainnet']['scripthash']) { } else if (version === networks['mainnet']['scripthash']) {
this.networkstr = 'mainnet'; this.networkstr = 'mainnet';
this.typestr = 'scripthash'; this.typestr = 'scripthash';
} else if (version === constants['testnet']['pubkeyhash']) { } else if (version === networks['testnet']['pubkeyhash']) {
this.networkstr = 'testnet'; this.networkstr = 'testnet';
this.typestr = 'pubkeyhash'; this.typestr = 'pubkeyhash';
} else if (version === constants['testnet']['scripthash']) { } else if (version === networks['testnet']['scripthash']) {
this.networkstr = 'testnet'; this.networkstr = 'testnet';
this.typestr = 'scripthash'; this.typestr = 'scripthash';
} else { } else {
@ -98,7 +98,7 @@ Address.prototype.isValid = function() {
}; };
Address.prototype.toBuffer = function() { Address.prototype.toBuffer = function() {
var version = new Buffer([constants[this.networkstr][this.typestr]]); var version = new Buffer([networks[this.networkstr][this.typestr]]);
var buf = Buffer.concat([version, this.hashbuf]); var buf = Buffer.concat([version, this.hashbuf]);
return buf; return buf;
}; };

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
var Base58Check = require('./protocol/base58check'); var Base58Check = require('./encoding/base58check');
var constants = require('./protocol/constants'); var networks = require('./networks');
var Hash = require('./crypto/hash'); var Hash = require('./crypto/hash');
var Point = require('./crypto/point'); var Point = require('./crypto/point');
var Random = require('./crypto/random'); var Random = require('./crypto/random');
@ -38,7 +38,7 @@ BIP32.prototype.set = function(obj) {
BIP32.prototype.fromRandom = function(networkstr) { BIP32.prototype.fromRandom = function(networkstr) {
if (!networkstr) if (!networkstr)
networkstr = 'mainnet'; networkstr = 'mainnet';
this.version = constants[networkstr].bip32privkey; this.version = networks[networkstr].bip32privkey;
this.depth = 0x00; this.depth = 0x00;
this.parentfingerprint = new Buffer([0, 0, 0, 0]); this.parentfingerprint = new Buffer([0, 0, 0, 0]);
this.childindex = new Buffer([0, 0, 0, 0]); this.childindex = new Buffer([0, 0, 0, 0]);
@ -72,7 +72,7 @@ BIP32.prototype.fromSeed = function(bytes, networkstr) {
this.parentfingerprint = new Buffer([0, 0, 0, 0]); this.parentfingerprint = new Buffer([0, 0, 0, 0]);
this.childindex = new Buffer([0, 0, 0, 0]); this.childindex = new Buffer([0, 0, 0, 0]);
this.chaincode = hash.slice(32, 64); this.chaincode = hash.slice(32, 64);
this.version = constants[networkstr].bip32privkey; this.version = networks[networkstr].bip32privkey;
this.keypair = new Keypair(); this.keypair = new Keypair();
this.keypair.privkey = new Privkey({bn: BN().fromBuffer(hash.slice(0, 32))}); this.keypair.privkey = new Privkey({bn: BN().fromBuffer(hash.slice(0, 32))});
this.keypair.privkey2pubkey(); this.keypair.privkey2pubkey();
@ -99,12 +99,12 @@ BIP32.prototype.initFromBytes = function(bytes) {
var keyBytes = bytes.slice(45, 78); var keyBytes = bytes.slice(45, 78);
var isPrivate = var isPrivate =
(this.version == constants.mainnet.bip32privkey || (this.version == networks.mainnet.bip32privkey ||
this.version == constants.testnet.bip32privkey); this.version == networks.testnet.bip32privkey);
var isPublic = var isPublic =
(this.version == constants.mainnet.bip32pubkey || (this.version == networks.mainnet.bip32pubkey ||
this.version == constants.testnet.bip32pubkey); this.version == networks.testnet.bip32pubkey);
if (isPrivate && keyBytes[0] == 0) { if (isPrivate && keyBytes[0] == 0) {
this.keypair = new Keypair(); this.keypair = new Keypair();
@ -130,13 +130,13 @@ BIP32.prototype.buildxpubkey = function() {
var v = null; var v = null;
switch (this.version) { switch (this.version) {
case constants.mainnet.bip32pubkey: case networks.mainnet.bip32pubkey:
case constants.mainnet.bip32privkey: case networks.mainnet.bip32privkey:
v = constants.mainnet.bip32pubkey; v = networks.mainnet.bip32pubkey;
break; break;
case constants.testnet.bip32pubkey: case networks.testnet.bip32pubkey:
case constants.testnet.bip32privkey: case networks.testnet.bip32privkey:
v = constants.testnet.bip32pubkey; v = networks.testnet.bip32pubkey;
break; break;
default: default:
throw new Error('Unknown version'); throw new Error('Unknown version');
@ -248,8 +248,8 @@ BIP32.prototype.deriveChild = function(i) {
var usePrivate = (i & 0x80000000) != 0; var usePrivate = (i & 0x80000000) != 0;
var isPrivate = var isPrivate =
(this.version == constants.mainnet.bip32privkey || (this.version == networks.mainnet.bip32privkey ||
this.version == constants.testnet.bip32privkey); this.version == networks.testnet.bip32privkey);
if (usePrivate && (!this.hasprivkey || !isPrivate)) if (usePrivate && (!this.hasprivkey || !isPrivate))
throw new Error('Cannot do private key derivation without private key'); throw new Error('Cannot do private key derivation without private key');
@ -316,8 +316,8 @@ BIP32.prototype.deriveChild = function(i) {
BIP32.prototype.toString = function() { BIP32.prototype.toString = function() {
var isPrivate = var isPrivate =
(this.version == constants.mainnet.bip32privkey || (this.version == networks.mainnet.bip32privkey ||
this.version == constants.testnet.bip32privkey); this.version == networks.testnet.bip32privkey);
if (isPrivate) if (isPrivate)
return this.xprivkeyString(); return this.xprivkeyString();

View File

@ -1,9 +1,9 @@
'use strict'; 'use strict';
var Hash = require('./crypto/hash'); var Hash = require('./crypto/hash');
var BufferReader = require('./protocol/bufferreader'); var BufferReader = require('./encoding/bufferreader');
var BufferWriter = require('./protocol/bufferwriter'); var BufferWriter = require('./encoding/bufferwriter');
var Varint = require('./protocol/varint'); var Varint = require('./encoding/varint');
var Transaction = require('./transaction'); var Transaction = require('./transaction');
var Blockheader = require('./blockheader'); var Blockheader = require('./blockheader');

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
var BufferReader = require('./protocol/bufferreader'); var BufferReader = require('./encoding/bufferreader');
var BufferWriter = require('./protocol/bufferwriter'); var BufferWriter = require('./encoding/bufferwriter');
var Blockheader = function Blockheader(version, prevblockidbuf, merklerootbuf, time, bits, nonce) { var Blockheader = function Blockheader(version, prevblockidbuf, merklerootbuf, time, bits, nonce) {
if (!(this instanceof Blockheader)) if (!(this instanceof Blockheader))

View File

@ -22,7 +22,4 @@ exports.testnet = {
bip32privkey: 0x04358394, bip32privkey: 0x04358394,
}; };
exports.ephemeral = { exports.livenet = exports.mainnet;
prefix: 0x0f,
identity: 0x02
};

View File

@ -3,8 +3,8 @@
var BN = require('./crypto/bn'); var BN = require('./crypto/bn');
var Point = require('./crypto/point'); var Point = require('./crypto/point');
var Random = require('./crypto/random'); var Random = require('./crypto/random');
var constants = require('./protocol/constants'); var networks = require('./networks');
var base58check = require('./protocol/base58check'); var base58check = require('./encoding/base58check');
var Privkey = function Privkey(bn) { var Privkey = function Privkey(bn) {
if (!(this instanceof Privkey)) if (!(this instanceof Privkey))
@ -50,7 +50,7 @@ Privkey.prototype.fromRandom = function() {
Privkey.prototype.validate = function() { Privkey.prototype.validate = function() {
if (!this.bn.lt(Point.getN())) if (!this.bn.lt(Point.getN()))
throw new Error('Number must be less than N'); throw new Error('Number must be less than N');
if (typeof constants[this.networkstr] === undefined) if (typeof networks[this.networkstr] === undefined)
throw new Error('Must specify the networkstr ("mainnet" or "testnet")'); throw new Error('Must specify the networkstr ("mainnet" or "testnet")');
if (typeof this.compressed !== 'boolean') if (typeof this.compressed !== 'boolean')
throw new Error('Must specify whether the corresponding public key is compressed or not (true or false)'); throw new Error('Must specify whether the corresponding public key is compressed or not (true or false)');
@ -68,9 +68,9 @@ Privkey.prototype.toWIF = function() {
var privbuf = this.bn.toBuffer({size: 32}); var privbuf = this.bn.toBuffer({size: 32});
var buf; var buf;
if (compressed) if (compressed)
buf = Buffer.concat([new Buffer([constants[networkstr].privkey]), this.bn.toBuffer({size: 32}), new Buffer([0x01])]); buf = Buffer.concat([new Buffer([networks[networkstr].privkey]), this.bn.toBuffer({size: 32}), new Buffer([0x01])]);
else else
buf = Buffer.concat([new Buffer([constants[networkstr].privkey]), this.bn.toBuffer({size: 32})]); buf = Buffer.concat([new Buffer([networks[networkstr].privkey]), this.bn.toBuffer({size: 32})]);
return base58check.encode(buf); return base58check.encode(buf);
}; };
@ -85,9 +85,9 @@ Privkey.prototype.fromWIF = function(str) {
else else
throw new Error('Length of buffer must be 33 (uncompressed) or 34 (compressed)'); throw new Error('Length of buffer must be 33 (uncompressed) or 34 (compressed)');
if (buf[0] === constants.mainnet.privkey) if (buf[0] === networks.mainnet.privkey)
this.networkstr = 'mainnet'; this.networkstr = 'mainnet';
else if (buf[0] === constants.testnet.privkey) else if (buf[0] === networks.testnet.privkey)
this.networkstr = 'testnet'; this.networkstr = 'testnet';
else else
throw new Error('Invalid networkstr'); throw new Error('Invalid networkstr');

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
var BufferReader = require('./protocol/bufferreader'); var BufferReader = require('./encoding/bufferreader');
var BufferWriter = require('./protocol/bufferwriter'); var BufferWriter = require('./encoding/bufferwriter');
var Opcode = require('./opcode'); var Opcode = require('./opcode');
var Script = function Script(buf) { var Script = function Script(buf) {

View File

@ -1,8 +1,8 @@
'use strict'; 'use strict';
var BufferWriter = require('./protocol/bufferwriter'); var BufferWriter = require('./encoding/bufferwriter');
var BufferReader = require('./protocol/bufferreader'); var BufferReader = require('./encoding/bufferreader');
var Varint = require('./protocol/varint'); var Varint = require('./encoding/varint');
var Hash = require('./crypto/hash'); var Hash = require('./crypto/hash');
var Txin = require('./txin'); var Txin = require('./txin');
var Txout = require('./txout'); var Txout = require('./txout');

View File

@ -1,8 +1,8 @@
'use strict'; 'use strict';
var BufferReader = require('./protocol/bufferreader'); var BufferReader = require('./encoding/bufferreader');
var BufferWriter = require('./protocol/bufferwriter'); var BufferWriter = require('./encoding/bufferwriter');
var Varint = require('./protocol/varint'); var Varint = require('./encoding/varint');
var Script = require('./script'); var Script = require('./script');
var Txin = function Txin(txidbuf, txoutnum, scriptvi, script, seqnum) { var Txin = function Txin(txidbuf, txoutnum, scriptvi, script, seqnum) {

View File

@ -1,9 +1,9 @@
'use strict'; 'use strict';
var BN = require('./crypto/bn'); var BN = require('./crypto/bn');
var BufferReader = require('./protocol/bufferreader'); var BufferReader = require('./encoding/bufferreader');
var BufferWriter = require('./protocol/bufferwriter'); var BufferWriter = require('./encoding/bufferwriter');
var Varint = require('./protocol/varint'); var Varint = require('./encoding/varint');
var Script = require('./script'); var Script = require('./script');
var Txout = function Txout(valuebn, scriptvi, script) { var Txout = function Txout(valuebn, scriptvi, script) {

View File

@ -2,7 +2,6 @@
var should = require('chai').should(); var should = require('chai').should();
var bitcore = require('..'); var bitcore = require('..');
var constants = bitcore.constants;
var BIP32 = bitcore.BIP32; var BIP32 = bitcore.BIP32;
describe('BIP32', function() { describe('BIP32', function() {

View File

@ -2,10 +2,10 @@
var should = require('chai').should(); var should = require('chai').should();
var bitcore = require('..'); var bitcore = require('..');
var Varint = bitcore.encoding.Varint;
var BufferReader = bitcore.encoding.BufferReader;
var Blockheader = bitcore.Blockheader; var Blockheader = bitcore.Blockheader;
var Block = bitcore.Block; var Block = bitcore.Block;
var BufferReader = bitcore.BufferReader;
var Varint = bitcore.Varint;
var Transaction = bitcore.Transaction; var Transaction = bitcore.Transaction;
describe('Block', function() { describe('Block', function() {

View File

@ -2,8 +2,8 @@
var should = require('chai').should(); var should = require('chai').should();
var bitcore = require('..'); var bitcore = require('..');
var BufferReader = bitcore.encoding.BufferReader;
var Blockheader = bitcore.Blockheader; var Blockheader = bitcore.Blockheader;
var BufferReader = bitcore.BufferReader;
describe('Blockheader', function() { describe('Blockheader', function() {

View File

@ -2,7 +2,7 @@
var should = require('chai').should(); var should = require('chai').should();
var bitcore = require('..'); var bitcore = require('..');
var bn = bitcore.BN; var bn = bitcore.crypto.BN;
var Privkey = bitcore.Privkey; var Privkey = bitcore.Privkey;
var Pubkey = bitcore.Pubkey; var Pubkey = bitcore.Pubkey;
var Keypair = bitcore.Keypair; var Keypair = bitcore.Keypair;

24
test/networks.js Normal file
View File

@ -0,0 +1,24 @@
'use strict';
var should = require('chai').should();
var bitcore = require('..');
var Networks = bitcore.Networks;
describe('Networks', function() {
it('should contain all Networks', function() {
should.exist(Networks.livenet);
should.exist(Networks.testnet);
should.exist(Networks.mainnet);
});
describe('contain all constants for livenet and testnet', function() {
for (var key in Networks.livenet) {
if (Networks.livenet.hasOwnProperty(key)) {
it('all should contain '+key, function() {
Networks.testnet.hasOwnProperty(key).should.equal(true);
});
}
}
});
});

View File

@ -2,9 +2,9 @@
var should = require('chai').should(); var should = require('chai').should();
var bitcore = require('..'); var bitcore = require('..');
var BN = bitcore.crypto.BN;
var Point = bitcore.crypto.Point;
var Privkey = bitcore.Privkey; var Privkey = bitcore.Privkey;
var BN = bitcore.BN;
var Point = bitcore.Point;
describe('Privkey', function() { describe('Privkey', function() {
var hex = '96c132224121b509b7d0a16245e957d9192609c5637c6228311287b1be21627a'; var hex = '96c132224121b509b7d0a16245e957d9192609c5637c6228311287b1be21627a';

View File

@ -1,18 +0,0 @@
'use strict';
var should = require('chai').should();
var bitcore = require('../../');
var constants = bitcore.Constants;
describe('Constants', function() {
it('should contain all constants for livenet and testnet', function() {
for (var key in constants.livenet) {
if (constants.livenet.hasOwnProperty(key)) {
constants.testnet.hasOwnProperty(key).should.equal(true);
}
}
});
});

View File

@ -2,9 +2,9 @@
var should = require('chai').should(); var should = require('chai').should();
var bitcore = require('..'); var bitcore = require('..');
var Point = bitcore.crypto.Point;
var BN = bitcore.crypto.BN;
var Pubkey = bitcore.Pubkey; var Pubkey = bitcore.Pubkey;
var Point = bitcore.Point;
var Bn = bitcore.BN;
var Privkey = bitcore.Privkey; var Privkey = bitcore.Privkey;
describe('Pubkey', function() { describe('Pubkey', function() {
@ -128,7 +128,7 @@ describe('Pubkey', function() {
describe('#fromX', function() { describe('#fromX', function() {
it('should create this known public key', function() { it('should create this known public key', function() {
var x = Bn.fromBuffer(new Buffer('1ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a', 'hex')); var x = BN.fromBuffer(new Buffer('1ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a', 'hex'));
var pk = new Pubkey(); var pk = new Pubkey();
pk.fromX(true, x); pk.fromX(true, x);
pk.point.getX().toString(16).should.equal('1ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a'); pk.point.getX().toString(16).should.equal('1ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a');
@ -140,7 +140,7 @@ describe('Pubkey', function() {
describe('#toBuffer', function() { describe('#toBuffer', function() {
it('should return this compressed DER format', function() { it('should return this compressed DER format', function() {
var x = Bn.fromBuffer(new Buffer('1ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a', 'hex')); var x = BN.fromBuffer(new Buffer('1ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a', 'hex'));
var pk = new Pubkey(); var pk = new Pubkey();
pk.fromX(true, x); pk.fromX(true, x);
pk.toBuffer().toString('hex').should.equal('031ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a'); pk.toBuffer().toString('hex').should.equal('031ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a');
@ -151,14 +151,14 @@ describe('Pubkey', function() {
describe('#toDER', function() { describe('#toDER', function() {
it('should return this compressed DER format', function() { it('should return this compressed DER format', function() {
var x = Bn.fromBuffer(new Buffer('1ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a', 'hex')); var x = BN.fromBuffer(new Buffer('1ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a', 'hex'));
var pk = new Pubkey(); var pk = new Pubkey();
pk.fromX(true, x); pk.fromX(true, x);
pk.toDER(true).toString('hex').should.equal('031ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a'); pk.toDER(true).toString('hex').should.equal('031ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a');
}); });
it('should return this uncompressed DER format', function() { it('should return this uncompressed DER format', function() {
var x = Bn.fromBuffer(new Buffer('1ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a', 'hex')); var x = BN.fromBuffer(new Buffer('1ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a', 'hex'));
var pk = new Pubkey(); var pk = new Pubkey();
pk.fromX(true, x); pk.fromX(true, x);
pk.toDER(false).toString('hex').should.equal('041ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a7baad41d04514751e6851f5304fd243751703bed21b914f6be218c0fa354a341'); pk.toDER(false).toString('hex').should.equal('041ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a7baad41d04514751e6851f5304fd243751703bed21b914f6be218c0fa354a341');

View File

@ -2,7 +2,7 @@
var should = require('chai').should(); var should = require('chai').should();
var bitcore = require('..'); var bitcore = require('..');
var BN = bitcore.BN; var BN = bitcore.crypto.BN;
var Signature = bitcore.Signature; var Signature = bitcore.Signature;
describe('Signature', function() { describe('Signature', function() {

View File

@ -2,11 +2,11 @@
var should = require('chai').should(); var should = require('chai').should();
var bitcore = require('..'); var bitcore = require('..');
var Varint = bitcore.Varint; var Varint = bitcore.encoding.Varint;
var BufferReader = bitcore.encoding.BufferReader;
var Transaction = bitcore.Transaction; var Transaction = bitcore.Transaction;
var Txin = bitcore.Txin; var Txin = bitcore.Txin;
var Txout = bitcore.Txout; var Txout = bitcore.Txout;
var BufferReader = bitcore.BufferReader;
describe('Transaction', function() { describe('Transaction', function() {

View File

@ -2,10 +2,10 @@
var should = require('chai').should(); var should = require('chai').should();
var bitcore = require('..'); var bitcore = require('..');
var Varint = bitcore.encoding.Varint;
var BufferReader = bitcore.encoding.BufferReader;
var Script = bitcore.Script; var Script = bitcore.Script;
var Txin = bitcore.Txin; var Txin = bitcore.Txin;
var Varint = bitcore.Varint;
var BufferReader = bitcore.BufferReader;
describe('Txin', function() { describe('Txin', function() {

View File

@ -2,11 +2,11 @@
var should = require('chai').should(); var should = require('chai').should();
var bitcore = require('..'); var bitcore = require('..');
var BN = bitcore.BN; var BN = bitcore.crypto.BN;
var Varint = bitcore.encoding.Varint;
var BufferReader = bitcore.encoding.BufferReader;
var Txout = bitcore.Txout; var Txout = bitcore.Txout;
var Script = bitcore.Script; var Script = bitcore.Script;
var Varint = bitcore.Varint;
var BufferReader = bitcore.BufferReader;
describe('Txout', function() { describe('Txout', function() {