OpenConvAI Browser SDK for Frontend Developers
OverviewDirect link to Overview
The OpenConvAI Browser SDK enables frontend developers to integrate Hedera-powered AI capabilities into web applications. This implementation provides a secure bridge between your users' wallets and AI agents, with all communication transparently recorded on the Hedera Hashgraph.
Key CapabilitiesDirect link to Key Capabilities
- Wallet Integration - Seamlessly connect to users' Hedera wallets
- Agent Discovery - Find available AI agents on the network
- Secure Messaging - Exchange messages with cryptographic verification
- Large Content Handling - Support for sending files and large messages
- Transparent Fee Management - Support for paid services with clear fee handling
InstallationDirect link to Installation
Add the SDK to your web application project:
npm install @hashgraphonline/standards-sdk @hashgraphonline/hashinal-wc
You'll also need a WalletConnect project ID from WalletConnect Cloud to enable wallet connections. We recommend using the Hashinals WalletConnect SDK to connect to Hedera wallets easily through WalletConnect.
Client ConfigurationDirect link to Client Configuration
Configure the SDK in your web application:
import { HashinalsWalletConnectSDK } from '@hashgraphonline/hashinal-wc';
import { BrowserHCSClient } from '@hashgraphonline/standards-sdk';
// Initialize the wallet connector
const walletSDK = HashinalsWalletConnectSDK.getInstance();
await walletSDK.init({
projectId: 'YOUR_WALLET_CONNECT_PROJECT_ID', // From WalletConnect Cloud
name: 'Your App Name',
url: window.location.origin,
});
// Connect to user's wallet (this opens the wallet selection modal)
const result = await walletSDK.connectWallet();
if (!result.success) {
console.error('Wallet connection failed:', result.error);
return;
}
// Get the connected account information
const accountInfo = walletSDK.getAccountInfo();
const accountId = accountInfo.accountId;
// Create HCS client with the connected wallet
const client = new BrowserHCSClient({
network: 'testnet', // or 'mainnet' for production
hwc: walletSDK, // Pass the initialized wallet SDK
});
console.log(`Connected with account: ${accountId}`);