Ether

Ether represents the ETH native currency on chains which do not implement their own native currencies (i.e. ARB, Linea, etc.).

GitHub File: ether.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.

Private

PropertyTypeModifierDescription

_etherCache

Ether

static

Object to store Ether information across instances of this class.

Constructor

Parameters

ParamsTypeDescription

chainId

number

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

Methods

wrapped() - public get

Accessor that returns the ERC20 wrapped version of Ether. Note that the token information for the nativeCurrency are stored in weth.ts.

Note that the invariant function will throw if a falsy value is detected. Refer to tiny-invariant package for more details.

Returns

TypeDescription

Token

The wrapped ERC20 token of Ether.


onChain() - public static

Returns the Ethers instance for the chainId provided.

Parameters

ParamsTypeDescription

chainId

number

The chain ID of the Ether instance being queried.

Returns

TypeDescription

Ether

The Ether instance on the chainId provided.


equals() - public

Returns whether the currency passed in the argument is functionally equivalent to the Ether instance (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 Ether instance.

Last updated