state

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultGasPrice specifies the default gas price value to be used when the user
	// wants to use the global minimal gas price, which is fetched from the celestia-app.
	DefaultGasPrice float64 = -1.0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// AccountAddress retrieves the address of the node's account/signer
	AccountAddress func(ctx context.Context) (Address, error) `perm:"read"`
	// Balance retrieves the Celestia coin balance for the node's account/signer
	// and verifies it against the corresponding block's AppHash.
	Balance func(ctx context.Context) (*Balance, error) `perm:"read"`
	// 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 func(ctx context.Context, addr Address) (*Balance, error) `perm:"read"`
	// Transfer sends the given amount of coins from default wallet of the node to the given account
	// address.
	Transfer func(
		ctx context.Context,
		to AccAddress,
		amount Int,
		config *TxConfig,
	) (*TxResponse, error) `perm:"write"`
	// SubmitPayForBlob builds, signs and submits a PayForBlob transaction.
	SubmitPayForBlob func(
		ctx context.Context,
		blobs []*blob.Blob,
		config *TxConfig,
	) (*TxResponse, error) `perm:"write"`
	// CancelUnbondingDelegation cancels a user's pending undelegation from a validator.
	CancelUnbondingDelegation func(
		ctx context.Context,
		valAddr ValAddress,
		amount, height Int,
		config *TxConfig,
	) (*TxResponse, error) `perm:"write"`
	// BeginRedelegate sends a user's delegated tokens to a new validator for redelegation.
	BeginRedelegate func(
		ctx context.Context,
		srcValAddr,
		dstValAddr ValAddress,
		amount Int,
		config *TxConfig,
	) (*TxResponse, error) `perm:"write"`
	// Undelegate undelegates a user's delegated tokens, unbonding them from the current validator.
	Undelegate func(
		ctx context.Context,
		delAddr ValAddress,
		amount Int,
		config *TxConfig,
	) (*TxResponse, error) `perm:"write"`
	// Delegate sends a user's liquid tokens to a validator for delegation.
	Delegate func(
		ctx context.Context,
		delAddr ValAddress,
		amount Int,
		config *TxConfig,
	) (*TxResponse, error) `perm:"write"`
	// QueryDelegation retrieves the delegation information between a delegator and a validator.
	QueryDelegation func(
		ctx context.Context,
		valAddr ValAddress,
	) (*QueryDelegationResponse, error) `perm:"read"`
	// QueryUnbonding retrieves the unbonding status between a delegator and a validator.
	QueryUnbonding func(
		ctx context.Context,
		valAddr ValAddress,
	) (*QueryUnbondingDelegationResponse, error) `perm:"read"`
	// QueryRedelegations retrieves the status of the redelegations between a delegator and a validator.
	QueryRedelegations func(
		ctx context.Context,
		srcValAddr,
		dstValAddr ValAddress,
	) (*QueryRedelegationsResponse, error) `perm:"read"`
	// GrantFee grants the given amount of fee to the given grantee.
	GrantFee func(
		ctx context.Context,
		grantee AccAddress,
		amount Int,
		config *TxConfig,
	) (*TxResponse, error) `perm:"write"`
	// RevokeGrantFee revokes the granted fee from the given grantee.
	RevokeGrantFee func(
		ctx context.Context,
		grantee AccAddress,
		config *TxConfig,
	) (*TxResponse, error) `perm:"write"`
}

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 ConfigOption added in v0.5.0

type ConfigOption func(cfg *TxConfig)

ConfigOption is the functional option that is applied to the TxConfig instance to configure parameters.

func WithFeeGranterAddress added in v0.5.0

func WithFeeGranterAddress(granter string) ConfigOption

WithFeeGranterAddress is an option that allows you to specify a GranterAddress to pay the fees.

func WithGas added in v0.5.0

func WithGas(gas uint64) ConfigOption

WithGas is an option that allows to specify Gas. Gas will be calculated in case it wasn't specified.

