Search
K
Links

Create your NFT Collection

MetaMask is a widely used Ethereum wallet that allows users to manage their Ether and ERC-20 tokens. It also provides an interface for interacting with decentralized applications (dApps) and smart contracts. With the growing popularity of non-fungible tokens (NFTs), you can now leverage MetaMask to create your very own NFT collection contract, opening up a world of opportunities and benefits.

Why create an NFT collection contract?

NFTs represent unique digital assets that can't be exchanged on a one-to-one basis, differentiating them from other cryptocurrencies. Creating an NFT collection contract allows you to mint, trade, and showcase a series of unique digital items, such as art, collectibles, virtual real estate, or game items. These contracts facilitate the management of your NFT collection, defining rules for minting, transferring, and managing the ownership of your tokens.
MetaMask is designed as a browser extension to provide a user-friendly interface and secure key management for interacting with dApps and web services. Connecting from Node.js is not supported because MetaMask focuses on end-user interactions within web browsers, while Node.js is a server-side JavaScript runtime typically used for backend development.

How to create your NFT collection with MetaMask from your browser-based application

Use the TatumSDK (@tatumio/tatum) to prepare, sign and broadcast the transaction using MetaMask.
You will leverage the WalletProvider submodule, which includes multiple browser-based wallet extensions. MetaMask is just one of them.
TypeScript
JavaScript
1
// yarn add @tatumio/tatum
2
import {TatumSDK, Network, Ethereum} from '@tatumio/tatum'
3
4
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
5
6
// We have prepared a deploy transaction of ERC-721 contract from your default connected MetaMask account to the recipient
7
// Result is a transaction IF of a broadcasted transaction
8
const txId: string = await tatum.walletProvider.metaMask.createNftCollection({
9
name: 'Your Collection Name',
10
symbol: 'Your Collection Symbol'})
11
12
console.log(txId)
13
14
// Once the transaction is included in a block, you can get the contract address of the newly created collection
15
const contractAddress: string | null = await tatum.rpc.getContractAddress(txId)
16
console.log(contractAddress)
1
// Install with: npm install @tatumio/tatum
2
const { TatumSDK, Network } = require("@tatumio/tatum");
3
4
(async () => {
5
try {
6
const tatum = await TatumSDK.init({ network: Network.ETHEREUM });
7
// We have prepared a deploy transaction of ERC-721 contract from your default connected MetaMask account to the recipient
8
// Result is a transaction IF of a broadcasted transaction
9
const txId = await tatum.walletProvider.metaMask.createNftCollection({
10
name: 'Your Collection Name',
11
symbol: 'Your Collection Symbol'});
12
13
console.log(txId);
14
15
// Once the transaction is included in a block, you can get the contract address of the newly created collection
16
const contractAddress: string | null = await tatum.rpc.getContractAddress(txId)
17
console.log(contractAddress)
18
} catch (error) {
19
console.error("Error signing a transaction using MetaMask:", error);
20
}
21
})();

Request object parameters

1
export interface CreateNftCollection {
2
/**
3
* Name of the token.
4
*/
5
name: string
6
/**
7
* Symbol of the token.
8
*/
9
symbol: string
10
/**
11
* base URI of the collection, defaults to empty string. Base URI is prepended to the token ID in the token URI.
12
*/
13
baseURI?: string
14
/**
15
* (Optional) Address of the admin of the token. Defaults to the connected MetaMask account. Admin can add new minters and pausers.
16
*/
17
author?: string
18
/**
19
* (Optional) Address of the minter of the token. Defaults to the connected MetaMask account. Minters can mint new tokens.
20
*/
21
minter?: string
22
}
23

Response

  • txId - string, transaction hash of signed and broadcasted transaction
    • Example: "0xdb1e03f4cea29265f031bfc0514b07c15a5fc5e5cc2fd47f7d9a54c74f5c5637"
© Tatum Technology, LLC