diff --git a/examples/vue-example/main.vue b/examples/vue-example/main.vue index 4d72646..95d2793 100644 --- a/examples/vue-example/main.vue +++ b/examples/vue-example/main.vue @@ -5,7 +5,7 @@

Your wallet is not connected to an Ethereum network
- error:{{ $eth.error }} + error:{{ $eth.error }}

You are not connected to an Ethereum network diff --git a/src/watcher.js b/src/watcher.js index 9575467..0ecb551 100644 --- a/src/watcher.js +++ b/src/watcher.js @@ -59,25 +59,26 @@ const Web3Watcher = () => { ...$.state, isConnected: await $.instance.eth.net.isListening() } + updateState({ init: $.state.init + 1 }) } catch (error) { $.state = { ...$.state, error: error.message, isConnected: false } + updateState({}) } - updateState({ init: $.state.init + 1 }) - $.walletType = await $.getWalletType() - updateState({}) - return Promise.resolve($.state) } else { try { - // commit('setInjected', true) if (window.web3.currentProvider) { $.injected = window.web3 $.instance = new Web3(window.web3.currentProvider) } + updateState({ init: $.state.init + 1 }) } catch (error) { - console.log(error) + $.state = { ...$.state, error: error.message, isConnected: false } + updateState({}) } } typeof eventHandler.connected === 'function' && $.state.isConnected && eventHandler.connected($) + $.walletType = await $.getWalletType() + updateState({}) return Promise.resolve($.state) }