import { c as Address } from "../../abi-Bjd7pZee.mjs"; //#region extensions/crypto/src/services/lending-service.d.ts declare const LENDING_CONTRACTS: { readonly aave: { readonly pool: `0x${string}`; readonly poolDataProvider: `0x${string}`; readonly oracle: `0x${string}`; readonly chain: 8453; readonly name: "Aave V3 Base"; }; readonly morpho: { readonly core: `0x${string}`; readonly chain: 8453; readonly name: "Morpho Base"; }; }; interface LendingAsset { symbol: string; address: Address; decimals: number; /** Aave aToken address (interest-bearing) */ aToken?: Address; /** Aave variable debt token address */ variableDebtToken?: Address; } declare const LENDING_ASSETS: Record; declare const AAVE_POOL_ABI: readonly [{ readonly name: "supply"; readonly type: "function"; readonly stateMutability: "nonpayable"; readonly inputs: readonly [{ readonly name: "asset"; readonly type: "address"; }, { readonly name: "amount"; readonly type: "uint256"; }, { readonly name: "onBehalfOf"; readonly type: "address"; }, { readonly name: "referralCode"; readonly type: "uint16"; }]; readonly outputs: readonly []; }, { readonly name: "borrow"; readonly type: "function"; readonly stateMutability: "nonpayable"; readonly inputs: readonly [{ readonly name: "asset"; readonly type: "address"; }, { readonly name: "amount"; readonly type: "uint256"; }, { readonly name: "interestRateMode"; readonly type: "uint256"; }, { readonly name: "referralCode"; readonly type: "uint16"; }, { readonly name: "onBehalfOf"; readonly type: "address"; }]; readonly outputs: readonly []; }, { readonly name: "repay"; readonly type: "function"; readonly stateMutability: "nonpayable"; readonly inputs: readonly [{ readonly name: "asset"; readonly type: "address"; }, { readonly name: "amount"; readonly type: "uint256"; }, { readonly name: "interestRateMode"; readonly type: "uint256"; }, { readonly name: "onBehalfOf"; readonly type: "address"; }]; readonly outputs: readonly [{ readonly name: ""; readonly type: "uint256"; }]; }, { readonly name: "withdraw"; readonly type: "function"; readonly stateMutability: "nonpayable"; readonly inputs: readonly [{ readonly name: "asset"; readonly type: "address"; }, { readonly name: "amount"; readonly type: "uint256"; }, { readonly name: "to"; readonly type: "address"; }]; readonly outputs: readonly [{ readonly name: ""; readonly type: "uint256"; }]; }, { readonly name: "getUserAccountData"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly name: "user"; readonly type: "address"; }]; readonly outputs: readonly [{ readonly name: "totalCollateralBase"; readonly type: "uint256"; }, { readonly name: "totalDebtBase"; readonly type: "uint256"; }, { readonly name: "availableBorrowsBase"; readonly type: "uint256"; }, { readonly name: "currentLiquidationThreshold"; readonly type: "uint256"; }, { readonly name: "ltv"; readonly type: "uint256"; }, { readonly name: "healthFactor"; readonly type: "uint256"; }]; }]; declare const ERC20_APPROVE_ABI: readonly [{ readonly name: "approve"; readonly type: "function"; readonly stateMutability: "nonpayable"; readonly inputs: readonly [{ readonly name: "spender"; readonly type: "address"; }, { readonly name: "amount"; readonly type: "uint256"; }]; readonly outputs: readonly [{ readonly name: ""; readonly type: "bool"; }]; }, { readonly name: "allowance"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly name: "owner"; readonly type: "address"; }, { readonly name: "spender"; readonly type: "address"; }]; readonly outputs: readonly [{ readonly name: ""; readonly type: "uint256"; }]; }]; interface UserAccountData { totalCollateralUsd: number; totalDebtUsd: number; availableBorrowsUsd: number; liquidationThreshold: number; ltv: number; healthFactor: number; } interface LendingPosition { protocol: 'aave' | 'morpho'; asset: string; type: 'supply' | 'borrow'; amount: string; amountUsd?: number; apy?: number; } type LendingProtocol = 'aave' | 'morpho'; declare class LendingService { /** * Resolve asset symbol to lending asset info. */ resolveAsset(symbolOrAddress: string): LendingAsset | null; /** * Get user account data from Aave V3 (health factor, collateral, debt). */ getUserAccountData(userAddress: Address, publicClient: any): Promise; /** * Supply an asset to Aave V3. * Returns the confirmed transaction hash. */ supply(asset: LendingAsset, amount: bigint, userAddress: Address, walletClient: any, publicClient: any): Promise<{ hash: string; action: 'supply'; asset: string; amount: string; }>; /** * Borrow an asset from Aave V3 (variable rate). */ borrow(asset: LendingAsset, amount: bigint, userAddress: Address, walletClient: any, publicClient?: any): Promise<{ hash: string; action: 'borrow'; asset: string; amount: string; }>; /** * Repay a borrowed asset on Aave V3. * Use amount = MaxUint256 to repay entire debt. * * When skipApproval is true, the caller has already handled approval * (e.g. for max repay with bounded approval instead of MaxUint256). */ repay(asset: LendingAsset, amount: bigint, userAddress: Address, walletClient: any, publicClient: any, skipApproval?: boolean): Promise<{ hash: string; action: 'repay'; asset: string; amount: string; }>; /** * Withdraw a supplied asset from Aave V3. * Use amount = MaxUint256 to withdraw entire balance. */ withdraw(asset: LendingAsset, amount: bigint, userAddress: Address, walletClient: any, publicClient?: any): Promise<{ hash: string; action: 'withdraw'; asset: string; amount: string; }>; /** * Get list of supported lending assets. */ getSupportedAssets(): LendingAsset[]; /** * Get supported protocols. * Note: Morpho contract address is defined in LENDING_CONTRACTS for future use, * but is not yet implemented. Only Aave V3 is currently supported. */ getSupportedProtocols(): Array<{ id: LendingProtocol; name: string; chain: number; }>; /** * Get the current variable debt balance for an asset. * Useful for calculating exact repay amounts instead of MaxUint256 approvals. */ getDebtBalance(asset: LendingAsset, userAddress: Address, publicClient: any): Promise; /** * Public wrapper for ensureApproval — used when the caller needs to * control the approval amount separately (e.g. max repay with bounded approval). */ ensureApprovalPublic(tokenAddress: Address, amount: bigint, owner: Address, walletClient: any, publicClient: any): Promise; private ensureApproval; } declare function getLendingService(): LendingService; declare function resetLendingService(): void; //#endregion export { AAVE_POOL_ABI, ERC20_APPROVE_ABI, LENDING_ASSETS, LENDING_CONTRACTS, LendingAsset, LendingPosition, LendingProtocol, LendingService, UserAccountData, getLendingService, resetLendingService }; //# sourceMappingURL=lending-service.d.mts.map