Class: EvmTransaction
moralis-monorepo / @moralisweb3/common-evm-utils / EvmTransaction
Class: EvmTransaction
@moralisweb3/common-evm-utils.EvmTransaction
The EvmTransaction is a representation of a published transaction.
Use this class any time you work with a transaction.
Hierarchy
EvmTransaction
Table of contents
Methods
Accessors
- blockHash
- blockNumber
- blockTimestamp
- chain
- contractAddress
- cumulativeGasUsed
- data
- from
- gas
- gasPrice
- gasUsed
- hash
- index
- internalTransactions
- logs
- nonce
- r
- receiptRoot
- receiptStatus
- result
- s
- signature
- to
- v
- value
Constructors
Properties
Methods
create
▸ Static
create(data
): EvmTransaction
Create a new instance of EvmTransaction from any valid transaction input
Example
const transaction = EvmTransaction.create(data);
Parameters
Name | Type | Description |
---|---|---|
data | EvmTransactionish | the EvmTransactionish type |
Returns
equals
▸ Static
equals(dataA
, dataB
): boolean
Check the equality between two Evm transactions
Example
EvmTransaction.equals(dataA, dataB)
Parameters
Name | Type | Description |
---|---|---|
dataA | EvmTransactionish | The first transaction |
dataB | EvmTransactionish | The second transaction |
Returns
boolean
parse
▸ Static
parse(data
): EvmTransactionData
Parameters
Name | Type |
---|---|
data | EvmTransactionInput |
Returns
equals
▸ equals(data
): boolean
Checks the equality of the current transaction with another evm transaction
Example
transaction.equals(data)
Parameters
Name | Type | Description |
---|---|---|
data | EvmTransactionish | the transaction to compare with |
Returns
boolean
format
▸ format(): Object
Deprecated
This method will be removed soon. To format the value, use one of the properties.
Returns
Object
Name | Type |
---|---|
blockHash | string |
blockNumber | string |
blockTimestamp | string |
chain | string |
contractAddress | undefined | string |
cumulativeGasUsed | string |
data? | string |
from | string |
gas | undefined | string |
gasPrice | string |
gasUsed | string |
hash | string |
index | string | number |
internalTransactions | EvmInternalTransactionJSON [] |
logs | { address : string ; blockHash : string ; blockNumber : number ; blockTimestamp? : string ; chain : string ; data : string ; logIndex? : number ; topics : (null | string )[] ; transactionHash : string ; transactionIndex? : number }[] |
nonce | undefined | string |
receiptRoot? | string |
receiptStatus? | number |
signature | undefined | MoralisDataObjectValue |
to | undefined | string |
value | undefined | string |
toJSON
▸ toJSON(): Object
Returns
Object
Name | Type |
---|---|
blockHash | string |
blockNumber | string |
blockTimestamp | string |
chain | string |
contractAddress | undefined | string |
cumulativeGasUsed | string |
data? | string |
from | string |
gas | undefined | string |
gasPrice | string |
gasUsed | string |
hash | string |
index | string | number |
internalTransactions | EvmInternalTransactionJSON [] |
logs | { address : string ; blockHash : string ; blockNumber : number ; blockTimestamp? : string ; chain : string ; data : string ; logIndex? : number ; topics : (null | string )[] ; transactionHash : string ; transactionIndex? : number }[] |
nonce | undefined | string |
receiptRoot? | string |
receiptStatus? | number |
signature | undefined | MoralisDataObjectValue |
to | undefined | string |
value | undefined | string |
Accessors
blockHash
• get
blockHash(): string
Example
transaction.blockHash // 0x0372c302e3c52e8f2e15d155e2c545e6d802e479236564af052759253b20fd86
Returns
string
the transaction black hash
blockNumber
• get
blockNumber(): BigNumber
Example
transaction.blockNumber // 12526958
Returns
BigNumber
the transaction block number
blockTimestamp
• get
blockTimestamp(): Date
Example
transaction.blockTimestamp // Date
Returns
Date
the transaction block timestamp
chain
• get
chain(): EvmChain
Example
transaction.chain // EvmChain
Returns
the transaction chain
contractAddress
• get
contractAddress(): undefined
| EvmAddress
Example
transaction.contractAddress // EvmAddress
Returns
undefined
| EvmAddress
the transaction contract address
cumulativeGasUsed
• get
cumulativeGasUsed(): BigNumber
Example
transaction.cumulativeGasUsed // 1340925
Returns
BigNumber
the transaction cumulative gas used
data
• get
data(): undefined
| string
Example
transaction.data // 0x000000000000000000000000000000000000000000000000000000000000002
Returns
undefined
| string
the transaction data
from
• get
from(): EvmAddress
Example
transaction.address // EvmAddress
Returns
the transaction from address
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
hash
• get
hash(): string
Example
transaction.hash // 0x057Ec652A4F150f7FF94f089A38008f49a0DF88e
Returns
string
the transaction hash
index
• get
index(): string
| number
Example
transaction.index // 1
Returns
string
| number
the index
internalTransactions
• get
internalTransactions(): EvmInternalTransaction
[]
Example
transaction.logs // EvmInternalTransaction[]
Returns
the internal transactions
logs
• get
logs(): EvmTransactionLog
[]
Example
transaction.logs // EvmTransactionLog[]
Returns
the transaction logs
nonce
• get
nonce(): undefined
| BigNumber
Example
transaction.nonce // 326595425
Returns
undefined
| BigNumber
the transaction nonce
r
• get
r(): undefined
| string
Returns
undefined
| string
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
result
• get
result(): EvmTransactionData
Example
transaction.result
Returns
the transaction
s
• get
s(): undefined
| string
Returns
undefined
| string
signature
• get
signature(): undefined
| EvmSignature
Example
transaction.signature // EvmSignature
Returns
undefined
| EvmSignature
the signature (if available)
to
• get
to(): undefined
| EvmAddress
Example
transaction.to // EvmAddress
Returns
undefined
| EvmAddress
the transaction to address
v
• get
v(): undefined
| number
Returns
undefined
| number
value
• get
value(): undefined
| EvmNative
Example
transaction.value // EvmNative
Returns
undefined
| EvmNative
the transaction value
Constructors
constructor
• new EvmTransaction(data
)
Parameters
Name | Type |
---|---|
data | EvmTransactionInput |
Properties
_data
• Protected
_data: EvmTransactionData