import { AssetType, ChainId } from 'caip'; import { Chain } from 'viem'; import { Asset, AssetEntity, AssetId, BalanceBigInt, Decimals, Symbol } from './types'; /** * Gets all supported assets * * Assets are aggregated by their id, which is a CAIP-19 identifier for the asset. * Each asset can have multiple aggregated entities, which are the different ways the asset can be represented on different chains. * Each aggregated entity has a CAIP-19 identifier for the asset type, which is a combination of the chainId and the asset type. * The asset type is a combination of the namespace and the reference. * The namespace is the type of asset, e.g. 'erc20' for ERC-20 tokens, 'slip44' for native assets. * The reference is the identifier for the asset, e.g. the contract address for ERC-20 tokens, the coin type for native assets. * * @returns All supported assets */ export declare function getSupportedAssets(): Asset[]; /** * Gets an asset by its id * * @param id - The id of the asset * @returns The asset or undefined if not found */ export declare function getAssetByid(id: AssetId): Asset | undefined; /** * Gets an asset by its assetType * * @param assetType - The assetType of the asset * @returns The asset or undefined if not found */ export declare function getAssetByAssetType(assetType: AssetType): Asset | undefined; /** * Gets an asset by its symbol * * @param symbol - The symbol of the asset (case-insensitive) * @returns The asset or undefined if not found */ export declare function getAssetBySymbol(symbol: Symbol): Asset | undefined; /** Minimal chain/spec shape required for native asset lookup */ type ChainLike = { nativeCurrency: { symbol: Symbol; }; }; /** * Gets a native asset for a chain or chain specification * * Accepts either a viem Chain or ChainSpecification (e.g. for Bitcoin chains * that don't have a viem Chain). * * @param chainOrSpec - Chain or spec with nativeCurrency.symbol * @returns Asset - Native asset */ export declare function getNativeAsset(chainOrSpec: Chain | ChainLike): Asset; /** * Gets an entity by chainId * * @param asset - The asset * @param chainId - The chainId * @returns The entity or undefined if not found */ export declare function getEntityByChainId(asset: Asset, chainId: ChainId): AssetEntity | undefined; /** * Checks if an asset is an ERC-20 token * * @param asset - The asset * @param chainId - The chain we're checking on * @returns Whether the asset is an ERC-20 token */ export declare function isErc20Token(asset: Asset, chainId: ChainId): boolean; /** * Checks if an asset is a native asset (uses slip44 namespace) * * Native assets are identified by the 'slip44' namespace in their asset type. * Examples include ETH, MATIC, and other native blockchain currencies. * * @param asset - The asset to check * @param chainId - The chain we're checking on * @returns Whether the asset is a native asset */ export declare function isNativeAsset(asset: Asset, chainId: ChainId): boolean; /** * Validates an asset's decimal configuration * * Checks that the parent decimals and every entity's decimals are * non-negative integers. * * @param asset - The asset to validate * @throws {InvalidAssetDecimalsError} If any decimals value is invalid */ export declare function validateAssetDecimals(asset: Asset): void; /** * Validates that an asset and its entities have complete metadata. * * Checks: * - Parent-level id, symbol, name are present and non-empty * - At least one entity exists * - All decimal values (parent + every entity) are valid * - Every entity has a non-empty symbol and name * * Per-entity values are allowed to differ from the parent (the data * model supports chain-specific naming), but they must be present. * * @param asset - The asset to validate * @throws {InvalidAssetDecimalsError} If any decimals value is invalid * @throws {InvalidAssetMetadataError} If required metadata fields are missing */ export declare function validateAssetMetadata(asset: Asset): void; /** * Normalises a raw balance from one decimal basis to another * * Converts a BigInt amount expressed in `sourceDecimals` precision to * the equivalent amount in `targetDecimals` precision. * * - When target > source the value is scaled up (lossless). * - When target < source the value is scaled down via integer * division (deterministic truncation toward zero). * - When target === source the value is returned unchanged. * * @param amount - Raw balance in source decimal precision * @param sourceDecimals - Decimal places of the input amount * @param targetDecimals - Decimal places of the desired output * @returns The normalised balance * @throws {InvalidAssetDecimalsError} If either decimal value is invalid */ export declare function normaliseBalance(amount: BalanceBigInt, sourceDecimals: Decimals, targetDecimals: Decimals): BalanceBigInt; export {};