From 48b04374d131870d588ba5319b58f702a57bd819 Mon Sep 17 00:00:00 2001 From: Rick <81699526+rick23p@users.noreply.github.com> Date: Tue, 19 Dec 2023 11:12:55 +0330 Subject: [PATCH] SOV-3416: Use mempool.space instead of BlockCypher for bitcoin block explorer links (#711) * feat: change btc explorer to mempool * fix: Replace useTranslation() hook usage with direct "t" import * Create ten-shirts-act.md * chore: update changeset message * trigger rebuild --------- Co-authored-by: soulBit --- .changeset/ten-shirts-act.md | 6 ++++++ .../3_organisms/FundingHistoryFrame/FundingHistoryFrame.tsx | 6 ++---- .../StakingDelegateChanges/StakingDelegateChanges.tsx | 4 +--- .../StakingExtendedDuration/StakingExtendedDuration.tsx | 4 +--- .../components/StakingHistory/StakingHistory.tsx | 4 +--- .../components/StakingWithdraws/StakingWithdraws.tsx | 4 +--- .../VestingDelegateChanges/VestingDelegateChanges.tsx | 4 +--- apps/frontend/src/constants/infrastructure.ts | 4 ++-- 8 files changed, 15 insertions(+), 21 deletions(-) create mode 100644 .changeset/ten-shirts-act.md diff --git a/.changeset/ten-shirts-act.md b/.changeset/ten-shirts-act.md new file mode 100644 index 000000000..4869af784 --- /dev/null +++ b/.changeset/ten-shirts-act.md @@ -0,0 +1,6 @@ +--- +"frontend": patch +--- + +SOV-3416: Use mempool.space instead of BlockCypher for bitcoin block explorer links +Fix broken localisations in history tables diff --git a/apps/frontend/src/app/3_organisms/FundingHistoryFrame/FundingHistoryFrame.tsx b/apps/frontend/src/app/3_organisms/FundingHistoryFrame/FundingHistoryFrame.tsx index b4a5212d0..4d26a913a 100644 --- a/apps/frontend/src/app/3_organisms/FundingHistoryFrame/FundingHistoryFrame.tsx +++ b/apps/frontend/src/app/3_organisms/FundingHistoryFrame/FundingHistoryFrame.tsx @@ -1,7 +1,7 @@ import React, { FC, useCallback, useEffect, useMemo, useState } from 'react'; +import { t } from 'i18next'; import { nanoid } from 'nanoid'; -import { useTranslation } from 'react-i18next'; import { NotificationType, @@ -40,7 +40,6 @@ import { useGetFundingHistory } from './hooks/useGetFundingHistory'; const pageSize = DEFAULT_HISTORY_FRAME_PAGE_SIZE; export const FundingHistoryFrame: FC = () => { - const { t } = useTranslation(); const { account } = useAccount(); const { addNotification } = useNotificationContext(); const { value: block } = useBlockNumber(); @@ -123,7 +122,6 @@ export const FundingHistoryFrame: FC = () => { const fundingData = funding.reduce((acc: FundingHistoryType[], item) => { const rows = parseData(item as BitcoinTransfer); - // make sure rows has at least 2 elements before using spread operator if (rows.length >= 2) { acc.push( @@ -152,7 +150,7 @@ export const FundingHistoryFrame: FC = () => { token: BITCOIN, txHash: item.txHash, })); - }, [t, account, addNotification, getFundingHistory, orderOptions]); + }, [account, addNotification, getFundingHistory, orderOptions]); useEffect(() => { setPage(0); diff --git a/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/StakingDelegateChanges/StakingDelegateChanges.tsx b/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/StakingDelegateChanges/StakingDelegateChanges.tsx index d193428fe..62e7c90ea 100644 --- a/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/StakingDelegateChanges/StakingDelegateChanges.tsx +++ b/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/StakingDelegateChanges/StakingDelegateChanges.tsx @@ -1,7 +1,7 @@ import React, { FC, useCallback, useEffect, useMemo, useState } from 'react'; +import { t } from 'i18next'; import { nanoid } from 'nanoid'; -import { useTranslation } from 'react-i18next'; import { ErrorBadge, @@ -41,7 +41,6 @@ export const StakingDelegateChanges: FC = ({ onChangeHistoryType, selectedHistoryType, }) => { - const { t } = useTranslation(); const { account } = useAccount(); const { addNotification } = useNotificationContext(); @@ -117,7 +116,6 @@ export const StakingDelegateChanges: FC = ({ orderOptions.orderBy, orderOptions.orderDirection, addNotification, - t, ]); useEffect(() => { diff --git a/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/StakingExtendedDuration/StakingExtendedDuration.tsx b/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/StakingExtendedDuration/StakingExtendedDuration.tsx index 1d75baa78..50cfca475 100644 --- a/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/StakingExtendedDuration/StakingExtendedDuration.tsx +++ b/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/StakingExtendedDuration/StakingExtendedDuration.tsx @@ -1,7 +1,7 @@ import React, { FC, useCallback, useEffect, useMemo, useState } from 'react'; +import { t } from 'i18next'; import { nanoid } from 'nanoid'; -import { useTranslation } from 'react-i18next'; import { ErrorBadge, @@ -42,7 +42,6 @@ export const StakingExtendedDuration: FC = ({ onChangeHistoryType, selectedHistoryType, }) => { - const { t } = useTranslation(); const { account } = useAccount(); const { addNotification } = useNotificationContext(); @@ -120,7 +119,6 @@ export const StakingExtendedDuration: FC = ({ orderOptions.orderBy, orderOptions.orderDirection, addNotification, - t, ]); useEffect(() => { diff --git a/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/StakingHistory/StakingHistory.tsx b/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/StakingHistory/StakingHistory.tsx index df361cf91..a38c8e31e 100644 --- a/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/StakingHistory/StakingHistory.tsx +++ b/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/StakingHistory/StakingHistory.tsx @@ -1,7 +1,7 @@ import React, { FC, useCallback, useEffect, useMemo, useState } from 'react'; +import { t } from 'i18next'; import { nanoid } from 'nanoid'; -import { useTranslation } from 'react-i18next'; import { ErrorBadge, @@ -42,7 +42,6 @@ export const StakingHistory: FC = ({ onChangeHistoryType, selectedHistoryType, }) => { - const { t } = useTranslation(); const { account } = useAccount(); const { addNotification } = useNotificationContext(); @@ -119,7 +118,6 @@ export const StakingHistory: FC = ({ orderOptions.orderBy, orderOptions.orderDirection, addNotification, - t, ]); useEffect(() => { diff --git a/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/StakingWithdraws/StakingWithdraws.tsx b/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/StakingWithdraws/StakingWithdraws.tsx index 32ce6e5b8..38a9582bd 100644 --- a/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/StakingWithdraws/StakingWithdraws.tsx +++ b/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/StakingWithdraws/StakingWithdraws.tsx @@ -1,7 +1,7 @@ import React, { FC, useCallback, useEffect, useMemo, useState } from 'react'; +import { t } from 'i18next'; import { nanoid } from 'nanoid'; -import { useTranslation } from 'react-i18next'; import { ErrorBadge, @@ -42,7 +42,6 @@ export const StakingWithdraws: FC = ({ onChangeHistoryType, selectedHistoryType, }) => { - const { t } = useTranslation(); const { account } = useAccount(); const { addNotification } = useNotificationContext(); @@ -119,7 +118,6 @@ export const StakingWithdraws: FC = ({ orderOptions.orderBy, orderOptions.orderDirection, addNotification, - t, ]); useEffect(() => { diff --git a/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/VestingDelegateChanges/VestingDelegateChanges.tsx b/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/VestingDelegateChanges/VestingDelegateChanges.tsx index 504503d1b..b65282225 100644 --- a/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/VestingDelegateChanges/VestingDelegateChanges.tsx +++ b/apps/frontend/src/app/3_organisms/StakingHistoryFrame/components/VestingDelegateChanges/VestingDelegateChanges.tsx @@ -1,7 +1,7 @@ import React, { FC, useCallback, useEffect, useMemo, useState } from 'react'; +import { t } from 'i18next'; import { nanoid } from 'nanoid'; -import { useTranslation } from 'react-i18next'; import { ErrorBadge, @@ -41,7 +41,6 @@ export const VestingDelegateChanges: FC = ({ onChangeHistoryType, selectedHistoryType, }) => { - const { t } = useTranslation(); const { account } = useAccount(); const { addNotification } = useNotificationContext(); @@ -116,7 +115,6 @@ export const VestingDelegateChanges: FC = ({ orderOptions.orderBy, orderOptions.orderDirection, addNotification, - t, ]); useEffect(() => { diff --git a/apps/frontend/src/constants/infrastructure.ts b/apps/frontend/src/constants/infrastructure.ts index 4e6a5f342..c021470d4 100644 --- a/apps/frontend/src/constants/infrastructure.ts +++ b/apps/frontend/src/constants/infrastructure.ts @@ -39,8 +39,8 @@ export const RSK_EXPLORER = { }; export const BTC_EXPLORER = { - [Environments.Mainnet]: 'https://live.blockcypher.com/btc', - [Environments.Testnet]: 'https://live.blockcypher.com/btc-testnet', + [Environments.Mainnet]: 'https://mempool.space', + [Environments.Testnet]: 'https://mempool.space/testnet', }; export const GRAPH_WRAPPER = {