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
Property | Type | Modifier | Description |
---|---|---|---|
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
Property | Type | Modifier | Description |
---|---|---|---|
_etherCache | Ether | static | Object to store Ether information across instances of this class. |
Constructor
Parameters
Params | Type | Description |
---|---|---|
chainId | number | The chain ID on which this currency resides. See supported chains. |
Methods
wrapped() - public
get
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
Type | Description |
---|---|
Token | The wrapped ERC20 token of Ether. |
onChain() - public
static
public
static
Returns the Ethers instance for the chainId provided.
Parameters
Params | Type | Description |
---|---|---|
chainId | number | The chain ID of the Ether instance being queried. |
Returns
Type | Description |
---|---|
Ether | The Ether instance on the chainId provided. |
equals() - public
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
Params | Type | Description |
---|---|---|
other | The currency to check against. |
Returns
Type | Description |
---|---|
boolean | Indicates whether the currency passed in the argument is functionally equivalent to the Ether instance. |
Last updated