Skip to content

Commit

Permalink
feat: add collection metadata limits
Browse files Browse the repository at this point in the history
  • Loading branch information
wkolod committed Jan 9, 2024
1 parent f7f9f5a commit 6fa88cf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/core/nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class NFTService extends NodeService<NFT> {
*/
public async mintCollection(
vaultId: string,
items: { asset: FileSource, metadata?: NFTMetadata, options?: StackCreateOptions }[],
items: { asset: FileSource, metadata: NFTMetadata, options?: StackCreateOptions }[],
metadata: CollectionMetadata,
options: StackCreateOptions = this.defaultCreateOptions
): Promise<MintCollectionResponse> {
Expand All @@ -157,8 +157,12 @@ class NFTService extends NodeService<NFT> {
throw new BadRequest("No items provided for minting.");
}

if (!metadata.name) {
throw new BadRequest("Missing collection name.");
if (!metadata?.name || metadata.name.length > 150) {
throw new BadRequest("metadata.name is mandatory and cannot exceed 150 characters.");
}

if (metadata?.description?.length > 300) {
throw new BadRequest("metadata.description cannot exceed 300 characters.");
}

const vault = await this.api.getVault(vaultId);
Expand Down

0 comments on commit 6fa88cf

Please sign in to comment.