cosmos-sdk/client/v2/autocli/builder.go
mergify[bot] 3ba671f0e8
chore(client/v2): sync client/v2 with main (backport #22493, #22817) (#22820)
Co-authored-by: Julien Robert <julien@rbrt.fr>
2024-12-10 22:30:41 +01:00

35 lines
994 B
Go

package autocli
import (
"github.com/spf13/cobra"
"google.golang.org/grpc"
"cosmossdk.io/client/v2/autocli/flag"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
)
// Builder manages options for building CLI commands.
type Builder struct {
// flag.Builder embeds the flag builder and its options.
flag.Builder
// GetClientConn specifies how CLI commands will resolve a grpc.ClientConnInterface
// from a given context.
GetClientConn func(*cobra.Command) (grpc.ClientConnInterface, error)
// AddQueryConnFlags and AddTxConnFlags are functions that add flags to query and transaction commands
AddQueryConnFlags func(*cobra.Command)
AddTxConnFlags func(*cobra.Command)
Cdc codec.Codec
EnabledSignModes []signing.SignMode
}
// ValidateAndComplete the builder fields.
// It returns an error if any of the required fields are missing.
func (b *Builder) ValidateAndComplete() error {
return b.Builder.ValidateAndComplete()
}