I set up local 0x testnet as described here-- https://0x.org/docs/guides/setting-up-a-local-0x-testnet. That works great. The document also states that the local testnet is pre-setup with dummy tokens.

However, I can't call https://api.0x.org/swap/v1/quote?... because it, of course, doesn't know about the dummy tokens (calls return "insufficient liquidity" error message). I have two questions about this:

  1. How can I set up a local API instance on my dev machine and populate with test liquidity for the dummy tokens?
  2. Is there a different best practice for integrating with 0x in dev? (Maybe instead of setting up a local testnet I should do something else?)


1 Answer 1


Turns out this was a local issue (mismatch of networks, 0xAPI mainnet and dev was testnet).

In general this should be fine to fork mainnet in hardhat and execute against it. The only warning I would give is to make sure the hardhat fork isn't too long lived. Prices and liquidity can move around.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.