Closed niZmosis closed 2 years ago
Some one must know how to get this to work
Sorry been super busy.. il look into this tomorrow for you and come back with an answer 👍
Hello, any update on this, can we do same for local network on ganache.
I was over thinking it. The library is expecting the _ETH suffix no matter what chain you are on. You can use the appendEthToContractAddress(wrappedNativeCoinAddress) function to wrap the address or just append _ETH yourself.
Using ETH.MAINNET().contractAddress works fine for eth, and I am trying to reproduce that for Polygon and BSC. I see it prints out WETHs address with a suffix _ETH. I tried to make my input token the same way for Polygon 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270_MATIC and it didn't work. My config is below, I have the nativeCurrency setup for the customNetwork. I have swaped tokens and everything so I know it works, I just don't know how to make the Native Coin of each chain as an input.
A few off topic questions. What does the baseTokens parameter do? How do I access them? Does the baseTokens have anything to do with the NativeCurrency?
Is there anyway I can swap using my wallet, but have the swap send the output to a different wallet?
Thanks
`const config = { name: 'Polygon Mainnet', nativeCurrency: { name: 'Polygon', symbol: 'MATIC', decimals: 18, logoUrl: [tokenImageUrlForContract({ tokenContractChainId: maticMainChainId })] }, nativeWrappedTokenInfo: { chainId: maticMainChainId, contractAddress: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', decimals: 18, symbol: 'WMATIC', name: 'Wrapped MATIC' }, multicallContractAddress: '0x275617327c958bD06b5D6b871E7f491D76113dd8', defaultPairs: { inputAddress: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', outputAddress: '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063' }, uniswapVersions: [UniswapVersion.v3], cloneUniswapContractDetails: { v3Override: { routerAddress: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', factoryAddress: '0x1f98431c8ad98523631ae4a59f267346ea31f984', quoterAddress: '0xb27308f9f90d607463bb33ea1bebb41c27ce5ab6' } } }
async function quote({ chainId, library, account, fromTokenContractAddress, toTokenContractAddress, slippage, deadlineMinutes, tradeAmount, tradeDirection }) { try { const { name, nativeCurrency, nativeWrappedTokenInfo, multicallContractAddress, uniswapVersions, cloneUniswapContractDetails } = config
} `