From 5e01938ece3dc1ccf7bea6c2805b6558c846db80 Mon Sep 17 00:00:00 2001 From: qperrot Date: Mon, 23 Dec 2024 16:26:23 +0100 Subject: [PATCH 1/2] fix: earn on llm --- .changeset/bright-cooks-breathe.md | 6 ++++++ .../src/families/solana/accountActions.tsx | 3 ++- libs/coin-framework/src/account/helpers.ts | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .changeset/bright-cooks-breathe.md diff --git a/.changeset/bright-cooks-breathe.md b/.changeset/bright-cooks-breathe.md new file mode 100644 index 000000000000..051e0ef6262d --- /dev/null +++ b/.changeset/bright-cooks-breathe.md @@ -0,0 +1,6 @@ +--- +"live-mobile": patch +"@ledgerhq/coin-framework": patch +--- + +fix solana earn on LLm diff --git a/apps/ledger-live-mobile/src/families/solana/accountActions.tsx b/apps/ledger-live-mobile/src/families/solana/accountActions.tsx index 05e4d9a8c6d1..133b6ebdfc37 100644 --- a/apps/ledger-live-mobile/src/families/solana/accountActions.tsx +++ b/apps/ledger-live-mobile/src/families/solana/accountActions.tsx @@ -7,6 +7,7 @@ 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, @@ -17,7 +18,7 @@ const getMainActions = ({ parentAccount: Account; parentRoute: RouteProp; }): ActionButtonEvent[] => { - const delegationDisabled = account.solanaResources?.stakes.length > 1; + const delegationDisabled = isAccountEmpty(account); const label = getStakeLabelLocaleBased(); const navigationParams: NavigationParamsType = delegationDisabled diff --git a/libs/coin-framework/src/account/helpers.ts b/libs/coin-framework/src/account/helpers.ts index 3ab46a1eb400..00db5eca261f 100644 --- a/libs/coin-framework/src/account/helpers.ts +++ b/libs/coin-framework/src/account/helpers.ts @@ -69,6 +69,13 @@ export const isAccountEmpty = (a: AccountLike): boolean => { (a as any).balance.isZero() ); } + if (a.type === "Account" && a.currency.family === "solana") { + return ( + (a as any).solanaResources && + (a as any).balance.isZero() && + (a as any).spendableBalance.isZero() + ); + } const hasSubAccounts = a.type === "Account" && a.subAccounts && a.subAccounts.length; return a.operationsCount === 0 && a.balance.isZero() && !hasSubAccounts; }; From db24171619f4876e1f0899fb08a1016063778183 Mon Sep 17 00:00:00 2001 From: qperrot Date: Fri, 27 Dec 2024 09:00:39 +0100 Subject: [PATCH 2/2] fix: check balance or spendableBalance and remove solanaResources --- libs/coin-framework/src/account/helpers.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libs/coin-framework/src/account/helpers.ts b/libs/coin-framework/src/account/helpers.ts index 00db5eca261f..dc1eefa9b359 100644 --- a/libs/coin-framework/src/account/helpers.ts +++ b/libs/coin-framework/src/account/helpers.ts @@ -70,11 +70,7 @@ export const isAccountEmpty = (a: AccountLike): boolean => { ); } if (a.type === "Account" && a.currency.family === "solana") { - return ( - (a as any).solanaResources && - (a as any).balance.isZero() && - (a as any).spendableBalance.isZero() - ); + return (a as any).balance.isZero() || (a as any).spendableBalance.isZero(); } const hasSubAccounts = a.type === "Account" && a.subAccounts && a.subAccounts.length; return a.operationsCount === 0 && a.balance.isZero() && !hasSubAccounts;