Documentation ¶
Index ¶
- Variables
- func Connect(protoAddr string) (net.Conn, error)
- func KeyringForPrivKey(name string, privKey cryptotypes.PrivKey) (keyring.Keyring, error)
- func NewClientContext(chainId, fromSpec string, kb keyring.Keyring) (client.Context, error)
- func NewTxConfig(signModes []signingtypes.SignMode) client.TxConfig
- func NewTxFactory(clientCtx client.Context) tx.Factory
- func OptionGasPrices(gasPrices string) cosmosClientOption
- func ProtocolAndAddress(listenAddr string) (string, string)
- type CosmosClient
- type EncodingConfig
Constants ¶
This section is empty.
Variables ¶
var ( ErrQueueClosed = errors.New("queue is closed") ErrEnqueueTimeout = errors.New("enqueue timeout") ErrReadOnly = errors.New("client is in read-only mode") )
var ErrTimedOut = errors.New("tx timed out")
Functions ¶
func Connect ¶
Connect dials the given address and returns a net.Conn. The protoAddr argument should be prefixed with the protocol, eg. "tcp://127.0.0.1:8080" or "unix:///tmp/test.sock"
func KeyringForPrivKey ¶
KeyringForPrivKey creates a temporary in-mem keyring for a PrivKey. Allows to init Context when the key has been provided in plaintext and parsed.
func NewClientContext ¶
NewClientContext creates a new Cosmos Client context, where chainID corresponds to Cosmos chain ID, fromSpec is either name of the key, or bech32-address of the Cosmos account. Keyring is required to contain the specified key.
func NewTxConfig ¶
func NewTxConfig(signModes []signingtypes.SignMode) client.TxConfig
NewTxConfig initializes new Cosmos TxConfig with certain signModes enabled.
func OptionGasPrices ¶
func OptionGasPrices(gasPrices string) cosmosClientOption
func ProtocolAndAddress ¶
ProtocolAndAddress splits an address into the protocol and address components. For instance, "tcp://127.0.0.1:8080" will be split into "tcp" and "127.0.0.1:8080". If the address has no protocol prefix, the default is "tcp".
Types ¶
type CosmosClient ¶
type CosmosClient interface { CanSignTransactions() bool FromAddress() sdk.AccAddress QueryClient() *grpc.ClientConn SyncBroadcastMsg(msgs ...sdk.Msg) (*sdk.TxResponse, error) AsyncBroadcastMsg(msgs ...sdk.Msg) (*sdk.TxResponse, error) QueueBroadcastMsg(msgs ...sdk.Msg) error ClientContext() client.Context Close() }
func NewCosmosClient ¶
func NewCosmosClient( ctx client.Context, protoAddr string, options ...cosmosClientOption, ) (CosmosClient, error)
NewCosmosClient creates a new gRPC client that communicates with gRPC server at protoAddr. protoAddr must be in form "tcp://127.0.0.1:8080" or "unix:///tmp/test.sock", protocol is required.