fix: coerce partially decoded instructions on parsed confirmed transactions (#13979)

* feat: coerce partially decoded instructions on parsed confirmed transactions

* fix: flow tests

* fix: need to check this again
This commit is contained in:
Josh
2020-12-14 19:22:22 -08:00
committed by GitHub
parent c2b7115031
commit 7c8276d2ac
2 changed files with 124 additions and 6 deletions

View File

@@ -368,14 +368,9 @@ const SimulatedTransactionResponseValidator = jsonRpcResultAndContext(
}),
);
type PartiallyDecodedInnerInstruction = {
index: number,
instructions: PartiallyDecodedInstruction[],
};
type ParsedInnerInstruction = {
index: number,
instructions: (ParsedInstruction | PartiallyDecodedInnerInstruction)[],
instructions: (ParsedInstruction | PartiallyDecodedInstruction)[],
};
/**
@@ -2602,6 +2597,18 @@ export class Connection {
assert(typeof result !== 'undefined');
if (result === null) return result;
if (result.meta.innerInstructions) {
result.meta.innerInstructions.forEach(inner => {
inner.instructions.forEach(ix => {
ix.programId = new PublicKey(ix.programId);
if (ix.accounts) {
ix.accounts = ix.accounts.map(account => new PublicKey(account));
}
});
});
}
const {
accountKeys,
instructions,