action

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// 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
)

Variables

View Source
var ErrTransferError = errors.New("transfer error")

ErrTransferError indicates error for a transfer action

View Source
var ErrVoteError = errors.New("vote error")

ErrVoteError indicates error for a vote action

Functions

This section is empty.

Types

type Transfer

type Transfer struct {
	Version uint32

	Nonce           uint64
	Amount          *big.Int
	Sender          string
	Recipient       string
	Payload         []byte
	SenderPublicKey []byte
	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

NewTransfer returns a Transfer instance

func (*Transfer) ByteStream

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

ByteStream returns a raw byte stream of this Transfer

func (*Transfer) ConvertFromTransferPb

func (tsf *Transfer) ConvertFromTransferPb(pbTx *iproto.TransferPb)

ConvertFromTransferPb converts a protobuf's TransferPb to Transfer

func (*Transfer) ConvertToTransferPb

func (tsf *Transfer) ConvertToTransferPb() *iproto.TransferPb

ConvertToTransferPb converts Transfer to protobuf's TransferPb

func (*Transfer) Deserialize

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

Deserialize parse the byte stream into Transfer

func (*Transfer) Hash

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

Hash returns the hash of the Transfer

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) 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.VotePb
}

Vote defines the struct of account-based vote

func NewVote

func NewVote(nonce uint64, selfPubKey []byte, votePubKey []byte) *Vote

NewVote returns a Vote instance

func (*Vote) ByteStream

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

ByteStream returns a raw byte stream of this Transfer

func (*Vote) ConvertFromVotePb

func (v *Vote) ConvertFromVotePb(pbVote *iproto.VotePb)

ConvertFromVotePb converts Vote to protobuf's VotePb

func (*Vote) ConvertToVotePb

func (v *Vote) ConvertToVotePb() *iproto.VotePb

ConvertToVotePb converts Vote to protobuf's VotePb

func (*Vote) Deserialize

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

Deserialize parse the byte stream into Vote

func (*Vote) Hash

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

Hash returns the hash 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) 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