truffle
truffle copied to clipboard
Fix Filecoin Box
PR #3 on the Filecoin box updates the readme to give details on the expected behavior of the box.
Currently, the box breaks when attempting to view minted NFTs on the gallery UI. The template UI, which points to the contract on Rinkeby and assets already hosted on IPFS works just fine. However, whenever you try uploading an image to your local IPFS node and minting it with the contract, the UI does not display the uploaded image.
@kevinbluer and I did some digging on this and have tracked down the bug to being an issue with the MyGallery contract. The contract sets the default URI to fetch the metadata for the gallery images as https://ipfs.io/ipfs/. This is fine for the template project which has the assets fully hosted on IPFS. Since the Ganache IPFS node does not sync with real IPFS nodes, however, none of the assets uploaded when testing the box are available on IPFS.
The contract constructor should allow the user to set the URI. It should probably read from some .env file when migrating to set it to https://ipfs.io/ipfs/ in production and 127.0.0.1:5001/ipfs in development.
As a side note, the way Ganache serves data on 127.0.0.1:5001/ipfs seems to restrict GET requests, so something like axios may need to be used to make POST requests instead.