diff --git a/FAQ.md b/FAQ.md new file mode 100644 index 000000000..ec8d64b47 --- /dev/null +++ b/FAQ.md @@ -0,0 +1,24 @@ +# FAQ + +## Too much nodejs dependencies! Who audits all of that? + +We do. Really, when we bump deps we glance over the diff, and all versions are +pinned. Also we use paid audit solution https://snyk.io which is specifically +designed to keep an eye on deps. + +And yes we have too many of them, and PRs cutting deps are welcome +(see https://github.com/BlueWallet/BlueWallet/blob/master/CONTRIBUTING.md) + +Also really risky dependencies (like, from not-reputable/anonymous maintainers) +we fork and use under our organization, and when we update them from upstream (rarely) +we do review the code + +## Does BlueWallet downloads the Bitcoin Headers? I see no place you call blockchain.block.headers so I'm wondering how do you guys deal with the headers, how can you make sure you follow the correct chain in order to make sure you're spending a confirmed UTXO? + +The idea is that by default BW doesn’t use public electrum servers, only +ones hosted by bluewallet, so they are kinda trusted. And end-user has an +option to change electrum server to something he provides, so he knows what +is he doing and trusts his own electrum server. + +We would definitely need proper SPV verification if we used random +electrum server every time from a pool of public servers. diff --git a/class/hodl-hodl-api.js b/class/hodl-hodl-api.js index 3a29875fa..6a642a9ce 100644 --- a/class/hodl-hodl-api.js +++ b/class/hodl-hodl-api.js @@ -76,39 +76,6 @@ export class HodlHodlApi { return (this._countries = json.countries); } - async getMyCountryCode() { - const _api = new Frisbee({ baseURI: 'https://ifconfig.co/' }); - const _api2 = new Frisbee({ baseURI: 'https://geolocation-db.com/' }); - let response; - - let allowedTries = 6; - while (allowedTries > 0) { - // this API fails a lot, so lets retry several times - response = await _api.get('/country-iso', { headers: { 'Access-Control-Allow-Origin': '*' } }); - - let body = response.body; - if (typeof body === 'string') body = body.replace('\n', ''); - if (!body || body.length !== 2) { - // trying api2 - const response = await _api2.get('/json/', { headers: { 'Access-Control-Allow-Origin': '*' } }); - body = response.body; - let json; - try { - json = JSON.parse(body); - } catch (_) {} - if (json && json.country_code) return (this._myCountryCode = json.country_code); - // failed, retry - - allowedTries--; - await (async () => new Promise(resolve => setTimeout(resolve, 3000)))(); // sleep - } else { - return (this._myCountryCode = body); - } - } - - throw new Error('API failure after several tries: ' + JSON.stringify(response)); - } - async getPaymentMethods(country) { const response = await this._api.get('/api/v1/payment_methods?filters[country]=' + country, this._getHeaders()); diff --git a/loc/ar.json b/loc/ar.json index 9bca1d524..10167018d 100644 --- a/loc/ar.json +++ b/loc/ar.json @@ -53,7 +53,6 @@ "filter_any": "أي عقد", "filter_buying": "الشراء", "filter_country_global": "العروض الشاملة", - "filter_country_near": "بالقرب مني", "filter_currency": "العملة", "filter_detail": "التفاصيل", "filter_filters": "المرشحات", diff --git a/loc/bg_bg.json b/loc/bg_bg.json index 14d5736aa..584a8ce4f 100644 --- a/loc/bg_bg.json +++ b/loc/bg_bg.json @@ -55,7 +55,6 @@ "filter_any": "Всички", "filter_buying": "Купуване", "filter_country_global": "Всички оферти", - "filter_country_near": "Наблизо", "filter_currency": "Валута", "filter_detail": "Детайли", "filter_filters": "Филтри", diff --git a/loc/ca.json b/loc/ca.json index 392e66483..cffd10589 100644 --- a/loc/ca.json +++ b/loc/ca.json @@ -58,7 +58,6 @@ "cont_title": "Els meus contractes", "filter_buying": "Comprant", "filter_country_global": "Ofertes globals", - "filter_country_near": "A prop meu", "filter_currency": "Moneda", "filter_detail": "Detalls", "filter_filters": "Filtres", diff --git a/loc/cs_cz.json b/loc/cs_cz.json index d794b75fb..58afb4985 100644 --- a/loc/cs_cz.json +++ b/loc/cs_cz.json @@ -61,7 +61,6 @@ "filter_any": "Žádné", "filter_buying": "Nákup", "filter_country_global": "Globální nabídky", - "filter_country_near": "Blízko mne", "filter_currency": "Měna", "filter_detail": "Detail", "filter_filters": "Filtry", diff --git a/loc/de_de.json b/loc/de_de.json index 7a1049e65..163ab6f2a 100644 --- a/loc/de_de.json +++ b/loc/de_de.json @@ -61,7 +61,6 @@ "filter_any": "Jegliche", "filter_buying": "Kaufen", "filter_country_global": "Weltweite Angebote", - "filter_country_near": "In meiner Nähe", "filter_currency": "Währung", "filter_detail": "Details", "filter_filters": "Filter", diff --git a/loc/en.json b/loc/en.json index 48f03679b..6110c0757 100644 --- a/loc/en.json +++ b/loc/en.json @@ -61,7 +61,6 @@ "filter_any": "Any", "filter_buying": "Buying", "filter_country_global": "Global Offers", - "filter_country_near": "Near Me", "filter_currency": "Currency", "filter_detail": "Detail", "filter_filters": "Filters", diff --git a/loc/es.json b/loc/es.json index 357360a39..dd206ebe5 100644 --- a/loc/es.json +++ b/loc/es.json @@ -61,7 +61,6 @@ "filter_any": "Cualquiera", "filter_buying": "Comprando", "filter_country_global": "Ofertas globales", - "filter_country_near": "Cerca de mí", "filter_currency": "Divisa", "filter_detail": "Detalle", "filter_filters": "Filtros", diff --git a/loc/es_419.json b/loc/es_419.json index 27a1edf92..8093ceff8 100644 --- a/loc/es_419.json +++ b/loc/es_419.json @@ -55,7 +55,6 @@ "filter_any": "Algo", "filter_buying": "Comprando", "filter_country_global": "Ofertas Globales", - "filter_country_near": "Cerca de mí", "filter_currency": "Moneda", "filter_detail": "Detalle", "filter_filters": "Filtros", diff --git a/loc/fa.json b/loc/fa.json index 07d76878c..ad4f80ad2 100644 --- a/loc/fa.json +++ b/loc/fa.json @@ -61,7 +61,6 @@ "filter_any": "همه", "filter_buying": "خرید", "filter_country_global": "پیشنهادهای جهانی", - "filter_country_near": "نزدیک من", "filter_currency": "واحد پول", "filter_detail": "جزئیات", "filter_filters": "فیلترها", diff --git a/loc/fi_fi.json b/loc/fi_fi.json index 92d8701f0..308274c86 100644 --- a/loc/fi_fi.json +++ b/loc/fi_fi.json @@ -61,7 +61,6 @@ "filter_any": "Mikä tahansa", "filter_buying": "Ostaminen", "filter_country_global": "Maailmanlaajuiset tarjoukset", - "filter_country_near": "Lähellä minua", "filter_currency": "Valuutta", "filter_detail": "Tiedot", "filter_filters": "Suodattimet", diff --git a/loc/fr_fr.json b/loc/fr_fr.json index 6e8ebd66b..35871ecf9 100644 --- a/loc/fr_fr.json +++ b/loc/fr_fr.json @@ -61,7 +61,6 @@ "filter_any": "Tous", "filter_buying": "Acheteur", "filter_country_global": "Offres internationales", - "filter_country_near": "Près de moi", "filter_currency": "Devise", "filter_detail": "Détails", "filter_filters": "Filtres", diff --git a/loc/he.json b/loc/he.json index c75dfdeaa..52fe00fd7 100644 --- a/loc/he.json +++ b/loc/he.json @@ -70,7 +70,6 @@ "filter_any": "הכל", "filter_buying": "קנייה", "filter_country_global": "הצעות גלובליות", - "filter_country_near": "לידי", "filter_currency": "מטבע", "filter_detail": "פרטים", "filter_filters": "מסננים", diff --git a/loc/hu_hu.json b/loc/hu_hu.json index 71a5d85fe..913b0f3d9 100644 --- a/loc/hu_hu.json +++ b/loc/hu_hu.json @@ -67,7 +67,6 @@ "filter_any": "Bármennyi", "filter_buying": "Vásárlás", "filter_country_global": "Ajánlatok világszerte", - "filter_country_near": "Közelemben", "filter_currency": "Pénznem", "filter_detail": "Részletek", "filter_filters": "Szűrők", diff --git a/loc/id_id.json b/loc/id_id.json index c0d11ee7c..e4a811a09 100644 --- a/loc/id_id.json +++ b/loc/id_id.json @@ -53,7 +53,6 @@ "filter_any": "Apapun", "filter_buying": "Membeli", "filter_country_global": "Penawaran global", - "filter_country_near": "Dekat saya", "filter_currency": "Mata uang", "filter_detail": "Perincian", "filter_filters": "Menyaring", diff --git a/loc/it.json b/loc/it.json index 058183a53..d45f6116c 100644 --- a/loc/it.json +++ b/loc/it.json @@ -34,7 +34,6 @@ "cont_how": "Come pagare", "cont_st_completed": "Fatto!", "cont_title": "I miei contratti", - "filter_country_near": "Vicino a me", "filter_currency": "Valuta", "filter_detail": "Dettaglio", "filter_filters": "Filtri", diff --git a/loc/jp_jp.json b/loc/jp_jp.json index 3ea6166cb..09fa97560 100644 --- a/loc/jp_jp.json +++ b/loc/jp_jp.json @@ -68,7 +68,6 @@ "filter_any": "すべて", "filter_buying": "買う", "filter_country_global": "グローバル・オファー", - "filter_country_near": "近くで探す", "filter_currency": "通貨", "filter_detail": "詳細", "filter_filters": "フィルター", diff --git a/loc/nl_nl.json b/loc/nl_nl.json index 6c98e7f86..7f4c3115a 100644 --- a/loc/nl_nl.json +++ b/loc/nl_nl.json @@ -61,7 +61,6 @@ "filter_any": "ieder", "filter_buying": "Kopen", "filter_country_global": "Wereldwijd aanbod", - "filter_country_near": "Dicht bij mij", "filter_currency": "Valuta", "filter_detail": "Detail", "filter_filters": "Filters", diff --git a/loc/pl.json b/loc/pl.json index 0085a4e44..23b858896 100644 --- a/loc/pl.json +++ b/loc/pl.json @@ -61,7 +61,6 @@ "filter_any": "Każdy", "filter_buying": "Kupno", "filter_country_global": "Oferty globalne", - "filter_country_near": "Blisko mnie", "filter_currency": "Waluta", "filter_detail": "Szczegóły", "filter_filters": "Filtry", diff --git a/loc/pt_br.json b/loc/pt_br.json index 6549a522b..8606295f9 100644 --- a/loc/pt_br.json +++ b/loc/pt_br.json @@ -61,7 +61,6 @@ "filter_any": "Qualquer", "filter_buying": "Compra", "filter_country_global": "Ofertas globais", - "filter_country_near": "Perto de mim", "filter_currency": "Moeda", "filter_detail": "Detalhe", "filter_filters": "Filtrar", diff --git a/loc/pt_pt.json b/loc/pt_pt.json index 6bbfc407f..e63911e34 100644 --- a/loc/pt_pt.json +++ b/loc/pt_pt.json @@ -53,7 +53,6 @@ "filter_any": "Qualquer", "filter_buying": "Compra", "filter_country_global": "Ofertas globais", - "filter_country_near": "Perto de mim", "filter_currency": "Moeda", "filter_detail": "Detalhe", "filter_filters": "Filtrar", diff --git a/loc/ru.json b/loc/ru.json index 9b78ad764..0b7dc899b 100644 --- a/loc/ru.json +++ b/loc/ru.json @@ -61,7 +61,6 @@ "filter_any": "Все", "filter_buying": "Покупаю", "filter_country_global": "Глобальные", - "filter_country_near": "Рядом со мной", "filter_currency": "Валюта", "filter_detail": "Все", "filter_filters": "Фильтры", diff --git a/loc/sk_sk.json b/loc/sk_sk.json index 7fc6f0e25..4c5dcacd3 100644 --- a/loc/sk_sk.json +++ b/loc/sk_sk.json @@ -36,7 +36,6 @@ "cont_paid_q": "Naozaj chcete označiť tento kontrakt ako zaplatený?", "cont_st_completed": "Hotovo!", "cont_title": "Moje kontrakty", - "filter_country_near": "Blízko mňa", "filter_currency": "Mena", "filter_detail": "Detail", "filter_filters": "Filtre", diff --git a/loc/sl_SI.json b/loc/sl_SI.json index a7b187fe4..7ed2fe524 100644 --- a/loc/sl_SI.json +++ b/loc/sl_SI.json @@ -61,7 +61,6 @@ "filter_any": "Vse", "filter_buying": "Kupujem", "filter_country_global": "Globalne ponudbe", - "filter_country_near": "Blizu mene", "filter_currency": "Valuta", "filter_detail": "Podrobno", "filter_filters": "Filtriraj", diff --git a/loc/sv_se.json b/loc/sv_se.json index e727060cb..c518e4bc0 100644 --- a/loc/sv_se.json +++ b/loc/sv_se.json @@ -49,7 +49,6 @@ "cont_st_completed": "Klart!", "cont_st_paid_enought": "Bitcoin hålls som säkerhet! Betala säljaren\nvia överenskommen betalmetod.", "cont_title": "Mina kontrakt", - "filter_country_near": "Nära mig", "filter_currency": "Valuta", "filter_detail": "Detaljer", "filter_filters": "Filtrera", diff --git a/loc/th_th.json b/loc/th_th.json index 2ef5de82c..044c1fbaf 100644 --- a/loc/th_th.json +++ b/loc/th_th.json @@ -51,7 +51,6 @@ "filter_any": "ใดๆ", "filter_buying": "กำลังซื้อ", "filter_country_global": "Global offers", - "filter_country_near": "ใก้ลท่าน", "filter_currency": "สกุลเงิน", "filter_detail": "รายละเอียด", "filter_filters": "ตัวกรอง", diff --git a/loc/zh_tw.json b/loc/zh_tw.json index 70fb3dd15..47d7382f0 100644 --- a/loc/zh_tw.json +++ b/loc/zh_tw.json @@ -39,7 +39,6 @@ "cont_title": "我的合約", "filter_any": "任何", "filter_buying": "購買", - "filter_country_near": "靠近我", "filter_currency": "貨幣", "filter_detail": "細節", "filter_iambuying": "我正在買比特幣", diff --git a/screen/wallets/hodlHodl.js b/screen/wallets/hodlHodl.js index 786795049..634f536a7 100644 --- a/screen/wallets/hodlHodl.js +++ b/screen/wallets/hodlHodl.js @@ -62,7 +62,6 @@ export default class HodlHodl extends Component { currencies: [], // list of hodlhodl supported currencies. filled later via api methods: [], // list of hodlhodl payment methods. filled later via api country: HodlHodlApi.FILTERS_COUNTRY_VALUE_GLOBAL, // country currently selected by user to display orders on screen. this is country code - myCountryCode: HodlHodlApi.FILTERS_COUNTRY_VALUE_GLOBAL, // current user's country. filled later, via geoip api }; } @@ -123,33 +122,6 @@ export default class HodlHodl extends Component { }); } - async fetchMyCountry() { - return new Promise(resolve => { - Geolocation.getCurrentPosition( - async _position => { - const myCountryCode = await this.state.HodlApi.getMyCountryCode(); - if (myCountryCode === 'US') { - alert('This service is currently not available in your country.'); - this.props.navigation.goBack(); - } else { - this.setState( - { - myCountryCode, - country: myCountryCode, // we start with orders from current country - }, - resolve(), - ); - } - }, - _error => - resolve( - this.setState({ myCountryCode: HodlHodlApi.FILTERS_COUNTRY_VALUE_GLOBAL, cuntry: HodlHodlApi.FILTERS_COUNTRY_VALUE_GLOBAL }), - ), - { enableHighAccuracy: false, timeout: 20000, maximumAge: 1000 }, - ); - }); - } - /** * fetches all countries from API and sets them to state * @@ -213,7 +185,6 @@ export default class HodlHodl extends Component { }); try { - await this.fetchMyCountry(); await this.fetchOffers(); } catch (Error) { alert(Error.message); @@ -345,8 +316,6 @@ export default class HodlHodl extends Component { } getNativeCountryName() { - if (this.state.country === this.state.myCountryCode && this.state.country !== HodlHodlApi.FILTERS_COUNTRY_VALUE_GLOBAL) - return loc.hodl.filter_country_near; for (const c of this.state.countries) { if (c.code === this.state.country) return c.native_name; } diff --git a/tests/integration/hodlhodl.test.js b/tests/integration/hodlhodl.test.js index c96e9d60a..f81cb6126 100644 --- a/tests/integration/hodlhodl.test.js +++ b/tests/integration/hodlhodl.test.js @@ -106,9 +106,6 @@ describe.skip('HodlHodl API', function () { assert.ok(countries[0].native_name); assert.ok(countries[0].currency_code); assert.ok(countries[0].currency_name); - - const countryCode = await Hodl.getMyCountryCode(); - assert.strictEqual(countryCode.length, 2); }); it('can get offers', async () => {