✨Quick Start

Complete your first cross-chain trade with WheelX API in a few minutes.

This guide walks you through a cross-chain trade from USDC on Ethereum to USDT on Soneium, from quote to final status.

Before You Start

Base URL:

https://api.wheelx.fi/v1

Requirements:

  • Node.js 18+

  • an Ethereum RPC URL

  • an EVM wallet address

  • a signer or wallet client that can send transactions on Ethereum

  • a wallet that holds USDC on Ethereum mainnet

  • a small amount of ETH for gas

System Flow

This is the execution flow for a standard WheelX cross-chain trade.

Try It Step by Step

1

Install the dependencies

This example uses axios to call the API and viem to check allowance, approve the token, and send the transaction. viem is not required by WheelX itself. It is included here because the sample script uses it end to end.

2

Configure your environment

Set the RPC endpoint and the wallet address before running the script.

3

Request a quote

This example performs a bridge-and-swap flow from Ethereum USDC to Soneium USDT.

You can use the placeholder address above to try the quote request first. Replace both address fields with your own EVM address before sending a real transaction. In the full script below, this value is read from WALLET_ADDRESS.

chevron-rightView the same request as CURLhashtag
4

Review the response

A successful quote returns the transaction payload, the approval requirement, and the order identifier you will use later for status tracking.

Key fields to check:

  • request_id: save this value for order polling

  • tx.to: contract address for the source-chain transaction

  • tx.data: calldata to submit

  • tx.value: native token value to include with the transaction

  • approve: approval instructions for the input token; if not null, approve before the main transaction

  • amount_out: quoted destination amount

  • min_receive: minimum receive amount after slippage

  • estimated_time: rough route duration

  • router: readable route summary

circle-info

The quote already contains the transaction payload needed for execution. You do not need to build calldata yourself.

chevron-rightView a longer response examplehashtag
5

Execute the trade

Create a file named wheelx-quickstart.mjs, paste the script below, and connect your own signer before running it. The script focuses on the WheelX flow and leaves wallet setup to your application.

chevron-rightView the full Node.js scripthashtag
chevron-rightView a local testing version that uses PRIVATE_KEYhashtag

If you prefer to run this flow locally without adding wallet connection code first, you can use a private key from an environment variable.

Run it:

6

Check the order status

For this flow, the order status is simple:

  • Open: the order has started and is still in progress

  • Filled: the cross-chain trade is complete

  • Failed: the order did not complete successfully

Use this rule in your application:

  1. Submit the source-chain transaction

  2. Keep the request_id

  3. Poll /order/{request_id}

  4. Mark the trade as complete only when the order reaches Filled

circle-exclamation

Last updated