You can follow the command-lines below to install Godwoken-Tests in your local environment, and run contract tests on testnet_v1:
git clone https://github.com/nervosnetwork/godwoken-tests
- Clone Godwoken-Testscd godwoken-tests/contracts
- Go to contracts foldernpm install
- Install dependenciesnpm run test:gw_testnet_v1
- Run tests on testnet_v1
If you wish to run tests on devnet instead of testnet, please read the current section.
First, you need to install Godwoken-Kicker, and then deploy a local devnet_v1 running in the localhost network:
git clonehttps://github.com/RetricSu/godwoken-kicker
- Clone Godwoken-Kickercd godwoken-kicker
- Go to kicker tool’s folder./kicker start
- Deploy and start a devnet_v1 in localhost network
The deployment will take some time to complete, and for more detailed about how to start devnet in your localhost network, please read this: Deploy Local Network of Godwoken.
After the devnet started, you should deposit some testing capacity of testing accounts from layer 1 (CKB network) to layer 2 (Godwoken network):
./kicker deposit 0x966b30e576a4d6731996748b48dd67c94ef29067 10000
./kicker deposit 0x4fef21f1d42e0d23d72100aefe84d555781c31bb 10000
NOTE: After the deposit commands have been completed, please wait 15 seconds before moving forward. Godwoken needs some time to consume and confirm deposit requests.
After deposited, you can follow command-lines below to install Godwoken-Tests in your local environment, and run contract tests on devnet_v1:
git clone https://github.com/nervosnetwork/godwoken-tests
- Clone Godwoken-Testscd godwoken-tests/contracts
- Go to contracts foldernpm install
- Install dependenciesnpm run test
- Run tests on devnet_v1
Testing accounts are defined in contracts/hardhat.config.js.
If you prefer using your own accounts for testing, you can replace them in the source code, or run test commands with environment variables, for example:
PRIVATE_KEY=<YOUR_KEY> npm run test