Closed heras1991 closed 2 years ago
Hey @heras1991! Thanks a lot for the kind word!
So indeed this package only manages what is called the web3 provider
layer, the exposed ethereum
object is the one MetaMask injects directly in the window
and does not come (intentionally) with a lot of features
In order to manage interactions with the chain, balance/block fetching or contract interactions, people generally use other libraries, the two major ones are ethersjs or web3js.
These libraries take as an entry param a web3 provider
, so in the case of this package, the ethereum
object :).
I would recommend you to take a look at this part of the ethersjs documentation which specifically describes the ERC20 case :). The ERC721 will be mostly similar at the exception of the ABI.
Feel free to tell me if I am not clear or you still have other questions :)
Thank you very much for the explication. I found the way to do it with web3.js 👍
I strongly suggest you implement the integration with web3.js to store the balance of an ERC20 token in the same context. This is a very popular use-case for blockchain devlopers and your library is almost there.
Thanks a lot for the idea! I will consider doing a separate package for these kind of use cases :)
I would love to keep this package far away from the battle of various use cases and/or choice of libraries such as web3.js/ethers.js
Are you okay if I close this issue? :)
sure! Please, close it. Thank you
El dom, 28 nov 2021 a las 14:00, Loïc Vincent-Genod (< @.***>) escribió:
Thanks a lot for the idea! I will consider doing a separate package for these kind of use cases :)
I would love to keep this package far away from the battle of various use cases and/or choice of libraries such as web3.js/ethers.js
Are you okay if I close this issue? :)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/VGLoic/metamask-react/issues/8#issuecomment-981081655, or unsubscribe https://github.com/notifications/unsubscribe-auth/AORR2WU6MXEBK2X73GTHYELUOIRYFANCNFSM5H5KNXTQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Thanks!
Hi VGLoic, thank you very much for this amazing library.
I have inspected the code without success to identify the balance of ERC20 and ERC721 tokens belonging to a connected account.
The only method I found is: eth_getBalance but only returns main balance of the chain.
Could you please lead me in the way to get another ERC721/ERC20 token balance? (not need to interact with it, just to know the balance)
Thank you again!