After creating a universe
, the next step is to deposit NFTs.
Every deposited NFT is a component of your meta NFT. The meta NFT combines the metadata of all component NFTs.
The combination requires you to add some configuration to the metadata of each NFT, in the form of mbkSchema
. This schema helps with storage and re-rendering of the meta NFT. More on this in the chapter Meta Blocks Schema
.
The following steps occur when a wallet deposits an NFT in a universe for the first time:
For subsequent deposits, step 2 is omitted since the meta NFT already exists.
A developer only needs to call one function to deposit. To learn more about the internal details of a deposit, check the chapter on how deposits work.
Since the contract will generate a receipt and a meta NFT, the deposit function expects a URI for the metadata of the receipt and meta NFTs. You can create these metadata files yourself or use our hosted service to create the metadata. # TODO: Add a section on how to use our service.
Assuming you have a system to generate these metadata URLs, you can call the deposit function as follows:
import { depositNft } from '@kyraa/metablocks';
const args = {
connection: connection,
wallet: dummyWallet,
isMetaNftMasterEdition: false,
isReceiptMasterEdition: false,
receiptName: 'receiptName',
receiptUrl: 'http://metablocks-receipt.metablocks.world/278781.json',
metaNftName: 'metaNftName',
metaNftUrl: 'http://metadata.metablocks.world/13999.json',
mintKey: userNftMint,
universeKey: universeKey,
};
try {
await depositNft(args);
} catch (e) {
console.log(e)
}
Let's dissect the the the deposit method:
connection
and wallet
are the Solana connection and connected wallet respectivelyisReceiptMasterEdition
and isMetaNftMasterEdition
flags are used to specify if the respective NFTs are master editions or not. By default, both these flags are set false
receiptName
and receiptUrl
are the the names and metadata url or receipt NFT respectively. You can use our service to generate metadata URLsmetaNftName
and metaNftUrl
are the names and metadata url of the meta NFT. The upgrades to the NFTs occur by updating the contents of this metadata URL. You can use our service for simple image upgrades or roll your own for complex upgradesmintKey
is the token mint key of the NFT being depositeduniverseKey
is the key of the universe in which the NFT is being deposited