Skip to content

Commit db9a795

Browse files
authored
chore: release v0.23.0 (ignite#2652)
chore: release v0.23.0
2 parents 1c2864b + f876cfc commit db9a795

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1053
-684
lines changed

.firebaserc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"projects": {
3-
"default": "ignite"
3+
"default": "ignite-hq"
44
},
55
"targets": {
6-
"ignite": {
6+
"ignite-hq": {
77
"hosting": {
88
"docs.ignite.com": [
99
"ignite-go-docs"

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# CODEOWNERS: https://help.github.com/articles/about-codeowners/
22

33
# Docs
4-
*.md @fadeev @ilgooz @barriebyron @ignite-hq/growth-ecodev
4+
*.md @ilgooz @aljo242
55

66
# Primary repo maintainers
7-
* @fadeev @ilgooz @lubtd @Pantani @ivanovpetr @jeronimoalbi
7+
* @ilgooz @lubtd @jeronimoalbi @aljo242 @tbruyelle

.github/workflows/docs-deploy-preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ jobs:
4141
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_IGNITE_HQ }}"
4242
expires: 7d
4343
target: docs.ignite.com
44-
projectId: ignite
44+
projectId: ignite-hq

.github/workflows/docs-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ jobs:
4949
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_IGNITE_HQ }}"
5050
channelId: live
5151
target: docs.ignite.com
52-
projectId: ignite
52+
projectId: ignite-hq

changelog.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Changelog
22

3+
## [`v0.23.0`](https://github.com/ignite/cli/releases/tag/v0.23.0)
4+
5+
### Features
6+
7+
- Apps can now use generics
8+
9+
### Fixes
10+
11+
- Fix `pkg/cosmosanalysis` to support apps with generics
12+
- Remove `ignite-hq/cli` from dependency list in scaffolded chains
13+
14+
### Changes
15+
16+
- Change `pkg/cosmosgen` to allow importing IBC proto files
17+
- Improve docs for Docker related commands
18+
- Improve and fix documentation issues in developer tutorials
19+
- Add migration docs for v0.22.2
20+
- Improve `go mod download` error report in `pkg/cosmosgen`
21+
322
## [`v0.22.2`](https://github.com/ignite/cli/releases/tag/v0.22.2)
423

524
### Features

docs/docs/guide/02-hello.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ This tutorial is a great place to start your journey into the Cosmos ecosystem.
1111

1212
In the previous chapter you've learned how to install [Ignite CLI](https://github.com/ignite/cli), the tool that offers everything you need to build, test, and launch your blockchain with a decentralized worldwide community.
1313

14-
This series of tutorials is based on a specific version of Ignite CLI, so be sure to install the correct version. For example, to install Ignite CLI v0.20.0 use the following command:
14+
This series of tutorials is based on a specific version of Ignite CLI, so be sure to install the correct version. For example, to install Ignite CLI v0.22.2 use the following command:
1515

1616
```bash
17-
curl https://get.ignite.com/cli@v0.21.2! | bash
17+
curl https://get.ignite.com/cli@v0.22.2! | bash
1818
```
1919

2020
Ignite CLI comes with a number of scaffolding commands that are designed to make development easier by creating everything that's required to start working on a particular task.

docs/docs/guide/03-blog/00-build-blog.md

Lines changed: 81 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ By completing this tutorial, you will learn about:
2222

2323
## Prerequisites
2424

25-
This series of blog tutorials is based on a specific version of Ignite CLI, so to install Ignite CLI v0.20.0 use the following command:
25+
This series of blog tutorials is based on a specific version of Ignite CLI, so to install Ignite CLI v0.22.2 use the following command:
2626

2727
```bash
28-
curl https://get.ignite.com/cli@v0.22.1! | bash
28+
curl https://get.ignite.com/cli@v0.22.2! | bash
2929
```
3030

3131
## Create your blog chain
@@ -139,14 +139,17 @@ You need to do two things:
139139
func (k msgServer) CreatePost(goCtx context.Context, msg *types.MsgCreatePost) (*types.MsgCreatePostResponse, error) {
140140
// Get the context
141141
ctx := sdk.UnwrapSDKContext(goCtx)
142+
142143
// Create variable of type Post
143144
var post = types.Post{
144145
Creator: msg.Creator,
145146
Title: msg.Title,
146147
Body: msg.Body,
147148
}
149+
148150
// Add a post to the store and get back the ID
149151
id := k.AppendPost(ctx, post)
152+
150153
// Return the ID of the post
151154
return &types.MsgCreatePostResponse{Id: id}, nil
152155
}
@@ -162,7 +165,9 @@ Create the `proto/blog/post.proto` file and define the `Post` message:
162165

163166
```go
164167
syntax = "proto3";
168+
165169
package blog.blog;
170+
166171
option go_package = "blog/x/blog/types";
167172

168173
message Post {
@@ -175,8 +180,8 @@ message Post {
175180

176181
The contents of the `post.proto` file are standard. The file defines:
177182

178-
- A package name `username.blog.blog` that is used to identify messages
179-
- The Go package `go_package = "github.com/username/blog/x/blog/types"` where new files are generated
183+
- A package name `blog.blog` that is used to identify messages
184+
- The Go package `go_package = "blog/x/blog/types"` where new files are generated
180185
- The message `message Post`
181186

182187
Continue developing your blog chain.
@@ -196,7 +201,8 @@ Then, add these prefixes to the `x/blog/types/keys.go` file in the `const` and a
196201
```go
197202
const (
198203
//...
199-
// Keep track of the index of posts
204+
205+
// Keep track of the index of posts
200206
PostKey = "Post-value-"
201207
PostCountKey = "Post-count-"
202208
)
@@ -228,14 +234,18 @@ First, implement `GetPostCount`:
228234
func (k Keeper) GetPostCount(ctx sdk.Context) uint64 {
229235
// Get the store using storeKey (which is "blog") and PostCountKey (which is "Post-count-")
230236
store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.PostCountKey))
237+
231238
// Convert the PostCountKey to bytes
232239
byteKey := []byte(types.PostCountKey)
240+
233241
// Get the value of the count
234242
bz := store.Get(byteKey)
243+
235244
// Return zero if the count value is not found (for example, it's the first post)
236245
if bz == nil {
237246
return 0
238247
}
248+
239249
// Convert the count into a uint64
240250
return binary.BigEndian.Uint64(bz)
241251
}
@@ -247,11 +257,14 @@ Now that `GetPostCount` returns the correct number of posts in the store, implem
247257
func (k Keeper) SetPostCount(ctx sdk.Context, count uint64) {
248258
// Get the store using storeKey (which is "blog") and PostCountKey (which is "Post-count-")
249259
store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.PostCountKey))
260+
250261
// Convert the PostCountKey to bytes
251262
byteKey := []byte(types.PostCountKey)
263+
252264
// Convert count from uint64 to string and get bytes
253265
bz := make([]byte, 8)
254266
binary.BigEndian.PutUint64(bz, count)
267+
255268
// Set the value of Post-count- to count
256269
store.Set(byteKey, bz)
257270
}
@@ -264,25 +277,33 @@ package keeper
264277

