Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base Network support #58

Open
alicercedigital opened this issue Apr 5, 2024 · 2 comments
Open

Base Network support #58

alicercedigital opened this issue Apr 5, 2024 · 2 comments

Comments

@alicercedigital
Copy link

alicercedigital commented Apr 5, 2024

How can we use the base network with this package?

I have defined customNetwork and cloneUniswapContractDetails, but when I try to use them, I get the message:

Can not find chain name for 8453. This lib only supports mainnet(1), ropsten(4), kovan(42), rinkeby(4) and görli(5)

This is my config:

 const uniswapPair = new UniswapPair({
  fromTokenContractAddress: "0x4200000000000000000000000000000000000006",
  toTokenContractAddress: "0x347F500323D51E9350285Daf299ddB529009e6AE",
  ethereumAddress: selectedAddress,
  ethereumProvider: metaMaskProvider,
  chainId: 8453,
  settings: new UniswapPairSettings({
   cloneUniswapContractDetails: {
    v2Override: {
     factoryAddress: "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6",
     routerAddress: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
     pairAddress: "0x0Aa352230c5C05Fa912DAC0B538551f79121e29B",
    },
    v3Override: {
     factoryAddress: "0x33128a8fC17869897dcE68Ed026d694621f6FDfD",
     routerAddress: "0x2626664c2603336E57B271c5C0b26F421741e481",
     quoterAddress: "0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a",
    },
   },
   customNetwork: {
    nameNetwork: "Base Mainnet",
    multicallContractAddress: "0x275617327c958bD06b5D6b871E7f491D76113dd8",
    nativeCurrency: {
     name: "Ether",
     symbol: "ETH",
    },
    nativeWrappedTokenInfo: {
     chainId: 8453,
     contractAddress: "0x4200000000000000000000000000000000000006",
     decimals: 18,
     symbol: "WETH",
     name: "Wrapped ETH",
    },
   },
   slippage: 0.0005,
   deadlineMinutes: 10,
   uniswapVersions: [UniswapVersion.v2, UniswapVersion.v3],
  }),
 });

Has anyone used this package with Base network? If so, could you kindly provide the configuration you used?
That would greatly help us; we have been struggling with the Uniswap SDK for almost a month now. We just want to use code to trade, and this package is our last hope. =/

@alicercedigital
Copy link
Author

alicercedigital commented Apr 6, 2024

I have created a fork of this package and made changes to the following files:
(https://github.com/alicercedigital/simple-uniswap-sdk)

uniswap-pair.ts
Added the chainId to the createFactory() check

chain-id.ts
Added the base chainId to the ChainNames and ChainId enum

tokens.factory.public.ts
Added providerContext.customNetwork to the TokensFactoryPublic constructor

eth.ts and wth.ts
Added the WETH address of the base network

ethers-provider.ts
Added the RPC base mainet of Infura

Now we are receiving the error:
unsupported network (argument="network", value={"chainId":8453,"name":"unknown"}, code=INVALID_ARGUMENT, version=providers/5.7.2)

This error is being thrown when we initialize new UniswapPair()
Does anyone know which contract is throwing this error?

@woodychanjm
Copy link

same problem here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants