@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
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { sendUserOperation } from "permissionless/actions/smartAccount";
|
|
2
|
-
import { AccountOrClientNotFoundError, parseAccount } from "permissionless/utils";
|
|
3
1
|
import { zeroAddress } from "viem";
|
|
4
|
-
import {
|
|
2
|
+
import { sendUserOperation } from "viem/account-abstraction";
|
|
3
|
+
import { concatHex, encodeFunctionData, getAction, pad, parseAccount } from "viem/utils";
|
|
5
4
|
import { KernelV3_1AccountAbi } from "../../accounts/kernel/abi/kernel_v_3_1/KernelAccountAbi.js";
|
|
6
5
|
import { KERNEL_V3_0, KERNEL_V3_1, KernelVersionToAddressesMap, VALIDATOR_TYPE } from "../../constants.js";
|
|
6
|
+
import { AccountNotFoundError } from "../../errors/index.js";
|
|
7
7
|
export async function changeSudoValidator(client, args) {
|
|
8
8
|
const { account: account_ = client.account, sudoValidator, hook } = args;
|
|
9
9
|
if (!account_)
|
|
10
|
-
throw new
|
|
10
|
+
throw new AccountNotFoundError({
|
|
11
|
+
docsPath: "/docs/actions/wallet/sendTransaction"
|
|
12
|
+
});
|
|
11
13
|
const account = parseAccount(account_);
|
|
12
14
|
let rootValidatorId;
|
|
13
15
|
if ([VALIDATOR_TYPE.PERMISSION, VALIDATOR_TYPE.SECONDARY].includes(VALIDATOR_TYPE[sudoValidator.validatorType])) {
|
|
@@ -29,30 +31,34 @@ export async function changeSudoValidator(client, args) {
|
|
|
29
31
|
* @dev Kernel v3.0 does not support changeRootValidator directly, so we need to use delegatecall to call changeRootValidator on Kernel v3.1 implementation contract
|
|
30
32
|
*/
|
|
31
33
|
if (account.kernelVersion === KERNEL_V3_0) {
|
|
32
|
-
return await getAction(client,
|
|
34
|
+
return await getAction(client, sendUserOperation, "sendUserOperation")({
|
|
33
35
|
...args,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
callData: await account.encodeCalls([
|
|
37
|
+
{
|
|
36
38
|
to: KernelVersionToAddressesMap[KERNEL_V3_1]
|
|
37
39
|
.accountImplementationAddress,
|
|
38
40
|
value: 0n,
|
|
39
41
|
data: encodeFunctionData({
|
|
40
42
|
abi: KernelV3_1AccountAbi,
|
|
41
43
|
functionName: "changeRootValidator",
|
|
42
|
-
args: [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
args: [
|
|
45
|
+
rootValidatorId,
|
|
46
|
+
hookId,
|
|
47
|
+
validatorData,
|
|
48
|
+
hookData
|
|
49
|
+
]
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
], "delegatecall")
|
|
47
53
|
});
|
|
48
54
|
}
|
|
49
55
|
/**
|
|
50
56
|
* @dev Kernel v3.1 supports changeRootValidator directly
|
|
51
57
|
*/
|
|
52
|
-
return await getAction(client,
|
|
58
|
+
return await getAction(client, sendUserOperation, "sendUserOperation")({
|
|
53
59
|
...args,
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
callData: await account.encodeCalls([
|
|
61
|
+
{
|
|
56
62
|
to: account.address,
|
|
57
63
|
value: 0n,
|
|
58
64
|
data: encodeFunctionData({
|
|
@@ -60,8 +66,8 @@ export async function changeSudoValidator(client, args) {
|
|
|
60
66
|
functionName: "changeRootValidator",
|
|
61
67
|
args: [rootValidatorId, hookId, validatorData, hookData]
|
|
62
68
|
})
|
|
63
|
-
}
|
|
64
|
-
|
|
69
|
+
}
|
|
70
|
+
])
|
|
65
71
|
});
|
|
66
72
|
}
|
|
67
73
|
//# sourceMappingURL=changeSudoValidator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changeSudoValidator.js","sourceRoot":"","sources":["../../../actions/account-client/changeSudoValidator.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"changeSudoValidator.js","sourceRoot":"","sources":["../../../actions/account-client/changeSudoValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAOH,WAAW,EACd,MAAM,MAAM,CAAA;AACb,OAAO,EAGH,iBAAiB,EACpB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,SAAS,EACT,kBAAkB,EAClB,SAAS,EACT,GAAG,EACH,YAAY,EACf,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAA;AACjG,OAAO,EACH,WAAW,EACX,WAAW,EACX,2BAA2B,EAC3B,cAAc,EACjB,MAAM,oBAAoB,CAAA;AAK3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAa7D,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAMrC,MAAyC,EACzC,IAEC;IAED,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;IACxE,IAAI,CAAC,QAAQ;QACT,MAAM,IAAI,oBAAoB,CAAC;YAC3B,QAAQ,EAAE,sCAAsC;SACnD,CAAC,CAAA;IAEN,MAAM,OAAO,GAAG,YAAY,CACxB,QAAQ,CACuC,CAAA;IAEnD,IAAI,eAAoB,CAAA;IACxB,IACI,CAAC,cAAc,CAAC,UAAU,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC,QAAQ,CAC1D,cAAc,CAAC,aAAa,CAAC,aAAa,CAAC,CAC9C,EACH,CAAC;QACC,eAAe,GAAG,SAAS,CAAC;YACxB,cAAc,CAAC,aAAa,CAAC,aAAa,CAAC;YAC3C,GAAG,CAAC,aAAa,CAAC,aAAa,EAAE,EAAE;gBAC/B,IAAI,EAAE,EAAE;gBACR,GAAG,EAAE,OAAO;aACf,CAAC;SACL,CAAC,CAAA;IACN,CAAC;SAAM,CAAC;QACJ,MAAM,IAAI,KAAK,CACX,wCAAwC,aAAa,CAAC,aAAa,EAAE,CACxE,CAAA;IACL,CAAC;IAED,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAExE,MAAM,MAAM,GAAG,IAAI,EAAE,aAAa,EAAE,IAAI,WAAW,CAAA;IAEnD,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,IAAI,CAAA;IAErE;;OAEG;IACH,IAAI,OAAO,CAAC,aAAa,KAAK,WAAW,EAAE,CAAC;QACxC,OAAO,MAAM,SAAS,CAClB,MAAM,EACN,iBAAiB,EACjB,mBAAmB,CACtB,CAAC;YACE,GAAG,IAAI;YACP,QAAQ,EAAE,MAAM,OAAO,CAAC,WAAW,CAC/B;gBACI;oBACI,EAAE,EAAE,2BAA2B,CAAC,WAAW,CAAC;yBACvC,4BAA4B;oBACjC,KAAK,EAAE,EAAE;oBACT,IAAI,EAAE,kBAAkB,CAAC;wBACrB,GAAG,EAAE,oBAAoB;wBACzB,YAAY,EAAE,qBAAqB;wBACnC,IAAI,EAAE;4BACF,eAAe;4BACf,MAAM;4BACN,aAAa;4BACb,QAAQ;yBACX;qBACJ,CAAC;iBACL;aACJ,EACD,cAAc,CACjB;SAC2B,CAAC,CAAA;IACrC,CAAC;IAED;;OAEG;IACH,OAAO,MAAM,SAAS,CAClB,MAAM,EACN,iBAAiB,EACjB,mBAAmB,CACtB,CAAC;QACE,GAAG,IAAI;QACP,QAAQ,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC;YAChC;gBACI,EAAE,EAAE,OAAO,CAAC,OAAO;gBACnB,KAAK,EAAE,EAAE;gBACT,IAAI,EAAE,kBAAkB,CAAC;oBACrB,GAAG,EAAE,oBAAoB;oBACzB,YAAY,EAAE,qBAAqB;oBACnC,IAAI,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,CAAC;iBAC3D,CAAC;aACL;SACJ,CAAC;KAC0B,CAAC,CAAA;AACrC,CAAC"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { AccountOrClientNotFoundError, parseAccount } from "permissionless/utils";
|
|
2
1
|
import { readContract } from "viem/actions";
|
|
3
|
-
import { getAction } from "viem/utils";
|
|
2
|
+
import { getAction, parseAccount } from "viem/utils";
|
|
4
3
|
import { KernelV3AccountAbi } from "../../accounts/kernel/abi/kernel_v_3_0_0/KernelAccountAbi.js";
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { AccountNotFoundError } from "../../errors/index.js";
|
|
5
|
+
export async function getKernelV3ModuleCurrentNonce(client) {
|
|
6
|
+
const account_ = client.account;
|
|
7
7
|
if (!account_)
|
|
8
|
-
throw new
|
|
8
|
+
throw new AccountNotFoundError({
|
|
9
|
+
docsPath: "/docs/actions/wallet/sendTransaction"
|
|
10
|
+
});
|
|
9
11
|
const account = parseAccount(account_);
|
|
10
12
|
try {
|
|
11
|
-
const nonce = await getAction(client, readContract, "
|
|
13
|
+
const nonce = await getAction(client, readContract, "readContract")({
|
|
12
14
|
abi: KernelV3AccountAbi,
|
|
13
15
|
address: account.address,
|
|
14
16
|
functionName: "currentNonce",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getKernelV3ModuleCurrentNonce.js","sourceRoot":"","sources":["../../../actions/account-client/getKernelV3ModuleCurrentNonce.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"getKernelV3ModuleCurrentNonce.js","sourceRoot":"","sources":["../../../actions/account-client/getKernelV3ModuleCurrentNonce.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8DAA8D,CAAA;AACjG,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAE5D,MAAM,CAAC,KAAK,UAAU,6BAA6B,CAIjD,MAA4C;IAC1C,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAA;IAC/B,IAAI,CAAC,QAAQ;QACT,MAAM,IAAI,oBAAoB,CAAC;YAC3B,QAAQ,EAAE,sCAAsC;SACnD,CAAC,CAAA;IAEN,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAiB,CAAA;IAEtD,IAAI,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,SAAS,CACzB,MAAM,EACN,YAAY,EACZ,cAAc,CACjB,CAAC;YACE,GAAG,EAAE,kBAAkB;YACvB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,YAAY,EAAE,cAAc;YAC5B,IAAI,EAAE,EAAE;SACX,CAAC,CAAA;QACF,OAAO,KAAK,CAAA;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,CAAA;IACZ,CAAC;AACL,CAAC"}
|
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { encodeFunctionData, getAction } from "viem/utils";
|
|
1
|
+
import { sendUserOperation } from "viem/account-abstraction";
|
|
2
|
+
import { encodeFunctionData, getAction, parseAccount } from "viem/utils";
|
|
4
3
|
import { KernelV3AccountAbi } from "../../accounts/kernel/abi/kernel_v_3_0_0/KernelAccountAbi.js";
|
|
4
|
+
import { AccountNotFoundError } from "../../errors/index.js";
|
|
5
5
|
export async function invalidateNonce(client, args) {
|
|
6
|
-
const { account: account_ = client.account,
|
|
6
|
+
const { account: account_ = client.account, nonceToSet } = args;
|
|
7
7
|
if (!account_)
|
|
8
|
-
throw new
|
|
8
|
+
throw new AccountNotFoundError({
|
|
9
|
+
docsPath: "/docs/actions/wallet/sendTransaction"
|
|
10
|
+
});
|
|
9
11
|
const account = parseAccount(account_);
|
|
10
|
-
return await getAction(client,
|
|
12
|
+
return await getAction(client, sendUserOperation, "sendUserOperation")({
|
|
11
13
|
...args,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
calls: [
|
|
15
|
+
{
|
|
16
|
+
to: account.address,
|
|
17
|
+
data: encodeFunctionData({
|
|
18
|
+
abi: KernelV3AccountAbi,
|
|
19
|
+
functionName: "invalidateNonce",
|
|
20
|
+
args: [nonceToSet]
|
|
21
|
+
}),
|
|
22
|
+
value: 0n
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
account
|
|
21
26
|
});
|
|
22
27
|
}
|
|
23
28
|
//# sourceMappingURL=invalidateNonce.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalidateNonce.js","sourceRoot":"","sources":["../../../actions/account-client/invalidateNonce.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invalidateNonce.js","sourceRoot":"","sources":["../../../actions/account-client/invalidateNonce.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,iBAAiB,EACpB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8DAA8D,CAAA;AACjG,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAY5D,MAAM,CAAC,KAAK,UAAU,eAAe,CAMjC,MAAyC,EACzC,IAA0E;IAE1E,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI,CAAA;IAC/D,IAAI,CAAC,QAAQ;QACT,MAAM,IAAI,oBAAoB,CAAC;YAC3B,QAAQ,EAAE,sCAAsC;SACnD,CAAC,CAAA;IAEN,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAiB,CAAA;IAEtD,OAAO,MAAM,SAAS,CAClB,MAAM,EACN,iBAAiB,EACjB,mBAAmB,CACtB,CAAC;QACE,GAAG,IAAI;QACP,KAAK,EAAE;YACH;gBACI,EAAE,EAAE,OAAO,CAAC,OAAO;gBACnB,IAAI,EAAE,kBAAkB,CAAC;oBACrB,GAAG,EAAE,kBAAkB;oBACvB,YAAY,EAAE,iBAAiB;oBAC/B,IAAI,EAAE,CAAC,UAAU,CAAC;iBACrB,CAAC;gBACF,KAAK,EAAE,EAAE;aACZ;SACJ;QACD,OAAO;KACqB,CAAC,CAAA;AACrC,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Copied from: https://github.com/pimlicolabs/permissionless.js/blob/main/packages/permissionless/actions/smartAccount/sendTransaction.ts
|
|
2
|
+
import { sendUserOperation, waitForUserOperationReceipt } from "viem/account-abstraction";
|
|
3
|
+
import { getAction, parseAccount } from "viem/utils";
|
|
4
|
+
import { AccountNotFoundError } from "../../errors";
|
|
5
|
+
/**
|
|
6
|
+
* Creates, signs, and sends a new transaction to the network.
|
|
7
|
+
* This function also allows you to sponsor this transaction if sender is a smartAccount
|
|
8
|
+
*
|
|
9
|
+
* - Docs: https://viem.sh/docs/actions/wallet/sendTransaction.html
|
|
10
|
+
* - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions
|
|
11
|
+
* - JSON-RPC Methods:
|
|
12
|
+
* - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
|
|
13
|
+
* - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
|
|
14
|
+
*
|
|
15
|
+
* @param client - Client to use
|
|
16
|
+
* @param parameters - {@link SendTransactionParameters}
|
|
17
|
+
* @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* import { createWalletClient, custom } from 'viem'
|
|
21
|
+
* import { mainnet } from 'viem/chains'
|
|
22
|
+
* import { sendTransaction } from 'viem/wallet'
|
|
23
|
+
*
|
|
24
|
+
* const client = createWalletClient({
|
|
25
|
+
* chain: mainnet,
|
|
26
|
+
* transport: custom(window.ethereum),
|
|
27
|
+
* })
|
|
28
|
+
* const hash = await sendTransaction(client, {
|
|
29
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
|
30
|
+
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
|
31
|
+
* value: 1000000000000000000n,
|
|
32
|
+
* })
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Account Hoisting
|
|
36
|
+
* import { createWalletClient, http } from 'viem'
|
|
37
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
38
|
+
* import { mainnet } from 'viem/chains'
|
|
39
|
+
* import { sendTransaction } from 'viem/wallet'
|
|
40
|
+
*
|
|
41
|
+
* const client = createWalletClient({
|
|
42
|
+
* account: privateKeyToAccount('0x…'),
|
|
43
|
+
* chain: mainnet,
|
|
44
|
+
* transport: http(),
|
|
45
|
+
* })
|
|
46
|
+
* const hash = await sendTransaction(client, {
|
|
47
|
+
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
|
48
|
+
* value: 1000000000000000000n,
|
|
49
|
+
* })
|
|
50
|
+
*/
|
|
51
|
+
export async function sendTransaction(client, args) {
|
|
52
|
+
let userOpHash;
|
|
53
|
+
if ("to" in args) {
|
|
54
|
+
const { account: account_ = client.account, data, maxFeePerGas, maxPriorityFeePerGas, to, value, nonce } = args;
|
|
55
|
+
if (!account_) {
|
|
56
|
+
throw new AccountNotFoundError({
|
|
57
|
+
docsPath: "/docs/actions/wallet/sendTransaction"
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const account = parseAccount(account_);
|
|
61
|
+
if (!to)
|
|
62
|
+
throw new Error("Missing to address");
|
|
63
|
+
userOpHash = await getAction(client, sendUserOperation, "sendUserOperation")({
|
|
64
|
+
calls: [
|
|
65
|
+
{
|
|
66
|
+
to,
|
|
67
|
+
value: value || BigInt(0),
|
|
68
|
+
data: data || "0x"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
account,
|
|
72
|
+
maxFeePerGas,
|
|
73
|
+
maxPriorityFeePerGas,
|
|
74
|
+
nonce: nonce ? BigInt(nonce) : undefined
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
userOpHash = await getAction(client, sendUserOperation, "sendUserOperation")({ ...args });
|
|
79
|
+
}
|
|
80
|
+
const userOperationReceipt = await getAction(client, waitForUserOperationReceipt, "waitForUserOperationReceipt")({
|
|
81
|
+
hash: userOpHash
|
|
82
|
+
});
|
|
83
|
+
return userOperationReceipt?.receipt.transactionHash;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=sendTransaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendTransaction.js","sourceRoot":"","sources":["../../../actions/account-client/sendTransaction.ts"],"names":[],"mappings":"AAAA,0IAA0I;AAS1I,OAAO,EAGH,iBAAiB,EACjB,2BAA2B,EAC9B,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAOjC,MAAyC,EACzC,IAEkE;IAElE,IAAI,UAAgB,CAAA;IAEpB,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACf,MAAM,EACF,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAClC,IAAI,EACJ,YAAY,EACZ,oBAAoB,EACpB,EAAE,EACF,KAAK,EACL,KAAK,EACR,GAAG,IAAI,CAAA;QAER,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,MAAM,IAAI,oBAAoB,CAAC;gBAC3B,QAAQ,EAAE,sCAAsC;aACnD,CAAC,CAAA;QACN,CAAC;QAED,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAiB,CAAA;QAEtD,IAAI,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAA;QAE9C,UAAU,GAAG,MAAM,SAAS,CACxB,MAAM,EACN,iBAAiB,EACjB,mBAAmB,CACtB,CAAC;YACE,KAAK,EAAE;gBACH;oBACI,EAAE;oBACF,KAAK,EAAE,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC;oBACzB,IAAI,EAAE,IAAI,IAAI,IAAI;iBACrB;aACJ;YACD,OAAO;YACP,YAAY;YACZ,oBAAoB;YACpB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;SAC3C,CAAC,CAAA;IACN,CAAC;SAAM,CAAC;QACJ,UAAU,GAAG,MAAM,SAAS,CACxB,MAAM,EACN,iBAAiB,EACjB,mBAAmB,CACtB,CAAC,EAAE,GAAG,IAAI,EAA2D,CAAC,CAAA;IAC3E,CAAC;IAED,MAAM,oBAAoB,GAAG,MAAM,SAAS,CACxC,MAAM,EACN,2BAA2B,EAC3B,6BAA6B,CAChC,CAAC;QACE,IAAI,EAAE,UAAU;KACnB,CAAC,CAAA;IAEF,OAAO,oBAAoB,EAAE,OAAO,CAAC,eAAe,CAAA;AACxD,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Copied from: https://github.com/pimlicolabs/permissionless.js/blob/main/packages/permissionless/actions/smartAccount/signMessage.ts
|
|
2
|
+
import { parseAccount } from "viem/utils";
|
|
3
|
+
import { AccountNotFoundError } from "../../errors";
|
|
4
|
+
/**
|
|
5
|
+
* Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
|
|
6
|
+
*
|
|
7
|
+
* - Docs: https://viem.sh/docs/actions/wallet/signMessage.html
|
|
8
|
+
* - JSON-RPC Methods:
|
|
9
|
+
* - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data.html#personal-sign)
|
|
10
|
+
* - Local Accounts: Signs locally. No JSON-RPC request.
|
|
11
|
+
*
|
|
12
|
+
* With the calculated signature, you can:
|
|
13
|
+
* - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage.html) to verify the signature,
|
|
14
|
+
* - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress.html) to recover the signing address from a signature.
|
|
15
|
+
*
|
|
16
|
+
* @param client - Client to use
|
|
17
|
+
* @param parameters - {@link SignMessageParameters}
|
|
18
|
+
* @returns The signed message. {@link SignMessageReturnType}
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* import { createWalletClient, custom } from 'viem'
|
|
22
|
+
* import { mainnet } from 'viem/chains'
|
|
23
|
+
* import { signMessage } from 'viem/wallet'
|
|
24
|
+
*
|
|
25
|
+
* const client = createWalletClient({
|
|
26
|
+
* chain: mainnet,
|
|
27
|
+
* transport: custom(window.ethereum),
|
|
28
|
+
* })
|
|
29
|
+
* const signature = await signMessage(client, {
|
|
30
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
|
31
|
+
* message: 'hello world',
|
|
32
|
+
* })
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Account Hoisting
|
|
36
|
+
* import { createWalletClient, custom } from 'viem'
|
|
37
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
38
|
+
* import { mainnet } from 'viem/chains'
|
|
39
|
+
* import { signMessage } from 'viem/wallet'
|
|
40
|
+
*
|
|
41
|
+
* const client = createWalletClient({
|
|
42
|
+
* account: privateKeyToAccount('0x…'),
|
|
43
|
+
* chain: mainnet,
|
|
44
|
+
* transport: custom(window.ethereum),
|
|
45
|
+
* })
|
|
46
|
+
* const signature = await signMessage(client, {
|
|
47
|
+
* message: 'hello world',
|
|
48
|
+
* })
|
|
49
|
+
*/
|
|
50
|
+
export async function signMessage(client, { account: account_ = client.account, message }) {
|
|
51
|
+
if (!account_)
|
|
52
|
+
throw new AccountNotFoundError({
|
|
53
|
+
docsPath: "/docs/actions/wallet/signMessage"
|
|
54
|
+
});
|
|
55
|
+
const account = parseAccount(account_);
|
|
56
|
+
return account.signMessage({ message });
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=signMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signMessage.js","sourceRoot":"","sources":["../../../actions/account-client/signMessage.ts"],"names":[],"mappings":"AAAA,sIAAsI;AAUtI,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC7B,MAAsD,EACtD,EACI,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAClC,OAAO,EACuB;IAElC,IAAI,CAAC,QAAQ;QACT,MAAM,IAAI,oBAAoB,CAAC;YAC3B,QAAQ,EAAE,kCAAkC;SAC/C,CAAC,CAAA;IAEN,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAiB,CAAA;IAEtD,OAAO,OAAO,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA;AAC3C,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Copied from: https://github.com/pimlicolabs/permissionless.js/blob/main/packages/permissionless/actions/smartAccount/signTypedData.ts
|
|
2
|
+
import { getTypesForEIP712Domain, validateTypedData } from "viem";
|
|
3
|
+
import { parseAccount } from "viem/utils";
|
|
4
|
+
import { AccountNotFoundError } from "../../errors";
|
|
5
|
+
/**
|
|
6
|
+
* Signs typed data and calculates an Ethereum-specific signature in [https://eips.ethereum.org/EIPS/eip-712](https://eips.ethereum.org/EIPS/eip-712): `sign(keccak256("\x19\x01" ‖ domainSeparator ‖ hashStruct(message)))`
|
|
7
|
+
*
|
|
8
|
+
* - Docs: https://viem.sh/docs/actions/wallet/signTypedData.html
|
|
9
|
+
* - JSON-RPC Methods:
|
|
10
|
+
* - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data.html#signtypeddata-v4)
|
|
11
|
+
* - Local Accounts: Signs locally. No JSON-RPC request.
|
|
12
|
+
*
|
|
13
|
+
* @param client - Client to use
|
|
14
|
+
* @param parameters - {@link SignTypedDataParameters}
|
|
15
|
+
* @returns The signed data. {@link SignTypedDataReturnType}
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* import { createWalletClient, custom } from 'viem'
|
|
19
|
+
* import { mainnet } from 'viem/chains'
|
|
20
|
+
* import { signTypedData } from 'viem/wallet'
|
|
21
|
+
*
|
|
22
|
+
* const client = createWalletClient({
|
|
23
|
+
* chain: mainnet,
|
|
24
|
+
* transport: custom(window.ethereum),
|
|
25
|
+
* })
|
|
26
|
+
* const signature = await signTypedData(client, {
|
|
27
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
|
28
|
+
* domain: {
|
|
29
|
+
* name: 'Ether Mail',
|
|
30
|
+
* version: '1',
|
|
31
|
+
* chainId: 1,
|
|
32
|
+
* verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
|
|
33
|
+
* },
|
|
34
|
+
* types: {
|
|
35
|
+
* Person: [
|
|
36
|
+
* { name: 'name', type: 'string' },
|
|
37
|
+
* { name: 'wallet', type: 'address' },
|
|
38
|
+
* ],
|
|
39
|
+
* Mail: [
|
|
40
|
+
* { name: 'from', type: 'Person' },
|
|
41
|
+
* { name: 'to', type: 'Person' },
|
|
42
|
+
* { name: 'contents', type: 'string' },
|
|
43
|
+
* ],
|
|
44
|
+
* },
|
|
45
|
+
* primaryType: 'Mail',
|
|
46
|
+
* message: {
|
|
47
|
+
* from: {
|
|
48
|
+
* name: 'Cow',
|
|
49
|
+
* wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
|
|
50
|
+
* },
|
|
51
|
+
* to: {
|
|
52
|
+
* name: 'Bob',
|
|
53
|
+
* wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
|
|
54
|
+
* },
|
|
55
|
+
* contents: 'Hello, Bob!',
|
|
56
|
+
* },
|
|
57
|
+
* })
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* // Account Hoisting
|
|
61
|
+
* import { createWalletClient, http } from 'viem'
|
|
62
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
63
|
+
* import { mainnet } from 'viem/chains'
|
|
64
|
+
* import { signTypedData } from 'viem/wallet'
|
|
65
|
+
*
|
|
66
|
+
* const client = createWalletClient({
|
|
67
|
+
* account: privateKeyToAccount('0x…'),
|
|
68
|
+
* chain: mainnet,
|
|
69
|
+
* transport: http(),
|
|
70
|
+
* })
|
|
71
|
+
* const signature = await signTypedData(client, {
|
|
72
|
+
* domain: {
|
|
73
|
+
* name: 'Ether Mail',
|
|
74
|
+
* version: '1',
|
|
75
|
+
* chainId: 1,
|
|
76
|
+
* verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
|
|
77
|
+
* },
|
|
78
|
+
* types: {
|
|
79
|
+
* Person: [
|
|
80
|
+
* { name: 'name', type: 'string' },
|
|
81
|
+
* { name: 'wallet', type: 'address' },
|
|
82
|
+
* ],
|
|
83
|
+
* Mail: [
|
|
84
|
+
* { name: 'from', type: 'Person' },
|
|
85
|
+
* { name: 'to', type: 'Person' },
|
|
86
|
+
* { name: 'contents', type: 'string' },
|
|
87
|
+
* ],
|
|
88
|
+
* },
|
|
89
|
+
* primaryType: 'Mail',
|
|
90
|
+
* message: {
|
|
91
|
+
* from: {
|
|
92
|
+
* name: 'Cow',
|
|
93
|
+
* wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
|
|
94
|
+
* },
|
|
95
|
+
* to: {
|
|
96
|
+
* name: 'Bob',
|
|
97
|
+
* wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
|
|
98
|
+
* },
|
|
99
|
+
* contents: 'Hello, Bob!',
|
|
100
|
+
* },
|
|
101
|
+
* })
|
|
102
|
+
*/
|
|
103
|
+
export async function signTypedData(client, { account: account_ = client.account, domain, message, primaryType, types: types_ }) {
|
|
104
|
+
if (!account_) {
|
|
105
|
+
throw new AccountNotFoundError({
|
|
106
|
+
docsPath: "/docs/actions/wallet/signMessage"
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const account = parseAccount(account_);
|
|
110
|
+
const types = {
|
|
111
|
+
EIP712Domain: getTypesForEIP712Domain({ domain }),
|
|
112
|
+
...types_
|
|
113
|
+
};
|
|
114
|
+
validateTypedData({
|
|
115
|
+
domain,
|
|
116
|
+
message,
|
|
117
|
+
primaryType,
|
|
118
|
+
types
|
|
119
|
+
});
|
|
120
|
+
return account.signTypedData({
|
|
121
|
+
domain,
|
|
122
|
+
primaryType,
|
|
123
|
+
types,
|
|
124
|
+
message
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=signTypedData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../actions/account-client/signTypedData.ts"],"names":[],"mappings":"AAAA,wIAAwI;AAExI,OAAO,EASH,uBAAuB,EACvB,iBAAiB,EACpB,MAAM,MAAM,CAAA;AAEb,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAK/B,MAAsD,EACtD,EACI,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAClC,MAAM,EACN,OAAO,EACP,WAAW,EACX,KAAK,EAAE,MAAM,EAC6C;IAE9D,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,MAAM,IAAI,oBAAoB,CAAC;YAC3B,QAAQ,EAAE,kCAAkC;SAC/C,CAAC,CAAA;IACN,CAAC;IAED,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAiB,CAAA;IAEtD,MAAM,KAAK,GAAG;QACV,YAAY,EAAE,uBAAuB,CAAC,EAAE,MAAM,EAE7C,CAAC;QACF,GAAI,MAAqB;KAC5B,CAAA;IAED,iBAAiB,CAAC;QACd,MAAM;QACN,OAAO;QACP,WAAW;QACX,KAAK;KACe,CAAC,CAAA;IAEzB,OAAO,OAAO,CAAC,aAAa,CAAC;QACzB,MAAM;QACN,WAAW;QACX,KAAK;QACL,OAAO;KACa,CAAC,CAAA;AAC7B,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { prepareUserOperation } from "viem/account-abstraction";
|
|
2
|
+
import { getAction, parseAccount } from "viem/utils";
|
|
3
|
+
import { AccountNotFoundError } from "../../errors";
|
|
4
4
|
export async function signUserOperation(client, args) {
|
|
5
5
|
const { account: account_ = client.account } = args;
|
|
6
6
|
if (!account_)
|
|
7
|
-
throw new
|
|
7
|
+
throw new AccountNotFoundError({
|
|
8
|
+
docsPath: "/docs/actions/wallet/sendTransaction"
|
|
9
|
+
});
|
|
8
10
|
const account = parseAccount(account_);
|
|
9
|
-
const userOperation = await getAction(client,
|
|
11
|
+
const userOperation = await getAction(client, prepareUserOperation, "prepareUserOperation")({ ...args, account });
|
|
10
12
|
userOperation.signature = await account.signUserOperation(userOperation);
|
|
11
13
|
return userOperation;
|
|
12
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signUserOperation.js","sourceRoot":"","sources":["../../../actions/account-client/signUserOperation.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"signUserOperation.js","sourceRoot":"","sources":["../../../actions/account-client/signUserOperation.ts"],"names":[],"mappings":"AACA,OAAO,EAKH,oBAAoB,EACvB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAUnD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAMnC,MAAyC,EACzC,IAAkE;IAElE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAA;IACnD,IAAI,CAAC,QAAQ;QACT,MAAM,IAAI,oBAAoB,CAAC;YAC3B,QAAQ,EAAE,sCAAsC;SACnD,CAAC,CAAA;IAEN,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAiB,CAAA;IAEtD,MAAM,aAAa,GAAG,MAAM,SAAS,CACjC,MAAM,EACN,oBAAoB,EACpB,sBAAsB,CACzB,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAoC,CAAC,CAAA;IAEzD,aAAa,CAAC,SAAS,GAAG,MAAM,OAAO,CAAC,iBAAiB,CACrD,aAA8B,CACjC,CAAA;IAED,OAAO,aAAa,CAAA;AACxB,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { concatHex, encodeFunctionData, getAction, pad } from "viem/utils";
|
|
1
|
+
import { sendUserOperation } from "viem/account-abstraction";
|
|
2
|
+
import { concatHex, encodeFunctionData, getAction, pad, parseAccount } from "viem/utils";
|
|
4
3
|
import { KernelV3AccountAbi } from "../../accounts/kernel/abi/kernel_v_3_0_0/KernelAccountAbi.js";
|
|
5
4
|
import { VALIDATOR_TYPE } from "../../constants.js";
|
|
5
|
+
import { AccountNotFoundError } from "../../errors/index.js";
|
|
6
6
|
export async function uninstallPlugin(client, args) {
|
|
7
|
-
const { account: account_ = client.account,
|
|
7
|
+
const { account: account_ = client.account, plugin, hook } = args;
|
|
8
8
|
if (!account_)
|
|
9
|
-
throw new
|
|
9
|
+
throw new AccountNotFoundError({
|
|
10
|
+
docsPath: "/docs/actions/wallet/sendTransaction"
|
|
11
|
+
});
|
|
10
12
|
const account = parseAccount(account_);
|
|
11
13
|
let validatorId;
|
|
12
14
|
if ([VALIDATOR_TYPE.PERMISSION, VALIDATOR_TYPE.SECONDARY].includes(VALIDATOR_TYPE[plugin.validatorType])) {
|
|
@@ -23,9 +25,9 @@ export async function uninstallPlugin(client, args) {
|
|
|
23
25
|
}
|
|
24
26
|
const validatorData = await plugin.getEnableData(account.address);
|
|
25
27
|
const hookData = (await hook?.getEnableData(account.address)) ?? "0x";
|
|
26
|
-
return await getAction(client,
|
|
28
|
+
return await getAction(client, sendUserOperation, "sendUserOperation")({
|
|
27
29
|
...args,
|
|
28
|
-
|
|
30
|
+
calls: [
|
|
29
31
|
{
|
|
30
32
|
to: account.address,
|
|
31
33
|
data: encodeFunctionData({
|
|
@@ -36,8 +38,7 @@ export async function uninstallPlugin(client, args) {
|
|
|
36
38
|
value: 0n
|
|
37
39
|
}
|
|
38
40
|
],
|
|
39
|
-
account
|
|
40
|
-
middleware
|
|
41
|
+
account
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
//# sourceMappingURL=uninstallPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uninstallPlugin.js","sourceRoot":"","sources":["../../../actions/account-client/uninstallPlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"uninstallPlugin.js","sourceRoot":"","sources":["../../../actions/account-client/uninstallPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,iBAAiB,EACpB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,SAAS,EACT,kBAAkB,EAClB,SAAS,EACT,GAAG,EACH,YAAY,EACf,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,8DAA8D,CAAA;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAe5D,MAAM,CAAC,KAAK,UAAU,eAAe,CAMjC,MAAyC,EACzC,IAAgE;IAEhE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;IACjE,IAAI,CAAC,QAAQ;QACT,MAAM,IAAI,oBAAoB,CAAC;YAC3B,QAAQ,EAAE,sCAAsC;SACnD,CAAC,CAAA;IAEN,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAiB,CAAA;IAEtD,IAAI,WAAgB,CAAA;IACpB,IACI,CAAC,cAAc,CAAC,UAAU,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC,QAAQ,CAC1D,cAAc,CAAC,MAAM,CAAC,aAAa,CAAC,CACvC,EACH,CAAC;QACC,WAAW,GAAG,SAAS,CAAC;YACpB,cAAc,CAAC,MAAM,CAAC,aAAa,CAAC;YACpC,GAAG,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE;gBACxB,IAAI,EAAE,EAAE;gBACR,GAAG,EAAE,OAAO;aACf,CAAC;SACL,CAAC,CAAA;IACN,CAAC;SAAM,CAAC;QACJ,MAAM,IAAI,KAAK,CAAC,oBAAoB,MAAM,CAAC,aAAa,SAAS,CAAC,CAAA;IACtE,CAAC;IAED,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAEjE,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,IAAI,CAAA;IACrE,OAAO,MAAM,SAAS,CAClB,MAAM,EACN,iBAAiB,EACjB,mBAAmB,CACtB,CAAC;QACE,GAAG,IAAI;QACP,KAAK,EAAE;YACH;gBACI,EAAE,EAAE,OAAO,CAAC,OAAO;gBACnB,IAAI,EAAE,kBAAkB,CAAC;oBACrB,GAAG,EAAE,kBAAkB;oBACvB,YAAY,EAAE,qBAAqB;oBACnC,IAAI,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,QAAQ,CAAC;iBAC/C,CAAC;gBACF,KAAK,EAAE,EAAE;aACZ;SACJ;QACD,OAAO;KACqB,CAAC,CAAA;AACrC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copied from: https://github.com/pimlicolabs/permissionless.js/blob/main/packages/permissionless/actions/smartAccount/writeContract.ts
|
|
2
|
+
import { encodeFunctionData } from "viem";
|
|
3
|
+
import { getAction } from "viem/utils";
|
|
4
|
+
import { sendTransaction } from "./sendTransaction.js";
|
|
5
|
+
export async function writeContract(client, { abi, address, args, dataSuffix, functionName, ...request }) {
|
|
6
|
+
const data = encodeFunctionData({
|
|
7
|
+
abi,
|
|
8
|
+
args,
|
|
9
|
+
functionName
|
|
10
|
+
});
|
|
11
|
+
const hash = await getAction(client, (sendTransaction), "sendTransaction")({
|
|
12
|
+
data: `${data}${dataSuffix ? dataSuffix.replace("0x", "") : ""}`,
|
|
13
|
+
to: address,
|
|
14
|
+
...request
|
|
15
|
+
});
|
|
16
|
+
return hash;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=writeContract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeContract.js","sourceRoot":"","sources":["../../../actions/account-client/writeContract.ts"],"names":[],"mappings":"AAAA,wIAAwI;AAExI,OAAO,EAWH,kBAAkB,EACrB,MAAM,MAAM,CAAA;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,MAAM,CAAC,KAAK,UAAU,aAAa,CAe/B,MAA2C,EAC3C,EACI,GAAG,EACH,OAAO,EACP,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,GAAG,OAAO,EAQb;IAED,MAAM,IAAI,GAAG,kBAAkB,CAAsB;QACjD,GAAG;QACH,IAAI;QACJ,YAAY;KACsC,CAAC,CAAA;IAEvD,MAAM,IAAI,GAAG,MAAM,SAAS,CACxB,MAAM,EACN,CAAA,eAA+C,CAAA,EAC/C,iBAAiB,CACpB,CAAC;QACE,IAAI,EAAE,GAAG,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE;QAChE,EAAE,EAAE,OAAO;QACX,GAAG,OAAO;KAKb,CAAC,CAAA;IACF,OAAO,IAAI,CAAA;AACf,CAAC"}
|
package/_esm/actions/index.js
CHANGED
|
@@ -2,7 +2,12 @@ export { sponsorUserOperation } from "./paymaster/sponsorUserOperation.js";
|
|
|
2
2
|
export { signUserOperation } from "./account-client/signUserOperation.js";
|
|
3
3
|
export { getUserOperationGasPrice } from "./account-client/getUserOperationGasPrice.js";
|
|
4
4
|
export { uninstallPlugin } from "./account-client/uninstallPlugin.js";
|
|
5
|
+
export { getKernelV3ModuleCurrentNonce } from "./account-client/getKernelV3ModuleCurrentNonce.js";
|
|
6
|
+
export { invalidateNonce } from "./account-client/invalidateNonce.js";
|
|
7
|
+
export { sendTransaction } from "./account-client/sendTransaction.js";
|
|
8
|
+
export { signMessage } from "./account-client/signMessage.js";
|
|
9
|
+
export { signTypedData } from "./account-client/signTypedData.js";
|
|
10
|
+
export { writeContract } from "./account-client/writeContract.js";
|
|
5
11
|
export { changeSudoValidator } from "./account-client/changeSudoValidator.js";
|
|
6
12
|
export { estimateGasInERC20 } from "./paymaster/estimateGasInERC20.js";
|
|
7
|
-
export { sponsorUserOperationEip7677 } from "./paymaster/sponsorUserOperationEip7677.js";
|
|
8
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EAGvB,MAAM,qCAAqC,CAAA;AAE5C,OAAO,EACH,iBAAiB,EAGpB,MAAM,uCAAuC,CAAA;AAE9C,OAAO,EACH,wBAAwB,EAE3B,MAAM,8CAA8C,CAAA;AAErD,OAAO,EACH,eAAe,EAElB,MAAM,qCAAqC,CAAA;AAE5C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EAGvB,MAAM,qCAAqC,CAAA;AAE5C,OAAO,EACH,iBAAiB,EAGpB,MAAM,uCAAuC,CAAA;AAE9C,OAAO,EACH,wBAAwB,EAE3B,MAAM,8CAA8C,CAAA;AAErD,OAAO,EACH,eAAe,EAElB,MAAM,qCAAqC,CAAA;AAE5C,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAA;AAEjG,OAAO,EAEH,eAAe,EAClB,MAAM,qCAAqC,CAAA;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAEjE,OAAO,EACH,mBAAmB,EAEtB,MAAM,yCAAyC,CAAA;AAEhD,OAAO,EACH,kBAAkB,EAGrB,MAAM,mCAAmC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { deepHexlify } from "
|
|
1
|
+
import { entryPoint06Address } from "viem/account-abstraction";
|
|
2
|
+
import { deepHexlify } from "../../utils.js";
|
|
3
3
|
/**
|
|
4
4
|
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
5
5
|
*/
|
|
@@ -14,7 +14,7 @@ export const estimateGasInERC20 = async (client, args) => {
|
|
|
14
14
|
initCode: args.userOperation.initCode || "0x"
|
|
15
15
|
},
|
|
16
16
|
tokenAddress: args.gasTokenAddress,
|
|
17
|
-
entryPointAddress: args.entryPoint ??
|
|
17
|
+
entryPointAddress: args.entryPoint ?? entryPoint06Address
|
|
18
18
|
}
|
|
19
19
|
]
|
|
20
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateGasInERC20.js","sourceRoot":"","sources":["../../../actions/paymaster/estimateGasInERC20.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"estimateGasInERC20.js","sourceRoot":"","sources":["../../../actions/paymaster/estimateGasInERC20.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,mBAAmB,EACtB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAiB5C;;GAEG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAGnC,MAAiD,EACjD,IAAkC,EACG,EAAE;IACvC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAClC,MAAM,EAAE,6BAA6B;QACrC,MAAM,EAAE;YACJ;gBACI,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,EAAY;gBACnC,MAAM,EAAE;oBACJ,GAAG,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC;oBAClC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,IAAI,IAAI;iBAChD;gBACD,YAAY,EAAE,IAAI,CAAC,eAAe;gBAClC,iBAAiB,EAAE,IAAI,CAAC,UAAU,IAAI,mBAAmB;aAC5D;SACJ;KACJ,CAAC,CAAA;IAEF,MAAM,MAAM,GAAkC;QAC1C,eAAe,EAAE,QAAQ,CAAC,eAAe;QACzC,aAAa,EAAE,QAAQ,CAAC,aAAa;KACxC,CAAA;IAED,MAAM,MAAM,GACR,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;IAEvE,OAAO,EAAE,MAAM,EAAE,CAAA;AACrB,CAAC,CAAA"}
|