GET routes

Get all options for sending a given USD value from a source address to destination address, across multiple chains.

Ranks routes by cost and execution speed. Only considers options where source address has sufficient balance. Currently same-chain transfers and swaps are supported. Bridging coming soon.

Endpoint

/routes

Request

Parameters

  • fromAmountUsd (string): Desired send amount, in USD.

  • fromAddress (string: 0x...): Address of sender. Balances on all chains will be considered.

  • toAccounts (IAccount[]): Destination address and chains that should be considered.

IAccount

  • address (string: 0x...): Address of recipient

  • chainId (number): EVM chain ID.

  • optionalRecipientId (string): ID that will be returned with any routes that use this recipient.

Response

Returns an object containing a single key routes. routes is an array of IRoutes with the following structure.

  • type (string): DIRECT or INDIRECT. Direct routes are when a single currency is being transferred on a single chain. INDIRECT are routes that require swapping between currencies and/or bridging chains.

  • pair (IPair): Currency + chain being sent and currency + chain of recipient.

  • totalFeesUsd (string): 1.00 = $1.00 in fees (gas, swap, bridge, etc).

  • estimatedTxMs (number): Number of miliseconds until the transaction is accepted to the first block.

  • fromAmount (string): Amount of source currency to send.

  • availableFromAmount (string): Amount of source currency available to send.

  • optionalReciepientId (string): Echo'd value supplied with request.

  • steps (IStep[]): Each step involved in moving the funds (transfer, swap, bridge, etc).

  • tags (string[]): CHEAPEST | FASTEST

IPair

  • fromAccount (object): Account that is sending.

  • fromCurrency (object): Currency that is being sent

  • toAccount (object): Account that is receiving.

  • toCurrency (object): Currency that is being received.

IStep

  • type (string): TRANSFER | CROSS | SWAP

  • name (string)

  • sendAmount (string)

  • subtotalFeesUsd (string)

  • fees (object[])

  • pair (IPair)

Example

Get the best possible paths to send $1 from 0x2680d6E9b4B54fBf1B8e912909531a1306e0e6A9 to 0x80dDd67686cE46acE9F9a34E26f4ffbD7D7f8e4b on Base or Optimism.

Request

curl -X POST https://engine.omo.so/api/v1/routes \
-H "Content-Type: application/json" \
-d '{
  "fromAmountUsd": "1.00",
  "fromAddresses": ["0x2680d6E9b4B54fBf1B8e912909531a1306e0e6A9"],
  "toAccounts": [
    {
      "address": "0x80dDd67686cE46acE9F9a34E26f4ffbD7D7f8e4b",
      "chainId": 10,
      "optionalRecipientId": "ba292fbe-14e9-41f5-8858-654799323aa6"
    },
    {
      "address": "0x80dDd67686cE46acE9F9a34E26f4ffbD7D7f8e4b",
      "chainId": 8453,
      "optionalRecipientId": "3124d851-d4c1-4958-a4b7-d7be06d66bce"
    }
  ]
}'

Response

