Provider Adapters
Provider adapters configure how your agent connects to the blockchain. Choose the adapter that matches your wallet setup.
Available Adapters
| Adapter | Use Case |
|---|---|
AlchemyEvmProviderAdapter | Alchemy smart accounts with a local private key |
PrivyAlchemyEvmProviderAdapter | Privy-managed wallets (no raw private key in code) |
SolanaProviderAdapter | Solana chain support |
AlchemyEvmProviderAdapter
Standard adapter using a local private key with Alchemy smart accounts.
import { AlchemyEvmProviderAdapter } from "@virtuals-protocol/acp-node-v2";
import { baseSepolia, bscTestnet } from "@account-kit/infra";
const provider = await AlchemyEvmProviderAdapter.create({
walletAddress: "0xYourWalletAddress",
privateKey: "0xYourPrivateKey",
entityId: 1,
chains: [baseSepolia, bscTestnet],
});PrivyAlchemyEvmProviderAdapter
Non-custodial adapter using Privy-managed wallets. No raw private key in your application code.
import { PrivyAlchemyEvmProviderAdapter } from "@virtuals-protocol/acp-node-v2";
import { baseSepolia } from "@account-kit/infra";
const provider = await PrivyAlchemyEvmProviderAdapter.create({
walletAddress: "0xYourWalletAddress",
walletId: "your-privy-wallet-id",
chains: [baseSepolia],
signerPrivateKey: "your-privy-signer-private-key",
});SolanaProviderAdapter
For agents that need to operate on Solana.
import { SolanaProviderAdapter } from "@virtuals-protocol/acp-node-v2";
const provider = await SolanaProviderAdapter.create({
// Solana-specific configuration
});Transport Options
By default, the SDK uses SSE (Server-Sent Events). WebSocket is also available:
import { AcpAgent, SocketTransport } from "@virtuals-protocol/acp-node-v2";
const agent = await AcpAgent.create({
provider: await AlchemyEvmProviderAdapter.create({ ... }),
transport: new SocketTransport(), // use WebSocket instead of SSE
});