Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/utils/validation.js
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | |||||
export const isValidTokenDocumentUrl = tokenDocumentUrl => { | export const isValidTokenDocumentUrl = tokenDocumentUrl => { | ||||
return ( | return ( | ||||
typeof tokenDocumentUrl === 'string' && | typeof tokenDocumentUrl === 'string' && | ||||
tokenDocumentUrl.length >= 0 && | tokenDocumentUrl.length >= 0 && | ||||
tokenDocumentUrl.length < 68 | tokenDocumentUrl.length < 68 | ||||
); | ); | ||||
}; | }; | ||||
export const isValidGroupNFTName = nftName => { | |||||
return ( | |||||
typeof nftName === 'string' && nftName.length > 0 && nftName.length < 68 | |||||
); | |||||
}; | |||||
export const isValidGroupNFTTicker = nftTicker => { | |||||
return ( | |||||
typeof nftTicker === 'string' && | |||||
nftTicker.length > 0 && | |||||
nftTicker.length < 13 | |||||
); | |||||
}; | |||||
export const isValidGroupNFTBatons = nftBatons => { | |||||
return ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].includes( | |||||
nftBatons, | |||||
); | |||||
}; | |||||
/* | |||||
export const isValidGroupNFTInitialQty = (nftInitialQty) => { | |||||
return ( | |||||
nftInitialQty >= 0 && | |||||
nftInitialQty < 1000000 | |||||
); | |||||
}; | |||||
*/ | |||||
export const isValidGroupNFTDocumentUrl = nftDocumentUrl => { | |||||
return ( | |||||
typeof nftDocumentUrl === 'string' && | |||||
nftDocumentUrl.length >= 0 && | |||||
nftDocumentUrl.length < 68 | |||||
); | |||||
}; | |||||
export const isValidChildNFTName = nftName => { | |||||
return ( | |||||
typeof nftName === 'string' && nftName.length > 0 && nftName.length < 68 | |||||
); | |||||
}; | |||||
export const isValidChildNFTTicker = nftTicker => { | |||||
return ( | |||||
typeof nftTicker === 'string' && | |||||
nftTicker.length > 0 && | |||||
nftTicker.length < 13 | |||||
); | |||||
}; | |||||
export const isValidChildNFTGroupId = nftGroupId => { | |||||
return nftGroupId != ''; | |||||
}; | |||||
/* | |||||
export const isValidGroupNFTInitialQty = (nftInitialQty) => { | |||||
return ( | |||||
nftInitialQty >= 0 && | |||||
nftInitialQty < 1000000 | |||||
); | |||||
}; | |||||
*/ | |||||
export const isValidChildNFTDocumentUrl = nftDocumentUrl => { | |||||
return ( | |||||
typeof nftDocumentUrl === 'string' && | |||||
nftDocumentUrl.length >= 0 && | |||||
nftDocumentUrl.length < 68 | |||||
); | |||||
}; | |||||
export const isValidTokenStats = tokenStats => { | export const isValidTokenStats = tokenStats => { | ||||
return ( | return ( | ||||
typeof tokenStats === 'object' && | typeof tokenStats === 'object' && | ||||
'timestampUnix' in tokenStats && | 'timestampUnix' in tokenStats && | ||||
'documentUri' in tokenStats && | 'documentUri' in tokenStats && | ||||
'containsBaton' in tokenStats && | 'containsBaton' in tokenStats && | ||||
'initialTokenQty' in tokenStats && | 'initialTokenQty' in tokenStats && | ||||
'totalMinted' in tokenStats && | 'totalMinted' in tokenStats && | ||||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |