etherBalanceOf
Returns the ETH (native base layer currency) balance of a user managed by a wallet module.
Usage
The following example creates an inspect request handler that assumes the payload
is an user address and just prints the balance of that user to the console.
import { createApp } from "@deroll/app";
import { createWallet } from "@deroll/wallet";
// create app
const app = createApp({ url: "http://127.0.0.1:5004" });
// create wallet
const wallet = createWallet();
app.addAdvanceHandler(wallet.handler);
app.addInspectHandler(async ({ payload }) => {
const address = payload;
const balance = wallet.etherBalanceOf(address);
console.log(balance);
});
Returns
Type: bigint
The ETH balance of the given address.
Parameters
Type: string
The address of the user to get the balance from.