added a wrapper for the method fromObj of Wallet
This commit is contained in:
parent
1168bf82b8
commit
47cb4bd3da
3 changed files with 29 additions and 16 deletions
|
|
@ -225,14 +225,16 @@ Wallet.prototype.toObj = function() {
|
|||
return walletObj;
|
||||
};
|
||||
|
||||
Wallet.fromObj = function(wallet) {
|
||||
var opts = wallet.opts;
|
||||
opts['publicKeyRing'] = this.publicKeyring.fromObj(wallet.publicKeyRing);
|
||||
opts['txProposals'] = this.txProposal.fromObj(wallet.txProposals);
|
||||
opts['privateKey'] = this.privateKey.fromObj(wallet.privateKey);
|
||||
Wallet.fromObj = function(o, storage, network, blockchain) {
|
||||
var opts = JSON.parse(JSON.stringify(o.opts));
|
||||
opts.publicKeyRing = copay.PublicKeyRing.fromObj(o.publicKeyRing);
|
||||
opts.txProposals = copay.TxProposals.fromObj(o.txProposals);
|
||||
opts.privateKey = copay.PrivateKey.fromObj(o.privateKey);
|
||||
|
||||
opts.storage = storage;
|
||||
opts.network = network;
|
||||
opts.blockchain = blockchain;
|
||||
var w = new Wallet(opts);
|
||||
|
||||
return w;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue