Documentation ¶
Index ¶
- Constants
- Variables
- func ClassifyActions(actions []SealedEnvelope) ([]*Transfer, []*Execution)
- func DecodeRawTx(rawData string, chainID uint32) (tx *types.Transaction, sig []byte, pubkey crypto.PublicKey, err error)
- func LoadErrorDescription(err error) string
- func MsgHash(sigType string, msg []byte) ([]byte, error)
- func NewConsignJSON(sigType, recipient, sig string, bucketIdx, nonce uint64) ([]byte, error)
- func NewConsignMsg(sigType, recipient string, bucketIdx, nonce uint64) ([]byte, error)
- func RecoverPubkeyFromEccSig(sigType string, msg, sig []byte) (crypto.PublicKey, error)
- func Verify(sealed SealedEnvelope) error
- type AbstractAction
- func (act *AbstractAction) BasicActionSize() uint32
- func (act *AbstractAction) GasLimit() uint64
- func (act *AbstractAction) GasPrice() *big.Int
- func (act *AbstractAction) Nonce() uint64
- func (act *AbstractAction) SanityCheck() error
- func (act *AbstractAction) SetEnvelopeContext(selp SealedEnvelope)
- func (act *AbstractAction) Version() uint32
- type Action
- type Builder
- func (b *Builder) Build() AbstractAction
- func (b *Builder) SetGasLimit(l uint64) *Builder
- func (b *Builder) SetGasPrice(p *big.Int) *Builder
- func (b *Builder) SetGasPriceByBytes(buf []byte) *Builder
- func (b *Builder) SetNonce(n uint64) *Builder
- func (b *Builder) SetSourcePublicKey(key crypto.PublicKey) *Builder
- func (b *Builder) SetVersion(v uint32) *Builder
- type CandidateRegister
- func (cr *CandidateRegister) Amount() *big.Int
- func (cr *CandidateRegister) AutoStake() bool
- func (cr *CandidateRegister) Cost() (*big.Int, error)
- func (cr *CandidateRegister) Duration() uint32
- func (cr *CandidateRegister) IntrinsicGas() (uint64, error)
- func (cr *CandidateRegister) LoadProto(pbAct *iotextypes.CandidateRegister) error
- func (cr *CandidateRegister) Name() string
- func (cr *CandidateRegister) OperatorAddress() address.Address
- func (cr *CandidateRegister) OwnerAddress() address.Address
- func (cr *CandidateRegister) Payload() []byte
- func (cr *CandidateRegister) Proto() *iotextypes.CandidateRegister
- func (cr *CandidateRegister) RewardAddress() address.Address
- func (cr *CandidateRegister) SanityCheck() error
- func (cr *CandidateRegister) Serialize() []byte
- type CandidateUpdate
- func (cu *CandidateUpdate) Cost() (*big.Int, error)
- func (cu *CandidateUpdate) IntrinsicGas() (uint64, error)
- func (cu *CandidateUpdate) LoadProto(pbAct *iotextypes.CandidateBasicInfo) error
- func (cu *CandidateUpdate) Name() string
- func (cu *CandidateUpdate) OperatorAddress() address.Address
- func (cu *CandidateUpdate) Proto() *iotextypes.CandidateBasicInfo
- func (cu *CandidateUpdate) RewardAddress() address.Address
- func (cu *CandidateUpdate) Serialize() []byte
- type ChangeCandidate
- func (cc *ChangeCandidate) BucketIndex() uint64
- func (cc *ChangeCandidate) Candidate() string
- func (cc *ChangeCandidate) Cost() (*big.Int, error)
- func (cc *ChangeCandidate) IntrinsicGas() (uint64, error)
- func (cc *ChangeCandidate) LoadProto(pbAct *iotextypes.StakeChangeCandidate) error
- func (cc *ChangeCandidate) Payload() []byte
- func (cc *ChangeCandidate) Proto() *iotextypes.StakeChangeCandidate
- func (cc *ChangeCandidate) Serialize() []byte
- type ClaimFromRewardingFund
- func (c *ClaimFromRewardingFund) Amount() *big.Int
- func (c *ClaimFromRewardingFund) Cost() (*big.Int, error)
- func (c *ClaimFromRewardingFund) Data() []byte
- func (c *ClaimFromRewardingFund) IntrinsicGas() (uint64, error)
- func (c *ClaimFromRewardingFund) LoadProto(claim *iotextypes.ClaimFromRewardingFund) error
- func (c *ClaimFromRewardingFund) Proto() *iotextypes.ClaimFromRewardingFund
- func (c *ClaimFromRewardingFund) SanityCheck() error
- func (c *ClaimFromRewardingFund) Serialize() []byte
- type ClaimFromRewardingFundBuilder
- type ConsignJSON
- type ConsignMsgEther
- type Consignment
- type CreateStake
- func (cs *CreateStake) Amount() *big.Int
- func (cs *CreateStake) AutoStake() bool
- func (cs *CreateStake) Candidate() string
- func (cs *CreateStake) Cost() (*big.Int, error)
- func (cs *CreateStake) Duration() uint32
- func (cs *CreateStake) IntrinsicGas() (uint64, error)
- func (cs *CreateStake) LoadProto(pbAct *iotextypes.StakeCreate) error
- func (cs *CreateStake) Payload() []byte
- func (cs *CreateStake) Proto() *iotextypes.StakeCreate
- func (cs *CreateStake) SanityCheck() error
- func (cs *CreateStake) Serialize() []byte
- type DepositToRewardingFund
- func (d *DepositToRewardingFund) Amount() *big.Int
- func (d *DepositToRewardingFund) Cost() (*big.Int, error)
- func (d *DepositToRewardingFund) Data() []byte
- func (d *DepositToRewardingFund) IntrinsicGas() (uint64, error)
- func (d *DepositToRewardingFund) LoadProto(deposit *iotextypes.DepositToRewardingFund) error
- func (d *DepositToRewardingFund) Proto() *iotextypes.DepositToRewardingFund
- func (d *DepositToRewardingFund) SanityCheck() error
- func (d *DepositToRewardingFund) Serialize() []byte
- type DepositToRewardingFundBuilder
- type DepositToStake
- func (ds *DepositToStake) Amount() *big.Int
- func (ds *DepositToStake) BucketIndex() uint64
- func (ds *DepositToStake) Cost() (*big.Int, error)
- func (ds *DepositToStake) IntrinsicGas() (uint64, error)
- func (ds *DepositToStake) LoadProto(pbAct *iotextypes.StakeAddDeposit) error
- func (ds *DepositToStake) Payload() []byte
- func (ds *DepositToStake) Proto() *iotextypes.StakeAddDeposit
- func (ds *DepositToStake) SanityCheck() error
- func (ds *DepositToStake) Serialize() []byte
- type Envelope
- type EnvelopeBuilder
- func (b *EnvelopeBuilder) Build() Envelope
- func (b *EnvelopeBuilder) SetAction(action actionPayload) *EnvelopeBuilder
- func (b *EnvelopeBuilder) SetGasLimit(l uint64) *EnvelopeBuilder
- func (b *EnvelopeBuilder) SetGasPrice(p *big.Int) *EnvelopeBuilder
- func (b *EnvelopeBuilder) SetGasPriceByBytes(buf []byte) *EnvelopeBuilder
- func (b *EnvelopeBuilder) SetNonce(n uint64) *EnvelopeBuilder
- func (b *EnvelopeBuilder) SetVersion(v uint32) *EnvelopeBuilder
- type Execution
- func (ex *Execution) Amount() *big.Int
- func (ex *Execution) Contract() string
- func (ex *Execution) Cost() (*big.Int, error)
- func (ex *Execution) Data() []byte
- func (ex *Execution) Destination() string
- func (ex *Execution) IntrinsicGas() (uint64, error)
- func (ex *Execution) LoadProto(pbAct *iotextypes.Execution) error
- func (ex *Execution) Payload() []byte
- func (ex *Execution) Proto() *iotextypes.Execution
- func (ex *Execution) Recipient() string
- func (ex *Execution) SanityCheck() error
- func (ex *Execution) Serialize() []byte
- func (ex *Execution) TotalSize() uint32
- type GrantReward
- func (*GrantReward) Cost() (*big.Int, error)
- func (g *GrantReward) Height() uint64
- func (*GrantReward) IntrinsicGas() (uint64, error)
- func (g *GrantReward) LoadProto(gProto *iotextypes.GrantReward) error
- func (g *GrantReward) Proto() *iotextypes.GrantReward
- func (g *GrantReward) RewardType() int
- func (g *GrantReward) Serialize() []byte
- type GrantRewardBuilder
- type Log
- type PutPollResult
- func (r *PutPollResult) Candidates() state.CandidateList
- func (r *PutPollResult) Cost() (*big.Int, error)
- func (r *PutPollResult) Height() uint64
- func (r *PutPollResult) IntrinsicGas() (uint64, error)
- func (r *PutPollResult) LoadProto(putPollResultPb *iotextypes.PutPollResult) error
- func (r *PutPollResult) Proto() *iotextypes.PutPollResult
- func (r *PutPollResult) Serialize() []byte
- type Receipt
- func (receipt *Receipt) AddLogs(logs ...*Log) *Receipt
- func (receipt *Receipt) AddTransactionLogs(logs ...*TransactionLog) *Receipt
- func (receipt *Receipt) ConvertFromReceiptPb(pbReceipt *iotextypes.Receipt)
- func (receipt *Receipt) ConvertToReceiptPb() *iotextypes.Receipt
- func (receipt *Receipt) Deserialize(buf []byte) error
- func (receipt *Receipt) ExecutionRevertMsg() string
- func (receipt *Receipt) Hash() hash.Hash256
- func (receipt *Receipt) Logs() []*Log
- func (receipt *Receipt) Serialize() ([]byte, error)
- func (receipt *Receipt) SetExecutionRevertMsg(revertReason string) *Receipt
- func (receipt *Receipt) TransactionLogs() []*TransactionLog
- type Restake
- func (rs *Restake) AutoStake() bool
- func (rs *Restake) BucketIndex() uint64
- func (rs *Restake) Cost() (*big.Int, error)
- func (rs *Restake) Duration() uint32
- func (rs *Restake) IntrinsicGas() (uint64, error)
- func (rs *Restake) LoadProto(pbAct *iotextypes.StakeRestake) error
- func (rs *Restake) Payload() []byte
- func (rs *Restake) Proto() *iotextypes.StakeRestake
- func (rs *Restake) Serialize() []byte
- type SealedEnvelope
- func AssembleSealedEnvelope(act Envelope, pk crypto.PublicKey, sig []byte) SealedEnvelope
- func FakeSeal(act Envelope, pubk crypto.PublicKey) SealedEnvelope
- func Sign(act Envelope, sk crypto.PrivateKey) (SealedEnvelope, error)
- func SignedCandidateRegister(nonce uint64, ...) (SealedEnvelope, error)
- func SignedCandidateUpdate(nonce uint64, name, operatorAddrStr, rewardAddrStr string, gasLimit uint64, ...) (SealedEnvelope, error)
- func SignedChangeCandidate(nonce uint64, candName string, bucketIndex uint64, payload []byte, ...) (SealedEnvelope, error)
- func SignedCreateStake(nonce uint64, candidateName, amount string, duration uint32, autoStake bool, ...) (SealedEnvelope, error)
- func SignedDepositToStake(nonce uint64, index uint64, amount string, payload []byte, gasLimit uint64, ...) (SealedEnvelope, error)
- func SignedExecution(contractAddr string, executorPriKey crypto.PrivateKey, nonce uint64, ...) (SealedEnvelope, error)
- func SignedReclaimStake(withdraw bool, nonce uint64, bucketIndex uint64, payload []byte, ...) (SealedEnvelope, error)
- func SignedRestake(nonce uint64, index uint64, duration uint32, autoStake bool, payload []byte, ...) (SealedEnvelope, error)
- func SignedTransfer(recipientAddr string, senderPriKey crypto.PrivateKey, nonce uint64, ...) (SealedEnvelope, error)
- func SignedTransferStake(nonce uint64, voterAddress string, bucketIndex uint64, payload []byte, ...) (SealedEnvelope, error)
- func (sealed *SealedEnvelope) Encoding() uint32
- func (sealed *SealedEnvelope) Hash() hash.Hash256
- func (sealed *SealedEnvelope) LoadProto(pbAct *iotextypes.Action) error
- func (sealed *SealedEnvelope) Proto() *iotextypes.Action
- func (sealed *SealedEnvelope) Signature() []byte
- func (sealed *SealedEnvelope) SrcPubkey() crypto.PublicKey
- type SealedEnvelopeValidator
- type Topics
- type TransactionLog
- type Transfer
- func (tsf *Transfer) Amount() *big.Int
- func (tsf *Transfer) Cost() (*big.Int, error)
- func (tsf *Transfer) Destination() string
- func (tsf *Transfer) IntrinsicGas() (uint64, error)
- func (tsf *Transfer) LoadProto(pbAct *iotextypes.Transfer) error
- func (tsf *Transfer) Payload() []byte
- func (tsf *Transfer) Proto() *iotextypes.Transfer
- func (tsf *Transfer) Recipient() string
- func (tsf *Transfer) SanityCheck() error
- func (tsf *Transfer) Serialize() []byte
- func (tsf *Transfer) TotalSize() uint32
- type TransferStake
- func (ts *TransferStake) BucketIndex() uint64
- func (ts *TransferStake) Cost() (*big.Int, error)
- func (ts *TransferStake) IntrinsicGas() (uint64, error)
- func (ts *TransferStake) LoadProto(pbAct *iotextypes.StakeTransferOwnership) error
- func (ts *TransferStake) Payload() []byte
- func (ts *TransferStake) Proto() *iotextypes.StakeTransferOwnership
- func (ts *TransferStake) Serialize() []byte
- func (ts *TransferStake) VoterAddress() address.Address
- type Unstake
- func (sr *Unstake) BucketIndex() uint64
- func (su *Unstake) Cost() (*big.Int, error)
- func (su *Unstake) IntrinsicGas() (uint64, error)
- func (sr *Unstake) LoadProto(pbAct *iotextypes.StakeReclaim) error
- func (sr *Unstake) Payload() []byte
- func (sr *Unstake) Proto() *iotextypes.StakeReclaim
- func (sr *Unstake) Serialize() []byte
- type WithdrawStake
- func (sr *WithdrawStake) BucketIndex() uint64
- func (sw *WithdrawStake) Cost() (*big.Int, error)
- func (sw *WithdrawStake) IntrinsicGas() (uint64, error)
- func (sr *WithdrawStake) LoadProto(pbAct *iotextypes.StakeReclaim) error
- func (sr *WithdrawStake) Payload() []byte
- func (sr *WithdrawStake) Proto() *iotextypes.StakeReclaim
- func (sr *WithdrawStake) Serialize() []byte
Constants ¶
const ( // CandidateRegisterPayloadGas represents the CandidateRegister payload gas per uint CandidateRegisterPayloadGas = uint64(100) // CandidateRegisterBaseIntrinsicGas represents the base intrinsic gas for CandidateRegister CandidateRegisterBaseIntrinsicGas = uint64(10000) )
const ( // EmptyAddress is the empty string EmptyAddress = "" // ExecutionDataGas represents the execution data gas per uint ExecutionDataGas = uint64(100) // ExecutionBaseIntrinsicGas represents the base intrinsic gas for execution ExecutionBaseIntrinsicGas = uint64(10000) )
const ( // BlockReward indicates that the action is to grant block reward BlockReward = iota // EpochReward indicates that the action is to grant epoch reward EpochReward )
const ( // DepositToStakePayloadGas represents the DepositToStake payload gas per uint DepositToStakePayloadGas = uint64(100) // DepositToStakeBaseIntrinsicGas represents the base intrinsic gas for DepositToStake DepositToStakeBaseIntrinsicGas = uint64(10000) )
const ( // MoveStakePayloadGas represents the stake move payload gas per uint MoveStakePayloadGas = uint64(100) // MoveStakeBaseIntrinsicGas represents the base intrinsic gas for stake move MoveStakeBaseIntrinsicGas = uint64(10000) )
const ( // CreateStakePayloadGas represents the CreateStake payload gas per uint CreateStakePayloadGas = uint64(100) // CreateStakeBaseIntrinsicGas represents the base intrinsic gas for CreateStake CreateStakeBaseIntrinsicGas = uint64(10000) )
const ( // ReclaimStakePayloadGas represents the stake reclaim payload gas per uint ReclaimStakePayloadGas = uint64(100) // ReclaimStakeBaseIntrinsicGas represents the base intrinsic gas for stake reclaim ReclaimStakeBaseIntrinsicGas = uint64(10000) )
const ( // RestakePayloadGas represents the Restake payload gas per uint RestakePayloadGas = uint64(100) // RestakeBaseIntrinsicGas represents the base intrinsic gas for stake again RestakeBaseIntrinsicGas = uint64(10000) )
const ( // TransferPayloadGas represents the transfer payload gas per uint TransferPayloadGas = uint64(100) // TransferBaseIntrinsicGas represents the base intrinsic gas for transfer TransferBaseIntrinsicGas = uint64(10000) )
const CandidateUpdateBaseIntrinsicGas = uint64(10000)
CandidateUpdateBaseIntrinsicGas represents the base intrinsic gas for CandidateUpdate
Variables ¶
var ( // ClaimFromRewardingFundBaseGas represents the base intrinsic gas for claimFromRewardingFund ClaimFromRewardingFundBaseGas = uint64(10000) // ClaimFromRewardingFundGasPerByte represents the claimFromRewardingFund payload gas per uint ClaimFromRewardingFundGasPerByte = uint64(100) )
var ( // ErrAddress indicates error of address ErrAddress = errors.New("invalid address") // ErrVotee indicates the error of votee ErrVotee = errors.New("votee is not a candidate") // ErrNotFound indicates the nonexistence of action ErrNotFound = errors.New("action not found") // ErrChainID indicates the error of chainID ErrChainID = errors.New("invalid chainID") // ErrExistedInPool indicates the action already exists in the actpool ErrExistedInPool = errors.New("known transaction") // ErrReplaceUnderpriced is returned if a transaction is attempted to be replaced // with a different one without the required price bump. ErrReplaceUnderpriced = errors.New("replacement transaction underpriced") // ErrNonceTooLow indicates if the nonce of a transaction is lower than the // one present in the local chain. ErrNonceTooLow = errors.New("nonce too low") // ErrUnderpriced is returned if a transaction's gas price is below the minimum // configured for the transaction pool. ErrUnderpriced = errors.New("transaction underpriced") // ErrNegativeValue is a sanity error to ensure no one is able to specify a // transaction with a negative value. ErrNegativeValue = errors.New("negative value") // ErrIntrinsicGas is returned if the transaction is specified to use less gas // than required to start the invocation. ErrIntrinsicGas = errors.New("intrinsic gas too low") // ErrInsufficientFunds is returned if the total cost of executing a transaction // is higher than the balance of the user's account. ErrInsufficientFunds = errors.New("insufficient funds for gas * price + value") // ErrNonceTooHigh is returned if the nonce of a transaction is higher than the // next one expected based on the local chain. ErrNonceTooHigh = errors.New("nonce too high") // ErrInvalidSender is returned if the transaction contains an invalid signature. ErrInvalidSender = errors.New("invalid sender") // ErrTxPoolOverflow is returned if the transaction pool is full and can't accpet // another remote transaction. ErrTxPoolOverflow = errors.New("txpool is full") // ErrGasLimit is returned if a transaction's requested gas limit exceeds the // maximum allowance of the current block. ErrGasLimit = errors.New("exceeds block gas limit") // ErrOversizedData is returned if the input data of a transaction is greater // than some meaningful limit a user might use. This is not a consensus error // making the transaction invalid, rather a DOS protection. ErrOversizedData = errors.New("oversized data") )
var ( // DepositToRewardingFundBaseGas represents the base intrinsic gas for depositToRewardingFund DepositToRewardingFundBaseGas = uint64(10000) // DepositToRewardingFundGasPerByte represents the depositToRewardingFund payload gas per uint DepositToRewardingFundGasPerByte = uint64(100) )
var ( // StakingBucketPoolTopic is topic for staking bucket pool StakingBucketPoolTopic = hash.BytesToHash256(address.StakingProtocolAddrHash[:]) // RewardingPoolTopic is topic for rewarding pool RewardingPoolTopic = hash.BytesToHash256(address.RewardingProtocolAddrHash[:]) )
var ( // ErrInvalidAmount represents that amount is 0 or negative ErrInvalidAmount = errors.New("invalid amount") )
var (
ErrNotSupported = errors.New("signature type not supported")
)
Errors
var (
ValidSig, _ = hex.DecodeString("15e73ad521ec9e06600c59e49b127c9dee114ad64fb2fcbe5e0d9f4c8d2b766e73d708cca1dc050dd27b20f2ee607f30428bf035f45d4da8ec2fb04a90c2c30901")
)
vars
Functions ¶
func ClassifyActions ¶
func ClassifyActions(actions []SealedEnvelope) ([]*Transfer, []*Execution)
ClassifyActions classfies actions
func DecodeRawTx ¶ added in v1.6.3
func DecodeRawTx(rawData string, chainID uint32) (tx *types.Transaction, sig []byte, pubkey crypto.PublicKey, err error)
DecodeRawTx decodes raw data string into eth tx
func LoadErrorDescription ¶ added in v1.6.1
LoadErrorDescription loads corresponding description related to the error
func NewConsignJSON ¶ added in v1.1.0
NewConsignJSON creates a consignment JSON from inputs
func NewConsignMsg ¶ added in v1.1.0
NewConsignMsg creates a consignment message from inputs
func RecoverPubkeyFromEccSig ¶ added in v1.1.0
RecoverPubkeyFromEccSig recovers public key from ECC signature
func Verify ¶
func Verify(sealed SealedEnvelope) error
Verify verifies the action using sender's public key
Types ¶
type AbstractAction ¶
type AbstractAction struct {
// contains filtered or unexported fields
}
AbstractAction is an abstract implementation of Action interface
func (*AbstractAction) BasicActionSize ¶
func (act *AbstractAction) BasicActionSize() uint32
BasicActionSize returns the basic size of action
func (*AbstractAction) GasLimit ¶
func (act *AbstractAction) GasLimit() uint64
GasLimit returns the gas limit
func (*AbstractAction) GasPrice ¶
func (act *AbstractAction) GasPrice() *big.Int
GasPrice returns the gas price
func (*AbstractAction) SanityCheck ¶ added in v1.0.0
func (act *AbstractAction) SanityCheck() error
SanityCheck validates the variables in the action
func (*AbstractAction) SetEnvelopeContext ¶ added in v0.4.4
func (act *AbstractAction) SetEnvelopeContext(selp SealedEnvelope)
SetEnvelopeContext sets the SealedEnvelope context to action context.
func (*AbstractAction) Version ¶
func (act *AbstractAction) Version() uint32
Version returns the version
type Action ¶
type Action interface { SetEnvelopeContext(SealedEnvelope) SanityCheck() error }
Action is the action can be Executed in protocols. The method is added to avoid mistakenly used empty interface as action.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is used to build an action.
func (*Builder) SetGasLimit ¶
SetGasLimit sets action's gas limit.
func (*Builder) SetGasPrice ¶
SetGasPrice sets action's gas price.
func (*Builder) SetGasPriceByBytes ¶ added in v0.4.4
SetGasPriceByBytes sets action's gas price from a byte slice source.
func (*Builder) SetSourcePublicKey ¶
SetSourcePublicKey sets action's source's public key.
func (*Builder) SetVersion ¶
SetVersion sets action's version.
type CandidateRegister ¶ added in v0.11.0
type CandidateRegister struct { AbstractAction // contains filtered or unexported fields }
CandidateRegister is the action to register a candidate
func NewCandidateRegister ¶ added in v0.11.0
func NewCandidateRegister( nonce uint64, name, operatorAddrStr, rewardAddrStr, ownerAddrStr, amountStr string, duration uint32, autoStake bool, payload []byte, gasLimit uint64, gasPrice *big.Int, ) (*CandidateRegister, error)
NewCandidateRegister creates a CandidateRegister instance
func (*CandidateRegister) Amount ¶ added in v0.11.0
func (cr *CandidateRegister) Amount() *big.Int
Amount returns the amount
func (*CandidateRegister) AutoStake ¶ added in v0.11.0
func (cr *CandidateRegister) AutoStake() bool
AutoStake returns the if staking is auth stake
func (*CandidateRegister) Cost ¶ added in v0.11.0
func (cr *CandidateRegister) Cost() (*big.Int, error)
Cost returns the total cost of a CandidateRegister
func (*CandidateRegister) Duration ¶ added in v0.11.0
func (cr *CandidateRegister) Duration() uint32
Duration returns the self-stake duration
func (*CandidateRegister) IntrinsicGas ¶ added in v0.11.0
func (cr *CandidateRegister) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a CandidateRegister
func (*CandidateRegister) LoadProto ¶ added in v0.11.0
func (cr *CandidateRegister) LoadProto(pbAct *iotextypes.CandidateRegister) error
LoadProto converts a protobuf's Action to CandidateRegister
func (*CandidateRegister) Name ¶ added in v0.11.0
func (cr *CandidateRegister) Name() string
Name returns candidate name to register
func (*CandidateRegister) OperatorAddress ¶ added in v0.11.0
func (cr *CandidateRegister) OperatorAddress() address.Address
OperatorAddress returns candidate operatorAddress to register
func (*CandidateRegister) OwnerAddress ¶ added in v0.11.0
func (cr *CandidateRegister) OwnerAddress() address.Address
OwnerAddress returns candidate ownerAddress to register
func (*CandidateRegister) Payload ¶ added in v0.11.0
func (cr *CandidateRegister) Payload() []byte
Payload returns the payload bytes
func (*CandidateRegister) Proto ¶ added in v0.11.0
func (cr *CandidateRegister) Proto() *iotextypes.CandidateRegister
Proto converts to protobuf CandidateRegister Action
func (*CandidateRegister) RewardAddress ¶ added in v0.11.0
func (cr *CandidateRegister) RewardAddress() address.Address
RewardAddress returns candidate rewardAddress to register
func (*CandidateRegister) SanityCheck ¶ added in v1.0.0
func (cr *CandidateRegister) SanityCheck() error
SanityCheck validates the variables in the action
func (*CandidateRegister) Serialize ¶ added in v0.11.0
func (cr *CandidateRegister) Serialize() []byte
Serialize returns a raw byte stream of the CandidateRegister struct
type CandidateUpdate ¶ added in v0.11.0
type CandidateUpdate struct { AbstractAction // contains filtered or unexported fields }
CandidateUpdate is the action to update a candidate
func NewCandidateUpdate ¶ added in v0.11.0
func NewCandidateUpdate( nonce uint64, name, operatorAddrStr, rewardAddrStr string, gasLimit uint64, gasPrice *big.Int, ) (*CandidateUpdate, error)
NewCandidateUpdate creates a CandidateUpdate instance
func (*CandidateUpdate) Cost ¶ added in v0.11.0
func (cu *CandidateUpdate) Cost() (*big.Int, error)
Cost returns the total cost of a CandidateUpdate
func (*CandidateUpdate) IntrinsicGas ¶ added in v0.11.0
func (cu *CandidateUpdate) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a CandidateUpdate
func (*CandidateUpdate) LoadProto ¶ added in v0.11.0
func (cu *CandidateUpdate) LoadProto(pbAct *iotextypes.CandidateBasicInfo) error
LoadProto converts a protobuf's Action to CandidateUpdate
func (*CandidateUpdate) Name ¶ added in v0.11.0
func (cu *CandidateUpdate) Name() string
Name returns candidate name to update
func (*CandidateUpdate) OperatorAddress ¶ added in v0.11.0
func (cu *CandidateUpdate) OperatorAddress() address.Address
OperatorAddress returns candidate operatorAddress to update
func (*CandidateUpdate) Proto ¶ added in v0.11.0
func (cu *CandidateUpdate) Proto() *iotextypes.CandidateBasicInfo
Proto converts to protobuf CandidateUpdate Action
func (*CandidateUpdate) RewardAddress ¶ added in v0.11.0
func (cu *CandidateUpdate) RewardAddress() address.Address
RewardAddress returns candidate rewardAddress to update
func (*CandidateUpdate) Serialize ¶ added in v0.11.0
func (cu *CandidateUpdate) Serialize() []byte
Serialize returns a raw byte stream of the CandidateUpdate struct
type ChangeCandidate ¶ added in v0.11.0
type ChangeCandidate struct { AbstractAction // contains filtered or unexported fields }
ChangeCandidate defines the action of changing stake candidate ts the other
func NewChangeCandidate ¶ added in v0.11.0
func NewChangeCandidate( nonce uint64, candName string, bucketIndex uint64, payload []byte, gasLimit uint64, gasPrice *big.Int, ) (*ChangeCandidate, error)
NewChangeCandidate returns a ChangeCandidate instance
func (*ChangeCandidate) BucketIndex ¶ added in v0.11.0
func (cc *ChangeCandidate) BucketIndex() uint64
BucketIndex returns bucket index
func (*ChangeCandidate) Candidate ¶ added in v0.11.0
func (cc *ChangeCandidate) Candidate() string
Candidate returns the address of recipient
func (*ChangeCandidate) Cost ¶ added in v0.11.0
func (cc *ChangeCandidate) Cost() (*big.Int, error)
Cost returns the tstal cost of a ChangeCandidate
func (*ChangeCandidate) IntrinsicGas ¶ added in v0.11.0
func (cc *ChangeCandidate) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a ChangeCandidate
func (*ChangeCandidate) LoadProto ¶ added in v0.11.0
func (cc *ChangeCandidate) LoadProto(pbAct *iotextypes.StakeChangeCandidate) error
LoadProto loads change candidate from protobuf
func (*ChangeCandidate) Payload ¶ added in v0.11.0
func (cc *ChangeCandidate) Payload() []byte
Payload returns the payload bytes
func (*ChangeCandidate) Proto ¶ added in v0.11.0
func (cc *ChangeCandidate) Proto() *iotextypes.StakeChangeCandidate
Proto converts change candidate to protobuf
func (*ChangeCandidate) Serialize ¶ added in v0.11.0
func (cc *ChangeCandidate) Serialize() []byte
Serialize returns a raw byte stream of the stake move action struct
type ClaimFromRewardingFund ¶ added in v0.5.0
type ClaimFromRewardingFund struct { AbstractAction // contains filtered or unexported fields }
ClaimFromRewardingFund is the action to claim reward from the rewarding fund
func (*ClaimFromRewardingFund) Amount ¶ added in v0.5.0
func (c *ClaimFromRewardingFund) Amount() *big.Int
Amount returns the amount to claim
func (*ClaimFromRewardingFund) Cost ¶ added in v0.5.0
func (c *ClaimFromRewardingFund) Cost() (*big.Int, error)
Cost returns the total cost of a claim action
func (*ClaimFromRewardingFund) Data ¶ added in v0.5.0
func (c *ClaimFromRewardingFund) Data() []byte
Data returns the additional data
func (*ClaimFromRewardingFund) IntrinsicGas ¶ added in v0.5.0
func (c *ClaimFromRewardingFund) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a claim action
func (*ClaimFromRewardingFund) LoadProto ¶ added in v0.5.0
func (c *ClaimFromRewardingFund) LoadProto(claim *iotextypes.ClaimFromRewardingFund) error
LoadProto converts a claim action protobuf to a claim action struct
func (*ClaimFromRewardingFund) Proto ¶ added in v0.5.0
func (c *ClaimFromRewardingFund) Proto() *iotextypes.ClaimFromRewardingFund
Proto converts a claim action struct to a claim action protobuf
func (*ClaimFromRewardingFund) SanityCheck ¶ added in v1.0.0
func (c *ClaimFromRewardingFund) SanityCheck() error
SanityCheck validates the variables in the action
func (*ClaimFromRewardingFund) Serialize ¶ added in v0.7.1
func (c *ClaimFromRewardingFund) Serialize() []byte
Serialize returns a raw byte stream of a claim action
type ClaimFromRewardingFundBuilder ¶ added in v0.5.0
type ClaimFromRewardingFundBuilder struct { Builder // contains filtered or unexported fields }
ClaimFromRewardingFundBuilder is the struct to build ClaimFromRewardingFund
func (*ClaimFromRewardingFundBuilder) Build ¶ added in v0.5.0
func (b *ClaimFromRewardingFundBuilder) Build() ClaimFromRewardingFund
Build builds a new claim from rewarding fund action
func (*ClaimFromRewardingFundBuilder) SetAmount ¶ added in v0.5.0
func (b *ClaimFromRewardingFundBuilder) SetAmount(amount *big.Int) *ClaimFromRewardingFundBuilder
SetAmount sets the amount to claim
func (*ClaimFromRewardingFundBuilder) SetData ¶ added in v0.5.0
func (b *ClaimFromRewardingFundBuilder) SetData(data []byte) *ClaimFromRewardingFundBuilder
SetData sets the additional data
type ConsignJSON ¶ added in v1.1.0
type ConsignJSON struct { Type string `json:"type"` Msg string `json:"msg"` Sig string `json:"sig"` }
ConsignJSON is the JSON format of a consignment, it contains the type, message, and signature
type ConsignMsgEther ¶ added in v1.1.0
type ConsignMsgEther struct { BucketIdx int `json:"bucket"` Nonce int `json:"nonce"` Recipient string `json:"recipient"` Reclaim string `json:"reclaim"` }
ConsignMsgEther is the consignment message format of Ethereum
type Consignment ¶ added in v1.1.0
type Consignment interface { Transferor() address.Address Transferee() address.Address AssetID() uint64 TransfereeNonce() uint64 }
Consignment represents a consignment
func NewConsignment ¶ added in v1.1.0
func NewConsignment(data []byte) (Consignment, error)
NewConsignment creates a consignment from data
type CreateStake ¶ added in v0.11.0
type CreateStake struct { AbstractAction // contains filtered or unexported fields }
CreateStake defines the action of CreateStake creation
func NewCreateStake ¶ added in v0.11.0
func NewCreateStake( nonce uint64, candidateName, amount string, duration uint32, autoStake bool, payload []byte, gasLimit uint64, gasPrice *big.Int, ) (*CreateStake, error)
NewCreateStake returns a CreateStake instance
func (*CreateStake) Amount ¶ added in v0.11.0
func (cs *CreateStake) Amount() *big.Int
Amount returns the amount
func (*CreateStake) AutoStake ¶ added in v0.11.0
func (cs *CreateStake) AutoStake() bool
AutoStake returns the flag of AutoStake s
func (*CreateStake) Candidate ¶ added in v0.11.0
func (cs *CreateStake) Candidate() string
Candidate returns the candidate name
func (*CreateStake) Cost ¶ added in v0.11.0
func (cs *CreateStake) Cost() (*big.Int, error)
Cost returns the total cost of a CreateStake
func (*CreateStake) Duration ¶ added in v0.11.0
func (cs *CreateStake) Duration() uint32
Duration returns the CreateStaked duration
func (*CreateStake) IntrinsicGas ¶ added in v0.11.0
func (cs *CreateStake) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a CreateStake
func (*CreateStake) LoadProto ¶ added in v0.11.0
func (cs *CreateStake) LoadProto(pbAct *iotextypes.StakeCreate) error
LoadProto converts a protobuf's Action to CreateStake
func (*CreateStake) Payload ¶ added in v0.11.0
func (cs *CreateStake) Payload() []byte
Payload returns the payload bytes
func (*CreateStake) Proto ¶ added in v0.11.0
func (cs *CreateStake) Proto() *iotextypes.StakeCreate
Proto converts to protobuf CreateStake Action
func (*CreateStake) SanityCheck ¶ added in v1.0.0
func (cs *CreateStake) SanityCheck() error
SanityCheck validates the variables in the action
func (*CreateStake) Serialize ¶ added in v0.11.0
func (cs *CreateStake) Serialize() []byte
Serialize returns a raw byte stream of the CreateStake struct
type DepositToRewardingFund ¶ added in v0.5.0
type DepositToRewardingFund struct { AbstractAction // contains filtered or unexported fields }
DepositToRewardingFund is the action to deposit to the rewarding fund
func (*DepositToRewardingFund) Amount ¶ added in v0.5.0
func (d *DepositToRewardingFund) Amount() *big.Int
Amount returns the amount to deposit
func (*DepositToRewardingFund) Cost ¶ added in v0.5.0
func (d *DepositToRewardingFund) Cost() (*big.Int, error)
Cost returns the total cost of a deposit action
func (*DepositToRewardingFund) Data ¶ added in v0.5.0
func (d *DepositToRewardingFund) Data() []byte
Data returns the additional data
func (*DepositToRewardingFund) IntrinsicGas ¶ added in v0.5.0
func (d *DepositToRewardingFund) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a deposit action
func (*DepositToRewardingFund) LoadProto ¶ added in v0.5.0
func (d *DepositToRewardingFund) LoadProto(deposit *iotextypes.DepositToRewardingFund) error
LoadProto converts a deposit action protobuf to a deposit action struct
func (*DepositToRewardingFund) Proto ¶ added in v0.5.0
func (d *DepositToRewardingFund) Proto() *iotextypes.DepositToRewardingFund
Proto converts a deposit action struct to a deposit action protobuf
func (*DepositToRewardingFund) SanityCheck ¶ added in v1.0.0
func (d *DepositToRewardingFund) SanityCheck() error
SanityCheck validates the variables in the action
func (*DepositToRewardingFund) Serialize ¶ added in v0.7.1
func (d *DepositToRewardingFund) Serialize() []byte
Serialize returns a raw byte stream of a deposit action
type DepositToRewardingFundBuilder ¶ added in v0.5.0
type DepositToRewardingFundBuilder struct { Builder // contains filtered or unexported fields }
DepositToRewardingFundBuilder is the struct to build DepositToRewardingFund
func (*DepositToRewardingFundBuilder) Build ¶ added in v0.5.0
func (b *DepositToRewardingFundBuilder) Build() DepositToRewardingFund
Build builds a new deposit to rewarding fund action
func (*DepositToRewardingFundBuilder) SetAmount ¶ added in v0.5.0
func (b *DepositToRewardingFundBuilder) SetAmount(amount *big.Int) *DepositToRewardingFundBuilder
SetAmount sets the amount to deposit
func (*DepositToRewardingFundBuilder) SetData ¶ added in v0.5.0
func (b *DepositToRewardingFundBuilder) SetData(data []byte) *DepositToRewardingFundBuilder
SetData sets the additional data
type DepositToStake ¶ added in v0.11.0
type DepositToStake struct { AbstractAction // contains filtered or unexported fields }
DepositToStake defines the action of stake add deposit
func NewDepositToStake ¶ added in v0.11.0
func NewDepositToStake( nonce uint64, index uint64, amount string, payload []byte, gasLimit uint64, gasPrice *big.Int, ) (*DepositToStake, error)
NewDepositToStake returns a DepositToStake instance
func (*DepositToStake) Amount ¶ added in v0.11.0
func (ds *DepositToStake) Amount() *big.Int
Amount returns the amount
func (*DepositToStake) BucketIndex ¶ added in v0.11.0
func (ds *DepositToStake) BucketIndex() uint64
BucketIndex returns bucket indexs
func (*DepositToStake) Cost ¶ added in v0.11.0
func (ds *DepositToStake) Cost() (*big.Int, error)
Cost returns the total cost of a DepositToStake
func (*DepositToStake) IntrinsicGas ¶ added in v0.11.0
func (ds *DepositToStake) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a DepositToStake
func (*DepositToStake) LoadProto ¶ added in v0.11.0
func (ds *DepositToStake) LoadProto(pbAct *iotextypes.StakeAddDeposit) error
LoadProto converts a protobuf's Action to DepositToStake
func (*DepositToStake) Payload ¶ added in v0.11.0
func (ds *DepositToStake) Payload() []byte
Payload returns the payload bytes
func (*DepositToStake) Proto ¶ added in v0.11.0
func (ds *DepositToStake) Proto() *iotextypes.StakeAddDeposit
Proto converts to protobuf DepositToStake Action
func (*DepositToStake) SanityCheck ¶ added in v1.0.0
func (ds *DepositToStake) SanityCheck() error
SanityCheck validates the variables in the action
func (*DepositToStake) Serialize ¶ added in v0.11.0
func (ds *DepositToStake) Serialize() []byte
Serialize returns a raw byte stream of the Stake Create struct
type Envelope ¶ added in v0.4.4
type Envelope interface { Version() uint32 Nonce() uint64 GasLimit() uint64 GasPrice() *big.Int Destination() (string, bool) Cost() (*big.Int, error) IntrinsicGas() (uint64, error) Action() Action Proto() *iotextypes.ActionCore LoadProto(pbAct *iotextypes.ActionCore) error SetNonce(n uint64) }
Envelope defines an envelope wrapped on action with some envelope metadata.
type EnvelopeBuilder ¶ added in v0.4.4
type EnvelopeBuilder struct {
// contains filtered or unexported fields
}
EnvelopeBuilder is the builder to build Envelope.
func (*EnvelopeBuilder) Build ¶ added in v0.4.4
func (b *EnvelopeBuilder) Build() Envelope
Build builds a new action.
func (*EnvelopeBuilder) SetAction ¶ added in v0.4.4
func (b *EnvelopeBuilder) SetAction(action actionPayload) *EnvelopeBuilder
SetAction sets the action payload for the Envelope Builder is building.
func (*EnvelopeBuilder) SetGasLimit ¶ added in v0.4.4
func (b *EnvelopeBuilder) SetGasLimit(l uint64) *EnvelopeBuilder
SetGasLimit sets action's gas limit.
func (*EnvelopeBuilder) SetGasPrice ¶ added in v0.4.4
func (b *EnvelopeBuilder) SetGasPrice(p *big.Int) *EnvelopeBuilder
SetGasPrice sets action's gas price.
func (*EnvelopeBuilder) SetGasPriceByBytes ¶ added in v0.4.4
func (b *EnvelopeBuilder) SetGasPriceByBytes(buf []byte) *EnvelopeBuilder
SetGasPriceByBytes sets action's gas price from a byte slice source.
func (*EnvelopeBuilder) SetNonce ¶ added in v0.4.4
func (b *EnvelopeBuilder) SetNonce(n uint64) *EnvelopeBuilder
SetNonce sets action's nonce.
func (*EnvelopeBuilder) SetVersion ¶ added in v0.4.4
func (b *EnvelopeBuilder) SetVersion(v uint32) *EnvelopeBuilder
SetVersion sets action's version.
type Execution ¶
type Execution struct { AbstractAction // contains filtered or unexported fields }
Execution defines the struct of account-based contract execution
func NewExecution ¶
func NewExecution( contractAddress string, nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, ) (*Execution, error)
NewExecution returns a Execution instance
func (*Execution) Destination ¶ added in v0.5.0
Destination returns a contract address
func (*Execution) IntrinsicGas ¶
IntrinsicGas returns the intrinsic gas of an execution
func (*Execution) LoadProto ¶
func (ex *Execution) LoadProto(pbAct *iotextypes.Execution) error
LoadProto converts a protobuf's Execution to Execution
func (*Execution) Proto ¶
func (ex *Execution) Proto() *iotextypes.Execution
Proto converts Execution to protobuf's Execution
func (*Execution) SanityCheck ¶ added in v1.0.0
SanityCheck validates the variables in the action
type GrantReward ¶ added in v0.5.0
type GrantReward struct { AbstractAction // contains filtered or unexported fields }
GrantReward is the action to grant either block or epoch reward
func (*GrantReward) Cost ¶ added in v0.5.0
func (*GrantReward) Cost() (*big.Int, error)
Cost returns the total cost of a grant reward action
func (*GrantReward) Height ¶ added in v0.5.0
func (g *GrantReward) Height() uint64
Height returns the block height to grant reward
func (*GrantReward) IntrinsicGas ¶ added in v0.5.0
func (*GrantReward) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a grant reward action, which is 0
func (*GrantReward) LoadProto ¶ added in v0.5.0
func (g *GrantReward) LoadProto(gProto *iotextypes.GrantReward) error
LoadProto converts a grant reward action protobuf to a grant reward action struct
func (*GrantReward) Proto ¶ added in v0.5.0
func (g *GrantReward) Proto() *iotextypes.GrantReward
Proto converts a grant reward action struct to a grant reward action protobuf
func (*GrantReward) RewardType ¶ added in v0.5.0
func (g *GrantReward) RewardType() int
RewardType returns the grant reward type
func (*GrantReward) Serialize ¶ added in v0.7.1
func (g *GrantReward) Serialize() []byte
Serialize returns a raw byte stream of a grant reward action
type GrantRewardBuilder ¶ added in v0.5.0
type GrantRewardBuilder struct { Builder // contains filtered or unexported fields }
GrantRewardBuilder is the struct to build GrantReward
func (*GrantRewardBuilder) Build ¶ added in v0.5.0
func (b *GrantRewardBuilder) Build() GrantReward
Build builds a new grant reward action
func (*GrantRewardBuilder) SetHeight ¶ added in v0.5.0
func (b *GrantRewardBuilder) SetHeight(height uint64) *GrantRewardBuilder
SetHeight sets the grant reward block height
func (*GrantRewardBuilder) SetRewardType ¶ added in v0.5.0
func (b *GrantRewardBuilder) SetRewardType(t int) *GrantRewardBuilder
SetRewardType sets the grant reward type
type Log ¶
type Log struct { Address string Topics Topics Data []byte BlockHeight uint64 ActionHash hash.Hash256 Index uint NotFixTopicCopyBug bool }
Log stores an evm contract event
func (*Log) ConvertFromLogPb ¶
func (log *Log) ConvertFromLogPb(pbLog *iotextypes.Log)
ConvertFromLogPb converts a protobuf's LogPb to Log
func (*Log) ConvertToLogPb ¶
func (log *Log) ConvertToLogPb() *iotextypes.Log
ConvertToLogPb converts a Log to protobuf's Log
func (*Log) Deserialize ¶
Deserialize parse the byte stream into Log
type PutPollResult ¶ added in v0.5.0
type PutPollResult struct { AbstractAction // contains filtered or unexported fields }
PutPollResult represents put the poll result from gravity chain.
func NewPutPollResult ¶ added in v0.5.0
func NewPutPollResult( nonce uint64, height uint64, candidates state.CandidateList, ) *PutPollResult
NewPutPollResult instantiates a putting poll result action struct.
func (*PutPollResult) Candidates ¶ added in v0.5.0
func (r *PutPollResult) Candidates() state.CandidateList
Candidates returns the list of candidates.
func (*PutPollResult) Cost ¶ added in v0.5.0
func (r *PutPollResult) Cost() (*big.Int, error)
Cost returns the total cost of a put poll result action
func (*PutPollResult) Height ¶ added in v0.5.0
func (r *PutPollResult) Height() uint64
Height returns put poll result height.
func (*PutPollResult) IntrinsicGas ¶ added in v0.5.0
func (r *PutPollResult) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a put poll result action
func (*PutPollResult) LoadProto ¶ added in v0.5.0
func (r *PutPollResult) LoadProto(putPollResultPb *iotextypes.PutPollResult) error
LoadProto converts a proto message into put block action.
func (*PutPollResult) Proto ¶ added in v0.5.0
func (r *PutPollResult) Proto() *iotextypes.PutPollResult
Proto converts put poll result action into a proto message.
func (*PutPollResult) Serialize ¶ added in v0.7.1
func (r *PutPollResult) Serialize() []byte
Serialize returns the byte representation of put poll result action.
type Receipt ¶
type Receipt struct { Status uint64 BlockHeight uint64 ActionHash hash.Hash256 GasConsumed uint64 ContractAddress string // contains filtered or unexported fields }
Receipt represents the result of a contract
func (*Receipt) AddTransactionLogs ¶ added in v1.1.0
func (receipt *Receipt) AddTransactionLogs(logs ...*TransactionLog) *Receipt
AddTransactionLogs add transaction logs to receipt and filter out nil log.
func (*Receipt) ConvertFromReceiptPb ¶
func (receipt *Receipt) ConvertFromReceiptPb(pbReceipt *iotextypes.Receipt)
ConvertFromReceiptPb converts a protobuf's Receipt to Receipt
func (*Receipt) ConvertToReceiptPb ¶
func (receipt *Receipt) ConvertToReceiptPb() *iotextypes.Receipt
ConvertToReceiptPb converts a Receipt to protobuf's Receipt
func (*Receipt) Deserialize ¶
Deserialize parse the byte stream into Receipt
func (*Receipt) ExecutionRevertMsg ¶ added in v1.1.4
ExecutionRevertMsg returns the list of execution revert error logs stored in receipt.
func (*Receipt) SetExecutionRevertMsg ¶ added in v1.1.4
SetExecutionRevertMsg sets executionerrorlogs to receipt.
func (*Receipt) TransactionLogs ¶ added in v1.1.0
func (receipt *Receipt) TransactionLogs() []*TransactionLog
TransactionLogs returns the list of transaction logs stored in receipt
type Restake ¶ added in v0.11.0
type Restake struct { AbstractAction // contains filtered or unexported fields }
Restake defines the action of stake again
func NewRestake ¶ added in v0.11.0
func NewRestake( nonce uint64, index uint64, duration uint32, autoStake bool, payload []byte, gasLimit uint64, gasPrice *big.Int, ) (*Restake, error)
NewRestake returns a Restake instance
func (*Restake) BucketIndex ¶ added in v0.11.0
BucketIndex returns bucket index
func (*Restake) IntrinsicGas ¶ added in v0.11.0
IntrinsicGas returns the intrinsic gas of a Restake
func (*Restake) LoadProto ¶ added in v0.11.0
func (rs *Restake) LoadProto(pbAct *iotextypes.StakeRestake) error
LoadProto converts a protobuf's Action to Restake
func (*Restake) Proto ¶ added in v0.11.0
func (rs *Restake) Proto() *iotextypes.StakeRestake
Proto converts to protobuf Restake Action
type SealedEnvelope ¶ added in v0.4.4
type SealedEnvelope struct { Envelope // contains filtered or unexported fields }
SealedEnvelope is a signed action envelope.
func AssembleSealedEnvelope ¶ added in v0.4.4
func AssembleSealedEnvelope(act Envelope, pk crypto.PublicKey, sig []byte) SealedEnvelope
AssembleSealedEnvelope assembles a SealedEnvelope use Envelope, Sender Address and Signature. This method should be only used in tests.
func FakeSeal ¶ added in v0.4.4
func FakeSeal(act Envelope, pubk crypto.PublicKey) SealedEnvelope
FakeSeal creates a SealedActionEnvelope without signature. This method should be only used in tests.
func Sign ¶
func Sign(act Envelope, sk crypto.PrivateKey) (SealedEnvelope, error)
Sign signs the action using sender's private key
func SignedCandidateRegister ¶ added in v1.2.1
func SignedCandidateRegister( nonce uint64, name, operatorAddrStr, rewardAddrStr, ownerAddrStr, amountStr string, duration uint32, autoStake bool, payload []byte, gasLimit uint64, gasPrice *big.Int, registererPriKey crypto.PrivateKey, ) (SealedEnvelope, error)
SignedCandidateRegister returns a signed candidate register
func SignedCandidateUpdate ¶ added in v1.2.1
func SignedCandidateUpdate( nonce uint64, name, operatorAddrStr, rewardAddrStr string, gasLimit uint64, gasPrice *big.Int, registererPriKey crypto.PrivateKey, ) (SealedEnvelope, error)
SignedCandidateUpdate returns a signed candidate update
func SignedChangeCandidate ¶ added in v1.2.1
func SignedChangeCandidate( nonce uint64, candName string, bucketIndex uint64, payload []byte, gasLimit uint64, gasPrice *big.Int, stakerPriKey crypto.PrivateKey, ) (SealedEnvelope, error)
SignedChangeCandidate returns a signed change candidate
func SignedCreateStake ¶ added in v1.2.1
func SignedCreateStake(nonce uint64, candidateName, amount string, duration uint32, autoStake bool, payload []byte, gasLimit uint64, gasPrice *big.Int, stakerPriKey crypto.PrivateKey, ) (SealedEnvelope, error)
SignedCreateStake returns a signed create stake
func SignedDepositToStake ¶ added in v1.2.1
func SignedDepositToStake( nonce uint64, index uint64, amount string, payload []byte, gasLimit uint64, gasPrice *big.Int, depositorPriKey crypto.PrivateKey, ) (SealedEnvelope, error)
SignedDepositToStake returns a signed deposit to stake
func SignedExecution ¶ added in v1.2.1
func SignedExecution(contractAddr string, executorPriKey crypto.PrivateKey, nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte) (SealedEnvelope, error)
SignedExecution return a signed execution
func SignedReclaimStake ¶ added in v1.2.1
func SignedReclaimStake( withdraw bool, nonce uint64, bucketIndex uint64, payload []byte, gasLimit uint64, gasPrice *big.Int, reclaimerPriKey crypto.PrivateKey, ) (SealedEnvelope, error)
SignedReclaimStake returns a signed unstake or withdraw stake
func SignedRestake ¶ added in v1.2.1
func SignedRestake( nonce uint64, index uint64, duration uint32, autoStake bool, payload []byte, gasLimit uint64, gasPrice *big.Int, restakerPriKey crypto.PrivateKey, ) (SealedEnvelope, error)
SignedRestake returns a signed restake
func SignedTransfer ¶ added in v1.2.1
func SignedTransfer(recipientAddr string, senderPriKey crypto.PrivateKey, nonce uint64, amount *big.Int, payload []byte, gasLimit uint64, gasPrice *big.Int) (SealedEnvelope, error)
SignedTransfer return a signed transfer
func SignedTransferStake ¶ added in v1.2.1
func SignedTransferStake( nonce uint64, voterAddress string, bucketIndex uint64, payload []byte, gasLimit uint64, gasPrice *big.Int, stakerPriKey crypto.PrivateKey, ) (SealedEnvelope, error)
SignedTransferStake returns a signed transfer stake
func (*SealedEnvelope) Encoding ¶ added in v1.2.0
func (sealed *SealedEnvelope) Encoding() uint32
Encoding returns the encoding
func (*SealedEnvelope) Hash ¶ added in v0.4.4
func (sealed *SealedEnvelope) Hash() hash.Hash256
Hash returns the hash value of SealedEnvelope. an all-0 return value means the transaction is invalid
func (*SealedEnvelope) LoadProto ¶ added in v0.4.4
func (sealed *SealedEnvelope) LoadProto(pbAct *iotextypes.Action) error
LoadProto loads from proto scheme.
func (*SealedEnvelope) Proto ¶ added in v0.4.4
func (sealed *SealedEnvelope) Proto() *iotextypes.Action
Proto converts it to it's proto scheme.
func (*SealedEnvelope) Signature ¶ added in v0.4.4
func (sealed *SealedEnvelope) Signature() []byte
Signature returns signature bytes
func (*SealedEnvelope) SrcPubkey ¶ added in v0.4.4
func (sealed *SealedEnvelope) SrcPubkey() crypto.PublicKey
SrcPubkey returns the source public key
type SealedEnvelopeValidator ¶ added in v0.11.0
type SealedEnvelopeValidator interface { // Validate returns an error if any validation failed Validate(context.Context, SealedEnvelope) error }
SealedEnvelopeValidator is the interface of validating an SealedEnvelope action
type Topics ¶ added in v1.0.0
Topics are data items of a transaction, such as send/recipient address
type TransactionLog ¶ added in v1.1.0
type TransactionLog struct { Type iotextypes.TransactionLogType Amount *big.Int Sender string Recipient string }
TransactionLog stores a transaction event
type Transfer ¶
type Transfer struct { AbstractAction // contains filtered or unexported fields }
Transfer defines the struct of account-based transfer
func NewTransfer ¶
func NewTransfer( nonce uint64, amount *big.Int, recipient string, payload []byte, gasLimit uint64, gasPrice *big.Int, ) (*Transfer, error)
NewTransfer returns a Transfer instance
func (*Transfer) Destination ¶ added in v0.5.0
Destination returns the recipient address as destination.
func (*Transfer) IntrinsicGas ¶
IntrinsicGas returns the intrinsic gas of a transfer
func (*Transfer) LoadProto ¶
func (tsf *Transfer) LoadProto(pbAct *iotextypes.Transfer) error
LoadProto converts a protobuf's Action to Transfer
func (*Transfer) Proto ¶
func (tsf *Transfer) Proto() *iotextypes.Transfer
Proto converts Transfer to protobuf's Action
func (*Transfer) Recipient ¶
Recipient returns the recipient address. It's the wrapper of Action.DstAddr
func (*Transfer) SanityCheck ¶ added in v1.0.0
SanityCheck validates the variables in the action
type TransferStake ¶ added in v0.11.0
type TransferStake struct { AbstractAction // contains filtered or unexported fields }
TransferStake defines the action of transfering stake ownership ts the other
func NewTransferStake ¶ added in v0.11.0
func NewTransferStake( nonce uint64, voterAddress string, bucketIndex uint64, payload []byte, gasLimit uint64, gasPrice *big.Int, ) (*TransferStake, error)
NewTransferStake returns a TransferStake instance
func (*TransferStake) BucketIndex ¶ added in v0.11.0
func (ts *TransferStake) BucketIndex() uint64
BucketIndex returns bucket index
func (*TransferStake) Cost ¶ added in v0.11.0
func (ts *TransferStake) Cost() (*big.Int, error)
Cost returns the tstal cost of a TransferStake
func (*TransferStake) IntrinsicGas ¶ added in v0.11.0
func (ts *TransferStake) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a TransferStake
func (*TransferStake) LoadProto ¶ added in v0.11.0
func (ts *TransferStake) LoadProto(pbAct *iotextypes.StakeTransferOwnership) error
LoadProto loads transfer stake protobuf
func (*TransferStake) Payload ¶ added in v0.11.0
func (ts *TransferStake) Payload() []byte
Payload returns the payload bytes
func (*TransferStake) Proto ¶ added in v0.11.0
func (ts *TransferStake) Proto() *iotextypes.StakeTransferOwnership
Proto converts transfer stake to protobuf
func (*TransferStake) Serialize ¶ added in v0.11.0
func (ts *TransferStake) Serialize() []byte
Serialize returns a raw byte stream of the transfer stake action struct
func (*TransferStake) VoterAddress ¶ added in v0.11.0
func (ts *TransferStake) VoterAddress() address.Address
VoterAddress returns the address of recipient
type Unstake ¶ added in v0.11.0
type Unstake struct {
// contains filtered or unexported fields
}
Unstake defines the action of unstake
func NewUnstake ¶ added in v0.11.0
func NewUnstake( nonce uint64, bucketIndex uint64, payload []byte, gasLimit uint64, gasPrice *big.Int, ) (*Unstake, error)
NewUnstake returns a Unstake instance
func (*Unstake) BucketIndex ¶ added in v0.11.0
func (sr *Unstake) BucketIndex() uint64
BucketIndex returns bucket index
func (*Unstake) IntrinsicGas ¶ added in v0.11.0
IntrinsicGas returns the intrinsic gas of a Unstake
func (*Unstake) LoadProto ¶ added in v0.11.0
func (sr *Unstake) LoadProto(pbAct *iotextypes.StakeReclaim) error
LoadProto converts a protobuf's Action to reclaimStake
func (*Unstake) Payload ¶ added in v0.11.0
func (sr *Unstake) Payload() []byte
Payload returns the payload bytes
func (*Unstake) Proto ¶ added in v0.11.0
func (sr *Unstake) Proto() *iotextypes.StakeReclaim
Proto converts to protobuf stake reclaim action struct
type WithdrawStake ¶ added in v0.11.0
type WithdrawStake struct {
// contains filtered or unexported fields
}
WithdrawStake defines the action of stake withdraw
func NewWithdrawStake ¶ added in v0.11.0
func NewWithdrawStake( nonce uint64, bucketIndex uint64, payload []byte, gasLimit uint64, gasPrice *big.Int, ) (*WithdrawStake, error)
NewWithdrawStake returns a WithdrawStake instance
func (*WithdrawStake) BucketIndex ¶ added in v0.11.0
func (sr *WithdrawStake) BucketIndex() uint64
BucketIndex returns bucket index
func (*WithdrawStake) Cost ¶ added in v0.11.0
func (sw *WithdrawStake) Cost() (*big.Int, error)
Cost returns the total cost of a WithdrawStake
func (*WithdrawStake) IntrinsicGas ¶ added in v0.11.0
func (sw *WithdrawStake) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a WithdrawStake
func (*WithdrawStake) LoadProto ¶ added in v0.11.0
func (sr *WithdrawStake) LoadProto(pbAct *iotextypes.StakeReclaim) error
LoadProto converts a protobuf's Action to reclaimStake
func (*WithdrawStake) Payload ¶ added in v0.11.0
func (sr *WithdrawStake) Payload() []byte
Payload returns the payload bytes
func (*WithdrawStake) Proto ¶ added in v0.11.0
func (sr *WithdrawStake) Proto() *iotextypes.StakeReclaim
Proto converts to protobuf stake reclaim action struct
Source Files ¶
- actctx.go
- action.go
- builder.go
- candidate_register.go
- candidate_update.go
- claimreward.go
- consignment_transfer.go
- const.go
- depositreward.go
- envelope.go
- execution.go
- grantreward.go
- putpollresult.go
- receipt.go
- rlp_tx.go
- sealedenvelope.go
- sealedenvelopevalidator.go
- signedaction.go
- stake_adddeposit.go
- stake_changecandidate.go
- stake_create.go
- stake_reclaim.go
- stake_restake.go
- stake_transferownership.go
- transfer.go