Archived Content from Web3Auth Community
This topic was originally posted by githubdiscussions on 9/14/2022.
This content has been migrated from our previous community forum to preserve valuable discussions.
Hello! I have a really great question! I would like to check if a user has NFT's in their wallet or if the user has some specific cryptocurrencies.
Now the balance only shows the amount of ETH in your account, but it is sure to be able to! We work at HTML, and in Unity we make a version for the iOS and Android cell phone. Can you help us?
This is the code for Get ETH in HTML. We dont have the code to do something in Unity
const getBalance = async (provider) => {
const web3 = new Web3(provider);
// Get user's Ethereum public address
const address = (await web3.eth.getAccounts())[0];
// Get userโs balance in ether
const balance = web3.utils.fromWei(
await web3.eth.getBalance(address) // Balance is in wei
);
return balance;
};
https://d318hu5thvz0lz.cloudfront.net/
Originally posted by: Androser
Check the discussion at: https://github.com/orgs/Web3Auth/discussions/611