SDK architecture
The SDK is thoughtfully organized into logical components. At its core are two main client types: REST for API endpoints and JSON-RPC for lower level blockchain interactions. These are complemented by service layers that group related functionality together. The architecture follows the principle of separation of concerns. Network communication is handled by the base clients, while business logic is organized into services. This design makes the SDK both powerful and maintainable, as new features can be added without disrupting existing functionality. Internally, the SDK uses interfaces extensively, making it easy to mock components for testing or create custom implementations for specific needs.| Client Type | Description |
|---|---|
REST Client | Calls api.autheo.com endpoints over HTTP (GET/POST) |
JSON-RPC Client | Calls Ethereum-like JSON-RPC methods on Autheo nodes |
ClientRPC | Internal struct for low level RPC operations |
ClientWithRPC | Mid-level wrapper over ClientRPC |
TokenService, BlockService, etc. | Service layers over the base clients |
Service layers overview
Service layers provide a more organized way to access SDK functionality. Instead of having all methods on a single client object, related operations are grouped into services. This approach improves discoverability and reduces cognitive load. TheTokenService, for example, collects all token related operations in one place. This includes methods for querying token balances, transfers, and contract information. Similarly, BlockService focuses exclusively on block-related queries.
These services aren’t separate entities but rather different facets of the same underlying client. They share connection pools and configuration, ensuring efficient resource usage while providing a cleaner API surface.
The Autheo SDK internally wraps grouped functionalities into services for cleaner API usage.