web3Helper

Source web3 helper

The web3 helper is a wrapper library to get a new Web3 Constructor with overwritten functions. By default, web3 cannot handle websocket disconnects and the UI will break after 5 minutes, when its not used. To handle this, the web3 helper overwrites the “WebsocketProvider.prototype.send” function.


getWeb3Constructor

web3Helper.getWeb3Constructor();

Returns the Web3 Constructor from blockchain-core and overwrites the send function

Returns

Promise returns void: resolved when done

Example

The web 3 constructor.

getWeb3Instance

web3Helper.getWeb3Instance(url);

Returns a new web3 instances. If a web3 currentProvider is provided, it will be used.

Parameters

  1. url - string: url for the web socket connection

Returns

any: web3 instance

Example

import { config } from '../config';
web3 = getWeb3Instance(config.web3Provider);