func WithGasPrice added in v0.5.0

func WithGasPrice(gasPrice float64) ConfigOption

WithGasPrice is an option that allows to specify a GasPrice, which is needed to calculate the fee. In case GasPrice is not specified, the global GasPrice fetched from celestia-app will be used.

func WithKeyName added in v0.5.0

func WithKeyName(key string) ConfigOption

WithKeyName is an option that allows you to specify an KeyName, which is needed to sign the transaction. This key should be associated with the address and stored locally in the key store. Default Account will be used in case it wasn't specified.

func WithSignerAddress added in v0.5.0

func WithSignerAddress(address string) ConfigOption

WithSignerAddress is an option that allows you to specify an address, that will sign the transaction. This address must be stored locally in the key store. Default signerAddress will be used in case it wasn't specified.

type Dec

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

NOTE: never use new(Dec) or else we will panic unmarshalling into the nil embedded big.Int

type Delegation

type Delegation struct {
	// delegator_address is the bech32-encoded address of the delegator.
	DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"`
	// validator_address is the bech32-encoded address of the validator.
	ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"`
	// shares define the delegation shares received.
	Shares Dec `protobuf:"bytes,3,opt,name=shares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"shares"`
}

Delegation represents the bond with tokens held by an account. It is owned by one delegator, and is associated with the voting power of one validator.

type DelegationResponse

type DelegationResponse struct {
	Delegation Delegation `protobuf:"bytes,1,opt,name=delegation,proto3" json:"delegation"`
	Balance    sdk.Coin   `protobuf:"bytes,2,opt,name=balance,proto3" json:"balance"`
}

DelegationResponse is equivalent to Delegation except that it contains a balance in addition to shares which is more suitable for client responses.

type Int

type Int = math.Int

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

type PageResponse

type PageResponse struct {
	// next_key is the key to be passed to PageRequest.key to
	// query the next page most efficiently. It will be empty if
	// there are no more results.
	NextKey []byte `protobuf:"bytes,1,opt,name=next_key,json=nextKey,proto3" json:"next_key,omitempty"`
	// total is total number of results available if PageRequest.count_total
	// was set, its value is undefined otherwise
	Total uint64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"`
}

PageResponse is to be embedded in gRPC response messages where the corresponding request message has used PageRequest.

message SomeResponse {
        repeated Bar results = 1;
        PageResponse page = 2;
}

type QueryDelegationResponse

type QueryDelegationResponse struct {
	// delegation_responses defines the delegation info of a delegation.
	DelegationResponse *DelegationResponse `protobuf:"bytes,1,opt,name=delegation_response,json=delegationResponse,proto3" json:"delegation_response,omitempty"`
}

QueryDelegationResponse is response type for the Query/Delegation RPC method.

type QueryRedelegationsResponse

