otterscan/src/components/InternalTransactionOperation.tsx

42 lines
1.3 KiB
TypeScript
Raw Normal View History

2021-07-21 19:06:51 +00:00
import React from "react";
import InternalTransfer from "./InternalTransfer";
import InternalSelfDestruct from "./InternalSelfDestruct";
import InternalCreate from "./InternalCreate";
import { TransactionData, InternalOperation, OperationType } from "../types";
import { ResolvedAddresses } from "../api/address-resolver";
2021-07-21 19:06:51 +00:00
type InternalTransactionOperationProps = {
txData: TransactionData;
internalOp: InternalOperation;
resolvedAddresses: ResolvedAddresses | undefined;
2021-07-21 19:06:51 +00:00
};
const InternalTransactionOperation: React.FC<InternalTransactionOperationProps> =
({ txData, internalOp, resolvedAddresses }) => (
2021-07-21 19:06:51 +00:00
<>
{internalOp.type === OperationType.TRANSFER && (
<InternalTransfer
txData={txData}
internalOp={internalOp}
resolvedAddresses={resolvedAddresses}
/>
2021-07-21 19:06:51 +00:00
)}
{internalOp.type === OperationType.SELF_DESTRUCT && (
<InternalSelfDestruct
txData={txData}
internalOp={internalOp}
resolvedAddresses={resolvedAddresses}
/>
2021-07-21 19:06:51 +00:00
)}
{(internalOp.type === OperationType.CREATE ||
internalOp.type === OperationType.CREATE2) && (
<InternalCreate
internalOp={internalOp}
resolvedAddresses={resolvedAddresses}
/>
2021-07-21 19:06:51 +00:00
)}
</>
);
export default React.memo(InternalTransactionOperation);