fix account action modals max bug

This commit is contained in:
saml33 2023-02-10 20:41:06 +11:00
parent c79045aaa0
commit 4f26846caf
4 changed files with 8 additions and 8 deletions

View File

@ -103,7 +103,7 @@ function BorrowForm({ onSuccess, token }: BorrowFormProps) {
new Decimal(percentage).div(100).mul(tokenMax),
bank.mintDecimals
)
setInputAmount(amount.toString())
setInputAmount(amount.toFixed())
},
[tokenMax, bank]
)
@ -111,7 +111,7 @@ function BorrowForm({ onSuccess, token }: BorrowFormProps) {
const setMax = useCallback(() => {
if (!bank) return
const max = floorToDecimal(tokenMax, bank.mintDecimals)
setInputAmount(max.toString())
setInputAmount(max.toFixed())
handleSizePercentage('100')
}, [bank, tokenMax, handleSizePercentage])

View File

@ -126,7 +126,7 @@ function DepositForm({ onSuccess, token }: DepositFormProps) {
const setMax = useCallback(() => {
const max = floorToDecimal(tokenMax.maxAmount, tokenMax.maxDecimals)
setInputAmount(max.toString())
setInputAmount(max.toFixed())
setSizePercentage('100')
}, [tokenMax])
@ -137,7 +137,7 @@ function DepositForm({ onSuccess, token }: DepositFormProps) {
new Decimal(tokenMax.maxAmount).mul(percentage).div(100),
tokenMax.maxDecimals
)
setInputAmount(amount.toString())
setInputAmount(amount.toFixed())
},
[tokenMax]
)

View File

@ -92,7 +92,7 @@ function RepayForm({ onSuccess, token }: RepayFormProps) {
bank.mintDecimals,
Decimal.ROUND_UP
)
setInputAmount(amount.toString())
setInputAmount(amount.toFixed())
setSizePercentage('100')
}, [bank, borrowAmount])
@ -105,7 +105,7 @@ function RepayForm({ onSuccess, token }: RepayFormProps) {
.div(100)
.toDecimalPlaces(bank.mintDecimals, Decimal.ROUND_UP)
setInputAmount(amount.toString())
setInputAmount(amount.toFixed())
},
[bank, borrowAmount]
)

View File

@ -90,7 +90,7 @@ function WithdrawForm({ onSuccess, token }: WithdrawFormProps) {
new Decimal(tokenMax).mul(percentage).div(100),
bank.mintDecimals
)
setInputAmount(amount.toString())
setInputAmount(amount.toFixed())
},
[bank, tokenMax]
)
@ -98,7 +98,7 @@ function WithdrawForm({ onSuccess, token }: WithdrawFormProps) {
const setMax = useCallback(() => {
if (!bank) return
const max = floorToDecimal(tokenMax, bank.mintDecimals)
setInputAmount(max.toString())
setInputAmount(max.toFixed())
setSizePercentage('100')
}, [bank, tokenMax])