mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-23 07:15:35 +01:00
FIX: all wallets are refreshed when app launches
This commit is contained in:
parent
0d83e581bc
commit
801807ac46
2 changed files with 30 additions and 0 deletions
|
@ -252,6 +252,15 @@ export default class Selftest extends Component {
|
|||
if (!hd2.validateMnemonic()) {
|
||||
throw new Error('mnemonic phrase validation not ok');
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
let hd3 = new HDSegwitP2SHWallet();
|
||||
hd3._xpub = 'ypub6XRSuTABFst6pd8BuTmjSwkDya7HrCRqmtsNmtrh1gyrEZwe24GcjJf6jk6nhhenZpLsm6sDHx2BXwnCQQtjF63FbpNyVEkmngKFQF11aph';
|
||||
await hd3.fetchBalance();
|
||||
if (hd3.getBalance() !== 0.00026) throw new Error('Could not fetch HD balance');
|
||||
await hd3.fetchTransactions();
|
||||
if (hd3.transactions.length !== 7) throw new Error('Could not fetch HD transactions');
|
||||
} else {
|
||||
console.warn('skipping RN-specific test');
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ let A = require('../../analytics');
|
|||
/** @type {AppStorage} */
|
||||
let BlueApp = require('../../BlueApp');
|
||||
let loc = require('../../loc');
|
||||
let BlueElectrum = require('../../BlueElectrum');
|
||||
|
||||
export default class WalletsList extends Component {
|
||||
static navigationOptions = ({ navigation }) => ({
|
||||
|
@ -46,6 +47,26 @@ export default class WalletsList extends Component {
|
|||
|
||||
componentDidMount() {
|
||||
this.redrawScreen();
|
||||
|
||||
// the idea is that upon wallet launch we will refresh
|
||||
// all balances and all transactions here:
|
||||
InteractionManager.runAfterInteractions(async () => {
|
||||
let noErr = true;
|
||||
try {
|
||||
await BlueElectrum.waitTillConnected();
|
||||
let balanceStart = +new Date();
|
||||
await BlueApp.fetchWalletBalances();
|
||||
let balanceEnd = +new Date();
|
||||
console.log('fetch all wallet balances took', (balanceEnd - balanceStart) / 1000, 'sec');
|
||||
let start = +new Date();
|
||||
await BlueApp.fetchWalletTransactions();
|
||||
let end = +new Date();
|
||||
console.log('fetch all wallet txs took', (end - start) / 1000, 'sec');
|
||||
} catch (_) {
|
||||
noErr = false;
|
||||
}
|
||||
if (noErr) this.redrawScreen();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue