metaplex-foundation / metaplex

A directory of what the Metaplex Foundation works on!
https://metaplex.com
Apache License 2.0
3.32k stars 6.26k forks source link

[Bug]: Candy Machine cannot upload a set of mixed format assets #1874

Closed srazzak closed 2 years ago

srazzak commented 2 years ago

Which package is this bug report for?

candy machine cli

Issue description

I was trying to upload a set of assets with different file formats (MP4 and PNG) and it appears that it won't accept multiple types of assets. The upload command will raise the error I've added below.

After reviewing those lines of code, my guess is that after it filters the supported files, it does a count of both animated files and image files within the animatedFileCount and imageFileCount variables. But then when the asset to JSON file count check happens it compares only one of them. So if one were to have 8 PNG files and 2 MP4 files, the comparison will always fail since 8 != 10 and 2 != 10.

Command

ts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts upload -e devnet -k ~/.config/solana/devnet.json -cp config.json -c example assets

Relevant log output

(node:28512) UnhandledPromiseRejectionWarning: Error: number of animation files (2) is different than the number of json files (96)
    at Command.<anonymous> (C:\Users\User\Documents\GitHub\minting\~\metaplex\js\packages\cli\src\candy-machine-v2-cli.ts:201:13)

Operating system

Windows

Priority this issue should have

Medium (should be fixed soon)

Check the Docs First

stegaBOB commented 2 years ago

Ah I get the issue here. I didn't read this properly. All NFTs need an image field. Explorers and wallets will default to that if they don't support the animation file yet.

sekoyo commented 2 years ago

Ah I get the issue here. I didn't read this properly. All NFTs need an image field. Explorers and wallets will default to that if they don't support the animation file yet.

Thanks I didn't get this either, couldn't find clear documentation on the fields (count? imageFileCount? animationFileCount? animated_url? I deduced animated_url replaces image), or how to do non-image media so was picking up bits and pieces from outside the main tutorial which is only images.

Still not sure if I just need to add back the image field, or also an entry in the files array? Still getting the error.

Would you mind sharing your config.json and the asset json with the mp4 please?