MCPcopy Create free account
hub / github.com/Modulus-Labs/RockyBot / getCurrentBalanceDisplay

Function getCurrentBalanceDisplay

front-end/src/util/interact.ts:118–128  ·  view source on GitHub ↗
(walletAddress: string)

Source from the content-addressed store, hash-verified

116 * @returns
117 */
118export const getCurrentBalanceDisplay = async (walletAddress: string): Promise<string> => {
119
120 // --- Unfortunate check we must do ---
121 if (ethersProvider === null) return "";
122
123 // balance (in Wei): { BigNumber: "182826475815887608" }
124 const balance: ethers.BigNumber = await ethersProvider.getBalance(walletAddress);
125
126 // --- Return the amount in Eth as a string representation ---
127 return ethers.utils.formatEther(balance);
128}
129
130export const connectWallet = async () => {
131 // --- Checks to see if the user's browser has Metamask enabled...

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected