mirror of https://github.com/BTCPrivate/copay.git
fix update from server
This commit is contained in:
parent
37daf6b490
commit
7fb85cb468
|
@ -32,7 +32,7 @@ export class WalletDetailsPage {
|
|||
if (force) this.wallet.completeHistory = [];
|
||||
|
||||
this.walletProvider.getTxHistory_(this.wallet, {force: force}).then((txh) => {
|
||||
this.wallet.completeHistory = this.wallet.completeHistory = txh;
|
||||
this.wallet.completeHistory = txh;
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
|
|
|
@ -392,14 +392,13 @@ export class WalletProvider {
|
|||
}
|
||||
|
||||
private updateTxHistory_(wallet: any, txsFromLocal: any, txsFromServer?: any) {
|
||||
let array = lodash.compact(txsFromLocal.concat(txsFromServer));
|
||||
let array = lodash.compact(txsFromLocal.concat(lodash.map(txsFromServer, 'res')));
|
||||
let newHistory = lodash.uniqBy(array, (x: any) => {
|
||||
return x.txid;
|
||||
});
|
||||
wallet.completeHistory = newHistory;
|
||||
wallet.completeHistory.isValid = true;
|
||||
|
||||
let historyToSave = lodash.compact(lodash.flatten(lodash.map(newHistory, 'res')));
|
||||
let historyToSave = lodash.compact(lodash.flatten(newHistory));
|
||||
|
||||
this.persistenceProvider.setTxHistory(wallet.credentials.walletId, JSON.stringify(historyToSave)).then(() => {
|
||||
this.logger.debug('Tx History saved for: ' + wallet.credentials.walletId);
|
||||
|
|
Loading…
Reference in New Issue