cosmos

package
v0.0.0-...-313251d Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 26 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DEFAULT_GAS_ADJUSTMENT = 1.2
)

Variables

This section is empty.

Functions

func CreateAccountFromMnemonic

func CreateAccountFromMnemonic(mnemonic string) (*secp256k1.PrivKey, types.AccAddress, error)

func CreateClientContext

func CreateClientContext(config *CosmosNetworkConfig) (*client.Context, error)

func CreateClientContextWithOptions

func CreateClientContextWithOptions(config *CosmosNetworkConfig, opts ...ClientContextOption) (*client.Context, error)

Types

type ClientContextOption

type ClientContextOption func(*client.Context) error

func WithRpcClientCtx

func WithRpcClientCtx(rpcUrl string) ClientContextOption

type CosmosNetworkConfig

type CosmosNetworkConfig struct {
	ChainID       uint64   `mapstructure:"chain_id"`
	ID            string   `mapstructure:"id"`
	Name          string   `mapstructure:"name"`
	RPCUrl        string   `mapstructure:"rpc_url"`
	LCDUrl        string   `mapstructure:"lcd_url"`
	WSUrl         string   `mapstructure:"ws_url"`
	Denom         string   `mapstructure:"denom"`
	Mnemonic      string   `mapstructure:"mnemonic"`
	GasPrice      float64  `mapstructure:"gas_price"`
	BroadcastMode string   `mapstructure:"broadcast_mode"`
	MaxRetries    int      `mapstructure:"max_retries"`
	RetryInterval int64    `mapstructure:"retry_interval"` //milliseconds
	PrivateKeys   []string `mapstructure:"private_keys"`
	PublicKeys    []string `mapstructure:"public_keys"`
	SignerNetwork string   `mapstructure:"signer_network"`
}

func (*CosmosNetworkConfig) GetChainId

func (c *CosmosNetworkConfig) GetChainId() uint64

func (*CosmosNetworkConfig) GetFamily

func (c *CosmosNetworkConfig) GetFamily() string

func (*CosmosNetworkConfig) GetId

func (c *CosmosNetworkConfig) GetId() string

func (*CosmosNetworkConfig) GetName

func (c *CosmosNetworkConfig) GetName() string

type NetworkClient

type NetworkClient struct {
	// contains filtered or unexported fields
}

func NewNetworkClient

func NewNetworkClient(config *CosmosNetworkConfig, queryClient *QueryClient, txConfig client.TxConfig) (*NetworkClient, error)

func NewNetworkClientWithOptions

func NewNetworkClientWithOptions(config *CosmosNetworkConfig, queryClient *QueryClient, txConfig client.TxConfig, opts ...NetworkClientOption) (*NetworkClient, error)

func (*NetworkClient) BroadcastTx

func (c *NetworkClient) BroadcastTx(ctx context.Context, txBytes []byte) (*sdk.TxResponse, error)

func (*NetworkClient) BroadcastTxAsync

func (c *NetworkClient) BroadcastTxAsync(ctx context.Context, txBytes []byte) (*sdk.TxResponse, error)

func (*NetworkClient) BroadcastTxCommit

func (c *NetworkClient) BroadcastTxCommit(ctx context.Context, txBytes []byte) (*sdk.TxResponse, error)

func (*NetworkClient) BroadcastTxSync

func (c *NetworkClient) BroadcastTxSync(ctx context.Context, txBytes []byte) (*sdk.TxResponse, error)

func (*NetworkClient) GetAddress

func (c *NetworkClient) GetAddress() sdk.AccAddress

Get Broadcast Address from config (privatekey or mnemonic)

func (*NetworkClient) GetRpcClient

func (c *NetworkClient) GetRpcClient() (rpcclient.Client, error)

func (*NetworkClient) SendRouteMessageRequest

func (c *NetworkClient) SendRouteMessageRequest(ctx context.Context, id string, payload string) (*sdk.TxResponse, error)

func (*NetworkClient) SetTxFactory

func (c *NetworkClient) SetTxFactory(txFactory tx.Factory)

func (*NetworkClient) SignAndBroadcastMsgs

func (c *NetworkClient) SignAndBroadcastMsgs(ctx context.Context, msgs ...sdk.Msg) (*sdk.TxResponse, error)

func (*NetworkClient) SignCommandsRequest

func (c *NetworkClient) SignCommandsRequest(ctx context.Context, destinationChain string) (*sdk.TxResponse, error)

func (*NetworkClient) Start

func (c *NetworkClient) Start() error

Start connections: rpc, websocket...

func (*NetworkClient) Subscribe

func (c *NetworkClient) Subscribe(ctx context.Context, subscriber string, query string) (<-chan ctypes.ResultEvent, error)

func (*NetworkClient) UnSubscribe

func (c *NetworkClient) UnSubscribe(ctx context.Context, subscriber string, query string) error

func (*NetworkClient) UnSubscribeAll

func (c *NetworkClient) UnSubscribeAll(ctx context.Context, subscriber string) error

type NetworkClientOption

type NetworkClientOption func(*NetworkClient)

func WithAccount

func WithAccount(privKey *secp256k1.PrivKey, addr sdk.AccAddress) NetworkClientOption

func WithQueryClient

func WithQueryClient(queryClient *QueryClient) NetworkClientOption

func WithRpcClient

func WithRpcClient(rpcClient rpcclient.Client) NetworkClientOption

func WithTxConfig

func WithTxConfig(txConfig client.TxConfig) NetworkClientOption

func WithTxFactory

func WithTxFactory(txFactory tx.Factory) NetworkClientOption

type QueryClient

type QueryClient struct {
	EvmQueryServiceClient emvtypes.QueryServiceClient
	MsgServiceClient      axltypes.MsgServiceClient
	TxServiceClient       tx.ServiceClient
	AccountQueryClient    auth.QueryClient
	// contains filtered or unexported fields
}

func NewQueryClient

func NewQueryClient(clientCtx *client.Context) *QueryClient

func (*QueryClient) GetClientCtx

func (c *QueryClient) GetClientCtx() *client.Context

func (*QueryClient) QueryAccount

func (c *QueryClient) QueryAccount(ctx context.Context, address sdk.AccAddress) (*auth.BaseAccount, error)

func (*QueryClient) QueryActivedChains

func (c *QueryClient) QueryActivedChains(ctx context.Context) ([]string, error)

func (*QueryClient) QueryBatchedCommands

func (c *QueryClient) QueryBatchedCommands(ctx context.Context, destinationChain string, batchedCommandId string) (*emvtypes.BatchedCommandsResponse, error)

func (*QueryClient) QueryPendingCommand

func (c *QueryClient) QueryPendingCommand(ctx context.Context, destinationChain string) ([]emvtypes.QueryCommandResponse, error)

func (*QueryClient) QueryRouteMessageRequest

func (c *QueryClient) QueryRouteMessageRequest(ctx context.Context, sender sdk.AccAddress, feegranter sdk.AccAddress, id string, payload string) (*axltypes.RouteMessageResponse, error)

func (*QueryClient) QueryTx

func (c *QueryClient) QueryTx(ctx context.Context, txHash string) (*sdk.TxResponse, error)

func (*QueryClient) UnmarshalAccount

func (c *QueryClient) UnmarshalAccount(resp *auth.QueryAccountResponse, account *auth.BaseAccount) error

Todo: Add code for more correct unmarshal

Jump to

Keyboard shortcuts

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