Skip to main content

getEventsAtBlockIds

A builder function that returns all instances of a particular event (by name) within a set of blocks, specified by block ids.

The block range provided must be from the current spork.

Event type is a string that follow a standard format: A.{AccountAddress}.{ContractName}.{EventName}

Please read more about events in the documentation.

Import

You can import the entire package and access the function:


_10
import * as sdk from '@onflow/sdk';
_10
_10
sdk.getEventsAtBlockIds(eventType, blockIds);

Or import directly the specific function:


_10
import { getEventsAtBlockIds } from '@onflow/sdk';
_10
_10
getEventsAtBlockIds(eventType, blockIds);

Usage


_10
import * as fcl from '@onflow/fcl';
_10
_10
const events = await fcl
_10
.send([
_10
fcl.getEventsAtBlockIds('A.7e60df042a9c0868.FlowToken.TokensWithdrawn', [
_10
'c4f239d49e96d1e5fbcf1f31027a6e582e8c03fcd9954177b7723fdb03d938c7',
_10
'5dbaa85922eb194a3dc463c946cc01c866f2ff2b88f3e59e21c0d8d00113273f',
_10
]),
_10
])
_10
.then(fcl.decode);

Parameters

eventType

  • Type: string
  • Description: The type of event to get

blockIds

  • Type: string[]
  • Description: The ids of the blocks to scan for events

Returns


_10
export type InteractionBuilderFn = (
_10
ix: Interaction,
_10
) => Interaction | Promise<Interaction>;

A function that processes an interaction object


Rate this page