Skip to content

Add getTransactionsForAddress to RPC API - #1776

Merged
mcintyre94 merged 1 commit into
mainfrom
gtfa
Jul 13, 2026
Merged

Add getTransactionsForAddress to RPC API#1776
mcintyre94 merged 1 commit into
mainfrom
gtfa

Conversation

@mcintyre94

Copy link
Copy Markdown
Member

Problem

It's not part of the JSON-RPC spec, but most major RPC providers have getTransactionsForAddress. The types are complex and annoying to use without a Kit helper.

Summary of Changes

This PR adds getTransactionsForAddress to the Kit RPC.

While this isn't part of the current spec or the Agave RPC, it's part of the new RPC spec and is already widely supported.

The refactor pulls the shared types from getTransaction.

Also added meta.costUnits: bigint to both getTransaction and getTransactionsForAddress, see https://solana.com/docs/rpc/http/gettransaction

See:

@changeset-bot

changeset-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b961e5a

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

This PR includes changesets to release 48 packages
Name Type
@solana/rpc-api Major
@solana/kit Major
@solana/program-client-core Major
@solana/rpc Major
@solana/sysvars Major
@solana/transaction-introspection Major
@solana/react Major
@solana/rpc-graphql Major
@solana/transaction-confirmation 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/programs Major
@solana/promises 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/signers Major
@solana/subscribable 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

Copy link
Copy Markdown
Member Author

@trevor-cortex

@bundlemon

bundlemon Bot commented Jun 22, 2026

Copy link
Copy Markdown

BundleMon

Files updated (4)
Status Path Size Limits
@solana/kit production bundle
kit/dist/index.production.min.js
54.95KB (+80B +0.14%) -
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%) -
Unchanged files (146)
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 -
transaction-introspection/dist/index.browser.
mjs
2.75KB -
transaction-introspection/dist/index.native.m
js
2.75KB -
transaction-introspection/dist/index.node.mjs
2.75KB -
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 +224B +0.04%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@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

Adds GetTransactionsForAddressApi to @solana/rpc-api, exposing the new method that combines getSignaturesForAddress-style address-history discovery with getTransaction-style per-transaction fetching, plus server-side filtering, bidirectional sorting, and cursor-based pagination. As part of the change, the shared transaction-meta types (TransactionMetaBase, TransactionJson/TransactionJsonParsed, inner-instruction/loaded-address shapes, etc.) move out of getTransaction.ts into a new transaction-meta.ts module so they can be reused by both methods, and an optional meta.costUnits: bigint field is added — which now also surfaces on getTransaction.

The extraction itself is mechanical and looks clean: the moved types are byte-identical to the originals, just re-exported (now public types in transaction-meta.ts) and re-imported by getTransaction.ts. Index wiring (SolanaRpcApiForAllClusters, exports, numeric-keypath entries) is consistent with the existing patterns for getTransaction and getSignaturesForAddress.

Things to watch out for

  • version is not surfaced on full-mode responses. Compare getTransaction, which conditionally adds version: TransactionVersion when maxSupportedTransactionVersion is set. The full-mode return types here omit it entirely, even though the underlying response per the spec/Helius/Triton docs includes version for versioned transactions. Worth confirming whether this was intentional or an oversight — see inline comment.
  • OptionalTransactionAddressTableLookups and Partial<TransactionMetaLoadedAddresses> are always-optional, regardless of maxSupportedTransactionVersion. getTransaction keys these off the type parameter (required when versioned, absent when legacy-only). This PR takes a more permissive stance — the fields are always optional. Defensible, but worth flagging as a deliberate divergence from the getTransaction modeling.
  • limit default doc may be incomplete. Helius docs note a cap of 100 for transactionDetails: 'full' vs 1000 for signatures. The JSDoc currently states a single 1000 cap. If providers cap full-mode lower, callers may be surprised.
  • Overload resolution for invalid combinations. The overloads correctly require transactionDetails: 'full' when encoding is one of the full encodings, but there's no typetest covering what happens if a caller passes { encoding: 'jsonParsed' } without transactionDetails. Excess-property checks should catch this on object literals, but a @ts-expect-error test would lock the behavior in.
  • No runtime tests. getTransaction has all-it.todo tests too, so this is the established pattern in this package — coverage is provided by the typetest. Calling that out so subsequent reviewers don't go looking for unit tests.

Notes for subsequent reviewers

  • The transaction-meta.ts extraction makes previously-private types part of the package's public surface (they're not exported from index.ts, but the module is now importable from the package by virtue of being a non-private .ts file). That's not necessarily wrong, but worth being aware of — any future changes to these shapes are now potentially observable.
  • The costUnits field addition is a soft user-visible change on getTransaction too. The changeset (correctly) calls this out and the bump level is minor, which is appropriate.
  • Allowed-numeric-keypath entries for getTransactionsForAddress are a straight port of the getTransaction entries with a ['data', KEYPATH_WILDCARD, ...] prefix — looks correct given the response envelope shape.
  • Worth a second pair of eyes on the spec mapping (filters, sortOrder enum, status enum values, paginationToken semantics) against the superbank source-of-truth linked in the PR description, since that's the canonical reference and providers differ in the details they document.

