From f528c49d232f2fd4a0f9241b8ca7584e567121ea Mon Sep 17 00:00:00 2001
From: Hugo Trentesaux <hugo@trentesaux.fr>
Date: Fri, 2 Jun 2023 16:59:40 +0200
Subject: [PATCH] add command examples

---
 README.md      |  2 ++
 doc/example.md | 44 ++++++++++++++++++++++++++++++++++++++++++++
 src/main.rs    |  2 +-
 3 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 doc/example.md

diff --git a/README.md b/README.md
index 0f97ffb..486a465 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,8 @@ List certifications and session keys that will expire within one month:
 
 	cargo run -- --url wss://gdev.p2p.legal:443/ws expire --blocks 432000
 
+For more examples see [in the example file](./doc/example.md).
+
 #### Log level
 
 You can adjust the log level:
diff --git a/doc/example.md b/doc/example.md
new file mode 100644
index 0000000..5d9b716
--- /dev/null
+++ b/doc/example.md
@@ -0,0 +1,44 @@
+# Examples of gcli commands for copy-paste
+
+Useful when developing: replace `gcli` by `cargo run --` to build in debug mode and launch gcli.
+
+## Mnemonics
+
+Used in duniter-indexer genesis config:  
+`pipe paddle ketchup filter life ice feel embody glide quantum ride usage`
+
+with derivations:
+
+- `//2` → `test1`
+- `//4` → `test2`
+- `//6` → `test3`
+
+Used in substrate for Alice, Bob and Co:  
+`bottom drive obey lake curtain smoke basket hold race lonely fit walk`
+
+with derivations:
+
+- `//Alice`
+- `//Bob`
+- `//Charlie`
+- ...
+
+## Commands
+
+```sh
+# get balance of test1 account
+gcli --address 5FeggKqw2AbnGZF9Y9WPM2QTgzENS3Hit94Ewgmzdg5a3LNa get-balance
+# get information about test1 identity (needs indexer)
+gcli identity --username test1
+# show address of given secret
+gcli --secret "pipe paddle ketchup filter life ice feel embody glide quantum ride usage"//2 show-address
+```
+
+## Indexer commands
+
+These commands uniquely relate with indexer
+
+```sh
+# show latest indexer indexed block
+gcli indexer latest-block
+```
\ No newline at end of file
diff --git a/src/main.rs b/src/main.rs
index e469734..fbdf1e8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -266,7 +266,7 @@ async fn main() -> Result<(), GcliError> {
 	match args.subcommand {
 		Subcommand::GetBalance => {
 			data = data
-				.build_keypair()
+				.build_address()
 				.build_client()
 				.await
 				.fetch_system_properties()
-- 
GitLab