simple-uniswap-sdk icon indicating copy to clipboard operation
simple-uniswap-sdk copied to clipboard

custom provider not set with pairfactory

Open csidi90 opened this issue 3 years ago • 4 comments

Following the docs I am trying to pass my own chainstack web3 provider to the UniswapPair

const provider = new Web3.providers.HttpProvider(providerUrl);

const uniswapPair = new UniswapPair({, ethereumProvider : provider, ........

When I log I still get some infura provider shown in the object and not my custom provider.

const uniswapPairFactory = await uniswapPair.createFactory();
console.log('pairProvider', uniswapPairFactory._uniswapPairFactoryContext.ethersProvider);

csidi90 avatar Oct 07 '21 08:10 csidi90

Same issue here

const provider = new ethers.providers.WebSocketProvider(quicknodeUrl) 

const uniswapPair = new UniswapPair({
  ethereumProvider: provider
})

const uniswapPairFactory = await uniswapPair.createFactory()
console.log('pairProvider', uniswapPairFactory.providerUrl) // returns infura

marcelo-mason avatar Oct 14 '21 02:10 marcelo-mason

Ahh ok will check this out sorry for any issues will fix soon

joshstevens19 avatar Oct 14 '21 19:10 joshstevens19

Hey guys the ethereum provider only accepts a EIP-1193 provider as per https://eips.ethereum.org/EIPS/eip-1193 exactly what metamask provider is this does not accept a web3 instance or ethers instance. This is something we may add later but for now we do not support a custom ethers provider or web3 instance just a custom EIP-1193 provider. Thanks

joshstevens19 avatar Oct 18 '21 07:10 joshstevens19

This is not correct it should work with an ethers instance or web3 instance.. will reopen and look at both errors

joshstevens19 avatar Oct 26 '21 03:10 joshstevens19