Make remote IP detection optional

Some may could not access to tornado.cash without VPN
This commit is contained in:
Ayanami 2022-02-06 07:47:57 +09:00
parent 1f26d8cc2f
commit ba31dfa32d
No known key found for this signature in database
GPG Key ID: 0CABDF03077D92E4

10
cli.js
View File

@ -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')