Skip to content

Instantly share code, notes, and snippets.

@petejkim
Created July 14, 2020 21:00
Show Gist options
  • Save petejkim/dd4f42bc0c3ee8bb07f88bdf5477ef81 to your computer and use it in GitHub Desktop.
Save petejkim/dd4f42bc0c3ee8bb07f88bdf5477ef81 to your computer and use it in GitHub Desktop.
Introduction to Building on DeFi with Ethereum and USDC  - Part 1 - getBalance.js
const ethers = require("ethers");
const wallet = require("./wallet");
const provider = require("./provider");
async function main() {
const account = wallet.connect(provider);
const balance = await account.getBalance();
console.log(`ETH Balance: ${ethers.utils.formatUnits(balance, 18)}`);
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment