Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

update: cli refact #15

Merged
merged 5 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .gitbook/assets/09_gnodev_build_run.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/10_gnodev_test_fail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/11_gnodev_test_ok.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/12_gnokey_build_recover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/13_gnokey_query_accounts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/14_gnokey_addpkg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/16_gnokey_maketx_call.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/17_gnokey_query.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/17_gnokey_query.png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/18_gnokey_new_addr_test3_balance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/19_gian_faucet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/2-11-dec-fix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/2-11-enc-fix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed .gitbook/assets/2-11.png
Binary file not shown.
Binary file added .gitbook/assets/2-12-dec-fix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/2-12-enc-fix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed .gitbook/assets/2-12.png
Binary file not shown.
Binary file modified .gitbook/assets/2-14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/2-15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/2-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/2-17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/2-18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/20_310_balance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed .gitbook/assets/21_gnoscan.png
Binary file not shown.
Binary file modified .gitbook/assets/21_test3_deploy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/22_gnoscan.png
Binary file modified .gitbook/assets/gor_01_01_test.png
Binary file modified .gitbook/assets/gor_01_02_addpkg.png
Binary file modified .gitbook/assets/gor_01_04_maketx.png
Binary file modified .gitbook/assets/gor_01_05_qrender.png
Binary file modified .gitbook/assets/gor_01_06_qeval.png
Binary file modified .gitbook/assets/gor_05_01_addpkg.png
Binary file modified .gitbook/assets/gor_05_02_faucetwithoutadmin.png
Binary file modified .gitbook/assets/img02.png
Binary file modified .gitbook/assets/img03.png
Binary file modified .gitbook/assets/img04.png
Binary file modified .gitbook/assets/img05.png
2 changes: 1 addition & 1 deletion docs/building-a-realm/realm-examples/foo.gno.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func assertGRC20Balance(t *testing.T, addr users.AddressOrName, expectedBal uint
}
```

> **Tip:** the `boards` realm enables users to [register addresses with usernames](https://onbloc.gitbook.io/gnoland-developer-portal/tutorials/cli/cli-examples#register-as-a-user) on `/r/demo/boards` for simplicity and convenience. 
> **Tip:** the `users` realm enables users to register addresses with usernames([example](https://onbloc.gitbook.io/gnoland-developer-portal/tutorials/interact-with-gnoland#register-as-a-user)) on `/r/demo/users` for simplicity and convenience. 



Expand Down
93 changes: 52 additions & 41 deletions docs/cli/gnokey.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ $ gnokey add {KEY_NAME}

| Name | Type | Description |
| ----------- | ---------- | -------------------------------------------------------------------------------------- |
| `account` | UInt | Account number for HD derivation. |
| `dryrun` | Boolean | Performs action, but doesn't add key to local keystore. |
| `index` | UInt | Address index number for HD derivation. |
| `ledger` | Boolean | Stores a local reference to a private key on a Ledger device. |
| `multisig` | String \[] | Constructs and stores a multisig public key (implies `--pubkey`). |
| `threshold` | Int | K out of N required signatures. For use in conjunction with --multisig (default: `1`). |
| `nobackup` | Boolean | Doesn't print out seed phrase (if others are watching the terminal). |
| `nosort` | Boolean | Keys passed to `--multisig` are taken in the order they're supplied. |
| `pubkey` | String | Parses a public key in bech32 format and save it to disk. |
| `ledger` | Boolean | Stores a local reference to a private key on a Ledger device. |
| `recover` | Boolean | Provides seed phrase to recover existing key instead of creating. |
| `nobackup` | Boolean | Doesn't print out seed phrase (if others are watching the terminal). |
| `dryrun` | Boolean | Performs action, but doesn't add key to local keystore. |
| `account` | UInt | Account number for HD derivation. |
| `index` | UInt | Address index number for HD derivation. |
| `threshold` | Int | K out of N required signatures. For use in conjunction with --multisig (default: `1`). |

#### **Example Result**

Expand Down Expand Up @@ -72,9 +72,9 @@ $ gnokey delete {KEY_NAME}

<figure><img src="../../../.gitbook/assets/2-10.png" alt=""><figcaption></figcaption></figure>

## Export an Encrypted Private Key
## Export a Private Key (Encrypted & Unencrypted)

Export a private key's encrypted armor using the following command.
Export a private key's (encrypted or unencrypted) armor using the following command.

```bash
$ gnokey export
Expand All @@ -85,30 +85,40 @@ $ gnokey export
| Name | Type | Description |
| ------------- | ------ | ---------------------------------------------------- |
| `key` | String | Name or Bech32 address of the private key |
| `output-path` | String | The desired output path for the encrypted armor file |
| `output-path` | String | The desired output path for the armor file |
| `unsafe` | Bool | Export the private key armor as unencrypted |

