@metamask/smart-accounts-kit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE.APACHE2 +201 -0
  3. package/LICENSE.MIT0 +16 -0
  4. package/README.md +77 -0
  5. package/dist/actions/index.cjs +39 -0
  6. package/dist/actions/index.cjs.map +1 -0
  7. package/dist/actions/index.d.cts +8 -0
  8. package/dist/actions/index.d.ts +8 -0
  9. package/dist/actions/index.mjs +39 -0
  10. package/dist/actions/index.mjs.map +1 -0
  11. package/dist/chunk-2EIX7ZYT.cjs +1325 -0
  12. package/dist/chunk-2EIX7ZYT.cjs.map +1 -0
  13. package/dist/chunk-662KDAAG.cjs +831 -0
  14. package/dist/chunk-662KDAAG.cjs.map +1 -0
  15. package/dist/chunk-6RN5RBOR.mjs +1325 -0
  16. package/dist/chunk-6RN5RBOR.mjs.map +1 -0
  17. package/dist/chunk-7MRTROLV.mjs +274 -0
  18. package/dist/chunk-7MRTROLV.mjs.map +1 -0
  19. package/dist/chunk-BFDBNFIP.cjs +336 -0
  20. package/dist/chunk-BFDBNFIP.cjs.map +1 -0
  21. package/dist/chunk-CPLIK3VF.mjs +77 -0
  22. package/dist/chunk-CPLIK3VF.mjs.map +1 -0
  23. package/dist/chunk-D4ILRL6Z.cjs +299 -0
  24. package/dist/chunk-D4ILRL6Z.cjs.map +1 -0
  25. package/dist/chunk-HD4O6IVC.cjs +274 -0
  26. package/dist/chunk-HD4O6IVC.cjs.map +1 -0
  27. package/dist/chunk-HLCOMYYU.cjs +1472 -0
  28. package/dist/chunk-HLCOMYYU.cjs.map +1 -0
  29. package/dist/chunk-KUEXI4ME.mjs +299 -0
  30. package/dist/chunk-KUEXI4ME.mjs.map +1 -0
  31. package/dist/chunk-MVKT5CLQ.mjs +336 -0
  32. package/dist/chunk-MVKT5CLQ.mjs.map +1 -0
  33. package/dist/chunk-RB4SOJM3.mjs +729 -0
  34. package/dist/chunk-RB4SOJM3.mjs.map +1 -0
  35. package/dist/chunk-T6PSFUOZ.cjs +77 -0
  36. package/dist/chunk-T6PSFUOZ.cjs.map +1 -0
  37. package/dist/chunk-TEI2NRPU.mjs +831 -0
  38. package/dist/chunk-TEI2NRPU.mjs.map +1 -0
  39. package/dist/chunk-UUDQWENY.mjs +1472 -0
  40. package/dist/chunk-UUDQWENY.mjs.map +1 -0
  41. package/dist/chunk-WA2O2K3K.cjs +729 -0
  42. package/dist/chunk-WA2O2K3K.cjs.map +1 -0
  43. package/dist/contracts/index.cjs +57 -0
  44. package/dist/contracts/index.cjs.map +1 -0
  45. package/dist/contracts/index.d.cts +8 -0
  46. package/dist/contracts/index.d.ts +8 -0
  47. package/dist/contracts/index.mjs +57 -0
  48. package/dist/contracts/index.mjs.map +1 -0
  49. package/dist/delegation-7PtFix8Y.d.ts +376 -0
  50. package/dist/delegation-d52Owevd.d.cts +376 -0
  51. package/dist/experimental/index.cjs +143 -0
  52. package/dist/experimental/index.cjs.map +1 -0
  53. package/dist/experimental/index.d.cts +29 -0
  54. package/dist/experimental/index.d.ts +29 -0
  55. package/dist/experimental/index.mjs +143 -0
  56. package/dist/experimental/index.mjs.map +1 -0
  57. package/dist/index-0-B0YlEP.d.cts +21935 -0
  58. package/dist/index-18Alar1P.d.ts +1174 -0
  59. package/dist/index-CLkk7zr4.d.cts +1174 -0
  60. package/dist/index-D1WbhKCc.d.ts +21935 -0
  61. package/dist/index.cjs +424 -0
  62. package/dist/index.cjs.map +1 -0
  63. package/dist/index.d.cts +56 -0
  64. package/dist/index.d.ts +56 -0
  65. package/dist/index.mjs +424 -0
  66. package/dist/index.mjs.map +1 -0
  67. package/dist/smartAccountsEnvironment-BOhrxEnt.d.ts +12 -0
  68. package/dist/smartAccountsEnvironment-SVknZ_3f.d.cts +12 -0
  69. package/dist/types-Bwksz_U6.d.cts +136 -0
  70. package/dist/types-Bwksz_U6.d.ts +136 -0
  71. package/dist/userOp-CFv4wNkl.d.cts +33 -0
  72. package/dist/userOp-CFv4wNkl.d.ts +33 -0
  73. package/dist/utils/index.cjs +60 -0
  74. package/dist/utils/index.cjs.map +1 -0
  75. package/dist/utils/index.d.cts +47 -0
  76. package/dist/utils/index.d.ts +47 -0
  77. package/dist/utils/index.mjs +60 -0
  78. package/dist/utils/index.mjs.map +1 -0
  79. package/package.json +151 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/smart-accounts-kit/smart-accounts-kit/packages/smart-accounts-kit/dist/chunk-WA2O2K3K.cjs","../src/actions/index.ts","../src/actions/erc7710RedeemDelegationAction.ts","../src/actions/erc7715RequestExecutionPermissionsAction.ts","../src/actions/getCaveatAvailableAmount.ts","../src/actions/isValid7702Implementation.ts","../src/actions/signDelegation.ts","../src/actions/signUserOperation.ts"],"names":["BaseError"],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACrBA,IAAA,gBAAA,EAAA,CAAA,CAAA;AAAA,wCAAA,eAAA,EAAA;AAAA,EAAA,qBAAA,EAAA,CAAA,EAAA,GAAA,qBAAA;AAAA,EAAA,qBAAA,EAAA,CAAA,EAAA,GAAA,qBAAA;AAAA,EAAA,oBAAA,EAAA,CAAA,EAAA,GAAA,oBAAA;AAAA,EAAA,sBAAA,EAAA,CAAA,EAAA,GAAA,sBAAA;AAAA,EAAA,6CAAA,EAAA,CAAA,EAAA,GAAA,6CAAA;AAAA,EAAA,wCAAA,EAAA,CAAA,EAAA,GAAA,wCAAA;AAAA,EAAA,0CAAA,EAAA,CAAA,EAAA,GAAA,0CAAA;AAAA,EAAA,mDAAA,EAAA,CAAA,EAAA,GAAA,mDAAA;AAAA,EAAA,8CAAA,EAAA,CAAA,EAAA,GAAA,8CAAA;AAAA,EAAA,yBAAA,EAAA,CAA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A;AACkB,QAAA;AACXA,UAAAA;AACR,YAAA;AACF,UAAA;AACF,QAAA;AACoB,QAAA;AACnB,MAAA;AACF,MAAA;AACJ,IAAA;AACL,EAAA;AACF;AP2iBqE;AACA;AC1nBJ;AAG1D,EAAA;AACI,IAAA;AACL,MAAA;AACA,MAAA;AACF,IAAA;AACF,EAAA;AACF;AAEqE;AAG9D,EAAA;AACP;AAEgE;AAGzD,EAAA;AACP;ADonBqE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/smart-accounts-kit/smart-accounts-kit/packages/smart-accounts-kit/dist/chunk-WA2O2K3K.cjs","sourcesContent":[null,"import type { Client, WalletClient } from 'viem';\nimport type { BundlerClient } from 'viem/account-abstraction';\n\nimport type {\n SendTransactionWithDelegationParameters,\n SendUserOperationWithDelegationParameters,\n} from './erc7710RedeemDelegationAction';\nimport {\n sendTransactionWithDelegationAction,\n sendUserOperationWithDelegationAction,\n} from './erc7710RedeemDelegationAction';\nimport { erc7715RequestExecutionPermissionsAction } from './erc7715RequestExecutionPermissionsAction';\nimport type {\n MetaMaskExtensionClient,\n RequestExecutionPermissionsParameters,\n} from './erc7715RequestExecutionPermissionsAction';\n\nexport {\n // Individual action functions\n getErc20PeriodTransferEnforcerAvailableAmount,\n getErc20StreamingEnforcerAvailableAmount,\n getMultiTokenPeriodEnforcerAvailableAmount,\n getNativeTokenPeriodTransferEnforcerAvailableAmount,\n getNativeTokenStreamingEnforcerAvailableAmount,\n // Action builder\n caveatEnforcerActions,\n // Parameter types\n type CaveatEnforcerParams,\n // Result types\n type PeriodTransferResult,\n type StreamingResult,\n} from './getCaveatAvailableAmount';\n\nexport { isValid7702Implementation } from './isValid7702Implementation';\n\n// Signing actions\nexport {\n signDelegation,\n signDelegationActions,\n type SignDelegationParameters,\n type SignDelegationReturnType,\n} from './signDelegation';\n\nexport {\n signUserOperation,\n signUserOperationActions,\n type SignUserOperationParameters,\n type SignUserOperationReturnType,\n} from './signUserOperation';\n\nexport {\n erc7715RequestExecutionPermissionsAction as requestExecutionPermissions,\n type MetaMaskExtensionClient,\n type MetaMaskExtensionSchema,\n type RequestExecutionPermissionsParameters,\n type RequestExecutionPermissionsReturnType,\n} from './erc7715RequestExecutionPermissionsAction';\n\nexport type { DelegatedCall } from './erc7710RedeemDelegationAction';\n\nexport const erc7715ProviderActions = () => (client: Client) => ({\n requestExecutionPermissions: async (\n parameters: RequestExecutionPermissionsParameters,\n ) => {\n return erc7715RequestExecutionPermissionsAction(\n client as MetaMaskExtensionClient,\n parameters,\n );\n },\n});\n\nexport const erc7710WalletActions = () => (client: WalletClient) => ({\n sendTransactionWithDelegation: async (\n args: SendTransactionWithDelegationParameters,\n ) => sendTransactionWithDelegationAction(client, args),\n});\n\nexport const erc7710BundlerActions = () => (client: Client) => ({\n sendUserOperationWithDelegation: async (\n args: SendUserOperationWithDelegationParameters,\n ) => sendUserOperationWithDelegationAction(client as BundlerClient, args),\n});\n","import { DelegationManager } from '@metamask/delegation-abis';\nimport type {\n Account,\n Chain,\n Hex,\n OneOf,\n PublicClient,\n SendTransactionParameters,\n SendTransactionRequest,\n Transport,\n WalletClient,\n} from 'viem';\nimport { concat, encodeFunctionData, isAddressEqual } from 'viem';\nimport type {\n BundlerClient,\n SendUserOperationParameters,\n SmartAccount,\n} from 'viem/account-abstraction';\n\nimport {\n createExecution,\n encodeExecutionCalldatas,\n ExecutionMode,\n} from '../executions';\nimport { getSmartAccountsEnvironment } from '../smartAccountsEnvironment';\nimport type { Call } from '../types';\n\nexport type DelegatedCall = Call &\n OneOf<{ permissionsContext: Hex; delegationManager: Hex } | object>;\n\nexport type SendTransactionWithDelegationParameters<\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends Account | undefined = Account | undefined,\n TChainOverride extends Chain | undefined = Chain | undefined,\n TRequest extends SendTransactionRequest<\n TChain,\n TChainOverride\n > = SendTransactionRequest<TChain, TChainOverride>,\n> = SendTransactionParameters<TChain, TAccount, TChainOverride, TRequest> & {\n permissionsContext: Hex;\n delegationManager: Hex;\n};\n\n/**\n * Sends a transaction using delegation to execute operations on behalf of another account.\n *\n * @param client - The wallet client to use for sending the transaction.\n * @param args - Transaction parameters with delegation details.\n * @returns Transaction hash of the executed transaction.\n */\nexport async function sendTransactionWithDelegationAction<\n TChain extends Chain | undefined,\n TAccount extends Account | undefined,\n>(\n client: WalletClient<Transport, TChain, TAccount>,\n args: SendTransactionWithDelegationParameters<TChain, TAccount>,\n) {\n if (!args.to) {\n throw new Error(\n '`to` is required. `sendTransactionWithDelegation` cannot be used to deploy contracts.',\n );\n }\n\n const executions = [\n createExecution({\n target: args.to,\n value: args.value,\n callData: args.data,\n }),\n ];\n\n const calldata = encodeFunctionData({\n abi: DelegationManager.abi,\n functionName: 'redeemDelegations',\n args: [\n [args.permissionsContext],\n [ExecutionMode.SingleDefault],\n encodeExecutionCalldatas([executions]),\n ],\n });\n\n const {\n value: _value,\n permissionsContext: _permissionsContext,\n delegationManager: _delegationManager,\n ...rest\n } = args;\n\n const hash = await client.sendTransaction({\n ...rest,\n to: args.delegationManager,\n data: calldata,\n } as unknown as SendTransactionParameters);\n\n return hash;\n}\n\nexport type SendUserOperationWithDelegationParameters<\n TAccount extends SmartAccount | undefined = SmartAccount | undefined,\n TAccountOverride extends SmartAccount | undefined = SmartAccount | undefined,\n> = SendUserOperationParameters<TAccount, TAccountOverride, DelegatedCall[]> & {\n accountMetadata?: { factory: Hex; factoryData: Hex }[];\n calls: DelegatedCall[];\n publicClient: PublicClient<Transport, Chain>;\n};\n\n/**\n * Broadcasts a User Operation with delegation to the Bundler.\n *\n * @param client - Client to use for sending the user operation.\n * @param parameters - Parameters for the user operation with delegation.\n * @returns The User Operation hash of the broadcasted operation.\n * @example\n * import { createBundlerClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const bundlerClient = createBundlerClient({\n * chain: mainnet,\n * transport: http(),\n * })\n *\n * const userOpHash = await sendUserOperationWithDelegationAction(bundlerClient, {\n * account: bobSmartAccount,\n * calls: [\n * {\n * to: aliceCounterContractAddress,\n * data: encodeFunctionData({\n * abi: CounterMetadata.abi,\n * functionName: 'increment',\n * }),\n * value: 0n,\n * permissionsContext: '0x...',\n * delegationManager: '0x...',\n * },\n * ],\n * accountMetadata: [{ factory: '0x...', factoryData: '0x...' }], // Optional: for deploying accounts\n * })\n */\nexport async function sendUserOperationWithDelegationAction<\n TAccount extends SmartAccount | undefined,\n TAccountOverride extends SmartAccount | undefined = undefined,\n>(\n client: BundlerClient<Transport, Chain | undefined, TAccount>,\n parameters: SendUserOperationWithDelegationParameters<\n TAccount,\n TAccountOverride\n >,\n) {\n if (parameters.accountMetadata) {\n const { publicClient } = parameters;\n\n const includedAccountKeys: Record<Hex, boolean> = {};\n\n const chainId = publicClient.chain?.id;\n\n if (!chainId) {\n throw new Error('Chain ID is not set');\n }\n\n const { SimpleFactory } = getSmartAccountsEnvironment(chainId);\n\n const uniqueAccountMetadatas = parameters.accountMetadata.filter(\n (accountMetadata) => {\n if (!isAddressEqual(accountMetadata.factory, SimpleFactory)) {\n throw new Error(\n `Invalid accountMetadata: ${accountMetadata.factory} is not allowed.`,\n );\n }\n\n // ensure that factory calls are not duplicated\n const accountKey = concat([\n accountMetadata.factory,\n accountMetadata.factoryData,\n ]);\n const isDuplicate = includedAccountKeys[accountKey];\n\n includedAccountKeys[accountKey] = true;\n return !isDuplicate;\n },\n );\n\n const factoryCalls = (\n await Promise.all(\n uniqueAccountMetadatas.map(async ({ factory, factoryData }) => {\n const isDeployed = await publicClient\n .call({\n to: factory,\n data: factoryData,\n })\n .then(() => false)\n .catch(() => true);\n\n if (isDeployed) {\n return undefined;\n }\n return {\n to: factory,\n value: 0n,\n data: factoryData,\n };\n }),\n )\n ).filter((call: Call | undefined) => call !== undefined) as Call[];\n\n parameters.calls = [\n ...(factoryCalls as DelegatedCall[]),\n ...parameters.calls,\n ];\n }\n\n return client.sendUserOperation(\n parameters as unknown as SendUserOperationParameters,\n );\n}\n","import type {\n AccountSigner,\n Erc20TokenPeriodicPermission,\n Erc20TokenStreamPermission,\n NativeTokenPeriodicPermission,\n NativeTokenStreamPermission,\n PermissionRequest,\n PermissionResponse,\n PermissionTypes,\n Rule,\n} from '@metamask/7715-permission-types';\nimport { isHex, toHex } from 'viem';\nimport type {\n Client,\n Account,\n RpcSchema,\n Transport,\n Chain,\n Address,\n} from 'viem';\n\n/**\n * RPC schema for MetaMask related methods.\n *\n * Extends the base RPC schema with methods specific to interacting with EIP-7715:\n * - `wallet_invokeSnap`: Invokes a method on a specific Snap.\n */\nexport type MetaMaskExtensionSchema = RpcSchema &\n [\n {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Method: 'wallet_requestExecutionPermissions';\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Params: PermissionRequest<AccountSigner, PermissionTypes>[];\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ReturnType: PermissionResponse<AccountSigner, PermissionTypes>[];\n },\n ];\n\n/**\n * A Viem client extended with MetaMask Snap-specific RPC methods.\n *\n * This client type allows for interaction with MetaMask Snaps through\n * the standard Viem client interface, with added type safety for\n * Snap-specific methods.\n */\nexport type MetaMaskExtensionClient = Client<\n Transport,\n Chain | undefined,\n Account | undefined,\n MetaMaskExtensionSchema\n>;\n\ntype PermissionParameter = {\n type: string;\n data: Record<string, unknown>;\n};\n\n/**\n * Represents a native token stream permission.\n * This allows for continuous token streaming with defined parameters.\n */\nexport type NativeTokenStreamPermissionParameter = PermissionParameter & {\n type: 'native-token-stream';\n data: {\n amountPerSecond: bigint;\n initialAmount?: bigint;\n maxAmount?: bigint;\n startTime?: number;\n justification?: string;\n };\n};\n\n/**\n * Represents an ERC-20 token stream permission.\n * This allows for continuous ERC-20 token streaming with defined parameters.\n */\nexport type Erc20TokenStreamPermissionParameter = PermissionParameter & {\n type: 'erc20-token-stream';\n data: {\n tokenAddress: Address;\n amountPerSecond: bigint;\n initialAmount?: bigint;\n maxAmount?: bigint;\n startTime?: number;\n justification?: string;\n };\n};\n\n/**\n * Represents a native token periodic permission.\n * This allows for periodic native token transfers with defined parameters.\n */\nexport type NativeTokenPeriodicPermissionParameter = PermissionParameter & {\n type: 'native-token-periodic';\n data: {\n periodAmount: bigint;\n periodDuration: number;\n startTime?: number;\n justification?: string;\n };\n};\n\n/**\n * Represents an ERC-20 token periodic permission.\n * This allows for periodic ERC-20 token transfers with defined parameters.\n */\nexport type Erc20TokenPeriodicPermissionParameter = PermissionParameter & {\n type: 'erc20-token-periodic';\n data: {\n tokenAddress: Address;\n periodAmount: bigint;\n periodDuration: number;\n startTime?: number;\n justification?: string;\n };\n};\n\nexport type SupportedPermissionParams =\n | NativeTokenStreamPermissionParameter\n | Erc20TokenStreamPermissionParameter\n | NativeTokenPeriodicPermissionParameter\n | Erc20TokenPeriodicPermissionParameter;\n\nexport type SignerParam = Address | AccountSigner;\n\n/**\n * Represents a single permission request.\n */\nexport type PermissionRequestParameter = {\n chainId: number;\n // The permission to grant to the user.\n permission: SupportedPermissionParams;\n // Whether the caller allows the permission to be adjusted.\n isAdjustmentAllowed: boolean;\n // Account to assign the permission to.\n signer: SignerParam;\n // address from which the permission should be granted.\n address?: Address;\n // Timestamp (in seconds) that specifies the time by which this permission MUST expire.\n expiry: number;\n};\n\n/**\n * Parameters for the RequestExecutionPermissions action.\n *\n * @template Signer - The type of the signer, either an Address or Account.\n */\nexport type RequestExecutionPermissionsParameters =\n PermissionRequestParameter[];\n\n/**\n * Return type for the request execution permissions action.\n */\nexport type RequestExecutionPermissionsReturnType = PermissionResponse<\n AccountSigner,\n PermissionTypes\n>[];\n\n/**\n * Grants permissions according to EIP-7715 specification.\n *\n * @template Signer - The type of the signer, either an Address or Account.\n * @param client - The client to use for the request.\n * @param parameters - The permissions requests to grant.\n * @returns A promise that resolves to the permission responses.\n * @description\n * This function formats the permissions requests and invokes the wallet method to grant permissions.\n * It will throw an error if the permissions could not be granted.\n */\nexport async function erc7715RequestExecutionPermissionsAction(\n client: MetaMaskExtensionClient,\n parameters: RequestExecutionPermissionsParameters,\n): Promise<RequestExecutionPermissionsReturnType> {\n const formattedPermissionRequest = parameters.map(formatPermissionsRequest);\n\n const result = await client.request(\n {\n method: 'wallet_requestExecutionPermissions',\n params: formattedPermissionRequest,\n },\n { retryCount: 0 },\n );\n\n if (!result) {\n throw new Error('Failed to grant permissions');\n }\n\n return result;\n}\n\n/**\n * Formats a permissions request for submission to the wallet.\n *\n * @param parameters - The permissions request to format.\n * @returns The formatted permissions request.\n * @internal\n */\nfunction formatPermissionsRequest(\n parameters: PermissionRequestParameter,\n): PermissionRequest<AccountSigner, PermissionTypes> {\n const { chainId, address, expiry, isAdjustmentAllowed } = parameters;\n\n const permissionFormatter = getPermissionFormatter(\n parameters.permission.type,\n );\n\n const signerAddress =\n typeof parameters.signer === 'string'\n ? parameters.signer\n : parameters.signer.data.address;\n\n const rules: Rule[] = [\n {\n type: 'expiry',\n isAdjustmentAllowed,\n data: {\n timestamp: expiry,\n },\n },\n ];\n\n const optionalFields = {\n ...(address ? { address } : {}),\n };\n\n return {\n ...optionalFields,\n chainId: toHex(chainId),\n permission: permissionFormatter({\n permission: parameters.permission,\n isAdjustmentAllowed,\n }),\n signer: {\n // MetaMask 7715 implementation only supports AccountSigner\n type: 'account',\n data: {\n address: signerAddress,\n },\n },\n rules,\n };\n}\n\n/**\n * Checks if a value is defined (not null or undefined).\n *\n * @param value - The value to check.\n * @returns A boolean indicating whether the value is defined.\n */\nfunction isDefined<TValue>(value: TValue | null | undefined): value is TValue {\n return value !== undefined && value !== null;\n}\n\n/**\n * Asserts that a value is defined (not null or undefined).\n *\n * @param value - The value to check.\n * @param message - Optional custom error message to throw if the value is not defined.\n * @throws {Error} If the value is null or undefined.\n */\nfunction assertIsDefined<TValue>(\n value: TValue | null | undefined,\n message?: string,\n): asserts value is TValue {\n if (!isDefined(value)) {\n throw new Error(message ?? 'Invalid parameters: value is required');\n }\n}\n\n/**\n * Converts a value to a hex string or throws an error if the value is invalid.\n *\n * @param value - The value to convert to hex.\n * @param message - Optional custom error message.\n * @returns The value as a hex string.\n */\nfunction toHexOrThrow(\n value: Parameters<typeof toHex>[0] | undefined,\n message?: string,\n) {\n assertIsDefined(value, message);\n\n if (typeof value === 'string') {\n if (!isHex(value)) {\n throw new Error('Invalid parameters: invalid hex value');\n }\n return value;\n }\n\n return toHex(value);\n}\n\ntype PermissionFormatter = (params: {\n permission: PermissionParameter;\n isAdjustmentAllowed: boolean;\n}) => PermissionTypes;\n\n/**\n * Gets the appropriate formatter function for a specific permission type.\n *\n * @param permissionType - The type of permission to format.\n * @returns A formatter function for the specified permission type.\n */\nfunction getPermissionFormatter(permissionType: string): PermissionFormatter {\n switch (permissionType) {\n case 'native-token-stream':\n return ({ permission, isAdjustmentAllowed }) =>\n formatNativeTokenStreamPermission({\n permission: permission as NativeTokenStreamPermissionParameter,\n isAdjustmentAllowed,\n });\n case 'erc20-token-stream':\n return ({ permission, isAdjustmentAllowed }) =>\n formatErc20TokenStreamPermission({\n permission: permission as Erc20TokenStreamPermissionParameter,\n isAdjustmentAllowed,\n });\n\n case 'native-token-periodic':\n return ({ permission, isAdjustmentAllowed }) =>\n formatNativeTokenPeriodicPermission({\n permission: permission as NativeTokenPeriodicPermissionParameter,\n isAdjustmentAllowed,\n });\n case 'erc20-token-periodic':\n return ({ permission, isAdjustmentAllowed }) =>\n formatErc20TokenPeriodicPermission({\n permission: permission as Erc20TokenPeriodicPermissionParameter,\n isAdjustmentAllowed,\n });\n default:\n throw new Error(`Unsupported permission type: ${permissionType}`);\n }\n}\n\n/**\n * Formats a native token stream permission for the wallet.\n *\n * @param permission - The native token stream permission to format.\n * @param permission.permission - The native token stream permission to format.\n * @param permission.isAdjustmentAllowed - Whether the permission is allowed to be adjusted.\n * @returns The formatted permission object.\n */\nfunction formatNativeTokenStreamPermission({\n permission,\n isAdjustmentAllowed,\n}: {\n permission: NativeTokenStreamPermissionParameter;\n isAdjustmentAllowed: boolean;\n}): NativeTokenStreamPermission {\n const {\n data: {\n initialAmount,\n justification,\n maxAmount,\n startTime,\n amountPerSecond,\n },\n } = permission;\n\n const optionalFields = {\n ...(isDefined(initialAmount) && {\n initialAmount: toHexOrThrow(initialAmount),\n }),\n ...(isDefined(maxAmount) && {\n maxAmount: toHexOrThrow(maxAmount),\n }),\n ...(isDefined(startTime) && {\n startTime: Number(startTime),\n }),\n ...(justification ? { justification } : {}),\n };\n\n return {\n type: 'native-token-stream',\n data: {\n amountPerSecond: toHexOrThrow(\n amountPerSecond,\n 'Invalid parameters: amountPerSecond is required',\n ),\n ...optionalFields,\n },\n isAdjustmentAllowed,\n };\n}\n\n/**\n * Formats an ERC-20 token stream permission parameter into the required\n * Erc20TokenStreamPermission object, converting numeric values to hex strings\n * and including only specified optional fields.\n *\n * @param params - The parameters for formatting the ERC-20 token stream permission.\n * @param params.permission - The ERC-20 token stream permission parameter to format.\n * @param params.isAdjustmentAllowed - Whether adjustment of the stream is allowed.\n * @returns The formatted Erc20TokenStreamPermission object.\n */\nfunction formatErc20TokenStreamPermission({\n permission,\n isAdjustmentAllowed,\n}: {\n permission: Erc20TokenStreamPermissionParameter;\n isAdjustmentAllowed: boolean;\n}): Erc20TokenStreamPermission {\n const {\n data: {\n tokenAddress,\n amountPerSecond,\n initialAmount,\n startTime,\n maxAmount,\n justification,\n },\n } = permission;\n\n const optionalFields = {\n ...(isDefined(initialAmount) && {\n initialAmount: toHexOrThrow(initialAmount),\n }),\n ...(isDefined(maxAmount) && {\n maxAmount: toHexOrThrow(maxAmount),\n }),\n ...(isDefined(startTime) && {\n startTime: Number(startTime),\n }),\n ...(justification ? { justification } : {}),\n };\n\n return {\n type: 'erc20-token-stream',\n data: {\n tokenAddress: toHexOrThrow(tokenAddress),\n amountPerSecond: toHexOrThrow(amountPerSecond),\n ...optionalFields,\n },\n isAdjustmentAllowed,\n };\n}\n\n/**\n * Formats a native token periodic permission for submission to the wallet.\n *\n * @param params - The parameters for formatting the native token periodic permission.\n * @param params.permission - The native token periodic permission parameter to format.\n * @param params.isAdjustmentAllowed - Whether the permission is allowed to be adjusted.\n * @returns The formatted NativeTokenPeriodicPermission object.\n */\nfunction formatNativeTokenPeriodicPermission({\n permission,\n isAdjustmentAllowed,\n}: {\n permission: NativeTokenPeriodicPermissionParameter;\n isAdjustmentAllowed: boolean;\n}): NativeTokenPeriodicPermission {\n const {\n data: { periodAmount, periodDuration, startTime, justification },\n } = permission;\n\n const optionalFields = {\n ...(isDefined(startTime) && {\n startTime: Number(startTime),\n }),\n ...(justification ? { justification } : {}),\n };\n\n return {\n type: 'native-token-periodic',\n data: {\n periodAmount: toHexOrThrow(periodAmount),\n periodDuration: Number(periodDuration),\n ...optionalFields,\n },\n isAdjustmentAllowed,\n };\n}\n\n/**\n * Formats an ERC20 token periodic permission for submission to the wallet.\n *\n * @param params - The parameters for formatting the ERC20 token periodic permission.\n * @param params.permission - The ERC20 token periodic permission parameter to format.\n * @param params.isAdjustmentAllowed - Whether the permission is allowed to be adjusted.\n * @returns The formatted Erc20TokenPeriodicPermission object.\n */\nfunction formatErc20TokenPeriodicPermission({\n permission,\n isAdjustmentAllowed,\n}: {\n permission: Erc20TokenPeriodicPermissionParameter;\n isAdjustmentAllowed: boolean;\n}): Erc20TokenPeriodicPermission {\n const {\n data: {\n tokenAddress,\n periodAmount,\n periodDuration,\n startTime,\n justification,\n },\n } = permission;\n\n const optionalFields = {\n ...(isDefined(startTime) && {\n startTime: Number(startTime),\n }),\n ...(justification ? { justification } : {}),\n };\n\n return {\n type: 'erc20-token-periodic',\n data: {\n tokenAddress: toHexOrThrow(tokenAddress),\n periodAmount: toHexOrThrow(periodAmount),\n periodDuration: Number(periodDuration),\n ...optionalFields,\n },\n isAdjustmentAllowed,\n };\n}\n","import type { Address, Hex, Client } from 'viem';\n\nimport { getDelegationHashOffchain } from '../delegation';\nimport * as ERC20PeriodTransferEnforcer from '../DelegationFramework/ERC20PeriodTransferEnforcer';\nimport * as ERC20StreamingEnforcer from '../DelegationFramework/ERC20StreamingEnforcer';\nimport * as MultiTokenPeriodEnforcer from '../DelegationFramework/MultiTokenPeriodEnforcer';\nimport * as NativeTokenPeriodTransferEnforcer from '../DelegationFramework/NativeTokenPeriodTransferEnforcer';\nimport * as NativeTokenStreamingEnforcer from '../DelegationFramework/NativeTokenStreamingEnforcer';\nimport type { SmartAccountsEnvironment, Delegation } from '../types';\n\n/**\n * Parameters for all caveat enforcer actions.\n */\nexport type CaveatEnforcerParams = {\n delegation: Delegation;\n};\n\n/**\n * Return type for period-based transfer enforcers\n */\nexport type PeriodTransferResult = {\n availableAmount: bigint;\n isNewPeriod: boolean;\n currentPeriod: bigint;\n};\n\n/**\n * Return type for streaming enforcers\n */\nexport type StreamingResult = {\n availableAmount: bigint;\n};\n\n/**\n * Finds a caveat that matches the specified enforcer address.\n * @param config - The configuration object.\n * @param config.delegation - The delegation to search.\n * @param config.enforcerAddress - The enforcer address to match.\n * @param config.enforcerName - The name of the enforcer.\n * @returns The matching caveat.\n * @throws Error if no matching caveat is found.\n * @throws Error if multiple matching caveats are found.\n */\nfunction findMatchingCaveat({\n delegation,\n enforcerAddress,\n enforcerName,\n}: {\n delegation: Delegation;\n enforcerAddress: Address;\n enforcerName: keyof SmartAccountsEnvironment['caveatEnforcers'];\n}): { terms: Hex; args: Hex } {\n const matchingCaveats = delegation.caveats.filter(\n (caveat) => caveat.enforcer.toLowerCase() === enforcerAddress.toLowerCase(),\n );\n\n if (matchingCaveats.length === 0) {\n throw new Error(`No caveat found with enforcer matching ${enforcerName}`);\n }\n\n if (matchingCaveats.length > 1) {\n throw new Error(\n `Multiple caveats found with enforcer matching ${enforcerName}`,\n );\n }\n\n const [{ terms, args }] = matchingCaveats as unknown as [\n { terms: Hex; args: Hex },\n ];\n\n return {\n terms,\n args,\n };\n}\n\n/**\n * Gets the delegation manager address from environment.\n *\n * @param environment - The SmartAccountsEnvironment.\n * @returns The delegation manager address.\n */\nfunction getDelegationManager(environment: SmartAccountsEnvironment): Address {\n if (!environment.DelegationManager) {\n throw new Error('Delegation manager address not found');\n }\n\n return environment.DelegationManager;\n}\n\n/**\n * Gets the enforcer address from environment.\n *\n * @param config - The configuration object.\n * @param config.enforcerName - The name of the enforcer.\n * @param config.environment - The SmartAccountsEnvironment.\n * @returns The enforcer address.\n */\nfunction getEnforcerAddress({\n enforcerName,\n environment,\n}: {\n enforcerName: keyof SmartAccountsEnvironment['caveatEnforcers'];\n environment: SmartAccountsEnvironment;\n}): Address {\n const enforcerAddress = environment.caveatEnforcers[enforcerName];\n if (!enforcerAddress) {\n throw new Error(`${enforcerName} not found in environment`);\n }\n\n return enforcerAddress;\n}\n\n/**\n * Get available amount for ERC20 period transfer enforcer.\n *\n * @param client - The viem client.\n * @param environment - The SmartAccountsEnvironment.\n * @param params - The parameters for the ERC20 period transfer enforcer.\n * @returns Promise resolving to the period transfer result.\n */\nexport async function getErc20PeriodTransferEnforcerAvailableAmount(\n client: Client,\n environment: SmartAccountsEnvironment,\n params: CaveatEnforcerParams,\n): Promise<PeriodTransferResult> {\n const enforcerName = 'ERC20PeriodTransferEnforcer';\n\n const delegationManager = getDelegationManager(environment);\n const enforcerAddress = getEnforcerAddress({\n enforcerName,\n environment,\n });\n\n const delegationHash = getDelegationHashOffchain(params.delegation);\n const { terms } = findMatchingCaveat({\n delegation: params.delegation,\n enforcerAddress,\n enforcerName,\n });\n\n return ERC20PeriodTransferEnforcer.read.getAvailableAmount({\n client,\n contractAddress: enforcerAddress,\n delegationHash,\n delegationManager,\n terms,\n });\n}\n\n/**\n * Get available amount for ERC20 streaming enforcer.\n *\n * @param client - The viem client.\n * @param environment - The SmartAccountsEnvironment.\n * @param params - The parameters for the ERC20 streaming enforcer.\n * @returns Promise resolving to the streaming result.\n */\nexport async function getErc20StreamingEnforcerAvailableAmount(\n client: Client,\n environment: SmartAccountsEnvironment,\n params: CaveatEnforcerParams,\n): Promise<StreamingResult> {\n const enforcerName = 'ERC20StreamingEnforcer';\n const delegationManager = getDelegationManager(environment);\n const enforcerAddress = getEnforcerAddress({\n enforcerName,\n environment,\n });\n\n const delegationHash = getDelegationHashOffchain(params.delegation);\n const { terms } = findMatchingCaveat({\n delegation: params.delegation,\n enforcerAddress,\n enforcerName,\n });\n\n return ERC20StreamingEnforcer.read.getAvailableAmount({\n client,\n contractAddress: enforcerAddress,\n delegationManager,\n delegationHash,\n terms,\n });\n}\n\n/**\n * Get available amount for multi-token period enforcer.\n *\n * @param client - The viem client.\n * @param environment - The SmartAccountsEnvironment.\n * @param params - The parameters for the multi-token period enforcer.\n * @returns Promise resolving to the period transfer result.\n */\nexport async function getMultiTokenPeriodEnforcerAvailableAmount(\n client: Client,\n environment: SmartAccountsEnvironment,\n params: CaveatEnforcerParams,\n): Promise<PeriodTransferResult> {\n const enforcerName = 'MultiTokenPeriodEnforcer';\n const delegationManager = getDelegationManager(environment);\n const enforcerAddress = getEnforcerAddress({\n enforcerName,\n environment,\n });\n\n const delegationHash = getDelegationHashOffchain(params.delegation);\n const { terms, args } = findMatchingCaveat({\n delegation: params.delegation,\n enforcerAddress,\n enforcerName,\n });\n\n return MultiTokenPeriodEnforcer.read.getAvailableAmount({\n client,\n contractAddress: enforcerAddress,\n delegationHash,\n delegationManager,\n terms,\n args,\n });\n}\n\n/**\n * Get available amount for native token period transfer enforcer.\n *\n * @param client - The viem client.\n * @param environment - The SmartAccountsEnvironment.\n * @param params - The parameters for the native token period transfer enforcer.\n * @returns Promise resolving to the period transfer result.\n */\nexport async function getNativeTokenPeriodTransferEnforcerAvailableAmount(\n client: Client,\n environment: SmartAccountsEnvironment,\n params: CaveatEnforcerParams,\n): Promise<PeriodTransferResult> {\n const enforcerName = 'NativeTokenPeriodTransferEnforcer';\n const delegationManager = getDelegationManager(environment);\n const enforcerAddress = getEnforcerAddress({\n enforcerName,\n environment,\n });\n\n const delegationHash = getDelegationHashOffchain(params.delegation);\n const { terms } = findMatchingCaveat({\n delegation: params.delegation,\n enforcerAddress,\n enforcerName,\n });\n\n return NativeTokenPeriodTransferEnforcer.read.getAvailableAmount({\n client,\n contractAddress: enforcerAddress,\n delegationHash,\n delegationManager,\n terms,\n });\n}\n\n/**\n * Get available amount for native token streaming enforcer.\n *\n * @param client - The viem client.\n * @param environment - The SmartAccountsEnvironment.\n * @param params - The parameters for the native token streaming enforcer.\n * @returns Promise resolving to the streaming result.\n */\nexport async function getNativeTokenStreamingEnforcerAvailableAmount(\n client: Client,\n environment: SmartAccountsEnvironment,\n params: CaveatEnforcerParams,\n): Promise<StreamingResult> {\n const enforcerName = 'NativeTokenStreamingEnforcer';\n const delegationManager = getDelegationManager(environment);\n const enforcerAddress = getEnforcerAddress({\n enforcerName,\n environment,\n });\n\n const delegationHash = getDelegationHashOffchain(params.delegation);\n const { terms } = findMatchingCaveat({\n delegation: params.delegation,\n enforcerAddress,\n enforcerName,\n });\n\n return NativeTokenStreamingEnforcer.read.getAvailableAmount({\n client,\n contractAddress: enforcerAddress,\n delegationManager,\n delegationHash,\n terms,\n });\n}\n\n/**\n * Caveat enforcer actions for extending viem clients.\n *\n * @param params - The parameters object.\n * @param params.environment - The SmartAccountsEnvironment.\n * @returns A function that takes a client and returns the client extension with caveat enforcer actions.\n */\nexport const caveatEnforcerActions =\n ({ environment }: { environment: SmartAccountsEnvironment }) =>\n (client: Client) => ({\n /**\n * Get available amount for ERC20 period transfer enforcer.\n *\n * @param params - The parameters for the ERC20 period transfer enforcer.\n * @returns Promise resolving to the period transfer result.\n */\n getErc20PeriodTransferEnforcerAvailableAmount: async (\n params: CaveatEnforcerParams,\n ): Promise<PeriodTransferResult> => {\n return getErc20PeriodTransferEnforcerAvailableAmount(\n client,\n environment,\n params,\n );\n },\n\n /**\n * Get available amount for ERC20 streaming enforcer.\n *\n * @param params - The parameters for the ERC20 streaming enforcer.\n * @returns Promise resolving to the streaming result.\n */\n getErc20StreamingEnforcerAvailableAmount: async (\n params: CaveatEnforcerParams,\n ): Promise<StreamingResult> => {\n return getErc20StreamingEnforcerAvailableAmount(\n client,\n environment,\n params,\n );\n },\n\n /**\n * Get available amount for multi-token period enforcer.\n *\n * @param params - The parameters for the multi-token period enforcer.\n * @returns Promise resolving to the period transfer result.\n */\n getMultiTokenPeriodEnforcerAvailableAmount: async (\n params: CaveatEnforcerParams,\n ): Promise<PeriodTransferResult> => {\n return getMultiTokenPeriodEnforcerAvailableAmount(\n client,\n environment,\n params,\n );\n },\n\n /**\n * Get available amount for native token period transfer enforcer.\n *\n * @param params - The parameters for the native token period transfer enforcer.\n * @returns Promise resolving to the period transfer result.\n */\n getNativeTokenPeriodTransferEnforcerAvailableAmount: async (\n params: CaveatEnforcerParams,\n ): Promise<PeriodTransferResult> => {\n return getNativeTokenPeriodTransferEnforcerAvailableAmount(\n client,\n environment,\n params,\n );\n },\n\n /**\n * Get available amount for native token streaming enforcer.\n *\n * @param params - The parameters for the native token streaming enforcer.\n * @returns Promise resolving to the streaming result.\n */\n getNativeTokenStreamingEnforcerAvailableAmount: async (\n params: CaveatEnforcerParams,\n ): Promise<StreamingResult> => {\n return getNativeTokenStreamingEnforcerAvailableAmount(\n client,\n environment,\n params,\n );\n },\n });\n","import type { Client, Address, Hex } from 'viem';\nimport { isAddressEqual } from 'viem';\nimport { getCode } from 'viem/actions';\n\nimport type { SmartAccountsEnvironment } from '../types';\n\n// EIP-7702 delegation prefix (0xef0100)\nconst DELEGATION_PREFIX = '0xef0100' as const;\n\n/**\n * Parameters for checking if an account is delegated to the EIP-7702 implementation.\n */\nexport type IsValid7702ImplementationParameters = {\n /** The client to use for the query. */\n client: Client;\n /** The address to check for proper delegation. */\n accountAddress: Address;\n /** The SmartAccountsEnvironment containing contract addresses. */\n environment: SmartAccountsEnvironment;\n};\n\n/**\n * Extracts the delegated contract address from EIP-7702 delegation code.\n *\n * @param code - The code returned from getCode for a delegated account.\n * @returns The delegated contract address or null if not a valid delegation.\n */\nfunction extractDelegatedAddress(code: Hex | undefined): Address | null {\n if (code?.length !== 48) {\n // 0x (2 chars) + ef0100 (6 chars) + address (40 chars) = 48 chars\n return null;\n }\n\n if (!code.toLowerCase().startsWith(DELEGATION_PREFIX.toLowerCase())) {\n return null;\n }\n\n // Extract the 20-byte address after the delegation prefix\n const addressHex = code.slice(8); // Remove '0xef0100' prefix (8 chars)\n return `0x${addressHex}`;\n}\n\n/**\n * Checks if an account is properly delegated to the EIP-7702 implementation.\n *\n * This function validates EIP-7702 delegations by checking if the EOA has a 7702\n * contract assigned to it and comparing the delegated address against the 7702\n * implementation found in the environment.\n *\n * @param params - The parameters for checking the delegation.\n * @param params.client - The client to use for the query.\n * @param params.accountAddress - The address to check for proper delegation.\n * @param params.environment - The SmartAccountsEnvironment containing contract addresses.\n * @returns A promise that resolves to true if the account is properly delegated to the 7702 implementation, false otherwise.\n * @example\n * ```typescript\n * const isValid = await isValid7702Implementation({\n * client: publicClient,\n * accountAddress: '0x...',\n * environment: smartAccountEnvironment,\n * });\n *\n * if (isValid) {\n * console.log('Account is properly delegated to EIP-7702 implementation');\n * } else {\n * console.log('Account is not properly delegated');\n * }\n * ```\n */\nexport async function isValid7702Implementation({\n client,\n accountAddress,\n environment,\n}: IsValid7702ImplementationParameters): Promise<boolean> {\n try {\n // Get the code at the account address\n const code = await getCode(client, {\n address: accountAddress,\n });\n\n // Extract the delegated contract address from the EIP-7702 delegation code\n const delegatedAddress = extractDelegatedAddress(code);\n\n // If no valid delegation found, return false\n if (!delegatedAddress) {\n return false;\n }\n\n // Compare the delegated address with the 7702 implementation in the environment\n const expectedImplementation =\n environment.implementations.EIP7702StatelessDeleGatorImpl;\n if (!expectedImplementation) {\n return false;\n }\n\n return isAddressEqual(delegatedAddress, expectedImplementation);\n } catch (error) {\n // If the call fails (e.g., no code at address, network error),\n // then it's not properly delegated to our implementation\n return false;\n }\n}\n","import type {\n Account,\n Address,\n Chain,\n Client,\n Hex,\n Transport,\n WalletClient,\n} from 'viem';\nimport { BaseError } from 'viem';\nimport { parseAccount } from 'viem/accounts';\n\nimport { prepareSignDelegationTypedData } from '../delegation';\nimport type { Delegation } from '../types';\n\nexport type SignDelegationParameters = {\n /** Account to sign with */\n account?: Account | Address;\n /** The delegation to sign */\n delegation: Omit<Delegation, 'signature'>;\n /** The address of the delegation manager contract */\n delegationManager: Address;\n /** The chain ID for the signature */\n chainId: number;\n /** The name of the contract */\n name?: string;\n /** The version of the contract */\n version?: string;\n /** Whether to allow insecure unrestricted delegation */\n allowInsecureUnrestrictedDelegation?: boolean;\n};\n\nexport type SignDelegationReturnType = Hex;\n\n/**\n * Signs a delegation using a wallet client.\n * @param client - The wallet client to use for signing.\n * @param parameters - The parameters for signing the delegation.\n * @returns The signature of the delegation.\n * @example\n * ```ts\n * const signature = await signDelegation(walletClient, {\n * delegation: {\n * delegate: '0x...',\n * delegator: '0x...',\n * authority: '0x...',\n * caveats: [],\n * salt: '0x'\n * },\n * delegationManager: '0x...',\n * chainId: 1\n * });\n * ```\n */\nexport async function signDelegation<\n TChain extends Chain | undefined,\n TAccount extends Account | undefined,\n>(\n client: Client<Transport, TChain, TAccount> & {\n signTypedData: WalletClient['signTypedData'];\n },\n parameters: SignDelegationParameters,\n): Promise<SignDelegationReturnType> {\n const {\n account: accountParam = client.account,\n delegation,\n delegationManager,\n chainId,\n name = 'DelegationManager',\n version = '1',\n allowInsecureUnrestrictedDelegation = false,\n } = parameters;\n\n if (!accountParam) {\n throw new BaseError('Account not found. Please provide an account.');\n }\n\n const account = parseAccount(accountParam);\n\n const typedData = prepareSignDelegationTypedData({\n delegation,\n delegationManager,\n chainId,\n name,\n version,\n allowInsecureUnrestrictedDelegation,\n });\n\n return client.signTypedData({\n account,\n ...typedData,\n });\n}\n\n/**\n * Creates a sign delegation action that can be used to extend a wallet client.\n * @returns A function that can be used with wallet client extend method.\n * @example\n * ```ts\n * const walletClient = createWalletClient({\n * chain: mainnet,\n * transport: http()\n * }).extend(signDelegationActions());\n * ```\n */\nexport function signDelegationActions() {\n return <\n TChain extends Chain | undefined,\n TAccount extends Account | undefined,\n >(\n client: Client<Transport, TChain, TAccount> & {\n signTypedData: WalletClient['signTypedData'];\n },\n ) => ({\n signDelegation: async (\n parameters: Omit<SignDelegationParameters, 'chainId'> & {\n chainId?: number;\n },\n ) =>\n signDelegation(client, {\n chainId:\n parameters.chainId ??\n (() => {\n if (!client.chain?.id) {\n throw new BaseError(\n 'Chain ID is required. Either provide it in parameters or configure the client with a chain.',\n );\n }\n return client.chain.id;\n })(),\n ...parameters,\n }),\n });\n}\n","import type {\n Account,\n Address,\n Chain,\n Client,\n Hex,\n Transport,\n WalletClient,\n} from 'viem';\nimport { BaseError } from 'viem';\nimport { parseAccount } from 'viem/accounts';\n\nimport { prepareSignUserOperationTypedData } from '../userOp';\nimport type { UserOperationV07 } from '../userOp';\n\nexport type SignUserOperationParameters = {\n /** Account to sign with */\n account?: Account | Address;\n /** The user operation to sign */\n userOperation: Omit<UserOperationV07, 'signature'>;\n /** The entry point contract address */\n entryPoint: { address: Address };\n /** The chain ID that the entry point is deployed on */\n chainId: number;\n /** The address of the smart account */\n address: Address;\n /** The name of the domain of the implementation contract */\n name: 'HybridDeleGator' | 'MultiSigDeleGator';\n /** The version of the domain of the implementation contract */\n version?: string;\n};\n\nexport type SignUserOperationReturnType = Hex;\n\n/**\n * Signs a user operation using a wallet client.\n * @param client - The wallet client to use for signing.\n * @param parameters - The parameters for signing the user operation.\n * @returns The signature of the user operation.\n * @example\n * ```ts\n * const signature = await signUserOperation(walletClient, {\n * userOperation: {\n * sender: '0x...',\n * nonce: 0n,\n * callData: '0x',\n * callGasLimit: 1000000n,\n * verificationGasLimit: 1000000n,\n * preVerificationGas: 21000n,\n * maxFeePerGas: 1000000000n,\n * maxPriorityFeePerGas: 1000000000n\n * },\n * entryPoint: { address: '0x...' },\n * chainId: 1,\n * address: '0x...',\n * name: 'HybridDeleGator'\n * });\n * ```\n */\nexport async function signUserOperation<\n TChain extends Chain | undefined,\n TAccount extends Account | undefined,\n>(\n client: Client<Transport, TChain, TAccount> & {\n signTypedData: WalletClient['signTypedData'];\n },\n parameters: SignUserOperationParameters,\n): Promise<SignUserOperationReturnType> {\n const {\n account: accountParam = client.account,\n userOperation,\n entryPoint,\n chainId,\n name,\n address,\n version = '1',\n } = parameters;\n\n if (!accountParam) {\n throw new BaseError('Account not found. Please provide an account.');\n }\n\n const account = parseAccount(accountParam);\n\n const typedData = prepareSignUserOperationTypedData({\n userOperation,\n entryPoint,\n chainId,\n name,\n address,\n version,\n });\n\n return client.signTypedData({\n account,\n ...typedData,\n });\n}\n\n/**\n * Creates a sign user operation action that can be used to extend a wallet client.\n * @returns A function that can be used with wallet client extend method.\n * @example\n * ```ts\n * const walletClient = createWalletClient({\n * chain: mainnet,\n * transport: http()\n * }).extend(signUserOperationActions());\n * ```\n */\nexport function signUserOperationActions() {\n return <\n TChain extends Chain | undefined,\n TAccount extends Account | undefined,\n >(\n client: Client<Transport, TChain, TAccount> & {\n signTypedData: WalletClient['signTypedData'];\n },\n ) => ({\n signUserOperation: async (\n parameters: Omit<SignUserOperationParameters, 'chainId'> & {\n chainId?: number;\n },\n ) =>\n signUserOperation(client, {\n chainId:\n parameters.chainId ??\n (() => {\n if (!client.chain?.id) {\n throw new BaseError(\n 'Chain ID is required. Either provide it in parameters or configure the client with a chain.',\n );\n }\n return client.chain.id;\n })(),\n ...parameters,\n }),\n });\n}\n"]}
