Skip to content

Commit

Permalink
Extract the annotated account key parser into a separate struct
Browse files Browse the repository at this point in the history
  • Loading branch information
steveluscher committed Dec 1, 2022
1 parent c83e421 commit 90d36e7
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions web3.js/src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2004,6 +2004,13 @@ const ConfirmedTransactionResult = pick({
}),
});

const AnnotatedAccountKey = pick({
pubkey: PublicKeyFromString,
signer: boolean(),
writable: boolean(),
source: optional(union([literal('transaction'), literal('lookupTable')])),
});

const ParsedInstructionResult = pick({
parsed: unknown(),
program: string(),
Expand Down Expand Up @@ -2052,16 +2059,7 @@ const ParsedOrRawInstruction = coerce(
const ParsedConfirmedTransactionResult = pick({
signatures: array(string()),
message: pick({
accountKeys: array(
pick({
pubkey: PublicKeyFromString,
signer: boolean(),
writable: boolean(),
source: optional(
union([literal('transaction'), literal('lookupTable')]),
),
}),
),
accountKeys: array(AnnotatedAccountKey),
instructions: array(ParsedOrRawInstruction),
recentBlockhash: string(),
addressTableLookups: optional(nullable(array(AddressTableLookupStruct))),
Expand Down

0 comments on commit 90d36e7

Please sign in to comment.