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

feat(live-11604): clean up swap legacy code and flags #8555

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions .changeset/tricky-dryers-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@ledgerhq/types-live": patch
"ledger-live-desktop": patch
"@ledgerhq/live-common": patch
---

remove legacy swap code on LLD
16 changes: 1 addition & 15 deletions apps/ledger-live-desktop/src/renderer/analytics/segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,7 @@ const getPtxAttributes = () => {
const fetchAdditionalCoins = analyticsFeatureFlagMethod("fetchAdditionalCoins");
const stakingProviders = analyticsFeatureFlagMethod("ethStakingProviders");
const ptxCard = analyticsFeatureFlagMethod("ptxCard");
const ptxSwapMoonpayProviderFlag = analyticsFeatureFlagMethod("ptxSwapMoonpayProvider");

const ptxSwapLiveAppDemoZero = analyticsFeatureFlagMethod("ptxSwapLiveAppDemoZero")?.enabled;
const ptxSwapLiveAppDemoOne = analyticsFeatureFlagMethod("ptxSwapLiveAppDemoOne")?.enabled;
const ptxSwapLiveAppDemoThree = analyticsFeatureFlagMethod("ptxSwapLiveAppDemoThree")?.enabled;
const ptxSwapExodusProvider = analyticsFeatureFlagMethod("ptxSwapExodusProvider")?.enabled;
const ptxSwapCoreExperimentFlag = analyticsFeatureFlagMethod("ptxSwapCoreExperiment");
const ptxSwapCoreExperiment = ptxSwapCoreExperimentFlag?.enabled
? ptxSwapCoreExperimentFlag?.params?.variant
: undefined;

const isBatch1Enabled: boolean =
!!fetchAdditionalCoins?.enabled && fetchAdditionalCoins?.params?.batch === 1;
Expand All @@ -122,18 +113,13 @@ const getPtxAttributes = () => {
stakingProviders?.params?.listProvider?.length > 0
? stakingProviders?.params?.listProvider.length
: "flag not loaded";
const ptxSwapMoonpayProviderEnabled: boolean = !!ptxSwapMoonpayProviderFlag?.enabled;

return {
isBatch1Enabled,
isBatch2Enabled,
isBatch3Enabled,
stakingProvidersEnabled,
ptxCard,
ptxSwapMoonpayProviderEnabled,
ptxSwapLiveAppDemoZero,
ptxSwapLiveAppDemoOne,
ptxSwapLiveAppDemoThree,
ptxSwapCoreExperiment,
ptxSwapExodusProvider,
};
};
Expand Down

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions apps/ledger-live-desktop/src/renderer/icons/ArrowsUpDown.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"
import { useDispatch } from "react-redux";
import styled from "styled-components";
import { updateAccountWithUpdater } from "~/renderer/actions/accounts";
import { useIsSwapLiveFlagEnabled } from "~/renderer/screens/exchange/Swap2/hooks/useIsSwapLiveFlagEnabled";

import { useRedirectToSwapHistory } from "~/renderer/screens/exchange/Swap2/utils";
import { BodyContent } from "./BodyContent";

export enum ExchangeModeEnum {
Sell = "sell",
Swap = "swap",
}

export type ExchangeMode = "sell" | "swap";

export type Data = {
provider: string;
exchange: Exchange;
Expand All @@ -32,13 +39,6 @@ export type Data = {
magnitudeAwareRate?: BigNumber;
};

export enum ExchangeModeEnum {
Sell = "sell",
Swap = "swap",
}

export type ExchangeMode = "sell" | "swap";

type ResultsState = {
mode: ExchangeMode;
swapId?: string;
Expand Down Expand Up @@ -195,7 +195,7 @@ const Body = ({ data, onClose }: { data: Data; onClose?: () => void | undefined
const handleSellTransaction = (operation: Operation, result: ResultsState) => {
handleTransactionResult(result, operation);
};
const isDemo3Enabled = useIsSwapLiveFlagEnabled("ptxSwapLiveAppDemoThree");
const isDemo3Enabled = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IsSwapLiveAppEnabled would be a better name here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is a hardcoded const do we need it?


const onBroadcastSuccess = useCallback(
(operation: Operation) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ const ErrorWrapper = styled.div`
font-weight: 500;
`;

// set the default manifest ID for the production swap live app
// in case the FF is failing to load the manifest ID
// "swap-live-app-demo-3" points to production vercel URL for the swap live app
const DEFAULT_MANIFEST_ID = process.env.DEFAULT_SWAP_MANIFEST_ID || "swap-live-app-demo-3";

export function SwapApp() {
const [unavailable, setUnavailable] = useState(false);
const swapLiveEnabledFlag = useSwapLiveConfig();
const swapLiveAppManifestID = swapLiveEnabledFlag?.params?.manifest_id;
const swapLiveAppManifestID = swapLiveEnabledFlag?.params?.manifest_id || DEFAULT_MANIFEST_ID;

const localManifest = useLocalLiveAppManifest(swapLiveAppManifestID || undefined);
const remoteManifest = useRemoteLiveAppManifest(swapLiveAppManifestID || undefined);
Expand Down

This file was deleted.

Loading
Loading