Skip to content

Commit

Permalink
Fetch only instance token transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
buberdds committed Dec 15, 2023
1 parent 1b58974 commit 7f4f018
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export const NFTTokenTransfersCard: FC<NftDashboardContext> = props => {
)
}

const NFTTokenTransfersView: FC<NftDashboardContext> = ({ scope, address }) => {
const NFTTokenTransfersView: FC<NftDashboardContext> = ({ 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 (
Expand Down
8 changes: 6 additions & 2 deletions src/app/pages/TokenDashboardPage/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<RuntimeEvent, RuntimeEventList>({
paramName: 'page',
Expand All @@ -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: {
Expand Down

0 comments on commit 7f4f018

Please sign in to comment.