Skip to content

Add react hooks for transaction-planning and -sending - #1869

Merged
mcintyre94 merged 1 commit into
mainfrom
instruction-plan-hooks
Aug 5, 2026
Merged

Add react hooks for transaction-planning and -sending#1869
mcintyre94 merged 1 commit into
mainfrom
instruction-plan-hooks

Conversation

@mcintyre94

@mcintyre94 mcintyre94 commented Jul 30, 2026

Copy link
Copy Markdown
Member

Summary of Changes

This PR adds hooks for the functions from ClientWithTransactionPlanning and ClientWithTransactionSending to the @solana/react package

  • usePlanTransaction
  • usePlanTransactions
  • useSendTransaction
  • useSendTransactions

All are just useAction-shaped wrappers around these client functions. As with the wallet hooks, they take a client with the required plugin as a param.

@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4b5f5bb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 48 packages
Name Type
@solana/react Major
@solana/accounts Major
@solana/addresses Major
@solana/assertions Major
@solana/codecs-core Major
@solana/codecs-data-structures Major
@solana/codecs-numbers Major
@solana/codecs-strings Major
@solana/codecs Major
@solana/compat Major
@solana/errors Major
@solana/fast-stable-stringify Major
@solana/fixed-points Major
@solana/functional Major
@solana/instruction-plans Major
@solana/instructions Major
@solana/keys Major
@solana/kit Major
@solana/nominal-types Major
@solana/offchain-messages Major
@solana/options Major
@solana/plugin-core Major
@solana/plugin-interfaces Major
@solana/program-client-core Major
@solana/programs Major
@solana/promises Major
@solana/rpc-api Major
@solana/rpc-graphql Major
@solana/rpc-parsed-types Major
@solana/rpc-spec-types Major
@solana/rpc-spec Major
@solana/rpc-subscriptions-api Major
@solana/rpc-subscriptions-channel-websocket Major
@solana/rpc-subscriptions-spec Major
@solana/rpc-subscriptions Major
@solana/rpc-transformers Major
@solana/rpc-transport-http Major
@solana/rpc-types Major
@solana/rpc Major
@solana/signers Major
@solana/subscribable Major
@solana/sysvars Major
@solana/transaction-confirmation Major
@solana/transaction-introspection Major
@solana/transaction-messages Major
@solana/transactions Major
@solana/wallet-account-signer Major
@solana/webcrypto-ed25519-polyfill Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@bundlemon

bundlemon Bot commented Jul 30, 2026

Copy link
Copy Markdown

BundleMon

