Listed below you can find a simple code snippet demonstrating how to use a Bware Labs generated endpoint in your javascript code
init: function() {
ws_provider = new Web3(new Web3.providers.WebsocketProvider ('wss://'
+ 'eth-api.bwarelabs.com/ws/69231efa-e959-4fb0-ad08-9141cda9ea4d'));
ws_provider.eth.net.getNetworkType().then((networkID) => {
switch (networkID) {
case "main":
this.chainID = ChainId.MAINNET;
this.network = 'homestead';
break;
case "rinkeby":
this.chainID = ChainId.RINKEBY;
this.network = 'rinkeby';
break;
default:
this.chainID = ChainId.MAINNET;
this.network = 'homestead';
}
logger.info(`Listening on the ${networkID} network...`);
});
oracle_provider = new ethers.providers.WebSocketProvider('wss://'
+ 'eth-api.bwarelabs.com/ws/69231efa-e959-4fb0-ad08-9141cda9ea4d', this.network);
},