From 574dbad76e01be50a267932336677728e2d760a2 Mon Sep 17 00:00:00 2001 From: Michal Zielenkiewicz Date: Mon, 2 Dec 2024 09:07:47 +0100 Subject: [PATCH] Use correct query param in token transfers card --- .changelog/1638.bugfix.md | 1 + .../AccountTokenTransfersCard.tsx | 2 +- src/app/pages/TokenDashboardPage/TokenTransfersCard.tsx | 6 +++++- src/app/pages/TokenDashboardPage/hook.ts | 8 ++------ 4 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 .changelog/1638.bugfix.md diff --git a/.changelog/1638.bugfix.md b/.changelog/1638.bugfix.md new file mode 100644 index 000000000..80a8ad206 --- /dev/null +++ b/.changelog/1638.bugfix.md @@ -0,0 +1 @@ +Use correct query param in token Transfers card diff --git a/src/app/pages/RuntimeAccountDetailsPage/AccountTokenTransfersCard.tsx b/src/app/pages/RuntimeAccountDetailsPage/AccountTokenTransfersCard.tsx index 38f4a4f82..465000e80 100644 --- a/src/app/pages/RuntimeAccountDetailsPage/AccountTokenTransfersCard.tsx +++ b/src/app/pages/RuntimeAccountDetailsPage/AccountTokenTransfersCard.tsx @@ -20,7 +20,7 @@ export const AccountTokenTransfersCard: FC = ({ sc const AccountTokenTransfers: FC = ({ scope, address, account }) => { const { t } = useTranslation() - const { isLoading, isFetched, results } = useTokenTransfers(scope, { address }) + const { isLoading, isFetched, results } = useTokenTransfers(scope, { rel: address }) const transfers = results.data diff --git a/src/app/pages/TokenDashboardPage/TokenTransfersCard.tsx b/src/app/pages/TokenDashboardPage/TokenTransfersCard.tsx index 3a04d992a..b5b31b233 100644 --- a/src/app/pages/TokenDashboardPage/TokenTransfersCard.tsx +++ b/src/app/pages/TokenDashboardPage/TokenTransfersCard.tsx @@ -23,7 +23,11 @@ export const TokenTransfersCard: FC = ({ scope, address } const TokenTransfersView: FC = ({ scope, address }) => { const { t } = useTranslation() - const { isLoading: areTransfersLoading, isFetched, results } = useTokenTransfers(scope, { address }) + const { + isLoading: areTransfersLoading, + isFetched, + results, + } = useTokenTransfers(scope, { contract_address: address }) const { isLoading: isTokenLoading } = useTokenInfo(scope, address) diff --git a/src/app/pages/TokenDashboardPage/hook.ts b/src/app/pages/TokenDashboardPage/hook.ts index 84317e86c..bccbefe65 100644 --- a/src/app/pages/TokenDashboardPage/hook.ts +++ b/src/app/pages/TokenDashboardPage/hook.ts @@ -36,18 +36,14 @@ export const useTokenInfo = (scope: SearchScope, address: string, enabled = true } } -export const useTokenTransfers = (scope: SearchScope, params: { address: string }) => { - return _useTokenTransfers(scope, { rel: params.address }) -} - export const useNFTInstanceTransfers = ( scope: SearchScope, params: { nft_id: string; contract_address: string }, ) => { - return _useTokenTransfers(scope, { nft_id: params.nft_id, contract_address: params.contract_address }) + return useTokenTransfers(scope, { nft_id: params.nft_id, contract_address: params.contract_address }) } -export const _useTokenTransfers = (scope: SearchScope, params: undefined | GetRuntimeEventsParams) => { +export const useTokenTransfers = (scope: SearchScope, params: undefined | GetRuntimeEventsParams) => { if (params && Object.values(params).some(value => value === undefined || value === null)) { throw new Error('Must set params=undefined while some values are unavailable') }