Class: Erc20Transaction
moralis-monorepo / @moralisweb3/common-evm-utils / Erc20Transaction
Class: Erc20Transaction
@moralisweb3/common-evm-utils.Erc20Transaction
The Erc20Transaction is a representation of an Erc20 token transaction.
Implements
MoralisDataObject
Table of contents
Methods
Accessors
- address
- blockHash
- blockNumber
- blockTimestamp
- chain
- contractAddress
- fromAddress
- fromWallet
- logIndex
- possibleSpam
- result
- toAddress
- toWallet
- transactionHash
- transactionIndex
- value
Constructors
Methods
create
▸ Static
create(data
): Erc20Transaction
Create a new instance of Erc20Transaction from any valid input
Example
const transfer = Erc20Transaction.create(data);
Parameters
Name | Type | Description |
---|---|---|
data | Erc20Transactionish | the Erc20Transactionish type |
Returns
equals
▸ Static
equals(dataA
, dataB
): boolean
Check the equality between two Erc20 transfers
Example
Erc20Transaction.equals(dataA, dataB)
Parameters
Name | Type | Description |
---|---|---|
dataA | Erc20Transactionish | The first transfer to compare |
dataB | Erc20Transactionish | The second transfer to compare |
Returns
boolean
true if the transfers are equal, false otherwise
parse
▸ Static
parse(data
): Erc20TransactionData
Parameters
Name | Type |
---|---|
data | Erc20TransactionInput |
Returns
equals
▸ equals(data
): boolean
Checks the equality of the current trnasfer with another erc20 trnasfer
Example
transfer.equals(data)
Parameters
Name | Type | Description |
---|---|---|
data | Erc20Transactionish | the transfer to compare with |
Returns
boolean
true if the transfers are equal, false otherwise
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
Name | Type |
---|---|
address | string |
blockHash | string |
blockNumber | string |
blockTimestamp | Date |
chain | string |
fromAddress | string |
logIndex | number |
possibleSpam | boolean |
toAddress | string |
transactionHash | string |
transactionIndex | number |
value | string |
Implementation of
MoralisDataObject.format
toJSON
▸ toJSON(): Object
Example
transfer.toJSON()
Returns
Object
a JSON represention of the transfer.
Name | Type |
---|---|
address | string |
blockHash | string |
blockNumber | string |
blockTimestamp | Date |
chain | string |
fromAddress | string |
logIndex | number |
possibleSpam | boolean |
toAddress | string |
transactionHash | string |
transactionIndex | number |
value | string |
Implementation of
MoralisDataObject.toJSON
Accessors
address
• get
address(): EvmAddress
Example
transfer.address // EvmAddress
Returns
the contract address of the transfer
blockHash
• get
blockHash(): string
Example
transfer.blockHash // "0x0372c302e3c52e8f2e15d155e2c545e6d802e479236564af052759253b20fd86"
Returns
string
the block hash of the transfer
blockNumber
• get
blockNumber(): BigNumber
Example
transfer.blockNumber // BigNumber
Returns
BigNumber
the block number of the transfer
blockTimestamp
• get
blockTimestamp(): Date
Example
transfer.blockTimestamp // Date
Returns
Date
the block timestamp of the transfer
chain
• get
chain(): EvmChain
Example
transfer.chain // EvmChain
Returns
the chain of the transfer
contractAddress
• get
contractAddress(): EvmAddress
Example
transfer.contractAddress // EvmAddress
Returns
the contract address of the transfer
fromAddress
• get
fromAddress(): EvmAddress
Example
transfer.fromAddress // EvmAddress
Returns
the from address of the transfer
fromWallet
• get
fromWallet(): EvmAddress
Example
transfer.fromWallet // EvmAddress
Returns
the from address of the transfer
logIndex
• get
logIndex(): number
Example
transfer.logIndex // 2
Returns
number
the logIndex of the transfer
possibleSpam
• get
possibleSpam(): boolean
Example
transfer.possibleSpam // true
Returns
boolean
possibility of the token being a spam token
result
• get
result(): Erc20TransactionData
Example
transfer.result
Returns
all the data without casting it to JSON.
toAddress
• get
toAddress(): EvmAddress
Example
transfer.toAddress // EvmAddress
Returns
the to address of the transfer
toWallet
• get
toWallet(): EvmAddress
Example
transfer.toWallet // EvmAddress
Returns
the to address of the transfer
transactionHash
• get
transactionHash(): string
Example
transfer.transactionHash // "0x0372c302e3c52e8f2e15d155e2c545e6d802e479236564af052759253b20fd86"
Returns
string
the transaction hash of the transfer
transactionIndex
• get
transactionIndex(): number
Example
transfer.transactionIndex // 3
Returns
number
the transactionIndex of the transfer
value
• get
value(): BigNumber
Example
transfer.value // BigNumber
Returns
BigNumber
the value of the transfer
Constructors
constructor
• new Erc20Transaction(data
)
Parameters
Name | Type |
---|---|
data | Erc20TransactionInput |