From 7f4f018d25efddf95f5345e645316cd16ef089f2 Mon Sep 17 00:00:00 2001 From: Michal Zielenkiewicz Date: Fri, 15 Dec 2023 12:38:11 +0100 Subject: [PATCH] Fetch only instance token transfers --- .../NFTInstanceDashboardPage/NFTTokenTransfersCard.tsx | 4 ++-- src/app/pages/TokenDashboardPage/hook.ts | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/pages/NFTInstanceDashboardPage/NFTTokenTransfersCard.tsx b/src/app/pages/NFTInstanceDashboardPage/NFTTokenTransfersCard.tsx index db66c82f35..fed0865621 100644 --- a/src/app/pages/NFTInstanceDashboardPage/NFTTokenTransfersCard.tsx +++ b/src/app/pages/NFTInstanceDashboardPage/NFTTokenTransfersCard.tsx @@ -30,9 +30,9 @@ export const NFTTokenTransfersCard: FC = props => { ) } -const NFTTokenTransfersView: FC = ({ scope, address }) => { +const NFTTokenTransfersView: FC = ({ scope, address, instanceId }) => { const { t } = useTranslation() - const { isLoading, isFetched, results } = useTokenTransfers(scope, address) + const { isLoading, isFetched, results } = useTokenTransfers(scope, address, instanceId) const transfers = results.data return ( diff --git a/src/app/pages/TokenDashboardPage/hook.ts b/src/app/pages/TokenDashboardPage/hook.ts index 16ee0a3c22..f38664279e 100644 --- a/src/app/pages/TokenDashboardPage/hook.ts +++ b/src/app/pages/TokenDashboardPage/hook.ts @@ -35,7 +35,7 @@ export const useTokenInfo = (scope: SearchScope, address: string, enabled = true } } -export const useTokenTransfers = (scope: SearchScope, address: string) => { +export const useTokenTransfers = (scope: SearchScope, address: string, nftId?: string) => { const { network, layer } = scope const pagination = useComprehensiveSearchParamsPagination({ paramName: 'page', @@ -48,15 +48,19 @@ export const useTokenTransfers = (scope: SearchScope, address: string) => { } const oasisAddress = useTransformToOasisAddress(address) + const rel = nftId ? undefined : oasisAddress! + const contract_address = nftId ? oasisAddress! : undefined const query = useGetRuntimeEvents( network, layer, // This is OK since consensus has been handled separately { ...pagination.paramsForQuery, - rel: oasisAddress!, + rel, type: 'evm.log', // The following is the hex-encoded signature for Transfer(address,address,uint256) evm_log_signature: 'ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', + contract_address, + nft_id: nftId, }, { query: {