ethers (etherjs)
Use WVM with ether-rs
In this example we will use the ethers npm package. First of all, install the package:
npm i ethers
Code Example: Retrieve Address Balance
import { ethers } from "ethers";
const provider = new ethers.providers.JsonRpcProvider("https://testnet-rpc.wvm.dev");
const address = "0x544836c1d127B0d5ed6586EAb297947dE7e38a78";
async function getBalance() {
const balance = await provider.getBalance(address);
console.log(`Balance: ${ethers.utils.formatEther(balance)} tWVM`);
}
getBalance();
Last updated