Skip to content

Commit

Permalink
Change gnodev, gnokey and gnofaucets commands so they are compatible …
Browse files Browse the repository at this point in the history
…the new cli

Since the new cli gnolang/gno#497 2 weeks ago,
the tools like gnodev use single dash options (-foo) instead of --foo,
and the address has to be put at the end. The pictures aren't changed
however.
  • Loading branch information
grepsuzette committed Mar 14, 2023
1 parent 1e681ec commit 32e6dc3
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 125 deletions.
4 changes: 2 additions & 2 deletions docs/cli/gnofaucet.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ $ gnofaucet serve
### **Step 1. Create an account named `test1` with the test seed phrase below.**

```bash
$ gnokey add test1 --recover
$ gnokey add -recover test1
```

> **Test Seed Phrase:** source bonus chronic canvas draft south burst lottery vacant surface solve popular case indicate oppose farm nothing bullet exhibit title speed wink action roast
### **Step 2. Run `gnofaucet`**

```bash
$ gnofaucet serve test1 --chain-id dev --send 500000000ugnot
$ gnofaucet serve -chain-id dev -send 500000000ugnot test1
```

### **Step 3. Receive GNOTs from the faucet**
Expand Down
55 changes: 29 additions & 26 deletions docs/cli/gnokey.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ $ gnokey query {QUERY_PATH}
| ------------------------- | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- |
| `auth/accounts/{ADDRESS}` | Returns information about an account. | `$ gnokey query auth/accounts/g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` |
| `bank/balances/{ADDRESS}` | Returns balances of an account. | `$ gnokey query bank/balances/g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` |
| `vm/qfuncs` | Returns public facing function signatures as JSON. | `$ gnokey query vm/qfuncs --data "gno.land/r/demo/boards"` |
| `vm/qfile` | Returns the file bytes, or list of files if directory. | `$ gnokey query vm/qfile --data "gno.land/r/demo/boards"` |
| `vm/qrender` | Calls .Render(\<path>) in readonly mode. | `$ gnokey query vm/qrender --data "gno.land/r/demo/boards"` |
| `vm/qeval` | Evaluates any expression in readonly mode and returns the results. | `$ gnokey query vm/qeval --data "gno.land/r/demo/boards GetBoardIDFromName("my_board")"` |
| `vm/qfuncs` | Returns public facing function signatures as JSON. | `$ gnokey query vm/qfuncs -data "gno.land/r/demo/boards"` |
| `vm/qfile` | Returns the file bytes, or list of files if directory. | `$ gnokey query vm/qfile -data "gno.land/r/demo/boards"` |
| `vm/qrender` | Calls .Render(\<path>) in readonly mode. | `$ gnokey query vm/qrender -data "gno.land/r/demo/boards"` |
| `vm/qeval` | Evaluates any expression in readonly mode and returns the results. | `$ gnokey query vm/qeval -data "gno.land/r/demo/boards GetBoardIDFromName("my_board")"` |
| `vm/store` | (not yet supported) Fetches items from the store. | - |
| `vm/package` | (not yet supported) Fetches a package's files. | - |

Expand Down Expand Up @@ -164,13 +164,14 @@ $ gnokey maketx {SUB_COMMAND} {ADDRESS or KeyName}
This subcommand lets you upload a new package.

```bash
$ gnokey maketx addpkg {ADDRESS} \
--gas-fee "1ugnot" \
--gas-wanted "5000000" \
--memo "" \
--pkgpath {Registered Realm path} \
--pkgdir {Package folder path} \
--deposit "" \
$ gnokey maketx addpkg \
-gas-fee "1ugnot" \
-gas-wanted "5000000" \
-memo "" \
-pkgpath {Registered Realm path} \
-pkgdir {Package folder path} \
-deposit "" \
{ADDRESS} \
> unsigned.tx
```

Expand Down Expand Up @@ -202,15 +203,16 @@ This subcommand lets you call a public function.

```bash
# Register
gnokey maketx call {ADDRESS} \
--gas-fee "1000000ugnot" \
--gas-wanted "2000000" \
--pkgpath "gno.land/r/demo/users" \
--send "200000000ugnot" \
--func "Register" \
--args "" \
--args {NAME} \
--args "" \
gnokey maketx call \
-gas-fee "1000000ugnot" \
-gas-wanted "2000000" \
-pkgpath "gno.land/r/demo/users" \
-send "200000000ugnot" \
-func "Register" \
-args "" \
-args {NAME} \
-args "" \
{ADDRESS} \
> unsigned.tx
```

Expand Down Expand Up @@ -242,12 +244,13 @@ gnokey maketx call {ADDRESS} \
This subcommand lets you send a native currency to an address.

```bash
gnokey maketx send {ADDRESS} \
--gas-fee "1ugnot" \
--gas-wanted "2000000" \
--memo "" \
--send {SEND_AMOUNT} \
--to {TO_ADDRESS} \
gnokey maketx send \
-gas-fee "1ugnot" \
-gas-wanted "2000000" \
-memo "" \
-send {SEND_AMOUNT} \
-to {TO_ADDRESS} \
{ADDRESS} \
> unsigned.tx
```

