diff --git a/apps/ledger-live-desktop/src/renderer/families/bitcoin/AccountHeaderManageActions.ts b/apps/ledger-live-desktop/src/renderer/families/bitcoin/AccountHeaderManageActions.ts index bc5ffc14b5ee..fe1939152ef4 100644 --- a/apps/ledger-live-desktop/src/renderer/families/bitcoin/AccountHeaderManageActions.ts +++ b/apps/ledger-live-desktop/src/renderer/families/bitcoin/AccountHeaderManageActions.ts @@ -7,6 +7,7 @@ import { stakeDefaultTrack } from "~/renderer/screens/stake/constants"; import { BitcoinAccount } from "@ledgerhq/coin-bitcoin/lib/types"; import { TokenAccount } from "@ledgerhq/types-live"; import IconCoins from "~/renderer/icons/Coins"; +import useFeature from "@ledgerhq/live-common/featureFlags/useFeature"; type Props = { account: BitcoinAccount | TokenAccount; @@ -14,6 +15,10 @@ type Props = { }; const AccountHeaderActions = ({ account, parentAccount }: Props) => { + const stakeProgramsFeatureFlag = useFeature("stakePrograms"); + const listFlag = stakeProgramsFeatureFlag?.params?.list ?? []; + const stakeProgramsEnabled = stakeProgramsFeatureFlag?.enabled ?? false; + const availableOnStake = stakeProgramsEnabled && listFlag.includes("bitcoin"); const history = useHistory(); const { t } = useTranslation(); const mainAccount = getMainAccount(account, parentAccount); @@ -43,18 +48,20 @@ const AccountHeaderActions = ({ account, parentAccount }: Props) => { }); }; - return [ - { - key: "Stake", - icon: IconCoins, - label: t("accounts.contextMenu.yield"), - event: "button_clicked2", - eventProperties: { - button: "stake", - }, - onClick: stakeOnClick, - }, - ]; + return availableOnStake + ? [ + { + key: "Stake", + icon: IconCoins, + label: t("accounts.contextMenu.yield"), + event: "button_clicked2", + eventProperties: { + button: "stake", + }, + onClick: stakeOnClick, + }, + ] + : []; }; export default AccountHeaderActions; diff --git a/apps/ledger-live-desktop/src/renderer/screens/account/AccountHeaderActions.tsx b/apps/ledger-live-desktop/src/renderer/screens/account/AccountHeaderActions.tsx index 5b46b9608858..02005b16748f 100644 --- a/apps/ledger-live-desktop/src/renderer/screens/account/AccountHeaderActions.tsx +++ b/apps/ledger-live-desktop/src/renderer/screens/account/AccountHeaderActions.tsx @@ -40,6 +40,7 @@ import { getAvailableProviders } from "@ledgerhq/live-common/exchange/swap/index import { useFetchCurrencyAll } from "@ledgerhq/live-common/exchange/swap/hooks/index"; import { isWalletConnectSupported } from "@ledgerhq/live-common/walletConnect/index"; import { WC_ID } from "@ledgerhq/live-common/wallet-api/constants"; +import useFeature from "@ledgerhq/live-common/featureFlags/useFeature"; type RenderActionParams = { label: React.ReactNode; @@ -189,6 +190,10 @@ const AccountHeaderActions = ({ account, parentAccount, openModal }: Props) => { const swapDefaultTrack = useGetSwapTrackingProperties(); const specific = getLLDCoinFamily(mainAccount.currency.family); + const stakeProgramsFeatureFlag = useFeature("stakePrograms"); + const listFlag = stakeProgramsFeatureFlag?.params?.list ?? []; + const stakeProgramsEnabled = stakeProgramsFeatureFlag?.enabled ?? false; + const manage = specific?.accountHeaderManageActions; let manageList: ManageAction[] = []; if (manage) { @@ -204,6 +209,7 @@ const AccountHeaderActions = ({ account, parentAccount, openModal }: Props) => { const availableOnBuy = !!currency && isCurrencyAvailable(currency.id, "onRamp"); const availableOnSell = !!currency && isCurrencyAvailable(currency.id, "offRamp"); + const availableOnStake = stakeProgramsEnabled && listFlag.includes(currency.id || ""); // don't show buttons until we know whether or not we can show swap button, otherwise possible click jacking const showButtons = !!getAvailableProviders(); @@ -278,8 +284,9 @@ const AccountHeaderActions = ({ account, parentAccount, openModal }: Props) => { }); }, [openModal, parentAccount, account, buttonSharedTrackingFields]); - const manageActions: RenderActionParams[] = [ - ...manageList.map(item => ({ + const manageActions: RenderActionParams[] = manageList + .filter(item => (availableOnStake && item.key === "Stake") || item.key !== "Stake") + .map(item => ({ ...item, contrastText, currency, @@ -287,8 +294,7 @@ const AccountHeaderActions = ({ account, parentAccount, openModal }: Props) => { ...buttonSharedTrackingFields, ...item.eventProperties, }, - })), - ]; + })); const buyHeader = onBuySell("buy")} />; const sellHeader = onBuySell("sell")} />; diff --git a/apps/ledger-live-desktop/tests/specs/accounts/account.spec.ts-snapshots/BTC-firstAccountPage-linux.png b/apps/ledger-live-desktop/tests/specs/accounts/account.spec.ts-snapshots/BTC-firstAccountPage-linux.png index 286410e3b7f8..c0a72777300e 100644 Binary files a/apps/ledger-live-desktop/tests/specs/accounts/account.spec.ts-snapshots/BTC-firstAccountPage-linux.png and b/apps/ledger-live-desktop/tests/specs/accounts/account.spec.ts-snapshots/BTC-firstAccountPage-linux.png differ diff --git a/apps/ledger-live-desktop/tests/specs/services/swap.spec.ts b/apps/ledger-live-desktop/tests/specs/services/swap.spec.ts index 52ef6cad60a1..0ebba65b2c65 100644 --- a/apps/ledger-live-desktop/tests/specs/services/swap.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/services/swap.spec.ts @@ -105,7 +105,8 @@ test.describe.parallel("Swap", () => { }); }); - test("Full Swap with Centralised Exchange @smoke", async ({ + //Test part of legacy swap, flaky at the moment they need to be reviewed + test.skip("Full Swap with Centralised Exchange @smoke", async ({ page, mockProviderSvgs, mockFeesEndpoint,