@metamask/smart-accounts-kit 1.4.0 → 1.6.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 (90) hide show
  1. package/CHANGELOG.md +57 -24
  2. package/dist/actions/index.cjs +9 -6
  3. package/dist/actions/index.cjs.map +1 -1
  4. package/dist/actions/index.d.cts +5 -3
  5. package/dist/actions/index.d.ts +5 -3
  6. package/dist/actions/index.mjs +8 -5
  7. package/dist/{caveats-BhjGBVHX.d.ts → caveats-B2OssjV4.d.ts} +1 -2
  8. package/dist/{caveats-CeHBbmt_.d.cts → caveats-gqMBZKkI.d.cts} +1 -2
  9. package/dist/{chunk-SOFB2MXG.cjs → chunk-2OS36DVV.cjs} +8 -1
  10. package/dist/chunk-2OS36DVV.cjs.map +1 -0
  11. package/dist/{chunk-6CEOFJY5.cjs → chunk-2ZOWIAP3.cjs} +266 -114
  12. package/dist/chunk-2ZOWIAP3.cjs.map +1 -0
  13. package/dist/{chunk-R2WT54GZ.mjs → chunk-AZYTTGON.mjs} +214 -62
  14. package/dist/chunk-AZYTTGON.mjs.map +1 -0
  15. package/dist/{chunk-MVBU3LRV.cjs → chunk-DCI2AN4N.cjs} +15 -17
  16. package/dist/chunk-DCI2AN4N.cjs.map +1 -0
  17. package/dist/{chunk-RR2AMG4A.cjs → chunk-EPU4O7FY.cjs} +158 -151
  18. package/dist/chunk-EPU4O7FY.cjs.map +1 -0
  19. package/dist/{chunk-QCULIK3O.mjs → chunk-GMGJRC3D.mjs} +8 -1
  20. package/dist/chunk-GMGJRC3D.mjs.map +1 -0
  21. package/dist/chunk-IMO6XNDJ.mjs +14 -0
  22. package/dist/chunk-IMO6XNDJ.mjs.map +1 -0
  23. package/dist/chunk-IQT6XFDT.cjs +14 -0
  24. package/dist/chunk-IQT6XFDT.cjs.map +1 -0
  25. package/dist/{chunk-SO5JAXGD.cjs → chunk-JKVSTPEC.cjs} +200 -18
  26. package/dist/chunk-JKVSTPEC.cjs.map +1 -0
  27. package/dist/{chunk-DVJX76J3.mjs → chunk-K7GTZGKJ.mjs} +2 -2
  28. package/dist/{chunk-HQHXGWNJ.mjs → chunk-L3EZCIY6.mjs} +67 -60
  29. package/dist/chunk-L3EZCIY6.mjs.map +1 -0
  30. package/dist/{chunk-XZ7UMCG3.cjs → chunk-PQPAEHJZ.cjs} +12 -12
  31. package/dist/{chunk-XZ7UMCG3.cjs.map → chunk-PQPAEHJZ.cjs.map} +1 -1
  32. package/dist/{chunk-EEIIVBNV.mjs → chunk-TNGQTVSY.mjs} +225 -53
  33. package/dist/chunk-TNGQTVSY.mjs.map +1 -0
  34. package/dist/{chunk-FG2CQGSE.mjs → chunk-UJQ3JN3U.mjs} +4 -6
  35. package/dist/{chunk-FG2CQGSE.mjs.map → chunk-UJQ3JN3U.mjs.map} +1 -1
  36. package/dist/{chunk-TMO23YRP.cjs → chunk-W6HPAK4M.cjs} +262 -90
  37. package/dist/chunk-W6HPAK4M.cjs.map +1 -0
  38. package/dist/{chunk-ZGBFPD4O.mjs → chunk-YVU66KSH.mjs} +188 -6
  39. package/dist/chunk-YVU66KSH.mjs.map +1 -0
  40. package/dist/contracts/index.cjs +5 -6
  41. package/dist/contracts/index.cjs.map +1 -1
  42. package/dist/contracts/index.d.cts +4 -3
  43. package/dist/contracts/index.d.ts +4 -3
  44. package/dist/contracts/index.mjs +4 -5
  45. package/dist/decodeRevertReason-CmmCpmZ_.d.cts +72 -0
  46. package/dist/decodeRevertReason-dOTpJx2h.d.ts +72 -0
  47. package/dist/experimental/index.cjs +364 -9
  48. package/dist/experimental/index.cjs.map +1 -1
  49. package/dist/experimental/index.d.cts +39 -3
  50. package/dist/experimental/index.d.ts +39 -3
  51. package/dist/experimental/index.mjs +357 -2
  52. package/dist/experimental/index.mjs.map +1 -1
  53. package/dist/index-B1Cmezvh.d.cts +61 -0
  54. package/dist/{index-DRKgDSZW.d.ts → index-BkgdU4LI.d.ts} +99 -92
  55. package/dist/{index-Cg-JakqA.d.ts → index-DUJmm8Wz.d.ts} +46 -5
  56. package/dist/{index-DzL9ccjU.d.cts → index-Dv4jPzhe.d.cts} +99 -92
  57. package/dist/index-LqiEgBjV.d.ts +61 -0
  58. package/dist/{index-BToRQKyJ.d.cts → index-X7Qn3JTg.d.cts} +46 -5
  59. package/dist/index.cjs +22 -24
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.d.cts +8 -7
  62. package/dist/index.d.ts +8 -7
  63. package/dist/index.mjs +9 -11
  64. package/dist/index.mjs.map +1 -1
  65. package/dist/{delegation-CR99q1-n.d.ts → resolveCaveats-A9xC29l8.d.cts} +160 -111
  66. package/dist/{delegation-DoVULGYE.d.cts → resolveCaveats-A9xC29l8.d.ts} +160 -111
  67. package/dist/utils/index.cjs +13 -6
  68. package/dist/utils/index.cjs.map +1 -1
  69. package/dist/utils/index.d.cts +8 -4
  70. package/dist/utils/index.d.ts +8 -4
  71. package/dist/utils/index.mjs +16 -9
  72. package/package.json +7 -6
  73. package/dist/chunk-4QXIOE7F.mjs +0 -79
  74. package/dist/chunk-4QXIOE7F.mjs.map +0 -1
  75. package/dist/chunk-6CEOFJY5.cjs.map +0 -1
  76. package/dist/chunk-EEIIVBNV.mjs.map +0 -1
  77. package/dist/chunk-HQHXGWNJ.mjs.map +0 -1
  78. package/dist/chunk-MOHCTPYQ.cjs +0 -79
  79. package/dist/chunk-MOHCTPYQ.cjs.map +0 -1
  80. package/dist/chunk-MVBU3LRV.cjs.map +0 -1
  81. package/dist/chunk-QCULIK3O.mjs.map +0 -1
  82. package/dist/chunk-R2WT54GZ.mjs.map +0 -1
  83. package/dist/chunk-RR2AMG4A.cjs.map +0 -1
  84. package/dist/chunk-SO5JAXGD.cjs.map +0 -1
  85. package/dist/chunk-SOFB2MXG.cjs.map +0 -1
  86. package/dist/chunk-TMO23YRP.cjs.map +0 -1
  87. package/dist/chunk-ZGBFPD4O.mjs.map +0 -1
  88. package/dist/types-BWaH4KH1.d.cts +0 -155
  89. package/dist/types-BWaH4KH1.d.ts +0 -155
  90. /package/dist/{chunk-DVJX76J3.mjs.map → chunk-K7GTZGKJ.mjs.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/contracts/index.ts","../src/DelegationFramework/DelegationManager/index.ts","../src/DelegationFramework/DelegationManager/constants.ts","../src/DelegationFramework/DelegationManager/encode.ts","../src/DelegationFramework/DelegationManager/methods/disableDelegation.ts","../src/DelegationFramework/DelegationManager/methods/enableDelegation.ts","../src/DelegationFramework/DelegationManager/methods/redeemDelegations.ts","../src/DelegationFramework/DelegationManager/execute.ts","../src/DelegationFramework/DelegationManager/read.ts","../src/DelegationFramework/DelegationManager/methods/disabledDelegations.ts","../src/DelegationFramework/DelegationManager/methods/getAnyDelegate.ts","../src/DelegationFramework/DelegationManager/methods/getRootAuthority.ts","../src/DelegationFramework/DelegationManager/simulate.ts","../src/DelegationFramework/DeleGatorCore/index.ts","../src/DelegationFramework/DeleGatorCore/execute.ts","../src/DelegationFramework/DeleGatorCore/simulate.ts","../src/DelegationFramework/EIP712/index.ts","../src/DelegationFramework/EIP712/read.ts","../src/DelegationFramework/EIP712/methods/getContractName.ts","../src/DelegationFramework/EIP712/methods/getContractVersion.ts","../src/DelegationFramework/EIP712/methods/getDomainVersion.ts","../src/DelegationFramework/EntryPoint/index.ts","../src/DelegationFramework/EntryPoint/read.ts","../src/DelegationFramework/EntryPoint/methods/getNonce.ts","../src/DelegationFramework/ERC20TransferAmountEnforcer/index.ts","../src/DelegationFramework/ERC20TransferAmountEnforcer/read.ts","../src/DelegationFramework/ERC20TransferAmountEnforcer/methods/getSpentAmount.ts","../src/DelegationFramework/ERC20TransferAmountEnforcer/methods/getTermsInfo.ts","../src/DelegationFramework/HybridDeleGator/index.ts","../src/DelegationFramework/HybridDeleGator/read.ts","../src/DelegationFramework/HybridDeleGator/methods/getKey.ts","../src/DelegationFramework/HybridDeleGator/methods/getKeyIdHashes.ts","../src/DelegationFramework/HybridDeleGator/methods/getKeyIdHashesCount.ts","../src/DelegationFramework/HybridDeleGator/simulate.ts","../src/DelegationFramework/HybridDeleGator/constants.ts","../src/DelegationFramework/IdEnforcer/index.ts","../src/DelegationFramework/IdEnforcer/read.ts","../src/DelegationFramework/IdEnforcer/methods/getIsUsed.ts","../src/DelegationFramework/IdEnforcer/methods/getTermsInfo.ts","../src/DelegationFramework/LimitedCallsEnforcer/index.ts","../src/DelegationFramework/LimitedCallsEnforcer/read.ts","../src/DelegationFramework/LimitedCallsEnforcer/methods/callCounts.ts","../src/DelegationFramework/LimitedCallsEnforcer/methods/getTermsInfo.ts","../src/DelegationFramework/MultiSigDeleGator/index.ts","../src/DelegationFramework/MultiSigDeleGator/read.ts","../src/DelegationFramework/MultiSigDeleGator/methods/getMaxNumberOfSigners.ts","../src/DelegationFramework/MultiSigDeleGator/methods/getSigners.ts","../src/DelegationFramework/MultiSigDeleGator/methods/getSignersCount.ts","../src/DelegationFramework/MultiSigDeleGator/methods/getThreshold.ts","../src/DelegationFramework/MultiSigDeleGator/methods/isSigner.ts","../src/DelegationFramework/MultiSigDeleGator/simulate.ts","../src/DelegationFramework/MultiSigDeleGator/constants.ts","../src/DelegationFramework/NativeTokenTransferAmountEnforcer/index.ts","../src/DelegationFramework/NativeTokenTransferAmountEnforcer/read.ts","../src/DelegationFramework/NativeTokenTransferAmountEnforcer/methods/getSpentAmount.ts","../src/DelegationFramework/NativeTokenTransferAmountEnforcer/methods/getTermsInfo.ts","../src/DelegationFramework/NonceEnforcer/index.ts","../src/DelegationFramework/NonceEnforcer/encode.ts","../src/DelegationFramework/NonceEnforcer/methods/incrementNonce.ts","../src/DelegationFramework/NonceEnforcer/execute.ts","../src/DelegationFramework/NonceEnforcer/read.ts","../src/DelegationFramework/NonceEnforcer/methods/currentNonce.ts","../src/DelegationFramework/NonceEnforcer/methods/getTermsInfo.ts","../src/DelegationFramework/NonceEnforcer/simulate.ts","../src/DelegationFramework/Ownable2Step/index.ts","../src/DelegationFramework/Ownable2Step/read.ts","../src/DelegationFramework/Ownable2Step/methods/getOwner.ts","../src/DelegationFramework/Ownable2Step/methods/getPendingOwner.ts","../src/DelegationFramework/Ownable2Step/execute.ts","../src/DelegationFramework/Ownable2Step/methods/acceptOwnership.ts","../src/DelegationFramework/Ownable2Step/methods/renounceOwnership.ts","../src/DelegationFramework/Ownable2Step/methods/transferOwnership.ts","../src/DelegationFramework/Ownable2Step/encode.ts","../src/DelegationFramework/Ownable2Step/simulate.ts","../src/DelegationFramework/Pausable/index.ts","../src/DelegationFramework/Pausable/read.ts","../src/DelegationFramework/Pausable/methods/isPaused.ts","../src/DelegationFramework/Pausable/execute.ts","../src/DelegationFramework/Pausable/methods/pause.ts","../src/DelegationFramework/Pausable/methods/unpause.ts","../src/DelegationFramework/Pausable/encode.ts","../src/DelegationFramework/Pausable/simulate.ts","../src/DelegationFramework/SimpleFactory/index.ts","../src/DelegationFramework/SimpleFactory/execute.ts","../src/DelegationFramework/SimpleFactory/read.ts","../src/DelegationFramework/SimpleFactory/methods/getCreate2Address.ts","../src/DelegationFramework/SimpleFactory/simulate.ts","../src/DelegationFramework/SpecificActionERC20TransferBatchEnforcer/index.ts","../src/DelegationFramework/SpecificActionERC20TransferBatchEnforcer/read.ts","../src/DelegationFramework/SpecificActionERC20TransferBatchEnforcer/methods/getTermsInfo.ts","../src/DelegationFramework/SpecificActionERC20TransferBatchEnforcer/methods/usedDelegations.ts"],"sourcesContent":["import * as DelegationManager from '../DelegationFramework/DelegationManager';\nimport * as DeleGatorCore from '../DelegationFramework/DeleGatorCore';\nimport * as EIP712 from '../DelegationFramework/EIP712';\nimport * as EntryPoint from '../DelegationFramework/EntryPoint';\nimport * as ERC20PeriodTransferEnforcer from '../DelegationFramework/ERC20PeriodTransferEnforcer';\nimport * as ERC20StreamingEnforcer from '../DelegationFramework/ERC20StreamingEnforcer';\nimport * as ERC20TransferAmountEnforcer from '../DelegationFramework/ERC20TransferAmountEnforcer';\nimport * as HybridDeleGator from '../DelegationFramework/HybridDeleGator';\nimport * as IdEnforcer from '../DelegationFramework/IdEnforcer';\nimport * as LimitedCallsEnforcer from '../DelegationFramework/LimitedCallsEnforcer';\nimport * as MultiSigDeleGator from '../DelegationFramework/MultiSigDeleGator';\nimport * as MultiTokenPeriodEnforcer from '../DelegationFramework/MultiTokenPeriodEnforcer';\nimport * as NativeTokenPeriodTransferEnforcer from '../DelegationFramework/NativeTokenPeriodTransferEnforcer';\nimport * as NativeTokenStreamingEnforcer from '../DelegationFramework/NativeTokenStreamingEnforcer';\nimport * as NativeTokenTransferAmountEnforcer from '../DelegationFramework/NativeTokenTransferAmountEnforcer';\nimport * as NonceEnforcer from '../DelegationFramework/NonceEnforcer';\nimport * as Ownable2Step from '../DelegationFramework/Ownable2Step';\nimport * as Pausable from '../DelegationFramework/Pausable';\nimport * as SimpleFactory from '../DelegationFramework/SimpleFactory';\nimport * as SpecificActionERC20TransferBatchEnforcer from '../DelegationFramework/SpecificActionERC20TransferBatchEnforcer';\n\nexport {\n isContractDeployed,\n isImplementationExpected,\n encodeProxyCreationCode,\n} from '../DelegationFramework/utils';\n\nexport {\n DelegationManager,\n DeleGatorCore,\n EIP712,\n EntryPoint,\n HybridDeleGator,\n IdEnforcer,\n LimitedCallsEnforcer,\n MultiSigDeleGator,\n NonceEnforcer,\n Ownable2Step,\n Pausable,\n SimpleFactory,\n SpecificActionERC20TransferBatchEnforcer,\n ERC20PeriodTransferEnforcer,\n ERC20StreamingEnforcer,\n ERC20TransferAmountEnforcer,\n MultiTokenPeriodEnforcer,\n NativeTokenPeriodTransferEnforcer,\n NativeTokenStreamingEnforcer,\n NativeTokenTransferAmountEnforcer,\n};\n\nexport type {\n P256Owner,\n InitializedClient,\n} from '../DelegationFramework/types';\n","import * as constants from './constants';\nimport * as encode from './encode';\nimport * as execute from './execute';\nimport * as read from './read';\nimport * as simulate from './simulate';\n\nexport { encode, execute, read, simulate, constants };\n","export { ROOT_AUTHORITY, ANY_BENEFICIARY } from '../../delegation';\n\nexport const NAME = 'DelegationManager';\nexport const VERSION = '1.3.0';\nexport const DOMAIN_VERSION = '1';\n","import { encode as disableDelegation } from './methods/disableDelegation';\nimport { encode as enableDelegation } from './methods/enableDelegation';\nimport { encode as redeemDelegations } from './methods/redeemDelegations';\n\nexport { disableDelegation, enableDelegation, redeemDelegations };\n","import { DelegationManager } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { encodeFunctionData } from 'viem';\nimport { simulateContract, writeContract } from 'viem/actions';\n\nimport { toDelegationStruct } from '../../../delegation';\nimport type { Delegation } from '../../../types';\nimport type { InitializedClient } from '../../types';\n\nexport type EncodeDisableDelegationParameters = {\n delegation: Delegation;\n};\n\nexport type SimulateDisableDelegationParameters = {\n client: Client;\n delegationManagerAddress: Address;\n} & EncodeDisableDelegationParameters;\n\nexport type ExecuteDisableDelegationParameters = {\n client: InitializedClient;\n delegationManagerAddress: Address;\n} & EncodeDisableDelegationParameters;\n\nexport const simulate = async ({\n client,\n delegationManagerAddress,\n delegation,\n}: SimulateDisableDelegationParameters) => {\n const delegationStruct = toDelegationStruct(delegation);\n\n return simulateContract(client, {\n address: delegationManagerAddress,\n abi: DelegationManager,\n functionName: 'disableDelegation',\n args: [delegationStruct],\n });\n};\n\nexport const execute = async ({\n client,\n delegationManagerAddress,\n delegation,\n}: ExecuteDisableDelegationParameters) => {\n const { request } = await simulate({\n client,\n delegationManagerAddress,\n delegation,\n });\n\n return writeContract(client, request);\n};\n\nexport const encode = ({ delegation }: EncodeDisableDelegationParameters) => {\n const delegationStruct = toDelegationStruct(delegation);\n\n return encodeFunctionData({\n abi: DelegationManager,\n functionName: 'disableDelegation',\n args: [delegationStruct],\n });\n};\n","import { DelegationManager } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { encodeFunctionData } from 'viem';\nimport { simulateContract, writeContract } from 'viem/actions';\n\nimport { toDelegationStruct } from '../../../delegation';\nimport type { Delegation } from '../../../types';\nimport type { InitializedClient } from '../../types';\n\nexport type EncodeEnableDelegationParameters = {\n delegation: Delegation;\n};\n\nexport type SimulateEnableDelegationParameters = {\n client: Client;\n delegationManagerAddress: Address;\n} & EncodeEnableDelegationParameters;\n\nexport type ExecuteEnableDelegationParameters = {\n client: InitializedClient;\n delegationManagerAddress: Address;\n} & EncodeEnableDelegationParameters;\n\nexport const simulate = async ({\n client,\n delegationManagerAddress,\n delegation,\n}: SimulateEnableDelegationParameters) => {\n const delegationStruct = toDelegationStruct(delegation);\n\n return simulateContract(client, {\n address: delegationManagerAddress,\n abi: DelegationManager,\n functionName: 'enableDelegation',\n args: [delegationStruct],\n });\n};\n\nexport const execute = async ({\n client,\n delegationManagerAddress,\n delegation,\n}: ExecuteEnableDelegationParameters) => {\n const { request } = await simulate({\n client,\n delegationManagerAddress,\n delegation,\n });\n\n return writeContract(client, request);\n};\n\nexport const encode = ({ delegation }: EncodeEnableDelegationParameters) => {\n const delegationStruct = toDelegationStruct(delegation);\n\n return encodeFunctionData({\n abi: DelegationManager,\n functionName: 'enableDelegation',\n args: [delegationStruct],\n });\n};\n","import { DelegationManager } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { encodeFunctionData } from 'viem';\nimport { simulateContract, writeContract } from 'viem/actions';\n\nimport { encodeDelegations } from '../../../delegation';\nimport { encodeExecutionCalldatas } from '../../../executions';\nimport type { ExecutionMode, ExecutionStruct } from '../../../executions';\nimport type { PermissionContext } from '../../../types';\nimport type { InitializedClient } from '../../types';\n\nexport type EncodeRedeemDelegationsParameters = {\n delegations: PermissionContext[];\n modes: ExecutionMode[];\n executions: ExecutionStruct[][];\n};\n\nexport type SimulateRedeemDelegationsParameters = {\n client: Client;\n delegationManagerAddress: Address;\n} & EncodeRedeemDelegationsParameters;\n\nexport type ExecuteRedeemDelegationsParameters = {\n client: InitializedClient;\n delegationManagerAddress: Address;\n} & EncodeRedeemDelegationsParameters;\n\nexport const simulate = async ({\n client,\n delegationManagerAddress,\n delegations,\n modes,\n executions,\n}: SimulateRedeemDelegationsParameters) => {\n return simulateContract(client, {\n address: delegationManagerAddress,\n abi: DelegationManager,\n functionName: 'redeemDelegations',\n args: [\n delegations.map((delegationChain) => encodeDelegations(delegationChain)),\n modes,\n encodeExecutionCalldatas(executions),\n ],\n });\n};\n\nexport const execute = async ({\n client,\n delegationManagerAddress,\n delegations,\n modes,\n executions,\n}: ExecuteRedeemDelegationsParameters) => {\n const { request } = await simulate({\n client,\n delegationManagerAddress,\n delegations,\n modes,\n executions,\n });\n\n return writeContract(client, request);\n};\n\nexport const encode = ({\n delegations,\n modes,\n executions,\n}: EncodeRedeemDelegationsParameters) => {\n return encodeFunctionData({\n abi: DelegationManager,\n functionName: 'redeemDelegations',\n args: [\n delegations.map((delegationChain) => encodeDelegations(delegationChain)),\n modes,\n encodeExecutionCalldatas(executions),\n ],\n });\n};\n","import { execute as disableDelegation } from './methods/disableDelegation';\nimport { execute as enableDelegation } from './methods/enableDelegation';\nimport { execute as redeemDelegations } from './methods/redeemDelegations';\n\nexport { disableDelegation, enableDelegation, redeemDelegations };\n","import { read as disabledDelegations } from './methods/disabledDelegations';\nimport { read as getAnyDelegate } from './methods/getAnyDelegate';\nimport { read as getRootAuthority } from './methods/getRootAuthority';\n\nexport { getAnyDelegate, getRootAuthority, disabledDelegations };\n","import { DelegationManager } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadDisabledDelegationsParameters = {\n client: Client;\n contractAddress: Address;\n delegationHash: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationHash,\n}: ReadDisabledDelegationsParameters) =>\n await readContract(client, {\n address: contractAddress,\n abi: DelegationManager,\n functionName: 'disabledDelegations',\n args: [delegationHash],\n });\n","import { DelegationManager } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetAnyDelegateParameters = {\n client: Client;\n contractAddress: Address;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n}: ReadGetAnyDelegateParameters) =>\n await readContract(client, {\n address: contractAddress,\n abi: DelegationManager,\n functionName: 'ANY_DELEGATE',\n });\n","import { DelegationManager } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetRootAuthorityParameters = {\n client: Client;\n contractAddress: Address;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n}: ReadGetRootAuthorityParameters) =>\n await readContract(client, {\n address: contractAddress,\n abi: DelegationManager,\n functionName: 'ROOT_AUTHORITY',\n });\n","import { simulate as disableDelegation } from './methods/disableDelegation';\nimport { simulate as enableDelegation } from './methods/enableDelegation';\nimport { simulate as redeemDelegations } from './methods/redeemDelegations';\n\nexport { disableDelegation, enableDelegation, redeemDelegations };\n","import * as encode from './encode';\nimport * as execute from './execute';\nimport * as read from './read';\nimport * as simulate from './simulate';\n\nexport { encode, simulate, read, execute };\n","import { execute as disableDelegation } from './methods/disableDelegation';\nimport { execute as enableDelegation } from './methods/enableDelegation';\nimport { execute } from './methods/execute';\nimport { execute as executeWithMode } from './methods/executeWithMode';\nimport { execute as upgradeToAndCall } from './methods/upgradeToAndCall';\n\nexport {\n disableDelegation,\n enableDelegation,\n execute,\n executeWithMode,\n upgradeToAndCall,\n};\n","import { simulate as disableDelegation } from './methods/disableDelegation';\nimport { simulate as enableDelegation } from './methods/enableDelegation';\nimport { simulate as execute } from './methods/execute';\nimport { simulate as executeWithMode } from './methods/executeWithMode';\nimport { simulate as upgradeToAndCall } from './methods/upgradeToAndCall';\n\nexport {\n disableDelegation,\n enableDelegation,\n execute,\n executeWithMode,\n upgradeToAndCall,\n};\n","export * as read from './read';\n","import { read as getContractName } from './methods/getContractName';\nimport { read as getContractVersion } from './methods/getContractVersion';\nimport { read as getDomainVersion } from './methods/getDomainVersion';\n\nexport { getContractName, getContractVersion, getDomainVersion };\n","import type { Client, Address } from 'viem';\nimport { readContract } from 'viem/actions';\n\n// NOTE: ABIs have been extracted and minimized for reuse across contracts. These methods are included in our contracts but are not a part of the EIP712 standard itself.\n\nexport type ReadGetContractNameParameters = {\n client: Client;\n contractAddress: Address;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n}: ReadGetContractNameParameters) =>\n await readContract(client, {\n address: contractAddress,\n abi: [\n {\n type: 'function',\n name: 'NAME',\n inputs: [],\n outputs: [\n {\n name: '',\n type: 'string',\n internalType: 'string',\n },\n ],\n stateMutability: 'view',\n },\n ],\n functionName: 'NAME',\n });\n","import type { Client, Address } from 'viem';\nimport { readContract } from 'viem/actions';\n\n// NOTE: ABIs have been extracted and minimized for reuse across contracts. These methods are included in our contracts but are not a part of the EIP712 standard itself.\n\nexport type ReadGetContractVersionParameters = {\n client: Client;\n contractAddress: Address;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n}: ReadGetContractVersionParameters) =>\n await readContract(client, {\n address: contractAddress,\n abi: [\n {\n type: 'function',\n name: 'VERSION',\n inputs: [],\n outputs: [\n {\n name: '',\n type: 'string',\n internalType: 'string',\n },\n ],\n stateMutability: 'view',\n },\n ],\n functionName: 'VERSION',\n });\n","import type { Client, Address } from 'viem';\nimport { readContract } from 'viem/actions';\n\n// NOTE: ABIs have been extracted and minimized for reuse across contracts. These methods are included in our contracts but are not a part of the EIP712 standard itself.\n\nexport type ReadGetDomainVersionParameters = {\n client: Client;\n contractAddress: Address;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n}: ReadGetDomainVersionParameters) =>\n await readContract(client, {\n address: contractAddress,\n abi: [\n {\n type: 'function',\n name: 'DOMAIN_VERSION',\n inputs: [],\n outputs: [\n {\n name: '',\n type: 'string',\n internalType: 'string',\n },\n ],\n stateMutability: 'view',\n },\n ],\n functionName: 'DOMAIN_VERSION',\n });\n","import * as read from './read';\n\nexport { read };\n","import { read as entryPointGetNonce } from './methods/getNonce';\n\nexport { entryPointGetNonce };\n","import { EntryPoint } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetNonceParameters = {\n client: Client;\n entryPoint: Address;\n contractAddress: Address;\n key: bigint;\n};\n\nexport const read = async ({\n client,\n entryPoint,\n contractAddress,\n key,\n}: ReadGetNonceParameters) =>\n await readContract(client, {\n address: entryPoint,\n abi: EntryPoint,\n functionName: 'getNonce',\n args: [contractAddress, key],\n });\n","import * as read from './read';\n\nexport { read };\n","import { read as getSpentAmount } from './methods/getSpentAmount';\nimport { read as getTermsInfo } from './methods/getTermsInfo';\n\nexport { getTermsInfo, getSpentAmount };\n","import { ERC20TransferAmountEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetSpentAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationManager: Address;\n delegationHash: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationManager,\n delegationHash,\n}: ReadGetSpentAmountParameters): Promise<bigint> => {\n const amount = await readContract(client, {\n address: contractAddress,\n abi: ERC20TransferAmountEnforcer,\n functionName: 'spentMap',\n args: [delegationManager, delegationHash],\n });\n\n return amount;\n};\n","import { ERC20TransferAmountEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetTermsInfoParameters = {\n client: Client;\n contractAddress: Address;\n terms: Hex;\n};\n\nexport type TermsData = {\n allowedContract: Address;\n maxTokens: bigint;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n terms,\n}: ReadGetTermsInfoParameters): Promise<TermsData> => {\n const [allowedContract, maxTokens] = await readContract(client, {\n address: contractAddress,\n abi: ERC20TransferAmountEnforcer,\n functionName: 'getTermsInfo',\n args: [terms],\n });\n\n return {\n allowedContract,\n maxTokens,\n };\n};\n","export * as read from './read';\nexport * as encode from './encode';\nexport * as simulate from './simulate';\nexport * as constants from './constants';\n","import { read as getKey } from './methods/getKey';\nimport { read as getKeyIdHashes } from './methods/getKeyIdHashes';\nimport { read as getKeyIdHashesCount } from './methods/getKeyIdHashesCount';\n\nexport { getKey, getKeyIdHashes, getKeyIdHashesCount };\n","import { HybridDeleGator } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetKeyParameters = {\n client: Client;\n hybridDeleGatorAddress: Address;\n keyId: string;\n};\n\nexport const read = async ({\n client,\n hybridDeleGatorAddress,\n keyId,\n}: ReadGetKeyParameters) =>\n await readContract(client, {\n address: hybridDeleGatorAddress,\n abi: HybridDeleGator,\n functionName: 'getKey',\n args: [keyId],\n });\n","import { HybridDeleGator } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetKeyIdHashesParameters = {\n client: Client;\n hybridDeleGatorAddress: Address;\n};\n\nexport const read = async ({\n client,\n hybridDeleGatorAddress,\n}: ReadGetKeyIdHashesParameters) =>\n await readContract(client, {\n address: hybridDeleGatorAddress,\n abi: HybridDeleGator,\n functionName: 'getKeyIdHashes',\n });\n","import { HybridDeleGator } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetKeyIdHashesCountParameters = {\n client: Client;\n hybridDeleGatorAddress: Address;\n};\n\nexport const read = async ({\n client,\n hybridDeleGatorAddress,\n}: ReadGetKeyIdHashesCountParameters) =>\n await readContract(client, {\n address: hybridDeleGatorAddress,\n abi: HybridDeleGator,\n functionName: 'getKeyIdHashesCount',\n });\n","import { simulate as addKey } from './methods/addKey';\nimport { simulate as initializeHybridDeleGator } from './methods/initialize';\nimport { simulate as reinitializeHybridDeleGator } from './methods/reinitialize';\nimport { simulate as removeKey } from './methods/removeKey';\nimport { simulate as updateSigners } from './methods/updateSigners';\n\nexport {\n addKey,\n initializeHybridDeleGator,\n reinitializeHybridDeleGator,\n removeKey,\n updateSigners,\n};\n","export { ROOT_AUTHORITY, ANY_BENEFICIARY } from '../../delegation';\n\nexport const NAME = 'HybridDeleGator';\nexport const VERSION = '1.3.0';\nexport const DOMAIN_VERSION = '1';\n","import * as read from './read';\n\nexport { read };\n","import { read as getIsUsed } from './methods/getIsUsed';\nimport { read as getTermsInfo } from './methods/getTermsInfo';\n\nexport { getTermsInfo, getIsUsed };\n","import { IdEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetIsUsedParameters = {\n client: Client;\n contractAddress: Address;\n delegationManager: Address;\n delegator: Address;\n id: bigint;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationManager,\n delegator,\n id,\n}: ReadGetIsUsedParameters): Promise<boolean> => {\n const isUsed = await readContract(client, {\n address: contractAddress,\n abi: IdEnforcer,\n functionName: 'getIsUsed',\n args: [delegationManager, delegator, id],\n });\n\n return isUsed;\n};\n","import { IdEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetTermsInfoParameters = {\n client: Client;\n contractAddress: Address;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n terms,\n}: ReadGetTermsInfoParameters): Promise<bigint> => {\n const id = await readContract(client, {\n address: contractAddress,\n abi: IdEnforcer,\n functionName: 'getTermsInfo',\n args: [terms],\n });\n\n return id;\n};\n","import * as read from './read';\n\nexport { read };\n","import { read as callCounts } from './methods/callCounts';\nimport { read as getTermsInfo } from './methods/getTermsInfo';\n\nexport { callCounts, getTermsInfo };\n","import { LimitedCallsEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadCallCountsParameters = {\n client: Client;\n contractAddress: Address;\n delegationManager: Address;\n delegationHash: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationManager,\n delegationHash,\n}: ReadCallCountsParameters): Promise<bigint> => {\n const count = await readContract(client, {\n address: contractAddress,\n abi: LimitedCallsEnforcer,\n functionName: 'callCounts',\n args: [delegationManager, delegationHash],\n });\n\n return count;\n};\n","import { LimitedCallsEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetTermsInfoParameters = {\n client: Client;\n contractAddress: Address;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n terms,\n}: ReadGetTermsInfoParameters): Promise<bigint> => {\n const limit = await readContract(client, {\n address: contractAddress,\n abi: LimitedCallsEnforcer,\n functionName: 'getTermsInfo',\n args: [terms],\n });\n\n return limit;\n};\n","export * as read from './read';\nexport * as encode from './encode';\nexport * as simulate from './simulate';\nexport * as constants from './constants';\n","import { read as getMaxNumberOfSigners } from './methods/getMaxNumberOfSigners';\nimport { read as getSigners } from './methods/getSigners';\nimport { read as getSignersCount } from './methods/getSignersCount';\nimport { read as getThreshold } from './methods/getThreshold';\nimport { read as isSigner } from './methods/isSigner';\n\nexport {\n getSigners,\n getSignersCount,\n getThreshold,\n isSigner,\n getMaxNumberOfSigners,\n};\n","import { MultiSigDeleGator } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetMaxNumberOfSignersParameters = {\n client: Client;\n multiSigDeleGatorAddress: Address;\n};\n\nexport const read = async ({\n client,\n multiSigDeleGatorAddress,\n}: ReadGetMaxNumberOfSignersParameters) =>\n await readContract(client, {\n address: multiSigDeleGatorAddress,\n abi: MultiSigDeleGator,\n functionName: 'MAX_NUMBER_OF_SIGNERS',\n });\n","import { MultiSigDeleGator } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetSignersParameters = {\n client: Client;\n multiSigDeleGatorAddress: Address;\n};\n\nexport const read = async ({\n client,\n multiSigDeleGatorAddress,\n}: ReadGetSignersParameters) =>\n await readContract(client, {\n address: multiSigDeleGatorAddress,\n abi: MultiSigDeleGator,\n functionName: 'getSigners',\n });\n","import { MultiSigDeleGator } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetSignersCountParameters = {\n client: Client;\n multiSigDeleGatorAddress: Address;\n};\n\nexport const read = async ({\n client,\n multiSigDeleGatorAddress,\n}: ReadGetSignersCountParameters) =>\n await readContract(client, {\n address: multiSigDeleGatorAddress,\n abi: MultiSigDeleGator,\n functionName: 'getSignersCount',\n });\n","import { MultiSigDeleGator } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetThresholdParameters = {\n client: Client;\n multiSigDeleGatorAddress: Address;\n};\n\nexport const read = async ({\n client,\n multiSigDeleGatorAddress,\n}: ReadGetThresholdParameters) =>\n await readContract(client, {\n address: multiSigDeleGatorAddress,\n abi: MultiSigDeleGator,\n functionName: 'getThreshold',\n });\n","import { MultiSigDeleGator } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadIsSignerParameters = {\n client: Client;\n multiSigDeleGatorAddress: Address;\n signer: Address;\n};\n\nexport const read = async ({\n client,\n multiSigDeleGatorAddress,\n signer,\n}: ReadIsSignerParameters) =>\n await readContract(client, {\n address: multiSigDeleGatorAddress,\n abi: MultiSigDeleGator,\n functionName: 'isSigner',\n args: [signer],\n });\n","import { simulate as addSigner } from './methods/addSigner';\nimport { simulate as initializeMultiSigDeleGator } from './methods/initialize';\nimport { simulate as reinitializeMultiSigDeleGator } from './methods/reinitialize';\nimport { simulate as removeSigner } from './methods/removeSigner';\nimport { simulate as replaceSigner } from './methods/replaceSigner';\nimport { simulate as updateMultiSigParameters } from './methods/updateMultiSigParameters';\nimport { simulate as updateThreshold } from './methods/updateThreshold';\n\nexport {\n addSigner,\n initializeMultiSigDeleGator,\n reinitializeMultiSigDeleGator,\n removeSigner,\n replaceSigner,\n updateMultiSigParameters,\n updateThreshold,\n};\n","export const MAX_NUMBER_OF_SIGNERS = 30;\n","import * as read from './read';\n\nexport { read };\n","import { read as getSpentAmount } from './methods/getSpentAmount';\nimport { read as getTermsInfo } from './methods/getTermsInfo';\n\nexport { getSpentAmount, getTermsInfo };\n","import { NativeTokenTransferAmountEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetSpentAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationManager: Address;\n delegationHash: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationManager,\n delegationHash,\n}: ReadGetSpentAmountParameters): Promise<bigint> => {\n const amount = await readContract(client, {\n address: contractAddress,\n abi: NativeTokenTransferAmountEnforcer,\n functionName: 'spentMap',\n args: [delegationManager, delegationHash],\n });\n\n return amount;\n};\n","import { NativeTokenTransferAmountEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetTermsInfoParameters = {\n client: Client;\n contractAddress: Address;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n terms,\n}: ReadGetTermsInfoParameters): Promise<bigint> => {\n const allowance = await readContract(client, {\n address: contractAddress,\n abi: NativeTokenTransferAmountEnforcer,\n functionName: 'getTermsInfo',\n args: [terms],\n });\n\n return allowance;\n};\n","import * as encode from './encode';\nimport * as execute from './execute';\nimport * as read from './read';\nimport * as simulate from './simulate';\n\nexport { encode, execute, read, simulate };\n","import { encode as incrementNonce } from './methods/incrementNonce';\n\nexport { incrementNonce };\n","import { NonceEnforcer } from '@metamask/delegation-abis';\nimport type { Account, Address, Chain, Client, Transport } from 'viem';\nimport { encodeFunctionData } from 'viem';\nimport { simulateContract, writeContract } from 'viem/actions';\n\nexport type SimulateIncrementNonceParameters = {\n client: Client<Transport, Chain, Account>;\n contractAddress: Address;\n delegationManager: Address;\n};\n\nexport const encode = (delegationManager: Address) => {\n return encodeFunctionData({\n abi: NonceEnforcer,\n functionName: 'incrementNonce',\n args: [delegationManager],\n });\n};\n\nexport const simulate = async ({\n client,\n contractAddress,\n delegationManager,\n}: SimulateIncrementNonceParameters) => {\n return simulateContract(client, {\n address: contractAddress,\n abi: NonceEnforcer,\n functionName: 'incrementNonce',\n args: [delegationManager],\n });\n};\n\nexport const execute = async ({\n client,\n contractAddress,\n delegationManager,\n}: SimulateIncrementNonceParameters) => {\n const { request } = await simulate({\n client,\n contractAddress,\n delegationManager,\n });\n return writeContract(client, request);\n};\n","import { execute as incrementNonce } from './methods/incrementNonce';\n\nexport { incrementNonce };\n","import { read as currentNonce } from './methods/currentNonce';\nimport { read as getTermsInfo } from './methods/getTermsInfo';\n\nexport { currentNonce, getTermsInfo };\n","import { NonceEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadCurrentNonceParameters = {\n client: Client;\n contractAddress: Address;\n delegationManager: Address;\n delegator: Address;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationManager,\n delegator,\n}: ReadCurrentNonceParameters): Promise<bigint> => {\n const nonce = await readContract(client, {\n address: contractAddress,\n abi: NonceEnforcer,\n functionName: 'currentNonce',\n args: [delegationManager, delegator],\n });\n\n return nonce;\n};\n","import { NonceEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetTermsInfoParameters = {\n client: Client;\n contractAddress: Address;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n terms,\n}: ReadGetTermsInfoParameters): Promise<bigint> => {\n const nonce = await readContract(client, {\n address: contractAddress,\n abi: NonceEnforcer,\n functionName: 'getTermsInfo',\n args: [terms],\n });\n\n return nonce;\n};\n","import { simulate as incrementNonce } from './methods/incrementNonce';\n\nexport { incrementNonce };\n","export * as read from './read';\nexport * as execute from './execute';\nexport * as encode from './encode';\nexport * as simulate from './simulate';\n","import { read as getOwner } from './methods/getOwner';\nimport { read as getPendingOwner } from './methods/getPendingOwner';\n\nexport { getPendingOwner, getOwner };\n","import { Ownable2Step } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetOwnerParameters = {\n client: Client;\n contractAddress: Address;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n}: ReadGetOwnerParameters) =>\n await readContract(client, {\n address: contractAddress,\n abi: Ownable2Step,\n functionName: 'owner',\n });\n","import { Ownable2Step } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetPendingOwnerParameters = {\n client: Client;\n contractAddress: Address;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n}: ReadGetPendingOwnerParameters) =>\n await readContract(client, {\n address: contractAddress,\n abi: Ownable2Step,\n functionName: 'pendingOwner',\n });\n","import { execute as acceptOwnership } from './methods/acceptOwnership';\nimport { execute as renounceOwnership } from './methods/renounceOwnership';\nimport { execute as transferOwnership } from './methods/transferOwnership';\n\nexport { transferOwnership, renounceOwnership, acceptOwnership };\n","import { Ownable2Step } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { encodeFunctionData } from 'viem';\nimport { simulateContract, writeContract } from 'viem/actions';\n\nimport type { InitializedClient } from '../../types';\n\nexport type SimulateAcceptOwnershipParameters = {\n client: Client;\n contractAddress: Address;\n};\n\nexport type ExecuteAcceptOwnershipParameters = {\n client: InitializedClient;\n contractAddress: Address;\n};\n\nexport const simulate = async ({\n client,\n contractAddress,\n}: SimulateAcceptOwnershipParameters) => {\n return simulateContract(client, {\n address: contractAddress,\n abi: Ownable2Step,\n functionName: 'acceptOwnership',\n });\n};\n\nexport const execute = async ({\n client,\n contractAddress,\n}: ExecuteAcceptOwnershipParameters) => {\n const { request } = await simulate({\n client,\n contractAddress,\n });\n return writeContract(client, request);\n};\n\nexport const encode = () => {\n return encodeFunctionData({\n abi: Ownable2Step,\n functionName: 'acceptOwnership',\n });\n};\n","import { Ownable2Step } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { encodeFunctionData } from 'viem';\nimport { simulateContract, writeContract } from 'viem/actions';\n\nimport type { InitializedClient } from '../../types';\n\nexport type SimulateRenounceOwnershipParameters = {\n client: Client;\n contractAddress: Address;\n};\n\nexport type ExecuteRenounceOwnershipParameters = {\n client: InitializedClient;\n contractAddress: Address;\n};\n\nexport const simulate = async ({\n client,\n contractAddress,\n}: SimulateRenounceOwnershipParameters) => {\n return simulateContract(client, {\n address: contractAddress,\n abi: Ownable2Step,\n functionName: 'renounceOwnership',\n });\n};\n\nexport const execute = async ({\n client,\n contractAddress,\n}: ExecuteRenounceOwnershipParameters) => {\n const { request } = await simulate({\n client,\n contractAddress,\n });\n return writeContract(client, request);\n};\n\nexport const encode = () => {\n return encodeFunctionData({\n abi: Ownable2Step,\n functionName: 'renounceOwnership',\n });\n};\n","import { Ownable2Step } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { encodeFunctionData } from 'viem';\nimport { simulateContract, writeContract } from 'viem/actions';\n\nimport type { InitializedClient } from '../../types';\n\nexport type SimulateTransferOwnershipParameters = {\n client: Client;\n contractAddress: Address;\n account: Address;\n};\n\nexport type ExecuteTransferOwnershipParameters = {\n client: InitializedClient;\n contractAddress: Address;\n account: Address;\n};\n\nexport const simulate = async ({\n client,\n contractAddress,\n account,\n}: SimulateTransferOwnershipParameters) => {\n return simulateContract(client, {\n address: contractAddress,\n abi: Ownable2Step,\n functionName: 'transferOwnership',\n args: [account],\n });\n};\n\nexport const execute = async ({\n client,\n contractAddress,\n account,\n}: ExecuteTransferOwnershipParameters) => {\n const { request } = await simulate({\n client,\n contractAddress,\n account,\n });\n return writeContract(client, request);\n};\n\nexport const encode = (account: Address) => {\n return encodeFunctionData({\n abi: Ownable2Step,\n functionName: 'transferOwnership',\n args: [account],\n });\n};\n","import { encode as acceptOwnership } from './methods/acceptOwnership';\nimport { encode as renounceOwnership } from './methods/renounceOwnership';\nimport { encode as transferOwnership } from './methods/transferOwnership';\n\nexport { transferOwnership, renounceOwnership, acceptOwnership };\n","import { simulate as acceptOwnership } from './methods/acceptOwnership';\nimport { simulate as renounceOwnership } from './methods/renounceOwnership';\nimport { simulate as transferOwnership } from './methods/transferOwnership';\n\nexport { transferOwnership, renounceOwnership, acceptOwnership };\n","export * as read from './read';\nexport * as execute from './execute';\nexport * as encode from './encode';\nexport * as simulate from './simulate';\n","import { read as isPaused } from './methods/isPaused';\n\nexport { isPaused };\n","import { Pausable } from '@metamask/delegation-abis';\nimport type { Address, Client } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadIsPausedParameters = {\n client: Client;\n contractAddress: Address;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n}: ReadIsPausedParameters) =>\n await readContract(client, {\n address: contractAddress,\n abi: Pausable,\n functionName: 'paused',\n });\n","import { execute as pause } from './methods/pause';\nimport { execute as unpause } from './methods/unpause';\n\nexport { pause, unpause };\n","import type { Address, Client } from 'viem';\nimport { encodeFunctionData } from 'viem';\nimport { simulateContract, writeContract } from 'viem/actions';\n\nimport type { InitializedClient } from '../../types';\n\nconst PauseAbi = [\n {\n type: 'function',\n name: 'pause',\n inputs: [],\n outputs: [],\n stateMutability: 'nonpayable',\n },\n];\n\nexport type SimulatePauseParameters = {\n client: Client;\n contractAddress: Address;\n};\n\nexport type ExecutePauseParameters = {\n client: InitializedClient;\n contractAddress: Address;\n};\n\nexport const simulate = async ({\n client,\n contractAddress,\n}: SimulatePauseParameters) => {\n return simulateContract(client, {\n address: contractAddress,\n abi: PauseAbi,\n functionName: 'pause',\n });\n};\n\nexport const execute = async ({\n client,\n contractAddress,\n}: ExecutePauseParameters) => {\n const { request } = await simulate({\n client,\n contractAddress,\n });\n return writeContract(client, request);\n};\n\nexport const encode = () => {\n return encodeFunctionData({\n abi: PauseAbi,\n functionName: 'pause',\n });\n};\n","import type { Address, Client } from 'viem';\nimport { encodeFunctionData } from 'viem';\nimport { simulateContract, writeContract } from 'viem/actions';\n\nimport type { InitializedClient } from '../../types';\n\nconst UnpauseAbi = [\n {\n type: 'function',\n name: 'unpause',\n inputs: [],\n outputs: [],\n stateMutability: 'nonpayable',\n },\n];\n\nexport type SimulateUnpauseParameters = {\n client: Client;\n contractAddress: Address;\n};\n\nexport type ExecuteUnpauseParameters = {\n client: InitializedClient;\n contractAddress: Address;\n};\n\nexport const simulate = async ({\n client,\n contractAddress,\n}: SimulateUnpauseParameters) => {\n return simulateContract(client, {\n address: contractAddress,\n abi: UnpauseAbi,\n functionName: 'unpause',\n });\n};\n\nexport const execute = async ({\n client,\n contractAddress,\n}: ExecuteUnpauseParameters) => {\n const { request } = await simulate({\n client,\n contractAddress,\n });\n return writeContract(client, request);\n};\n\nexport const encode = () => {\n return encodeFunctionData({\n abi: UnpauseAbi,\n functionName: 'unpause',\n });\n};\n","import { encode as pause } from './methods/pause';\nimport { encode as unpause } from './methods/unpause';\n\nexport { pause, unpause };\n","import { simulate as pause } from './methods/pause';\nimport { simulate as unpause } from './methods/unpause';\n\nexport { pause, unpause };\n","import * as encode from './encode';\nimport * as execute from './execute';\nimport * as read from './read';\nimport * as simulate from './simulate';\n\nexport { read, simulate, execute, encode };\n","import { execute as create2Deploy } from './methods/create2Deploy';\n\nexport { create2Deploy };\n","import { read as getCreate2Address } from './methods/getCreate2Address';\n\nexport { getCreate2Address };\n","import { SimpleFactory } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport const read = async (\n client: Client,\n factoryAddress: Address,\n creationCode: Hex,\n salt: Hex,\n) => {\n return readContract(client, {\n address: factoryAddress,\n abi: SimpleFactory,\n functionName: 'computeAddress',\n args: [creationCode, salt],\n });\n};\n","import { simulate as create2Deploy } from './methods/create2Deploy';\n\nexport { create2Deploy };\n","import * as read from './read';\n\nexport { read };\n","import { read as getTermsInfo } from './methods/getTermsInfo';\nimport { read as usedDelegations } from './methods/usedDelegations';\n\nexport { getTermsInfo, usedDelegations };\n","import { SpecificActionERC20TransferBatchEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetTermsInfoParameters = {\n client: Client;\n contractAddress: Address;\n terms: Hex;\n};\n\nexport type TermsData = {\n tokenAddress: Address;\n recipient: Address;\n amount: bigint;\n firstTarget: Address;\n firstCalldata: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n terms,\n}: ReadGetTermsInfoParameters): Promise<TermsData> => {\n const termsData = await readContract(client, {\n address: contractAddress,\n abi: SpecificActionERC20TransferBatchEnforcer,\n functionName: 'getTermsInfo',\n args: [terms],\n });\n\n return termsData as TermsData;\n};\n","import { SpecificActionERC20TransferBatchEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadUsedDelegationsParameters = {\n client: Client;\n contractAddress: Address;\n delegationManager: Address;\n delegationHash: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationManager,\n delegationHash,\n}: ReadUsedDelegationsParameters): Promise<boolean> => {\n const isUsed = await readContract(client, {\n address: contractAddress,\n abi: SpecificActionERC20TransferBatchEnforcer,\n functionName: 'usedDelegations',\n args: [delegationManager, delegationHash],\n });\n\n return isUsed;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA,gBAAAA;AAAA,EAAA;AAAA,cAAAC;AAAA,EAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAM,OAAO;AACb,IAAM,UAAU;AAChB,IAAM,iBAAiB;;;ACJ9B,IAAAC,kBAAA;AAAA,SAA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ports","read_exports","encode_exports","encode","simulate","execute","DelegationManager","encodeFunctionData","simulateContract","writeContract","simulate","simulateContract","DelegationManager","execute","writeContract","encode","encodeFunctionData","DelegationManager","encodeFunctionData","simulateContract","writeContract","simulate","simulateContract","DelegationManager","execute","writeContract","encode","encodeFunctionData","execute","read_exports","read","DelegationManager","DelegationManager","readContract","read","DelegationManager","readContract","read","simulate","encode_exports","execute_exports","simulate_exports","execute_exports","execute","simulate_exports","simulate","read_exports","read_exports","read","readContract","read","readContract","read","readContract","read","read_exports","read_exports","read","readContract","read","read_exports","read_exports","read","readContract","read","ERC20TransferAmountEnforcer","readContract","read","constants_exports","read_exports","simulate_exports","read_exports","read","readContract","read","HybridDeleGator","readContract","read","HybridDeleGator","readContract","read","simulate_exports","simulate","constants_exports","DOMAIN_VERSION","NAME","VERSION","NAME","VERSION","DOMAIN_VERSION","read_exports","read_exports","read","readContract","read","IdEnforcer","readContract","read","read_exports","read_exports","read","readContract","read","LimitedCallsEnforcer","readContract","read","constants_exports","encode_exports","read_exports","simulate_exports","read_exports","read","readContract","read","MultiSigDeleGator","readContract","read","MultiSigDeleGator","readContract","read","MultiSigDeleGator","readContract","read","MultiSigDeleGator","readContract","read","simulate_exports","simulate","constants_exports","read_exports","read_exports","read","readContract","read","NativeTokenTransferAmountEnforcer","readContract","read","encode_exports","execute_exports","read_exports","simulate_exports","encode_exports","encode","encodeFunctionData","simulateContract","writeContract","encode","simulate","execute","execute_exports","execute","read_exports","read","NonceEnforcer","readContract","read","NonceEnforcer","readContract","read","simulate_exports","simulate","encode_exports","execute_exports","read_exports","simulate_exports","read_exports","read","readContract","read","Ownable2Step","readContract","read","execute_exports","execute","Ownable2Step","encodeFunctionData","simulateContract","writeContract","simulate","execute","encode","Ownable2Step","encodeFunctionData","simulateContract","writeContract","simulate","execute","encode","Ownable2Step","encodeFunctionData","simulateContract","writeContract","simulate","execute","encode","encode_exports","encode","simulate_exports","simulate","encode_exports","execute_exports","read_exports","simulate_exports","read_exports","read","readContract","read","execute_exports","execute","encodeFunctionData","simulateContract","writeContract","simulate","execute","encode","encodeFunctionData","simulateContract","writeContract","simulate","execute","encode","encode_exports","encode","simulate_exports","simulate","encode_exports","execute_exports","read_exports","simulate_exports","execute_exports","read_exports","read","readContract","read","simulate_exports","simulate","read_exports","read_exports","read","readContract","read","SpecificActionERC20TransferBatchEnforcer","readContract","read"]}
