REF: last tx fetch time (rel #2963)

This commit is contained in:
Overtorment 2021-04-21 11:29:34 +01:00
parent ad931ec3f9
commit bdb2bd9fa1
3 changed files with 16 additions and 1 deletions

View file

@ -37,6 +37,13 @@ export class AbstractWallet {
this._utxoMetadata = {};
}
/**
* @returns {number} Timestamp (millisecsec) of when last transactions were fetched from the network
*/
getLastTxFetch() {
return this._lastTxFetch;
}
getID() {
return createHash('sha256').update(this.getSecret()).digest().toString('hex');
}

View file

@ -16,6 +16,14 @@ export class WatchOnlyWallet extends LegacyWallet {
this.masterFingerprint = false;
}
/**
* @inheritDoc
*/
getLastTxFetch() {
if (this._hdWalletInstance) return this._hdWalletInstance.getLastTxFetch();
return super.getLastTxFetch();
}
allowSend() {
return this.useWithHardwareWalletEnabled() && this.isHd() && this._hdWalletInstance.allowSend();
}

View file

@ -149,7 +149,7 @@ const WalletTransactions = () => {
// refresh transactions if it never hasn't been done. It could be a fresh imported wallet
useEffect(() => {
if (wallet._lastTxFetch === 0) {
if (wallet.getLastTxFetch() === 0) {
refreshTransactions();
}
// eslint-disable-next-line react-hooks/exhaustive-deps