diff --git a/.changeset/fresh-cows-float.md b/.changeset/fresh-cows-float.md new file mode 100644 index 000000000000..67850929248b --- /dev/null +++ b/.changeset/fresh-cows-float.md @@ -0,0 +1,5 @@ +--- +"ledger-live-desktop": patch +--- + +error messages for transaction and fees drawers diff --git a/apps/ledger-live-desktop/src/renderer/screens/exchange/Swap2/Form/SwapWebViewDemo3.tsx b/apps/ledger-live-desktop/src/renderer/screens/exchange/Swap2/Form/SwapWebViewDemo3.tsx index 4d4dfe600c63..f5f5171bea16 100644 --- a/apps/ledger-live-desktop/src/renderer/screens/exchange/Swap2/Form/SwapWebViewDemo3.tsx +++ b/apps/ledger-live-desktop/src/renderer/screens/exchange/Swap2/Form/SwapWebViewDemo3.tsx @@ -1,10 +1,13 @@ import { SwapLiveError } from "@ledgerhq/live-common/exchange/swap/types"; import { LiveAppManifest } from "@ledgerhq/live-common/platform/types"; +import { getAccountIdFromWalletAccountId } from "@ledgerhq/live-common/wallet-api/converters"; import { handlers as loggerHandlers } from "@ledgerhq/live-common/wallet-api/CustomLogger/server"; import { getEnv } from "@ledgerhq/live-env"; +import BigNumber from "bignumber.js"; import React, { useEffect, useMemo, useRef, useState } from "react"; import { useSelector } from "react-redux"; import styled from "styled-components"; +import { track } from "~/renderer/analytics/segment"; import { Web3AppWebview } from "~/renderer/components/Web3AppWebview"; import { initialWebviewState } from "~/renderer/components/Web3AppWebview/helpers"; import { WebviewAPI, WebviewProps, WebviewState } from "~/renderer/components/Web3AppWebview/types"; @@ -13,6 +16,7 @@ import { usePTXCustomHandlers } from "~/renderer/components/WebPTXPlayer/CustomH import { context } from "~/renderer/drawers/Provider"; import useTheme from "~/renderer/hooks/useTheme"; import logger from "~/renderer/logger"; +import { flattenAccountsSelector } from "~/renderer/reducers/accounts"; import { counterValueCurrencySelector, enablePlatformDevToolsSelector, @@ -20,13 +24,9 @@ import { } from "~/renderer/reducers/settings"; import { captureException } from "~/sentry/renderer"; import WebviewErrorDrawer from "./WebviewErrorDrawer/index"; -import BigNumber from "bignumber.js"; -import { getAccountIdFromWalletAccountId } from "@ledgerhq/live-common/wallet-api/converters"; -import { track } from "~/renderer/analytics/segment"; -import { flattenAccountsSelector } from "~/renderer/reducers/accounts"; +import { GasOptions } from "@ledgerhq/coin-evm/lib/types/transaction"; import { getMainAccount, getParentAccount } from "@ledgerhq/live-common/account/helpers"; -import { transformToBigNumbers, useGetSwapTrackingProperties } from "../utils/index"; import { getAccountBridge } from "@ledgerhq/live-common/bridge/impl"; import { getAbandonSeedAddress } from "@ledgerhq/live-common/exchange/swap/hooks/useFromState"; import { @@ -34,10 +34,11 @@ import { convertToNonAtomicUnit, getCustomFeesPerFamily, } from "@ledgerhq/live-common/exchange/swap/webApp/utils"; -import FeesDrawerLiveApp from "./FeesDrawerLiveApp"; import { useTranslation } from "react-i18next"; -import { GasOptions } from "@ledgerhq/coin-evm/lib/types/transaction"; import { useLocation } from "react-router"; +import { NetworkStatus, useNetworkStatus } from "~/renderer/hooks/useNetworkStatus"; +import { transformToBigNumbers, useGetSwapTrackingProperties } from "../utils/index"; +import FeesDrawerLiveApp from "./FeesDrawerLiveApp"; export class UnableToLoadSwapLiveError extends Error { constructor(message: string) { @@ -102,6 +103,9 @@ const SwapWebView = ({ manifest, liveAppUnavailable }: SwapWebProps) => { const swapDefaultTrack = useGetSwapTrackingProperties(); const { state } = useLocation<{ defaultCurrency?: { id: string } }>(); + const { networkStatus } = useNetworkStatus(); + const isOffline = networkStatus === NetworkStatus.OFFLINE; + const customPTXHandlers = usePTXCustomHandlers(manifest); const customHandlers = useMemo( () => ({ @@ -255,8 +259,10 @@ const SwapWebView = ({ manifest, liveAppUnavailable }: SwapWebProps) => { () => new URLSearchParams({ ...(state?.defaultCurrency?.id ? { from: state?.defaultCurrency?.id } : {}), + ...(isOffline ? { isOffline: "true" } : {}), }).toString(), - [state?.defaultCurrency?.id], + + [isOffline, state?.defaultCurrency?.id], ); const onSwapWebviewError = (error?: SwapLiveError) => { diff --git a/apps/ledger-live-desktop/static/i18n/en/app.json b/apps/ledger-live-desktop/static/i18n/en/app.json index 88c6642f74d0..f55c7b84e8d5 100644 --- a/apps/ledger-live-desktop/static/i18n/en/app.json +++ b/apps/ledger-live-desktop/static/i18n/en/app.json @@ -5668,14 +5668,14 @@ }, "SwapRateExpiredError": { "title": "Rate Expired", - "description": "The exchange transaction could not be completed as the rate has expired. Please refresh the rates and try your swap again." + "description": "Exchange rate expired. Please refresh and try again." }, "PayinExtraIdError": { "message": "Missing required extraId required for swap" }, "SwapGenericAPIError": { "title": "Something went wrong", - "description": "The exchange transaction did not go through. Please try again or contact support." + "description": "Transaction failed. Please try again." }, "TimeoutError": { "title": "Sorry, server took too long to respond", @@ -5844,7 +5844,7 @@ "title": "Priority fee is higher than necessary. You might be overpaying" }, "MaxFeeTooLow": { - "title": "Max fee is lower than the recommended value" + "title": "Fee is lower than the recommended value" }, "PriorityFeeHigherThanMaxFee": { "title": "Max priority fee cannot be higher than max fee" @@ -6592,4 +6592,4 @@ "description": "Follow the instruction which appear on your Ledger’s Trusted Display." } } -} \ No newline at end of file +}