diff --git a/apps/token-server/config.ts b/apps/token-server/config.ts --- a/apps/token-server/config.ts +++ b/apps/token-server/config.ts @@ -31,7 +31,7 @@ // See Production Step 3 in README.md imageDir: '/token-server/token-icons', rejectedDir: '/token-server/rejected', - maxUploadSize: 500000, // max upload size in bytes + maxUploadSize: 1000000, // max upload size in bytes // We support uploading image files from these origins whitelist: [ 'http://localhost:3000', diff --git a/cashtab/src/components/Etokens/CreateTokenForm/index.js b/cashtab/src/components/Etokens/CreateTokenForm/index.js --- a/cashtab/src/components/Etokens/CreateTokenForm/index.js +++ b/cashtab/src/components/Etokens/CreateTokenForm/index.js @@ -69,6 +69,7 @@ const isNftMint = Array.isArray(nftChildGenesisInput); const NFT_DECIMALS = 0; const NFT_GENESIS_QTY = '1'; + const ICON_MAX_UPLOAD_BYTES = 1000000; const navigate = useNavigate(); const location = useLocation(); const userLocale = getUserLocale(navigator); @@ -442,7 +443,9 @@ // Name must not be empty formData.name !== '' && // If this is an nft mint, we need an NFT Mint Input - ((isNftMint && nftChildGenesisInput.length === 1) || !isNftMint); + ((isNftMint && nftChildGenesisInput.length === 1) || !isNftMint) && + (tokenIcon === '' || + (tokenIcon !== '' && tokenIcon.size <= ICON_MAX_UPLOAD_BYTES)); const submitTokenIcon = async tokenId => { let submittedFormData = new FormData(); @@ -868,17 +871,22 @@ ? 'Mint NFT' : 'Create eToken'} - - {!tokenGenesisDataIsValid - ? `${ - isNftMint - ? 'NFT' - : createNftCollection - ? 'NFT Collection' - : 'Token' - } must have a name` - : ''} - + {formData.name === '' && ( + + {isNftMint + ? 'NFT' + : createNftCollection + ? 'NFT Collection' + : 'Token'}{' '} + must have a name + + )} + {tokenIcon !== '' && tokenIcon.size > ICON_MAX_UPLOAD_BYTES && ( + + Icon exceeds max upload size of{' '} + {ICON_MAX_UPLOAD_BYTES.toLocaleString()} bytes + + )} );