From 2d2e221c37a44f12ca4c172f9e6f997c300ac2eb Mon Sep 17 00:00:00 2001 From: nishadsingh1 Date: Sat, 8 Aug 2020 17:41:49 +0800 Subject: [PATCH] Indicate more clearly that it takes SOL to add a token to your wallet --- src/components/AddTokenDialog.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/AddTokenDialog.js b/src/components/AddTokenDialog.js index 93bb8c3..3aaf01b 100644 --- a/src/components/AddTokenDialog.js +++ b/src/components/AddTokenDialog.js @@ -12,6 +12,7 @@ import { useUpdateTokenName } from '../utils/tokens/names'; import { useAsyncData } from '../utils/fetch-loop'; import LoadingIndicator from './LoadingIndicator'; import { useSendTransaction } from '../utils/notifications'; +import { useBalanceInfo } from '../utils/wallet'; const feeFormat = new Intl.NumberFormat(undefined, { minimumFractionDigits: 6, @@ -30,6 +31,10 @@ export default function AddTokenDialog({ open, onClose }) { let [tokenName, setTokenName] = useState(''); let [tokenSymbol, setTokenSymbol] = useState(''); let [sendTransaction, sending] = useSendTransaction(); + let balanceInfo = useBalanceInfo(wallet.account.publicKey); + + let { amount } = balanceInfo || {}; + let noSol = amount === 0; function onSubmit() { let mint = new PublicKey(mintAddress); @@ -81,8 +86,8 @@ export default function AddTokenDialog({ open, onClose }) { -