A minimalistic example - metamask docs.
- Clone the repo
git clone https://github.com/akshtsng/HtmlFundMe
cd HtmlFundMe
- Run the file.
Optionally:
If running with prettier formatting, or don't have a way to run file in the browser, run:
yarn
yarn http-server
A small button can be see that says "connect", metamask will pop on clicking it.
To execute a transaction follow this:
Make sure to have the following installed:
- Need to open up a second terminal and run:
git clone https://github.com/akshtsng/HardhatFundMe
cd HardhatFundMe
yarn
yarn hardhat node
This will deploy a sample contract and start a local hardhat blockchain.
- Update
constants.js
with the new contract address.
In constants.js
file, update the variable contractAddress
with the address of the deployed "FundMe" contract. It can be seen near the top of the hardhat output.
- Connect metamask to local hardhat blockchain.
In the output of the above command, take one of the private key accounts and import it into metamask.
Additionally, add localhost with chainid 31337 to metamask.
- Reserve the front end with
yarn http-server
, input an amount in the text box, and hitfund
button after connecting