Created
August 7, 2025 16:38
-
-
Save Turupawn/eb39161a20e090283b5280ff7bb5e3ef to your computer and use it in GitHub Desktop.
Revisions
-
Turupawn created this gist
Aug 7, 2025 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,51 @@ import 'dotenv/config' import { createPublicClient, http } from 'viem' import { scrollSepolia } from 'viem/chains' import { toSimpleSmartAccount } from 'permissionless/accounts' import { createSmartAccountClient } from 'permissionless' import { createPimlicoClient } from 'permissionless/clients/pimlico' import { privateKeyToAccount } from 'viem/accounts' async function main() { const apiKey = process.env.PIMLICO_API_KEY! const privateKey: `0x${string}` = process.env.PRIVATE_KEY! as `0x${string}` const publicClient = createPublicClient({ chain: scrollSepolia, transport: http('https://sepolia-rpc.scroll.io') }) const pimlicoUrl = `https://api.pimlico.io/v2/${scrollSepolia.id}/rpc?apikey=${apiKey}` const pimlicoClient = createPimlicoClient({ chain: scrollSepolia, transport: http(pimlicoUrl) }) const account = await toSimpleSmartAccount({ client: publicClient, owner: privateKeyToAccount(privateKey) }) console.log(`Smart account address: ${account.address}`) const smartAccountClient = createSmartAccountClient({ account, chain: scrollSepolia, bundlerTransport: http(pimlicoUrl), paymaster: pimlicoClient, userOperation: { estimateFeesPerGas: async () => (await pimlicoClient.getUserOperationGasPrice()).fast } }) const txHash = await smartAccountClient.sendTransaction({ to: '0xb6f5414bab8d5ad8f33e37591c02f7284e974fcb', value: 0n, data: '0x' }) console.log(`Transaction included: ${txHash}`) /* */ } main().catch(console.error)