Documentation ¶
Index ¶
- Constants
- func CreateAccountFromMnemonic(mnemonic string) (*secp256k1.PrivKey, types.AccAddress, error)
- func CreateClientContext(config *CosmosNetworkConfig) (*client.Context, error)
- func CreateClientContextWithOptions(config *CosmosNetworkConfig, opts ...ClientContextOption) (*client.Context, error)
- type ClientContextOption
- type CosmosNetworkConfig
- type NetworkClient
- func (c *NetworkClient) BroadcastTx(ctx context.Context, txBytes []byte) (*sdk.TxResponse, error)
- func (c *NetworkClient) BroadcastTxAsync(ctx context.Context, txBytes []byte) (*sdk.TxResponse, error)
- func (c *NetworkClient) BroadcastTxCommit(ctx context.Context, txBytes []byte) (*sdk.TxResponse, error)
- func (c *NetworkClient) BroadcastTxSync(ctx context.Context, txBytes []byte) (*sdk.TxResponse, error)
- func (c *NetworkClient) ConfirmEvmTx(ctx context.Context, msg *emvtypes.ConfirmGatewayTxsRequest) (*sdk.TxResponse, error)
- func (c *NetworkClient) GetAddress() sdk.AccAddress
- func (c *NetworkClient) GetRpcClient() (rpcclient.Client, error)
- func (c *NetworkClient) SendRouteMessageRequest(ctx context.Context, id string, payload string) (*sdk.TxResponse, error)
- func (c *NetworkClient) SetTxFactory(txFactory tx.Factory)
- func (c *NetworkClient) SignAndBroadcastMsgs(ctx context.Context, msgs ...sdk.Msg) (*sdk.TxResponse, error)
- func (c *NetworkClient) SignCommandsRequest(ctx context.Context, destinationChain string) (*sdk.TxResponse, error)
- func (c *NetworkClient) Start() error
- func (c *NetworkClient) Subscribe(ctx context.Context, subscriber string, query string) (<-chan ctypes.ResultEvent, error)
- func (c *NetworkClient) UnSubscribe(ctx context.Context, subscriber string, query string) error
- func (c *NetworkClient) UnSubscribeAll(ctx context.Context, subscriber string) error
- type NetworkClientOption
- func WithAccount(privKey *secp256k1.PrivKey, addr sdk.AccAddress) NetworkClientOption
- func WithQueryClient(queryClient *QueryClient) NetworkClientOption
- func WithRpcClient(rpcClient rpcclient.Client) NetworkClientOption
- func WithTxConfig(txConfig client.TxConfig) NetworkClientOption
- func WithTxFactory(txFactory tx.Factory) NetworkClientOption
- type QueryClient
- func (c *QueryClient) GetClientCtx() *client.Context
- func (c *QueryClient) QueryAccount(ctx context.Context, address sdk.AccAddress) (*auth.BaseAccount, error)
- func (c *QueryClient) QueryActivedChains(ctx context.Context) ([]string, error)
- func (c *QueryClient) QueryBatchedCommands(ctx context.Context, destinationChain string, batchedCommandId string) (*emvtypes.BatchedCommandsResponse, error)
- func (c *QueryClient) QueryPendingCommand(ctx context.Context, destinationChain string) ([]emvtypes.QueryCommandResponse, error)
- func (c *QueryClient) QueryRouteMessageRequest(ctx context.Context, sender sdk.AccAddress, feegranter sdk.AccAddress, ...) (*axltypes.RouteMessageResponse, error)
- func (c *QueryClient) QueryTx(ctx context.Context, txHash string) (*sdk.TxResponse, error)
- func (c *QueryClient) UnmarshalAccount(resp *auth.QueryAccountResponse, account *auth.BaseAccount) error
Constants ¶
View Source
const (
DEFAULT_GAS_ADJUSTMENT = 1.2
)
Variables ¶
This section is empty.
Functions ¶
func CreateClientContext ¶
func CreateClientContext(config *CosmosNetworkConfig) (*client.Context, error)
func CreateClientContextWithOptions ¶
func CreateClientContextWithOptions(config *CosmosNetworkConfig, opts ...ClientContextOption) (*client.Context, error)
Types ¶
type ClientContextOption ¶
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) ConfirmEvmTx ¶
func (c *NetworkClient) ConfirmEvmTx(ctx context.Context, msg *emvtypes.ConfirmGatewayTxsRequest) (*sdk.TxResponse, error)
https://github.com/cosmos/cosmos-sdk/blob/main/client/tx/tx.go#L31
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 (*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
Click to show internal directories.
Click to hide internal directories.