@startale-scs/aa-sdk 0.0.0-dev.20260331120000
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.
- package/LICENSE +21 -0
- package/README.md +73 -0
- package/dist/_cjs/account/decorators/getFactoryData.js +36 -0
- package/dist/_cjs/account/decorators/getFactoryData.js.map +1 -0
- package/dist/_cjs/account/decorators/getStartaleAccountAddress.js +18 -0
- package/dist/_cjs/account/decorators/getStartaleAccountAddress.js.map +1 -0
- package/dist/_cjs/account/decorators/index.js +6 -0
- package/dist/_cjs/account/decorators/index.js.map +1 -0
- package/dist/_cjs/account/index.js +6 -0
- package/dist/_cjs/account/index.js.map +1 -0
- package/dist/_cjs/account/toStartaleSmartAccount.js +311 -0
- package/dist/_cjs/account/toStartaleSmartAccount.js.map +1 -0
- package/dist/_cjs/account/utils/AccountNotFound.js +18 -0
- package/dist/_cjs/account/utils/AccountNotFound.js.map +1 -0
- package/dist/_cjs/account/utils/Constants.js +128 -0
- package/dist/_cjs/account/utils/Constants.js.map +1 -0
- package/dist/_cjs/account/utils/Helpers.js +39 -0
- package/dist/_cjs/account/utils/Helpers.js.map +1 -0
- package/dist/_cjs/account/utils/Logger.js +35 -0
- package/dist/_cjs/account/utils/Logger.js.map +1 -0
- package/dist/_cjs/account/utils/Types.js +3 -0
- package/dist/_cjs/account/utils/Types.js.map +1 -0
- package/dist/_cjs/account/utils/Utils.js +258 -0
- package/dist/_cjs/account/utils/Utils.js.map +1 -0
- package/dist/_cjs/account/utils/addressToEmptyAccount.js +24 -0
- package/dist/_cjs/account/utils/addressToEmptyAccount.js.map +1 -0
- package/dist/_cjs/account/utils/contractSimulation.js +27 -0
- package/dist/_cjs/account/utils/contractSimulation.js.map +1 -0
- package/dist/_cjs/account/utils/deepHexlify.js +26 -0
- package/dist/_cjs/account/utils/deepHexlify.js.map +1 -0
- package/dist/_cjs/account/utils/eip7702Utils.js +21 -0
- package/dist/_cjs/account/utils/eip7702Utils.js.map +1 -0
- package/dist/_cjs/account/utils/fromBundlerClient.js +45 -0
- package/dist/_cjs/account/utils/fromBundlerClient.js.map +1 -0
- package/dist/_cjs/account/utils/getAAError.js +37 -0
- package/dist/_cjs/account/utils/getAAError.js.map +1 -0
- package/dist/_cjs/account/utils/getChain.js +66 -0
- package/dist/_cjs/account/utils/getChain.js.map +1 -0
- package/dist/_cjs/account/utils/getVersion.js +46 -0
- package/dist/_cjs/account/utils/getVersion.js.map +1 -0
- package/dist/_cjs/account/utils/index.js +28 -0
- package/dist/_cjs/account/utils/index.js.map +1 -0
- package/dist/_cjs/account/utils/parseErrorMessage.js +79 -0
- package/dist/_cjs/account/utils/parseErrorMessage.js.map +1 -0
- package/dist/_cjs/account/utils/tenderlySimulation.js +52 -0
- package/dist/_cjs/account/utils/tenderlySimulation.js.map +1 -0
- package/dist/_cjs/account/utils/toInitData.js +13 -0
- package/dist/_cjs/account/utils/toInitData.js.map +1 -0
- package/dist/_cjs/account/utils/toInstallData.js +15 -0
- package/dist/_cjs/account/utils/toInstallData.js.map +1 -0
- package/dist/_cjs/account/utils/toSigner.js +81 -0
- package/dist/_cjs/account/utils/toSigner.js.map +1 -0
- package/dist/_cjs/clients/createHttpClient.js +46 -0
- package/dist/_cjs/clients/createHttpClient.js.map +1 -0
- package/dist/_cjs/clients/createSCSBundlerClient.js +85 -0
- package/dist/_cjs/clients/createSCSBundlerClient.js.map +1 -0
- package/dist/_cjs/clients/createSCSPaymasterClient.js +48 -0
- package/dist/_cjs/clients/createSCSPaymasterClient.js.map +1 -0
- package/dist/_cjs/clients/decorators/bundler/getGasFeeValues.js +49 -0
- package/dist/_cjs/clients/decorators/bundler/getGasFeeValues.js.map +1 -0
- package/dist/_cjs/clients/decorators/bundler/index.js +11 -0
- package/dist/_cjs/clients/decorators/bundler/index.js.map +1 -0
- package/dist/_cjs/clients/decorators/bundler/waitForUserOperationReceipt.js +11 -0
- package/dist/_cjs/clients/decorators/bundler/waitForUserOperationReceipt.js.map +1 -0
- package/dist/_cjs/clients/decorators/erc7579/accountId.js +65 -0
- package/dist/_cjs/clients/decorators/erc7579/accountId.js.map +1 -0
- package/dist/_cjs/clients/decorators/erc7579/getActiveHook.js +43 -0
- package/dist/_cjs/clients/decorators/erc7579/getActiveHook.js.map +1 -0
- package/dist/_cjs/clients/decorators/erc7579/getFallbackBySelector.js +56 -0
- package/dist/_cjs/clients/decorators/erc7579/getFallbackBySelector.js.map +1 -0
- package/dist/_cjs/clients/decorators/erc7579/getInstalledExecutors.js +63 -0
- package/dist/_cjs/clients/decorators/erc7579/getInstalledExecutors.js.map +1 -0
- package/dist/_cjs/clients/decorators/erc7579/getInstalledValidators.js +61 -0
- package/dist/_cjs/clients/decorators/erc7579/getInstalledValidators.js.map +1 -0
- package/dist/_cjs/clients/decorators/erc7579/getPreviousModule.js +37 -0
- package/dist/_cjs/clients/decorators/erc7579/getPreviousModule.js.map +1 -0
- package/dist/_cjs/clients/decorators/erc7579/index.js +64 -0
- package/dist/_cjs/clients/decorators/erc7579/index.js.map +1 -0
- package/dist/_cjs/clients/decorators/erc7579/installModule.js +73 -0
- package/dist/_cjs/clients/decorators/erc7579/installModule.js.map +1 -0
- package/dist/_cjs/clients/decorators/erc7579/installModules.js +25 -0
- package/dist/_cjs/clients/decorators/erc7579/installModules.js.map +1 -0
- package/dist/_cjs/clients/decorators/erc7579/isModuleInstalled.js +90 -0
- package/dist/_cjs/clients/decorators/erc7579/isModuleInstalled.js.map +1 -0
- package/dist/_cjs/clients/decorators/erc7579/supportsExecutionMode.js +102 -0
- package/dist/_cjs/clients/decorators/erc7579/supportsExecutionMode.js.map +1 -0
- package/dist/_cjs/clients/decorators/erc7579/supportsModule.js +90 -0
- package/dist/_cjs/clients/decorators/erc7579/supportsModule.js.map +1 -0
- package/dist/_cjs/clients/decorators/erc7579/uninstallFallback.js +61 -0
- package/dist/_cjs/clients/decorators/erc7579/uninstallFallback.js.map +1 -0
- package/dist/_cjs/clients/decorators/erc7579/uninstallModule.js +79 -0
- package/dist/_cjs/clients/decorators/erc7579/uninstallModule.js.map +1 -0
- package/dist/_cjs/clients/decorators/erc7579/uninstallModules.js +26 -0
- package/dist/_cjs/clients/decorators/erc7579/uninstallModules.js.map +1 -0
- package/dist/_cjs/clients/decorators/index.js +8 -0
- package/dist/_cjs/clients/decorators/index.js.map +1 -0
- package/dist/_cjs/clients/decorators/smartAccount/debugUserOperation.js +75 -0
- package/dist/_cjs/clients/decorators/smartAccount/debugUserOperation.js.map +1 -0
- package/dist/_cjs/clients/decorators/smartAccount/index.js +32 -0
- package/dist/_cjs/clients/decorators/smartAccount/index.js.map +1 -0
- package/dist/_cjs/clients/decorators/smartAccount/prepareTokenPaymasterUserOp.js +32 -0
- package/dist/_cjs/clients/decorators/smartAccount/prepareTokenPaymasterUserOp.js.map +1 -0
- package/dist/_cjs/clients/decorators/smartAccount/prepareUserOperationWithoutSignature.js +35 -0
- package/dist/_cjs/clients/decorators/smartAccount/prepareUserOperationWithoutSignature.js.map +1 -0
- package/dist/_cjs/clients/decorators/smartAccount/sendTokenPaymasterUserOp.js +21 -0
- package/dist/_cjs/clients/decorators/smartAccount/sendTokenPaymasterUserOp.js.map +1 -0
- package/dist/_cjs/clients/decorators/smartAccount/sendTransaction.js +41 -0
- package/dist/_cjs/clients/decorators/smartAccount/sendTransaction.js.map +1 -0
- package/dist/_cjs/clients/decorators/smartAccount/signMessage.js +14 -0
- package/dist/_cjs/clients/decorators/smartAccount/signMessage.js.map +1 -0
- package/dist/_cjs/clients/decorators/smartAccount/signTypedData.js +31 -0
- package/dist/_cjs/clients/decorators/smartAccount/signTypedData.js.map +1 -0
- package/dist/_cjs/clients/decorators/smartAccount/upgradeSmartAccount.js +61 -0
- package/dist/_cjs/clients/decorators/smartAccount/upgradeSmartAccount.js.map +1 -0
- package/dist/_cjs/clients/decorators/smartAccount/waitForTransactionReceipt.js +17 -0
- package/dist/_cjs/clients/decorators/smartAccount/waitForTransactionReceipt.js.map +1 -0
- package/dist/_cjs/clients/decorators/smartAccount/writeContract.js +20 -0
- package/dist/_cjs/clients/decorators/smartAccount/writeContract.js.map +1 -0
- package/dist/_cjs/clients/decorators/tokenPaymaster/getSupportedTokens.js +25 -0
- package/dist/_cjs/clients/decorators/tokenPaymaster/getSupportedTokens.js.map +1 -0
- package/dist/_cjs/clients/decorators/tokenPaymaster/getTokenPaymasterQuotes.js +71 -0
- package/dist/_cjs/clients/decorators/tokenPaymaster/getTokenPaymasterQuotes.js.map +1 -0
- package/dist/_cjs/clients/decorators/tokenPaymaster/index.js +11 -0
- package/dist/_cjs/clients/decorators/tokenPaymaster/index.js.map +1 -0
- package/dist/_cjs/clients/index.js +8 -0
- package/dist/_cjs/clients/index.js.map +1 -0
- package/dist/_cjs/constants/abi/AccountFactory.js +337 -0
- package/dist/_cjs/constants/abi/AccountFactory.js.map +1 -0
- package/dist/_cjs/constants/abi/AccountImplementationAbi.js +1179 -0
- package/dist/_cjs/constants/abi/AccountImplementationAbi.js.map +1 -0
- package/dist/_cjs/constants/abi/BootstrapAbi.js +730 -0
- package/dist/_cjs/constants/abi/BootstrapAbi.js.map +1 -0
- package/dist/_cjs/constants/abi/ComposabilityAbi.js +274 -0
- package/dist/_cjs/constants/abi/ComposabilityAbi.js.map +1 -0
- package/dist/_cjs/constants/abi/EIP1271Abi.js +31 -0
- package/dist/_cjs/constants/abi/EIP1271Abi.js.map +1 -0
- package/dist/_cjs/constants/abi/ERC7484RegistryAbi.js +17 -0
- package/dist/_cjs/constants/abi/ERC7484RegistryAbi.js.map +1 -0
- package/dist/_cjs/constants/abi/EntryPointABI.js +661 -0
- package/dist/_cjs/constants/abi/EntryPointABI.js.map +1 -0
- package/dist/_cjs/constants/abi/SmartSessionAbi.js +1472 -0
- package/dist/_cjs/constants/abi/SmartSessionAbi.js.map +1 -0
- package/dist/_cjs/constants/abi/TokenWithPermitAbi.js +622 -0
- package/dist/_cjs/constants/abi/TokenWithPermitAbi.js.map +1 -0
- package/dist/_cjs/constants/abi/UniActionPolicyAbi.js +62 -0
- package/dist/_cjs/constants/abi/UniActionPolicyAbi.js.map +1 -0
- package/dist/_cjs/constants/abi/UniswapSwapRouterAbi.js +486 -0
- package/dist/_cjs/constants/abi/UniswapSwapRouterAbi.js.map +1 -0
- package/dist/_cjs/constants/abi/index.js +14 -0
- package/dist/_cjs/constants/abi/index.js.map +1 -0
- package/dist/_cjs/constants/index.js +64 -0
- package/dist/_cjs/constants/index.js.map +1 -0
- package/dist/_cjs/index.js +13 -0
- package/dist/_cjs/index.js.map +1 -0
- package/dist/_cjs/modules/index.js +8 -0
- package/dist/_cjs/modules/index.js.map +1 -0
- package/dist/_cjs/modules/toEmptyExecutor.js +10 -0
- package/dist/_cjs/modules/toEmptyExecutor.js.map +1 -0
- package/dist/_cjs/modules/toEmptyHook.js +10 -0
- package/dist/_cjs/modules/toEmptyHook.js.map +1 -0
- package/dist/_cjs/modules/utils/Helpers.js +59 -0
- package/dist/_cjs/modules/utils/Helpers.js.map +1 -0
- package/dist/_cjs/modules/utils/Types.js +15 -0
- package/dist/_cjs/modules/utils/Types.js.map +1 -0
- package/dist/_cjs/modules/utils/Uid.js +14 -0
- package/dist/_cjs/modules/utils/Uid.js.map +1 -0
- package/dist/_cjs/modules/utils/composabilityCalls.js +117 -0
- package/dist/_cjs/modules/utils/composabilityCalls.js.map +1 -0
- package/dist/_cjs/modules/utils/index.js +9 -0
- package/dist/_cjs/modules/utils/index.js.map +1 -0
- package/dist/_cjs/modules/utils/runtimeAbiEncoding.js +276 -0
- package/dist/_cjs/modules/utils/runtimeAbiEncoding.js.map +1 -0
- package/dist/_cjs/modules/utils/toModule.js +39 -0
- package/dist/_cjs/modules/utils/toModule.js.map +1 -0
- package/dist/_cjs/modules/validators/default/index.js +5 -0
- package/dist/_cjs/modules/validators/default/index.js.map +1 -0
- package/dist/_cjs/modules/validators/default/toDefaultModule.js +18 -0
- package/dist/_cjs/modules/validators/default/toDefaultModule.js.map +1 -0
- package/dist/_cjs/modules/validators/index.js +9 -0
- package/dist/_cjs/modules/validators/index.js.map +1 -0
- package/dist/_cjs/modules/validators/ownable/decorators/addOwner.js +48 -0
- package/dist/_cjs/modules/validators/ownable/decorators/addOwner.js.map +1 -0
- package/dist/_cjs/modules/validators/ownable/decorators/getAddOwnerTx.js +42 -0
- package/dist/_cjs/modules/validators/ownable/decorators/getAddOwnerTx.js.map +1 -0
- package/dist/_cjs/modules/validators/ownable/decorators/getOwners.js +28 -0
- package/dist/_cjs/modules/validators/ownable/decorators/getOwners.js.map +1 -0
- package/dist/_cjs/modules/validators/ownable/decorators/getRemoveOwnerTx.js +42 -0
- package/dist/_cjs/modules/validators/ownable/decorators/getRemoveOwnerTx.js.map +1 -0
- package/dist/_cjs/modules/validators/ownable/decorators/getSetThresholdTx.js +32 -0
- package/dist/_cjs/modules/validators/ownable/decorators/getSetThresholdTx.js.map +1 -0
- package/dist/_cjs/modules/validators/ownable/decorators/getThreshold.js +28 -0
- package/dist/_cjs/modules/validators/ownable/decorators/getThreshold.js.map +1 -0
- package/dist/_cjs/modules/validators/ownable/decorators/index.js +70 -0
- package/dist/_cjs/modules/validators/ownable/decorators/index.js.map +1 -0
- package/dist/_cjs/modules/validators/ownable/decorators/multiSign.js +25 -0
- package/dist/_cjs/modules/validators/ownable/decorators/multiSign.js.map +1 -0
- package/dist/_cjs/modules/validators/ownable/decorators/prepareForMultiSign.js +22 -0
- package/dist/_cjs/modules/validators/ownable/decorators/prepareForMultiSign.js.map +1 -0
- package/dist/_cjs/modules/validators/ownable/decorators/removeOwner.js +47 -0
- package/dist/_cjs/modules/validators/ownable/decorators/removeOwner.js.map +1 -0
- package/dist/_cjs/modules/validators/ownable/decorators/setThreshold.js +39 -0
- package/dist/_cjs/modules/validators/ownable/decorators/setThreshold.js.map +1 -0
- package/dist/_cjs/modules/validators/ownable/index.js +6 -0
- package/dist/_cjs/modules/validators/ownable/index.js.map +1 -0
- package/dist/_cjs/modules/validators/ownable/toOwnableModule.js +16 -0
- package/dist/_cjs/modules/validators/ownable/toOwnableModule.js.map +1 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/Helpers.js +132 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/Helpers.js.map +1 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/Types.js +13 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/Types.js.map +1 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/grantPermission.js +38 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/grantPermission.js.map +1 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/index.js +30 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/index.js.map +1 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/preparePermission.js +152 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/preparePermission.js.map +1 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/revokeSession.js +42 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/revokeSession.js.map +1 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/usePermission.js +16 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/usePermission.js.map +1 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/index.js +8 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/index.js.map +1 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/toSmartSessionsValidator.js +49 -0
- package/dist/_cjs/modules/validators/smartSessionsValidator/toSmartSessionsValidator.js.map +1 -0
- package/dist/_cjs/modules/validators/toValidator.js +21 -0
- package/dist/_cjs/modules/validators/toValidator.js.map +1 -0
- package/dist/_cjs/package.json +1 -0
- package/dist/_esm/account/decorators/getFactoryData.js +31 -0
- package/dist/_esm/account/decorators/getFactoryData.js.map +1 -0
- package/dist/_esm/account/decorators/getStartaleAccountAddress.js +31 -0
- package/dist/_esm/account/decorators/getStartaleAccountAddress.js.map +1 -0
- package/dist/_esm/account/decorators/index.js +3 -0
- package/dist/_esm/account/decorators/index.js.map +1 -0
- package/dist/_esm/account/index.js +3 -0
- package/dist/_esm/account/index.js.map +1 -0
- package/dist/_esm/account/toStartaleSmartAccount.js +403 -0
- package/dist/_esm/account/toStartaleSmartAccount.js.map +1 -0
- package/dist/_esm/account/utils/AccountNotFound.js +17 -0
- package/dist/_esm/account/utils/AccountNotFound.js.map +1 -0
- package/dist/_esm/account/utils/Constants.js +129 -0
- package/dist/_esm/account/utils/Constants.js.map +1 -0
- package/dist/_esm/account/utils/Helpers.js +45 -0
- package/dist/_esm/account/utils/Helpers.js.map +1 -0
- package/dist/_esm/account/utils/Logger.js +50 -0
- package/dist/_esm/account/utils/Logger.js.map +1 -0
- package/dist/_esm/account/utils/Types.js +2 -0
- package/dist/_esm/account/utils/Types.js.map +1 -0
- package/dist/_esm/account/utils/Utils.js +319 -0
- package/dist/_esm/account/utils/Utils.js.map +1 -0
- package/dist/_esm/account/utils/addressToEmptyAccount.js +21 -0
- package/dist/_esm/account/utils/addressToEmptyAccount.js.map +1 -0
- package/dist/_esm/account/utils/contractSimulation.js +48 -0
- package/dist/_esm/account/utils/contractSimulation.js.map +1 -0
- package/dist/_esm/account/utils/deepHexlify.js +63 -0
- package/dist/_esm/account/utils/deepHexlify.js.map +1 -0
- package/dist/_esm/account/utils/eip7702Utils.js +16 -0
- package/dist/_esm/account/utils/eip7702Utils.js.map +1 -0
- package/dist/_esm/account/utils/fromBundlerClient.js +67 -0
- package/dist/_esm/account/utils/fromBundlerClient.js.map +1 -0
- package/dist/_esm/account/utils/getAAError.js +34 -0
- package/dist/_esm/account/utils/getAAError.js.map +1 -0
- package/dist/_esm/account/utils/getChain.js +117 -0
- package/dist/_esm/account/utils/getChain.js.map +1 -0
- package/dist/_esm/account/utils/getVersion.js +163 -0
- package/dist/_esm/account/utils/getVersion.js.map +1 -0
- package/dist/_esm/account/utils/index.js +20 -0
- package/dist/_esm/account/utils/index.js.map +1 -0
- package/dist/_esm/account/utils/parseErrorMessage.js +89 -0
- package/dist/_esm/account/utils/parseErrorMessage.js.map +1 -0
- package/dist/_esm/account/utils/tenderlySimulation.js +47 -0
- package/dist/_esm/account/utils/tenderlySimulation.js.map +1 -0
- package/dist/_esm/account/utils/toInitData.js +14 -0
- package/dist/_esm/account/utils/toInitData.js.map +1 -0
- package/dist/_esm/account/utils/toInstallData.js +16 -0
- package/dist/_esm/account/utils/toInstallData.js.map +1 -0
- package/dist/_esm/account/utils/toSigner.js +91 -0
- package/dist/_esm/account/utils/toSigner.js.map +1 -0
- package/dist/_esm/clients/createHttpClient.js +47 -0
- package/dist/_esm/clients/createHttpClient.js.map +1 -0
- package/dist/_esm/clients/createSCSBundlerClient.js +96 -0
- package/dist/_esm/clients/createSCSBundlerClient.js.map +1 -0
- package/dist/_esm/clients/createSCSPaymasterClient.js +85 -0
- package/dist/_esm/clients/createSCSPaymasterClient.js.map +1 -0
- package/dist/_esm/clients/decorators/bundler/getGasFeeValues.js +77 -0
- package/dist/_esm/clients/decorators/bundler/getGasFeeValues.js.map +1 -0
- package/dist/_esm/clients/decorators/bundler/index.js +7 -0
- package/dist/_esm/clients/decorators/bundler/index.js.map +1 -0
- package/dist/_esm/clients/decorators/bundler/waitForUserOperationReceipt.js +8 -0
- package/dist/_esm/clients/decorators/bundler/waitForUserOperationReceipt.js.map +1 -0
- package/dist/_esm/clients/decorators/erc7579/accountId.js +77 -0
- package/dist/_esm/clients/decorators/erc7579/accountId.js.map +1 -0
- package/dist/_esm/clients/decorators/erc7579/getActiveHook.js +52 -0
- package/dist/_esm/clients/decorators/erc7579/getActiveHook.js.map +1 -0
- package/dist/_esm/clients/decorators/erc7579/getFallbackBySelector.js +67 -0
- package/dist/_esm/clients/decorators/erc7579/getFallbackBySelector.js.map +1 -0
- package/dist/_esm/clients/decorators/erc7579/getInstalledExecutors.js +74 -0
- package/dist/_esm/clients/decorators/erc7579/getInstalledExecutors.js.map +1 -0
- package/dist/_esm/clients/decorators/erc7579/getInstalledValidators.js +72 -0
- package/dist/_esm/clients/decorators/erc7579/getInstalledValidators.js.map +1 -0
- package/dist/_esm/clients/decorators/erc7579/getPreviousModule.js +54 -0
- package/dist/_esm/clients/decorators/erc7579/getPreviousModule.js.map +1 -0
- package/dist/_esm/clients/decorators/erc7579/index.js +48 -0
- package/dist/_esm/clients/decorators/erc7579/index.js.map +1 -0
- package/dist/_esm/clients/decorators/erc7579/installModule.js +115 -0
- package/dist/_esm/clients/decorators/erc7579/installModule.js.map +1 -0
- package/dist/_esm/clients/decorators/erc7579/installModules.js +41 -0
- package/dist/_esm/clients/decorators/erc7579/installModules.js.map +1 -0
- package/dist/_esm/clients/decorators/erc7579/isModuleInstalled.js +106 -0
- package/dist/_esm/clients/decorators/erc7579/isModuleInstalled.js.map +1 -0
- package/dist/_esm/clients/decorators/erc7579/supportsExecutionMode.js +120 -0
- package/dist/_esm/clients/decorators/erc7579/supportsExecutionMode.js.map +1 -0
- package/dist/_esm/clients/decorators/erc7579/supportsModule.js +108 -0
- package/dist/_esm/clients/decorators/erc7579/supportsModule.js.map +1 -0
- package/dist/_esm/clients/decorators/erc7579/uninstallFallback.js +76 -0
- package/dist/_esm/clients/decorators/erc7579/uninstallFallback.js.map +1 -0
- package/dist/_esm/clients/decorators/erc7579/uninstallModule.js +94 -0
- package/dist/_esm/clients/decorators/erc7579/uninstallModule.js.map +1 -0
- package/dist/_esm/clients/decorators/erc7579/uninstallModules.js +42 -0
- package/dist/_esm/clients/decorators/erc7579/uninstallModules.js.map +1 -0
- package/dist/_esm/clients/decorators/index.js +5 -0
- package/dist/_esm/clients/decorators/index.js.map +1 -0
- package/dist/_esm/clients/decorators/smartAccount/debugUserOperation.js +105 -0
- package/dist/_esm/clients/decorators/smartAccount/debugUserOperation.js.map +1 -0
- package/dist/_esm/clients/decorators/smartAccount/index.js +28 -0
- package/dist/_esm/clients/decorators/smartAccount/index.js.map +1 -0
- package/dist/_esm/clients/decorators/smartAccount/prepareTokenPaymasterUserOp.js +60 -0
- package/dist/_esm/clients/decorators/smartAccount/prepareTokenPaymasterUserOp.js.map +1 -0
- package/dist/_esm/clients/decorators/smartAccount/prepareUserOperationWithoutSignature.js +36 -0
- package/dist/_esm/clients/decorators/smartAccount/prepareUserOperationWithoutSignature.js.map +1 -0
- package/dist/_esm/clients/decorators/smartAccount/sendTokenPaymasterUserOp.js +43 -0
- package/dist/_esm/clients/decorators/smartAccount/sendTokenPaymasterUserOp.js.map +1 -0
- package/dist/_esm/clients/decorators/smartAccount/sendTransaction.js +57 -0
- package/dist/_esm/clients/decorators/smartAccount/sendTransaction.js.map +1 -0
- package/dist/_esm/clients/decorators/smartAccount/signMessage.js +30 -0
- package/dist/_esm/clients/decorators/smartAccount/signMessage.js.map +1 -0
- package/dist/_esm/clients/decorators/smartAccount/signTypedData.js +82 -0
- package/dist/_esm/clients/decorators/smartAccount/signTypedData.js.map +1 -0
- package/dist/_esm/clients/decorators/smartAccount/upgradeSmartAccount.js +75 -0
- package/dist/_esm/clients/decorators/smartAccount/upgradeSmartAccount.js.map +1 -0
- package/dist/_esm/clients/decorators/smartAccount/waitForTransactionReceipt.js +14 -0
- package/dist/_esm/clients/decorators/smartAccount/waitForTransactionReceipt.js.map +1 -0
- package/dist/_esm/clients/decorators/smartAccount/writeContract.js +40 -0
- package/dist/_esm/clients/decorators/smartAccount/writeContract.js.map +1 -0
- package/dist/_esm/clients/decorators/tokenPaymaster/getSupportedTokens.js +35 -0
- package/dist/_esm/clients/decorators/tokenPaymaster/getSupportedTokens.js.map +1 -0
- package/dist/_esm/clients/decorators/tokenPaymaster/getTokenPaymasterQuotes.js +120 -0
- package/dist/_esm/clients/decorators/tokenPaymaster/getTokenPaymasterQuotes.js.map +1 -0
- package/dist/_esm/clients/decorators/tokenPaymaster/index.js +63 -0
- package/dist/_esm/clients/decorators/tokenPaymaster/index.js.map +1 -0
- package/dist/_esm/clients/index.js +5 -0
- package/dist/_esm/clients/index.js.map +1 -0
- package/dist/_esm/constants/abi/AccountFactory.js +334 -0
- package/dist/_esm/constants/abi/AccountFactory.js.map +1 -0
- package/dist/_esm/constants/abi/AccountImplementationAbi.js +1176 -0
- package/dist/_esm/constants/abi/AccountImplementationAbi.js.map +1 -0
- package/dist/_esm/constants/abi/BootstrapAbi.js +727 -0
- package/dist/_esm/constants/abi/BootstrapAbi.js.map +1 -0
- package/dist/_esm/constants/abi/ComposabilityAbi.js +271 -0
- package/dist/_esm/constants/abi/ComposabilityAbi.js.map +1 -0
- package/dist/_esm/constants/abi/EIP1271Abi.js +28 -0
- package/dist/_esm/constants/abi/EIP1271Abi.js.map +1 -0
- package/dist/_esm/constants/abi/ERC7484RegistryAbi.js +14 -0
- package/dist/_esm/constants/abi/ERC7484RegistryAbi.js.map +1 -0
- package/dist/_esm/constants/abi/EntryPointABI.js +658 -0
- package/dist/_esm/constants/abi/EntryPointABI.js.map +1 -0
- package/dist/_esm/constants/abi/SmartSessionAbi.js +1469 -0
- package/dist/_esm/constants/abi/SmartSessionAbi.js.map +1 -0
- package/dist/_esm/constants/abi/TokenWithPermitAbi.js +619 -0
- package/dist/_esm/constants/abi/TokenWithPermitAbi.js.map +1 -0
- package/dist/_esm/constants/abi/UniActionPolicyAbi.js +59 -0
- package/dist/_esm/constants/abi/UniActionPolicyAbi.js.map +1 -0
- package/dist/_esm/constants/abi/UniswapSwapRouterAbi.js +483 -0
- package/dist/_esm/constants/abi/UniswapSwapRouterAbi.js.map +1 -0
- package/dist/_esm/constants/abi/index.js +11 -0
- package/dist/_esm/constants/abi/index.js.map +1 -0
- package/dist/_esm/constants/index.js +38 -0
- package/dist/_esm/constants/index.js.map +1 -0
- package/dist/_esm/index.js +12 -0
- package/dist/_esm/index.js.map +1 -0
- package/dist/_esm/modules/index.js +6 -0
- package/dist/_esm/modules/index.js.map +1 -0
- package/dist/_esm/modules/toEmptyExecutor.js +6 -0
- package/dist/_esm/modules/toEmptyExecutor.js.map +1 -0
- package/dist/_esm/modules/toEmptyHook.js +6 -0
- package/dist/_esm/modules/toEmptyHook.js.map +1 -0
- package/dist/_esm/modules/utils/Helpers.js +81 -0
- package/dist/_esm/modules/utils/Helpers.js.map +1 -0
- package/dist/_esm/modules/utils/Types.js +12 -0
- package/dist/_esm/modules/utils/Types.js.map +1 -0
- package/dist/_esm/modules/utils/Uid.js +11 -0
- package/dist/_esm/modules/utils/Uid.js.map +1 -0
- package/dist/_esm/modules/utils/composabilityCalls.js +127 -0
- package/dist/_esm/modules/utils/composabilityCalls.js.map +1 -0
- package/dist/_esm/modules/utils/index.js +6 -0
- package/dist/_esm/modules/utils/index.js.map +1 -0
- package/dist/_esm/modules/utils/runtimeAbiEncoding.js +365 -0
- package/dist/_esm/modules/utils/runtimeAbiEncoding.js.map +1 -0
- package/dist/_esm/modules/utils/toModule.js +61 -0
- package/dist/_esm/modules/utils/toModule.js.map +1 -0
- package/dist/_esm/modules/validators/default/index.js +2 -0
- package/dist/_esm/modules/validators/default/index.js.map +1 -0
- package/dist/_esm/modules/validators/default/toDefaultModule.js +14 -0
- package/dist/_esm/modules/validators/default/toDefaultModule.js.map +1 -0
- package/dist/_esm/modules/validators/index.js +6 -0
- package/dist/_esm/modules/validators/index.js.map +1 -0
- package/dist/_esm/modules/validators/ownable/decorators/addOwner.js +56 -0
- package/dist/_esm/modules/validators/ownable/decorators/addOwner.js.map +1 -0
- package/dist/_esm/modules/validators/ownable/decorators/getAddOwnerTx.js +50 -0
- package/dist/_esm/modules/validators/ownable/decorators/getAddOwnerTx.js.map +1 -0
- package/dist/_esm/modules/validators/ownable/decorators/getOwners.js +38 -0
- package/dist/_esm/modules/validators/ownable/decorators/getOwners.js.map +1 -0
- package/dist/_esm/modules/validators/ownable/decorators/getRemoveOwnerTx.js +50 -0
- package/dist/_esm/modules/validators/ownable/decorators/getRemoveOwnerTx.js.map +1 -0
- package/dist/_esm/modules/validators/ownable/decorators/getSetThresholdTx.js +48 -0
- package/dist/_esm/modules/validators/ownable/decorators/getSetThresholdTx.js.map +1 -0
- package/dist/_esm/modules/validators/ownable/decorators/getThreshold.js +54 -0
- package/dist/_esm/modules/validators/ownable/decorators/getThreshold.js.map +1 -0
- package/dist/_esm/modules/validators/ownable/decorators/index.js +57 -0
- package/dist/_esm/modules/validators/ownable/decorators/index.js.map +1 -0
- package/dist/_esm/modules/validators/ownable/decorators/multiSign.js +22 -0
- package/dist/_esm/modules/validators/ownable/decorators/multiSign.js.map +1 -0
- package/dist/_esm/modules/validators/ownable/decorators/prepareForMultiSign.js +21 -0
- package/dist/_esm/modules/validators/ownable/decorators/prepareForMultiSign.js.map +1 -0
- package/dist/_esm/modules/validators/ownable/decorators/removeOwner.js +66 -0
- package/dist/_esm/modules/validators/ownable/decorators/removeOwner.js.map +1 -0
- package/dist/_esm/modules/validators/ownable/decorators/setThreshold.js +62 -0
- package/dist/_esm/modules/validators/ownable/decorators/setThreshold.js.map +1 -0
- package/dist/_esm/modules/validators/ownable/index.js +3 -0
- package/dist/_esm/modules/validators/ownable/index.js.map +1 -0
- package/dist/_esm/modules/validators/ownable/toOwnableModule.js +38 -0
- package/dist/_esm/modules/validators/ownable/toOwnableModule.js.map +1 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/Helpers.js +181 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/Helpers.js.map +1 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/Types.js +13 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/Types.js.map +1 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/decorators/grantPermission.js +80 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/decorators/grantPermission.js.map +1 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/decorators/index.js +37 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/decorators/index.js.map +1 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/decorators/preparePermission.js +214 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/decorators/preparePermission.js.map +1 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/decorators/revokeSession.js +67 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/decorators/revokeSession.js.map +1 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/decorators/usePermission.js +47 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/decorators/usePermission.js.map +1 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/index.js +5 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/index.js.map +1 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/toSmartSessionsValidator.js +82 -0
- package/dist/_esm/modules/validators/smartSessionsValidator/toSmartSessionsValidator.js.map +1 -0
- package/dist/_esm/modules/validators/toValidator.js +17 -0
- package/dist/_esm/modules/validators/toValidator.js.map +1 -0
- package/dist/_esm/package.json +1 -0
- package/dist/_types/account/decorators/getFactoryData.d.ts +25 -0
- package/dist/_types/account/decorators/getFactoryData.d.ts.map +1 -0
- package/dist/_types/account/decorators/getStartaleAccountAddress.d.ts +33 -0
- package/dist/_types/account/decorators/getStartaleAccountAddress.d.ts.map +1 -0
- package/dist/_types/account/decorators/index.d.ts +3 -0
- package/dist/_types/account/decorators/index.d.ts.map +1 -0
- package/dist/_types/account/index.d.ts +3 -0
- package/dist/_types/account/index.d.ts.map +1 -0
- package/dist/_types/account/toStartaleSmartAccount.d.ts +120 -0
- package/dist/_types/account/toStartaleSmartAccount.d.ts.map +1 -0
- package/dist/_types/account/utils/AccountNotFound.d.ts +10 -0
- package/dist/_types/account/utils/AccountNotFound.d.ts.map +1 -0
- package/dist/_types/account/utils/Constants.d.ts +73 -0
- package/dist/_types/account/utils/Constants.d.ts.map +1 -0
- package/dist/_types/account/utils/Helpers.d.ts +21 -0
- package/dist/_types/account/utils/Helpers.d.ts.map +1 -0
- package/dist/_types/account/utils/Logger.d.ts +20 -0
- package/dist/_types/account/utils/Logger.d.ts.map +1 -0
- package/dist/_types/account/utils/Types.d.ts +94 -0
- package/dist/_types/account/utils/Types.d.ts.map +1 -0
- package/dist/_types/account/utils/Utils.d.ts +129 -0
- package/dist/_types/account/utils/Utils.d.ts.map +1 -0
- package/dist/_types/account/utils/addressToEmptyAccount.d.ts +4 -0
- package/dist/_types/account/utils/addressToEmptyAccount.d.ts.map +1 -0
- package/dist/_types/account/utils/contractSimulation.d.ts +801 -0
- package/dist/_types/account/utils/contractSimulation.d.ts.map +1 -0
- package/dist/_types/account/utils/deepHexlify.d.ts +41 -0
- package/dist/_types/account/utils/deepHexlify.d.ts.map +1 -0
- package/dist/_types/account/utils/eip7702Utils.d.ts +4 -0
- package/dist/_types/account/utils/eip7702Utils.d.ts.map +1 -0
- package/dist/_types/account/utils/fromBundlerClient.d.ts +50 -0
- package/dist/_types/account/utils/fromBundlerClient.d.ts.map +1 -0
- package/dist/_types/account/utils/getAAError.d.ts +17 -0
- package/dist/_types/account/utils/getAAError.d.ts.map +1 -0
- package/dist/_types/account/utils/getChain.d.ts +64 -0
- package/dist/_types/account/utils/getChain.d.ts.map +1 -0
- package/dist/_types/account/utils/getVersion.d.ts +135 -0
- package/dist/_types/account/utils/getVersion.d.ts.map +1 -0
- package/dist/_types/account/utils/index.d.ts +20 -0
- package/dist/_types/account/utils/index.d.ts.map +1 -0
- package/dist/_types/account/utils/parseErrorMessage.d.ts +2 -0
- package/dist/_types/account/utils/parseErrorMessage.d.ts.map +1 -0
- package/dist/_types/account/utils/tenderlySimulation.d.ts +13 -0
- package/dist/_types/account/utils/tenderlySimulation.d.ts.map +1 -0
- package/dist/_types/account/utils/toInitData.d.ts +12 -0
- package/dist/_types/account/utils/toInitData.d.ts.map +1 -0
- package/dist/_types/account/utils/toInstallData.d.ts +8 -0
- package/dist/_types/account/utils/toInstallData.d.ts.map +1 -0
- package/dist/_types/account/utils/toSigner.d.ts +26 -0
- package/dist/_types/account/utils/toSigner.d.ts.map +1 -0
- package/dist/_types/clients/createHttpClient.d.ts +44 -0
- package/dist/_types/clients/createHttpClient.d.ts.map +1 -0
- package/dist/_types/clients/createSCSBundlerClient.d.ts +66 -0
- package/dist/_types/clients/createSCSBundlerClient.d.ts.map +1 -0
- package/dist/_types/clients/createSCSPaymasterClient.d.ts +70 -0
- package/dist/_types/clients/createSCSPaymasterClient.d.ts.map +1 -0
- package/dist/_types/clients/decorators/bundler/getGasFeeValues.d.ts +51 -0
- package/dist/_types/clients/decorators/bundler/getGasFeeValues.d.ts.map +1 -0
- package/dist/_types/clients/decorators/bundler/index.d.ts +43 -0
- package/dist/_types/clients/decorators/bundler/index.d.ts.map +1 -0
- package/dist/_types/clients/decorators/bundler/waitForUserOperationReceipt.d.ts +5 -0
- package/dist/_types/clients/decorators/bundler/waitForUserOperationReceipt.d.ts.map +1 -0
- package/dist/_types/clients/decorators/erc7579/accountId.d.ts +21 -0
- package/dist/_types/clients/decorators/erc7579/accountId.d.ts.map +1 -0
- package/dist/_types/clients/decorators/erc7579/getActiveHook.d.ts +35 -0
- package/dist/_types/clients/decorators/erc7579/getActiveHook.d.ts.map +1 -0
- package/dist/_types/clients/decorators/erc7579/getFallbackBySelector.d.ts +43 -0
- package/dist/_types/clients/decorators/erc7579/getFallbackBySelector.d.ts.map +1 -0
- package/dist/_types/clients/decorators/erc7579/getInstalledExecutors.d.ts +52 -0
- package/dist/_types/clients/decorators/erc7579/getInstalledExecutors.d.ts.map +1 -0
- package/dist/_types/clients/decorators/erc7579/getInstalledValidators.d.ts +52 -0
- package/dist/_types/clients/decorators/erc7579/getInstalledValidators.d.ts.map +1 -0
- package/dist/_types/clients/decorators/erc7579/getPreviousModule.d.ts +32 -0
- package/dist/_types/clients/decorators/erc7579/getPreviousModule.d.ts.map +1 -0
- package/dist/_types/clients/decorators/erc7579/index.d.ts +165 -0
- package/dist/_types/clients/decorators/erc7579/index.d.ts.map +1 -0
- package/dist/_types/clients/decorators/erc7579/installModule.d.ts +36 -0
- package/dist/_types/clients/decorators/erc7579/installModule.d.ts.map +1 -0
- package/dist/_types/clients/decorators/erc7579/installModules.d.ts +36 -0
- package/dist/_types/clients/decorators/erc7579/installModules.d.ts.map +1 -0
- package/dist/_types/clients/decorators/erc7579/isModuleInstalled.d.ts +54 -0
- package/dist/_types/clients/decorators/erc7579/isModuleInstalled.d.ts.map +1 -0
- package/dist/_types/clients/decorators/erc7579/supportsExecutionMode.d.ts +54 -0
- package/dist/_types/clients/decorators/erc7579/supportsExecutionMode.d.ts.map +1 -0
- package/dist/_types/clients/decorators/erc7579/supportsModule.d.ts +48 -0
- package/dist/_types/clients/decorators/erc7579/supportsModule.d.ts.map +1 -0
- package/dist/_types/clients/decorators/erc7579/uninstallFallback.d.ts +35 -0
- package/dist/_types/clients/decorators/erc7579/uninstallFallback.d.ts.map +1 -0
- package/dist/_types/clients/decorators/erc7579/uninstallModule.d.ts +35 -0
- package/dist/_types/clients/decorators/erc7579/uninstallModule.d.ts.map +1 -0
- package/dist/_types/clients/decorators/erc7579/uninstallModules.d.ts +32 -0
- package/dist/_types/clients/decorators/erc7579/uninstallModules.d.ts.map +1 -0
- package/dist/_types/clients/decorators/index.d.ts +5 -0
- package/dist/_types/clients/decorators/index.d.ts.map +1 -0
- package/dist/_types/clients/decorators/smartAccount/debugUserOperation.d.ts +35 -0
- package/dist/_types/clients/decorators/smartAccount/debugUserOperation.d.ts.map +1 -0
- package/dist/_types/clients/decorators/smartAccount/index.d.ts +315 -0
- package/dist/_types/clients/decorators/smartAccount/index.d.ts.map +1 -0
- package/dist/_types/clients/decorators/smartAccount/prepareTokenPaymasterUserOp.d.ts +52 -0
- package/dist/_types/clients/decorators/smartAccount/prepareTokenPaymasterUserOp.d.ts.map +1 -0
- package/dist/_types/clients/decorators/smartAccount/prepareUserOperationWithoutSignature.d.ts +16 -0
- package/dist/_types/clients/decorators/smartAccount/prepareUserOperationWithoutSignature.d.ts.map +1 -0
- package/dist/_types/clients/decorators/smartAccount/sendTokenPaymasterUserOp.d.ts +36 -0
- package/dist/_types/clients/decorators/smartAccount/sendTokenPaymasterUserOp.d.ts.map +1 -0
- package/dist/_types/clients/decorators/smartAccount/sendTransaction.d.ts +23 -0
- package/dist/_types/clients/decorators/smartAccount/sendTransaction.d.ts.map +1 -0
- package/dist/_types/clients/decorators/smartAccount/signMessage.d.ts +23 -0
- package/dist/_types/clients/decorators/smartAccount/signMessage.d.ts.map +1 -0
- package/dist/_types/clients/decorators/smartAccount/signTypedData.d.ts +60 -0
- package/dist/_types/clients/decorators/smartAccount/signTypedData.d.ts.map +1 -0
- package/dist/_types/clients/decorators/smartAccount/upgradeSmartAccount.d.ts +40 -0
- package/dist/_types/clients/decorators/smartAccount/upgradeSmartAccount.d.ts.map +1 -0
- package/dist/_types/clients/decorators/smartAccount/waitForTransactionReceipt.d.ts +6 -0
- package/dist/_types/clients/decorators/smartAccount/waitForTransactionReceipt.d.ts.map +1 -0
- package/dist/_types/clients/decorators/smartAccount/writeContract.d.ts +27 -0
- package/dist/_types/clients/decorators/smartAccount/writeContract.d.ts.map +1 -0
- package/dist/_types/clients/decorators/tokenPaymaster/getSupportedTokens.d.ts +16 -0
- package/dist/_types/clients/decorators/tokenPaymaster/getSupportedTokens.d.ts.map +1 -0
- package/dist/_types/clients/decorators/tokenPaymaster/getTokenPaymasterQuotes.d.ts +93 -0
- package/dist/_types/clients/decorators/tokenPaymaster/getTokenPaymasterQuotes.d.ts.map +1 -0
- package/dist/_types/clients/decorators/tokenPaymaster/index.d.ts +65 -0
- package/dist/_types/clients/decorators/tokenPaymaster/index.d.ts.map +1 -0
- package/dist/_types/clients/index.d.ts +5 -0
- package/dist/_types/clients/index.d.ts.map +1 -0
- package/dist/_types/constants/abi/AccountFactory.d.ts +259 -0
- package/dist/_types/constants/abi/AccountFactory.d.ts.map +1 -0
- package/dist/_types/constants/abi/AccountImplementationAbi.d.ts +903 -0
- package/dist/_types/constants/abi/AccountImplementationAbi.d.ts.map +1 -0
- package/dist/_types/constants/abi/BootstrapAbi.d.ts +554 -0
- package/dist/_types/constants/abi/BootstrapAbi.d.ts.map +1 -0
- package/dist/_types/constants/abi/ComposabilityAbi.d.ts +67 -0
- package/dist/_types/constants/abi/ComposabilityAbi.d.ts.map +1 -0
- package/dist/_types/constants/abi/EIP1271Abi.d.ts +54 -0
- package/dist/_types/constants/abi/EIP1271Abi.d.ts.map +1 -0
- package/dist/_types/constants/abi/ERC7484RegistryAbi.d.ts +16 -0
- package/dist/_types/constants/abi/ERC7484RegistryAbi.d.ts.map +1 -0
- package/dist/_types/constants/abi/EntryPointABI.d.ts +776 -0
- package/dist/_types/constants/abi/EntryPointABI.d.ts.map +1 -0
- package/dist/_types/constants/abi/SmartSessionAbi.d.ts +90 -0
- package/dist/_types/constants/abi/SmartSessionAbi.d.ts.map +1 -0
- package/dist/_types/constants/abi/TokenWithPermitAbi.d.ts +477 -0
- package/dist/_types/constants/abi/TokenWithPermitAbi.d.ts.map +1 -0
- package/dist/_types/constants/abi/UniActionPolicyAbi.d.ts +33 -0
- package/dist/_types/constants/abi/UniActionPolicyAbi.d.ts.map +1 -0
- package/dist/_types/constants/abi/UniswapSwapRouterAbi.d.ts +821 -0
- package/dist/_types/constants/abi/UniswapSwapRouterAbi.d.ts.map +1 -0
- package/dist/_types/constants/abi/index.d.ts +11 -0
- package/dist/_types/constants/abi/index.d.ts.map +1 -0
- package/dist/_types/constants/index.d.ts +20 -0
- package/dist/_types/constants/index.d.ts.map +1 -0
- package/dist/_types/index.d.ts +7 -0
- package/dist/_types/index.d.ts.map +1 -0
- package/dist/_types/modules/index.d.ts +6 -0
- package/dist/_types/modules/index.d.ts.map +1 -0
- package/dist/_types/modules/toEmptyExecutor.d.ts +3 -0
- package/dist/_types/modules/toEmptyExecutor.d.ts.map +1 -0
- package/dist/_types/modules/toEmptyHook.d.ts +3 -0
- package/dist/_types/modules/toEmptyHook.d.ts.map +1 -0
- package/dist/_types/modules/utils/Helpers.d.ts +48 -0
- package/dist/_types/modules/utils/Helpers.d.ts.map +1 -0
- package/dist/_types/modules/utils/Types.d.ts +103 -0
- package/dist/_types/modules/utils/Types.d.ts.map +1 -0
- package/dist/_types/modules/utils/Uid.d.ts +2 -0
- package/dist/_types/modules/utils/Uid.d.ts.map +1 -0
- package/dist/_types/modules/utils/composabilityCalls.d.ts +63 -0
- package/dist/_types/modules/utils/composabilityCalls.d.ts.map +1 -0
- package/dist/_types/modules/utils/index.d.ts +6 -0
- package/dist/_types/modules/utils/index.d.ts.map +1 -0
- package/dist/_types/modules/utils/runtimeAbiEncoding.d.ts +18 -0
- package/dist/_types/modules/utils/runtimeAbiEncoding.d.ts.map +1 -0
- package/dist/_types/modules/utils/toModule.d.ts +28 -0
- package/dist/_types/modules/utils/toModule.d.ts.map +1 -0
- package/dist/_types/modules/validators/default/index.d.ts +2 -0
- package/dist/_types/modules/validators/default/index.d.ts.map +1 -0
- package/dist/_types/modules/validators/default/toDefaultModule.d.ts +3 -0
- package/dist/_types/modules/validators/default/toDefaultModule.d.ts.map +1 -0
- package/dist/_types/modules/validators/index.d.ts +6 -0
- package/dist/_types/modules/validators/index.d.ts.map +1 -0
- package/dist/_types/modules/validators/ownable/decorators/addOwner.d.ts +36 -0
- package/dist/_types/modules/validators/ownable/decorators/addOwner.d.ts.map +1 -0
- package/dist/_types/modules/validators/ownable/decorators/getAddOwnerTx.d.ts +30 -0
- package/dist/_types/modules/validators/ownable/decorators/getAddOwnerTx.d.ts.map +1 -0
- package/dist/_types/modules/validators/ownable/decorators/getOwners.d.ts +25 -0
- package/dist/_types/modules/validators/ownable/decorators/getOwners.d.ts.map +1 -0
- package/dist/_types/modules/validators/ownable/decorators/getRemoveOwnerTx.d.ts +30 -0
- package/dist/_types/modules/validators/ownable/decorators/getRemoveOwnerTx.d.ts.map +1 -0
- package/dist/_types/modules/validators/ownable/decorators/getSetThresholdTx.d.ts +39 -0
- package/dist/_types/modules/validators/ownable/decorators/getSetThresholdTx.d.ts.map +1 -0
- package/dist/_types/modules/validators/ownable/decorators/getThreshold.d.ts +40 -0
- package/dist/_types/modules/validators/ownable/decorators/getThreshold.d.ts.map +1 -0
- package/dist/_types/modules/validators/ownable/decorators/index.d.ts +37 -0
- package/dist/_types/modules/validators/ownable/decorators/index.d.ts.map +1 -0
- package/dist/_types/modules/validators/ownable/decorators/multiSign.d.ts +11 -0
- package/dist/_types/modules/validators/ownable/decorators/multiSign.d.ts.map +1 -0
- package/dist/_types/modules/validators/ownable/decorators/prepareForMultiSign.d.ts +25 -0
- package/dist/_types/modules/validators/ownable/decorators/prepareForMultiSign.d.ts.map +1 -0
- package/dist/_types/modules/validators/ownable/decorators/removeOwner.d.ts +47 -0
- package/dist/_types/modules/validators/ownable/decorators/removeOwner.d.ts.map +1 -0
- package/dist/_types/modules/validators/ownable/decorators/setThreshold.d.ts +51 -0
- package/dist/_types/modules/validators/ownable/decorators/setThreshold.d.ts.map +1 -0
- package/dist/_types/modules/validators/ownable/index.d.ts +3 -0
- package/dist/_types/modules/validators/ownable/index.d.ts.map +1 -0
- package/dist/_types/modules/validators/ownable/toOwnableModule.d.ts +44 -0
- package/dist/_types/modules/validators/ownable/toOwnableModule.d.ts.map +1 -0
- package/dist/_types/modules/validators/smartSessionsValidator/Helpers.d.ts +98 -0
- package/dist/_types/modules/validators/smartSessionsValidator/Helpers.d.ts.map +1 -0
- package/dist/_types/modules/validators/smartSessionsValidator/Types.d.ts +262 -0
- package/dist/_types/modules/validators/smartSessionsValidator/Types.d.ts.map +1 -0
- package/dist/_types/modules/validators/smartSessionsValidator/decorators/grantPermission.d.ts +73 -0
- package/dist/_types/modules/validators/smartSessionsValidator/decorators/grantPermission.d.ts.map +1 -0
- package/dist/_types/modules/validators/smartSessionsValidator/decorators/index.d.ts +79 -0
- package/dist/_types/modules/validators/smartSessionsValidator/decorators/index.d.ts.map +1 -0
- package/dist/_types/modules/validators/smartSessionsValidator/decorators/preparePermission.d.ts +81 -0
- package/dist/_types/modules/validators/smartSessionsValidator/decorators/preparePermission.d.ts.map +1 -0
- package/dist/_types/modules/validators/smartSessionsValidator/decorators/revokeSession.d.ts +55 -0
- package/dist/_types/modules/validators/smartSessionsValidator/decorators/revokeSession.d.ts.map +1 -0
- package/dist/_types/modules/validators/smartSessionsValidator/decorators/usePermission.d.ts +63 -0
- package/dist/_types/modules/validators/smartSessionsValidator/decorators/usePermission.d.ts.map +1 -0
- package/dist/_types/modules/validators/smartSessionsValidator/index.d.ts +5 -0
- package/dist/_types/modules/validators/smartSessionsValidator/index.d.ts.map +1 -0
- package/dist/_types/modules/validators/smartSessionsValidator/toSmartSessionsValidator.d.ts +65 -0
- package/dist/_types/modules/validators/smartSessionsValidator/toSmartSessionsValidator.d.ts.map +1 -0
- package/dist/_types/modules/validators/toValidator.d.ts +45 -0
- package/dist/_types/modules/validators/toValidator.d.ts.map +1 -0
- package/package.json +134 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { getAddress, toBytes, toFunctionSelector, toHex } from "viem";
|
|
2
|
+
import { OWNABLE_VALIDATOR_ADDRESS, REGISTRY_ADDRESS, encodeValidationData } from "../../../constants/index.js";
|
|
3
|
+
import { ERC7484RegistryAbi } from "../../../constants/abi/index.js";
|
|
4
|
+
import { parseReferenceValue } from "../../utils/Helpers.js";
|
|
5
|
+
import { ONE_YEAR_FROM_NOW_IN_SECONDS } from "./decorators/preparePermission.js";
|
|
6
|
+
export const MAX_RULES = 16;
|
|
7
|
+
export const DUMMY_SIGNATURE = "0x81d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b";
|
|
8
|
+
/**
|
|
9
|
+
* Generates a random salt as a hexadecimal string.
|
|
10
|
+
*
|
|
11
|
+
* @returns A 32-byte hexadecimal string prefixed with '0x'.
|
|
12
|
+
*/
|
|
13
|
+
export const generateSalt = () => {
|
|
14
|
+
const randomBytes = new Uint8Array(32);
|
|
15
|
+
crypto.getRandomValues(randomBytes);
|
|
16
|
+
return `0x${Array.from(randomBytes, (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Creates an ActionConfig object from rules and a value limit.
|
|
20
|
+
*
|
|
21
|
+
* @param rules - An array of Rule objects.
|
|
22
|
+
* @param valueLimit - The maximum value allowed for the action.
|
|
23
|
+
* @returns An ActionConfig object.
|
|
24
|
+
*/
|
|
25
|
+
export const createActionConfig = (rules, valueLimit = 0n) => ({
|
|
26
|
+
paramRules: {
|
|
27
|
+
length: rules.length,
|
|
28
|
+
rules: rules
|
|
29
|
+
},
|
|
30
|
+
valueLimitPerUse: valueLimit
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* Applies default values to a CreateSessionDataParams object.
|
|
34
|
+
*
|
|
35
|
+
* @param sessionInfo - The CreateSessionDataParams object to apply defaults to.
|
|
36
|
+
* @returns A FullCreateSessionDataParams object with default values applied.
|
|
37
|
+
*/
|
|
38
|
+
export const applyDefaults = (sessionInfo) => {
|
|
39
|
+
const sessionKeyData = sessionInfo.sessionKeyData ?? toHex(toBytes(sessionInfo.sessionPublicKey));
|
|
40
|
+
const sessionPublicKey = sessionInfo.sessionPublicKey ?? sessionKeyData;
|
|
41
|
+
return {
|
|
42
|
+
...sessionInfo,
|
|
43
|
+
sessionKeyData,
|
|
44
|
+
sessionPublicKey,
|
|
45
|
+
sessionValidUntil: sessionInfo.sessionValidUntil ?? ONE_YEAR_FROM_NOW_IN_SECONDS,
|
|
46
|
+
sessionValidAfter: sessionInfo.sessionValidAfter ?? 0,
|
|
47
|
+
sessionValidator: sessionInfo.sessionValidator ?? OWNABLE_VALIDATOR_ADDRESS,
|
|
48
|
+
sessionValidatorInitData: sessionInfo.sessionValidatorInitData ??
|
|
49
|
+
encodeValidationData({
|
|
50
|
+
threshold: 1,
|
|
51
|
+
owners: [getAddress(sessionPublicKey)]
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Creates an ActionData object.
|
|
57
|
+
*
|
|
58
|
+
* @param contractAddress - The address of the contract.
|
|
59
|
+
* @param functionSelector - The function selector or AbiFunction.
|
|
60
|
+
* @param policies - An array of PolicyData objects.
|
|
61
|
+
* @returns An ActionData object.
|
|
62
|
+
*/
|
|
63
|
+
export const createActionData = (contractAddress, functionSelector, policies) => {
|
|
64
|
+
return {
|
|
65
|
+
actionTarget: contractAddress,
|
|
66
|
+
actionTargetSelector: (typeof functionSelector === "string"
|
|
67
|
+
? functionSelector
|
|
68
|
+
: functionSelector.name),
|
|
69
|
+
actionPolicies: policies
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Converts an ActionConfig to a RawActionConfig.
|
|
74
|
+
*
|
|
75
|
+
* @param config - The ActionConfig to convert.
|
|
76
|
+
* @returns A ActionConfigFromUpstream object.
|
|
77
|
+
*/
|
|
78
|
+
export const toActionConfig = (config) => {
|
|
79
|
+
// Ensure we always have 16 rules, filling with default values if necessary
|
|
80
|
+
const filledRules = [...config.paramRules.rules];
|
|
81
|
+
// Fill the rest with default ParamRule if the length is less than 16
|
|
82
|
+
while (filledRules.length < MAX_RULES) {
|
|
83
|
+
filledRules.push({
|
|
84
|
+
condition: 0, // Default condition (EQUAL)
|
|
85
|
+
offsetIndex: 0, // Default offset
|
|
86
|
+
isLimited: false, // Default isLimited flag
|
|
87
|
+
ref: "0x0000000000000000000000000000000000000000000000000000000000000000", // Default bytes32 ref
|
|
88
|
+
usage: {
|
|
89
|
+
limit: BigInt(0), // Default limit
|
|
90
|
+
used: BigInt(0) // Default used
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
valueLimitPerUse: BigInt(config.valueLimitPerUse),
|
|
96
|
+
paramRules: {
|
|
97
|
+
length: BigInt(config.paramRules.length),
|
|
98
|
+
rules: filledRules
|
|
99
|
+
.map((rule) => {
|
|
100
|
+
const parsedRef = parseReferenceValue(rule.ref);
|
|
101
|
+
return {
|
|
102
|
+
condition: rule.condition,
|
|
103
|
+
offset: rule.offsetIndex * 32,
|
|
104
|
+
isLimited: rule.isLimited,
|
|
105
|
+
ref: parsedRef,
|
|
106
|
+
usage: rule.usage
|
|
107
|
+
};
|
|
108
|
+
})
|
|
109
|
+
.concat(Array(MAX_RULES - filledRules.length).fill({
|
|
110
|
+
condition: 0,
|
|
111
|
+
offset: 0,
|
|
112
|
+
isLimited: false,
|
|
113
|
+
ref: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
114
|
+
usage: { limit: 0n, used: 0n }
|
|
115
|
+
}))
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Stringifies an object, explicitly tagging BigInt values.
|
|
121
|
+
*
|
|
122
|
+
* @param obj - The object to be stringified.
|
|
123
|
+
* @returns A string representing the stringified object with tagged BigInts.
|
|
124
|
+
*/
|
|
125
|
+
export function stringify(obj) {
|
|
126
|
+
return JSON.stringify(obj, (_, value) => typeof value === "bigint"
|
|
127
|
+
? { __type: "bigint", value: value.toString() }
|
|
128
|
+
: value);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Parses a string representation back into an object, correctly handling tagged BigInt values.
|
|
132
|
+
*
|
|
133
|
+
* @param data - The string representing the stringified object.
|
|
134
|
+
* @returns The parsed object with BigInt values restored.
|
|
135
|
+
*/
|
|
136
|
+
export function parse(data) {
|
|
137
|
+
return JSON.parse(data, (_, value) => {
|
|
138
|
+
if (value && typeof value === "object" && value.__type === "bigint") {
|
|
139
|
+
return BigInt(value.value);
|
|
140
|
+
}
|
|
141
|
+
return value;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
// Todo
|
|
145
|
+
// 1. find trusted attesters. why not just here instead of part of read decorators?
|
|
146
|
+
// 2. get trusteAttesters calldata. or returning the whole "Action"/Execution
|
|
147
|
+
/**
|
|
148
|
+
* Retrieves the list of trusted attesters for a given account from the registry.
|
|
149
|
+
*
|
|
150
|
+
* This function queries the registry contract to find all attesters that are trusted
|
|
151
|
+
* by the specified account.
|
|
152
|
+
*
|
|
153
|
+
* @param params - The parameters object
|
|
154
|
+
* @param params.account - The account to check trusted attesters for
|
|
155
|
+
* @param params.client - The public client used to interact with the blockchain
|
|
156
|
+
* @returns A promise that resolves to an array of addresses representing the trusted attesters
|
|
157
|
+
* @throws Will log error and return empty array if registry query fails
|
|
158
|
+
*/
|
|
159
|
+
export const getTrustedAttesters = async ({ accountAddress, client }) => {
|
|
160
|
+
try {
|
|
161
|
+
const attesters = (await client.readContract({
|
|
162
|
+
address: REGISTRY_ADDRESS,
|
|
163
|
+
abi: ERC7484RegistryAbi,
|
|
164
|
+
functionName: "findTrustedAttesters",
|
|
165
|
+
args: [accountAddress]
|
|
166
|
+
}));
|
|
167
|
+
return attesters;
|
|
168
|
+
}
|
|
169
|
+
catch (err) {
|
|
170
|
+
console.error(err);
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
export const abiToPoliciesInfo = ({ abi, ...actionPolicyInfo }) => (abi ?? [])
|
|
175
|
+
.filter((item) => item.type === "function")
|
|
176
|
+
.map((func) => ({
|
|
177
|
+
...actionPolicyInfo,
|
|
178
|
+
functionSelector: toFunctionSelector(func),
|
|
179
|
+
rules: [] // Rules should not be available here because they should be custom per method, not used in a loop
|
|
180
|
+
}));
|
|
181
|
+
//# sourceMappingURL=Helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Helpers.js","sourceRoot":"","sources":["../../../../../src/sdk/modules/validators/smartSessionsValidator/Helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,UAAU,EACV,OAAO,EACP,kBAAkB,EAClB,KAAK,EACN,MAAM,MAAM,CAAA;AACb,OAAO,EAEL,yBAAyB,EAEzB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAYzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAE7E,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,CAAA;A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B,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,OAAO;AACP,mFAAmF;AACnF,6EAA6E;AAE7E;;;;;;;;;;;GAWG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EAAE,EACxC,cAAc,EACd,MAAM,EAIP,EAAsB,EAAE;IACvB,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,CAAC,MAAM,MAAM,CAAC,YAAY,CAAC;YAC3C,OAAO,EAAE,gBAAgB;YACzB,GAAG,EAAE,kBAAkB;YACvB,YAAY,EAAE,sBAAsB;YACpC,IAAI,EAAE,CAAC,cAAc,CAAC;SACvB,CAAC,CAAc,CAAA;QAEhB,OAAO,SAAS,CAAA;IAClB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAClB,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC,CAAA;AA4BD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAChC,GAAG,EACH,GAAG,gBAAgB,EACK,EAA8B,EAAE,CACxD,CAAC,GAAG,IAAI,EAAE,CAAC;KACR,MAAM,CAAC,CAAC,IAAI,EAAuB,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC;KAC/D,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACd,GAAG,gBAAgB;IACnB,gBAAgB,EAAE,kBAAkB,CAAC,IAAI,CAAC;IAC1C,KAAK,EAAE,EAAE,CAAC,kGAAkG;CAC7G,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing different parameter conditions for rules.
|
|
3
|
+
*/
|
|
4
|
+
export var ParamCondition;
|
|
5
|
+
(function (ParamCondition) {
|
|
6
|
+
ParamCondition[ParamCondition["EQUAL"] = 0] = "EQUAL";
|
|
7
|
+
ParamCondition[ParamCondition["GREATER_THAN"] = 1] = "GREATER_THAN";
|
|
8
|
+
ParamCondition[ParamCondition["LESS_THAN"] = 2] = "LESS_THAN";
|
|
9
|
+
ParamCondition[ParamCondition["GREATER_THAN_OR_EQUAL"] = 3] = "GREATER_THAN_OR_EQUAL";
|
|
10
|
+
ParamCondition[ParamCondition["LESS_THAN_OR_EQUAL"] = 4] = "LESS_THAN_OR_EQUAL";
|
|
11
|
+
ParamCondition[ParamCondition["NOT_EQUAL"] = 5] = "NOT_EQUAL";
|
|
12
|
+
})(ParamCondition || (ParamCondition = {}));
|
|
13
|
+
//# sourceMappingURL=Types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Types.js","sourceRoot":"","sources":["../../../../../src/sdk/modules/validators/smartSessionsValidator/Types.ts"],"names":[],"mappings":"AAsLA;;GAEG;AACH,MAAM,CAAN,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,qDAAS,CAAA;IACT,mEAAgB,CAAA;IAChB,6DAAa,CAAA;IACb,qFAAyB,CAAA;IACzB,+EAAsB,CAAA;IACtB,6DAAa,CAAA;AACf,CAAC,EAPW,cAAc,KAAd,cAAc,QAOzB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { sendUserOperation } from "viem/account-abstraction";
|
|
2
|
+
import { getAction, parseAccount } from "viem/utils";
|
|
3
|
+
import { AccountNotFoundError } from "../../../../account/utils/AccountNotFound.js";
|
|
4
|
+
import { preparePermission } from "./preparePermission.js";
|
|
5
|
+
/**
|
|
6
|
+
* Adds multiple sessions to the SmartSessionValidator module of a given smart account.
|
|
7
|
+
*
|
|
8
|
+
* This function prepares and sends a user operation to create multiple sessions
|
|
9
|
+
* for the specified modular smart account. Each session can have its own policies
|
|
10
|
+
* and permissions.
|
|
11
|
+
*
|
|
12
|
+
* @template TModularSmartAccount - Type of the modular smart account, extending ModularSmartAccount or undefined.
|
|
13
|
+
* @param client - The client used to interact with the blockchain.
|
|
14
|
+
* @param parameters - Parameters including the smart account, required session specific policies info, and optional gas settings.
|
|
15
|
+
* @returns A promise that resolves to an object containing the user operation hash and an array of permission IDs.
|
|
16
|
+
*
|
|
17
|
+
* @throws {AccountNotFoundError} If the account is not found.
|
|
18
|
+
* @throws {Error} If there's an error getting the enable sessions action.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { grantPermission } from '@startale-scs/aa-sdk'
|
|
23
|
+
*
|
|
24
|
+
* const result = await grantPermission(startaleClient, {
|
|
25
|
+
* sessionRequestedInfo: [
|
|
26
|
+
* {
|
|
27
|
+
* sessionKeyData: '0x...',
|
|
28
|
+
* actionPoliciesInfo: [
|
|
29
|
+
* {
|
|
30
|
+
* contractAddress: '0x...',
|
|
31
|
+
* functionSelector: '0x...',
|
|
32
|
+
* rules: [...],
|
|
33
|
+
* valueLimit: 1000000000000000000n
|
|
34
|
+
* }
|
|
35
|
+
* ],
|
|
36
|
+
* sessionValidUntil: 1234567890
|
|
37
|
+
* }
|
|
38
|
+
* ]
|
|
39
|
+
* });
|
|
40
|
+
* console.log(result.userOpHash); // '0x...'
|
|
41
|
+
* console.log(result.permissionIds); // ['0x...', '0x...']
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* - Ensure that the client has sufficient gas to cover the transaction.
|
|
46
|
+
* - The number of sessions created is determined by the length of the `sessionRequestedInfo` array.
|
|
47
|
+
* - Each session's policies and permissions are determined by the `actionPoliciesInfo` provided.
|
|
48
|
+
*/
|
|
49
|
+
export async function grantPermission(client, parameters) {
|
|
50
|
+
const { account: account_ = client.account, maxFeePerGas, maxPriorityFeePerGas, nonce, calls: calls_ } = parameters;
|
|
51
|
+
if (!account_) {
|
|
52
|
+
throw new AccountNotFoundError({
|
|
53
|
+
docsPath: "/startale-client/methods#sendtransaction"
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const account = parseAccount(account_);
|
|
57
|
+
if (!account || !account.address) {
|
|
58
|
+
throw new Error("Account not found");
|
|
59
|
+
}
|
|
60
|
+
const preparedPermission = await getAction(client, preparePermission, "preparePermission")(parameters);
|
|
61
|
+
const userOpHash = await getAction(client, sendUserOperation, "sendUserOperation")({
|
|
62
|
+
calls: [
|
|
63
|
+
{
|
|
64
|
+
// If smart session address gets updated, review to get this right
|
|
65
|
+
to: preparedPermission.action.target,
|
|
66
|
+
data: preparedPermission.action.callData
|
|
67
|
+
},
|
|
68
|
+
...(calls_ || [])
|
|
69
|
+
],
|
|
70
|
+
maxFeePerGas,
|
|
71
|
+
maxPriorityFeePerGas,
|
|
72
|
+
nonce,
|
|
73
|
+
account
|
|
74
|
+
});
|
|
75
|
+
return {
|
|
76
|
+
userOpHash,
|
|
77
|
+
...preparedPermission
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=grantPermission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grantPermission.js","sourceRoot":"","sources":["../../../../../../src/sdk/modules/validators/smartSessionsValidator/decorators/grantPermission.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAIhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AA4BvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAGnC,MAAkE,EAClE,UAA2D;IAE3D,MAAM,EACJ,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAClC,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,KAAK,EAAE,MAAM,EACd,GAAG,UAAU,CAAA;IAEd,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,oBAAoB,CAAC;YAC7B,QAAQ,EAAE,0CAA0C;SACrD,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAwB,CAAA;IAC7D,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;IACtC,CAAC;IAED,MAAM,kBAAkB,GAAG,MAAM,SAAS,CACxC,MAAM,EACN,iBAAiB,EACjB,mBAAmB,CACpB,CAAC,UAAU,CAAC,CAAA;IAEb,MAAM,UAAU,GAAG,MAAM,SAAS,CAChC,MAAM,EACN,iBAAiB,EACjB,mBAAmB,CACpB,CAAC;QACA,KAAK,EAAE;YACL;gBACE,kEAAkE;gBAClE,EAAE,EAAE,kBAAkB,CAAC,MAAM,CAAC,MAAM;gBACpC,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,QAAQ;aACzC;YACD,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC;SAClB;QACD,YAAY;QACZ,oBAAoB;QACpB,KAAK;QACL,OAAO;KACR,CAAC,CAAA;IAEF,OAAO;QACL,UAAU;QACV,GAAG,kBAAkB;KACtB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { grantPermission } from "./grantPermission.js";
|
|
2
|
+
import { revokeSession } from "./revokeSession.js";
|
|
3
|
+
import { preparePermission } from "./preparePermission.js";
|
|
4
|
+
import { usePermission } from "./usePermission.js";
|
|
5
|
+
/**
|
|
6
|
+
* Creates actions for managing smart session creation.
|
|
7
|
+
*
|
|
8
|
+
* @param _ - Unused parameter (placeholder for potential future use).
|
|
9
|
+
* @returns A function that takes a client and returns SmartSessionCreateActions.
|
|
10
|
+
*/
|
|
11
|
+
export function smartSessionCreateActions(_) {
|
|
12
|
+
return (client) => {
|
|
13
|
+
return {
|
|
14
|
+
grantPermission: (args) => grantPermission(client, args),
|
|
15
|
+
preparePermission: (args) => preparePermission(client, args),
|
|
16
|
+
revokeSession: (args) => revokeSession(client, args)
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates actions for using smart sessions.
|
|
22
|
+
*
|
|
23
|
+
* @param smartSessionsModule - The smart sessions module to be set on the client's account.
|
|
24
|
+
* @returns A function that takes a client and returns SmartSessionUseActions.
|
|
25
|
+
*/
|
|
26
|
+
export function smartSessionUseActions(smartSessionsModule) {
|
|
27
|
+
return (client) => {
|
|
28
|
+
client?.account?.setModule(smartSessionsModule);
|
|
29
|
+
return {
|
|
30
|
+
usePermission: (args) => usePermission(client, args)
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export * from "./usePermission.js";
|
|
35
|
+
export * from "./grantPermission.js";
|
|
36
|
+
export * from "./revokeSession.js";
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/sdk/modules/validators/smartSessionsValidator/decorators/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAEL,aAAa,EACd,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAEL,iBAAiB,EAClB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAgC,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAoE7E;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,CAAS;IACjD,OAAO,CACL,MAAkE,EACjB,EAAE;QACnD,OAAO;YACL,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC;YACxD,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC;YAC5D,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC;SACrD,CAAA;IACH,CAAC,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,mBAAuC;IAEvC,OAAO,CACL,MAAkE,EACpB,EAAE;QAChD,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,mBAAmB,CAAC,CAAA;QAC/C,OAAO;YACL,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC;SACrD,CAAA;IACH,CAAC,CAAA;AACH,CAAC;AAED,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { getTimeFramePolicy, getUniversalActionPolicy } from "@rhinestone/module-sdk";
|
|
2
|
+
import { getPermissionId } from "@rhinestone/module-sdk";
|
|
3
|
+
import { encodeFunctionData, encodePacked, parseAccount } from "viem/utils";
|
|
4
|
+
import { ERROR_MESSAGES } from "../../../../account/index.js";
|
|
5
|
+
import { AccountNotFoundError } from "../../../../account/utils/AccountNotFound.js";
|
|
6
|
+
import { encodeValidationData, getSpendingLimitsPolicy, getSudoPolicy, getUsageLimitPolicy, getValueLimitPolicy, TIME_FRAME_POLICY_ADDRESS, VALUE_LIMIT_POLICY_ADDRESS, USAGE_LIMIT_POLICY_ADDRESS, SPENDING_LIMITS_POLICY_ADDRESS, SUDO_POLICY_ADDRESS, SMART_SESSIONS_ADDRESS, OWNABLE_VALIDATOR_ADDRESS, UNIVERSAL_ACTION_POLICY_ADDRESS } from "../../../../constants/index.js";
|
|
7
|
+
import { SmartSessionAbi } from "../../../../constants/abi/SmartSessionAbi.js";
|
|
8
|
+
import { abiToPoliciesInfo, applyDefaults, createActionConfig, createActionData, generateSalt, toActionConfig } from "../Helpers.js";
|
|
9
|
+
// Date.now() returns milliseconds, so we need to convert it to seconds // 60 * 60 * 24 * 365 is in seconds
|
|
10
|
+
export const ONE_YEAR_FROM_NOW_IN_SECONDS = Math.floor(new Date().getTime() / 1000.0) + 60 * 60 * 24 * 365;
|
|
11
|
+
/**
|
|
12
|
+
* Generates the action data for creating sessions in the SmartSessionValidator.
|
|
13
|
+
*
|
|
14
|
+
* @param sessionRequestedInfo - Array of session data parameters.
|
|
15
|
+
* @param client - The public client for blockchain interactions.
|
|
16
|
+
* @returns A promise that resolves to the action data and permission IDs, or an Error.
|
|
17
|
+
*/
|
|
18
|
+
export const getPermissionAction = async ({ chainId, sessionRequestedInfo, withPaymaster = false }) => {
|
|
19
|
+
const sessions = [];
|
|
20
|
+
const permissionIds = [];
|
|
21
|
+
const resolvedPolicyInfo2ActionData = (actionPolicyInfo) => {
|
|
22
|
+
const policyData = [];
|
|
23
|
+
// creating time frame policy here..
|
|
24
|
+
// Note: can do packing fix and address update in upstream also
|
|
25
|
+
const timeFramePolicy = getTimeFramePolicy({
|
|
26
|
+
validUntil: actionPolicyInfo.validUntil ?? ONE_YEAR_FROM_NOW_IN_SECONDS,
|
|
27
|
+
validAfter: actionPolicyInfo.validAfter ?? 0
|
|
28
|
+
});
|
|
29
|
+
timeFramePolicy.address = TIME_FRAME_POLICY_ADDRESS;
|
|
30
|
+
timeFramePolicy.policy = TIME_FRAME_POLICY_ADDRESS;
|
|
31
|
+
timeFramePolicy.initData = encodePacked(['uint48', 'uint48'], [actionPolicyInfo.validUntil ?? ONE_YEAR_FROM_NOW_IN_SECONDS, actionPolicyInfo.validAfter ?? 0]);
|
|
32
|
+
policyData.push(timeFramePolicy);
|
|
33
|
+
const hasValidRules = actionPolicyInfo?.rules && actionPolicyInfo?.rules?.length > 0;
|
|
34
|
+
if (hasValidRules) {
|
|
35
|
+
const actionConfig = createActionConfig(actionPolicyInfo.rules ?? [], actionPolicyInfo.valueLimit);
|
|
36
|
+
// create uni action policy here..
|
|
37
|
+
const uniActionPolicyInfo = getUniversalActionPolicy(toActionConfig(actionConfig));
|
|
38
|
+
uniActionPolicyInfo.address = UNIVERSAL_ACTION_POLICY_ADDRESS;
|
|
39
|
+
uniActionPolicyInfo.policy = UNIVERSAL_ACTION_POLICY_ADDRESS;
|
|
40
|
+
policyData.push(uniActionPolicyInfo);
|
|
41
|
+
}
|
|
42
|
+
// create sudo policy here..
|
|
43
|
+
if (actionPolicyInfo.sudo || !hasValidRules) {
|
|
44
|
+
const sudoPolicy = getSudoPolicy();
|
|
45
|
+
sudoPolicy.address = SUDO_POLICY_ADDRESS;
|
|
46
|
+
sudoPolicy.policy = SUDO_POLICY_ADDRESS;
|
|
47
|
+
policyData.push(sudoPolicy);
|
|
48
|
+
}
|
|
49
|
+
// create value limit policy here..
|
|
50
|
+
if (actionPolicyInfo.valueLimit) {
|
|
51
|
+
const valueLimitPolicy = getValueLimitPolicy({
|
|
52
|
+
limit: actionPolicyInfo.valueLimit
|
|
53
|
+
});
|
|
54
|
+
valueLimitPolicy.address = VALUE_LIMIT_POLICY_ADDRESS;
|
|
55
|
+
valueLimitPolicy.policy = VALUE_LIMIT_POLICY_ADDRESS;
|
|
56
|
+
policyData.push(valueLimitPolicy);
|
|
57
|
+
}
|
|
58
|
+
// create usage limit policy here..
|
|
59
|
+
if (actionPolicyInfo.usageLimit) {
|
|
60
|
+
const usageLimitPolicy = getUsageLimitPolicy({
|
|
61
|
+
limit: actionPolicyInfo.usageLimit
|
|
62
|
+
});
|
|
63
|
+
usageLimitPolicy.address = USAGE_LIMIT_POLICY_ADDRESS;
|
|
64
|
+
usageLimitPolicy.policy = USAGE_LIMIT_POLICY_ADDRESS;
|
|
65
|
+
policyData.push(usageLimitPolicy);
|
|
66
|
+
}
|
|
67
|
+
// create token spending limit policy here..
|
|
68
|
+
if (actionPolicyInfo.tokenLimits?.length) {
|
|
69
|
+
const spendingLimitPolicy = getSpendingLimitsPolicy(actionPolicyInfo.tokenLimits);
|
|
70
|
+
spendingLimitPolicy.address = SPENDING_LIMITS_POLICY_ADDRESS;
|
|
71
|
+
spendingLimitPolicy.policy = SPENDING_LIMITS_POLICY_ADDRESS;
|
|
72
|
+
policyData.push(spendingLimitPolicy);
|
|
73
|
+
}
|
|
74
|
+
// Create ActionData
|
|
75
|
+
const actionPolicy = createActionData(actionPolicyInfo.contractAddress, actionPolicyInfo.functionSelector, policyData);
|
|
76
|
+
return actionPolicy;
|
|
77
|
+
};
|
|
78
|
+
// Start populating the session for each param provided
|
|
79
|
+
for (const sessionInfo of sessionRequestedInfo) {
|
|
80
|
+
const actionPolicies = [];
|
|
81
|
+
for (const actionPolicyInfo of sessionInfo.actionPoliciesInfo ?? []) {
|
|
82
|
+
if (actionPolicyInfo.abi) {
|
|
83
|
+
// Resolve the abi to multiple function selectors...
|
|
84
|
+
const resolvedPolicyInfos = abiToPoliciesInfo(actionPolicyInfo);
|
|
85
|
+
const actionPolicies_ = resolvedPolicyInfos.map(resolvedPolicyInfo2ActionData);
|
|
86
|
+
actionPolicies.push(...actionPolicies_);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
const actionPolicy = resolvedPolicyInfo2ActionData(actionPolicyInfo);
|
|
90
|
+
actionPolicies.push(actionPolicy);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const timeFramePolicy = getTimeFramePolicy({
|
|
94
|
+
validUntil: sessionInfo.sessionValidUntil ?? ONE_YEAR_FROM_NOW_IN_SECONDS,
|
|
95
|
+
validAfter: sessionInfo.sessionValidAfter ?? 0
|
|
96
|
+
});
|
|
97
|
+
timeFramePolicy.address = TIME_FRAME_POLICY_ADDRESS;
|
|
98
|
+
timeFramePolicy.policy = TIME_FRAME_POLICY_ADDRESS;
|
|
99
|
+
timeFramePolicy.initData = encodePacked(['uint48', 'uint48'], [sessionInfo.sessionValidUntil ?? ONE_YEAR_FROM_NOW_IN_SECONDS, sessionInfo.sessionValidAfter ?? 0]);
|
|
100
|
+
// Review
|
|
101
|
+
const userOpPolicies = withPaymaster ? [timeFramePolicy] : [timeFramePolicy];
|
|
102
|
+
// Maybe if there is no validUntil and validAfter, then we can use sudo policy here
|
|
103
|
+
// const userOpPolicies = withPaymaster ? [getSudoPolicy()] : []
|
|
104
|
+
const session = {
|
|
105
|
+
chainId: BigInt(chainId),
|
|
106
|
+
permitERC4337Paymaster: withPaymaster,
|
|
107
|
+
sessionValidator: OWNABLE_VALIDATOR_ADDRESS,
|
|
108
|
+
sessionValidatorInitData: encodeValidationData({
|
|
109
|
+
threshold: 1,
|
|
110
|
+
owners: [sessionInfo.sessionKeyData]
|
|
111
|
+
}),
|
|
112
|
+
salt: sessionInfo.salt ?? generateSalt(),
|
|
113
|
+
userOpPolicies,
|
|
114
|
+
actions: actionPolicies,
|
|
115
|
+
erc7739Policies: {
|
|
116
|
+
allowedERC7739Content: [],
|
|
117
|
+
erc1271Policies: []
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const permissionId = getPermissionId({
|
|
121
|
+
session
|
|
122
|
+
});
|
|
123
|
+
// push permissionId to the array
|
|
124
|
+
permissionIds.push(permissionId);
|
|
125
|
+
// Push to sessions array
|
|
126
|
+
sessions.push(session);
|
|
127
|
+
}
|
|
128
|
+
const preparePermissionData = encodeFunctionData({
|
|
129
|
+
abi: SmartSessionAbi,
|
|
130
|
+
functionName: "enableSessions",
|
|
131
|
+
args: [sessions]
|
|
132
|
+
});
|
|
133
|
+
return {
|
|
134
|
+
action: {
|
|
135
|
+
target: SMART_SESSIONS_ADDRESS,
|
|
136
|
+
value: BigInt(0),
|
|
137
|
+
callData: preparePermissionData
|
|
138
|
+
},
|
|
139
|
+
permissionIds: permissionIds,
|
|
140
|
+
sessions
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Adds multiple sessions to the SmartSessionValidator module of a given smart account.
|
|
145
|
+
*
|
|
146
|
+
* This function prepares and sends a user operation to create multiple sessions
|
|
147
|
+
* for the specified modular smart account. Each session can have its own policies
|
|
148
|
+
* and permissions.
|
|
149
|
+
*
|
|
150
|
+
* @template TModularSmartAccount - Type of the modular smart account, extending ModularSmartAccount or undefined.
|
|
151
|
+
* @param client - The client used to interact with the blockchain.
|
|
152
|
+
* @param parameters - Parameters including the smart account, required session specific policies info, and optional gas settings.
|
|
153
|
+
* @returns A promise that resolves to an object containing the user operation hash and an array of permission IDs.
|
|
154
|
+
*
|
|
155
|
+
* @throws {AccountNotFoundError} If the account is not found.
|
|
156
|
+
* @throws {Error} If there's an error getting the enable sessions action.
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* import { preparePermission } from '@startale-scs/aa-sdk'
|
|
161
|
+
*
|
|
162
|
+
* const result = await preparePermission(startaleClient, {
|
|
163
|
+
* sessionRequestedInfo: [
|
|
164
|
+
* {
|
|
165
|
+
* sessionKeyData: '0x...',
|
|
166
|
+
* actionPoliciesInfo: [
|
|
167
|
+
* {
|
|
168
|
+
* contractAddress: '0x...',
|
|
169
|
+
* functionSelector: '0x...',
|
|
170
|
+
* rules: [...],
|
|
171
|
+
* valueLimit: 1000000000000000000n
|
|
172
|
+
* }
|
|
173
|
+
* ],
|
|
174
|
+
* sessionValidUntil: 1234567890
|
|
175
|
+
* }
|
|
176
|
+
* ]
|
|
177
|
+
* });
|
|
178
|
+
* console.log(result.userOpHash); // '0x...'
|
|
179
|
+
* console.log(result.permissionIds); // ['0x...', '0x...']
|
|
180
|
+
* ```
|
|
181
|
+
*
|
|
182
|
+
* @remarks
|
|
183
|
+
* - Ensure that the client has sufficient gas to cover the transaction.
|
|
184
|
+
* - The number of sessions created is determined by the length of the `sessionRequestedInfo` array.
|
|
185
|
+
* - Each session's policies and permissions are determined by the `actionPoliciesInfo` provided.
|
|
186
|
+
*/
|
|
187
|
+
export async function preparePermission(client, parameters) {
|
|
188
|
+
const { publicClient: publicClient_ = client.account?.client, account: account_ = client.account, sessionRequestedInfo } = parameters;
|
|
189
|
+
if (!account_) {
|
|
190
|
+
throw new AccountNotFoundError({
|
|
191
|
+
docsPath: "/startale-client/methods#sendtransaction"
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
const account = parseAccount(account_);
|
|
195
|
+
if (!account || !account.address) {
|
|
196
|
+
throw new Error("Account not found");
|
|
197
|
+
}
|
|
198
|
+
const withPaymaster = !!client?.paymaster;
|
|
199
|
+
const chainId = publicClient_?.chain?.id;
|
|
200
|
+
if (!chainId) {
|
|
201
|
+
throw new Error(ERROR_MESSAGES.CHAIN_NOT_FOUND);
|
|
202
|
+
}
|
|
203
|
+
const defaultedSessionRequestedInfo = sessionRequestedInfo.map(applyDefaults);
|
|
204
|
+
const actionResponse = await getPermissionAction({
|
|
205
|
+
chainId,
|
|
206
|
+
sessionRequestedInfo: defaultedSessionRequestedInfo,
|
|
207
|
+
withPaymaster
|
|
208
|
+
});
|
|
209
|
+
if (actionResponse instanceof Error) {
|
|
210
|
+
throw actionResponse;
|
|
211
|
+
}
|
|
212
|
+
return actionResponse;
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=preparePermission.js.map
|
package/dist/_esm/modules/validators/smartSessionsValidator/decorators/preparePermission.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preparePermission.js","sourceRoot":"","sources":["../../../../../../src/sdk/modules/validators/smartSessionsValidator/decorators/preparePermission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAIL,oBAAoB,EACpB,uBAAuB,EACvB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC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7E,MAAM,cAAc,GAAG,MAAM,mBAAmB,CAAC;QAC/C,OAAO;QACP,oBAAoB,EAAE,6BAA6B;QACnD,aAAa;KACd,CAAC,CAAA;IAEF,IAAI,cAAc,YAAY,KAAK,EAAE,CAAC;QACpC,MAAM,cAAc,CAAA;IACtB,CAAC;IAED,OAAO,cAAc,CAAA;AACvB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { sendUserOperation } from "viem/account-abstraction";
|
|
2
|
+
import { getAction, parseAccount } from "viem/utils";
|
|
3
|
+
import { AccountNotFoundError } from "../../../../account/utils/AccountNotFound.js";
|
|
4
|
+
import { getRemoveSessionAction } from "@rhinestone/module-sdk";
|
|
5
|
+
/**
|
|
6
|
+
* Revokes a particular session by permissionId in the SmartSessionValidator module of a given smart account.
|
|
7
|
+
*
|
|
8
|
+
* This function prepares and sends a user operation to revoke a particular session by permissionId
|
|
9
|
+
* for the specified modular smart account.
|
|
10
|
+
*
|
|
11
|
+
* @template TModularSmartAccount - Type of the modular smart account, extending ModularSmartAccount or undefined.
|
|
12
|
+
* @param client - The client used to interact with the blockchain.
|
|
13
|
+
* @param parameters - Parameters including the smart account, permissionId, and optional gas settings.
|
|
14
|
+
* @returns A promise that resolves to an object containing the user operation hash.
|
|
15
|
+
*
|
|
16
|
+
* @throws {AccountNotFoundError} If the account is not found.
|
|
17
|
+
* @throws {Error} If there's an error getting the remove session action.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { revokeSession } from '@startale-scs/aa-sdk'
|
|
22
|
+
*
|
|
23
|
+
* const result = await revokeSession(startaleClient, {
|
|
24
|
+
* permissionId: '0x...',
|
|
25
|
+
* });
|
|
26
|
+
* console.log(result.userOpHash); // '0x...'
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* - Ensure that the client has sufficient gas to cover the transaction.
|
|
31
|
+
* - The session is revoked by the permissionId.
|
|
32
|
+
*/
|
|
33
|
+
export async function revokeSession(client, parameters) {
|
|
34
|
+
const { account: account_ = client.account, maxFeePerGas, maxPriorityFeePerGas, nonce, calls: calls_ } = parameters;
|
|
35
|
+
if (!account_) {
|
|
36
|
+
throw new AccountNotFoundError({
|
|
37
|
+
docsPath: "/startale-client/methods#sendtransaction"
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const account = parseAccount(account_);
|
|
41
|
+
if (!account || !account.address) {
|
|
42
|
+
throw new AccountNotFoundError({
|
|
43
|
+
docsPath: "/startale-client/methods#parseaccount"
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const action = getRemoveSessionAction({
|
|
47
|
+
permissionId: parameters.permissionId
|
|
48
|
+
});
|
|
49
|
+
const userOpHash = await getAction(client, sendUserOperation, "sendUserOperation")({
|
|
50
|
+
calls: [
|
|
51
|
+
{
|
|
52
|
+
to: action.target,
|
|
53
|
+
value: BigInt(action.value.toString()),
|
|
54
|
+
data: action.callData
|
|
55
|
+
},
|
|
56
|
+
...(calls_ || [])
|
|
57
|
+
],
|
|
58
|
+
maxFeePerGas,
|
|
59
|
+
maxPriorityFeePerGas,
|
|
60
|
+
nonce,
|
|
61
|
+
account
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
userOpHash,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=revokeSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revokeSession.js","sourceRoot":"","sources":["../../../../../../src/sdk/modules/validators/smartSessionsValidator/decorators/revokeSession.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAIhF,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AA0B/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