@alphea-dev/blockexplorer-sharedtypes
v1.0.0
Published
Shared TypeScript types for Aphexplorer services
Downloads
11
Maintainers
Readme
Shared Types for Aphexplorer
TypeScript type definitions shared across all Aphexplorer services.
Overview
This package provides common interfaces and types for:
- API - REST and GraphQL request/response types
- Blockchain - Block, transaction, address, and contract types
- Database - Entity interfaces and configuration types
- Messages - Kafka message formats for inter-service communication
Installation
npm install @aphexplorer/shared-typesUsage
import {
BlockData,
TransactionData,
APIResponse
} from '@aphexplorer/shared-types';
// Use in your service
const block: BlockData = {
hash: '0x...',
number: 12345,
timestamp: Date.now()
};
const response: APIResponse<BlockData> = {
success: true,
data: block
};Development
Setup
npm installBuild
npm run buildDevelopment with Watch Mode
npm run devPackage Structure
src/
├── api/ # API request/response types
├── blockchain/ # Blockchain entity types
├── database/ # Database configuration types
├── messages/ # Kafka message formats
└── index.ts # Main exportsType Categories
API Types
APIResponse<T>- Standard API response wrapperAPIError- Error response format- Request/response types for all endpoints
Blockchain Types
BlockData- Block informationTransactionData- Transaction detailsAddressData- Address informationContractData- Smart contract data
Message Types
BlockMessage- Block data for KafkaTransactionMessage- Transaction data for KafkaContractEventMessage- Contract event data
Versioning
This package follows Semantic Versioning:
- Patch (1.0.X) - Add optional fields, fix typos
- Minor (1.X.0) - Add new types, extend interfaces
- Major (X.0.0) - Breaking changes, remove fields
Publishing
# Update version
npm version patch|minor|major
# Publish to registry
npm publishServices Using This Package
- aphexplorer-api - REST/GraphQL API service
- aphexplorer-agent - Blockchain data collection
- aphexplorer-ingestion - Data processing service
Contributing
- Add new types to appropriate category in
src/ - Export from
src/index.ts - Update version in
package.json - Update CHANGELOG.md with changes
- Test with dependent services before publishing
License
MIT
