maia-core-sdk
Version:
⚒️ An SDK for building applications on top of Maia DAO Ecosytem
141 lines (140 loc) • 5.2 kB
TypeScript
import type { BaseTokenExtensions, OFTInfo, PeerInfo, PriceSource, StargateInfo, UlyssesInfo } from '../../../types';
import type { Currency } from '../currency';
import { NativeToken } from '../nativeToken';
/**
* A currency is any fungible financial instrument, including Ether, all ERC20 tokens, and other chain-native currencies
*/
export declare abstract class BaseCurrency {
/**
* Returns whether the currency is native to the chain and must be wrapped (e.g. Ether)
*/
abstract readonly isNative: boolean;
/**
* Returns whether the currency is a token that is usable in Uniswap without wrapping
*/
abstract readonly isToken: boolean;
/**
* Returns whether the currency is a global token that has wrappers on different chains
*/
abstract readonly isGlobal: boolean;
/**
* The chain ID on which this currency resides
*/
readonly chainId: number;
/**
* The decimals used in representing currency amounts
*/
readonly decimals: number;
/**
* The symbol of the currency, i.e. a short textual non-unique identifier
*/
readonly symbol?: string;
/**
* The name of the currency, i.e. a descriptive textual non-unique identifier
*/
readonly name?: string;
/**
* Token extensions containing bridging info, pricing, and other metadata
*/
readonly extensions?: BaseTokenExtensions;
/**
* Constructs an instance of the base class `BaseCurrency`.
* @param chainId the chain ID on which this currency resides
* @param decimals decimals of the currency
* @param symbol symbol of the currency
* @param name of the currency
* @param extensions token extensions containing bridging info, pricing, and other metadata
*/
protected constructor(chainId: number, decimals: number, symbol?: string, name?: string, extensions?: BaseTokenExtensions);
/**
* True if there is no liquidity for that token on this chain
*/
get noLiquidityOnChain(): boolean;
/**
* The price source for the token, if applicable
*/
get priceSource(): PriceSource | undefined;
/**
* True if token has OFT (Omnichain Fungible Token) configurations
*/
get isOFT(): boolean;
/**
* Get all OFT configurations for this token
*/
get oftInfo(): readonly OFTInfo[] | undefined;
/**
* Get OFT Info for a specific adapter address
* @param adapterAddress the adapter address used for LayerZero messaging
*/
getOftInfo(adapterAddress: string): OFTInfo | undefined;
/**
* Get OFT Info with least fee for a specific target chain
* @param chainId the target chain ID
*/
getBestOftInfoForChain(chainId: number): OFTInfo | undefined;
/**
* Get OFT peer info for a specific chain
* @param chainId the target chain ID
* @param adapterAddress the adapter address used for LayerZero messaging
*/
getOftPeerInfo(chainId: number, adapterAddress: string): PeerInfo | undefined;
/**
* Get the adapter address for a specific OFT peer
* @param peer the peer info object
* @returns the adapter address or the peer address if no adapter is specified
*/
getOftPeerAdapter(peer: PeerInfo): string | undefined;
/**
* Get all chain IDs that have OFT peers for this token
*/
getAllOftPeerChainIds(): number[];
/**
* Get all chain IDs that have OFT peers for this token
* @param adapterAddress the adapter address used for LayerZero messaging
*/
getOftPeerChainIds(adapterAddress: string): number[];
/**
* True if token has Stargate bridge configurations
*/
get isStargate(): boolean;
/**
* Get all Stargate configurations for this token
*/
get stargateInfo(): StargateInfo | undefined;
/**
* Get Stargate route info for a specific destination chain
* @param chainId the destination chain ID
*/
getStargateRoute(chainId: number): StargateInfo['routes'][number] | undefined;
/**
* Get all chain IDs that have Stargate routes for this token
*/
getStargateRouteChainIds(): number[];
/**
* True if token has Ulysses bridging info
*/
get isUlysses(): boolean;
/**
* Get Ulysses bridging info
*/
get ulyssesInfo(): UlyssesInfo | undefined;
/**
* Get Ulysses local address for a specific chain
* @param chainId the target chain ID
*/
getUlyssesLocalAddress(chainId: number): string | undefined;
/**
* Get all chain IDs that have Ulysses local addresses
*/
getUlyssesChainIds(): number[];
/**
* Returns whether this currency is functionally equivalent to the other currency
* @param other the other currency
*/
abstract equals(other: Currency): boolean;
/**
* Return the wrapped version of this currency that can be used with the Uniswap contracts. Currencies must
* implement this to be used in Uniswap
*/
abstract get wrapped(): NativeToken;
}