'This transaction will not succeed either due to price movement or fee on transfer. Try increasing your slippage tolerance.'
break
case'UniswapV2: TRANSFER_FAILED':
errorMessage='The token could not be transferred. There may be an issue with the token.'
break
case'UniswapV2: K':
errorMessage=
'The Uniswap invariant x*y=k was not satisfied by the swap. This usually means one of the tokens you are swapping incorporates custom behavior on transfer.'
break
default:
errorMessage=`The transaction cannot succeed due to error: ${callError.reason}. This is probably an issue with one of the tokens you are swapping.`
return{call}
}
return{call,error:newError(errorMessage)}
})
...
...
@@ -190,21 +203,25 @@ export function useSwapCallback(
)
// a successful estimation is a bignumber gas estimate and the next call is also a bignumber gas estimate