events

package
v0.19.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TypeCall          = Type(0x00)
	TypeLog           = Type(0x01)
	TypeAccountInput  = Type(0x02)
	TypeAccountOutput = Type(0x03)
)

Execution event types

Variables

This section is empty.

Functions

func EventStringAccountCall added in v0.19.0

func EventStringAccountCall(addr crypto.Address) string

func EventStringAccountInput

func EventStringAccountInput(addr crypto.Address) string

func EventStringAccountOutput

func EventStringAccountOutput(addr crypto.Address) string

func EventStringBond

func EventStringBond() string

func EventStringLogEvent added in v0.19.0

func EventStringLogEvent(addr crypto.Address) string

func EventStringNameReg

func EventStringNameReg(name string) string

func EventStringPermissions

func EventStringPermissions(perm ptypes.PermFlag) string

func EventStringUnbond

func EventStringUnbond() string

func PublishAccountCall added in v0.19.0

func PublishAccountCall(publisher event.Publisher, tx *txs.Tx, height uint64, call *EventDataCall) error

Publish/Subscribe

func PublishAccountInput

func PublishAccountInput(publisher event.Publisher, height uint64, address crypto.Address, tx *txs.Tx, ret []byte,
	exception *errors.Exception) error

Publish/Subscribe

func PublishAccountOutput

func PublishAccountOutput(publisher event.Publisher, height uint64, address crypto.Address, tx *txs.Tx, ret []byte,
	exception *errors.Exception) error

func PublishLogEvent added in v0.19.0

func PublishLogEvent(publisher event.Publisher, tx *txs.Tx, log *EventDataLog) error

Publish/Subscribe

func PublishNameReg

func PublishNameReg(publisher event.Publisher, height uint64, tx *txs.Tx) error

func PublishPermissions

func PublishPermissions(publisher event.Publisher, height uint64, tx *txs.Tx) error

func SubscribeAccountCall added in v0.19.0

func SubscribeAccountCall(ctx context.Context, subscribable event.Subscribable, subscriber string, address crypto.Address,
	txHash []byte, stackDepth int, ch chan<- *EventDataCall) error

