Skip to main content

getBlock

A builder function that returns the interaction to get the latest block.

Use with 'fcl.atBlockId()' and 'fcl.atBlockHeight()' when building the interaction to get information for older blocks.

Consider using the pre-built interaction 'fcl.block(options)' if you do not need to pair with any other builders.

Block ID is SHA3-256 hash of the entire block payload. This hash is stored as an ID field on any block response object (ie. response from 'GetLatestBlock').

Block height expresses the height of the block on the chain. The latest block height increases by one for every valid block produced.

Import

You can import the entire package and access the function:


_10
import * as sdk from "@onflow/sdk"
_10
_10
sdk.getBlock(isSealed)

Or import directly the specific function:


_10
import { getBlock } from "@onflow/sdk"
_10
_10
getBlock(isSealed)

Usage


_10
import * as fcl from "@onflow/fcl";
_10
_10
const latestSealedBlock = await fcl.send([
_10
fcl.getBlock(true) // isSealed = true
_10
]).then(fcl.decode);

Parameters

isSealed (optional)

  • Type: boolean
  • Description: If the latest block should be sealed or not. See block states

Returns

InteractionBuilderFn


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


Rate this page