import { type PublicClient, type WalletClient, type Chain, type Transport, type Account } from 'viem'; import { type AzethContractAddresses, type PaymentAgreement } from '@azeth/common'; import type { AzethSmartAccountClient } from '../utils/userop.js'; export interface CreateAgreementParams { payee: `0x${string}`; token: `0x${string}`; amount: bigint; interval: number; endTime?: bigint; maxExecutions?: number; totalCap?: bigint; } export interface AgreementResult { agreementId: bigint; txHash: `0x${string}`; } /** Create a recurring payment agreement via ERC-4337 UserOperation. * * Routes the call through the smart account so msg.sender = smart account address. * The SmartAccountClient wraps the PaymentAgreementModule.createAgreement() call * inside AzethAccount.execute() via a UserOp submitted to EntryPoint v0.7. */ export declare function createPaymentAgreement(publicClient: PublicClient, smartAccountClient: AzethSmartAccountClient, addresses: AzethContractAddresses, account: `0x${string}`, params: CreateAgreementParams): Promise; /** Get agreement details */ export declare function getAgreement(publicClient: PublicClient, addresses: AzethContractAddresses, account: `0x${string}`, agreementId: bigint): Promise; /** Find an active agreement from a given account to a specific payee. * Iterates from newest to oldest (newest more likely active). * Scans at most MAX_AGREEMENT_SCAN agreements to prevent O(n) RPC calls. * * @param publicClient - viem public client for on-chain reads * @param addresses - Contract addresses containing paymentAgreementModule * @param account - The payer's smart account address * @param payee - The payee address to match * @param token - Optional token address to filter by * @returns The first matching active agreement, or null */ export declare function findAgreementWithPayee(publicClient: PublicClient, addresses: AzethContractAddresses, account: `0x${string}`, payee: `0x${string}`, token?: `0x${string}`): Promise; /** Execute a due payment agreement via ERC-4337 UserOperation. * * Routes the call through the smart account so msg.sender = smart account address. */ export declare function executeAgreement(publicClient: PublicClient, smartAccountClient: AzethSmartAccountClient, addresses: AzethContractAddresses, account: `0x${string}`, agreementId: bigint): Promise<`0x${string}`>; /** Execute a payment agreement as a third-party keeper. * * The contract's executeAgreement() is permissionless — any msg.sender can trigger it. * When the caller is NOT the payer (i.e., it's a keeper or payee), we cannot build a * UserOp for the payer's smart account (AA24 signature mismatch). Instead: * * - If the keeper has their own smart account: route via the keeper's SmartAccountClient * (the keeper's smart account calls the module, which executes on the payer's account) * - If the keeper has no smart account: call the module directly from the keeper's EOA * via walletClient.writeContract() */ export declare function executeAgreementAsKeeper(publicClient: PublicClient, keeperSmartAccountClient: AzethSmartAccountClient | null, walletClient: WalletClient, addresses: AzethContractAddresses, payerAccount: `0x${string}`, agreementId: bigint): Promise<`0x${string}`>; /** Cancel an active payment agreement via ERC-4337 UserOperation. * * Routes the call through the smart account so msg.sender = smart account address. * Only the payer (agreement creator) can cancel. Immediate effect, no timelock. */ export declare function cancelAgreement(publicClient: PublicClient, smartAccountClient: AzethSmartAccountClient, addresses: AzethContractAddresses, agreementId: bigint): Promise<`0x${string}`>; /** Get the total number of agreements for an account */ export declare function getAgreementCount(publicClient: PublicClient, addresses: AzethContractAddresses, account: `0x${string}`): Promise; /** Check if a payment agreement can be executed right now. * Returns [executable, reason] — reason explains why if not executable. */ export declare function canExecutePayment(publicClient: PublicClient, addresses: AzethContractAddresses, account: `0x${string}`, agreementId: bigint): Promise<{ executable: boolean; reason: string; }>; /** Check if a payment agreement is executable (ignoring interval timing). * Checks: active, not expired, not maxed, not capped, guardian whitelist, * guardian limits, and payer balance >= accrued amount. */ export declare function isAgreementExecutable(publicClient: PublicClient, addresses: AzethContractAddresses, account: `0x${string}`, agreementId: bigint): Promise; /** Get comprehensive agreement data in a single RPC call. * Combines getAgreement + isAgreementExecutable + isAgreementDue + * getNextExecutionTime + getAgreementCount. */ export declare function getAgreementData(publicClient: PublicClient, addresses: AzethContractAddresses, account: `0x${string}`, agreementId: bigint): Promise<{ agreement: PaymentAgreement; executable: boolean; reason: string; isDue: boolean; nextExecutionTime: bigint; count: bigint; }>; /** Get the next execution timestamp for a payment agreement */ export declare function getNextExecutionTime(publicClient: PublicClient, addresses: AzethContractAddresses, account: `0x${string}`, agreementId: bigint): Promise; //# sourceMappingURL=agreements.d.ts.map