Skip to content

Commit

Permalink
Revert "Merge pull request #8756 from LedgerHQ/bugfix/solana-delegati…
Browse files Browse the repository at this point in the history
…on-llm"

This reverts commit 80a46be, reversing
changes made to eb948eb.
  • Loading branch information
qperrot committed Jan 28, 2025
1 parent 763b486 commit 7e8983c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -18,7 +17,7 @@ const getMainActions = ({
parentAccount: Account;
parentRoute: RouteProp<ParamListBase, ScreenName>;
}): ActionButtonEvent[] => {
const delegationDisabled = isAccountEmpty(account);
const delegationDisabled = account.solanaResources?.stakes.length > 1;
const label = getStakeLabelLocaleBased();

const navigationParams: NavigationParamsType = delegationDisabled
Expand Down
46 changes: 0 additions & 46 deletions libs/coin-framework/src/account/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, () => {
Expand Down

0 comments on commit 7e8983c

Please sign in to comment.