events

package
v0.37.19 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: AGPL-3.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

View Source
const (
	EventTypeBlockExecuted       flow.EventType = "EVM.BlockExecuted"
	EventTypeTransactionExecuted flow.EventType = "EVM.TransactionExecuted"
)
View Source
const ChecksumLength = 4

ChecksumLength captures number of bytes a checksum uses

Variables

This section is empty.

Functions

func FlowEventToCadenceEvent

func FlowEventToCadenceEvent(event flow.Event) (cadence.Event, error)

Types

type BlockEventPayload

type BlockEventPayload struct {
	Height              uint64          `cadence:"height"`
	Hash                gethCommon.Hash `cadence:"hash"`
	Timestamp           uint64          `cadence:"timestamp"`
	TotalSupply         cadence.Int     `cadence:"totalSupply"`
	TotalGasUsed        uint64          `cadence:"totalGasUsed"`
	ParentBlockHash     gethCommon.Hash `cadence:"parentHash"`
	ReceiptRoot         gethCommon.Hash `cadence:"receiptRoot"`
	TransactionHashRoot gethCommon.Hash `cadence:"transactionHashRoot"`
	PrevRandao          gethCommon.Hash `cadence:"prevrandao"`
}

func DecodeBlockEventPayload

func DecodeBlockEventPayload(event cadence.Event) (*BlockEventPayload, error)

DecodeBlockEventPayload decodes Cadence event into block event payload.

type Event

type Event struct {
	Etype   flow.EventType
	Payload EventPayload
}

func NewBlockEvent

func NewBlockEvent(block *types.Block) *Event

NewBlockEvent creates a new block event with the given block as payload.

func NewTransactionEvent

func NewTransactionEvent(
	result *types.Result,
	payload []byte,
	blockHeight uint64,
) *Event

NewTransactionEvent creates a new transaction event with the given parameters - result: the result of the transaction execution - payload: the RLP-encoded payload of the transaction - blockHeight: the height of the block where the transaction is included

type EventPayload

type EventPayload interface {
	// ToCadence converts the event to Cadence event
	ToCadence(chainID flow.ChainID) (cadence.Event, error)
}

type FLOWTokensDepositedEventPayload

type FLOWTokensDepositedEventPayload struct {
	Address                string         `cadence:"address"`
	Amount                 cadence.UFix64 `cadence:"amount"`
	DepositedUUID          uint64         `cadence:"depositedUUID"`
	BalanceAfterInAttoFlow cadence.Int    `cadence:"balanceAfterInAttoFlow"`
}

FLOWTokensDepositedEventPayload captures payloads for a FlowTokenDeposited event

func DecodeFLOWTokensDepositedEventPayload

func DecodeFLOWTokensDepositedEventPayload(event cadence.Event) (*FLOWTokensDepositedEventPayload, error)

DecodeFLOWTokensDepositedEventPayload decodes a flow FLOWTokenDeposited events into a FLOWTokensEventDepositedPayload

type FLOWTokensWithdrawnEventPayload

type FLOWTokensWithdrawnEventPayload struct {
	Address                string         `cadence:"address"`
	Amount                 cadence.UFix64 `cadence:"amount"`
	WithdrawnUUID          uint64         `cadence:"withdrawnUUID"`
	BalanceAfterInAttoFlow cadence.Int    `cadence:"balanceAfterInAttoFlow"`
}

FLOWTokensWithdrawnEventPayload captures payloads for a FlowTokensWithdrawn event

func DecodeFLOWTokensWithdrawnEventPayload

func DecodeFLOWTokensWithdrawnEventPayload(event cadence.Event) (*FLOWTokensWithdrawnEventPayload, error)

DecodeFLOWTokensWithdrawnEventPayload decodes a flow FLOWTokensWithdrawn events into a FLOWTokensEventDepositedPayload

type TransactionEventPayload

type TransactionEventPayload struct {
	Hash                gethCommon.Hash      `cadence:"hash"`
	Index               uint16               `cadence:"index"`
	TransactionType     uint8                `cadence:"type"`
	Payload             []byte               `cadence:"payload"`
	ErrorCode           uint16               `cadence:"errorCode"`
	GasConsumed         uint64               `cadence:"gasConsumed"`
	ContractAddress     string               `cadence:"contractAddress"`
	Logs                []byte               `cadence:"logs"`
	BlockHeight         uint64               `cadence:"blockHeight"`
	ErrorMessage        string               `cadence:"errorMessage"`
	ReturnedData        []byte               `cadence:"returnedData"`
	PrecompiledCalls    []byte               `cadence:"precompiledCalls"`
	StateUpdateChecksum [ChecksumLength]byte `cadence:"stateUpdateChecksum"`
}

func DecodeTransactionEventPayload

func DecodeTransactionEventPayload(event cadence.Event) (*TransactionEventPayload, error)

DecodeTransactionEventPayload decodes Cadence event into transaction event payload.

Jump to

Keyboard shortcuts

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