Created
December 29, 2023 20:29
-
-
Save 0xBigBoss/1e96ab9cedf066fc2fa2477be2e0df37 to your computer and use it in GitHub Desktop.
ERC-4337 Account abstraction sponsor a transactions by setting the deposit on the Entry Point
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sponsor the creation by setting the deposit on the Entry Point | |
const { request: depositRequest } = await baseMainnetClient.simulateContract({ | |
address: entrypoint.address, | |
functionName: 'depositTo', | |
abi: iEntryPointABI, | |
args: [senderAddress], | |
account: dummyAccount, | |
value: parseEther('0.5'), | |
}) | |
const depositHash = await walletClient.writeContract(depositRequest) | |
const depositReceipt = await baseMainnetClient.waitForTransactionReceipt({ hash: depositHash }) | |
if (depositReceipt.status !== 'success') { | |
throw new Error('Failed to deposit') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment