Skip to content

Commit

Permalink
🚩 (llm/lld) update mev feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasWerey committed Feb 14, 2025
1 parent d423a3e commit c39b231
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .changeset/orange-turkeys-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@ledgerhq/types-live": minor
"ledger-live-desktop": minor
"@ledgerhq/live-common": minor
---

Add link param to mevProtection ff
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import React from "react";
import styled from "styled-components";
import { rgba } from "~/renderer/styles/helpers";
import Box, { Card } from "~/renderer/components/Box";
import { Flex, Link } from "@ledgerhq/react-ui";
import { openURL } from "~/renderer/linking";

export const SettingsSection = styled(Card).attrs(() => ({
p: 0,
}))``;
Expand Down Expand Up @@ -94,6 +97,8 @@ type SettingsSectionRowProps = {
childrenContainerStyle?: React.CSSProperties;
dataTestId?: string;
id?: string;
externalUrl?: string;
linkText?: string;
};
export const SettingsSectionRow = ({
title,
Expand All @@ -106,6 +111,8 @@ export const SettingsSectionRow = ({
childrenContainerStyle,
dataTestId,
id,
externalUrl,
linkText,
}: SettingsSectionRowProps) => (
<SettingsSectionRowContainer
onClick={onClick}
Expand Down Expand Up @@ -140,6 +147,28 @@ export const SettingsSectionRow = ({
>
{desc}
</Box>
{externalUrl && (
<Flex
color="palette.text.shade60"
mr={1}
style={{
...(descContainerStyle || {}),
}}
>
<Link
alwaysUnderline
color="palette.text.shade60"
textProps={{
fontFamily: "Inter",
fontSize: 3,
fontWeight: "500",
}}
onClick={() => openURL(externalUrl)}
>
{linkText}
</Link>
</Flex>
)}
</Box>
<Box style={childrenContainerStyle}>{children}</Box>
</SettingsSectionRowContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const SectionGeneral = () => {
const { t } = useTranslation();
useInitSupportedCounterValues();
const lldAnalyticsOptInPromptFlag = useFeature("lldAnalyticsOptInPrompt");

const llMevProtectionFeatureFlag = useFeature("llMevProtection");
const mevLearnMoreLink = llMevProtectionFeatureFlag?.params?.link?.trim() || undefined;
return (
<>
<TrackPage category="Settings" name="Display" />
Expand Down Expand Up @@ -97,6 +98,8 @@ const SectionGeneral = () => {
desc={t("settings.display.mevProtectionDesc")}
dataTestId="setting-mevProtection"
id="setting-mevProtection"
externalUrl={mevLearnMoreLink}
linkText={t("settings.display.mevProtectionLearnMore")}
>
<MevProtectionRow />
</Row>
Expand Down
3 changes: 2 additions & 1 deletion apps/ledger-live-desktop/static/i18n/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4154,7 +4154,8 @@
"walletSync": "Ledger Sync",
"walletSyncDesc": "Sync your Ledger Live crypto accounts across different phones and computers.",
"mevProtection": "MEV Protection",
"mevProtectionDesc": "Enable MEV Protection for more reliable transactions on Ethereum",
"mevProtectionDesc": "Enable MEV Protection for more reliable transactions on Ethereum.",
"mevProtectionLearnMore": "Learn about shared data with partners",
"marketPerformanceWidget": "Market Performance Widget",
"marketPerformanceWidgetDesc": "Enable this feature to view the top gainers and losers over selected timeframes on the portfolio page."
},
Expand Down
5 changes: 4 additions & 1 deletion libs/ledger-live-common/src/featureFlags/defaultFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,10 @@ export const DEFAULT_FEATURES: Features = {
warningVisible: true,
},
},
llMevProtection: DEFAULT_FEATURE,
llMevProtection: {
...DEFAULT_FEATURE,
params: { link: null },
},
llmNetworkBasedAddAccountFlow: DEFAULT_FEATURE,
llCounterValueGranularitiesRates: {
...DEFAULT_FEATURE,
Expand Down
6 changes: 5 additions & 1 deletion libs/ledgerjs/packages/types-live/src/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export type Features = CurrencyFeatures & {
llmMemoTag: Feature_MemoTag;
lldMemoTag: Feature_MemoTag;
ldmkTransport: Feature_LdmkTransport;
llMevProtection: DefaultFeature;
llMevProtection: Feature_LlMevProtection;
llmNetworkBasedAddAccountFlow: DefaultFeature;
llCounterValueGranularitiesRates: Feature_LlCounterValueGranularitiesRates;
llmRebornLP: Feature_LlmRebornLP;
Expand Down Expand Up @@ -549,6 +549,10 @@ export type Feature_LlCounterValueGranularitiesRates = Feature<{
hourly: number;
}>;

export type Feature_LlMevProtection = Feature<{
link: string | null;
}>;

export type Feature_CounterValue = DefaultFeature;
export type Feature_MockFeature = DefaultFeature;
export type Feature_DisableNftSend = DefaultFeature;
Expand Down

0 comments on commit c39b231

Please sign in to comment.