Skip to content

Commit

Permalink
feat: display solana tokens in LLM
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhd authored and Justkant committed Nov 4, 2024
1 parent e34a167 commit 6a48948
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
28 changes: 26 additions & 2 deletions apps/ledger-live-mobile/src/families/solana/AccountSubHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
import React from "react";
import { Trans } from "react-i18next";
import { SubAccount } from "@ledgerhq/types-live";
import { Box, Alert, Text } from "@ledgerhq/native-ui";
import { isTokenAccountFrozen } from "@ledgerhq/live-common/families/solana/logic";
import { SolanaAccount, SolanaTokenAccount } from "@ledgerhq/live-common/families/solana/types";
import AccountSubHeader from "~/components/AccountSubHeader";

function SolanaAccountSubHeader() {
return <AccountSubHeader family="Solana" team="Solana Labs" />;
type Account = SolanaAccount | SolanaTokenAccount | SubAccount;

type Props = {
account: Account;
};

function SolanaAccountSubHeader({ account }: Props) {
return (
<>
{isTokenAccountFrozen(account) && (
<Box mt={6}>
<Alert type="warning">
<Text variant="body">
<Trans i18nKey="solana.token.frozenStateWarning" />
</Text>
</Alert>
</Box>
)}
<AccountSubHeader family="Solana" team="Solana Labs" />
</>
);
}

export default SolanaAccountSubHeader;
4 changes: 2 additions & 2 deletions apps/ledger-live-mobile/src/families/solana/SendRowsFee.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ type Props = {
StackNavigatorProps<BaseNavigatorStackParamList>
>;

export default function SolanaFeeRow({ account, status }: Props) {
export default function SolanaFeeRow({ account, parentAccount, status }: Props) {
const { colors } = useTheme();
const extraInfoFees = useCallback(() => {
Linking.openURL(urls.solana.supportPage);
}, []);

const fees = (status as SolanaTransactionStatus).estimatedFees;

const unit = useAccountUnit(account);
const unit = useAccountUnit(account.type === "TokenAccount" ? parentAccount || account : account);
const currency = getAccountCurrency(account);

return (
Expand Down
9 changes: 9 additions & 0 deletions apps/ledger-live-mobile/src/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,12 @@
"SolanaAccountNotFunded": {
"title": "Account not funded"
},
"SolanaAssociatedTokenAccountWillBeFunded": {
"title": "Account will be funded"
},
"SolanaTokenAccountFrozen": {
"title": "Token account assets are frozen"
},
"SolanaAddressOfEd25519": {
"title": "Address off ed25519 curve"
},
Expand Down Expand Up @@ -5906,6 +5912,9 @@
"description": "You may earn rewards by delegating your SOL assets to a validator."
},
"reserveWarning": "Please ensure you reserve at least {{amount}} SOL in your wallet to cover future network fees to deactivate and withdraw your stake"
},
"token": {
"frozenStateWarning": "Account assets are frozen!"
}
},
"near": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export function getListHeaderComponents({
<Header key="Header" />,
!!AccountSubHeader && (
<Box bg={colors.background.main} key="AccountSubHeader">
<AccountSubHeader />
<AccountSubHeader account={account} parentAccount={parentAccount} />
</Box>
),
oldestEditableOperation ? (
Expand Down

0 comments on commit 6a48948

Please sign in to comment.