Concrete SDK

The Concrete SDK is an internal interface designed to facilitate API interactions. It provides a set of utility functions, scopes, and methods to streamline communication with various endpoints.

SDK Structure

The SDK is organized into different files and directories:

1. src/core/sdk/scope.abstract.ts

This file contains the abstract class ConcreteApiScope , serving as the base for different scopes in the SDK.

It includes methods for common HTTP request types (get, post, patch, put, delete) and binds these methods to the Concrete API instance.

2. src/core/sdk/index.tsx

This is the main entry point of the SDK. It exports types such as Endpoint and Method.

Additionally, it includes utility functions like getConcreteApiError and the main ConcreteApi class, responsible for managing authentication, API communication, and various scopes.

3. src/core/sdk/scopes

This directory holds individual scope files, each representing a specific functionality within the Concrete backend or blockchain service providers.

Examples include AuthScope, BorrowScope, OracleScope, and others.

Each scope extends the ConcreteApiScope and specializes in a particular set of API endpoints.

4. src/core/sdk/scopes/{functionalityScope}.ts

These files define specific functionality scopes within the Concrete backend or blockchain service providers. Each file includes methods and logic related to a particular aspect of the network, enhancing modularity and maintainability.

For example, Borrow functionality.:

  • BorrowScope (src/core/sdk/scopes/borrow.ts):

The BorrowScope class extends ConcreteApiScope and represents the Borrow-related API endpoints. It includes a method for fetching networks (getNetworks).

5. src/core/sdk/scopes/index.ts

This file acts as an index for functionality scopes, exporting all the available scopes. It simplifies the process of importing and using scopes in other parts of the application.

Last updated