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