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