Class: Erc20Token

moralis-monorepo / @moralisweb3/evm-utils / Erc20Token

Class: Erc20Token

@moralisweb3/evm-utils.Erc20Token

The Erc20Token class is a MoralisData that references to a Erc20 Token
It holds data about the data and metadata of an Erc20 token

Implements

  • MoralisDataObject

Table of contents

Methods

Accessors

Methods

create

Static create(value, core?): Erc20Token

Create a new instance of Erc20Token from any valid Erc20Token input

Example

const token = Erc20Token.create(value);

Parameters

NameTypeDescription
valueErc20Tokenishthe Erc20Tokenish type
core?MoralisCore-

Returns

Erc20Token


equals

Static equals(valueA, valueB): boolean

Compares two Erc20Token instances. This checks if the chain and contractAddress of both tokens are equal.

Example

Erc20Token.equals(valueA, valueB);

Parameters

NameTypeDescription
valueAErc20Tokenishthe first Erc20Token to compare
valueBErc20Tokenishthe second Erc20Token to compare

Returns

boolean

true if the two Erc20Tokens are equal


equals

equals(value): boolean

Compares Erc20Token instance to current instance

Example

token.equals(value);

Parameters

NameTypeDescription
valueErc20Tokenishthe Erc20Tokenish to compare

Returns

boolean

true if the Erc20Token is equals given token

Implementation of

MoralisDataObject.equals


toJSON

toJSON(): Object

Returns the token as JSON

Example

token.toJSON();

Returns

Object

the Erc20Token as a JSON object

NameType
contractAddressstring
chainstring | number
decimalsnumber
namestring
symbolstring
logo?null | string
logoHash?null | string
thumbnail?null | string

Implementation of

MoralisDataObject.toJSON


format

format(): Object

Returns the token as JSON

Example

token.format();

Returns

Object

the Erc20Token as a JSON object

NameType
contractAddressstring
chainstring | number
decimalsnumber
namestring
symbolstring
logo?null | string
logoHash?null | string
thumbnail?null | string

Implementation of

MoralisDataObject.format

Accessors

result

get result(): Erc20Data

Returns the processed Erc20Token.

Example

token.result;

Returns

Erc20Data

the Erc20Token value


decimals

get decimals(): number

Example

token.decimals;

Returns

number

the decimals of the token.


name

get name(): string

Example

token.name;

Returns

string

The name of the token.


symbol

get symbol(): string

Example

token.symbol;

Returns

string

The symbol of the token.


contractAddress

get contractAddress(): EvmAddress

Example

token.contractAddress;

Returns

EvmAddress

The contract address of the token.


chain

get chain(): EvmChain

Example

token.chain;

Returns

EvmChain

The chain of the token.


logo

get logo(): undefined | null | string

Example

token.logo;

Returns

undefined | null | string

The logo of the token.


logoHash

get logoHash(): undefined | null | string

Example

token.logoHash;

Returns

undefined | null | string

The logo hash of the token.


thumbnail

get thumbnail(): undefined | null | string

Example

token.thumbnail;

Returns

undefined | null | string

The thumbnail of the token.


Did this page help you?