How to run the frontend:
- Node.js > 12
- Yarn Classic, aka Yarn v1, you can install it using this guide. If you are using macOS a simple
brew install yarnshould work.
On a terminal, install all the dependencies:
cd contract
yarn install
yarn compileOn a terminal
cd contract
yarn exec hardhat nodeThis command launch an HTTP and WebSocket JSON-RPC server @ http://127.0.0.1:8545/, you can use it as Web3 Provider on Remix.
On another terminal, deploy it
cd contract
yarn deploy- An Alchemy account with a valid project on a Testnet (I suggest Mumbai Polygon testnet).
- An account with some funds on the chain selected before, if you choose Mumbai you can obtain them on the official faucet
- The choosen testnet available as Network in MetaMask, you can add Mumbai Testnet from here. (You can find a longer guide here)
- Rename
contract/.env.exampleincontract/.envand put in it theAPI_URLthat can be found in the Alchemy Dashboard. - Export your MetaMask private key and put it in the
PRIVATE_KEYfield in the.envfile - Uncomment the
mumbaipart incontract/hardhat.config.js - Run
yarn deploy:testnet
On terminal:
cd frontend
yarn install
yarn start You can now visit http://localhost:3000/
cd frontend
docker build -t blockchain-frontend .
docker run -p 8000:80 blockchain-frontend:latestYou can now visit http://localhost:8000/
- Launch a local node, as described here
- Deploy the contract on a local node, as described before
- Connect MetaMask to
http://127.0.0.1:8545/ - Import an Account on Metamask from the private key printed on terminal in step
1, as described here - Open
contract\artifacts\contracts\NFTSwap.sol\NFTSwap.jsonand paste the content intofrontend\src\contracts\contract-abi.json. - Edit
frontend\src\utils\blockchain.jswithCONTRACT_ADDRESSobtained in point2