Skip to content

Support transaction-introspection for more RPC responses - #1814

Merged
mcintyre94 merged 2 commits into
mainfrom
gtfa-introspect
Jul 13, 2026
Merged

Support transaction-introspection for more RPC responses#1814
mcintyre94 merged 2 commits into
mainfrom
gtfa-introspect

Conversation

@mcintyre94

@mcintyre94 mcintyre94 commented Jul 2, 2026

Copy link
Copy Markdown
Member

Problem

The new transaction-introspection API is currently tied to the getTransaction RPC response, but other RPC methods also return the same shape transactions.

Summary of Changes

Generalise the shape so that the transactions returned by getBlock and the new getTransactionsForAddress also satisfy it and can be decoded/parsed.

Fixes #1785

@changeset-bot

changeset-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bec07ce

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

This PR includes changesets to release 48 packages
Name Type
@solana/transaction-introspection Major
@solana/kit Major
@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/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-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

mcintyre94 commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

@bundlemon

bundlemon Bot commented Jul 2, 2026

Copy link
Copy Markdown

BundleMon

Files updated (7)
Status Path Size Limits
@solana/kit production bundle
kit/dist/index.production.min.js
54.96KB (+88B +0.16%) -
rpc-api/dist/index.browser.mjs
1.04KB (+48B +4.73%) -
rpc-api/dist/index.native.mjs
1.04KB (+48B +4.73%) -
rpc-api/dist/index.node.mjs
1.04KB (+48B +4.74%) -
transaction-introspection/dist/index.native.m
js
2.73KB (-19B -0.67%) -
transaction-introspection/dist/index.node.mjs
2.73KB (-19B -0.67%) -
transaction-introspection/dist/index.browser.
mjs
2.73KB (-20B -0.71%) -
Unchanged files (143)
Status Path Size Limits
errors/dist/index.node.mjs
21.55KB -
errors/dist/index.browser.mjs
21.53KB -
errors/dist/index.native.mjs
21.52KB -
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.28KB -
wallet-account-signer/dist/index.browser.mjs
18.26KB -
wallet-account-signer/dist/index.native.mjs
18.26KB -
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.3KB -
codecs-data-structures/dist/index.native.mjs
5.3KB -
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 -
react/dist/index.browser.mjs
5.02KB -
react/dist/index.node.mjs
5.02KB -
react/dist/index.native.mjs
5.02KB -
kit/dist/index.browser.mjs
4.6KB -
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 -
keys/dist/index.node.mjs
3.06KB -
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 -
subscribable/dist/index.node.mjs
2.8KB -
subscribable/dist/index.native.mjs
2.73KB -
subscribable/dist/index.browser.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 -
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 -
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 -
plugin-core/dist/index.browser.mjs
799B -
plugin-core/dist/index.native.mjs
798B -
plugin-core/dist/index.node.mjs
796B -
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 +174B +0.03%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@mcintyre94

Copy link
Copy Markdown
Member Author

@trevor-cortex

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

Summary

Generalises decodeTransactionFromRpcResponse so it no longer takes method-specific GetTransaction* types. Instead it takes two structural shapes (DecodableWireTransactionResponse / DecodableJsonTransactionResponse) that model only the transaction / meta / version fields actually read. That's a clean refactor: it decouples the decoder from @solana/rpc-api, lets getBlock and getTransactionsForAddress results flow through unchanged, and simplifies the overload set from three type-parameter-heavy signatures to two straightforward ones.

The wire-vs-JSON split on the shape of transaction (base-encoded tuple vs. { message: … }) keeps overload resolution unambiguous per encoding. Tightening the JSON return to transaction?: never is a nice bit of extra rigour — it was previously typed as an optional Transaction, which the JSON path never actually produces.

Good catch on rpcTx.version ?? 'legacy' vs. the old 'version' in rpcTx check: with version now a declared optional key on the input type, the in check would return true even when the property is undefined. The ?? (not ||) note in the comment is right — 0 is a legitimate version.

The new runtime test that includes slot / blockTime / transactionIndex on the input object is a good addition. And deriving the typetest inputs from the real GetTransactionsForAddressApi / GetBlockApi result types (rather than hand-written literals) is the right call to avoid excess-property-check false negatives.

Things to watch out for

1. @solana/rpc-types should probably move to dependencies. The source now imports Base58EncodedBytes, Base58EncodedDataResponse, Base64EncodedDataResponse, and Blockhash at the type level, and those references leak into the emitted .d.ts via the exported overload signatures (through DecodableWireTransactionResponse / DecodableJsonTransactionResponse). It's currently in devDependencies only. Compare @solana/transaction-messages/package.json, which lists @solana/rpc-types as a runtime dependency for the same reason. Consumers of @solana/transaction-introspection who happen to not already have @solana/rpc-types installed would get a broken types resolution.

2. Conversely, @solana/rpc-api may no longer belong in dependencies. After this PR, the source file no longer imports anything from @solana/rpc-api — only the tests and typetests do. Consider demoting it to devDependencies. (Worth double-checking the rest of the package's src/ first — I only inspected the file changed here.)

3. getBlock with encoding: 'json' + maxSupportedTransactionVersion is not covered by the typetest, and I suspect it wouldn't type-check today. TransactionForFullTransactionAddressTableLookups in @solana/rpc-types declares addressTableLookups?: readonly AddressTableLookup[] | null (nullable), but DecodableJsonTransactionResponse.message.addressTableLookups? is not nullable. So rpc.getBlock(slot, { encoding: 'json', maxSupportedTransactionVersion: 0, transactionDetails: 'full' }).transactions[i] should be rejected by the overload as an argument. The changeset text advertises getBlock results decoding, so this gap is worth either closing (widen the field to | null and let the existing message.addressTableLookups ? ... : [] guard handle null — which it already does, since null is falsy) or explicitly documenting. Adding a typetest case for it would be the surest way to lock in the behaviour.

4. Changeset bump level. minor may or may not be right. The removed overloads (previously typed as GetTransactionApiResponseBase64<...> etc.) are gone from the public surface; anyone who typed a variable as Parameters<typeof decodeTransactionFromRpcResponse>[0] would see a different shape. And the JSON overload's transaction narrowing from ?: Transaction to ?: never will break code that read that field expecting Transaction | undefined. Both are arguably user-code bugs the new types now catch, but they're observable API changes. Given the package is at 7.0.0 and part of the fixed release group, a maintainer sanity-check on minor vs. major seems worthwhile — happy to defer to whatever the project's precedent is.

Notes for subsequent reviewers

  • Please double-check point (3) — I reasoned through it from the type sources but didn't actually run tsc against a real getBlock versioned-JSON call. If you have the repo checked out, adding one line to the typetest for that shape will confirm it in seconds.
  • Worth verifying the @solana/rpc-api demotion in point (2) against the full packages/transaction-introspection/src/ tree, not just this file, before acting on it.
  • Everything else is straightforward and reads well. The new comment on getLoadedAddresses correctly captures why the runtime extraction still needs to be defensive even after the type generalisation.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

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

Generalise the shape so that the transactions returned by `getBlock` and
`getTransactionsForAddress` also satisfy it and can be decoded/parsed.
@mcintyre94

Copy link
Copy Markdown
Member Author
  1. @solana/rpc-types should probably move to dependencies.

Agreed, added

  1. Conversely, @solana/rpc-api may no longer belong in dependencies.

Agreed, removed the last import of GetTransactionApiResponseBase64 and moved to devDependencies

  1. getBlock with encoding: 'json' + maxSupportedTransactionVersion is not covered by the typetest, and I suspect it wouldn't type-check today.

Added a typetest, and made addressTableLookups nullable

  1. Changeset bump level. minor may or may not be right.

I think this is fine. The change widens the type, and the flagged breakages are user-code bugs as mentioned.

@mcintyre94
mcintyre94 marked this pull request as ready for review July 6, 2026 09:21
@mcintyre94
mcintyre94 requested a review from lorisleiva July 6, 2026 10:13
"@solana/errors": "workspace:*",
"@solana/instructions": "workspace:*",
"@solana/rpc-api": "workspace:*",
"@solana/rpc-types": "workspace:*",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice!

Base automatically changed from gtfa to main July 13, 2026 12:18
@mcintyre94
mcintyre94 added this pull request to the merge queue Jul 13, 2026
Merged via the queue into main with commit c45d5e0 Jul 13, 2026
14 checks passed
@mcintyre94
mcintyre94 deleted the gtfa-introspect branch July 13, 2026 12:51
@github-actions github-actions Bot mentioned this pull request Jul 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transaction-introspection for getTransactionsForAddress

3 participants