Skip to content

Commit

Permalink
Additional Error Checking
Browse files Browse the repository at this point in the history
  • Loading branch information
kirksgithub committed Oct 16, 2023
1 parent 8da110b commit e767022
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/DepositTokensButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const DepositTokensButton = ({
? undefined
: depositAmount.shiftedBy(-mintInfo.decimals).toNumber()

const [amount, setAmount] = useState((humanReadableMax?.toString() && humanReadableMax > 0) ? humanReadableMax.toString() : '')
const [amount, setAmount] = useState((humanReadableMax && humanReadableMax?.toString() && parseInt(humanReadableMax) > 0) ? humanReadableMax.toString() : '')

const deposit = useDepositCallback(role)
return (
Expand All @@ -63,7 +63,7 @@ export const DepositTokensButton = ({
<Input
placeholder={humanReadableMax?.toString() + ' (max)'}
type="number"
label={<>Amount to deposit - <a href="#" onClick={() => { setAmount(humanReadableMax?.toString()) }}>Max</a></>}
label={<>Amount to deposit - <a href="#" onClick={() => { setAmount(humanReadableMax ? humanReadableMax.toString() || '') }}>Max</a></>}
value={amount}
onChange={(e) => { setAmount(e.target.value) }}
max={humanReadableMax}
Expand Down

0 comments on commit e767022

Please sign in to comment.