ethereumblockchainswapweb3jshardhat

Can I swap with 1inch swap apis with forked hardhart?


I have used hardhat to fork mainnet and imported the account in metamask. When I swap with that account on uniswap it works perfectly fine. But when I use 1inch swap api it connects with my mainnet and says i dont have sufficient fund for swapping. Can I use 1inch api and hardhat forked network to do the swapping in the same network?

https://api.1inch.dev/swap/v6.0/1/swap?fromTokenAddress=${query.fromTokenAddress}&toTokenAddress=${query.toTokenAddress}&amount=${query.amount}&fromAddress=${query.fromAddress}&slippage=${query.slippage}

This is the api i m hitting from the front end.


Solution

  • 1inch API doesn't talk to local forks it's mainnet or public testnets only