From 65d2e36a420214bfe54b9db624bb670f78fbb0fd Mon Sep 17 00:00:00 2001 From: aggelossik Date: Mon, 6 Nov 2023 16:19:41 +0200 Subject: [PATCH 1/8] docs: Update 01-go-client.md comments broadcasting a transaction to create a post and store the response in txResp --- .../versioned_docs/version-v0.27.2/03-clients/01-go-client.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md b/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md index 6f01677c41..1c6ca746b8 100644 --- a/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md +++ b/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md @@ -157,7 +157,7 @@ func main() { } // Broadcast a transaction from account `alice` with the message - // to create a post store response in txResp + // to create a post and store the response in txResp txResp, err := client.BroadcastTx(ctx, account, msg) if err != nil { log.Fatal(err) @@ -297,4 +297,4 @@ pagination: Great job! You have successfully completed the process of creating a Go client for your Cosmos SDK blockchain, submitting a transaction, and querying the -chain. \ No newline at end of file +chain. From cb8b0c57eb5afe16e426bffa52dc81e110b3bb1c Mon Sep 17 00:00:00 2001 From: aggelossik Date: Tue, 7 Nov 2023 15:28:33 +0200 Subject: [PATCH 2/8] docs: Update 01-go-client.md Adding description on running the client app from a remote/diff machine and also a small intro to test keyring --- .../03-clients/01-go-client.md | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md b/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md index 1c6ca746b8..da234033b5 100644 --- a/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md +++ b/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md @@ -94,7 +94,7 @@ Your package will import two dependencies: * `ignite` for the `cosmosclient` package The `replace` directive uses the package from the local `blog` directory and is -specified as a relative path to the `blogclient` directory. +specified as a relative path to the `blogclient` directory. Cosmos SDK uses a custom version of the `protobuf` package, so use the `replace` directive to specify the correct dependency. @@ -211,6 +211,36 @@ package documentation for This documentation provides information on how to use the `Client` type with `Options` and `KeyringBackend`. +## Blockchain and Client app not on the same machine + +If the blockchain and the client app is not on the same machine replace ../blog with the github +repository pointing to your blog node: + +dependencies for your package + +`go.mod` file: + +```text title="blogclient/go.mod" +... +replace blog => github.com//blog/x/blog/types v0.0.0-00010101000000-000000000000 +... +``` + +and `main.go` file: + +```go title="blogclient/main.go" + // Importing the types package of your blog blockchain + "github.com//blog/x/blog/types" +``` +then update the dependencies again: + +```bash +go mod tidy +``` +You will also have to export the blockchains accounts and import + + + ## Run the blockchain and the client Make sure your blog blockchain is still running with `ignite chain serve`. From 29e0d8132647416880efcd5ffeb0b7e62fd946d4 Mon Sep 17 00:00:00 2001 From: aggelossik Date: Tue, 7 Nov 2023 15:49:34 +0200 Subject: [PATCH 3/8] docs: Update 01-go-client.md adding the test keyring backend and define the path --- .../03-clients/01-go-client.md | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md b/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md index da234033b5..21d11bbcf3 100644 --- a/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md +++ b/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md @@ -237,8 +237,38 @@ then update the dependencies again: ```bash go mod tidy ``` -You will also have to export the blockchains accounts and import +## Using the test keyring backend +***Only for testing*** + +Export the blockchains account keys from the user you want to be sign the transaction and move them +to a folder in root directory of your client app named keyring-test. You will need both .info and .address +to sign, encode and broadcast the transaction. + +After moving the key to the local client app keyring-test directory path: test/keyring-test define the path inside main.go + +```go title="blogclient/main.go" +. +. +. +func main() { + ctx := context.Background() + addressPrefix := "cosmos" + + // Create a Cosmos client instance + client, err := cosmosclient.New(ctx, cosmosclient.WithAddressPrefix(addressPrefix), + cosmosclient.WithKeyringBackend("test"), cosmosclient.WithKeyringDir("test") ) + if err != nil { + log.Fatal(err) + } + + // Account `alice` was initialized during `ignite chain serve` + accountName :="" +. +. +. +``` +in the root directory you should see folder test/keyring-test ## Run the blockchain and the client From 4799bea7e78ec9fbd2cdcf078782329e2664a34a Mon Sep 17 00:00:00 2001 From: aggelossik Date: Thu, 30 Nov 2023 14:15:44 +0200 Subject: [PATCH 4/8] docs:Update 01-go-client.md update documentation changes, changed the dependency to the latest cli stable version, new section creating a client for the blog from a remote location (node and client not on the same system) --- .../03-clients/01-go-client.md | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md b/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md index 21d11bbcf3..b73ae94411 100644 --- a/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md +++ b/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md @@ -77,11 +77,11 @@ To import dependencies for your package, you can add the following code to the ```text title="blogclient/go.mod" module blogclient -go 1.19 +go 1.20 require ( blog v0.0.0-00010101000000-000000000000 - github.com/ignite/cli v0.25.2 + github.com/ignite/cli v0.27.2 ) replace blog => ../blog @@ -222,7 +222,7 @@ dependencies for your package ```text title="blogclient/go.mod" ... -replace blog => github.com//blog/x/blog/types v0.0.0-00010101000000-000000000000 +replace blog => github.com//blog v0.0.0-00010101000000-000000000000 ... ``` @@ -237,13 +237,17 @@ then update the dependencies again: ```bash go mod tidy ``` + ## Using the test keyring backend ***Only for testing*** -Export the blockchains account keys from the user you want to be sign the transaction and move them -to a folder in root directory of your client app named keyring-test. You will need both .info and .address -to sign, encode and broadcast the transaction. +Export the blockchains account keys from the user you want to be sign and broadcast the transaction and move them +to a folder in root directory of your client app named keyring-test. You can use ignite account import command + +```bash +ignite account import alice --keyring-dir /path/to/client/blogclient/keyring-test +``` After moving the key to the local client app keyring-test directory path: test/keyring-test define the path inside main.go @@ -257,7 +261,7 @@ func main() { // Create a Cosmos client instance client, err := cosmosclient.New(ctx, cosmosclient.WithAddressPrefix(addressPrefix), - cosmosclient.WithKeyringBackend("test"), cosmosclient.WithKeyringDir("test") ) + cosmosclient.WithKeyringBackend("test"), cosmosclient.WithKeyringDir(".") ) if err != nil { log.Fatal(err) } @@ -268,7 +272,7 @@ func main() { . . ``` -in the root directory you should see folder test/keyring-test +in the root directory you should see folder keyring-test ## Run the blockchain and the client From 8a58f70aa02a28dea96b777d02042a47ac1a2534 Mon Sep 17 00:00:00 2001 From: aggelossik Date: Thu, 30 Nov 2023 14:21:47 +0200 Subject: [PATCH 5/8] docs:Update 01-go-client.md documentation update of the client creation including new section for remote client require from github.com/user/blog and keyring backend example with test --- .../version-v0.27.2/03-clients/01-go-client.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md b/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md index b73ae94411..c3b4d5e225 100644 --- a/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md +++ b/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md @@ -242,14 +242,14 @@ go mod tidy ***Only for testing*** -Export the blockchains account keys from the user you want to be sign and broadcast the transaction and move them -to a folder in root directory of your client app named keyring-test. You can use ignite account import command +Create a new directory inside the blog client named keyring-test. Export the blockchains account keys from the user you want to be sign and broadcast the transaction. Import the keys +to the keyring-test dir you just created in root directory of your client app. You can use ignite account import command ```bash ignite account import alice --keyring-dir /path/to/client/blogclient/keyring-test ``` -After moving the key to the local client app keyring-test directory path: test/keyring-test define the path inside main.go +define the path inside main.go ```go title="blogclient/main.go" . @@ -267,13 +267,11 @@ func main() { } // Account `alice` was initialized during `ignite chain serve` - accountName :="" + accountName :="aliceAddress" . . . ``` -in the root directory you should see folder keyring-test - ## Run the blockchain and the client From a933b8c51540deec3e8356b9adde87e671bf7743 Mon Sep 17 00:00:00 2001 From: aggelossik Date: Thu, 30 Nov 2023 14:25:49 +0200 Subject: [PATCH 6/8] docs: Update 01-go-client.md changed the word node to repository --- docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md b/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md index c3b4d5e225..8a2da5878b 100644 --- a/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md +++ b/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md @@ -214,7 +214,7 @@ This documentation provides information on how to use the `Client` type with ## Blockchain and Client app not on the same machine If the blockchain and the client app is not on the same machine replace ../blog with the github -repository pointing to your blog node: +repository pointing to your blog github repository: dependencies for your package From 596d01ab7bdf3c02a4f8a452007d9d815580ab1e Mon Sep 17 00:00:00 2001 From: aggelossik Date: Mon, 4 Dec 2023 08:54:25 +0200 Subject: [PATCH 7/8] Update docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md Co-authored-by: Danny --- docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md b/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md index 8a2da5878b..f066bf5943 100644 --- a/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md +++ b/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md @@ -238,7 +238,7 @@ then update the dependencies again: go mod tidy ``` -## Using the test keyring backend +## Using the Test Keyring Backend ***Only for testing*** From d1eb8860410ad93c5882cd5589ea1e5b8cc36773 Mon Sep 17 00:00:00 2001 From: aggelossik Date: Mon, 4 Dec 2023 09:05:03 +0200 Subject: [PATCH 8/8] Apply suggestions from code review Co-authored-by: Danny --- .../version-v0.27.2/03-clients/01-go-client.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md b/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md index f066bf5943..36bdc90838 100644 --- a/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md +++ b/docs/versioned_docs/version-v0.27.2/03-clients/01-go-client.md @@ -211,10 +211,10 @@ package documentation for This documentation provides information on how to use the `Client` type with `Options` and `KeyringBackend`. -## Blockchain and Client app not on the same machine +## Blockchain and Client App Are on Different Machines -If the blockchain and the client app is not on the same machine replace ../blog with the github -repository pointing to your blog github repository: +If the blockchain and the client app are not on the same machine, replace ../blog with the github +repository pointing to your blog GitHub repository: dependencies for your package @@ -232,7 +232,8 @@ and `main.go` file: // Importing the types package of your blog blockchain "github.com//blog/x/blog/types" ``` -then update the dependencies again: + +Then, update the dependencies again: ```bash go mod tidy @@ -242,14 +243,14 @@ go mod tidy ***Only for testing*** -Create a new directory inside the blog client named keyring-test. Export the blockchains account keys from the user you want to be sign and broadcast the transaction. Import the keys -to the keyring-test dir you just created in root directory of your client app. You can use ignite account import command +Create a new directory inside the blog client named 'keyring-test'. Next, export the blockchain account keys from the user you want to be sign and broadcast the transaction too. After exporting, import the keys +to the 'keyring-test' directory you just created in root directory of your client app. You can use the following `ignite account import` command: ```bash ignite account import alice --keyring-dir /path/to/client/blogclient/keyring-test ``` -define the path inside main.go +Define the path inside 'main.go': ```go title="blogclient/main.go" .