show sol balance warning when connected
This commit is contained in:
parent
8384bca7e0
commit
f2bdd7a54b
|
@ -1,16 +1,18 @@
|
|||
import { TokenInstructions } from '@project-serum/serum'
|
||||
import { useWallet } from '@solana/wallet-adapter-react'
|
||||
import mangoStore from '@store/mangoStore'
|
||||
import { useMemo } from 'react'
|
||||
import { MIN_SOL_BALANCE } from 'utils/constants'
|
||||
|
||||
export default function useSolBalance() {
|
||||
const walletTokens = mangoStore((s) => s.wallet.tokens)
|
||||
const { connected } = useWallet()
|
||||
const solBalance: number = useMemo(() => {
|
||||
return (
|
||||
walletTokens.find((t) =>
|
||||
t.mint.equals(TokenInstructions.WRAPPED_SOL_MINT)
|
||||
)?.uiAmount || 0
|
||||
)
|
||||
return connected
|
||||
? walletTokens.find((t) =>
|
||||
t.mint.equals(TokenInstructions.WRAPPED_SOL_MINT)
|
||||
)?.uiAmount || 0
|
||||
: 100
|
||||
}, [walletTokens])
|
||||
|
||||
const maxSolDeposit: number = useMemo(() => {
|
||||
|
|
Loading…
Reference in New Issue