From 7e8983c78550b858be8533c23385a5fb604f3748 Mon Sep 17 00:00:00 2001 From: qperrot Date: Tue, 28 Jan 2025 12:33:31 +0100 Subject: [PATCH] Revert "Merge pull request #8756 from LedgerHQ/bugfix/solana-delegation-llm" This reverts commit 80a46be830a333787c18533b8c57fcaad74c01dd, reversing changes made to eb948ebab5339d6b7ff97e8590e1cea032ad4f67. --- .../src/families/solana/accountActions.tsx | 3 +- .../src/account/helpers.test.ts | 46 ------------------- 2 files changed, 1 insertion(+), 48 deletions(-) diff --git a/apps/ledger-live-mobile/src/families/solana/accountActions.tsx b/apps/ledger-live-mobile/src/families/solana/accountActions.tsx index 133b6ebdfc37..05e4d9a8c6d1 100644 --- a/apps/ledger-live-mobile/src/families/solana/accountActions.tsx +++ b/apps/ledger-live-mobile/src/families/solana/accountActions.tsx @@ -7,7 +7,6 @@ import { SolanaAccount } from "@ledgerhq/live-common/families/solana/types"; import { NavigatorName, ScreenName } from "~/const"; import type { ActionButtonEvent, NavigationParamsType } from "~/components/FabActions"; import { getStakeLabelLocaleBased } from "~/helpers/getStakeLabelLocaleBased"; -import { isAccountEmpty } from "@ledgerhq/live-common/account/index"; const getMainActions = ({ account, @@ -18,7 +17,7 @@ const getMainActions = ({ parentAccount: Account; parentRoute: RouteProp; }): ActionButtonEvent[] => { - const delegationDisabled = isAccountEmpty(account); + const delegationDisabled = account.solanaResources?.stakes.length > 1; const label = getStakeLabelLocaleBased(); const navigationParams: NavigationParamsType = delegationDisabled diff --git a/libs/coin-framework/src/account/helpers.test.ts b/libs/coin-framework/src/account/helpers.test.ts index 8def35b126e1..0cec6c7fd07d 100644 --- a/libs/coin-framework/src/account/helpers.test.ts +++ b/libs/coin-framework/src/account/helpers.test.ts @@ -160,52 +160,6 @@ describe(isAccountEmpty.name, () => { }); }); }); - describe("given a solana account", () => { - beforeAll(() => { - mockAccount.type = "Account"; - mockAccount.currency = { family: "solana" } as CryptoCurrency; - mockAccount.operationsCount = 0; - delete mockAccount.subAccounts; - }); - - it("returns false when balance and spendableBalance is zero ", () => { - mockAccount.balance = new BigNumber(10); - mockAccount.spendableBalance = new BigNumber(0); - expect(isAccountEmpty(mockAccount)).toEqual(false); - }); - it("returns true when spendableBalance and balance is zero", () => { - mockAccount.balance = new BigNumber(0); - mockAccount.spendableBalance = new BigNumber(10); - expect(isAccountEmpty(mockAccount)).toEqual(true); - }); - it("returns false when spendableBalance and has balance", () => { - mockAccount.balance = new BigNumber(10); - mockAccount.spendableBalance = new BigNumber(10); - expect(isAccountEmpty(mockAccount)).toEqual(false); - }); - - describe("when it has subaccounts", () => { - beforeAll(() => { - mockAccount.subAccounts = [{} as TokenAccount]; - }); - - it("returns false when balance and spendableBalance is zero ", () => { - mockAccount.balance = new BigNumber(10); - mockAccount.spendableBalance = new BigNumber(0); - expect(isAccountEmpty(mockAccount)).toEqual(false); - }); - it("returns false when spendableBalance and balance is zero", () => { - mockAccount.balance = new BigNumber(0); - mockAccount.spendableBalance = new BigNumber(10); - expect(isAccountEmpty(mockAccount)).toEqual(false); - }); - it("returns false when spendableBalance and has balance", () => { - mockAccount.balance = new BigNumber(10); - mockAccount.spendableBalance = new BigNumber(10); - expect(isAccountEmpty(mockAccount)).toEqual(false); - }); - }); - }); }); describe(clearAccount.name, () => {