implements delete wallet, in backuptab

This commit is contained in:
Matias Alejo Garcia 2014-06-16 17:37:33 -03:00
commit 2c60fd91c0
7 changed files with 219 additions and 79 deletions

View file

@ -1,20 +1,22 @@
var FakeWallet = function(){
this.balance=10000;
this.safeBalance=1000;
this.balanceByAddr={'1CjPR7Z5ZSyWk6WtXvSFgkptmpoi4UM9BC': 1000};
var FakeWallet = function() {
this.id = 'testID';
this.balance = 10000;
this.safeBalance = 1000;
this.balanceByAddr = {
'1CjPR7Z5ZSyWk6WtXvSFgkptmpoi4UM9BC': 1000
};
};
FakeWallet.prototype.set = function(balance, safeBalance, balanceByAddr){
this.balance=balance;
FakeWallet.prototype.set = function(balance, safeBalance, balanceByAddr) {
this.balance = balance;
this.safeBalance = safeBalance;
this.balanceByAddr = balanceByAddr;
};
FakeWallet.prototype.getAddressesInfo=function(){
FakeWallet.prototype.getAddressesInfo = function() {
var ret = [];
for(var ii in this.balanceByAddr){
for (var ii in this.balanceByAddr) {
ret.push({
address: ii,
isChange: false,
@ -24,10 +26,22 @@ FakeWallet.prototype.getAddressesInfo=function(){
};
FakeWallet.prototype.getBalance=function(cb){
FakeWallet.prototype.getBalance = function(cb) {
return cb(null, this.balance, this.balanceByAddr, this.safeBalance);
};
FakeWallet.prototype.setEnc = function(enc) {
this.enc = enc;
};
FakeWallet.prototype.toEncryptedObj = function() {
return this.enc;
};
FakeWallet.prototype.disconnect = function() {
this.disconnectCalled = 1;
};
// This mock is meant for karma, module.exports is not necesary.
try {
module.exports = require('soop')(FakeWallet);