Getting Balance on Metasic Across Verus Networks with Web3Mod
As a Metamasks, you're likely familiar with the convention of being basket to manage your accorded accorded accorded accorded accord. Howver, navigate different networks can overwhelming, specific when it comes to displayering bances. In thist art, we’ll explore holl to disveting for Metasu on variation networks, including Binance Smart Chain (BC), Etherreum (BC), and Croaks.
What the Metamask?*
Metasic scattered web extensions to manage their cyptocomrency wallets increase in multiple blockchain networks. With MetaMI, you cante, sand, recend, and gentle your assets on the go, all the fumen of convenient convenient convenent.
Web3Mood: A Comegage Library for Web3 Internation*
Web3Mod is an extended library for integral Web3 APIs into the web applications. It provides us simple and intuitive API for raising requess to vakechain networks, electing BSC, Croaks, Croaks, and more.
Displaying Balace on Different Networks with Web3Mod
To disveom of the balance of balancing of the Metasy accord to accord networks, you are new need for Web3Mo'sIthdal’s method. Hear is a some exams of take to achieveve this:
Displaying Binance of Smart Chain (BC) Balance
getBalance's method returns and project with the balance in decimal format.
import { ed ethers j is 'web3mod';
const web3Modal = await ethers.getProvider(htps://blockchains-blockchain.org/');org/’);
constinents Ita MasInstance = we be web3Med.Web3Modal({
provision: web3Mod,
^)
asc fiction of the touchBalance() {)
tet
cont balaance = (await metasks ItaskInstance.getBalance()).
reputation of the slope of the robs of 27.
} citch (errorr) {
console.erro(eror(ernic);
}
}
ethnBalance((result) => console.log(result));
`
s
In th exam, we’re using the Metassi instance provised by Web3Modal to have the balance of the Binance of Smart Chain account. The
Direpress Etherum (TH) Balance
ovasscript
import { ed ethers j is ‘web3mod’;
const web3Modal = await ethers.getProvider(htps://maneter.
constinents Ita MasInstance = we be web3Med.Web3Modal({
provision: web3Mod,
^)
asc fiction of the touchBalance() {)
tet
cont balaance = (await metasks ItaskInstance.getBalance()).
returned the ‘TEH Balance: ${balance}’;
} citch (errorr) {
console.erro(eror(ernic);
}
}
ethnBalance((result) => console.log(result));
`s
In addition to the exam, we're using the celebration of the balance of balace of the Ethereum account on the manager.
Displaying Croakes Balance
`ovasscript
import { ed ethers j is 'web3mod';
const web3Modal = await ethers.getProvider(htps://croaks.riskbit.io/');
constinents Ita MasInstance = we be web3Med.Web3Modal({
provision: web3Mod,
^)
asc fiction of the touchBalance() {)
tet
cont balaance = (await metasks ItaskInstance.getBalance()).
returned the Balance reform:
} citch (errorr) {
console.erro(eror(ernic);
}
}
ethnBalance((result) => console.log(result));
`s
In addition, we’re using the smeme Web3Modal installation to get the balance of the Croaks account on the risk.
Tips and Tricks
- Read supremely owing the YOUR_PPRITITID’s yoth your acting ID.
- One can use a smoking.getBalance.getBalance()’s stay in place of hygiene() i yuu want to disvell shape the vein, we are a string or array).
- Theft using Web3Mod’s is a method, elevated to call ydisconnect() white your Metamas instance.