Possible Tool Errors

When requesting a quote or routes to the API, it is possible that one or more tools (exchanges or bridges) won't be able to provide a result. This can be caused by many reasons, from the tool simply not supporting the requested token pair or insufficient liquidity.

To better explain failure cases, we try to return errors in a predictable format. The ToolError interface looks like the following:

type ToolErrorType = 'NO_QUOTE'

interface ToolError {
  errorType: ToolErrorType
  code: string
  action: Action
  tool: string
  message: string
}

The possible codes we return are:

  • NO_POSSIBLE_ROUTE: No route was found for this action.

  • INSUFFICIENT_LIQUIDITY: The tool's liquidity is insufficient.

  • TOOL_TIMEOUT: The third-party tool timed out.

  • UNKNOWN_ERROR: An unknown error occurred.

  • RPC_ERROR: There was a problem getting on-chain data. Please try again later.

  • AMOUNT_TOO_LOW:The initial amount is too low to transfer using this tool.

  • AMOUNT_TOO_HIGH: The initial amount is too high to transfer using this tool.

  • FEES_HGHER_THAN_AMOUNT: The fees are higher than the initial amount -- this would result in negative resulting token.

  • DIFFERENT_RECIPIENT_NOT_SUPPORTED: This tool does not support different recipient addresses.

  • TOOL_SPECIFIC_ERROR: The third-party tool returned an error.

  • CANNOT_GUARANTEE_MIN_AMOUNT: The tool cannot guarantee that the minimum amount will be met.

Example Response:

If no quote is found, you will get an object that looks like this:

{
    "message": "Unable to find a quote for the requested transfer.",
    "errors": [
        {
            "errorType": "NO_QUOTE",
            "code": "INSUFFICIENT_LIQUIDITY",
            "action": {
                "fromChainId": 100,
                "toChainId": 100,
                "fromToken": {
                    "address": "0x4ecaba5870353805a9f068101a40e0f32ed605c6",
                    "decimals": 6,
                    "symbol": "USDT",
                    "chainId": 100,
                    "coinKey": "USDT",
                    "name": "USDT",
                    "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",
                    "priceUSD": "0.99872"
                },
                "toToken": {
                    "address": "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
                    "decimals": 6,
                    "symbol": "USDC",
                    "chainId": 100,
                    "coinKey": "USDC",
                    "name": "USDC",
                    "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"
                },
                "fromAmount": "1",
                "slippage": 0.03,
                "fromAddress": "0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0",
                "toAddress": "0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0"
            },
            "tool": "1inch",
            "message": "The tool's liquidity is insufficient."
        },
        {
            "errorType": "NO_QUOTE",
            "code": "TOOL_TIMEOUT",
            "action": {
                "fromChainId": 100,
                "toChainId": 100,
                "fromToken": {
                    "address": "0x4ecaba5870353805a9f068101a40e0f32ed605c6",
                    "decimals": 6,
                    "symbol": "USDT",
                    "chainId": 100,
                    "coinKey": "USDT",
                    "name": "USDT",
                    "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",
                    "priceUSD": "0.99872"
                },
                "toToken": {
                    "address": "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
                    "decimals": 6,
                    "symbol": "USDC",
                    "chainId": 100,
                    "coinKey": "USDC",
                    "name": "USDC",
                    "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"
                },
                "fromAmount": "1",
                "slippage": 0.03,
                "fromAddress": "0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0",
                "toAddress": "0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0"
            },
            "tool": "openocean",
            "message": "The third party tool timed out."
        },
        {
            "errorType": "NO_QUOTE",
            "code": "NO_POSSIBLE_ROUTE",
            "action": {
                "fromChainId": 100,
                "toChainId": 100,
                "fromToken": {
                    "address": "0x4ecaba5870353805a9f068101a40e0f32ed605c6",
                    "decimals": 6,
                    "symbol": "USDT",
                    "chainId": 100,
                    "coinKey": "USDT",
                    "name": "USDT",
                    "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",
                    "priceUSD": "0.99872"
                },
                "toToken": {
                    "address": "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
                    "decimals": 6,
                    "symbol": "USDC",
                    "chainId": 100,
                    "coinKey": "USDC",
                    "name": "USDC",
                    "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"
                },
                "fromAmount": "1",
                "slippage": 0.03,
                "fromAddress": "0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0",
                "toAddress": "0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0"
            },
            "tool": "superfluid",
            "message": "No route was found for this action."
        }
    ]
}

Last updated