import { type Address } from "viem"; import type { EVault } from "../../../entities/EVault.js"; import type { EulerEarn } from "../../../entities/EulerEarn.js"; import type { SecuritizeCollateralVault } from "../../../entities/SecuritizeCollateralVault.js"; import type { FetchAllVaultsArgs, IVaultService, VaultFetchOptions } from "../index.js"; import type { IVaultTypeAdapter } from "./adapters/IVaultTypeAdapter.js"; import type { StandardEVaultPerspectives } from "../eVaultService/index.js"; import type { StandardEulerEarnPerspectives } from "../eulerEarnService/index.js"; import type { ServiceResult } from "../../../utils/entityDiagnostics.js"; export type VaultMetaPerspective = StandardEulerEarnPerspectives | StandardEVaultPerspectives | Address; /** Default union of vault entity types (EVault, Euler Earn, SecuritizeCollateral). Extend this when registering additional vault services. */ export type VaultEntity = EVault | EulerEarn | SecuritizeCollateralVault; /** Type guard: narrows VaultEntity to EVault. */ export declare function isEVault(v: unknown): v is EVault; /** Type guard: narrows VaultEntity to EulerEarn. */ export declare function isEulerEarn(v: unknown): v is EulerEarn; /** Type guard: narrows VaultEntity to SecuritizeCollateralVault. */ export declare function isSecuritizeCollateralVault(v: unknown): v is SecuritizeCollateralVault; /** A vault service that can be registered with VaultMetaService. Use TEntity to extend the meta service return type (e.g. EVault | EulerEarn | CustomVault). */ export type RegisteredVaultService = IVaultService; /** Extendable vault type: built-in (e.g. VaultType.EVault, VaultType.EulerEarn) or custom string when adding vault services with a type. */ export type VaultTypeString = string; /** A vault service optionally tagged with a type for getFactoryByType(chainId, type). Use { type, service } when adding custom vault types. */ export type VaultServiceEntry = RegisteredVaultService | { type: VaultTypeString; service: RegisteredVaultService; }; /** Meta vault service; TEntity is the union of all registered vault entity types (default EVault | EulerEarn). Extend with a wider union when registering more services. */ export interface IVaultMetaService extends Omit, "factory"> { /** Register a vault service; use { type, service } to make the type available to getFactoryByType(chainId, type). */ registerVaultService(entry: VaultServiceEntry): void; /** Returns vault type for the given vault address, or undefined if unknown. */ fetchVaultType(chainId: number, vault: Address): Promise; /** Returns vault types for the given vault addresses (keyed by normalized vault address). */ fetchVaultTypes(chainId: number, vaults: Address[]): Promise>>; /** Returns the factory address for the given chain and vault type, or undefined if the type is not registered. */ getFactoryByType(chainId: number, type: VaultTypeString): Address | undefined; } export interface VaultMetaServiceConfig { vaultTypeAdapter: IVaultTypeAdapter; /** Initial vault services. Use { type, service } to register a vault type for getFactoryByType(chainId, type). */ vaultServices?: VaultServiceEntry[]; } export declare class VaultMetaService implements IVaultMetaService { private config; private readonly vaultServicesList; private readonly typeToService; private readonly serviceToType; constructor(config: VaultMetaServiceConfig); setVaultTypeAdapter(adapter: IVaultTypeAdapter): void; /** Register a vault service; use { type, service } to make the type available to getFactoryByType(chainId, type). */ registerVaultService(entry: VaultServiceEntry): void; private get vaultServices(); private getFactoryToServiceMap; private getServiceByResolvedType; private getServiceLabel; private fetchVaultToService; getFactoryByType(chainId: number, type: string): Address | undefined; fetchVault(chainId: number, vault: Address, options?: VaultFetchOptions): Promise>; fetchVaultType(chainId: number, vault: Address): Promise; fetchVaultTypes(chainId: number, vaults: Address[]): Promise>>; fetchVaults(chainId: number, vaults: Address[], options?: VaultFetchOptions): Promise>; fetchVerifiedVaultAddresses(chainId: number, perspectives: VaultMetaPerspective[]): Promise; fetchVerifiedVaults(chainId: number, perspectives: VaultMetaPerspective[], options?: VaultFetchOptions): Promise>; /** * Fetches all discoverable vaults across registered vault services. * The optional async `filter` runs after the first fetch in each service and before populate/enrichment work, * so rejected vaults are skipped before additional resources are spent on them. */ fetchAllVaults(chainId: number, args?: FetchAllVaultsArgs): Promise>; } //# sourceMappingURL=vaultMetaService.d.ts.map