- yarn
- can be installed with
brew install yarn
- can be installed with
- Run
yarn installto install dependencies - In a terminal, run
cp dev.env .env- please note, I did not take the time to setup a local blockchain with something likeganache. - Install Metamask and setup a wallet with the Harmony One testnet - see https://docs.harmony.one/home/network/wallets/browser-extensions-wallets/metamask-wallet I suggest using the mobile version.
- In the
.envfile in the project, add the private key and mnemonic from your wallet. https://metamask.zendesk.com/hc/en-us/articles/360015290032-How-to-Reveal-Your-Seed-Phrase https://metamask.zendesk.com/hc/en-us/articles/360015289632-How-to-Export-an-Account-Private-Key - You can fund your wallet by visiting https://faucet.pops.one/
- run
yarn truffle compile- this will compile the contracts to do so. - Run
truffle migrate --network testnetto run migrations and deploy the contract to testnet. - Run the truffle cli -
yarn truffle console --network testnet - Type
ArtCollectibleToken- this should dump the contents of the smart contract - Type
nft = await ArtCollectibleToken.deployed()- we can now interact with our contract throughnft.
Typingnftwill dump the entire object, - You will need to create a
tokenUrifor metadata and display - Example is in the project -json/art-sample.json - Now run
await nft.mint("address of recipient","image url","artist name", "tokenUri")- this will mint the token and send it to the intended recipient. Use your own address, and it is probably a good idea to have the image url match the metadata url. Copy the address from your metamask wallet, not in theoneformat.
You should able to see your NFT in Metamask mobile - you can add it to Metamask in Chrome but it will not render as a collectible. (https://metamask.zendesk.com/hc/en-us/articles/360015489031-How-to-View-See-Your-Tokens-and-Custom-Tokens-in-Metamask)
Let me know if there are any issues!