> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getpara.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Solana Integration

> Sign Solana transactions using Para's unified wallet architecture

export const Card = ({imgUrl, title, description, href, horizontal = false, newTab = false}) => {
  const [isHovered, setIsHovered] = useState(false);
  const handleClick = e => {
    e.preventDefault();
    if (newTab) {
      window.open(href, '_blank', 'noopener,noreferrer');
    } else {
      window.location.href = href;
    }
  };
  return <div className={`not-prose relative my-2 p-[1px] rounded-xl transition-all duration-300 ${isHovered ? 'bg-gradient-to-r from-[#FF4E00] to-[#874AE3]' : 'bg-gray-200'}`} onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => setIsHovered(false)}>
      <a href={href} onClick={handleClick} className={`not-prose flex ${horizontal ? 'flex-row' : 'flex-col'} font-normal h-full bg-white overflow-hidden w-full cursor-pointer rounded-[11px] no-underline`}>
        {imgUrl && <div className={`relative overflow-hidden flex-shrink-0 ${horizontal ? 'w-[30%] rounded-l-[11px]' : 'w-full'}`} onClick={e => e.stopPropagation()}>
            <img src={imgUrl} alt={title} className="w-full h-full object-cover pointer-events-none select-none" draggable="false" />
            <div className="absolute inset-0 pointer-events-none" />
          </div>}
        <div className={`flex-grow px-6 py-5 ${horizontal ? 'w-[70%]' : 'w-full'} flex flex-col ${horizontal && imgUrl ? 'justify-center' : 'justify-start'}`}>
          {title && <h2 className="font-semibold text-base text-gray-800 m-0">{title}</h2>}
          {description && <div className={`font-normal text-gray-500 re leading-6 ${horizontal || !imgUrl ? 'mt-0' : 'mt-1'}`}>
              <p className="m-0 text-xs">{description}</p>
            </div>}
        </div>
      </a>
    </div>;
};

## Quick Start

```dart theme={null}
import 'package:para/para.dart';

// Sign a Solana transaction
final para = Para(apiKey: 'your-api-key');
final wallet = (await para.fetchWallets()).firstWhere((w) => w.type == 'SOLANA');

final transaction = SolanaTransaction(
  to: '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM',
  lamports: '1000000', // 0.001 SOL
  feePayer: null, // Uses wallet as fee payer
  recentBlockhash: null, // Fetched automatically with RPC URL
);

final result = await para.signTransaction(
  walletId: wallet.id!,
  transaction: transaction.toJson(),
  chainId: null, // Not needed for Solana
  rpcUrl: 'https://api.devnet.solana.com',
);
print('Transaction signed: ${result.signedTransaction}');
```

## Common Operations

### Sign Transaction

```dart theme={null}
final transaction = SolanaTransaction(
  to: '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM',
  lamports: '1000000', // 0.001 SOL
  feePayer: null, // Uses wallet as fee payer
  recentBlockhash: null, // Fetched automatically with RPC URL
);

final result = await para.signTransaction(
  walletId: wallet.id!,
  transaction: transaction.toJson(),
  chainId: null, // Not needed for Solana
  rpcUrl: 'https://api.devnet.solana.com',
);
print('Signed: ${result.signedTransaction}');
```

### Check Balance

```dart theme={null}
final balance = await para.getBalance(
  walletId: wallet.id!,
  token: null, // Native SOL
  rpcUrl: 'https://api.devnet.solana.com',
);

// Convert lamports to SOL
final lamports = double.parse(balance);
final sol = lamports / 1000000000;
print('Balance: ${sol.toStringAsFixed(4)} SOL');
```

### Sign Message

```dart theme={null}
final message = 'Hello, Solana!';
final result = await para.signMessage(
  walletId: wallet.id!,
  message: message,
);
print('Signature: ${result.signedTransaction}');
```

## Networks

### Testnets

| Network     | RPC URL                          | Native Token |
| ----------- | -------------------------------- | ------------ |
| **Devnet**  | `https://api.devnet.solana.com`  | SOL          |
| **Testnet** | `https://api.testnet.solana.com` | SOL          |

### Mainnet

| Network     | RPC URL                                            | Native Token | Network Type |
| ----------- | -------------------------------------------------- | ------------ | ------------ |
| **Mainnet** | `https://api.mainnet-beta.solana.com`              | SOL          | Production   |
| **Alchemy** | `https://solana-mainnet.g.alchemy.com/v2/YOUR_KEY` | SOL          | Production   |

## Complete Example

```dart theme={null}
import 'package:flutter/material.dart';
import 'package:para/para.dart';

class SolanaWalletView extends StatefulWidget {
  final Para para;
  final Wallet wallet;

  const SolanaWalletView({required this.para, required this.wallet});

  @override
  State<SolanaWalletView> createState() => _SolanaWalletViewState();
}

class _SolanaWalletViewState extends State<SolanaWalletView> {
  bool _isLoading = false;
  String? _signature;
  final String _rpcUrl = 'https://api.devnet.solana.com';

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(16),
      child: Column(
        children: [
          Text(
            widget.wallet.address ?? 'No address',
            style: TextStyle(fontFamily: 'monospace', fontSize: 12),
          ),
          SizedBox(height: 20),
          ElevatedButton(
            onPressed: _isLoading ? null : _signTransaction,
            child: Text(_isLoading ? 'Signing...' : 'Sign Transaction'),
          ),
          if (_signature != null)
            Padding(
              padding: const EdgeInsets.only(top: 20),
              child: Text('Signed: $_signature', style: TextStyle(fontSize: 12)),
            ),
        ],
      ),
    );
  }

  Future<void> _signTransaction() async {
    setState(() => _isLoading = true);
    try {
      final transaction = SolanaTransaction(
        to: '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM',
        lamports: '1000000', // 0.001 SOL
        feePayer: null,
        recentBlockhash: null,
      );

      final result = await widget.para.signTransaction(
        walletId: widget.wallet.id!,
        transaction: transaction.toJson(),
        chainId: null, // Not needed for Solana
        rpcUrl: _rpcUrl,
      );
      setState(() => _signature = result.signedTransaction);
    } catch (e) {
      print('Error: $e');
    } finally {
      setState(() => _isLoading = false);
    }
  }
}
```

## Advanced Transaction Options

```dart theme={null}
// Transaction with memo
final transaction = SolanaTransaction(
  to: '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM',
  lamports: '1000000',
  memo: 'Payment for services',
);

// Transaction with custom blockhash
final transaction = SolanaTransaction(
  to: '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM',
  lamports: '1000000',
  recentBlockhash: 'custom_blockhash',
  feePayer: wallet.address,
);
```
