From 101aa5a21ff6bb83bffa8a7be2ffeb23a2afaf1a Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Sat, 18 Sep 2021 17:53:02 -0300 Subject: [PATCH] Custom formatting for bytes param type (no fixed size) --- src/transaction/DecodedParamsTable.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/transaction/DecodedParamsTable.tsx b/src/transaction/DecodedParamsTable.tsx index 1d79347..fca7a81 100644 --- a/src/transaction/DecodedParamsTable.tsx +++ b/src/transaction/DecodedParamsTable.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { LogDescription, ParamType, Result } from "@ethersproject/abi"; +import { ParamType, Result } from "@ethersproject/abi"; import AddressHighlighter from "../components/AddressHighlighter"; import DecoratedAddressLink from "../components/DecoratedAddressLink"; import Copy from "../components/Copy"; @@ -51,6 +51,14 @@ const DecodedParamsTable: React.FC = ({ {r.toString()} + ) : paramTypes[i].type === "bytes" ? ( + + {r.toString()}{" "} + + {r.toString().length / 2 - 1}{" "} + {r.toString().length / 2 - 1 === 1 ? "byte" : "bytes"} + + ) : ( r.toString() )}