NativeCurrency

NativeCurrency represents the currency of the chain on which it resides (i.e. the currency which is used to pay for gas on a particular chain). The NativeCurrency class ensures the equivalence of any native currency for the purposes of trades or queries.

GitHub File: nativeCurrency.ts

Extends

Properties

Public

PropertyTypeModifierDescription

chainId

readonly

The chain ID on which this currency resides. See supported chains.

chainType

readonly

The virtual machine environment. Currently supports EVM only.

decimals

number

readonly

Number of decimals for the currency.

symbol

string

readonly

The currency symbol. Optional.

name

string

readonly

The currency name. Optional.

isNative

boolean

readonly

Whether the currency is native to the chain and must be wrapped.

isToken

boolean

readonly

Whether the currency meets the ERC20 standard and if not, needs to be wrapped.

Constructor

Parameters

ParamsTypeDescription

chainId

number

The chain ID on which this currency resides. See supported chains.

decimals

number

Number of decimals for the currency.

symbol

string

The currency symbol. Optional.

name

string

The currency name. Optional.

Methods

wrapped() - get

Returns the ERC20 wrapped version of the native currency. Note that the token information for the nativeCurrency are stored in weth.ts.

Returns

TypeDescription

Token

The wrapped ERC20 token of the nativeCurrency.


equals()

Returns whether the currency passed in the argument is functionally equivalent to the native currency (i.e. the currency is tagged as a nativeCurrency and the chainIds are the same).

Parameters

ParamsTypeDescription

other

The currency to check against.

Returns

TypeDescription

boolean

Indicates whether the currency passed in the argument is functionally equivalent to the native currency.

Last updated