Skip to content

Commit

Permalink
feat: add maxAmount to TransactionForm (#738)
Browse files Browse the repository at this point in the history
  • Loading branch information
TravellerOnTheRun authored Sep 11, 2023
1 parent e9ed8e0 commit ae203be
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/screens/send/TransactionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ const transactionSchema = yup.object().shape({
isToValid: yup.boolean().isTrue(),
})

const maxAmount = 99999999

export const TransactionForm = ({
initialValues,
tokenList,
Expand Down Expand Up @@ -168,6 +170,7 @@ export const TransactionForm = ({
...prev,
balance: text,
}))

if (_balanceInverted) {
const balanceToSet = convertUSDtoToken(numberAmount, tokenQuote)
setValue('amount', balanceToSet)
Expand Down Expand Up @@ -316,9 +319,12 @@ export const TransactionForm = ({
error={hasEnoughBalance ? t('transaction_form_error_balance') : ''}
onSwap={onSwapBalance}
editable
handleAmountChange={value =>
handleAmountChange={value => {
if (Number(value) > maxAmount) {
return
}
handleAmountChange(value, balanceInverted)
}
}}
/>
<Input
containerStyle={styles.marginTop10}
Expand Down

0 comments on commit ae203be

Please sign in to comment.