Vana SDK - v2.2.2
    Preparing search index...

    Interface NetworkInfo

    Network information for blockchain connectivity and monitoring.

    Provides comprehensive details about the connected blockchain network, including configuration URLs and real-time status. Use this information to verify network connectivity, display network details to users, and construct explorer links for transactions.

    // Get current network info
    const network: NetworkInfo = await vana.protocol.getNetworkInfo();

    console.log(`Connected to: ${network.chainName} (ID: ${network.chainId})`);
    console.log(`Current block: ${network.currentBlock}`);

    // Check network health
    if (network.status !== 'healthy') {
    console.warn(`Network ${network.status}: consider switching RPC`);
    }

    // Generate explorer link for transaction
    function getExplorerLink(txHash: string): string {
    if (!network.explorerUrl) {
    return `Transaction: ${txHash}`;
    }
    return `${network.explorerUrl}/tx/${txHash}`;
    }

    // Verify expected network
    const EXPECTED_CHAIN_ID = 1337; // Vana testnet
    if (network.chainId !== EXPECTED_CHAIN_ID) {
    throw new Error(`Wrong network! Expected ${EXPECTED_CHAIN_ID}, got ${network.chainId}`);
    }
    interface NetworkInfo {
        chainId: number;
        chainName: string;
        rpcUrl: string;
        explorerUrl?: string;
        currentBlock: bigint;
        status: "healthy" | "degraded" | "down";
    }
    Index

    Properties

    chainId: number

    Chain ID

    chainName: string

    Chain name

    rpcUrl: string

    RPC URL

    explorerUrl?: string

    Block explorer URL

    currentBlock: bigint

    Current block number

    status: "healthy" | "degraded" | "down"

    Network status