Skip to content

    0x Swap API v2 (AllowanceHolder) Headless Example

    Created by
    0xproject
    0xproject

    A headless example of how to use 0x Swap API v2 (AllowanceHolder) price and quote endpoints using viem.

    To run in replit, fork the project.

    Demonstrates the following on Base mainnet:

    1. Build price params. Fetch price.
    2. Check token approval.
    3. Build quote params. Fetch quote.
    4. Send transaction

    See additional details in github repo: https://github.com/0xProject/0x-examples/tree/main/swap-v2-allowance-holder-headless-example