@hsuite/client-types
A comprehensive type system and validation library for Smart Node client operations. This library provides type definitions, interfaces, and runtime validation for client configuration and operations within the Smart Node ecosystem, supporting multiple distributed ledger networks.
Installation
Features
Type-safe client configuration interfaces - Comprehensive TypeScript interfaces for client setup
Multi-ledger support - Configuration for multiple blockchain networks (Hashgraph, Ripple, etc.)
Runtime validation - Robust validation for client options with proper error handling
Swagger/OpenAPI documentation - Automatic API documentation generation support
Comprehensive JSDoc documentation - Detailed inline documentation for all types and interfaces
Modular architecture - Separated interfaces and models for clean separation of concerns
Dependencies
Peer Dependencies
@nestjs/common
: ^10.4.2@nestjs/core
: ^10.4.2@hsuite/hashgraph-types
: ^2.0.3
Dependencies
@hsuite/nestjs-swagger
: ^1.0.3
Dev Dependencies
@compodoc/compodoc
: ^1.1.23
Usage
Basic Configuration
Multi-Ledger Configuration
API Documentation
IClient Namespace
The IClient
namespace provides interfaces and types for client operations:
IClient.IOptions
Configuration interface for Smart Node client setup:
enabled
(boolean): Controls whether the client is active and processing requestsbaseUrl
(string): The root URL for all API calls made by the Smart Node clientledgers
(Record<ChainType, ILedgerConfig>): Configuration for multiple blockchain networks
Ledger Configuration Properties:
chain
: The blockchain type (hashgraph, ripple, etc.)network
: Network environment (mainnet, testnet, etc.)credentials
: Authentication credentials specific to each chain typeoptions
: Optional network-specific configuration parameters
Client Namespace
The Client
namespace provides concrete implementations with runtime validation:
Client.Options
A class that extends _Options
with comprehensive runtime validation:
Runtime validation of all configuration parameters
Type-safe instantiation with proper error handling
Swagger/OpenAPI decorators for automatic API documentation
Environment variable validation for ledger configurations
Constructor Validation:
Validates ledger configuration completeness
Ensures baseUrl is a valid HTTP(S) URL
Throws descriptive errors for invalid configurations
Error Handling
The library provides robust error handling:
Architecture
Development
Documentation Generation
Generate comprehensive documentation using Compodoc:
Check documentation coverage:
Best Practices
Always use interfaces for type definitions - Import from
IClient
namespaceUse models for runtime validation - Instantiate
Client.Options
for validationHandle configuration errors - Wrap instantiation in try-catch blocks
Validate environment variables - Ensure required ledger configurations are present
Version
Current version: 2.0.3
Changelog
License
This package is part of the HSuite Enterprise ecosystem.
Built with ❤️ by the HbarSuite Team Copyright © 2025 HbarSuite. All rights reserved.
Last updated