Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.signMessage(...args);
}
})
);
!shareNonce
? this.engine.addProvider(new NonceSubProvider())
: this.engine.addProvider(singletonNonceSubProvider);
this.engine.addProvider(new FiltersSubprovider());
if (typeof provider === "string") {
// shim Web3 to give it expected sendAsync method. Needed if web3-engine-provider upgraded!
// Web3.providers.HttpProvider.prototype.sendAsync =
// Web3.providers.HttpProvider.prototype.send;
this.engine.addProvider(
new ProviderSubprovider(
// @ts-ignore
new Web3.providers.HttpProvider(provider, { keepAlive: false })
)
);
} else {
this.engine.addProvider(new ProviderSubprovider(provider));
}
this.engine.start(); // Required by the provider engine.
}
? this.engine.addProvider(new NonceSubProvider())
: this.engine.addProvider(singletonNonceSubProvider);
this.engine.addProvider(new FiltersSubprovider());
if (typeof provider === "string") {
// shim Web3 to give it expected sendAsync method. Needed if web3-engine-provider upgraded!
// Web3.providers.HttpProvider.prototype.sendAsync =
// Web3.providers.HttpProvider.prototype.send;
this.engine.addProvider(
new ProviderSubprovider(
// @ts-ignore
new Web3.providers.HttpProvider(provider, { keepAlive: false })
)
);
} else {
this.engine.addProvider(new ProviderSubprovider(provider));
}
this.engine.start(); // Required by the provider engine.
}
static getWeb3Instance() {
const wallet = this.getWallet();
const engine = new ProviderEngine();
engine.addProvider(new WalletSubprovider(wallet, {}));
engine.addProvider(new ProviderSubprovider(this.getWeb3HTTPProvider()));
engine.start();
const web3 = new Web3(engine);
web3.eth.defaultAccount = wallet.getAddressString();
return web3;
}