Mint
We are now ready to mint an NFT. Since the tokenId
and serialId
are both auto-generated, a contentHash
is introduced to identify the token, which could be an IPFS content identifier or so. As mintNFTFromRealloop()
implies, Realloop pass the contentHash
back on withdrawing L2 minted NFTs.
export async function mint(creator: RlWallet, recipient: RlWallet) {
const tx = await creator.mintNFT({
recipient: recipient.address(),
contentHash: '0xbd7289936758c562235a3a42ba2c4a56cbb23a263bb8f8d27aead80d74d9d996',
feeToken: 'ETH'
});
const receipt = await tx.awaitReceipt();
console.log(JSON.stringify(receipt));
}
(async function () {
const provider = await getDefaultProvider('localhost');
const creator = await RlWallet.fromEthSigner(wallets[0], provider);
const receipt = await RlWallet.fromEthSigner(wallets[1], provider);
await mint(creator, receipt);
})();
Last updated