Class: EvmEvent

moralis-monorepo / @moralisweb3/evm-utils / EvmEvent

Class: EvmEvent

@moralisweb3/evm-utils.EvmEvent

The EvmEvent is a representation of an event.

Use this class any time you work with an event.

Implements

  • MoralisDataObject

Table of contents

Methods

Accessors

Methods

create

Static create(data, core?): EvmEvent

Create a new instance of EvmEvent from any valid event input

Example

const event = EvmEventish.create(data);

Parameters

NameTypeDescription
dataEvmEventishthe EvmEventish type
core?MoralisCore-

Returns

EvmEvent


equals

Static equals(dataA, dataB): boolean

Check the equality between two Evm events. It checks if the chain, block number, address and data are equal.

Example

EvmEvent.equals(dataA, dataB)

Parameters

NameTypeDescription
dataAEvmEventishThe first event
dataBEvmEventishThe second event

Returns

boolean

true if the events are equal, false otherwise


equals

equals(data): boolean

Checks the equality of the current event instance with another evm event

Example

event.equals(data)

Parameters

NameTypeDescription
dataEvmEventishthe event to compare with

Returns

boolean

true if the events are equal, false otherwise

Implementation of

MoralisDataObject.equals


toJSON

toJSON(): Object

Example

event.toJSON()

Returns

Object

a JSON represention of the event.

NameType
chainstring | number
addressstring
blockNumberstring
data{ from: undefined | string ; to: undefined | string ; value: undefined | string }
data.fromundefined | string
data.toundefined | string
data.valueundefined | string
transactionHashstring
blockTimestampDate
blockHashstring

Implementation of

MoralisDataObject.toJSON


format

format(): Object

Example

event.format()

Returns

Object

a JSON represention of the event.

NameType
chainstring | number
addressstring
blockNumberstring
data{ from: undefined | string ; to: undefined | string ; value: undefined | string }
data.fromundefined | string
data.toundefined | string
data.valueundefined | string
transactionHashstring
blockTimestampDate
blockHashstring

Implementation of

MoralisDataObject.format

Accessors

result

get result(): EvmEventData

Example

event.result

Returns

EvmEventData

all the data without casting it to JSON.


chain

get chain(): EvmChain

Example

event.chain // EvmChain

Returns

EvmChain

the event chain


address

get address(): EvmAddress

Example

event.address // EvmAddress

Returns

EvmAddress

the event address


blockNumber

get blockNumber(): BigNumber

Example

event.blockNumber // BigNumber

Returns

BigNumber

the event block number


blockTimestamp

get blockTimestamp(): Date

Example

event.blockTimestamp // Date

Returns

Date

the event block timestamp


data

get data(): Object

Example

event.data

Returns

Object

the event data with from address, to address and value

NameType
from?EvmAddress
to?EvmAddress
value?EvmNative

transactionHash

get transactionHash(): string

Example

event.transactionHash // "0xc9f62f4f6ab505a96c1a84ec2899c6bfd86245ef1effaa689fc997798be763d5"

Returns

string

the event block trannsaciton hash


blockHash

get blockHash(): string

Example

event.blockHash // "0xc9f62f4f6ab505a96c1a84ec2899c6bfd86245ef1effaa689fc997798be763d5"

Returns

string

the event block hash


Did this page help you?