Class: EvmTransaction

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

Class: EvmTransaction

@moralisweb3/evm-utils.EvmTransaction

The EvmTranaction is a representation of a published transaction.

Use this class any time you work with a transaction.

Implements

  • MoralisDataObject

Table of contents

Methods

Accessors

Methods

create

Static create(data, core?): EvmTransaction

Create a new instance of EvmTransaction from any valid transaction input

Example

const transaction = EvmTransaction.create(data);

Parameters

NameTypeDescription
dataEvmTransactionishthe EvmTransactionish type
core?MoralisCore-

Returns

EvmTransaction


equals

Static equals(dataA, dataB): boolean

Check the equality between two Evm transactions

Example

EvmTransaction.equals(dataA, dataB)

Parameters

NameTypeDescription
dataAEvmTransactionishThe first transaction
dataBEvmTransactionishThe second transaction

Returns

boolean


equals

equals(data): boolean

Checks the equality of the current transaction with another evm transaction

Example

transaction.equals(data)

Parameters

NameTypeDescription
dataEvmTransactionishthe transaction to compare with

Returns

boolean

Implementation of

MoralisDataObject.equals


format

format(): Object

Example

transaction.format()

Returns

Object

a JSON represention of the transaction.

NameType
toundefined | string
fromstring
nonceundefined | string
gasundefined | string
gasPricestring
gasUsedstring
cumulativeGasUsedstring
blockNumberstring
valueundefined | string
chainstring | number
contractAddressundefined | string
logs{ address: string ; logIndex?: number ; transactionHash: string ; transactionIndex?: number ; data: string ; topics: string[] ; blockHash: string ; blockNumber: number ; blockTimestamp?: string }[]
blockTimestampstring
data?string
hashstring
type?number
indexnumber
blockHashstring
receiptRoot?string
receiptStatus?number

Implementation of

MoralisDataObject.format

Accessors

result

get result(): EvmTransactionData

Example

transaction.result

Returns

EvmTransactionData

the transaction


to

get to(): undefined | EvmAddress

Example

transaction.to // EvmAddress

Returns

undefined | EvmAddress

the transaction to address


from

get from(): EvmAddress

Example

transaction.address // EvmAddress

Returns

EvmAddress

the transaction from address


nonce

get nonce(): undefined | BigNumber

Example

transaction.nonce // 326595425

Returns

undefined | BigNumber

the transaction nonce


gas

get gas(): undefined | BigNumber

Example

transaction.gas // 6721975

Returns

undefined | BigNumber

the transaction gas


gasPrice

get gasPrice(): BigNumber

Example

transaction.gasPrice // 20000000000

Returns

BigNumber

the transaction gas price


gasUsed

get gasUsed(): BigNumber

Example

transaction.gasUsed // 1340925

Returns

BigNumber

the transaction gas used


cumulativeGasUsed

get cumulativeGasUsed(): BigNumber

Example

transaction.cumulativeGasUsed // 1340925

Returns

BigNumber

the transaction cumulative gas used


blockNumber

get blockNumber(): BigNumber

Example

transaction.blockNumber // 12526958

Returns

BigNumber

the transaction block number


value

get value(): undefined | EvmNative

Example

transaction.value // EvmNative

Returns

undefined | EvmNative

the transaction value


chain

get chain(): EvmChain

Example

transaction.chain // EvmChain

Returns

EvmChain

the transaction chain


contractAddress

get contractAddress(): undefined | EvmAddress

Example

transaction.contractAddress // EvmAddress

Returns

undefined | EvmAddress

the transaction contract address


logs

get logs(): EvmTransactionLog[]

Example

transaction.logs // EvmTransactionLog[]

Returns

EvmTransactionLog[]

the transaction logs


receiptRoot

get receiptRoot(): undefined | string

Example

transaction.receiptRoot // string

Returns

undefined | string

the transaction receipt root


receiptStatus

get receiptStatus(): undefined | number

Example

transaction.receiptStatus // 1

Returns

undefined | number

the transaction receipt status


data

get data(): undefined | string

Example

transaction.data // 0x000000000000000000000000000000000000000000000000000000000000002

Returns

undefined | string

the transaction data


hash

get hash(): string

Example

transaction.hash // 0x057Ec652A4F150f7FF94f089A38008f49a0DF88e

Returns

string

the transaction hash


type

get type(): undefined | number

Example

transaction.type // 1

Returns

undefined | number

the transaction type


blockHash

get blockHash(): string

Example

transaction.blockHash // 0x0372c302e3c52e8f2e15d155e2c545e6d802e479236564af052759253b20fd86

Returns

string

the transaction black hash


blockTimestamp

get blockTimestamp(): Date

Example

transaction.blockTimestamp // Date

Returns

Date

the transaction block timestamp


Did this page help you?