2014-06-16 13:37:33 -07:00
|
|
|
var FakeWallet = function() {
|
|
|
|
this.id = 'testID';
|
|
|
|
this.balance = 10000;
|
|
|
|
this.safeBalance = 1000;
|
2014-06-24 11:46:07 -07:00
|
|
|
this.totalCopayers = 2;
|
|
|
|
this.requiredCopayers = 2;
|
2014-08-07 16:07:41 -07:00
|
|
|
this.isLocked = false;
|
2014-06-16 13:37:33 -07:00
|
|
|
this.balanceByAddr = {
|
|
|
|
'1CjPR7Z5ZSyWk6WtXvSFgkptmpoi4UM9BC': 1000
|
|
|
|
};
|
2014-06-16 13:40:59 -07:00
|
|
|
this.name = 'myTESTwullet';
|
2014-06-24 08:36:32 -07:00
|
|
|
this.addressBook = {
|
|
|
|
'2NFR2kzH9NUdp8vsXTB4wWQtTtzhpKxsyoJ': {
|
2014-06-19 10:21:38 -07:00
|
|
|
label: 'John',
|
|
|
|
copayerId: '026a55261b7c898fff760ebe14fd22a71892295f3b49e0ca66727bc0a0d7f94d03',
|
|
|
|
createdTs: 1403102115,
|
|
|
|
}
|
|
|
|
};
|
2014-07-08 07:20:38 -07:00
|
|
|
this.publicKeyRing = {isComplete: function(){ return true; }};
|
2014-06-12 13:42:26 -07:00
|
|
|
};
|
|
|
|
|
2014-06-24 11:46:07 -07:00
|
|
|
FakeWallet.prototype.createTx = function(toAddress, amountSatStr, comment, opts, cb) {
|
|
|
|
var callback = cb || opts;
|
|
|
|
callback({});
|
|
|
|
}
|
|
|
|
|
|
|
|
FakeWallet.prototype.sendTx = function(ntxid, cb) {
|
|
|
|
cb(8);
|
|
|
|
}
|
|
|
|
|
2014-06-16 13:37:33 -07:00
|
|
|
FakeWallet.prototype.set = function(balance, safeBalance, balanceByAddr) {
|
|
|
|
this.balance = balance;
|
2014-06-12 13:42:26 -07:00
|
|
|
this.safeBalance = safeBalance;
|
|
|
|
this.balanceByAddr = balanceByAddr;
|
|
|
|
};
|
|
|
|
|
2014-06-16 13:37:33 -07:00
|
|
|
FakeWallet.prototype.getAddressesInfo = function() {
|
2014-06-12 13:42:26 -07:00
|
|
|
var ret = [];
|
|
|
|
|
2014-06-16 13:37:33 -07:00
|
|
|
for (var ii in this.balanceByAddr) {
|
2014-06-12 13:42:26 -07:00
|
|
|
ret.push({
|
|
|
|
address: ii,
|
2014-06-25 07:12:38 -07:00
|
|
|
addressStr: ii,
|
2014-06-12 13:42:26 -07:00
|
|
|
isChange: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
};
|
|
|
|
|
2014-08-05 06:21:29 -07:00
|
|
|
FakeWallet.prototype.isShared = function() {
|
|
|
|
return this.totalCopayers > 1;
|
|
|
|
}
|
|
|
|
|
2014-07-31 12:13:27 -07:00
|
|
|
FakeWallet.prototype.isReady = function() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-06-12 13:42:26 -07:00
|
|
|
|
2014-06-16 13:37:33 -07:00
|
|
|
FakeWallet.prototype.getBalance = function(cb) {
|
2014-06-12 13:42:26 -07:00
|
|
|
return cb(null, this.balance, this.balanceByAddr, this.safeBalance);
|
|
|
|
};
|
|
|
|
|
2014-06-16 13:37:33 -07:00
|
|
|
FakeWallet.prototype.setEnc = function(enc) {
|
|
|
|
this.enc = enc;
|
|
|
|
};
|
|
|
|
|
|
|
|
FakeWallet.prototype.toEncryptedObj = function() {
|
|
|
|
return this.enc;
|
|
|
|
};
|
|
|
|
|
|
|
|
FakeWallet.prototype.disconnect = function() {
|
|
|
|
this.disconnectCalled = 1;
|
|
|
|
};
|
|
|
|
|
2014-06-12 13:42:26 -07:00
|
|
|
// This mock is meant for karma, module.exports is not necesary.
|
|
|
|
try {
|
|
|
|
module.exports = require('soop')(FakeWallet);
|
|
|
|
} catch (e) {}
|