joshstevens19 / simple-uniswap-sdk

Uniswap SDK which handles the routes automatically for you, changes in trade quotes reactive subscriptions, exposure to formatted easy to understand information, bringing back the best trade quotes automatically, generating transactions for you and much more.
MIT License
188 stars 95 forks source link

custom provider not set with pairfactory #22

Open csidi90 opened 2 years ago

csidi90 commented 2 years ago

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);
marcelo-mason commented 2 years ago

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
joshstevens19 commented 2 years ago

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

joshstevens19 commented 2 years ago

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 commented 2 years ago

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