Skip to content

Added useFlowQueryRaw docs #1333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions docs/tools/kit/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ sidebar_position: 1
- [`useFlowConfig`](#useflowconfig) – Access the current Flow configuration
- [`useFlowEvents`](#useflowevents) – Subscribe to Flow events in real-time
- [`useFlowQuery`](#useflowquery) – Execute Cadence scripts with optional arguments
- [`useFlowQueryRaw`](#useflowqueryraw) – Execute Cadence scripts with optional arguments returning non-decoded data
- [`useFlowMutate`](#useflowmutate) – Send transactions to the Flow blockchain
- [`useFlowRevertibleRandom`](#useflowrevertiblerandom) – Generate pseudorandom values tied to block height
- [`useFlowTransactionStatus`](#useflowtransactionstatus) – Track transaction status updates
Expand Down Expand Up @@ -314,6 +315,51 @@ function QueryExample() {

---

### `useFlowQueryRaw`

```tsx
import { useFlowQueryRaw } from "@onflow/kit"
```

This hook is identical to `useFlowQuery` but returns the raw, non-decoded response data from the Flow blockchain. This is useful when you need access to the original response structure or want to handle decoding manually.

#### Parameters:

- `cadence: string` – Cadence script to run
- `args?: (arg, t) => unknown[]` – Function returning FCL arguments
- `query?: UseQueryOptions<unknown, Error>` – Optional TanStackQuery options

#### Returns: `UseQueryResult<unknown, Error>`

The returned data will be in its raw, non-decoded format as received from the Flow access node.

```tsx
function QueryRawExample() {
const { data: rawData, isLoading, error, refetch } = useFlowQueryRaw({
cadence: `
access(all)
fun main(a: Int, b: Int): Int {
return a + b
}
`,
args: (arg, t) => [arg(1, t.Int), arg(2, t.Int)],
query: { staleTime: 10000 },
})

if (isLoading) return <p>Loading query...</p>
if (error) return <p>Error: {error.message}</p>

return (
<div>
<p>Raw Result: {JSON.stringify(rawData, null, 2)}</p>
<button onClick={refetch}>Refetch</button>
</div>
)
}
```

---

### `useFlowMutate`

```tsx
Expand Down