#### **Example Result**
#### **Example Result - Encrypted**

<figure><img src="../../../.gitbook/assets/2-11-enc-fix.png" alt=""><figcaption></figcaption></figure>

<figure><img src="../../../.gitbook/assets/2-11.png" alt=""><figcaption></figcaption></figure>
#### **Example Result - Unencrypted**

## Import an Encrypted Private Key
<figure><img src="../../../.gitbook/assets/2-11-dec-fix.png" alt=""><figcaption></figcaption></figure>

Import a private key's encrypted armor with the following command.
## Import a Private Key (Encrypted & Unencrypted)

Import a private key's (encrypted or unencrypted) armor with the following command.

```bash
$ gnokey import
```

#### **Options**

| Name | Type | Description |
| ------------ | ------ | ------------------------------------- |
| `name` | String | The name of the private key. |
| `armor-path` | String | The path to the encrypted armor file. |
| Name | Type | Description |
| ------------ | ------ | ------------------------------------------- |
| `armor-path` | String | The path to the encrypted armor file. |
| `name` | String | The name of the private key. |
| `unsafe` | Bool | Import the private key armor as unencrypted |

#### **Example Result**
#### **Example Result - Encrypted**

<figure><img src="../../../.gitbook/assets/2-12-enc-fix.png" alt=""><figcaption></figcaption></figure>

#### **Example Result - Unencrypted**

<figure><img src="../../../.gitbook/assets/2-12.png" alt=""><figcaption></figcaption></figure>
<figure><img src="../../../.gitbook/assets/2-12-dec-fix.png" alt=""><figcaption></figcaption></figure>

## Make an ABCI Query

Expand Down Expand Up @@ -164,13 +174,13 @@ $ 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 \
-deposit="1ugnot" \
-gas-fee="1ugnot" \
-gas-wanted="5000000" \
-pkgpath={Registered Realm path} \
-pkgdir={Package folder path} \
{ADDRESS} \
> unsigned.tx
```

Expand Down Expand Up @@ -202,15 +212,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="1ugnot" \
-gas-wanted="5000000" \
-pkgpath="gno.land/r/demo/users" \
-send="200000000ugnot" \
-func="Register" \
-args="" \
-args={NAME} \
-args="" \
{ADDRESS} \
> unsigned.tx
```

Expand Down Expand Up @@ -242,12 +253,12 @@ 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="5000000" \
-send={SEND_AMOUNT} \
-to={TO_ADDRESS} \
{ADDRESS} \
> unsigned.tx
```

Expand Down
75 changes: 38 additions & 37 deletions tutorials/interact-with-gnoland.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This tutorial will teach you how to interact with the Gnoland blockchain by crea

## Prerequisites

* [Initial Setup](../docs/environment-setup/initial-setup.md)
- [Initial Setup](../docs/environment-setup/initial-setup.md)

## Create an Account

Expand All @@ -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="1ugnot" \
-gas-wanted="5000000" \
-broadcast="true" \
-remote="test3.gno.land:36657" \
-chainid="test3" \
-pkgpath="gno.land/r/demo/users" \
-func="Register" \
-args="" \
-args="my_account" \ # (must be at least 6 characters, lowercase alphanumeric with underscore)
-args="" \
-send="200000000ugnot" \
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 -remote="test3.gno.land:36657" "auth/accounts/{address}"

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

# 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 -remote="test3.gno.land:36657" -data "gno.land/r/demo/users
my_account" "vm/qrender"
```

## Send Tokens
Expand All @@ -59,15 +60,15 @@ 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 send \
-gas-fee="1ugnot" \
-gas-wanted="5000000" \
-broadcast="true" \
-remote="test3.gno.land:36657" \
-chainid="test3" \
-to="{address}" \ # g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5
-send="{amount}{denom}" \ # 1234ugnot
my-account
```

## Create a Board
Expand All @@ -76,14 +77,14 @@ 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="1ugnot" \
-gas-wanted="5000000" \
-broadcast="true" \
-remote "test3.gno.land:36657" \
-chainid="test3" \
-pkgpath="gno.land/r/demo/boards" \
-func="CreateBoard" \
-args="my_board" \
my-account
```
Loading