0.0.2-alpha.55 • Published 3 years ago

@crypto-connect/ethereum v0.0.2-alpha.55

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Ethereum

Install

PackageNPMYarn
Ethereumnpm i @crypto-connect/ethereumyarn add @crypto-connect/ethereum
Web3npm i Web3yarn 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();