From 80c969904936350fbf4e3d9e66f3ac575fb010f3 Mon Sep 17 00:00:00 2001 From: Fara Woolf Date: Wed, 24 Apr 2024 08:36:36 -0500 Subject: [PATCH] refactor: remove unneeded logger errors --- src/app/components/loaders/runes-loader.tsx | 4 +--- src/app/query/bitcoin/runes/runes.hooks.ts | 16 +++++++--------- src/app/query/common/alex-sdk/alex-sdk.hooks.ts | 5 +---- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/app/components/loaders/runes-loader.tsx b/src/app/components/loaders/runes-loader.tsx index 18e81e21d15..ee78d0287e8 100644 --- a/src/app/components/loaders/runes-loader.tsx +++ b/src/app/components/loaders/runes-loader.tsx @@ -1,5 +1,3 @@ -import { isDefined } from '@shared/utils'; - import type { RuneToken } from '@app/query/bitcoin/bitcoin-client'; import { useRuneTokens } from '@app/query/bitcoin/runes/runes.hooks'; @@ -9,5 +7,5 @@ interface RunesLoaderProps { } export function RunesLoader({ addresses, children }: RunesLoaderProps) { const runes = useRuneTokens(addresses); - return children(runes.filter(isDefined)); + return children(runes); } diff --git a/src/app/query/bitcoin/runes/runes.hooks.ts b/src/app/query/bitcoin/runes/runes.hooks.ts index 1ea8030e261..7e1cff6e0d8 100644 --- a/src/app/query/bitcoin/runes/runes.hooks.ts +++ b/src/app/query/bitcoin/runes/runes.hooks.ts @@ -1,4 +1,3 @@ -import { logger } from '@shared/logger'; import { createMoney } from '@shared/models/money.model'; import { isDefined } from '@shared/utils'; @@ -41,14 +40,13 @@ export function useRuneTokens(addresses: string[]) { .flatMap(query => query.data) .filter(isDefined); - return runesBalances.map(r => { - const tickerInfo = runesTickerInfo.find(t => t.rune_name === r.rune_name); - if (!tickerInfo) { - logger.error('No ticker info found for Rune'); - return; - } - return makeRuneToken(r, tickerInfo); - }); + return runesBalances + .map(r => { + const tickerInfo = runesTickerInfo.find(t => t.rune_name === r.rune_name); + if (!tickerInfo) return; + return makeRuneToken(r, tickerInfo); + }) + .filter(isDefined); } export function useRunesOutputsByAddress(address: string) { diff --git a/src/app/query/common/alex-sdk/alex-sdk.hooks.ts b/src/app/query/common/alex-sdk/alex-sdk.hooks.ts index f343a0dd3bb..e7986efa9fc 100644 --- a/src/app/query/common/alex-sdk/alex-sdk.hooks.ts +++ b/src/app/query/common/alex-sdk/alex-sdk.hooks.ts @@ -42,10 +42,7 @@ export function useAlexCurrencyPriceAsMarketData() { const tokenInfo = supportedCurrencies .filter(isDefined) .find(token => pullContractIdFromIdentity(token.contractAddress) === principal); - if (!symbol || !prices || !tokenInfo) { - logger.error('Could not create market data'); - return null; - } + if (!symbol || !prices || !tokenInfo) return null; const currency = tokenInfo.id as Currency; const price = convertAmountToFractionalUnit(new BigNumber(prices[currency] ?? 0), 2); return createMarketData(createMarketPair(symbol, 'USD'), createMoney(price, 'USD'));