bridge_ui: add NFT URI length check

This commit is contained in:
Chase Moran 2021-12-27 14:01:17 -05:00 committed by Evan Gray
parent 94a15d37a9
commit 7f74392a91
1 changed files with 12 additions and 0 deletions

View File

@ -89,6 +89,18 @@ export const selectNFTSourceError = (state: RootState): string | undefined => {
// TODO: more advanced NFT check - also check supply and uri
return "For non-NFTs, use the Transfer flow";
}
if (
state.nft.sourceParsedTokenAccount?.uri === null ||
state.nft.sourceParsedTokenAccount?.uri === undefined
) {
return "Failed to load NFT Metadata.";
}
if (
state.nft.sourceParsedTokenAccount?.uri &&
state.nft.sourceParsedTokenAccount?.uri.length > 200
) {
return "This NFT has a URL longer than the maximum supported length of 200.";
}
try {
// these may trigger error: fractional component exceeds decimals
if (