diff --git a/src/AppOnboarded.tsx b/src/AppOnboarded.tsx index 66cb58457..344ed4da2 100644 --- a/src/AppOnboarded.tsx +++ b/src/AppOnboarded.tsx @@ -116,7 +116,7 @@ const AppOnboarded = (): ReactElement => { dispatch(updateUi({ isOnline: true })); } else { showToast({ - type: 'error', + type: 'warning', title: t('connection_issue'), description: t('connection_issue_explain'), }); diff --git a/src/components/AuthWidget.tsx b/src/components/AuthWidget.tsx index 9ed828e38..754b77b91 100644 --- a/src/components/AuthWidget.tsx +++ b/src/components/AuthWidget.tsx @@ -58,7 +58,7 @@ const AuthWidget = ({ : `An error occurred: ${e.message}`; showToast({ - type: 'error', + type: 'warning', title: t('auth_error_link'), description: message, }); @@ -67,7 +67,7 @@ const AuthWidget = ({ if (magiclink) { Linking.openURL(magiclink.url).catch((e) => { showToast({ - type: 'error', + type: 'warning', title: t('auth_error_link'), description: e.message, }); diff --git a/src/components/BaseFeedWidget.tsx b/src/components/BaseFeedWidget.tsx index 60e72c297..ceaae8e98 100644 --- a/src/components/BaseFeedWidget.tsx +++ b/src/components/BaseFeedWidget.tsx @@ -13,6 +13,7 @@ import { } from '../styles/icons'; import { useAppDispatch } from '../hooks/redux'; import { useSlashfeed } from '../hooks/widgets'; +import { truncate } from '../utils/helpers'; import { deleteWidget } from '../store/slices/widgets'; import Dialog from './Dialog'; import SvgImage from './SvgImage'; @@ -80,7 +81,7 @@ const BaseFeedWidget = ({ - {widgetName} + {truncate(widgetName, 18)} diff --git a/src/components/FactsWidget.tsx b/src/components/FactsWidget.tsx index 645e87e07..5f5b015a2 100644 --- a/src/components/FactsWidget.tsx +++ b/src/components/FactsWidget.tsx @@ -47,7 +47,7 @@ const FactsWidget = ({ console.error(error); setIsLoading(false); showToast({ - type: 'error', + type: 'warning', title: t('widget_error_drive'), description: `An error occurred: ${error.message}`, }); diff --git a/src/components/HeadlinesWidget.tsx b/src/components/HeadlinesWidget.tsx index 854f3c669..55a0f57e4 100644 --- a/src/components/HeadlinesWidget.tsx +++ b/src/components/HeadlinesWidget.tsx @@ -79,7 +79,7 @@ const HeadlinesWidget = ({ console.error(error); setIsLoading(false); showToast({ - type: 'error', + type: 'warning', title: t('widget_error_drive'), description: `An error occurred: ${error.message}`, }); diff --git a/src/components/PinPad.tsx b/src/components/PinPad.tsx index 3c833f025..cb1317481 100644 --- a/src/components/PinPad.tsx +++ b/src/components/PinPad.tsx @@ -129,7 +129,7 @@ const PinPad = ({ vibrate({ type: 'default' }); await wipeApp(); showToast({ - type: 'error', + type: 'warning', title: t('wiped_title'), description: t('wiped_message'), }); diff --git a/src/components/SlashtagsProvider2.tsx b/src/components/SlashtagsProvider2.tsx index f3f69acea..fec147fbd 100644 --- a/src/components/SlashtagsProvider2.tsx +++ b/src/components/SlashtagsProvider2.tsx @@ -127,7 +127,7 @@ export const SlashtagsProvider2 = ({ (primaryKeyRes.data && primaryKeyRes.data.length === 0) ) { showToast({ - type: 'error', + type: 'warning', title: 'Data Connection Issue', description: 'An error occurred: Could not load primary key from keychain.', diff --git a/src/components/Toast.tsx b/src/components/Toast.tsx index 0f8f86d70..ac0f4a181 100644 --- a/src/components/Toast.tsx +++ b/src/components/Toast.tsx @@ -39,11 +39,16 @@ const Toast = ({ gradientColor = '#00294e'; } - if (type === 'error') { + if (type === 'warning') { titleColor = 'brand'; gradientColor = '#411a00'; } + if (type === 'error') { + titleColor = 'red'; + gradientColor = '#2b1215'; + } + return ( @@ -73,5 +78,6 @@ const styles = StyleSheet.create({ export const toastConfig: ToastConfig = { success: (props) => , info: (props) => , + warning: (props) => , error: (props) => , }; diff --git a/src/navigation/bottom-sheet/ForceTransfer.tsx b/src/navigation/bottom-sheet/ForceTransfer.tsx index 8f22cbf7a..83ec14477 100644 --- a/src/navigation/bottom-sheet/ForceTransfer.tsx +++ b/src/navigation/bottom-sheet/ForceTransfer.tsx @@ -100,7 +100,7 @@ const ForceTransfer = (): ReactElement => { }); if (closeResponse.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('close_error'), description: closeResponse.error.message, }); @@ -118,7 +118,7 @@ const ForceTransfer = (): ReactElement => { } else { console.log('force close failed.'); showToast({ - type: 'error', + type: 'warning', title: t('force_failed_title'), description: t('force_failed_msg'), }); diff --git a/src/screens/Activity/ActivityDetail.tsx b/src/screens/Activity/ActivityDetail.tsx index 54578c295..cdfaa132d 100644 --- a/src/screens/Activity/ActivityDetail.tsx +++ b/src/screens/Activity/ActivityDetail.tsx @@ -27,6 +27,7 @@ import { import Clipboard from '@react-native-clipboard/clipboard'; import { useTranslation } from 'react-i18next'; import { parse } from '@synonymdev/slashtags-url'; +import { EBoostType, EPaymentType } from 'beignet'; import { View as ThemedView } from '../../styles/components'; import { Caption13Up, Text02M, Title } from '../../styles/text'; @@ -77,7 +78,7 @@ import { } from '../../store/slices/metadata'; import { getTransactions } from '../../utils/wallet/electrum'; import { ITransaction, ITxHash } from '../../utils/wallet'; -import { openURL } from '../../utils/helpers'; +import { ellipsis, openURL } from '../../utils/helpers'; import { getBoostedTransactionParents } from '../../utils/boost'; import { showToast } from '../../utils/notifications'; import { @@ -95,7 +96,6 @@ import type { import { i18nTime } from '../../utils/i18n'; import { useSwitchUnit } from '../../hooks/wallet'; import { contactsSelector } from '../../store/reselect/slashtags'; -import { EBoostType, EPaymentType } from 'beignet'; const Section = memo( ({ title, value }: { title: string; value: ReactNode }) => { @@ -195,7 +195,7 @@ const OnchainActivityDetail = ({ getTransactions({ txHashes: [{ tx_hash: id }] }).then((txResponse) => { if (txResponse.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('activity_error_get'), description: t('activity_error_get_description'), }); @@ -204,7 +204,7 @@ const OnchainActivityDetail = ({ const txData = txResponse.value.data; if (txData.length === 0) { showToast({ - type: 'error', + type: 'warning', title: t('activity_error_get'), description: t('activity_error_tx_not_found'), }); @@ -285,14 +285,14 @@ const OnchainActivityDetail = ({ await openURL(blockExplorerUrl); }, [blockExplorerUrl]); - const copyTransactionId = useCallback(() => { - Clipboard.setString(id); + const onCopy = (text: string): void => { + Clipboard.setString(text); showToast({ type: 'success', - title: t('activity_copied_tx'), - description: id, + title: t('copied'), + description: ellipsis(text, 40), }); - }, [id, t]); + }; const getOutputAddresses = useCallback(() => { if (txDetails && txDetails.vout.length > 0) { @@ -552,19 +552,21 @@ const OnchainActivityDetail = ({ ) : ( <> + style={styles.sectionContainer} + onPress={(): void => onCopy(id)}>
{id}} /> - + onCopy(address)}>
{address}} /> - + {txDetails ? ( <> @@ -682,14 +684,14 @@ const LightningActivityDetail = ({ }); }; - const copyTransactionId = useCallback(() => { - Clipboard.setString(id); + const onCopy = (text: string): void => { + Clipboard.setString(text); showToast({ type: 'success', - title: t('activity_copied_tx'), - description: id, + title: t('copied'), + description: ellipsis(text, 40), }); - }, [id, t]); + }; const isSend = txType === EPaymentType.sent; const total = value + (fee ?? 0); @@ -914,19 +916,21 @@ const LightningActivityDetail = ({ ) : ( <> + style={styles.sectionContainer} + onPress={(): void => onCopy(id)}>
{id}} /> - + onCopy(address)}>
{address}} /> - + )} diff --git a/src/screens/Contacts/Contact.tsx b/src/screens/Contacts/Contact.tsx index 5540c50f3..f240473aa 100644 --- a/src/screens/Contacts/Contact.tsx +++ b/src/screens/Contacts/Contact.tsx @@ -95,7 +95,7 @@ const Contact = ({ } else { console.log(res.error.message); showToast({ - type: 'error', + type: 'warning', title: t('contact_pay_error'), description: `An error occurred: ${res.error.message}`, }); diff --git a/src/screens/Lightning/CustomConfirm.tsx b/src/screens/Lightning/CustomConfirm.tsx index ca51655b7..bb31c6a05 100644 --- a/src/screens/Lightning/CustomConfirm.tsx +++ b/src/screens/Lightning/CustomConfirm.tsx @@ -53,9 +53,9 @@ const CustomConfirm = ({ const fiatTransactionFee = useDisplayValues(transactionFee); const clientBalance = useDisplayValues(order?.clientBalanceSat ?? 0); - // avoid flashing different price after confirmation + // TODO: avoid flashing different price & allocation after confirmation // eslint-disable-next-line react-hooks/exhaustive-deps - const txFee = useMemo(() => fiatTransactionFee.fiatValue, [orderId]); + const txFee = fiatTransactionFee.fiatValue; const lspFee = purchaseFeeValue.fiatValue - clientBalance.fiatValue; const handleConfirm = async (): Promise => { @@ -83,7 +83,7 @@ const CustomConfirm = ({ }); if (purchaseResponse.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('error_channel_purchase'), description: purchaseResponse.error.message, }); diff --git a/src/screens/Lightning/CustomSetup.tsx b/src/screens/Lightning/CustomSetup.tsx index d2925691e..26f72e8a7 100644 --- a/src/screens/Lightning/CustomSetup.tsx +++ b/src/screens/Lightning/CustomSetup.tsx @@ -435,7 +435,7 @@ const CustomSetup = ({ }); } showToast({ - type: 'error', + type: 'warning', title: t('error_channel_purchase'), description: msg, }); diff --git a/src/screens/Lightning/Introduction.tsx b/src/screens/Lightning/Introduction.tsx index eff08246b..d2994a12e 100644 --- a/src/screens/Lightning/Introduction.tsx +++ b/src/screens/Lightning/Introduction.tsx @@ -73,7 +73,7 @@ const Introduction = ({ onPress={(): void => { if (accountVersion < 2) { showToast({ - type: 'error', + type: 'warning', title: t('migrating_ldk_title'), description: t('migrating_ldk_description'), }); @@ -93,7 +93,7 @@ const Introduction = ({ onPress={(): void => { if (accountVersion < 2) { showToast({ - type: 'error', + type: 'warning', title: t('migrating_ldk_title'), description: t('migrating_ldk_description'), }); diff --git a/src/screens/Lightning/QuickConfirm.tsx b/src/screens/Lightning/QuickConfirm.tsx index 74e5a1c99..98d9d3ba3 100644 --- a/src/screens/Lightning/QuickConfirm.tsx +++ b/src/screens/Lightning/QuickConfirm.tsx @@ -48,9 +48,9 @@ const QuickConfirm = ({ const fiatTransactionFee = useDisplayValues(transactionFee); const clientBalance = useDisplayValues(order?.clientBalanceSat ?? 0); - // avoid flashing different price after confirmation + // TODO: avoid flashing different price & allocation after confirmation // eslint-disable-next-line react-hooks/exhaustive-deps - const txFee = useMemo(() => fiatTransactionFee.fiatValue, [orderId]); + const txFee = fiatTransactionFee.fiatValue; const lspFee = purchaseFeeValue.fiatValue - clientBalance.fiatValue; const savingsAmount = onchainBalance - spendingAmount; diff --git a/src/screens/Lightning/QuickSetup.tsx b/src/screens/Lightning/QuickSetup.tsx index 5dd7afaa3..e9e57a3a2 100644 --- a/src/screens/Lightning/QuickSetup.tsx +++ b/src/screens/Lightning/QuickSetup.tsx @@ -155,7 +155,7 @@ const QuickSetup = ({ setLoading(false); if (purchaseResponse.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('error_channel_purchase'), description: purchaseResponse.error.message, }); diff --git a/src/screens/Onboarding/RestoreFromSeed.tsx b/src/screens/Onboarding/RestoreFromSeed.tsx index a1e79a09b..5ba37454e 100644 --- a/src/screens/Onboarding/RestoreFromSeed.tsx +++ b/src/screens/Onboarding/RestoreFromSeed.tsx @@ -111,7 +111,7 @@ const RestoreFromSeed = (): ReactElement => { }); if (res.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('restore_error_title'), description: res.error.message, }); diff --git a/src/screens/Onboarding/Restoring.tsx b/src/screens/Onboarding/Restoring.tsx index 5197e4fb0..f31512a24 100644 --- a/src/screens/Onboarding/Restoring.tsx +++ b/src/screens/Onboarding/Restoring.tsx @@ -59,7 +59,7 @@ const RestoringScreen = (): ReactElement => { if (res.isErr()) { console.log(res.error.message); showToast({ - type: 'error', + type: 'warning', title: t('restore_error_title'), description: t('restore_error_description'), }); diff --git a/src/screens/Onboarding/Slideshow.tsx b/src/screens/Onboarding/Slideshow.tsx index a862c8550..2b7eab548 100644 --- a/src/screens/Onboarding/Slideshow.tsx +++ b/src/screens/Onboarding/Slideshow.tsx @@ -83,7 +83,7 @@ const Slideshow = ({ if (res.isErr()) { setIsCreatingWallet(false); showToast({ - type: 'error', + type: 'warning', title: t('error_create'), description: res.error.message, }); diff --git a/src/screens/Recovery/Lightning.tsx b/src/screens/Recovery/Lightning.tsx index 7edbc77ee..13768d11b 100644 --- a/src/screens/Recovery/Lightning.tsx +++ b/src/screens/Recovery/Lightning.tsx @@ -77,7 +77,7 @@ const LightningWithSlashtags = ({ if (res.isErr()) { console.error(res.error); showToast({ - type: 'error', + type: 'warning', title: t('lightning_recovery_error'), description: res.error.message, }); @@ -124,7 +124,7 @@ const LightningWithSlashtags = ({ console.log(res.error); setIsFetchingBackup(false); showToast({ - type: 'error', + type: 'warning', title: t('lightning_recovery_error'), description: res.error.message, }); @@ -145,7 +145,7 @@ const LightningWithSlashtags = ({ if (Object.keys(backup.data.channel_monitors).length === 0) { showToast({ - type: 'error', + type: 'warning', title: t('lightning_recovery_error'), description: t('lightning_recovery_no_channels'), }); @@ -162,7 +162,7 @@ const LightningWithSlashtags = ({ console.error(storageRes.error); setIsRecoveringChannels(false); showToast({ - type: 'error', + type: 'warning', title: t('lightning_recovery_error'), description: storageRes.error.message, }); @@ -176,7 +176,7 @@ const LightningWithSlashtags = ({ console.error(importRes.error); setIsRecoveringChannels(false); showToast({ - type: 'error', + type: 'warning', title: t('lightning_recovery_error'), description: importRes.error.message, }); @@ -192,7 +192,7 @@ const LightningWithSlashtags = ({ if (setupRes.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('lightning_recovery_error'), description: setupRes.error.message, }); @@ -203,7 +203,7 @@ const LightningWithSlashtags = ({ const balances = await ldk.claimableBalances(false); if (balances.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('lightning_recovery_error'), description: balances.error.message, }); diff --git a/src/screens/Recovery/Mnemonic.tsx b/src/screens/Recovery/Mnemonic.tsx index 5f7faa7ee..f22f5407a 100644 --- a/src/screens/Recovery/Mnemonic.tsx +++ b/src/screens/Recovery/Mnemonic.tsx @@ -27,7 +27,7 @@ const Mnemonic = ({ if (mnemoncicResult.isErr()) { console.log(mnemoncicResult.error.message); showToast({ - type: 'error', + type: 'warning', title: t('mnemonic_error'), description: t('mnemonic_error_description'), }); diff --git a/src/screens/Recovery/Recovery.tsx b/src/screens/Recovery/Recovery.tsx index e9941977c..6e94b8643 100644 --- a/src/screens/Recovery/Recovery.tsx +++ b/src/screens/Recovery/Recovery.tsx @@ -38,7 +38,7 @@ const Recovery = ({ const result = await zipLogs({ limit: 20, allAccounts: true }); if (result.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('lightning:error_logs'), description: t('lightning:error_logs_description'), }); diff --git a/src/screens/Scanner/MainScanner.tsx b/src/screens/Scanner/MainScanner.tsx index 5247517bd..b0df6e6eb 100644 --- a/src/screens/Scanner/MainScanner.tsx +++ b/src/screens/Scanner/MainScanner.tsx @@ -34,7 +34,7 @@ const ScannerScreen = ({ const onRead = (data: string): void => { if (!data) { showToast({ - type: 'error', + type: 'warning', title: t('qr_error_header'), description: t('qr_error_text'), }); diff --git a/src/screens/Settings/AddressViewer/index.tsx b/src/screens/Settings/AddressViewer/index.tsx index 30e8c2bc9..41e4e4c64 100644 --- a/src/screens/Settings/AddressViewer/index.tsx +++ b/src/screens/Settings/AddressViewer/index.tsx @@ -840,7 +840,7 @@ const AddressViewer = ({ if (utxosRes.isErr()) { console.log(utxosRes.error.message); showToast({ - type: 'error', + type: 'warning', title: t('addr.rescan_error'), description: t('addr.rescan_error_description'), }); diff --git a/src/screens/Settings/Backup/ExportToPhone.tsx b/src/screens/Settings/Backup/ExportToPhone.tsx index 0292987f9..534aa4bae 100644 --- a/src/screens/Settings/Backup/ExportToPhone.tsx +++ b/src/screens/Settings/Backup/ExportToPhone.tsx @@ -51,7 +51,7 @@ const ExportToPhone = ({ } catch (error) { if (JSON.stringify(error).indexOf('CANCELLED') < 0) { showToast({ - type: 'error', + type: 'warning', title: t('export_error_title'), description: t('export_error_msg'), }); @@ -68,7 +68,7 @@ const ExportToPhone = ({ console.log(fileRes.error.message); setIsCreating(false); showToast({ - type: 'error', + type: 'warning', title: t('export_error_title'), description: t('export_error_file'), }); diff --git a/src/screens/Settings/Backup/ShowMnemonic.tsx b/src/screens/Settings/Backup/ShowMnemonic.tsx index 2cd58d170..6f5d89e37 100644 --- a/src/screens/Settings/Backup/ShowMnemonic.tsx +++ b/src/screens/Settings/Backup/ShowMnemonic.tsx @@ -48,7 +48,7 @@ const ShowMnemonic = ({ if (res.isErr()) { console.log(res.error.message); showToast({ - type: 'error', + type: 'warning', title: t('mnemonic_error'), description: t('mnemonic_error_description'), }); diff --git a/src/screens/Settings/DevSettings/index.tsx b/src/screens/Settings/DevSettings/index.tsx index c6062583e..bd88942ee 100644 --- a/src/screens/Settings/DevSettings/index.tsx +++ b/src/screens/Settings/DevSettings/index.tsx @@ -73,7 +73,7 @@ const DevSettings = ({ }); if (result.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('error_logs'), description: t('error_logs_description'), }); diff --git a/src/screens/Settings/ElectrumConfig/index.tsx b/src/screens/Settings/ElectrumConfig/index.tsx index a32ac51df..abd5c0e72 100644 --- a/src/screens/Settings/ElectrumConfig/index.tsx +++ b/src/screens/Settings/ElectrumConfig/index.tsx @@ -129,7 +129,7 @@ const ElectrumConfig = ({ const validityCheck = validateInput(peerData, t); if (validityCheck.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('es.error_peer'), description: validityCheck.error.message, }); @@ -174,7 +174,7 @@ const ElectrumConfig = ({ console.log(connectResponse.error.message); dispatch(updateUi({ isConnectedToElectrum: false })); showToast({ - type: 'error', + type: 'warning', title: t('es.server_error'), description: t('es.server_error_description'), }); @@ -238,7 +238,7 @@ const ElectrumConfig = ({ const validityCheck = validateInput(connectData, t); if (validityCheck.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('es.error_peer'), description: validityCheck.error.message, }); diff --git a/src/screens/Settings/Lightning/Channels.tsx b/src/screens/Settings/Lightning/Channels.tsx index da541ba28..44822e15b 100644 --- a/src/screens/Settings/Lightning/Channels.tsx +++ b/src/screens/Settings/Lightning/Channels.tsx @@ -261,7 +261,7 @@ const Channels = ({ const handleAdd = useCallback((): void => { if (accountVersion < 2) { showToast({ - type: 'error', + type: 'warning', title: t('migrating_ldk_title'), description: t('migrating_ldk_description'), }); @@ -280,7 +280,7 @@ const Channels = ({ const result = await zipLogs(); if (result.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('error_logs'), description: t('error_logs_description'), }); @@ -312,7 +312,7 @@ const Channels = ({ }); if (createPaymentRequest.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('error_invoice'), description: createPaymentRequest.error.message, }); @@ -348,7 +348,7 @@ const Channels = ({ }); if (addPeerRes.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('error_add_title'), description: addPeerRes.error.message, }); @@ -357,7 +357,7 @@ const Channels = ({ const savePeerRes = savePeer({ selectedWallet, selectedNetwork, peer }); if (savePeerRes.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('error_save_title'), description: savePeerRes.error.message, }); @@ -557,7 +557,7 @@ const Channels = ({ }); } else { showToast({ - type: 'error', + type: 'warning', title: 'No stuck outputs recovered', description: res.error.message, }); @@ -616,7 +616,7 @@ const Channels = ({ const invoice = await Clipboard.getString(); if (!invoice) { showToast({ - type: 'error', + type: 'warning', title: 'No Invoice Detected', description: 'Unable to retrieve anything from the clipboard.', @@ -625,7 +625,7 @@ const Channels = ({ const response = await payLightningInvoice(invoice); if (response.isErr()) { showToast({ - type: 'error', + type: 'warning', title: 'Invoice Payment Failed', description: response.error.message, }); diff --git a/src/screens/Settings/Lightning/CloseConnection.tsx b/src/screens/Settings/Lightning/CloseConnection.tsx index bce2e9f5b..dfc841447 100644 --- a/src/screens/Settings/Lightning/CloseConnection.tsx +++ b/src/screens/Settings/Lightning/CloseConnection.tsx @@ -48,7 +48,7 @@ const CloseConnection = ({ // If error, display error notification and return. if (closeResponse.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('close_error'), description: closeResponse.error.message, }); diff --git a/src/screens/Settings/PIN/AskForBiometrics.tsx b/src/screens/Settings/PIN/AskForBiometrics.tsx index 72c6a419f..5a340bc17 100644 --- a/src/screens/Settings/PIN/AskForBiometrics.tsx +++ b/src/screens/Settings/PIN/AskForBiometrics.tsx @@ -81,7 +81,7 @@ const AskForBiometrics = ({ }) .catch(() => { showToast({ - type: 'error', + type: 'warning', title: t('bio_error_title'), description: t('bio_error_message', { type: biometricsName }), }); diff --git a/src/screens/Settings/WebRelay/index.tsx b/src/screens/Settings/WebRelay/index.tsx index 08d24e927..4427e7a65 100644 --- a/src/screens/Settings/WebRelay/index.tsx +++ b/src/screens/Settings/WebRelay/index.tsx @@ -64,7 +64,7 @@ const WebRelay = ({ const validityCheck = validateInput(newUrl, t); if (validityCheck.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('wr.error_wr'), description: validityCheck.error.message, }); @@ -75,7 +75,7 @@ const WebRelay = ({ const response = await fetch(newUrl + '/health-check?format=json'); if (response.status !== 200) { showToast({ - type: 'error', + type: 'warning', title: t('wr.error_wr'), description: t('wr.error_healthcheck'), }); @@ -111,7 +111,7 @@ const WebRelay = ({ return; } showToast({ - type: 'error', + type: 'warning', title: t('slashtags:error_saving_profile'), description: res.error.message, }); diff --git a/src/screens/Transfer/Confirm.tsx b/src/screens/Transfer/Confirm.tsx index 1ad4e9661..5e7da91b2 100644 --- a/src/screens/Transfer/Confirm.tsx +++ b/src/screens/Transfer/Confirm.tsx @@ -56,9 +56,9 @@ const Confirm = ({ const fiatTransactionFee = useDisplayValues(transactionFee); const clientBalance = useDisplayValues(order?.clientBalanceSat ?? 0); - // avoid flashing different price after confirmation + // TODO: avoid flashing different price & allocation after confirmation // eslint-disable-next-line react-hooks/exhaustive-deps - const txFee = useMemo(() => fiatTransactionFee.fiatValue, [orderId]); + const txFee = fiatTransactionFee.fiatValue; const lspFee = purchaseFeeValue.fiatValue - clientBalance.fiatValue; const handleConfirm = async (): Promise => { diff --git a/src/screens/Transfer/Setup.tsx b/src/screens/Transfer/Setup.tsx index e919952ff..0daa4b398 100644 --- a/src/screens/Transfer/Setup.tsx +++ b/src/screens/Transfer/Setup.tsx @@ -156,7 +156,7 @@ const Setup = ({ navigation }: TransferScreenProps<'Setup'>): ReactElement => { setLoading(false); if (purchaseResponse.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('error_channel_purchase'), description: purchaseResponse.error.message, }); diff --git a/src/screens/Wallets/BoostPrompt.tsx b/src/screens/Wallets/BoostPrompt.tsx index f4bae7e24..0918a4bb2 100644 --- a/src/screens/Wallets/BoostPrompt.tsx +++ b/src/screens/Wallets/BoostPrompt.tsx @@ -100,7 +100,7 @@ const BoostForm = ({ }); if (res.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('send_fee_error'), description: res.error.message, }); @@ -120,7 +120,7 @@ const BoostForm = ({ }); if (res.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('send_fee_error'), description: res.error.message, }); @@ -134,7 +134,7 @@ const BoostForm = ({ }); if (res.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('send_fee_error'), description: res.error.message, }); @@ -147,7 +147,7 @@ const BoostForm = ({ if (transactionIsValid.isErr()) { setLoading(false); showToast({ - type: 'error', + type: 'warning', title: t('tx_invalid'), description: transactionIsValid.error.message, }); @@ -177,7 +177,7 @@ const BoostForm = ({ }); } else { showToast({ - type: 'error', + type: 'warning', title: t('boost_error_title'), description: t('boost_error_msg'), }); diff --git a/src/screens/Wallets/Receive/ReceiveConnect.tsx b/src/screens/Wallets/Receive/ReceiveConnect.tsx index b3f0136d4..db7baac0f 100644 --- a/src/screens/Wallets/Receive/ReceiveConnect.tsx +++ b/src/screens/Wallets/Receive/ReceiveConnect.tsx @@ -67,7 +67,7 @@ const ReceiveConnect = ({ }); if (cJitEntryResponse.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('receive_cjit_error'), description: cJitEntryResponse.error.message, }); diff --git a/src/screens/Wallets/Send/Amount.tsx b/src/screens/Wallets/Send/Amount.tsx index 4447a5fde..63419d8b6 100644 --- a/src/screens/Wallets/Send/Amount.tsx +++ b/src/screens/Wallets/Send/Amount.tsx @@ -191,7 +191,7 @@ const Amount = ({ navigation }: SendScreenProps<'Amount'>): ReactElement => { }); if (result.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('send_amount_error_title'), description: result.error.message, }); @@ -206,7 +206,7 @@ const Amount = ({ navigation }: SendScreenProps<'Amount'>): ReactElement => { const feeSetupRes = setupFeeForOnChainTransaction(); if (feeSetupRes.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('send_output_to_small_title'), description: t('send_output_to_small_description'), }); diff --git a/src/screens/Wallets/Send/CoinSelection.tsx b/src/screens/Wallets/Send/CoinSelection.tsx index f8af1acf8..020d4c8ba 100644 --- a/src/screens/Wallets/Send/CoinSelection.tsx +++ b/src/screens/Wallets/Send/CoinSelection.tsx @@ -164,7 +164,7 @@ const CoinSelection = ({ const feeSetupRes = setupFeeForOnChainTransaction(); if (feeSetupRes.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('send_output_to_small_title'), description: t('send_coin_selection_output_to_small_description'), }); diff --git a/src/screens/Wallets/Send/Contacts.tsx b/src/screens/Wallets/Send/Contacts.tsx index b59ed2e4e..7a080f7dc 100644 --- a/src/screens/Wallets/Send/Contacts.tsx +++ b/src/screens/Wallets/Send/Contacts.tsx @@ -46,7 +46,7 @@ const Contacts = ({ navigation.navigate('Amount'); } else { showToast({ - type: 'error', + type: 'warning', title: t('contact_pay_error'), description: res.error.message, }); diff --git a/src/screens/Wallets/Send/FeeCustom.tsx b/src/screens/Wallets/Send/FeeCustom.tsx index 81ace14b1..6239a3d95 100644 --- a/src/screens/Wallets/Send/FeeCustom.tsx +++ b/src/screens/Wallets/Send/FeeCustom.tsx @@ -54,7 +54,7 @@ const FeeCustom = ({ }); if (res.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('send_fee_error'), description: res.error.message, }); diff --git a/src/screens/Wallets/Send/FeeRate.tsx b/src/screens/Wallets/Send/FeeRate.tsx index 847b9b597..41141316e 100644 --- a/src/screens/Wallets/Send/FeeRate.tsx +++ b/src/screens/Wallets/Send/FeeRate.tsx @@ -62,7 +62,7 @@ const FeeRate = ({ navigation }: SendScreenProps<'FeeRate'>): ReactElement => { }); if (res.isErr()) { showToast({ - type: 'error', + type: 'warning', title: t('send_fee_error'), description: res.error.message, }); diff --git a/src/screens/Wallets/Send/Recipient.tsx b/src/screens/Wallets/Send/Recipient.tsx index d3e7c0240..15321d175 100644 --- a/src/screens/Wallets/Send/Recipient.tsx +++ b/src/screens/Wallets/Send/Recipient.tsx @@ -86,7 +86,7 @@ const Recipient = ({ if (!text) { showToast({ - type: 'error', + type: 'warning', title: t('send_clipboard_empty_title'), description: t('send_clipboard_empty_text'), }); diff --git a/src/screens/Wallets/Send/Result.tsx b/src/screens/Wallets/Send/Result.tsx index 6f1e4f107..5d798ad5a 100644 --- a/src/screens/Wallets/Send/Result.tsx +++ b/src/screens/Wallets/Send/Result.tsx @@ -145,7 +145,7 @@ const Result = ({ return; } showToast({ - type: 'error', + type: 'warning', title: t('send_error_contact'), description: res.error.message, }); diff --git a/src/screens/Wallets/Send/ReviewAndSend.tsx b/src/screens/Wallets/Send/ReviewAndSend.tsx index a89699faa..76e82d6c6 100644 --- a/src/screens/Wallets/Send/ReviewAndSend.tsx +++ b/src/screens/Wallets/Send/ReviewAndSend.tsx @@ -10,6 +10,7 @@ import React, { import { StyleSheet, View, TouchableOpacity, Keyboard } from 'react-native'; import { TInvoice } from '@synonymdev/react-native-ldk'; import { useTranslation } from 'react-i18next'; +import { validateTransaction } from 'beignet'; import { Caption13Up, Text02M } from '../../../styles/text'; import { @@ -75,7 +76,7 @@ import { updateLastPaidContacts } from '../../../store/slices/slashtags'; import { truncate } from '../../../utils/helpers'; import AmountToggle from '../../../components/AmountToggle'; import LightningSyncing from '../../../components/LightningSyncing'; -import { validateTransaction } from 'beignet'; +import { i18nTime } from '../../../utils/i18n'; const Section = memo( ({ @@ -106,6 +107,7 @@ const ReviewAndSend = ({ navigation, }: SendScreenProps<'ReviewAndSend'>): ReactElement => { const { t, i18n } = useTranslation('wallet'); + const { t: tTime } = useTranslation('intl', { i18n: i18nTime }); const selectedWallet = useAppSelector(selectedWalletSelector); const selectedNetwork = useAppSelector(selectedNetworkSelector); const onChainBalance = useAppSelector(onChainBalanceSelector); @@ -408,7 +410,7 @@ const ReviewAndSend = ({ if (res.isErr()) { console.log(res.error.message); showToast({ - type: 'error', + type: 'warning', title: t('tag_remove_error_title'), description: t('tag_remove_error_description'), }); @@ -562,6 +564,10 @@ const ReviewAndSend = ({ } }, [selectedFeeId]); + const invoiceExpiryTimestamp = new Date( + new Date().getTime() + decodedInvoice?.expiry_time! * 1000, + ); + return ( <> @@ -646,7 +652,17 @@ const ReviewAndSend = ({ <> - {(decodedInvoice.expiry_time / 60).toFixed()} minutes + {tTime('dateTime', { + v: invoiceExpiryTimestamp, + formatParams: { + v: { + month: 'short', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + }, + }, + })} } diff --git a/src/screens/Wallets/Send/Scanner.tsx b/src/screens/Wallets/Send/Scanner.tsx index 0c39a0e7a..2d061a504 100644 --- a/src/screens/Wallets/Send/Scanner.tsx +++ b/src/screens/Wallets/Send/Scanner.tsx @@ -23,7 +23,7 @@ const ScannerScreen = (): ReactElement => { const onRead = async (data: string): Promise => { if (!data) { showToast({ - type: 'error', + type: 'warning', title: t('qr_error_header'), description: t('qr_error_text'), }); diff --git a/src/screens/Wallets/Send/Tags.tsx b/src/screens/Wallets/Send/Tags.tsx index e92fc0297..353bc71a7 100644 --- a/src/screens/Wallets/Send/Tags.tsx +++ b/src/screens/Wallets/Send/Tags.tsx @@ -31,7 +31,7 @@ const Tags = ({ navigation }: SendScreenProps<'Tags'>): ReactElement => { if (res.isErr()) { console.log(res.error.message); showToast({ - type: 'error', + type: 'warning', title: t('tags_add_error_header'), description: t('tags_add_error_description'), }); @@ -48,7 +48,7 @@ const Tags = ({ navigation }: SendScreenProps<'Tags'>): ReactElement => { if (res.isErr()) { console.log(res.error.message); showToast({ - type: 'error', + type: 'warning', title: t('tags_add_error_header'), description: t('tags_add_error_description'), }); diff --git a/src/screens/Wallets/WalletsDetail/BitcoinBreakdown.tsx b/src/screens/Wallets/WalletsDetail/BitcoinBreakdown.tsx index 1d7ba4428..c32a6c5e0 100644 --- a/src/screens/Wallets/WalletsDetail/BitcoinBreakdown.tsx +++ b/src/screens/Wallets/WalletsDetail/BitcoinBreakdown.tsx @@ -33,7 +33,7 @@ const BitcoinBreakdown = (): ReactElement => { const onRebalancePress = (): void => { if (accountVersion < 2) { showToast({ - type: 'error', + type: 'warning', title: t('migrating_ldk_title'), description: t('migrating_ldk_description'), }); diff --git a/src/screens/Widgets/SlashAuthModal.tsx b/src/screens/Widgets/SlashAuthModal.tsx index d7e8ec149..4e8d1969c 100644 --- a/src/screens/Widgets/SlashAuthModal.tsx +++ b/src/screens/Widgets/SlashAuthModal.tsx @@ -128,7 +128,7 @@ const _SlashAuthModal = (): ReactElement => { } catch (e) { console.log(e.message); showToast({ - type: 'error', + type: 'warning', title: t('signin_to_error_header'), description: e.message === 'channel closed' @@ -154,7 +154,7 @@ const _SlashAuthModal = (): ReactElement => { } else { console.log(response.message); showToast({ - type: 'error', + type: 'warning', title: t('signin_to_error_header'), description: response?.message ? `An error occurred: ${response.message}` diff --git a/src/store/actions/wallet.ts b/src/store/actions/wallet.ts index 19d5730cb..0c4c1c783 100644 --- a/src/store/actions/wallet.ts +++ b/src/store/actions/wallet.ts @@ -341,7 +341,7 @@ export const updatePendingTransfers = (headerHeight: number): void => { pendingTransfers.forEach((transfer) => { const tx = transactions[transfer.txId]; if (tx && transfer.confirmations <= 6) { - const confs = tx.height < 1 ? 0 : headerHeight - tx.height + 1; + const confs = tx.height === -1 ? 1 : headerHeight - tx.height + 1; updateTransfer({ txId: transfer.txId, type: ETransferType.coopClose, diff --git a/src/store/utils/blocktank.ts b/src/store/utils/blocktank.ts index 0eda1daef..ccc55fc17 100644 --- a/src/store/utils/blocktank.ts +++ b/src/store/utils/blocktank.ts @@ -271,7 +271,7 @@ export const startChannelPurchase = async ({ const orderData = await getOrder(buyChannelData.id); if (orderData.isErr()) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:bt_error_retrieve'), description: `An error occurred: ${orderData.error.message}`, }); @@ -358,7 +358,7 @@ export const confirmChannelPurchase = async ({ const rawTx = await createTransaction(); if (rawTx.isErr()) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('wallet:error_create_tx'), description: rawTx.error.message, }); @@ -375,7 +375,7 @@ export const confirmChannelPurchase = async ({ }); if (broadcastResponse.isErr()) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('wallet:error_broadcast_tx'), description: broadcastResponse.error.message, }); @@ -427,7 +427,7 @@ const handleOrderStateChange = (order: IBtOrder): void => { // given up if (order.payment.bolt11Invoice.state === 'failed') { showToast({ - type: 'error', + type: 'warning', title: i18n.t('lightning:order_given_up_title'), description: i18n.t('lightning:order_given_up_msg'), }); @@ -437,7 +437,7 @@ const handleOrderStateChange = (order: IBtOrder): void => { // order expired if (order.state === BtOrderState.EXPIRED) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('lightning:order_expired_title'), description: i18n.t('lightning:order_expired_msg'), }); diff --git a/src/utils/backup/backups-subscriber.tsx b/src/utils/backup/backups-subscriber.tsx index ba9368d1a..0e108d58e 100644 --- a/src/utils/backup/backups-subscriber.tsx +++ b/src/utils/backup/backups-subscriber.tsx @@ -119,7 +119,9 @@ const EnabledSlashtag = (): ReactElement => { showToast({ type: 'error', title: t('backup.failed_title'), - description: t('backup.failed_message'), + description: t('backup.failed_message', { + interval: BACKUP_CHECK_INTERVAL / 60000, // displayed in minutes + }), }); }, FAILED_BACKUP_NOTIFICATION_INTERVAL); diff --git a/src/utils/exchange-rate/index.ts b/src/utils/exchange-rate/index.ts index bb23e9ec2..806b2f154 100644 --- a/src/utils/exchange-rate/index.ts +++ b/src/utils/exchange-rate/index.ts @@ -81,7 +81,7 @@ export const getExchangeRates = async (): Promise> => { if (lastUpdatedAt) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:rate_error_title'), description: i18n.t('other:rate_error_msg_date', { date: timeAgo(lastUpdatedAt), @@ -89,7 +89,7 @@ export const getExchangeRates = async (): Promise> => { }); } else { showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:rate_error_title'), description: i18n.t('other:rate_error_msg_nodate'), }); diff --git a/src/utils/i18n/locales/en/settings.json b/src/utils/i18n/locales/en/settings.json index fed4c2da4..d9a02ceb2 100644 --- a/src/utils/i18n/locales/en/settings.json +++ b/src/utils/i18n/locales/en/settings.json @@ -69,8 +69,8 @@ "wallet": "Back up your wallet", "export": "Export wallet data to phone", "reset": "Reset and restore wallet", - "failed_title": "Data Backup Failed", - "failed_message": "Bitkit failed to back up wallet data. Please check your connection.", + "failed_title": "Data Backup Failure", + "failed_message": "Bitkit failed to back up wallet data. Retrying in {interval, plural, one {# minute} other {# minutes}}.", "latest": "latest data backups", "status_failed": "Failed Backup: {time}", "status_success": "Latest Backup: {time}", @@ -111,25 +111,25 @@ "pending": "Reconnecting...", "error": "Disconnected" }, - "bitcoin_node" : { + "bitcoin_node": { "title": "Bitcoin Node", "ready": "Connected", "pending": "Connecting...", "error": "Could not connect to Electrum" }, - "lightning_node" : { + "lightning_node": { "title": "Lightning Node", "ready": "Synced", "pending": "Syncing...", "error": "Could not initiate" }, - "lightning_connection" : { + "lightning_connection": { "title": "Lightning Connection", "ready": "Open", "pending": "Opening...", "error": "No open connections" }, - "full_backup" : { + "full_backup": { "title": "Latest Full Data Backup", "ready": "Backed up", "pending": "Backing up...", diff --git a/src/utils/i18n/locales/en/wallet.json b/src/utils/i18n/locales/en/wallet.json index 25c211ecf..c84f468ee 100644 --- a/src/utils/i18n/locales/en/wallet.json +++ b/src/utils/i18n/locales/en/wallet.json @@ -124,7 +124,6 @@ "activity_error_get": "Transaction Retrieval Failed", "activity_error_get_description": "Bitkit was not able to fetch the transaction data.", "activity_error_tx_not_found": "The transaction was not found.", - "activity_copied_tx": "Copied To Clipboard", "activity_confirming": "Confirming", "activity_confirmed": "Confirmed", "activity_removed": "Removed from Mempool", diff --git a/src/utils/lnurl.ts b/src/utils/lnurl.ts index 2ab5da7a0..af97f8f78 100644 --- a/src/utils/lnurl.ts +++ b/src/utils/lnurl.ts @@ -77,7 +77,7 @@ export const handleLnurlPay = async ({ if (!nodeId) { const message = i18n.t('other:lnurl_ln_error_msg'); showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_pay_error'), description: message, }); @@ -98,7 +98,7 @@ export const handleLnurlPay = async ({ if (callbackRes.isErr()) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_pay_error'), description: `An error occurred: ${callbackRes.error.message}`, }); @@ -108,7 +108,7 @@ export const handleLnurlPay = async ({ return ok(callbackRes.value.pr); } catch (e) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_pay_error'), description: `An error occurred: ${e.message}`, }); @@ -135,7 +135,7 @@ export const handleLnurlChannel = async ({ if (peer.includes('onion')) { const message = i18n.t('lightning:error_add_tor'); showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_channel_error'), description: message, }); @@ -146,7 +146,7 @@ export const handleLnurlChannel = async ({ if (!nodeId) { const message = i18n.t('other:lnurl_ln_error_msg'); showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_channel_error'), description: message, }); @@ -163,7 +163,7 @@ export const handleLnurlChannel = async ({ if (addPeerRes.isErr()) { console.log(addPeerRes.error.message); showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_channel_error'), description: i18n.t('lightning:error_add'), }); @@ -173,7 +173,7 @@ export const handleLnurlChannel = async ({ if (savePeerRes.isErr()) { console.log(savePeerRes.error.message); showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_channel_error'), description: i18n.t('lightning:error_save'), }); @@ -189,7 +189,7 @@ export const handleLnurlChannel = async ({ }); if (callbackRes.isErr()) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_channel_error'), description: `An error occurred: ${callbackRes.error.message}`, }); @@ -200,7 +200,7 @@ export const handleLnurlChannel = async ({ if (channelStatusRes.status !== 200) { const message = i18n.t('other:lnurl_blocktank_error'); showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_channel_error'), description: message, }); @@ -210,7 +210,7 @@ export const handleLnurlChannel = async ({ if (jsonRes.status === 'ERROR') { showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_channel_error'), description: `An error occurred: ${jsonRes.reason}`, }); @@ -257,7 +257,7 @@ export const handleLnurlAuth = async ({ if (authRes.isErr()) { console.log(authRes.error.message); showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_auth_error'), description: `An error occurred: ${authRes.error.message}`, }); @@ -303,7 +303,7 @@ export const handleLnurlWithdraw = async ({ if (invoice.isErr()) { const message = i18n.t('other:lnurl_withdr_error_create_invoice'); showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_withdr_error'), description: message, }); @@ -316,7 +316,7 @@ export const handleLnurlWithdraw = async ({ if (callbackRes.isErr()) { console.log(callbackRes.error.message); showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_withdr_error'), description: i18n.t('other:lnurl_withdr_error_generic'), }); @@ -330,7 +330,7 @@ export const handleLnurlWithdraw = async ({ if (jsonRes.status === 'ERROR') { console.log(jsonRes.reason); showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_withdr_error'), description: i18n.t('other:lnurl_withdr_error_generic'), }); @@ -347,7 +347,7 @@ export const handleLnurlWithdraw = async ({ } catch (e) { console.log(e.message); showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_withdr_error'), description: i18n.t('other:lnurl_withdr_error_generic'), }); diff --git a/src/utils/notifications.ts b/src/utils/notifications.ts index bdf9ae1b0..94eafff48 100644 --- a/src/utils/notifications.ts +++ b/src/utils/notifications.ts @@ -2,7 +2,7 @@ import Toast from 'react-native-toast-message'; import { __E2E__ } from '../constants/env'; export type ToastOptions = { - type: 'success' | 'error' | 'info'; + type: 'success' | 'info' | 'warning' | 'error'; title: string; description: string; autoHide?: boolean; diff --git a/src/utils/scanner.ts b/src/utils/scanner.ts index a16ab4541..df71ba4cd 100644 --- a/src/utils/scanner.ts +++ b/src/utils/scanner.ts @@ -204,7 +204,7 @@ export const processInputData = async ({ const errorMessage = i18n.t('other:scan_err_interpret_msg'); if (showErrors) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:scan_err_decoding'), description: errorMessage, }); @@ -217,7 +217,7 @@ export const processInputData = async ({ const errorMessage = i18n.t('other:scan_err_interpret_msg'); if (showErrors) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:scan_err_interpret_title'), description: errorMessage, }); @@ -261,7 +261,7 @@ export const processInputData = async ({ if (response.isErr()) { if (showErrors) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('slashtags:error_pay_title'), description: `An error occurred: ${response.error.message}`, }); @@ -273,7 +273,7 @@ export const processInputData = async ({ const errorMessage = i18n.t('slashtags:error_pay_empty_msg'); if (showErrors) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('slashtags:error_pay_title'), description: errorMessage, }); @@ -638,7 +638,7 @@ export const processBitcoinTransactionData = async ({ requestedAmount = decodedLightningInvoice.amount_satoshis ?? 0; if (decodedLightningInvoice.is_expired) { error = { - type: 'error', + type: 'warning', title: 'Lightning Invoice Expired', description: 'This Lightning invoice has expired.', }; @@ -662,7 +662,7 @@ export const processBitcoinTransactionData = async ({ response = filteredLightningInvoice; } else { error = { - type: 'error', + type: 'warning', title: i18n.t('other:pay_insufficient_spending'), description: i18n.t( 'other:pay_insufficient_spending_amount_description', @@ -696,7 +696,7 @@ export const processBitcoinTransactionData = async ({ if (showErrors) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:pay_insufficient_savings'), description: i18n.t( 'other:pay_insufficient_savings_amount_description', @@ -719,7 +719,7 @@ export const processBitcoinTransactionData = async ({ } else { if (requestedAmount) { error = { - type: 'error', + type: 'warning', title: i18n.t('other:pay_insufficient_savings'), description: i18n.t( 'other:pay_insufficient_savings_amount_description', @@ -730,7 +730,7 @@ export const processBitcoinTransactionData = async ({ }; } else { error = { - type: 'error', + type: 'warning', title: i18n.t('other:pay_insufficient_savings'), description: i18n.t('other:pay_insufficient_savings_description'), }; @@ -761,7 +761,7 @@ export const handleData = async ({ }): Promise> => { if (!data) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:qr_error_no_data_header'), description: i18n.t('other:qr_error_no_data_text'), }); @@ -775,7 +775,7 @@ export const handleData = async ({ EAvailableNetwork[data.network] !== EAvailableNetwork[selectedNetwork] ) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:qr_error_network_header'), description: i18n.t('other:qr_error_network_text', { selectedNetwork, @@ -838,7 +838,7 @@ export const handleData = async ({ if (decodedInvoice.isErr()) { console.log(decodedInvoice.error.message); showToast({ - type: 'error', + type: 'warning', title: i18n.t('lightning:error_decode'), description: i18n.t('other:qr_error_no_data_text'), }); @@ -891,7 +891,7 @@ export const handleData = async ({ if (lightningBalance.localBalance < params.minSendable) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_pay_error'), description: i18n.t('other:lnurl_pay_error_no_capacity'), }); @@ -936,7 +936,7 @@ export const handleData = async ({ if (params.minWithdrawable > params.maxWithdrawable) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_withdr_error'), description: i18n.t('other:lnurl_withdr_error_minmax'), }); @@ -954,7 +954,7 @@ export const handleData = async ({ if (lightningBalance.remoteBalance < params.minWithdrawable) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:lnurl_withdr_error'), description: i18n.t('other:lnurl_withdr_error_no_capacity'), }); @@ -973,7 +973,7 @@ export const handleData = async ({ } if (peer.includes('onion')) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('lightning:error_add_title'), description: i18n.t('lightning:error_add_tor'), }); @@ -985,7 +985,7 @@ export const handleData = async ({ }); if (addPeerRes.isErr()) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('lightning:error_add'), description: addPeerRes.error.message, }); @@ -994,7 +994,7 @@ export const handleData = async ({ const savePeerRes = savePeer({ selectedWallet, selectedNetwork, peer }); if (savePeerRes.isErr()) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('lightning:error_save_title'), description: savePeerRes.error.message, }); @@ -1052,7 +1052,7 @@ export const validateInputData = async ({ const errorMessage = i18n.t('other:scan_err_interpret_msg'); if (showErrors) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:scan_err_interpret_title'), description: errorMessage, }); @@ -1098,7 +1098,7 @@ export const validateInputData = async ({ const errorMessage = response.error.message; if (showErrors) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('slashtags:error_pay_title'), description: `An error occurred: ${errorMessage}`, }); @@ -1109,7 +1109,7 @@ export const validateInputData = async ({ const errorMessage = i18n.t('slashtags:error_pay_empty_msg'); if (showErrors) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('slashtags:error_pay_title'), description: errorMessage, }); @@ -1127,7 +1127,7 @@ export const validateInputData = async ({ const errorMessage = i18n.t('other:scan_err_not_payable_msg'); if (showErrors) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('slashtags:error_pay_title'), description: errorMessage, }); @@ -1143,7 +1143,7 @@ export const validateInputData = async ({ const errorMessage = i18n.t('other:scan_err_not_payable_msg'); if (showErrors) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('slashtags:error_pay_title'), description: errorMessage, }); diff --git a/src/utils/slashtags/index.ts b/src/utils/slashtags/index.ts index ccceaf27a..f44b5842b 100644 --- a/src/utils/slashtags/index.ts +++ b/src/utils/slashtags/index.ts @@ -76,7 +76,7 @@ export const saveContact = async ( await drive?.put('/' + id, encodeJSON(record)).catch((error: Error) => { console.log(error.message); showToast({ - type: 'error', + type: 'warning', title: i18n.t('slashtags:error_saving_contact'), description: `An error occurred: ${error.message}`, }); @@ -95,7 +95,7 @@ export const saveProfile = async ( const drive = await slashtag?.drivestore.get(); await drive.put('/profile.json', encodeJSON(profile)).catch((error: Error) => showToast({ - type: 'error', + type: 'warning', title: i18n.t('slashtags:error_saving_profile'), description: error.message, }), @@ -127,7 +127,7 @@ export const deleteContact = async ( const { id } = parse(url); await drive.del('/' + id).catch((error: Error) => { showToast({ - type: 'error', + type: 'warning', title: i18n.t('slashtags:error_delete_contact'), description: error.message, }); @@ -173,7 +173,7 @@ export const onSDKError = (error: Error): void => { } showToast({ - type: 'error', + type: 'warning', title: 'Data Connection Issue', description: error.message, }); @@ -410,7 +410,7 @@ function noop(): void {} function checkClosed(slashtag: Slashtag): boolean { if (slashtag.drivestore.closed) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('slashtags:error_sdk_title'), description: i18n.t('slashtags:error_sdk_msg'), }); diff --git a/src/utils/slashtags2/index.ts b/src/utils/slashtags2/index.ts index 0f4f1ab2d..a03834030 100644 --- a/src/utils/slashtags2/index.ts +++ b/src/utils/slashtags2/index.ts @@ -36,7 +36,7 @@ export const saveProfile2 = async ( } catch (e) { console.log('profile saving error', e); showToast({ - type: 'error', + type: 'warning', title: i18n.t('slashtags:error_saving_contact'), description: `An error occurred: ${e.message}`, }); diff --git a/src/utils/wallet/index.ts b/src/utils/wallet/index.ts index bbfd7d430..19224738b 100644 --- a/src/utils/wallet/index.ts +++ b/src/utils/wallet/index.ts @@ -164,7 +164,7 @@ const handleRefreshError = (msg): void => { // If the error is due to the batch limit being exceeded, show a toast and set the throttled state. if (msg.includes('Batch limit exceeded')) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('wallet:refresh_error_throttle_title'), description: i18n.t('wallet:refresh_error_throttle_description'), }); @@ -172,7 +172,7 @@ const handleRefreshError = (msg): void => { } else { // If the error is not due to the batch limit, show a toast with the error message. showToast({ - type: 'error', + type: 'warning', title: i18n.t('wallet:refresh_error_title'), description: msg, }); @@ -926,7 +926,7 @@ const onElectrumConnectionChange = (isConnected: boolean): void => { if (isConnectedToElectrum && !isConnected) { dispatch(updateUi({ isConnectedToElectrum: isConnected })); showToast({ - type: 'error', + type: 'warning', title: i18n.t('other:connection_reconnect_title'), description: i18n.t('other:connection_reconnect_msg'), }); @@ -983,7 +983,7 @@ const onMessage: TOnMessage = (key, data) => { case 'rbf': const rbfData = data as string[]; showToast({ - type: 'error', + type: 'warning', title: i18n.t('wallet:activity_removed_title'), description: i18n.t('wallet:activity_removed_msg', { count: rbfData.length, diff --git a/src/utils/wallet/transactions.ts b/src/utils/wallet/transactions.ts index 9cebb1e53..63ee260f8 100644 --- a/src/utils/wallet/transactions.ts +++ b/src/utils/wallet/transactions.ts @@ -151,7 +151,7 @@ export const createTransaction = async ({ }); if (createTxRes.isErr()) { showToast({ - type: 'error', + type: 'warning', title: i18n.t('wallet:error_create_tx'), description: createTxRes.error.message, });