Subscribe to account call event - if TxHash is provided listens for a specifc Tx otherwise captures all, if stackDepth is greater than or equal to 0 captures calls at a specific stack depth (useful for capturing the return of the root call over recursive calls

func SubscribeAccountOutputSendTx

func SubscribeAccountOutputSendTx(ctx context.Context, subscribable event.Subscribable, subscriber string,
	address crypto.Address, txHash []byte, ch chan<- *payload.SendTx) error

func SubscribeLogEvent added in v0.19.0

func SubscribeLogEvent(ctx context.Context, subscribable event.Subscribable, subscriber string, address crypto.Address,
	ch chan<- *EventDataLog) error

Types

type CallData added in v0.19.0

type CallData struct {
	Caller crypto.Address
	Callee crypto.Address
	Data   binary.HexBytes
	Value  uint64
	Gas    uint64
}

type Event added in v0.19.0

type Event struct {
	Header *Header
	Call   *EventDataCall `json:",omitempty"`
	Log    *EventDataLog  `json:",omitempty"`
	Tx     *EventDataTx   `json:",omitempty"`
	// contains filtered or unexported fields
}

func DecodeEvent added in v0.19.0

func DecodeEvent(bs []byte) (*Event, error)

func (*Event) Copy added in v0.19.0

func (ev *Event) Copy() *Event

Performs a shallow copy of Event

func (*Event) Encode added in v0.19.0

func (ev *Event) Encode() ([]byte, error)

func (*Event) Get added in v0.19.0

func (ev *Event) Get(key string) (value string, ok bool)

func (*Event) GetCall added in v0.19.0

func (ev *Event) GetCall() *EventDataCall

func (*Event) GetLog added in v0.19.0

func (ev *Event) GetLog() *EventDataLog

func (*Event) GetTx added in v0.19.0

func (ev *Event) GetTx() *EventDataTx

func (*Event) Key added in v0.19.0

func (ev *Event) Key() Key

func (*Event) Keys added in v0.19.0

func (ev *Event) Keys() []string

func (*Event) Len added in v0.19.0

func (ev *Event) Len() int

func (*Event) ProvideIndex added in v0.19.0

func (ev *Event) ProvideIndex(index uint64)

event.Cache will provide an index through this methods of Indexable

func (*Event) String added in v0.19.0

func (ev *Event) String() string

func (*Event) Tags added in v0.19.0

func (ev *Event) Tags() event.Tags

type EventDataCall added in v0.19.0

type EventDataCall struct {
	CallData   *CallData
	Origin     crypto.Address
	StackDepth uint64
	Return     binary.HexBytes
	Exception  *errors.Exception
}

EventDataCall fires when we call a contract, and when a contract calls another contract

func (*EventDataCall) Get added in v0.19.0

func (call *EventDataCall) Get(key string) (string, bool)

Implements Tags for events

func (*EventDataCall) Keys added in v0.19.0

func (call *EventDataCall) Keys() []string

func (*EventDataCall) Len added in v0.19.0

func (call *EventDataCall) Len() int

func (*EventDataCall) Tags added in v0.19.0

func (call *EventDataCall) Tags(tags map[string]interface{}) map[string]interface{}

type EventDataLog added in v0.19.0

type EventDataLog struct {
	Height  uint64
	Address crypto.Address
	Topics  []Word256
	Data    binary.HexBytes
}

EventDataLog fires when a contract executes the LOG opcode

func (*EventDataLog) Get added in v0.19.0

func (log *EventDataLog) Get(key string) (string, bool)

func (*EventDataLog) GetTopic added in v0.19.0

func (log *EventDataLog) GetTopic(i int) Word256

func (*EventDataLog) Keys added in v0.19.0

func (log *EventDataLog) Keys() []string

func (*EventDataLog) Len added in v0.19.0

func (log *EventDataLog) Len() int

type EventDataTx

type EventDataTx struct {
	Tx        *txs.Tx
	Return    binary.HexBytes
	Exception *errors.Exception
}

All txs fire EventDataTx, but only CallTx might have Return or Exception

func (*EventDataTx) Get added in v0.19.0

func (tx *EventDataTx) Get(key string) (string, bool)

func (*EventDataTx) Keys added in v0.19.0

func (tx *EventDataTx) Keys() []string

func (*EventDataTx) Len added in v0.19.0

func (tx *EventDataTx) Len() int
type Header struct {
	TxType    payload.Type
	TxHash    binary.HexBytes
	EventType Type
	EventID   string
	Height    uint64
	Index     uint64
}

func (*Header) Get added in v0.19.0

func (h *Header) Get(key string) (value string, ok bool)

Implements Tags for events

func (*Header) Key added in v0.19.0

func (h *Header) Key() Key

Returns a lexicographically sortable key encoding the height and index of this event

func (*Header) Keys added in v0.19.0

func (h *Header) Keys() []string

func (*Header) Len added in v0.19.0

func (h *Header) Len() int

func (*Header) Map added in v0.19.0

func (h *Header) Map() map[string]interface{}

func (*Header) String added in v0.19.0

func (h *Header) String() string

type Key added in v0.19.0

type Key []byte

func NewKey added in v0.19.0

func NewKey(height, index uint64) Key

func (Key) Bytes added in v0.19.0

func (k Key) Bytes() []byte

func (Key) Compare added in v0.19.0

func (k Key) Compare(k2 Key) int

-1 if k < k2

0 if k == k2
1 if k > k2

func (Key) Height added in v0.19.0

func (k Key) Height() uint64

func (Key) Index added in v0.19.0

func (k Key) Index() uint64

func (Key) IsSuccessorOf added in v0.19.0

func (k Key) IsSuccessorOf(p Key) bool

Returns true iff k is a valid successor key to p; iff (the height is the same and the index is one greater) or (the height is greater and the index is zero) or (p is uninitialised)

func (Key) String added in v0.19.0

func (k Key) String() string

type Provider added in v0.19.0

type Provider interface {
	GetEvents(startKey, endKey Key, consumer func(*Event) (stop bool)) (stopped bool, err error)
	LatestEventKey() Key
}

type Type added in v0.19.0

type Type int8

func EventTypeFromString added in v0.19.0

func EventTypeFromString(name string) Type

func (Type) MarshalText added in v0.19.0

func (typ Type) MarshalText() ([]byte, error)

func (Type) String added in v0.19.0

func (typ Type) String() string

func (*Type) UnmarshalText added in v0.19.0

func (typ *Type) UnmarshalText(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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