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

queryRaw

Allows you to submit scripts to query the blockchain and get raw response data.

Import

You can import the entire package and access the function:


_10
import * as fcl from "@onflow/fcl"
_10
_10
fcl.queryRaw(opts)

Or import directly the specific function:


_10
import { queryRaw } from "@onflow/fcl"
_10
_10
queryRaw(opts)

Usage


_15
import * as fcl from '@onflow/fcl';
_15
_15
const result = await fcl.queryRaw({
_15
cadence: `
_15
access(all) fun main(a: Int, b: Int, addr: Address): Int {
_15
log(addr)
_15
return a + b
_15
}
_15
`,
_15
args: (arg, t) => [
_15
arg(7, t.Int), // a: Int
_15
arg(6, t.Int), // b: Int
_15
arg('0xba1132bc08f82fe2', t.Address), // addr: Address
_15
],
_15
});

Parameters

opts (optional)

  • Type:

_10
export interface QueryOptions {
_10
cadence?: string
_10
args?: ArgsFn
_10
template?: any
_10
isSealed?: boolean
_10
limit?: number
_10
}

  • Description: Query Options and configuration

Properties:

  • cadence - Cadence Script used to query Flow
  • args - Arguments passed to cadence script
  • template - Interaction Template for a script
  • isSealed - Block Finality
  • limit - Compute Limit for Query

Returns

Promise<any>

A promise that resolves to the raw query result


Rate this page