types

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultHomePath, _ = os.UserHomeDir()
	DefaultConfigPath  = filepath.Join(DefaultHomePath, ".icq-relayer")
)

Functions

func Bech32ifyAddressBytes

func Bech32ifyAddressBytes(prefix string, address sdktypes.AccAddress) (string, error)

func SetSDKConfigPrefix

func SetSDKConfigPrefix(prefix string)

Types

type ChainConfig

type ChainConfig struct {
	*ReadOnlyChainConfig
	MnemonicPath           string
	Prefix                 string
	TxSubmitTimeoutSeconds int
	GasLimit               int
	GasPrice               string
	GasMultiplier          float64
	AddressBytes           sdktypes.AccAddress `toml:"-"`
}

func (*ChainConfig) GetAddress

func (c *ChainConfig) GetAddress() string

func (*ChainConfig) GetAddressBytes

func (c *ChainConfig) GetAddressBytes() sdktypes.AccAddress

func (*ChainConfig) GetClient

func (r *ChainConfig) GetClient() *rpchttp.HTTP

func (*ChainConfig) GetPrivKeyAddress

func (c *ChainConfig) GetPrivKeyAddress() (sdkcryptotypes.PrivKey, sdktypes.AccAddress)

func (*ChainConfig) Init

func (r *ChainConfig) Init(codec *codec.ProtoCodec, cache *ristretto.Cache) error

func (*ChainConfig) SignAndBroadcastMsg

func (c *ChainConfig) SignAndBroadcastMsg(ctx context.Context, cliContext *client.Context, exec []sdktypes.Msg, version string) (string, uint32, error)

type Config

type Config struct {
	BindPort       int
	MaxMsgsPerTx   int
	AllowedQueries []string
	SkipEpoch      bool
	DefaultChain   *ChainConfig
	Chains         map[string]*ReadOnlyChainConfig
	ProtoCodec     *codec.ProtoCodec `toml:"-"`
	ClientContext  *client.Context   `toml:"-"`
	HomePath       string            `toml:"-"`
}

Config represents the config file for the relayer

func InitializeConfigFromToml

func InitializeConfigFromToml(homepath string) Config

func NewConfig

func NewConfig() Config

type QueryClient

type QueryClient interface {
	Init(codec *codec.ProtoCodec, cache *ristretto.Cache) error
	GetClientState(ctx context.Context, clientId string, logger log2.Logger, metrics prommetrics.Metrics) (*clienttypes.QueryClientStateResponse, error)
	GetClientStateHeights(ctx context.Context, clientId string, chainId string, height uint64, logger log2.Logger, metrics prommetrics.Metrics, depth int) ([]clienttypes.Height, error)
	GetClientId(ctx context.Context, connectionId string, logger log2.Logger, metrics prommetrics.Metrics) (string, error)
}

type RPCClient

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

RPCClient is a client for the Tendermint RPC interface. This is copy and pasted from github.com/tendermint/tendermint/rpc/client/http, which does not expost the baseRPCClient, and as such does not permit you to create a HTTP RPC Client without websocket connection.

func NewWithTimeout

func NewWithTimeout(remote string, timeout uint) (*RPCClient, error)

Create timeout enabled http client

func (*RPCClient) ABCIInfo

func (c *RPCClient) ABCIInfo(ctx context.Context) (*ctypes.ResultABCIInfo, error)

func (*RPCClient) ABCIQuery

func (c *RPCClient) ABCIQuery(
	ctx context.Context,
	path string,
	data bytes.HexBytes,
) (*ctypes.ResultABCIQuery, error)

func (*RPCClient) ABCIQueryWithOptions

func (c *RPCClient) ABCIQueryWithOptions(
	ctx context.Context,
	path string,
	data bytes.HexBytes,
	opts rpcclient.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)

func (*RPCClient) Block

func (c *RPCClient) Block(ctx context.Context, height *int64) (*ctypes.ResultBlock, error)

func (*RPCClient) BlockByHash

