diff --git a/src/features/account/AccountTokenScreen.tsx b/src/features/account/AccountTokenScreen.tsx index 66889159a..e7b9a0d26 100644 --- a/src/features/account/AccountTokenScreen.tsx +++ b/src/features/account/AccountTokenScreen.tsx @@ -13,12 +13,15 @@ import BottomSheet, { BottomSheetFlatList, WINDOW_HEIGHT, } from '@gorhom/bottom-sheet' +import { useOwnedAmount } from '@helium/helium-react-hooks' import { DC_MINT, HNT_MINT, IOT_MINT, MOBILE_MINT } from '@helium/spl-utils' +import { useCurrentWallet } from '@hooks/useCurrentWallet' import useLayoutHeight from '@hooks/useLayoutHeight' import { useMetaplexMetadata } from '@hooks/useMetaplexMetadata' import { usePublicKey } from '@hooks/usePublicKey' import { RouteProp, useRoute } from '@react-navigation/native' import { NATIVE_MINT } from '@solana/spl-token' +import { LAMPORTS_PER_SOL } from '@solana/web3.js' import globalStyles from '@theme/globalStyles' import { useColors } from '@theme/themeHooks' import React, { useCallback, useMemo, useRef, useState } from 'react' @@ -135,6 +138,8 @@ const AccountTokenScreen = () => { topHeaderHeight, topHeaderYPos, ]) + const wallet = useCurrentWallet() + const { amount } = useOwnedAmount(wallet, mint) const canShowList = useMemo(() => snapPoints?.length === 2, [snapPoints]) @@ -490,7 +495,16 @@ const AccountTokenScreen = () => { /> - + {mint.equals(NATIVE_MINT) && + (amount || 0) < 0.02 * LAMPORTS_PER_SOL ? ( + + + {t('accountsScreen.solWarning')} + + + ) : ( + + )} {!!canShowList && ( diff --git a/src/features/account/AccountsScreen.tsx b/src/features/account/AccountsScreen.tsx index 584622f68..65461a9e4 100644 --- a/src/features/account/AccountsScreen.tsx +++ b/src/features/account/AccountsScreen.tsx @@ -275,7 +275,7 @@ const AccountsScreen = () => { - + ) }, [handleTopHeaderLayout, headerAnimatedStyle]) diff --git a/src/features/account/TokenListItem.tsx b/src/features/account/TokenListItem.tsx index 31cacd363..0d3a56cab 100644 --- a/src/features/account/TokenListItem.tsx +++ b/src/features/account/TokenListItem.tsx @@ -1,4 +1,5 @@ import Arrow from '@assets/images/listItemRight.svg' +import InfoWarning from '@assets/images/warning.svg' import Box from '@components/Box' import FadeInOut from '@components/FadeInOut' import Text from '@components/Text' @@ -9,7 +10,8 @@ import { useCurrentWallet } from '@hooks/useCurrentWallet' import useHaptic from '@hooks/useHaptic' import { useMetaplexMetadata } from '@hooks/useMetaplexMetadata' import { useNavigation } from '@react-navigation/native' -import { PublicKey } from '@solana/web3.js' +import { NATIVE_MINT } from '@solana/spl-token' +import { LAMPORTS_PER_SOL, PublicKey } from '@solana/web3.js' import { humanReadable } from '@utils/solanaUtils' import BN from 'bn.js' import React, { useCallback, useMemo } from 'react' @@ -105,6 +107,11 @@ const TokenListItem = ({ mint }: Props) => { /> )} + {mint.equals(NATIVE_MINT) && (amount || 0) < 0.02 * LAMPORTS_PER_SOL && ( + + + + )} diff --git a/src/locales/en.ts b/src/locales/en.ts index 31e3829b5..554394a85 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -169,6 +169,8 @@ export default { delegate: 'Delegated', mint: 'Received', }, + solWarning: + 'Your balance may not have enough SOL to cover all transactions. Solana wallets require a minimum of 0.00089088 SOL. We recommend keeping greater than 0.02 sol in your wallet for the best experience', hideFilters: 'Hide Filters', myTransactions: 'My Transactions', showFilters: 'Show Filters', diff --git a/src/theme/theme.ts b/src/theme/theme.ts index a32568986..0f499a8a9 100644 --- a/src/theme/theme.ts +++ b/src/theme/theme.ts @@ -149,6 +149,7 @@ const palette = { offWhite: '#F9FAFC', orange500: '#FFB156', + warning: '#FFE5C7', persianRose: '#FF2DB7',