update to master

This commit is contained in:
Matias Alejo Garcia 2014-06-13 11:30:48 -03:00
commit 4fe58ec446
5 changed files with 54 additions and 42 deletions

View file

@ -18,7 +18,7 @@
"sjcl": "1.0.0",
"file-saver": "*",
"qrcode-decoder-js": "*",
"bitcore": "git://github.com/bitpay/bitcore.git#772b12e471a76c092f73271449edc1890078e49e",
"bitcore": "git://github.com/bitpay/bitcore.git#c94d2789582a481db19955f9e5df0129ffcc9e92",
"angular-moment": "~0.7.1",
"socket.io-client": ">=1.0.0",
"mousetrap": "1.4.6"

View file

@ -569,6 +569,9 @@ Wallet.prototype.getBalance = function(cb) {
var BIT = coinUtil.BIT;
var COIN = coinUtil.COIN;
if (!BIT)
throw new Error('BIT not defined. A newer version of bitcore is needed');
this.getUnspent(function(err, safeUnspent, unspent) {
if (err) {
return cb(err);

View file

@ -28,7 +28,7 @@
"homepage": "https://github.com/bitpay/copay",
"devDependencies": {
"async": "0.9.0",
"bitcore": "git://github.com/bitpay/bitcore.git#772b12e471a76c092f73271449edc1890078e49e",
"bitcore": "git://github.com/bitpay/bitcore.git#c94d2789582a481db19955f9e5df0129ffcc9e92",
"blanket": "1.1.6",
"browser-pack": "2.0.1",
"browserify": "3.32.1",

View file

@ -462,20 +462,20 @@ describe('Wallet model', function() {
});
});
var roundErrorChecks=[
{ unspent: [ 1.0001 ],
var roundErrorChecks = [{
unspent: [1.0001],
balance: 1000100
},
{ unspent: [ 1.0002 , 1.0003 , 1.0004 ],
}, {
unspent: [1.0002, 1.0003, 1.0004],
balance: 3000900
},
{ unspent: [ 0.000002 , 1.000003 , 2.000004 ],
}, {
unspent: [0.000002, 1.000003, 2.000004],
balance: 3000009
},
{ unspent: [ 0.0001 , 0.0003 ],
}, {
unspent: [0.0001, 0.0003],
balance: 400
},
{ unspent: [ 0.0001 , 0.0003, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0002 ],
}, {
unspent: [0.0001, 0.0003, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0002],
balance: 1100
},
@ -485,7 +485,11 @@ describe('Wallet model', function() {
it('check rounding errors ' + c.unspent[0], function(done) {
var w = createW2();
w.generateAddress();
w.blockchain.fixUnspent(c.unspent.map(function(u){return {amount:u}}));
w.blockchain.fixUnspent(c.unspent.map(function(u) {
return {
amount: u
}
}));
w.getBalance(function(err, balance, balanceByAddr, safeBalance) {
balance.should.equal(c.balance);
done();

View file

@ -7,7 +7,7 @@ if (typeof process === 'undefined' || !process.version) {
var copay = copay || require('../copay');
var LocalPlain = copay.StorageLocalPlain;
describe('Storage/LocalPlain model', function() {
describe.skip('Storage/LocalPlain model', function() {
it('should create an instance', function() {
var s = new LocalPlain();
@ -17,7 +17,12 @@ if (typeof process === 'undefined' || !process.version) {
describe('#setFromObj', function() {
it('should set keys from an object', function() {
localStorage.clear();
var obj = {test:'testval', opts: {name: 'testname'}};
var obj = {
test: 'testval',
opts: {
name: 'testname'
}
};
var storage = new LocalPlain();
storage.setFromObj('walletId', obj);
storage.get('walletId', 'test').should.equal('testval');