Skip to main content

Class: Erc20Approval

moralis-monorepo / @moralisweb3/common-evm-utils / Erc20Approval

Class: Erc20Approval

@moralisweb3/common-evm-utils.Erc20Approval

The Erc20Approval is a representation of an Erc20 token approval.

Implements

  • MoralisDataObject

Table of contents

Methods

Accessors

Constructors

Methods

create

Static create(data): Erc20Approval

Create a new instance of Erc20Approval from any valid input

Example

const approval = Erc20Approval.create(data);

Parameters

NameTypeDescription
dataErc20ApprovalInput | Erc20ApprovalErc20Approval instance or valid Erc20ApprovalInput

Returns

Erc20Approval


equals

Static equals(dataA, dataB): boolean

Check the equality between two Erc20 approvals

Example

Erc20Approval.equals(dataA, dataB)

Parameters

NameTypeDescription
dataAErc20ApprovalInput | Erc20ApprovalThe first approval to compare
dataBErc20ApprovalInput | Erc20ApprovalThe second approval to compare

Returns

boolean

true if the approvals are equal, false otherwise


parse

Static parse(data): Erc20ApprovalData

Parameters

NameType
dataErc20ApprovalInput

Returns

Erc20ApprovalData


equals

equals(data): boolean

Checks the equality of the current approval with another erc20 approval

Example

approval.equals(data)

Parameters

NameTypeDescription
dataErc20ApprovalInput | Erc20Approvalthe approval to compare with

Returns

boolean

true if the approvals 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

NameType
blockHashstring
blockNumberstring
blockTimestampDate
chainstring
contractAddressstring
fromWalletstring
logIndexnumber
possibleSpamboolean
toWalletstring
tokenDecimalsnumber
tokenLogo?string
tokenNamestring
tokenSymbolstring
transactionHashstring
transactionIndexnumber
valuestring

Implementation of

MoralisDataObject.format


toJSON

toJSON(): Object

Example

approval.toJSON()

Returns

Object

a JSON representation of the approval.

NameType
blockHashstring
blockNumberstring
blockTimestampDate
chainstring
contractAddressstring
fromWalletstring
logIndexnumber
possibleSpamboolean
toWalletstring
tokenDecimalsnumber
tokenLogo?string
tokenNamestring
tokenSymbolstring
transactionHashstring
transactionIndexnumber
valuestring

Implementation of

MoralisDataObject.toJSON

Accessors

blockHash

get blockHash(): string

Example

approval.blockHash // "0x0372c302e3c52e8f2e15d155e2c545e6d802e479236564af052759253b20fd86"

Returns

string

the block hash of the approval


blockNumber

get blockNumber(): BigNumber

Example

approval.blockNumber // BigNumber

Returns

BigNumber

the block number of the approval


blockTimestamp

get blockTimestamp(): Date

Example

approval.blockTimestamp // Date

Returns

Date

the block timestamp of the approval


chain

get chain(): EvmChain

Example

approval.chain // EvmChain

Returns

EvmChain

the chain of the approval


contractAddress

get contractAddress(): EvmAddress

Example

approval.contractAddress // EvmAddress

Returns

EvmAddress

the contractAddress of the approval


fromWallet

get fromWallet(): EvmAddress

Example

approval.fromWallet // EvmAddress

Returns

EvmAddress

the fromWallet of the approval


logIndex

get logIndex(): number

Example

approval.logIndex // 2

Returns

number

the logIndex of the approval


possibleSpam

get possibleSpam(): boolean

Example

transfer.possibleSpam // true

Returns

boolean

possibility of the token being a spam token


result

get result(): Erc20ApprovalData

Example

approval.result

Returns

Erc20ApprovalData

all the data without casting it to JSON.


toWallet

get toWallet(): EvmAddress

Example

approval.toWallet // EvmAddress

Returns

EvmAddress

the toWallet of the approval


tokenDecimals

get tokenDecimals(): number

Example

burn.tokenDecimals // 18

Returns

number

The decimals of the token.


get tokenLogo(): undefined | string

Example

burn.tokenLogo // "https://cdn.moralis.io/eth/0x67b6d479c7bb412c54e03dca8e1bc6740ce6b99c.png"

Returns

undefined | string

The logo of the token


tokenName

get tokenName(): string

Example

burn.tokenName // "Kylin Network"

Returns

string

The name of the token.


tokenSymbol

get tokenSymbol(): string

Example

burn.tokenSymbol // "KYL"

Returns

string

The symbol of the token.


transactionHash

get transactionHash(): string

Example

approval.transactionHash // "0x0372c302e3c52e8f2e15d155e2c545e6d802e479236564af052759253b20fd86"

Returns

string

the transaction hash of the approval


transactionIndex

get transactionIndex(): number

Example

approval.transactionIndex // 3

Returns

number

the transactionIndex of the approval


value

get value(): BigNumber

Example

approval.value // BigNumber

Returns

BigNumber

the value of the approval

Constructors

constructor

new Erc20Approval(data)

Parameters

NameType
dataErc20ApprovalInput