Execute Token Swaps on Uniswap V3 with Pimlico Alto & BuildBear
Pimlico Alto simplifies bundling user operations into transactions and submitting them to the blockchain via standard JSON-RPC requests.
Introduction
This tutorial guides you through integrating ERC-4337-compatible bundlers for account abstraction in blockchain applications using the Pimlico Alto plugin. Pimlico Alto simplifies bundling user operations into transactions and submitting them to the blockchain via standard JSON-RPC requests. It supports permissionless.js, enabling seamless Web3 application development and testing.
What You'll Learn
- Install and configure Pimlico Alto in your BuildBear Sandbox.
- Use permissionless.js to create and manage smart accounts.
- Set up Alto Bundler on your BuildBear network.
- Fund smart accounts for transactions.
- Swap DAI to USDC on Uniswap V3 using Alto Bundler.
Why Test Pimlico AA with BuildBear Sandbox?
✅ Seamless Integration
Pimlico Alto Plugin is designed for effortless integration with BuildBear Sandboxes, making it easy to experiment with Account Abstraction (AA) features.
✅ Permissionless.js Support
- High-level API for managing ERC-4337 smart accounts, bundlers, and paymasters.
- Built on Viem for modularity and extensibility.
✅ JSON-RPC Support for Bundler
Interact with the bundler using standard methods:
eth_sendUserOperation
eth_estimateUserOperationGas
eth_getUserOperationReceipt
eth_getUserOperationByHash
eth_supportedEntryPoints
pimlico_getUserOperationGasPrice
pimlico_getUserOperationStatus
✅ Unlocked Faucets
BuildBear provides unlimited access to native and ERC-20 tokens, ensuring smooth development and testing.
Step 1: Setting Up Pimlico Alto
1. Create a BuildBear Sandbox
- Navigate to BuildBear and create a new Sandbox or use an existing one.
- Open the Plugins tab in your Sandbox dashboard.
2. Install the Pimlico Alto Plugin
- Locate Pimlico Alto Bundler in the plugin marketplace.
- Click Install to add it to your environment.
- Verify installation in the Installed Plugins tab.
3. Retrieve the RPC URL
Copy the RPC URL from your dashboard:
4. Install Dependencies
Step 2: Configuring BuildBear
Define and configure your sandbox network with Viem:
Setup network and client:
Step 3: Configuring Pimlico Client & Smart Accounts
Setup Pimlico and Smart Accounts:
Step 4: Funding & Executing Transactions
Fund your account using BuildBear faucets:
- Native Faucet:
buildbear_nativeFaucet
- ERC20 Faucet:
buildbear_ERC20Faucet
Setup swap transaction:
Send and execute:
(Optional) Debugging and Deep Dive into UserOp with Sentio
Clicking on View On Sentio will open the Sentio debugger for the transaction, offering detailed insights into the transaction's execution, including fund flow, contract interactions, and gas consumption.
✅ Fund Flow
Depicts the flow of funds among different contracts and their order of execution:
✅ Call Trace
Displays the detailed sequence of contract calls executed during the transaction, including function calls, inputs, and outputs:
✅ Call Graph
Provides a high-level visual representation of contracts and the functions involved in the transaction execution:
✅ Gas Profiler
Illustrates gas usage metrics, including gas limits, actual gas used, initial gas provided, and a detailed breakdown of gas consumption per function call:
✅ Debugging with Sentio
Beyond the overview, Sentio offers a detailed debugging interface:
-
Debugger Tab: Inspect individual function calls, inputs, gas metrics, and return values:
-
Contracts Tab: Provides deeper insight into contract details and the specific functions executed:
-
Events Tab: Lists all events emitted by contracts during transaction execution:
-
State Tab: Offers an overview of account balances and state changes before and after the transaction.
✅ Conclusion
By following this tutorial, you have successfully:
- Set up Pimlico Alto
- Configured smart accounts
- Funded accounts
- Executed token swaps on Uniswap V3
For full code and demos, check out the GitHub repository