This commit is contained in:
tjs 2023-01-06 00:26:54 -05:00
parent 665cf9742d
commit 079e622624
2 changed files with 18 additions and 11 deletions

View File

@ -308,7 +308,11 @@ const Balance = ({ bank }: { bank: Bank }) => {
) : asPath.includes('/swap') ? (
<LinkButton
className="font-normal underline-offset-4"
onClick={() => handleSwapFormBalanceClick(balance)}
onClick={() =>
handleSwapFormBalanceClick(
floorToDecimal(balance, bank.mintDecimals).toNumber()
)
}
>
{formatDecimal(balance, bank.mintDecimals)}
</LinkButton>

View File

@ -21,26 +21,29 @@ const MaxSwapAmount = ({
if (mangoAccountLoading) return null
const maxBalanceValue = floorToDecimal(
tokenMax.toNumber(),
decimals
).toFixed()
const maxBorrowValue = floorToDecimal(
amountWithBorrow.toNumber(),
decimals
).toFixed()
return (
<div className="flex flex-wrap justify-end pl-6 text-xs">
<MaxAmountButton
className="mb-0.5"
label="Bal"
onClick={() =>
setAmountIn(floorToDecimal(Number(tokenMax), decimals).toFixed())
}
value={floorToDecimal(Number(tokenMax), decimals).toFixed()}
onClick={() => setAmountIn(maxBalanceValue)}
value={maxBalanceValue}
/>
{useMargin ? (
<MaxAmountButton
className="mb-0.5 ml-2"
label={t('max')}
onClick={() =>
setAmountIn(
floorToDecimal(Number(amountWithBorrow), decimals).toFixed()
)
}
value={floorToDecimal(Number(amountWithBorrow), decimals).toFixed()}
onClick={() => setAmountIn(maxBorrowValue)}
value={maxBorrowValue}
/>
) : null}
</div>