This repository demonstrates how 0xweb can be used in Hardhat development process. It also serves as a CI pipeline for publishing the 0xweb package, streamlining the development and deployment process.
Further reading https://github.com/NomicFoundation/hardhat/blob/main/docs/src/content/hardhat-runner/docs/advanced/using-0xweb.md
Install the 0xweb package and initialize the project with Hardhat:
npm i 0xweb
npx 0xweb init --hardhat
Update the configuration to generate JavaScript modules instead of TypeScript classes (default):
npx 0xweb config --set settings.generate.target=mjs
Start the Hardhat node and compile your contracts. This will also generate MyToken classes in the ./0xc/hardhat/ directory:
npx hardhat node
# Generates also MyToken classes in ./0xc/hardhat/
npx hardhat compile
Run the script to:
- Deploy the contract (if not already deployed),
- Read data from the contract, and
- Update data in the contract:
node scripts/contracts.mjs