Skip to content

Commit

Permalink
Make sure that either metadata or data is present in NFT / Collection (
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuripetusko authored Apr 28, 2021
1 parent 0286522 commit dcc813c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/tools/validate-remark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ export const validateCollection = (remark: string): any => {
try {
validateBase(remark, OP_TYPES.MINT);
const obj = getRemarkData(dataString);
if (!obj.metadata && !obj.data) {
throw new Error("NFT is missing metadata");
}
return assert(obj, CollectionStruct);
} catch (error) {
throw new Error(
Expand All @@ -117,6 +120,9 @@ export const validateNFT = (remark: string): any => {
try {
validateBase(remark, OP_TYPES.MINTNFT);
const obj = getRemarkData(dataString);
if (!obj.metadata && !obj.data) {
throw new Error("NFT is missing metadata");
}
return assert(obj, NFTStruct);
} catch (error) {
throw new Error(
Expand Down

0 comments on commit dcc813c

Please sign in to comment.