]> git.ardis.lu - solc-metadata/commitdiff
Handle literal source code content in metadata file
authorArdis Lu <ardisglu@gmail.com>
Thu, 11 Apr 2024 04:31:37 +0000 (21:31 -0700)
committerArdis Lu <ardisglu@gmail.com>
Thu, 11 Apr 2024 04:31:37 +0000 (21:31 -0700)
index.html

index 20066ea4d5a8a24817ecf3c7b7f8c08215485b97..91dde2f2cb8d7c599d5cfdd66bb6d8709cb7bb45 100644 (file)
       // Fetch source code
       if (json?.sources !== undefined) {
         for (const [file, source] of Object.entries(json.sources)) {
+          // Source code is literal within the metadata file (i.e., compiler option "useLiteralContent: true")
+          if (source?.content !== undefined) {
+            const code = source.content;
+            logOutput(result, `✅ Successfully fetched source code for "${file}".`, code);
+            continue;
+          }
+          // Source code is linked within metadata file via IPFS
           try {
             const cidV0 = source.urls[1].substring(11);
             const code = await fetchCID(cidV0, ipfs).then(r => r.text());
This page took 0.035868 seconds and 4 git commands to generate.