Merge pull request #1265 from chaotixkilla/fix-infura-to-geth-provider-reset

Reset web3 provider when changing between ETH wallets
This commit is contained in:
Rafael Taranto 2022-06-22 15:23:58 +01:00 committed by GitHub
commit f2f4683ae5
4 changed files with 12 additions and 10 deletions

View file

@ -11,7 +11,6 @@ const pify = require('pify')
const BN = require('../../../bn')
const ABI = require('../../tokens')
const NAME = 'geth'
exports.SUPPORTED_MODULES = ['wallet']
const paymentPrefixPath = "m/44'/60'/0'/0'"
@ -19,7 +18,6 @@ const defaultPrefixPath = "m/44'/60'/1'/0'"
let lastUsedNonces = {}
module.exports = {
NAME,
balance,
sendCoins,
newAddress,
@ -35,9 +33,7 @@ module.exports = {
}
function connect (url) {
if (!web3.isConnected()) {
web3.setProvider(new web3.providers.HttpProvider(url))
}
return web3.setProvider(new web3.providers.HttpProvider(url))
}
const hex = bigNum => '0x' + bigNum.integerValue(BN.ROUND_DOWN).toString(16)