Skip to content

Commit

Permalink
Fix accountKeys type in getTransaction JSON parsed (#85)
Browse files Browse the repository at this point in the history
#### Problem

`accountKeys` was incorrectly typed as a list containing one account key, instead of a list of arbitrary length of account keys

#### Summary of Changes

- Fix the type
- Change the type of `source` to the enum it comes from (https://github.com/anza-xyz/agave/blob/8889b4ac1ea39121dffcbc95421dbffae737c1fe/transaction-status-client-types/src/lib.rs#L134-L148)

Fixes #80
  • Loading branch information
mcintyre94 authored Jan 31, 2025
1 parent 5a6a463 commit 3c25e7f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/red-melons-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@solana/rpc-api': patch
---

Fix accountKeys type in getTransaction JSON parsed
16 changes: 8 additions & 8 deletions packages/rpc-api/src/getTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,16 @@ type ParsedTransactionInstruction = Readonly<{
stackHeight?: number;
}>;

type ParsedAccount = Readonly<{
pubkey: Address;
signer: boolean;
source: 'lookupTable' | 'transaction';
writable: boolean;
}>;

type TransactionJsonParsed = Readonly<{
message: {
accountKeys: [
{
pubkey: Address;
signer: boolean;
source: string;
writable: boolean;
},
];
accountKeys: readonly ParsedAccount[];
instructions: readonly (ParsedTransactionInstruction | PartiallyDecodedTransactionInstruction)[];
};
}> &
Expand Down

0 comments on commit 3c25e7f

Please sign in to comment.