transaction

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: Apache-2.0 Imports: 27 Imported by: 4

Documentation

Index

Constants

View Source
const (
	InvalidGenesisError = iota + errors.CodeService + 100
	InvalidSignatureError
	InvalidVersion
	InvalidTxValue
	InvalidFormat
	NotEnoughStepError
	NotEnoughBalanceError
	ContractNotUsable
	AccessDeniedError
)
View Source
const (
	ICONMainNetGenesisID = "5aa2453a84ba2fb1e3394b9e3471f5dcebc6225fc311a97ca505728153b9d246"
	ICONMainNetCID       = 1
)
View Source
const (
	Version2 = 2
	Version3 = 3
)

Variables

View Source
var ICONMainNetGenesisIDBytes, _ = hex.DecodeString(ICONMainNetGenesisID)
View Source
var TransactionType = reflect.TypeOf((*transaction)(nil))

Functions

func CIDForGenesisTransactionID

func CIDForGenesisTransactionID(txid []byte) int

func MeasureBytesOfData

func MeasureBytesOfData(rev module.Revision, data []byte) (int, error)

func NewTransactionListFromHash

func NewTransactionListFromHash(d db.Database, h []byte) module.TransactionList

func NewTransactionListFromSlice

func NewTransactionListFromSlice(dbase db.Database, list []module.Transaction) module.TransactionList

func NewTransactionListV1FromSlice

func NewTransactionListV1FromSlice(list []module.Transaction) module.TransactionList

func NewTransactionListWithBuilder

func NewTransactionListWithBuilder(builder merkle.Builder, h []byte) module.TransactionList

func RegisterFactory added in v0.9.1

func RegisterFactory(f *Factory)

func SerializeJSON

func SerializeJSON(s []byte, in map[string]bool, exclude map[string]bool) ([]byte, error)

func SerializeMap

func SerializeMap(d map[string]interface{}, i map[string]bool, e map[string]bool) ([]byte, error)

func SerializeValue added in v0.9.1

func SerializeValue(v interface{}) ([]byte, error)

func Unwrap added in v0.9.6

Types

type Factory added in v0.9.1

type Factory struct {
	Priority    int
	CheckJSON   func(jso map[string]interface{}) bool
	ParseJSON   func(js []byte, raw bool) (Transaction, error)
	CheckBinary func(bs []byte) bool
	ParseBinary func(bs []byte) (Transaction, error)
}

type GenesisTransaction

type GenesisTransaction interface {
	Transaction
	CID() int
	NID() int
}

func NewGenesisTransaction

func NewGenesisTransaction(b []byte) (GenesisTransaction, error)

type Handler

type Handler interface {
	Prepare(ctx contract.Context) (state.WorldContext, error)
	Execute(ctx contract.Context, estimate bool) (txresult.Receipt, error)
	Dispose()
}

func NewHandler

func NewHandler(cm contract.ContractManager, group module.TransactionGroup, from, to module.Address, value, stepLimit *big.Int, dataType *string, data []byte) (Handler, error)

type SerializeError

type SerializeError struct {
	// contains filtered or unexported fields
}

func (*SerializeError) Error

func (s *SerializeError) Error() string

type Transaction

type Transaction interface {
	module.Transaction
	PreValidate(wc state.WorldContext, update bool) error
	GetHandler(cm contract.ContractManager) (Handler, error)
	Timestamp() int64
	Nonce() *big.Int
	To() module.Address
	IsSkippable() bool
}

TODO It assumes normal transaction. When supporting patch, add skipping timestamp checking for it at PreValidate().

func NewPatchTransaction

func NewPatchTransaction(p module.Patch, nid int, ts int64, w module.Wallet) (Transaction, error)

func NewTransaction

func NewTransaction(b []byte) (Transaction, error)

func NewTransactionFromJSON

func NewTransactionFromJSON(b []byte) (Transaction, error)

func Wrap added in v0.9.4

func Wrap(t Transaction) Transaction

type TransactionListV1

type TransactionListV1 struct {
	// contains filtered or unexported fields
}

func (*TransactionListV1) Equal

func (*TransactionListV1) Flush

func (l *TransactionListV1) Flush() error

func (*TransactionListV1) Get

func (*TransactionListV1) Hash

func (l *TransactionListV1) Hash() []byte

func (*TransactionListV1) Iterator

Jump to

Keyboard shortcuts

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