Files updated (3)
Status Path Size Limits
react/dist/index.browser.mjs
5.13KB (+106B +2.06%) -
react/dist/index.native.mjs
5.12KB (+106B +2.06%) -
react/dist/index.node.mjs
5.12KB (+105B +2.04%) -
Unchanged files (147)
Status Path Size Limits
@solana/kit production bundle
kit/dist/index.production.min.js
55.54KB -
errors/dist/index.node.mjs
21.6KB -
errors/dist/index.browser.mjs
21.58KB -
errors/dist/index.native.mjs
21.58KB -
rpc-graphql/dist/index.browser.mjs
18.82KB -
rpc-graphql/dist/index.native.mjs
18.82KB -
rpc-graphql/dist/index.node.mjs
18.82KB -
wallet-account-signer/dist/index.node.mjs
18.31KB -
wallet-account-signer/dist/index.browser.mjs
18.29KB -
wallet-account-signer/dist/index.native.mjs
18.29KB -
transaction-messages/dist/index.browser.mjs
11.34KB -
transaction-messages/dist/index.native.mjs
11.34KB -
transaction-messages/dist/index.node.mjs
11.34KB -
instruction-plans/dist/index.browser.mjs
7.02KB -
instruction-plans/dist/index.native.mjs
7.02KB -
instruction-plans/dist/index.node.mjs
7.02KB -
codecs-data-structures/dist/index.browser.mjs
5.29KB -
codecs-data-structures/dist/index.native.mjs
5.29KB -
codecs-data-structures/dist/index.node.mjs
5.29KB -
fixed-points/dist/index.browser.mjs
5.08KB -
fixed-points/dist/index.native.mjs
5.07KB -
fixed-points/dist/index.node.mjs
5.07KB -
offchain-messages/dist/index.browser.mjs
5.06KB -
offchain-messages/dist/index.native.mjs
5.06KB -
offchain-messages/dist/index.node.mjs
5.06KB -
kit/dist/index.browser.mjs
4.61KB -
kit/dist/index.native.mjs
4.6KB -
kit/dist/index.node.mjs
4.6KB -
transactions/dist/index.browser.mjs
4.07KB -
transactions/dist/index.native.mjs
4.07KB -
transactions/dist/index.node.mjs
4.07KB -
codecs-core/dist/index.browser.mjs
3.62KB -
codecs-core/dist/index.native.mjs
3.62KB -
codecs-core/dist/index.node.mjs
3.62KB -
webcrypto-ed25519-polyfill/dist/index.node.mj
s
3.61KB -
webcrypto-ed25519-polyfill/dist/index.browser
.mjs
3.59KB -
webcrypto-ed25519-polyfill/dist/index.native.
mjs
3.57KB -
rpc-subscriptions/dist/index.browser.mjs
3.37KB -
rpc-subscriptions/dist/index.node.mjs
3.34KB -
rpc-subscriptions/dist/index.native.mjs
3.31KB -
signers/dist/index.browser.mjs
3.26KB -
signers/dist/index.native.mjs
3.26KB -
signers/dist/index.node.mjs
3.26KB -
rpc-transformers/dist/index.browser.mjs
3.16KB -
rpc-transformers/dist/index.native.mjs
3.16KB -
rpc-transformers/dist/index.node.mjs
3.15KB -
subscribable/dist/index.node.mjs
3.13KB -
keys/dist/index.node.mjs
3.06KB -
subscribable/dist/index.native.mjs
3.06KB -
subscribable/dist/index.browser.mjs
3.05KB -
addresses/dist/index.browser.mjs
2.93KB -
addresses/dist/index.native.mjs
2.92KB -
addresses/dist/index.node.mjs
2.92KB -
keys/dist/index.browser.mjs
2.85KB -
keys/dist/index.native.mjs
2.85KB -
transaction-introspection/dist/index.browser.
mjs
2.73KB -
transaction-introspection/dist/index.native.m
js
2.73KB -
transaction-introspection/dist/index.node.mjs
2.73KB -
codecs-strings/dist/index.browser.mjs
2.55KB -
codecs-strings/dist/index.node.mjs
2.51KB -
codecs-strings/dist/index.native.mjs
2.47KB -
transaction-confirmation/dist/index.node.mjs
2.42KB -
transaction-confirmation/dist/index.native.mj
s
2.37KB -
sysvars/dist/index.browser.mjs
2.37KB -
sysvars/dist/index.native.mjs
2.37KB -
transaction-confirmation/dist/index.browser.m
js
2.37KB -
sysvars/dist/index.node.mjs
2.37KB -
rpc-subscriptions-spec/dist/index.node.mjs
2.23KB -
rpc-subscriptions-spec/dist/index.native.mjs
2.19KB -
rpc-subscriptions-spec/dist/index.browser.mjs
2.19KB -
rpc/dist/index.node.mjs
1.95KB -
codecs-numbers/dist/index.browser.mjs
1.95KB -
codecs-numbers/dist/index.native.mjs
1.95KB -
codecs-numbers/dist/index.node.mjs
1.94KB -
rpc-types/dist/index.browser.mjs
1.9KB -
rpc-types/dist/index.native.mjs
1.9KB -
rpc-types/dist/index.node.mjs
1.9KB -
rpc-transport-http/dist/index.browser.mjs
1.89KB -
rpc-transport-http/dist/index.native.mjs
1.89KB -
rpc/dist/index.native.mjs
1.81KB -
rpc/dist/index.browser.mjs
1.8KB -
rpc-transport-http/dist/index.node.mjs
1.71KB -
rpc-subscriptions-channel-websocket/dist/inde
x.node.mjs
1.33KB -
rpc-subscriptions-channel-websocket/dist/inde
x.native.mjs
1.27KB -
rpc-subscriptions-channel-websocket/dist/inde
x.browser.mjs
1.26KB -
program-client-core/dist/index.browser.mjs
1.21KB -
program-client-core/dist/index.native.mjs
1.21KB -
program-client-core/dist/index.node.mjs
1.21KB -
plugin-core/dist/index.browser.mjs
1.18KB -
plugin-core/dist/index.native.mjs
1.18KB -
plugin-core/dist/index.node.mjs
1.18KB -
options/dist/index.browser.mjs
1.18KB -
options/dist/index.native.mjs
1.18KB -
options/dist/index.node.mjs
1.17KB -
accounts/dist/index.browser.mjs
1.17KB -
accounts/dist/index.native.mjs
1.17KB -
accounts/dist/index.node.mjs
1.16KB -
rpc-spec-types/dist/index.browser.mjs
1.15KB -
rpc-spec-types/dist/index.native.mjs
1.15KB -
rpc-spec-types/dist/index.node.mjs
1.15KB -
rpc-api/dist/index.browser.mjs
1.04KB -
rpc-api/dist/index.native.mjs
1.04KB -
rpc-api/dist/index.node.mjs
1.04KB -
compat/dist/index.browser.mjs
969B -
compat/dist/index.native.mjs
968B -
compat/dist/index.node.mjs
966B -
rpc-spec/dist/index.browser.mjs
898B -
rpc-spec/dist/index.native.mjs
897B -
rpc-spec/dist/index.node.mjs
896B -
rpc-subscriptions-api/dist/index.native.mjs
871B -
rpc-subscriptions-api/dist/index.browser.mjs
870B -
rpc-subscriptions-api/dist/index.node.mjs
870B -
promises/dist/index.native.mjs
841B -
promises/dist/index.node.mjs
840B -
promises/dist/index.browser.mjs
839B -
assertions/dist/index.browser.mjs
783B -
instructions/dist/index.browser.mjs
771B -
instructions/dist/index.native.mjs
770B -
instructions/dist/index.node.mjs
768B -
fast-stable-stringify/dist/index.browser.mjs
726B -
fast-stable-stringify/dist/index.native.mjs
725B -
assertions/dist/index.native.mjs
724B -
fast-stable-stringify/dist/index.node.mjs
724B -
assertions/dist/index.node.mjs
723B -
programs/dist/index.browser.mjs
329B -
programs/dist/index.native.mjs
327B -
programs/dist/index.node.mjs
325B -
fs-impl/dist/index.browser.mjs
245B -
event-target-impl/dist/index.node.mjs
230B -
functional/dist/index.browser.mjs
154B -
functional/dist/index.native.mjs
152B -
text-encoding-impl/dist/index.native.mjs
152B -
functional/dist/index.node.mjs
151B -
codecs/dist/index.browser.mjs
145B -
codecs/dist/index.native.mjs
144B -
codecs/dist/index.node.mjs
142B -
event-target-impl/dist/index.browser.mjs
133B -
ws-impl/dist/index.node.mjs
131B -
text-encoding-impl/dist/index.browser.mjs
122B -
fs-impl/dist/index.node.mjs
120B -
text-encoding-impl/dist/index.node.mjs
119B -
ws-impl/dist/index.browser.mjs
113B -
crypto-impl/dist/index.node.mjs
111B -
crypto-impl/dist/index.browser.mjs
109B -
rpc-parsed-types/dist/index.browser.mjs
66B -
rpc-parsed-types/dist/index.native.mjs
65B -
rpc-parsed-types/dist/index.node.mjs
63B -

