Unichain API Integration

Overview

Unichain is supported by Pocket Network's enterprise-grade infrastructure with guaranteed uptime, global edge network, and developer-first tooling.

Network Information

Property Value
Network Name Unichain
Native Token ETH
EVM Chain ID 1301
Pocket Service ID unichain
Block Explorer Unichain Explorer

Supported APIs

API Documentation
JSON-RPC view spec

Integration Examples

Quick Setup

// Using ethers.js (for EVM-compatible chains)
import { JsonRpcProvider } from 'ethers';

const provider = new JsonRpcProvider('YOUR_ENDPOINT');

// Get latest block
const blockNumber = await provider.getBlockNumber();
console.log('Latest block:', blockNumber);

// Get account balance
const balance = await provider.getBalance('WALLET_ADDRESS');
console.log('Balance:', balance.toString());

Smart Contract Interaction

// Contract interaction example
const contractABI = [...]; // Your contract ABI
const contractAddress = '0x...'; // Your contract address

const contract = new Contract(contractAddress, contractABI, provider);

// Read contract data
const result = await contract.someReadMethod();

// Write to contract (requires signer)
const signer = provider.getSigner();
const contractWithSigner = contract.connect(signer);
const tx = await contractWithSigner.someWriteMethod(param1, param2);
await tx.wait(); // Wait for confirmation

DeFi Integration

// Example: Interacting with Uniswap V4 on Unichain
import { Contract } from 'ethers';

// Uniswap V4 Pool Manager (example address)
const poolManagerAddress = '0x...';
const poolManagerABI = [...];

const poolManager = new Contract(poolManagerAddress, poolManagerABI, provider);

// Get pool information
const poolKey = {
  currency0: '0x...', // Token A address
  currency1: '0x...', // Token B address
  fee: 3000, // 0.3% fee tier
  tickSpacing: 60,
  hooks: '0x0000000000000000000000000000000000000000'
};

const poolInfo = await poolManager.getPool(poolKey);
console.log('Pool info:', poolInfo);

Developer Resources

📚 Essential Links

🛠️ Tools & SDKs

💬 Community & Support

Public Endpoint

Free public RPC endpoint available with fair use limits. No API key required.

View Public Endpoint →