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/client - Client Service Module

🌐 Comprehensive NestJS client module for Web3 authentication and multi-ledger communication

A powerful client service module that provides Web3-based authentication flow, dynamic node connection management, and network resilience with multi-chain support for HSuite applications.


Table of Contents


Quick Start

Installation

npm install @hsuite/client

Basic Setup

Use Client Service


Architecture

Core Components

πŸ” Authentication Flow

  • Web3 Authentication - Cryptographic signing with private key management

  • Session Management - Cookie jar support for session persistence

  • Credential Storage - Secure storage of Web3 credentials

🌐 Network Management

  • Dynamic Node Connection - Automatic failover and node discovery

  • Multi-Chain Support - Hedera, Ripple, and other blockchain networks

  • Health Monitoring - Periodic connection health checks

⚑ HTTP Client

  • Axios Integration - Configured HTTP client with interceptors

  • Request/Response Handling - Automatic authentication header injection

  • Error Handling - Network resilience with retry mechanisms

Module Structure


API Reference

ClientModule

Static Methods

forRootAsync(options: ClientModuleAsyncOptions): Promise<DynamicModule>

Configures the client module with async dependency injection and global scope.

Configuration Interface:

ClientService

Properties

login: Auth.Credentials.Web3.Response.Login

  • Current Web3 login credentials and authentication state

  • Returns: Web3 authentication response with wallet details

operator: ISmartNetwork.IOperator.IEntity

  • Current operator information for blockchain transactions

  • Returns: Operator entity with account details and permissions

axios: AxiosInstance

  • Configured axios instance for making authenticated HTTP requests

  • Returns: Axios instance with auth headers and interceptors

Methods

onModuleInit(): Promise<void>

  • Initializes client connection and performs Web3 authentication

  • Called automatically during module startup

  • Throws: Error if authentication or connection fails


Guides

Web3 Authentication Setup

Configure Web3 authentication with wallet integration and signature verification. Set up blockchain-based authentication flows and credential management.

Multi-Ledger Configuration

Set up support for multiple blockchain networks with failover capabilities. Configure Hedera Hashgraph, Ripple/XRP Ledger, and other supported networks.

HTTP Client Usage

Learn how to use the configured axios instance for authenticated API calls. Implement request interceptors, error handling, and retry logic.


Examples

Complete Module Configuration

Service Usage Patterns

Factory Configuration Pattern


Integration

Required Dependencies

Environment Variables

Network Health Monitoring


πŸ” Security Note: Keep private keys and credentials secure. Use environment variables and never commit sensitive data to version control.

⚑ Performance Tip: The client service automatically handles connection pooling and request retry logic for optimal performance across multiple blockchain networks.

Built with ❀️ by the HSuite Team Copyright © 2025 HSuite. All rights reserved.

Last updated