{
  "routes": [
    {
      "type": "DIRECT",
      "totalFeesUsd": "0.147813",
      "estimatedTxMs": 2000,
      "pair": {
        "fromAccount": {
          "address": "0x2680d6E9b4B54fBf1B8e912909531a1306e0e6A9",
          "chain": {
            "name": "Optimism",
            "chainId": 10
          }
        },
        "fromCurrency": {
          "decimals": 6,
          "name": "USDC",
          "address": "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
          "chain": {
            "name": "Optimism",
            "chainId": 10
          }
        },
        "toAccount": {
          "address": "0x80dDd67686cE46acE9F9a34E26f4ffbD7D7f8e4b",
          "chain": {
            "name": "Optimism",
            "chainId": 10
          },
          "optionalId": "ba292fbe-14e9-41f5-8858-654799323aa6"
        },
        "toCurrency": {
          "decimals": 6,
          "name": "USDC",
          "address": "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
          "chain": {
            "name": "Optimism",
            "chainId": 10
          }
        }
      },
      "fromAmount": "1000000",
      "availableFromAmount": "6000000",
      "optionalRecipientId": "ba292fbe-14e9-41f5-8858-654799323aa6",
      "steps": [
        {
          "type": "TRANSFER",
          "name": "TRANSFER",
          "sendAmount": "1000000",
          "subtotalFeesUsd": "0.147813",
          "fees": [
            {
              "name": "GAS",
              "type": "GAS",
              "feeUsd": "0.147813",
              "feeAmount": "0.000062572445960738",
              "feeAmountCurrency": {
                "address": "0x0000000000000000000000000000000000000000",
                "chain": {
                  "name": "Optimism",
                  "chainId": 10
                },
                "decimals": 18,
                "name": "NATIVE"
              }
            }
          ],
          "pair": {
            "fromAccount": {
              "address": "0x2680d6E9b4B54fBf1B8e912909531a1306e0e6A9",
              "chain": {
                "name": "Optimism",
                "chainId": 10
              }
            },
            "fromCurrency": {
              "decimals": 6,
              "name": "USDC",
              "address": "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
              "chain": {
                "name": "Optimism",
                "chainId": 10
              }
            },
            "toAccount": {
              "address": "0x80dDd67686cE46acE9F9a34E26f4ffbD7D7f8e4b",
              "chain": {
                "name": "Optimism",
                "chainId": 10
              },
              "optionalId": "ba292fbe-14e9-41f5-8858-654799323aa6"
            },
            "toCurrency": {
              "decimals": 6,
              "name": "USDC",
              "address": "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
              "chain": {
                "name": "Optimism",
                "chainId": 10
              }
            }
          }
        }
      ],
      "tags": [
        "CHEAPEST",
        "FASTEST"
      ]
    },
    {
      "type": "DIRECT",
      "totalFeesUsd": "0.154448",
      "estimatedTxMs": 2000,
      "pair": {
        "fromAccount": {
          "address": "0x2680d6E9b4B54fBf1B8e912909531a1306e0e6A9",
          "chain": {
            "name": "Base",
            "chainId": 8453
          }
        },
        "fromCurrency": {
          "decimals": 6,
          "name": "USDC",
          "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
          "chain": {
            "name": "Base",
            "chainId": 8453
          }
        },
        "toAccount": {
          "address": "0x80dDd67686cE46acE9F9a34E26f4ffbD7D7f8e4b",
          "chain": {
            "name": "Base",
            "chainId": 8453
          },
          "optionalId": "3124d851-d4c1-4958-a4b7-d7be06d66bce"
        },
        "toCurrency": {
          "decimals": 6,
          "name": "USDC",
          "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
          "chain": {
            "name": "Base",
            "chainId": 8453
          }
        }
      },
      "fromAmount": "1000000",
      "availableFromAmount": "2999900",
      "optionalRecipientId": "3124d851-d4c1-4958-a4b7-d7be06d66bce",
      "steps": [
        {
          "type": "TRANSFER",
          "name": "TRANSFER",
          "sendAmount": "1000000",
          "subtotalFeesUsd": "0.154448",
          "fees": [
            {
              "name": "GAS",
              "type": "GAS",
              "feeUsd": "0.154448",
              "feeAmount": "0.000065402167149033",
              "feeAmountCurrency": {
                "address": "0x0000000000000000000000000000000000000000",
                "chain": {
                  "name": "Base",
                  "chainId": 8453
                },
                "decimals": 18,
                "name": "NATIVE"
              }
            }
          ],
          "pair": {
            "fromAccount": {
              "address": "0x2680d6E9b4B54fBf1B8e912909531a1306e0e6A9",
              "chain": {
                "name": "Base",
                "chainId": 8453
              }
            },
            "fromCurrency": {
              "decimals": 6,
              "name": "USDC",
              "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
              "chain": {
                "name": "Base",
                "chainId": 8453
              }
            },
            "toAccount": {
              "address": "0x80dDd67686cE46acE9F9a34E26f4ffbD7D7f8e4b",
              "chain": {
                "name": "Base",
                "chainId": 8453
              },
              "optionalId": "3124d851-d4c1-4958-a4b7-d7be06d66bce"
            },
            "toCurrency": {
              "decimals": 6,
              "name": "USDC",
              "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
              "chain": {
                "name": "Base",
                "chainId": 8453
              }
            }
          }
        }
      ],
      "tags": [
        "FASTEST"
      ]
    }
  ]
}

Last updated