]> git.ardis.lu - solc-metadata/commitdiff
Improve type definitions
authorArdis Lu <ardisglu@gmail.com>
Wed, 25 Feb 2026 07:49:32 +0000 (23:49 -0800)
committerArdis Lu <ardisglu@gmail.com>
Wed, 25 Feb 2026 07:49:32 +0000 (23:49 -0800)
index.js

index de5cf7552377182a2b98600bfd33a0e1cacdc670..cce9fea7306cc6dcdba6c3bc3c72eb4fad2c7eb0 100644 (file)
--- a/index.js
+++ b/index.js
@@ -194,10 +194,23 @@ function solcMultihashToCIDv1(byteArray) {
   return `${prefix}${out}`;
 }
 
+/**
+ * @typedef {Object} BytecodeMetadata
+ * @property {Uint8Array} ipfs Byte array of a multihash of the SHA-256 hash of the full JSON metadata file.
+ * @property {Uint8Array} solc Byte array of the literal Solidity version number.
+ */
+
+/**
+ * @typedef {Object} CIDs
+ * @property {string} solcVersion String representation of the Solidity version number used.
+ * @property {string} cidV0 A CID V0 that can be directly used to look up the JSON metadata file on IPFS.
+ * @property {string} cidV1 A CID V1 that can be directly used to look up the JSON metadata file on IPFS.
+ */
+
 /**
  * Get IPFS CIDs for the JSON metadata file from decoded bytecode metadata.
- * @param {Object} metadata Decoded bytecode metadata.
- * @returns {Object} The `solc` compiler version and IPFS CIDs (both CIDv0 and CIDv1) of the JSON metadata.
+ * @param {BytecodeMetadata} metadata Decoded bytecode metadata.
+ * @returns {CIDs} The `solc` compiler version and IPFS CIDs (both CIDv0 and CIDv1) of the JSON metadata.
  */
 function calculateCID(metadata) {
   const { ipfs, solc } = metadata;
This page took 0.035997 seconds and 4 git commands to generate.