0x Gasless v2 Headless Example
Created by
0xproject
A headless example of how to use 0x Swap API v2 price and quote endpoints using viem.
To run in replit, fork the project.
Demonstrates the following on Base mainnet:
- Get an indicative price (sell 0.1 USDC → buy WETH) using /gasless/price
- Get a firm quote (sell 0.1 USDC → buy WETH) using /gasless/quote
- Submit the transaction using /gasless/submit a. Sign the gasless approval object (if applicable) b. Sign the trade object c. Split the signatures d. Package signed objects into a format that can be POST to /gasless/submit e. Compute trade hash
- Check the trade status using /gasless/status/{tradeHash}
See additional details in github repo: https://github.com/0xProject/0x-examples/tree/main/gasless-v2-headless-example
Loading...