From 5ce9886cbe788013b854eb4d3c1ce0504d7b2d68 Mon Sep 17 00:00:00 2001 From: Mikhail Date: Mon, 20 May 2024 12:52:00 +0300 Subject: [PATCH] feat: display solana tokens in LLM --- .../src/families/solana/AccountSubHeader.tsx | 28 +++++++++++++++++-- .../src/families/solana/SendRowsFee.tsx | 4 +-- .../src/locales/en/common.json | 9 ++++++ .../screens/Account/ListHeaderComponent.tsx | 2 +- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/apps/ledger-live-mobile/src/families/solana/AccountSubHeader.tsx b/apps/ledger-live-mobile/src/families/solana/AccountSubHeader.tsx index 54fe755006cc..8cc760b845ff 100644 --- a/apps/ledger-live-mobile/src/families/solana/AccountSubHeader.tsx +++ b/apps/ledger-live-mobile/src/families/solana/AccountSubHeader.tsx @@ -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 ; +type Account = SolanaAccount | SolanaTokenAccount | SubAccount; + +type Props = { + account: Account; +}; + +function SolanaAccountSubHeader({ account }: Props) { + return ( + <> + {isTokenAccountFrozen(account) && ( + + + + + + + + )} + + + ); } export default SolanaAccountSubHeader; diff --git a/apps/ledger-live-mobile/src/families/solana/SendRowsFee.tsx b/apps/ledger-live-mobile/src/families/solana/SendRowsFee.tsx index 9f4c1761c474..64ad6e73fa71 100644 --- a/apps/ledger-live-mobile/src/families/solana/SendRowsFee.tsx +++ b/apps/ledger-live-mobile/src/families/solana/SendRowsFee.tsx @@ -32,7 +32,7 @@ type Props = { StackNavigatorProps >; -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); @@ -40,7 +40,7 @@ export default function SolanaFeeRow({ account, status }: Props) { const fees = (status as SolanaTransactionStatus).estimatedFees; - const unit = useAccountUnit(account); + const unit = useAccountUnit(account.type === "TokenAccount" ? parentAccount || account : account); const currency = getAccountCurrency(account); return ( diff --git a/apps/ledger-live-mobile/src/locales/en/common.json b/apps/ledger-live-mobile/src/locales/en/common.json index ec5eefb43c03..896dbe7a6815 100644 --- a/apps/ledger-live-mobile/src/locales/en/common.json +++ b/apps/ledger-live-mobile/src/locales/en/common.json @@ -764,6 +764,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" }, @@ -5794,6 +5800,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": { diff --git a/apps/ledger-live-mobile/src/screens/Account/ListHeaderComponent.tsx b/apps/ledger-live-mobile/src/screens/Account/ListHeaderComponent.tsx index f7af804b39ce..ea4333164cf6 100644 --- a/apps/ledger-live-mobile/src/screens/Account/ListHeaderComponent.tsx +++ b/apps/ledger-live-mobile/src/screens/Account/ListHeaderComponent.tsx @@ -161,7 +161,7 @@ export function getListHeaderComponents({
, !!AccountSubHeader && ( - + ), oldestEditableOperation ? (