state

package
v0.0.0-...-4e9d6c2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package state provides a structure for elysium-node's ability to access state-relevant information from as well as submit transactions/messages to the elysium network.

This package contains one main interface, `Accessor`, that defines the methods available for both accessing and updating state on the elysium network.

`Accessor` will contain three different implementations:

  1. Implementation over a gRPC connection with a elysium-core node called `CoreAccess`.
  2. Implementation over a libp2p stream with a state-providing node.
  3. Implementation over a local running instance of the elysium-application (this feature will be implemented in *Full* nodes).

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidAmount = errors.New("state: amount must be greater than zero")
)

Functions

func WithMetrics

func WithMetrics(ca *CoreAccessor)

Types

type AccAddress

type AccAddress = sdk.AccAddress

AccAddress is an alias to the AccAddress type from Cosmos-SDK.

type Address

type Address = sdk.Address

Address is an alias to the Address type from Cosmos-SDK.

type Balance

type Balance = sdk.Coin

Balance is an alias to the Coin type from Cosmos-SDK.

type CoreAccessor

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

CoreAccessor implements service over a gRPC connection with a elysium-core node.

func NewCoreAccessor

func NewCoreAccessor(
	signer *apptypes.KeyringSigner,
	getter libhead.Head[*header.ExtendedHeader],
	coreIP,
	rpcPort string,
	grpcPort string,
) *CoreAccessor

NewCoreAccessor dials the given elysium-core endpoint and constructs and returns a new CoreAccessor (state service) with the active connection.

func (*CoreAccessor) AccountAddress

func (ca *CoreAccessor) AccountAddress(context.Context) (Address, error)

func (*CoreAccessor) Balance

func (ca *CoreAccessor) Balance(ctx context.Context) (*Balance, error)

func (*CoreAccessor) BalanceForAddress

func (ca *CoreAccessor) BalanceForAddress(ctx context.Context, addr Address) (*Balance, error)

func (*CoreAccessor) BeginRedelegate

func (ca *CoreAccessor) BeginRedelegate(
	ctx context.Context,
	srcValAddr,
	dstValAddr ValAddress,
	amount,
	fee Int,
	gasLim uint64,
) (*TxResponse, error)

func (*CoreAccessor) CancelUnbondingDelegation

func (ca *CoreAccessor) CancelUnbondingDelegation(
	ctx context.Context,
	valAddr ValAddress,
	amount,
	height,
	fee Int,
	gasLim uint64,
) (*TxResponse, error)

func (*CoreAccessor) Delegate

func (ca *CoreAccessor) Delegate(
	ctx context.Context,
	delAddr ValAddress,
	amount Int,
	fee Int,
	gasLim uint64,
) (*TxResponse, error)

func (*CoreAccessor) IsStopped

func (ca *CoreAccessor) IsStopped(context.Context) bool

func (*CoreAccessor) QueryDelegation

func (ca *CoreAccessor) QueryDelegation(
	ctx context.Context,
	valAddr ValAddress,
) (*stakingtypes.QueryDelegationResponse, error)

func (*CoreAccessor) QueryRedelegations

func (ca *CoreAccessor) QueryRedelegations(
	ctx context.Context,
	srcValAddr,
	dstValAddr ValAddress,
) (*stakingtypes.QueryRedelegationsResponse, error)

func (*CoreAccessor) QueryUnbonding

func (*CoreAccessor) Start

func (ca *CoreAccessor) Start(ctx context.Context) error

func (*CoreAccessor) Stop

func (ca *CoreAccessor) Stop(context.Context) error

func (*CoreAccessor) SubmitPayForBlob

func (ca *CoreAccessor) SubmitPayForBlob(
	ctx context.Context,
	nID namespace.ID,
	data []byte,
	fee Int,
	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 sdktx.BroadcastMode,
) (*TxResponse, error)

func (*CoreAccessor) Transfer

func (ca *CoreAccessor) Transfer(
	ctx context.Context,
	addr AccAddress,
	amount,
	fee Int,
	gasLim uint64,
) (*TxResponse, error)

func (*CoreAccessor) Undelegate

func (ca *CoreAccessor) Undelegate(
	ctx context.Context,
	delAddr ValAddress,
	amount,
	fee Int,
	gasLim uint64,
) (*TxResponse, error)

type Int

type Int = math.Int

Int is an alias to the Int type from Cosmos-SDK.

type Tx

type Tx = coretypes.Tx

Tx is an alias to the Tx type from elysium-core.

type TxResponse

type TxResponse = sdk.TxResponse

TxResponse is an alias to the TxResponse type from Cosmos-SDK.

type ValAddress

type ValAddress = sdk.ValAddress

ValAddress is an alias to the ValAddress type from Cosmos-SDK.

Jump to

Keyboard shortcuts

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