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