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
- blockHash
- blockNumber
- blockTimestamp
- chain
- contractAddress
- fromWallet
- logIndex
- possibleSpam
- result
- toWallet
- tokenDecimals
- tokenLogo
- tokenName
- tokenSymbol
- transactionHash
- transactionIndex
- value
Constructors
Methods
create
▸ Static
create(data
): Erc20Approval
Create a new instance of Erc20Approval from any valid input
Example
const approval = Erc20Approval.create(data);
Parameters
Name | Type | Description |
---|---|---|
data | Erc20ApprovalInput | Erc20Approval | Erc20Approval instance or valid Erc20ApprovalInput |
Returns
equals
▸ Static
equals(dataA
, dataB
): boolean
Check the equality between two Erc20 approvals
Example
Erc20Approval.equals(dataA, dataB)
Parameters
Name | Type | Description |
---|---|---|
dataA | Erc20ApprovalInput | Erc20Approval | The first approval to compare |
dataB | Erc20ApprovalInput | Erc20Approval | The second approval to compare |
Returns
boolean
true if the approvals are equal, false otherwise
parse
▸ Static
parse(data
): Erc20ApprovalData
Parameters
Name | Type |
---|---|
data | Erc20ApprovalInput |
Returns
equals
▸ equals(data
): boolean
Checks the equality of the current approval with another erc20 approval
Example
approval.equals(data)
Parameters
Name | Type | Description |
---|---|---|
data | Erc20ApprovalInput | Erc20Approval | the 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
Name | Type |
---|---|
blockHash | string |
blockNumber | string |
blockTimestamp | Date |
chain | string |
contractAddress | string |
fromWallet | string |
logIndex | number |
possibleSpam | boolean |
toWallet | string |
tokenDecimals | number |
tokenLogo? | string |
tokenName | string |
tokenSymbol | string |
transactionHash | string |
transactionIndex | number |
value | string |
Implementation of
MoralisDataObject.format
toJSON
▸ toJSON(): Object
Example
approval.toJSON()
Returns
Object
a JSON representation of the approval.
Name | Type |
---|---|
blockHash | string |
blockNumber | string |
blockTimestamp | Date |
chain | string |
contractAddress | string |
fromWallet | string |
logIndex | number |
possibleSpam | boolean |
toWallet | string |
tokenDecimals | number |
tokenLogo? | string |
tokenName | string |
tokenSymbol | string |
transactionHash | string |
transactionIndex | number |
value | string |
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
the chain of the approval
contractAddress
• get
contractAddress(): EvmAddress
Example
approval.contractAddress // EvmAddress
Returns
the contractAddress of the approval
fromWallet
• get
fromWallet(): EvmAddress
Example
approval.fromWallet // EvmAddress
Returns
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
all the data without casting it to JSON.
toWallet
• get
toWallet(): EvmAddress
Example
approval.toWallet // EvmAddress
Returns
the toWallet of the approval
tokenDecimals
• get
tokenDecimals(): number
Example
burn.tokenDecimals // 18
Returns
number
The decimals of the token.
tokenLogo
• 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
Name | Type |
---|---|
data | Erc20ApprovalInput |