> ## 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.

# EVM Integration

> Transfer ETH and interact with EVM chains 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

### Transfer

Para handles signing and broadcasting in one call:

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

final para = Para(apiKey: 'your-api-key');
final wallet = (await para.fetchWallets()).firstWhere((w) => w.type == 'EVM');

// Send ETH - Para signs and broadcasts
final result = await para.transfer(
  walletId: wallet.id!,
  to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
  amount: '1000000000000000', // 0.001 ETH in wei
  chainId: '11155111', // Optional: Sepolia testnet (defaults to wallet's chain)
  rpcUrl: null, // Optional: override default RPC
);
print('Transaction sent: ${result.hash}');
print('From: ${result.from}, To: ${result.to}');
print('Amount: ${result.amount}, Chain: ${result.chainId}');
```

### Advanced Control

Sign with Para, then broadcast yourself for custom gas/RPC settings:

```dart theme={null}
// Step 1: Sign transaction with Para
final transaction = EVMTransaction(
  to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
  value: '1000000000000000',
  gasLimit: '21000',
);

final result = await para.signTransaction(
  walletId: wallet.id!,
  transaction: transaction.toJson(),
  chainId: '11155111', // Sepolia testnet
);

// Step 2: Broadcast using your preferred library (e.g., web3dart)
// The transactionData getter provides the complete signed transaction
// final txHash = await broadcastWithWeb3Dart(result.transactionData);
```

## Common Operations

### Send ETH

```dart theme={null}
// Para handles everything - signing and broadcasting
final result = await para.transfer(
  walletId: wallet.id!,
  to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
  amount: '1000000000000000', // 0.001 ETH in wei
  chainId: '11155111', // Optional: Sepolia testnet
  rpcUrl: null, // Optional: custom RPC URL
);
print('Transaction hash: ${result.hash}');
print('From: ${result.from}, To: ${result.to}, Chain: ${result.chainId}');
```

### Sign Transaction

```dart theme={null}
final transaction = EVMTransaction(
  to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
  value: '1000000000000000',
  gasLimit: '21000',
  maxPriorityFeePerGas: '1000000000', // 1 Gwei
  maxFeePerGas: '3000000000', // 3 Gwei
  nonce: '0',
  chainId: '11155111', // Sepolia
  type: 2,
);

final result = await para.signTransaction(
  walletId: wallet.id!,
  transaction: transaction.toJson(),
  chainId: '11155111',
);
// The transactionData getter returns the complete RLP-encoded transaction
// ready for broadcasting via eth_sendRawTransaction
print('Signed transaction: ${result.transactionData}');
// For backward compatibility, signature field still contains the raw signature
print('Raw signature: ${result.signedTransaction}');
```

### Check Balance

```dart theme={null}
// Native ETH balance
final ethBalance = await para.getBalance(walletId: wallet.id!);

// ERC-20 token balance
final tokenBalance = await para.getBalance(
  walletId: wallet.id!,
  token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
);
```

### Sign Message

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

## Networks

### Testnets

| Network            | Chain ID   | Native Token | Default RPC                                   |
| ------------------ | ---------- | ------------ | --------------------------------------------- |
| **Sepolia**        | `11155111` | ETH          | `https://ethereum-sepolia-rpc.publicnode.com` |
| **Polygon Mumbai** | `80001`    | MATIC        | `https://rpc-mumbai.maticvigil.com`           |
| **Base Sepolia**   | `84532`    | ETH          | `https://sepolia.base.org`                    |

### Mainnets

| Network      | Chain ID | Native Token | Default RPC                    |
| ------------ | -------- | ------------ | ------------------------------ |
| **Ethereum** | `1`      | ETH          | `https://eth.llamarpc.com`     |
| **Polygon**  | `137`    | MATIC        | `https://polygon-rpc.com`      |
| **Base**     | `8453`   | ETH          | `https://mainnet.base.org`     |
| **Arbitrum** | `42161`  | ETH          | `https://arb1.arbitrum.io/rpc` |
| **Optimism** | `10`     | ETH          | `https://mainnet.optimism.io`  |

