diff --git a/.changeset/two-seas-remember.md b/.changeset/two-seas-remember.md new file mode 100644 index 000000000000..1fbd21c02ed7 --- /dev/null +++ b/.changeset/two-seas-remember.md @@ -0,0 +1,5 @@ +--- +"@ledgerhq/coin-evm": minor +--- + +fix: evm fee drawer correcly updates tx after changing fee strat (aligned with BTC) diff --git a/apps/ledger-live-desktop/src/renderer/families/evm/SendAmountFields/index.tsx b/apps/ledger-live-desktop/src/renderer/families/evm/SendAmountFields/index.tsx index bfb477d60c0f..75a0fbd1eaac 100644 --- a/apps/ledger-live-desktop/src/renderer/families/evm/SendAmountFields/index.tsx +++ b/apps/ledger-live-desktop/src/renderer/families/evm/SendAmountFields/index.tsx @@ -62,13 +62,23 @@ const Root: NonNullable["component"] = props => { const onFeeStrategyClick = useCallback( ({ feesStrategy }: { feesStrategy: Strategy }) => { - updateTransaction((tx: EvmTransaction) => - bridge.updateTransaction(tx, { + updateTransaction((tx: EvmTransaction) => { + let gasValues = {}; + + // ts tricks to not complain about type0 into type2 + if (gasOptions && feesStrategy in gasOptions) { + gasValues = Object.fromEntries( + Object.entries(gasOptions[feesStrategy]).filter(([key]) => key in tx), + ); + } + + return bridge.updateTransaction(tx, { feesStrategy, - }), - ); + ...gasValues, + }); + }); }, - [updateTransaction, bridge], + [updateTransaction, bridge, gasOptions], ); if (loading) {