diff --git a/apps/ledger-live-desktop/src/renderer/components/Web3AppWebview/LiveAppSDKLogic.ts b/apps/ledger-live-desktop/src/renderer/components/Web3AppWebview/LiveAppSDKLogic.ts index 2be53315eb3..5ed516eee91 100644 --- a/apps/ledger-live-desktop/src/renderer/components/Web3AppWebview/LiveAppSDKLogic.ts +++ b/apps/ledger-live-desktop/src/renderer/components/Web3AppWebview/LiveAppSDKLogic.ts @@ -18,7 +18,6 @@ import { OperationDetails } from "~/renderer/drawers/OperationDetails"; import { setDrawer } from "~/renderer/drawers/Provider"; import { track } from "~/renderer/analytics/segment"; import { WalletState } from "@ledgerhq/live-wallet/store"; -import { mevProtectionSelector } from "~/renderer/reducers/settings"; const trackingLiveAppSDKLogic = trackingWrapper(track); @@ -27,6 +26,7 @@ type WebPlatformContext = { dispatch: Dispatch; accounts: AccountLike[]; tracking: typeof trackingLiveAppSDKLogic; + mevProtected: boolean; }; export type RequestAccountParams = { @@ -55,7 +55,7 @@ export const requestAccountLogic = async ( }; export const broadcastTransactionLogic = ( - { manifest, dispatch, accounts, tracking }: WebPlatformContext, + { manifest, dispatch, accounts, tracking, mevProtected }: WebPlatformContext, accountId: string, signedTransaction: RawPlatformSignedTransaction, pushToast: (data: ToastData) => void, @@ -72,7 +72,6 @@ export const broadcastTransactionLogic = ( ): Promise => { const bridge = getAccountBridge(account, parentAccount); const mainAccount = getMainAccount(account, parentAccount); - const mevProtected = useSelector(mevProtectionSelector); let optimisticOperation: Operation = signedOperation.operation; diff --git a/apps/ledger-live-desktop/src/renderer/components/Web3AppWebview/PlatformAPIWebview.tsx b/apps/ledger-live-desktop/src/renderer/components/Web3AppWebview/PlatformAPIWebview.tsx index 3ea51be4de5..0344e83df5c 100644 --- a/apps/ledger-live-desktop/src/renderer/components/Web3AppWebview/PlatformAPIWebview.tsx +++ b/apps/ledger-live-desktop/src/renderer/components/Web3AppWebview/PlatformAPIWebview.tsx @@ -37,6 +37,7 @@ import { Loader } from "./styled"; import { WebviewAPI, WebviewProps } from "./types"; import { useWebviewState } from "./helpers"; import { currentRouteNameRef } from "~/renderer/analytics/screenRefs"; +import { mevProtectionSelector } from "~/renderer/reducers/settings"; import { walletSelector } from "~/renderer/reducers/wallet"; export const PlatformAPIWebview = forwardRef( @@ -77,6 +78,7 @@ export const PlatformAPIWebview = forwardRef( const dispatch = useDispatch(); const accounts = useSelector(flattenAccountsSelector); + const mevProtected = useSelector(mevProtectionSelector); const { pushToast } = useToasts(); const { t } = useTranslation(); @@ -178,14 +180,14 @@ export const PlatformAPIWebview = forwardRef( signedTransaction: RawPlatformSignedTransaction; }) => { return broadcastTransactionLogic( - { manifest, dispatch, accounts, tracking }, + { manifest, dispatch, accounts, tracking, mevProtected }, accountId, signedTransaction, pushToast, t, ); }, - [manifest, accounts, pushToast, dispatch, t, tracking], + [manifest, accounts, pushToast, dispatch, t, tracking, mevProtected], ); const startExchange = useCallback(