From ba31dfa32d4346c1df9d99d40f9ebcf1eea7991a Mon Sep 17 00:00:00 2001 From: Ayanami Date: Sun, 6 Feb 2022 07:47:57 +0900 Subject: [PATCH] Make remote IP detection optional Some may could not access to tornado.cash without VPN --- cli.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cli.js b/cli.js index 6249c8d..a0db85c 100755 --- a/cli.js +++ b/cli.js @@ -945,9 +945,13 @@ async function init({ rpc, noteNetId, currency = 'dai', amount = '100', torPort, console.log("Connecting to remote node") web3 = new Web3(rpc, null, { transactionConfirmationBlocks: 1 }) } - const fetchRemoteIP = await axios.get('https://ip.tornado.cash', ipOptions) - const { country, ip } = fetchRemoteIP.data - console.log('Your remote IP address is',ip,'from',country+'.'); + try { + const fetchRemoteIP = await axios.get('https://ip.tornado.cash', ipOptions) + const { country, ip } = fetchRemoteIP.data + console.log('Your remote IP address is',ip,'from',country+'.'); + } catch (error) { + console.error('Could not fetch remote IP from ip.tornado.cash, use VPN if the problem repeats.'); + } contractJson = require('./build/contracts/TornadoProxy.abi.json') instanceJson = require('./build/contracts/Instance.abi.json') circuit = require('./build/circuits/tornado.json')