mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-21 14:34:55 +01:00
FIX: remove checks before invoking getAddressAsync
This commit is contained in:
parent
ce1027a2ce
commit
c56acd5e54
3 changed files with 18 additions and 24 deletions
|
@ -126,24 +126,22 @@ function WatchConnectivity() {
|
|||
|
||||
for (const wallet of wallets) {
|
||||
let receiveAddress;
|
||||
if (wallet.getAddressAsync) {
|
||||
if (wallet.chain === Chain.ONCHAIN) {
|
||||
try {
|
||||
receiveAddress = await wallet.getAddressAsync();
|
||||
} catch (_) {}
|
||||
if (!receiveAddress) {
|
||||
// either sleep expired or getAddressAsync threw an exception
|
||||
receiveAddress = wallet._getExternalAddressByIndex(wallet.next_free_address_index);
|
||||
}
|
||||
} else if (wallet.chain === Chain.OFFCHAIN) {
|
||||
try {
|
||||
await wallet.getAddressAsync();
|
||||
receiveAddress = wallet.getAddress();
|
||||
} catch (_) {}
|
||||
if (!receiveAddress) {
|
||||
// either sleep expired or getAddressAsync threw an exception
|
||||
receiveAddress = wallet.getAddress();
|
||||
}
|
||||
if (wallet.chain === Chain.ONCHAIN) {
|
||||
try {
|
||||
receiveAddress = await wallet.getAddressAsync();
|
||||
} catch (_) {}
|
||||
if (!receiveAddress) {
|
||||
// either sleep expired or getAddressAsync threw an exception
|
||||
receiveAddress = wallet._getExternalAddressByIndex(wallet.next_free_address_index);
|
||||
}
|
||||
} else if (wallet.chain === Chain.OFFCHAIN) {
|
||||
try {
|
||||
await wallet.getAddressAsync();
|
||||
receiveAddress = wallet.getAddress();
|
||||
} catch (_) {}
|
||||
if (!receiveAddress) {
|
||||
// either sleep expired or getAddressAsync threw an exception
|
||||
receiveAddress = wallet.getAddress();
|
||||
}
|
||||
}
|
||||
const transactions = wallet.getTransactions(10);
|
||||
|
|
|
@ -216,7 +216,7 @@ const ReceiveDetails = () => {
|
|||
setAddressBIP21Encoded(address);
|
||||
await Notifications.tryToObtainPermissions();
|
||||
Notifications.majorTomToGroundControl([address], [], []);
|
||||
} else if (wallet.getAddressAsync) {
|
||||
} else {
|
||||
if (wallet.chain === Chain.ONCHAIN) {
|
||||
try {
|
||||
newAddress = await Promise.race([wallet.getAddressAsync(), sleep(1000)]);
|
||||
|
@ -244,10 +244,6 @@ const ReceiveDetails = () => {
|
|||
setAddressBIP21Encoded(newAddress);
|
||||
await Notifications.tryToObtainPermissions();
|
||||
Notifications.majorTomToGroundControl([newAddress], [], []);
|
||||
} else if (wallet.getAddress) {
|
||||
setAddressBIP21Encoded(wallet.getAddress());
|
||||
await Notifications.tryToObtainPermissions();
|
||||
Notifications.majorTomToGroundControl([wallet.getAddress()], [], []);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
|
|
@ -37,7 +37,7 @@ const AOPP = () => {
|
|||
const wallet = await selectWallet(navigation.navigate, name, false, availableWallets, 'Onchain wallet is required to sign a message');
|
||||
if (!wallet) return navigation.pop();
|
||||
|
||||
const address = wallet.getAddressAsync ? await wallet.getAddressAsync() : wallet.getAddress();
|
||||
const address = await wallet.getAddressAsync();
|
||||
navigation.navigate('SignVerify', {
|
||||
walletID: wallet.getID(),
|
||||
address,
|
||||
|
|
Loading…
Add table
Reference in a new issue