import type { NetworkClientId } from '@metamask/network-controller'; import type { Hex } from '@metamask/utils'; import type { TransactionControllerMessenger } from '../TransactionController.js'; import type { BatchTransactionParams, NestedTransactionUpdate, Authorization, AuthorizationList, TransactionMeta } from '../types.js'; export declare const DELEGATION_PREFIX = "0xef0100"; export declare const BATCH_FUNCTION_NAME = "execute"; export declare const CALLS_SIGNATURE = "(address,uint256,bytes)[]"; export declare const ERROR_MESSGE_PUBLIC_KEY = "EIP-7702 public key not specified"; /** * Check whether a given account's keyring supports EIP-7702 authorization * signing. * * Looks up the account's keyring via `KeyringController:getState` and returns * `true` only when the keyring type is in the supported list. * Returns `false` when the keyring cannot be resolved. * * @param messenger - Controller messenger. * @param account - The account address to check. * @returns Whether the account supports EIP-7702. */ export declare function doesAccountSupportEIP7702(messenger: TransactionControllerMessenger, account: string): boolean; /** * Determine if a chain supports EIP-7702 using LaunchDarkly feature flag. * * @param chainId - Hexadecimal ID of the chain. * @param messenger - Messenger instance. * @returns True if the chain supports EIP-7702. */ export declare function doesChainSupportEIP7702(chainId: Hex, messenger: TransactionControllerMessenger): boolean; /** * Retrieve the delegation address for an account. * * @param address - The address to check. * @param messenger - The TransactionController messenger. * @param networkClientId - The network client ID to use. * @returns The delegation address if it exists. */ export declare function getDelegationAddress(address: Hex, messenger: TransactionControllerMessenger, networkClientId: NetworkClientId): Promise; /** * Determine if an account has been upgraded to a supported EIP-7702 contract. * * @param address - The EOA address to check. * @param chainId - The chain ID. * @param publicKey - Public key used to validate EIP-7702 contract signatures in feature flags. * @param messenger - The messenger instance. * @param networkClientId - The network client ID to use. * @returns An object with the results of the check. */ export declare function isAccountUpgradedToEIP7702(address: Hex, chainId: Hex, publicKey: Hex, messenger: TransactionControllerMessenger, networkClientId: NetworkClientId): Promise<{ delegationAddress: Hex | undefined; isSupported: boolean; }>; /** * Update indexed transactions in an EIP-7702 batch and regenerate its calldata. * * @param options - Update options. * @param options.from - The sender address. * @param options.transactions - The existing nested transactions. * @param options.updates - Indexed calldata updates. * @returns Updated nested transactions and regenerated batch calldata. */ export declare function updateEIP7702BatchData({ from, transactions, updates, }: { from: Hex; transactions: BatchTransactionParams[]; updates: NestedTransactionUpdate[]; }): { nestedTransactions: BatchTransactionParams[]; transactionData: Hex; }; /** * Generate an EIP-7702 batch transaction. * * @param from - The sender address. * @param transactions - The transactions to batch. * @param options - Options bag. * @param options.atomic - Whether the batch should be atomic. Defaults to `true`. * When `true`, uses ERC-7579 ExecType `default` and all calls revert together. * When `false`, uses ERC-7579 ExecType `try` and individual calls can fail independently. * @returns The batch transaction. */ export declare function generateEIP7702BatchTransaction(from: Hex, transactions: BatchTransactionParams[], options?: { atomic?: boolean; }): BatchTransactionParams; /** * Sign an authorization list. * * @param options - Options bag. * @param options.authorizationList - The authorization list to sign. * @param options.messenger - The controller messenger. * @param options.transactionMeta - The transaction metadata. * @returns The signed authorization list. */ export declare function signAuthorizationList({ authorizationList, messenger, transactionMeta, }: { authorizationList?: AuthorizationList; messenger: TransactionControllerMessenger; transactionMeta: TransactionMeta; }): Promise>; /** * Decode a 65-byte EIP-7702 authorization signature into RLP-canonical * `r`, `s`, and `yParity` (no leading zero nibbles, `0x0` for zero). * * @param signature - The 65-byte signature. * @returns The decoded authorization fields. */ export declare function decodeAuthorizationSignature(signature: Hex): { r: Hex; s: Hex; yParity: Hex; }; /** * Whether an authorization already includes a complete EIP-7702 signature. * * @param authorization - Authorization to check. * @returns True when chainId, nonce, and signature components are all present. */ export declare function isAuthorizationSigned(authorization: Authorization): authorization is Required; /** * Recover the authority (signer) of a fully signed EIP-7702 authorization. * * Per EIP-7702: `authority = ecrecover(keccak(MAGIC || rlp([chain_id, address, nonce])), y_parity, r, s)`. * * @param authorization - Fully signed authorization. * @returns The recovered authority address, or undefined if recovery fails. */ export declare function recoverAuthorizationAuthority(authorization: Required): Hex | undefined; /** * Resolve which account an authorization nonce belongs to for nonce tracking. * * Unsigned authorizations are signed by the outer transaction sender (`from`). * Signed authorizations recover their authority independently per EIP-7702. * * @param authorization - Authorization entry. * @param transactionFrom - Outer transaction sender. * @returns Authority address, or undefined when a signed auth cannot be recovered. */ export declare function getAuthorizationAuthority(authorization: Authorization, transactionFrom: string): Hex | undefined; //# sourceMappingURL=eip7702.d.ts.map