Skip to content

docs(frontend): adopt useTrackedDataSWR, useAction, and SOL/lamports helpers - #63

Merged
amilz merged 3 commits into
mainfrom
docs/frontend-tracked-data-swr
Aug 7, 2026
Merged

docs(frontend): adopt useTrackedDataSWR, useAction, and SOL/lamports helpers#63
amilz merged 3 commits into
mainfrom
docs/frontend-tracked-data-swr

Conversation

@amilz

@amilz amilz commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Updates the frontend and React references for @solana/kit 7 / @solana/react 7. Incorporates feedback from Callum McIntyre on the Kit team; both of his suggestions are already applied upstream in solana-foundation/templates (use-balance.ts, use-send.tsx), so this brings the skill in line.

Closes DEV-845

What changed

references/frontend.md

  • Live account data (balances, token accounts) now documented via useTrackedDataSWR, modeled on the Kit example app's Balance.tsx. Previously the docs described the problem but left the reader to hand-roll a getBalance + accountNotifications pair.
  • Transaction sending rewritten around useAction, replacing the bare async function and a stale "Kit will ship dedicated hooks shortly" note.
  • Added swr / @tanstack/react-query to the dependency list as the optional peer deps of the adapter subpaths.

references/kit/react.md — expanded the data-hooks table into real useTrackedData / useTrackedDataSWR and useAction sections. This file is now the canonical hook reference; frontend.md keeps app-shaped examples and links here.

references/kit/overview.md — new SOL ↔ Lamports section covering sol, solToLamports, lamportsToSol, and formatDecimalFixedPoint.

SKILL.md — links kit/react.md directly. It was previously reachable only via kit/overview.md, which is likely why the hook content got duplicated in the first place.

Bugs fixed along the way

  • frontend.md passed sol('0.01') as an instruction amount. sol() returns a fixed-point object ({ raw, decimals, ... }), not a bigint, so the example could not have worked. Now solToLamports(sol('0.01')).
  • useSelectAccount was listed as an action hook returning dispatch. It is synchronous and returns the bound selectAccount function directly — const { dispatch } = useSelectAccount(client) would yield undefined.

Verification

Every referenced API was checked against the installed .d.ts files, and all snippets were compiled in a scratch project (@solana/kit@7.0.0, @solana/react@7.0.0, @solana/kit-plugin-{rpc,wallet}, @solana-program/system, tsc 7.0.2, strict) — clean.

@linear

linear Bot commented Aug 7, 2026

Copy link
Copy Markdown

DEV-845

@greptile-apps

greptile-apps Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This documentation update modernizes the Solana frontend guidance for Kit and React v7.

  • Replaces hand-rolled transaction and live-data patterns with useAction and useTrackedDataSWR.
  • Documents SOL/Lamports conversion and formatting helpers.
  • Adds a direct link to the expanded React bindings reference.

Confidence Score: 4/5

The documentation changes appear sound, but the unsigned commits must be replaced with verified commits before merging.

The previously reported abort-signal issue is fixed by forwarding the signal to sendTransaction, but all commits currently in the PR report no signature and therefore still violate the repository’s verified-commit requirement.

Important Files Changed

Filename Overview
skills/solana-dev/SKILL.md Adds the Kit React bindings reference to the skill’s frontend documentation index.
skills/solana-dev/references/frontend.md Updates application-oriented examples for cancellable transaction sending, tracked balance data, and SOL formatting.
skills/solana-dev/references/kit/overview.md Adds guidance for converting and formatting SOL and Lamports fixed-point values.
skills/solana-dev/references/kit/react.md Expands the canonical React reference with tracked-data adapters, useAction, and corrected wallet-hook semantics.

Reviews (4): Last reviewed commit: "docs(kit): drop unreleased v8 transactio..." | Re-trigger Greptile

Comment thread skills/solana-dev/SKILL.md
Comment thread skills/solana-dev/references/frontend.md
…helpers

Incorporates Kit team feedback on the React reference:
- balance/live account data now documented via useTrackedDataSWR, matching
  the Kit example app, instead of a hand-rolled fetch + subscription pair
- transaction sending wrapped in useAction for lifecycle state and
  abort-on-resend
- sol/solToLamports/lamportsToSol/formatDecimalFixedPoint documented; fixes
  a broken example that passed a Sol fixed-point value where an instruction
  expects Lamports

All snippets typecheck against @solana/kit 7.0.0, @solana/react 7.0.0, and
tsc 7.0.2 under strict mode.
@amilz
amilz force-pushed the docs/frontend-tracked-data-swr branch from ed422bf to 772740a Compare August 7, 2026 00:45
@amilz

amilz commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks — one applied, one is a false positive.

P2, abort signal discarded — fixed in 772740a. Correct catch: the prose promised abort-on-resend while the example dropped the signal, and kit/react.md already passed it, so the two files disagreed. client.sendTransaction takes { abortSignal } in its config (verified against @solana/plugin-interfaces), so it's now forwarded with a comment explaining why.

P1, unsigned commit — not reproducible. Both ed422bf (the commit you reviewed) and 772740a are SSH-signed and report verified via the API:

gh api repos/solana-foundation/solana-dev-skill/commits/772740a --jq '.commit.verification'
{"reason": "valid", "verified": true}

Signing is on (commit.gpgsign=true, gpg.format=ssh). Local git log --show-signature does error with gpg.ssh.allowedSignersFile needs to be configured, but that's a missing local verification config, not a missing signature — worth knowing in case that's the signal being read.

@mcintyre94 mcintyre94 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Comment thread skills/solana-dev/references/kit/react.md Outdated
Comment thread skills/solana-dev/references/kit/react.md Outdated
Comment thread skills/solana-dev/references/frontend.md
amilz added 2 commits August 7, 2026 06:18
…rcing

Addresses review feedback from the Kit team:
- note that useTrackedData/useRequest/useSubscription each have SWR and
  TanStack Query counterparts
- @solana/promises is re-exported from @solana/kit as of v8; the explicit
  install is only needed on v7
- add the useSendTransaction / useSendTransactions / usePlanTransaction /
  usePlanTransactions hooks landing in v8, with the useAction pattern kept
  as the v7 path
The useSendTransaction family is merged on kit main but not published.
Documenting it risks agents importing exports that do not resolve against
the v7 baseline the skill targets.

@dev-jodee dev-jodee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs(frontend): adopt useTrackedDataSWR, useAction, and SOL/lamports helpers. Greptile review green. Approved.

@amilz
amilz merged commit d4ecf16 into main Aug 7, 2026
1 check passed
@amilz
amilz deleted the docs/frontend-tracked-data-swr branch August 7, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants