### Clone and Install Tutorial Template Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/tutorials/tutorial-2.mdx Clone the Pimlico tutorial template repository and install its dependencies to get started. ```bash git clone https://github.com/pimlicolabs/tutorial-template.git pimlico-tutorial-2 cd pimlico-tutorial-2 npm install ``` -------------------------------- ### Start Alto Bundler Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/bundler/self-host.mdx Initiate the Alto bundler after installation by running the help command. ```bash ./alto help ``` -------------------------------- ### Install and Run Pimlico CLI Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/create-api-key.mdx Use this command to interactively set up Pimlico, generate an API key, and add it to your .env file. This is the recommended method for quick setup. ```bash pnpm dlx @pimlico/cli@latest ``` -------------------------------- ### Install Dependencies Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/eip7702/demo.mdx Install the necessary libraries for permissionless smart account interactions. ```bash npm install permissionless viem ``` ```bash yarn add permissionless ``` ```bash pnpm install permissionless viem ``` ```bash bun install permissionless viem ``` -------------------------------- ### Install required packages Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/signers/passkey.mdx Install the necessary packages for Viem and Permissionless. ```bash npm install viem permissionless ``` -------------------------------- ### Install @permissionless/wagmi with bun Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/permissionless/wagmi/tutorial/tutorial-1.mdx Install the @permissionless/wagmi library using bun. ```bash bun install @permissionless/wagmi ``` -------------------------------- ### Install permissionless.js, viem, and MetaMask Delegation Toolkit Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/accounts/use-metamask-account.mdx Install the necessary packages using npm, yarn, pnpm, or bun. ```bash npm install permissionless viem @metamask/delegation-toolkit ``` ```bash yarn add permissionless viem @metamask/delegation-toolkit ``` ```bash pnpm install permissionless viem @metamask/delegation-toolkit ``` ```bash bun install permissionless viem @metamask/delegation-toolkit ``` -------------------------------- ### Install Dependencies Source: https://github.com/pimlicolabs/docs/blob/main/scrape/README.md Install the necessary Python packages listed in requirements.txt after activating the virtual environment. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install Required Packages Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/signers/passkey-server.mdx Install the necessary packages for Viem, Ox, and Permissionless using npm. ```bash npm install viem ox permissionless ``` -------------------------------- ### Clone Pimlico Tutorial Repository and Install Dependencies Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/tutorials/tutorial-1.mdx Clone the template repository and install npm dependencies to set up the project environment. ```bash git clone https://github.com/pimlicolabs/tutorial-template.git pimlico-tutorial-1 cd pimlico-tutorial-1 npm install ``` -------------------------------- ### Setup Smart Account Client Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/testing/build-bear.mdx Configure the smart account client using a specific chain ID and RPC URL for BuildBear. This setup uses a private key for signing. ```typescript import { create } from "@/index.js"; import { http, createWalletClient } from "viem"; const chainId = 172; const rpcUrl = "https://rpc.buildbear.io/"; const privateKey = "0xdf57089c2754787e4771d0000000000000000000000000000000000000000000"; const smartAccountClient = create({ chain: { id: chainId, name: "Buildbear", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: [rpcUrl] } } }, transport: http(rpcUrl), account: { address: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", signMessage: async ({ message }) => { const walletClient = createWalletClient({ account: privateKey as any, chain: { id: chainId, name: "Buildbear", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: [rpcUrl] } } }, transport: http(rpcUrl), }); return walletClient.signMessage({ message: message.message }); }, signTransaction: async ({ transaction }) => { const walletClient = createWalletClient({ account: privateKey as any, chain: { id: chainId, name: "Buildbear", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: [rpcUrl] } } }, transport: http(rpcUrl), }); return walletClient.signTransaction(transaction as any); }, signTypedData: async ({ domain, types, primaryType, message }) => { const walletClient = createWalletClient({ account: privateKey as any, chain: { id: chainId, name: "Buildbear", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: [rpcUrl] } } }, transport: http(rpcUrl), }); return walletClient.signTypedData({ domain, types, primaryType, message, }); }, getAddresses: async () => ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"], }, }); export { smartAccountClient }; ``` -------------------------------- ### Install Prool and Alto Packages Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/bundler/testing.mdx Install the Prool and Alto packages using npm. ```bash npm install @pimlico/alto prool ``` -------------------------------- ### Install permissionless.js with bun Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/permissionless/reference/index.mdx Use this command to install the library if you are using bun. ```bash bun install permissionless ``` -------------------------------- ### Permissionless: How To - Migration Guide Source: https://github.com/pimlicolabs/docs/blob/main/scrape/output/pimlico_urls.txt Guide for migrating to Pimlico's permissionless accounts. ```APIDOC ## Permissionless: How To - Migration Guide ### Description This document provides a step-by-step guide for migrating existing applications or users to Pimlico's permissionless smart account infrastructure. ``` -------------------------------- ### Install Required Packages Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/signers/lit-protocol.mdx Install necessary npm packages for Stytch, Lit Protocol PKP, Lit Auth Client, and related utilities. ```bash npm install stytch @lit-protocol/pkp-ethers @lit-protocol/lit-auth-client @lit-protocol/auth-helpers @lit-protocol/types @lit-protocol/lit-node-client-nodejs ``` -------------------------------- ### eth_sendUserOperation Request Example (EntryPoint 0.6) Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/bundler/endpoints/eth_sendUserOperation.mdx Example JSON-RPC request for sending a user operation using EntryPoint 0.6. Ensure all fields are correctly formatted as hex strings. ```json { "jsonrpc": "2.0", "method": "eth_sendUserOperation", "params": [ { "sender":"0xb341FEAFaF71b09089d03B7D114599f8F491EE45", "nonce":"0x0", "initCode":"0x5de4839a76cf55d0c90e2061ef4386d962E15ae3296601cd0000000000000000000000000da6a956b9488ed4dd761e59f52fdc6c8068e6b5...", "callData":"0x5194544700000000000000000000000000000000000000000000000000000000000000000000000000...", "callGasLimit":"0x115b5c0", "verificationGasLimit":"0x249f0", "preVerificationGas":"0xeb11", "maxPriorityFeePerGas":"0x12a05f200", "maxFeePerGas":"0x5b08082fa", "paymasterAndData":"0x", "signature":"0xa6cc6589c8bd561cfd68d7b6b0757ef6f208e7438782939938498eee7d703260137856c840c491b3d415956265e81bf5c2184a725be2abfc365f7536b6af525e1c" }, "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789" ], "id": 1 } ``` -------------------------------- ### Upgrade with permissionless Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/platform/api/upgrade.mdx These snippets demonstrate how to upgrade using permissionless methods. Ensure you have the necessary setup for these TypeScript examples. ```typescript // [!include ~/snippets/references/platform/api/upgrade/upgrade.ts] ``` ```typescript // [!include ~/snippets/references/platform/api/upgrade/createSmartAccountClient.ts] ``` -------------------------------- ### Sending UserOperation with ERC-20 Paymaster Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/testing/build-bear.mdx Example of sending a user operation using an ERC-20 paymaster. This snippet requires the `erc20Paymaster` setup. ```typescript // [!include ~/snippets/testing/build-bear.ts:erc20Paymaster] ``` -------------------------------- ### Sending UserOperation with Verifying Paymaster Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/testing/build-bear.mdx Example of sending a user operation using a verifying paymaster. This snippet requires the `verifyingPaymaster` setup. ```typescript // [!include ~/snippets/testing/build-bear.ts:verifyingPaymaster] ``` -------------------------------- ### Send User Operation with Pimlico SDK Source: https://github.com/pimlicolabs/docs/blob/main/scrape/output/pimlico_urls.txt Example of sending a user operation using the Pimlico SDK. Ensure you have the 'ethers' and '@pimlico/sdk' packages installed. ```typescript import { ethers } from "ethers"; import { PimlicoPaymasterClient } from "@pimlico/sdk"; const provider = new ethers.BrowserProvider(window.ethereum); const signer = await provider.getSigner(); const paymasterClient = new PimlicoPaymasterClient( "YOUR_PIMLICO_API_KEY", "YOUR_ENTRYPOINT_ADDRESS" ); const userOperation = { sender: await signer.getAddress(), // ... other user operation fields }; const paymasterAndData = await paymasterClient.sponsorOperation(userOperation); console.log("PaymasterAndData:", paymasterAndData); ``` -------------------------------- ### Setup Smart Account Client for BuildBear Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/permissionless/how-to/testing/build-bear.mdx Initialize a smart account client using the configured viem client for interacting with your BuildBear Sandbox. ```typescript import { createSmartAccountClient } from "permissionless" import { signerToEcdsaOwnershipManager } "permissionless/accounts" const smartAccountClient = createSmartAccountClient({ account: await signerToEcdsaOwnershipManager({ chain: client.chain, signer: privateKeyToAccountObject(privateKey), entryPoint: entryPointAddress, }), chain: client.chain, entryPoint: entryPointAddress, middleware: { gasPrice: async () => BigInt(1000000000), }, transport: client.transport, }) ``` -------------------------------- ### Setup Clients with Viem and Permissionless Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/testing/build-bear.mdx Set up Viem and Permissionless clients for interacting with a BuildBear Sandbox. Ensure you have the necessary imports. ```typescript import { create } from "@/index.js"; import { http, createPublicClient, createWalletClient, toHex } from "viem"; const chainId = 172; const rpcUrl = "https://rpc.buildbear.io/"; const publicClient = createPublicClient({ chain: { id: chainId, name: "Buildbear", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: [rpcUrl] } } }, transport: http(rpcUrl), }); const privateKey = "0xdf57089c2754787e4771d0000000000000000000000000000000000000000000"; const smartAccountClient = create({ chain: { id: chainId, name: "Buildbear", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: [rpcUrl] } } }, transport: http(rpcUrl), account: { // Use a private key for the smart account signer address: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", signMessage: async ({ message }) => { const walletClient = createWalletClient({ account: privateKey as any, chain: { id: chainId, name: "Buildbear", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: [rpcUrl] } } }, transport: http(rpcUrl), }); return walletClient.signMessage({ message: message.message }); }, signTransaction: async ({ transaction }) => { const walletClient = createWalletClient({ account: privateKey as any, chain: { id: chainId, name: "Buildbear", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: [rpcUrl] } } }, transport: http(rpcUrl), }); return walletClient.signTransaction(transaction as any); }, signTypedData: async ({ domain, types, primaryType, message }) => { const walletClient = createWalletClient({ account: privateKey as any, chain: { id: chainId, name: "Buildbear", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: [rpcUrl] } } }, transport: http(rpcUrl), }); return walletClient.signTypedData({ domain, types, primaryType, message, }); }, getAddresses: async () => ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"], }, }); export { publicClient, smartAccountClient }; ``` -------------------------------- ### Get Paymaster Data with Verification Gas Limit Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/permissionless/reference/pimlico-actions/getPaymasterData.mdx This example shows how to obtain paymaster data, including an optional verification gas limit for the User Operation. Ensure `paymasterClient` is configured. ```typescript import { paymasterClient } from './config' const paymasterArgs = await paymasterClient.getPaymasterData({ callData: '0xb61d27f600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000', callGasLimit: 69420n, factory: '0xfb6dab6200b8958c2655c3747708f82243d3f32e', factoryData: '0xf14ddffc000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb922660000000000000000000000000000000000000000000000000000000000000000', maxFeePerGas: 14510554812n, maxPriorityFeePerGas: 2000000000n, nonce: 0n, sender: '0xE911628bF8428C23f179a07b081325cAe376DE1f', signature: '0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c', verificationGasLimit: 69420n, // [!code focus] }) ``` -------------------------------- ### Install Server Packages Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/signers/passkey-server.mdx Install the necessary packages for creating a Passkey (WebAuthn) server using Fastify. This includes server utilities, CBOR encoding, a web framework, CORS, and data validation. ```bash npm install @simplewebauthn/server @levischuck/tiny-cbor fastify @fastify/cors zod ``` -------------------------------- ### Install Anvil Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/bundler/testing.mdx Install Anvil using the provided curl command. Source your bashrc or zshrc file afterwards. Finally, install Foundry. ```bash curl -L https://foundry.paradigm.xyz | bash ``` ```bash source $HOME/.bashrc ``` ```bash source $HOME/.zshrc ``` ```bash foundryup ``` -------------------------------- ### Initialize Permissionless Clients for Local Environment Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/testing/docker.mdx Set up viem clients to connect to the local development environment. Use 'http://localhost:8545' for the public client and 'http://localhost:3000' for bundler and Pimlico clients. ```typescript import { createPimlicoClient } from "permissionless/clients/pimlico"; import { http, createPublicClient } from "viem"; import { createBundlerClient, entryPoint07Address } from "viem/account-abstraction" import { foundry } from "viem/chains"; const publicClient = createPublicClient({ chain: foundry, transport: http("http://localhost:8545"), // [!code ++] }); const bundlerClient = createBundlerClient({ chain: foundry, transport: http("http://localhost:3000") // [!code ++] }); const pimlicoClient = createPimlicoClient({ transport: http("http://localhost:3000"), // [!code ++] entryPoint: { address: entryPoint07Address, version: "0.7", } }) ``` -------------------------------- ### Install @permissionless/wagmi with yarn Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/permissionless/wagmi/tutorial/tutorial-1.mdx Install the @permissionless/wagmi library using yarn. ```bash yarn install @permissionless/wagmi ``` -------------------------------- ### Set up Hooks and Wallet Configuration for Smart Account Demo Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/signers/openfort.mdx Configure necessary hooks and wallet settings, including switching to the Sepolia network, to prepare for smart account interactions using Openfort and permissionless.js. This snippet demonstrates the initial setup for a smart account demo component. ```typescript import { useWallets, use7702Authorization, useUser, type UserWallet } from "@openfort/react"; import { useEffect, useState } from "react"; import { useWalletClient, useAccount, useSwitchChain } from "wagmi"; import { createPublicClient, http, zeroAddress } from "viem"; import { sepolia } from "viem/chains"; import { createSmartAccountClient } from "permissionless"; import { toSimpleSmartAccount } from "permissionless/accounts"; import { createPimlicoClient } from "permissionless/clients/pimlico"; import { entryPoint08Address } from "viem/account-abstraction"; export function SmartAccountDemo() { const { user } = useUser(); const { wallets, setActiveWallet } = useWallets(); const walletClient = useWalletClient(); const { isConnected, chainId } = useAccount(); const { switchChain } = useSwitchChain(); const { signAuthorization } = use7702Authorization(); const [embeddedWallet, setEmbeddedWallet] = useState(undefined); const [isLoading, setIsLoading] = useState(false); const [txHash, setTxHash] = useState(null); const [error, setError] = useState(null); // Set up the embedded wallet useEffect(() => { if (wallets.length > 0) { setActiveWallet({ walletId: wallets[0].id, address: wallets[0].address, }).then((activeWallet) => { setEmbeddedWallet(activeWallet.wallet); }); } }, [wallets.length]); useEffect(() => { if (isConnected && chainId !== sepolia.id) { console.log('Switching to Sepolia network...'); switchChain( { chainId: sepolia.id }, { onError: (error) => { console.error('Failed to switch chain:', error); setError(`Please switch to Sepolia network manually. ${error.message}`); }, } ); } }, [chainId, isConnected, switchChain]); ``` -------------------------------- ### Install @permissionless/wagmi with npm Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/permissionless/wagmi/tutorial/tutorial-1.mdx Install the @permissionless/wagmi library using npm. ```bash npm install @permissionless/wagmi ``` -------------------------------- ### Install @permissionless/wagmi with pnpm Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/permissionless/wagmi/tutorial/tutorial-1.mdx Install the @permissionless/wagmi library using pnpm. ```bash pnpm install @permissionless/wagmi ``` -------------------------------- ### Install permissionless.js with pnpm Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/permissionless/reference/index.mdx Use this command to install the library if you are using pnpm. ```bash pnpm install permissionless ``` -------------------------------- ### Create a Smart Account Client Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/accounts/use-safe-account.mdx Initialize a permissionless.js client that functions as a replacement for viem's walletClient. ```typescript // [!include ~/snippets/accounts/safe.ts:smartAccountClient] ``` -------------------------------- ### Install permissionless.js with yarn Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/permissionless/reference/index.mdx Use this command to install the library if you are using yarn. ```bash yarn add permissionless ``` -------------------------------- ### Create a Viem Public Client Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/permissionless/reference/public-actions/getSenderAddress.mdx Set up a public client using Viem for interacting with the Ethereum mainnet. Replace the Infura URL with your actual endpoint. ```typescript import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' export const publicClient = createPublicClient({ chain: mainnet, transport: http("https://mainnet.infura.io/v3/...") }) ``` -------------------------------- ### Steps Component Example Source: https://github.com/pimlicolabs/docs/blob/main/CLAUDE.md Demonstrates how to use the 'steps' component in MDX for multi-step instructions. ```mdx ::::steps :::step[Step Title] Step content here... ::: :::step[Another Step] More content... ::: :::: ``` -------------------------------- ### Install permissionless.js with npm Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/permissionless/reference/index.mdx Use this command to install the library if you are using npm. ```bash npm install permissionless ``` -------------------------------- ### Setup Clients for BuildBear Sandbox Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/permissionless/how-to/testing/build-bear.mdx Configure viem clients to interact with a BuildBear Sandbox environment. Ensure you have the necessary RPC URL from your sandbox. ```typescript import { create } from "viem" import { http } from "viem" const client = create({ transport: http("https://rpc.buildbear.io/"), }) ``` -------------------------------- ### Install Vitest for Testing Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/testing/prool.mdx Installs Vitest as a development dependency for running tests. ```bash npm install --save-dev vitest ``` -------------------------------- ### Build Bear Docker Setup Source: https://github.com/pimlicolabs/docs/blob/main/scrape/output/pimlico_urls.txt Provides the Docker command to set up Build Bear for testing. This is useful for creating isolated testing environments. ```bash docker run -p 8545:8545 --name build-bear ghcr.io/pimlicolabs/build-bear:latest ``` -------------------------------- ### Initialize Pimlico and Smart Account Clients Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/paymasters/extending-sponsorship-duration.mdx This snippet demonstrates the setup for Pimlico and smart account clients, including necessary imports and configurations for Sepolia testnet. Ensure your `PRIVATE_KEY` and `PIMLICO_API_KEY` environment variables are set. ```typescript import { sepolia } from "viem/chains" import { createPublicClient, http } from "viem" import { privateKeyToAccount } from "viem/accounts"; import { createPimlicoClient } from "permissionless/clients/pimlico" import { toSafeSmartAccount } from "permissionless/accounts" import { createSmartAccountClient } from "permissionless" const privateKey = process.env.PRIVATE_KEY const apiKey = process.env.PIMLICO_API_KEY export const publicClient = createPublicClient({ chain: sepolia, transport: http(), }) const pimlicoUrl = `https://api.pimlico.io/v2/sepolia/rpc?apikey=${apiKey}` const pimlicoClient = createPimlicoClient({ transport: http(pimlicoUrl), entryPoint: { address: entryPoint07Address, version: "0.7", }, }) const account = await toSafeSmartAccount({ client: publicClient, owners: [privateKeyToAccount(privateKey)], entryPoint: { address: entryPoint07Address, version: "0.7", }, version: "1.4.1", }) export const smartAccountClient = createSmartAccountClient({ account, chain: sepolia, bundlerTransport: http(pimlicoUrl), paymaster: pimlicoClient, userOperation: { estimateFeesPerGas: async () => { return (await pimlicoClient.getUserOperationGasPrice()).fast }, }, }) ``` -------------------------------- ### ECDSA Kernel Smart Account Setup Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/permissionless/reference/erc7579-actions/installModule.mdx This snippet demonstrates the setup for an ECDSA Kernel smart account, which supports ERC-7579 modules. No specific setup is required beyond having the necessary client initialized. ```typescript // [!include ~/snippets/erc7579/ecdsaKernelSmartAccount.ts] ``` -------------------------------- ### Create a Smart Account Client Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/permissionless/how-to/accounts/use-kernel-account.mdx Initialize a smart account client that acts as a replacement for viem's walletClient. This client is used for sending transactions through the Kernel account. ```typescript const smartAccountClient = create({ chain: publicClient.chain, entryPoint: ENTRYPOINT_V0_7, transport: publicClient.transport, signer: signer, middleware: { gasPrice: async () => ( // Use Pimlico's gas price or your own logic await pimlicoPaymasterClient.request({ method: "eth_gasPrice", }) ), // sponsorTransaction: sponsorTransaction, }, account: kernelSmartAccount, }); ``` -------------------------------- ### Create a Smart Account Client Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/accounts/use-thirdweb-account.mdx Initialize a permissionless.js client configured as a smart account client, serving as a replacement for viem's walletClient. ```typescript // [!include ~/snippets/accounts/thirdweb.ts:smartAccountClient] ``` -------------------------------- ### Run Alto with Command-Line Arguments Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/references/bundler/self-host.mdx Start the Alto bundler with essential configurations provided via command-line flags. Ensure the RPC URL supports debug_traceCall if safe-mode is enabled. ```bash ./alto run --entrypoints "0x0000000071727De22E5E9d8BAf0edAc6f37da032,0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789" --executor-private-keys "0x34e9a7...,0xb08d34...,0x163cbb..." --utility-private-key "0xe768f1..." --rpc-url "http://localhost:8545" --safe-mode false ``` -------------------------------- ### Install Dependencies for Dynamic Signer Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/signers/dynamic.mdx Install the necessary packages for integrating Dynamic with permissionless.js and Wagmi. ```bash npm i @dynamic-labs/sdk-react-core @dynamic-labs/wagmi-connector @dynamic-labs/ethereum permissionless viem wagmi ``` -------------------------------- ### Create a Smart Account Client Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/accounts/use-nexus-account.mdx Initialize a smart account client that mimics viem's walletClient, enabling seamless integration with existing viem-based applications. ```typescript const smartAccountClient = await smartAccount.getClient({ publicClient, paymasterClient, }); ``` -------------------------------- ### Initiate WebAuthn Registration Source: https://github.com/pimlicolabs/docs/blob/main/docs/pages/guides/how-to/signers/passkey-server.mdx Handles the 'pks_startRegistration' RPC method by generating WebAuthn registration options using `@simplewebauthn/server`. It requires a valid `userName` and returns the generated options, which must be saved for the verification step. ```typescript import { generateRegistrationOptions } from "@simplewebauthn/server" const pksStartRegistrationHandler = async ( body: z.infer ) => { const { params: [{ userName }] } = body // Validate userName if (!userName) { throw new Error("Invalid userName") } // Start registration const options = await generateRegistrationOptions({ rpName: rpName, rpID: rpID, userName: userName, attestationType: "none", authenticatorSelection: { residentKey: "preferred", userVerification: "preferred", authenticatorAttachment: "platform" } }) // Save options somewhere as we will need it for verification // .... // .... return { jsonrpc: "2.0", id: body.id, result: options } } ``` -------------------------------- ### Install Module for ERC-7579 Source: https://github.com/pimlicolabs/docs/blob/main/scrape/output/pimlico_urls.txt Installs a module for an ERC-7579 smart account using `installModule`. This is an ERC-7579 action. ```typescript import { installModule } from "@pimlico.js/permissionless/v0.1/reference/erc7579-actions"; const txHash = await installModule({ // ... parameters for installing module }); ```