Step Execution using the API
When executing orders using the API directly, there are often multiple steps, like submitting a deposit transaction to the solver or signing a message. These steps differ based on the desired action and best route to execute the action. To make this simple, you can use the quote endpoint, which return the exact steps that you need to follow, including descriptions that you can display to users. The flow looks like this:Fetching Steps
Call the Get Quote API to start your execution.
Iterate Through Steps
Iterate through the steps and the items within a step, taking the necessary
actions. Steps with no items, or an empty array of items, should be skipped.
If step item data is missing then polling the api is necessary.
Executing Steps
As mentioned above each step contains an array of one or more items. These
items need to be iterated and completed depending on the kind of step
(signature or transaction).
Checking the fill status
After a step is signed or submitted you should check on the progress of the
fill
Success!
Once all the steps are complete you can consider the action complete and
notify the user.
Signature Step
A message that needs to be signed. Every signature comes with sign data and post data. The first action we need to take is to sign the message, keep in mind the signatureKind and use the appropriate signing method. Refer to your crypto library of choice on how to sign (viem, web3, etc).post body to the endpoint provided in the post data. You’ll also need to provide the signature that was generated from the sign data as a query parameter. If the request is successful we can mark the step item as complete locally.
The design pattern of this API is completely generic, allowing for automatic support of new types of liquidity without needing to update the app. This data can be fed directly into an Ethereum library such as viem, making it easy to sign and submit the exact data that is needed.
Transaction Step
A transaction that needs to be submitted onchain. After the transaction is submitted onchain you can poll the step itemscheck endpoint. The endpoint will return a status which when successful will return ‘success’. The step item can then be successfully marked as complete. Note that the transaction step item contains a chainId for which the transaction should be submitted on.
Step IDs
Each step has a uniqueid that identifies the type of action required. Understanding these step IDs helps you build better UX and handle each step appropriately.
Transaction Steps
| Step ID | Description | When Used |
|---|---|---|
deposit | Deposit funds to the relayer for cross-chain execution | Used for cross-chain swaps and bridges. |
approve | Approve the transfer of an ERC20 token | Required before deposit or swap steps for ERC20 tokens the solver doesn’t hold. |
approval | Approve token for deposit | Token approval for deposit operations. |
swap | Execute a same-chain token swap | For same-chain swaps. May require an approval step first for EVM swaps. |
send | Send funds to the recipient | When sending the same asset on the same chain to a different recipient. |
Signature Steps
| Step ID | Description | When Used |
|---|---|---|
authorize | Sign authorization for specific operations | Used for: (1) Claiming app fees - EIP-191 signature to verify wallet ownership, (2) Hyperliquid v2 deposits - nonce-mapping signature. |
authorize1 | Sign to approve swap of tokens | Main flow for cross-chain permits Permit/Permit2. |
authorize2 | Sign to approve transfer of tokens | Same-chain swap permits. |
Common Step Flows
Depending on the action and tokens involved, Relay chains steps together. Here are common flows you may encounter:| Flow | Description |
|---|---|
deposit | Single step for cross-chain swaps/bridges |
swap | Single step for same-chain swaps |
approve → deposit | Approval needed before deposit for ERC20 tokens |
approve → swap | Same-chain swap requiring approval |
authorize1 | Cross-chain permit-based transfer (gasless) |
Step ID Examples
Below are detailed examples of each step type you may encounter when working with the Quote API.deposit
Deposit funds to the relayer to execute the swap. Used when the Relay solver holds the destination token.Example Step
Example Step
approve
An approval transaction to approve the transfer of an ERC20 token. Always followed by an additional step (deposit or swap).
Example Step
Example Step
send
Send funds to a recipient on the same chain.Example Step
Example Step
authorize
Sign authorization for specific operations. This step is used in two scenarios:- Claiming App Fees: Signs an EIP-191 message to verify wallet ownership before claiming accrued app fees.
- Hyperliquid Deposits: Signs a nonce-mapping signature for v2 Hyperliquid deposits.
App Fee Claim Example
App Fee Claim Example
authorize1
The main flow for cross-chain permits. Uses Permit2 or TransferWithAuthorization (EIP-3009).Example Step
Example Step
authorize2
Sign authorization for same-chain swap permits using PermitBatchWitnessTransferFrom.Example Step
Example Step
Full Quote Example
fees, breakdown and balances. Information about fees is detailed here. breakdown pertains to time estimation for the execution, broken down by value. The balances object is in regards to the user and how much they require to solve for the execution.
Checking the fill status
Along with the step data there’s an optional check object. You can use this object to check if the status of the transaction is complete. The object details the method and the endpoint to request. You should poll this until the endpoint returnssuccess.