0x Swap 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:
- Build price params. Fetch price.
- Check token approval.
- Build quote params. Fetch quote.
- Sign the Permit2 EIP-712 message.
- Append signature length and signature data to calldata.
- Send transaction
Send transaction.
See additional details in github repo: https://github.com/0xProject/0x-examples/tree/main/swap-v2-headless-example
Loading...