Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.arc.network/llms.txt

Use this file to discover all available pages before exploring further.

App Kit works with common adapter libraries to integrate smoothly with your existing workflow:
  • viem v2 for EVM-compatible blockchains
  • ethers v6 for EVM-compatible blockchains
  • solana for the Solana blockchain
  • circle-wallets for your existing Circle Wallets account
Pick your adapter to see its setup options.

Standard setup

The standard setup is the fastest way to start. Create one adapter from your wallet private key that works across multiple blockchains. This setup uses built-in public RPC endpoints and factory functions.
Default RPC URLs are shared and may be rate-limited or unreliable. For a more stable connection, configure a custom RPC.
TypeScript
import { createViemAdapterFromPrivateKey } from "@circle-fin/adapter-viem-v2";

const adapter = createViemAdapterFromPrivateKey({
  privateKey: process.env.PRIVATE_KEY as string,
});

Custom RPC

Use your own connection to override the default RPC URLs from standard setup, which may be rate-limited and unreliable. Alchemy, QuickNode, and chainlist.org are common places to source endpoints. This example uses Alchemy:
TypeScript
import { createViemAdapterFromPrivateKey } from "@circle-fin/adapter-viem-v2";
import { EthereumSepolia, ArcTestnet } from "@circle-fin/app-kit/chains";
import { createPublicClient, http } from "viem";

// Map RPC endpoints by chain name
const RPC_BY_CHAIN_NAME: Record<string, string> = {
  [EthereumSepolia.name]: `https://eth-sepolia.g.alchemy.com/v2/${process.env.ALCHEMY_KEY}`,
  [ArcTestnet.name]: `https://arc-testnet.g.alchemy.com/v2/${process.env.ALCHEMY_KEY}`,
};

// Create an adapter
const adapter = createViemAdapterFromPrivateKey({
  privateKey: process.env.PRIVATE_KEY as string,
  // Replace the default connection
  getPublicClient: ({ chain }) => {
    const rpcUrl = RPC_BY_CHAIN_NAME[chain.name];
    if (!rpcUrl) {
      throw new Error(`No RPC configured for chain: ${chain.name}`);
    }
    return createPublicClient({
      chain,
      transport: http(rpcUrl, {
        retryCount: 3,
        timeout: 10000,
      }),
    });
  },
});

Browser wallet

This setup expects a wallet extension in the browser (for example window.ethereum or window.solana), not a Node.js server. You can use wallets like MetaMask or Phantom:
TypeScript
import { createViemAdapterFromProvider } from "@circle-fin/adapter-viem-v2";
import type { EIP1193Provider } from "viem";

declare global {
  interface Window {
    ethereum?: EIP1193Provider;
  }
}

// Check if wallet provider is available
if (!window.ethereum) {
  throw new Error("No wallet provider found");
}

const adapter = await createViemAdapterFromProvider({
  provider: window.ethereum,
});