import { type Hex, type DecodedCall } from './abi.js'; import { type UnpackedUserOp } from './userOpHash.js'; import { type StepUpProof, type StepUpCheck } from './stepup.js'; export { ENTRY_POINT_V07 } from './userOpHash.js'; export { AAVE_V3_POOLS } from './evmYieldPolicy.js'; export type LendingIntentVerb = 'borrow' | 'repay'; export interface LendingUserIntent { schema: 'flows-lending-userop-intent-v1'; verb: LendingIntentVerb; chainId: number; /** The borrowed (verb=borrow) or repaid (verb=repay) ERC-20 asset. */ asset: Hex; /** The Aave V3 Pool — MUST equal the vetted pool for the chain. */ pool: Hex; /** Base units — caps the borrow/repay amount (and the repay approve). */ amountBaseUnits: string; /** Aave interest-rate mode: 2 = variable (1 = stable, deprecated). Bound to the call. */ interestRateMode: number; smartAccount: Hex; pkpAddress: Hex; userOpNonce: string; nonce: number; expiresAt: string; } export type LendingUserIntentProof = { proof: Extract; credentialPublicKey: Hex; webauthn: { rpId: string; allowedOrigins: string[]; }; } | { proof: Extract; credentialAddress: Hex; }; export declare function lendingUserIntentHash(intent: LendingUserIntent): string; export declare function lendingUserIntentChallenge(intent: LendingUserIntent): Uint8Array; export declare function verifyLendingUserIntentProof(input: { intent: LendingUserIntent; intentProof: LendingUserIntentProof; nowMs?: number; }): StepUpCheck; /** * Fail-closed lending policy for the inner calls of a smart-account UserOp. * Returns violations (empty = allowed). Requires a user-signed intent. * - borrow: exactly one `borrow` to the vetted pool; asset == intent.asset; * amount <= intent; interestRateMode == intent; onBehalfOf == sender (debt on self, * not a third party). No approve (nothing is spent). * - repay: an optional `approve(asset -> pool, <= intent)` + exactly one `repay` to the * vetted pool; asset == intent.asset; amount <= intent (no MAX sentinel — the exact * debt is known at quote time); onBehalfOf == sender (repay own debt). * Native value 0 on every call. */ export declare function validateLendingCalls(input: { calls: DecodedCall[]; sender: string; chainId: number; intent?: LendingUserIntent; pkpAddress?: string; }): string[]; export interface GateResult { ok: boolean; userOpHash: Hex; violations: string[]; } /** * The one call a lending signer makes. Recomputes the v0.7 userOpHash, binds it to * `messageRaw`, verifies the user-signed intent proof, decodes the Kernel calls, and * validates them. `ok` true ⇒ the action may sign `userOpHash`. */ export declare function gateLendingUserOp(input: { userOp: UnpackedUserOp; chainId: number; messageRaw?: string; entryPoint?: string; intent: LendingUserIntent; intentProof?: LendingUserIntentProof; pkpAddress?: string; }): GateResult;