import { c as Address } from "../../abi-Bjd7pZee.mjs"; import { r as Hex } from "../../misc-BASHpEmW.mjs"; //#region extensions/crypto/src/services/delegation-types.d.ts /** * A single caveat restricting a delegation. * Each caveat references an on-chain enforcer contract and ABI-encoded terms. */ interface Caveat { /** Address of the caveat enforcer contract. */ enforcer: Address; /** ABI-encoded terms the enforcer checks. Encoding varies by enforcer. */ terms: Hex; /** Runtime arguments passed during redemption (usually '0x'). */ args: Hex; } /** * An unsigned delegation — all fields except the signature. * The delegator must sign this to produce a valid Delegation. */ interface UnsignedDelegation { /** Who receives the permission (the agent's address). */ delegate: Address; /** Who grants the permission (the user's wallet). */ delegator: Address; /** * Parent delegation hash for chained delegations. * 0x0...0 for root delegations (granted directly by the account owner). */ authority: Hex; /** Restrictions on the delegation. */ caveats: Caveat[]; /** Random salt for uniqueness. */ salt: bigint; } /** * A fully signed delegation ready for on-chain redemption. */ interface SignedDelegation extends UnsignedDelegation { /** The delegator's EIP-712 signature over the delegation. */ signature: Hex; } type DelegationStatus = 'unsigned' | 'signed' | 'active' | 'revoked' | 'expired'; /** * Metadata stored in the policy's `delegation` field. * Links an off-chain policy to its on-chain delegation. */ interface DelegationMetadata { /** Chain ID where the delegation is deployed. */ chainId: number; /** Keccak256 hash of the delegation struct. */ hash: Hex; /** DelegationManager contract address on this chain. */ delegationManager: Address; /** Current lifecycle status. */ status: DelegationStatus; /** The delegate address (agent). */ delegate: Address; /** The delegator address (user). */ delegator: Address; /** Salt used for uniqueness. */ salt: string; /** ISO timestamp when the delegation was created. */ createdAt: string; /** ISO timestamp when last status check was performed. */ lastCheckedAt?: string; /** Caveats that couldn't be mapped (app-layer only). */ unmappedRules?: string[]; } declare const DELEGATION_CONTRACTS: { /** Core delegation manager — handles creation, redemption, revocation. */readonly DelegationManager: Address; /** MetaMask EIP-7702 Stateless DeleGator — production audited implementation. * Use as the designation target for `/upgrade 7702`. Deterministic CREATE2 across all chains. */ readonly EIP7702StatelessDeleGator: Address; /** MetaMask HybridDeleGator — ERC-4337 + EIP-712 hybrid account implementation. */ readonly HybridDeleGator: Address; /** MetaMask MultiSigDeleGator — multi-signature DeleGator implementation. */ readonly MultiSigDeleGator: Address; /** Limits total ERC-20 transfer amount. Terms: (address token, uint256 amount) */ readonly ERC20TransferAmountEnforcer: Address; /** Limits ERC-20 transfers per time period. Terms: (address token, uint256 allowance, uint256 startTime, uint256 period) */ readonly ERC20PeriodTransferEnforcer: Address; /** Limits total number of calls. Terms: (uint256 count) */ readonly LimitedCallsEnforcer: Address; /** Restricts which contract addresses can be called. Terms: (address[]) */ readonly AllowedTargetsEnforcer: Address; /** Restricts which function selectors can be called. Terms: (bytes4[]) */ readonly AllowedMethodsEnforcer: Address; /** Enforces time bounds on delegation. Terms: (uint128 executeAfter, uint128 executeBefore) */ readonly TimestampEnforcer: Address; /** Limits total native token (ETH) transfer amount. Terms: (uint256 amount) */ readonly NativeTokenTransferAmountEnforcer: Address; /** Limits native token transfers per time period. Terms: (uint256 allowance, uint256 startTime, uint256 period) */ readonly NativeTokenPeriodTransferEnforcer: Address; /** Limits msg.value to be <= encoded amount. Terms: (uint256 maxValue) */ readonly ValueLteEnforcer: Address; /** Requires a specific nonce for single-use delegations. Terms: (uint256 nonce) */ readonly NonceEnforcer: Address; }; declare const SUPPORTED_CHAIN_IDS: Set; declare const CHAIN_NAMES: Record; declare const DELEGATION_EIP712_TYPES: { readonly Delegation: readonly [{ readonly name: "delegate"; readonly type: "address"; }, { readonly name: "delegator"; readonly type: "address"; }, { readonly name: "authority"; readonly type: "bytes32"; }, { readonly name: "caveats"; readonly type: "Caveat[]"; }, { readonly name: "salt"; readonly type: "uint256"; }]; readonly Caveat: readonly [{ readonly name: "enforcer"; readonly type: "address"; }, { readonly name: "terms"; readonly type: "bytes"; }]; }; /** * Build the EIP-712 domain for a DelegationManager on a specific chain. */ declare function getDelegationDomain(chainId: number): { readonly name: "DelegationManager"; readonly version: "1"; readonly chainId: number; readonly verifyingContract: `0x${string}`; }; /** * Root authority for top-level delegations (no parent). * The DelegationManager uses 0xfff...f as the sentinel value. */ declare const ROOT_AUTHORITY: Hex; /** * Default single-call execution mode. * callType=0x00 (single), execType=0x00 (default), rest zeros. */ declare const EXECUTE_MODE_DEFAULT: Hex; /** * Encode a single execution as callData for redeemDelegations. * ERC-7579 single execution: abi.encodePacked(target, value, callData). * But DelegationManager expects: abi.encode(target, value, callData) as the * executionCallData parameter. */ interface ExecutionAction { /** Target contract address. */ target: Address; /** Value in wei to send with the call. */ value: bigint; /** Encoded function calldata (e.g., from encodeFunctionData). */ callData: Hex; } type CaveatMappingResult = { type: 'mapped'; caveats: Caveat[]; } | { type: 'app_layer_only'; reason: string; }; /** * Well-known period durations in seconds, for on-chain period enforcers. */ declare const PERIOD_SECONDS: Record; declare const DELEGATION_MANAGER_ABI: readonly [{ readonly name: "redeemDelegations"; readonly type: "function"; readonly stateMutability: "nonpayable"; readonly inputs: readonly [{ readonly name: "_permissionContexts"; readonly type: "bytes[]"; }, { readonly name: "_modes"; readonly type: "bytes32[]"; }, { readonly name: "_executionCallData"; readonly type: "bytes[]"; }]; readonly outputs: readonly []; }, { readonly name: "disableDelegation"; readonly type: "function"; readonly stateMutability: "nonpayable"; readonly inputs: readonly [{ readonly name: "_delegation"; readonly type: "tuple"; readonly components: readonly [{ readonly name: "delegate"; readonly type: "address"; }, { readonly name: "delegator"; readonly type: "address"; }, { readonly name: "authority"; readonly type: "bytes32"; }, { readonly name: "caveats"; readonly type: "tuple[]"; readonly components: readonly [{ readonly name: "enforcer"; readonly type: "address"; }, { readonly name: "terms"; readonly type: "bytes"; }, { readonly name: "args"; readonly type: "bytes"; }]; }, { readonly name: "salt"; readonly type: "uint256"; }, { readonly name: "signature"; readonly type: "bytes"; }]; }]; readonly outputs: readonly []; }, { readonly name: "getDelegationHash"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly name: "_delegation"; readonly type: "tuple"; readonly components: readonly [{ readonly name: "delegate"; readonly type: "address"; }, { readonly name: "delegator"; readonly type: "address"; }, { readonly name: "authority"; readonly type: "bytes32"; }, { readonly name: "caveats"; readonly type: "tuple[]"; readonly components: readonly [{ readonly name: "enforcer"; readonly type: "address"; }, { readonly name: "terms"; readonly type: "bytes"; }, { readonly name: "args"; readonly type: "bytes"; }]; }, { readonly name: "salt"; readonly type: "uint256"; }, { readonly name: "signature"; readonly type: "bytes"; }]; }]; readonly outputs: readonly [{ readonly name: ""; readonly type: "bytes32"; }]; }, { readonly name: "disabledDelegations"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly name: "_delegationHash"; readonly type: "bytes32"; }]; readonly outputs: readonly [{ readonly name: ""; readonly type: "bool"; }]; }]; /** ABI for NativeTokenPeriodTransferEnforcer.spentMap (read cumulative ETH usage). */ declare const NATIVE_PERIOD_ENFORCER_ABI: readonly [{ readonly name: "spentMap"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly name: "_delegationManager"; readonly type: "address"; }, { readonly name: "_delegationHash"; readonly type: "bytes32"; }]; readonly outputs: readonly [{ readonly name: "spent"; readonly type: "uint256"; }, { readonly name: "lastUpdated"; readonly type: "uint256"; }]; }]; /** ABI for ERC20PeriodTransferEnforcer.spentMap (read cumulative ERC-20 usage). */ declare const ERC20_PERIOD_ENFORCER_ABI: readonly [{ readonly name: "spentMap"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly name: "_delegationManager"; readonly type: "address"; }, { readonly name: "_delegationHash"; readonly type: "bytes32"; }]; readonly outputs: readonly [{ readonly name: "spent"; readonly type: "uint256"; }, { readonly name: "lastUpdated"; readonly type: "uint256"; }]; }]; /** ABI for LimitedCallsEnforcer.callCounts (read cumulative call count). */ declare const LIMITED_CALLS_ENFORCER_ABI: readonly [{ readonly name: "callCounts"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly name: "_delegationManager"; readonly type: "address"; }, { readonly name: "_delegationHash"; readonly type: "bytes32"; }]; readonly outputs: readonly [{ readonly name: ""; readonly type: "uint256"; }]; }]; //#endregion export { CHAIN_NAMES, Caveat, CaveatMappingResult, DELEGATION_CONTRACTS, DELEGATION_EIP712_TYPES, DELEGATION_MANAGER_ABI, DelegationMetadata, DelegationStatus, ERC20_PERIOD_ENFORCER_ABI, EXECUTE_MODE_DEFAULT, ExecutionAction, LIMITED_CALLS_ENFORCER_ABI, NATIVE_PERIOD_ENFORCER_ABI, PERIOD_SECONDS, ROOT_AUTHORITY, SUPPORTED_CHAIN_IDS, SignedDelegation, UnsignedDelegation, getDelegationDomain }; //# sourceMappingURL=delegation-types.d.mts.map