ref
A builder function that sets the reference block for a transaction.
The reference block specifies an expiration window (measured in blocks) during which a transaction is considered valid by the network. A transaction will be rejected if it is submitted past its expiry block. Flow calculates transaction expiry using the reference block field.
Import
You can import the entire package and access the function:
_10import * as sdk from "@onflow/sdk"_10_10sdk.ref(refBlock)
Or import directly the specific function:
_10import { ref } from "@onflow/sdk"_10_10ref(refBlock)
Usage
_20import * as fcl from "@onflow/fcl";_20_20// Set specific reference block for transaction_20await fcl.send([_20 fcl.transaction`_20 transaction {_20 prepare(account: AuthAccount) {_20 log("Transaction with custom reference block")_20 }_20 }_20 `,_20 fcl.ref("a1b2c3d4e5f6789..."), // Custom reference block ID_20 fcl.proposer(fcl.authz),_20 fcl.payer(fcl.authz),_20 fcl.authorizations([fcl.authz]),_20 fcl.limit(100)_20]);_20_20// Usually, you don't need to set reference block manually_20// as FCL will automatically set it to the latest block
Parameters
refBlock
- Type:
string
- Description: The reference block ID
Returns
InteractionBuilderFn
_10export type InteractionBuilderFn = (_10 ix: Interaction_10) => Interaction | Promise<Interaction>