FIX: remove checks before invoking getAddressAsync

This commit is contained in:
Gabriele Genta 2021-07-14 14:40:19 +02:00
parent ce1027a2ce
commit c56acd5e54
3 changed files with 18 additions and 24 deletions

View file

@ -126,7 +126,6 @@ function WatchConnectivity() {
for (const wallet of wallets) {
let receiveAddress;
if (wallet.getAddressAsync) {
if (wallet.chain === Chain.ONCHAIN) {
try {
receiveAddress = await wallet.getAddressAsync();
@ -145,7 +144,6 @@ function WatchConnectivity() {
receiveAddress = wallet.getAddress();
}
}
}
const transactions = wallet.getTransactions(10);
const watchTransactions = [];
for (const transaction of transactions) {

View file

@ -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
}, []);

View file

@ -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,