Documentation
¶
Index ¶
- func ConstructModule(tp node.Type, cfg *Config) fx.Option
- func CoreAccessor(corecfg core.Config, signer *apptypes.KeyringSigner, sync *sync.Syncer) *state.CoreAccessor
- func Flags() *flag.FlagSet
- func Keyring(cfg Config, ks keystore.Keystore, net p2p.Network) (*apptypes.KeyringSigner, error)
- func ParseFlags(cmd *cobra.Command, cfg *Config)
- func WithKeyringSigner(signer *types.KeyringSigner) fx.Option
- type API
- type Config
- type Module
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConstructModule ¶
ConstructModule provides all components necessary to construct the state service.
func CoreAccessor ¶
func CoreAccessor( corecfg core.Config, signer *apptypes.KeyringSigner, sync *sync.Syncer, ) *state.CoreAccessor
CoreAccessor constructs a new instance of state.Module over a celestia-core connection.
func ParseFlags ¶
ParseFlags parses State flags from the given cmd and saves them to the passed config.
func WithKeyringSigner ¶
func WithKeyringSigner(signer *types.KeyringSigner) fx.Option
WithKeyringSigner overrides the default keyring signer constructed by the node.
Types ¶
type API ¶ added in v0.5.0
type API struct {
IsStopped func() bool
Balance func(ctx context.Context) (*state.Balance, error)
BalanceForAddress func(ctx context.Context, addr state.Address) (*state.Balance, error)
Transfer func(
ctx context.Context,
to state.AccAddress,
amount math.Int,
gasLimit uint64,
) (*state.TxResponse, error)
SubmitTx func(ctx context.Context, tx state.Tx) (*state.TxResponse, error)
SubmitPayForData func(ctx context.Context, nID namespace.ID, data []byte, gasLim uint64) (
*state.TxResponse,
error,
)
CancelUnbondingDelegation func(
ctx context.Context,
valAddr state.ValAddress,
amount,
height state.Int,
gasLim uint64,
) (*state.TxResponse, error)
BeginRedelegate func(
ctx context.Context,
srcValAddr,
dstValAddr state.ValAddress,
amount state.Int,
gasLim uint64,
) (*state.TxResponse, error)
Undelegate func(ctx context.Context, delAddr state.ValAddress, amount state.Int, gasLim uint64) (
*state.TxResponse,
error,
)
Delegate func(ctx context.Context, delAddr state.ValAddress, amount state.Int, gasLim uint64) (
*state.TxResponse,
error,
)
QueryDelegation func(ctx context.Context, valAddr state.ValAddress) (*types.QueryDelegationResponse, error)
QueryUnbonding func(ctx context.Context, valAddr state.ValAddress) (*types.QueryUnbondingDelegationResponse, error)
QueryRedelegations func(
ctx context.Context,
srcValAddr,
dstValAddr state.ValAddress,
) (*types.QueryRedelegationsResponse, error)
}
API is a wrapper around Module for the RPC. TODO(@distractedm1nd): These structs need to be autogenerated.
type Config ¶
type Config struct {
KeyringAccName string
}
Config contains configuration parameters for constructing the node's keyring signer.
func DefaultConfig ¶
func DefaultConfig() Config
type Module ¶
type Module interface {
// IsStopped checks if the Module's context has been stopped
IsStopped() bool
// AccountAddress retrieves the address of the node's account/signer
AccountAddress(ctx context.Context) (state.Address, error)
// Balance retrieves the Celestia coin balance for the node's account/signer
// and verifies it against the corresponding block's AppHash.
Balance(ctx context.Context) (*state.Balance, error)
// BalanceForAddress retrieves the Celestia coin balance for the given address and verifies
// the returned balance against the corresponding block's AppHash.
//
// NOTE: the balance returned is the balance reported by the block right before
// the node's current head (head-1). This is due to the fact that for block N, the block's
// `AppHash` is the result of applying the previous block's transaction list.
BalanceForAddress(ctx context.Context, addr state.Address) (*state.Balance, error)
// Transfer sends the given amount of coins from default wallet of the node to the given account address.
Transfer(ctx context.Context, to state.AccAddress, amount math.Int, gasLimit uint64) (*state.TxResponse, 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 state.Tx) (*state.TxResponse, error)
// SubmitPayForData builds, signs and submits a PayForData transaction.
SubmitPayForData(ctx context.Context, nID namespace.ID, data []byte, gasLim uint64) (*state.TxResponse, error)
// CancelUnbondingDelegation cancels a user's pending undelegation from a validator.
CancelUnbondingDelegation(
ctx context.Context,
valAddr state.ValAddress,
amount,
height state.Int,
gasLim uint64,
) (*state.TxResponse, error)
// BeginRedelegate sends a user's delegated tokens to a new validator for redelegation.
BeginRedelegate(
ctx context.Context,
srcValAddr,
dstValAddr state.ValAddress,
amount state.Int,
gasLim uint64,
) (*state.TxResponse, error)
// Undelegate undelegates a user's delegated tokens, unbonding them from the current validator.
Undelegate(ctx context.Context, delAddr state.ValAddress, amount state.Int, gasLim uint64) (*state.TxResponse, error)
// Delegate sends a user's liquid tokens to a validator for delegation.
Delegate(ctx context.Context, delAddr state.ValAddress, amount state.Int, gasLim uint64) (*state.TxResponse, error)
// QueryDelegation retrieves the delegation information between a delegator and a validator.
QueryDelegation(ctx context.Context, valAddr state.ValAddress) (*types.QueryDelegationResponse, error)
// QueryUnbonding retrieves the unbonding status between a delegator and a validator.
QueryUnbonding(ctx context.Context, valAddr state.ValAddress) (*types.QueryUnbondingDelegationResponse, error)
// QueryRedelegations retrieves the status of the redelegations between a delegator and a validator.
QueryRedelegations(
ctx context.Context,
srcValAddr,
dstValAddr state.ValAddress,
) (*types.QueryRedelegationsResponse, error)
}
Module represents the behaviors necessary for a user to query for state-related information and submit transactions/ messages to the Celestia network.