Skip to content

Commit

Permalink
bugfix: add mev protection on swap
Browse files Browse the repository at this point in the history
  • Loading branch information
Canestin committed Dec 4, 2024
1 parent b6c8ff1 commit ddae56a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/perfect-toys-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": minor
---

fix: add mev protection on swap
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import { CryptoCurrency, Currency, TokenCurrency } from "@ledgerhq/types-cryptoa
import { AccountLike, Operation, SignedOperation } from "@ledgerhq/types-live";
import { BigNumber } from "bignumber.js";
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useDispatch } from "react-redux";
import { useSelector, useDispatch } from "react-redux";
import styled from "styled-components";
import { mevProtectionSelector } from "~/renderer/reducers/settings";
import { updateAccountWithUpdater } from "~/renderer/actions/accounts";
import { useIsSwapLiveFlagEnabled } from "~/renderer/screens/exchange/Swap2/hooks/useIsSwapLiveFlagEnabled";
import { useRedirectToSwapHistory } from "~/renderer/screens/exchange/Swap2/utils";
Expand Down Expand Up @@ -112,7 +113,8 @@ const Body = ({ data, onClose }: { data: Data; onClose?: () => void | undefined
return null;
}, [toAccount, getCurrencyByAccount]);

const broadcast = useBroadcast({ account, parentAccount });
const mevProtected = useSelector(mevProtectionSelector);
const broadcast = useBroadcast({ account, parentAccount, broadcastConfig: { mevProtected } });
const [transaction, setTransaction] = useState<Transaction>();
const [signedOperation, setSignedOperation] = useState<SignedOperation>();
const [error, setError] = useState<Error>();
Expand Down

0 comments on commit ddae56a

Please sign in to comment.