From e515747409a9ab8eca91132bb589bfd7944e0bfd Mon Sep 17 00:00:00 2001 From: 0raclus Date: Mon, 18 May 2026 23:44:37 +0300 Subject: [PATCH 1/2] Add optional transactionIndex to getSignaturesForAddress response Agave 4.0 (anza-xyz/agave#9683) added the 0 based transaction index inside the block to each signature returned by getSignaturesForAddress. This change exposes the new field on the Kit response type as an optional property so callers can read it where available without breaking against older RPC servers that omit it. --- .changeset/afraid-peaches-heal.md | 5 ++ .../get-signatures-for-address-typetest.ts | 48 +++++++++++++++++++ .../rpc-api/src/getSignaturesForAddress.ts | 8 ++++ 3 files changed, 61 insertions(+) create mode 100644 .changeset/afraid-peaches-heal.md create mode 100644 packages/rpc-api/src/__typetests__/get-signatures-for-address-typetest.ts diff --git a/.changeset/afraid-peaches-heal.md b/.changeset/afraid-peaches-heal.md new file mode 100644 index 000000000..dd0b21af4 --- /dev/null +++ b/.changeset/afraid-peaches-heal.md @@ -0,0 +1,5 @@ +--- +'@solana/rpc-api': minor +--- + +Add the optional `transactionIndex` field to each element of the `getSignaturesForAddress` response. Agave 4.0 (anza-xyz/agave#9683) included the 0 based transaction index inside the block alongside each returned signature. The field is omitted by older RPC servers, so the new property is optional and existing call sites continue to compile without modification. diff --git a/packages/rpc-api/src/__typetests__/get-signatures-for-address-typetest.ts b/packages/rpc-api/src/__typetests__/get-signatures-for-address-typetest.ts new file mode 100644 index 000000000..6dffe1b50 --- /dev/null +++ b/packages/rpc-api/src/__typetests__/get-signatures-for-address-typetest.ts @@ -0,0 +1,48 @@ +import type { Address } from '@solana/addresses'; +import type { Signature } from '@solana/keys'; +import type { PendingRpcRequest, Rpc } from '@solana/rpc-spec'; +import type { Commitment, Slot, TransactionError, UnixTimestamp } from '@solana/rpc-types'; + +import type { GetSignaturesForAddressApi } from '../getSignaturesForAddress'; + +const rpc = null as unknown as Rpc; +const address = null as unknown as Address; + +type GetSignaturesForAddressElement = Awaited< + ReturnType['send']> +>[number]; + +// [DESCRIBE] getSignaturesForAddress response +{ + // It returns a pending RPC request when called with no config + { + rpc.getSignaturesForAddress(address) satisfies PendingRpcRequest; + } + // It exposes the documented core fields on each element + { + const element = null as unknown as GetSignaturesForAddressElement; + element.signature satisfies Signature; + element.slot satisfies Slot; + element.blockTime satisfies UnixTimestamp | null; + element.confirmationStatus satisfies Commitment | null; + element.err satisfies TransactionError | null; + element.memo satisfies string | null; + } + // It exposes `transactionIndex` as an optional number + { + const element = null as unknown as GetSignaturesForAddressElement; + element.transactionIndex satisfies number | undefined; + } + // `transactionIndex` is optional, so it may be omitted by older RPC servers + { + const responseFromOldRpc: GetSignaturesForAddressElement = { + blockTime: null, + confirmationStatus: null, + err: null, + memo: null, + signature: null as unknown as Signature, + slot: 0n as Slot, + }; + responseFromOldRpc satisfies GetSignaturesForAddressElement; + } +} diff --git a/packages/rpc-api/src/getSignaturesForAddress.ts b/packages/rpc-api/src/getSignaturesForAddress.ts index 991a1e886..8cdfa8526 100644 --- a/packages/rpc-api/src/getSignaturesForAddress.ts +++ b/packages/rpc-api/src/getSignaturesForAddress.ts @@ -15,6 +15,14 @@ type GetSignaturesForAddressTransaction = Readonly<{ signature: Signature; /** The slot that contains the block with the transaction */ slot: Slot; + /** + * The 0 based index of the transaction within its block. + * + * This field was added in Agave 4.0 + * (see https://github.com/anza-xyz/agave/pull/9683) and is omitted by + * older versions of the RPC server. + */ + transactionIndex?: number; }>; type GetSignaturesForAddressApiResponse = readonly GetSignaturesForAddressTransaction[]; From c635c140b9cdbbf4785772614ae8a21d5b6f18c3 Mon Sep 17 00:00:00 2001 From: Callum Date: Tue, 19 May 2026 11:46:49 +0000 Subject: [PATCH 2/2] Add transactionIndex to bigint exclusions --- packages/rpc-api/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/rpc-api/src/index.ts b/packages/rpc-api/src/index.ts index 03690674f..78c166442 100644 --- a/packages/rpc-api/src/index.ts +++ b/packages/rpc-api/src/index.ts @@ -304,6 +304,7 @@ function getAllowedNumericKeypaths(): AllowedNumericKeypaths