0.0.2-alpha.55 • Published 3 years ago
@crypto-connect/ethereum v0.0.2-alpha.55
Ethereum
Install
Package | NPM | Yarn |
---|---|---|
Ethereum | npm i @crypto-connect/ethereum | yarn add @crypto-connect/ethereum |
Web3 | npm i Web3 | yarn add Web3 |
Usage
import Web3 from "web3";
import ethereumConnect from "@crypto-connect/ethereum";
// Set up Web3
const httpProvider = new Web3.providers.HttpProvider("<ETH_NODE_URL>");
const web3 = new Web3(httpProvider);
// List of tokens to find balances for
const erc20Tokens = [
{
name: "BAT",
contractAddress: "0x0d8775f648430679a709e98d2b0cb6250d2887ef",
},
];
// Authorise
const ethereum = ethereumConnect({ web3, erc20Tokens }).withWallet(
"<WALLET_ADDRESS>",
);
// Get balances
const balances = await ethereum.getBalances();
0.0.2-alpha.55
3 years ago