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

@spacebudz/wormhole

v1.0.4

Published

<p align="center"> <img width="100%" src="./assets/wormhole.png" align="center"/> </p>

Downloads

10

Readme

Wormhole

The SpaceBudz wormhole contract. Moving from CIP-0025 to CIP-0068.

Official SpaceBudz Policy

Policy Id: 4523c5e21d409b81c95b45b0aea275b8ea1406e6cafea5583b9f8a5f

Requirements

  • Deno >= 1.28.1

Installation

Deno

import { Contract } from "https://deno.land/x/[email protected]/mod.ts";

NPM

npm install @spacebudz/wormhole

Get started

import { Lucid, Blockfrost } from "https://deno.land/x/[email protected]/mod.ts";
import { Contract } from "https://deno.land/x/[email protected]/mod.ts";

const lucid = await Lucid.new(new Blockfrost(...));

lucid.selectWalletFromSeed(
  "<seed_phrase>",
);

const contract = new Contract(lucid);

// Logging the SpaceBudz policy id
console.log(contract.mintPolicyId);

// Migrate SpaceBud #10
console.log(await contract.migrate([10]));

Compile contract

deno task build:contract

See requirements.

Bundle for NPM

deno task build

Outputs a dist folder. Lucid needs to be imported separately and is a peer dependency (version @0.10.9).

Contract endpoints

migrate(ids: number[]): Promise<TxHash>
deployScripts(): Promise<TxHash>
burn(id: number): Promise<TxHash> 
move(id: number): Promise<TxHash> 
updateIp(url: string): Promise<Transaction> 
updateRoyalty(royaltyRecipients: RoyaltyRecipient[]): Promise<Transaction> 
getRoyalty(): Promise<RoyaltyRecipient[]>
getMetadata(id: number): Promise<Json>
hasMigrated(id: number): Promise<boolean>
getDeployedScripts(): Promise<{ mint: UTxO }> 

How the wormhole works

In order to migrate a SpaceBud of the old collection, three outputs need to be created:

  • Lock address holding the old SpaceBud
  • Reference address holding the reference NFT with the metadata in the datum
  • Wallet address receives the user NFT that represent the new SpaceBud

The reference NFT and user NFT are minted during the transaction and need to follow the CIP-0068 (222) sub standard. To validate metadata and correctness of the minted SpaceBud a merkle tree is used that contains 10,000 entries. Each entry is a sha2_256 hash of:

metadata hash + asset name of reference NFT + asset name of user NFT + asset name of single asset sent to Lock address

Only a small merkle tree proof needs to be brought on-chain to make sure a SpaceBud is minted correctly

Exceptions for Twin SpaceBudz

To keep integrity for the twins 1903 and 6413 (with quantity 2) some extra steps are required. Important is that there exists only ever one reference NFT. In order to achieve this the reference NFTs including their respective metadata are preminted and locked in the script UTxO. Whenever you migrate a twin you mint a mock reference NFT (with label 1), that doesn't really have any functionality, but it allows to keep the existing contract logic as it is. No unnecessary complexity and risk needs to be introduced into the contract.