Support web3 providers that do not support sync calls
This is currently the non default web3 provider used for rinkeby etc.
This commit is contained in:
@@ -4,10 +4,12 @@ const promptly = require('promptly');
|
||||
const ethers = require('ethers');
|
||||
const Kredits = require('../lib/kredits');
|
||||
|
||||
module.exports = function(callback) {
|
||||
const networkId = parseInt(web3.version.network);
|
||||
const getNetworkId = require('./helpers/networkid.js')
|
||||
|
||||
module.exports = async function(callback) {
|
||||
const networkId = await getNetworkId(web3)
|
||||
const provider = new ethers.providers.Web3Provider(
|
||||
web3.currentProvider, { chainId: networkId }
|
||||
web3.currentProvider, { chainId: parseInt(networkId) }
|
||||
);
|
||||
|
||||
new Kredits(provider, provider.getSigner()).init().then(async function(kredits) {
|
||||
|
||||
Reference in New Issue
Block a user