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

```swift theme={null}
import ParaSwift

let paraManager = ParaManager(apiKey: "your-api-key")
// Get an existing EVM wallet or create one
let wallets = try await paraManager.fetchWallets()
let wallet: Wallet
if let existing = wallets.first(where: { $0.type == .evm }) {
    wallet = existing
} else {
    wallet = try await paraManager.createWallet(type: .evm, skipDistributable: false)
}

// Send ETH - Para signs and broadcasts
let result = try await paraManager.transfer(
    walletId: wallet.id,
    to: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    amount: "1000000000000000", // 0.001 ETH in wei
    chainId: "11155111", // Optional: Sepolia testnet (defaults to wallet's chain)
    rpcUrl: nil // 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:

```swift theme={null}
import ParaSwift
import BigInt

// Step 1: Sign transaction with Para
let transaction = EVMTransaction(
    to: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    value: BigUInt("1000000000000000")!,
    gasLimit: BigUInt("21000")!
)

let result = try await paraManager.signTransaction(
    walletId: wallet.id,
    transaction: transaction,
    chainId: "11155111" // Sepolia testnet
)

// Step 2: Broadcast using your preferred method (e.g., web3.swift)
// The transactionData property provides the complete signed transaction
// let txHash = try await broadcastWithWeb3Swift(result.transactionData)
```

## Common Operations

### Send ETH

```swift theme={null}
// Para handles everything - signing and broadcasting
let result = try await paraManager.transfer(
    walletId: wallet.id,
    to: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    amount: "1000000000000000", // 0.001 ETH in wei
    chainId: "11155111", // Optional: Sepolia testnet
    rpcUrl: nil // Optional: custom RPC URL
)
print("Transaction hash: \(result.hash)")
print("From: \(result.from), To: \(result.to), Chain: \(result.chainId)")
```

### Sign Transaction

```swift theme={null}
import BigInt

let transaction = EVMTransaction(
    to: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    value: BigUInt("1000000000000000")!,
    gasLimit: BigUInt("21000")!,
    maxPriorityFeePerGas: BigUInt("1000000000")!,
    maxFeePerGas: BigUInt("3000000000")!,
    nonce: BigUInt("0")!,
    chainId: BigUInt("11155111")!, // Sepolia
    type: 2
)

let result = try await paraManager.signTransaction(
    walletId: wallet.id,
    transaction: transaction,
    chainId: "11155111"
)
// The transactionData property 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

```swift theme={null}
// Native ETH balance
let ethBalance = try await paraManager.getBalance(walletId: wallet.id)

// ERC-20 token balance
let tokenBalance = try await paraManager.getBalance(
    walletId: wallet.id,
    token: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" // USDC
)
```

### Sign Message

```swift theme={null}
let message = "Hello, Ethereum!"
let result = try await paraManager.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

```swift theme={null}
import SwiftUI
import ParaSwift
import BigInt

struct EVMWalletView: View {
    @EnvironmentObject var paraManager: ParaManager
    @State private var isLoading = false
    @State private var txHash: String?
    
    let wallet: Wallet
    
    var body: some View {
        VStack(spacing: 20) {
            Text(wallet.address ?? "No address")
                .font(.system(.caption, design: .monospaced))
            
            Button(action: sendETH) {
                Text(isLoading ? "Sending..." : "Send 0.001 ETH")
            }
            .disabled(isLoading)
            
            if let txHash = txHash {
                Text("Sent: \(txHash)")
                    .font(.caption)
            }
        }
        .padding()
    }
    
    private func sendETH() {
        isLoading = true
        Task {
            do {
                let result = try await paraManager.transfer(
                    walletId: wallet.id,
                    to: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                    amount: "1000000000000000",
                    chainId: "11155111", // Optional: Sepolia testnet
                    rpcUrl: nil // Optional: custom RPC
                )
                txHash = result.hash
            } catch {
                print("Error: \(error)")
            }
            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>

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

let result = try await paraManager.signTransaction(
    walletId: wallet.id,
    transaction: contractTransaction,
    chainId: "11155111" // Sepolia testnet
)
// Use result.transactionData to get the complete signed transaction
print("Signed transaction: \(result.transactionData)")
```

### ERC20 Token Transfer

```swift theme={null}
// Transfer USDC on Sepolia testnet
let usdcTransaction = EVMTransaction(
    to: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238", // USDC contract on Sepolia
    value: BigUInt(0), // No ETH value for token transfer
    gasLimit: BigUInt("100000")!, // Higher gas limit for token transfers
    maxPriorityFeePerGas: BigUInt("1000000000")!,
    maxFeePerGas: BigUInt("3000000000")!,
    nonce: BigUInt("0")!,
    chainId: BigUInt("11155111")!, // Sepolia testnet
    smartContractAbi: """
    [{
        "inputs": [
            {"name": "recipient", "type": "address"},
            {"name": "amount", "type": "uint256"}
        ],
        "name": "transfer",
        "outputs": [{"name": "", "type": "bool"}],
        "type": "function"
    }]
    """,
    smartContractFunctionName: "transfer",
    smartContractFunctionArgs: [
        "0xcb53FD7529d257D40618992993c5F863f5d86572", // Recipient address
        "100000" // 0.1 USDC (6 decimals, so 100000 = 0.1)
    ],
    type: 2
)

// Sign the transaction - Para bridge handles ABI encoding
let result = try await paraManager.signTransaction(
    walletId: wallet.id,
    transaction: usdcTransaction,
    chainId: "11155111"
)

// The signed transaction is ready to broadcast
// Para encodes the function call data using the provided ABI
print("Signed ERC20 transfer: \(result.transactionData)")

// You can broadcast using your preferred method
// The transaction will transfer 0.1 USDC to the recipient
```