Expand Down
61 changes: 32 additions & 29 deletions tutorials/cli/cli-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ You may create a new account or recover one using the seed phrase.
```bash
$ gnokey generate # create a new seed phrase (mnemonic)

$ gnokey add my-account --recover # registers a key named ‘my-account’ with a seed phrase
$ gnokey add -recover my-account # registers a key named ‘my-account’ with a seed phrase

$ gnokey list # check the list of keys
```
Expand All @@ -17,15 +17,15 @@ $ gnokey list # check the list of keys
### **Step 1. Create an account named `test1` with the test seed phrase below.**

```bash
$ gnokey add test1 --recover
$ gnokey add -recover test1
```

> **Test Seed Phrase:** source bonus chronic canvas draft south burst lottery vacant surface solve popular case indicate oppose farm nothing bullet exhibit title speed wink action roast
### **Step 2. Run the gnofaucet**

```bash
$ gnofaucet serve test1 --chain-id dev --send 500000000ugnot
$ gnofaucet serve -chain-id dev -send 500000000ugnot test1
```

### **Step 3. Request for GNOT from the faucet**
Expand All @@ -39,16 +39,17 @@ $ curl --location --request POST 'http://localhost:5050' \
## Register As a User

```bash
$ gnokey maketx call my-account \
--gas-fee "1000000ugnot" \
--gas-wanted "2000000" \
--pkgpath "gno.land/r/demo/users" \
--broadcast \
--send "200000000ugnot" \
--func "Register" \
--args "" \
--args "my_account" \ # (must be at least 6 characters, lowercase alphanumeric with underscore)
--args ""
$ gnokey maketx call \
-gas-fee "1000000ugnot" \
-gas-wanted "2000000" \
-pkgpath "gno.land/r/demo/users" \
-broadcast \
-send "200000000ugnot" \
-func "Register" \
-args "" \
-args "my_account" \ # (must be at least 6 characters, lowercase alphanumeric with underscore)
-args "" \
my-account

# username: must be at least 6 characters, lowercase alphanumeric with underscore
```
Expand All @@ -65,7 +66,7 @@ $ gnokey query auth/accounts/{address}
$ gnokey query bank/balances/{address}

# Get /r/demo/boards user information
$ gnokey query vm/qrender --data "gno.land/r/demo/users
$ gnokey query vm/qrender -data "gno.land/r/demo/users
my_account"
```

Expand All @@ -75,13 +76,14 @@ The following command will send 1,000,000 ugnot (= 1 GNOT) to the address specif

```bash
# Creates and broadcast a token transfer transaction
$ gnokey maketx send my-account \
--gas-fee "1ugnot" \
--gas-wanted "2000000" \
--memo "" \
--broadcast \
--send "1000000ugnot" \
--to "{address}"
$ gnokey maketx send \
-gas-fee "1ugnot" \
-gas-wanted "2000000" \
-memo "" \
-broadcast \
-send "1000000ugnot" \
-to "{address}" \
my-account
```

## Create a Board
Expand All @@ -90,12 +92,13 @@ You can create a board called `my_board` on the `gno.land/r/demo/boards` realm w

```bash
# Calls the CreateBoard function of gno.land/r/demo/boards
$ gnokey maketx call my-account \
--gas-fee "1000000ugnot" \
--gas-wanted "10000000" \
--broadcast \
--pkgpath "gno.land/r/demo/boards" \
--send "" \
--func "CreateBoard" \
--args "my_board"
$ gnokey maketx call \
-gas-fee "1000000ugnot" \
-gas-wanted "10000000" \
-broadcast \
-pkgpath "gno.land/r/demo/boards" \
-send "" \
-func "CreateBoard" \
-args "my_board" \
my-account
```
47 changes: 25 additions & 22 deletions tutorials/cli/gno-commands/gnokey.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,14 @@ $ gnokey maketx {SUB_COMMAND} {ADDRESS or KeyName}
This subcommand lets you upload a new package.

```bash
$ gnokey maketx addpkg {ADDRESS} \
--gas-fee "1ugnot" \
--gas-wanted "5000000" \
--memo "" \
--pkgpath {Registered Realm path} \
--pkgdir {Package folder path} \
--deposit "" \
$ gnokey maketx addpkg \
-gas-fee "1ugnot" \
-gas-wanted "5000000" \
-memo "" \
-pkgpath {Registered Realm path} \
-pkgdir {Package folder path} \
-deposit "" \
{ADDRESS} \
> unsigned.tx
```

Expand Down Expand Up @@ -202,15 +203,16 @@ This subcommand lets you call a public function.

```bash
# Register
gnokey maketx call {ADDRESS} \
--gas-fee "1000000ugnot" \
--gas-wanted "2000000" \
--pkgpath "gno.land/r/demo/users" \
--send "200000000ugnot" \
--func "Register" \
--args "" \
--args {NAME} \
--args "" \
gnokey maketx call \
-gas-fee "1000000ugnot" \
-gas-wanted "2000000" \
-pkgpath "gno.land/r/demo/users" \
-send "200000000ugnot" \
-func "Register" \
-args "" \
-args {NAME} \
-args "" \
{ADDRESS} \
> unsigned.tx
```

Expand Down Expand Up @@ -242,12 +244,13 @@ gnokey maketx call {ADDRESS} \
This subcommand lets you send a native currency to an address.

```bash
gnokey maketx send {ADDRESS} \
--gas-fee "1ugnot" \
--gas-wanted "2000000" \
--memo "" \
--send {SEND_AMOUNT} \
--to {TO_ADDRESS} \
gnokey maketx send \
-gas-fee "1ugnot" \
-gas-wanted "2000000" \
-memo "" \
-send {SEND_AMOUNT} \
-to {TO_ADDRESS} \
{ADDRESS} \
> unsigned.tx
```

Expand Down
75 changes: 39 additions & 36 deletions tutorials/interact-with-gnoland.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,27 @@ In order to interact with Gnoland, you need an account that you will use to sign
```bash
$ gnokey generate # create a new seed phrase (mnemonic)

