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:
_10import * as sdk from "@onflow/sdk"_10_10sdk.getBlock(isSealed)
Or import directly the specific function:
_10import { getBlock } from "@onflow/sdk"_10_10getBlock(isSealed)
Usage
_10import * as fcl from "@onflow/fcl";_10_10const 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
_10export type InteractionBuilderFn = (_10 ix: Interaction_10) => Interaction | Promise<Interaction>