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 crypto = args['crypto'] as CryptoCurrency;
|
||||||
final fiat = args['fiat'] as FiatCurrency;
|
final fiat = args['fiat'] as FiatCurrency;
|
||||||
final torOnly = args['torOnly'] as bool;
|
final torOnly = args['torOnly'] as bool;
|
||||||
|
|
||||||
|
final Map<String, String> queryParams = {
|
||||||
|
'interval_count': '1',
|
||||||
|
'base': crypto.toString(),
|
||||||
|
'quote': fiat.toString(),
|
||||||
|
};
|
||||||
|
|
||||||
double price = 0.0;
|
double price = 0.0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final uri = Uri.https(
|
late final Uri uri;
|
||||||
torOnly ? _fiatApiOnionAuthority : _fiatApiClearNetAuthority,
|
if (torOnly) {
|
||||||
_fiatApiPath,
|
uri = Uri.http(_fiatApiOnionAuthority, _fiatApiPath, queryParams);
|
||||||
<String, String>{
|
} else {
|
||||||
'interval_count': '1',
|
uri = Uri.https(_fiatApiClearNetAuthority, _fiatApiPath, queryParams);
|
||||||
'base': crypto.toString(),
|
}
|
||||||
'quote': fiat.toString(),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
final response = await get(uri);
|
final response = await get(uri);
|
||||||
|
|
||||||
if (response.statusCode != 200) {
|
if (response.statusCode != 200) {
|
||||||
|
|
Loading…
Reference in a new issue