Skip to content

A basic example for how you can test 0x API using a private for of Ethereum mainnet

License

Notifications You must be signed in to change notification settings

0xProject/0x-api-forked-testnet-example

Repository files navigation

0x API mainnet forking Hardhat example

This project demonstrates how you can use Hardhat to fork the Ethereum mainnet and run tests on your private fork using quotes from using production Ethereum 0x API.

Getting started

  1. Clone the repo, and then run npm install.
  2. Copy .env.example to .env and add your own RPC_URL
  3. The example test is located in test/index.ts and can be executed with npx hardhat test

After running npx hardhat test you should see an output similar to this, confirming that your mainnet quote was successfully executed on your private fork

  0x API integration
--------BALANCES (before -> after)---------------------------
ETH: 53975713661856780269 -> 52969700071856780269
DAI: 2112188250000000000 -> 3105205012411249518052
-------------------------------------------------------------
    ✓ it should be able to use a 0x API mainnet quote (9812ms)


  1 passing (10s)

About

A basic example for how you can test 0x API using a private for of Ethereum mainnet

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published