fix negative swap max
This commit is contained in:
parent
efdd8a8934
commit
73162e5544
|
@ -53,15 +53,17 @@ export const getTokenInMax = (
|
|||
? inputTokenBalance
|
||||
: new Decimal(0)
|
||||
|
||||
const maxUiAmountWithBorrow = floorToDecimal(
|
||||
mangoAccount.getMaxSourceUiForTokenSwap(
|
||||
group,
|
||||
inputBank.mint,
|
||||
outputBank.mint
|
||||
),
|
||||
inputBank.mintDecimals
|
||||
const rawMaxUiAmountWithBorrow = mangoAccount.getMaxSourceUiForTokenSwap(
|
||||
group,
|
||||
inputBank.mint,
|
||||
outputBank.mint
|
||||
)
|
||||
|
||||
const maxUiAmountWithBorrow =
|
||||
rawMaxUiAmountWithBorrow > 0
|
||||
? floorToDecimal(rawMaxUiAmountWithBorrow, inputBank.mintDecimals)
|
||||
: new Decimal(0)
|
||||
|
||||
const inputBankVaultBalance = floorToDecimal(
|
||||
group
|
||||
.getTokenVaultBalanceByMintUi(inputBank.mint)
|
||||
|
|
Loading…
Reference in New Issue