Solana Wallet Plugin for Flutter

A Flutter plugin that provides easy integration with Solana wallets for web applications. This plugin supports multiple Solana wallets including Phantom, Solflare, Slope, and more.

Features

  • Connect to multiple Solana wallets
  • Check wallet installation status
  • Get wallet balance
  • Launch wallet installation URLs
  • Beautiful and customizable wallet selection dialog
  • Support for multiple Solana wallets:
    • Phantom
    • Solflare
    • Slope
    • Backpack
    • Brave
    • Coin98
    • Glow
    • Exodus
    • Trust Wallet

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  solana_wallet_plugin:
    git:
      url: https://github.com/yourusername/solana_wallet_plugin.git

Usage

Basic Usage

import 'package:solana_wallet_plugin/solana_wallet_plugin.dart';
import 'package:solana_wallet_plugin/widgets/wallet_selection_dialog.dart';

// Create an instance of the plugin
final walletPlugin = SolanaWalletPlugin();

// Show the wallet selection dialog
showDialog(
  context: context,
  builder: (context) => WalletSelectionDialog(
    walletPlugin: walletPlugin,
    onWalletSelected: (wallet) async {
      try {
        // Connect to the selected wallet
        final publicKey = await walletPlugin.connectWallet();
        print('Connected to wallet: $publicKey');
        
        // Get wallet balance
        final balance = await walletPlugin.getBalance();
        print('Wallet balance: $balance SOL');
      } catch (e) {
        print('Error connecting to wallet: $e');
      }
    },
  ),
);

// Disconnect from the wallet
await walletPlugin.disconnectWallet();

Check if a wallet is installed

final isPhantomInstalled = walletPlugin.isWalletInstalled('phantom');

Get wallet installation URL

final phantomUrl = walletPlugin.getWalletInstallationUrl('phantom');

Launch wallet installation

await walletPlugin.launchWalletInstallation('phantom');

Example

Check out the example directory for a complete working example of how to use the plugin.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.