The Routescan Wagmi plugin is a new integration that gives developers building decentralized applications (dApps) access to more than 180 blockchain networks through a single configuration. This plugin is designed to simplify the process of interacting with smart contracts on multiple chains, offering the same familiar developer experience as existing solutions but with significantly broader network coverage.
How It Works
The core of this integration is the routescan.ts
plugin module within the Wagmi CLI. It acts as a connector, automatically fetching contract ABIs from Routescan's API. This eliminates the need for you to manually find, copy, and paste ABIs into your projects. Once the ABI is fetched, the plugin:
Generates TypeScript Code. The CLI uses the fetched ABI to automatically generate strongly typed code and hooks for your contract, which ensures your dApp is type-safe and your code is clean.
Handles Proxy Contracts. The plugin can automatically detect if a contract address is a proxy. If it is, it intelligently fetches the ABI of the underlying implementation contract so you are always interacting with the correct logic.
Caches ABIs. To improve performance and avoid rate limits, the plugin automatically caches fetched ABIs. Subsequent requests for the same ABI are served instantly from a local cache, which speeds up your development workflow.
Multi-Chain Development
Routescan plugin provides developers with a single integration to access blockchain data across more than 180 networks. This simplifies development for multi-chain projects without the need of using multiple tools.
Routescan provides coverage for a wide variety of blockchains, including:
Layer 1s (L1s). These are the base blockchains that validate and finalize transactions on their own network. Ethereum for example serves as a foundational network for many decentralized applications, and Berachain, a newer L1 that uses a novel ‘Proof-of-Liquidity’ consensus model to incentivize liquidity provision.
Layer 2s (L2s). These are scaling solutions built on top of L1s to improve transaction speed and reduce costs. Routescan supports major L2s like Arbitrum and Base, which use optimistic rollups to bundle transactions offchain before settling them on Ethereum. It also supports Unichain, an L2 built by Uniswap Labs as part of the Optimism Superchain ecosystem, designed to be a liquidity hub for decentralized finance (DeFi).
Specialized and Emerging Chains. Routescan also covers chains with specific use cases, such as World Chain, which is built for ‘real humans’ and prioritizes block space for users verified with a World ID.
Simplified Developer Experience
The Routescan plugin works seamlessly with familiar Wagmi hooks like useContractRead
and useContractWrite
. This allows you to use standard React development patterns for all your blockchain interactions. Common tasks like connecting wallets, managing accounts, and fetching data are simplified with hooks such as useConnect
and useAccount
, which automatically handle data fetching and caching for you.
Getting Started
To begin building with the Routescan Wagmi plugin, you'll need to follow these three simple steps:
Install Wagmi and Viem. Install the core libraries you need to get started. Viem is the low-level library that Wagmi uses for blockchain interactions.
npm install wagmi viem
Configure Your Wagmi Client. Set up your client to connect to the Routescan-supported network of your choice.
import { createConfig, http } from 'wagmi'
import { mainnet } from 'wagmi/chains'
import { injected } from 'wagmi/connectors'
export const config = createConfig({
chains: [mainnet],
connectors: [
injected(),
],
transports: {
[mainnet.id]: http(),
},
})Wrap Your Application. Wrap your React application with the
WagmiConfig
provider to make the hooks available to your components.import { WagmiConfig } from 'wagmi'
import { config } from './wagmi.ts'
import { App } from './App.tsx'
ReactDOM.createRoot(document.getElementById('root')).render(
<WagmiConfig config={config}>
<App />
</WmiConfig>,
)
By following these steps, you can start building powerful and user-friendly dApps, while the Routescan Wagmi plugin handles the complexity of blockchain communication.