dymension

package
v0.0.0-...-568787c Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

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

func (d *HubClient) GetSequencers(rollappID string) ([]*types.Sequencer, error)

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.

func (*HubClient) Start

func (d *HubClient) Start() error

Start starts the HubClient.

func (*HubClient) Stop

func (d *HubClient) Stop() error

Stop stops the HubClient.

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

func WithBatchAcceptanceTimeout(batchAcceptanceTimeout time.Duration) Option

WithBatchAcceptanceTimeout is an option that sets the timeout for waiting for a batch to be accepted by the settlement layer.

func WithBatchRetryAttempts

func WithBatchRetryAttempts(batchRetryAttempts uint) Option

WithBatchRetryAttempts is an option that sets the number of attempts to retry sending a batch to the settlement layer.

func WithBatchRetryDelay

func WithBatchRetryDelay(batchRetryDelay time.Duration) Option

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.

Jump to

Keyboard shortcuts

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