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

using this sdk on polygon #29

Open jdavidteki opened 2 years ago

jdavidteki commented 2 years ago

hello,

is there a special chain id when im on the polygon network? i keep getting SushiswapError: invalid from or to contract tokens

when i do -

////sushiswap const sushiswapPair = new SushiswapPair({ // the contract address of the token you want to convert FROM fromTokenContractAddress: '0x111111111117dC0aa78b770fA6A738034120C302', // the contract address of the token you want to convert TO toTokenContractAddress: '0x1985365e9f78359a9B6AD760e32412f4a445E862', // the ethereum address of the user using this part of the dApp ethereumAddress: '0xB1E6079212888f0bE0cf55874B2EB9d7a5e02cD9', // you can pass in the provider url as well if you want providerUrl: url, chainId: ChainId.MAINNET, });

// now to create the factory you just do const sushiswapPairFactory = await sushiswapPair.createFactory();

const toToken = sushiswapPairFactory.toToken; console.log("toToken", sushiswapPairFactory);