From 82316acae7ecdf5ea990964987ae57fc4d2727ca Mon Sep 17 00:00:00 2001 From: Hiroyuki Kumazawa Date: Thu, 16 May 2024 20:20:10 +0000 Subject: [PATCH] Update SayHello Function Example in Ignite Documentation to to Align with Latest Ignite (#4143) --- docs/docs/02-guide/03-hello-world.md | 11 +++++------ .../version-v28/02-guide/03-hello-world.md | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/docs/docs/02-guide/03-hello-world.md b/docs/docs/02-guide/03-hello-world.md index 5f5c317a82..b0666d0d73 100644 --- a/docs/docs/02-guide/03-hello-world.md +++ b/docs/docs/02-guide/03-hello-world.md @@ -56,24 +56,23 @@ import ( "context" "fmt" + "hello/x/hello/types" + sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - - "hello/x/hello/types" ) -func (k Keeper) SayHello(goCtx context.Context, req *types.QuerySayHelloRequest) (*types.QuerySayHelloResponse, error) { +func (q queryServer) SayHello(ctx context.Context, req *types.QuerySayHelloRequest) (*types.QuerySayHelloResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } // Validation and Context unwrapping - ctx := sdk.UnwrapSDKContext(goCtx) + sdkCtx := sdk.UnwrapSDKContext(ctx) - _ = ctx + _ = sdkCtx // Custom Response - // highlight-next-line return &types.QuerySayHelloResponse{Name: fmt.Sprintf("Hello %s!", req.Name)}, nil } ``` diff --git a/docs/versioned_docs/version-v28/02-guide/03-hello-world.md b/docs/versioned_docs/version-v28/02-guide/03-hello-world.md index 5f5c317a82..b0666d0d73 100644 --- a/docs/versioned_docs/version-v28/02-guide/03-hello-world.md +++ b/docs/versioned_docs/version-v28/02-guide/03-hello-world.md @@ -56,24 +56,23 @@ import ( "context" "fmt" + "hello/x/hello/types" + sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - - "hello/x/hello/types" ) -func (k Keeper) SayHello(goCtx context.Context, req *types.QuerySayHelloRequest) (*types.QuerySayHelloResponse, error) { +func (q queryServer) SayHello(ctx context.Context, req *types.QuerySayHelloRequest) (*types.QuerySayHelloResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } // Validation and Context unwrapping - ctx := sdk.UnwrapSDKContext(goCtx) + sdkCtx := sdk.UnwrapSDKContext(ctx) - _ = ctx + _ = sdkCtx // Custom Response - // highlight-next-line return &types.QuerySayHelloResponse{Name: fmt.Sprintf("Hello %s!", req.Name)}, nil } ```