@zerodev/sdk 5.3.25 → 5.4.0-beta.0
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 +171 -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 +81 -94
- package/_cjs/accounts/kernel/v1/createKernelAccountV1.js.map +1 -1
- package/_cjs/accounts/kernel/v2/createKernelAccountV0_2.js +104 -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 +13 -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 +8 -0
- package/_cjs/actions/public/index.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 +18 -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.map +1 -1
- package/_cjs/providers/KernelEIP1193Provider.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 +181 -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 +91 -98
- package/_esm/accounts/kernel/v1/createKernelAccountV1.js.map +1 -1
- package/_esm/accounts/kernel/v2/createKernelAccountV0_2.js +105 -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 +6 -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 +3 -0
- package/_esm/actions/public/index.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 +14 -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.map +1 -1
- package/_esm/providers/KernelEIP1193Provider.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 +9 -7
- 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 +6 -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 +3 -0
- package/_types/actions/public/index.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 +7 -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 +1 -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 +1 -0
- 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 +312 -357
- 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 +147 -174
- package/accounts/kernel/v2/createKernelAccountV0_2.ts +135 -179
- 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 -54
- package/actions/account-client/writeContract.ts +72 -0
- package/actions/index.ts +15 -6
- 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 +9 -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 +17 -0
- package/gasTokenAddresses.ts +3 -2
- package/index.ts +5 -2
- package/package.json +2 -3
- package/providers/KernelEIP1193Provider.ts +4 -7
- package/types/index.ts +2 -0
- 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
package/actions/index.ts
CHANGED
|
@@ -20,6 +20,21 @@ export {
|
|
|
20
20
|
type UninstallPluginParameters
|
|
21
21
|
} from "./account-client/uninstallPlugin.js"
|
|
22
22
|
|
|
23
|
+
export { getKernelV3ModuleCurrentNonce } from "./account-client/getKernelV3ModuleCurrentNonce.js"
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
type InvalidateNonceParameters,
|
|
27
|
+
invalidateNonce
|
|
28
|
+
} from "./account-client/invalidateNonce.js"
|
|
29
|
+
|
|
30
|
+
export { sendTransaction } from "./account-client/sendTransaction.js"
|
|
31
|
+
|
|
32
|
+
export { signMessage } from "./account-client/signMessage.js"
|
|
33
|
+
|
|
34
|
+
export { signTypedData } from "./account-client/signTypedData.js"
|
|
35
|
+
|
|
36
|
+
export { writeContract } from "./account-client/writeContract.js"
|
|
37
|
+
|
|
23
38
|
export {
|
|
24
39
|
changeSudoValidator,
|
|
25
40
|
type ChangeSudoValidatorParameters
|
|
@@ -30,9 +45,3 @@ export {
|
|
|
30
45
|
type EstimateGasInERC20Parameters,
|
|
31
46
|
type EstimateGasInERC20ReturnType
|
|
32
47
|
} from "./paymaster/estimateGasInERC20.js"
|
|
33
|
-
|
|
34
|
-
export {
|
|
35
|
-
type SponsorUserOperationEip7677Parameters,
|
|
36
|
-
type SponsorUserOperationEip7677ReturnType,
|
|
37
|
-
sponsorUserOperationEip7677
|
|
38
|
-
} from "./paymaster/sponsorUserOperationEip7677.js"
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { ENTRYPOINT_ADDRESS_V06 } from "permissionless"
|
|
2
|
-
import type { EntryPoint } from "permissionless/types"
|
|
3
|
-
import type { UserOperation } from "permissionless/types/userOperation.js"
|
|
4
|
-
import { deepHexlify } from "permissionless/utils"
|
|
5
1
|
import type { Address, Hex } from "viem"
|
|
2
|
+
import {
|
|
3
|
+
type EntryPointVersion,
|
|
4
|
+
type UserOperation,
|
|
5
|
+
entryPoint06Address
|
|
6
|
+
} from "viem/account-abstraction"
|
|
6
7
|
import type { ZeroDevPaymasterClient } from "../../clients/paymasterClient.js"
|
|
8
|
+
import { deepHexlify } from "../../utils.js"
|
|
7
9
|
|
|
8
10
|
export type EstimateGasInERC20Parameters = {
|
|
9
|
-
userOperation: UserOperation
|
|
11
|
+
userOperation: UserOperation
|
|
10
12
|
gasTokenAddress: Hex
|
|
11
13
|
entryPoint: Address
|
|
12
14
|
}
|
|
@@ -24,8 +26,10 @@ export type EstimateGasInERC20ReturnType = {
|
|
|
24
26
|
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
25
27
|
*/
|
|
26
28
|
|
|
27
|
-
export const estimateGasInERC20 = async <
|
|
28
|
-
|
|
29
|
+
export const estimateGasInERC20 = async <
|
|
30
|
+
entryPointVersion extends EntryPointVersion
|
|
31
|
+
>(
|
|
32
|
+
client: ZeroDevPaymasterClient<entryPointVersion>,
|
|
29
33
|
args: EstimateGasInERC20Parameters
|
|
30
34
|
): Promise<EstimateGasInERC20ReturnType> => {
|
|
31
35
|
const response = await client.request({
|
|
@@ -38,7 +42,7 @@ export const estimateGasInERC20 = async <entryPoint extends EntryPoint>(
|
|
|
38
42
|
initCode: args.userOperation.initCode || "0x"
|
|
39
43
|
},
|
|
40
44
|
tokenAddress: args.gasTokenAddress,
|
|
41
|
-
entryPointAddress: args.entryPoint ??
|
|
45
|
+
entryPointAddress: args.entryPoint ?? entryPoint06Address
|
|
42
46
|
}
|
|
43
47
|
]
|
|
44
48
|
})
|
|
@@ -1,77 +1,80 @@
|
|
|
1
|
-
import { getEntryPointVersion } from "permissionless"
|
|
2
|
-
import type { PartialPick } from "permissionless/types"
|
|
3
|
-
import type {
|
|
4
|
-
ENTRYPOINT_ADDRESS_V06_TYPE,
|
|
5
|
-
EntryPoint
|
|
6
|
-
} from "permissionless/types/entrypoint"
|
|
7
|
-
import type { UserOperation } from "permissionless/types/userOperation.js"
|
|
8
|
-
import { deepHexlify } from "permissionless/utils"
|
|
9
1
|
import type { Address, Hex } from "viem"
|
|
10
|
-
import type { PartialBy } from "viem
|
|
2
|
+
import type { PartialBy } from "viem"
|
|
3
|
+
import type { EntryPointVersion, UserOperation } from "viem/account-abstraction"
|
|
11
4
|
import type { ZeroDevPaymasterClient } from "../../clients/paymasterClient.js"
|
|
5
|
+
import type { PartialPick } from "../../types/index.js"
|
|
6
|
+
import { deepHexlify } from "../../utils.js"
|
|
12
7
|
|
|
13
|
-
export type SponsorUserOperationParameters<
|
|
14
|
-
|
|
8
|
+
export type SponsorUserOperationParameters<
|
|
9
|
+
entryPointVersion extends EntryPointVersion
|
|
10
|
+
> = {
|
|
11
|
+
userOperation: entryPointVersion extends "0.6"
|
|
15
12
|
? PartialBy<
|
|
16
|
-
UserOperation<"
|
|
13
|
+
UserOperation<"0.6">,
|
|
17
14
|
"callGasLimit" | "preVerificationGas" | "verificationGasLimit"
|
|
18
15
|
>
|
|
19
16
|
: PartialBy<
|
|
20
|
-
UserOperation<"
|
|
17
|
+
UserOperation<"0.7">,
|
|
21
18
|
| "callGasLimit"
|
|
22
19
|
| "preVerificationGas"
|
|
23
20
|
| "verificationGasLimit"
|
|
24
21
|
| "paymasterVerificationGasLimit"
|
|
25
22
|
| "paymasterPostOpGasLimit"
|
|
26
23
|
>
|
|
27
|
-
entryPoint:
|
|
24
|
+
entryPoint: {
|
|
25
|
+
address: Address
|
|
26
|
+
version: entryPointVersion
|
|
27
|
+
}
|
|
28
28
|
gasToken?: Hex
|
|
29
29
|
shouldOverrideFee?: boolean
|
|
30
30
|
shouldConsume?: boolean
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export type SponsorUserOperationReturnType<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
33
|
+
export type SponsorUserOperationReturnType<
|
|
34
|
+
entryPointVersion extends EntryPointVersion
|
|
35
|
+
> = entryPointVersion extends "0.6"
|
|
36
|
+
? Pick<
|
|
37
|
+
UserOperation<"0.6">,
|
|
38
|
+
| "callGasLimit"
|
|
39
|
+
| "verificationGasLimit"
|
|
40
|
+
| "preVerificationGas"
|
|
41
|
+
| "paymasterAndData"
|
|
42
|
+
> &
|
|
43
|
+
PartialPick<
|
|
44
|
+
UserOperation<"0.6">,
|
|
45
|
+
"maxFeePerGas" | "maxPriorityFeePerGas"
|
|
46
|
+
>
|
|
47
|
+
: Pick<
|
|
48
|
+
UserOperation<"0.7">,
|
|
49
|
+
| "callGasLimit"
|
|
50
|
+
| "verificationGasLimit"
|
|
51
|
+
| "preVerificationGas"
|
|
52
|
+
| "paymaster"
|
|
53
|
+
| "paymasterVerificationGasLimit"
|
|
54
|
+
| "paymasterPostOpGasLimit"
|
|
55
|
+
| "paymasterData"
|
|
56
|
+
> &
|
|
57
|
+
PartialPick<
|
|
58
|
+
UserOperation<"0.7">,
|
|
59
|
+
"maxFeePerGas" | "maxPriorityFeePerGas"
|
|
60
|
+
>
|
|
60
61
|
|
|
61
62
|
/**
|
|
62
63
|
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
63
64
|
*/
|
|
64
|
-
export const sponsorUserOperation = async <
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
export const sponsorUserOperation = async <
|
|
66
|
+
entryPointVersion extends EntryPointVersion
|
|
67
|
+
>(
|
|
68
|
+
client: ZeroDevPaymasterClient<entryPointVersion>,
|
|
69
|
+
args: SponsorUserOperationParameters<entryPointVersion>
|
|
70
|
+
): Promise<SponsorUserOperationReturnType<entryPointVersion>> => {
|
|
68
71
|
const response = await client.request({
|
|
69
72
|
method: "zd_sponsorUserOperation",
|
|
70
73
|
params: [
|
|
71
74
|
{
|
|
72
75
|
chainId: client.chain?.id as number,
|
|
73
76
|
userOp: deepHexlify(args.userOperation),
|
|
74
|
-
entryPointAddress: args.entryPoint,
|
|
77
|
+
entryPointAddress: args.entryPoint.address,
|
|
75
78
|
gasTokenData: args.gasToken && {
|
|
76
79
|
tokenAddress: args.gasToken
|
|
77
80
|
},
|
|
@@ -80,8 +83,7 @@ export const sponsorUserOperation = async <entryPoint extends EntryPoint>(
|
|
|
80
83
|
}
|
|
81
84
|
]
|
|
82
85
|
})
|
|
83
|
-
|
|
84
|
-
if (entryPointVersion === "v0.6") {
|
|
86
|
+
if (args.entryPoint.version === "0.6") {
|
|
85
87
|
return {
|
|
86
88
|
paymasterAndData: response.paymasterAndData,
|
|
87
89
|
preVerificationGas: BigInt(response.preVerificationGas),
|
|
@@ -92,7 +94,7 @@ export const sponsorUserOperation = async <entryPoint extends EntryPoint>(
|
|
|
92
94
|
maxPriorityFeePerGas:
|
|
93
95
|
response.maxPriorityFeePerGas &&
|
|
94
96
|
BigInt(response.maxPriorityFeePerGas)
|
|
95
|
-
} as SponsorUserOperationReturnType<
|
|
97
|
+
} as SponsorUserOperationReturnType<entryPointVersion>
|
|
96
98
|
}
|
|
97
99
|
const responseV07 = response as {
|
|
98
100
|
preVerificationGas: Hex
|
|
@@ -121,5 +123,5 @@ export const sponsorUserOperation = async <entryPoint extends EntryPoint>(
|
|
|
121
123
|
maxPriorityFeePerGas:
|
|
122
124
|
response.maxPriorityFeePerGas &&
|
|
123
125
|
BigInt(response.maxPriorityFeePerGas)
|
|
124
|
-
} as SponsorUserOperationReturnType<
|
|
126
|
+
} as SponsorUserOperationReturnType<entryPointVersion>
|
|
125
127
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Copied from: https://github.com/pimlicolabs/permissionless.js/blob/main/packages/permissionless/actions/public/getAccountNonce.ts
|
|
2
|
+
|
|
3
|
+
import type { Address, Client } from "viem"
|
|
4
|
+
import { readContract } from "viem/actions"
|
|
5
|
+
import { getAction } from "viem/utils"
|
|
6
|
+
|
|
7
|
+
export type GetAccountNonceParams = {
|
|
8
|
+
address: Address
|
|
9
|
+
entryPointAddress: Address
|
|
10
|
+
key?: bigint
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Returns the nonce of the account with the entry point.
|
|
15
|
+
*
|
|
16
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/public-actions/getAccountNonce
|
|
17
|
+
*
|
|
18
|
+
* @param client {@link client} that you created using viem's createPublicClient.
|
|
19
|
+
* @param args {@link GetAccountNonceParams} address, entryPoint & key
|
|
20
|
+
* @returns bigint nonce
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* import { createPublicClient } from "viem"
|
|
24
|
+
* import { getAccountNonce } from "permissionless/actions"
|
|
25
|
+
*
|
|
26
|
+
* const client = createPublicClient({
|
|
27
|
+
* chain: goerli,
|
|
28
|
+
* transport: http("https://goerli.infura.io/v3/your-infura-key")
|
|
29
|
+
* })
|
|
30
|
+
*
|
|
31
|
+
* const nonce = await getAccountNonce(client, {
|
|
32
|
+
* address,
|
|
33
|
+
* entryPoint,
|
|
34
|
+
* key
|
|
35
|
+
* })
|
|
36
|
+
*
|
|
37
|
+
* // Return 0n
|
|
38
|
+
*/
|
|
39
|
+
export const getAccountNonce = async (
|
|
40
|
+
client: Client,
|
|
41
|
+
args: GetAccountNonceParams
|
|
42
|
+
): Promise<bigint> => {
|
|
43
|
+
const { address, entryPointAddress, key = BigInt(0) } = args
|
|
44
|
+
|
|
45
|
+
return await getAction(
|
|
46
|
+
client,
|
|
47
|
+
readContract,
|
|
48
|
+
"readContract"
|
|
49
|
+
)({
|
|
50
|
+
address: entryPointAddress,
|
|
51
|
+
abi: [
|
|
52
|
+
{
|
|
53
|
+
inputs: [
|
|
54
|
+
{
|
|
55
|
+
name: "sender",
|
|
56
|
+
type: "address"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "key",
|
|
60
|
+
type: "uint192"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
name: "getNonce",
|
|
64
|
+
outputs: [
|
|
65
|
+
{
|
|
66
|
+
name: "nonce",
|
|
67
|
+
type: "uint256"
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
stateMutability: "view",
|
|
71
|
+
type: "function"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
functionName: "getNonce",
|
|
75
|
+
args: [address, key]
|
|
76
|
+
})
|
|
77
|
+
}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
// Copied from: https://github.com/pimlicolabs/permissionless.js/blob/main/packages/permissionless/actions/public/getSenderAddress.ts
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type Address,
|
|
5
|
+
BaseError,
|
|
6
|
+
type Client,
|
|
7
|
+
type ContractFunctionExecutionErrorType,
|
|
8
|
+
ContractFunctionRevertedError,
|
|
9
|
+
type Hex,
|
|
10
|
+
InvalidInputRpcError,
|
|
11
|
+
type OneOf,
|
|
12
|
+
type Prettify,
|
|
13
|
+
RawContractError,
|
|
14
|
+
RpcRequestError,
|
|
15
|
+
UnknownRpcError,
|
|
16
|
+
concat,
|
|
17
|
+
decodeErrorResult
|
|
18
|
+
} from "viem"
|
|
19
|
+
|
|
20
|
+
import { simulateContract } from "viem/actions"
|
|
21
|
+
import { getAction } from "viem/utils"
|
|
22
|
+
|
|
23
|
+
export type GetSenderAddressParams = OneOf<
|
|
24
|
+
| {
|
|
25
|
+
initCode: Hex
|
|
26
|
+
entryPointAddress: Address
|
|
27
|
+
factory?: never
|
|
28
|
+
factoryData?: never
|
|
29
|
+
}
|
|
30
|
+
| {
|
|
31
|
+
entryPointAddress: Address
|
|
32
|
+
factory: Address
|
|
33
|
+
factoryData: Hex
|
|
34
|
+
initCode?: never
|
|
35
|
+
}
|
|
36
|
+
>
|
|
37
|
+
|
|
38
|
+
export class InvalidEntryPointError extends BaseError {
|
|
39
|
+
override name = "InvalidEntryPointError"
|
|
40
|
+
|
|
41
|
+
constructor({
|
|
42
|
+
cause,
|
|
43
|
+
entryPointAddress
|
|
44
|
+
}: { cause?: BaseError; entryPointAddress?: Address } = {}) {
|
|
45
|
+
super(
|
|
46
|
+
`The entry point address (\`entryPoint\`${
|
|
47
|
+
entryPointAddress ? ` = ${entryPointAddress}` : ""
|
|
48
|
+
}) is not a valid entry point. getSenderAddress did not revert with a SenderAddressResult error.`,
|
|
49
|
+
{
|
|
50
|
+
cause
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Returns the address of the account that will be deployed with the given init code.
|
|
58
|
+
*
|
|
59
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/public-actions/getSenderAddress
|
|
60
|
+
*
|
|
61
|
+
* @param client {@link Client} that you created using viem's createPublicClient.
|
|
62
|
+
* @param args {@link GetSenderAddressParams} initCode & entryPoint
|
|
63
|
+
* @returns Sender's Address
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* import { createPublicClient } from "viem"
|
|
67
|
+
* import { getSenderAddress } from "permissionless/actions"
|
|
68
|
+
*
|
|
69
|
+
* const publicClient = createPublicClient({
|
|
70
|
+
* chain: goerli,
|
|
71
|
+
* transport: http("https://goerli.infura.io/v3/your-infura-key")
|
|
72
|
+
* })
|
|
73
|
+
*
|
|
74
|
+
* const senderAddress = await getSenderAddress(publicClient, {
|
|
75
|
+
* initCode,
|
|
76
|
+
* entryPoint
|
|
77
|
+
* })
|
|
78
|
+
*
|
|
79
|
+
* // Return '0x7a88a206ba40b37a8c07a2b5688cf8b287318b63'
|
|
80
|
+
*/
|
|
81
|
+
export const getSenderAddress = async (
|
|
82
|
+
client: Client,
|
|
83
|
+
args: Prettify<GetSenderAddressParams>
|
|
84
|
+
): Promise<Address> => {
|
|
85
|
+
const { initCode, entryPointAddress, factory, factoryData } = args
|
|
86
|
+
|
|
87
|
+
if (!initCode && !factory && !factoryData) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
"Either `initCode` or `factory` and `factoryData` must be provided"
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
await getAction(
|
|
95
|
+
client,
|
|
96
|
+
simulateContract,
|
|
97
|
+
"simulateContract"
|
|
98
|
+
)({
|
|
99
|
+
address: entryPointAddress,
|
|
100
|
+
abi: [
|
|
101
|
+
{
|
|
102
|
+
inputs: [
|
|
103
|
+
{
|
|
104
|
+
internalType: "address",
|
|
105
|
+
name: "sender",
|
|
106
|
+
type: "address"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
name: "SenderAddressResult",
|
|
110
|
+
type: "error"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
inputs: [
|
|
114
|
+
{
|
|
115
|
+
internalType: "bytes",
|
|
116
|
+
name: "initCode",
|
|
117
|
+
type: "bytes"
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
name: "getSenderAddress",
|
|
121
|
+
outputs: [],
|
|
122
|
+
stateMutability: "nonpayable",
|
|
123
|
+
type: "function"
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
functionName: "getSenderAddress",
|
|
127
|
+
args: [initCode || concat([factory as Hex, factoryData as Hex])]
|
|
128
|
+
})
|
|
129
|
+
} catch (e) {
|
|
130
|
+
const revertError = (e as ContractFunctionExecutionErrorType).walk(
|
|
131
|
+
(err) =>
|
|
132
|
+
err instanceof ContractFunctionRevertedError ||
|
|
133
|
+
err instanceof RpcRequestError ||
|
|
134
|
+
err instanceof InvalidInputRpcError ||
|
|
135
|
+
err instanceof UnknownRpcError
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
if (!revertError) {
|
|
139
|
+
// biome-ignore lint/suspicious/noExplicitAny:
|
|
140
|
+
const cause = (e as ContractFunctionExecutionErrorType).cause as any
|
|
141
|
+
const errorName = cause?.data?.errorName ?? ""
|
|
142
|
+
if (
|
|
143
|
+
errorName === "SenderAddressResult" &&
|
|
144
|
+
cause?.data?.args &&
|
|
145
|
+
cause?.data?.args[0]
|
|
146
|
+
) {
|
|
147
|
+
return cause.data?.args[0] as Address
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (revertError instanceof ContractFunctionRevertedError) {
|
|
152
|
+
const errorName = revertError.data?.errorName ?? ""
|
|
153
|
+
if (
|
|
154
|
+
errorName === "SenderAddressResult" &&
|
|
155
|
+
revertError.data?.args &&
|
|
156
|
+
revertError.data?.args[0]
|
|
157
|
+
) {
|
|
158
|
+
return revertError.data?.args[0] as Address
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (revertError instanceof RpcRequestError) {
|
|
163
|
+
const hexStringRegex = /0x[a-fA-F0-9]+/
|
|
164
|
+
// biome-ignore lint/suspicious/noExplicitAny:
|
|
165
|
+
const match = (revertError as unknown as any).cause.data.match(
|
|
166
|
+
hexStringRegex
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
if (!match) {
|
|
170
|
+
throw new Error(
|
|
171
|
+
"Failed to parse revert bytes from RPC response"
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const data: Hex = match[0]
|
|
176
|
+
|
|
177
|
+
const error = decodeErrorResult({
|
|
178
|
+
abi: [
|
|
179
|
+
{
|
|
180
|
+
inputs: [
|
|
181
|
+
{
|
|
182
|
+
internalType: "address",
|
|
183
|
+
name: "sender",
|
|
184
|
+
type: "address"
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
name: "SenderAddressResult",
|
|
188
|
+
type: "error"
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
data
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
return error.args[0] as Address
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (revertError instanceof InvalidInputRpcError) {
|
|
198
|
+
const { data: data_ } = (
|
|
199
|
+
e instanceof RawContractError
|
|
200
|
+
? e
|
|
201
|
+
: e instanceof BaseError
|
|
202
|
+
? e.walk((err) => "data" in (err as Error)) || e.walk()
|
|
203
|
+
: {}
|
|
204
|
+
) as RawContractError
|
|
205
|
+
|
|
206
|
+
const data = typeof data_ === "string" ? data_ : data_?.data
|
|
207
|
+
|
|
208
|
+
if (data === undefined) {
|
|
209
|
+
throw new Error(
|
|
210
|
+
"Failed to parse revert bytes from RPC response"
|
|
211
|
+
)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const error = decodeErrorResult({
|
|
215
|
+
abi: [
|
|
216
|
+
{
|
|
217
|
+
inputs: [
|
|
218
|
+
{
|
|
219
|
+
internalType: "address",
|
|
220
|
+
name: "sender",
|
|
221
|
+
type: "address"
|
|
222
|
+
}
|
|
223
|
+
],
|
|
224
|
+
name: "SenderAddressResult",
|
|
225
|
+
type: "error"
|
|
226
|
+
}
|
|
227
|
+
],
|
|
228
|
+
data
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
return error.args[0] as Address
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (revertError instanceof UnknownRpcError) {
|
|
235
|
+
const parsedBody = JSON.parse(
|
|
236
|
+
// biome-ignore lint/suspicious/noExplicitAny:
|
|
237
|
+
(revertError as unknown as any).cause.body
|
|
238
|
+
)
|
|
239
|
+
const revertData = parsedBody.error.data
|
|
240
|
+
|
|
241
|
+
const hexStringRegex = /0x[a-fA-F0-9]+/
|
|
242
|
+
const match = revertData.match(hexStringRegex)
|
|
243
|
+
|
|
244
|
+
if (!match) {
|
|
245
|
+
throw new Error(
|
|
246
|
+
"Failed to parse revert bytes from RPC response"
|
|
247
|
+
)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const data: Hex = match[0]
|
|
251
|
+
|
|
252
|
+
const error = decodeErrorResult({
|
|
253
|
+
abi: [
|
|
254
|
+
{
|
|
255
|
+
inputs: [
|
|
256
|
+
{
|
|
257
|
+
internalType: "address",
|
|
258
|
+
name: "sender",
|
|
259
|
+
type: "address"
|
|
260
|
+
}
|
|
261
|
+
],
|
|
262
|
+
name: "SenderAddressResult",
|
|
263
|
+
type: "error"
|
|
264
|
+
}
|
|
265
|
+
],
|
|
266
|
+
data
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
return error.args[0] as Address
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
throw e
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
throw new InvalidEntryPointError({ entryPointAddress })
|
|
276
|
+
}
|