Create a Web3Connection

Create a Simple Web3 Connection

A very simple way to connect your app to the web3 Environment

The use for other objects as StakingContract of ERC20Contract are similar to options structure A & B, either if you want to connect to a backend system and provide all variables (Option A) connect directly to an injected wallet (Option B)

const { Web3Connection } = require("bepro-js");

/* Options */

/* a) Create Instance without Injected Web3 (without Metamask) */
let web3 = new Web3Connection({ 
opt : { web3Connection : 'https://kovan.infura.io/v3' } });

await web3.start();

/* b) Create Instance with Injected Web3 (Metamask For Example) */
let web3 = new Web3Connection({});

await web3.login();

/* After A) or B) access methods easily */
let transactionData = await web3.getWeb3().eth.getTransactionReceipt(tx);

Looking for more functions?

See all available functions here

Last updated