Total files change +317B +0.06%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@mcintyre94

Copy link
Copy Markdown
Member Author

@trevor-cortex

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Documentation Preview: https://kit-docs-1kwzd706s-anza-tech.vercel.app

@trevor-cortex trevor-cortex 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.

Adds four new hooks (usePlanTransaction, usePlanTransactions, useSendTransaction, useSendTransactions) that wrap the corresponding methods on ClientWithTransactionPlanning / ClientWithTransactionSending as useAction-based reactive actions. Each is a ~one-line delegation into useAction((abortSignal, input) => client.method(input, { abortSignal })), plus tests, typetests, README, and a minor changeset.

The pattern matches the design goals set up by useAction — fresh AbortSignal per dispatch, supersede-aborts-previous, stale-while-revalidate on data/error. Because the hooks are so thin, the real coverage is useAction's own; the added tests just verify the plumbing (input forwarded, signal injected, resolve/reject surfaced), which is the right scope. Docs are thorough — JSDoc has @param / @returns / @example / @see, README has a grouped section with a runnable snippet.

One consistency nit worth flagging (inline): the send-hook typetests use ActionResult<never, ...> where the plan-hook typetests use precise ActionResult<[input: ...], ...>. Both compile, but the never variant is a weaker assertion. Non-blocking.

