Documentation ¶
Index ¶
- Constants
- Variables
- type Execution
- func (ex *Execution) ByteStream() []byte
- func (ex *Execution) ConvertFromActionPb(pbAct *iproto.ActionPb)
- func (ex *Execution) ConvertToActionPb() *iproto.ActionPb
- func (ex *Execution) Deserialize(buf []byte) error
- func (ex *Execution) Hash() hash.Hash32B
- func (ex *Execution) Serialize() ([]byte, error)
- func (ex *Execution) Sign(executor *iotxaddress.Address) (*Execution, error)
- func (ex *Execution) ToJSON() (*explorer.Execution, error)
- func (ex *Execution) TotalSize() uint32
- func (ex *Execution) Verify(sender *iotxaddress.Address) error
- type Transfer
- func (tsf *Transfer) ByteStream() []byte
- func (tsf *Transfer) ConvertFromActionPb(pbAct *iproto.ActionPb)
- func (tsf *Transfer) ConvertToActionPb() *iproto.ActionPb
- func (tsf *Transfer) Deserialize(buf []byte) error
- func (tsf *Transfer) Hash() hash.Hash32B
- func (tsf *Transfer) IsContract() bool
- func (tsf *Transfer) Serialize() ([]byte, error)
- func (tsf *Transfer) Sign(sender *iotxaddress.Address) (*Transfer, error)
- func (tsf *Transfer) ToJSON() *explorer.Transfer
- func (tsf *Transfer) TotalSize() uint32
- func (tsf *Transfer) Verify(sender *iotxaddress.Address) error
- type Vote
- func (v *Vote) ByteStream() []byte
- func (v *Vote) ConvertFromActionPb(pbAct *iproto.ActionPb)
- func (v *Vote) ConvertToActionPb() *iproto.ActionPb
- func (v *Vote) Deserialize(buf []byte) error
- func (v *Vote) Hash() hash.Hash32B
- func (v *Vote) SelfPublicKey() (keypair.PublicKey, error)
- func (v *Vote) Serialize() ([]byte, error)
- func (v *Vote) Sign(sender *iotxaddress.Address) (*Vote, error)
- func (v *Vote) ToJSON() (*explorer.Vote, error)
- func (v *Vote) TotalSize() uint32
- func (v *Vote) Verify(sender *iotxaddress.Address) error
Constants ¶
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 )
const EmptyAddress = ""
EmptyAddress is the empty string
Variables ¶
var ( // ErrTransferError indicates error for a transfer action ErrTransferError = errors.New("transfer error") // ErrAddr indicates error of address ErrAddr = errors.New("address error") )
var ( // ErrExecutionError indicates error for an execution action ErrExecutionError = errors.New("execution error") )
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
NewExecutionFromJSON creates a new Execution from ExecutionJSON
func (*Execution) ByteStream ¶ added in v0.3.0
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
Deserialize parse the byte stream into Execution
func (*Execution) Serialize ¶ added in v0.3.0
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
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 ¶
NewCoinBaseTransfer returns a coinbase Transfer
func NewTransfer ¶
NewTransfer returns a Transfer instance
func NewTransferFromJSON ¶ added in v0.3.0
NewTransferFromJSON creates a new Transfer from TransferJSON
func (*Transfer) ByteStream ¶
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 ¶
Deserialize parse the byte stream into Transfer
func (*Transfer) IsContract ¶ added in v0.3.0
IsContract returns true for contract action
func (*Transfer) Sign ¶
func (tsf *Transfer) Sign(sender *iotxaddress.Address) (*Transfer, error)
Sign signs the Transfer using sender's private key
type Vote ¶
type Vote struct {
*iproto.ActionPb
}
Vote defines the struct of account-based vote
func NewVoteFromJSON ¶ added in v0.3.0
NewVoteFromJSON creates a new Vote from VoteJSON
func (*Vote) ByteStream ¶
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 ¶
Deserialize parse the byte stream into Vote
func (*Vote) SelfPublicKey ¶ added in v0.3.0
SelfPublicKey returns the self public key of the vote
func (*Vote) Sign ¶
func (v *Vote) Sign(sender *iotxaddress.Address) (*Vote, error)
Sign signs the Vote using sender's private key