diff --git a/src/address/ABI.tsx b/src/address/ABI.tsx new file mode 100644 index 0000000..7190f4e --- /dev/null +++ b/src/address/ABI.tsx @@ -0,0 +1,24 @@ +import React from "react"; +import { Light as SyntaxHighlighter } from "react-syntax-highlighter"; +import hljs from "highlight.js"; +import docco from "react-syntax-highlighter/dist/esm/styles/hljs/docco"; + +import hljsDefineSolidity from "highlightjs-solidity"; +hljsDefineSolidity(hljs); + +type ABIProps = { + abi: any[]; +}; + +const ABI: React.FC = ({ abi }) => ( + + {JSON.stringify(abi, null, " ") ?? ""} + +); + +export default React.memo(ABI); diff --git a/src/address/Contract.tsx b/src/address/Contract.tsx index 0fd7c89..8a18d86 100644 --- a/src/address/Contract.tsx +++ b/src/address/Contract.tsx @@ -2,9 +2,9 @@ import React from "react"; import { Light as SyntaxHighlighter } from "react-syntax-highlighter"; import hljs from "highlight.js"; import docco from "react-syntax-highlighter/dist/esm/styles/hljs/docco"; +import { useContract } from "../useSourcify"; import hljsDefineSolidity from "highlightjs-solidity"; -import { useContract } from "../useSourcify"; hljsDefineSolidity(hljs); type ContractProps = { diff --git a/src/address/Contracts.tsx b/src/address/Contracts.tsx index 470da58..94f25c4 100644 --- a/src/address/Contracts.tsx +++ b/src/address/Contracts.tsx @@ -5,6 +5,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faChevronDown } from "@fortawesome/free-solid-svg-icons/faChevronDown"; import ContentFrame from "../ContentFrame"; import InfoRow from "../components/InfoRow"; +import ABI from "./ABI"; import Contract from "./Contract"; import { RuntimeContext } from "../useRuntime"; import { Metadata } from "../useSourcify"; @@ -82,57 +83,67 @@ const Contracts: React.FC = ({ )} {rawMetadata !== undefined && rawMetadata !== null && ( -
- -
- - {selected} - - - - - {provider && ( -
- - Open in Remix - -
- )} + <> + {rawMetadata.output.abi && ( +
+
+ ABI +
+
-
- - {Object.entries(rawMetadata.sources).map(([k]) => ( - - - - ))} - -
-
- {selected && ( - )} -
+
+ +
+ + {selected} + + + + + {provider && ( +
+ + Open in Remix + +
+ )} +
+
+ + {Object.entries(rawMetadata.sources).map(([k]) => ( + + + + ))} + +
+
+ {selected && ( + + )} +
+ )}