What We’re Building
By the end of this tutorial, your users will be able to:- Connect their existing MetaMask, Rabby, or Trust wallet
- Execute orchestrated transactions (swaps, bridges, multicalls)
- Pay gas with ERC-20 tokens instead of ETH
- Receive all resulting tokens back to their original wallet
How it works: When a user signs a “trigger” transaction, Biconomy’s MEE temporarily moves funds to a Companion Account, executes all operations, and returns the results to the user’s wallet—all in one seamless flow.
Understanding Fusion Mode
Before diving into code, let’s understand how Fusion Mode differs from the EIP-7702 approach used with embedded wallets.Why Fusion Mode?
External wallets are browser extensions that maintain their own security model. They don’t permit apps to “upgrade” the wallet to a smart account using EIP-7702. Fusion Mode works around this limitation by:- Using a trigger transaction to authorize the orchestration
- Routing execution through a Companion Account (fully owned by the user)
- Returning all assets to the user’s original wallet
The Fusion Flow
1
User Signs Trigger
The user signs a transaction (often a permit or approve) that contains the hash of all orchestration instructions. This single signature authorizes the entire flow.
2
Funds Move to Companion Account
Funds are pulled into a Companion Account that the user fully owns. This account is non-custodial and stateless—nothing remains after execution.
3
Instructions Execute
All operations (swaps, bridges, multicalls) execute using the Companion Account. MEE nodes handle the complexity.
4
Assets Return to EOA
Final assets are sent back to the user’s original wallet address. The Companion Account is left clean.
5
Automatic Cleanup (if needed)
If any step fails, cleanup logic can revert intermediate steps and return funds safely.
Invisible to Users: Your users never need to know about the Companion Account. From their perspective, they sign once and receive tokens in their wallet.
Trigger Types
Fusion Mode supports two trigger types, automatically selected based on your input token:Fusion Constraints
Before implementing, understand these limitations:- One token per signature: Fusion can only consume one input token per user action
- Same token for gas: The trigger token must also pay for gas fees
- Same-chain gas only: Unlike EIP-7702, you can’t pay gas on Chain A for execution on Chain B
- Sponsorship available: You can sponsor gas to bypass the gas requirement entirely
Step 1: Install Dependencies
@biconomy/abstractjs— Biconomy’s SDK for MEE and Fusion Modeviem— Ethereum library for building transactionswagmi— React hooks for wallet connections@tanstack/react-query— Required peer dependency for wagmi
Step 2: Configure Wallet Connection
Set up wagmi to support popular external wallets:Step 3: Connect the Wallet
Use wagmi hooks to connect and access the user’s wallet:Step 4: Create the Fusion Account
For Fusion Mode, create atoFusionAccount instead of the standard Nexus account:
Step 5: Build the Trigger
The trigger defines which token the user will “spend” to initiate the orchestration:Step 6: Define Instructions
Instructions describe what operations to execute. Here’s an example that transfers USDC:Step 7: Get a Fusion Quote
Request a quote that includes the trigger and instructions:Step 8: Execute the Fusion Transaction
Execute the quote—the SDK handles trigger signing automatically:Complete Example
Here’s a full React component for Fusion Mode with MetaMask:Comparison: Fusion vs EIP-7702
When to Use Fusion Mode
Use Fusion When
- Users have MetaMask, Rabby, Trust, or similar
- You need maximum wallet compatibility
- Single-token input flows (swaps, deposits)
- Same-chain gas payment is acceptable
Consider EIP-7702 When
- You control the wallet (embedded wallets)
- Cross-chain gas payment is needed
- Multiple input tokens per operation
- Direct smart account features required
Key Takeaways
- Fusion enables any wallet — MetaMask, Rabby, Trust, and all browser extensions work
- One signature, full orchestration — Users sign once to authorize complex operations
- Transparent Companion Account — Users never see it; assets always return to their wallet
- Automatic trigger detection — SDK chooses gasless permit or onchain tx based on token