payload

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeUnknown = Type(0x00)
	// Account transactions
	TypeSend = Type(0x01)
	TypeCall = Type(0x02)
	TypeName = Type(0x03)

	// Validation transactions
	TypeBond   = Type(0x11)
	TypeUnbond = Type(0x12)

	// Admin transactions
	TypePermissions = Type(0x21)
	TypeGovernance  = Type(0x22)
)

Types of Payload implementations

Variables

View Source
var (
	ErrTxInvalidAddress    = errors.New("error invalid address")
	ErrTxDuplicateAddress  = errors.New("error duplicate address")
	ErrTxInvalidAmount     = errors.New("error invalid amount")
	ErrTxInsufficientFunds = errors.New("error insufficient funds")
	ErrTxUnknownPubKey     = errors.New("error unknown pubkey")
	ErrTxInvalidPubKey     = errors.New("error invalid pubkey")
	ErrTxInvalidSignature  = errors.New("error invalid signature")
)

Functions

This section is empty.

Types

type BondTx

type BondTx struct {
	// At least one should have bond permission (even if 0 amount transfer)
	Inputs   []*TxInput
	UnbondTo []*TxOutput
}

func NewBondTx

func NewBondTx(pubkey crypto.PublicKey) (*BondTx, error)

func (*BondTx) AddInput

func (tx *BondTx) AddInput(st state.AccountGetter, pubkey crypto.PublicKey, amt uint64) error

func (*BondTx) AddInputWithSequence

func (tx *BondTx) AddInputWithSequence(pubkey crypto.PublicKey, amt uint64, sequence uint64) error

func (*BondTx) AddOutput

func (tx *BondTx) AddOutput(addr crypto.Address, amt uint64) error

func (*BondTx) GetInputs

func (tx *BondTx) GetInputs() []*TxInput

func (*BondTx) String

func (tx *BondTx) String() string

func (*BondTx) Type

func (tx *BondTx) Type() Type

type CallTx

type CallTx struct {
	Input *TxInput
	// Pointer since CallTx defines unset 'to' address as inducing account creation
	Address  *crypto.Address
	GasLimit uint64
	Fee      uint64
	// Signing normalisation needs omitempty
	Data binary.HexBytes `json:",omitempty"`
}

func NewCallTx

func NewCallTx(st state.AccountGetter, from crypto.PublicKey, to *crypto.Address, data []byte,
	amt, gasLimit, fee uint64) (*CallTx, error)

func NewCallTxWithSequence

func NewCallTxWithSequence(from crypto.PublicKey, to *crypto.Address, data []byte,
	amt, gasLimit, fee, sequence uint64) *CallTx

func (*CallTx) GetInputs

func (tx *CallTx) GetInputs() []*TxInput

func (*CallTx) String

func (tx *CallTx) String() string

func (*CallTx) Type

func (tx *CallTx) Type() Type

type ErrTxInvalidSequence

type ErrTxInvalidSequence struct {
	Got      uint64
	Expected uint64
}

func (ErrTxInvalidSequence) Error

func (e ErrTxInvalidSequence) Error() string

type ErrTxInvalidString

type ErrTxInvalidString struct {
	Msg string
}

func (ErrTxInvalidString) Error

func (e ErrTxInvalidString) Error() string

type GovernanceTx

type GovernanceTx struct {
	Input          *TxInput
	AccountUpdates []spec.TemplateAccount
}

func NewGovTx

func NewGovTx(st state.AccountGetter, from crypto.Address, accounts ...spec.TemplateAccount) (*GovernanceTx, error)

func NewGovTxWithSequence

func NewGovTxWithSequence(from crypto.Address, sequence uint64, accounts []spec.TemplateAccount) *GovernanceTx

func (*GovernanceTx) GetInputs

func (tx *GovernanceTx) GetInputs() []*TxInput

func (*GovernanceTx) String

func (tx *GovernanceTx) String() string

