@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/types/kernel.ts
CHANGED
|
@@ -1,30 +1,28 @@
|
|
|
1
|
+
import type { Address, CustomSource, Hex, LocalAccount, PartialBy } from "viem"
|
|
1
2
|
import type {
|
|
2
|
-
|
|
3
|
-
EntryPoint
|
|
4
|
-
} from "permissionless/types"
|
|
5
|
-
import type { GetEntryPointVersion } from "permissionless/types/entrypoint"
|
|
6
|
-
import type {
|
|
3
|
+
EntryPointVersion,
|
|
7
4
|
UserOperation,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import type { PartialBy } from "viem/types/utils"
|
|
5
|
+
entryPoint06Abi,
|
|
6
|
+
entryPoint07Abi
|
|
7
|
+
} from "viem/account-abstraction"
|
|
12
8
|
import type { VALIDATOR_TYPE } from "../constants.js"
|
|
13
|
-
export type ZeroDevPaymasterRpcSchema<
|
|
9
|
+
export type ZeroDevPaymasterRpcSchema<
|
|
10
|
+
entryPointVersion extends EntryPointVersion
|
|
11
|
+
> = [
|
|
14
12
|
{
|
|
15
13
|
Method: "zd_sponsorUserOperation"
|
|
16
14
|
Parameters: [
|
|
17
15
|
{
|
|
18
16
|
chainId: number
|
|
19
|
-
userOp:
|
|
17
|
+
userOp: entryPointVersion extends "0.6"
|
|
20
18
|
? PartialBy<
|
|
21
|
-
|
|
19
|
+
UserOperation<"0.6">,
|
|
22
20
|
| "callGasLimit"
|
|
23
21
|
| "preVerificationGas"
|
|
24
22
|
| "verificationGasLimit"
|
|
25
23
|
>
|
|
26
24
|
: PartialBy<
|
|
27
|
-
|
|
25
|
+
UserOperation<"0.7">,
|
|
28
26
|
| "callGasLimit"
|
|
29
27
|
| "preVerificationGas"
|
|
30
28
|
| "verificationGasLimit"
|
|
@@ -40,7 +38,7 @@ export type ZeroDevPaymasterRpcSchema<entryPoint extends EntryPoint> = [
|
|
|
40
38
|
shouldConsume?: boolean
|
|
41
39
|
}
|
|
42
40
|
]
|
|
43
|
-
ReturnType:
|
|
41
|
+
ReturnType: entryPointVersion extends "0.6"
|
|
44
42
|
? {
|
|
45
43
|
paymasterAndData: Hex
|
|
46
44
|
preVerificationGas: Hex
|
|
@@ -81,7 +79,7 @@ export type ZeroDevPaymasterRpcSchema<entryPoint extends EntryPoint> = [
|
|
|
81
79
|
Parameters: [
|
|
82
80
|
{
|
|
83
81
|
chainId: number
|
|
84
|
-
userOp:
|
|
82
|
+
userOp: UserOperation<"0.6">
|
|
85
83
|
entryPointAddress: Address
|
|
86
84
|
tokenAddress: Address
|
|
87
85
|
}
|
|
@@ -121,28 +119,28 @@ export type ValidatorType = Extract<
|
|
|
121
119
|
"PERMISSION" | "SECONDARY"
|
|
122
120
|
>
|
|
123
121
|
|
|
124
|
-
export type KernelValidator<
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
122
|
+
export type KernelValidator<Name extends string = string> =
|
|
123
|
+
LocalAccount<Name> & {
|
|
124
|
+
validatorType: ValidatorType
|
|
125
|
+
supportedKernelVersions: string
|
|
126
|
+
getNonceKey: (
|
|
127
|
+
accountAddress?: Address,
|
|
128
|
+
customNonceKey?: bigint
|
|
129
|
+
) => Promise<bigint>
|
|
130
|
+
getStubSignature(
|
|
131
|
+
userOperation: UserOperation,
|
|
132
|
+
pluginEnableSignature?: Hex
|
|
133
|
+
): Promise<Hex>
|
|
134
|
+
signUserOperation: (
|
|
135
|
+
userOperation: UserOperation & {
|
|
136
|
+
chainId?: number | undefined
|
|
137
|
+
},
|
|
138
|
+
pluginEnableSignature?: Hex
|
|
139
|
+
) => Promise<Hex>
|
|
140
|
+
getEnableData(accountAddress?: Address): Promise<Hex>
|
|
141
|
+
isEnabled(accountAddress: Address, selector: Hex): Promise<boolean>
|
|
142
|
+
getIdentifier: () => Hex
|
|
143
|
+
}
|
|
146
144
|
|
|
147
145
|
export type KernelValidatorHook = {
|
|
148
146
|
getEnableData(accountAddress?: Address): Promise<Hex>
|
|
@@ -156,10 +154,10 @@ export type ValidatorInitData = {
|
|
|
156
154
|
initConfig?: Hex[]
|
|
157
155
|
}
|
|
158
156
|
|
|
159
|
-
export type KernelPluginManager<
|
|
160
|
-
KernelValidator
|
|
161
|
-
sudoValidator?: KernelValidator
|
|
162
|
-
regularValidator?: KernelValidator
|
|
157
|
+
export type KernelPluginManager<entryPointVersion extends EntryPointVersion> =
|
|
158
|
+
KernelValidator & {
|
|
159
|
+
sudoValidator?: KernelValidator
|
|
160
|
+
regularValidator?: KernelValidator
|
|
163
161
|
hook?: KernelValidatorHook
|
|
164
162
|
getPluginEnableSignature(accountAddress: Address): Promise<Hex>
|
|
165
163
|
getValidatorInitData(): Promise<ValidatorInitData>
|
|
@@ -171,12 +169,12 @@ export type KernelPluginManager<entryPoint extends EntryPoint> =
|
|
|
171
169
|
accountAddress: Address
|
|
172
170
|
) => Promise<Parameters<CustomSource["signTypedData"]>[0]>
|
|
173
171
|
signUserOperationWithActiveValidator: (
|
|
174
|
-
userOperation: UserOperation<
|
|
172
|
+
userOperation: UserOperation<entryPointVersion>
|
|
175
173
|
) => Promise<Hex>
|
|
176
174
|
}
|
|
177
175
|
|
|
178
|
-
export type PluginInstallData<
|
|
179
|
-
|
|
176
|
+
export type PluginInstallData<entryPointVersion extends EntryPointVersion> =
|
|
177
|
+
entryPointVersion extends "0.6"
|
|
180
178
|
? {
|
|
181
179
|
selector: Hex
|
|
182
180
|
executor: Address
|
|
@@ -188,14 +186,19 @@ export type PluginInstallData<entryPoint extends EntryPoint> =
|
|
|
188
186
|
: // TODO: Add support for EP v0.7
|
|
189
187
|
never
|
|
190
188
|
|
|
191
|
-
export type KernelPluginManagerParams<
|
|
192
|
-
|
|
193
|
-
|
|
189
|
+
export type KernelPluginManagerParams<
|
|
190
|
+
entryPointVersion extends EntryPointVersion
|
|
191
|
+
> = {
|
|
192
|
+
sudo?: KernelValidator
|
|
193
|
+
regular?: KernelValidator
|
|
194
194
|
hook?: KernelValidatorHook
|
|
195
195
|
pluginEnableSignature?: Hex
|
|
196
196
|
validatorInitData?: ValidatorInitData
|
|
197
197
|
action?: Action
|
|
198
|
-
entryPoint:
|
|
198
|
+
entryPoint: {
|
|
199
|
+
address: Address
|
|
200
|
+
version: entryPointVersion
|
|
201
|
+
}
|
|
199
202
|
kernelVersion: KERNEL_VERSION_TYPE
|
|
200
203
|
chainId?: number
|
|
201
204
|
} & Partial<PluginValidityData>
|
|
@@ -223,19 +226,17 @@ export enum ValidatorMode {
|
|
|
223
226
|
|
|
224
227
|
export type CallType = "call" | "delegatecall"
|
|
225
228
|
|
|
226
|
-
export type KernelEncodeCallDataArgs =
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
callType: CallType | undefined
|
|
238
|
-
}[]
|
|
229
|
+
export type KernelEncodeCallDataArgs = {
|
|
230
|
+
to: Address
|
|
231
|
+
value: bigint
|
|
232
|
+
data: Hex
|
|
233
|
+
callType: CallType | undefined
|
|
234
|
+
}[]
|
|
235
|
+
|
|
236
|
+
export type GetEntryPointAbi<entryPointVersion extends EntryPointVersion> =
|
|
237
|
+
entryPointVersion extends "0.6"
|
|
238
|
+
? typeof entryPoint06Abi
|
|
239
|
+
: typeof entryPoint07Abi
|
|
239
240
|
|
|
240
241
|
export type Execution = {
|
|
241
242
|
target: Address
|
|
@@ -251,7 +252,7 @@ export type KERNEL_VERSION_TYPE =
|
|
|
251
252
|
| KERNEL_V2_VERSION_TYPE
|
|
252
253
|
| KERNEL_V3_VERSION_TYPE
|
|
253
254
|
|
|
254
|
-
export type GetKernelVersion<
|
|
255
|
-
|
|
255
|
+
export type GetKernelVersion<entryPointVersion extends EntryPointVersion> =
|
|
256
|
+
entryPointVersion extends "0.6"
|
|
256
257
|
? KERNEL_V2_VERSION_TYPE
|
|
257
258
|
: KERNEL_V3_VERSION_TYPE
|
package/utils.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ENTRYPOINT_ADDRESS_V06, ENTRYPOINT_ADDRESS_V07 } from "permissionless"
|
|
2
|
-
import type { EntryPoint } from "permissionless/types/entrypoint"
|
|
3
1
|
import { satisfies } from "semver"
|
|
4
2
|
import {
|
|
5
3
|
type Address,
|
|
@@ -10,8 +8,10 @@ import {
|
|
|
10
8
|
hexToSignature,
|
|
11
9
|
isHex,
|
|
12
10
|
pad,
|
|
13
|
-
signatureToHex
|
|
11
|
+
signatureToHex,
|
|
12
|
+
toHex
|
|
14
13
|
} from "viem"
|
|
14
|
+
import type { EntryPointVersion } from "viem/account-abstraction"
|
|
15
15
|
import type { ZeroDevPaymasterClient } from "./clients/paymasterClient.js"
|
|
16
16
|
import type { CALL_TYPE, EXEC_TYPE } from "./constants.js"
|
|
17
17
|
import type { GetKernelVersion } from "./types/kernel.js"
|
|
@@ -40,9 +40,9 @@ export const hasKernelFeature = (
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export const getERC20PaymasterApproveCall = async <
|
|
43
|
-
|
|
43
|
+
entryPointVersion extends EntryPointVersion
|
|
44
44
|
>(
|
|
45
|
-
client: ZeroDevPaymasterClient<
|
|
45
|
+
client: ZeroDevPaymasterClient<entryPointVersion>,
|
|
46
46
|
{
|
|
47
47
|
gasToken,
|
|
48
48
|
approveAmount,
|
|
@@ -50,7 +50,7 @@ export const getERC20PaymasterApproveCall = async <
|
|
|
50
50
|
}: {
|
|
51
51
|
gasToken: Address
|
|
52
52
|
approveAmount: bigint
|
|
53
|
-
entryPoint: Address
|
|
53
|
+
entryPoint: { address: Address; version: entryPointVersion }
|
|
54
54
|
}
|
|
55
55
|
): Promise<{ to: Address; value: bigint; data: Hex }> => {
|
|
56
56
|
const response = await client.request({
|
|
@@ -58,7 +58,7 @@ export const getERC20PaymasterApproveCall = async <
|
|
|
58
58
|
params: [
|
|
59
59
|
{
|
|
60
60
|
chainId: client.chain?.id as number,
|
|
61
|
-
entryPointAddress: entryPoint
|
|
61
|
+
entryPointAddress: entryPoint.address
|
|
62
62
|
}
|
|
63
63
|
]
|
|
64
64
|
})
|
|
@@ -106,16 +106,15 @@ export const getExecMode = ({
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
export const validateKernelVersionWithEntryPoint = <
|
|
109
|
-
|
|
109
|
+
entryPointVersion extends EntryPointVersion
|
|
110
110
|
>(
|
|
111
|
-
|
|
112
|
-
kernelVersion: GetKernelVersion<
|
|
111
|
+
entryPointVersion: EntryPointVersion,
|
|
112
|
+
kernelVersion: GetKernelVersion<entryPointVersion>
|
|
113
113
|
) => {
|
|
114
114
|
if (
|
|
115
|
-
(
|
|
115
|
+
(entryPointVersion === "0.6" &&
|
|
116
116
|
!satisfies(kernelVersion, ">=0.2.2 || <=0.2.4")) ||
|
|
117
|
-
(
|
|
118
|
-
!satisfies(kernelVersion, ">=0.3.0"))
|
|
117
|
+
(entryPointVersion === "0.7" && !satisfies(kernelVersion, ">=0.3.0"))
|
|
119
118
|
) {
|
|
120
119
|
throw new Error(
|
|
121
120
|
"KernelVersion should be >= 0.2.2 and <= 0.2.4 for EntryPointV0.6 and >= 0.3.0 for EntryPointV0.7"
|
|
@@ -126,3 +125,32 @@ export const validateKernelVersionWithEntryPoint = <
|
|
|
126
125
|
export const satisfiesRange = (version: string, range: string): boolean => {
|
|
127
126
|
return satisfies(version, range)
|
|
128
127
|
}
|
|
128
|
+
|
|
129
|
+
// biome-ignore lint/suspicious/noExplicitAny: it's a recursive function, so it's hard to type
|
|
130
|
+
export function deepHexlify(obj: any): any {
|
|
131
|
+
if (typeof obj === "function") {
|
|
132
|
+
return undefined
|
|
133
|
+
}
|
|
134
|
+
if (obj == null || typeof obj === "string" || typeof obj === "boolean") {
|
|
135
|
+
return obj
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (typeof obj === "bigint") {
|
|
139
|
+
return toHex(obj)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (obj._isBigNumber != null || typeof obj !== "object") {
|
|
143
|
+
return toHex(obj).replace(/^0x0/, "0x")
|
|
144
|
+
}
|
|
145
|
+
if (Array.isArray(obj)) {
|
|
146
|
+
return obj.map((member) => deepHexlify(member))
|
|
147
|
+
}
|
|
148
|
+
return Object.keys(obj).reduce(
|
|
149
|
+
// biome-ignore lint/suspicious/noExplicitAny: it's a recursive function, so it's hard to type
|
|
150
|
+
(set: any, key: string) => {
|
|
151
|
+
set[key] = deepHexlify(obj[key])
|
|
152
|
+
return set
|
|
153
|
+
},
|
|
154
|
+
{}
|
|
155
|
+
)
|
|
156
|
+
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sponsorUserOperationEip7677 = void 0;
|
|
4
|
-
const permissionless_1 = require("permissionless");
|
|
5
|
-
const experimental_1 = require("permissionless/experimental");
|
|
6
|
-
const sponsorUserOperationEip7677 = async (client, args, bundlerClient, stateOverrides) => {
|
|
7
|
-
const { entryPoint: entryPointAddress, userOperation } = args;
|
|
8
|
-
const chain = client.chain;
|
|
9
|
-
const paymasterClient = client.extend((0, experimental_1.paymasterActionsEip7677)(entryPointAddress));
|
|
10
|
-
const stubData = await paymasterClient.getPaymasterStubData({
|
|
11
|
-
userOperation: userOperation,
|
|
12
|
-
chain
|
|
13
|
-
});
|
|
14
|
-
const stubUserOperation = {
|
|
15
|
-
...userOperation,
|
|
16
|
-
...stubData
|
|
17
|
-
};
|
|
18
|
-
const gas = (await bundlerClient.estimateUserOperationGas({
|
|
19
|
-
userOperation: stubUserOperation
|
|
20
|
-
}, stateOverrides));
|
|
21
|
-
const userOperationWithGas = {
|
|
22
|
-
...stubUserOperation,
|
|
23
|
-
callGasLimit: gas.callGasLimit,
|
|
24
|
-
verificationGasLimit: gas.verificationGasLimit,
|
|
25
|
-
preVerificationGas: gas.preVerificationGas
|
|
26
|
-
};
|
|
27
|
-
const paymasterData = await paymasterClient.getPaymasterData({
|
|
28
|
-
userOperation: userOperationWithGas,
|
|
29
|
-
chain
|
|
30
|
-
});
|
|
31
|
-
if (entryPointAddress === permissionless_1.ENTRYPOINT_ADDRESS_V06) {
|
|
32
|
-
const paymasterDataV06 = paymasterData;
|
|
33
|
-
return {
|
|
34
|
-
callGasLimit: BigInt(gas.callGasLimit),
|
|
35
|
-
verificationGasLimit: BigInt(gas.verificationGasLimit),
|
|
36
|
-
preVerificationGas: BigInt(gas.preVerificationGas),
|
|
37
|
-
paymasterAndData: paymasterDataV06?.paymasterAndData,
|
|
38
|
-
maxFeePerGas: BigInt(userOperation.maxFeePerGas),
|
|
39
|
-
maxPriorityFeePerGas: BigInt(userOperation.maxPriorityFeePerGas)
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
const stubDataV07 = stubData;
|
|
43
|
-
const paymasterDataV07 = paymasterData;
|
|
44
|
-
return {
|
|
45
|
-
callGasLimit: BigInt(gas.callGasLimit),
|
|
46
|
-
verificationGasLimit: BigInt(gas.verificationGasLimit),
|
|
47
|
-
preVerificationGas: BigInt(gas.preVerificationGas),
|
|
48
|
-
paymaster: paymasterDataV07.paymaster,
|
|
49
|
-
paymasterData: paymasterDataV07.paymasterData,
|
|
50
|
-
paymasterVerificationGasLimit: stubDataV07.paymasterVerificationGasLimit &&
|
|
51
|
-
BigInt(stubDataV07.paymasterVerificationGasLimit),
|
|
52
|
-
paymasterPostOpGasLimit: stubDataV07?.paymasterPostOpGasLimit &&
|
|
53
|
-
BigInt(stubDataV07.paymasterPostOpGasLimit),
|
|
54
|
-
maxFeePerGas: BigInt(userOperation.maxFeePerGas),
|
|
55
|
-
maxPriorityFeePerGas: BigInt(userOperation.maxPriorityFeePerGas)
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
exports.sponsorUserOperationEip7677 = sponsorUserOperationEip7677;
|
|
59
|
-
//# sourceMappingURL=sponsorUserOperationEip7677.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sponsorUserOperationEip7677.js","sourceRoot":"","sources":["../../../actions/paymaster/sponsorUserOperationEip7677.ts"],"names":[],"mappings":";;;AAAA,mDAKuB;AACvB,8DAMoC;AA+D7B,MAAM,2BAA2B,GAAG,KAAK,EAG5C,MAA0C,EAC1C,IAAuD,EACvD,aAAwC,EACxC,cAA+B,EAC2B,EAAE;IAC5D,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,aAAa,EAAE,GAAG,IAAI,CAAA;IAC7D,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;IAC1B,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CACjC,IAAA,sCAAuB,EAAC,iBAAiB,CAAC,CAC7C,CAAA;IACD,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,oBAAoB,CAAC;QACxD,aAAa,EAAE,aAGG;QAClB,KAAK;KACR,CAAC,CAAA;IACF,MAAM,iBAAiB,GAAG;QACtB,GAAG,aAAa;QAChB,GAAG,QAAQ;KACd,CAAA;IAED,MAAM,GAAG,GAAG,CAAC,MAAM,aAAa,CAAC,wBAAwB,CACrD;QACI,aAAa,EACT,iBAAoF;K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AE,uBAAuB;YACpC,MAAM,CAAC,WAAW,CAAC,uBAAuB,CAAC;QAC/C,YAAY,EAAE,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC;QAChD,oBAAoB,EAAE,MAAM,CAAC,aAAa,CAAC,oBAAoB,CAAC;KACd,CAAA;AAC1D,CAAC,CAAA;AA5EY,QAAA,2BAA2B,+BA4EvC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { ENTRYPOINT_ADDRESS_V06 } from "permissionless";
|
|
2
|
-
import { paymasterActionsEip7677 } from "permissionless/experimental";
|
|
3
|
-
/**
|
|
4
|
-
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
5
|
-
*/
|
|
6
|
-
export const sponsorUserOperationEip7677 = async (client, args, bundlerClient, stateOverrides) => {
|
|
7
|
-
const { entryPoint: entryPointAddress, userOperation } = args;
|
|
8
|
-
const chain = client.chain;
|
|
9
|
-
const paymasterClient = client.extend(paymasterActionsEip7677(entryPointAddress));
|
|
10
|
-
const stubData = await paymasterClient.getPaymasterStubData({
|
|
11
|
-
userOperation: userOperation,
|
|
12
|
-
chain
|
|
13
|
-
});
|
|
14
|
-
const stubUserOperation = {
|
|
15
|
-
...userOperation,
|
|
16
|
-
...stubData
|
|
17
|
-
};
|
|
18
|
-
const gas = (await bundlerClient.estimateUserOperationGas({
|
|
19
|
-
userOperation: stubUserOperation
|
|
20
|
-
}, stateOverrides));
|
|
21
|
-
const userOperationWithGas = {
|
|
22
|
-
...stubUserOperation,
|
|
23
|
-
callGasLimit: gas.callGasLimit,
|
|
24
|
-
verificationGasLimit: gas.verificationGasLimit,
|
|
25
|
-
preVerificationGas: gas.preVerificationGas
|
|
26
|
-
};
|
|
27
|
-
const paymasterData = await paymasterClient.getPaymasterData({
|
|
28
|
-
userOperation: userOperationWithGas,
|
|
29
|
-
chain
|
|
30
|
-
});
|
|
31
|
-
if (entryPointAddress === ENTRYPOINT_ADDRESS_V06) {
|
|
32
|
-
const paymasterDataV06 = paymasterData;
|
|
33
|
-
return {
|
|
34
|
-
callGasLimit: BigInt(gas.callGasLimit),
|
|
35
|
-
verificationGasLimit: BigInt(gas.verificationGasLimit),
|
|
36
|
-
preVerificationGas: BigInt(gas.preVerificationGas),
|
|
37
|
-
paymasterAndData: paymasterDataV06?.paymasterAndData,
|
|
38
|
-
maxFeePerGas: BigInt(userOperation.maxFeePerGas),
|
|
39
|
-
maxPriorityFeePerGas: BigInt(userOperation.maxPriorityFeePerGas)
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
const stubDataV07 = stubData;
|
|
43
|
-
const paymasterDataV07 = paymasterData;
|
|
44
|
-
return {
|
|
45
|
-
callGasLimit: BigInt(gas.callGasLimit),
|
|
46
|
-
verificationGasLimit: BigInt(gas.verificationGasLimit),
|
|
47
|
-
preVerificationGas: BigInt(gas.preVerificationGas),
|
|
48
|
-
paymaster: paymasterDataV07.paymaster,
|
|
49
|
-
paymasterData: paymasterDataV07.paymasterData,
|
|
50
|
-
paymasterVerificationGasLimit: stubDataV07.paymasterVerificationGasLimit &&
|
|
51
|
-
BigInt(stubDataV07.paymasterVerificationGasLimit),
|
|
52
|
-
paymasterPostOpGasLimit: stubDataV07?.paymasterPostOpGasLimit &&
|
|
53
|
-
BigInt(stubDataV07.paymasterPostOpGasLimit),
|
|
54
|
-
maxFeePerGas: BigInt(userOperation.maxFeePerGas),
|
|
55
|
-
maxPriorityFeePerGas: BigInt(userOperation.maxPriorityFeePerGas)
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=sponsorUserOperationEip7677.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sponsorUserOperationEip7677.js","sourceRoot":"","sources":["../../../actions/paymaster/sponsorUserOperationEip7677.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,sBAAsB,EAGzB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAKH,uBAAuB,EAC1B,MAAM,6BAA6B,CAAA;AA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BAAgB,EAAE,gBAAgB;YACpD,YAAY,EAAE,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC;YAChD,oBAAoB,EAAE,MAAM,CAAC,aAAa,CAAC,oBAAoB,CAAC;SACd,CAAA;IAC1D,CAAC;IACD,MAAM,WAAW,GACb,QAAuE,CAAA;IAC3E,MAAM,gBAAgB,GAClB,aAAwE,CAAA;IAE5E,OAAO;QACH,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC;QACtC,oBAAoB,EAAE,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;QACtD,kBAAkB,EAAE,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC;QAClD,SAAS,EAAE,gBAAgB,CAAC,SAAS;QACrC,aAAa,EAAE,gBAAgB,CAAC,aAAa;QAC7C,6BAA6B,EACzB,WAAW,CAAC,6BAA6B;YACzC,MAAM,CAAC,WAAW,CAAC,6BAA6B,CAAC;QACrD,uBAAuB,EACnB,WAAW,EAAE,uBAAuB;YACpC,MAAM,CAAC,WAAW,CAAC,uBAAuB,CAAC;QAC/C,YAAY,EAAE,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC;QAChD,oBAAoB,EAAE,MAAM,CAAC,aAAa,CAAC,oBAAoB,CAAC;KACd,CAAA;AAC1D,CAAC,CAAA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type BundlerClient } from "permissionless";
|
|
2
|
-
import type { ENTRYPOINT_ADDRESS_V06_TYPE, EntryPoint, PartialPick } from "permissionless/types";
|
|
3
|
-
import type { StateOverrides } from "permissionless/types/bundler";
|
|
4
|
-
import type { UserOperation } from "permissionless/types/userOperation.js";
|
|
5
|
-
import type { PartialBy } from "viem/types/utils";
|
|
6
|
-
import type { ZeroDevPaymasterClient } from "../../clients/paymasterClient.js";
|
|
7
|
-
export type SponsorUserOperationEip7677Parameters<entryPoint extends EntryPoint> = {
|
|
8
|
-
userOperation: entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE ? PartialBy<UserOperation<"v0.6">, "callGasLimit" | "preVerificationGas" | "verificationGasLimit"> : PartialBy<UserOperation<"v0.7">, "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "paymasterVerificationGasLimit" | "paymasterPostOpGasLimit">;
|
|
9
|
-
entryPoint: entryPoint;
|
|
10
|
-
};
|
|
11
|
-
export type SponsorUserOperationEip7677ReturnType<entryPoint extends EntryPoint> = entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE ? Pick<UserOperation<"v0.6">, "callGasLimit" | "verificationGasLimit" | "preVerificationGas" | "paymasterAndData"> & PartialPick<UserOperation<"v0.6">, "maxFeePerGas" | "maxPriorityFeePerGas"> : Pick<UserOperation<"v0.7">, "callGasLimit" | "verificationGasLimit" | "preVerificationGas" | "paymaster" | "paymasterVerificationGasLimit" | "paymasterPostOpGasLimit" | "paymasterData"> & PartialPick<UserOperation<"v0.7">, "maxFeePerGas" | "maxPriorityFeePerGas">;
|
|
12
|
-
/**
|
|
13
|
-
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
14
|
-
*/
|
|
15
|
-
export declare const sponsorUserOperationEip7677: <entryPoint extends EntryPoint>(client: ZeroDevPaymasterClient<entryPoint>, args: SponsorUserOperationEip7677Parameters<entryPoint>, bundlerClient: BundlerClient<entryPoint>, stateOverrides?: StateOverrides) => Promise<SponsorUserOperationEip7677ReturnType<entryPoint>>;
|
|
16
|
-
//# sourceMappingURL=sponsorUserOperationEip7677.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sponsorUserOperationEip7677.d.ts","sourceRoot":"","sources":["../../../actions/paymaster/sponsorUserOperationEip7677.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,aAAa,EAIrB,MAAM,gBAAgB,CAAA;AAQvB,OAAO,KAAK,EACR,2BAA2B,EAE3B,UAAU,EACV,WAAW,EACd,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE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type EstimateUserOperationGasReturnType
|
|
6
|
-
} from "permissionless"
|
|
7
|
-
import {
|
|
8
|
-
type GetPaymasterDataParameters,
|
|
9
|
-
type GetPaymasterDataReturnType,
|
|
10
|
-
type GetPaymasterStubDataParameters,
|
|
11
|
-
type GetPaymasterStubDataReturnType,
|
|
12
|
-
paymasterActionsEip7677
|
|
13
|
-
} from "permissionless/experimental"
|
|
14
|
-
import type {
|
|
15
|
-
ENTRYPOINT_ADDRESS_V06_TYPE,
|
|
16
|
-
ENTRYPOINT_ADDRESS_V07_TYPE,
|
|
17
|
-
EntryPoint,
|
|
18
|
-
PartialPick
|
|
19
|
-
} from "permissionless/types"
|
|
20
|
-
import type { StateOverrides } from "permissionless/types/bundler"
|
|
21
|
-
import type { UserOperation } from "permissionless/types/userOperation.js"
|
|
22
|
-
import type { PartialBy } from "viem/types/utils"
|
|
23
|
-
import type { ZeroDevPaymasterClient } from "../../clients/paymasterClient.js"
|
|
24
|
-
|
|
25
|
-
export type SponsorUserOperationEip7677Parameters<
|
|
26
|
-
entryPoint extends EntryPoint
|
|
27
|
-
> = {
|
|
28
|
-
userOperation: entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE
|
|
29
|
-
? PartialBy<
|
|
30
|
-
UserOperation<"v0.6">,
|
|
31
|
-
"callGasLimit" | "preVerificationGas" | "verificationGasLimit"
|
|
32
|
-
>
|
|
33
|
-
: PartialBy<
|
|
34
|
-
UserOperation<"v0.7">,
|
|
35
|
-
| "callGasLimit"
|
|
36
|
-
| "preVerificationGas"
|
|
37
|
-
| "verificationGasLimit"
|
|
38
|
-
| "paymasterVerificationGasLimit"
|
|
39
|
-
| "paymasterPostOpGasLimit"
|
|
40
|
-
>
|
|
41
|
-
entryPoint: entryPoint
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export type SponsorUserOperationEip7677ReturnType<
|
|
45
|
-
entryPoint extends EntryPoint
|
|
46
|
-
> = entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE
|
|
47
|
-
? Pick<
|
|
48
|
-
UserOperation<"v0.6">,
|
|
49
|
-
| "callGasLimit"
|
|
50
|
-
| "verificationGasLimit"
|
|
51
|
-
| "preVerificationGas"
|
|
52
|
-
| "paymasterAndData"
|
|
53
|
-
> &
|
|
54
|
-
PartialPick<
|
|
55
|
-
UserOperation<"v0.6">,
|
|
56
|
-
"maxFeePerGas" | "maxPriorityFeePerGas"
|
|
57
|
-
>
|
|
58
|
-
: Pick<
|
|
59
|
-
UserOperation<"v0.7">,
|
|
60
|
-
| "callGasLimit"
|
|
61
|
-
| "verificationGasLimit"
|
|
62
|
-
| "preVerificationGas"
|
|
63
|
-
| "paymaster"
|
|
64
|
-
| "paymasterVerificationGasLimit"
|
|
65
|
-
| "paymasterPostOpGasLimit"
|
|
66
|
-
| "paymasterData"
|
|
67
|
-
> &
|
|
68
|
-
PartialPick<
|
|
69
|
-
UserOperation<"v0.7">,
|
|
70
|
-
"maxFeePerGas" | "maxPriorityFeePerGas"
|
|
71
|
-
>
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
75
|
-
*/
|
|
76
|
-
export const sponsorUserOperationEip7677 = async <
|
|
77
|
-
entryPoint extends EntryPoint
|
|
78
|
-
>(
|
|
79
|
-
client: ZeroDevPaymasterClient<entryPoint>,
|
|
80
|
-
args: SponsorUserOperationEip7677Parameters<entryPoint>,
|
|
81
|
-
bundlerClient: BundlerClient<entryPoint>,
|
|
82
|
-
stateOverrides?: StateOverrides
|
|
83
|
-
): Promise<SponsorUserOperationEip7677ReturnType<entryPoint>> => {
|
|
84
|
-
const { entryPoint: entryPointAddress, userOperation } = args
|
|
85
|
-
const chain = client.chain
|
|
86
|
-
const paymasterClient = client.extend(
|
|
87
|
-
paymasterActionsEip7677(entryPointAddress)
|
|
88
|
-
)
|
|
89
|
-
const stubData = await paymasterClient.getPaymasterStubData({
|
|
90
|
-
userOperation: userOperation as GetPaymasterStubDataParameters<
|
|
91
|
-
entryPoint,
|
|
92
|
-
typeof chain
|
|
93
|
-
>["userOperation"],
|
|
94
|
-
chain
|
|
95
|
-
})
|
|
96
|
-
const stubUserOperation = {
|
|
97
|
-
...userOperation,
|
|
98
|
-
...stubData
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const gas = (await bundlerClient.estimateUserOperationGas(
|
|
102
|
-
{
|
|
103
|
-
userOperation:
|
|
104
|
-
stubUserOperation as EstimateUserOperationGasParameters<entryPoint>["userOperation"]
|
|
105
|
-
},
|
|
106
|
-
stateOverrides
|
|
107
|
-
)) as EstimateUserOperationGasReturnType<entryPoint>
|
|
108
|
-
const userOperationWithGas = {
|
|
109
|
-
...stubUserOperation,
|
|
110
|
-
callGasLimit: gas.callGasLimit,
|
|
111
|
-
verificationGasLimit: gas.verificationGasLimit,
|
|
112
|
-
preVerificationGas: gas.preVerificationGas
|
|
113
|
-
} as GetPaymasterDataParameters<entryPoint>["userOperation"]
|
|
114
|
-
|
|
115
|
-
const paymasterData = await paymasterClient.getPaymasterData({
|
|
116
|
-
userOperation: userOperationWithGas,
|
|
117
|
-
chain
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
if (entryPointAddress === ENTRYPOINT_ADDRESS_V06) {
|
|
121
|
-
const paymasterDataV06 =
|
|
122
|
-
paymasterData as GetPaymasterDataReturnType<ENTRYPOINT_ADDRESS_V06_TYPE>
|
|
123
|
-
return {
|
|
124
|
-
callGasLimit: BigInt(gas.callGasLimit),
|
|
125
|
-
verificationGasLimit: BigInt(gas.verificationGasLimit),
|
|
126
|
-
preVerificationGas: BigInt(gas.preVerificationGas),
|
|
127
|
-
paymasterAndData: paymasterDataV06?.paymasterAndData,
|
|
128
|
-
maxFeePerGas: BigInt(userOperation.maxFeePerGas),
|
|
129
|
-
maxPriorityFeePerGas: BigInt(userOperation.maxPriorityFeePerGas)
|
|
130
|
-
} as SponsorUserOperationEip7677ReturnType<entryPoint>
|
|
131
|
-
}
|
|
132
|
-
const stubDataV07 =
|
|
133
|
-
stubData as GetPaymasterStubDataReturnType<ENTRYPOINT_ADDRESS_V07_TYPE>
|
|
134
|
-
const paymasterDataV07 =
|
|
135
|
-
paymasterData as GetPaymasterDataReturnType<ENTRYPOINT_ADDRESS_V07_TYPE>
|
|
136
|
-
|
|
137
|
-
return {
|
|
138
|
-
callGasLimit: BigInt(gas.callGasLimit),
|
|
139
|
-
verificationGasLimit: BigInt(gas.verificationGasLimit),
|
|
140
|
-
preVerificationGas: BigInt(gas.preVerificationGas),
|
|
141
|
-
paymaster: paymasterDataV07.paymaster,
|
|
142
|
-
paymasterData: paymasterDataV07.paymasterData,
|
|
143
|
-
paymasterVerificationGasLimit:
|
|
144
|
-
stubDataV07.paymasterVerificationGasLimit &&
|
|
145
|
-
BigInt(stubDataV07.paymasterVerificationGasLimit),
|
|
146
|
-
paymasterPostOpGasLimit:
|
|
147
|
-
stubDataV07?.paymasterPostOpGasLimit &&
|
|
148
|
-
BigInt(stubDataV07.paymasterPostOpGasLimit),
|
|
149
|
-
maxFeePerGas: BigInt(userOperation.maxFeePerGas),
|
|
150
|
-
maxPriorityFeePerGas: BigInt(userOperation.maxPriorityFeePerGas)
|
|
151
|
-
} as SponsorUserOperationEip7677ReturnType<entryPoint>
|
|
152
|
-
}
|