diff --git a/flowallet/scripts/floBlockchainAPI.js b/flowallet/scripts/floBlockchainAPI.js index 9dedb90..3e0c43c 100644 --- a/flowallet/scripts/floBlockchainAPI.js +++ b/flowallet/scripts/floBlockchainAPI.js @@ -1,4 +1,4 @@ -(function (EXPORTS) { //floBlockchainAPI v3.0.1b +(function (EXPORTS) { //floBlockchainAPI v3.1.0 /* FLO Blockchain Operator to send/receive data from blockchain using API calls via FLO Blockbook*/ 'use strict'; const floBlockchainAPI = EXPORTS; @@ -17,6 +17,21 @@ const SATOSHI_IN_BTC = 1e8; const isUndefined = val => typeof val === 'undefined'; + const checkIfTor = btcOperator.checkIfTor = () => { + return fetch('https://check.torproject.org/api/ip', { + mode: 'no-cors' + }) + .then(response => response.json()) + .then(result => result.IsTor) + .catch(error => false) + } + let isTor = false; + checkIfTor().then(result => { + isTor = result + if (isTor) { + DEFAULT.apiURL.FLO.push('http://vl7ni6byqx7rbub5hypxtod5dbfeuhoj5r5exuyl44pspqh2gasjj4qd.onion:9166/') + } + }); const util = floBlockchainAPI.util = {};