Quick Start
Transfer
Para handles signing and broadcasting in one call:Copy
Ask AI
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:Copy
Ask AI
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
Copy
Ask AI
// 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
Copy
Ask AI
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
Copy
Ask AI
// 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
Copy
Ask AI
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
Copy
Ask AI
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
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.Copy
Ask AI
// 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
Copy
Ask AI
// 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