Wagmi Web exposes the powerful Wagmi SDK to your Flutter web projects, providing intuitive building blocks for creating Ethereum applications. This plugin enables Wallet Connect (Reown AppKit) integration, allowing seamless blockchain-based wallet connections in your Flutter web apps.
- π Wallet Connect Integration - Connect to 300+ wallets through Reown AppKit (formerly WalletConnect) or injected web3 exposed by Wagmi.
- π 100% WASM Compatible - Full support for WebAssembly compilation
- π οΈ Comprehensive Ethereum Tools - Access to Wagmi's complete suite of Web3 utilities
- π± Flutter Web Optimized - Seamlessly integrates with Flutter's web platform
Try out Wagmi Web in action:
- JavaScript Version: https://wagmiweb.web.app
- WASM Version: https://wagmiweb-wasm.web.app
Add wagmi_web
to your pubspec.yaml
:
dependencies:
wagmi_web:
import 'package:wagmi_web/wagmi.dart' as wagmi;
// Load and initialize Wagmi lib
await wagmi.init();
// Initialize AppKit (Reown AppKit)
wagmi.AppKit.init(
'f642e3f39ba3e375f8f714f18354faa4', // Your project ID
[wagmi.Chain.ethereum.name!, wagmi.Chain.sepolia.name!], // Supported chains
true, // Include recommended wallets
true, // Set as default
wagmi.AppKitMetadata(
name: 'Reown AppKit',
description: 'Reown AppKit Example',
url: 'https://reown.com',
icons: ['https://avatars.githubusercontent.com/u/37784886'],
),
false, // Email wallet
[], // Social networks
true, // Show wallets
true, // Wallet features
);
// Open the wallet connection modal
wagmi.AppKit.open();
Handle Wagmi errors effectively using the WagmiError
object:
try {
final transactionHash = await wagmi.Core.writeContract(
parameters,
);
} on wagmi.WagmiError catch (e, stackTrace) {
if (e.findError(wagmi.WagmiErrors.UserRejectedRequestError) != null) {
throw Exception('userRejected');
}
if (e.findError(wagmi.WagmiErrors.InsufficientFundsError) != null) {
throw Exception('insufficientFunds');
}
throw Exception('${e.shortMessage}');
}
The error stack is accessible through the cause
property, and you can use findError
to check for specific error types available in the WagmiErrors
enumeration.
β
Implemented - Ready to use
π Work In Progress - Coming soon
π΄ Not Implemented Yet - Planned for future
π TODO - To be managed
For detailed API documentation, visit Wagmi Actions Documentation.
Action Name | Status |
---|---|
call |
β Implemented |
connect |
π΄ |
deployContract |
π΄ |
disconnect |
β Implemented |
estimateFeesPerGas |
β Implemented |
estimateGas |
β Implemented |
estimateMaxPriorityFeePerGas |
β Implemented |
getAccount |
β Implemented |
getBalance |
β Implemented |
getBlock |
β Implemented |
getBlockNumber |
β Implemented |
getBlockTransactionCount |
β Implemented |
getBytecode |
β Implemented |
getChainId |
β Implemented |
getChains |
β Implemented |
getClient |
π΄ |
getConnections |
β Implemented |
getConnectorClient |
π΄ |
getConnectors |
π΄ |
getEnsAddress |
π΄ |
getEnsAvatar |
π΄ |
getEnsName |
π΄ |
getEnsResolver |
π΄ |
getEnsText |
π΄ |
getFeeHistory |
β Implemented |
getGasPrice |
β Implemented |
getProof |
π΄ |
getPublicClient |
π΄ |
getStorageAt |
π΄ |
getToken |
β Implemented |
getTransaction |
β Implemented |
getTransactionConfirmations |
β Implemented |
getTransactionCount |
β Implemented |
getTransactionReceipt |
β Implemented |
getWalletClient |
π΄ |
multicall |
π΄ |
prepareTransactionRequest |
π΄ |
readContract |
β Implemented |
readContracts |
β Implemented |
reconnect |
β Implemented |
sendTransaction |
β Implemented |
signMessage |
β Implemented |
signTypedData |
π΄ |
simulateContract |
π΄ |
switchAccount |
β Implemented |
switchChain |
β Implemented |
verifyMessage |
β Implemented |
verifyTypedData |
π΄ |
waitForTransactionReceipt |
β Implemented |
watchAccount |
β Implemented |
watchAsset |
β Implemented |
watchBlockNumber |
π΄ |
watchBlocks |
π΄ |
watchChainId |
β Implemented |
watchClient |
π΄ |
watchConnections |
β Implemented |
watchConnectors |
π΄ |
watchContractEvent |
β Implemented |
watchPendingTransactions |
π΄ |
watchPublicClient |
π΄ |
writeContract |
β Implemented |
Ensure you have the following tools installed:
- Flutter >= 3.22.3
- Node.js >= 18
Build the JavaScript code for web browser embedding:
# Install dependencies
npm install
# Build production library
npm run build
# Build & watch in development mode
npm run dev
After building the TypeScript code, run your Flutter project normally:
flutter run -d chrome
flutter run -d chrome --wasm
npm test
VSCode Tip: For debugging support, create your terminal using the command
Debug: JavaScript Debug Terminal
# Run tests
dart test -p chrome
# Run with debugging
dart test -p chrome --pause-after-load
We welcome all contributions! Whether it's:
- π Bug reports
- π‘ Feature requests
- π Documentation improvements
- π§ Code contributions
Please feel free to submit a Pull Request. All PRs are welcome!
This project is licensed under the GNU Affero General Public License.
For issues, feature requests, or questions:
- π« Open an issue on GitHub
- π Check out the Wagmi documentation
Made with β€οΈ by 0xMetaLabs