@zerodev/sdk 5.3.26 → 5.4.0-beta.1
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/_cjs/accounts/index.js.map +1 -1
- package/_cjs/accounts/kernel/createKernelAccount.js +173 -199
- package/_cjs/accounts/kernel/createKernelAccount.js.map +1 -1
- package/_cjs/accounts/kernel/utils/account/ep0_6/encodeCallData.js +13 -9
- package/_cjs/accounts/kernel/utils/account/ep0_6/encodeCallData.js.map +1 -1
- package/_cjs/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.js.map +1 -1
- package/_cjs/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.js +18 -17
- package/_cjs/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.js.map +1 -1
- package/_cjs/accounts/kernel/utils/account/ep0_7/encodeCallData.js +12 -8
- package/_cjs/accounts/kernel/utils/account/ep0_7/encodeCallData.js.map +1 -1
- package/_cjs/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.js.map +1 -1
- package/_cjs/accounts/kernel/utils/common/accountMetadata.js.map +1 -1
- package/_cjs/accounts/kernel/utils/common/getActionSelector.js +2 -2
- package/_cjs/accounts/kernel/utils/common/getActionSelector.js.map +1 -1
- package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.js +2 -2
- package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.js.map +1 -1
- package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.js +1 -1
- package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.js.map +1 -1
- package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.js +1 -1
- package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.js.map +1 -1
- package/_cjs/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.js +2 -2
- package/_cjs/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.js.map +1 -1
- package/_cjs/accounts/kernel/utils/ep0_7/encodeExecuteCall.js +2 -2
- package/_cjs/accounts/kernel/utils/ep0_7/encodeExecuteCall.js.map +1 -1
- package/_cjs/accounts/kernel/utils/plugins/ep0_6/getEncodedPluginsData.js.map +1 -1
- package/_cjs/accounts/kernel/utils/plugins/ep0_6/getPluginsEnableTypedData.js.map +1 -1
- package/_cjs/accounts/kernel/utils/plugins/ep0_7/getPluginsEnableTypedData.js.map +1 -1
- package/_cjs/accounts/kernel/v1/createKernelAccountV1.js +83 -94
- package/_cjs/accounts/kernel/v1/createKernelAccountV1.js.map +1 -1
- package/_cjs/accounts/kernel/v2/createKernelAccountV0_2.js +106 -110
- package/_cjs/accounts/kernel/v2/createKernelAccountV0_2.js.map +1 -1
- package/_cjs/accounts/utils/getCustomNonceKeyFromString.js +2 -4
- package/_cjs/accounts/utils/getCustomNonceKeyFromString.js.map +1 -1
- package/_cjs/accounts/utils/index.js +1 -7
- package/_cjs/accounts/utils/index.js.map +1 -1
- package/_cjs/accounts/utils/multisend.js.map +1 -1
- package/_cjs/accounts/utils/toKernelPluginManager.js +14 -16
- package/_cjs/accounts/utils/toKernelPluginManager.js.map +1 -1
- package/_cjs/actions/account-client/changeSudoValidator.js +27 -21
- package/_cjs/actions/account-client/changeSudoValidator.js.map +1 -1
- package/_cjs/actions/account-client/getKernelV3ModuleCurrentNonce.js +8 -6
- package/_cjs/actions/account-client/getKernelV3ModuleCurrentNonce.js.map +1 -1
- package/_cjs/actions/account-client/invalidateNonce.js +20 -15
- package/_cjs/actions/account-client/invalidateNonce.js.map +1 -1
- package/_cjs/actions/account-client/sendTransaction.js +42 -0
- package/_cjs/actions/account-client/sendTransaction.js.map +1 -0
- package/_cjs/actions/account-client/signMessage.js +15 -0
- package/_cjs/actions/account-client/signMessage.js.map +1 -0
- package/_cjs/actions/account-client/signTypedData.js +32 -0
- package/_cjs/actions/account-client/signTypedData.js.map +1 -0
- package/_cjs/actions/account-client/signUserOperation.js +7 -5
- package/_cjs/actions/account-client/signUserOperation.js.map +1 -1
- package/_cjs/actions/account-client/uninstallPlugin.js +13 -12
- package/_cjs/actions/account-client/uninstallPlugin.js.map +1 -1
- package/_cjs/actions/account-client/writeContract.js +21 -0
- package/_cjs/actions/account-client/writeContract.js.map +1 -0
- package/_cjs/actions/index.js +15 -3
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/paymaster/estimateGasInERC20.js +4 -4
- package/_cjs/actions/paymaster/estimateGasInERC20.js.map +1 -1
- package/_cjs/actions/paymaster/sponsorUserOperation.js +4 -6
- package/_cjs/actions/paymaster/sponsorUserOperation.js.map +1 -1
- package/_cjs/actions/public/getAccountNonce.js +38 -0
- package/_cjs/actions/public/getAccountNonce.js.map +1 -0
- package/_cjs/actions/public/getSenderAddress.js +166 -0
- package/_cjs/actions/public/getSenderAddress.js.map +1 -0
- package/_cjs/actions/public/index.js +10 -0
- package/_cjs/actions/public/index.js.map +1 -0
- package/_cjs/actions/public/isSmartAccountDeployed.js +14 -0
- package/_cjs/actions/public/isSmartAccountDeployed.js.map +1 -0
- package/_cjs/clients/decorators/kernel.js +17 -27
- package/_cjs/clients/decorators/kernel.js.map +1 -1
- package/_cjs/clients/fallbackKernelAccountClient.js.map +1 -1
- package/_cjs/clients/kernelAccountClient.js +27 -45
- package/_cjs/clients/kernelAccountClient.js.map +1 -1
- package/_cjs/clients/paymasterClient.js +7 -18
- package/_cjs/clients/paymasterClient.js.map +1 -1
- package/_cjs/errors/index.js +26 -0
- package/_cjs/errors/index.js.map +1 -0
- package/_cjs/gasTokenAddresses.js +2 -1
- package/_cjs/gasTokenAddresses.js.map +1 -1
- package/_cjs/index.js +1 -0
- package/_cjs/index.js.map +1 -1
- package/_cjs/providers/KernelEIP1193Provider.js.map +1 -1
- package/_cjs/types/index.js.map +1 -1
- package/_cjs/types/kernel.js.map +1 -1
- package/_cjs/utils.js +27 -7
- package/_cjs/utils.js.map +1 -1
- package/_esm/accounts/index.js.map +1 -1
- package/_esm/accounts/kernel/createKernelAccount.js +183 -217
- package/_esm/accounts/kernel/createKernelAccount.js.map +1 -1
- package/_esm/accounts/kernel/utils/account/ep0_6/encodeCallData.js +13 -9
- package/_esm/accounts/kernel/utils/account/ep0_6/encodeCallData.js.map +1 -1
- package/_esm/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.js.map +1 -1
- package/_esm/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.js +18 -17
- package/_esm/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.js.map +1 -1
- package/_esm/accounts/kernel/utils/account/ep0_7/encodeCallData.js +12 -8
- package/_esm/accounts/kernel/utils/account/ep0_7/encodeCallData.js.map +1 -1
- package/_esm/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.js.map +1 -1
- package/_esm/accounts/kernel/utils/common/accountMetadata.js.map +1 -1
- package/_esm/accounts/kernel/utils/common/getActionSelector.js +2 -2
- package/_esm/accounts/kernel/utils/common/getActionSelector.js.map +1 -1
- package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.js +2 -2
- package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.js.map +1 -1
- package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.js +1 -1
- package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.js.map +1 -1
- package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.js +1 -1
- package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.js.map +1 -1
- package/_esm/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.js +2 -2
- package/_esm/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.js.map +1 -1
- package/_esm/accounts/kernel/utils/ep0_7/encodeExecuteCall.js +2 -2
- package/_esm/accounts/kernel/utils/ep0_7/encodeExecuteCall.js.map +1 -1
- package/_esm/accounts/kernel/utils/plugins/ep0_6/getEncodedPluginsData.js.map +1 -1
- package/_esm/accounts/kernel/utils/plugins/ep0_6/getPluginsEnableTypedData.js.map +1 -1
- package/_esm/accounts/kernel/utils/plugins/ep0_7/getPluginsEnableTypedData.js.map +1 -1
- package/_esm/accounts/kernel/v1/createKernelAccountV1.js +93 -98
- package/_esm/accounts/kernel/v1/createKernelAccountV1.js.map +1 -1
- package/_esm/accounts/kernel/v2/createKernelAccountV0_2.js +107 -118
- package/_esm/accounts/kernel/v2/createKernelAccountV0_2.js.map +1 -1
- package/_esm/accounts/utils/getCustomNonceKeyFromString.js +2 -4
- package/_esm/accounts/utils/getCustomNonceKeyFromString.js.map +1 -1
- package/_esm/accounts/utils/index.js +0 -5
- package/_esm/accounts/utils/index.js.map +1 -1
- package/_esm/accounts/utils/multisend.js.map +1 -1
- package/_esm/accounts/utils/toKernelPluginManager.js +14 -16
- package/_esm/accounts/utils/toKernelPluginManager.js.map +1 -1
- package/_esm/actions/account-client/changeSudoValidator.js +23 -17
- package/_esm/actions/account-client/changeSudoValidator.js.map +1 -1
- package/_esm/actions/account-client/getKernelV3ModuleCurrentNonce.js +8 -6
- package/_esm/actions/account-client/getKernelV3ModuleCurrentNonce.js.map +1 -1
- package/_esm/actions/account-client/invalidateNonce.js +20 -15
- package/_esm/actions/account-client/invalidateNonce.js.map +1 -1
- package/_esm/actions/account-client/sendTransaction.js +85 -0
- package/_esm/actions/account-client/sendTransaction.js.map +1 -0
- package/_esm/actions/account-client/signMessage.js +58 -0
- package/_esm/actions/account-client/signMessage.js.map +1 -0
- package/_esm/actions/account-client/signTypedData.js +127 -0
- package/_esm/actions/account-client/signTypedData.js.map +1 -0
- package/_esm/actions/account-client/signUserOperation.js +7 -5
- package/_esm/actions/account-client/signUserOperation.js.map +1 -1
- package/_esm/actions/account-client/uninstallPlugin.js +10 -9
- package/_esm/actions/account-client/uninstallPlugin.js.map +1 -1
- package/_esm/actions/account-client/writeContract.js +18 -0
- package/_esm/actions/account-client/writeContract.js.map +1 -0
- package/_esm/actions/index.js +7 -1
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/paymaster/estimateGasInERC20.js +3 -3
- package/_esm/actions/paymaster/estimateGasInERC20.js.map +1 -1
- package/_esm/actions/paymaster/sponsorUserOperation.js +3 -5
- package/_esm/actions/paymaster/sponsorUserOperation.js.map +1 -1
- package/_esm/actions/public/getAccountNonce.js +61 -0
- package/_esm/actions/public/getAccountNonce.js.map +1 -0
- package/_esm/actions/public/getSenderAddress.js +191 -0
- package/_esm/actions/public/getSenderAddress.js.map +1 -0
- package/_esm/actions/public/index.js +4 -0
- package/_esm/actions/public/index.js.map +1 -0
- package/_esm/actions/public/isSmartAccountDeployed.js +10 -0
- package/_esm/actions/public/isSmartAccountDeployed.js.map +1 -0
- package/_esm/clients/decorators/kernel.js +19 -28
- package/_esm/clients/decorators/kernel.js.map +1 -1
- package/_esm/clients/fallbackKernelAccountClient.js.map +1 -1
- package/_esm/clients/kernelAccountClient.js +28 -46
- package/_esm/clients/kernelAccountClient.js.map +1 -1
- package/_esm/clients/paymasterClient.js +8 -19
- package/_esm/clients/paymasterClient.js.map +1 -1
- package/_esm/errors/index.js +21 -0
- package/_esm/errors/index.js.map +1 -0
- package/_esm/gasTokenAddresses.js +2 -1
- package/_esm/gasTokenAddresses.js.map +1 -1
- package/_esm/index.js +1 -0
- package/_esm/index.js.map +1 -1
- package/_esm/providers/KernelEIP1193Provider.js.map +1 -1
- package/_esm/types/index.js.map +1 -1
- package/_esm/types/kernel.js.map +1 -1
- package/_esm/utils.js +29 -7
- package/_esm/utils.js.map +1 -1
- package/_types/accounts/index.d.ts +2 -2
- package/_types/accounts/index.d.ts.map +1 -1
- package/_types/accounts/kernel/createKernelAccount.d.ts +21 -18
- package/_types/accounts/kernel/createKernelAccount.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/account/ep0_6/encodeCallData.d.ts +8 -3
- package/_types/accounts/kernel/utils/account/ep0_6/encodeCallData.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.d.ts +3 -2
- package/_types/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.d.ts +0 -1
- package/_types/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/account/ep0_7/encodeCallData.d.ts +8 -3
- package/_types/accounts/kernel/utils/account/ep0_7/encodeCallData.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.d.ts +3 -2
- package/_types/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/common/accountMetadata.d.ts +2 -2
- package/_types/accounts/kernel/utils/common/accountMetadata.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/common/getActionSelector.d.ts +1 -1
- package/_types/accounts/kernel/utils/common/getActionSelector.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.d.ts +1 -1
- package/_types/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.d.ts +1 -1
- package/_types/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/plugins/ep0_6/getEncodedPluginsData.d.ts +2 -3
- package/_types/accounts/kernel/utils/plugins/ep0_6/getEncodedPluginsData.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/plugins/ep0_6/getPluginsEnableTypedData.d.ts +4 -5
- package/_types/accounts/kernel/utils/plugins/ep0_6/getPluginsEnableTypedData.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/plugins/ep0_7/getPluginsEnableTypedData.d.ts +2 -3
- package/_types/accounts/kernel/utils/plugins/ep0_7/getPluginsEnableTypedData.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/types.d.ts +2 -2
- package/_types/accounts/kernel/utils/types.d.ts.map +1 -1
- package/_types/accounts/kernel/v1/createKernelAccountV1.d.ts +18 -9
- package/_types/accounts/kernel/v1/createKernelAccountV1.d.ts.map +1 -1
- package/_types/accounts/kernel/v2/createKernelAccountV0_2.d.ts +10 -8
- package/_types/accounts/kernel/v2/createKernelAccountV0_2.d.ts.map +1 -1
- package/_types/accounts/utils/getCustomNonceKeyFromString.d.ts +2 -2
- package/_types/accounts/utils/getCustomNonceKeyFromString.d.ts.map +1 -1
- package/_types/accounts/utils/index.d.ts +0 -2
- package/_types/accounts/utils/index.d.ts.map +1 -1
- package/_types/accounts/utils/multisend.d.ts +2 -2
- package/_types/accounts/utils/multisend.d.ts.map +1 -1
- package/_types/accounts/utils/toKernelPluginManager.d.ts +4 -4
- package/_types/accounts/utils/toKernelPluginManager.d.ts.map +1 -1
- package/_types/actions/account-client/changeSudoValidator.d.ts +5 -11
- package/_types/actions/account-client/changeSudoValidator.d.ts.map +1 -1
- package/_types/actions/account-client/getKernelV3ModuleCurrentNonce.d.ts +2 -5
- package/_types/actions/account-client/getKernelV3ModuleCurrentNonce.d.ts.map +1 -1
- package/_types/actions/account-client/invalidateNonce.d.ts +4 -6
- package/_types/actions/account-client/invalidateNonce.d.ts.map +1 -1
- package/_types/actions/account-client/sendTransaction.d.ts +50 -0
- package/_types/actions/account-client/sendTransaction.d.ts.map +1 -0
- package/_types/actions/account-client/signMessage.d.ts +50 -0
- package/_types/actions/account-client/signMessage.d.ts.map +1 -0
- package/_types/actions/account-client/signTypedData.d.ts +104 -0
- package/_types/actions/account-client/signTypedData.d.ts.map +1 -0
- package/_types/actions/account-client/signUserOperation.d.ts +4 -6
- package/_types/actions/account-client/signUserOperation.d.ts.map +1 -1
- package/_types/actions/account-client/uninstallPlugin.d.ts +5 -7
- package/_types/actions/account-client/uninstallPlugin.d.ts.map +1 -1
- package/_types/actions/account-client/writeContract.d.ts +4 -0
- package/_types/actions/account-client/writeContract.d.ts.map +1 -0
- package/_types/actions/index.d.ts +7 -1
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/paymaster/estimateGasInERC20.d.ts +1305 -4
- package/_types/actions/paymaster/estimateGasInERC20.d.ts.map +1 -1
- package/_types/actions/paymaster/sponsorUserOperation.d.ts +1314 -10
- package/_types/actions/paymaster/sponsorUserOperation.d.ts.map +1 -1
- package/_types/actions/public/getAccountNonce.d.ts +34 -0
- package/_types/actions/public/getAccountNonce.d.ts.map +1 -0
- package/_types/actions/public/getSenderAddress.d.ts +46 -0
- package/_types/actions/public/getSenderAddress.d.ts.map +1 -0
- package/_types/actions/public/index.d.ts +4 -0
- package/_types/actions/public/index.d.ts.map +1 -0
- package/_types/actions/public/isSmartAccountDeployed.d.ts +3 -0
- package/_types/actions/public/isSmartAccountDeployed.d.ts.map +1 -0
- package/_types/clients/decorators/kernel.d.ts +774 -20
- package/_types/clients/decorators/kernel.d.ts.map +1 -1
- package/_types/clients/fallbackKernelAccountClient.d.ts +255 -4
- package/_types/clients/fallbackKernelAccountClient.d.ts.map +1 -1
- package/_types/clients/kernelAccountClient.d.ts +34 -36
- package/_types/clients/kernelAccountClient.d.ts.map +1 -1
- package/_types/clients/paymasterClient.d.ts +10 -24
- package/_types/clients/paymasterClient.d.ts.map +1 -1
- package/_types/errors/index.d.ts +10 -0
- package/_types/errors/index.d.ts.map +1 -0
- package/_types/gasTokenAddresses.d.ts +1 -1
- package/_types/gasTokenAddresses.d.ts.map +1 -1
- package/_types/index.d.ts +2 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/providers/KernelEIP1193Provider.d.ts +3 -4
- package/_types/providers/KernelEIP1193Provider.d.ts.map +1 -1
- package/_types/types/index.d.ts +2 -1
- package/_types/types/index.d.ts.map +1 -1
- package/_types/types/kernel.d.ts +25 -27
- package/_types/types/kernel.d.ts.map +1 -1
- package/_types/utils.d.ts +1310 -4
- package/_types/utils.d.ts.map +1 -1
- package/accounts/index.ts +5 -2
- package/accounts/kernel/createKernelAccount.ts +315 -359
- package/accounts/kernel/utils/account/ep0_6/encodeCallData.ts +22 -12
- package/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.ts +6 -3
- package/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.ts +22 -19
- package/accounts/kernel/utils/account/ep0_7/encodeCallData.ts +21 -11
- package/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.ts +6 -3
- package/accounts/kernel/utils/common/accountMetadata.ts +2 -7
- package/accounts/kernel/utils/common/getActionSelector.ts +3 -3
- package/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.ts +3 -3
- package/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.ts +1 -1
- package/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.ts +1 -1
- package/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.ts +3 -3
- package/accounts/kernel/utils/ep0_7/encodeExecuteCall.ts +2 -2
- package/accounts/kernel/utils/plugins/ep0_6/getEncodedPluginsData.ts +2 -8
- package/accounts/kernel/utils/plugins/ep0_6/getPluginsEnableTypedData.ts +4 -10
- package/accounts/kernel/utils/plugins/ep0_7/getPluginsEnableTypedData.ts +2 -8
- package/accounts/kernel/utils/types.ts +2 -2
- package/accounts/kernel/v1/createKernelAccountV1.ts +151 -176
- package/accounts/kernel/v2/createKernelAccountV0_2.ts +141 -196
- package/accounts/utils/getCustomNonceKeyFromString.ts +3 -6
- package/accounts/utils/index.ts +0 -9
- package/accounts/utils/multisend.ts +5 -2
- package/accounts/utils/toKernelPluginManager.ts +23 -27
- package/actions/account-client/changeSudoValidator.ts +61 -85
- package/actions/account-client/getKernelV3ModuleCurrentNonce.ts +12 -51
- package/actions/account-client/invalidateNonce.ts +38 -67
- package/actions/account-client/sendTransaction.ts +134 -0
- package/actions/account-client/signMessage.ts +75 -0
- package/actions/account-client/signTypedData.ts +159 -0
- package/actions/account-client/signUserOperation.ts +31 -63
- package/actions/account-client/uninstallPlugin.ts +35 -56
- package/actions/account-client/writeContract.ts +72 -0
- package/actions/index.ts +16 -5
- package/actions/paymaster/estimateGasInERC20.ts +12 -8
- package/actions/paymaster/sponsorUserOperation.ts +52 -50
- package/actions/public/getAccountNonce.ts +77 -0
- package/actions/public/getSenderAddress.ts +276 -0
- package/actions/public/index.ts +10 -0
- package/actions/public/isSmartAccountDeployed.ts +18 -0
- package/clients/decorators/kernel.ts +363 -159
- package/clients/fallbackKernelAccountClient.ts +9 -11
- package/clients/kernelAccountClient.ts +142 -104
- package/clients/paymasterClient.ts +69 -43
- package/errors/index.ts +25 -0
- package/gasTokenAddresses.ts +3 -2
- package/index.ts +6 -2
- package/package.json +11 -34
- package/providers/KernelEIP1193Provider.ts +4 -7
- package/types/index.ts +4 -1
- package/types/kernel.ts +64 -63
- package/utils.ts +41 -13
- package/_cjs/actions/paymaster/sponsorUserOperationEip7677.js +0 -59
- package/_cjs/actions/paymaster/sponsorUserOperationEip7677.js.map +0 -1
- package/_esm/actions/paymaster/sponsorUserOperationEip7677.js +0 -58
- package/_esm/actions/paymaster/sponsorUserOperationEip7677.js.map +0 -1
- package/_types/actions/paymaster/sponsorUserOperationEip7677.d.ts +0 -16
- package/_types/actions/paymaster/sponsorUserOperationEip7677.d.ts.map +0 -1
- package/actions/paymaster/sponsorUserOperationEip7677.ts +0 -152
|
@@ -1,43 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getAccountNonce,
|
|
3
|
-
getEntryPointVersion,
|
|
4
|
-
getSenderAddress,
|
|
5
|
-
isSmartAccountDeployed
|
|
6
|
-
} from "permissionless"
|
|
7
|
-
import { SignTransactionNotSupportedBySmartAccount } from "permissionless/accounts"
|
|
8
|
-
import type {
|
|
9
|
-
ENTRYPOINT_ADDRESS_V06_TYPE,
|
|
10
|
-
EntryPoint
|
|
11
|
-
} from "permissionless/types"
|
|
12
1
|
import {
|
|
13
2
|
type Address,
|
|
14
|
-
type Chain,
|
|
15
3
|
type Client,
|
|
16
4
|
type EncodeDeployDataParameters,
|
|
17
|
-
type Hash,
|
|
18
5
|
type Hex,
|
|
19
|
-
type PublicActions,
|
|
20
|
-
type PublicRpcSchema,
|
|
21
|
-
type Transport,
|
|
22
6
|
type TypedDataDefinition,
|
|
23
7
|
concatHex,
|
|
8
|
+
createNonceManager,
|
|
24
9
|
encodeDeployData,
|
|
25
10
|
encodeFunctionData,
|
|
26
11
|
getTypesForEIP712Domain,
|
|
27
|
-
hashMessage,
|
|
28
12
|
hashTypedData,
|
|
29
13
|
parseAbi,
|
|
30
14
|
validateTypedData
|
|
31
15
|
} from "viem"
|
|
16
|
+
import {
|
|
17
|
+
type UserOperation,
|
|
18
|
+
entryPoint06Abi,
|
|
19
|
+
entryPoint06Address,
|
|
20
|
+
toSmartAccount
|
|
21
|
+
} from "viem/account-abstraction"
|
|
32
22
|
import { toAccount } from "viem/accounts"
|
|
23
|
+
import { getChainId } from "viem/actions"
|
|
24
|
+
import { getAction } from "viem/utils"
|
|
25
|
+
import {
|
|
26
|
+
getAccountNonce,
|
|
27
|
+
getSenderAddress
|
|
28
|
+
} from "../../../actions/public/index.js"
|
|
33
29
|
import type {
|
|
34
30
|
GetKernelVersion,
|
|
35
|
-
KernelEncodeCallDataArgs,
|
|
36
31
|
KernelPluginManager,
|
|
37
32
|
KernelPluginManagerParams
|
|
38
33
|
} from "../../../types/kernel.js"
|
|
39
|
-
import { wrapSignatureWith6492 } from "../../utils/6492.js"
|
|
40
|
-
import { parseFactoryAddressAndCallDataFromAccountInitCode } from "../../utils/index.js"
|
|
41
34
|
import {
|
|
42
35
|
MULTISEND_ADDRESS,
|
|
43
36
|
encodeMultiSend,
|
|
@@ -47,7 +40,10 @@ import {
|
|
|
47
40
|
isKernelPluginManager,
|
|
48
41
|
toKernelPluginManager
|
|
49
42
|
} from "../../utils/toKernelPluginManager.js"
|
|
50
|
-
import type {
|
|
43
|
+
import type {
|
|
44
|
+
CreateKernelAccountReturnType,
|
|
45
|
+
KernelSmartAccountImplementation
|
|
46
|
+
} from "../createKernelAccount.js"
|
|
51
47
|
import { KernelAccountV2Abi } from "./abi/KernelAccountV2Abi.js"
|
|
52
48
|
import { KernelFactoryV2Abi } from "./abi/KernelFactoryV2Abi.js"
|
|
53
49
|
|
|
@@ -99,35 +95,6 @@ const getAccountInitCode = async ({
|
|
|
99
95
|
])
|
|
100
96
|
}
|
|
101
97
|
|
|
102
|
-
/**
|
|
103
|
-
* Check the validity of an existing account address, or fetch the pre-deterministic account address for a kernel smart wallet
|
|
104
|
-
* @param client
|
|
105
|
-
* @param entryPoint
|
|
106
|
-
* @param initCodeProvider
|
|
107
|
-
*/
|
|
108
|
-
const getAccountAddress = async <
|
|
109
|
-
entryPoint extends EntryPoint,
|
|
110
|
-
TTransport extends Transport = Transport,
|
|
111
|
-
TChain extends Chain | undefined = Chain | undefined
|
|
112
|
-
>({
|
|
113
|
-
client,
|
|
114
|
-
entryPoint: entryPointAddress,
|
|
115
|
-
initCodeProvider
|
|
116
|
-
}: {
|
|
117
|
-
client: Client<TTransport, TChain, undefined>
|
|
118
|
-
initCodeProvider: () => Promise<Hex>
|
|
119
|
-
entryPoint: entryPoint
|
|
120
|
-
}): Promise<Address> => {
|
|
121
|
-
// Find the init code for this account
|
|
122
|
-
const initCode = await initCodeProvider()
|
|
123
|
-
|
|
124
|
-
// Get the sender address based on the init code
|
|
125
|
-
return getSenderAddress(client, {
|
|
126
|
-
initCode,
|
|
127
|
-
entryPoint: entryPointAddress as ENTRYPOINT_ADDRESS_V06_TYPE
|
|
128
|
-
})
|
|
129
|
-
}
|
|
130
|
-
|
|
131
98
|
/**
|
|
132
99
|
* Build a kernel smart account from a private key, that use the ECDSA signer behind the scene
|
|
133
100
|
* @param client
|
|
@@ -138,43 +105,31 @@ const getAccountAddress = async <
|
|
|
138
105
|
* @param ecdsaValidatorAddress
|
|
139
106
|
* @param deployedAccountAddress
|
|
140
107
|
*/
|
|
141
|
-
export async function createKernelAccountV0_2
|
|
142
|
-
|
|
143
|
-
TTransport extends Transport = Transport,
|
|
144
|
-
TChain extends Chain | undefined = Chain | undefined
|
|
145
|
-
>(
|
|
146
|
-
client: Client<
|
|
147
|
-
TTransport,
|
|
148
|
-
TChain,
|
|
149
|
-
undefined,
|
|
150
|
-
PublicRpcSchema,
|
|
151
|
-
PublicActions<TTransport, TChain>
|
|
152
|
-
>,
|
|
108
|
+
export async function createKernelAccountV0_2(
|
|
109
|
+
client: Client,
|
|
153
110
|
{
|
|
154
111
|
plugins,
|
|
155
|
-
entryPoint
|
|
112
|
+
entryPoint,
|
|
156
113
|
index = 0n,
|
|
157
114
|
factoryAddress = KERNEL_ADDRESSES.FACTORY_ADDRESS,
|
|
158
|
-
|
|
115
|
+
address
|
|
159
116
|
}: {
|
|
160
117
|
plugins:
|
|
161
118
|
| Omit<
|
|
162
|
-
KernelPluginManagerParams<
|
|
119
|
+
KernelPluginManagerParams<"0.6">,
|
|
163
120
|
"entryPoint" | "kernelVersion"
|
|
164
121
|
>
|
|
165
|
-
| KernelPluginManager<
|
|
166
|
-
entryPoint:
|
|
122
|
+
| KernelPluginManager<"0.6">
|
|
123
|
+
entryPoint: {
|
|
124
|
+
address: Address
|
|
125
|
+
version: "0.6"
|
|
126
|
+
}
|
|
167
127
|
index?: bigint
|
|
168
128
|
factoryAddress?: Address
|
|
169
|
-
|
|
129
|
+
address?: Address
|
|
170
130
|
}
|
|
171
|
-
): Promise<
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
if (entryPointVersion !== "v0.6") {
|
|
175
|
-
throw new Error("Only EntryPoint 0.6 is supported")
|
|
176
|
-
}
|
|
177
|
-
const kernelPluginManager = isKernelPluginManager<entryPoint>(plugins)
|
|
131
|
+
): Promise<CreateKernelAccountReturnType<"0.6">> {
|
|
132
|
+
const kernelPluginManager = isKernelPluginManager<"0.6">(plugins)
|
|
178
133
|
? plugins
|
|
179
134
|
: await toKernelPluginManager(client, {
|
|
180
135
|
sudo: plugins.sudo,
|
|
@@ -182,7 +137,7 @@ export async function createKernelAccountV0_2<
|
|
|
182
137
|
action: plugins.action,
|
|
183
138
|
pluginEnableSignature: plugins.pluginEnableSignature,
|
|
184
139
|
kernelVersion: "0.0.2",
|
|
185
|
-
entryPoint
|
|
140
|
+
entryPoint
|
|
186
141
|
})
|
|
187
142
|
// Helper to generate the init code for the smart account
|
|
188
143
|
const generateInitCode = async () => {
|
|
@@ -196,97 +151,86 @@ export async function createKernelAccountV0_2<
|
|
|
196
151
|
})
|
|
197
152
|
}
|
|
198
153
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
initCodeProvider: generateInitCode
|
|
206
|
-
}))
|
|
154
|
+
const getFactoryArgs = async () => {
|
|
155
|
+
return {
|
|
156
|
+
factory: factoryAddress,
|
|
157
|
+
factoryData: await generateInitCode()
|
|
158
|
+
}
|
|
159
|
+
}
|
|
207
160
|
|
|
208
|
-
|
|
161
|
+
// Fetch account address
|
|
162
|
+
let accountAddress =
|
|
163
|
+
address ??
|
|
164
|
+
(await (async () => {
|
|
165
|
+
const { factory, factoryData } = await getFactoryArgs()
|
|
166
|
+
|
|
167
|
+
// Get the sender address based on the init code
|
|
168
|
+
return await getSenderAddress(client, {
|
|
169
|
+
factory,
|
|
170
|
+
factoryData,
|
|
171
|
+
entryPointAddress: entryPoint.address
|
|
172
|
+
})
|
|
173
|
+
})())
|
|
209
174
|
|
|
210
175
|
// Build the EOA Signer
|
|
211
176
|
const account = toAccount({
|
|
212
177
|
address: accountAddress,
|
|
213
178
|
async signMessage({ message }) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
kernelPluginManager.signMessage({
|
|
218
|
-
message: {
|
|
219
|
-
raw: messageHash
|
|
220
|
-
}
|
|
221
|
-
})
|
|
222
|
-
])
|
|
223
|
-
return create6492Signature(isDeployed, signature)
|
|
179
|
+
return kernelPluginManager.signMessage({
|
|
180
|
+
message
|
|
181
|
+
})
|
|
224
182
|
},
|
|
225
183
|
async signTransaction(_, __) {
|
|
226
|
-
throw new
|
|
184
|
+
throw new Error(
|
|
185
|
+
"Smart account signer doesn't need to sign transactions"
|
|
186
|
+
)
|
|
227
187
|
},
|
|
228
188
|
async signTypedData(typedData) {
|
|
189
|
+
const _typedData = typedData as TypedDataDefinition
|
|
229
190
|
const types = {
|
|
230
191
|
EIP712Domain: getTypesForEIP712Domain({
|
|
231
|
-
domain:
|
|
192
|
+
domain: _typedData.domain
|
|
232
193
|
}),
|
|
233
|
-
...
|
|
194
|
+
..._typedData.types
|
|
234
195
|
}
|
|
235
196
|
|
|
236
197
|
// Need to do a runtime validation check on addresses, byte ranges, integer ranges, etc
|
|
237
198
|
// as we can't statically check this with TypeScript.
|
|
238
199
|
validateTypedData({
|
|
239
|
-
domain:
|
|
240
|
-
message:
|
|
241
|
-
primaryType:
|
|
200
|
+
domain: _typedData.domain,
|
|
201
|
+
message: _typedData.message,
|
|
202
|
+
primaryType: _typedData.primaryType,
|
|
242
203
|
types: types
|
|
243
|
-
}
|
|
204
|
+
})
|
|
244
205
|
|
|
245
206
|
const typedHash = hashTypedData(typedData)
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}
|
|
252
|
-
})
|
|
253
|
-
])
|
|
254
|
-
return create6492Signature(isDeployed, signature)
|
|
207
|
+
return kernelPluginManager.signMessage({
|
|
208
|
+
message: {
|
|
209
|
+
raw: typedHash
|
|
210
|
+
}
|
|
211
|
+
})
|
|
255
212
|
}
|
|
256
213
|
})
|
|
257
214
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const [factoryAddress, factoryCalldata] =
|
|
272
|
-
parseFactoryAddressAndCallDataFromAccountInitCode(
|
|
273
|
-
await generateInitCode()
|
|
274
|
-
)
|
|
275
|
-
|
|
276
|
-
return wrapSignatureWith6492({
|
|
277
|
-
factoryAddress,
|
|
278
|
-
factoryCalldata,
|
|
279
|
-
signature
|
|
280
|
-
})
|
|
215
|
+
const _entryPoint = {
|
|
216
|
+
address: entryPoint?.address ?? entryPoint06Address,
|
|
217
|
+
abi: entryPoint06Abi,
|
|
218
|
+
version: entryPoint?.version ?? "0.6"
|
|
219
|
+
}
|
|
220
|
+
let chainId: number
|
|
221
|
+
|
|
222
|
+
const getMemoizedChainId = async () => {
|
|
223
|
+
if (chainId) return chainId
|
|
224
|
+
chainId = client.chain
|
|
225
|
+
? client.chain.id
|
|
226
|
+
: await getAction(client, getChainId, "getChainId")({})
|
|
227
|
+
return chainId
|
|
281
228
|
}
|
|
282
229
|
|
|
283
|
-
return {
|
|
284
|
-
|
|
285
|
-
kernelVersion: "0.0.2" as GetKernelVersion<entryPoint>,
|
|
230
|
+
return toSmartAccount<KernelSmartAccountImplementation<"0.6">>({
|
|
231
|
+
kernelVersion: "0.0.2" as GetKernelVersion<"0.6">,
|
|
286
232
|
client: client,
|
|
287
|
-
|
|
288
|
-
entryPoint: entryPointAddress,
|
|
289
|
-
source: "kernelSmartAccount",
|
|
233
|
+
entryPoint: _entryPoint,
|
|
290
234
|
kernelPluginManager,
|
|
291
235
|
generateInitCode,
|
|
292
236
|
encodeModuleInstallCallData: async () => {
|
|
@@ -294,65 +238,56 @@ export async function createKernelAccountV0_2<
|
|
|
294
238
|
accountAddress
|
|
295
239
|
)
|
|
296
240
|
},
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
accountAddress
|
|
303
|
-
)
|
|
304
|
-
|
|
305
|
-
if (smartAccountDeployed) return undefined
|
|
306
|
-
|
|
307
|
-
return factoryAddress
|
|
241
|
+
nonceKeyManager: createNonceManager({
|
|
242
|
+
source: { get: () => 0, set: () => {} }
|
|
243
|
+
}),
|
|
244
|
+
async sign({ hash }) {
|
|
245
|
+
return account.signMessage({ message: hash })
|
|
308
246
|
},
|
|
247
|
+
async signMessage(message) {
|
|
248
|
+
return account.signMessage(message)
|
|
249
|
+
},
|
|
250
|
+
async signTypedData(typedData) {
|
|
251
|
+
return account.signTypedData(typedData)
|
|
252
|
+
},
|
|
253
|
+
getFactoryArgs,
|
|
254
|
+
async getAddress() {
|
|
255
|
+
if (accountAddress) return accountAddress
|
|
309
256
|
|
|
310
|
-
|
|
311
|
-
if (smartAccountDeployed) return undefined
|
|
312
|
-
|
|
313
|
-
smartAccountDeployed = await isSmartAccountDeployed(
|
|
314
|
-
client,
|
|
315
|
-
accountAddress
|
|
316
|
-
)
|
|
257
|
+
const { factory, factoryData } = await getFactoryArgs()
|
|
317
258
|
|
|
318
|
-
|
|
259
|
+
// Get the sender address based on the init code
|
|
260
|
+
accountAddress = await getSenderAddress(client, {
|
|
261
|
+
factory,
|
|
262
|
+
factoryData,
|
|
263
|
+
entryPointAddress: entryPoint.address
|
|
264
|
+
})
|
|
319
265
|
|
|
320
|
-
return
|
|
321
|
-
await generateInitCode()
|
|
322
|
-
)[1]
|
|
266
|
+
return accountAddress
|
|
323
267
|
},
|
|
324
|
-
|
|
325
268
|
// Get the nonce of the smart account
|
|
326
|
-
async getNonce(
|
|
269
|
+
async getNonce(_args) {
|
|
327
270
|
const key = await kernelPluginManager.getNonceKey(
|
|
328
271
|
accountAddress,
|
|
329
|
-
|
|
272
|
+
_args?.key
|
|
330
273
|
)
|
|
331
274
|
return getAccountNonce(client, {
|
|
332
|
-
|
|
333
|
-
|
|
275
|
+
address: accountAddress,
|
|
276
|
+
entryPointAddress: entryPoint.address,
|
|
334
277
|
key
|
|
335
278
|
})
|
|
336
279
|
},
|
|
337
280
|
|
|
338
281
|
// Sign a user operation
|
|
339
|
-
async signUserOperation(
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
smartAccountDeployed = await isSmartAccountDeployed(
|
|
348
|
-
client,
|
|
349
|
-
accountAddress
|
|
350
|
-
)
|
|
351
|
-
|
|
352
|
-
if (smartAccountDeployed) return "0x"
|
|
353
|
-
return generateInitCode()
|
|
282
|
+
async signUserOperation(parameters) {
|
|
283
|
+
const { chainId = await getMemoizedChainId(), ...userOperation } =
|
|
284
|
+
parameters
|
|
285
|
+
return kernelPluginManager.signUserOperation({
|
|
286
|
+
...userOperation,
|
|
287
|
+
sender: userOperation.sender ?? (await this.getAddress()),
|
|
288
|
+
chainId
|
|
289
|
+
})
|
|
354
290
|
},
|
|
355
|
-
|
|
356
291
|
// Encode the deploy call data
|
|
357
292
|
async encodeDeployCallData(_tx) {
|
|
358
293
|
return encodeFunctionData({
|
|
@@ -379,13 +314,12 @@ export async function createKernelAccountV0_2<
|
|
|
379
314
|
},
|
|
380
315
|
|
|
381
316
|
// Encode a call
|
|
382
|
-
async
|
|
383
|
-
|
|
384
|
-
if (Array.isArray(tx)) {
|
|
317
|
+
async encodeCalls(calls, callType): Promise<Hex> {
|
|
318
|
+
if (calls.length > 1) {
|
|
385
319
|
const multiSendCallData = encodeFunctionData({
|
|
386
320
|
abi: multiSendAbi,
|
|
387
321
|
functionName: "multiSend",
|
|
388
|
-
args: [encodeMultiSend(
|
|
322
|
+
args: [encodeMultiSend(calls)]
|
|
389
323
|
})
|
|
390
324
|
return encodeFunctionData({
|
|
391
325
|
abi: KernelAccountV2Abi,
|
|
@@ -394,23 +328,29 @@ export async function createKernelAccountV0_2<
|
|
|
394
328
|
})
|
|
395
329
|
}
|
|
396
330
|
|
|
331
|
+
const call = calls.length === 0 ? undefined : calls[0]
|
|
332
|
+
|
|
333
|
+
if (!call) {
|
|
334
|
+
throw new Error("No calls to encode")
|
|
335
|
+
}
|
|
336
|
+
|
|
397
337
|
// Default to `call`
|
|
398
|
-
if (!
|
|
399
|
-
if (
|
|
400
|
-
return
|
|
338
|
+
if (!callType || callType === "call") {
|
|
339
|
+
if (call.to.toLowerCase() === accountAddress.toLowerCase()) {
|
|
340
|
+
return call.data || "0x"
|
|
401
341
|
}
|
|
402
342
|
return encodeFunctionData({
|
|
403
343
|
abi: KernelAccountV2Abi,
|
|
404
344
|
functionName: "execute",
|
|
405
|
-
args: [
|
|
345
|
+
args: [call.to, call.value || 0n, call.data || "0x", 0]
|
|
406
346
|
})
|
|
407
347
|
}
|
|
408
348
|
|
|
409
|
-
if (
|
|
349
|
+
if (callType === "delegatecall") {
|
|
410
350
|
return encodeFunctionData({
|
|
411
351
|
abi: KernelAccountV2Abi,
|
|
412
352
|
functionName: "execute",
|
|
413
|
-
args: [
|
|
353
|
+
args: [call.to, 0n, call.data || "0x", 1]
|
|
414
354
|
})
|
|
415
355
|
}
|
|
416
356
|
|
|
@@ -418,8 +358,13 @@ export async function createKernelAccountV0_2<
|
|
|
418
358
|
},
|
|
419
359
|
|
|
420
360
|
// Get simple dummy signature
|
|
421
|
-
async
|
|
422
|
-
|
|
361
|
+
async getStubSignature(userOperation) {
|
|
362
|
+
if (!userOperation) {
|
|
363
|
+
throw new Error("No user operation provided")
|
|
364
|
+
}
|
|
365
|
+
return kernelPluginManager.getStubSignature(
|
|
366
|
+
userOperation as UserOperation
|
|
367
|
+
)
|
|
423
368
|
}
|
|
424
|
-
}
|
|
369
|
+
})
|
|
425
370
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { getEntryPointVersion } from "permissionless"
|
|
2
|
-
import type { EntryPoint } from "permissionless/types"
|
|
3
1
|
import { keccak256, toHex } from "viem"
|
|
2
|
+
import type { EntryPointVersion } from "viem/account-abstraction"
|
|
4
3
|
|
|
5
4
|
const hashAndTruncate = (input: string, byteSize: number): bigint => {
|
|
6
5
|
const hash = keccak256(toHex(input))
|
|
@@ -10,11 +9,9 @@ const hashAndTruncate = (input: string, byteSize: number): bigint => {
|
|
|
10
9
|
|
|
11
10
|
export const getCustomNonceKeyFromString = (
|
|
12
11
|
input: string,
|
|
13
|
-
|
|
12
|
+
entryPointVersion: EntryPointVersion
|
|
14
13
|
) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (entryPointVersion === "v0.6") {
|
|
14
|
+
if (entryPointVersion === "0.6") {
|
|
18
15
|
return hashAndTruncate(input, 24) // 24 bytes for v0.6
|
|
19
16
|
}
|
|
20
17
|
return hashAndTruncate(input, 2) // 2 bytes for v0.7
|
package/accounts/utils/index.ts
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
export { toKernelPluginManager } from "./toKernelPluginManager.js"
|
|
2
2
|
|
|
3
|
-
import type { Address, Hex } from "viem"
|
|
4
3
|
export { verifyEIP6492Signature, universalValidatorByteCode } from "./6492.js"
|
|
5
4
|
|
|
6
|
-
export const parseFactoryAddressAndCallDataFromAccountInitCode = (
|
|
7
|
-
initCode: Hex
|
|
8
|
-
): [Address, Hex] => {
|
|
9
|
-
const factoryAddress = `0x${initCode.substring(2, 42)}` as Address
|
|
10
|
-
const factoryCalldata = `0x${initCode.substring(42)}` as Hex
|
|
11
|
-
return [factoryAddress, factoryCalldata]
|
|
12
|
-
}
|
|
13
|
-
|
|
14
5
|
export { getCustomNonceKeyFromString } from "./getCustomNonceKeyFromString.js"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Address, type Hex, encodePacked, toBytes } from "viem"
|
|
2
|
-
import type { CallType
|
|
2
|
+
import type { CallType } from "../../types/index.js"
|
|
3
|
+
import type { KernelSmartAccountImplementation } from "../kernel/createKernelAccount.js"
|
|
3
4
|
|
|
4
5
|
export const MULTISEND_ADDRESS = "0x8ae01fcf7c655655ff2c6ef907b8b4718ab4e17c"
|
|
5
6
|
|
|
@@ -31,7 +32,9 @@ const encodeCall = (call: {
|
|
|
31
32
|
return encoded.slice(2)
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
export const encodeMultiSend = (
|
|
35
|
+
export const encodeMultiSend = (
|
|
36
|
+
calls: Parameters<KernelSmartAccountImplementation<"0.6">["encodeCalls"]>[0]
|
|
37
|
+
): Hex => {
|
|
35
38
|
if (!Array.isArray(calls)) {
|
|
36
39
|
throw new Error("Invalid multiSend calls, should use an array of calls")
|
|
37
40
|
}
|