@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,55 +1,57 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
getAccountNonce,
|
|
4
|
-
getEntryPointVersion,
|
|
5
|
-
getSenderAddress,
|
|
6
|
-
getUserOperationHash,
|
|
7
|
-
isSmartAccountDeployed
|
|
8
|
-
} from "permissionless"
|
|
9
|
-
import {
|
|
10
|
-
SignTransactionNotSupportedBySmartAccount,
|
|
11
|
-
type SmartAccountSigner
|
|
12
|
-
} from "permissionless/accounts"
|
|
13
|
-
import type {
|
|
14
|
-
ENTRYPOINT_ADDRESS_V06_TYPE,
|
|
15
|
-
EntryPoint
|
|
16
|
-
} from "permissionless/types"
|
|
17
|
-
import {
|
|
2
|
+
type Account,
|
|
18
3
|
type Address,
|
|
4
|
+
type Assign,
|
|
19
5
|
type Chain,
|
|
20
6
|
type Client,
|
|
21
|
-
type
|
|
7
|
+
type EIP1193Provider,
|
|
22
8
|
type Hex,
|
|
23
9
|
type LocalAccount,
|
|
24
|
-
type
|
|
25
|
-
type PublicRpcSchema,
|
|
10
|
+
type OneOf,
|
|
26
11
|
type Transport,
|
|
27
12
|
type TypedData,
|
|
28
13
|
type TypedDataDefinition,
|
|
29
|
-
|
|
14
|
+
type WalletClient,
|
|
15
|
+
createNonceManager,
|
|
30
16
|
encodeFunctionData
|
|
31
17
|
} from "viem"
|
|
18
|
+
import {
|
|
19
|
+
type SmartAccount,
|
|
20
|
+
type SmartAccountImplementation,
|
|
21
|
+
entryPoint06Abi,
|
|
22
|
+
entryPoint06Address,
|
|
23
|
+
getUserOperationHash,
|
|
24
|
+
toSmartAccount
|
|
25
|
+
} from "viem/account-abstraction"
|
|
32
26
|
import { toAccount } from "viem/accounts"
|
|
33
|
-
import { getChainId, signMessage
|
|
34
|
-
import
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
import { getChainId, signMessage } from "viem/actions"
|
|
28
|
+
import {
|
|
29
|
+
getAccountNonce,
|
|
30
|
+
getSenderAddress
|
|
31
|
+
} from "../../../actions/public/index.js"
|
|
32
|
+
import type { CallType, GetEntryPointAbi } from "../../../types/kernel.js"
|
|
37
33
|
import {
|
|
38
34
|
MULTISEND_ADDRESS,
|
|
39
35
|
encodeMultiSend,
|
|
40
36
|
multiSendAbi
|
|
41
37
|
} from "../../utils/multisend.js"
|
|
42
|
-
import type { KernelSmartAccount } from "../createKernelAccount.js"
|
|
43
38
|
|
|
44
|
-
export type
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
39
|
+
export type KernelSmartAccountV1Implementation = Assign<
|
|
40
|
+
SmartAccountImplementation<GetEntryPointAbi<"0.6">, "0.6">,
|
|
41
|
+
{
|
|
42
|
+
sign: NonNullable<SmartAccountImplementation["sign"]>
|
|
43
|
+
encodeCalls: (
|
|
44
|
+
calls: Parameters<SmartAccountImplementation["encodeCalls"]>[0],
|
|
45
|
+
callType?: CallType | undefined
|
|
46
|
+
) => Promise<Hex>
|
|
47
|
+
generateInitCode: () => Promise<Hex>
|
|
48
|
+
encodeModuleInstallCallData: () => Promise<Hex>
|
|
49
|
+
}
|
|
51
50
|
>
|
|
52
51
|
|
|
52
|
+
export type CreateKernelAccountV1ReturnType =
|
|
53
|
+
SmartAccount<KernelSmartAccountV1Implementation>
|
|
54
|
+
|
|
53
55
|
const createAccountAbi = [
|
|
54
56
|
{
|
|
55
57
|
inputs: [
|
|
@@ -92,43 +94,33 @@ const KERNEL_V1_ADDRESSES: {
|
|
|
92
94
|
ENTRYPOINT_V0_6: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
|
|
93
95
|
}
|
|
94
96
|
|
|
95
|
-
export async function createKernelAccountV1
|
|
96
|
-
|
|
97
|
-
TTransport extends Transport = Transport,
|
|
98
|
-
TChain extends Chain | undefined = Chain | undefined,
|
|
99
|
-
TSource extends string = string,
|
|
100
|
-
TAddress extends Address = Address
|
|
101
|
-
>(
|
|
102
|
-
client: Client<
|
|
103
|
-
TTransport,
|
|
104
|
-
TChain,
|
|
105
|
-
undefined,
|
|
106
|
-
PublicRpcSchema,
|
|
107
|
-
PublicActions<TTransport, TChain>
|
|
108
|
-
>,
|
|
97
|
+
export async function createKernelAccountV1(
|
|
98
|
+
client: Client,
|
|
109
99
|
{
|
|
110
100
|
signer,
|
|
111
|
-
|
|
101
|
+
address,
|
|
102
|
+
entryPoint,
|
|
112
103
|
index = 0n
|
|
113
104
|
}: {
|
|
114
|
-
signer:
|
|
115
|
-
|
|
105
|
+
signer: OneOf<
|
|
106
|
+
| EIP1193Provider
|
|
107
|
+
| WalletClient<Transport, Chain | undefined, Account>
|
|
108
|
+
| LocalAccount
|
|
109
|
+
>
|
|
110
|
+
entryPoint: {
|
|
111
|
+
address: Address
|
|
112
|
+
version: "0.6"
|
|
113
|
+
}
|
|
114
|
+
address?: Address
|
|
116
115
|
index?: bigint
|
|
117
116
|
}
|
|
118
|
-
): Promise<
|
|
119
|
-
const entryPointVersion = getEntryPointVersion(entryPointAddress)
|
|
120
|
-
|
|
121
|
-
if (
|
|
122
|
-
entryPointVersion !== "v0.6" ||
|
|
123
|
-
entryPointAddress !== ENTRYPOINT_ADDRESS_V06
|
|
124
|
-
) {
|
|
125
|
-
throw new Error("Only EntryPoint 0.6 is supported")
|
|
126
|
-
}
|
|
127
|
-
|
|
117
|
+
): Promise<CreateKernelAccountV1ReturnType> {
|
|
128
118
|
const viemSigner: LocalAccount = {
|
|
129
119
|
...signer,
|
|
130
120
|
signTransaction: (_, __) => {
|
|
131
|
-
throw new
|
|
121
|
+
throw new Error(
|
|
122
|
+
"Smart account signer doesn't need to sign transactions"
|
|
123
|
+
)
|
|
132
124
|
}
|
|
133
125
|
} as LocalAccount
|
|
134
126
|
|
|
@@ -136,43 +128,45 @@ export async function createKernelAccountV1<
|
|
|
136
128
|
const chainId = await getChainId(client)
|
|
137
129
|
|
|
138
130
|
const generateInitCode = async (): Promise<Hex> => {
|
|
139
|
-
return
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
args: [signer.address, index]
|
|
145
|
-
})
|
|
146
|
-
]) as Hex
|
|
131
|
+
return encodeFunctionData({
|
|
132
|
+
abi: createAccountAbi,
|
|
133
|
+
functionName: "createAccount",
|
|
134
|
+
args: [signer.address, index]
|
|
135
|
+
})
|
|
147
136
|
}
|
|
148
137
|
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
initCode,
|
|
154
|
-
entryPoint: entryPointAddress
|
|
138
|
+
const getFactoryArgs = async () => {
|
|
139
|
+
return {
|
|
140
|
+
factory: KERNEL_V1_ADDRESSES.FACTORY_ADDRESS,
|
|
141
|
+
factoryData: await generateInitCode()
|
|
155
142
|
}
|
|
156
|
-
|
|
143
|
+
}
|
|
157
144
|
|
|
158
|
-
|
|
145
|
+
// Fetch account address and chain id
|
|
146
|
+
let accountAddress =
|
|
147
|
+
address ??
|
|
148
|
+
(await (async () => {
|
|
149
|
+
const { factory, factoryData } = await getFactoryArgs()
|
|
150
|
+
|
|
151
|
+
// Get the sender address based on the init code
|
|
152
|
+
return await getSenderAddress(client, {
|
|
153
|
+
factory,
|
|
154
|
+
factoryData,
|
|
155
|
+
entryPointAddress: entryPoint.address
|
|
156
|
+
})
|
|
157
|
+
})())
|
|
159
158
|
|
|
160
|
-
|
|
161
|
-
client,
|
|
162
|
-
accountAddress
|
|
163
|
-
)
|
|
159
|
+
if (!accountAddress) throw new Error("Account address not found")
|
|
164
160
|
|
|
165
161
|
const account = toAccount({
|
|
166
162
|
address: accountAddress,
|
|
167
163
|
async signMessage({ message }) {
|
|
168
|
-
|
|
169
|
-
isSmartAccountDeployed(client, accountAddress),
|
|
170
|
-
signer.signMessage({ message })
|
|
171
|
-
])
|
|
172
|
-
return create6492Signature(isDeployed, signature)
|
|
164
|
+
return viemSigner.signMessage({ message })
|
|
173
165
|
},
|
|
174
166
|
async signTransaction(_, __) {
|
|
175
|
-
throw new
|
|
167
|
+
throw new Error(
|
|
168
|
+
"Smart account signer doesn't need to sign transactions"
|
|
169
|
+
)
|
|
176
170
|
},
|
|
177
171
|
async signTypedData<
|
|
178
172
|
const TTypedData extends TypedData | Record<string, unknown>,
|
|
@@ -180,94 +174,71 @@ export async function createKernelAccountV1<
|
|
|
180
174
|
| keyof TTypedData
|
|
181
175
|
| "EIP712Domain" = keyof TTypedData
|
|
182
176
|
>(typedData: TypedDataDefinition<TTypedData, TPrimaryType>) {
|
|
183
|
-
return signTypedData
|
|
184
|
-
client,
|
|
185
|
-
{
|
|
186
|
-
account: viemSigner,
|
|
187
|
-
...typedData
|
|
188
|
-
}
|
|
189
|
-
)
|
|
177
|
+
return viemSigner.signTypedData(typedData)
|
|
190
178
|
}
|
|
191
179
|
})
|
|
192
180
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
// return (contractCode?.length ?? 0) > 2
|
|
199
|
-
// }
|
|
200
|
-
|
|
201
|
-
const create6492Signature = async (
|
|
202
|
-
isDeployed: boolean,
|
|
203
|
-
signature: Hash
|
|
204
|
-
): Promise<Hash> => {
|
|
205
|
-
if (isDeployed) {
|
|
206
|
-
return signature
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const [factoryAddress, factoryCalldata] =
|
|
210
|
-
parseFactoryAddressAndCallDataFromAccountInitCode(
|
|
211
|
-
await generateInitCode()
|
|
212
|
-
)
|
|
213
|
-
|
|
214
|
-
return wrapSignatureWith6492({
|
|
215
|
-
factoryAddress,
|
|
216
|
-
factoryCalldata,
|
|
217
|
-
signature
|
|
218
|
-
})
|
|
181
|
+
const _entryPoint = {
|
|
182
|
+
address: entryPoint?.address ?? entryPoint06Address,
|
|
183
|
+
abi: entryPoint06Abi,
|
|
184
|
+
version: entryPoint?.version ?? "0.6"
|
|
219
185
|
}
|
|
220
186
|
|
|
221
|
-
return {
|
|
187
|
+
return toSmartAccount<KernelSmartAccountV1Implementation>({
|
|
222
188
|
...account,
|
|
223
189
|
generateInitCode,
|
|
224
190
|
encodeModuleInstallCallData: async () => {
|
|
225
191
|
throw new Error("Not implemented")
|
|
226
192
|
},
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
client,
|
|
236
|
-
accountAddress
|
|
237
|
-
)
|
|
238
|
-
|
|
239
|
-
if (smartAccountDeployed) return undefined
|
|
240
|
-
|
|
241
|
-
return KERNEL_V1_ADDRESSES.FACTORY_ADDRESS
|
|
193
|
+
nonceKeyManager: createNonceManager({
|
|
194
|
+
source: { get: () => 0, set: () => {} }
|
|
195
|
+
}),
|
|
196
|
+
async sign({ hash }) {
|
|
197
|
+
return account.signMessage({ message: hash })
|
|
198
|
+
},
|
|
199
|
+
async signMessage({ message }) {
|
|
200
|
+
return account.signMessage({ message })
|
|
242
201
|
},
|
|
202
|
+
async signTypedData<
|
|
203
|
+
const TTypedData extends TypedData | Record<string, unknown>,
|
|
204
|
+
TPrimaryType extends
|
|
205
|
+
| keyof TTypedData
|
|
206
|
+
| "EIP712Domain" = keyof TTypedData
|
|
207
|
+
>(typedData: TypedDataDefinition<TTypedData, TPrimaryType>) {
|
|
208
|
+
return viemSigner.signTypedData(typedData)
|
|
209
|
+
},
|
|
210
|
+
async getAddress() {
|
|
211
|
+
if (accountAddress) return accountAddress
|
|
243
212
|
|
|
244
|
-
|
|
245
|
-
if (smartAccountDeployed) return undefined
|
|
213
|
+
const { factory, factoryData } = await getFactoryArgs()
|
|
246
214
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
215
|
+
// Get the sender address based on the init code
|
|
216
|
+
accountAddress = await getSenderAddress(client, {
|
|
217
|
+
factory,
|
|
218
|
+
factoryData,
|
|
219
|
+
entryPointAddress: entryPoint.address
|
|
220
|
+
})
|
|
253
221
|
|
|
254
|
-
return
|
|
255
|
-
await generateInitCode()
|
|
256
|
-
)[1]
|
|
222
|
+
return accountAddress
|
|
257
223
|
},
|
|
224
|
+
getFactoryArgs,
|
|
225
|
+
client: client,
|
|
226
|
+
entryPoint: _entryPoint,
|
|
258
227
|
async getNonce() {
|
|
259
228
|
return getAccountNonce(client, {
|
|
260
|
-
|
|
261
|
-
|
|
229
|
+
address: accountAddress,
|
|
230
|
+
entryPointAddress: entryPoint.address
|
|
262
231
|
})
|
|
263
232
|
},
|
|
264
233
|
async signUserOperation(userOperation) {
|
|
265
234
|
const hash = getUserOperationHash({
|
|
266
235
|
userOperation: {
|
|
267
236
|
...userOperation,
|
|
237
|
+
sender: userOperation.sender ?? (await this.getAddress()),
|
|
268
238
|
signature: "0x"
|
|
269
239
|
},
|
|
270
|
-
|
|
240
|
+
entryPointAddress: entryPoint.address,
|
|
241
|
+
entryPointVersion: entryPoint.version,
|
|
271
242
|
chainId: chainId
|
|
272
243
|
})
|
|
273
244
|
const signature = await signMessage(client, {
|
|
@@ -276,26 +247,27 @@ export async function createKernelAccountV1<
|
|
|
276
247
|
})
|
|
277
248
|
return signature
|
|
278
249
|
},
|
|
279
|
-
async getInitCode() {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
},
|
|
290
|
-
async
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
250
|
+
// async getInitCode() {
|
|
251
|
+
// if (smartAccountDeployed) return "0x"
|
|
252
|
+
|
|
253
|
+
// smartAccountDeployed = await isSmartAccountDeployed(
|
|
254
|
+
// client,
|
|
255
|
+
// accountAddress
|
|
256
|
+
// )
|
|
257
|
+
|
|
258
|
+
// if (smartAccountDeployed) return "0x"
|
|
259
|
+
// return generateInitCode()
|
|
260
|
+
// },
|
|
261
|
+
async encodeCalls(calls, callType): Promise<Hex> {
|
|
262
|
+
if (calls.length > 1) {
|
|
263
|
+
if (callType === "delegatecall") {
|
|
264
|
+
throw new Error("Cannot batch delegatecall")
|
|
265
|
+
}
|
|
294
266
|
// Encode a batched call using multiSend
|
|
295
267
|
const multiSendCallData = encodeFunctionData({
|
|
296
268
|
abi: multiSendAbi,
|
|
297
269
|
functionName: "multiSend",
|
|
298
|
-
args: [encodeMultiSend(
|
|
270
|
+
args: [encodeMultiSend(calls)]
|
|
299
271
|
})
|
|
300
272
|
|
|
301
273
|
return encodeFunctionData({
|
|
@@ -305,34 +277,37 @@ export async function createKernelAccountV1<
|
|
|
305
277
|
})
|
|
306
278
|
}
|
|
307
279
|
|
|
280
|
+
const call = calls.length === 0 ? undefined : calls[0]
|
|
281
|
+
|
|
282
|
+
if (!call) {
|
|
283
|
+
throw new Error("No calls to encode")
|
|
284
|
+
}
|
|
285
|
+
|
|
308
286
|
// Default to `call`
|
|
309
|
-
if (!
|
|
310
|
-
if (
|
|
311
|
-
return
|
|
287
|
+
if (!callType || callType === "call") {
|
|
288
|
+
if (call.to.toLowerCase() === accountAddress.toLowerCase()) {
|
|
289
|
+
return call.data || "0x"
|
|
312
290
|
}
|
|
313
291
|
|
|
314
292
|
return encodeFunctionData({
|
|
315
293
|
abi: executeAndRevertAbi,
|
|
316
294
|
functionName: "executeAndRevert",
|
|
317
|
-
args: [
|
|
295
|
+
args: [call.to, call.value || 0n, call.data, 0n]
|
|
318
296
|
})
|
|
319
297
|
}
|
|
320
298
|
|
|
321
|
-
if (
|
|
299
|
+
if (callType === "delegatecall") {
|
|
322
300
|
return encodeFunctionData({
|
|
323
301
|
abi: executeAndRevertAbi,
|
|
324
302
|
functionName: "executeAndRevert",
|
|
325
|
-
args: [
|
|
303
|
+
args: [call.to, call.value || 0n, call.data, 1n]
|
|
326
304
|
})
|
|
327
305
|
}
|
|
328
306
|
|
|
329
307
|
throw new Error("Invalid call type")
|
|
330
308
|
},
|
|
331
|
-
async
|
|
332
|
-
return "0x"
|
|
333
|
-
},
|
|
334
|
-
async getDummySignature() {
|
|
309
|
+
async getStubSignature() {
|
|
335
310
|
return "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"
|
|
336
311
|
}
|
|
337
|
-
}
|
|
312
|
+
})
|
|
338
313
|
}
|