UNPKG

@ryniaubenpm2/voluptatem-temporibus-explicabo

Version:

![Build Status](https://codebuild.us-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiMmtFajZWQmNUbEhidnBKN1VncjRrNVI3d0JUcFpGWUd3STh4T3N3Rnljc1BMaEIrYm9HU2t4YTV1RlE1YmlnUG9XM3luY0Ftc2tBc0xTeVFJMkVOa24wPSIsIml2UGFyYW1ldGVyU3BlYyI6IlBDMDl6UEROK1dlU

52 lines (46 loc) 1.18 kB
import Web3 from "web3"; let minABI = [ // balanceOf { constant: true, inputs: [{ name: "_owner", type: "address" }], name: "balanceOf", outputs: [{ name: "balance", type: "uint256" }], type: "function" }, // decimals { constant: true, inputs: [], name: "decimals", outputs: [{ name: "", type: "uint8" }], type: "function" } ]; const addr = "0xxxx"; const contractSeedTree = "0xxxx"; export default function IndexPage() { const web3 = new Web3( new Web3.providers.HttpProvider("https://bsc-dataseed.binance.org/") //Web3.givenProvider ); const click = async () => { console.log("teste"); var filter = { from: addr }; //web3.eth.getBalance(addr).then(console.log); let contract = new web3.eth.Contract(minABI, contractSeedTree); //var balance1 = contract.balanceOf(addr).toNumber(); var pastTransferEvents = contract.getPastEvents("allEvents", filter, { fromBlock: 0 }); }; return ( <div> Address: {addr} <br /> <button onClick={click}>List</button> <br /> {web3 ? "loading" : web3.eth.getBalance(addr).then(console.log)} </div> ); }