From bc32eb92ce1307ab29be8e77083afeaff3464f06 Mon Sep 17 00:00:00 2001 From: Asa Oines Date: Tue, 22 Nov 2022 08:14:19 -0500 Subject: [PATCH] Do not make empty queries to coingecko (#1285) --- typescript/sdk/src/gas/token-prices.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/typescript/sdk/src/gas/token-prices.ts b/typescript/sdk/src/gas/token-prices.ts index da331a3dd..c8689a201 100644 --- a/typescript/sdk/src/gas/token-prices.ts +++ b/typescript/sdk/src/gas/token-prices.ts @@ -104,10 +104,12 @@ export class CoinGeckoTokenPriceGetter implements TokenPriceGetter { } const toQuery = chains.filter((c) => !this.cache.isFresh(c)); - try { - await this.queryTokenPrices(toQuery); - } catch (e) { - warn('Failed to query token prices', e); + if (toQuery.length > 0) { + try { + await this.queryTokenPrices(toQuery); + } catch (e) { + warn('Failed to query token prices', e); + } } return chains.map((chain) => this.cache.fetch(chain)); }