diff --git a/src/i18n/en/translations.ts b/src/i18n/en/translations.ts index b34b5928..26600580 100644 --- a/src/i18n/en/translations.ts +++ b/src/i18n/en/translations.ts @@ -69,6 +69,12 @@ export default { spendable: "Spendable", channel_size: "Channel size", channel_reserve: "- Channel reserve", + error_under_min_lightning: + "Defaulting to On-chain. Amount is too small for your initial Lightning receive.", + error_creating_unified: + "Defaulting to On-chain. Something went wrong when creating the unified address", + error_creating_address: + "Something went wrong when creating the on-chain address", amount_editable: { receive_too_small: "Your first lightning receive needs to be {{amount}} SATS or greater. A setup fee will be deducted from the requested amount.", diff --git a/src/routes/Receive.tsx b/src/routes/Receive.tsx index 1ae30dc4..4cd66b2c 100644 --- a/src/routes/Receive.tsx +++ b/src/routes/Receive.tsx @@ -45,7 +45,6 @@ import { VStack } from "~/components"; import { useI18n } from "~/i18n/context"; -import { matchError } from "~/logic/errorDispatch"; import { Network } from "~/logic/mutinyWalletSetup"; import { useMegaStore } from "~/state/megaStore"; import { @@ -140,6 +139,7 @@ export default function Receive() { // loading state for the continue button const [loading, setLoading] = createSignal(false); + const [error, setError] = createSignal(""); const RECEIVE_FLAVORS = [ { @@ -253,8 +253,12 @@ export default function Receive() { setLoading(false); return `bitcoin:${raw?.address}?${params}`; } catch (e) { - showToast(matchError(e)); console.error(e); + if (e === "Satoshi amount is invalid") { + setError(i18n.t("receive.error_under_min_lightning")); + } else { + setError(i18n.t("receive.error_creating_unified")); + } } // If we didn't return before this, that means create_bip21 failed @@ -271,7 +275,7 @@ export default function Receive() { return raw?.address; } catch (e) { // If THAT failed we're really screwed - showToast(matchError(e)); + showToast(eify(i18n.t("receive.error_creating_address"))); console.error(e); } finally { setLoading(false); @@ -414,6 +418,11 @@ export default function Receive() { + + +

{error()}

+
+