diff --git a/app/components/Views/Approval/index.js b/app/components/Views/Approval/index.js index 8232ecccf7db..b82660f7cf51 100644 --- a/app/components/Views/Approval/index.js +++ b/app/components/Views/Approval/index.js @@ -56,6 +56,7 @@ class Approval extends Component { if (!transactionHandled) { Engine.context.TransactionController.cancelTransaction(transaction.id); } + Engine.context.TransactionController.hub.removeAllListeners(`${transaction.id}:finished`); this.clear(); }; @@ -95,7 +96,7 @@ class Approval extends Component { await TransactionController.updateTransaction(updatedTx); await TransactionController.approveTransaction(transaction.id); } catch (error) { - Alert.alert('Transaction error', JSON.stringify(error), [{ text: 'OK' }]); + Alert.alert('Transaction error', error && error.message, [{ text: 'OK' }]); this.setState({ transactionHandled: false }); } }; diff --git a/app/components/Views/Send/index.js b/app/components/Views/Send/index.js index cbd6047bfb62..ee82052a958b 100644 --- a/app/components/Views/Send/index.js +++ b/app/components/Views/Send/index.js @@ -249,8 +249,14 @@ class Send extends Component { transaction = this.prepareAssetTransaction(transaction, selectedAsset); } const { result, transactionMeta } = await TransactionController.addTransaction(transaction); + await TransactionController.approveTransaction(transactionMeta.id); - await result; + await new Promise(resolve => { + resolve(result); + }); + if (transactionMeta.error) { + throw transactionMeta.error; + } this.removeCollectible(); this.setState({ transactionConfirmed: false, transactionSubmitted: true }); this.props.navigation.pop(); @@ -258,7 +264,7 @@ class Send extends Component { TransactionsNotificationManager.watchSubmittedTransaction(transactionMeta); }); } catch (error) { - Alert.alert('Transaction error', JSON.stringify(error), [{ text: 'OK' }]); + Alert.alert('Transaction error', error && error.message, [{ text: 'OK' }]); this.setState({ transactionConfirmed: false }); await this.reset(); }