client

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: Apache-2.0 Imports: 18 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BabylonClient

type BabylonClient interface {
	Stop()
	GetConfig() *config.BabylonConfig
	GetTagIdx() uint8
	GetAddr() (sdk.AccAddress, error)
	MustGetAddr() sdk.AccAddress
	InsertBTCSpvProof(msg *btcctypes.MsgInsertBTCSpvProof) (*sdk.TxResponse, error)
	InsertHeader(msg *btclctypes.MsgInsertHeader) (*sdk.TxResponse, error)
	InsertHeaders(msgs []*btclctypes.MsgInsertHeader) (*sdk.TxResponse, error)
	MustInsertBTCSpvProof(msg *btcctypes.MsgInsertBTCSpvProof) *sdk.TxResponse

	// staking module related queries
	QueryStakingParams() (*stakingtypes.Params, error)

	// epoch module related queries
	QueryEpochingParams() (*epochingtypes.Params, error)
	QueryCurrentEpoch() (uint64, error)

	// btclightclient module related queries
	QueryBTCLightclientParams() (*btclctypes.Params, error)
	QueryHeaderChainTip() (*chainhash.Hash, uint64, error)
	QueryBaseHeader() (*wire.BlockHeader, uint64, error)
	QueryContainsBlock(blockHash *chainhash.Hash) (bool, error)

	// btccheckpoint module related queries
	QueryBTCCheckpointParams() (*btcctypes.Params, error)
	MustQueryBTCCheckpointParams() *btcctypes.Params

	// checkpointing module related queries
	QueryRawCheckpoint(epochNumber uint64) (*checkpointingtypes.RawCheckpointWithMeta, error)
	QueryRawCheckpointList(status checkpointingtypes.CheckpointStatus) ([]*checkpointingtypes.RawCheckpointWithMeta, error)
	BlsPublicKeyList(epochNumber uint64) ([]*checkpointingtypes.ValidatorWithBlsKey, error)

	// monitor module related queries
	QueryEndedEpochBtcHeight(epochNum uint64) (uint64, error)
	QueryReportedCheckpointBtcHeight(hash string) (uint64, error)
}

type Client

type Client struct {
	*lensclient.ChainClient
	// contains filtered or unexported fields
}

func New

func New(cfg *config.BabylonConfig, retrySleepTime, maxRetrySleepTime time.Duration) (*Client, error)

func (*Client) BlsPublicKeyList

func (c *Client) BlsPublicKeyList(epochNumber uint64) ([]*checkpointingtypes.ValidatorWithBlsKey, error)

func (*Client) GetAddr

func (c *Client) GetAddr() (sdk.AccAddress, error)

func (*Client) GetConfig

func (c *Client) GetConfig() *config.BabylonConfig

func (*Client) GetTagIdx

func (c *Client) GetTagIdx() uint8

func (*Client) InsertBTCSpvProof

func (c *Client) InsertBTCSpvProof(msg *btcctypes.MsgInsertBTCSpvProof) (*sdk.TxResponse, error)

func (*Client) InsertHeader

func (c *Client) InsertHeader(msg *btclctypes.MsgInsertHeader) (*sdk.TxResponse, error)

func (*Client) InsertHeaders

func (c *Client) InsertHeaders(msgs []*btclctypes.MsgInsertHeader) (*sdk.TxResponse, error)

func (*Client) MustGetAddr

func (c *Client) MustGetAddr() sdk.AccAddress

func (*Client) MustInsertBTCSpvProof

func (c *Client) MustInsertBTCSpvProof(msg *btcctypes.MsgInsertBTCSpvProof) *sdk.TxResponse

func (*Client) MustQueryBTCCheckpointParams

func (c *Client) MustQueryBTCCheckpointParams() *btcctypes.Params

func (*Client) QueryBTCCheckpointParams

func (c *Client) QueryBTCCheckpointParams() (*btcctypes.Params, error)

QueryBTCCheckpointParams queries btccheckpoint module's parameters via ChainClient

func (*Client) QueryBTCLightclientParams

func (c *Client) QueryBTCLightclientParams() (*btclctypes.Params, error)

QueryBTCLightclientParams queries btclightclient module's parameters via ChainClient

func (*Client) QueryBaseHeader

func (c *Client) QueryBaseHeader() (*wire.BlockHeader, uint64, error)

func (*Client) QueryContainsBlock

func (c *Client) QueryContainsBlock(blockHash *chainhash.Hash) (bool, error)

func (*Client) QueryCurrentEpoch

func (c *Client) QueryCurrentEpoch() (uint64, error)

QueryCurrentEpoch queries the current epoch number via ChainClient

func (*Client) QueryEndedEpochBtcHeight

func (c *Client) QueryEndedEpochBtcHeight(epochNum uint64) (uint64, error)

QueryEndedEpochBtcHeight queries the tip height of BTC light client at epoch ends

func (*Client) QueryEpochingParams

func (c *Client) QueryEpochingParams() (*epochingtypes.Params, error)

QueryEpochingParams queries epoching module's parameters via ChainClient code is adapted from https://github.com/strangelove-ventures/lens/blob/v0.5.1/client/query/staking.go#L7-L18

func (*Client) QueryHeaderChainTip

func (c *Client) QueryHeaderChainTip() (*chainhash.Hash, uint64, error)

QueryHeaderChainTip queries hash/height of the latest BTC block in the btclightclient module

func (*Client) QueryRawCheckpoint

func (c *Client) QueryRawCheckpoint(epochNumber uint64) (*checkpointingtypes.RawCheckpointWithMeta, error)

func (*Client) QueryReportedCheckpointBtcHeight

func (c *Client) QueryReportedCheckpointBtcHeight(hashStr string) (uint64, error)

QueryReportedCheckpointBtcHeight queries the tip height of BTC light client when a given checkpoint is reported

func (*Client) QueryStakingParams

func (c *Client) QueryStakingParams() (*stakingtypes.Params, error)

QueryStakingParams queries staking module's parameters via ChainClient code is adapted from https://github.com/strangelove-ventures/lens/blob/v0.5.1/cmd/staking.go#L128-L149

func (*Client) Stop

func (c *Client) Stop()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