Skip to content

Commit

Permalink
Merge branch 'hotfix'
Browse files Browse the repository at this point in the history
  • Loading branch information
live-github-bot[bot] committed Oct 15, 2024
2 parents 3e5bb3f + a7a904a commit a6265ea
Show file tree
Hide file tree
Showing 81 changed files with 934 additions and 90 deletions.
24 changes: 24 additions & 0 deletions apps/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# @ledgerhq/live-cli

## 24.7.2

### Patch Changes

- Updated dependencies [[`80e333c`](https://github.com/LedgerHQ/ledger-live/commit/80e333c30afdc7d14f1b5fd3e92c9fb10372e2c1), [`d8c171a`](https://github.com/LedgerHQ/ledger-live/commit/d8c171a6ed32012733786bde29b5493b1106cf56)]:
- @ledgerhq/live-common@34.11.1
- @ledgerhq/coin-framework@0.18.4
- @ledgerhq/coin-bitcoin@0.8.4
- @ledgerhq/device-core@0.4.3
- @ledgerhq/live-countervalues@0.2.9
- @ledgerhq/live-wallet@0.7.1

## 24.7.2-hotfix.0

### Patch Changes

- Updated dependencies [[`80e333c`](https://github.com/LedgerHQ/ledger-live/commit/80e333c30afdc7d14f1b5fd3e92c9fb10372e2c1), [`d8c171a`](https://github.com/LedgerHQ/ledger-live/commit/d8c171a6ed32012733786bde29b5493b1106cf56)]:
- @ledgerhq/live-common@34.11.1-hotfix.0
- @ledgerhq/coin-framework@0.18.4-hotfix.0
- @ledgerhq/coin-bitcoin@0.8.4-hotfix.0
- @ledgerhq/device-core@0.4.3-hotfix.0
- @ledgerhq/live-countervalues@0.2.9-hotfix.0
- @ledgerhq/live-wallet@0.7.1-hotfix.0

## 24.7.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ledgerhq/live-cli",
"version": "24.7.1",
"version": "24.7.2",
"description": "ledger-live CLI version",
"repository": {
"type": "git",
Expand Down
44 changes: 44 additions & 0 deletions apps/ledger-live-desktop/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
# ledger-live-desktop

## 2.89.1

### Patch Changes

- [#8089](https://github.com/LedgerHQ/ledger-live/pull/8089) [`80e333c`](https://github.com/LedgerHQ/ledger-live/commit/80e333c30afdc7d14f1b5fd3e92c9fb10372e2c1) Thanks [@live-github-bot](https://github.com/apps/live-github-bot)! - add ptxSwapCoreExperiment flag

- [#8089](https://github.com/LedgerHQ/ledger-live/pull/8089) [`d8c171a`](https://github.com/LedgerHQ/ledger-live/commit/d8c171a6ed32012733786bde29b5493b1106cf56) Thanks [@live-github-bot](https://github.com/apps/live-github-bot)! - hotfix: [swap] add ptxSwapCoreExperiment flag

- Updated dependencies [[`80e333c`](https://github.com/LedgerHQ/ledger-live/commit/80e333c30afdc7d14f1b5fd3e92c9fb10372e2c1), [`d8c171a`](https://github.com/LedgerHQ/ledger-live/commit/d8c171a6ed32012733786bde29b5493b1106cf56)]:
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]

## 2.89.1-hotfix.0

### Patch Changes

- [#8089](https://github.com/LedgerHQ/ledger-live/pull/8089) [`80e333c`](https://github.com/LedgerHQ/ledger-live/commit/80e333c30afdc7d14f1b5fd3e92c9fb10372e2c1) Thanks [@live-github-bot](https://github.com/apps/live-github-bot)! - add ptxSwapCoreExperiment flag

- [#8089](https://github.com/LedgerHQ/ledger-live/pull/8089) [`d8c171a`](https://github.com/LedgerHQ/ledger-live/commit/d8c171a6ed32012733786bde29b5493b1106cf56) Thanks [@live-github-bot](https://github.com/apps/live-github-bot)! - hotfix: [swap] add ptxSwapCoreExperiment flag

- Updated dependencies [[`80e333c`](https://github.com/LedgerHQ/ledger-live/commit/80e333c30afdc7d14f1b5fd3e92c9fb10372e2c1), [`d8c171a`](https://github.com/LedgerHQ/ledger-live/commit/d8c171a6ed32012733786bde29b5493b1106cf56)]:
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]

## 2.89.0

### Minor Changes
Expand Down
4 changes: 4 additions & 0 deletions apps/ledger-live-desktop/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.89.1

This release includes minor bug fixes.

# 2.89.0

This release includes small security improvements, UI tweaks, and minor bug fixes.
Expand Down
2 changes: 1 addition & 1 deletion apps/ledger-live-desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"license": "MIT",
"private": true,
"main": "./.webpack/main.bundle.js",
"version": "2.89.0",
"version": "2.89.1",
"scripts": {
"start:prod": "electron ./.webpack/main.bundle.js",
"start": "cross-env NODE_ENV=development node ./tools/main.js",
Expand Down
48 changes: 25 additions & 23 deletions apps/ledger-live-desktop/src/renderer/analytics/segment.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import { v4 as uuid } from "uuid";
import { runOnceWhen } from "@ledgerhq/live-common/utils/runOnceWhen";
import { getEnv } from "@ledgerhq/live-env";
import {
GENESIS_PASS_COLLECTION_CONTRACT,
hasNftInAccounts,
INFINITY_PASS_COLLECTION_CONTRACT,
} from "@ledgerhq/live-nft";
import { getDefaultAccountName } from "@ledgerhq/live-wallet/accountName";
import { AccountLike, Feature, FeatureId, Features, idsToLanguage } from "@ledgerhq/types-live";
import invariant from "invariant";
import { useCallback, useContext } from "react";
import { ReplaySubject } from "rxjs";
import { getEnv } from "@ledgerhq/live-env";
import logger from "~/renderer/logger";
import { v4 as uuid } from "uuid";
import { getParsedSystemLocale } from "~/helpers/systemLocale";
import user from "~/helpers/user";
import { runOnceWhen } from "@ledgerhq/live-common/utils/runOnceWhen";
import logger from "~/renderer/logger";
import { State } from "~/renderer/reducers";
import {
sidebarCollapsedSelector,
shareAnalyticsSelector,
developerModeSelector,
devicesModelListSelector,
hasSeenAnalyticsOptInPromptSelector,
languageSelector,
lastSeenDeviceSelector,
localeSelector,
languageSelector,
devicesModelListSelector,
shareAnalyticsSelector,
sharePersonalizedRecommendationsSelector,
hasSeenAnalyticsOptInPromptSelector,
sidebarCollapsedSelector,
trackingEnabledSelector,
developerModeSelector,
} from "~/renderer/reducers/settings";
import { State } from "~/renderer/reducers";
import { AccountLike, Feature, FeatureId, Features, idsToLanguage } from "@ledgerhq/types-live";
import { accountsSelector } from "../reducers/accounts";
import {
GENESIS_PASS_COLLECTION_CONTRACT,
hasNftInAccounts,
INFINITY_PASS_COLLECTION_CONTRACT,
} from "@ledgerhq/live-nft";
import createStore from "../createStore";
import { currentRouteNameRef, previousRouteNameRef } from "./screenRefs";
import { useCallback, useContext } from "react";
import { analyticsDrawerContext } from "../drawers/Provider";
import { getDefaultAccountName } from "@ledgerhq/live-wallet/accountName";
import { accountsSelector } from "../reducers/accounts";
import { currentRouteNameRef, previousRouteNameRef } from "./screenRefs";

invariant(typeof window !== "undefined", "analytics/segment must be called on renderer thread");
// eslint-disable-next-line @typescript-eslint/no-var-requires
Expand Down Expand Up @@ -87,8 +87,10 @@ const getPtxAttributes = () => {
const ptxSwapLiveAppDemoZero = analyticsFeatureFlagMethod("ptxSwapLiveAppDemoZero")?.enabled;
const ptxSwapLiveAppDemoOne = analyticsFeatureFlagMethod("ptxSwapLiveAppDemoOne")?.enabled;
const ptxSwapLiveAppDemoThree = analyticsFeatureFlagMethod("ptxSwapLiveAppDemoThree")?.enabled;
const ptxSwapThorswapProvider = analyticsFeatureFlagMethod("ptxSwapThorswapProvider")?.enabled;
const ptxSwapExodusProvider = analyticsFeatureFlagMethod("ptxSwapExodusProvider")?.enabled;
const ptxSwapCoreExperimentFlag = analyticsFeatureFlagMethod("ptxSwapCoreExperiment");
const ptxSwapCoreExperiment =
ptxSwapCoreExperimentFlag?.enabled && ptxSwapCoreExperimentFlag?.params?.variant;

const isBatch1Enabled: boolean =
!!fetchAdditionalCoins?.enabled && fetchAdditionalCoins?.params?.batch === 1;
Expand All @@ -113,7 +115,7 @@ const getPtxAttributes = () => {
ptxSwapLiveAppDemoZero,
ptxSwapLiveAppDemoOne,
ptxSwapLiveAppDemoThree,
ptxSwapThorswapProvider,
ptxSwapCoreExperiment,
ptxSwapExodusProvider,
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { NetworkDown } from "@ledgerhq/errors";
import { getAccountBridge } from "@ledgerhq/live-common/bridge/impl";
import { formatCurrencyUnit } from "@ledgerhq/live-common/currencies/index";
import { SwapExchangeRateAmountTooLow } from "@ledgerhq/live-common/errors";
import { useSwapLiveConfig } from "@ledgerhq/live-common/exchange/swap/hooks/index";
import { getAbandonSeedAddress } from "@ledgerhq/live-common/exchange/swap/hooks/useFromState";
import { SwapLiveError } from "@ledgerhq/live-common/exchange/swap/types";
import {
Expand Down Expand Up @@ -136,6 +137,7 @@ const SwapWebView = ({
const { networkStatus } = useNetworkStatus();
const isOffline = networkStatus === NetworkStatus.OFFLINE;
const swapDefaultTrack = useGetSwapTrackingProperties();
const swapLiveEnabledFlag = useSwapLiveConfig();

const hasSwapState = !!swapState;
const customPTXHandlers = usePTXCustomHandlers(manifest);
Expand Down Expand Up @@ -471,6 +473,11 @@ const SwapWebView = ({
toNewTokenId: swapState?.toNewTokenId,
feeStrategy: swapState?.feeStrategy,
customFeeConfig: swapState?.customFeeConfig,
...(swapLiveEnabledFlag?.params &&
"variant" in swapLiveEnabledFlag.params &&
swapLiveEnabledFlag.params.variant === "Demo0"
? { ptxSwapCoreExperiment: "Demo0" }
: {}),
};

Object.entries(swapParams).forEach(([key, value]) => {
Expand All @@ -484,11 +491,22 @@ const SwapWebView = ({
}, [
addressFrom,
addressTo,
swapState,
swapState?.fromAmount,
swapState?.error,
swapState?.loading,
swapState?.fromParentAccountId,
swapState?.estimatedFees,
swapState?.provider,
swapState?.toAccountId,
swapState?.fromAccountId,
swapState?.toNewTokenId,
swapState?.feeStrategy,
swapState?.customFeeConfig,
sourceCurrency?.id,
isMaxEnabled,
fromCurrency,
targetCurrency?.id,
swapLiveEnabledFlag?.params,
]);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import WebviewErrorDrawer from "./WebviewErrorDrawer/index";
import { GasOptions } from "@ledgerhq/coin-evm/lib/types/transaction";
import { getMainAccount, getParentAccount } from "@ledgerhq/live-common/account/helpers";
import { getAccountBridge } from "@ledgerhq/live-common/bridge/impl";
import { useSwapLiveConfig } from "@ledgerhq/live-common/exchange/swap/hooks/live-app-migration/useSwapLiveConfig";
import { getAbandonSeedAddress } from "@ledgerhq/live-common/exchange/swap/hooks/useFromState";
import {
convertToAtomicUnit,
Expand Down Expand Up @@ -123,6 +124,7 @@ const SwapWebView = ({ manifest, liveAppUnavailable }: SwapWebProps) => {
from?: string;
}>();
const redirectToHistory = useRedirectToSwapHistory();
const swapLiveEnabledFlag = useSwapLiveConfig();

const { networkStatus } = useNetworkStatus();
const isOffline = networkStatus === NetworkStatus.OFFLINE;
Expand Down Expand Up @@ -287,14 +289,26 @@ const SwapWebView = ({ manifest, liveAppUnavailable }: SwapWebProps) => {
? {
fromAccountId: accountToWalletAPIAccount(
walletState,
state.defaultAccount,
state?.defaultAccount,
state?.defaultParentAccount,
).id,
}
: {}),
...(state?.from ? { fromPath: simplifyFromPath(state.from) } : {}),
...(state?.from ? { fromPath: simplifyFromPath(state?.from) } : {}),
...(swapLiveEnabledFlag?.params && "variant" in swapLiveEnabledFlag.params
? {
ptxSwapCoreExperiment: swapLiveEnabledFlag.params?.variant as string,
}
: {}),
}).toString(),
[isOffline, state?.defaultAccount, state?.defaultParentAccount, walletState, state?.from],
[
isOffline,
state?.defaultAccount,
state?.defaultParentAccount,
state?.from,
walletState,
swapLiveEnabledFlag,
],
);

const onSwapWebviewError = (error?: SwapLiveError) => {
Expand All @@ -306,7 +320,7 @@ const SwapWebView = ({ manifest, liveAppUnavailable }: SwapWebProps) => {
const onStateChange: WebviewProps["onStateChange"] = state => {
setWebviewState(state);

if (!state.loading && state.isAppUnavailable) {
if (!state?.loading && state?.isAppUnavailable) {
liveAppUnavailable();
captureException(
new UnableToLoadSwapLiveError(
Expand All @@ -317,12 +331,12 @@ const SwapWebView = ({ manifest, liveAppUnavailable }: SwapWebProps) => {
};

useEffect(() => {
if (webviewState.url.includes("/unknown-error")) {
if (webviewState?.url.includes("/unknown-error")) {
// the live app has re-directed to /unknown-error. Handle this in callback, probably wallet-api failure.
onSwapWebviewError();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [webviewState.url]);
}, [webviewState?.url]);

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@ import { useFeature } from "@ledgerhq/live-common/featureFlags/index";
// used to get the value of the Swap Live App flag
export const useIsSwapLiveFlagEnabled = (flag: string): boolean => {
const demoZero = useFeature("ptxSwapLiveAppDemoZero");
const demoOne = useFeature("ptxSwapLiveAppDemoOne");
const demoThree = useFeature("ptxSwapLiveAppDemoThree");
const coreExperiment = useFeature("ptxSwapCoreExperiment");
const coreExperimentVariant = coreExperiment?.enabled && coreExperiment?.params?.variant;

if (flag === "ptxSwapLiveAppDemoThree") {
return !!demoThree?.enabled;
return (
!!demoThree?.enabled || ["Demo3", "Demo3Thorswap"].includes(coreExperimentVariant as string)
);
}

if (flag === "ptxSwapLiveAppDemoOne") {
return !!demoOne?.enabled;
if (flag === "ptxSwapLiveAppDemoZero") {
return !!demoZero?.enabled || coreExperimentVariant === "Demo0";
}

if (flag === "ptxSwapLiveAppDemoZero") {
return !!demoZero?.enabled;
if (flag === "ptxSwapLiveAppDemoOne") {
return false;
}

throw new Error(`Unknown Swap Live App flag: ${flag}`);
throw new Error(`Unknown Swap Live App flag ${flag}`);
};
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const GlobalStyle = createGlobalStyle`

const Swap2 = () => {
const isDemo3Enabled = useIsSwapLiveFlagEnabled("ptxSwapLiveAppDemoThree");

const SwapPage = isDemo3Enabled ? SwapApp : SwapForm;

return (
Expand Down
36 changes: 36 additions & 0 deletions apps/ledger-live-mobile/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
# live-mobile

## 3.52.1

### Patch Changes

- Updated dependencies [[`80e333c`](https://github.com/LedgerHQ/ledger-live/commit/80e333c30afdc7d14f1b5fd3e92c9fb10372e2c1), [`d8c171a`](https://github.com/LedgerHQ/ledger-live/commit/d8c171a6ed32012733786bde29b5493b1106cf56)]:
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]

## 3.52.1-hotfix.0

### Patch Changes

- Updated dependencies [[`80e333c`](https://github.com/LedgerHQ/ledger-live/commit/80e333c30afdc7d14f1b5fd3e92c9fb10372e2c1), [`d8c171a`](https://github.com/LedgerHQ/ledger-live/commit/d8c171a6ed32012733786bde29b5493b1106cf56)]:
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]

## 3.52.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/ledger-live-mobile/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "live-mobile",
"version": "3.52.0",
"version": "3.52.1",
"private": true,
"scripts": {
"postinstall": "zx ./scripts/post.mjs",
Expand Down
Loading

0 comments on commit a6265ea

Please sign in to comment.