From 277319236b3ac87febb61c35a15b618e2bd32433 Mon Sep 17 00:00:00 2001 From: daryl Date: Wed, 7 Aug 2024 14:07:16 +0800 Subject: [PATCH 1/3] fix(block): extra null block request (#409) * fix(block): extra null block request * style(block): use falsy condition --- src/pages/BlockDetail/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/BlockDetail/index.tsx b/src/pages/BlockDetail/index.tsx index f84b302c9..6e48c1959 100644 --- a/src/pages/BlockDetail/index.tsx +++ b/src/pages/BlockDetail/index.tsx @@ -79,7 +79,7 @@ export default () => { const queryBlockTransactions = useQuery( ['block-transactions', blockHash, currentPage, pageSizeParam, filter], async () => { - assert(blockHash != null) + assert(!!blockHash) try { const { transactions, total, pageSize } = await explorerService.api.fetchTransactionsByBlockHash(blockHash, { page: currentPage, From 6e0254e59dc0d5a55addf192558b2e4542c51da4 Mon Sep 17 00:00:00 2001 From: daryl Date: Wed, 7 Aug 2024 18:37:26 +0800 Subject: [PATCH 2/3] fix(live-cell): not filter bound status when using ckb address (#414) --- src/pages/Address/Cells.tsx | 3 ++- src/services/ExplorerService/fetcher.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/Address/Cells.tsx b/src/pages/Address/Cells.tsx index a342e5470..4406435ce 100644 --- a/src/pages/Address/Cells.tsx +++ b/src/pages/Address/Cells.tsx @@ -44,7 +44,8 @@ const fetchCells = async ({ sort: string page: number }) => { - const res = await explorerService.api.fetchAddressLiveCells(address, page, size, sort) + const boundStatus = address.startsWith('ckb') || address.startsWith('ckt') ? undefined : 'bound' + const res = await explorerService.api.fetchAddressLiveCells(address, page, size, sort, boundStatus) return { data: res.data, nextPage: page + 1, diff --git a/src/services/ExplorerService/fetcher.ts b/src/services/ExplorerService/fetcher.ts index 4266adad3..775a72fe0 100644 --- a/src/services/ExplorerService/fetcher.ts +++ b/src/services/ExplorerService/fetcher.ts @@ -176,7 +176,7 @@ export const apiFetcher = { page: number, size: number, sort?: string, - boundStatus: 'bound' | 'unbound' = 'bound', + boundStatus?: 'bound' | 'unbound', ) => { return v1GetUnwrappedPagedList(`address_live_cells/${address}`, { params: { From 380c792db65bdf6c7e2bcf5a06c7866463a07509 Mon Sep 17 00:00:00 2001 From: daryl Date: Thu, 8 Aug 2024 14:11:31 +0800 Subject: [PATCH 3/3] fix(btc-link): link to the different btc env (#412) * fix(btc-link): link to the different btc env * feat(btc-link): address depends on the txid * style(btc-link): change the code style --- src/components/Btc/Transaction/index.tsx | 41 +++++------------ src/components/Link/index.tsx | 21 +++++---- .../TransactionRGBPPDigestContent.tsx | 21 ++------- .../UTXOGraph/GraphNode/cellNode.tsx | 24 ++++------ src/pages/Address/AddressPage.tsx | 12 ++--- src/pages/Address/RgbppAssets.tsx | 25 ++++------- src/pages/RGBPP/TransactionList/List/item.tsx | 37 ++++----------- .../TransactionCellScript/index.tsx | 45 ++++--------------- 8 files changed, 63 insertions(+), 163 deletions(-) diff --git a/src/components/Btc/Transaction/index.tsx b/src/components/Btc/Transaction/index.tsx index 7ab736ebf..4507d94a1 100644 --- a/src/components/Btc/Transaction/index.tsx +++ b/src/components/Btc/Transaction/index.tsx @@ -1,11 +1,9 @@ import { useMemo, type FC } from 'react' import { useTranslation } from 'react-i18next' -import { useQuery } from '@tanstack/react-query' import { Tooltip } from 'antd' import dayjs from 'dayjs' import styles from './styles.module.scss' import { type RawBtcRPC } from '../../../services/ExplorerService' -import config from '../../../config' import AddressText from '../../AddressText' import EllipsisMiddle from '../../EllipsisMiddle' import { ReactComponent as UsedSeal } from './used-seal.svg' @@ -14,8 +12,7 @@ import { ReactComponent as ViewNewSeal } from './view-new-seal.svg' import { ReactComponent as MoreIcon } from '../../../assets/more-icon.svg' import { ReactComponent as BtcIcon } from './btc.svg' import { ReactComponent as DirectionIcon } from '../../../assets/direction.svg' -import { getBtcChainIdentify } from '../../../services/BTCIdentifier' -import { IS_MAINNET } from '../../../constants/common' +import { BTCExplorerLink } from '../../Link' const MAX_ITEMS = 10 @@ -26,14 +23,6 @@ const BtcTransaction: FC<{ }> = ({ tx, boundCellIndex, showId = true }) => { const { t } = useTranslation() - const { data: identity } = useQuery({ - queryKey: ['btc-testnet-identity', tx.txid], - queryFn: () => (tx.txid ? getBtcChainIdentify(tx.txid) : null), - enabled: !IS_MAINNET && !!tx.txid, - }) - - const btcExplorer = `${config.BITCOIN_EXPLORER}${IS_MAINNET ? '' : `/${identity}`}` - const time = tx.blocktime ? dayjs(tx.blocktime * 1000) : null const commitment = useMemo(() => { @@ -49,9 +38,9 @@ const BtcTransaction: FC<{ {showId ? (

- + - +

{time && tx.confirmations ? (