keroro520 / godwoken-examples

Home Page:https://nervosnetwork.github.io/godwoken-examples/html/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Godwoken Examples

Install dependencies & Build

yarn && yarn build-all

Update Tools Configs

Firstly copy config files.

export SCRIPT_DEPLOY_RESULT_PATH=<your godwoken `scripts-deploy-result.json`>
export GODWOKEN_CONFIG_PATH=<your godwoken `config.toml`>
yarn copy-configs

Or copy by yourself.

cp <your godwoken `scripts-deploy-result.json`> packages/tools/configs/scripts-deploy-result.json
cp <your godwoken `config.toml`> packages/tools/configs/godwoken-config.toml
yarn convert-config-format # convert `godwoken-config.toml` to `godwoken-config.json`

For testnet

yarn generate-testnet-configs

Generate your lumos config

If run dev chain, lumos config should generated by yourself, and this tool may help you.

For example, in linux system

wget https://github.com/classicalliu/lumos-config-generator/releases/download/v0.1.1/lumos-config-generator-linux-amd64 -O lumos-config-generator
chmod +x ./lumos-config-generator
./lumos-config-generator
# `config.json` is the generated lumos config file.

Account operations

Run node ./packages/tools/lib/account-cli.js --help to see how to deposit, deposit-sudt, transfer, withdraw and get-balance.

LUMOS_CONFIG_FILE=<your lumos config file path> node ./packages/tools/lib/account-cli.js --help # for devnet
node ./packages/tools/lib/account-cli.js --help # for testnet

Polyjuice CLI

Run node ./packages/tools/lib/polyjuice-cli.js --help to see how to creator creator account, deploy contract, call contract.

node ./packages/tools/lib/polyjuice-cli.js --help # for devnet
ENABLE_TESTNET_MODE=true node ./packages/tools/lib/polyjuice-cli.js --help # for testnet

Debug

If you want to debug your commands and need more information in the console, please set DEBUG environment variable, eg.:

DEBUG=true node ./packages/tools/lib/account-cli.js

About

https://nervosnetwork.github.io/godwoken-examples/html/

License:MIT License


Languages

Language:JavaScript 54.6%Language:TypeScript 45.4%Language:Shell 0.0%Language:Solidity 0.0%