action

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VersionSizeInBytes defines the size of version in byte units
	VersionSizeInBytes = 4
	// NonceSizeInBytes defines the size of nonce in byte units
	NonceSizeInBytes = 8
	// TimestampSizeInBytes defines the size of 8-byte timestamp
	TimestampSizeInBytes = 8
	// BooleanSizeInBytes defines the size of booleans
	BooleanSizeInBytes = 1
	// GasSizeInBytes defines the size of gas in byte uints
	GasSizeInBytes = 8
	// GasPriceSizeInBytes defines the size of gas price in byte uints
	GasPriceSizeInBytes = 8
)
View Source
const EmptyAddress = ""

EmptyAddress is the empty string

Variables

View Source
var (
	// ErrTransferError indicates error for a transfer action
	ErrTransferError = errors.New("transfer error")
	// ErrAddr indicates error of address
	ErrAddr = errors.New("address error")
)
View Source
var (
	// ErrExecutionError indicates error for an execution action
	ErrExecutionError = errors.New("execution error")
)
View Source
var (
	// ErrVoteError indicates error for a vote action
	ErrVoteError = errors.New("vote error")
)

Functions

This section is empty.

Types

type Execution added in v0.3.0

type Execution struct {
	Version        uint32
	Nonce          uint64
	Amount         *big.Int
	Executor       string
	Contract       string
	ExecutorPubKey keypair.PublicKey
	Gas            uint64
	GasPrice       uint64
	Signature      []byte
	Data           []byte
}

Execution defines the struct of account-based contract execution

func NewExecution added in v0.3.0

func NewExecution(executorAddress string, contractAddress string, nonce uint64, amount *big.Int, gas uint64, gasPrice uint64, data []byte) (*Execution, error)

NewExecution returns a Execution instance

func NewExecutionFromJSON added in v0.3.0

func NewExecutionFromJSON(jsonExecution *explorer.Execution) (*Execution, error)

NewExecutionFromJSON creates a new Execution from ExecutionJSON

func (*Execution) ByteStream added in v0.3.0

func (ex *Execution) ByteStream() []byte

ByteStream returns a raw byte stream of this Transfer

func (*Execution) ConvertFromActionPb added in v0.3.0

func (ex *Execution) ConvertFromActionPb(pbAct *iproto.ActionPb)

ConvertFromActionPb converts a protobuf's ActionPb to Execution

func (*Execution) ConvertToActionPb added in v0.3.0

func (ex *Execution) ConvertToActionPb() *iproto.ActionPb

ConvertToActionPb converts Execution to protobuf's ActionPb

func (*Execution) Deserialize added in v0.3.0

func (ex *Execution) Deserialize(buf []byte) error

Deserialize parse the byte stream into Execution

func (*Execution) Hash added in v0.3.0

func (ex *Execution) Hash() hash.Hash32B

Hash returns the hash of the Execution

func (*Execution) Serialize added in v0.3.0

func (ex *Execution) Serialize() ([]byte, error)

Serialize returns a serialized byte stream for the Execution

func (*Execution) Sign added in v0.3.0

func (ex *Execution) Sign(executor *iotxaddress.Address) (*Execution, error)

Sign signs the Execution using executer's private key

func (*Execution) ToJSON added in v0.3.0

func (ex *Execution) ToJSON() (*explorer.Execution, error)

ToJSON converts Execution to ExecutionJSON

func (*Execution) TotalSize added in v0.3.0

func (ex *Execution) TotalSize() uint32

TotalSize returns the total size of this Execution

func (*Execution) Verify added in v0.3.0

func (ex *Execution) Verify(sender *iotxaddress.Address) error

Verify verifies the Execution using sender's public key

type Transfer

type Transfer struct {
	Version uint32

	Nonce           uint64
	Amount          *big.Int
	Sender          string
	Recipient       string
	Payload         []byte
	SenderPublicKey keypair.PublicKey
	Signature       []byte
	IsCoinbase      bool
}

Transfer defines the struct of account-based transfer

func NewCoinBaseTransfer

func NewCoinBaseTransfer(amount *big.Int, recipient string) *Transfer

NewCoinBaseTransfer returns a coinbase Transfer

func NewTransfer

func NewTransfer(nonce uint64, amount *big.Int, sender string, recipient string) (*Transfer, error)