265278
import (
266279
"encoding/binary"
267-
"blog/x/blog/types"
280+
268281
"github.com/cosmos/cosmos-sdk/store/prefix"
269282
sdk "github.com/cosmos/cosmos-sdk/types"
283+
284+
"blog/x/blog/types"
270285
)
271286

272287
func (k Keeper) AppendPost(ctx sdk.Context, post types.Post) uint64 {
273288
// Get the current number of posts in the store
274289
count := k.GetPostCount(ctx)
290+
275291
// Assign an ID to the post based on the number of posts in the store
276292
post.Id = count
293+
277294
// Get the store
278295
store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.PostKey))
296+
279297
// Convert the post ID into bytes
280298
byteKey := make([]byte, 8)
281299
binary.BigEndian.PutUint64(byteKey, post.Id)
300+
282301
// Marshal the post into bytes
283302
appendedValue := k.cdc.MustMarshal(&post)
303+
284304
// Insert the post bytes using post ID as a key
285305
store.Set(byteKey, appendedValue)
306+
286307
// Update the post count
287308
k.SetPostCount(ctx, count+1)
288309
return count
@@ -315,73 +336,83 @@ To define the types in proto files, make the following updates in `proto/blog/qu
315336

316337
1. Add the `import`:
317338

318-
```go
319-
import "blog/post.proto";
320-
```
339+
```go
340+
import "blog/post.proto";
341+
```
321342

322343
2. Add pagination to the post request:
323344

324-
```go
325-
message QueryPostsRequest {
326-
// Adding pagination to request
327-
cosmos.base.query.v1beta1.PageRequest pagination = 1;
328-
}
329-
```
345+
```go
346+
message QueryPostsRequest {
347+
// Adding pagination to request
348+
cosmos.base.query.v1beta1.PageRequest pagination = 1;
349+
}
350+
```
330351

331352
3. Add pagination to the post response:
332353

333-
```go
334-
message QueryPostsResponse {
335-
// Returning a list of posts
336-
repeated Post Post = 1;
337-
// Adding pagination to response
338-
cosmos.base.query.v1beta1.PageResponse pagination = 2;
339-
}
340-
```
354+
```go
355+
message QueryPostsResponse {
356+
// Returning a list of posts
357+
repeated Post Post = 1;
358+
359+
// Adding pagination to response
360+
cosmos.base.query.v1beta1.PageResponse pagination = 2;
361+
}
362+
```
341363

342-
To implement post querying logic in the `grpc_query_posts.go` file, delete the contents of that file and replace it with:
364+
To implement post querying logic in the `x/blog/keeper/grpc_query_posts.go` file, delete the contents of that file and replace it with:
343365

344366
```go
345367
package keeper
346368

