diff --git a/src/Transaction.tsx b/src/Transaction.tsx index 1857f72..2fc69a2 100644 --- a/src/Transaction.tsx +++ b/src/Transaction.tsx @@ -87,7 +87,7 @@ const Transaction: React.FC = () => { /> - + diff --git a/src/transaction/DecodedInput.tsx b/src/transaction/DecodedInput.tsx index f41406b..1e4bcd4 100644 --- a/src/transaction/DecodedInput.tsx +++ b/src/transaction/DecodedInput.tsx @@ -7,12 +7,14 @@ type DecodedInputProps = { const DecodedInput: React.FC = ({ txDesc }) => ( - - - - + + + + + + {txDesc.args.map((r, i) => ( diff --git a/src/transaction/DecodedLog.tsx b/src/transaction/DecodedLog.tsx new file mode 100644 index 0000000..a55da73 --- /dev/null +++ b/src/transaction/DecodedLog.tsx @@ -0,0 +1,34 @@ +import React from "react"; +import { LogDescription } from "@ethersproject/abi"; + +type DecodedLogProps = { + logDesc: LogDescription; +}; + +const DecodedLog: React.FC = ({ logDesc }) => ( +
- param (index) - typevalue
+ param (index) + typevalue
+ + + + + + + + + {logDesc.args.map((r, i) => ( + + + + + + ))} + +
+ param (index) + typevalue
+ {logDesc.eventFragment.inputs[i].name}{" "} + ({i}) + {logDesc.eventFragment.inputs[i].type}{r}
+); + +export default React.memo(DecodedLog); diff --git a/src/transaction/DecodedLogSignature.tsx b/src/transaction/DecodedLogSignature.tsx new file mode 100644 index 0000000..daceeee --- /dev/null +++ b/src/transaction/DecodedLogSignature.tsx @@ -0,0 +1,23 @@ +import React from "react"; +import { EventFragment } from "@ethersproject/abi"; + +type DecodedLogSignatureProps = { + event: EventFragment; +}; + +const DecodedLogSignature: React.FC = ({ event }) => { + return ( + + {event.name}( + {event.inputs.map((input, i) => ( + <> + {i > 0 ? ", " : ""} + {input.format("full")} + + ))} + ){event.anonymous ? " anonymous" : ""} + + ); +}; + +export default React.memo(DecodedLogSignature); diff --git a/src/transaction/LogEntry.tsx b/src/transaction/LogEntry.tsx new file mode 100644 index 0000000..a41f070 --- /dev/null +++ b/src/transaction/LogEntry.tsx @@ -0,0 +1,75 @@ +import React from "react"; +import { Log } from "@ethersproject/abstract-provider"; +import { LogDescription } from "@ethersproject/abi"; +import DecoratedAddressLink from "../components/DecoratedAddressLink"; +import DecodedLog from "./DecodedLog"; +import DecodedLogSignature from "./DecodedLogSignature"; +import { TransactionData } from "../types"; + +type LogEntryProps = { + txData: TransactionData; + log: Log; + logDesc: LogDescription | null | undefined; +}; + +const LogEntry: React.FC = ({ txData, log, logDesc }) => ( +
+
+ + {log.logIndex} + +
+
+
+
Address
+
+ +
+
+ {logDesc && ( +
+
Signature
+
+ +
+
+ )} + {logDesc && ( +
+
Name
+
+ +
+
+ )} + {log.topics.map((t, i) => ( +
+
{i === 0 && "Topics"}
+
+ + {i} + + {t} +
+
+ ))} +
+
Data
+
+