atBlockHeight
A builder function that returns a partial interaction to a block at a specific height.
Use with other interactions like 'fcl.getBlock()' to get a full interaction at the specified block height.
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.atBlockHeight(height)
Or import directly the specific function:
_10import { atBlockHeight } from "@onflow/sdk"_10_10atBlockHeight(height)
Usage
_20import * as fcl from "@onflow/fcl";_20_20// Get block at specific height_20await fcl.send([fcl.getBlock(), fcl.atBlockHeight(123)]).then(fcl.decode);_20_20// Get account at specific block height_20await fcl.send([_20 fcl.getAccount("0x1d007d755706c469"),_20 fcl.atBlockHeight(12345)_20]).then(fcl.decode);_20_20// Execute script at specific block height_20await fcl.send([_20 fcl.script`_20 access(all) fun main(): UFix64 {_20 return getCurrentBlock().height_20 }_20 `,_20 fcl.atBlockHeight(100)_20]).then(fcl.decode);
Parameters
height
- Type:
number
- Description: The height of the block to execute the interaction at
Returns
InteractionBuilderFn
_10export type InteractionBuilderFn = (_10 ix: Interaction_10) => Interaction | Promise<Interaction>