From 28b810019d66a9442b3416688adc52a33307da13 Mon Sep 17 00:00:00 2001 From: arnaucube Date: Thu, 21 May 2020 19:47:24 +0200 Subject: [PATCH] =?UTF-8?q?Add=20check=20to=20be=20on=20G=C3=B6erli=20netw?= =?UTF-8?q?ork?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/index.js b/index.js index 6a409fe..040fd0b 100644 --- a/index.js +++ b/index.js @@ -49,6 +49,11 @@ async function deposit(circuitname) { toastr.error("Please install/connect Metamask"); return; } + if (window.ethereum.networkVersion!='5') { + toastr.warning("Please switch to Göerli"); + alert("Please switch to Göerli"); + return; + } document.getElementById("depositRes").innerHTML = ` Generating zkProof & making the deposit `; @@ -91,6 +96,7 @@ async function deposit(circuitname) { const time = end - start; println("circuit " + circuitname + " took " + time + "ms to compute"); console.log(proof); + console.log("proof", JSON.stringify(proof)); // send tx @@ -151,6 +157,11 @@ async function withdraw(circuitname) { toastr.error("Please install/connect Metamask"); return; } + if (window.ethereum.networkVersion!='5') { + toastr.warning("Please switch to Göerli"); + alert("Please switch to Göerli"); + return; + } document.getElementById("withdrawRes").innerHTML = ` Generating zkProof & making the withdraw `; @@ -269,6 +280,11 @@ async function connectMetamask() { if (!ethEnabled()) { toastr.warning("Please install Metamask to use miksi"); alert("Please install MetaMask to use miksi"); + return; + } else if (window.ethereum.networkVersion!='5') { + toastr.warning("Please switch to Göerli"); + alert("Please switch to Göerli"); + return; } else { metamask = true; }