Type definitions and interfaces for the HbarSuite Hedera Hashgraph integration.
The @hsuite/hashgraph-types
package provides a comprehensive set of TypeScript type definitions, interfaces, models, and namespaces for interacting with the Hedera Hashgraph network. It serves as the foundational type system for the HbarSuite ecosystem, ensuring type safety and providing clear contracts for Hedera network operations.
-
🏗️ Comprehensive Type System
- Complete TypeScript definitions for all Hedera operations
- Strongly typed interfaces for network interactions
- Extensive model implementations with decorators
-
🌐 Transaction Management
- Detailed transaction type definitions
- Transaction identity and authentication structures
- Status tracking and result handling
-
💰 Account & Token Operations
- Account balance tracking
- Token balance management (fungible and non-fungible)
- Multi-token support
-
🔐 Identity & Security
- Private key management
- DID (Decentralized Identifier) support
- Multi-signature capabilities
-
📡 Network Integration
- Mirror node interaction types
- Operator account definitions
- Network configuration interfaces
-
🛠️ Utility & Commons
- Shared utility types
- Common constants and helpers
- RESTful API interfaces
npm install @hsuite/hashgraph-types
import { IHashgraph, Hashgraph } from '@hsuite/hashgraph-types';
// Using interfaces
const operatorConfig: IHashgraph.IOperator = {
accountId: "0.0.123456",
privateKey: "302e020100300506032b657004220420..."
};
// Using models
const operator = new Hashgraph.Operator(operatorConfig);
// Transaction details
const txDetails = new Hashgraph.TransactionDetails({
transactionId: "[email protected]",
status: "SUCCESS",
consensusTimestamp: "2023-01-01T00:00:00.000Z"
});
// Transaction identity
const txIdentity = new Hashgraph.TransactionIdEntity({
signerPublicKey: "302a300506032b6570032100...",
signature: "signed_transaction_bytes"
});
// Account balance management
const accountBalance = new Hashgraph.AccountBalance({
hbarBalance: 100,
tokens: new Map([["0.0.123456", 1000]])
});
// Token balance tracking
const tokenBalance = new Hashgraph.TokenBalance({
tokenId: "0.0.123456",
balance: 1000,
decimals: 8
});
// Mirror node configuration
const mirrorNode = new Hashgraph.MirrorNode({
endpoint: "api.mirrornode.hedera.com",
apiKey: "your-api-key"
});
// Network options
const options = new Hashgraph.Options({
maxTransactionFee: 1000000,
transactionValidDuration: 120
});
The library is organized into several key namespaces:
IHashgraph
: Root namespace for interfacesHashgraph
: Root namespace for model implementationsHashgraph.DID
: DID-related functionalityHashgraph.Restful
: RESTful API interactionsHashgraph.Commons
: Shared utilities and constantsHashgraph.Ledger
: Ledger operations
Each namespace provides a clean and intuitive API for its specific domain while maintaining strong type safety.
To generate and view the detailed API documentation:
yarn compodoc
To include coverage information:
yarn compodoc:coverage
All types and interfaces are extensively documented with JSDoc comments, providing:
- Detailed descriptions
- Usage examples
- Parameter descriptions
- Return type information
This package is part of the HbarSuite ecosystem and is covered by its license terms.
Built with ❤️ by the HbarSuite Team
Copyright © 2024 HbarSuite. All rights reserved.