2

I'm working on a project using Solana's Metaplex protocol where I'm trying to mint NFTs to an unsized collection. However, I keep encountering an error that says "Can't use this function on unsized collection." Below is the relevant code and the response JSON for the collection NFT.

Collection NFT Response JSON:

json

    "model": "nft",
    "updateAuthorityAddress": "address",
    "json": {
        "name": "My NFT Collection",
        "symbol": "MNFT",
        "description": "A unique collection of digital artworks.",
        "seller_fee_basis_points": 500,
        "attributes": [
            {
                "trait_type": "Background",
                "value": "Blue"
            },
            {
                "trait_type": "Type",
                "value": "Abstract"
            }
        ],
        "properties": {
            "files": [],
            "category": "image",
            "creators": [
                {
                    "address": "address",
                    "share": 100
                }
            ]
        }
    },
    "jsonLoaded": true,
    "name": "Test 1",
    "symbol": "COLLECTION",
    "uri": "s3uri",
    "isMutable": true,
    "primarySaleHappened": false,
    "sellerFeeBasisPoints": 500,
    "editionNonce": 255,
    "creators": [
        {
            "address": "address",
            "verified": true,
            "share": 100
        }
    ],
    "tokenStandard": 0,
    "collection": null,
    "collectionDetails": null,
    "uses": null,
    "programmableConfig": null,
    "address": "address_from_json",
    "metadataAddress": "xxx",
    "mint": {
        "model": "mint",
        "address": "address_from_json",
        "mintAuthorityAddress": "xxx",
        "freezeAuthorityAddress": "xxx",
        "decimals": 0,
        "supply": {
            "basisPoints": "01",
            "currency": {
                "symbol": "COLLECTION",
                "decimals": 0,
                "namespace": "spl-token"
            }
        },
        "isWrappedSol": false,
        "currency": {
            "symbol": "COLLECTION",
            "decimals": 0,
            "namespace": "spl-token"
        }
    },
    "token": {
        "model": "token",
        "address": "xxx",
        "isAssociatedToken": true,
        "mintAddress": "xxx",
        "ownerAddress": "xxx",
        "amount": {
            "basisPoints": "01",
            "currency": {
                "symbol": "COLLECTION",
                "decimals": 0,
                "namespace": "spl-token"
            }
        },
        "closeAuthorityAddress": null,
        "delegateAddress": null,
        "delegateAmount": {
            "basisPoints": "00",
            "currency": {
                "symbol": "COLLECTION",
                "decimals": 0,
                "namespace": "spl-token"
            }
        },
        "state": 1
    },
    "edition": {
        "model": "nftEdition",
        "isOriginal": true,
        "address": "xxx",
        "supply": "00",
        "maxSupply": "00"
    }
}

Minting Function Code:


const { nft } = await metaplex.nfts().create({
                uri: nftURI,
                name: namenft,
                sellerFeeBasisPoints: 500,
                useNewMint: newMintKeypair,
                tokenOwner: nftTokenOwner,
                symbol: symbol,
                collection: collectionNFTAddress,
                collectionAuthority: authorityKeypair
            });

Minting Collection Code:


const { nft } = await metaplex.nfts().create({
        uri: "https://.s3.eu-west-1.amazonaws.com/metauri.json",
        name: metadata.name,
        symbol: metadata.symbol,
        sellerFeeBasisPoints: 500,
        collectionIsSized: false
    });

Error Message:

Failed to mint the NFT: ParsedProgramError: The program [TokenMetadataProgram] at address [metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s] raised an error of code [101] that translates to "Can't use this function on unsized collection".

Attempts to Resolve:

I have verified that the collection is unsized (maxSupply is "00").
I confirmed the collection NFT setup seems correct.
I ensured the collectionNFTAddress is correct.
I am using the correct authorityKeypair, it is the same one i used to create the collection.

Despite these checks, the error persists. I'm looking for insights into what might be causing this issue or if there are specific considerations for minting NFTs to an unsized collection in Metaplex that I might be missing.

Environment:

Solana Metaplex protocol
TypeScript for the backend

Any guidance or suggestions would be greatly appreciated. Thank you!

2
  • From what I understand, collection with a size of 0 is not the same as an unsized collection. How are you minting the collection? Note that collectionIsSized is true by default: metaplex-foundation.github.io/js/types/… Commented Nov 16, 2023 at 14:53
  • I'm minting the NFT collection with this code: typescript const keypair = keypairIdentity(this.authority); const { nft } = await metaplex.nfts().create({ uri: "s3link/metauri.json", name: metadata.name, symbol: metadata.symbol, sellerFeeBasisPoints: 500, collectionIsSized: false }); I'm using the same authority as the one for minting the NFTs later. ive added that code to the original question so it easier to read Commented Nov 16, 2023 at 15:07

1 Answer 1

1

The solution was to do with the creation of my NFT collection,

I had excluded the isCollection field

    // Create the NFT Collection
    const { nft } = await metaplex.nfts().create({
        uri: "s3.eu-west-1.amazonaws.com/metauri.json",
        name: metadata.name,
        symbol: metadata.symbol,
        sellerFeeBasisPoints: 500,
        isCollection: true,
        collectionIsSized: false
    });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.