@@ -0,0 +1,57 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+ var _chunk2EIX7ZYTcjs = require('../chunk-2EIX7ZYT.cjs');
18
+
19
+
20
+
21
+
22
+
23
+
24
+ var _chunkD4ILRL6Zcjs = require('../chunk-D4ILRL6Z.cjs');
25
+
26
+
27
+
28
+
29
+ var _chunk662KDAAGcjs = require('../chunk-662KDAAG.cjs');
30
+ require('../chunk-T6PSFUOZ.cjs');
31
+ require('../chunk-HLCOMYYU.cjs');
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+ exports.DeleGatorCore = _chunk2EIX7ZYTcjs.DeleGatorCore_exports; exports.DelegationManager = _chunk2EIX7ZYTcjs.DelegationManager_exports; exports.EIP712 = _chunk2EIX7ZYTcjs.EIP712_exports; exports.ERC20PeriodTransferEnforcer = _chunkD4ILRL6Zcjs.ERC20PeriodTransferEnforcer_exports; exports.ERC20StreamingEnforcer = _chunkD4ILRL6Zcjs.ERC20StreamingEnforcer_exports; exports.ERC20TransferAmountEnforcer = _chunk2EIX7ZYTcjs.ERC20TransferAmountEnforcer_exports; exports.EntryPoint = _chunk2EIX7ZYTcjs.EntryPoint_exports; exports.HybridDeleGator = _chunk2EIX7ZYTcjs.HybridDeleGator_exports; exports.IdEnforcer = _chunk2EIX7ZYTcjs.IdEnforcer_exports; exports.LimitedCallsEnforcer = _chunk2EIX7ZYTcjs.LimitedCallsEnforcer_exports; exports.MultiSigDeleGator = _chunk2EIX7ZYTcjs.MultiSigDeleGator_exports; exports.MultiTokenPeriodEnforcer = _chunkD4ILRL6Zcjs.MultiTokenPeriodEnforcer_exports; exports.NativeTokenPeriodTransferEnforcer = _chunkD4ILRL6Zcjs.NativeTokenPeriodTransferEnforcer_exports; exports.NativeTokenStreamingEnforcer = _chunkD4ILRL6Zcjs.NativeTokenStreamingEnforcer_exports; exports.NativeTokenTransferAmountEnforcer = _chunk2EIX7ZYTcjs.NativeTokenTransferAmountEnforcer_exports; exports.NonceEnforcer = _chunk2EIX7ZYTcjs.NonceEnforcer_exports; exports.Ownable2Step = _chunk2EIX7ZYTcjs.Ownable2Step_exports; exports.Pausable = _chunk2EIX7ZYTcjs.Pausable_exports; exports.SimpleFactory = _chunk2EIX7ZYTcjs.SimpleFactory_exports; exports.SpecificActionERC20TransferBatchEnforcer = _chunk2EIX7ZYTcjs.SpecificActionERC20TransferBatchEnforcer_exports; exports.encodeProxyCreationCode = _chunk662KDAAGcjs.encodeProxyCreationCode; exports.isContractDeployed = _chunk662KDAAGcjs.isContractDeployed; exports.isImplementationExpected = _chunk662KDAAGcjs.isImplementationExpected;
57
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/smart-accounts-kit/smart-accounts-kit/packages/smart-accounts-kit/dist/contracts/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,kvDAAC","file":"/home/runner/work/smart-accounts-kit/smart-accounts-kit/packages/smart-accounts-kit/dist/contracts/index.cjs"}
@@ -0,0 +1,8 @@
1
+ export { b as DeleGatorCore, a as DelegationManager, c as EIP712, o as ERC20PeriodTransferEnforcer, p as ERC20StreamingEnforcer, q as ERC20TransferAmountEnforcer, d as EntryPoint, e as HybridDeleGator, f as IdEnforcer, I as InitializedClient, g as LimitedCallsEnforcer, h as MultiSigDeleGator, r as MultiTokenPeriodEnforcer, N as NarrowAbiToFunction, s as NativeTokenPeriodTransferEnforcer, t as NativeTokenStreamingEnforcer, u as NativeTokenTransferAmountEnforcer, j as NonceEnforcer, k as Ownable2Step, P as P256Owner, l as Pausable, m as SimpleFactory, n as SpecificActionERC20TransferBatchEnforcer, x as encodeProxyCreationCode, v as isContractDeployed, w as isImplementationExpected } from '../index-0-B0YlEP.cjs';
2
+ export { R as Redemption } from '../types-Bwksz_U6.cjs';
3
+ import '@metamask/delegation-core';
4
+ import 'viem';
5
+ import '../delegation-d52Owevd.cjs';
6
+ import '@metamask/delegation-abis';
7
+ import 'viem/account-abstraction';
8
+ import 'viem/chains';
@@ -0,0 +1,8 @@
1
+ export { b as DeleGatorCore, a as DelegationManager, c as EIP712, o as ERC20PeriodTransferEnforcer, p as ERC20StreamingEnforcer, q as ERC20TransferAmountEnforcer, d as EntryPoint, e as HybridDeleGator, f as IdEnforcer, I as InitializedClient, g as LimitedCallsEnforcer, h as MultiSigDeleGator, r as MultiTokenPeriodEnforcer, N as NarrowAbiToFunction, s as NativeTokenPeriodTransferEnforcer, t as NativeTokenStreamingEnforcer, u as NativeTokenTransferAmountEnforcer, j as NonceEnforcer, k as Ownable2Step, P as P256Owner, l as Pausable, m as SimpleFactory, n as SpecificActionERC20TransferBatchEnforcer, x as encodeProxyCreationCode, v as isContractDeployed, w as isImplementationExpected } from '../index-D1WbhKCc.js';
2
+ export { R as Redemption } from '../types-Bwksz_U6.js';
3
+ import '@metamask/delegation-core';
4
+ import 'viem';
5
+ import '../delegation-7PtFix8Y.js';
6
+ import '@metamask/delegation-abis';
7
+ import 'viem/account-abstraction';
8
+ import 'viem/chains';
@@ -0,0 +1,57 @@
1
+ import {
2
+ DeleGatorCore_exports,
3
+ DelegationManager_exports,
4
+ EIP712_exports,
5
+ ERC20TransferAmountEnforcer_exports,
6
+ EntryPoint_exports,
7
+ HybridDeleGator_exports,
8
+ IdEnforcer_exports,
9
+ LimitedCallsEnforcer_exports,
10
+ MultiSigDeleGator_exports,
11
+ NativeTokenTransferAmountEnforcer_exports,
12
+ NonceEnforcer_exports,
13
+ Ownable2Step_exports,
14
+ Pausable_exports,
15
+ SimpleFactory_exports,
16
+ SpecificActionERC20TransferBatchEnforcer_exports
17
+ } from "../chunk-6RN5RBOR.mjs";
18
+ import {
19
+ ERC20PeriodTransferEnforcer_exports,
20
+ ERC20StreamingEnforcer_exports,
21
+ MultiTokenPeriodEnforcer_exports,
22
+ NativeTokenPeriodTransferEnforcer_exports,
23
+ NativeTokenStreamingEnforcer_exports
24
+ } from "../chunk-KUEXI4ME.mjs";
25
+ import {
26
+ encodeProxyCreationCode,
27
+ isContractDeployed,
28
+ isImplementationExpected
29
+ } from "../chunk-TEI2NRPU.mjs";
30
+ import "../chunk-CPLIK3VF.mjs";
31
+ import "../chunk-UUDQWENY.mjs";
32
+ export {
33
+ DeleGatorCore_exports as DeleGatorCore,
34
+ DelegationManager_exports as DelegationManager,
35
+ EIP712_exports as EIP712,
36
+ ERC20PeriodTransferEnforcer_exports as ERC20PeriodTransferEnforcer,
37
+ ERC20StreamingEnforcer_exports as ERC20StreamingEnforcer,
38
+ ERC20TransferAmountEnforcer_exports as ERC20TransferAmountEnforcer,
39
+ EntryPoint_exports as EntryPoint,
40
+ HybridDeleGator_exports as HybridDeleGator,
41
+ IdEnforcer_exports as IdEnforcer,
42
+ LimitedCallsEnforcer_exports as LimitedCallsEnforcer,
43
+ MultiSigDeleGator_exports as MultiSigDeleGator,
44
+ MultiTokenPeriodEnforcer_exports as MultiTokenPeriodEnforcer,
45
+ NativeTokenPeriodTransferEnforcer_exports as NativeTokenPeriodTransferEnforcer,
46
+ NativeTokenStreamingEnforcer_exports as NativeTokenStreamingEnforcer,
47
+ NativeTokenTransferAmountEnforcer_exports as NativeTokenTransferAmountEnforcer,
48
+ NonceEnforcer_exports as NonceEnforcer,
49
+ Ownable2Step_exports as Ownable2Step,
50
+ Pausable_exports as Pausable,
51
+ SimpleFactory_exports as SimpleFactory,
52
+ SpecificActionERC20TransferBatchEnforcer_exports as SpecificActionERC20TransferBatchEnforcer,
53
+ encodeProxyCreationCode,
54
+ isContractDeployed,
55
+ isImplementationExpected
56
+ };
57
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,376 @@
1
+ import { Hex, AbiFunction, Address, AbiParameter, TypedData } from 'viem';
2
+ import { S as SmartAccountsEnvironment, C as Caveat, k as ExecutionStruct, D as Delegation } from './types-Bwksz_U6.js';
3
+
4
+ type AllowedCalldataBuilderConfig = {
5
+ startIndex: number;
6
+ value: Hex;
7
+ };
8
+ declare const allowedCalldataBuilder: (environment: SmartAccountsEnvironment, config: AllowedCalldataBuilderConfig) => Caveat;
9
+
10
+ type MethodSelector = Hex | string | AbiFunction;
11
+ type AllowedMethodsBuilderConfig = {
12
+ selectors: MethodSelector[];
13
+ };
14
+ declare const allowedMethodsBuilder: (environment: SmartAccountsEnvironment, config: AllowedMethodsBuilderConfig) => Caveat;
15
+
16
+ type AllowedTargetsBuilderConfig = {
17
+ targets: Address[];
18
+ };
19
+ declare const allowedTargetsBuilder: (environment: SmartAccountsEnvironment, config: AllowedTargetsBuilderConfig) => Caveat;
20
+
21
+ type ArgsEqualityCheckBuilderConfig = {
22
+ args: Hex;
23
+ };
24
+ declare const argsEqualityCheckBuilder: (environment: SmartAccountsEnvironment, config: ArgsEqualityCheckBuilderConfig) => Caveat;
25
+
26
+ type BlockNumberBuilderConfig = {
27
+ afterThreshold: bigint;
28
+ beforeThreshold: bigint;
29
+ };
30
+ declare const blockNumberBuilder: (environment: SmartAccountsEnvironment, config: BlockNumberBuilderConfig) => Caveat;
31
+
32
+ type CaveatWithOptionalArgs = Omit<Caveat, 'args'> & {
33
+ args?: Caveat['args'];
34
+ };
35
+ type CaveatBuilderMap = {
36
+ [key: string]: (environment: SmartAccountsEnvironment, ...args: [...any]) => Caveat;
37
+ };
38
+ type CaveatBuilderConfig = {
39
+ allowInsecureUnrestrictedDelegation?: boolean;
40
+ };
41
+ declare class CaveatBuilder<TCaveatBuilderMap extends CaveatBuilderMap = Record<string, never>> {
42
+ #private;
43
+ constructor(environment: SmartAccountsEnvironment, config?: CaveatBuilderConfig, enforcerBuilders?: TCaveatBuilderMap, builtCaveats?: Caveat[]);
44
+ extend<TEnforcerName extends string, TFunction extends (environment: SmartAccountsEnvironment, config: any) => Caveat>(name: TEnforcerName, fn: TFunction): CaveatBuilder<TCaveatBuilderMap & Record<TEnforcerName, TFunction>>;
45
+ addCaveat(caveat: CaveatWithOptionalArgs): CaveatBuilder<TCaveatBuilderMap>;
46
+ addCaveat<TEnforcerName extends keyof TCaveatBuilderMap>(name: TEnforcerName, config: Parameters<TCaveatBuilderMap[TEnforcerName]>[1]): CaveatBuilder<TCaveatBuilderMap>;
47
+ build(): Caveat[];
48
+ }
49
+
50
+ type DeployedBuilderConfig = {
51
+ contractAddress: Address;
52
+ salt: Hex;
53
+ bytecode: Hex;
54
+ };
55
+ declare const deployedBuilder: (environment: SmartAccountsEnvironment, config: DeployedBuilderConfig) => Caveat;
56
+
57
+ declare enum BalanceChangeType {
58
+ Increase = 0,
59
+ Decrease = 1
60
+ }
61
+
62
+ type Erc1155BalanceChangeBuilderConfig = {
63
+ tokenAddress: Address;
64
+ recipient: Address;
65
+ tokenId: bigint;
66
+ balance: bigint;
67
+ changeType: BalanceChangeType;
68
+ };
69
+ declare const erc1155BalanceChangeBuilder: (environment: SmartAccountsEnvironment, config: Erc1155BalanceChangeBuilderConfig) => Caveat;
70
+
71
+ type Erc20BalanceChangeBuilderConfig = {
72
+ tokenAddress: Address;
73
+ recipient: Address;
74
+ balance: bigint;
75
+ changeType: BalanceChangeType;
76
+ };
77
+ declare const erc20BalanceChangeBuilder: (environment: SmartAccountsEnvironment, config: Erc20BalanceChangeBuilderConfig) => Caveat;
78
+
79
+ declare const erc20PeriodTransfer = "erc20PeriodTransfer";
80
+ type Erc20PeriodTransferBuilderConfig = {
81
+ tokenAddress: Address;
82
+ periodAmount: bigint;
83
+ periodDuration: number;
84
+ startDate: number;
85
+ };
86
+ declare const erc20PeriodTransferBuilder: (environment: SmartAccountsEnvironment, config: Erc20PeriodTransferBuilderConfig) => Caveat;
87
+
88
+ declare const erc20Streaming = "erc20Streaming";
89
+ type Erc20StreamingBuilderConfig = {
90
+ tokenAddress: Address;
91
+ initialAmount: bigint;
92
+ maxAmount: bigint;
93
+ amountPerSecond: bigint;
94
+ startTime: number;
95
+ };
96
+ declare const erc20StreamingBuilder: (environment: SmartAccountsEnvironment, config: Erc20StreamingBuilderConfig) => Caveat;
97
+
98
+ declare const erc20TransferAmount = "erc20TransferAmount";
99
+ type Erc20TransferAmountBuilderConfig = {
100
+ tokenAddress: Address;
101
+ maxAmount: bigint;
102
+ };
103
+ declare const erc20TransferAmountBuilder: (environment: SmartAccountsEnvironment, config: Erc20TransferAmountBuilderConfig) => Caveat;
104
+
105
+ type Erc721BalanceChangeBuilderConfig = {
106
+ tokenAddress: Address;
107
+ recipient: Address;
108
+ amount: bigint;
109
+ changeType: BalanceChangeType;
110
+ };
111
+ declare const erc721BalanceChangeBuilder: (environment: SmartAccountsEnvironment, config: Erc721BalanceChangeBuilderConfig) => Caveat;
112
+
113
+ declare const erc721Transfer = "erc721Transfer";
114
+ type Erc721TransferBuilderConfig = {
115
+ tokenAddress: Address;
116
+ tokenId: bigint;
117
+ };
118
+ declare const erc721TransferBuilder: (environment: SmartAccountsEnvironment, config: Erc721TransferBuilderConfig) => Caveat;
119
+
120
+ type ExactCalldataBatchBuilderConfig = {
121
+ executions: ExecutionStruct[];
122
+ };
123
+ declare const exactCalldataBatchBuilder: (environment: SmartAccountsEnvironment, config: ExactCalldataBatchBuilderConfig) => Caveat;
124
+
125
+ type ExactCalldataBuilderConfig = {
126
+ calldata: Hex;
127
+ };
128
+ declare const exactCalldataBuilder: (environment: SmartAccountsEnvironment, config: ExactCalldataBuilderConfig) => Caveat;
129
+
130
+ type ExactExecutionBatchBuilderConfig = {
131
+ executions: ExecutionStruct[];
132
+ };
133
+ declare const exactExecutionBatchBuilder: (environment: SmartAccountsEnvironment, config: ExactExecutionBatchBuilderConfig) => Caveat;
134
+
135
+ type ExactExecutionBuilderConfig = {
136
+ execution: ExecutionStruct;
137
+ };
138
+ declare const exactExecutionBuilder: (environment: SmartAccountsEnvironment, config: ExactExecutionBuilderConfig) => Caveat;
139
+
140
+ type IdBuilderConfig = {
141
+ id: bigint | number;
142
+ };
143
+ declare const idBuilder: (environment: SmartAccountsEnvironment, config: IdBuilderConfig) => Caveat;
144
+
145
+ type LimitedCallsBuilderConfig = {
146
+ limit: number;
147
+ };
148
+ declare const limitedCallsBuilder: (environment: SmartAccountsEnvironment, config: LimitedCallsBuilderConfig) => Caveat;
149
+
150
+ type TokenPeriodConfig = {
151
+ token: Hex;
152
+ periodAmount: bigint;
153
+ periodDuration: number;
154
+ startDate: number;
155
+ };
156
+ type MultiTokenPeriodBuilderConfig = {
157
+ tokenConfigs: TokenPeriodConfig[];
158
+ };
159
+ declare const multiTokenPeriodBuilder: (environment: SmartAccountsEnvironment, config: MultiTokenPeriodBuilderConfig) => Caveat;
160
+
161
+ type NativeBalanceChangeBuilderConfig = {
162
+ recipient: Address;
163
+ balance: bigint;
164
+ changeType: BalanceChangeType;
165
+ };
166
+ declare const nativeBalanceChangeBuilder: (environment: SmartAccountsEnvironment, config: NativeBalanceChangeBuilderConfig) => Caveat;
167
+
168
+ type NativeTokenPaymentBuilderConfig = {
169
+ recipient: Address;
170
+ amount: bigint;
171
+ };
172
+ declare const nativeTokenPaymentBuilder: (environment: SmartAccountsEnvironment, config: NativeTokenPaymentBuilderConfig) => Caveat;
173
+
174
+ declare const nativeTokenPeriodTransfer = "nativeTokenPeriodTransfer";
175
+ type NativeTokenPeriodTransferBuilderConfig = {
176
+ periodAmount: bigint;
177
+ periodDuration: number;
178
+ startDate: number;
179
+ };
180
+ declare const nativeTokenPeriodTransferBuilder: (environment: SmartAccountsEnvironment, config: NativeTokenPeriodTransferBuilderConfig) => Caveat;
181
+
182
+ declare const nativeTokenStreaming = "nativeTokenStreaming";
183
+ type NativeTokenStreamingBuilderConfig = {
184
+ initialAmount: bigint;
185
+ maxAmount: bigint;
186
+ amountPerSecond: bigint;
187
+ startTime: number;
188
+ };
189
+ declare const nativeTokenStreamingBuilder: (environment: SmartAccountsEnvironment, config: NativeTokenStreamingBuilderConfig) => Caveat;
190
+
191
+ declare const nativeTokenTransferAmount = "nativeTokenTransferAmount";
192
+ type NativeTokenTransferAmountBuilderConfig = {
193
+ maxAmount: bigint;
194
+ };
195
+ declare const nativeTokenTransferAmountBuilder: (environment: SmartAccountsEnvironment, config: NativeTokenTransferAmountBuilderConfig) => Caveat;
196
+
197
+ type NonceBuilderConfig = {
198
+ nonce: Hex;
199
+ };
200
+ declare const nonceBuilder: (environment: SmartAccountsEnvironment, config: NonceBuilderConfig) => Caveat;
201
+
202
+ declare const ownershipTransfer = "ownershipTransfer";
203
+ type OwnershipTransferBuilderConfig = {
204
+ contractAddress: Address;
205
+ };
206
+ declare const ownershipTransferBuilder: (environment: SmartAccountsEnvironment, config: OwnershipTransferBuilderConfig) => Caveat;
207
+
208
+ type RedeemerBuilderConfig = {
209
+ redeemers: Address[];
210
+ };
211
+ declare const redeemerBuilder: (environment: SmartAccountsEnvironment, config: RedeemerBuilderConfig) => Caveat;
212
+
213
+ type SpecificActionErc20TransferBatchBuilderConfig = {
214
+ tokenAddress: Address;
215
+ recipient: Address;
216
+ amount: bigint;
217
+ target: Address;
218
+ calldata: Hex;
219
+ };
220
+ declare const specificActionERC20TransferBatchBuilder: (environment: SmartAccountsEnvironment, config: SpecificActionErc20TransferBatchBuilderConfig) => Caveat;
221
+
222
+ type TimestampBuilderConfig = {
223
+ afterThreshold: number;
224
+ beforeThreshold: number;
225
+ };
226
+ declare const timestampBuilder: (environment: SmartAccountsEnvironment, config: TimestampBuilderConfig) => Caveat;
227
+
228
+ type ValueLteBuilderConfig = {
229
+ maxValue: bigint;
230
+ };
231
+ declare const valueLteBuilder: (environment: SmartAccountsEnvironment, config: ValueLteBuilderConfig) => Caveat;
232
+
233
+ type CoreCaveatMap = {
234
+ allowedMethods: typeof allowedMethodsBuilder;
235
+ allowedTargets: typeof allowedTargetsBuilder;
236
+ deployed: typeof deployedBuilder;
237
+ allowedCalldata: typeof allowedCalldataBuilder;
238
+ erc20BalanceChange: typeof erc20BalanceChangeBuilder;
239
+ erc721BalanceChange: typeof erc721BalanceChangeBuilder;
240
+ erc1155BalanceChange: typeof erc1155BalanceChangeBuilder;
241
+ valueLte: typeof valueLteBuilder;
242
+ limitedCalls: typeof limitedCallsBuilder;
243
+ id: typeof idBuilder;
244
+ nonce: typeof nonceBuilder;
245
+ timestamp: typeof timestampBuilder;
246
+ blockNumber: typeof blockNumberBuilder;
247
+ erc20TransferAmount: typeof erc20TransferAmountBuilder;
248
+ erc20Streaming: typeof erc20StreamingBuilder;
249
+ nativeTokenStreaming: typeof nativeTokenStreamingBuilder;
250
+ erc721Transfer: typeof erc721TransferBuilder;
251
+ nativeTokenTransferAmount: typeof nativeTokenTransferAmountBuilder;
252
+ nativeBalanceChange: typeof nativeBalanceChangeBuilder;
253
+ redeemer: typeof redeemerBuilder;
254
+ nativeTokenPayment: typeof nativeTokenPaymentBuilder;
255
+ argsEqualityCheck: typeof argsEqualityCheckBuilder;
256
+ specificActionERC20TransferBatch: typeof specificActionERC20TransferBatchBuilder;
257
+ erc20PeriodTransfer: typeof erc20PeriodTransferBuilder;
258
+ nativeTokenPeriodTransfer: typeof nativeTokenPeriodTransferBuilder;
259
+ exactCalldataBatch: typeof exactCalldataBatchBuilder;
260
+ exactCalldata: typeof exactCalldataBuilder;
261
+ exactExecution: typeof exactExecutionBuilder;
262
+ exactExecutionBatch: typeof exactExecutionBatchBuilder;
263
+ multiTokenPeriod: typeof multiTokenPeriodBuilder;
264
+ ownershipTransfer: typeof ownershipTransferBuilder;
265
+ };
266
+ type CoreCaveatBuilder = CaveatBuilder<CoreCaveatMap>;
267
+ type ExtractCaveatMapType<TCaveatBuilder extends CaveatBuilder<any>> = TCaveatBuilder extends CaveatBuilder<infer TCaveatMap> ? TCaveatMap : never;
268
+ type CaveatConfiguration<TCaveatBuilder extends CaveatBuilder<any>, CaveatMap = ExtractCaveatMapType<TCaveatBuilder>> = CaveatMap extends Record<string, (...args: any[]) => any> ? {
269
+ [TType in keyof CaveatMap]: {
270
+ type: TType;
271
+ } & Parameters<CaveatMap[TType]>[1];
272
+ }[keyof CaveatMap] : never;
273
+ type CoreCaveatConfiguration = CaveatConfiguration<CoreCaveatBuilder>;
274
+ declare const createCaveatBuilder: (environment: SmartAccountsEnvironment, config?: CaveatBuilderConfig) => CoreCaveatBuilder;
275
+
276
+ type Erc20PeriodicScopeConfig = {
277
+ type: typeof erc20PeriodTransfer;
278
+ } & Erc20PeriodTransferBuilderConfig;
279
+
280
+ type Erc20StreamingScopeConfig = {
281
+ type: typeof erc20Streaming;
282
+ } & Erc20StreamingBuilderConfig;
283
+
284
+ type Erc20TransferScopeConfig = {
285
+ type: typeof erc20TransferAmount;
286
+ } & Erc20TransferAmountBuilderConfig;
287
+
288
+ type Erc721ScopeBaseConfig = {
289
+ type: typeof erc721Transfer;
290
+ };
291
+ type Erc721ScopeConfig = Erc721ScopeBaseConfig & Erc721TransferBuilderConfig;
292
+
293
+ type FunctionCallScopeBaseConfig = {
294
+ type: 'functionCall';
295
+ };
296
+ type FunctionCallScopeConfig = FunctionCallScopeBaseConfig & AllowedTargetsBuilderConfig & AllowedMethodsBuilderConfig & {
297
+ allowedCalldata?: AllowedCalldataBuilderConfig[];
298
+ exactCalldata?: ExactCalldataBuilderConfig;
299
+ };
300
+
301
+ type NativeTokenPeriodicScopeConfig = {
302
+ type: typeof nativeTokenPeriodTransfer;
303
+ allowedCalldata?: AllowedCalldataBuilderConfig[];
304
+ exactCalldata?: ExactCalldataBuilderConfig;
305
+ } & NativeTokenPeriodTransferBuilderConfig;
306
+
307
+ type NativeTokenStreamingScopeConfig = {
308
+ type: typeof nativeTokenStreaming;
309
+ allowedCalldata?: AllowedCalldataBuilderConfig[];
310
+ exactCalldata?: ExactCalldataBuilderConfig;
311
+ } & NativeTokenStreamingBuilderConfig;
312
+
313
+ type NativeTokenTransferScopeConfig = {
314
+ type: typeof nativeTokenTransferAmount;
315
+ allowedCalldata?: AllowedCalldataBuilderConfig[];
316
+ exactCalldata?: ExactCalldataBuilderConfig;
317
+ } & NativeTokenTransferAmountBuilderConfig;
318
+
319
+ type OwnershipScopeBaseConfig = {
320
+ type: typeof ownershipTransfer;
321
+ };
322
+ type OwnershipScopeConfig = OwnershipScopeBaseConfig & OwnershipTransferBuilderConfig;
323
+
324
+ type ScopeConfig = Erc20TransferScopeConfig | Erc20StreamingScopeConfig | Erc20PeriodicScopeConfig | NativeTokenTransferScopeConfig | NativeTokenStreamingScopeConfig | NativeTokenPeriodicScopeConfig | Erc721ScopeConfig | OwnershipScopeConfig | FunctionCallScopeConfig;
325
+
326
+ type Caveats = CaveatBuilder | (Caveat | CoreCaveatConfiguration)[];
327
+
328
+ declare const DELEGATION_ABI_TYPE_COMPONENTS: ({
329
+ type: string;
330
+ name: string;
331
+ components?: undefined;
332
+ } | {
333
+ type: string;
334
+ name: string;
335
+ components: {
336
+ type: string;
337
+ name: string;
338
+ }[];
339
+ })[];
340
+ declare const toDelegationStruct: (delegation: Delegation) => DelegationStruct;
341
+ declare const toDelegation: (delegationStruct: DelegationStruct) => Delegation;
342
+ type DelegationStruct = Omit<Delegation, 'salt'> & {
343
+ salt: bigint;
344
+ };
345
+ declare const encodeDelegations: (delegations: Delegation[]) => Hex;
346
+ declare const encodePermissionContexts: (delegations: Delegation[][]) => `0x${string}`[];
347
+ declare const decodeDelegations: (encoded: Hex) => Delegation[];
348
+ declare const decodePermissionContexts: (encoded: Hex[]) => Delegation[][];
349
+ declare const SIGNABLE_DELEGATION_TYPED_DATA: TypedData;
350
+ declare const DELEGATION_ARRAY_ABI_TYPE: AbiParameter;
351
+ declare const getDelegationHashOffchain: (input: Delegation) => Hex;
352
+ type BaseCreateDelegationOptions = {
353
+ environment: SmartAccountsEnvironment;
354
+ scope: ScopeConfig;
355
+ from: Hex;
356
+ caveats?: Caveats;
357
+ parentDelegation?: Delegation | Hex;
358
+ salt?: Hex;
359
+ };
360
+ type CreateDelegationOptions = BaseCreateDelegationOptions & {
361
+ to: Hex;
362
+ };
363
+ type CreateOpenDelegationOptions = BaseCreateDelegationOptions;
364
+ declare const createDelegation: (options: CreateDelegationOptions) => Delegation;
365
+ declare const createOpenDelegation: (options: CreateOpenDelegationOptions) => Delegation;
366
+ declare const signDelegation: ({ privateKey, delegation, delegationManager, chainId, name, version, allowInsecureUnrestrictedDelegation, }: {
367
+ privateKey: Hex;
368
+ delegation: Omit<Delegation, 'signature'>;
369
+ delegationManager: Address;
370
+ chainId: number;
371
+ name?: string | undefined;
372
+ version?: string | undefined;
373
+ allowInsecureUnrestrictedDelegation?: boolean | undefined;
374
+ }) => Promise<`0x${string}`>;
375
+
376
+ export { BalanceChangeType as B, type CreateDelegationOptions as C, DELEGATION_ARRAY_ABI_TYPE as D, SIGNABLE_DELEGATION_TYPED_DATA as S, createOpenDelegation as a, type CreateOpenDelegationOptions as b, createDelegation as c, type Caveats as d, encodeDelegations as e, decodeDelegations as f, toDelegation as g, encodePermissionContexts as h, decodePermissionContexts as i, DELEGATION_ABI_TYPE_COMPONENTS as j, getDelegationHashOffchain as k, type DelegationStruct as l, type CoreCaveatBuilder as m, type CaveatBuilderConfig as n, createCaveatBuilder as o, CaveatBuilder as p, signDelegation as s, toDelegationStruct as t };