@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,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { deepHexlify } from "permissionless/utils";
|
|
1
|
+
import { deepHexlify } from "../../utils.js";
|
|
3
2
|
/**
|
|
4
3
|
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
5
4
|
*/
|
|
@@ -10,7 +9,7 @@ export const sponsorUserOperation = async (client, args) => {
|
|
|
10
9
|
{
|
|
11
10
|
chainId: client.chain?.id,
|
|
12
11
|
userOp: deepHexlify(args.userOperation),
|
|
13
|
-
entryPointAddress: args.entryPoint,
|
|
12
|
+
entryPointAddress: args.entryPoint.address,
|
|
14
13
|
gasTokenData: args.gasToken && {
|
|
15
14
|
tokenAddress: args.gasToken
|
|
16
15
|
},
|
|
@@ -19,8 +18,7 @@ export const sponsorUserOperation = async (client, args) => {
|
|
|
19
18
|
}
|
|
20
19
|
]
|
|
21
20
|
});
|
|
22
|
-
|
|
23
|
-
if (entryPointVersion === "v0.6") {
|
|
21
|
+
if (args.entryPoint.version === "0.6") {
|
|
24
22
|
return {
|
|
25
23
|
paymasterAndData: response.paymasterAndData,
|
|
26
24
|
preVerificationGas: BigInt(response.preVerificationGas),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sponsorUserOperation.js","sourceRoot":"","sources":["../../../actions/paymaster/sponsorUserOperation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sponsorUserOperation.js","sourceRoot":"","sources":["../../../actions/paymaster/sponsorUserOperation.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAwD5C;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAGrC,MAAiD,EACjD,IAAuD,EACG,EAAE;IAC5D,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAClC,MAAM,EAAE,yBAAyB;QACjC,MAAM,EAAE;YACJ;gBACI,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,EAAY;gBACnC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC;gBACvC,iBAAiB,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO;gBAC1C,YAAY,EAAE,IAAI,CAAC,QAAQ,IAAI;oBAC3B,YAAY,EAAE,IAAI,CAAC,QAAQ;iBAC9B;gBACD,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,IAAI,KAAK;gBAClD,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,IAAI;aAC5C;SACJ;KACJ,CAAC,CAAA;IACF,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;QACpC,OAAO;YACH,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;YAC3C,kBAAkB,EAAE,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YACvD,oBAAoB,EAAE,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC;YAC3D,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;YAC3C,YAAY,EACR,QAAQ,CAAC,YAAY,IAAI,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;YAC1D,oBAAoB,EAChB,QAAQ,CAAC,oBAAoB;gBAC7B,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC;SACS,CAAA;IAC1D,CAAC;IACD,MAAM,WAAW,GAAG,QAWnB,CAAA;IAED,OAAO;QACH,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC;QAC9C,oBAAoB,EAAE,MAAM,CAAC,WAAW,CAAC,oBAAoB,CAAC;QAC9D,kBAAkB,EAAE,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC;QAC1D,SAAS,EAAE,WAAW,CAAC,SAAS;QAChC,6BAA6B,EAAE,MAAM,CACjC,WAAW,CAAC,6BAA6B,CAC5C;QACD,uBAAuB,EAAE,MAAM,CAAC,WAAW,CAAC,uBAAuB,CAAC;QACpE,aAAa,EAAE,WAAW,CAAC,aAAa;QACxC,YAAY,EAAE,QAAQ,CAAC,YAAY,IAAI,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;QACpE,oBAAoB,EAChB,QAAQ,CAAC,oBAAoB;YAC7B,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC;KACS,CAAA;AAC1D,CAAC,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Copied from: https://github.com/pimlicolabs/permissionless.js/blob/main/packages/permissionless/actions/public/getAccountNonce.ts
|
|
2
|
+
import { readContract } from "viem/actions";
|
|
3
|
+
import { getAction } from "viem/utils";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the nonce of the account with the entry point.
|
|
6
|
+
*
|
|
7
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/public-actions/getAccountNonce
|
|
8
|
+
*
|
|
9
|
+
* @param client {@link client} that you created using viem's createPublicClient.
|
|
10
|
+
* @param args {@link GetAccountNonceParams} address, entryPoint & key
|
|
11
|
+
* @returns bigint nonce
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* import { createPublicClient } from "viem"
|
|
15
|
+
* import { getAccountNonce } from "permissionless/actions"
|
|
16
|
+
*
|
|
17
|
+
* const client = createPublicClient({
|
|
18
|
+
* chain: goerli,
|
|
19
|
+
* transport: http("https://goerli.infura.io/v3/your-infura-key")
|
|
20
|
+
* })
|
|
21
|
+
*
|
|
22
|
+
* const nonce = await getAccountNonce(client, {
|
|
23
|
+
* address,
|
|
24
|
+
* entryPoint,
|
|
25
|
+
* key
|
|
26
|
+
* })
|
|
27
|
+
*
|
|
28
|
+
* // Return 0n
|
|
29
|
+
*/
|
|
30
|
+
export const getAccountNonce = async (client, args) => {
|
|
31
|
+
const { address, entryPointAddress, key = BigInt(0) } = args;
|
|
32
|
+
return await getAction(client, readContract, "readContract")({
|
|
33
|
+
address: entryPointAddress,
|
|
34
|
+
abi: [
|
|
35
|
+
{
|
|
36
|
+
inputs: [
|
|
37
|
+
{
|
|
38
|
+
name: "sender",
|
|
39
|
+
type: "address"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "key",
|
|
43
|
+
type: "uint192"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
name: "getNonce",
|
|
47
|
+
outputs: [
|
|
48
|
+
{
|
|
49
|
+
name: "nonce",
|
|
50
|
+
type: "uint256"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
stateMutability: "view",
|
|
54
|
+
type: "function"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
functionName: "getNonce",
|
|
58
|
+
args: [address, key]
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=getAccountNonce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAccountNonce.js","sourceRoot":"","sources":["../../../actions/public/getAccountNonce.ts"],"names":[],"mappings":"AAAA,oIAAoI;AAGpI,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAQtC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAChC,MAAc,EACd,IAA2B,EACZ,EAAE;IACjB,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAA;IAE5D,OAAO,MAAM,SAAS,CAClB,MAAM,EACN,YAAY,EACZ,cAAc,CACjB,CAAC;QACE,OAAO,EAAE,iBAAiB;QAC1B,GAAG,EAAE;YACD;gBACI,MAAM,EAAE;oBACJ;wBACI,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,SAAS;qBAClB;oBACD;wBACI,IAAI,EAAE,KAAK;wBACX,IAAI,EAAE,SAAS;qBAClB;iBACJ;gBACD,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE;oBACL;wBACI,IAAI,EAAE,OAAO;wBACb,IAAI,EAAE,SAAS;qBAClB;iBACJ;gBACD,eAAe,EAAE,MAAM;gBACvB,IAAI,EAAE,UAAU;aACnB;SACJ;QACD,YAAY,EAAE,UAAU;QACxB,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC;KACvB,CAAC,CAAA;AACN,CAAC,CAAA"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
// Copied from: https://github.com/pimlicolabs/permissionless.js/blob/main/packages/permissionless/actions/public/getSenderAddress.ts
|
|
2
|
+
import { BaseError, ContractFunctionRevertedError, InvalidInputRpcError, RawContractError, RpcRequestError, UnknownRpcError, concat, decodeErrorResult } from "viem";
|
|
3
|
+
import { simulateContract } from "viem/actions";
|
|
4
|
+
import { getAction } from "viem/utils";
|
|
5
|
+
export class InvalidEntryPointError extends BaseError {
|
|
6
|
+
constructor({ cause, entryPointAddress } = {}) {
|
|
7
|
+
super(`The entry point address (\`entryPoint\`${entryPointAddress ? ` = ${entryPointAddress}` : ""}) is not a valid entry point. getSenderAddress did not revert with a SenderAddressResult error.`, {
|
|
8
|
+
cause
|
|
9
|
+
});
|
|
10
|
+
Object.defineProperty(this, "name", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: "InvalidEntryPointError"
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Returns the address of the account that will be deployed with the given init code.
|
|
20
|
+
*
|
|
21
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/public-actions/getSenderAddress
|
|
22
|
+
*
|
|
23
|
+
* @param client {@link Client} that you created using viem's createPublicClient.
|
|
24
|
+
* @param args {@link GetSenderAddressParams} initCode & entryPoint
|
|
25
|
+
* @returns Sender's Address
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* import { createPublicClient } from "viem"
|
|
29
|
+
* import { getSenderAddress } from "permissionless/actions"
|
|
30
|
+
*
|
|
31
|
+
* const publicClient = createPublicClient({
|
|
32
|
+
* chain: goerli,
|
|
33
|
+
* transport: http("https://goerli.infura.io/v3/your-infura-key")
|
|
34
|
+
* })
|
|
35
|
+
*
|
|
36
|
+
* const senderAddress = await getSenderAddress(publicClient, {
|
|
37
|
+
* initCode,
|
|
38
|
+
* entryPoint
|
|
39
|
+
* })
|
|
40
|
+
*
|
|
41
|
+
* // Return '0x7a88a206ba40b37a8c07a2b5688cf8b287318b63'
|
|
42
|
+
*/
|
|
43
|
+
export const getSenderAddress = async (client, args) => {
|
|
44
|
+
const { initCode, entryPointAddress, factory, factoryData } = args;
|
|
45
|
+
if (!initCode && !factory && !factoryData) {
|
|
46
|
+
throw new Error("Either `initCode` or `factory` and `factoryData` must be provided");
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
await getAction(client, simulateContract, "simulateContract")({
|
|
50
|
+
address: entryPointAddress,
|
|
51
|
+
abi: [
|
|
52
|
+
{
|
|
53
|
+
inputs: [
|
|
54
|
+
{
|
|
55
|
+
internalType: "address",
|
|
56
|
+
name: "sender",
|
|
57
|
+
type: "address"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
name: "SenderAddressResult",
|
|
61
|
+
type: "error"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
inputs: [
|
|
65
|
+
{
|
|
66
|
+
internalType: "bytes",
|
|
67
|
+
name: "initCode",
|
|
68
|
+
type: "bytes"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
name: "getSenderAddress",
|
|
72
|
+
outputs: [],
|
|
73
|
+
stateMutability: "nonpayable",
|
|
74
|
+
type: "function"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
functionName: "getSenderAddress",
|
|
78
|
+
args: [initCode || concat([factory, factoryData])]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
const revertError = e.walk((err) => err instanceof ContractFunctionRevertedError ||
|
|
83
|
+
err instanceof RpcRequestError ||
|
|
84
|
+
err instanceof InvalidInputRpcError ||
|
|
85
|
+
err instanceof UnknownRpcError);
|
|
86
|
+
if (!revertError) {
|
|
87
|
+
// biome-ignore lint/suspicious/noExplicitAny:
|
|
88
|
+
const cause = e.cause;
|
|
89
|
+
const errorName = cause?.data?.errorName ?? "";
|
|
90
|
+
if (errorName === "SenderAddressResult" &&
|
|
91
|
+
cause?.data?.args &&
|
|
92
|
+
cause?.data?.args[0]) {
|
|
93
|
+
return cause.data?.args[0];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (revertError instanceof ContractFunctionRevertedError) {
|
|
97
|
+
const errorName = revertError.data?.errorName ?? "";
|
|
98
|
+
if (errorName === "SenderAddressResult" &&
|
|
99
|
+
revertError.data?.args &&
|
|
100
|
+
revertError.data?.args[0]) {
|
|
101
|
+
return revertError.data?.args[0];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (revertError instanceof RpcRequestError) {
|
|
105
|
+
const hexStringRegex = /0x[a-fA-F0-9]+/;
|
|
106
|
+
// biome-ignore lint/suspicious/noExplicitAny:
|
|
107
|
+
const match = revertError.cause.data.match(hexStringRegex);
|
|
108
|
+
if (!match) {
|
|
109
|
+
throw new Error("Failed to parse revert bytes from RPC response");
|
|
110
|
+
}
|
|
111
|
+
const data = match[0];
|
|
112
|
+
const error = decodeErrorResult({
|
|
113
|
+
abi: [
|
|
114
|
+
{
|
|
115
|
+
inputs: [
|
|
116
|
+
{
|
|
117
|
+
internalType: "address",
|
|
118
|
+
name: "sender",
|
|
119
|
+
type: "address"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
name: "SenderAddressResult",
|
|
123
|
+
type: "error"
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
data
|
|
127
|
+
});
|
|
128
|
+
return error.args[0];
|
|
129
|
+
}
|
|
130
|
+
if (revertError instanceof InvalidInputRpcError) {
|
|
131
|
+
const { data: data_ } = (e instanceof RawContractError
|
|
132
|
+
? e
|
|
133
|
+
: e instanceof BaseError
|
|
134
|
+
? e.walk((err) => "data" in err) || e.walk()
|
|
135
|
+
: {});
|
|
136
|
+
const data = typeof data_ === "string" ? data_ : data_?.data;
|
|
137
|
+
if (data === undefined) {
|
|
138
|
+
throw new Error("Failed to parse revert bytes from RPC response");
|
|
139
|
+
}
|
|
140
|
+
const error = decodeErrorResult({
|
|
141
|
+
abi: [
|
|
142
|
+
{
|
|
143
|
+
inputs: [
|
|
144
|
+
{
|
|
145
|
+
internalType: "address",
|
|
146
|
+
name: "sender",
|
|
147
|
+
type: "address"
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
name: "SenderAddressResult",
|
|
151
|
+
type: "error"
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
data
|
|
155
|
+
});
|
|
156
|
+
return error.args[0];
|
|
157
|
+
}
|
|
158
|
+
if (revertError instanceof UnknownRpcError) {
|
|
159
|
+
const parsedBody = JSON.parse(
|
|
160
|
+
// biome-ignore lint/suspicious/noExplicitAny:
|
|
161
|
+
revertError.cause.body);
|
|
162
|
+
const revertData = parsedBody.error.data;
|
|
163
|
+
const hexStringRegex = /0x[a-fA-F0-9]+/;
|
|
164
|
+
const match = revertData.match(hexStringRegex);
|
|
165
|
+
if (!match) {
|
|
166
|
+
throw new Error("Failed to parse revert bytes from RPC response");
|
|
167
|
+
}
|
|
168
|
+
const data = match[0];
|
|
169
|
+
const error = decodeErrorResult({
|
|
170
|
+
abi: [
|
|
171
|
+
{
|
|
172
|
+
inputs: [
|
|
173
|
+
{
|
|
174
|
+
internalType: "address",
|
|
175
|
+
name: "sender",
|
|
176
|
+
type: "address"
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
name: "SenderAddressResult",
|
|
180
|
+
type: "error"
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
data
|
|
184
|
+
});
|
|
185
|
+
return error.args[0];
|
|
186
|
+
}
|
|
187
|
+
throw e;
|
|
188
|
+
}
|
|
189
|
+
throw new InvalidEntryPointError({ entryPointAddress });
|
|
190
|
+
};
|
|
191
|
+
//# sourceMappingURL=getSenderAddress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSenderAddress.js","sourceRoot":"","sources":["../../../actions/public/getSenderAddress.ts"],"names":[],"mappings":"AAAA,qIAAqI;AAErI,OAAO,EAEH,SAAS,EAGT,6BAA6B,EAE7B,oBAAoB,EAGpB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,MAAM,EACN,iBAAiB,EACpB,MAAM,MAAM,CAAA;AAEb,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAiBtC,M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AAO,EAGH,gBAAgB,EACnB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getCode } from "viem/actions";
|
|
2
|
+
import { getAction } from "viem/utils";
|
|
3
|
+
export const isSmartAccountDeployed = async (client, address) => {
|
|
4
|
+
const code = await getAction(client, getCode, "getCode")({
|
|
5
|
+
address
|
|
6
|
+
});
|
|
7
|
+
const deployed = Boolean(code);
|
|
8
|
+
return deployed;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=isSmartAccountDeployed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isSmartAccountDeployed.js","sourceRoot":"","sources":["../../../actions/public/isSmartAccountDeployed.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACvC,MAAc,EACd,OAAgB,EACA,EAAE;IAClB,MAAM,IAAI,GAAG,MAAM,SAAS,CACxB,MAAM,EACN,OAAO,EACP,SAAS,CACZ,CAAC;QACE,OAAO;KACV,CAAC,CAAA;IACF,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9B,OAAO,QAAQ,CAAA;AACnB,CAAC,CAAA"}
|
|
@@ -1,42 +1,33 @@
|
|
|
1
|
-
import { smartAccountActions } from "permissionless";
|
|
2
1
|
import { getKernelV3ModuleCurrentNonce } from "../../actions/account-client/getKernelV3ModuleCurrentNonce.js";
|
|
3
2
|
import { getUserOperationGasPrice } from "../../actions/account-client/getUserOperationGasPrice.js";
|
|
4
3
|
import { invalidateNonce } from "../../actions/account-client/invalidateNonce.js";
|
|
5
|
-
import {
|
|
4
|
+
import { sendTransaction } from "../../actions/account-client/sendTransaction.js";
|
|
5
|
+
import { signMessage } from "../../actions/account-client/signMessage.js";
|
|
6
|
+
import { signTypedData } from "../../actions/account-client/signTypedData.js";
|
|
7
|
+
import { writeContract } from "../../actions/account-client/writeContract.js";
|
|
8
|
+
import { changeSudoValidator, signUserOperation, uninstallPlugin } from "../../actions/index.js";
|
|
6
9
|
import { estimateGasInERC20 } from "../../actions/paymaster/estimateGasInERC20.js";
|
|
7
10
|
import { sponsorUserOperation } from "../../actions/paymaster/sponsorUserOperation.js";
|
|
8
|
-
export const zerodevPaymasterActions = (
|
|
11
|
+
export const zerodevPaymasterActions = (entryPoint) => (client) => ({
|
|
9
12
|
sponsorUserOperation: async (args) => sponsorUserOperation(client, {
|
|
10
13
|
...args,
|
|
11
|
-
entryPoint
|
|
14
|
+
entryPoint
|
|
12
15
|
}),
|
|
13
|
-
estimateGasInERC20: async (args) => estimateGasInERC20(client, args)
|
|
14
|
-
sponsorUserOperationEip7677: async (args, bundlerClient, stateOverrides) => sponsorUserOperationEip7677(client, args, bundlerClient, stateOverrides)
|
|
16
|
+
estimateGasInERC20: async (args) => estimateGasInERC20(client, args)
|
|
15
17
|
});
|
|
16
|
-
export function kernelAccountClientActions(
|
|
18
|
+
export function kernelAccountClientActions() {
|
|
17
19
|
return (client) => ({
|
|
18
|
-
|
|
19
|
-
signUserOperation: (args) => signUserOperation(client, {
|
|
20
|
-
...args,
|
|
21
|
-
middleware
|
|
22
|
-
}),
|
|
20
|
+
signUserOperation: (args) => signUserOperation(client, args),
|
|
23
21
|
getUserOperationGasPrice: async () => getUserOperationGasPrice(client),
|
|
24
|
-
uninstallPlugin: async (args) => uninstallPlugin(client,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
...args,
|
|
34
|
-
middleware
|
|
35
|
-
}),
|
|
36
|
-
getKernelV3ModuleCurrentNonce: async (args) => getKernelV3ModuleCurrentNonce(client, {
|
|
37
|
-
...args,
|
|
38
|
-
middleware
|
|
39
|
-
})
|
|
22
|
+
uninstallPlugin: async (args) => uninstallPlugin(client, args),
|
|
23
|
+
changeSudoValidator: async (args) => changeSudoValidator(client, args),
|
|
24
|
+
invalidateNonce: async (args) => invalidateNonce(client, args),
|
|
25
|
+
getKernelV3ModuleCurrentNonce: async () => getKernelV3ModuleCurrentNonce(client),
|
|
26
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
27
|
+
sendTransaction: (args) => sendTransaction(client, args),
|
|
28
|
+
signMessage: (args) => signMessage(client, args),
|
|
29
|
+
signTypedData: (args) => signTypedData(client, args),
|
|
30
|
+
writeContract: (args) => writeContract(client, args)
|
|
40
31
|
});
|
|
41
32
|
}
|
|
42
33
|
//# sourceMappingURL=kernel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../../clients/decorators/kernel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../../clients/decorators/kernel.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,6BAA6B,EAAE,MAAM,+DAA+D,CAAA;AAC7G,OAAO,EAEH,wBAAwB,EAC3B,MAAM,0DAA0D,CAAA;AACjE,OAAO,EAEH,eAAe,EAClB,MAAM,iDAAiD,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAA;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAA;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAA;AAM7E,OAAO,EACH,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EAClB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAGH,kBAAkB,EACrB,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAGH,oBAAoB,EACvB,MAAM,iDAAiD,CAAA;AAiBxD,MAA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,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC;KACvD,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fallbackKernelAccountClient.js","sourceRoot":"","sources":["../../clients/fallbackKernelAccountClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fallbackKernelAccountClient.js","sourceRoot":"","sources":["../../clients/fallbackKernelAccountClient.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAO7C,OAEC,EACD,OAA4D,EACK,EAAE;IACnE,6DAA6D;IAC7D,+EAA+E;IAC/E,SAAS,oBAAoB,CAAC,IAAiB;QAC3C,2DAA2D;QAC3D,OAAO,KAAK,EAAE,GAAG,IAAW,EAAE,EAAE;YAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACtC,IAAI,CAAC;oBACD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;oBAC5C,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;wBAC/B,OAAO,MAAM,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA;oBAChC,CAAC;gBACL,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACb,OAAO,CAAC,KAAK,CACT,UAAU,MAAM,CAAC,IAAI,CAAC,uBAClB,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GACzB,6BAA6B,CAChC,CAAA;oBACD,sCAAsC;oBACtC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;wBACxB,MAAM,OAAO,CAAC,KAAc,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;oBAC3D,CAAC;oBACD,IAAI,CAAC,KAAK,OAAO,CAAC,MAAM,GAAG,CAAC,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
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { getUserOperationGasPrice } from "../actions/account-client/getUserOperationGasPrice.js";
|
|
1
|
+
import { createClient } from "viem";
|
|
2
|
+
import { bundlerActions } from "viem/account-abstraction";
|
|
4
3
|
import { kernelAccountClientActions } from "./decorators/kernel.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const entryPointVersion = getEntryPointVersion(entryPoint);
|
|
9
|
-
const shouldIncludePimlicoProvider = bundlerTransport({}).config.key === "http" &&
|
|
10
|
-
entryPointVersion === "v0.7";
|
|
11
|
-
const client = createClient({
|
|
4
|
+
export function createKernelAccountClient(parameters) {
|
|
5
|
+
const { client: client_, key = "Account", name = "Kernel Account Client", paymaster, paymasterContext, bundlerTransport, userOperation } = parameters;
|
|
6
|
+
const client = Object.assign(createClient({
|
|
12
7
|
...parameters,
|
|
8
|
+
chain: parameters.chain ?? client_?.chain,
|
|
9
|
+
transport: bundlerTransport,
|
|
13
10
|
key,
|
|
14
11
|
name,
|
|
15
|
-
transport: (opts) => {
|
|
16
|
-
let _bundlerTransport = bundlerTransport({
|
|
17
|
-
...opts,
|
|
18
|
-
timeout: bundlerTransport({}).config.timeout,
|
|
19
|
-
retryCount: 0
|
|
20
|
-
});
|
|
21
|
-
if (!shouldIncludePimlicoProvider ||
|
|
22
|
-
isProviderSet(_bundlerTransport.value?.url, "ALCHEMY") ||
|
|
23
|
-
isProviderSet(_bundlerTransport.value?.url, "ZERODEV") ||
|
|
24
|
-
isProviderSet(_bundlerTransport.value?.url, "THIRDWEB") ||
|
|
25
|
-
isProviderSet(_bundlerTransport.value?.url, "CONDUIT"))
|
|
26
|
-
return _bundlerTransport;
|
|
27
|
-
_bundlerTransport = http(setPimlicoAsProvider(_bundlerTransport.value?.url))({
|
|
28
|
-
...opts,
|
|
29
|
-
timeout: bundlerTransport({}).config.timeout,
|
|
30
|
-
retryCount: 0
|
|
31
|
-
});
|
|
32
|
-
return _bundlerTransport;
|
|
33
|
-
},
|
|
34
12
|
type: "kernelAccountClient"
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
13
|
+
}), { client: client_, paymaster, paymasterContext, userOperation });
|
|
14
|
+
if (parameters.userOperation?.prepareUserOperation) {
|
|
15
|
+
const customPrepareUserOp = parameters.userOperation.prepareUserOperation;
|
|
16
|
+
return client
|
|
17
|
+
.extend(bundlerActions)
|
|
18
|
+
.extend((client) => ({
|
|
19
|
+
prepareUserOperation: (args) => {
|
|
20
|
+
return customPrepareUserOp(client, args);
|
|
21
|
+
}
|
|
22
|
+
}))
|
|
23
|
+
.extend(bundlerActions)
|
|
24
|
+
.extend((client) => ({
|
|
25
|
+
prepareUserOperation: (args) => {
|
|
26
|
+
return customPrepareUserOp(client, args);
|
|
27
|
+
}
|
|
28
|
+
}))
|
|
29
|
+
.extend(kernelAccountClientActions());
|
|
48
30
|
}
|
|
49
|
-
return client
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
31
|
+
return client
|
|
32
|
+
.extend(bundlerActions)
|
|
33
|
+
.extend(kernelAccountClientActions());
|
|
34
|
+
}
|
|
53
35
|
//# sourceMappingURL=kernelAccountClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernelAccountClient.js","sourceRoot":"","sources":["../../clients/kernelAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"kernelAccountClient.js","sourceRoot":"","sources":["../../clients/kernelAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EASH,YAAY,EACf,MAAM,MAAM,CAAA;AACb,OAAO,EAOH,cAAc,EAEjB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAEH,0BAA0B,EAC7B,MAAM,wBAAwB,CAAA;AAoG/B,MAAM,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"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { createClient } from "viem";
|
|
2
|
+
import { entryPoint07Address, paymasterActions } from "viem/account-abstraction";
|
|
3
3
|
import { zerodevPaymasterActions } from "./decorators/kernel.js";
|
|
4
|
-
import { isProviderSet, setPimlicoAsProvider } from "./utils.js";
|
|
5
4
|
/**
|
|
6
5
|
* Creates a ZeroDev-specific Paymaster Client with a given [Transport](https://viem.sh/docs/clients/intro.html) configured for a [Chain](https://viem.sh/docs/clients/chains.html).
|
|
7
6
|
*
|
|
@@ -20,32 +19,22 @@ import { isProviderSet, setPimlicoAsProvider } from "./utils.js";
|
|
|
20
19
|
* })
|
|
21
20
|
*/
|
|
22
21
|
export const createZeroDevPaymasterClient = (parameters) => {
|
|
23
|
-
const { key = "public", name = "ZeroDev Paymaster Client", entryPoint
|
|
24
|
-
const entryPointVersion = getEntryPointVersion(entryPointAddress);
|
|
25
|
-
const shouldIncludePimlicoProvider = transport({}).config.key === "http" && entryPointVersion === "v0.7";
|
|
22
|
+
const { key = "public", name = "ZeroDev Paymaster Client", entryPoint, transport } = parameters;
|
|
26
23
|
const client = createClient({
|
|
27
24
|
...parameters,
|
|
28
25
|
transport: (opts) => {
|
|
29
|
-
|
|
26
|
+
return transport({
|
|
30
27
|
...opts,
|
|
31
28
|
retryCount: 0
|
|
32
29
|
});
|
|
33
|
-
if (!shouldIncludePimlicoProvider ||
|
|
34
|
-
isProviderSet(_transport.value?.url, "ALCHEMY") ||
|
|
35
|
-
isProviderSet(_transport.value?.url, "ZERODEV") ||
|
|
36
|
-
isProviderSet(_transport.value?.url, "THIRDWEB") ||
|
|
37
|
-
isProviderSet(_transport.value?.url, "CONDUIT"))
|
|
38
|
-
return _transport;
|
|
39
|
-
_transport = http(setPimlicoAsProvider(_transport.value?.url))({
|
|
40
|
-
...opts,
|
|
41
|
-
retryCount: 0
|
|
42
|
-
});
|
|
43
|
-
return _transport;
|
|
44
30
|
},
|
|
45
31
|
key,
|
|
46
32
|
name,
|
|
47
33
|
type: "zerodevPaymasterClient"
|
|
48
34
|
});
|
|
49
|
-
return client.extend(zerodevPaymasterActions(
|
|
35
|
+
return client.extend(paymasterActions).extend(zerodevPaymasterActions({
|
|
36
|
+
address: entryPoint?.address ?? entryPoint07Address,
|
|
37
|
+
version: entryPoint?.version ?? "0.7"
|
|
38
|
+
}));
|
|
50
39
|
};
|
|
51
40
|
//# sourceMappingURL=paymasterClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paymasterClient.js","sourceRoot":"","sources":["../../clients/paymasterClient.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"paymasterClient.js","sourceRoot":"","sources":["../../clients/paymasterClient.ts"],"names":[],"mappings":"AAAA,OAAO,EASH,YAAY,EACf,MAAM,MAAM,CAAA;AACb,OAAO,EAGH,mBAAmB,EACnB,gBAAgB,EACnB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAkDhE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CACxC,UAAwC,EAClB,EAAE;IACxB,MAAM,EACF,GAAG,GAAG,QAAQ,EACd,IAAI,GAAG,0BAA0B,EACjC,UAAU,EACV,SAAS,EACZ,GAAG,UAAU,CAAA;IACd,MAAM,MAAM,GAAG,YAAY,CAAC;QACxB,GAAG,UAAU;QACb,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE;YAChB,OAAO,SAAS,CAAC;gBACb,GAAG,IAAI;gBACP,UAAU,EAAE,CAAC;aAChB,CAAC,CAAA;QACN,CAAC;QACD,GAAG;QACH,IAAI;QACJ,IAAI,EAAE,wBAAwB;KACjC,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,MAAM,CACzC,uBAAuB,CAAC;QACpB,OAAO,EAAE,UAAU,EAAE,OAAO,IAAI,mBAAmB;QACnD,OAAO,EAAE,UAAU,EAAE,OAAO,IAAI,KAAK;KACxC,CAAC,CACL,CAAA;AACL,CAAC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseError } from "viem";
|
|
2
|
+
export class AccountNotFoundError extends BaseError {
|
|
3
|
+
constructor({ docsPath } = {}) {
|
|
4
|
+
super([
|
|
5
|
+
"Could not find an Account to execute with this Action.",
|
|
6
|
+
"Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."
|
|
7
|
+
].join("\n"), {
|
|
8
|
+
docsPath,
|
|
9
|
+
docsSlug: "account",
|
|
10
|
+
name: "AccountNotFoundError"
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export class SignTransactionNotSupportedBySmartAccountError extends BaseError {
|
|
15
|
+
constructor() {
|
|
16
|
+
super("Smart account signer doesn't need to sign transactions", {
|
|
17
|
+
name: "SignTransactionNotSupportedError"
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAEhC,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAC/C,YAAY,EAAE,QAAQ,KAAwC,EAAE;QAC5D,KAAK,CACD;YACI,wDAAwD;YACxD,kHAAkH;SACrH,CAAC,IAAI,CAAC,IAAI,CAAC,EACZ;YACI,QAAQ;YACR,QAAQ,EAAE,SAAS;YACnB,IAAI,EAAE,sBAAsB;SAC/B,CACJ,CAAA;IACL,CAAC;CACJ;AAED,MAAM,OAAO,8CAA+C,SAAQ,SAAS;IACzE;QACI,KAAK,CAAC,wDAAwD,EAAE;YAC5D,IAAI,EAAE,kCAAkC;SAC3C,CAAC,CAAA;IACN,CAAC;CACJ"}
|
|
@@ -346,7 +346,8 @@ export const gasTokenAddresses = {
|
|
|
346
346
|
"6TEST": "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B"
|
|
347
347
|
},
|
|
348
348
|
11155111: {
|
|
349
|
-
"6TEST": "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B"
|
|
349
|
+
"6TEST": "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B",
|
|
350
|
+
USDC: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"
|
|
350
351
|
},
|
|
351
352
|
11155420: {
|
|
352
353
|
"6TEST": "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B"
|