NFT Pet marketplace built on Flow and NFT Storage.
First, make sure you have installe Flow CLI and sign up for NFT.storage account to get the API token. You will also need to have Docker and Docker Compose installed.
-
Run the Flow chain emulator and the local dev wallet with
docker-compose up
-
Deploy the
PetshopContract
withflow project deploy
-
Optional: Pre-mint the NFTs
- Add NFT storage API key in the
.env.local
file withREACT_APP_NFTSTORAGE_API_KEY={your API token}
- Mint the NFTs with
npm run mint-tokens
, which run the program in/minter
that serializespets.json
and send transactions over to the local emulator and uploading images to NFT storage. - Alternatively, if you're adding the key to a different
.env.*
file, make sure to provide the path to the file withENVFILE={.env.*} npm run mint-tokens
.
- Add NFT storage API key in the
-
Click Login or Signup button to connect to a local dev wallet, which will let you choose an account. You can choose a separate account from the emulator (service account) or create new ones. Then, select "Activate Collection" under the dropdown menu for every new account.
-
Try minting, adopting (transfer from marketplace to you), and releasing (transferring back to the marketplace) pet NFTs.
💡 Pre-minting all pets with the command line will mint and deposit them to the emulator's (service account's) address, ready to be transferred to another logged in account.
Without the pre-minting, the logged in user will be able to mint each pet individually.
- Authentication
- Local dev wallet (emulator)
- Flow-compatible wallets (testnet)
- Non-fungible Token
- Account setup
- Minting (pre-minting and user-minting)
- Withdrawing and deposit
- Fungible Token
- Account setup
- Minting
- Withdrawing and deposit
- Storage
- Store images on NFT Storage
- Store all metadata on NFT Storage (testnet or mainnet)
It can be helpful to directly interact with the contract(s) via the Flow CLI. Try running the following in a separate terminal, while the emulator is running:
Get all the NFTs' IDs on the chain
flow scripts execute ./src/flow/scripts/pets/GetAllTokenIds.cdc
Get the NFT's metadata from its ID
flow scripts execute ./src/flow/scripts/pets/CheckTokenMetaData.cdc <id>
Mint a new NFT of your own. Check out pets.json
to get the idea of the JSON string to pass as an argument. Don't forget to include the IPFS link in the uri
field (or any link to an online image resource) for your NFT to show up.
flow transactions send ./src/flow/transactions/pets/MintPetToken.cdc <JSON-string-describing-a-pet>
Dog and cat photos from Unsplash.