Skip to content

Commit

Permalink
feat: display solana tokens in LLD
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhd authored and Justkant committed Nov 4, 2024
1 parent e4e006e commit e34a167
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import { openModal } from "~/renderer/actions/modals";
import IconCoins from "~/renderer/icons/Coins";
import { SolanaFamily } from "./types";

const AccountHeaderActions: SolanaFamily["accountHeaderManageActions"] = ({ account, source }) => {
const AccountHeaderActions: SolanaFamily["accountHeaderManageActions"] = ({
account,
parentAccount,
source,
}) => {
const { t } = useTranslation();
const dispatch = useDispatch();
const mainAccount = getMainAccount(account);
const mainAccount = getMainAccount(account, parentAccount);
const { solanaResources } = mainAccount;

const onClick = useCallback(() => {
Expand All @@ -34,6 +38,10 @@ const AccountHeaderActions: SolanaFamily["accountHeaderManageActions"] = ({ acco
}
}, [account, dispatch, source, solanaResources, mainAccount]);

if (account.type === "TokenAccount") {
return null;
}

return [
{
key: "Stake",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
import React from "react";
import { Trans } from "react-i18next";
import { SolanaAccount, SolanaTokenAccount } from "@ledgerhq/live-common/families/solana/types";
import { isTokenAccountFrozen } from "@ledgerhq/live-common/families/solana/logic";
import { SubAccount } from "@ledgerhq/types-live";

import Box from "~/renderer/components/Box";
import Alert from "~/renderer/components/Alert";
import AccountSubHeader from "../../components/AccountSubHeader/index";
export default function SolanaAccountSubHeader() {
return <AccountSubHeader family="Solana" team="Solana Labs"></AccountSubHeader>;

type Account = SolanaAccount | SolanaTokenAccount | SubAccount;

type Props = {
account: Account;
};

export default function SolanaAccountSubHeader({ account }: Props) {
return (
<>
{isTokenAccountFrozen(account) && (
<Box mb={10}>
<Alert type="warning">
<Trans i18nKey="solana.token.frozenStateWarning" />
</Alert>
</Box>
)}
<AccountSubHeader family="Solana" team="Solana Labs"></AccountSubHeader>
</>
);
}
12 changes: 12 additions & 0 deletions apps/ledger-live-desktop/static/i18n/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -3717,6 +3717,9 @@
}
}
}
},
"token": {
"frozenStateWarning": "Account assets are frozen!"
}
},
"ethereum": {
Expand Down Expand Up @@ -6170,6 +6173,15 @@
"SolanaAccountNotFunded": {
"title": "Account not funded"
},
"SolanaAssociatedTokenAccountWillBeFunded": {
"title": "Account will be funded"
},
"SolanaTokenAccountFrozen": {
"title": "Token account assets are frozen"
},
"SolanaTokenAccounNotInitialized": {
"title": "Account not initialized"
},
"SolanaMemoIsTooLong": {
"title": "Memo is too long. Max length is {{maxLength}}"
},
Expand Down

0 comments on commit e34a167

Please sign in to comment.