🚀 AngorHub SDK

Complete Guide & Interactive Examples

📖 Overview

AngorHub SDK is a comprehensive TypeScript/JavaScript library for interacting with the Angor ecosystem. It provides seamless access to project data, investment information, and Nostr integration with support for both mainnet and testnet networks.

🌐

Multi-Network Support

Works with both mainnet and testnet networks

⚙️

Flexible Configuration

Remote, manual, or default configuration modes

🔗

Nostr Integration

Enhanced project data with Nostr enrichment

High Performance

Built-in caching and concurrent request handling

🔧

TypeScript Support

Full type safety and IntelliSense support

📱

Universal Compatibility

Works in browsers, Node.js, React, Angular, and more

📦 Installation

NPM Installation

npm install angorhub-sdk

Yarn Installation

yarn add angorhub-sdk

CDN Usage (Browser)

<script src="https://cdn.jsdelivr.net/npm/angorhub-sdk@latest/dist/browser/angorhub-sdk.bundle.js"></script>
Note: For browser usage, the SDK is available as AngorHubSDK global variable when using CDN.

🚀 Quick Start

Get started with AngorHub SDK in just a few lines of code:

Basic Example
import { AngorHubSDK } from 'angorhub-sdk'; // Function to wait for SDK to be ready async function initializeSDK(network = 'mainnet', config = {}) { const sdk = new AngorHubSDK(network, config); // Wait for SDK initialization by checking health status let attempts = 0; while (attempts < 10) { try { const health = sdk.getHealthStatus(); if (health.healthyCount > 0) { break; // SDK is ready } } catch (error) { // SDK not ready yet } await new Promise(resolve => setTimeout(resolve, 500)); attempts++; } return sdk; } // Initialize and use SDK const sdk = await initializeSDK('mainnet'); // Fetch first 10 projects const projects = await sdk.getProjects(10); console.log('Projects:', projects); // Get specific project details const projectId = projects[0].projectIdentifier; const projectDetails = await sdk.getProject(projectId); console.log('Project details:', projectDetails); // Get project statistics const stats = await sdk.getProjectStats(projectId); console.log('Project stats:', stats);
Testnet Example
// Initialize SDK for testnet with custom configuration const testnetSdk = new AngorHubSDK('testnet', { enableNostr: true, enableCache: true, cacheTtl: 300000, // 5 minutes cache maxRetries: 3, timeout: 10000 }); // Wait for SDK initialization await new Promise(resolve => setTimeout(resolve, 2000)); // Get testnet projects const testnetProjects = await testnetSdk.getProjects(5); console.log('Testnet projects:', testnetProjects);
With Error Handling
try { const sdk = new AngorHubSDK('mainnet'); // Wait for SDK initialization await new Promise(resolve => setTimeout(resolve, 2000)); // Get projects with pagination const projects = await sdk.getProjects(10, 0); if (projects.length > 0) { const firstProject = await sdk.getProject(projects[0].projectIdentifier); console.log('First project:', firstProject); // Get project investments const investments = await sdk.getProjectInvestments(projects[0].projectIdentifier, 5); console.log('Investments:', investments); } else { console.log('No projects found'); } } catch (error) { console.error('SDK Error:', error.message); }

⚙️ Configuration Modes

AngorHub SDK supports three configuration modes to suit different use cases:

1. Remote Configuration (Default)

Automatically fetches indexer and relay configurations from a remote service.

import { AngorHubSDK } from 'angorhub-sdk'; const sdk = new AngorHubSDK('mainnet', { configMode: 'remote', configServiceUrl: 'https://angorhub.github.io/lists' // Optional: custom URL });

2. Manual Configuration

Provide your own indexer and relay endpoints.

const sdk = new AngorHubSDK('mainnet', { configMode: 'manual', manualIndexers: { mainnet: ['https://api.angor.io'], testnet: ['https://api-testnet.angor.io'] }, manualRelays: 'wss://relay.damus.io,wss://nos.lol' });

3. Default Configuration

Uses built-in default endpoints.

const sdk = new AngorHubSDK('mainnet', { configMode: 'default' });

🎮 Interactive Configuration Demo

Configuration Settings

SDK Status & Output

Click "Initialize SDK" to start...

💡 Usage Examples

Basic SDK Initialization

Node.js / ES Modules
import { AngorHubSDK } from 'angorhub-sdk'; // Initialize SDK for mainnet const sdk = new AngorHubSDK('mainnet'); // Initialize with custom configuration const customSdk = new AngorHubSDK('testnet', { enableNostr: true, enableCache: true, cacheTtl: 300000, // 5 minutes maxRetries: 3, timeout: 10000 });
Browser / Global Variable
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/angorhub-sdk@latest/dist/browser/angorhub-sdk.bundle.js"></script> <script> // SDK is available as AngorHubSDK.AngorHubSDK const sdk = new AngorHubSDK.AngorHubSDK('mainnet'); </script>
CommonJS
const { AngorHubSDK } = require('angorhub-sdk'); const sdk = new AngorHubSDK('mainnet');

Working with Projects

Get Projects List
// Get first 10 projects const projects = await sdk.getProjects(10, 0); console.log(`Found ${projects.length} projects`); // Get specific project by ID const projectId = 'angor1qe8swvv3xu9dnf3q9q8v6cvc7x60kwums7c5r37'; const project = await sdk.getProject(projectId); console.log('Project details:', project); // Get project statistics const stats = await sdk.getProjectStats(projectId); console.log('Project stats:', stats);
Testnet Projects
// Initialize testnet SDK const testnetSdk = new AngorHubSDK('testnet'); // Get testnet projects const testnetProjects = await testnetSdk.getTestnetProjects(5); console.log('Testnet projects:', testnetProjects);

🎮 Interactive Projects Demo

Click a button to fetch projects...

Investment Data

Get Project Investments
const projectId = 'angor1qe8swvv3xu9dnf3q9q8v6cvc7x60kwums7c5r37'; // Get all investments for a project const investments = await sdk.getProjectInvestments(projectId, 50, 0); investments.forEach((investment, index) => { console.log(`Investment ${index + 1}:`); console.log(` Investor: ${investment.investorPublicKey}`); console.log(` Amount: ${investment.totalAmount}`); console.log(` Transaction: ${investment.transactionId}`); console.log(` Is Seeder: ${investment.isSeeder}`); });
Get Specific Investor Investment
const projectId = 'angor1qe8swvv3xu9dnf3q9q8v6cvc7x60kwums7c5r37'; const investorPublicKey = '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798'; try { const investment = await sdk.getInvestorInvestment(projectId, investorPublicKey); console.log('Investor investment:', investment); } catch (error) { console.log('No investment found for this investor'); }

🎮 Interactive Investments Demo


Enter a project ID and click "Get Investments"...

Nostr Integration

Nostr Enhancement: The SDK automatically enriches project data with Nostr metadata when enabled, providing additional information like project descriptions, founder profiles, and social links.
Enable Nostr Enrichment
const sdk = new AngorHubSDK('mainnet', { enableNostr: true, configMode: 'remote' // Uses remote relay configuration }); // Projects will automatically include Nostr data const projects = await sdk.getProjects(); projects.forEach(project => { // Basic project data console.log('Project ID:', project.projectIdentifier); console.log('Founder:', project.founderKey); // Enhanced Nostr data (if available) if (project.projectInfo) { console.log('Target Amount:', project.projectInfo.targetAmount); console.log('Start Date:', new Date(project.projectInfo.startDate * 1000)); console.log('End Date:', new Date(project.projectInfo.endDate * 1000)); } if (project.metadata) { console.log('Project Name:', project.metadata.name); console.log('Description:', project.metadata.about); console.log('Website:', project.metadata.website); console.log('Picture:', project.metadata.picture); } });
Manual Nostr Enrichment
// Get projects without automatic enrichment const plainProjects = await sdk.getProjects(); // Manually enrich specific projects const enrichedProjects = await sdk.enrichProjectsWithNostr(plainProjects.slice(0, 5)); console.log('Enriched projects:', enrichedProjects);

🎮 Interactive Nostr Demo

Click "Test Nostr Enrichment" to see enhanced data...

📚 API Reference

Constructor

new AngorHubSDK( network: 'mainnet' | 'testnet', config?: SDKConfig )

SDKConfig Interface

interface SDKConfig { configMode?: 'remote' | 'manual' | 'default'; // Default: 'remote' configServiceUrl?: string; // Default: 'https://angorhub.github.io/lists' manualIndexers?: { mainnet?: string[]; testnet?: string[]; }; manualRelays?: string; // Comma-separated relay URLs enableNostr?: boolean; // Default: true enableCache?: boolean; // Default: true cacheTtl?: number; // Default: 300000 (5 minutes) maxRetries?: number; // Default: 2 timeout?: number; // Default: 8000ms enableCompression?: boolean; // Default: false concurrentRequests?: number; // Default: 8 }

Core Methods

Project Methods

// Get projects list with pagination async getProjects(limit = 10, offset = 0, useCache = true): Promise<AngorProject[]> // Get specific project details async getProject(projectId: string, useCache = true): Promise<AngorProjectDetails> // Get project statistics async getProjectStats(projectId: string, useCache = true): Promise<AngorProjectStats> // Get multiple projects at once async getMultipleProjects(projectIds: string[], useCache = true): Promise<AngorProjectDetails[]> // Get multiple project statistics at once async getMultipleProjectStats(projectIds: string[], useCache = true): Promise<AngorProjectStats[]>
Project Methods Usage Examples
// Basic project fetching const projects = await sdk.getProjects(5, 0); console.log(`Fetched ${projects.length} projects`); // Get specific project with details const projectId = 'angor1qe8swvv3xu9dnf3q9q8v6cvc7x60kwums7c5r37'; const project = await sdk.getProject(projectId); console.log('Project:', project.projectName); // Get project statistics const stats = await sdk.getProjectStats(projectId); console.log(`Target: ${stats.targetAmount}, Invested: ${stats.investedAmount}`); // Batch fetch multiple projects const projectIds = ['angor1qe8swvv3xu9dnf3q9q8v6cvc7x60kwums7c5r37', 'angor1qwq68qqe38m37nqp75ut227sjyack49d4d5ntfv']; const multipleProjects = await sdk.getMultipleProjects(projectIds); console.log('Fetched multiple projects:', multipleProjects.length);

Investment Methods

// Get project investments with pagination async getProjectInvestments( projectId: string, limit = 10, offset = 0, useCache = true ): Promise<AngorInvestment[]> // Get specific investor investment async getInvestorInvestment( projectId: string, investorPublicKey: string, useCache = true ): Promise<AngorInvestment>
Investment Methods Usage Examples
// Get project investments const projectId = 'angor1qe8swvv3xu9dnf3q9q8v6cvc7x60kwums7c5r37'; const investments = await sdk.getProjectInvestments(projectId, 10, 0); console.log(`Found ${investments.length} investments`); // Get specific investor's investment const investorKey = '03ff751a5557df3daa4526b0056124e43d9b3205f491f4299c8fa584291b3c3bf0'; const investment = await sdk.getInvestorInvestment(projectId, investorKey); console.log('Investment amount:', investment.investedAmount); // Paginate through all investments let allInvestments = []; let offset = 0; const limit = 20; while (true) { const batch = await sdk.getProjectInvestments(projectId, limit, offset); if (batch.length === 0) break; allInvestments.push(...batch); offset += limit; } console.log(`Total investments found: ${allInvestments.length}`);

Nostr Methods

// Enrich projects with Nostr data enrichProjectsWithNostr(projects: Project[]): Promise<Project[]>

Configuration Methods

// Update configuration at runtime async updateConfiguration( configMode: 'remote' | 'manual' | 'default', options?: { configServiceUrl?: string; manualIndexers?: { mainnet?: string[]; testnet?: string[] }; manualRelays?: string; } ): Promise<void> // Refresh remote configuration async refreshConfiguration(): Promise<void> // Get current configuration info getConfigurationInfo(): { mode: ConfigMode; serviceUrl: string; indexers: IndexerService[]; relaysCount: number; network: string; }
Configuration Methods Usage Examples
// Switch to manual configuration await sdk.updateConfiguration('manual', { manualIndexers: { mainnet: ['https://api.angor.io', 'https://backup.angor.io'], testnet: ['https://testnet-api.angor.io'] }, manualRelays: 'wss://relay.damus.io,wss://nos.lol' }); // Switch to remote configuration with custom service URL await sdk.updateConfiguration('remote', { configServiceUrl: 'https://my-custom-config.example.com' }); // Switch to default configuration await sdk.updateConfiguration('default'); // Get current configuration info const configInfo = sdk.getConfigurationInfo(); console.log('Current mode:', configInfo.mode); console.log('Active indexers:', configInfo.indexers.length); console.log('Nostr relays count:', configInfo.relaysCount); // Refresh configuration (useful for remote mode) await sdk.refreshConfiguration(); console.log('Configuration refreshed');

Utility Methods

// Get indexer health status getHealthStatus(): { indexers: IndexerHealth[]; healthyCount: number; } // Get cache statistics getCacheStats(): { sdkCache: { size: number; keys: string[] }; nostrCache?: { size: number; keys: string[] }; } // Get general SDK configuration and status getConfigInfo(): { network: string; config: SDKConfig; currentHealthyIndexers: number; totalIndexers: number; cacheSize: number; activeRequests: number; queuedRequests: number; timestamp: string; } // Clear all caches clearCache(): void // Clean up resources (call when done) destroy(): void
Utility Methods Usage Examples
// Check indexer health const health = sdk.getHealthStatus(); console.log(`Healthy indexers: ${health.healthyCount}/${health.indexers.length}`); health.indexers.forEach(indexer => { console.log(`${indexer.url}: ${indexer.isHealthy ? 'OK' : 'FAILED'} (${indexer.responseTime}ms)`); }); // Monitor cache usage const cacheStats = sdk.getCacheStats(); console.log(`SDK cache size: ${cacheStats.sdkCache.size} entries`); if (cacheStats.nostrCache) { console.log(`Nostr cache size: ${cacheStats.nostrCache.size} entries`); } // Get detailed SDK status const sdkInfo = sdk.getConfigInfo(); console.log('SDK Status:', { network: sdkInfo.network, mode: sdkInfo.config.configMode, healthyIndexers: sdkInfo.currentHealthyIndexers, cacheSize: sdkInfo.cacheSize, activeRequests: sdkInfo.activeRequests }); // Clear cache when needed sdk.clearCache(); console.log('Cache cleared'); // Clean up when done (important for proper cleanup) sdk.destroy();

Type Definitions

Project Interface

interface Project { projectIdentifier: string; founderKey: string; createdOnBlock: number; trxId: string; nostrEventId: string; totalInvestmentsCount?: number; projectInfo?: { nostrPubKey: string; targetAmount: number; startDate: number; endDate: number; penaltyDays: number; stages: any[]; projectSeeders: any[]; }; metadata?: { name?: string; display_name?: string; about?: string; website?: string; picture?: string; nip05?: string; lud16?: string; banner?: string; }; }

Investment Interface

interface Investment { investorPublicKey: string; totalAmount: number; transactionId: string; isSeeder: boolean; }

🔧 Framework Integration

React Integration

import React, { useState, useEffect } from 'react'; import { AngorHubSDK } from 'angorhub-sdk'; function ProjectsList() { const [projects, setProjects] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { const fetchProjects = async () => { try { const sdk = new AngorHubSDK('mainnet'); const projectsData = await sdk.getProjects(10); setProjects(projectsData); } catch (error) { console.error('Error fetching projects:', error); } finally { setLoading(false); } }; fetchProjects(); }, []); if (loading) return <div>Loading projects...</div>; return ( <div> <h2>Projects ({projects.length})</h2> {projects.map(project => ( <div key={project.projectIdentifier}> <h3>{project.metadata?.name || project.projectIdentifier}</h3> <p>Founder: {project.founderKey}</p> {project.metadata?.about && <p>{project.metadata.about}</p>} </div> ))} </div> ); }

Angular Integration

import { Component, OnInit } from '@angular/core'; import { AngorHubSDK } from 'angorhub-sdk'; @Component({ selector: 'app-projects', template: ` <div *ngIf="loading">Loading projects...</div> <div *ngIf="!loading"> <h2>Projects ({{projects.length}})</h2> <div *ngFor="let project of projects"> <h3>{{project.metadata?.name || project.projectIdentifier}}</h3> <p>Founder: {{project.founderKey}}</p> <p *ngIf="project.metadata?.about">{{project.metadata.about}}</p> </div> </div> ` }) export class ProjectsComponent implements OnInit { projects: any[] = []; loading = true; private sdk = new AngorHubSDK('mainnet'); async ngOnInit() { try { this.projects = await this.sdk.getProjects(10); } catch (error) { console.error('Error fetching projects:', error); } finally { this.loading = false; } } }

Vue.js Integration

import { ref, onMounted } from 'vue'; import { AngorHubSDK } from 'angorhub-sdk'; export default { setup() { const projects = ref([]); const loading = ref(true); const sdk = new AngorHubSDK('mainnet'); const fetchProjects = async () => { try { const projectsData = await sdk.getProjects(10); projects.value = projectsData; } catch (error) { console.error('Error fetching projects:', error); } finally { loading.value = false; } }; onMounted(fetchProjects); return { projects, loading }; }, template: ` <div v-if="loading">Loading projects...</div> <div v-else> <h2>Projects ({{ projects.length }})</h2> <div v-for="project in projects" :key="project.projectIdentifier"> <h3>{{ project.metadata?.name || project.projectIdentifier }}</h3> <p>Founder: {{ project.founderKey }}</p> <p v-if="project.metadata?.about">{{ project.metadata.about }}</p> </div> </div> ` };

Next.js Integration

// pages/projects.js import { useState, useEffect } from 'react'; import { AngorHubSDK } from 'angorhub-sdk'; export default function ProjectsPage() { const [projects, setProjects] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { const fetchProjects = async () => { try { const sdk = new AngorHubSDK('mainnet'); const projectsData = await sdk.getProjects(10); setProjects(projectsData); } catch (error) { console.error('Error fetching projects:', error); } finally { setLoading(false); } }; fetchProjects(); }, []); return ( <div> <h1>Angor Projects</h1> {loading ? ( <p>Loading projects...</p> ) : ( <div> {projects.map(project => ( <div key={project.projectIdentifier}> <h3>{project.metadata?.name || project.projectIdentifier}</h3> <p>Founder: {project.founderKey}</p> {project.metadata?.about && <p>{project.metadata.about}</p>} </div> ))} </div> )} </div> ); } // For server-side rendering export async function getServerSideProps() { try { const sdk = new AngorHubSDK('mainnet'); const projects = await sdk.getProjects(10); return { props: { initialProjects: projects } }; } catch (error) { return { props: { initialProjects: [] } }; } }

🔍 Troubleshooting

Common Issues & Solutions

1. CORS Issues in Browser

Problem: CORS errors when making requests from the browser.

Solutions:

// Use CDN bundle which handles CORS better // <script src="https://cdn.jsdelivr.net/npm/angorhub-sdk@latest/dist/browser/angorhub-sdk.bundle.js"></script> // Or configure a CORS proxy const sdk = new AngorHubSDK('mainnet', { configMode: 'manual', manualIndexers: { mainnet: ['https://cors-proxy.example.com/https://api.angor.io/'] } });

2. Network Timeouts & Connection Issues

Problem: Requests timing out or failing intermittently.

Solutions:

// Increase timeout and enable retries const sdk = new AngorHubSDK('mainnet', { timeout: 15000, // 15 seconds maxRetries: 5, // Retry failed requests retryDelay: 2000, // Wait 2 seconds between retries concurrentRequests: 5 // Reduce concurrent requests if network is slow }); // Monitor health status const health = sdk.getHealthStatus(); console.log('Healthy indexers:', health.healthyCount); // Handle errors gracefully try { const projects = await sdk.getProjects(); } catch (error) { if (error.message.includes('timeout')) { console.log('Request timed out, trying with fewer results...'); const projects = await sdk.getProjects(5); // Try with fewer results } }

3. Nostr Connection Issues

Problem: Nostr enrichment not working or failing.

Solutions:

// Option 1: Disable Nostr if causing issues const sdk = new AngorHubSDK('mainnet', { enableNostr: false }); // Option 2: Use custom reliable relays const sdk = new AngorHubSDK('mainnet', { enableNostr: true, nostrRelays: [ 'wss://relay.damus.io', 'wss://nos.lol', 'wss://relay.nostr.info' ] }); // Option 3: Handle Nostr failures gracefully const projects = await sdk.getProjects(); console.log('Projects loaded, Nostr data may be enriched asynchronously');

4. SDK Initialization Issues

Problem: SDK methods fail immediately after initialization or return unexpected results.

Solutions:

// Use proper initialization pattern async function initializeSDK(network = 'mainnet', config = {}) { const sdk = new AngorHubSDK(network, config); // Wait for SDK to be ready by checking health status let attempts = 0; while (attempts < 20) { try { const health = sdk.getHealthStatus(); if (health.healthyCount > 0) { return sdk; // SDK is ready } } catch (error) { // Still initializing } await new Promise(resolve => setTimeout(resolve, 500)); attempts++; } return sdk; // Return anyway after max attempts } // Use it const sdk = await initializeSDK('mainnet'); const projects = await sdk.getProjects();

5. Cache Issues

Problem: Stale data or cache taking too much memory.

Solutions:

// Configure cache settings const sdk = new AngorHubSDK('mainnet', { enableCache: true, cacheTtl: 60000 // 1 minute cache (shorter for fresh data) }); // Monitor cache size const stats = sdk.getCacheStats(); console.log('Cache entries:', stats.sdkCache.size); // Clear cache when needed if (stats.sdkCache.size > 1000) { sdk.clearCache(); console.log('Cache cleared due to size'); } // Disable cache for real-time data const freshProjects = await sdk.getProjects(10, 0, false); // useCache = false

6. TypeScript Issues

Problem: TypeScript compilation errors.

Solutions:

// Ensure proper imports import { AngorHubSDK } from 'angorhub-sdk'; import type { AngorProject, AngorProjectDetails, SDKConfig } from 'angorhub-sdk'; // Type the config properly const config: SDKConfig = { configMode: 'manual', manualIndexers: { mainnet: ['https://api.angor.io/'] }, enableNostr: true, timeout: 10000 }; const sdk = new AngorHubSDK('mainnet', config); // Type assertions when needed const projects = await sdk.getProjects() as AngorProject[];

Debugging Tips

Debug Configuration
// Enable detailed logging and monitoring const sdk = new AngorHubSDK('mainnet', { timeout: 10000, maxRetries: 3, enableCache: true }); // Monitor SDK status setInterval(() => { const info = sdk.getConfigInfo(); const health = sdk.getHealthStatus(); const cache = sdk.getCacheStats(); console.log('SDK Status:', { healthyIndexers: `${health.healthyCount}/${health.indexers.length}`, activeRequests: info.activeRequests, queuedRequests: info.queuedRequests, cacheSize: cache.sdkCache.size }); }, 30000); // Log every 30 seconds
Test Configuration
// Test different configuration modes async function testConfiguration() { const configs = [ { mode: 'remote', name: 'Remote Config' }, { mode: 'default', name: 'Default Config' } ]; for (const { mode, name } of configs) { try { console.log(`Testing ${name}...`); const sdk = new AngorHubSDK('mainnet', { configMode: mode }); // Wait for initialization await new Promise(resolve => setTimeout(resolve, 2000)); const projects = await sdk.getProjects(1); console.log(`${name}: SUCCESS - Got ${projects.length} projects`); const health = sdk.getHealthStatus(); console.log(`${name}: Healthy indexers: ${health.healthyCount}`); } catch (error) { console.error(`${name}: FAILED -`, error.message); } } } testConfiguration();

Getting Help

Need more help?
  • Check the examples section for working code
  • Review the API reference for method signatures
  • Test with the interactive demos on this page
  • Use the browser's developer console to check for errors
  • Try different configuration modes if one isn't working

Debug Mode

Enable debug logging to troubleshoot issues:

// Check SDK health const health = sdk.getHealth(); console.log('SDK Health:', health); // Check configuration const config = sdk.getConfigurationInfo(); console.log('Current Config:', config); // Check cache statistics const cacheStats = sdk.getCacheStats(); console.log('Cache Stats:', cacheStats);

Performance Optimization

Enable Caching

const sdk = new AngorHubSDK('mainnet', { enableCache: true, cacheTtl: 600000 // 10 minutes });

Optimize Concurrent Requests

const sdk = new AngorHubSDK('mainnet', { concurrentRequests: 12 // Increase for better performance });

Use Compression

const sdk = new AngorHubSDK('mainnet', { enableCompression: true });

Error Handling Best Practices

try { const projects = await sdk.getProjects(); // Handle success } catch (error) { if (error.code === 'NETWORK_ERROR') { // Handle network issues console.error('Network error:', error.message); } else if (error.code === 'TIMEOUT') { // Handle timeout console.error('Request timed out'); } else { // Handle other errors console.error('Unknown error:', error); } }

Support

Need Help?
  • Check the GitHub repository for issues and documentation
  • Join the Angor community Discord for real-time support
  • Review the examples in the examples/ directory