npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dcspark/cml-cip25-wasm-nodejs

v1.1.0

Published

Multiplatform SDK for CIP25 (Cardano NFT Metadata)

Downloads

5

Readme

cml-cip25

Multiplatform SDK for CIP25 (Cardano NFT Metadata)

This can be used for both parsing and creating CIP25-compatible metadata.

Parsing can either be done directly from metadata bytes:

let schema = wasm.CIP25.CIP25Metadata.from_bytes(Buffer.from("a11902d1a26464617461a144baadf00da144cafed00da5646e616d656d4d65746164617461204e616d656566696c657382a3637372636473726331646e616d656966696c656e616d6531696d65646961547970656966696c657479706531a3637372636473726332646e616d656966696c656e616d6532696d65646961547970656966696c65747970653265696d6167657821687474733a2f2f736f6d652e776562736974652e636f6d2f696d6167652e706e67696d656469615479706567696d6167652f2a6b6465736372697074696f6e776465736372697074696f6e206f662074686973204e46546776657273696f6e02", "hex"));

// the above CBOR hex is for a V2 CIP25 schema. You should check which type it is first
// as as_label_metadata_v2() will return None (undefined) if it's a v1 schema
let v2Schema = schema.key_721().as_label_metadata_v2().data();
let policies = v2Schema.keys();
for (var i = 0; i < policies.len(); ++i) {
  let policy = policies.get(i);
  let assets = v2Schema.get(policy);
  let assetNames = assets.keys();
  for (var j = 0; j < assetNames.len(); ++j) {
    let assetName = assetNames.get(j);
    let details = assets.get(assetName);
    console.log(`CIP25 NFT ${policy.toString("hex")}.${asset_name.toString("hex")} found:`);
    console.log(`  name: ${details.name().to_str()}`);
    console.log(`  image: ${details.image().to_string()}`);
    let mediaType = details.media_type();
    if (mediaType != null) {
      console.log(`  media_type: ${mediaType.to_str()}`);
    }
    let description = details.media_type();
    if (description != null) {
      console.log(`  description: ${description.to_str()}`);
    }
    let files = details.files();
    if (files != null) {
      console.log(`  files:`);
      for (var k = 0; k < files.len(); ++k) {
        let file = files.get(k);
        console.log(`    file #${k + 1}:`);
        console.log(`      name: ${file.name().to_str()}`);
        console.log(`      media_type: ${file.media_type().to_str()}`);
        console.log(`      src: ${file.src().to_string()}`);
      }
    }
  }
}

We also support loose NFT parsing to try and parse key information out of potentially incorrectly formatted CIP25

const details = wasm.CIP25.MiniMetadataDetails.loose_parse(Buffer.from("a1646e616d65694d6574617665727365", "hex"));
console.log(details.name());