chain

package
v1.32.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2022 License: MIT Imports: 57 Imported by: 43

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimedOut       = errors.New("tx timed out")
	ErrQueueClosed    = errors.New("queue is closed")
	ErrEnqueueTimeout = errors.New("enqueue timeout")
	ErrReadOnly       = errors.New("client is in read-only mode")
)

Functions

func InitCosmosKeyring

func InitCosmosKeyring(
	cosmosKeyringDir string,
	cosmosKeyringAppName string,
	cosmosKeyringBackend string,
	cosmosKeyFrom string,
	cosmosKeyPassphrase string,
	cosmosPrivKey string,
	cosmosUseLedger bool,
) (cosmtypes.AccAddress, keyring.Keyring, error)

func KeyringForPrivKey

func KeyringForPrivKey(name string, privKey cryptotypes.PrivKey) (keyring.Keyring, error)

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

func NewClientContext(
	chainId, fromSpec string, kb keyring.Keyring,
) (client.Context, error)

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 NewTxFactory

func NewTxFactory(clientCtx client.Context) tx.Factory

Types

type ChainClient

type ChainClient interface {
	CanSignTransactions() bool
	FromAddress() sdk.AccAddress
	QueryClient() *grpc.ClientConn
	ClientContext() client.Context

	SyncBroadcastMsg(msgs ...sdk.Msg) (*txtypes.BroadcastTxResponse, error)
	AsyncBroadcastMsg(msgs ...sdk.Msg) (*txtypes.BroadcastTxResponse, error)
	QueueBroadcastMsg(msgs ...sdk.Msg) error

	GetBankBalances(ctx context.Context, address string) (*banktypes.QueryAllBalancesResponse, error)

	Close()
}

func NewChainClient

func NewChainClient(
	ctx client.Context,
	protoAddr string,
	options ...common.ClientOption,
) (ChainClient, 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.

type EncodingConfig

type EncodingConfig struct {
	InterfaceRegistry types.InterfaceRegistry
	Marshaler         codec.Codec
	TxConfig          client.TxConfig
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL