Skip to content

Commit

Permalink
fix(client/v2): set context for queries
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Nov 1, 2023
1 parent 79246d2 commit 983595f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/v2/autocli/query.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package autocli

import (
"context"
"fmt"
"io"
"time"

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
"cosmossdk.io/x/tx/signing/aminojson"
"github.com/cockroachdb/errors"
"github.com/cosmos/cosmos-sdk/client"
"github.com/spf13/cobra"
"google.golang.org/protobuf/reflect/protoreflect"

Expand Down Expand Up @@ -112,6 +114,8 @@ func (b *Builder) BuildQueryMethodCommand(descriptor protoreflect.MethodDescript
}

cmd, err := b.buildMethodCommandCommon(descriptor, options, func(cmd *cobra.Command, input protoreflect.Message) error {
cmd.SetContext(context.WithValue(context.Background(), client.ClientContextKey, &b.ClientCtx))

if noIndent, _ := cmd.Flags().GetBool(flags.FlagNoIndent); noIndent {
encoderOptions.Indent = ""
}
Expand Down

0 comments on commit 983595f

Please sign in to comment.