import type { Client } from "viem"; import { type Metadata, type MorphoClientType } from "../types/index.js"; /** * Returns a viem `extend(...)` function that adds a stateless `morpho` namespace to a viem client. * The namespace rides on top of the same client (one transport / chain / account) and exposes the * protocol entity factories under `client.morpho`, so reads and writes share one client. * * Holds no state beyond configuration: no cache, no `init()`, no warm-up. Each factory call * (`client.morpho.vaultV1`, `vaultV2`, `blue`, `midnight`) returns a fresh entity bound to the client. * * @param _options - Optional SDK-wide options forwarded to the `morpho` namespace. * @param _options.metadata - Optional analytics metadata applied to every transaction the * `morpho` namespace builds. * @param _options.supportSignature - Whether the integrator can collect EIP-712 signatures for * permit / permit2. Defaults to `false` (classic approvals only). * @param _options.supportDeployless - Whether entity fetchers may use deployless multicall. * @returns A viem extension function — `client.extend(morphoViemExtension(...))` adds * `client.morpho`. * @example * ```ts * import { createWalletClient, http, publicActions } from "viem"; * import { mainnet } from "viem/chains"; * import { morphoViemExtension } from "@morpho-org/morpho-sdk"; * * const client = createWalletClient({ * chain: mainnet, * transport: http(), * account: user, * }) * .extend(publicActions) * .extend(morphoViemExtension({ supportSignature: true })); * * // Native viem reads and Morpho factories share the same client: * const block = await client.getBlockNumber(); * const vault = client.morpho.vaultV1(vaultAddress, 1); * const vaultData = await vault.getData(); * const { buildTx } = vault.deposit({ * amount: 1_000_000n, * userAddress: user, * vaultData, * }); * const tx = buildTx(); * ``` */ export declare function morphoViemExtension(_options?: { readonly metadata?: Metadata; readonly supportSignature?: boolean; readonly supportDeployless?: boolean; }): (client: TClient) => { morpho: MorphoClientType; };