mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-23 19:16:09 +00:00
use Http protocol for onion connection
This commit is contained in:
parent
248e8037a9
commit
861616fda2
1 changed files with 14 additions and 9 deletions
|
@ -12,18 +12,23 @@ Future<double> _fetchPrice(Map<String, dynamic> args) async {
|
|||
final crypto = args['crypto'] as CryptoCurrency;
|
||||
final fiat = args['fiat'] as FiatCurrency;
|
||||
final torOnly = args['torOnly'] as bool;
|
||||
double price = 0.0;
|
||||
|
||||
try {
|
||||
final uri = Uri.https(
|
||||
torOnly ? _fiatApiOnionAuthority : _fiatApiClearNetAuthority,
|
||||
_fiatApiPath,
|
||||
<String, String>{
|
||||
final Map<String, String> queryParams = {
|
||||
'interval_count': '1',
|
||||
'base': crypto.toString(),
|
||||
'quote': fiat.toString(),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
double price = 0.0;
|
||||
|
||||
try {
|
||||
late final Uri uri;
|
||||
if (torOnly) {
|
||||
uri = Uri.http(_fiatApiOnionAuthority, _fiatApiPath, queryParams);
|
||||
} else {
|
||||
uri = Uri.https(_fiatApiClearNetAuthority, _fiatApiPath, queryParams);
|
||||
}
|
||||
|
||||
final response = await get(uri);
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
|
|
Loading…
Reference in a new issue