Wallet Management
Overview
The Blockend Widget features intelligent wallet management that seamlessly integrates with your existing dApp's wallet setup. The widget automatically detects and reuses external wallet providers when available, providing a unified user experience without requiring users to connect multiple times.
Key Features
Automatic Provider Detection: Detects existing Wagmi, Dynamic Labs, and TanStack Query providers
Multi-Chain Support: Handles automatic provider detection(External Providers) for EVM and Solana.
Fallback Providers: Uses internal providers when external ones aren't available for the supported ecosystems.
Zero Configuration: Works out of the box with Wagmi and @dynamic-labs(Solana) based libraries
Architecture
The widget uses a conditional provider system that checks for external providers before initialising internal ones:
graph TD
A[Widget Initialization] --> B[Check External Providers]
B --> C{Wagmi Provider Found?}
C -->|Yes| D[Use External Wagmi]
C -->|No| E[Use Internal Wagmi]
B --> F{Dynamic Provider Found?}
F -->|Yes| G[Use External Dynamic]
F -->|No| H[Use Internal Dynamic]
B --> I{Query Client Found?}
I -->|Yes| J[Use External Query Client]
I -->|No| K[Use Internal Query Client]
D --> L[Widget Ready]
E --> L
G --> L
H --> L
J --> L
K --> LSupported Provider Libraries
EVM Wallet Management
The widget supports the following EVM wallet management libraries:
Wagmi v2: Core Web3 React library
RainbowKit: Built on top of Wagmi
Reown AppKit (formerly WalletConnect): Universal wallet connector
Solana Wallet Management
Dynamic Labs: Solana support
Solana Wallet Adapter: Standard Solana wallet library
Integration Examples
Basic Integration (Uses Internal Providers)
Integration for EVM wallets
Integration with Wagmi
Integration with RainbowKit
Important: For the widget to work on all supported chains, you must add the widget-supported chains to your Wagmi configuration. Here is the list of supported EVM chains:
Ethereum (mainnet) Polygon Arbitrum Optimism BSC zkSYNC Era BASE Avalanche Gnosis Fantom Moonriver Moonbeam Fuse OKXchain Boba Aurora Cronos Heco Harmony Linea RootStock Mode Celo Mantle Scroll Blast Berachain Unichain Sonic Story Polygon zkEVM
Alternatively, you can dynamically fetch the latest supported chains by calling the Blockend API and filtering for EVM chains using networkType: 'evm':
This approach ensures you always have the most up-to-date list of supported chains.
or use useUpdateWagmiConfig hook
useUpdateWagmiConfig Hook
Purpose
The useUpdateWagmiConfig hook synchronizes your Wagmi configuration with the Blockend widget's supported chains, ensuring wallet connections work across all widget networks.
Usage
Parameters
config: Wagmi configuration objectconnectors: Array of Wagmi connectorschains: Array of chain data from widget (must havenetworkType: "evm")
The hook automatically converts widget chains to Wagmi format and updates your config.
Integration for Solana wallets
Integration with Dynamic Labs for Solana wallets
Full Stack Integration
Troubleshooting
Common Issues
1. Widget Not Detecting External Providers
Problem: Widget uses internal providers even when external ones are available.
Solution: Ensure the widget is wrapped inside the provider components:
2. Chain Switching Issues
Problem: Chain switching doesn't work properly.
Solution: Ensure your Wagmi config includes all the chains supported by the widget:
3. Multiple Wallet Connection Prompts
Problem: Users see multiple wallet connection prompts.
Solution: This usually happens when providers are not properly detected. Check the browser console for provider detection logs.
4. Solana Wallet Issues
Problem: Solana wallets not working with Dynamic Labs integration.
Solution: Ensure you have the correct Dynamic Labs environment setup:
Migration Guide
From Internal to External Providers
If you're currently using the widget with internal providers and want to migrate to external providers:
Step 1: Install Required Dependencies
Step 2: Wrap Your App
Step 3: Test Integration
Verify that:
Wallet connections work correctly
Chain switching functions properly
Transaction signing operates as expected
Last updated
Was this helpful?