LLM Notice: This documentation site supports content negotiation for AI agents. Request any page with Accept: text/markdown or Accept: text/plain header to receive Markdown instead of HTML. Alternatively, append ?format=md to any URL. All markdown files are available at /md/ prefix paths. For all content in one file, visit /llms-full.txt
Skip to main content

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:


_10
import * as fcl from "@onflow/fcl"
_10
_10
fcl.ref(refBlock)

Or import directly the specific function:


_10
import { ref } from "@onflow/fcl"
_10
_10
ref(refBlock)

Usage​


_20
import * as fcl from "@onflow/fcl";
_20
_20
// Set specific reference block for transaction
_20
await 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​


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

A function that processes an interaction object


Rate this page