func (*GovernanceTx) Type

func (tx *GovernanceTx) Type() Type

type NameTx

type NameTx struct {
	Input *TxInput
	Name  string
	Data  string
	Fee   uint64
}

func NewNameTx

func NewNameTx(st state.AccountGetter, from crypto.PublicKey, name, data string, amt, fee uint64) (*NameTx, error)

func NewNameTxWithSequence

func NewNameTxWithSequence(from crypto.PublicKey, name, data string, amt, fee, sequence uint64) *NameTx

func (*NameTx) GetInputs

func (tx *NameTx) GetInputs() []*TxInput

func (*NameTx) String

func (tx *NameTx) String() string

func (*NameTx) Type

func (tx *NameTx) Type() Type

func (*NameTx) ValidateStrings

func (tx *NameTx) ValidateStrings() error

type Payload

type Payload interface {
	String() string
	GetInputs() []*TxInput
	Type() Type
}

func New

func New(txType Type) Payload

type PermissionsTx

type PermissionsTx struct {
	Input    *TxInput
	PermArgs snatives.PermArgs
}

func NewPermissionsTx

func NewPermissionsTx(st state.AccountGetter, from crypto.PublicKey, args snatives.PermArgs) (*PermissionsTx, error)

func NewPermissionsTxWithSequence

func NewPermissionsTxWithSequence(from crypto.PublicKey, args snatives.PermArgs, sequence uint64) *PermissionsTx

func (*PermissionsTx) GetInputs

func (tx *PermissionsTx) GetInputs() []*TxInput

func (*PermissionsTx) String

func (tx *PermissionsTx) String() string

func (*PermissionsTx) Type

func (tx *PermissionsTx) Type() Type

type SendTx

type SendTx struct {
	Inputs  []*TxInput
	Outputs []*TxOutput
}

func NewSendTx

func NewSendTx() *SendTx

func (*SendTx) AddInput

func (tx *SendTx) AddInput(st state.AccountGetter, pubkey crypto.PublicKey, amt uint64) error

func (*SendTx) AddInputWithSequence

func (tx *SendTx) AddInputWithSequence(pubkey crypto.PublicKey, amt uint64, sequence uint64) error

func (*SendTx) AddOutput

func (tx *SendTx) AddOutput(addr crypto.Address, amt uint64) error

func (*SendTx) GetInputs

func (tx *SendTx) GetInputs() []*TxInput

func (*SendTx) String

func (tx *SendTx) String() string

func (*SendTx) Type

func (tx *SendTx) Type() Type

type TxInput

type TxInput struct {
	Address  crypto.Address
	Amount   uint64
	Sequence uint64
}

func (*TxInput) String

func (txIn *TxInput) String() string

func (*TxInput) ValidateBasic

func (txIn *TxInput) ValidateBasic() error

type TxOutput

type TxOutput struct {
	Address crypto.Address
	Amount  uint64
}

func (*TxOutput) String

func (txOut *TxOutput) String() string

func (*TxOutput) ValidateBasic

func (txOut *TxOutput) ValidateBasic() error

type Type

type Type int8

func TxTypeFromString

func TxTypeFromString(name string) Type

func (Type) MarshalText

func (typ Type) MarshalText() ([]byte, error)

func (Type) String

func (typ Type) String() string

func (*Type) UnmarshalText

func (typ *Type) UnmarshalText(data []byte) error

type UnbondTx

type UnbondTx struct {
	Input   *TxInput
	Address crypto.Address
	Height  int
}

func NewUnbondTx

func NewUnbondTx(addr crypto.Address, height int) *UnbondTx

func (*UnbondTx) GetInputs

func (tx *UnbondTx) GetInputs() []*TxInput

func (*UnbondTx) String

func (tx *UnbondTx) String() string

func (*UnbondTx) Type

func (tx *UnbondTx) Type() Type

Jump to

Keyboard shortcuts

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