import type { Address, Client } from "viem"; import { type ERC20ApprovalAction, type Transaction } from "../../../types/index.js"; /** Parameters for {@link getMidnightApprovalRequirements}. */ export interface GetMidnightApprovalRequirementsParams { readonly viemClient: Client; readonly chainId: number; readonly token: Address; readonly owner: Address; readonly spender: Address; readonly amount: bigint; } /** * Resolves classic ERC20 approval requirements for a Midnight spender. * * Entity flows call this from `getRequirements()`. Direct low-level consumers * should call it before encoding a Midnight action that lets `Midnight` or * `MidnightBundles` pull ERC20 tokens from the user. * * @param params.viemClient - Viem client used to read ERC20 allowance. * @param params.chainId - Chain id expected by the viem client. * @param params.token - ERC20 token that may need approval. * @param params.owner - Token owner. * @param params.spender - Midnight spender that will pull tokens. * @param params.amount - Token amount the spender must be able to pull. * @returns Approval transactions required for `spender` to pull `amount`. * @throws {ChainIdMismatchError} when the viem client is connected to another chain. * @throws {NegativeInputError} when `amount < 0n`. * @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not the chain's Midnight or MidnightBundles deployment. * @example * ```ts * import { * getMidnightApprovalRequirements, * midnightTakeLend, * } from "@morpho-org/morpho-sdk"; * * const approvals = await getMidnightApprovalRequirements({ * viemClient: client, * chainId: 8453, * token: loanToken, * owner: user, * spender: midnightBundles, * amount: 1_000_000n, * }); * if (approvals.length === 0) { * const tx = midnightTakeLend(takeParams); * } * ``` */ export declare const getMidnightApprovalRequirements: (params: GetMidnightApprovalRequirementsParams) => Promise>[]>;