getBlockTransactionCount
Action for fetching the number of Transactions at a block number, hash or tag.
Import
ts
import { getBlockTransactionCount } from '@wagmi/core'
import { getBlockTransactionCount } from '@wagmi/core'
Usage
ts
import { getBlockTransactionCount } from '@wagmi/core'
import { config } from './config'
const blockTransactionCount = await getBlockTransactionCount(config)
import { getBlockTransactionCount } from '@wagmi/core'
import { config } from './config'
const blockTransactionCount = await getBlockTransactionCount(config)
ts
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'
export const config = createConfig({
chains: [mainnet, sepolia],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
})
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'
export const config = createConfig({
chains: [mainnet, sepolia],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
})
Parameters
ts
import { type GetBlockTransactionCountParameters } from '@wagmi/core'
import { type GetBlockTransactionCountParameters } from '@wagmi/core'
cacheTime
number | undefined
Time in milliseconds that cached block transaction count will remain in memory.
ts
import { getBlockTransactionCount } from '@wagmi/core'
import { config } from './config'
const blockTransactionCount = await getBlockTransactionCount(config, {
cacheTime: 4_000,
})
import { getBlockTransactionCount } from '@wagmi/core'
import { config } from './config'
const blockTransactionCount = await getBlockTransactionCount(config, {
cacheTime: 4_000,
})
ts
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'
export const config = createConfig({
chains: [mainnet, sepolia],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
})
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'
export const config = createConfig({
chains: [mainnet, sepolia],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
})
chainId
config['chains'][number]['id'] | undefined
ID of chain to use when fetching data.
ts
import { getBlockTransactionCount } from '@wagmi/core'
import { mainnet } from '@wagmi/core/chains'
import { config } from './config'
const blockTransactionCount = await getBlockTransactionCount(config, {
chainId: mainnet.id,
})
import { getBlockTransactionCount } from '@wagmi/core'
import { mainnet } from '@wagmi/core/chains'
import { config } from './config'
const blockTransactionCount = await getBlockTransactionCount(config, {
chainId: mainnet.id,
})
ts
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'
export const config = createConfig({
chains: [mainnet, sepolia],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
})
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'
export const config = createConfig({
chains: [mainnet, sepolia],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
})
Return Type
ts
import { type GetBlockTransactionCountReturnType } from '@wagmi/core'
import { type GetBlockTransactionCountReturnType } from '@wagmi/core'
number
The number of Transactions at a block number
Error
ts
import { type GetBlockTransactionCountErrorType } from '@wagmi/core'
import { type GetBlockTransactionCountErrorType } from '@wagmi/core'
TanStack Query
ts
import {
type GetBlockTransactionCountData,
type GetBlockTransactionCountOptions,
type GetBlockTransactionCountQueryFnData,
type GetBlockTransactionCountQueryKey,
getBlockTransactionCountQueryKey,
getBlockTransactionCountQueryOptions,
} from '@wagmi/core/query'
import {
type GetBlockTransactionCountData,
type GetBlockTransactionCountOptions,
type GetBlockTransactionCountQueryFnData,
type GetBlockTransactionCountQueryKey,
getBlockTransactionCountQueryKey,
getBlockTransactionCountQueryOptions,
} from '@wagmi/core/query'