use the given Blockstore instance (useful for testing).
Maximum NFTs a bundle can support.
This is currently limited by the size of the root block, which must stay below 256 kib to be a valid "simple" (non-sharded) UnixFS directory object. May be increased in the future by switching to sharded directories for the root object.
Maximum byte length for each NFT id string (encoded as UTF-8).
Maximum length is enforced to ensure we can fit MAX_ENTRIES in a single root block. With 64 byte ids, each link in the root block takes a max of 114 bytes, which gives us 2299 max entries to stay below 256 kib.
If you change this value, make sure to recalculate and change MAX_ENTRIES to stay below the hard limit.
Adds a PackagedNFT to the bundle.
an identifier for the NFT that will be used to create links from the bundle root directory object to the NFT data. Must be unique within the bundle.
a JS object containing Metaplex NFT metadata
a File object containing image data for the main NFT image
override the default HTTP gateway to use in metadata links. Must include scheme, e.g. "https://dweb.link" instead of just "dweb.link". Default is "https://nftstorage.link".
if true, validate the metadata using a JSON schema before adding. off by default.
a Promise that resolves to the input PackagedNFT
object on success.
Loads an NFT from the local filesystem (node.js only) using loadNFTFromFilesystem.
Note: if opts.id is not set, the basename of the metadata json file will be used as the id, which will only work if each NFT metadata file has a unique name.
path to metadata json file
optional path to image file. If not given, will be inferred using the logic in loadNFTFromFilesystem.
override the default HTTP gateway to use in metadata links. Must include scheme, e.g. "https://dweb.link" instead of just "dweb.link". Default is "https://nftstorage.link".
an identifier for the NFT that will be used to create links from the bundle root directory object to the NFT data. Must be unique within the bundle. If not given, the name of the metadata json file (without '.json' extension) will be used.
if true, validate the metadata using a JSON schema before adding. off by default.
a Promise that resolves to a PackagedNFT containing the NFT data on success.
"Finalizes" the bundle by creating a root block linking to all the NFTs in the bundle and generating a CAR containing all added NFT data.
a Promise that resolves to an EncodedCar, which contains a CarReader and the root object's CID.
the total size of all blocks in our blockstore. Will be slightly smaller than the size of the final CAR, due to the CAR header.
Creates a root UnixFS directory object that links to each NFT and encodes it as an IPLD block.
a Promise that resolves to an IPLD block of dab-pb / unixfs data.
an object that links to each added NFT. Object keys are the id
given when the NFT was added. Values are PackagedNFT objects.
Generated using TypeDoc
An NFTBundle is a collection of Metaplex NFTs that can be packaged into a single CAR for uploading to NFT.Storage.
All added NFTs require a unique ID string, which will be used to link from the root directory object to the
assets
andmetadata
directories for that NFT.For example, if you add nfts with the ids
a
,b
, andc
, you'll end up with a root directory tree like this:When using addNFTFromFileSystem, the id will be derived from the metadata json filename, unless an
id
option is provided. This should play nice with the default candy-machine directory structure, where each json file has a unique name (e.g. 0.json, etc). If you're using a different naming convention, you should pass in explicit ids to avoid duplicate entries, which will fail.