diff --git a/screen/wallets/WalletTransactions.tsx b/screen/wallets/WalletTransactions.tsx index dce07c23b..818270dcc 100644 --- a/screen/wallets/WalletTransactions.tsx +++ b/screen/wallets/WalletTransactions.tsx @@ -128,17 +128,23 @@ const WalletTransactions: React.FC = ({ route }) => { } }, [wallet, isElectrumDisabled, isLoading, saveToDisk, pageSize]); - useEffect(() => { - if (wallet && wallet.getLastTxFetch() === 0) { - refreshTransactions(); - } - }, [wallet, refreshTransactions]); + useFocusEffect( + useCallback(() => { + const task = InteractionManager.runAfterInteractions(() => { + if (wallet && wallet.getLastTxFetch() === 0) { + refreshTransactions(); + } + }); + + return () => task.cancel(); + }, [refreshTransactions, wallet]), + ); useEffect(() => { if (wallet) { - setSelectedWalletID(wallet.getID()); + setSelectedWalletID(walletID); } - }, [wallet, setSelectedWalletID]); + }, [wallet, setSelectedWalletID, walletID]); const isLightning = (): boolean => wallet?.chain === Chain.OFFCHAIN || false; @@ -173,7 +179,7 @@ const WalletTransactions: React.FC = ({ route }) => { navigate('SendDetailsRoot', { screen: 'SendDetails', params: { - walletID: wallet?.getID(), + walletID, }, }); }; @@ -182,8 +188,8 @@ const WalletTransactions: React.FC = ({ route }) => { assert(wallet?.type === LightningCustodianWallet.type, `internal error, wallet is not ${LightningCustodianWallet.type}`); navigate('WalletTransactions', { walletType: wallet?.type, - walletID: wallet?.getID(), - key: `WalletTransactions-${wallet?.getID()}`, + walletID, + key: `WalletTransactions-${walletID}`, }); // navigating back to ln wallet screen // getting refill address, either cached or from the server: @@ -252,7 +258,7 @@ const WalletTransactions: React.FC = ({ route }) => { if (!isLoading) { setIsLoading(true); const params = { - walletID: wallet?.getID(), + walletID, uri: ret?.data ? ret.data : ret, }; if (wallet?.chain === Chain.ONCHAIN) { @@ -263,7 +269,7 @@ const WalletTransactions: React.FC = ({ route }) => { setIsLoading(false); } }, - [wallet, navigate, isLoading], + [isLoading, walletID, wallet?.chain, navigate], ); const choosePhoto = () => { @@ -288,7 +294,7 @@ const WalletTransactions: React.FC = ({ route }) => { const sendButtonPress = () => { if (wallet?.chain === Chain.OFFCHAIN) { - return navigate('ScanLndInvoiceRoot', { screen: 'ScanLndInvoice', params: { walletID: wallet.getID() } }); + return navigate('ScanLndInvoiceRoot', { screen: 'ScanLndInvoice', params: { walletID } }); } if (wallet?.type === WatchOnlyWallet.type && wallet.isHd() && !wallet.useWithHardwareWalletEnabled()) { @@ -407,7 +413,7 @@ const WalletTransactions: React.FC = ({ route }) => { navigate('WalletExportRoot', { screen: 'WalletExport', params: { - walletID: wallet!.getID(), + walletID, }, }); }); @@ -460,9 +466,9 @@ const WalletTransactions: React.FC = ({ route }) => { text={loc.receive.header} onPress={() => { if (wallet.chain === Chain.OFFCHAIN) { - navigate('LNDCreateInvoiceRoot', { screen: 'LNDCreateInvoice', params: { walletID: wallet.getID() } }); + navigate('LNDCreateInvoiceRoot', { screen: 'LNDCreateInvoice', params: { walletID } }); } else { - navigate('ReceiveDetailsRoot', { screen: 'ReceiveDetails', params: { walletID: wallet.getID() } }); + navigate('ReceiveDetailsRoot', { screen: 'ReceiveDetails', params: { walletID } }); } }} icon={ diff --git a/tests/e2e/bluewallet.spec.js b/tests/e2e/bluewallet.spec.js index 8a0e2e8e0..751e2a069 100644 --- a/tests/e2e/bluewallet.spec.js +++ b/tests/e2e/bluewallet.spec.js @@ -178,6 +178,7 @@ describe('BlueWallet UI Tests - no wallets', () => { await yo('WalletsList'); await expect(element(by.id('cr34t3d'))).toBeVisible(); await element(by.id('cr34t3d')).tap(); + await yo('ReceiveButton'); await element(by.id('ReceiveButton')).tap(); await element(by.text('Yes, I have.')).tap(); try { @@ -506,7 +507,7 @@ describe('BlueWallet UI Tests - no wallets', () => { await element(by.id('CreateButton')).tap(); await yo('Multisig Vault'); await element(by.id('Multisig Vault')).tap(); // go inside the wallet - + await yo('ReceiveButton'); await element(by.id('ReceiveButton')).tap(); await element(by.text('Yes, I have.')).tap(); try { @@ -571,6 +572,7 @@ describe('BlueWallet UI Tests - no wallets', () => { // sending... + await yo('SendButton'); await element(by.id('SendButton')).tap(); await element(by.id('AddressInput')).replaceText('bc1q063ctu6jhe5k4v8ka99qac8rcm2tzjjnuktyrl'); diff --git a/tests/e2e/bluewallet2.spec.js b/tests/e2e/bluewallet2.spec.js index ec894edb7..27e1334c7 100644 --- a/tests/e2e/bluewallet2.spec.js +++ b/tests/e2e/bluewallet2.spec.js @@ -40,6 +40,7 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => { await element(by.text('Imported HD SegWit (BIP84 Bech32 Native)')).tap(); // lets create real transaction: + await yo('SendButton'); await element(by.id('SendButton')).tap(); await element(by.id('AddressInput')).replaceText('bc1q063ctu6jhe5k4v8ka99qac8rcm2tzjjnuktyrl'); await element(by.id('BitcoinAmountInput')).typeText('0.0001\n'); @@ -188,6 +189,7 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => { // go inside the wallet await element(by.text('Imported HD SegWit (BIP84 Bech32 Native)')).tap(); + await yo('SendButton'); await element(by.id('SendButton')).tap(); // lets create real transaction: @@ -262,7 +264,7 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => { // go inside the wallet await element(by.text('Imported HD SegWit (BIP84 Bech32 Native)')).tap(); - + await yo('SendButton'); await element(by.id('SendButton')).tap(); // set fee rate @@ -332,6 +334,7 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => { // go inside the wallet await element(by.text('Imported HD SegWit (BIP84 Bech32 Native)')).tap(); + await yo('SendButton'); await element(by.id('SendButton')).tap(); await element(by.id('HeaderMenuButton')).tap(); @@ -391,6 +394,7 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => { // go to receive screen and check that payment code is there + await yo('ReceiveButton'); await element(by.id('ReceiveButton')).tap(); try { @@ -451,6 +455,8 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => { await device.pressBack(); await device.pressBack(); await element(by.text('Imported HD SegWit (BIP84 Bech32 Native)')).tap(); + await yo('SendButton'); + await element(by.id('SendButton')).tap(); await element(by.id('HeaderMenuButton')).tap(); await element(by.text('Insert Contact')).tap(); @@ -600,6 +606,7 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => { await device.launchApp({ newInstance: true }); await yo('WalletsList'); await element(by.text('Imported HD SegWit (BIP84 Bech32 Native)')).tap(); + await yo('SendButton'); await element(by.id('SendButton')).tap(); await element(by.id('HeaderMenuButton')).tap(); await element(by.text('Coin Control')).tap(); @@ -647,6 +654,7 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => { await device.pressBack(); // create tx with unfrozen input + await yo('SendButton'); await element(by.id('SendButton')).tap(); await element(by.id('AddressInput')).replaceText('bc1q063ctu6jhe5k4v8ka99qac8rcm2tzjjnuktyrl'); await element(by.id('HeaderMenuButton')).tap(); diff --git a/tests/e2e/bluewallet3.spec.js b/tests/e2e/bluewallet3.spec.js index 2ee3e49da..9961732c6 100644 --- a/tests/e2e/bluewallet3.spec.js +++ b/tests/e2e/bluewallet3.spec.js @@ -29,7 +29,6 @@ describe('BlueWallet UI Tests - import Watch-only wallet (zpub)', () => { '0.0001', ); await sleep(15000); - await element(by.id('ReceiveButton')).tap(); try { // in case emulator has no google services and doesnt support pushes @@ -51,7 +50,6 @@ describe('BlueWallet UI Tests - import Watch-only wallet (zpub)', () => { await expect(element(by.text('bitcoin:bc1qc8wun6lf9vcajpddtgdpd2pdrp0kwp29j6upgv?amount=1&label=Test'))).toBeVisible(); await device.pressBack(); - await element(by.id('SendButton')).tap(); await element(by.text('OK')).tap();