Install latest lts version of node using nvm: nvm install node --lts If already installed: nvm use --lts
- Install dependency
npm install
- To produce abi code of the latest contract that will interact with frontend, run:
npx hardhat compile
- Setup local eth blockchain network using node. It will provide pre-funded accounts also.:
npx hardhat node
- Open a new terminal and run the frontend code
npm run dev
-
Open the frontend page at http://localhost:5173/ at Chrome. Please use chrome only as we need metamask in chrome extension for wallet.
-
To add localhost to metamask, add a network and "add network manually"
-
Copy the JSON-RPC server address which should be: http://127.0.0.1:8545/
-
Select "Add network manually" and fill in the relevant details. Chain Id should be 1337.
-
Copy pre-loaded account's private key and import them in metamask.
-
Use Account 0,1,2 for user1, user2, and seller1 respectively
-
Now you will be able to log into the dutch auction frontend application.
-
Once you have made any transactions, metamask will keep a record of them.
-
Thus when you restart your local hardhat blockchain, it will be inconsistent with metamask and thus throw errors.
-
In order to resolve this, you need to go to metamask settings -> advanced -> clear tab activity data for each account you made transactions with.
-
You may also wish to click on "Delete database" to clear all the existing auction and token data tied to the users on the application.
To run the test case report together with the reported gas used, run
REPORT_GAS=true npx hardhat test
To run the coverage report, you may run npx hardhat coverage
npx hardhat coverage --solcoverjs ./solcover.js
You may find the coverage report under coverage folder