mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
Avoids any confusion / potential trademark friction with HashWallet
(Spanish hardware-wallet company). Hash Bags is a more distinctive
name, harder to collide with, and we can still rank for 'hash wallet'
search via App Store / Play Store subtitle ('Hash Bags - A Wallet
for your Coins').
What changed (all user-visible strings):
- Launcher labels: android/app.properties, scripts/android/app_env.sh,
scripts/ios/app_env.sh, linux window title (CMakeLists +
my_application.cc)
- In-app text: lib/generated/i18n.dart + ARB sources under res/values/
- Brand docs: README.md, CONTRIBUTING.md, PRIVACY.md,
assets/text/Terms_of_Use.txt, assets/text/Release_Notes.txt
- hash.boats website: index.html, og-image.svg + regen og-image.png,
site.webmanifest, styles.css comment, splash/confirm/pulse/mark/
lockup svg titles, report/index.html, server/server.js
- CI workflow display names ("Hash Bags Linux build", etc.)
What did NOT change (deliberate):
- Bundle ID / Package: com.suchsoftware.hashwallet (immutable app
identity on App Store + Play Store — changing == orphaning the app)
- Binary name: hash_wallet (Linux executable)
- Dart import paths: package:hash_wallet/...
- Git repo: hash-wallet (Such-Software/hash-wallet)
- URL scheme: hashwallet:// (internal deep links)
- support@such.software (no domain change yet)
- App Store / Play Store listing names (whatever was registered there
stays; we updated launcher label only)
- hash.boats domain (still the wallet site)
Also kept the '#ash Wallet' wordplay in the nav but updated to
'#ash Bags' so the # mark still serves as the H. Nav reads:
[# mark] #ash Bags
Website hero tagline now matches the App Store sub-title concept:
'A wallet for your coins. Open-source, non-custodial, multi-chain.
Privacy-leaning by default.'
108 files modified, ~674 string replacements.
73 lines
2.3 KiB
Dart
73 lines
2.3 KiB
Dart
import 'package:cw_core/utils/proxy_wrapper.dart';
|
|
import 'package:cw_core/crypto_currency.dart';
|
|
import 'package:hash_wallet/entities/fiat_currency.dart';
|
|
import 'dart:convert';
|
|
|
|
// Hash Bags price endpoint. Backed by the Cloudflare Worker in
|
|
// github.com/Such-Software/hash-wallet-prices — Kraken for majors, NonKYC for
|
|
// WOW, KV-cached every 60s.
|
|
//
|
|
// USD-only. The wallet still lets the user pick other fiats from the UI, but
|
|
// non-USD requests will return price=0 until forex conversion is added on the
|
|
// server side.
|
|
//
|
|
// TODO: add a .onion mirror once we deploy a Tor hidden service and update
|
|
// _fiatApiOnionAuthority — Tor users currently fall back to clearnet.
|
|
const _fiatApiClearNetAuthority = 'prices.neroswap.com';
|
|
const _fiatApiOnionAuthority = '';
|
|
const _fiatApiPath = '/v2/rates';
|
|
|
|
Future<double> _fetchPrice(String crypto, String fiat, bool torOnly) async {
|
|
|
|
final Map<String, String> queryParams = {
|
|
'base': crypto.split(".").first,
|
|
'quote': fiat,
|
|
};
|
|
|
|
num price = 0.0;
|
|
|
|
try {
|
|
final clearnetUri = Uri.https(_fiatApiClearNetAuthority, _fiatApiPath, queryParams);
|
|
final onionUri = _fiatApiOnionAuthority.isEmpty
|
|
? clearnetUri
|
|
: Uri.http(_fiatApiOnionAuthority, _fiatApiPath, queryParams);
|
|
|
|
final response = await ProxyWrapper().get(
|
|
onionUri: onionUri,
|
|
clearnetUri: torOnly ? onionUri : clearnetUri,
|
|
);
|
|
|
|
if (response.statusCode != 200) {
|
|
return 0.0;
|
|
}
|
|
|
|
final responseJSON = json.decode(response.body) as Map<String, dynamic>;
|
|
final results = responseJSON['results'] as Map<String, dynamic>;
|
|
|
|
if (results.isNotEmpty) {
|
|
price = results.values.first as num;
|
|
}
|
|
|
|
return price.toDouble();
|
|
} catch (e) {
|
|
return price.toDouble();
|
|
}
|
|
}
|
|
|
|
/// Override specific [CryptoCurrency] to fix its price to the price of another
|
|
/// e.g. nDEPS should have the same price as DEPS, but only DEPS is tracked
|
|
CryptoCurrency _overrideCryptoCurrency(CryptoCurrency crypto) {
|
|
if (crypto.title == CryptoCurrency.ndeps.title)
|
|
return CryptoCurrency.deps;
|
|
return crypto;
|
|
}
|
|
|
|
class FiatConversionService {
|
|
static Future<double> fetchPrice({
|
|
required CryptoCurrency crypto,
|
|
required FiatCurrency fiat,
|
|
required bool torOnly,
|
|
}) async =>
|
|
await _fetchPrice(_overrideCryptoCurrency(crypto).toString(), fiat.toString(), torOnly);
|
|
}
|