Skip to main content

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

Constructors

Methods

create

Static create(data): Erc20Transfer

Create a new instance of Erc20Transfer from any valid input

Example

const transfer = Erc20Transfer.create(data);

Parameters

NameTypeDescription
dataErc20Transferishthe Erc20Transferish type

Returns

Erc20Transfer


equals

Static equals(dataA, dataB): boolean

Check the equality between two Erc20 transfers

Example

Erc20Transfer.equals(dataA, dataB)

Parameters

NameTypeDescription
dataAErc20TransferishThe first transfer to compare
dataBErc20TransferishThe second transfer to compare

Returns

boolean

true if the transfers are equal, false otherwise


parse

Static parse(data): Erc20TransferData

Parameters

NameType
dataErc20TransferInput

Returns

Erc20TransferData


equals

equals(data): boolean

Checks the equality of the current trnasfer with another erc20 trnasfer

Example

transfer.equals(data)

Parameters

NameTypeDescription
dataErc20Transferishthe 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.

NameType
addressstring
blockHashstring
blockNumberstring
blockTimestampDateInput
chainstring | number
fromAddressstring
logIndexnumber
toAddressstring
transactionHashstring
transactionIndexnumber
valuestring

Implementation of

MoralisDataObject.format


toJSON

toJSON(): Object

Example

transfer.toJSON()

Returns

Object

a JSON represention of the transfer.

NameType
addressstring
blockHashstring
blockNumberstring
blockTimestampDateInput
chainstring | number
fromAddressstring
logIndexnumber
toAddressstring
transactionHashstring
transactionIndexnumber
valuestring

Implementation of

MoralisDataObject.toJSON

Accessors

address

get address(): EvmAddress

Example

transfer.address // EvmAddress

Returns

EvmAddress

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

EvmChain

the chain of the tranfer


fromAddress

get fromAddress(): EvmAddress

Example

transfer.fromAddress // EvmAddress

Returns

EvmAddress

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

Erc20TransferData

all the data without casting it to JSON.


toAddress

get toAddress(): EvmAddress

Example

transfer.toAddress // EvmAddress

Returns

EvmAddress

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

NameType
dataErc20TransferInput