Class

Web3Connection

Web3Connection(options)

Constructor

# new Web3Connection(options)

Web3Connection Object

Parameters:
Name Type Description
options Web3Connection~Options

View Source Web3Connection.js, line 33

Methods

# async getAddress() → {Promise.<string>}

Get Address connected via login()

View Source Web3Connection.js, line 156

Address in Use

Promise.<string>

# async getCurrentAccount() → {Promise.<string>}

Get current/selected account in use if available, or selected signer wallet/address otherwise.

View Source Web3Connection.js, line 145

Account/Wallet in use

Promise.<string>

# async getETHBalance() → {Promise.<string>}

Get ETH Balance of Address connected via login()

View Source Web3Connection.js, line 197

ETH Balance

Promise.<string>

# async getETHNetwork() → {Promise.<string>}

Get ETH Network

View Source Web3Connection.js, line 130

Network Name (Ex : Kovan)

Promise.<string>

# async getSigners() → {Promise.<Array.<string>>}

Get signers connected via login()

View Source Web3Connection.js, line 174

Addresses array available

Promise.<Array.<string>>

# getWeb3() → {Web3}

Get Web3 to access functions as https://ethereum.stackexchange.com/questions/66454/how-to-get-events-emitted-by-a-transaction-with-web3-js

View Source Web3Connection.js, line 207

Web3

Web3

# async login() → {Promise.<boolean>}

Login with Metamask/Web3 Wallet - substitutes start()

View Source Web3Connection.js, line 104

Promise.<boolean>

# start()

Connect to Web3 injected in the constructor

View Source Web3Connection.js, line 69

Please Use an Ethereum Enabled Browser like Metamask or Coinbase Wallet

Error

# switchWallet(newAccount) → {Promise.<void>}

Switch current user account/signer to a new one

Parameters:
Name Type Description
newAccount Address | Account

New user wallet/signer address in use or new account

View Source Web3Connection.js, line 187

Promise.<void>

Type Definitions

Object

# Optional

Properties:
Name Type Description
web3Connection string

Web3 Connection String (Ex : https://data-seed-prebsc-1-s1.binance.org:8545)

privateKey string

Private key (0x....) used for server side use

View Source Web3Connection.js, line 20

Object

# Options

Properties:
Name Type Attributes Default Description
test boolean <optional>
false

Automated Tests

localtest boolean <optional>
false

Ganache Local Blockchain

opt Web3Connection~Optional <optional>

Optional Chain Connection Object (Default ETH)

View Source Web3Connection.js, line 26