mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-24 11:15:58 +00:00
disable eth token price fetching to prevent being throttled
This commit is contained in:
parent
af87ec76ef
commit
02997ffc70
1 changed files with 33 additions and 33 deletions
|
@ -187,39 +187,39 @@ class PriceAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (final contractAddress in contractAddresses) {
|
// for (final contractAddress in contractAddresses) {
|
||||||
final uri = Uri.parse(
|
// final uri = Uri.parse(
|
||||||
"https://api.coingecko.com/api/v3/simple/token_price/ethereum"
|
// "https://api.coingecko.com/api/v3/simple/token_price/ethereum"
|
||||||
"?vs_currencies=${baseCurrency.toLowerCase()}&contract_addresses"
|
// "?vs_currencies=${baseCurrency.toLowerCase()}&contract_addresses"
|
||||||
"=$contractAddress&include_24hr_change=true");
|
// "=$contractAddress&include_24hr_change=true");
|
||||||
|
//
|
||||||
final coinGeckoResponse = await client.get(
|
// final coinGeckoResponse = await client.get(
|
||||||
url: uri,
|
// url: uri,
|
||||||
headers: {'Content-Type': 'application/json'},
|
// headers: {'Content-Type': 'application/json'},
|
||||||
proxyInfo: Prefs.instance.useTor
|
// proxyInfo: Prefs.instance.useTor
|
||||||
? TorService.sharedInstance.getProxyInfo()
|
// ? TorService.sharedInstance.getProxyInfo()
|
||||||
: null,
|
// : null,
|
||||||
);
|
// );
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
final coinGeckoData = jsonDecode(coinGeckoResponse.body) as Map;
|
// final coinGeckoData = jsonDecode(coinGeckoResponse.body) as Map;
|
||||||
|
//
|
||||||
final map = coinGeckoData[contractAddress] as Map;
|
// final map = coinGeckoData[contractAddress] as Map;
|
||||||
|
//
|
||||||
final price =
|
// final price =
|
||||||
Decimal.parse(map[baseCurrency.toLowerCase()].toString());
|
// Decimal.parse(map[baseCurrency.toLowerCase()].toString());
|
||||||
final change24h = double.parse(
|
// final change24h = double.parse(
|
||||||
map["${baseCurrency.toLowerCase()}_24h_change"].toString());
|
// map["${baseCurrency.toLowerCase()}_24h_change"].toString());
|
||||||
|
//
|
||||||
tokenPrices[contractAddress] = Tuple2(price, change24h);
|
// tokenPrices[contractAddress] = Tuple2(price, change24h);
|
||||||
} catch (e, s) {
|
// } catch (e, s) {
|
||||||
// only log the error as we don't want to interrupt the rest of the loop
|
// // only log the error as we don't want to interrupt the rest of the loop
|
||||||
Logging.instance.log(
|
// Logging.instance.log(
|
||||||
"getPricesAnd24hChangeForEthTokens($baseCurrency,$contractAddress): $e\n$s\nRESPONSE: ${coinGeckoResponse.body}",
|
// "getPricesAnd24hChangeForEthTokens($baseCurrency,$contractAddress): $e\n$s\nRESPONSE: ${coinGeckoResponse.body}",
|
||||||
level: LogLevel.Warning,
|
// level: LogLevel.Warning,
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
return tokenPrices;
|
return tokenPrices;
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
|
|
Loading…
Reference in a new issue