Add key index to tx instructions

This commit is contained in:
Justin Starry 2020-05-09 15:32:28 +08:00 committed by Michael Vines
parent 01b99a0570
commit 0df52938b2
1 changed files with 11 additions and 11 deletions

View File

@ -299,7 +299,7 @@ function InstructionsSection({ signature }: Props) {
const props = { ix, result, index };
if (!ix.programId.equals(SystemProgram.programId)) {
return <UnknownDetailsCard {...props} />;
return <UnknownDetailsCard key={index} {...props} />;
}
let systemInstructionType;
@ -307,28 +307,28 @@ function InstructionsSection({ signature }: Props) {
systemInstructionType = SystemInstruction.decodeInstructionType(ix);
} catch (err) {
console.error(err);
return <UnknownDetailsCard {...props} />;
return <UnknownDetailsCard key={index} {...props} />;
}
switch (systemInstructionType) {
case "Create":
return <CreateDetailsCard {...props} />;
return <CreateDetailsCard key={index} {...props} />;
case "Assign":
return <AssignDetailsCard {...props} />;
return <AssignDetailsCard key={index} {...props} />;
case "Transfer":
return <TransferDetailsCard {...props} />;
return <TransferDetailsCard key={index} {...props} />;
case "CreateWithSeed":
return <CreateWithSeedDetailsCard {...props} />;
return <CreateWithSeedDetailsCard key={index} {...props} />;
case "AdvanceNonceAccount":
return <NonceAdvanceDetailsCard {...props} />;
return <NonceAdvanceDetailsCard key={index} {...props} />;
case "WithdrawNonceAccount":
return <NonceWithdrawDetailsCard {...props} />;
return <NonceWithdrawDetailsCard key={index} {...props} />;
case "AuthorizeNonceAccount":
return <NonceAuthorizeDetailsCard {...props} />;
return <NonceAuthorizeDetailsCard key={index} {...props} />;
case "InitializeNonceAccount":
return <NonceInitializeDetailsCard {...props} />;
return <NonceInitializeDetailsCard key={index} {...props} />;
default:
return <UnknownDetailsCard {...props} />;
return <UnknownDetailsCard key={index} {...props} />;
}
});