type QueryRedelegationsResponse struct {
	RedelegationResponses []RedelegationResponse `protobuf:"bytes,1,rep,name=redelegation_responses,json=redelegationResponses,proto3" json:"redelegation_responses"`
	// pagination defines the pagination in the response.
	Pagination *PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

QueryRedelegationsResponse is response type for the Query/Redelegations RPC method.

type QueryUnbondingDelegationResponse

type QueryUnbondingDelegationResponse struct {
	// unbond defines the unbonding information of a delegation.
	Unbond UnbondingDelegation `protobuf:"bytes,1,opt,name=unbond,proto3" json:"unbond"`
}

QueryDelegationResponse is response type for the Query/UnbondingDelegation RPC method.

type Redelegation

type Redelegation struct {
	// delegator_address is the bech32-encoded address of the delegator.
	DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"`
	// validator_src_address is the validator redelegation source operator address.
	ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty"`
	// validator_dst_address is the validator redelegation destination operator address.
	ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty"`
	// entries are the redelegation entries.
	Entries []RedelegationEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries"`
}

Redelegation contains the list of a particular delegator's redelegating bonds from a particular source validator to a particular destination validator.

type RedelegationEntry

type RedelegationEntry struct {
	// creation_height  defines the height which the redelegation took place.
	CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"`
	// completion_time defines the unix time for redelegation completion.
	CompletionTime time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time"`
	// initial_balance defines the initial balance when redelegation started.
	InitialBalance Int `` /* 143-byte string literal not displayed */
	// shares_dst is the amount of destination-validator shares created by redelegation.
	SharesDst Dec `` /* 128-byte string literal not displayed */
}

RedelegationEntry defines a redelegation object with relevant metadata.

type RedelegationEntryResponse

type RedelegationEntryResponse struct {
	RedelegationEntry RedelegationEntry `protobuf:"bytes,1,opt,name=redelegation_entry,json=redelegationEntry,proto3" json:"redelegation_entry"`
	Balance           Int               `protobuf:"bytes,4,opt,name=balance,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"balance"`
}

RedelegationEntryResponse is equivalent to a RedelegationEntry except that it contains a balance in addition to shares which is more suitable for client responses.

type RedelegationResponse

type RedelegationResponse struct {
	Redelegation Redelegation                `protobuf:"bytes,1,opt,name=redelegation,proto3" json:"redelegation"`
	Entries      []RedelegationEntryResponse `protobuf:"bytes,2,rep,name=entries,proto3" json:"entries"`
}

RedelegationResponse is equivalent to a Redelegation except that its entries contain a balance in addition to shares which is more suitable for client responses.

type Tx

type Tx = coretypes.Tx

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

type TxConfig added in v0.5.0

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

TxConfig specifies additional options that will be applied to the Tx.

func NewTxConfig added in v0.5.0

func NewTxConfig(opts ...ConfigOption) *TxConfig

NewTxConfig constructs a new TxConfig with the provided options. It starts with a DefaultGasPrice and then applies any additional options provided through the variadic parameter.

func (*TxConfig) FeeGranterAddress added in v0.5.0

func (cfg *TxConfig) FeeGranterAddress() string

func (*TxConfig) GasLimit added in v0.5.0

func (cfg *TxConfig) GasLimit() uint64

func (*TxConfig) GasPrice added in v0.5.0

func (cfg *TxConfig) GasPrice() float64

func (*TxConfig) KeyName added in v0.5.0

func (cfg *TxConfig) KeyName() string

func (*TxConfig) MarshalJSON added in v0.5.0

func (cfg *TxConfig) MarshalJSON() ([]byte, error)

func (*TxConfig) SignerAddress added in v0.5.0

func (cfg *TxConfig) SignerAddress() string

func (*TxConfig) UnmarshalJSON added in v0.5.0

func (cfg *TxConfig) UnmarshalJSON(data []byte) error

type TxResponse

type TxResponse = sdk.TxResponse

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

type UnbondingDelegation

type UnbondingDelegation struct {
	// delegator_address is the bech32-encoded address of the delegator.
	DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"`
	// validator_address is the bech32-encoded address of the validator.
	ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"`
	// entries are the unbonding delegation entries.
	Entries []UnbondingDelegationEntry `protobuf:"bytes,3,rep,name=entries,proto3" json:"entries"`
}

UnbondingDelegation stores all of a single delegator's unbonding bonds for a single validator in an time-ordered list.

type UnbondingDelegationEntry

type UnbondingDelegationEntry struct {
	// creation_height is the height which the unbonding took place.
	CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"`
	// completion_time is the unix time for unbonding completion.
	CompletionTime time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time"`
	// initial_balance defines the tokens initially scheduled to receive at completion.
	InitialBalance Int `` /* 143-byte string literal not displayed */
	// balance defines the tokens to receive at completion.
	Balance Int `protobuf:"bytes,4,opt,name=balance,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"balance"`
}

UnbondingDelegationEntry defines an unbonding object with relevant metadata.

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