add try catch in useTokenMax
This commit is contained in:
parent
ff6c03d7a7
commit
6c66cdbf20
|
@ -116,16 +116,19 @@ export const useTokenMax = (useMargin = true): TokenMaxResults => {
|
||||||
const outputBank = mangoStore((s) => s.swap.outputBank)
|
const outputBank = mangoStore((s) => s.swap.outputBank)
|
||||||
|
|
||||||
const tokenInMax = useMemo(() => {
|
const tokenInMax = useMemo(() => {
|
||||||
if (mangoAccount && group && inputBank && outputBank) {
|
try {
|
||||||
return getTokenInMax(
|
if (mangoAccount && group && inputBank && outputBank) {
|
||||||
mangoAccount,
|
return getTokenInMax(
|
||||||
inputBank.mint,
|
mangoAccount,
|
||||||
outputBank.mint,
|
inputBank.mint,
|
||||||
group,
|
outputBank.mint,
|
||||||
useMargin
|
group,
|
||||||
)
|
useMargin
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('Error in useTokenMax: ', e)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
amount: new Decimal(0),
|
amount: new Decimal(0),
|
||||||
amountWithBorrow: new Decimal(0),
|
amountWithBorrow: new Decimal(0),
|
||||||
|
|
Loading…
Reference in New Issue