Skip to content

Collection

You can Create NFT Collection with Rarible Multichain Protocol in different blockchains.

Before start, install and configure Rarible SDK and required wallets.

Create collection

Use createCollection function:

import { createRaribleSdk } from "@rarible/sdk"
import type { BlockchainWallet } from "@rarible/sdk-wallet/src"
import type { CreateCollectionRequest } from "@rarible/sdk/src/types/nft/deploy/domain"

async function createCollection(wallet: BlockchainWallet, collectionRequest: CreateCollectionRequest) {
    const sdk = createRaribleSdk(wallet, "dev")
    const result = await sdk.nft.createCollection(collectionRequest)
    await result.tx.wait()
    return result.address
}

Depending on blockchain type, in collectionRequest should pass the following parameters:

Ethereum

const ethereumRequest: CreateCollectionRequest = {
  blockchain: Blockchain.ETHEREUM,
  asset: {
    assetType: "ERC721",
    arguments: {
      name: "name",
      symbol: "RARI",
      baseURI: "https://ipfs.rarible.com",
      contractURI: "https://ipfs.rarible.com",
      isUserToken: false,
    },
  },
}

Tezos

const tezosRequest: CreateCollectionRequest = {
  blockchain: Blockchain.TEZOS,
  asset: {
    assetType: "NFT",
    arguments: {
      name: "My NFT collection",
      symbol: "MYNFT",
      contractURI: "https://ipfs.io/ipfs/QmTKxwnqqxTxH4HE3UVM9yoJFZgbsZ8CuqqRFZCSWBF53m",
      isUserToken: false,
    },
  },
}
  • blockchain — blockchain type: ETHEREUM or TEZOS
  • assetType — NFT collection type: ERC721 or ERC1155 for ETHEREUM, NFT or MT for TEZOS
  • name — name of the collection
  • symbol — symbol of the collection
  • baseURI — prefix of the result of the tokenURI call
  • contractURI — URI meta of the entire collection
  • isUserToken — privat (true) or public (false) collection

Checking created collection

To check the created collection:

  • Use the getCollectionById API method

    getCollectionById

    Returns collection by address.

    https://api.rarible.org/v0.1/collections/{collection}

    Example request (staging)

    curl --request GET 'https://api-staging.rarible.org/v0.1/collections/all?blockchains=ETHEREUM&size=3'
    

    Example response (status 200)

    {
        "total": 3,
        "continuation": "ETHEREUM:0x6ea0adbc173c7e8ca64c1ce881c1cfc161927876",
        "collections": [
            {
                "id": "ETHEREUM:0x6ea0adbc173c7e8ca64c1ce881c1cfc161927876",
                "blockchain": "ETHEREUM",
                "type": "ERC721",
                "name": "CryptoKitties",
                "symbol": "CK",
                "features": [],
                "minters": []
            },
            {
                "id": "ETHEREUM:0xaf2584a8b198f5d0b360b95d92aec852f7902e52",
                "blockchain": "ETHEREUM",
                "type": "CRYPTO_PUNKS",
                "name": "CRYPTOPUNKS",
                "symbol": "(Ͼ)",
                "owner": "ETHEREUM:0xfb571f9da71d1ac33e069571bf5c67fadcff18e4",
                "features": [],
                "minters": []
            },
            {
                "id": "ETHEREUM:0xd0200fa0a9c94484c7152813313b122e31bed99d",
                "blockchain": "ETHEREUM",
                "type": "ERC721",
                "name": "CryptoKitties",
                "symbol": "CK",
                "features": [],
                "minters": []
            }
        ]
    }
    
  • Or check Etherscan for Ethereum and Polygon, Flowscan for Flow, or tezblock for Tezos.

See more information about usage Protocol SDK on https://github.com/rarible/sdk

Back to top