import { BaseCurrency, type SerializableErc20TokenType } from './base-currency.js'; /** * The address of the native token on the Ethereum chain */ export const NATIVE_TOKEN_ADDRESS = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' as const; type NativeCurrencyParamsType = { chainId: number; decimals: number; symbol: string; name: string; }; /** * Represents the native currency of the chain on which it resides, e.g. */ export abstract class NativeCurrency extends BaseCurrency { public readonly address = NATIVE_TOKEN_ADDRESS; public readonly isNative: true = true as const; public readonly isToken: false = false as const; constructor(params: NativeCurrencyParamsType) { super(params); } } export function nativeCurrencyToSerializableErc20TokenType(currency: NativeCurrency): SerializableErc20TokenType { return { address: currency.address, chainId: currency.chainId, decimals: currency.decimals, symbol: currency.symbol, name: currency.name, }; }