dymension

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 21 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	KeyringBackend cosmosaccount.KeyringBackend `json:"keyring_backend"`
	NodeAddress    string                       `json:"node_address"`
	KeyRingHomeDir string                       `json:"keyring_home_dir"`
	DymAccountName string                       `json:"dym_account_name"`
	RollappID      string                       `json:"rollapp_id"`
	GasLimit       uint64                       `json:"gas_limit"`
	GasPrices      string                       `json:"gas_prices"`
	GasFees        string                       `json:"gas_fees"`
}

Config for the DymensionLayerClient

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) (settlement.PostBatchResp, error)

PostBatch posts a batch to the Dymension Hub.

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 []byte, 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 WithCosmosClient

func WithCosmosClient(cosmosClient CosmosClient) Option

WithCosmosClient is an option that sets the CosmosClient.

type PostBatchResp

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

PostBatchResp is the response after posting a batch to the Dymension Hub.

func (PostBatchResp) GetCode

func (d PostBatchResp) GetCode() uint32

GetCode returns the response code.

func (PostBatchResp) GetTxHash

func (d PostBatchResp) GetTxHash() string

GetTxHash returns the transaction hash.

Jump to

Keyboard shortcuts

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