2014-06-16 13:37:33 -07:00
|
|
|
var FakeWallet = function() {
|
|
|
|
this.id = 'testID';
|
|
|
|
this.balance = 10000;
|
|
|
|
this.safeBalance = 1000;
|
|
|
|
this.balanceByAddr = {
|
|
|
|
'1CjPR7Z5ZSyWk6WtXvSFgkptmpoi4UM9BC': 1000
|
|
|
|
};
|
2014-06-16 13:40:59 -07:00
|
|
|
this.name = 'myTESTwullet';
|
2014-06-12 13:42:26 -07:00
|
|
|
};
|
|
|
|
|
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,
|
|
|
|
isChange: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
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) {}
|