diff --git a/src/screens/WalletEmbed.tsx b/src/screens/WalletEmbed.tsx index 4cbd1b5..894d6b0 100644 --- a/src/screens/WalletEmbed.tsx +++ b/src/screens/WalletEmbed.tsx @@ -1,6 +1,7 @@ import React, { useEffect, useState, useCallback, useRef } from 'react'; import { ScrollView, View } from 'react-native'; import { + ActivityIndicator, Button, Text, TextInput, @@ -193,7 +194,10 @@ export const WalletEmbed = () => { setIsTxRequested(true); } catch (error) { - console.error('Error processing transaction request:', error); + if (!(error instanceof Error)) { + throw error; + } + setTxError(error.message); } }, [networksData]); @@ -247,8 +251,10 @@ export const WalletEmbed = () => { console.error('No event source available to send message'); } } catch (error) { - console.error('Transaction error:', error); - setTxError('Transaction failed'); + if (!(error instanceof Error)) { + throw error; + } + setTxError(error.message); } finally { setIsTxLoading(false); } @@ -314,7 +320,7 @@ export const WalletEmbed = () => { mode="contained" onPress={acceptRequestHandler} loading={isTxLoading} - disabled={!transactionDetails.balance || !fees} + disabled={!transactionDetails.balance || !fees || isTxLoading} > {isTxLoading ? 'Processing' : 'Yes'} @@ -328,11 +334,21 @@ export const WalletEmbed = () => { - ) : null} + ) : ( + + Loading... + + + )} setTxError(null)} + hideDialog={() => { + setTxError(null) + if (window.parent) { + window.parent.postMessage('closeIframe', '*'); + } + }} /> );