payload

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	TypeTransfer  = Type(1)
	TypeBond      = Type(2)
	TypeSortition = Type(3)
	TypeUnbond    = Type(4)
	TypeWithdraw  = Type(5)
)

Variables

View Source
var ErrInvalidPublicKeySize = errors.New("invalid public key size")

ErrInvalidPublicKeySize is returned when the public key size is not valid.

Functions

This section is empty.

Types

type BasicCheckError added in v0.15.0

type BasicCheckError struct {
	Reason string
}

BasicCheckError describes is returned when the basic check on the transaction's payload fails.

func (BasicCheckError) Error added in v0.15.0

func (e BasicCheckError) Error() string

type BondPayload

type BondPayload struct {
	From      crypto.Address
	To        crypto.Address
	PublicKey *bls.PublicKey
	Stake     amount.Amount
}

func (*BondPayload) BasicCheck added in v0.15.0

func (p *BondPayload) BasicCheck() error

func (*BondPayload) Decode

func (p *BondPayload) Decode(r io.Reader) error

func (*BondPayload) Encode

func (p *BondPayload) Encode(w io.Writer) error

func (*BondPayload) Receiver

func (p *BondPayload) Receiver() *crypto.Address

func (*BondPayload) SerializeSize

func (p *BondPayload) SerializeSize() int

func (*BondPayload) Signer

func (p *BondPayload) Signer() crypto.Address

func (*BondPayload) String added in v0.15.0

func (p *BondPayload) String() string

func (*BondPayload) Type

func (*BondPayload) Type() Type

func (*BondPayload) Value

func (p *BondPayload) Value() amount.Amount

type Payload

type Payload interface {
	Signer() crypto.Address
	Value() amount.Amount
	Type() Type
	SerializeSize() int
	Encode(io.Writer) error
	Decode(io.Reader) error
	BasicCheck() error
	String() string
	Receiver() *crypto.Address
}

type SortitionPayload

type SortitionPayload struct {
	Validator crypto.Address
	Proof     sortition.Proof
}

func (*SortitionPayload) BasicCheck added in v0.15.0

func (p *SortitionPayload) BasicCheck() error

func (*SortitionPayload) Decode

func (p *SortitionPayload) Decode(r io.Reader) error

func (*SortitionPayload) Encode

func (p *SortitionPayload) Encode(w io.Writer) error

func (*SortitionPayload) Receiver added in v0.15.0

func (*SortitionPayload) Receiver() *crypto.Address

func (*SortitionPayload) SerializeSize

func (*SortitionPayload) SerializeSize() int

func (*SortitionPayload) Signer

func (p *SortitionPayload) Signer() crypto.Address

func (*SortitionPayload) String added in v0.15.0

func (p *SortitionPayload) String() string

func (*SortitionPayload) Type

func (*SortitionPayload) Type() Type

func (*SortitionPayload) Value

func (*SortitionPayload) Value() amount.Amount

type TransferPayload added in v0.11.0

type TransferPayload struct {
	From   crypto.Address
	To     crypto.Address
	Amount amount.Amount
}

func (*TransferPayload) BasicCheck added in v0.15.0

func (p *TransferPayload) BasicCheck() error

func (*TransferPayload) Decode added in v0.11.0

func (p *TransferPayload) Decode(r io.Reader) error

func (*TransferPayload) Encode added in v0.11.0

func (p *TransferPayload) Encode(w io.Writer) error

func (*TransferPayload) Receiver added in v0.11.0

func (p *TransferPayload) Receiver() *crypto.Address

func (*TransferPayload) SerializeSize added in v0.11.0

func (p *TransferPayload) SerializeSize() int

func (*TransferPayload) Signer added in v0.11.0

func (p *TransferPayload) Signer() crypto.Address

func (*TransferPayload) String added in v0.15.0

func (p *TransferPayload) String() string

func (*TransferPayload) Type added in v0.11.0

func (*TransferPayload) Type() Type

func (*TransferPayload) Value added in v0.11.0

func (p *TransferPayload) Value() amount.Amount

type Type

type Type uint8

func (Type) String

func (t Type) String() string

type UnbondPayload

type UnbondPayload struct {
	Validator crypto.Address
}

func (*UnbondPayload) BasicCheck added in v0.15.0

func (p *UnbondPayload) BasicCheck() error

func (*UnbondPayload) Decode

func (p *UnbondPayload) Decode(r io.Reader) error

func (*UnbondPayload) Encode

func (p *UnbondPayload) Encode(w io.Writer) error

func (*UnbondPayload) Receiver added in v0.15.0

func (*UnbondPayload) Receiver() *crypto.Address

func (*UnbondPayload) SerializeSize

func (*UnbondPayload) SerializeSize() int

func (*UnbondPayload) Signer

func (p *UnbondPayload) Signer() crypto.Address

func (*UnbondPayload) String added in v0.15.0

func (p *UnbondPayload) String() string

func (*UnbondPayload) Type

func (*UnbondPayload) Type() Type

func (*UnbondPayload) Value

func (*UnbondPayload) Value() amount.Amount

type WithdrawPayload

type WithdrawPayload struct {
	From   crypto.Address // withdraw from validator address
	To     crypto.Address // deposit to account address
	Amount amount.Amount  // amount to deposit
}

func (*WithdrawPayload) BasicCheck added in v0.15.0

func (p *WithdrawPayload) BasicCheck() error

BasicCheck performs basic checks on the Withdraw payload. TODO: write test for me.

func (*WithdrawPayload) Decode

func (p *WithdrawPayload) Decode(r io.Reader) error

func (*WithdrawPayload) Encode

func (p *WithdrawPayload) Encode(w io.Writer) error

func (*WithdrawPayload) Receiver added in v0.15.0

func (p *WithdrawPayload) Receiver() *crypto.Address

func (*WithdrawPayload) SerializeSize

func (p *WithdrawPayload) SerializeSize() int

func (*WithdrawPayload) Signer

func (p *WithdrawPayload) Signer() crypto.Address

func (*WithdrawPayload) String added in v0.15.0

func (p *WithdrawPayload) String() string

func (*WithdrawPayload) Type

func (*WithdrawPayload) Type() Type

func (*WithdrawPayload) Value

func (p *WithdrawPayload) Value() amount.Amount

Jump to

Keyboard shortcuts

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