347369
import (
348370
"context"
349-
350-
"blog/x/blog/types"
351371

352372
"github.com/cosmos/cosmos-sdk/store/prefix"
353373
sdk "github.com/cosmos/cosmos-sdk/types"
354374
"github.com/cosmos/cosmos-sdk/types/query"
355375
"google.golang.org/grpc/codes"
356376
"google.golang.org/grpc/status"
377+
378+
"blog/x/blog/types"
357379
)
358380

359381
func (k Keeper) Posts(c context.Context, req *types.QueryPostsRequest) (*types.QueryPostsResponse, error) {
360382
// Throw an error if request is nil
361383
if req == nil {
362384
return nil, status.Error(codes.InvalidArgument, "invalid request")
363385
}
386+
364387
// Define a variable that will store a list of posts
365388
var posts []*types.Post
389+
366390
// Get context with the information about the environment
367391
ctx := sdk.UnwrapSDKContext(c)
392+
368393
// Get the key-value module store using the store key (in our case store key is "chain")
369394
store := ctx.KVStore(k.storeKey)
395+
370396
// Get the part of the store that keeps posts (using post key, which is "Post-value-")
371397
postStore := prefix.NewStore(store, []byte(types.PostKey))
398+
372399
// Paginate the posts store based on PageRequest
373400
pageRes, err := query.Paginate(postStore, req.Pagination, func(key []byte, value []byte) error {
374401
var post types.Post
375402
if err := k.cdc.Unmarshal(value, &post); err != nil {
376403
return err
377404
}
405+
378406
posts = append(posts, &post)
407+
379408
return nil
380409
})
410+
381411
// Throw an error if pagination failed
382412
if err != nil {
383413
return nil, status.Error(codes.Internal, err.Error())
384414
}
415+
385416
// Return a struct containing a list of posts and pagination info
386417
return &types.QueryPostsResponse{Post: posts, Pagination: pageRes}, nil
387418
}
@@ -393,28 +424,41 @@ In the `x/blog/module.go` file:
393424

394425
1. Add `"context"` to the imports, don't save the file yet.
395426

396-
```go
397-
import (
398-
"context"
427+
```go
428+
import (
429+
"context"
430+
399431
// ... other imports
400-
)
401-
```
432+
)
433+
```
402434

403435
2. Update the `RegisterGRPCGatewayRoutes` function to register the query handler client:
404436

405-
```go
406-
// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
407-
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
408-
types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
409-
}
410-
```
437+
```go
438+
// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
439+
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
440+
types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
441+
}
442+
```
411443

412444
3. Now that you've modified the file with the two updates, now it's safe to save the file.
413445

414446
## Use the CLI to create a post
415447

416448
Now that you have implemented logic for creating and querying posts, you can interact with your blog chain using the command line. The blog chain binary is `blogd`.
417449

450+
First, start the chain on your development machine by running the following command in the `blog` directory:
451+
452+
```bash
453+
ignite chain serve
454+
```
455+
456+
The binary is built by the `ignite chain serve` command bit it can also be built by running:
457+
458+
```bash
459+
ignite chain build
460+
```
461+
418462
To create a post at the command line:
419463

420464
```bash

0 commit comments

Comments
 (0)