Skip to main content

Class: EvmSimpleBlock

moralis-monorepo / @moralisweb3/common-evm-utils / EvmSimpleBlock

Class: EvmSimpleBlock

@moralisweb3/common-evm-utils.EvmSimpleBlock

The EvmSimpleBlock is a representation of a block.

Implements

  • MoralisDataObject

Table of contents

Methods

Accessors

Constructors

Methods

create

Static create(data): EvmSimpleBlock

Create a new instance of EvmSimpleBlock from any valid transaction input

Example

const transaction = EvmSimpleBlock.create(data);

Parameters

NameTypeDescription
dataEvmSimpleBlockishthe EvmSimpleBlockish type

Returns

EvmSimpleBlock


equals

Static equals(dataA, dataB): boolean

Check the equality between two Evm blocks. It compares their hashes and blocks.

Example

EvmSimpleBlock.equals(dataA, dataB)

Parameters

NameTypeDescription
dataAEvmSimpleBlockish | EvmBlockishThe first block to compare
dataBEvmSimpleBlockish | EvmBlockishThe second block to compare

Returns

boolean


parse

Static parse(data): EvmSimpleBlockData

Parameters

NameType
dataEvmSimpleBlockInput

Returns

EvmSimpleBlockData


equals

equals(data): boolean

Checks the equality of the current block with another evm block

Example

block.equals(data)

Parameters

NameTypeDescription
dataEvmSimpleBlockishthe block to compare with

Returns

boolean

Implementation of

MoralisDataObject.equals


format

format(): Object

Deprecated

This method will be removed soon. To format the value, use one of the properties.

Returns

Object

NameType
chainstring
hashstring
numberstring
timestampDate

Implementation of

MoralisDataObject.format


toJSON

toJSON(): Object

Example

block.toJSON()

Returns

Object

a JSON represention of the block.

NameType
chainstring
hashstring
numberstring
timestampDate

Implementation of

MoralisDataObject.toJSON

Accessors

chain

get chain(): EvmChain

Example

block.chain // EvmChain

Returns

EvmChain

the block chain.


hash

get hash(): string

Example

block.hash // "0x9b559aef7ea858608c2e554246fe4a24287e7aeeb976848df2b9a2531f4b9171"

Returns

string

the block hash.


number

get number(): BigNumber

Example

block.number // BigNumber

Returns

BigNumber

the block number.


result

get result(): EvmSimpleBlockData

Example

block.result

Returns

EvmSimpleBlockData

all the data without casting it to JSON.


timestamp

get timestamp(): Date

Example

block.timestamp // Date

Returns

Date

the block timestamp.

Constructors

constructor

new EvmSimpleBlock(data)

Parameters

NameType
dataEvmSimpleBlockInput