import { type Address } from "@morpho-org/blue-sdk"; import type { ERC20ApprovalAction, Transaction } from "../../../types/index.js"; /** Parameters for {@link encodeErc20Approval}. */ interface EncodeErc20ApprovalParams { token: Address; spender: Address; amount: bigint; chainId: number; } /** * Encodes a deep-frozen ERC-20 approval transaction for a supported SDK spender. * * Caps `amount` at the per-chain, per-token maximum from `MAX_TOKEN_APPROVALS` (defaults to * `maxUint256`). Used by {@link getRequirementsApproval} and {@link getGeneralAdapterRequirementsPermit2}. * * @param params - Encoding parameters. * @param params.token - ERC-20 token address to approve. * @param params.spender - Address granted the allowance. Must be GeneralAdapter1, Permit2, * Midnight, MidnightBundles, or VaultExitBundlesV1 for the chain. * @param params.amount - Allowance amount before per-token cap. * @param params.chainId - The chain the transaction targets (used to resolve supported spenders and the per-token cap). * @returns A deep-frozen `Transaction` with the capped approval amount. * @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not a supported SDK spender for `chainId`. * @example * ```ts * import { encodeErc20Approval } from "@morpho-org/morpho-sdk"; * * const tx = encodeErc20Approval({ * token: USDC, * spender: generalAdapter1, * amount: 1_000_000n, * chainId: 1, * }); * // tx satisfies Readonly> * ``` */ export declare const encodeErc20Approval: (params: EncodeErc20ApprovalParams) => Transaction; export {};