Documentation
¶
Overview ¶
Package state provides a structure for celestia-node's ability to access state-relevant information from as well as submit transactions/messages to the celestia network.
This package contains one main interface, `Accessor`, that defines the methods available for both accessing and updating state on the celestia network.
`Accessor` will contain three different implementations:
- Implementation over a gRPC connection with a celestia-core node called `CoreAccess`.
- Implementation over a libp2p stream with a state-providing node.
- Implementation over a local running instance of the celestia-application (this feature will be implemented in *Full* nodes).
Index ¶
- type Accessor
- type Address
- type Balance
- type CoreAccessor
- func (ca *CoreAccessor) Balance(ctx context.Context) (*Balance, error)
- func (ca *CoreAccessor) BalanceForAddress(ctx context.Context, addr Address) (*Balance, error)
- func (ca *CoreAccessor) Start(ctx context.Context) error
- func (ca *CoreAccessor) Stop(context.Context) error
- func (ca *CoreAccessor) SubmitPayForData(ctx context.Context, nID namespace.ID, data []byte, gasLim uint64) (*TxResponse, error)
- func (ca *CoreAccessor) SubmitTx(ctx context.Context, tx Tx) (*TxResponse, error)
- func (ca *CoreAccessor) SubmitTxWithBroadcastMode(ctx context.Context, tx Tx, mode sdk_tx.BroadcastMode) (*TxResponse, error)
- func (ca *CoreAccessor) Transfer(ctx context.Context, addr Address, amount Int, gasLim uint64) (*TxResponse, error)
- type Int
- type Service
- func (s *Service) Balance(ctx context.Context) (*Balance, error)
- func (s *Service) BalanceForAddress(ctx context.Context, addr Address) (*Balance, error)
- func (s *Service) IsStopped() bool
- func (s *Service) Start(context.Context) error
- func (s *Service) Stop(context.Context) error
- func (s *Service) SubmitPayForData(ctx context.Context, nID namespace.ID, data []byte, gasLim uint64) (*TxResponse, error)
- func (s *Service) SubmitTx(ctx context.Context, tx Tx) (*TxResponse, error)
- func (s *Service) Transfer(ctx context.Context, to Address, amount Int, gasLimit uint64) (*TxResponse, error)
- type Tx
- type TxResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Accessor ¶
type Accessor interface {
// Start starts the state Accessor.
Start(context.Context) error
// Stop stops the state Accessor.
Stop(context.Context) error
// SubmitPayForData builds, signs and submits a PayForData transaction.
SubmitPayForData(ctx context.Context, nID namespace.ID, data []byte, gasLim uint64) (*TxResponse, error)
// Balance retrieves the Celestia coin balance
// for the node's account/signer.
Balance(ctx context.Context) (*Balance, error)
// BalanceForAddress retrieves the Celestia coin balance
// for the given types.AccAddress.
BalanceForAddress(ctx context.Context, addr Address) (*Balance, error)
// SubmitTx submits the given transaction/message to the
// Celestia network and blocks until the tx is included in
// a block.
SubmitTx(ctx context.Context, tx Tx) (*TxResponse, error)
// Transfer sends the given amount of coins from default wallet of the node to the given account address.
Transfer(ctx context.Context, to types.Address, amount types.Int, gasLimit uint64) (*TxResponse, error)
}
Accessor represents the behaviors necessary for a user to query for state-related information and submit transactions/ messages to the Celestia network.
type CoreAccessor ¶
type CoreAccessor struct {
// contains filtered or unexported fields
}
CoreAccessor implements Accessor over a gRPC connection with a celestia-core node.
func NewCoreAccessor ¶
func NewCoreAccessor( signer *apptypes.KeyringSigner, endpoint string, ) *CoreAccessor
NewCoreAccessor dials the given celestia-core endpoint and constructs and returns a new CoreAccessor with the active connection.
func (*CoreAccessor) Balance ¶
func (ca *CoreAccessor) Balance(ctx context.Context) (*Balance, error)
func (*CoreAccessor) BalanceForAddress ¶
func (*CoreAccessor) SubmitPayForData ¶
func (ca *CoreAccessor) SubmitPayForData( ctx context.Context, nID namespace.ID, data []byte, gasLim uint64, ) (*TxResponse, error)
func (*CoreAccessor) SubmitTx ¶
func (ca *CoreAccessor) SubmitTx(ctx context.Context, tx Tx) (*TxResponse, error)
func (*CoreAccessor) SubmitTxWithBroadcastMode ¶
func (ca *CoreAccessor) SubmitTxWithBroadcastMode( ctx context.Context, tx Tx, mode sdk_tx.BroadcastMode, ) (*TxResponse, error)
func (*CoreAccessor) Transfer ¶
func (ca *CoreAccessor) Transfer( ctx context.Context, addr Address, amount Int, gasLim uint64, ) (*TxResponse, error)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service can access state-related information via the given Accessor.
func NewService ¶
NewService constructs a new state Service.
func (*Service) BalanceForAddress ¶
func (*Service) SubmitPayForData ¶
type TxResponse ¶
type TxResponse = sdk.TxResponse
TxResponse is an alias to the TxResponse type from Cosmos-SDK.