func (c *RPCClient) BlockByHash(ctx context.Context, hash []byte) (*ctypes.ResultBlock, error)

func (*RPCClient) BlockResults

func (c *RPCClient) BlockResults(
	ctx context.Context,
	height *int64,
) (*ctypes.ResultBlockResults, error)

func (*RPCClient) BlockSearch

func (c *RPCClient) BlockSearch(
	ctx context.Context,
	query string,
	page, perPage *int,
	orderBy string,
) (*ctypes.ResultBlockSearch, error)

func (*RPCClient) BlockchainInfo

func (c *RPCClient) BlockchainInfo(
	ctx context.Context,
	minHeight,
	maxHeight int64,
) (*ctypes.ResultBlockchainInfo, error)

func (*RPCClient) BroadcastEvidence

func (c *RPCClient) BroadcastEvidence(
	ctx context.Context,
	ev types.Evidence,
) (*ctypes.ResultBroadcastEvidence, error)

func (*RPCClient) BroadcastTxAsync

func (c *RPCClient) BroadcastTxAsync(
	ctx context.Context,
	tx types.Tx,
) (*ctypes.ResultBroadcastTx, error)

func (*RPCClient) BroadcastTxCommit

func (c *RPCClient) BroadcastTxCommit(
	ctx context.Context,
	tx types.Tx,
) (*ctypes.ResultBroadcastTxCommit, error)

func (*RPCClient) BroadcastTxSync

func (c *RPCClient) BroadcastTxSync(
	ctx context.Context,
	tx types.Tx,
) (*ctypes.ResultBroadcastTx, error)

func (*RPCClient) CheckTx

func (c *RPCClient) CheckTx(ctx context.Context, tx types.Tx) (*ctypes.ResultCheckTx, error)

func (*RPCClient) Commit

func (c *RPCClient) Commit(ctx context.Context, height *int64) (*ctypes.ResultCommit, error)

func (*RPCClient) ConsensusParams

func (c *RPCClient) ConsensusParams(
	ctx context.Context,
	height *int64,
) (*ctypes.ResultConsensusParams, error)

func (*RPCClient) ConsensusState

func (c *RPCClient) ConsensusState(ctx context.Context) (*ctypes.ResultConsensusState, error)

func (*RPCClient) DumpConsensusState

func (c *RPCClient) DumpConsensusState(ctx context.Context) (*ctypes.ResultDumpConsensusState, error)

func (*RPCClient) Genesis

func (c *RPCClient) Genesis(ctx context.Context) (*ctypes.ResultGenesis, error)

func (*RPCClient) GenesisChunked

func (c *RPCClient) GenesisChunked(ctx context.Context, id uint) (*ctypes.ResultGenesisChunk, error)

func (*RPCClient) Health

func (c *RPCClient) Health(ctx context.Context) (*ctypes.ResultHealth, error)

func (*RPCClient) NetInfo

func (c *RPCClient) NetInfo(ctx context.Context) (*ctypes.ResultNetInfo, error)

func (*RPCClient) NumUnconfirmedTxs

func (c *RPCClient) NumUnconfirmedTxs(ctx context.Context) (*ctypes.ResultUnconfirmedTxs, error)

func (*RPCClient) Status

func (c *RPCClient) Status(ctx context.Context) (*ctypes.ResultStatus, error)

func (*RPCClient) Tx

func (c *RPCClient) Tx(ctx context.Context, hash []byte, prove bool) (*ctypes.ResultTx, error)

func (*RPCClient) TxSearch

func (c *RPCClient) TxSearch(
	ctx context.Context,
	query string,
	prove bool,
	page,
	perPage *int,
	orderBy string,
) (*ctypes.ResultTxSearch, error)

func (*RPCClient) UnconfirmedTxs

func (c *RPCClient) UnconfirmedTxs(
	ctx context.Context,
	limit *int,
) (*ctypes.ResultUnconfirmedTxs, error)

func (*RPCClient) Validators

