Documentation ¶
Index ¶
- Variables
- func SignTxContent(tx *Tx, id string, account *account.KeyPair) (*crypto.Signature, error)
- type Action
- type Receipt
- type ReceiptType
- type Status
- type StatusCode
- type ToBytesLevel
- type Tx
- func (t *Tx) CanceledDelaytxHash() ([]byte, bool)
- func (t *Tx) CheckGas() error
- func (t *Tx) CheckSize() error
- func (t *Tx) Decode(b []byte) error
- func (t *Tx) Encode() []byte
- func (t *Tx) FromPb(tr *txpb.Tx) *Tx
- func (t *Tx) Hash() []byte
- func (t *Tx) IsCreatedBefore(ct int64) bool
- func (t *Tx) IsDefer() bool
- func (t *Tx) IsExpired(ct int64) bool
- func (t *Tx) String() string
- func (t *Tx) ToBytes(l ToBytesLevel) []byte
- func (t *Tx) ToPb() *txpb.Tx
- func (t *Tx) VerifyDefer(referredTx *Tx) error
- func (t *Tx) VerifySelf() error
- func (t *Tx) VerifySigner(sig *crypto.Signature) bool
- type TxReceipt
Constants ¶
This section is empty.
Variables ¶
var (
MaxExpiration = int64(90 * time.Second)
)
values
Functions ¶
Types ¶
type Action ¶
type Action struct { Contract string // contract name ActionName string // method name of contract Data string // parameters of method, with json format }
Action implement
type Receipt ¶
Receipt generated when applying transaction
type ReceiptType ¶
type ReceiptType int32
ReceiptType type of single receipt
const ( // SystemDefined system receipt, recording info of calling a method SystemDefined ReceiptType = iota // UserDefined user defined receipt, usually a json string UserDefined )
type Status ¶
type Status struct { Code StatusCode Message string }
Status status of transaction execution result, including code and message
type StatusCode ¶
type StatusCode int32
StatusCode status code of transaction execution result
const ( Success StatusCode = iota ErrorGasRunOut ErrorBalanceNotEnough ErrorParamter // parameter mismatch when calling function ErrorRuntime // runtime error ErrorTimeout ErrorTxFormat // tx format errors ErrorDuplicateSetCode // more than one set code action in a tx ErrorUnknown // other errors )
tx execution result
type ToBytesLevel ¶ added in v1.1.0
type ToBytesLevel int
ToBytesLevel judges which fields of tx should be written to bytes.
const ( Base ToBytesLevel = iota Publish Full )
consts
type Tx ¶
type Tx struct { Time int64 `json:"time"` Expiration int64 `json:"expiration"` GasRatio int64 `json:"gas_ratio"` GasLimit int64 `json:"gas_limit"` Delay int64 `json:"delay"` Actions []*Action `json:"-"` Signers []string `json:"-"` Signs []*crypto.Signature `json:"-"` Publisher string `json:"-"` PublishSigns []*crypto.Signature `json:"-"` ReferredTx []byte `json:"referred_tx"` AmountLimit []*contract.Amount `json:"amountLimit"` // contains filtered or unexported fields }
Tx Transaction structure
func (*Tx) CanceledDelaytxHash ¶
CanceledDelaytxHash returns the delay transaction hash that is canceled.
func (*Tx) IsCreatedBefore ¶ added in v1.1.0
IsCreatedBefore checks whether the transaction time is valid compared to the given time ct. ct may be time.Now().UnixNano() or block head time.
func (*Tx) IsDefer ¶ added in v1.1.0
IsDefer returns whether the transaction is a defer tx.
Defer transaction is the transaction that's generated by a delay tx.
func (*Tx) IsExpired ¶ added in v1.1.0
IsExpired checks whether the transaction is expired compared to the given time ct.
func (*Tx) ToBytes ¶ added in v1.1.0
func (t *Tx) ToBytes(l ToBytesLevel) []byte
ToBytes converts tx to bytes.
func (*Tx) ToPb ¶ added in v1.1.0
func (t *Tx) ToPb() *txpb.Tx
ToPb convert tx to txpb.Tx for transmission.
func (*Tx) VerifyDefer ¶ added in v1.1.0
VerifyDefer verifes whether the defer tx is matched with the referred tx.
type TxReceipt ¶
type TxReceipt struct { TxHash []byte GasUsage int64 RAMUsage map[string]int64 Status *Status Returns []string Receipts []*Receipt }
TxReceipt Transaction Receipt
func NewTxReceipt ¶
NewTxReceipt generate tx receipt for a tx hash