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