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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mbkjs/nft-composer

v2.0.8

Published

![NPM Version](https://img.shields.io/npm/v/@mbkjs/nft-composer)

Readme

NPM Version

SDK bindings for Solana MetaBlocks Program

This repo contains the API bindings for interacting with MetaBlocks program for more info refer this link

Connection and Wallet

For interacting with any program in Solana blockchain, first we need a wallet and connection to the blockchain. Here is the sample code for establishing connection with Metablocks and solana network

const connection = new anchor.web3.Connection(CLUSTER_URL, 'confirmed');
const program = getMetaBlocksProgram(connection, wallet);

Universe

Universes allow you to use the protocol without caring about on-chain deployments. All you need is a wallet. You can create only one universe per wallet. For more info, refer the Official Docs

Below is a how you initialize/update an universe in your code.

Create an universe

Import Dependencies

import { createUniverse } from '@mbkjs/nft-composer';

To create an universe, all you need is below argument to be passed to the createUniverse method

const args = {
  name: 'sample name',
  description: ' sample description',
  websiteUrl: 'http://your-sample.website.url',
  connection: connection,
  wallet: dummyWallet,
};

const tx = await createUniverse(args);

Update an universe

Import dependencies

import { updateUniverse } from '@mbkjs/nft-composer';

Similar to the above create universe, update universe is as simple as below updateUniverse call

const args = {
  name: 'sample name',
  description: ' sample description',
  websiteUrl: 'http://your-sample.website.url',
  connection: connection,
  wallet: dummyWallet,
};

const tx = await updateUniverse(args);

Deposit NFT

Import dependencies

import { depositNft, NftComposerCluster } from '@mbkjs/nft-composer';

Users can deposit their NFTs for upgrading their NFTs, it could be done with depositNft.

  1. Once the user deposit's the NFT, in-return the User gets a receiptNFT as an acknowledgement for depositing the NFT.

  2. A Meta NFT is generated. This NFT is the final combined NFT of the NFTs that you have deposited into the Metablocks program.

const args: GroupedDepositNftApiArgs = {
  connection: connection,
  isReceiptMasterEdition: false, // // You can mint a master-edition of the Receipt NFT, you can keep this a default
  arweaveUrl: 'http://localhost:8090', // arweave url of the  NFT
  receiptName: 'receiptName', // receipt NFT name
  metaNftName: 'metaNftName', // Generated meta NFT name
  cluster: NftComposerCluster.Devnet, // This is the cluster, we have chosen devnet as the cluster
  isMetaNftMasterEdition: false, // You can mint a master-edition of the Meta NFT, you can keep this a default
  wallet: dummyWallet,
  mintKey: userNftMint, // this is the token mint of the User's NFT that needs to be deposited
  universeKey: universeKey, // this is the public key where users wants to deposit the nft
};

await depositNft(args);

Deposit Raw NFT

Import dependencies

import { depositRawNft } from '@mbkjs/nft-composer';

Users can deposit their NFTs for upgrading their NFTs, it could be done with depositRawNft. The difference between the above and this nft is that the you need to pass the receiptUrl and the metaNftUrl as params.

  1. Once the user deposit's the NFT, in-return the User gets a receiptNFT as an acknowledgement for depositing the NFT.

  2. A Meta NFT is generated. This NFT is the final combined NFT of the NFTs that you have deposited into the Metablocks program.

const args: GroupedDepositRawNftApiArgs = {
  connection: connection,
  isReceiptMasterEdition: false, // // You can mint a master-edition of the Receipt NFT, you can keep this a default
  receiptUrl: 'http://localhost:8090', // reciept NFT url
  receiptName: 'receiptName', // receipt NFT name
  metaNftName: 'metaNftName', // Generated meta NFT name
  metaNftUrl: 'http://localhost_meta_api.url', // this the url where combining of the deposited NFTs happen (Your rendering service URL)
  isMetaNftMasterEdition: false, // You can mint a master-edition of the Meta NFT, you can keep this a default
  wallet: dummyWallet,
  mintKey: userNftMint, // this is the token mint of the User's NFT that needs to be deposited
  universeKey: universeKey, // this is the public key where users wants to deposit the nft
};

await depositRawNft(args);

Withdraw NFT

Import the API

import { withdrawNft } from '@mbkjs/nft-composer';

User could withdraw NFT anytime. The API to withdraw NFT is as simple as the following sample code.

const args: WithdrawNftApiArgs = {
  connection: connection,
  wallet: dummyWallet,
  mintKey: userNftMint, // original mint public key of the user
  universeKey: universeKey, // public key of the universe where the User deposited the NFT
};

await withdrawNft(args);

Withdraw NFT with Receipt NFT

Import the API

import { withdrawNftWithReceipt } from '@mbkjs/nft-composer';

NFTs could also be withdraw from MetaBlocks Program using receiptMint Publickey

const args: WithdrawNftWithReceiptApiArgs = {
  connection: connection,
  receiptMint: pdaKeys.receiptMint, // public key of the receipt mint NFT
  wallet: dummyWallet,
  universeKey: universeKey, // public key of the universe where user deposited NFT
};

await withdrawNftWithReceipt(args);

Read Meta NFT Metadata

Import the API

import { getMetaNftMetadata } from '@mbkjs/nft-composer';

Receive MetaNFT metadata for a user and universe. If nothing is present, sends error if nothing is found

const args = {
  connection: connection,
  wallet: dummyWallet,
  universe: universeKey, // public key of the universe where user deposited NFT
};

await getMetaNftMetadata(args);

Read Receipt NFTs Metadata

Import the API

import { getReceiptNftsMetadata } from '@mbkjs/nft-composer';

Receive all ReceiptNFT metadata for a user and universe. If nothing is present, sends error if nothing is found

const args = {
  connection: connection,
  wallet: dummyWallet,
  universe: universeKey, // public key of the universe where user deposited NFT
};

await getReceiptNftsMetadata(args);

For More Details

For more details refer the tests folder of this package to get an idea on using the APIs

Contributions

You could contribute to this package by creating a PR. Feel free to open issues if you face any problems while using this package.