NOTE: this is still a draft, so it's subject to changes. This alert will be removed as soon as final version will be available

πŸ“’@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/snapshots

Basic 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

Event Type
Description
Payload

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

Network
Token Types
Features
Rate Limits

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

  1. Request Validation - Token format and authentication verification

  2. Queue Management - Bull queue job creation with Redis persistence

  3. Multi-Chain Processing - Plugin-based blockchain data fetching

  4. Progress Tracking - Real-time WebSocket updates during generation

  5. IPFS Upload - Decentralized storage of final snapshot data

  6. 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