## Complete Example

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

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

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

  @override
  State<EVMWalletView> createState() => _EVMWalletViewState();
}

class _EVMWalletViewState extends State<EVMWalletView> {
  bool _isLoading = false;
  String? _txHash;

  @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 : _sendETH,
            child: Text(_isLoading ? 'Sending...' : 'Send 0.001 ETH'),
          ),
          if (_txHash != null)
            Padding(
              padding: const EdgeInsets.only(top: 20),
              child: Text('Sent: $_txHash', style: TextStyle(fontSize: 12)),
            ),
        ],
      ),
    );
  }

  Future<void> _sendETH() async {
    setState(() => _isLoading = true);
    try {
      final result = await widget.para.transfer(
        walletId: widget.wallet.id!,
        to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
        amount: '1000000000000000',
        chainId: '11155111', // Optional: Sepolia testnet
        rpcUrl: null, // Optional: custom RPC
      );
      setState(() => _txHash = result.hash);
    } catch (e) {
      print('Error: $e');
    } finally {
      setState(() => _isLoading = false);
    }
  }
}
```

## Smart Contract Interaction

<Info>
  **Transaction Data**: For EVM transactions, `result.transactionData` returns the complete RLP-encoded signed transaction that's ready to broadcast via `eth_sendRawTransaction`. The `signature` field contains just the raw signature for backward compatibility.
</Info>

```dart theme={null}
// Call a contract function
final contractTransaction = EVMTransaction(
  to: '0x123abc...', // Contract address
  value: '0',
  gasLimit: '150000',
  maxPriorityFeePerGas: '1000000000',
  maxFeePerGas: '3000000000',
  nonce: '0',
  chainId: '11155111', // Sepolia testnet
  smartContractAbi: '''[{
    "inputs": [{"name":"num","type":"uint256"}],
    "name": "store",
    "type": "function"
  }]''',
  smartContractFunctionName: 'store',
  smartContractFunctionArgs: ['42'],
  type: 2,
);

final result = await para.signTransaction(
  walletId: wallet.id!,
  transaction: contractTransaction.toJson(),
  chainId: '11155111', // Sepolia testnet
);
// Use result.transactionData to get the complete signed transaction
print('Signed transaction: ${result.transactionData}');
```

### ERC20 Token Transfer

Transfer ERC20 tokens using the standard transfer function:

```dart theme={null}
// Transfer USDC on Sepolia testnet
final usdcTransaction = EVMTransaction(
  to: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238', // USDC contract on Sepolia
  value: '0', // No ETH being sent, only tokens
  gasLimit: '100000', // Higher gas limit for token transfers
  maxPriorityFeePerGas: '1000000000', // 1 Gwei
  maxFeePerGas: '3000000000', // 3 Gwei
  nonce: '0',
  chainId: '11155111', // Sepolia testnet
  // ERC20 transfer function ABI
  smartContractAbi: '''[{
    "inputs": [
      {"name": "to", "type": "address"},
      {"name": "amount", "type": "uint256"}
    ],
    "name": "transfer",
    "outputs": [{"name": "", "type": "bool"}],
    "type": "function"
  }]''',
  smartContractFunctionName: 'transfer',
  smartContractFunctionArgs: [
    '0x742d35Cc6634C0532925a3b844Bc454e4438f44e', // Recipient address
    '100000', // 0.1 USDC (USDC has 6 decimals, so 100000 = 0.1 USDC)
  ],
  type: 2, // EIP-1559 transaction
);

// Sign the token transfer transaction
final result = await para.signTransaction(
  walletId: wallet.id!,
  transaction: usdcTransaction.toJson(),
  chainId: '11155111',
);

// The Flutter SDK sends the ABI and function parameters separately
// The bridge handles the encoding to create the proper transaction data
print('Token transfer signed: ${result.transactionData}');

// You can now broadcast this transaction using eth_sendRawTransaction
// or use Para's transfer method for automatic broadcasting
```
