Skip to content

Commit

Permalink
Merge branch 'develop' into feat/ton-token-integration-importer
Browse files Browse the repository at this point in the history
  • Loading branch information
hzheng-ledger committed Sep 5, 2024
2 parents 88eac68 + b606b71 commit 180ed89
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-cows-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

error messages for transaction and fees drawers
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -13,31 +16,29 @@ 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,
languageSelector,
} 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 {
convertToAtomicUnit,
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) {
Expand Down Expand Up @@ -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(
() => ({
Expand Down Expand Up @@ -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) => {
Expand Down
8 changes: 4 additions & 4 deletions apps/ledger-live-desktop/static/i18n/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -6592,4 +6592,4 @@
"description": "Follow the instruction which appear on your Ledger’s Trusted Display."
}
}
}
}

0 comments on commit 180ed89

Please sign in to comment.