Skip to main content

getEventsAtBlockHeightRange

A builder function that returns all instances of a particular event (by name) within a height range.

The block range provided must be from the current spork.

The block range provided must be 250 blocks or lower per request.

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

Please read more about events in the documentation.

Block height range expresses the height of the start and end block in the chain.

Import​

You can import the entire package and access the function:


_10
import * as fcl from '@onflow/fcl';
_10
_10
fcl.getEventsAtBlockHeightRange(eventType, startHeight, endHeight);

Or import directly the specific function:


_10
import { getEventsAtBlockHeightRange } from '@onflow/fcl';
_10
_10
getEventsAtBlockHeightRange(eventType, startHeight, endHeight);

Usage​


_12
import * as fcl from '@onflow/fcl';
_12
_12
// Get events at block height range
_12
await fcl
_12
.send([
_12
fcl.getEventsAtBlockHeightRange(
_12
'A.7e60df042a9c0868.FlowToken.TokensWithdrawn', // event name
_12
35580624, // block to start looking for events at
_12
35580624, // block to stop looking for events at
_12
),
_12
])
_12
.then(fcl.decode);

Parameters​

eventType​

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

startHeight​

  • Type: number
  • Description: The height of the block to start looking for events (inclusive)

endHeight​

  • Type: number
  • Description: The height of the block to stop looking for events (inclusive)

Returns​


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

A function that processes an interaction object


Rate this page