import { type Address, type Hex } from "viem"; export declare enum SessionKeyAccessListType { ALLOWLIST = 0, DENYLIST = 1, ALLOW_ALL_ACCESS = 2 } export type ContractAccessEntry = { contractAddress: Address; isOnList: boolean; checkSelectors: boolean; }; export type ContractMethodEntry = { contractAddress: Address; methodSelector: Hex; isOnList: boolean; }; export type TimeRange = { validFrom: number; validUntil: number; }; export type NativeTokenLimit = { spendLimit: bigint; refreshInterval?: number; }; export type Erc20TokenLimit = { tokenAddress: Address; spendLimit: bigint; refreshInterval?: number; }; export type GasSpendLimit = { spendLimit: bigint; refreshInterval?: number; }; /** * A builder for creating the hex-encoded data for updating session key permissions. */ export declare class SessionKeyPermissionsBuilder { private _contractAccessControlType; private _contractAddressAccessEntrys; private _contractMethodAccessEntrys; private _timeRange?; private _nativeTokenSpendLimit?; private _erc20TokenSpendLimits; private _gasSpendLimit?; private _requiredPaymaster?; /** * Sets the access control type for the contract and returns the current instance for method chaining. * * @example * ```ts * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts"; * * const builder = new SessionKeyPermissionsBuilder(); * builder.setContractAccessControlType(SessionKeyAccessListType.ALLOWLIST); * ``` * * @param {SessionKeyAccessListType} aclType The access control type for the session key * @returns {SessionKeyPermissionsBuilder} The current instance for method chaining */ setContractAccessControlType(aclType: SessionKeyAccessListType): this; /** * Adds a contract access entry to the internal list of contract address access entries. * * @example * ```ts * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts"; * * const builder = new SessionKeyPermissionsBuilder(); * builder.addContractAddressAccessEntry({ * contractAddress: "0x1234", * isOnList: true, * checkSelectors: true, * }); * ``` * * @param {ContractAccessEntry} entry the contract access entry to be added * @returns {SessionKeyPermissionsBuilder} the instance of the current class for chaining */ addContractAddressAccessEntry(entry: ContractAccessEntry): this; /** * Adds a contract method entry to the `_contractMethodAccessEntrys` array. * * @example * ```ts * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts"; * * const builder = new SessionKeyPermissionsBuilder(); * builder.addContractAddressAccessEntry({ * contractAddress: "0x1234", * methodSelector: "0x45678", * isOnList: true, * }); * ``` * * @param {ContractMethodEntry} entry The contract method entry to be added * @returns {SessionKeyPermissionsBuilder} The instance of the class for method chaining */ addContractFunctionAccessEntry(entry: ContractMethodEntry): this; /** * Sets the time range for an object and returns the object itself for chaining. * * @example * ```ts * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts"; * * const builder = new SessionKeyPermissionsBuilder(); * builder.setTimeRange({ * validFrom: Date.now(), * validUntil: Date.now() + (15 * 60 * 1000), * }); * ``` * * @param {TimeRange} timeRange The time range to be set * @returns {SessionKeyPermissionsBuilder} The current object for method chaining */ setTimeRange(timeRange: TimeRange): this; /** * Sets the native token spend limit and returns the instance for chaining. * * @example * ```ts * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts"; * * const builder = new SessionKeyPermissionsBuilder(); * builder.setNativeTokenSpendLimit({ * spendLimit: 1000000000000000000n, * refreshInterval: 3600, * }); * ``` * * @param {NativeTokenLimit} limit The limit to set for native token spending * @returns {SessionKeyPermissionsBuilder} The instance for chaining */ setNativeTokenSpendLimit(limit: NativeTokenLimit): this; /** * Adds an ERC20 token spend limit to the list of limits and returns the updated object. * * @example * ```ts * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts"; * * const builder = new SessionKeyPermissionsBuilder(); * builder.addErc20TokenSpendLimit({ * tokenAddress: "0x1234", * spendLimit: 1000000000000000000n, * refreshInterval: 3600, * }); * ``` * * @param {Erc20TokenLimit} limit The ERC20 token spend limit to be added * @returns {object} The updated object with the new ERC20 token spend limit */ addErc20TokenSpendLimit(limit: Erc20TokenLimit): this; /** * Sets the gas spend limit and returns the current instance for method chaining. * * @example * ```ts * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts"; * * const builder = new SessionKeyPermissionsBuilder(); * builder.setGasSpendLimit({ * spendLimit: 1000000000000000000n, * refreshInterval: 3600, * }); * ``` * * @param {GasSpendLimit} limit - The gas spend limit to be set * @returns {SessionKeyPermissionsBuilder} The current instance for chaining */ setGasSpendLimit(limit: GasSpendLimit): this; /** * Sets the required paymaster address. * * @example * ```ts * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts"; * * const builder = new SessionKeyPermissionsBuilder(); * builder.setRequiredPaymaster("0x1234"); * ``` * * @param {Address} paymaster the address of the paymaster to be set * @returns {SessionKeyPermissionsBuilder} the current instance for method chaining */ setRequiredPaymaster(paymaster: Address): this; /** * Encodes various function calls into an array of hexadecimal strings based on the provided permissions and limits. * * @example * ```ts * import { SessionKeyPermissionsBuilder } from "@account-kit/smart-contracts"; * * const builder = new SessionKeyPermissionsBuilder(); * builder.setRequiredPaymaster("0x1234"); * const encoded = builder.encode(); * ``` * * @returns {Hex[]} An array of encoded hexadecimal strings representing the function calls for setting access control, permissions, and limits. */ encode(): Hex[]; private encodeIfDefined; }