diff --git a/apps/ledger-live-desktop/static/i18n/en/app.json b/apps/ledger-live-desktop/static/i18n/en/app.json index bfcfee588412..d29b3008e0b6 100644 --- a/apps/ledger-live-desktop/static/i18n/en/app.json +++ b/apps/ledger-live-desktop/static/i18n/en/app.json @@ -6085,12 +6085,12 @@ "title": "Ensure that you have {{depositAmount}} ADA available for the deposit" }, "CardanoFeeTooHigh": { - "title": "Network fees seems higher than usual", - "description": "Please try again or contact Ledger Support" + "title": "Abnormally high network fees.", + "description": "Network fees unusually high please double check your transaction." }, "CardanoInvalidProtoParams": { - "title": "Cardano Invalid Protocol Prams", - "description": "Something went wrong, Please contact Ledger Support" + "title": "Cardano Invalid Protocol Parameters", + "description": "ADA transactions are temporarily unavailable. Please resync your account and try again or contact Support if you need assistance." }, "StacksMemoTooLong": { "title": "Memo length is too long" diff --git a/libs/coin-modules/coin-cardano/src/config.ts b/libs/coin-modules/coin-cardano/src/config.ts new file mode 100644 index 000000000000..1a8694aa05e3 --- /dev/null +++ b/libs/coin-modules/coin-cardano/src/config.ts @@ -0,0 +1,12 @@ +import buildConConfig, { type CurrencyConfig } from "@ledgerhq/coin-framework/config"; + +export type CardanoConfig = { + maxFeesWarning: number; + maxFeesError: number; +}; + +export type CardanoCoinConfig = CurrencyConfig & CardanoConfig; + +const coinConfig = buildConConfig(); + +export default coinConfig; diff --git a/libs/coin-modules/coin-cardano/src/constants.ts b/libs/coin-modules/coin-cardano/src/constants.ts index 4740f9a58040..e3ab7bbca4f4 100644 --- a/libs/coin-modules/coin-cardano/src/constants.ts +++ b/libs/coin-modules/coin-cardano/src/constants.ts @@ -9,6 +9,3 @@ export const CARDANO_MAX_SUPPLY = 45e9; export const CARDANO_API_ENDPOINT = getEnv("CARDANO_API_ENDPOINT"); export const CARDANO_TESTNET_API_ENDPOINT = getEnv("CARDANO_TESTNET_API_ENDPOINT"); - -export const MAX_FEES_WARN = 5e6; -export const MAX_FEES_THROW = 10e6; diff --git a/libs/coin-modules/coin-cardano/src/getTransactionStatus.ts b/libs/coin-modules/coin-cardano/src/getTransactionStatus.ts index 66f9e9942de7..227d528dbb75 100644 --- a/libs/coin-modules/coin-cardano/src/getTransactionStatus.ts +++ b/libs/coin-modules/coin-cardano/src/getTransactionStatus.ts @@ -28,7 +28,8 @@ import type { Transaction, TransactionStatus, } from "./types"; -import { CARDANO_MAX_SUPPLY, MAX_FEES_THROW, MAX_FEES_WARN } from "./constants"; +import { CARDANO_MAX_SUPPLY } from "./constants"; +import coinConfig from "./config"; export const getTransactionStatus: AccountBridge< Transaction, @@ -64,6 +65,9 @@ export const getTransactionStatus: AccountBridge< throw new Error("Invalid transaction mode"); } + const MAX_FEES_WARN = coinConfig.getCoinConfig().maxFeesWarning; + const MAX_FEES_THROW = coinConfig.getCoinConfig().maxFeesError; + if (txStatus.estimatedFees.gt(MAX_FEES_THROW)) { throw new CardanoFeeTooHigh(); } else if (txStatus.estimatedFees.gt(MAX_FEES_WARN)) { diff --git a/libs/ledger-live-common/src/families/cardano/config.ts b/libs/ledger-live-common/src/families/cardano/config.ts index c0a3d93b10a1..465a1254be11 100644 --- a/libs/ledger-live-common/src/families/cardano/config.ts +++ b/libs/ledger-live-common/src/families/cardano/config.ts @@ -1,12 +1,15 @@ -import { ConfigInfo } from "@ledgerhq/live-config/LiveConfig"; +import { CardanoCoinConfig } from "@ledgerhq/coin-cardano/config"; +import { CurrencyLiveConfigDefinition } from "../../config"; -export const cardanoConfig: Record = { +export const cardanoConfig: CurrencyLiveConfigDefinition = { config_currency_cardano: { type: "object", default: { status: { type: "active", }, - }, + maxFeesWarning: 5e6, + maxFeesError: 10e6, + } as CardanoCoinConfig, }, };