Here is a simple boilerplate to code smartweave contracts and iterate tests quickly.
$ git clone [email protected]:bidetaggle/testweave-boilerplate.git --recursive
$ cd testweave-boilerplate/
$ npm install
- Run testweave-docker
$ cd testweave-docker
$ docker-compose up
-
In a separate terminal,
$ cd src/
-
Generate user wallets
$ node generate-wallets.js
- Deploy the contract you are working on
$ node contract.js deploy <contract name>
This command will find the contract file <contract name>.js
and its initial state file <contract name>.json
situated in /contracts/
directory.
-
Edit
INPUT.js
as you like -
Interact with the last contract deployed
$ node contract.js interact [wallet number (opt: default=0)]
And that's it 🙂
Also, you can read the contract state at anytime by using:
$ node contract.js read
If you get issues with testweave-docker, it sometimes helps to hard reset:
$ docker-compose down
if it's still running$ docker container prune
$ docker volume prune
$ docker-compose up