const {ChainId, Fetcher, WETH, Route, Trade, TokenAmount, TradeType, Percent} = require ('@uniswap/sdk');
const ethers = require('ethers');

const chainId = ChainId.MAINNET;

how would I specify it to be the locally forked ganache chain?

tried this:

const Web3 = require('web3');
const web3 = new Web3(`http://localhost:8545`);

const tokenAddress = '0x6B175474E89094C44Da98b954EedeAC495271d0F';

const init = async ()=> {
  const chainId = await web3.eth.getChainId();

following error is shown:

        var error = new Error(message);

Error: unsupported getDefaultProvider network (operation="getDefaultProvider", network={"chainId":1337,"name":"unknown"}, code=NETWORK_ERROR, version=providers/5.0.17)

Help is much appreciated

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.