import { c as Address } from "../../abi-Bjd7pZee.mjs"; import { Caveat, CaveatMappingResult, UnsignedDelegation } from "./delegation-types.mjs"; import { Policy, PolicyRule } from "./policy-types.mjs"; //#region extensions/crypto/src/services/delegation-compiler.d.ts /** * Optional context for price-aware compilation. * When provided, USD amounts are converted to real token amounts * using live prices. Without it, USD * 1e18 placeholder is used. */ interface CompilationContext { /** ETH price in USD at compilation time. */ ethPriceUsd?: number; /** ERC-20 token address → { priceUsd, decimals } for token-aware enforcers. */ tokenPrices?: Map; } interface CompilationResult { /** The unsigned delegation struct, ready for signing. */ delegation: UnsignedDelegation; /** Rules that mapped to on-chain caveats. */ mappedRules: Array<{ rule: PolicyRule; caveats: Caveat[]; }>; /** Rules that have no on-chain enforcer and are app-layer only. */ unmappedRules: Array<{ rule: PolicyRule; reason: string; }>; /** Warnings about the compilation (e.g., approximate mappings). */ warnings: string[]; } interface CompilationError { type: 'error'; message: string; } /** Set compilation context (prices) before compiling. */ declare function setCompilationContext(ctx: CompilationContext): void; /** Get current compilation context. */ declare function getCompilationContext(): CompilationContext; /** * Compile a single PolicyRule into zero or more on-chain caveats. */ declare function compileRuleToCaveats(rule: PolicyRule): CaveatMappingResult; /** * Compile a full Policy into an UnsignedDelegation. * * @param policy - The policy to compile * @param delegator - The user's wallet address (who grants the delegation) * @param delegate - The agent's wallet address (who receives the delegation) * @param chainId - Target chain ID * @returns CompilationResult with the delegation and mapping details, or error */ declare function compilePolicyToDelegation(policy: Policy, delegator: Address, delegate: Address, chainId: number): CompilationResult | CompilationError; /** * Generate a human-readable compilation summary for user review. */ declare function formatCompilationSummary(result: CompilationResult, chainId: number): string; //#endregion export { CompilationContext, CompilationError, CompilationResult, compilePolicyToDelegation, compileRuleToCaveats, formatCompilationSummary, getCompilationContext, setCompilationContext }; //# sourceMappingURL=delegation-compiler.d.mts.map