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!
collectionIsSized
is true by default: metaplex-foundation.github.io/js/types/…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