@@ -1,79 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/executions.ts
2
-
3
-
4
-
5
- var _viem = require('viem');
6
- var createExecution = ({
7
- target,
8
- value = 0n,
9
- callData = "0x"
10
- }) => {
11
- return {
12
- target,
13
- value,
14
- callData
15
- };
16
- };
17
- var ExecutionMode = /* @__PURE__ */ ((ExecutionMode2) => {
18
- ExecutionMode2["SingleDefault"] = "0x0000000000000000000000000000000000000000000000000000000000000000";
19
- ExecutionMode2["SingleTry"] = "0x0001000000000000000000000000000000000000000000000000000000000000";
20
- ExecutionMode2["BatchDefault"] = "0x0100000000000000000000000000000000000000000000000000000000000000";
21
- ExecutionMode2["BatchTry"] = "0x0101000000000000000000000000000000000000000000000000000000000000";
22
- return ExecutionMode2;
23
- })(ExecutionMode || {});
24
- var EXECUTION_ABI_TYPE_COMPONENTS = [
25
- { type: "address", name: "target" },
26
- { type: "uint256", name: "value" },
27
- { type: "bytes", name: "callData" }
28
- ];
29
- var encodeSingleExecution = (execution) => {
30
- return _viem.encodePacked.call(void 0,
31
- ["address", "uint256", "bytes"],
32
- [execution.target, execution.value, execution.callData]
33
- );
34
- };
35
- var encodeBatchExecution = (executions) => {
36
- return _viem.encodeAbiParameters.call(void 0,
37
- [
38
- {
39
- components: EXECUTION_ABI_TYPE_COMPONENTS,
40
- name: "executions",
41
- type: "tuple[]"
42
- }
43
- ],
44
- [executions]
45
- );
46
- };
47
- var encodeExecutionCalldata = (executions) => {
48
- if (executions.length === 0) {
49
- throw new Error(
50
- "Error while getting the execution calldatas, executions is empty"
51
- );
52
- }
53
- if (executions.length === 1) {
54
- const execution = executions[0];
55
- if (!execution) {
56
- throw new Error("Execution not found");
57
- }
58
- return encodeSingleExecution(execution);
59
- }
60
- return encodeBatchExecution(executions);
61
- };
62
- var encodeExecutionCalldatas = (executionsBatch) => {
63
- if (executionsBatch.length === 0) {
64
- throw new Error(
65
- "Error while getting the execution calldatas, executionsBatch is empty"
66
- );
67
- }
68
- return executionsBatch.map(encodeExecutionCalldata);
69
- };
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
- exports.createExecution = createExecution; exports.ExecutionMode = ExecutionMode; exports.encodeSingleExecution = encodeSingleExecution; exports.encodeBatchExecution = encodeBatchExecution; exports.encodeExecutionCalldata = encodeExecutionCalldata; exports.encodeExecutionCalldatas = encodeExecutionCalldatas;
79
- //# sourceMappingURL=chunk-MOHCTPYQ.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/smart-accounts-kit/smart-accounts-kit/packages/smart-accounts-kit/dist/chunk-MOHCTPYQ.cjs","../src/executions.ts"],"names":["ExecutionMode"],"mappings":"AAAA;ACAA;AAGE;AACA;AAAA,4BACK;AAuBA,IAAM,gBAAA,EAAkB,CAAC;AAAA,EAC9B,MAAA;AAAA,EACA,MAAA,EAAQ,EAAA;AAAA,EACR,SAAA,EAAW;AACb,CAAA,EAAA,GAA4C;AAC1C,EAAA,OAAO;AAAA,IACL,MAAA;AAAA,IACA,KAAA;AAAA,IACA;AAAA,EACF,CAAA;AACF,CAAA;AAIO,IAAK,cAAA,kBAAL,CAAA,CAAKA,cAAAA,EAAAA,GAAL;AACL,EAAAA,cAAAA,CAAA,eAAA,EAAA,EAAgB,oEAAA;AAChB,EAAAA,cAAAA,CAAA,WAAA,EAAA,EAAY,oEAAA;AACZ,EAAAA,cAAAA,CAAA,cAAA,EAAA,EAAe,oEAAA;AACf,EAAAA,cAAAA,CAAA,UAAA,EAAA,EAAW,oEAAA;AAJD,EAAA,OAAAA,cAAAA;AAAA,CAAA,CAAA,CAAA,c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,EAAA,OAAO,oBAAA,CAAqB,UAAU,CAAA;AACxC,CAAA;AAQO,IAAM,yBAAA,EAA2B,CACtC,eAAA,EAAA,GACU;AACV,EAAA,GAAA,CAAI,eAAA,CAAgB,OAAA,IAAW,CAAA,EAAG;AAChC,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,IACF,CAAA;AAAA,EACF;AACA,EAAA,OAAO,eAAA,CAAgB,GAAA,CAAI,uBAAuB,CAAA;AACpD,CAAA;AD3DA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACF,qTAAC","file":"/home/runner/work/smart-accounts-kit/smart-accounts-kit/packages/smart-accounts-kit/dist/chunk-MOHCTPYQ.cjs","sourcesContent":[null,"import {\n type Address,\n type Hex,\n encodeAbiParameters,\n encodePacked,\n} from 'viem';\n\nexport type ExecutionStruct = {\n target: Address;\n value: bigint;\n callData: Hex;\n};\n\nexport type CreateExecutionArgs = {\n target: Address;\n value?: bigint;\n callData?: Hex;\n};\n\n/**\n * Creates an execution data structure.\n *\n * @param args - The arguments for creating an execution.\n * @param args.target - The address to invoke some calldata on.\n * @param args.value - ETH to send to the address.\n * @param args.callData - The calldata to invoke on the address.\n * @returns The created execution data structure.\n */\nexport const createExecution = ({\n target,\n value = 0n,\n callData = '0x',\n}: CreateExecutionArgs): ExecutionStruct => {\n return {\n target,\n value,\n callData,\n };\n};\n\n// Encoded modes\n// https://github.com/erc7579/erc7579-implementation/blob/main/src/lib/ModeLib.sol\nexport enum ExecutionMode {\n SingleDefault = '0x0000000000000000000000000000000000000000000000000000000000000000',\n SingleTry = '0x0001000000000000000000000000000000000000000000000000000000000000',\n BatchDefault = '0x0100000000000000000000000000000000000000000000000000000000000000',\n BatchTry = '0x0101000000000000000000000000000000000000000000000000000000000000',\n}\n\n/**\n * The ABI type components of an Execution.\n */\nexport const EXECUTION_ABI_TYPE_COMPONENTS = [\n { type: 'address', name: 'target' },\n { type: 'uint256', name: 'value' },\n { type: 'bytes', name: 'callData' },\n];\n\n/**\n * Encodes a single Execution. Used for executing a single Execution in a DeleGator SCA.\n *\n * @param execution - The execution to encode.\n * @returns The encoded execution.\n */\nexport const encodeSingleExecution = (execution: ExecutionStruct): Hex => {\n return encodePacked(\n ['address', 'uint256', 'bytes'],\n [execution.target, execution.value, execution.callData],\n );\n};\n\n/**\n * Encodes a batch of Executions. Used for executing a batch of Executions in a DeleGator SCA.\n *\n * @param executions - The executions to encode.\n * @returns The encoded executions.\n */\nexport const encodeBatchExecution = (executions: ExecutionStruct[]): Hex => {\n return encodeAbiParameters(\n [\n {\n components: EXECUTION_ABI_TYPE_COMPONENTS,\n name: 'executions',\n type: 'tuple[]',\n },\n ],\n [executions],\n );\n};\n\n/**\n * Encodes the calldata for interacting with the advanced `execute` DeleGator method.\n *\n * @param executions - The execution(s) to encode.\n * @returns The encoded execution(s).\n */\nexport const encodeExecutionCalldata = (executions: ExecutionStruct[]): Hex => {\n if (executions.length === 0) {\n throw new Error(\n 'Error while getting the execution calldatas, executions is empty',\n );\n }\n if (executions.length === 1) {\n const execution = executions[0];\n if (!execution) {\n throw new Error('Execution not found');\n }\n return encodeSingleExecution(execution);\n }\n\n return encodeBatchExecution(executions);\n};\n\n/**\n * Encodes the calldata for interacting with `redeemDelegations`.\n *\n * @param executionsBatch - The executions to encode.\n * @returns The encoded executions.\n */\nexport const encodeExecutionCalldatas = (\n executionsBatch: ExecutionStruct[][],\n): Hex[] => {\n if (executionsBatch.length === 0) {\n throw new Error(\n 'Error while getting the execution calldatas, executionsBatch is empty',\n );\n }\n return executionsBatch.map(encodeExecutionCalldata);\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/smart-accounts-kit/smart-accounts-kit/packages/smart-accounts-kit/dist/chunk-MVBU3LRV.cjs","../src/counterfactualAccountData.ts","../src/encodeCalls.ts","../src/webAuthn.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6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,IAAA;AACR,EAAA;AAEL;AAYO;AAML,EAAA;AAEA,EAAA;AAEA,EAAA;AAEA,EAAA;AACE,IAAA;AAA8B,EAAA;AAGhC,EAAA;AAGA,EAAA;AAEA,EAAA;AAEA,EAAA;AAAmE,IAAA;AACjE,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,EAAA;AAEF,EAAA;AACF;AAEA;AAsBO;AAGL,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACE,IAAA;AAAqE,EAAA;AAKvE,EAAA;AAEA,EAAA;AAAO;AAAA,IAAA;AAE+B,EAAA;AAExC;AASO;AAEL,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AAEA,EAAA;AACA,EAAA;AAEA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AAEA,EAAA;AAAmE,IAAA;AACjE,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,EAAA;AAGF,EAAA;AACF;AH8CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/smart-accounts-kit/smart-accounts-kit/packages/smart-accounts-kit/dist/chunk-MVBU3LRV.cjs","sourcesContent":[null,"import type { Address, Hex } from 'viem';\nimport { getContractAddress, pad } from 'viem';\n\nimport { Implementation } from './constants';\nimport { initializeHybridDeleGator } from './DelegationFramework/HybridDeleGator/encode';\nimport { initializeMultiSigDeleGator } from './DelegationFramework/MultiSigDeleGator/encode';\nimport { create2Deploy as encodeCreate2Deploy } from './DelegationFramework/SimpleFactory/encode';\nimport { encodeProxyCreationCode } from './DelegationFramework/utils';\nimport type {\n SmartAccountsEnvironment,\n HybridDeleGatorDeployParams,\n MultiSigDeleGatorDeployParams,\n DeployParams,\n} from './types';\n\n/**\n * Infers counterfactual account data for a DeleGator smart account.\n *\n * @template TImplementation - The type of implementation, extending Implementation.\n * @template TDeployParams - The type of deployment parameters, defaults to DeployParams<Implementation>.\n * @param options - The options for generating counterfactual account data.\n * @param options.factory - The address of the SimpleFactory contract.\n * @param options.implementations - The DeleGator implementation contracts.\n * @param options.implementation - The implementation type to use.\n * @param options.deployParams - The deployment parameters for the specified implementation.\n * @param options.deploySalt - The salt to use for CREATE2 address computation.\n * @returns An object containing the counterfactual address and factory calldata.\n * @description This function calculates the address a DeleGator contract would have if deployed,\n * and provides the calldata needed to deploy it.\n */\nexport const getCounterfactualAccountData = async <\n TImplementation extends Implementation,\n>({\n factory,\n implementations,\n implementation,\n deployParams,\n deploySalt,\n}: {\n factory: Address;\n implementations: SmartAccountsEnvironment['implementations'];\n implementation: TImplementation;\n deployParams: DeployParams<TImplementation>;\n deploySalt: Hex;\n}): Promise<{ factoryData: Hex; address: Address }> => {\n let implementationAddress: Address;\n let initcode: Hex;\n\n switch (implementation) {\n case Implementation.Hybrid: {\n const [owner, keyIds, xValues, yValues] =\n deployParams as HybridDeleGatorDeployParams;\n\n if (!implementations.HybridDeleGatorImpl) {\n throw new Error(\n 'HybridDeleGatorImpl address not provided in environment',\n );\n }\n\n implementationAddress = implementations.HybridDeleGatorImpl;\n\n const p256Owners = keyIds.map((keyId, index) => {\n const xValue = xValues[index];\n const yValue = yValues[index];\n\n if (!xValue || !yValue) {\n throw new Error(\n `Missing X or Y value for keyId ${keyId} at index ${index}`,\n );\n }\n\n return {\n keyId,\n x: xValue,\n y: yValue,\n };\n });\n\n initcode = initializeHybridDeleGator({ eoaOwner: owner, p256Owners });\n break;\n }\n case Implementation.MultiSig: {\n const [owners, threshold] = deployParams as MultiSigDeleGatorDeployParams;\n\n if (!implementations.MultiSigDeleGatorImpl) {\n throw new Error(\n 'MultiSigDeleGatorImpl address not provided in environment',\n );\n }\n\n implementationAddress = implementations.MultiSigDeleGatorImpl;\n initcode = initializeMultiSigDeleGator({ owners, threshold });\n break;\n }\n case Implementation.Stateless7702:\n default:\n throw new Error(`Implementation type '${implementation}' not supported`);\n }\n\n const salt = pad(deploySalt, { dir: 'left', size: 32 });\n\n const proxyCreationCode = encodeProxyCreationCode({\n implementationAddress,\n initcode,\n });\n\n const address = getContractAddress({\n bytecode: proxyCreationCode,\n from: factory,\n opcode: 'CREATE2',\n salt,\n });\n\n const factoryData = encodeCreate2Deploy(proxyCreationCode, salt);\n\n return {\n factoryData,\n address,\n };\n};\n","import { DelegationManager } from '@metamask/delegation-abis';\nimport { encodeFunctionData } from 'viem';\nimport type { Address, Hex } from 'viem';\n\nimport type { DelegatedCall } from './actions/erc7710RedeemDelegationAction';\nimport { encodeDelegations } from './delegation';\nimport {\n execute,\n executeWithMode,\n} from './DelegationFramework/DeleGatorCore/encode';\nimport {\n ExecutionMode,\n createExecution,\n encodeExecutionCalldatas,\n} from './executions';\nimport type { Call } from './types';\n\n/**\n * Checks if a call is a delegated call by checking for the presence of permissionContext and delegationManager.\n *\n * @param call - The call to check.\n * @returns True if the call is a delegated call, false otherwise.\n */\nconst isDelegatedCall = (call: Call): call is DelegatedCall => {\n return 'permissionContext' in call && 'delegationManager' in call;\n};\n\n/**\n * If there's a single call with permissionContext and delegationManager,\n * processes it as a delegated call.\n *\n * @param call - The call to process.\n * @returns The execution object for the delegated call.\n * @description\n * This function creates an execution that calls redeemDelegations on the delegation manager.\n */\nconst processDelegatedCall = (call: DelegatedCall) => {\n const {\n permissionContext,\n delegationManager,\n to: target,\n value,\n data: callData,\n } = call;\n\n const callAsExecution = createExecution({ target, value, callData });\n\n if (!permissionContext) {\n return callAsExecution;\n }\n\n const encodedPermissionsContext = encodeDelegations(permissionContext);\n\n const redeemCalldata = encodeFunctionData({\n abi: DelegationManager,\n functionName: 'redeemDelegations',\n args: [\n [encodedPermissionsContext],\n [ExecutionMode.SingleDefault],\n encodeExecutionCalldatas([[callAsExecution]]),\n ],\n });\n\n return createExecution({\n target: delegationManager,\n callData: redeemCalldata,\n });\n};\n\n/**\n * If there's a single call, encode the shorthand `execute` function. Otherwise, encode the `executeWithMode` function. Execution type will always be \"default\".\n *\n * @param calls - The calls to execute.\n * @returns The encoded calldata for the DeleGator to execute the calls.\n * @description\n * This function supports both single and batch execution modes.\n * For single calls, it uses the gas-efficient execute function.\n */\nexport const encodeCalls = (calls: readonly Call[]) => {\n if (calls.length === 1) {\n const call = calls[0];\n if (call && !isDelegatedCall(call)) {\n const { to: target, value, data: callData } = call;\n const execution = createExecution({ target, value, callData });\n return execute({ execution });\n }\n }\n\n const executions = calls.map((call) => {\n if (isDelegatedCall(call)) {\n return processDelegatedCall(call);\n }\n const { to: target, value, data: callData } = call;\n return createExecution({ target, value, callData });\n });\n\n const mode =\n calls.length === 1\n ? ExecutionMode.SingleDefault\n : ExecutionMode.BatchDefault;\n return executeWithMode({ mode, executions });\n};\n\n/**\n * Encodes calls for execution by a DeleGator smart contract.\n *\n * @param caller - The address of the DeleGator contract.\n * @param calls - An array of Call objects, each containing 'to', optional 'data', and optional 'value'.\n * @returns A promise that resolves to the encoded function data as a hexadecimal string.\n * @description\n * - If there's a single call directly to the delegator, it returns the call data directly.\n * - For multiple calls or calls to other addresses, it creates executions and encodes them for the DeleGator's execute function.\n * - The execution mode is set to ExecutionMode.SingleDefault for a single call, or ExecutionMode.BatchDefault for multiple calls.\n *\n * todo: This doesn't fully expose the flexibility of the DeleGator's execute function, but it's a start.\n * maybe we add a mechanism where individual calls passed to this function can be encoded batches.\n */\nexport const encodeCallsForCaller = async (\n caller: Address,\n calls: readonly Call[],\n): Promise<Hex> => {\n if (calls.length === 1) {\n const call = calls[0];\n if (call?.to === caller && !isDelegatedCall(call)) {\n // if there's a single call, and it's to the delegator, we can just return the calldata directly.\n return call.data ?? '0x';\n }\n }\n return encodeCalls(calls);\n};\n","import { Signature } from 'ox';\nimport {\n parseAbiParameters,\n encodeAbiParameters,\n type Hex,\n encodePacked,\n keccak256,\n concat,\n hexToBytes,\n} from 'viem';\n\nexport const FIELD_MODULUS =\n 115792089210356248762697446949407573529996955224135760342422259061068512044369n;\nexport const MALLEABILITY_THRESHOLD = FIELD_MODULUS / 2n;\n\nexport const SIGNATURE_ABI_PARAMS = parseAbiParameters(\n 'bytes32, uint256, uint256, bytes, bool, string, string, uint256',\n);\n\n/**\n * This function is used to convert the client data returned from the\n * credentials API into a format that can be consumed by the DeleGator\n * contracts. We need the flattend JSON strings before and after the\n * userOpHash/challenge. This function provides those two client data string\n * slices.\n *\n * @param clientDataJson - The client data JSON string.\n * @returns Returns [clientDataJSONPrefix and clientDataJSONSuffix]\n * ClientDataJSONPrefix contains the client data till the challengeHash\n * ClientDataJSONSuffix contains the client data after the challengeHash.\n */\nexport const splitOnChallenge = (\n clientDataJson: string,\n): [clientDataJSONPrefix: string, clientDataJSONSuffix: string] => {\n /*\n CientData looks like this:\n {\n \"type\": \"webauthn.create\" | \"webauthn.get\",\n \"challenge\": \"{userOpHash}\",\n \"origin\": \"{Domain}\",\n \"crossOrigin\": boolean\n }\n */\n try {\n const { challenge } = JSON.parse(clientDataJson);\n if (challenge === undefined) {\n throw new Error('No \"challenge\" found in the input string');\n }\n return clientDataJson.split(challenge) as [string, string];\n } catch (error) {\n throw new Error('No \"challenge\" found in the input string', {\n cause: error,\n });\n }\n};\n\n/**\n * Returns the index of '\"type\":' in the ClientData.\n *\n * @param clientDataJson - Stringified ClientDataJSON.\n * @returns The index of '\"type\":' in the ClientData.\n */\nexport const getResponseTypeLocation = (clientDataJson: string): bigint => {\n try {\n // Find the index of the `\"type\":` key in the JSON string directly\n const typeIndex = clientDataJson.indexOf('\"type\":');\n\n if (typeIndex === -1) {\n throw new Error('No \"type\" found in the input string');\n }\n // Return the index of the `\"type\":` key\n return BigInt(typeIndex);\n } catch (error) {\n // Handle any errors that occur during the search\n throw new Error('No \"type\" found in the input string', {\n cause: error,\n });\n }\n};\n\n/**\n * Encodes a signature to a hexadecimal signature that will be accepted\n * by the DeleGator contracts.\n *\n * @param keyId - The key used for the signature, represented as a hexadecimal string.\n * @param signature - The signature to convert, as Hex.\n * @param clientDataJSON - The client data used in the creation of the signature.\n * @param authenticatorData - The authenticator data used in the creation of the signature.\n * @returns The signature as a valid DeleGator signature encoded as Hexadecimal string.\n */\nexport function encodeDeleGatorSignature(\n keyId: string,\n signature: Hex,\n clientDataJSON: string,\n authenticatorData: Hex,\n): Hex {\n const keyIdHash = keccak256(encodePacked(['string'], [keyId]));\n\n const { r: rValue, s: sValue } = Signature.fromHex(signature);\n\n let normalizedS = sValue;\n\n while (normalizedS > MALLEABILITY_THRESHOLD) {\n normalizedS = FIELD_MODULUS - normalizedS;\n }\n\n const [clientDataComponent1, clientDataComponent2] =\n splitOnChallenge(clientDataJSON);\n\n const { userVerified } = parseAuthenticatorFlags(authenticatorData);\n\n const responseTypeLocation = getResponseTypeLocation(clientDataJSON);\n\n const encodedSignature = encodeAbiParameters(SIGNATURE_ABI_PARAMS, [\n keyIdHash,\n rValue,\n normalizedS,\n authenticatorData,\n userVerified,\n clientDataComponent1,\n clientDataComponent2,\n responseTypeLocation,\n ]);\n return encodedSignature;\n}\n\nconst AUTHENTICATOR_DATA_FLAGS_OFFSET = 32;\n// We have all of the flag bits defined here for completeness, even though we only extract the userVerified flag.\nenum AuthenticatorDataFlagBitIndex {\n UserPresence = 0,\n UserVerified = 2,\n BackupEligibility = 3,\n BackupState = 4,\n AttestedCredentialData = 6,\n ExtensionData = 7,\n}\n\nexport type AuthenticatorFlags = {\n userVerified: boolean;\n};\n\n/**\n * Parses the authenticator data and returns an authenticator flags object with the `userVerified` flag.\n * See https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API/Authenticator_data.\n *\n * @param authenticatorData - The authenticator data to parse.\n * @returns An object representing the parsed authenticator flags.\n */\nexport function parseAuthenticatorFlags(\n authenticatorData: Hex,\n): AuthenticatorFlags {\n const authenticatorDataBuffer = hexToBytes(authenticatorData);\n const dataBufferUint8 = new Uint8Array(authenticatorDataBuffer);\n const flags = dataBufferUint8[AUTHENTICATOR_DATA_FLAGS_OFFSET];\n if (flags === undefined) {\n throw new Error('Authenticator flags not found in authenticator data');\n }\n\n // Bit 0 is the least significant bit in the flags byte, so we left shift 0b1 by the bit index\n // eslint-disable-next-line no-bitwise\n const bitMask = 0b1 << AuthenticatorDataFlagBitIndex.UserVerified;\n\n return {\n // eslint-disable-next-line no-bitwise\n userVerified: (flags & bitMask) !== 0x0,\n };\n}\n\n/**\n * Creates a dummy signature.\n * This must meet all early-failure conditions of the real signature, but does not need to be a valid signature.\n *\n * @param keyId - The key ID to use for the dummy signature.\n * @returns The encoded signature.\n */\nexport const createDummyWebAuthnSignature = (keyId: Hex) => {\n // https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API/Authenticator_data#data_structure\n const rpIdHash = keccak256(encodePacked(['string'], ['AuthenticatorData']));\n const flags = '0x05';\n const signCount = '0x00000000';\n const authenticatorData = concat([rpIdHash, flags, signCount]);\n\n const keyIdHash = keccak256(encodePacked(['string'], [keyId]));\n const rs =\n 57896044605178124381348723474703786764998477612067880171211129530534256022184n;\n const userVerification = true;\n const clientDataPrefix = '{\"type\":\"webauthn.get\",\"challenge\":\"';\n const clientDataSuffix = '\",\"origin\":\"passkey-domain\",\"crossOrigin\":false}';\n const responseTypeLocation = 1n;\n\n const encodedSignature = encodeAbiParameters(SIGNATURE_ABI_PARAMS, [\n keyIdHash,\n rs,\n rs,\n authenticatorData,\n userVerification,\n clientDataPrefix,\n clientDataSuffix,\n responseTypeLocation,\n ]);\n\n return encodedSignature;\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/smartAccountsEnvironment.ts","../src/write.ts","../src/userOp.ts"],"sourcesContent":["import {\n EntryPoint,\n SimpleFactory,\n DelegationManager,\n MultiSigDeleGator,\n HybridDeleGator,\n EIP7702StatelessDeleGator,\n SCL_RIP7212,\n AllowedTargetsEnforcer,\n AllowedMethodsEnforcer,\n DeployedEnforcer,\n TimestampEnforcer,\n NonceEnforcer,\n AllowedCalldataEnforcer,\n BlockNumberEnforcer,\n LimitedCallsEnforcer,\n ERC20BalanceChangeEnforcer,\n ERC20StreamingEnforcer,\n IdEnforcer,\n ERC20TransferAmountEnforcer,\n ValueLteEnforcer,\n NativeTokenTransferAmountEnforcer,\n NativeBalanceChangeEnforcer,\n NativeTokenStreamingEnforcer,\n NativeTokenPaymentEnforcer,\n RedeemerEnforcer,\n ArgsEqualityCheckEnforcer,\n ERC721BalanceChangeEnforcer,\n ERC721TransferEnforcer,\n ERC1155BalanceChangeEnforcer,\n OwnershipTransferEnforcer,\n SpecificActionERC20TransferBatchEnforcer,\n ERC20PeriodTransferEnforcer,\n NativeTokenPeriodTransferEnforcer,\n ExactCalldataBatchEnforcer,\n ExactCalldataEnforcer,\n ExactExecutionEnforcer,\n ExactExecutionBatchEnforcer,\n MultiTokenPeriodEnforcer,\n} from '@metamask/delegation-abis';\nimport {\n EntryPoint as EntryPointBytecode,\n SimpleFactory as SimpleFactoryBytecode,\n DelegationManager as DelegationManagerBytecode,\n MultiSigDeleGator as MultiSigDeleGatorBytecode,\n HybridDeleGator as HybridDeleGatorBytecode,\n EIP7702StatelessDeleGator as EIP7702StatelessDeleGatorBytecode,\n SCL_RIP7212 as SCLRIP7212Bytecode,\n AllowedTargetsEnforcer as AllowedTargetsEnforcerBytecode,\n AllowedMethodsEnforcer as AllowedMethodsEnforcerBytecode,\n DeployedEnforcer as DeployedEnforcerBytecode,\n TimestampEnforcer as TimestampEnforcerBytecode,\n NonceEnforcer as NonceEnforcerBytecode,\n AllowedCalldataEnforcer as AllowedCalldataEnforcerBytecode,\n BlockNumberEnforcer as BlockNumberEnforcerBytecode,\n LimitedCallsEnforcer as LimitedCallsEnforcerBytecode,\n ERC20BalanceChangeEnforcer as ERC20BalanceChangeEnforcerBytecode,\n ERC20StreamingEnforcer as ERC20StreamingEnforcerBytecode,\n IdEnforcer as IdEnforcerBytecode,\n ERC20TransferAmountEnforcer as ERC20TransferAmountEnforcerBytecode,\n ValueLteEnforcer as ValueLteEnforcerBytecode,\n NativeTokenTransferAmountEnforcer as NativeTokenTransferAmountEnforcerBytecode,\n NativeBalanceChangeEnforcer as NativeBalanceChangeEnforcerBytecode,\n NativeTokenStreamingEnforcer as NativeTokenStreamingEnforcerBytecode,\n NativeTokenPaymentEnforcer as NativeTokenPaymentEnforcerBytecode,\n RedeemerEnforcer as RedeemerEnforcerBytecode,\n ArgsEqualityCheckEnforcer as ArgsEqualityCheckEnforcerBytecode,\n ERC721BalanceChangeEnforcer as ERC721BalanceChangeEnforcerBytecode,\n ERC721TransferEnforcer as ERC721TransferEnforcerBytecode,\n ERC1155BalanceChangeEnforcer as ERC1155BalanceChangeEnforcerBytecode,\n OwnershipTransferEnforcer as OwnershipTransferEnforcerBytecode,\n SpecificActionERC20TransferBatchEnforcer as SpecificActionERC20TransferBatchEnforcerBytecode,\n ERC20PeriodTransferEnforcer as ERC20PeriodTransferEnforcerBytecode,\n NativeTokenPeriodTransferEnforcer as NativeTokenPeriodTransferEnforcerBytecode,\n ExactCalldataBatchEnforcer as ExactCalldataBatchEnforcerBytecode,\n ExactCalldataEnforcer as ExactCalldataEnforcerBytecode,\n ExactExecutionEnforcer as ExactExecutionEnforcerBytecode,\n ExactExecutionBatchEnforcer as ExactExecutionBatchEnforcerBytecode,\n MultiTokenPeriodEnforcer as MultiTokenPeriodEnforcerBytecode,\n} from '@metamask/delegation-abis/bytecode';\nimport { DELEGATOR_CONTRACTS } from '@metamask/delegation-deployments';\nimport type { Chain, Hex, PublicClient, WalletClient } from 'viem';\n\nimport type { ContractMetaData, SmartAccountsEnvironment } from './types';\nimport { deployContract } from './write';\n\ntype SupportedVersion = '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0';\nexport const PREFERRED_VERSION: SupportedVersion = '1.3.0';\n\nconst contractOverrideMap: Map<string, SmartAccountsEnvironment> = new Map();\n\nconst getContractOverrideKey = (chainId: number, version: SupportedVersion) =>\n `${version}:${chainId}`;\n\n/**\n * Overrides the default environment for a specific chain and version.\n *\n * @param chainId - The chain ID to override.\n * @param version - The version of the environment to override.\n * @param environment - The environment to use as override.\n */\nexport function overrideDeployedEnvironment(\n chainId: number,\n version: SupportedVersion,\n environment: SmartAccountsEnvironment,\n) {\n contractOverrideMap.set(\n getContractOverrideKey(chainId, version),\n environment,\n );\n}\n\n/**\n * Gets the SmartAccountsEnvironment for the specified chain and version.\n *\n * @param chainId - The chain ID to get the environment for.\n * @param version - The version of the environment to get.\n * @returns The SmartAccountsEnvironment.\n */\nexport function getSmartAccountsEnvironment(\n chainId: number,\n version: SupportedVersion = PREFERRED_VERSION,\n): SmartAccountsEnvironment {\n const overrideKey = getContractOverrideKey(chainId, version);\n\n const overriddenContracts = contractOverrideMap.get(overrideKey);\n if (overriddenContracts) {\n return overriddenContracts;\n }\n\n const contracts = DELEGATOR_CONTRACTS[version]?.[chainId];\n if (!contracts) {\n throw new Error(\n `No contracts found for version ${version} chain ${chainId}`,\n );\n }\n return getSmartAccountsEnvironmentV1(contracts);\n}\n\n/**\n * Creates a SmartAccountsEnvironment from contract addresses.\n *\n * @param contracts - The contract addresses to create the environment from.\n * @returns The created SmartAccountsEnvironment.\n */\nexport function getSmartAccountsEnvironmentV1(contracts: {\n [contract: string]: Hex;\n}) {\n return {\n DelegationManager: contracts.DelegationManager,\n EntryPoint: contracts.EntryPoint,\n SimpleFactory: contracts.SimpleFactory,\n implementations: {\n MultiSigDeleGatorImpl: contracts.MultiSigDeleGatorImpl,\n HybridDeleGatorImpl: contracts.HybridDeleGatorImpl,\n EIP7702StatelessDeleGatorImpl: contracts.EIP7702StatelessDeleGatorImpl,\n },\n caveatEnforcers: {\n AllowedCalldataEnforcer: contracts.AllowedCalldataEnforcer,\n AllowedMethodsEnforcer: contracts.AllowedMethodsEnforcer,\n AllowedTargetsEnforcer: contracts.AllowedTargetsEnforcer,\n ArgsEqualityCheckEnforcer: contracts.ArgsEqualityCheckEnforcer,\n BlockNumberEnforcer: contracts.BlockNumberEnforcer,\n DeployedEnforcer: contracts.DeployedEnforcer,\n ERC20BalanceChangeEnforcer: contracts.ERC20BalanceChangeEnforcer,\n ERC20TransferAmountEnforcer: contracts.ERC20TransferAmountEnforcer,\n ERC20StreamingEnforcer: contracts.ERC20StreamingEnforcer,\n ERC721BalanceChangeEnforcer: contracts.ERC721BalanceChangeEnforcer,\n ERC721TransferEnforcer: contracts.ERC721TransferEnforcer,\n ERC1155BalanceChangeEnforcer: contracts.ERC1155BalanceChangeEnforcer,\n IdEnforcer: contracts.IdEnforcer,\n LimitedCallsEnforcer: contracts.LimitedCallsEnforcer,\n NonceEnforcer: contracts.NonceEnforcer,\n TimestampEnforcer: contracts.TimestampEnforcer,\n ValueLteEnforcer: contracts.ValueLteEnforcer,\n NativeTokenTransferAmountEnforcer:\n contracts.NativeTokenTransferAmountEnforcer,\n NativeBalanceChangeEnforcer: contracts.NativeBalanceChangeEnforcer,\n NativeTokenStreamingEnforcer: contracts.NativeTokenStreamingEnforcer,\n NativeTokenPaymentEnforcer: contracts.NativeTokenPaymentEnforcer,\n OwnershipTransferEnforcer: contracts.OwnershipTransferEnforcer,\n RedeemerEnforcer: contracts.RedeemerEnforcer,\n SpecificActionERC20TransferBatchEnforcer:\n contracts.SpecificActionERC20TransferBatchEnforcer,\n ERC20PeriodTransferEnforcer: contracts.ERC20PeriodTransferEnforcer,\n NativeTokenPeriodTransferEnforcer:\n contracts.NativeTokenPeriodTransferEnforcer,\n ExactCalldataBatchEnforcer: contracts.ExactCalldataBatchEnforcer,\n ExactCalldataEnforcer: contracts.ExactCalldataEnforcer,\n ExactExecutionEnforcer: contracts.ExactExecutionEnforcer,\n ExactExecutionBatchEnforcer: contracts.ExactExecutionBatchEnforcer,\n MultiTokenPeriodEnforcer: contracts.MultiTokenPeriodEnforcer,\n },\n } as SmartAccountsEnvironment;\n}\n\nexport type DeployedContract = {\n name: string;\n address: string;\n};\n\n/**\n * Deploys the contracts needed for the Delegation Framework and MetaMask SCA to be functional as well as all Caveat Enforcers.\n *\n * @param walletClient - The wallet client to use for deployment.\n * @param publicClient - The public client to use for deployment.\n * @param chain - The chain to deploy to.\n * @param deployedContracts - Optional map of already deployed contracts.\n * @returns A promise that resolves to the SmartAccountsEnvironment.\n */\nexport async function deploySmartAccountsEnvironment(\n walletClient: WalletClient,\n publicClient: PublicClient,\n chain: Chain,\n deployedContracts: { [contract: string]: Hex } = {},\n) {\n const deployContractCurried = async (\n name: string,\n contract: ContractMetaData,\n params: any[] = [],\n ) => {\n const existingAddress = deployedContracts[name];\n if (existingAddress) {\n return {\n address: existingAddress,\n name,\n };\n }\n\n const deployedContract = await deployContract(\n walletClient,\n publicClient,\n chain,\n contract,\n params,\n );\n\n const newDeployedContracts = { ...deployedContracts };\n newDeployedContracts[name] = deployedContract.address;\n Object.assign(deployedContracts, newDeployedContracts);\n\n return { ...deployedContract, name };\n };\n\n // Deploy v1.3.0 DeleGator contracts\n // - deploy standalone contracts\n const standaloneContracts = {\n SimpleFactory: {\n abi: SimpleFactory,\n bytecode: SimpleFactoryBytecode,\n },\n AllowedCalldataEnforcer: {\n abi: AllowedCalldataEnforcer,\n bytecode: AllowedCalldataEnforcerBytecode,\n },\n AllowedTargetsEnforcer: {\n abi: AllowedTargetsEnforcer,\n bytecode: AllowedTargetsEnforcerBytecode,\n },\n AllowedMethodsEnforcer: {\n abi: AllowedMethodsEnforcer,\n bytecode: AllowedMethodsEnforcerBytecode,\n },\n ArgsEqualityCheckEnforcer: {\n abi: ArgsEqualityCheckEnforcer,\n bytecode: ArgsEqualityCheckEnforcerBytecode,\n },\n DeployedEnforcer: {\n abi: DeployedEnforcer,\n bytecode: DeployedEnforcerBytecode,\n },\n TimestampEnforcer: {\n abi: TimestampEnforcer,\n bytecode: TimestampEnforcerBytecode,\n },\n BlockNumberEnforcer: {\n abi: BlockNumberEnforcer,\n bytecode: BlockNumberEnforcerBytecode,\n },\n LimitedCallsEnforcer: {\n abi: LimitedCallsEnforcer,\n bytecode: LimitedCallsEnforcerBytecode,\n },\n ERC20BalanceChangeEnforcer: {\n abi: ERC20BalanceChangeEnforcer,\n bytecode: ERC20BalanceChangeEnforcerBytecode,\n },\n ERC20TransferAmountEnforcer: {\n abi: ERC20TransferAmountEnforcer,\n bytecode: ERC20TransferAmountEnforcerBytecode,\n },\n ERC20StreamingEnforcer: {\n abi: ERC20StreamingEnforcer,\n bytecode: ERC20StreamingEnforcerBytecode,\n },\n ERC721BalanceChangeEnforcer: {\n abi: ERC721BalanceChangeEnforcer,\n bytecode: ERC721BalanceChangeEnforcerBytecode,\n },\n ERC721TransferEnforcer: {\n abi: ERC721TransferEnforcer,\n bytecode: ERC721TransferEnforcerBytecode,\n },\n ERC1155BalanceChangeEnforcer: {\n abi: ERC1155BalanceChangeEnforcer,\n bytecode: ERC1155BalanceChangeEnforcerBytecode,\n },\n IdEnforcer: { abi: IdEnforcer, bytecode: IdEnforcerBytecode },\n NonceEnforcer: {\n abi: NonceEnforcer,\n bytecode: NonceEnforcerBytecode,\n },\n ValueLteEnforcer: {\n abi: ValueLteEnforcer,\n bytecode: ValueLteEnforcerBytecode,\n },\n NativeTokenTransferAmountEnforcer: {\n abi: NativeTokenTransferAmountEnforcer,\n bytecode: NativeTokenTransferAmountEnforcerBytecode,\n },\n NativeBalanceChangeEnforcer: {\n abi: NativeBalanceChangeEnforcer,\n bytecode: NativeBalanceChangeEnforcerBytecode,\n },\n NativeTokenStreamingEnforcer: {\n abi: NativeTokenStreamingEnforcer,\n bytecode: NativeTokenStreamingEnforcerBytecode,\n },\n OwnershipTransferEnforcer: {\n abi: OwnershipTransferEnforcer,\n bytecode: OwnershipTransferEnforcerBytecode,\n },\n RedeemerEnforcer: {\n abi: RedeemerEnforcer,\n bytecode: RedeemerEnforcerBytecode,\n },\n SpecificActionERC20TransferBatchEnforcer: {\n abi: SpecificActionERC20TransferBatchEnforcer,\n bytecode: SpecificActionERC20TransferBatchEnforcerBytecode,\n },\n ERC20PeriodTransferEnforcer: {\n abi: ERC20PeriodTransferEnforcer,\n bytecode: ERC20PeriodTransferEnforcerBytecode,\n },\n NativeTokenPeriodTransferEnforcer: {\n abi: NativeTokenPeriodTransferEnforcer,\n bytecode: NativeTokenPeriodTransferEnforcerBytecode,\n },\n ExactCalldataBatchEnforcer: {\n abi: ExactCalldataBatchEnforcer,\n bytecode: ExactCalldataBatchEnforcerBytecode,\n },\n ExactCalldataEnforcer: {\n abi: ExactCalldataEnforcer,\n bytecode: ExactCalldataEnforcerBytecode,\n },\n ExactExecutionEnforcer: {\n abi: ExactExecutionEnforcer,\n bytecode: ExactExecutionEnforcerBytecode,\n },\n ExactExecutionBatchEnforcer: {\n abi: ExactExecutionBatchEnforcer,\n bytecode: ExactExecutionBatchEnforcerBytecode,\n },\n MultiTokenPeriodEnforcer: {\n abi: MultiTokenPeriodEnforcer,\n bytecode: MultiTokenPeriodEnforcerBytecode,\n },\n };\n for (const [name, contract] of Object.entries(standaloneContracts)) {\n await deployContractCurried(name, contract);\n }\n\n // - deploy dependencies\n const delegationManager = await deployContractCurried(\n 'DelegationManager',\n { abi: DelegationManager, bytecode: DelegationManagerBytecode },\n [walletClient.account?.address],\n );\n\n // - NativeTokenPaymentEnforcer DelegationManager and ArgsEqualityCheckEnforcer as constructor args\n await deployContractCurried(\n 'NativeTokenPaymentEnforcer',\n {\n abi: NativeTokenPaymentEnforcer,\n bytecode: NativeTokenPaymentEnforcerBytecode,\n },\n [delegationManager.address, deployedContracts.ArgsEqualityCheckEnforcer],\n );\n\n const entryPoint = await deployContractCurried('EntryPoint', {\n abi: EntryPoint,\n bytecode: EntryPointBytecode,\n });\n\n // This is a hack to work around the SCL_RIP7212 being deployed as a library.\n // Forge handles this gracefully, but in the tests we need to manually link\n // the library.\n // We don't use the curried function here because we don't need it added to\n // the environment.\n const { address: sclRIP7212 } = await deployContract(\n walletClient,\n publicClient,\n chain,\n { abi: SCL_RIP7212, bytecode: SCLRIP7212Bytecode },\n [],\n );\n\n // replace linked library address in bytecode https://docs.soliditylang.org/en/latest/using-the-compiler.html#library-linking\n const hybridDeleGatorWithLinkedLibrary = {\n abi: HybridDeleGator,\n bytecode: HybridDeleGatorBytecode.replace(\n /__\\$b8f96b288d4d0429e38b8ed50fd423070f\\$__/gu,\n sclRIP7212.slice(2),\n ) as Hex,\n };\n\n // - deploy DeleGator implementations\n await deployContractCurried(\n 'HybridDeleGatorImpl',\n hybridDeleGatorWithLinkedLibrary,\n [delegationManager.address, entryPoint.address],\n );\n\n await deployContractCurried(\n 'MultiSigDeleGatorImpl',\n {\n abi: MultiSigDeleGator,\n bytecode: MultiSigDeleGatorBytecode,\n },\n [delegationManager.address, entryPoint.address],\n );\n\n await deployContractCurried(\n 'EIP7702StatelessDeleGatorImpl',\n {\n abi: EIP7702StatelessDeleGator,\n bytecode: EIP7702StatelessDeleGatorBytecode,\n },\n [delegationManager.address, entryPoint.address],\n );\n\n // Format deployments\n return getSmartAccountsEnvironmentV1(deployedContracts);\n}\n","import { SimpleFactory } from '@metamask/delegation-abis';\nimport type { Address, Chain, Hex, PublicClient, WalletClient } from 'viem';\n\nimport type { ContractMetaData } from './types';\n\n/**\n * Deploys a contract using the SimpleFactory contract.\n *\n * @param walletClient - The wallet client to use for deployment.\n * @param publicClient - The public client to use for simulation.\n * @param simpleFactoryAddress - The address of the SimpleFactory contract.\n * @param creationCode - The creation code for the contract to deploy.\n * @param salt - The salt to use for deterministic deployment.\n * @returns The transaction hash of the deployment.\n */\nexport const deployWithSimpleFactory = async (\n walletClient: WalletClient,\n publicClient: PublicClient,\n simpleFactoryAddress: Address,\n creationCode: Hex,\n salt: Hex,\n) => {\n const { request } = await publicClient.simulateContract({\n account: walletClient.account,\n address: simpleFactoryAddress,\n abi: SimpleFactory,\n functionName: 'deploy',\n args: [creationCode, salt],\n });\n return await walletClient.writeContract(request);\n};\n\n/**\n * Deploys a contract to the blockchain.\n *\n * @param walletClient - The wallet client to use for deployment.\n * @param publicClient - The public client to use for transaction receipt.\n * @param chain - The chain to deploy on.\n * @param contractMetadata - The metadata of the contract to deploy.\n * @param contractMetadata.bytecode - The bytecode of the contract to deploy.\n * @param contractMetadata.abi - The ABI of the contract to deploy.\n * @param args - The constructor arguments for the contract.\n * @returns An object containing the deployed contract address, transaction hash, and receipt.\n */\nexport async function deployContract(\n walletClient: WalletClient,\n publicClient: PublicClient,\n chain: Chain,\n { bytecode, abi }: ContractMetaData,\n args: any[] = [],\n) {\n if (!walletClient.account) {\n throw new Error('Wallet client account is required');\n }\n\n const hash = await walletClient.deployContract({\n abi,\n bytecode,\n args,\n account: walletClient.account,\n chain,\n });\n\n const receipt = await publicClient.waitForTransactionReceipt({\n hash,\n });\n\n if (!receipt.contractAddress) {\n throw new Error('No contract address in receipt');\n }\n\n return { address: receipt.contractAddress, hash, receipt };\n}\n","import { concat, encodeAbiParameters, keccak256, pad, toHex } from 'viem';\nimport type { Address, Hex, TypedData } from 'viem';\nimport { toPackedUserOperation } from 'viem/account-abstraction';\nimport { signTypedData } from 'viem/accounts';\n\nimport type { OptionalUserOpProps, PackedUserOperationStruct } from './types';\n\n// v7 off-chain user operation, hexlified incoming data from rpc call\nexport type UserOperationV07Hexlify = {\n sender: Hex;\n nonce: Hex;\n factory?: Hex;\n factoryData?: Hex;\n callData: Hex;\n callGasLimit: Hex;\n\n verificationGasLimit: Hex;\n preVerificationGas: Hex;\n maxFeePerGas: Hex;\n maxPriorityFeePerGas: Hex;\n\n paymaster?: Hex;\n paymasterVerificationGasLimit?: Hex;\n paymasterPostOpGasLimit?: Hex;\n paymasterData?: Hex;\n\n signature: Hex;\n};\n\n// v7 off-chain user operation with BigInt fields\nexport type UserOperationV07 = {\n sender: Hex;\n nonce: bigint;\n factory?: Hex;\n factoryData?: Hex;\n callData: Hex;\n\n callGasLimit: bigint;\n verificationGasLimit: bigint;\n preVerificationGas: bigint;\n maxFeePerGas: bigint;\n maxPriorityFeePerGas: bigint;\n\n paymaster?: Hex;\n paymasterVerificationGasLimit?: bigint;\n paymasterPostOpGasLimit?: bigint;\n paymasterData?: Hex;\n\n signature: Hex;\n};\n\n/**\n * Creates a raw user operation data structure.\n *\n * @param sender - The smart account taking some action.\n * @param nonce - A nonce, ideally fetched from the Entry Point.\n * @param callData - Calldata to invoke on some contract.\n * @param signature - The signature for the user operation.\n * @param options - Optional properties for the user operation.\n * @returns The created raw user operation data structure.\n */\nexport const createRawUserOp = (\n sender: Hex,\n nonce: bigint,\n callData: Hex,\n signature: Hex = '0x',\n options?: OptionalUserOpProps,\n): UserOperationV07 => ({\n sender,\n nonce,\n callData,\n factory: options?.factory,\n factoryData: options?.factoryData,\n callGasLimit: options?.callGasLimit ?? 0n,\n verificationGasLimit: options?.verificationGasLimit ?? 0n,\n preVerificationGas: options?.preVerificationGas ?? 0n,\n maxFeePerGas: options?.maxFeePerGas ?? 0n,\n maxPriorityFeePerGas: options?.maxPriorityFeePerGas ?? 0n,\n paymaster: options?.paymaster,\n paymasterVerificationGasLimit: options?.paymasterVerificationGasLimit,\n paymasterPostOpGasLimit: options?.paymasterPostOpGasLimit,\n paymasterData: options?.paymasterData,\n signature,\n});\n\n// //////////////////////////////////////////////////////////////////////////////////////\n\n// TODO: These userOp functions are duplicated in ./apps/ew-client/src/utils/userOpBuilder.ts. We should move them to a shared location along with test(./apps/ew-client/test/UserOpBuilder.test.ts) to avoid duplication\n/**\n * Generates a salt value for address derivation.\n *\n * @param salt - Optional salt value.\n * @returns The chosen salt value.\n */\nexport const getSalt = (salt?: Hex): Hex => {\n return salt ?? '0x0';\n};\n\nexport const getPaymasterAndData = (userOp: UserOperationV07): Hex => {\n let paymasterAndData: Hex;\n if (userOp.paymaster) {\n paymasterAndData = concat([\n userOp.paymaster,\n pad(toHex(userOp.paymasterVerificationGasLimit ?? 0n), {\n size: 16,\n }),\n pad(toHex(userOp.paymasterPostOpGasLimit ?? 0n), {\n size: 16,\n }),\n userOp.paymasterData ?? '0x',\n ]);\n } else {\n paymasterAndData = '0x';\n }\n\n return paymasterAndData;\n};\n\nexport const getInitCode = (userOp: UserOperationV07): Hex => {\n return userOp.factory\n ? concat([userOp.factory, userOp.factoryData ?? ('0x' as Hex)])\n : '0x';\n};\n\nexport const getAccountGasLimits = (userOp: UserOperationV07): Hex => {\n return concat([\n pad(toHex(userOp.verificationGasLimit), {\n size: 16,\n }),\n pad(toHex(userOp.callGasLimit), { size: 16 }),\n ]);\n};\n\nexport const getGasFees = (userOp: UserOperationV07): Hex => {\n return concat([\n pad(toHex(userOp.maxPriorityFeePerGas), {\n size: 16,\n }),\n pad(toHex(userOp.maxFeePerGas), { size: 16 }),\n ]);\n};\n\n/**\n * Packs a user operation into a `PackedUserOperationStruct` object.\n *\n * @param userOp - The user operation to pack.\n * @returns The packed user operation.\n */\nexport const packUserOp = (\n userOp: UserOperationV07,\n): PackedUserOperationStruct => {\n const packedOp = {\n sender: userOp.sender,\n nonce: BigInt(userOp.nonce),\n initCode: getInitCode(userOp),\n callData: userOp.callData,\n accountGasLimits: getAccountGasLimits(userOp),\n preVerificationGas: BigInt(userOp.preVerificationGas),\n gasFees: getGasFees(userOp),\n paymasterAndData: getPaymasterAndData(userOp),\n signature: userOp.signature,\n };\n\n return packedOp;\n};\n\n/**\n * Calculates the user operation hash for a given packed user operation.\n *\n * @param packedOp - The packed user operation.\n * @param entryPoint - The entry point address.\n * @param chainId - The chain ID.\n * @returns The user operation hash.\n */\nexport const createUserOpHashV07 = (\n packedOp: PackedUserOperationStruct,\n entryPoint: Hex,\n chainId: bigint,\n) => {\n const hash = keccak256(\n encodeAbiParameters(\n [\n {\n name: 'sender',\n type: 'address',\n },\n {\n name: 'nonce',\n type: 'uint256',\n },\n {\n name: 'initCodeHash',\n type: 'bytes32',\n },\n {\n name: 'callDataHash',\n type: 'bytes32',\n },\n {\n name: 'accountGasLimits',\n type: 'bytes32',\n },\n {\n name: 'preVerificationGas',\n type: 'uint256',\n },\n {\n name: 'gasFees',\n type: 'bytes32',\n },\n {\n name: 'paymasterAndDataHash',\n type: 'bytes32',\n },\n ],\n [\n packedOp.sender,\n packedOp.nonce,\n keccak256(packedOp.initCode),\n keccak256(packedOp.callData),\n packedOp.accountGasLimits,\n packedOp.preVerificationGas,\n packedOp.gasFees,\n keccak256(packedOp.paymasterAndData),\n ],\n ),\n );\n\n return keccak256(\n encodeAbiParameters(\n [\n {\n name: 'userOpHash',\n type: 'bytes32',\n },\n {\n name: 'entryPointAddress',\n type: 'address',\n },\n {\n name: 'chainId',\n type: 'uint256',\n },\n ],\n [hash, entryPoint, chainId],\n ),\n );\n};\n\nexport const SIGNABLE_USER_OP_TYPED_DATA: TypedData = {\n PackedUserOperation: [\n { name: 'sender', type: 'address' },\n { name: 'nonce', type: 'uint256' },\n { name: 'initCode', type: 'bytes' },\n { name: 'callData', type: 'bytes' },\n { name: 'accountGasLimits', type: 'bytes32' },\n { name: 'preVerificationGas', type: 'uint256' },\n { name: 'gasFees', type: 'bytes32' },\n { name: 'paymasterAndData', type: 'bytes' },\n { name: 'entryPoint', type: 'address' },\n ],\n} as const;\n\n/**\n * Prepares typed data for user operation signing.\n * This is an internal helper function that's not exposed in the public API.\n *\n * @param params - The parameters for preparing the typed data.\n * @param params.userOperation - The user operation to prepare for signing.\n * @param params.entryPoint - The entry point contract address.\n * @param params.entryPoint.address - The address of the entry point contract.\n * @param params.chainId - The chain ID that the entry point is deployed on.\n * @param params.name - The name of the domain of the implementation contract.\n * @param params.version - The version of the domain of the implementation contract.\n * @param params.address - The address of the smart account.\n * @returns The prepared typed data for signing.\n */\nexport const prepareSignUserOperationTypedData = ({\n userOperation,\n entryPoint,\n chainId,\n name,\n address,\n version = '1',\n}: {\n userOperation: Omit<UserOperationV07, 'signature'>;\n entryPoint: { address: Address };\n chainId: number;\n name: 'HybridDeleGator' | 'MultiSigDeleGator';\n address: Address;\n version?: string;\n}) => {\n const packedUserOp = toPackedUserOperation({\n ...userOperation,\n signature: '0x',\n });\n\n return {\n domain: {\n chainId,\n name,\n version,\n verifyingContract: address,\n },\n types: SIGNABLE_USER_OP_TYPED_DATA,\n primaryType: 'PackedUserOperation' as const,\n message: { ...packedUserOp, entryPoint: entryPoint.address },\n };\n};\n\n/**\n * Signs a user operation using a private key.\n *\n * @param params - The parameters for signing the user operation.\n * @param params.privateKey - The private key to use for signing.\n * @param params.userOperation - The user operation to sign.\n * @param params.entryPoint - The entry point contract address.\n * @param params.chainId - The chain ID that the entry point is deployed on.\n * @param params.name - The name of the domain of the implementation contract.\n * @param params.version - The version of the domain of the implementation contract.\n * @param params.address - The address of the smart account.\n * @param params.entryPoint.address - The address of the entry point contract.\n * @returns The signature of the user operation.\n */\nexport const signUserOperation = async ({\n privateKey,\n userOperation,\n entryPoint,\n chainId,\n name,\n address,\n version = '1',\n}: {\n privateKey: Hex;\n userOperation: Omit<UserOperationV07, 'signature'>;\n entryPoint: { address: Address };\n chainId: number;\n address: Address;\n name: 'HybridDeleGator' | 'MultiSigDeleGator';\n version?: string;\n}) => {\n const typedData = prepareSignUserOperationTypedData({\n userOperation,\n entryPoint,\n chainId,\n name,\n address,\n version,\n });\n\n return signTypedData({\n privateKey,\n ...typedData,\n });\n};\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA,iBAAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,mBAAmB;AAAA,EACnB,6BAA6B;AAAA,EAC7B,eAAe;AAAA,EACf,0BAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,oBAAoB;AAAA,EACpB,qBAAqB;AAAA,EACrB,iBAAiB;A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oBAAoB,OAAO;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AACZ,MAQM;AACJ,QAAM,YAAY,kCAAkC;AAAA,IAClD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO,cAAc;AAAA,IACnB;AAAA,IACA,GAAG;AAAA,EACL,CAAC;AACH;","names":["SimpleFactory","SimpleFactory"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/actions/index.ts","../src/actions/erc7710RedeemDelegationAction.ts","../src/actions/erc7715Mapping.ts","../src/actions/erc7715GetGrantedExecutionPermissionsAction.ts","../src/actions/erc7715GetSupportedExecutionPermissionsAction.ts","../src/actions/erc7715RequestExecutionPermissionsAction.ts","../src/actions/getCaveatAvailableAmount.ts","../src/actions/isValid7702Implementation.ts","../src/actions/signDelegation.ts","../src/actions/signUserOperation.ts"],"sourcesContent":["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 { erc7715GetGrantedExecutionPermissionsAction } from './erc7715GetGrantedExecutionPermissionsAction';\nimport { erc7715GetSupportedExecutionPermissionsAction } from './erc7715GetSupportedExecutionPermissionsAction';\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 { PermissionRequestParameter } from './erc7715Types';\n\nexport { erc7715GetSupportedExecutionPermissionsAction as getSupportedExecutionPermissions } from './erc7715GetSupportedExecutionPermissionsAction';\n\nexport { erc7715GetGrantedExecutionPermissionsAction as getGrantedExecutionPermissions } from './erc7715GetGrantedExecutionPermissionsAction';\n\nexport {\n type GetSupportedExecutionPermissionsResult,\n type GetGrantedExecutionPermissionsResult,\n type Rule,\n type SupportedPermissionInfo,\n type PermissionTypes,\n type NativeTokenStreamPermission,\n type NativeTokenPeriodicPermission,\n type NativeTokenAllowancePermission,\n type Erc20TokenStreamPermission,\n type Erc20TokenPeriodicPermission,\n type Erc20TokenAllowancePermission,\n type Erc20TokenRevocationPermission,\n type RpcGetSupportedExecutionPermissionsResult,\n type RpcGetGrantedExecutionPermissionsResult,\n type RpcSupportedPermissionInfo,\n} from './erc7715Types';\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 getSupportedExecutionPermissions: async () => {\n return erc7715GetSupportedExecutionPermissionsAction(\n client as MetaMaskExtensionClient,\n );\n },\n getGrantedExecutionPermissions: async () => {\n return erc7715GetGrantedExecutionPermissionsAction(\n client as MetaMaskExtensionClient,\n );\n },\n});\n\n/**\n * Type for a viem Client extended with ERC-7715 provider actions.\n * Use this to type variables that will be assigned an extended client later.\n *\n * @example\n * ```typescript\n * let client: Erc7715Client | null = null;\n *\n * function setupClient() {\n * client = createWalletClient({\n * chain: sepolia,\n * transport: custom(window.ethereum),\n * }).extend(erc7715ProviderActions());\n * }\n * ```\n */\nexport type Erc7715Client = Client &\n ReturnType<ReturnType<typeof erc7715ProviderActions>>;\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 { trackSmartAccountsKitFunctionCall } from '../analytics';\nimport { encodeDelegations } from '../delegation';\nimport {\n createExecution,\n encodeExecutionCalldatas,\n ExecutionMode,\n} from '../executions';\nimport { getSmartAccountsEnvironment } from '../smartAccountsEnvironment';\nimport type { Call, PermissionContext } from '../types';\n\nexport type DelegatedCall = Call &\n OneOf<\n { permissionContext: PermissionContext; delegationManager: Hex } | object\n >;\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<TChain, TChainOverride> =\n SendTransactionRequest<TChain, TChainOverride>,\n> = SendTransactionParameters<TChain, TAccount, TChainOverride, TRequest> & {\n permissionContext: PermissionContext;\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 trackSmartAccountsKitFunctionCall('sendTransactionWithDelegationAction', {\n chainId: client.chain?.id ?? null,\n });\n\n if (!args.to) {\n throw new Error(\n '`to` is required. `sendTransactionWithDelegation` cannot be used to deploy contracts.',\n );\n }\n\n // Validate DelegationManager address\n const chainId = client.chain?.id;\n if (!chainId) {\n throw new Error('Chain ID is not set');\n }\n\n const { DelegationManager: expectedDelegationManager } =\n getSmartAccountsEnvironment(chainId);\n if (!isAddressEqual(args.delegationManager, expectedDelegationManager)) {\n throw new Error(\n `Invalid DelegationManager: expected ${expectedDelegationManager} for chain ${chainId}, but got ${args.delegationManager}`,\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,\n functionName: 'redeemDelegations',\n args: [\n [encodeDelegations(args.permissionContext)],\n [ExecutionMode.SingleDefault],\n encodeExecutionCalldatas([executions]),\n ],\n });\n\n const {\n value: _value,\n permissionContext: _permissionContext,\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 dependencies?: { 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 * permissionContext: '0x...',\n * delegationManager: '0x...',\n * },\n * ],\n * dependencies: [{ 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 trackSmartAccountsKitFunctionCall('sendUserOperationWithDelegationAction', {\n chainId: client.chain?.id ?? null,\n callCount: parameters.calls.length,\n hasDependencies: parameters.dependencies !== undefined,\n });\n\n if (parameters.dependencies) {\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 uniqueDependencies = parameters.dependencies.filter((dependency) => {\n if (!isAddressEqual(dependency.factory, SimpleFactory)) {\n throw new Error(\n `Invalid dependency: ${dependency.factory} is not allowed.`,\n );\n }\n\n // ensure that factory calls are not duplicated\n const accountKey = concat([dependency.factory, dependency.factoryData]);\n const isDuplicate = includedAccountKeys[accountKey];\n\n includedAccountKeys[accountKey] = true;\n return !isDuplicate;\n });\n\n const factoryCalls = (\n await Promise.all(\n uniqueDependencies.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 parameters.calls = parameters.calls.map((call) => {\n if (!('permissionContext' in call)) {\n return call;\n }\n\n const { permissionContext } = call;\n if (!permissionContext) {\n return call;\n }\n\n return {\n ...call,\n permissionContext: encodeDelegations(permissionContext),\n };\n });\n\n return client.sendUserOperation(\n parameters as unknown as SendUserOperationParameters,\n );\n}\n","import type {\n Erc20TokenAllowancePermission as RpcErc20TokenAllowancePermission,\n Erc20TokenPeriodicPermission as RpcErc20TokenPeriodicPermission,\n Erc20TokenStreamPermission as RpcErc20TokenStreamPermission,\n Erc20TokenRevocationPermission as RpcErc20TokenRevocationPermission,\n NativeTokenAllowancePermission as RpcNativeTokenAllowancePermission,\n NativeTokenPeriodicPermission as RpcNativeTokenPeriodicPermission,\n NativeTokenStreamPermission as RpcNativeTokenStreamPermission,\n PermissionRequest,\n PermissionTypes as RpcPermissionTypes,\n Rule,\n} from '@metamask/7715-permission-types';\nimport { getAddress, hexToNumber, isAddress, toHex, type Hex } from 'viem';\n\nimport { isDefined, toHexOrThrow } from '../utils';\nimport type {\n Erc20TokenAllowancePermission,\n Erc20TokenPeriodicPermission,\n Erc20TokenRevocationPermission,\n Erc20TokenStreamPermission,\n GetGrantedExecutionPermissionsResult,\n GetSupportedExecutionPermissionsResult,\n NativeTokenAllowancePermission,\n NativeTokenPeriodicPermission,\n NativeTokenStreamPermission,\n PermissionRequestParameter,\n PermissionTypes as DeveloperPermissionTypes,\n RpcGetGrantedExecutionPermissionsResult,\n RpcGetSupportedExecutionPermissionsResult,\n} from './erc7715Types';\n\n// =============================================================================\n// Developer → RPC (request formatting)\n// =============================================================================\n\n/**\n * Converts a developer permission request to RPC format for wallet submission.\n *\n * @param parameters the permission request parameters\n * @returns the permission request in RPC format\n */\nexport function permissionRequestToRpc(\n parameters: PermissionRequestParameter,\n): PermissionRequest<RpcPermissionTypes> {\n const { chainId, from, expiry, redeemer, payee } = parameters;\n\n const converter = getPermissionRequestToRpcConverter(\n parameters.permission.type,\n );\n\n const rules: Rule[] = [];\n if (isDefined(expiry)) {\n rules.push({\n type: 'expiry',\n data: {\n timestamp: expiry,\n },\n });\n }\n if (isDefined(redeemer)) {\n if (redeemer.length === 0) {\n throw new Error(\n 'Invalid redeemers: must specify at least one redeemer address',\n );\n }\n const addresses: Hex[] = [];\n for (const addr of redeemer) {\n if (!isAddress(addr)) {\n throw new Error('Invalid redeemers: must be a valid address');\n }\n addresses.push(getAddress(addr));\n }\n rules.push({\n type: 'redeemer',\n data: { addresses },\n });\n }\n if (isDefined(payee)) {\n if (payee.length === 0) {\n throw new Error(\n 'Invalid payees: must specify at least one payee address',\n );\n }\n const payeeAddresses: Hex[] = [];\n for (const addr of payee) {\n if (!isAddress(addr)) {\n throw new Error('Invalid payees: must be a valid address');\n }\n payeeAddresses.push(getAddress(addr));\n }\n rules.push({\n type: 'payee',\n data: { addresses: payeeAddresses },\n });\n }\n\n const optionalFields = {\n ...(from ? { from } : {}),\n };\n\n return {\n ...optionalFields,\n chainId: toHex(chainId),\n permission: converter(parameters.permission),\n to: parameters.to,\n rules,\n };\n}\n\ntype PermissionRequestToRpcConverter = (\n permission: DeveloperPermissionTypes,\n) => RpcPermissionTypes;\n\n/**\n * Get the permission request to RPC converter for the given permission type.\n *\n * @param permissionType the permission type\n * @returns the permission request to RPC converter for the given permission type\n */\nfunction getPermissionRequestToRpcConverter(\n permissionType: string,\n): PermissionRequestToRpcConverter {\n switch (permissionType) {\n case 'native-token-stream':\n return (permission) =>\n nativeTokenStreamPermissionToRpc(\n permission as NativeTokenStreamPermission,\n );\n case 'erc20-token-stream':\n return (permission) =>\n erc20TokenStreamPermissionToRpc(\n permission as Erc20TokenStreamPermission,\n );\n case 'native-token-periodic':\n return (permission) =>\n nativeTokenPeriodicPermissionToRpc(\n permission as NativeTokenPeriodicPermission,\n );\n case 'native-token-allowance':\n return (permission) =>\n nativeTokenAllowancePermissionToRpc(\n permission as NativeTokenAllowancePermission,\n );\n case 'erc20-token-periodic':\n return (permission) =>\n erc20TokenPeriodicPermissionToRpc(\n permission as Erc20TokenPeriodicPermission,\n );\n case 'erc20-token-allowance':\n return (permission) =>\n erc20TokenAllowancePermissionToRpc(\n permission as Erc20TokenAllowancePermission,\n );\n case 'erc20-token-revocation':\n return (permission) =>\n erc20TokenRevocationPermissionToRpc(\n permission as Erc20TokenRevocationPermission,\n );\n default:\n throw new Error(`Unsupported permission type: ${permissionType}`);\n }\n}\n\n/**\n * Convert native token stream permission to RPC format.\n *\n * @param permission the native token stream permission\n * @returns the native token stream permission in RPC format\n */\nfunction nativeTokenStreamPermissionToRpc(\n permission: NativeTokenStreamPermission,\n): RpcNativeTokenStreamPermission {\n const {\n data: {\n initialAmount,\n justification,\n maxAmount,\n startTime,\n amountPerSecond,\n },\n isAdjustmentAllowed,\n } = permission;\n\n const optionalFields = {\n ...(isDefined(initialAmount) && {\n initialAmount: toHexOrThrow(initialAmount, 'initialAmount'),\n }),\n ...(isDefined(maxAmount) && {\n maxAmount: toHexOrThrow(maxAmount, '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(amountPerSecond, 'amountPerSecond'),\n ...optionalFields,\n },\n isAdjustmentAllowed,\n };\n}\n\n/**\n * Convert ERC20 token stream permission to RPC format.\n *\n * @param permission the erc20 token stream permission\n * @returns the erc20 token stream permission in RPC format\n */\nfunction erc20TokenStreamPermissionToRpc(\n permission: Erc20TokenStreamPermission,\n): RpcErc20TokenStreamPermission {\n const {\n data: {\n tokenAddress,\n amountPerSecond,\n initialAmount,\n startTime,\n maxAmount,\n justification,\n },\n isAdjustmentAllowed,\n } = permission;\n\n const optionalFields = {\n ...(isDefined(initialAmount) && {\n initialAmount: toHexOrThrow(initialAmount, 'initialAmount'),\n }),\n ...(isDefined(maxAmount) && {\n maxAmount: toHexOrThrow(maxAmount, '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, 'tokenAddress'),\n amountPerSecond: toHexOrThrow(amountPerSecond, 'amountPerSecond'),\n ...optionalFields,\n },\n isAdjustmentAllowed,\n };\n}\n\n/**\n * Convert native token periodic permission to RPC format.\n *\n * @param permission the native token periodic permission\n * @returns the native token periodic permission in RPC format\n */\nfunction nativeTokenPeriodicPermissionToRpc(\n permission: NativeTokenPeriodicPermission,\n): RpcNativeTokenPeriodicPermission {\n const {\n data: { periodAmount, periodDuration, startTime, justification },\n isAdjustmentAllowed,\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, 'periodAmount'),\n periodDuration: Number(periodDuration),\n ...optionalFields,\n },\n isAdjustmentAllowed,\n };\n}\n\n/**\n * Convert ERC20 token periodic permission to RPC format.\n *\n * @param permission the erc20 token periodic permission\n * @returns the erc20 token periodic permission in RPC format\n */\nfunction erc20TokenPeriodicPermissionToRpc(\n permission: Erc20TokenPeriodicPermission,\n): RpcErc20TokenPeriodicPermission {\n const {\n data: {\n tokenAddress,\n periodAmount,\n periodDuration,\n startTime,\n justification,\n },\n isAdjustmentAllowed,\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, 'tokenAddress'),\n periodAmount: toHexOrThrow(periodAmount, 'periodAmount'),\n periodDuration: Number(periodDuration),\n ...optionalFields,\n },\n isAdjustmentAllowed,\n };\n}\n\n/**\n * Convert native token fixed allowance permission to RPC format.\n *\n * @param permission the native token fixed allowance permission\n * @returns the native token fixed allowance permission in RPC format\n */\nfunction nativeTokenAllowancePermissionToRpc(\n permission: NativeTokenAllowancePermission,\n): RpcNativeTokenAllowancePermission {\n const {\n data: { allowanceAmount, startTime, justification },\n isAdjustmentAllowed,\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-allowance',\n data: {\n allowanceAmount: toHexOrThrow(allowanceAmount, 'allowanceAmount'),\n ...optionalFields,\n },\n isAdjustmentAllowed,\n };\n}\n\n/**\n * Convert ERC-20 token fixed allowance permission to RPC format.\n *\n * @param permission the ERC-20 token fixed allowance permission\n * @returns the ERC-20 token fixed allowance permission in RPC format\n */\nfunction erc20TokenAllowancePermissionToRpc(\n permission: Erc20TokenAllowancePermission,\n): RpcErc20TokenAllowancePermission {\n const {\n data: { tokenAddress, allowanceAmount, startTime, justification },\n isAdjustmentAllowed,\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-allowance',\n data: {\n tokenAddress: toHexOrThrow(tokenAddress, 'tokenAddress'),\n allowanceAmount: toHexOrThrow(allowanceAmount, 'allowanceAmount'),\n ...optionalFields,\n },\n isAdjustmentAllowed,\n };\n}\n\n/**\n * Convert ERC20 token revocation permission to RPC format.\n *\n * @param permission the erc20 token revocation permission\n * @returns the erc20 token revocation permission in RPC format\n */\nfunction erc20TokenRevocationPermissionToRpc(\n permission: Erc20TokenRevocationPermission,\n): RpcErc20TokenRevocationPermission {\n const {\n data: { justification },\n isAdjustmentAllowed,\n } = permission;\n\n const data = {\n ...(justification ? { justification } : {}),\n };\n return {\n type: 'erc20-token-revocation',\n data,\n isAdjustmentAllowed,\n };\n}\n\n// =============================================================================\n// RPC → Developer friendly types (response conversion)\n// =============================================================================\n\n/**\n * Converts RPC permission responses to developer-friendly types.\n * Converts chainId from hex to number, and token amounts from hex to bigint.\n *\n * @param result the RPC permission responses\n * @returns the developer-friendly permission responses\n */\nexport function permissionResponsesFromRpc(\n result: RpcGetGrantedExecutionPermissionsResult,\n): GetGrantedExecutionPermissionsResult {\n return result.map((permission) => ({\n ...permission,\n chainId: hexToNumber(permission.chainId),\n permission: permissionTypeFromRpc(permission.permission),\n rules: normalizeRulesFromRpc(permission.rules),\n }));\n}\n\n/**\n * Checksums addresses in `redeemer` and `payee` rules; other rules are returned unchanged.\n *\n * @param rules - Rules from the wallet RPC response.\n * @returns The same list with normalized addresses, or null/undefined if that was the input.\n */\nfunction normalizeRulesFromRpc(\n rules: Rule[] | null | undefined,\n): Rule[] | null | undefined {\n if (rules === undefined || rules === null) {\n return rules;\n }\n return rules.map((rule) => {\n if (rule.type !== 'redeemer' && rule.type !== 'payee') {\n return rule;\n }\n const rawAddresses = (rule.data as { addresses?: unknown } | undefined)\n ?.addresses;\n if (!Array.isArray(rawAddresses)) {\n return rule;\n }\n return {\n type: rule.type,\n data: {\n addresses: rawAddresses.map((addr) => getAddress(addr as Hex)),\n },\n };\n });\n}\n\n/**\n * Converts RPC permission type data to developer-friendly types.\n * Converts hex amount fields to bigint.\n *\n * @param permission the RPC permission\n * @returns the developer-friendly permission\n */\nexport function permissionTypeFromRpc(\n permission: RpcPermissionTypes,\n): DeveloperPermissionTypes {\n const convertedData: Record<string, unknown> = { ...permission.data };\n\n if ('amountPerSecond' in convertedData && convertedData.amountPerSecond) {\n convertedData.amountPerSecond = BigInt(\n convertedData.amountPerSecond as `0x${string}`,\n );\n }\n\n if ('periodAmount' in convertedData && convertedData.periodAmount) {\n convertedData.periodAmount = BigInt(\n convertedData.periodAmount as `0x${string}`,\n );\n }\n\n if ('initialAmount' in convertedData && convertedData.initialAmount) {\n convertedData.initialAmount = BigInt(\n convertedData.initialAmount as `0x${string}`,\n );\n }\n\n if ('maxAmount' in convertedData && convertedData.maxAmount) {\n convertedData.maxAmount = BigInt(convertedData.maxAmount as `0x${string}`);\n }\n\n if ('allowanceAmount' in convertedData && convertedData.allowanceAmount) {\n convertedData.allowanceAmount = BigInt(\n convertedData.allowanceAmount as `0x${string}`,\n );\n }\n\n return {\n ...permission,\n data: convertedData,\n } as DeveloperPermissionTypes;\n}\n\n/**\n * Converts RPC supported permissions result to developer-friendly types.\n * Converts chain IDs from hex to numbers.\n *\n * @param result the RPC supported permissions result\n * @returns the developer-friendly supported permissions result\n */\nexport function rpcSupportedPermissionsToDeveloper(\n result: RpcGetSupportedExecutionPermissionsResult,\n): GetSupportedExecutionPermissionsResult {\n const converted: GetSupportedExecutionPermissionsResult = {};\n\n for (const [permissionType, permissionInfo] of Object.entries(result)) {\n converted[permissionType] = {\n chainIds: permissionInfo.chainIds.map((chainId) => hexToNumber(chainId)),\n ruleTypes: permissionInfo.ruleTypes,\n };\n }\n\n return converted;\n}\n","import { trackSmartAccountsKitFunctionCall } from '../analytics';\nimport { permissionResponsesFromRpc } from './erc7715Mapping';\nimport type {\n GetGrantedExecutionPermissionsResult,\n MetaMaskExtensionClient,\n} from './erc7715Types';\n\nexport type { GetGrantedExecutionPermissionsResult } from './erc7715Types';\n\n/**\n * Retrieves all previously granted execution permissions from the wallet according to EIP-7715 specification.\n *\n * @param client - The client to use for the request.\n * @returns A promise that resolves to an array of granted permission responses.\n * @description\n * This function queries the wallet for all granted permissions that are not yet revoked.\n * Each permission response includes the chain ID, address, signer, permission details,\n * context, and dependency information.\n * @example\n * ```typescript\n * const grantedPermissions = await erc7715GetGrantedExecutionPermissionsAction(client);\n * // Returns an array of PermissionResponse objects with user-friendly types\n * ```\n */\nexport async function erc7715GetGrantedExecutionPermissionsAction(\n client: MetaMaskExtensionClient,\n): Promise<GetGrantedExecutionPermissionsResult> {\n trackSmartAccountsKitFunctionCall(\n 'erc7715GetGrantedExecutionPermissionsAction',\n {\n chainId: client.chain?.id ?? null,\n },\n );\n\n const result = await client.request(\n {\n method: 'wallet_getGrantedExecutionPermissions',\n params: [],\n },\n { retryCount: 0 },\n );\n\n if (!result) {\n throw new Error('Failed to get granted execution permissions');\n }\n\n return permissionResponsesFromRpc(result);\n}\n","import { trackSmartAccountsKitFunctionCall } from '../analytics';\nimport { rpcSupportedPermissionsToDeveloper } from './erc7715Mapping';\nimport type {\n GetSupportedExecutionPermissionsResult,\n MetaMaskExtensionClient,\n} from './erc7715Types';\n\nexport type { GetSupportedExecutionPermissionsResult } from './erc7715Types';\n\n/**\n * Retrieves the supported execution permission types from the wallet according to EIP-7715 specification.\n *\n * @param client - The client to use for the request.\n * @returns A promise that resolves to a record of supported permission types with their chain IDs and rule types.\n * @description\n * This function queries the wallet for the permission types it supports.\n * The result is keyed by permission type and includes the supported chain IDs and rule types.\n * @example\n * ```typescript\n * const supported = await erc7715GetSupportedExecutionPermissionsAction(client);\n * // Returns:\n * // {\n * // \"native-token-allowance\": {\n * // \"chainIds\": [1, 137],\n * // \"ruleTypes\": [\"expiry\", \"redeemer\", \"payee\"]\n * // },\n * // \"erc20-token-allowance\": {\n * // \"chainIds\": [1],\n * // \"ruleTypes\": [\"expiry\"]\n * // }\n * // }\n * //\n * // Which strings appear in `ruleTypes` is defined by the wallet; when supported,\n * // `\"redeemer\"` indicates the wallet accepts a redeemer execution rule and\n * // `\"payee\"` indicates the wallet accepts a payee execution rule.\n * ```\n */\nexport async function erc7715GetSupportedExecutionPermissionsAction(\n client: MetaMaskExtensionClient,\n): Promise<GetSupportedExecutionPermissionsResult> {\n trackSmartAccountsKitFunctionCall(\n 'erc7715GetSupportedExecutionPermissionsAction',\n {\n chainId: client.chain?.id ?? null,\n },\n );\n\n const result = await client.request(\n {\n method: 'wallet_getSupportedExecutionPermissions',\n params: [],\n },\n { retryCount: 0 },\n );\n\n if (!result) {\n throw new Error('Failed to get supported execution permissions');\n }\n\n return rpcSupportedPermissionsToDeveloper(result);\n}\n","import { trackSmartAccountsKitFunctionCall } from '../analytics';\nimport {\n permissionRequestToRpc,\n permissionResponsesFromRpc,\n} from './erc7715Mapping';\nimport type {\n GetGrantedExecutionPermissionsResult,\n MetaMaskExtensionClient,\n PermissionRequestParameter,\n} from './erc7715Types';\n\nexport type {\n GetGrantedExecutionPermissionsResult,\n GetSupportedExecutionPermissionsResult,\n MetaMaskExtensionClient,\n MetaMaskExtensionSchema,\n SupportedPermissionInfo,\n PermissionTypes,\n PermissionRequestParameter,\n} from './erc7715Types';\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 =\n GetGrantedExecutionPermissionsResult;\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 trackSmartAccountsKitFunctionCall(\n 'erc7715RequestExecutionPermissionsAction',\n {\n chainId: client.chain?.id ?? null,\n requestCount: parameters.length,\n },\n );\n const formattedPermissionRequest = parameters.map(permissionRequestToRpc);\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 permissionResponsesFromRpc(result);\n}\n","import type { Address, Hex, Client } from 'viem';\n\nimport { trackSmartAccountsKitFunctionCall } from '../analytics';\nimport { hashDelegation } 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 *\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 trackSmartAccountsKitFunctionCall(\n 'getErc20PeriodTransferEnforcerAvailableAmount',\n {\n chainId: client.chain?.id ?? null,\n },\n );\n const enforcerName = 'ERC20PeriodTransferEnforcer';\n\n const delegationManager = getDelegationManager(environment);\n const enforcerAddress = getEnforcerAddress({\n enforcerName,\n environment,\n });\n\n const delegationHash = hashDelegation(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 trackSmartAccountsKitFunctionCall(\n 'getErc20StreamingEnforcerAvailableAmount',\n {\n chainId: client.chain?.id ?? null,\n },\n );\n const enforcerName = 'ERC20StreamingEnforcer';\n const delegationManager = getDelegationManager(environment);\n const enforcerAddress = getEnforcerAddress({\n enforcerName,\n environment,\n });\n\n const delegationHash = hashDelegation(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 trackSmartAccountsKitFunctionCall(\n 'getMultiTokenPeriodEnforcerAvailableAmount',\n {\n chainId: client.chain?.id ?? null,\n },\n );\n const enforcerName = 'MultiTokenPeriodEnforcer';\n const delegationManager = getDelegationManager(environment);\n const enforcerAddress = getEnforcerAddress({\n enforcerName,\n environment,\n });\n\n const delegationHash = hashDelegation(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 trackSmartAccountsKitFunctionCall(\n 'getNativeTokenPeriodTransferEnforcerAvailableAmount',\n {\n chainId: client.chain?.id ?? null,\n },\n );\n const enforcerName = 'NativeTokenPeriodTransferEnforcer';\n const delegationManager = getDelegationManager(environment);\n const enforcerAddress = getEnforcerAddress({\n enforcerName,\n environment,\n });\n\n const delegationHash = hashDelegation(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 trackSmartAccountsKitFunctionCall(\n 'getNativeTokenStreamingEnforcerAvailableAmount',\n {\n chainId: client.chain?.id ?? null,\n },\n );\n const enforcerName = 'NativeTokenStreamingEnforcer';\n const delegationManager = getDelegationManager(environment);\n const enforcerAddress = getEnforcerAddress({\n enforcerName,\n environment,\n });\n\n const delegationHash = hashDelegation(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 {\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 *\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 *\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 *\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 *\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,SAAS,yBAAyB;AAYlC,SAAS,QAAQ,oBAAoB,sBAAsB;AAwC3D,eAAsB,oCAIpB,QACA,MACA;AACA,oCAAkC,uCAAuC;AAAA,IACvE,SAAS,OAAO,OAAO,MAAM;AAAA,EAC/B,CAAC;AAED,MAAI,CAAC,KAAK,IAAI;AACZ,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAGA,QAAM,UAAU,OAAO,OAAO;AAC9B,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,QAAM,EAAE,mBAAmB,0BAA0B,IACnD,4BAA4B,OAAO;AACrC,MAAI,CAAC,eAAe,KAAK,mBAAmB,yBAAyB,GAAG;AACtE,UAAM,IAAI;AAAA,MACR,uCAAuC,yBAAyB,cAAc,OAAO,aAAa,KAAK,iBAAiB;AAAA,IAC1H;AAAA,EACF;AAEA,QAAM,aAAa;AAAA,IACjB,gBAAgB;AAAA,MACd,QAAQ,KAAK;AAAA,MACb,OAAO,KAAK;AAAA,MACZ,UAAU,KAAK;AAAA,IACjB,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,mBAAmB;AAAA,IAClC,KAAK;AAAA,IACL,c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;AAAA,IACA,GAAG;AAAA,EACL,CAAC;AACH;AAcO,SAAS,2BAA2B;AACzC,SAAO,CAIL,YAGI;AAAA,IACJ,mBAAmB,OACjB,eAIA,kBAAkB,QAAQ;AAAA,MACxB,SACE,WAAW,YACV,MAAM;AACL,YAAI,CAAC,OAAO,OAAO,IAAI;AACrB,gBAAM,IAAID;AAAA,YACR;AAAA,UACF;AAAA,QACF;AACA,eAAO,OAAO,MAAM;AAAA,MACtB,GAAG;AAAA,MACL,GAAG;AAAA,IACL,CAAC;AAAA,EACL;AACF;;;ATtDO,IAAM,yBAAyB,MAAM,CAAC,YAAoB;AAAA,EAC/D,6BAA6B,OAC3B,eACG;AACH,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,kCAAkC,YAAY;AAC5C,WAAO;AAAA,MACL;AAAA,IACF;AAAA,EACF;AAAA,EACA,gCAAgC,YAAY;AAC1C,WAAO;AAAA,MACL;AAAA,IACF;AAAA,EACF;AACF;AAqBO,IAAM,uBAAuB,MAAM,CAAC,YAA0B;AAAA,EACnE,+BAA+B,OAC7B,SACG,oCAAoC,QAAQ,IAAI;AACvD;AAEO,IAAM,wBAAwB,MAAM,CAAC,YAAoB;AAAA,EAC9D,iCAAiC,OAC/B,SACG,sCAAsC,QAAyB,IAAI;AAC1E;","names":["read_exports","isAddressEqual","BaseError","parseAccount","BaseError","parseAccount"]}