π@hsuite/snapshots - Multi-Ledger Token Snapshot Management
πΈ Comprehensive NestJS module for generating and managing token holder snapshots across multiple blockchain networks
Enterprise-grade snapshot management solution providing multi-ledger support, real-time progress tracking via WebSockets, IPFS integration, and plugin-based architecture for Hedera Hashgraph and Ripple/XRP Ledger networks with asynchronous processing.
Table of Contents
Quick Start
Installation
npm install @hsuite/snapshotsBasic Setup
Simple Snapshot Generation
Architecture
Core Component Areas
πΈ Snapshot Generation Engine
Multi-Ledger Support - Hedera Hashgraph and Ripple/XRP Ledger compatibility
Asynchronous Processing - Bull queues for reliable background processing
Real-time Progress - WebSocket events for live snapshot generation updates
Rate Limiting Compliance - Network-specific API rate limiting and batching
π Plugin-Based Architecture
Chain-Specific Handlers - Extensible plugin system for different blockchain networks
Dynamic Configuration - Smart chain selection and configuration management
Modular Design - Easy addition of new blockchain network support
Standardized Interface - Consistent API across all supported networks
π Real-time Communication
WebSocket Gateway - Live progress tracking and event broadcasting
JWT Authentication - Secure WebSocket connections and API access
Event-Driven Updates - Comprehensive event system for all snapshot phases
Client Reconnection - Automatic handling of connection recovery
πΎ Storage & Distribution
IPFS Integration - Decentralized storage for generated snapshots
Data Persistence - Reliable snapshot data management
Metadata Handling - Complete token metadata and holder information
Export Formats - Multiple output formats for snapshot data
Module Structure
API Reference
Core Module
SnapshotsModule
Purpose: Main module providing snapshot generation functionality
Features: Redis queue configuration, JWT authentication, plugin registration
Usage: Application-wide snapshot management integration
Core Services
SnapshotsService
Purpose: Core service for initiating snapshot generation
Methods: generateSnapshot(), getSnapshotStatus()
Features: Token validation, job queue management, progress tracking
SnapshotsController
Purpose: REST API controller for HTTP endpoints
Endpoints: POST /snapshots/generate/:tokenId
Features: Request validation, authentication, response formatting
WebSocket Events
snapshots_waiting
Job entered the waiting queue
{ jobId }
snapshots_active
Job started processing
{ jobId, jobName, snapshotId, status: 'activated', progress: 0 }
snapshots_progress
Progress update during generation
{ jobId, jobName, snapshotId, status: 'running', progress }
snapshots_completed
Job completed successfully
{ jobId, jobName, snapshotId, status: 'completed', progress: 100 }
snapshots_failed
Job failed with error
{ jobId, jobName, snapshotId, status: 'error', error }
Supported Networks
Hedera Hashgraph
Fungible, NFTs
Balance snapshots, metadata
25 accounts/batch, 1s delay
Ripple/XRP Ledger
Tokens
Balance snapshots
Framework ready
Plugin Interface
Guides
Types System Documentation
Complete TypeScript definitions and data models for all snapshot operations. Understand the type system, interfaces, and models used throughout the snapshot generation process.
Multi-Chain Ledger Support
Plugin architecture guide for implementing new blockchain network support. Learn how to extend the system to support additional blockchains beyond Hedera and XRPL.
WebSocket Integration Guide
Learn how to implement real-time snapshot progress tracking in your applications. Set up WebSocket connections, handle progress events, and manage client-side state.
IPFS Storage Configuration
Set up decentralized storage for snapshot data with IPFS integration. Configure IPFS nodes, implement pinning strategies, and manage distributed storage for large datasets.
Examples
Advanced Snapshot Service Implementation
WebSocket Client Integration
Multi-Chain Plugin Implementation
Integration
Required Dependencies
Module Integration
Environment Configuration
Processing Flow
π Snapshot Generation Pipeline
Request Validation - Token format and authentication verification
Queue Management - Bull queue job creation with Redis persistence
Multi-Chain Processing - Plugin-based blockchain data fetching
Progress Tracking - Real-time WebSocket updates during generation
IPFS Upload - Decentralized storage of final snapshot data
Notification - Complete event broadcasting to clients
β‘ Performance Optimizations
Rate Limiting Compliance - Network-specific API batching and delays
Asynchronous Processing - Non-blocking queue-based generation
Real-time Updates - Efficient WebSocket event broadcasting
Error Recovery - Automatic retry with exponential backoff
πΈ Multi-Ledger Snapshots: Comprehensive token holder snapshot generation with support for Hedera Hashgraph and Ripple/XRP Ledger networks.
π Real-time Tracking: WebSocket-based progress monitoring with JWT authentication and automatic reconnection handling.
π Plugin Architecture: Extensible multi-chain support with standardized interfaces for easy blockchain network integration.
Built with β€οΈ by the HSuite Team Copyright Β© 2025 HSuite. All rights reserved.
Last updated