Notes for subsequent reviewers

  • Input unions are duplicated from the client method signatures. useSendTransaction re-declares InstructionPlanInput | SingleTransactionPlan | SingleTransactionPlan['message'], and useSendTransactions re-declares InstructionPlanInput | TransactionPlanInput. If the client methods in kit-plugins grow another accepted input shape, these hooks (and their typetests) will silently narrow the accepted set. Worth confirming these unions match the current ClientWithTransactionSending definitions in kit-plugins, and consider whether deriving via Parameters<typeof client.sendTransaction>[0] would be more future-proof.
  • README section deviates slightly from the surrounding style. The other hooks in this file each get their own H3; this PR groups the four new ones under a single "Transaction planning & sending" H3 with a bullet list. Reads fine, but if the intent is to give each hook a dedicated API-reference entry, four sub-headings would match the pattern.

Overall LGTM — behavior is correct, follows the established useAction shape, docs and changeset are in order. (Would approve if I had write access; leaving as a comment review.)

Comment thread packages/react/src/__typetests__/useSendTransaction-typetest.ts Outdated
Comment thread packages/react/src/useSendTransactions.ts Outdated

mcintyre94 commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

Merge activity

  • Aug 4, 4:15 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Aug 4, 4:16 PM UTC: Graphite couldn't merge this pull request because a downstack PR Make the type param in useClient non-optional #1841 failed to merge.
  • Aug 4, 5:11 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Aug 4, 5:12 PM UTC: Graphite couldn't merge this pull request because a downstack PR Update the react-app example to use the wallet plugin #1825 failed to merge.
  • Aug 5, 7:47 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Aug 5, 8:05 AM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 5, 8:16 AM UTC: Graphite couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'Build Documentation Preview').
  • Aug 5, 4:53 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Aug 5, 4:54 PM UTC: @mcintyre94 merged this pull request with Graphite.

@mcintyre94
mcintyre94 force-pushed the instruction-plan-hooks branch from 8da5a8a to eb09af5 Compare August 4, 2026 16:21
@mcintyre94
mcintyre94 force-pushed the react-app-simplify-chain branch from 8458772 to 119873a Compare August 4, 2026 16:21
@mcintyre94
mcintyre94 changed the base branch from react-app-simplify-chain to graphite-base/1869 August 5, 2026 07:48
@mcintyre94
mcintyre94 changed the base branch from graphite-base/1869 to main August 5, 2026 08:03
@mcintyre94
mcintyre94 force-pushed the instruction-plan-hooks branch from eb09af5 to 4b5f5bb Compare August 5, 2026 08:04
@mcintyre94
mcintyre94 merged commit 2193459 into main Aug 5, 2026
14 of 15 checks passed
@mcintyre94
mcintyre94 deleted the instruction-plan-hooks branch August 5, 2026 16:54
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🔎💬 Inkeep AI search and chat service is syncing content for source 'Solana Kit Docs'

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