$ gnokey add {your_account_name} --recover # registers a key with the name set as the value you put in {your_account_name} with a seed phrase
$ gnokey add -recover {your_account_name} # registers a key with the name set as the value you put in {your_account_name} with a seed phrase

$ gnokey list # check the list of keys
```

## Register As a User

```bash
$ gnokey maketx call my-account \
--gas-fee "1000000ugnot" \
--gas-wanted "2000000" \
--pkgpath "gno.land/r/demo/users" \
--broadcast \
--send "200000000ugnot" \
--func "Register" \
--args "" \
--args "my_account" \ # (must be at least 6 characters, lowercase alphanumeric with underscore)
--args "" \
--chainid "test3" \
--remote "test3.gno.land:36657"
$ gnokey maketx call \
-gas-fee "1000000ugnot" \
-gas-wanted "2000000" \
-pkgpath "gno.land/r/demo/users" \
-broadcast \
-send "200000000ugnot" \
-func "Register" \
-args "" \
-args "my_account" \ # (must be at least 6 characters, lowercase alphanumeric with underscore)
-args "" \
-chainid "test3" \
-remote "test3.gno.land:36657"
my-account

# username: must be at least 6 characters, lowercase alphanumeric with underscore
```
Expand All @@ -43,14 +44,14 @@ $ gnokey maketx call my-account \

```bash
# Get account information
$ gnokey query auth/accounts/{address} --remote "test3.gno.land:36657"
$ gnokey query auth/accounts/{address} -remote "test3.gno.land:36657"

# Get account balance
$ gnokey query bank/balances/{address} --remote "test3.gno.land:36657"
$ gnokey query bank/balances/{address} -remote "test3.gno.land:36657"

# Get /r/demo/boards user information
$ gnokey query vm/qrender --data "gno.land/r/demo/users
my_account" --remote "test3.gno.land:36657"
$ gnokey query vm/qrender -data "gno.land/r/demo/users
my_account" -remote "test3.gno.land:36657"
```

## Send Tokens
Expand All @@ -59,15 +60,16 @@ The following command will send 1,000,000 ugnot (= 1 GNOT) to the address specif

```bash
# Creates and broadcast a token transfer transaction
$ gnokey maketx send my-account \
--gas-fee "1ugnot" \
--gas-wanted "2000000" \
--memo "" \
--broadcast \
--send "1000000ugnot" \
--to "{address}" \
--chainid "test3" \
--remote "test3.gno.land:36657"
$ gnokey maketx \
-gas-fee "1ugnot" \
-gas-wanted "2000000" \
-memo "" \
-broadcast \
-send "1000000ugnot" \
-to "{address}" \
-chainid "test3" \
-remote "test3.gno.land:36657" \
send my-account
```

## Create a Board
Expand All @@ -76,14 +78,15 @@ Try creating a board called `my_board` on the `gno.land/r/demo/boards` realm wit

```bash
# Calls the CreateBoard function of gno.land/r/demo/boards
$ gnokey maketx call my-account \
--gas-fee "1000000ugnot" \
--gas-wanted "10000000" \
--broadcast \
--pkgpath "gno.land/r/demo/boards" \
--send "" \
--func "CreateBoard" \
--args "my_board" \
--chainid "test3" \
--remote "test3.gno.land:36657"
$ gnokey maketx call \
-gas-fee "1000000ugnot" \
-gas-wanted "10000000" \
-broadcast \
-pkgpath "gno.land/r/demo/boards" \
-send "" \
-func "CreateBoard" \
-args "my_board" \
-chainid "test3" \
-remote "test3.gno.land:36657" \
my-account
```
Loading

0 comments on commit 32e6dc3

Please sign in to comment.