Documentation ¶
Index ¶
- type CosmosClient
- type HubClient
- func (d *HubClient) GetBatchAtIndex(rollappID string, index uint64) (*settlement.ResultRetrieveBatch, error)
- func (d *HubClient) GetLatestBatch(rollappID string) (*settlement.ResultRetrieveBatch, error)
- func (d *HubClient) GetSequencers(rollappID string) ([]*types.Sequencer, error)
- func (d *HubClient) PostBatch(batch *types.Batch, daClient da.Client, daResult *da.ResultSubmitBatch)
- func (d *HubClient) Start() error
- func (d *HubClient) Stop() error
- type LayerClient
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CosmosClient ¶
type CosmosClient interface { Context() sdkclient.Context StartEventListener() error StopEventListener() error EventListenerQuit() <-chan struct{} SubscribeToEvents(ctx context.Context, subscriber string, query string, outCapacity ...int) (out <-chan ctypes.ResultEvent, err error) BroadcastTx(accountName string, msgs ...sdktypes.Msg) (cosmosclient.Response, error) GetRollappClient() rollapptypes.QueryClient GetSequencerClient() sequencertypes.QueryClient GetAccount(accountName string) (cosmosaccount.Account, error) }
CosmosClient is an interface for interacting with cosmos client chains. It is a wrapper around the cosmos client in order to provide with an interface which can be implemented by other clients and can easily be mocked for testing purposes. Currently it contains only the methods that are used by the dymension hub client.
func NewCosmosClient ¶
func NewCosmosClient(client cosmosclient.Client) CosmosClient
NewCosmosClient creates a new cosmos client
type HubClient ¶
type HubClient struct {
// contains filtered or unexported fields
}
HubClient is the client for the Dymension Hub.
func (*HubClient) GetBatchAtIndex ¶
func (d *HubClient) GetBatchAtIndex(rollappID string, index uint64) (*settlement.ResultRetrieveBatch, error)
GetBatchAtIndex returns the batch at the given index from the Dymension Hub.
func (*HubClient) GetLatestBatch ¶
func (d *HubClient) GetLatestBatch(rollappID string) (*settlement.ResultRetrieveBatch, error)
GetLatestBatch returns the latest batch from the Dymension Hub.
func (*HubClient) GetSequencers ¶
GetSequencers returns the sequence of the given rollapp.
func (*HubClient) PostBatch ¶
func (d *HubClient) PostBatch(batch *types.Batch, daClient da.Client, daResult *da.ResultSubmitBatch)
PostBatch posts a batch to the Dymension Hub. it tries to post the batch until it is accepted by the settlement layer. it emits success and failure events to the event bus accordingly.
type LayerClient ¶
type LayerClient struct {
*settlement.BaseLayerClient
}
LayerClient is intended only for usage in tests.
func (*LayerClient) Init ¶
func (dlc *LayerClient) Init(config settlement.Config, pubsub *pubsub.Server, logger log.Logger, options ...settlement.Option) error
Init is called once. it initializes the struct members.
type Option ¶
type Option func(*HubClient)
Option is a function that configures the HubClient.
func WithBatchAcceptanceTimeout ¶
WithBatchAcceptanceTimeout is an option that sets the timeout for waiting for a batch to be accepted by the settlement layer.
func WithBatchRetryAttempts ¶
WithBatchRetryAttempts is an option that sets the number of attempts to retry sending a batch to the settlement layer.
func WithBatchRetryDelay ¶
WithBatchRetryDelay is an option that sets the delay between batch retry attempts.
func WithCosmosClient ¶
func WithCosmosClient(cosmosClient CosmosClient) Option
WithCosmosClient is an option that sets the CosmosClient.