import { type Address, type Hex, type TypedDataDefinition } from 'viem'; import type { Policy, ProviderConfig, RhinestoneAccountConfig, RhinestoneConfig, Session, SessionEnableData } from '../../types'; import { type Module } from '../common'; import { SMART_SESSION_EMISSARY_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS_DEV } from './core'; interface SessionData { sessionValidator: Address; sessionValidatorInitData: Hex; salt: Hex; erc7739Policies: { allowedERC7739Content: readonly AllowedERC7739Content[]; erc1271Policies: readonly ERC1271Policy[]; }; actions: readonly ActionData[]; claimPolicies: readonly PolicyData[]; } interface ERC1271Policy { policy: Address; initData: Hex; } interface AllowedERC7739Content { appDomainSeparator: Hex; contentNames: readonly string[]; } interface ActionData { actionTargetSelector: Hex; actionTarget: Address; actionPolicies: readonly PolicyData[]; } interface PolicyData { policy: Address; initData: Hex; } type SmartSessionModeType = typeof SMART_SESSION_MODE_USE | typeof SMART_SESSION_MODE_ENABLE; interface ChainDigest { chainId: bigint; sessionDigest: Hex; } interface SignedPermissions { permitGenericPolicy: boolean; permitAdminAccess: boolean; ignoreSecurityAttestations: boolean; permitERC4337Paymaster: boolean; userOpPolicies: readonly PolicyData[]; erc7739Policies: ERC7739Data; actions: readonly ActionData[]; } interface SignedSession { account: Address; permissions: SignedPermissions; sessionValidator: Address; sessionValidatorInitData: Hex; salt: Hex; smartSession: Address; nonce: bigint; } interface ChainSession { chainId: bigint; session: SignedSession; } interface ERC7739Data { allowedERC7739Content: readonly ERC7739Context[]; erc1271Policies: readonly PolicyData[]; } interface ERC7739Context { appDomainSeparator: Hex; contentName: readonly string[]; } interface SessionDetails { nonces: bigint[]; hashesAndChainIds: ChainDigest[]; data: TypedDataDefinition; } declare const types: { readonly PolicyData: readonly [{ readonly name: "policy"; readonly type: "address"; }, { readonly name: "initData"; readonly type: "bytes"; }]; readonly ActionData: readonly [{ readonly name: "actionTargetSelector"; readonly type: "bytes4"; }, { readonly name: "actionTarget"; readonly type: "address"; }, { readonly name: "actionPolicies"; readonly type: "PolicyData[]"; }]; readonly ERC7739Context: readonly [{ readonly name: "appDomainSeparator"; readonly type: "bytes32"; }, { readonly name: "contentName"; readonly type: "string[]"; }]; readonly ERC7739Data: readonly [{ readonly name: "allowedERC7739Content"; readonly type: "ERC7739Context[]"; }, { readonly name: "erc1271Policies"; readonly type: "PolicyData[]"; }]; readonly LockTagData: readonly [{ readonly name: "lockTag"; readonly type: "bytes12"; }, { readonly name: "claimPolicies"; readonly type: "PolicyData[]"; }]; readonly SignedPermissions: readonly [{ readonly name: "actions"; readonly type: "ActionData[]"; }, { readonly name: "erc7739Policies"; readonly type: "ERC7739Data"; }, { readonly name: "lockTagPolicies"; readonly type: "LockTagData"; }, { readonly name: "permitGenericPolicy"; readonly type: "bool"; }]; readonly SignedSession: readonly [{ readonly name: "account"; readonly type: "address"; }, { readonly name: "expires"; readonly type: "uint256"; }, { readonly name: "nonce"; readonly type: "uint256"; }, { readonly name: "permissions"; readonly type: "SignedPermissions"; }, { readonly name: "salt"; readonly type: "bytes32"; }, { readonly name: "sessionValidator"; readonly type: "address"; }, { readonly name: "sessionValidatorInitData"; readonly type: "bytes"; }, { readonly name: "smartSessionEmissary"; readonly type: "address"; }]; readonly ChainSession: readonly [{ readonly name: "chainId"; readonly type: "uint64"; }, { readonly name: "session"; readonly type: "SignedSession"; }]; readonly MultiChainSession: readonly [{ readonly name: "sessionsAndChainIds"; readonly type: "ChainSession[]"; }]; }; declare const SMART_SESSION_MODE_USE = "0x00"; declare const SMART_SESSION_MODE_ENABLE = "0x01"; declare const SMART_SESSIONS_FALLBACK_TARGET_FLAG: Address; declare const SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG: Hex; declare const SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG_PERMITTED_TO_CALL_SMARTSESSION: Hex; declare const DUMMY_PRECLAIMOP_TARGET: Address; declare const DUMMY_PRECLAIMOP_SELECTOR: Hex; declare const SPENDING_LIMITS_POLICY_ADDRESS: Address; declare const TIME_FRAME_POLICY_ADDRESS: Address; declare const SUDO_POLICY_ADDRESS: Address; declare const UNIVERSAL_ACTION_POLICY_ADDRESS: Address; declare const USAGE_LIMIT_POLICY_ADDRESS: Address; declare const VALUE_LIMIT_POLICY_ADDRESS: Address; declare const INTENT_EXECUTION_POLICY_ADDRESS: Address; interface ResolvedSessionSignerSet { type: 'experimental_session'; session: Session; enableData?: SessionEnableData; verifyExecutions: boolean; claimPolicyData?: Hex; } declare function packSignature(signers: ResolvedSessionSignerSet, validatorSignature: Hex): Hex; declare function getSessionDetails(account: Address, sessions: Session[], provider: ProviderConfig | undefined, useDevContracts?: boolean): Promise; declare function isSessionEnabled(account: Address, provider: ProviderConfig | undefined, session: Session, useDevContracts?: boolean): Promise; declare function signEnableSession(config: RhinestoneAccountConfig, details: SessionDetails): Promise; declare function getEnableSessionCall(account: Address, session: Session, enableSessionSignature: Hex, hashesAndChainIds: { chainId: bigint; sessionDigest: Hex; }[], sessionToEnableIndex: number, useDevContracts?: boolean): Promise<{ to: `0x${string}`; data: `0x${string}`; }>; declare function getSessionData(session: Session, useDevContracts?: boolean): SessionData; declare function getPermissionId(session: Session): `0x${string}`; declare function getPolicyData(policy: Policy, useDevContracts?: boolean): PolicyData; declare function getSmartSessionValidator(config: RhinestoneConfig): Module | null; /** * Builds a mockSignature for SSX validation gas estimation. * Format: emissaryAddress (20 bytes) + enable-mode sigData. * Uses real session data (policies/actions from the user's session config) with dummy * sigs and hashes — the mock emissary skips sig verification and only writes storage. * The orchestrator slices off the first 20 bytes to identify the validator, then * simulates verifyExecution with the mock emissary to estimate gas before the user signs. */ declare function buildMockSignature(session: Session, useDevContracts?: boolean, chainCount?: number, targetChainId?: number): Hex; export { SMART_SESSION_EMISSARY_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS_DEV, SMART_SESSIONS_FALLBACK_TARGET_FLAG, SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG, SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG_PERMITTED_TO_CALL_SMARTSESSION, DUMMY_PRECLAIMOP_TARGET, DUMMY_PRECLAIMOP_SELECTOR, SPENDING_LIMITS_POLICY_ADDRESS, TIME_FRAME_POLICY_ADDRESS, SUDO_POLICY_ADDRESS, UNIVERSAL_ACTION_POLICY_ADDRESS, USAGE_LIMIT_POLICY_ADDRESS, VALUE_LIMIT_POLICY_ADDRESS, INTENT_EXECUTION_POLICY_ADDRESS, packSignature, getSessionData, getPolicyData, getEnableSessionCall, getPermissionId, getSmartSessionValidator, getSessionDetails, isSessionEnabled, signEnableSession, buildMockSignature, }; export type { ChainSession, ChainDigest, ResolvedSessionSignerSet, SessionData, SmartSessionModeType, SessionDetails, }; //# sourceMappingURL=smart-sessions.d.ts.map