Replies: 4 comments 1 reply
-
Yes this can be done in a number of ways
I would go with the provider approach as you don't have to pay for an additional service. In this case, I'd probably connect to the mainnet account with metamask or walletconnect or some other connector and simply use a StaticJsonRPCProvider for fetching the BSC balance with contract.balanceOf. However, note that the BSC account won't have a signer attached so you can't really sign and execute transactions, you can however read from the chain. |
Beta Was this translation helpful? Give feedback.
-
No, i just want to read actually. I want to build a zapper.fi like app, where you can track your balance on multiple chains |
Beta Was this translation helpful? Give feedback.
-
I see that I can accomplish this with ethers.js. But using a third party rpc like infura. is it possible to use the web3-react core instead of the bare ethers.js library? |
Beta Was this translation helpful? Give feedback.
-
i use something like this to get the priority connector which the user choose: metamask, wallet connect, etc.:
then when I need to access some info : ` const { usePriorityAccount, usePriorityWeb3React, usePriorityProvider } = useActiveConnector();
I assume if I want to use the web3-react hooks I just need to instantiate a number of web3-providers for each chain I m gonna use then, when using usePriorityWeb3React, just pass another provider. The issue is that, that hook accepts only a web3 provider, not a jsonrpc one `const chainData = getChainParameters(chainId ?? 1);
` here I m able to read chain data from bsc and eth, but if I want to instantiate a web3provider using ethers, I cant on a chain different than the one I m connected using metamask. If someone can give me a direction with this issue, I would appreciate very much :) |
Beta Was this translation helpful? Give feedback.
-
Hello. I have a question, is it possible to fetch the native ETH balance of any other chain than the one you are connected? Like, I want to fetch my BSC balance while connected to ETH mainnet. Is it possible?
Beta Was this translation helpful? Give feedback.
All reactions