@trevor-cortex

Copy link
Copy Markdown

Missing version field on full-mode responses?

GetTransactionsForAddressFullBase doesn't surface version, and none of the full-mode return types intersect it in either. Compare GetTransactionApi, which adds version: TransactionVersion to the response when maxSupportedTransactionVersion is set:

// getTransaction.ts
(TMaxSupportedTransactionVersion extends void
    ? Record<string, never>
    : { version: TransactionVersion })

The Helius/Triton/superbank docs all show version in the per-transaction payload for versioned transactions, so callers will likely want to read it. Was this an intentional omission, or should the full-mode results include version: TransactionVersion (possibly gated on maxSupportedTransactionVersion like getTransaction)?

(Anchoring here on GetTransactionsForAddressFullBase; same point applies to all four full-mode overloads further down.)

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

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

@mcintyre94

Copy link
Copy Markdown
Member Author

Excluding version was intentional because that's the current behaviour of Superbank and the Triton docs don't mention it, but Helius does include it. I've opened a PR to add it to Superbank: solana-rpc/superbank#20

If that gets merged then we can add the version field, and it'll align with getTransaction. I'll hold this in draft for now.

@mcintyre94

Copy link
Copy Markdown
Member Author

Updated after solana-rpc/superbank#20 was merged, we now include version: TransactionVersion when maxSupportedTransactionVersion is set.

Please re-review this PR @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.

Re-review — LGTM (posting as COMMENT since I can't APPROVE without repo access).

The main open point from my prior pass was that version (and the other version-gated fields) needed to be conditional on maxSupportedTransactionVersion. That's now modelled correctly:

  • Each full encoding has a paired legacy / version-specified overload. The version-specified overloads intersect in GetTransactionsForAddressVersion (version: TransactionVersion), TransactionMetaLoadedAddresses, and TransactionAddressTableLookups; the legacy overloads omit all three.
  • The typetest asserts the presence/absence in both directions with @ts-expect-error on version, addressTableLookups, and meta.loadedAddresses for each of json / jsonParsed / base58 / base64. Nice coverage.
  • The signatures overload sits last and correctly rejects encoding and processed commitment via the negative tests.

Other things I re-checked and am happy with:

  • limit caps are now documented (1000 signatures / 100 full).
  • paginationToken format is documented as "<slot>:<position>", matching the example in the typetest.
  • Response envelope ({ data, paginationToken }) is intentionally bare (not context/value), and the typetest calls that out explicitly.
  • transaction-meta.ts extraction is internal only — none of those types are re-exported from packages/rpc-api/src/index.ts, so the public surface remains just GetTransactionsForAddressApi. Good call keeping them un-exported.
  • Keypath registration for getTransactionsForAddress mirrors getTransaction's exactly (transposed under ['data', KEYPATH_WILDCARD, ...]) and additionally covers transactionIndex, which is the non-obvious one.
  • meta.costUnits on getTransaction is optional, so it's a non-breaking widening. Flagged in the changeset — good.
  • Exclude<TransactionVersion, 'legacy'> for maxSupportedTransactionVersion is a nice constraint that lines up with the existing getTransaction semantics ("set to 0 to include version-0").

Two very small things, none blocking:

  1. getTransaction uses a generic TMaxSupportedTransactionVersion parameter with conditional types; getTransactionsForAddress doubles the overloads (legacy + version-specified) with concrete configs. Both work — the doubled form gives clearer per-case JSDoc, so I don't think it's worth changing, but it does mean the two files now diverge in style. Worth being aware of if a third method ever wants to pick a house pattern.
  2. minContextSlot is in the common config but I didn't verify against the superbank source-of-truth that it's actually a supported knob for this method (the linked Triton/Helius docs don't mention it either way). Worth a quick sanity check before merge, but low risk — extra fields are typically ignored server-side.

Happy to see this go in. Nice work on the version modelling and the typetest expansion — the negative assertions make the intent unambiguous.

Copy link
Copy Markdown
Member Author

@mcintyre94

Copy link
Copy Markdown
Member Author

Confirmed that minContextSlot is supported by the superbank source.

@mcintyre94
mcintyre94 marked this pull request as ready for review July 6, 2026 07:48
@mcintyre94
mcintyre94 requested a review from lorisleiva July 6, 2026 07:48

@lorisleiva lorisleiva left a comment

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, thanks for that!

@mcintyre94
mcintyre94 added this pull request to the merge queue Jul 13, 2026
Merged via the queue into main with commit c8235ca Jul 13, 2026
14 checks passed
@mcintyre94
mcintyre94 deleted the gtfa branch July 13, 2026 12:18
@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.

3 participants