/** * ByzantineClient — top-level entry point for the SDK. * * Responsibilities: * - Vault factory: create a vault and obtain a `Vault` instance * - Adapter factory & lookup (delegates to AdaptersFactoryClient) * - Adapter introspection (delegates to AdaptersClient) * - Network / chain helpers * * For per-vault operations, call `client.vault(address)` to get a `Vault` * instance; everything else lives there. */ import { type ethers } from "ethers"; import type { ChainsOptions, NetworkConfig } from "../types"; import { ContractProvider } from "../utils"; import { Vault } from "../Vault"; import type { AdapterInstance, AdapterType, CometState, DeployAdapterResult, ERC4626VaultState, MarketParams, MorphoMarketState } from "./adapters"; export interface CreateVaultResult extends ethers.ContractTransactionResponse { vaultAddress: string; /** Vault instance ready to use once the tx is mined. */ vault: Vault; } export declare class ByzantineClient { private provider; private signer?; private contractProvider; private adaptersFactoryClient; private adaptersClient; constructor(provider: ethers.Provider, signer?: ethers.Signer); /** * Get a `Vault` instance for an existing vault address. All vault-specific * operations (reads, writes, multicall) live on this object. */ vault(vaultAddress: string): Vault; /** * Deploy a new vault via the factory. Returns the tx response augmented * with `vaultAddress` and a ready-to-use `vault` instance. * * @example * const { vault, wait } = await client.createVault(owner, asset, salt); * await wait(); * await vault.multicall([...]); // configure in one tx */ createVault(owner: string, asset: string, salt: string): Promise; /** * Deploy an adapter of the specified type. * @param cometRewards required only for `compoundV3` adapters. */ deployAdapter(type: AdapterType, parentVault: string, underlying: string, cometRewards?: string): Promise; /** Find an existing adapter for (parent, underlying), trying all types if `type` omitted. */ findAdapter(parentVault: string, underlying: string, options?: { type?: AdapterType; cometRewards?: string; }): Promise; /** Check whether an address is a registered adapter of the given type. */ isAdapter(type: AdapterType, account: string): Promise; /** Detect an adapter's type by looking up its factory address. */ getAdapterType(adapterAddress: string): Promise; /** Get the factory address that deployed a given adapter. */ getAdapterFactoryAddress(adapterAddress: string): Promise; getIdsERC4626(adapterAddress: string): Promise; getIdsERC4626Merkl(adapterAddress: string): Promise; getIdsCompoundV3(adapterAddress: string): Promise; getIdsMarketV1(adapterAddress: string, marketParams: MarketParams): Promise; getUnderlyingERC4626(adapterAddress: string): Promise; getUnderlyingERC4626Merkl(adapterAddress: string): Promise; getUnderlyingCompoundV3(adapterAddress: string): Promise; getUnderlyingMarketV1(adapterAddress: string): Promise; getMarketIdsLength(adapterAddress: string): Promise; getMarketId(adapterAddress: string, index: number): Promise; /** Read live state of a Morpho V1 market by id. */ getMarketState(adapterAddress: string, id: string): Promise; /** Read live state of the underlying Comet for a Compound V3 adapter. */ getCometState(adapterAddress: string): Promise; /** Read live state of the underlying ERC-4626 vault for an erc4626 adapter. */ getVaultStateERC4626(adapterAddress: string): Promise; /** Read live state of the underlying ERC-4626 vault for an erc4626Merkl adapter. */ getVaultStateERC4626Merkl(adapterAddress: string): Promise; /** Read the on-chain `adapterId` (bytes32) — works for any adapter type. */ getAdapterId(adapterAddress: string, type: AdapterType): Promise; /** * Live value of an adapter's investments in underlying asset units, * pending interest included. `realAssets()` is required by the `IAdapter` * interface, so this works for ANY adapter, even of unknown type. This is * the value the vault reads on interest accrual, contrast it with the * vault-side `allocation(id)` which is lazy (resynced only on * (de)allocate) and excludes interest/losses since the last interaction. */ getRealAssets(adapterAddress: string): Promise; /** Parent vault of an adapter. Works for any adapter type. */ getParentVault(adapterAddress: string): Promise; /** * Vault-side tracked (lazy) allocation of a single-id adapter. For * morphoMarketV1 use `getAllocationMarketV1` (per-market). */ getAllocation(adapterAddress: string, type: AdapterType): Promise; /** Vault-side tracked (lazy) allocation of one Morpho V1 market. */ getAllocationMarketV1(adapterAddress: string, marketParams: MarketParams): Promise; /** * Live value of a Morpho V1 adapter's position on one market by id * (bytes32), pending interest included: the per-market term of * `realAssets()`. */ getExpectedSupplyAssets(adapterAddress: string, marketId: string): Promise; /** Raw supply shares of a Morpho V1 adapter on one market by id (bytes32). */ getSupplyShares(adapterAddress: string, marketId: string): Promise; /** * Get an `AdapterInstance` for an existing adapter. Use this for * adapter-level admin writes (`setSkimRecipient`, `skim`, `claim`, * `submit`/`accept`/`abdicate`, …) that target the adapter contract * directly and therefore cannot be bundled into the parent vault's * multicall. * * @example * const adapter = client.adapter(addr, "compoundV3"); * await adapter.claim(swapData); * await adapter.setClaimer(newClaimer); */ adapter(adapterAddress: string, type: AdapterType): AdapterInstance; getNetworkConfig(): Promise; getChainId(): Promise; getVaultFactoryContract(): Promise; /** Swap signer at runtime. */ useSigner(signer: ethers.Signer): void; /** Escape hatch for advanced usage. */ getContractProvider(): ContractProvider; }