@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,403 @@
|
|
|
1
|
+
import { concat, concatHex, createPublicClient, createWalletClient, domainSeparator, encodeAbiParameters, encodeFunctionData, encodePacked, getContract, isAddressEqual, keccak256, parseAbi, parseAbiParameters, publicActions, toBytes, toHex, validateTypedData, zeroAddress } from "viem";
|
|
2
|
+
import { entryPoint07Address, getUserOperationHash, toSmartAccount } from "viem/account-abstraction";
|
|
3
|
+
import { ACCOUNT_FACTORY_ADDRESS, BOOTSTRAP_ADDRESS, ENTRY_POINT_ADDRESS, STARTALE_7702_DELEGATION_ADDRESS } from "../constants/index.js";
|
|
4
|
+
// Constants
|
|
5
|
+
import { EntrypointAbi } from "../constants/abi/index.js";
|
|
6
|
+
import { toEmptyHook } from "../modules/toEmptyHook.js";
|
|
7
|
+
import { toDefaultModule } from "../modules/validators/default/toDefaultModule.js";
|
|
8
|
+
import { getFactoryData, getInitData } from "./decorators/getFactoryData.js";
|
|
9
|
+
import { getStartaleAccountAddress } from "./decorators/getStartaleAccountAddress.js";
|
|
10
|
+
import { EXECUTE_BATCH, EXECUTE_SINGLE, PARENT_TYPEHASH } from "./utils/Constants.js";
|
|
11
|
+
import { addressEquals, eip712WrapHash, getAccountDomainStructFields, getTypesForEIP712Domain, isNullOrUndefined, typeToString } from "./utils/Utils.js";
|
|
12
|
+
import { toInitData } from "./utils/toInitData.js";
|
|
13
|
+
import { toSigner } from "./utils/toSigner.js";
|
|
14
|
+
import { getCode, signAuthorization as signAuthorizationAction } from "viem/actions";
|
|
15
|
+
import { verifyAuthorization } from "viem/utils";
|
|
16
|
+
import { addressToEmptyAccount } from "./utils/addressToEmptyAccount.js";
|
|
17
|
+
/**
|
|
18
|
+
* @description Create a Startale Smart Account.
|
|
19
|
+
*
|
|
20
|
+
* @param parameters - {@link ToStartaleSmartAccountParameters}
|
|
21
|
+
* @returns Startale Smart Account. {@link StartaleSmartAccount}
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* import { toStartaleAccount } from '@startale-scs/aa-sdk'
|
|
25
|
+
* import { createWalletClient, http } from 'viem'
|
|
26
|
+
* import { mainnet } from 'viem/chains'
|
|
27
|
+
*
|
|
28
|
+
* const account = await toStartaleAccount({
|
|
29
|
+
* chain: mainnet,
|
|
30
|
+
* transport: http(),
|
|
31
|
+
* signer: '0x...',
|
|
32
|
+
* })
|
|
33
|
+
*/
|
|
34
|
+
export const toStartaleSmartAccount = async (parameters) => {
|
|
35
|
+
const { chain, transport, signer: _signer, index = 0n, key = "startale account", name = "Startale Account", registryAddress = zeroAddress, validators: customValidators, executors: customExecutors, hook: customHook, fallbacks: customFallbacks, prevalidationHooks: customPrevalidationHooks, accountAddress: accountAddress_, factoryAddress = ACCOUNT_FACTORY_ADDRESS, bootStrapAddress = BOOTSTRAP_ADDRESS, accountImplementationAddress = STARTALE_7702_DELEGATION_ADDRESS, eip7702Auth, eip7702Account } = parameters;
|
|
36
|
+
// Note: we could also accept deliberate optional flag to enable EIP-7702
|
|
37
|
+
const isEip7702 = !!eip7702Account || !!eip7702Auth;
|
|
38
|
+
const signer = await toSigner({ signer: _signer });
|
|
39
|
+
// Review
|
|
40
|
+
// Has to be EOA signer who does sign the authorization.
|
|
41
|
+
// Note: Might as well use signer interchangeably.
|
|
42
|
+
const localAccount = eip7702Account
|
|
43
|
+
? await toSigner({
|
|
44
|
+
signer: eip7702Account,
|
|
45
|
+
address: eip7702Account.address
|
|
46
|
+
})
|
|
47
|
+
: undefined;
|
|
48
|
+
const walletClient = createWalletClient({
|
|
49
|
+
account: signer,
|
|
50
|
+
chain,
|
|
51
|
+
transport,
|
|
52
|
+
key,
|
|
53
|
+
name
|
|
54
|
+
}).extend(publicActions);
|
|
55
|
+
const publicClient = createPublicClient({ chain, transport });
|
|
56
|
+
const entryPointContract = getContract({
|
|
57
|
+
address: ENTRY_POINT_ADDRESS,
|
|
58
|
+
abi: EntrypointAbi,
|
|
59
|
+
client: {
|
|
60
|
+
public: publicClient,
|
|
61
|
+
wallet: walletClient
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
// Prepare default validator module
|
|
65
|
+
const defaultValidator = toDefaultModule({ signer });
|
|
66
|
+
// Prepare validator modules
|
|
67
|
+
const validators = customValidators || [];
|
|
68
|
+
// The default validator should be the defaultValidator unless custom validators have been set
|
|
69
|
+
let module = customValidators?.[0] || defaultValidator;
|
|
70
|
+
// Prepare executor modules
|
|
71
|
+
const executors = customExecutors || [];
|
|
72
|
+
// Prepare hook module
|
|
73
|
+
const hook = customHook || toEmptyHook();
|
|
74
|
+
// Prepare fallback modules
|
|
75
|
+
const fallbacks = customFallbacks || [];
|
|
76
|
+
// Generate the initialization data for the account using the init function
|
|
77
|
+
const prevalidationHooks = customPrevalidationHooks || [];
|
|
78
|
+
const initData = getInitData({
|
|
79
|
+
defaultValidator: toInitData(defaultValidator),
|
|
80
|
+
validators: validators.map(toInitData),
|
|
81
|
+
executors: executors.map(toInitData),
|
|
82
|
+
hook: toInitData(hook),
|
|
83
|
+
fallbacks: fallbacks.map(toInitData),
|
|
84
|
+
registryAddress,
|
|
85
|
+
bootStrapAddress,
|
|
86
|
+
prevalidationHooks
|
|
87
|
+
});
|
|
88
|
+
// Generate the factory data with the bootstrap address and init data
|
|
89
|
+
const factoryData = getFactoryData({ initData, index });
|
|
90
|
+
/**
|
|
91
|
+
* @description Gets the init code for the account
|
|
92
|
+
* @returns The init code as a hexadecimal string
|
|
93
|
+
*/
|
|
94
|
+
const getInitCode = () => {
|
|
95
|
+
if (isEip7702) {
|
|
96
|
+
return "0x";
|
|
97
|
+
}
|
|
98
|
+
return concatHex([factoryAddress, factoryData]);
|
|
99
|
+
};
|
|
100
|
+
let _accountAddress = accountAddress_;
|
|
101
|
+
/**
|
|
102
|
+
* @description Gets the counterfactual address of the account
|
|
103
|
+
* @returns The counterfactual address
|
|
104
|
+
* @throws {Error} If unable to get the counterfactual address
|
|
105
|
+
*/
|
|
106
|
+
const getAddress = async () => {
|
|
107
|
+
// In case of EIP-7702, the account address is the EOA address. We could provide an override always.
|
|
108
|
+
// Note: there may be ways to find out by checking bytecode.
|
|
109
|
+
if (!isNullOrUndefined(_accountAddress))
|
|
110
|
+
return _accountAddress;
|
|
111
|
+
const addressFromFactory = await getStartaleAccountAddress({
|
|
112
|
+
factoryAddress,
|
|
113
|
+
index,
|
|
114
|
+
initData,
|
|
115
|
+
publicClient
|
|
116
|
+
});
|
|
117
|
+
if (!addressEquals(addressFromFactory, zeroAddress)) {
|
|
118
|
+
_accountAddress = addressFromFactory;
|
|
119
|
+
return addressFromFactory;
|
|
120
|
+
}
|
|
121
|
+
throw new Error("Failed to get account address");
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* @description Calculates the hash of a user operation
|
|
125
|
+
* @param userOp - The user operation
|
|
126
|
+
* @returns The hash of the user operation
|
|
127
|
+
*/
|
|
128
|
+
const getUserOpHash = (userOp) => getUserOperationHash({
|
|
129
|
+
chainId: chain.id,
|
|
130
|
+
entryPointAddress: entryPoint07Address,
|
|
131
|
+
entryPointVersion: "0.7",
|
|
132
|
+
userOperation: userOp
|
|
133
|
+
});
|
|
134
|
+
/**
|
|
135
|
+
* @description Encodes a batch of calls for execution
|
|
136
|
+
* @param calls - An array of calls to encode
|
|
137
|
+
* @param mode - The execution mode
|
|
138
|
+
* @returns The encoded calls
|
|
139
|
+
*/
|
|
140
|
+
const encodeExecuteBatch = async (calls, mode = EXECUTE_BATCH) => {
|
|
141
|
+
const executionAbiParams = {
|
|
142
|
+
type: "tuple[]",
|
|
143
|
+
components: [
|
|
144
|
+
{ name: "target", type: "address" },
|
|
145
|
+
{ name: "value", type: "uint256" },
|
|
146
|
+
{ name: "callData", type: "bytes" }
|
|
147
|
+
]
|
|
148
|
+
};
|
|
149
|
+
const executions = calls.map((tx) => ({
|
|
150
|
+
target: tx.to,
|
|
151
|
+
callData: tx.data ?? "0x",
|
|
152
|
+
value: BigInt(tx.value ?? 0n)
|
|
153
|
+
}));
|
|
154
|
+
const executionCalldataPrep = encodeAbiParameters([executionAbiParams], [executions]);
|
|
155
|
+
return encodeFunctionData({
|
|
156
|
+
abi: parseAbi([
|
|
157
|
+
"function execute(bytes32 mode, bytes calldata executionCalldata) external"
|
|
158
|
+
]),
|
|
159
|
+
functionName: "execute",
|
|
160
|
+
args: [mode, executionCalldataPrep]
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* @description Encodes a single call for execution
|
|
165
|
+
* @param call - The call to encode
|
|
166
|
+
* @param mode - The execution mode
|
|
167
|
+
* @returns The encoded call
|
|
168
|
+
*/
|
|
169
|
+
const encodeExecute = async (call, mode = EXECUTE_SINGLE) => {
|
|
170
|
+
const executionCalldata = encodePacked(["address", "uint256", "bytes"], [call.to, BigInt(call.value ?? 0n), (call.data ?? "0x")]);
|
|
171
|
+
return encodeFunctionData({
|
|
172
|
+
abi: parseAbi([
|
|
173
|
+
"function execute(bytes32 mode, bytes calldata executionCalldata) external"
|
|
174
|
+
]),
|
|
175
|
+
functionName: "execute",
|
|
176
|
+
args: [mode, executionCalldata]
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* @description Gets the nonce for the account
|
|
181
|
+
* @param parameters - Optional parameters for getting the nonce
|
|
182
|
+
* @returns The nonce
|
|
183
|
+
*/
|
|
184
|
+
const getNonce = async (parameters) => {
|
|
185
|
+
const TIMESTAMP_ADJUSTMENT = 16777215n;
|
|
186
|
+
const { key: key_ = 0n, validationMode = "0x00", moduleAddress = module.module } = parameters ?? {};
|
|
187
|
+
try {
|
|
188
|
+
const adjustedKey = BigInt(key_) % TIMESTAMP_ADJUSTMENT;
|
|
189
|
+
const key = concat([
|
|
190
|
+
toHex(adjustedKey, { size: 3 }),
|
|
191
|
+
validationMode,
|
|
192
|
+
moduleAddress
|
|
193
|
+
]);
|
|
194
|
+
const accountAddress = await getAddress();
|
|
195
|
+
return await entryPointContract.read.getNonce([
|
|
196
|
+
accountAddress,
|
|
197
|
+
BigInt(key)
|
|
198
|
+
]);
|
|
199
|
+
}
|
|
200
|
+
catch (e) {
|
|
201
|
+
return 0n;
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* @description Checks if the account is delegated to the implementation address
|
|
206
|
+
* @returns True if the account is delegated, false otherwise
|
|
207
|
+
*/
|
|
208
|
+
async function isDelegated() {
|
|
209
|
+
const code = await publicClient.getCode({ address: signer.address });
|
|
210
|
+
return (!!code &&
|
|
211
|
+
code
|
|
212
|
+
?.toLowerCase()
|
|
213
|
+
.includes(STARTALE_7702_DELEGATION_ADDRESS.substring(2).toLowerCase()));
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* @description Get authorization data to unauthorize the account
|
|
217
|
+
* @returns Hex of the transaction hash. You can wait for the receipt on this hash.
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* const undelegateTxHash = await startaleSmartAccount.unDelegate()
|
|
221
|
+
*/
|
|
222
|
+
async function unDelegate() {
|
|
223
|
+
const deAuthorization = await walletClient.signAuthorization({
|
|
224
|
+
address: zeroAddress,
|
|
225
|
+
executor: "self"
|
|
226
|
+
});
|
|
227
|
+
return await walletClient.sendTransaction({
|
|
228
|
+
to: signer.address, // any target
|
|
229
|
+
data: "0xdeadbeef", // any data
|
|
230
|
+
type: "eip7702",
|
|
231
|
+
authorizationList: [deAuthorization]
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* @description Signs typed data
|
|
236
|
+
* @param parameters - The typed data parameters
|
|
237
|
+
* @returns The signature
|
|
238
|
+
*/
|
|
239
|
+
async function signTypedData(parameters) {
|
|
240
|
+
const { message, primaryType, types: _types, domain } = parameters;
|
|
241
|
+
if (!domain)
|
|
242
|
+
throw new Error("Missing domain");
|
|
243
|
+
if (!message)
|
|
244
|
+
throw new Error("Missing message");
|
|
245
|
+
const types = {
|
|
246
|
+
EIP712Domain: getTypesForEIP712Domain({ domain }),
|
|
247
|
+
..._types
|
|
248
|
+
};
|
|
249
|
+
// @ts-ignore: Comes from startale parent typehash
|
|
250
|
+
const messageStuff = message.stuff;
|
|
251
|
+
// @ts-ignore
|
|
252
|
+
validateTypedData({
|
|
253
|
+
domain,
|
|
254
|
+
message,
|
|
255
|
+
primaryType,
|
|
256
|
+
types
|
|
257
|
+
});
|
|
258
|
+
const appDomainSeparator = domainSeparator({ domain });
|
|
259
|
+
const accountDomainStructFields = await getAccountDomainStructFields(publicClient, await getAddress());
|
|
260
|
+
const parentStructHash = keccak256(encodePacked(["bytes", "bytes"], [
|
|
261
|
+
encodeAbiParameters(parseAbiParameters(["bytes32, bytes32"]), [
|
|
262
|
+
keccak256(toBytes(PARENT_TYPEHASH)),
|
|
263
|
+
messageStuff
|
|
264
|
+
]),
|
|
265
|
+
accountDomainStructFields
|
|
266
|
+
]));
|
|
267
|
+
const wrappedTypedHash = eip712WrapHash(parentStructHash, appDomainSeparator);
|
|
268
|
+
let signature = await module.signMessage({ raw: toBytes(wrappedTypedHash) });
|
|
269
|
+
const contentsType = toBytes(typeToString(types)[1]);
|
|
270
|
+
const signatureData = concatHex([
|
|
271
|
+
signature,
|
|
272
|
+
appDomainSeparator,
|
|
273
|
+
messageStuff,
|
|
274
|
+
toHex(contentsType),
|
|
275
|
+
toHex(contentsType.length, { size: 2 })
|
|
276
|
+
]);
|
|
277
|
+
signature = encodePacked(["address", "bytes"], [module.module, signatureData]);
|
|
278
|
+
return signature;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* @description Changes the active module for the account
|
|
282
|
+
* @param module - The new module to set as active
|
|
283
|
+
* @returns void
|
|
284
|
+
*/
|
|
285
|
+
const setModule = (validationModule) => {
|
|
286
|
+
if (validationModule.type !== "validator") {
|
|
287
|
+
throw new Error("Only validator modules are supported");
|
|
288
|
+
}
|
|
289
|
+
module = validationModule;
|
|
290
|
+
};
|
|
291
|
+
// Todo: We could also implement unDelegate. and isDelegated = isEIP7702
|
|
292
|
+
const signAuthorization = async () => {
|
|
293
|
+
// Note: Signer would be EOA signer
|
|
294
|
+
// Could also be accountAddress assuming we would have overriden the address.
|
|
295
|
+
const code = await getCode(walletClient, { address: signer.address });
|
|
296
|
+
// check if account has not activated 7702 with implementation address
|
|
297
|
+
if (!code ||
|
|
298
|
+
code.length === 0 ||
|
|
299
|
+
!code
|
|
300
|
+
.toLowerCase()
|
|
301
|
+
.startsWith(`0xef0100${accountImplementationAddress.slice(2).toLowerCase()}`)) {
|
|
302
|
+
if (eip7702Auth &&
|
|
303
|
+
!isAddressEqual(eip7702Auth.address, accountImplementationAddress)) {
|
|
304
|
+
throw new Error("EIP-7702 authorization delegate address does not match account implementation address");
|
|
305
|
+
}
|
|
306
|
+
const auth = eip7702Auth ??
|
|
307
|
+
(await signAuthorizationAction(walletClient, {
|
|
308
|
+
account: localAccount,
|
|
309
|
+
address: accountImplementationAddress,
|
|
310
|
+
chainId: chain.id
|
|
311
|
+
}));
|
|
312
|
+
const verified = await verifyAuthorization({
|
|
313
|
+
authorization: auth,
|
|
314
|
+
address: accountAddress_ ?? signer.address
|
|
315
|
+
});
|
|
316
|
+
if (!verified) {
|
|
317
|
+
throw new Error("Authorization verification failed");
|
|
318
|
+
}
|
|
319
|
+
return auth;
|
|
320
|
+
}
|
|
321
|
+
return undefined;
|
|
322
|
+
};
|
|
323
|
+
return toSmartAccount({
|
|
324
|
+
client: walletClient,
|
|
325
|
+
entryPoint: {
|
|
326
|
+
abi: EntrypointAbi,
|
|
327
|
+
address: ENTRY_POINT_ADDRESS,
|
|
328
|
+
version: "0.7"
|
|
329
|
+
},
|
|
330
|
+
authorization: isEip7702
|
|
331
|
+
? {
|
|
332
|
+
account: localAccount ??
|
|
333
|
+
addressToEmptyAccount(accountAddress_ ?? signer.address), // Review
|
|
334
|
+
address: accountImplementationAddress
|
|
335
|
+
}
|
|
336
|
+
: undefined,
|
|
337
|
+
getAddress,
|
|
338
|
+
encodeCalls: (calls) => {
|
|
339
|
+
return calls.length === 1
|
|
340
|
+
? encodeExecute(calls[0])
|
|
341
|
+
: encodeExecuteBatch(calls);
|
|
342
|
+
},
|
|
343
|
+
getFactoryArgs: async () => {
|
|
344
|
+
if (isEip7702) {
|
|
345
|
+
return { factory: undefined, factoryData: undefined };
|
|
346
|
+
}
|
|
347
|
+
return {
|
|
348
|
+
factory: factoryAddress,
|
|
349
|
+
factoryData
|
|
350
|
+
};
|
|
351
|
+
},
|
|
352
|
+
getStubSignature: async () => module.getStubSignature(),
|
|
353
|
+
/**
|
|
354
|
+
* @description Signs a message
|
|
355
|
+
* @param params - The parameters for signing
|
|
356
|
+
* @param params.message - The message to sign
|
|
357
|
+
* @returns The signature
|
|
358
|
+
*/
|
|
359
|
+
async signMessage({ message }) {
|
|
360
|
+
const tempSignature = await module.signMessage(message);
|
|
361
|
+
return encodePacked(["address", "bytes"], [module.module, tempSignature]);
|
|
362
|
+
},
|
|
363
|
+
signTypedData,
|
|
364
|
+
eip7702Authorization: signAuthorization,
|
|
365
|
+
signUserOperation: async (parameters) => {
|
|
366
|
+
const { chainId = publicClient.chain.id, ...userOpWithoutSender } = parameters;
|
|
367
|
+
const address = await getAddress();
|
|
368
|
+
const userOperation = {
|
|
369
|
+
...userOpWithoutSender,
|
|
370
|
+
sender: address
|
|
371
|
+
};
|
|
372
|
+
const hash = getUserOperationHash({
|
|
373
|
+
chainId,
|
|
374
|
+
entryPointAddress: entryPoint07Address,
|
|
375
|
+
entryPointVersion: "0.7",
|
|
376
|
+
userOperation
|
|
377
|
+
});
|
|
378
|
+
return await module.signUserOpHash(hash);
|
|
379
|
+
},
|
|
380
|
+
getNonce,
|
|
381
|
+
extend: {
|
|
382
|
+
unDelegate,
|
|
383
|
+
isDelegated,
|
|
384
|
+
entryPointAddress: entryPoint07Address,
|
|
385
|
+
getAddress,
|
|
386
|
+
getInitCode,
|
|
387
|
+
encodeExecute,
|
|
388
|
+
encodeExecuteBatch,
|
|
389
|
+
getUserOpHash,
|
|
390
|
+
factoryData,
|
|
391
|
+
factoryAddress,
|
|
392
|
+
accountImplementationAddress,
|
|
393
|
+
registryAddress,
|
|
394
|
+
signer,
|
|
395
|
+
walletClient,
|
|
396
|
+
publicClient,
|
|
397
|
+
chain,
|
|
398
|
+
setModule,
|
|
399
|
+
getModule: () => module
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
};
|
|
403
|
+
//# sourceMappingURL=toStartaleSmartAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toStartaleSmartAccount.js","sourceRoot":"","sources":["../../../src/sdk/account/toStartaleSmartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAoBL,MAAM,EACN,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,cAAc,EACd,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,aAAa,EACb,OAAO,EACP,KAAK,EACL,iBAAiB,EACjB,WAAW,EACZ,MAAM,MAAM,CAAA;AACb,OAAO,EAIL,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACf,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,gCAAgC,EACjC,MAAM,cAAc,CAAA;AACrB,YAAY;AACZ,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAA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OAAO;aAChB,CAAA;YAED,MAAM,IAAI,GAAG,oBAAoB,CAAC;gBAChC,OAAO;gBACP,iBAAiB,EAAE,mBAAmB;gBACtC,iBAAiB,EAAE,KAAK;gBACxB,aAAa;aACd,CAAC,CAAA;YACF,OAAO,MAAM,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;QAC1C,CAAC;QACD,QAAQ;QACR,MAAM,EAAE;YACN,UAAU;YACV,WAAW;YACX,iBAAiB,EAAE,mBAAmB;YACtC,UAAU;YACV,WAAW;YACX,aAAa;YACb,kBAAkB;YAClB,aAAa;YACb,WAAW;YACX,cAAc;YACd,4BAA4B;YAC5B,eAAe;YACf,MAAM;YACN,YAAY;YACZ,YAAY;YACZ,KAAK;YACL,SAAS;YACT,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM;SACxB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseError } from "viem";
|
|
2
|
+
/**
|
|
3
|
+
* @ignore
|
|
4
|
+
*/
|
|
5
|
+
export class AccountNotFoundError extends BaseError {
|
|
6
|
+
constructor({ docsPath } = {}) {
|
|
7
|
+
super([
|
|
8
|
+
"Could not find an Account to execute with this Action.",
|
|
9
|
+
"Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."
|
|
10
|
+
].join("\n"), {
|
|
11
|
+
docsPath,
|
|
12
|
+
docsSlug: "account",
|
|
13
|
+
name: "AccountNotFoundError"
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=AccountNotFound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountNotFound.js","sourceRoot":"","sources":["../../../../src/sdk/account/utils/AccountNotFound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAEhC;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IACjD,YAAY,EAAE,QAAQ,KAAwC,EAAE;QAC9D,KAAK,CACH;YACE,wDAAwD;YACxD,kHAAkH;SACnH,CAAC,IAAI,CAAC,IAAI,CAAC,EACZ;YACE,QAAQ;YACR,QAAQ,EAAE,SAAS;YACnB,IAAI,EAAE,sBAAsB;SAC7B,CACF,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { concat, keccak256, pad, toHex } from "viem";
|
|
2
|
+
export const ADDRESS_ZERO = "0x0000000000000000000000000000000000000000";
|
|
3
|
+
// Note: This is only applicable when prod env is used.
|
|
4
|
+
export const STARTALE_TOKEN_PAYMASTER = "0x0000006C18daC1Ff8F50Df743F7587a8b7d8a8a7";
|
|
5
|
+
export const EIP1559_UNSUPPORTED_NETWORKS = [97, 56, 1442, 1101];
|
|
6
|
+
export const PROXY_CREATION_CODE = "0x603d3d8160223d3973600966Ae45ad5BE4be08a70AD99e9cF41e6d6884B06F5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3";
|
|
7
|
+
// REview: Deploy in future if we need one
|
|
8
|
+
export const ADDRESS_RESOLVER_ADDRESS = "0x00000E81673606e07fC79CE5F1b3B26957844468";
|
|
9
|
+
export const DefaultGasLimit = {
|
|
10
|
+
callGasLimit: 800000n,
|
|
11
|
+
verificationGasLimit: 1000000n,
|
|
12
|
+
preVerificationGas: 100000n
|
|
13
|
+
};
|
|
14
|
+
export const LargeGasLimit = {
|
|
15
|
+
callGasLimit: 10000000n,
|
|
16
|
+
verificationGasLimit: 15000000n,
|
|
17
|
+
preVerificationGas: 1500000n
|
|
18
|
+
};
|
|
19
|
+
export const ERROR_MESSAGES = {
|
|
20
|
+
KEY_GEN_DATA_NOT_FOUND: "Key generation data is not available",
|
|
21
|
+
SIGNATURE_NOT_FOUND: "Signature not found from Dan",
|
|
22
|
+
FAILED_COMPUTE_ACCOUNT_ADDRESS: "Failed to compute account address. Possible reasons:\n" +
|
|
23
|
+
"- The factory contract does not have the function 'computeAccountAddress'\n" +
|
|
24
|
+
"- The parameters passed to the factory contract function may be invalid\n" +
|
|
25
|
+
"- The provided factory address is not a contract",
|
|
26
|
+
SIGNER_REQUIRED_FOR_CREATE_SESSION: "Signer is required",
|
|
27
|
+
ACCOUNT_REQUIRED: "Account is required",
|
|
28
|
+
MODULE_NOT_ACTIVATED: "Module not activated",
|
|
29
|
+
SMART_SESSION_DATA_REQUIRED: "Data is required for using smart session module",
|
|
30
|
+
MISSING_ACCOUNT_CONTRACT: 'The contract function "computeAccountAddress" returned no data ("0x")',
|
|
31
|
+
INVALID_HEX: "Invalid hex, if you are targeting a number, consider using pad() and toHex() from viem: pad(toHex(BigInt(2000))",
|
|
32
|
+
CONTRACT_NOT_DEPLOYED: "Address is not a contract. Make sure that the contract you are trying to use is deployed.",
|
|
33
|
+
ACCOUNT_NOT_DEPLOYED: "Account has not yet been deployed",
|
|
34
|
+
ACCOUNT_ALREADY_DEPLOYED: "Account already deployed",
|
|
35
|
+
NO_NATIVE_TOKEN_BALANCE_DURING_DEPLOY: "Smart Account does not have sufficient funds to execute the User Operation.",
|
|
36
|
+
SPENDER_REQUIRED: "spender is required for ERC20 mode",
|
|
37
|
+
NO_FEE_QUOTE: "FeeQuote was not provided, please call smartAccount.getTokenFees() to get feeQuote",
|
|
38
|
+
FAILED_FEE_QUOTE_FETCH: "Failed to fetch fee quote",
|
|
39
|
+
CHAIN_NOT_FOUND: "Chain not found",
|
|
40
|
+
NO_RECIPIENT: "Recipient is required",
|
|
41
|
+
NATIVE_TOKEN_WITHDRAWAL_WITHOUT_AMOUNT: "'Amount' is required for withdrawal of native token without using a paymaster",
|
|
42
|
+
MISSING_RPC_URL: "rpcUrl is required for this signer type, please provide it in the config",
|
|
43
|
+
INVALID_SESSION_INDEXES: "Session indexes and transactions must be of the same length and correspond to each other",
|
|
44
|
+
SIGNER_REQUIRED: "Signer is required for creating a smart account",
|
|
45
|
+
UNKNOW_SESSION_ARGUMENTS: "You have not provided the necessary information to find and use a session"
|
|
46
|
+
};
|
|
47
|
+
export const NATIVE_TOKEN_ALIAS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
48
|
+
export const ERC20_ABI = [
|
|
49
|
+
"function transfer(address to, uint256 value) external returns (bool)",
|
|
50
|
+
"function transferFrom(address from, address to, uint256 value) external returns (bool)",
|
|
51
|
+
"function approve(address spender, uint256 value) external returns (bool)",
|
|
52
|
+
"function allowance(address owner, address spender) external view returns (uint256)",
|
|
53
|
+
"function balanceOf(address owner) external view returns (uint256)",
|
|
54
|
+
"function decimals() external view returns (uint8)"
|
|
55
|
+
];
|
|
56
|
+
// define mode and exec type enums
|
|
57
|
+
export const CALLTYPE_SINGLE = "0x00"; // 1 byte
|
|
58
|
+
export const CALLTYPE_BATCH = "0x01"; // 1 byte
|
|
59
|
+
export const EXECTYPE_DEFAULT = "0x00"; // 1 byte
|
|
60
|
+
export const EXECTYPE_TRY = "0x01"; // 1 byte
|
|
61
|
+
export const EXECTYPE_DELEGATE = "0xFF"; // 1 byte
|
|
62
|
+
export const MODE_DEFAULT = "0x00000000"; // 4 bytes
|
|
63
|
+
export const UNUSED = "0x00000000"; // 4 bytes
|
|
64
|
+
export const MODE_PAYLOAD = "0x00000000000000000000000000000000000000000000"; // 22 bytes
|
|
65
|
+
export const GENERIC_FALLBACK_SELECTOR = "0xcb5baf0f";
|
|
66
|
+
export const SENTINEL_ADDRESS = "0x0000000000000000000000000000000000000001";
|
|
67
|
+
export const MODE_VALIDATION = "0x00";
|
|
68
|
+
export const MODE_MODULE_ENABLE = "0x01";
|
|
69
|
+
export const MODULE_ENABLE_MODE_TYPE_HASH = keccak256(toHex("ModuleEnableMode(address module, bytes32 initDataHash)"));
|
|
70
|
+
export const MOCK_MULTI_MODULE_ADDRESS = "0x9C992f91E7Cd4697B81E137007f446E826b8378b";
|
|
71
|
+
export const MODULE_TYPE_MULTI = 0;
|
|
72
|
+
// Todo: Update when final prod contracts are deployed
|
|
73
|
+
export const ACCOUNT_DOMAIN_NAME = "Startale";
|
|
74
|
+
export const ACCOUNT_DOMAIN_VERSION = "1.0.0";
|
|
75
|
+
export const ACCOUNT_DOMAIN_TYPEHASH = "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)";
|
|
76
|
+
export const PARENT_TYPEHASH = "TypedDataSign(Contents contents,string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)Contents(bytes32 stuff)";
|
|
77
|
+
export const eip1271MagicValue = "0x1626ba7e";
|
|
78
|
+
export const EXECUTE_SINGLE = concat([
|
|
79
|
+
CALLTYPE_SINGLE,
|
|
80
|
+
EXECTYPE_DEFAULT,
|
|
81
|
+
MODE_DEFAULT,
|
|
82
|
+
UNUSED,
|
|
83
|
+
MODE_PAYLOAD
|
|
84
|
+
]);
|
|
85
|
+
export const EXECUTE_BATCH = concat([
|
|
86
|
+
CALLTYPE_BATCH,
|
|
87
|
+
EXECTYPE_DEFAULT,
|
|
88
|
+
MODE_DEFAULT,
|
|
89
|
+
UNUSED,
|
|
90
|
+
MODE_PAYLOAD
|
|
91
|
+
]);
|
|
92
|
+
export const ACCOUNT_MODES = {
|
|
93
|
+
DEFAULT_SINGLE: concat([
|
|
94
|
+
pad(EXECTYPE_DEFAULT, { size: 1 }),
|
|
95
|
+
pad(CALLTYPE_SINGLE, { size: 1 }),
|
|
96
|
+
pad(UNUSED, { size: 4 }),
|
|
97
|
+
pad(MODE_DEFAULT, { size: 4 }),
|
|
98
|
+
pad(MODE_PAYLOAD, { size: 22 })
|
|
99
|
+
]),
|
|
100
|
+
DEFAULT_BATCH: concat([
|
|
101
|
+
pad(EXECTYPE_DEFAULT, { size: 1 }),
|
|
102
|
+
pad(CALLTYPE_BATCH, { size: 1 }),
|
|
103
|
+
pad(UNUSED, { size: 4 }),
|
|
104
|
+
pad(MODE_DEFAULT, { size: 4 }),
|
|
105
|
+
pad(MODE_PAYLOAD, { size: 22 })
|
|
106
|
+
]),
|
|
107
|
+
TRY_BATCH: concat([
|
|
108
|
+
pad(EXECTYPE_TRY, { size: 1 }),
|
|
109
|
+
pad(CALLTYPE_BATCH, { size: 1 }),
|
|
110
|
+
pad(UNUSED, { size: 4 }),
|
|
111
|
+
pad(MODE_DEFAULT, { size: 4 }),
|
|
112
|
+
pad(MODE_PAYLOAD, { size: 22 })
|
|
113
|
+
]),
|
|
114
|
+
TRY_SINGLE: concat([
|
|
115
|
+
pad(EXECTYPE_TRY, { size: 1 }),
|
|
116
|
+
pad(CALLTYPE_SINGLE, { size: 1 }),
|
|
117
|
+
pad(UNUSED, { size: 4 }),
|
|
118
|
+
pad(MODE_DEFAULT, { size: 4 }),
|
|
119
|
+
pad(MODE_PAYLOAD, { size: 22 })
|
|
120
|
+
]),
|
|
121
|
+
DELEGATE_SINGLE: concat([
|
|
122
|
+
pad(EXECTYPE_DELEGATE, { size: 1 }),
|
|
123
|
+
pad(CALLTYPE_SINGLE, { size: 1 }),
|
|
124
|
+
pad(UNUSED, { size: 4 }),
|
|
125
|
+
pad(MODE_DEFAULT, { size: 4 }),
|
|
126
|
+
pad(MODE_PAYLOAD, { size: 22 })
|
|
127
|
+
])
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=Constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../../src/sdk/account/utils/Constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AAC9D,MAAM,CAAC,MAAM,YAAY,GAAQ,4CAA4C,CAAA;AAE7E,uDAAuD;AACvD,MAAM,CAAC,MAAM,wBAAwB,GACnC,4CAA4C,CAAA;AAE9C,MAAM,CAAC,MAAM,4BAA4B,GAAkB,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE/E,MAA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EAAE,CAAC;QAChC,GAAG,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACxB,GAAG,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAC9B,GAAG,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;KAChC,CAAC;IACF,UAAU,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAC9B,GAAG,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACjC,GAAG,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACxB,GAAG,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAC9B,GAAG,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;KAChC,CAAC;IACF,eAAe,EAAE,MAAM,CAAC;QACtB,GAAG,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACnC,GAAG,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACjC,GAAG,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACxB,GAAG,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAC9B,GAAG,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;KAChC,CAAC;CACH,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export const isDebugging = () => {
|
|
2
|
+
try {
|
|
3
|
+
return (process?.env?.SDK_DEBUG === "true" ||
|
|
4
|
+
process?.env?.REACT_APP_SDK_DEBUG === "true" ||
|
|
5
|
+
process?.env?.NEXT_PUBLIC_SDK_DEBUG === "true");
|
|
6
|
+
}
|
|
7
|
+
catch (e) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export const isStaging = () => {
|
|
12
|
+
try {
|
|
13
|
+
return process?.env?.STAGING?.toString() === "true";
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export const bigIntReplacer = (_, value) => {
|
|
20
|
+
if (typeof value === "bigint") {
|
|
21
|
+
return `${value.toString()}n`;
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
* Returns a random integer between min and max
|
|
28
|
+
* @param min - The minimum value (inclusive)
|
|
29
|
+
* @param max - The maximum value (inclusive)
|
|
30
|
+
* @returns A random integer between min and max
|
|
31
|
+
*/
|
|
32
|
+
export const getRandomInt = (min = 1, max = 10000000000000) => {
|
|
33
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
* Returns a random bigint between min and max
|
|
38
|
+
* @param min - The minimum value (inclusive)
|
|
39
|
+
* @param max - The maximum value (inclusive)
|
|
40
|
+
* @returns A random bigint between min and max
|
|
41
|
+
*/
|
|
42
|
+
export const getRandomBigInt = (min = 1n, max = 10000000000000n) => {
|
|
43
|
+
return (BigInt(Math.floor(Math.random() * (Number(max) - Number(min) + 1))) + min);
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=Helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Helpers.js","sourceRoot":"","sources":["../../../../src/sdk/account/utils/Helpers.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,IAAI,CAAC;QACH,OAAO,CACL,OAAO,EAAE,GAAG,EAAE,SAAS,KAAK,MAAM;YAClC,OAAO,EAAE,GAAG,EAAE,mBAAmB,KAAK,MAAM;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