Skip to content

Instantly share code, notes, and snippets.

@0xBigBoss
Created December 29, 2023 20:29
Show Gist options
  • Save 0xBigBoss/1e96ab9cedf066fc2fa2477be2e0df37 to your computer and use it in GitHub Desktop.
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
// 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