From 15aa3e62643b0b54aba0d8a55f267598b9906ba4 Mon Sep 17 00:00:00 2001 From: Muhammad Usman Date: Tue, 9 Oct 2018 22:23:22 +0530 Subject: [PATCH] migrate gitcoin from web3js 0.2 to 1.0 --- app/assets/v2/js/shared.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/assets/v2/js/shared.js b/app/assets/v2/js/shared.js index ad6bb829547..2920c716dc7 100644 --- a/app/assets/v2/js/shared.js +++ b/app/assets/v2/js/shared.js @@ -824,7 +824,7 @@ var listen_for_web3_changes = function() { document.listen_for_web3_iterations += 1; } - if (typeof web3 == 'undefined') { + /* if (typeof web3 == 'undefined') { currentNetwork(); trigger_form_hooks(); } else if (typeof web3 == 'undefined' || typeof web3.eth == 'undefined' || typeof web3.eth.coinbase == 'undefined' || !web3.eth.coinbase) { @@ -847,7 +847,15 @@ var listen_for_web3_changes = function() { trigger_form_hooks(); } }); - } + } */ + web3.eth.net.getNetworkType().then(function(cb, err) { + if (err) { + currentNetwork(); + } else { + currentNetwork(cb); + trigger_form_hooks(); + } + }); }; var actions_page_warn_if_not_on_same_network = function() {