Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: evm fee drawer correcly updates tx after changing fee strat (aligned with BTC) #7755

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/two-seas-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/coin-evm": minor
---

fix: evm fee drawer correcly updates tx after changing fee strat (aligned with BTC)
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,23 @@ const Root: NonNullable<EvmFamily["sendAmountFields"]>["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) {
Expand Down
Loading