NewTransfer returns a Transfer instance

func NewTransferFromJSON added in v0.3.0

func NewTransferFromJSON(jsonTsf *explorer.Transfer) (*Transfer, error)

NewTransferFromJSON creates a new Transfer from TransferJSON

func (*Transfer) ByteStream

func (tsf *Transfer) ByteStream() []byte

ByteStream returns a raw byte stream of this Transfer

func (*Transfer) ConvertFromActionPb added in v0.3.0

func (tsf *Transfer) ConvertFromActionPb(pbAct *iproto.ActionPb)

ConvertFromActionPb converts a protobuf's ActionPb to Transfer

func (*Transfer) ConvertToActionPb added in v0.3.0

func (tsf *Transfer) ConvertToActionPb() *iproto.ActionPb

ConvertToActionPb converts Transfer to protobuf's ActionPb

func (*Transfer) Deserialize

func (tsf *Transfer) Deserialize(buf []byte) error

Deserialize parse the byte stream into Transfer

func (*Transfer) Hash

func (tsf *Transfer) Hash() hash.Hash32B

Hash returns the hash of the Transfer

func (*Transfer) IsContract added in v0.3.0

func (tsf *Transfer) IsContract() bool

IsContract returns true for contract action

func (*Transfer) Serialize

func (tsf *Transfer) Serialize() ([]byte, error)

Serialize returns a serialized byte stream for the Transfer

func (*Transfer) Sign

func (tsf *Transfer) Sign(sender *iotxaddress.Address) (*Transfer, error)

Sign signs the Transfer using sender's private key

func (*Transfer) ToJSON added in v0.3.0

func (tsf *Transfer) ToJSON() *explorer.Transfer

ToJSON converts Transfer to TransferJSON

func (*Transfer) TotalSize

func (tsf *Transfer) TotalSize() uint32

TotalSize returns the total size of this Transfer

func (*Transfer) Verify

func (tsf *Transfer) Verify(sender *iotxaddress.Address) error

Verify verifies the Transfer using sender's public key

type Vote

type Vote struct {
	*iproto.ActionPb
}

Vote defines the struct of account-based vote

func NewVote

func NewVote(nonce uint64, voterAddress string, voteeAddress string) (*Vote, error)

NewVote returns a Vote instance

func NewVoteFromJSON added in v0.3.0

func NewVoteFromJSON(jsonVote *explorer.Vote) (*Vote, error)

NewVoteFromJSON creates a new Vote from VoteJSON

func (*Vote) ByteStream

func (v *Vote) ByteStream() []byte

ByteStream returns a raw byte stream of this Transfer

func (*Vote) ConvertFromActionPb added in v0.3.0

func (v *Vote) ConvertFromActionPb(pbAct *iproto.ActionPb)

ConvertFromActionPb converts a protobuf's ActionPb to Vote

func (*Vote) ConvertToActionPb added in v0.3.0

func (v *Vote) ConvertToActionPb() *iproto.ActionPb

ConvertToActionPb converts Vote to protobuf's ActionPb

func (*Vote) Deserialize

func (v *Vote) Deserialize(buf []byte) error

Deserialize parse the byte stream into Vote

func (*Vote) Hash

func (v *Vote) Hash() hash.Hash32B

Hash returns the hash of the Vote

func (*Vote) SelfPublicKey added in v0.3.0

func (v *Vote) SelfPublicKey() (keypair.PublicKey, error)

SelfPublicKey returns the self public key of the vote

func (*Vote) Serialize

func (v *Vote) Serialize() ([]byte, error)

Serialize returns a serialized byte stream for the Transfer

func (*Vote) Sign

func (v *Vote) Sign(sender *iotxaddress.Address) (*Vote, error)

Sign signs the Vote using sender's private key

func (*Vote) ToJSON added in v0.3.0

func (v *Vote) ToJSON() (*explorer.Vote, error)

ToJSON converts Vote to VoteJSON

func (*Vote) TotalSize

func (v *Vote) TotalSize() uint32

TotalSize returns the total size of this Vote

func (*Vote) Verify

func (v *Vote) Verify(sender *iotxaddress.Address) error

Verify verifies the Vote using sender's public key

Jump to

Keyboard shortcuts

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