func (c *RPCClient) Validators(
	ctx context.Context,
	height *int64,
	page,
	perPage *int,
) (*ctypes.ResultValidators, error)

type ReadOnlyChainConfig

type ReadOnlyChainConfig struct {
	ChainID                     string
	RpcUrl                      string
	ConnectTimeoutSeconds       int
	QueryTimeoutSeconds         int
	QueryRetries                int
	QueryRetryDelayMilliseconds int
	CompatibilityMode           string
	Client                      RPCClientI        `toml:"-"`
	LightProvider               prov.Provider     `toml:"-"`
	Codec                       *codec.ProtoCodec `toml:"-"`
	Cache                       *ristretto.Cache  `toml:"-"`
}

func DefaultReadOnlyChainConfig

func DefaultReadOnlyChainConfig(chainID string, rpcUrl string) *ReadOnlyChainConfig

func (*ReadOnlyChainConfig) GetClientId

func (r *ReadOnlyChainConfig) GetClientId(ctx context.Context, connectionId string, logger log2.Logger, metrics prommetrics.Metrics) (string, error)

func (*ReadOnlyChainConfig) GetClientState

func (r *ReadOnlyChainConfig) GetClientState(ctx context.Context, clientId string, logger log2.Logger, metrics prommetrics.Metrics) (*clienttypes.QueryClientStateResponse, error)

func (*ReadOnlyChainConfig) GetClientStateHeights

func (r *ReadOnlyChainConfig) GetClientStateHeights(ctx context.Context, clientId string, chainId string, height uint64, logger log2.Logger, metrics prommetrics.Metrics, depth int) ([]clienttypes.Height, error)

func (*ReadOnlyChainConfig) GetCurrentHeight

func (r *ReadOnlyChainConfig) GetCurrentHeight(ctx context.Context, cache *ristretto.Cache, logger log2.Logger) (int64, error)

func (*ReadOnlyChainConfig) Init

func (r *ReadOnlyChainConfig) Init(codec *codec.ProtoCodec, cache *ristretto.Cache) error

func (*ReadOnlyChainConfig) LightBlock

func (r *ReadOnlyChainConfig) LightBlock(ctx context.Context, height int64) (*tmtypes.LightBlock, error)

func (*ReadOnlyChainConfig) RunABCIQuery

func (r *ReadOnlyChainConfig) RunABCIQuery(ctx context.Context, method string, reqBz []byte, height int64, prove bool, metrics prommetrics.Metrics) (abcitypes.ResponseQuery, error)

func (*ReadOnlyChainConfig) Tx

func (r *ReadOnlyChainConfig) Tx(hash []byte) (*codectypes.Any, int64, error)

tm0.37 has a breaking change whereby tx events are no longer base64 encoded, so are represented as string and not bytes. As a result, we cannot use the RPCClient.Tx() method which attempts to unmarshal the Result, including the underlying Tx object. As such, we want to query the result directly, and unmarshal the json ourselves, to a representation of the result that conveniently does not contain the Tx object (that we don't use, because the TxProof already contains a byte representation of tx anyway!) Note: this function is compatible with 0.34 and 0.37 representations of transactions.

type TxClient

type TxClient interface {
	QueryClient
	SignAndBroadcastMsg(ctx context.Context, cliContext *client.Context, exec []sdktypes.Msg, memo string) (string, uint32, error)
}

type TxResultMinimal

type TxResultMinimal struct {
	Height string          `json:"height"`
	Proof  tmtypes.TxProof `json:"proof"`
}

a minimised representation of the Tx emitted by a Tx query, only containing Height and Proof and thus compatbiel with tm0.34 and tm0.37.

type TxResultMinimalCelestia

type TxResultMinimalCelestia struct {
	Height string                   `json:"height"`
	Proof  celestiatypes.ShareProof `json:"proof"`
	Index  uint32                   `json:"index"`
}

define celestia based TxResultMinimal

Jump to

Keyboard shortcuts

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