getFilterLogs
Returns a list of event logs since the filter was created.
Note: getFilterLogs
is only compatible with event filters.
Usage
ts
import { parseAbiItem } from 'viem'
import { publicClient } from './client'
const filter = await publicClient.createEventFilter({
address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'),
})
// ...
const logs = await publicClient.getFilterLogs({ filter })
// [{ ... }, { ... }, { ... }]
import { parseAbiItem } from 'viem'
import { publicClient } from './client'
const filter = await publicClient.createEventFilter({
address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'),
})
// ...
const logs = await publicClient.getFilterLogs({ filter })
// [{ ... }, { ... }, { ... }]
ts
import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'
export const publicClient = createPublicClient({
chain: mainnet,
transport: http()
})
import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'
export const publicClient = createPublicClient({
chain: mainnet,
transport: http()
})
Returns
A list of event logs.
Parameters
filter
- Type:
Filter
An event filter.
ts
const filter = await publicClient.createEventFilter()
const logs = await publicClient.getFilterChanges({
filter,
})
const filter = await publicClient.createEventFilter()
const logs = await publicClient.getFilterChanges({
filter,
})