@thencc/dapi-lib
v0.0.17
Published
The NCC dAPIs SDK is a TypeScript library that provides a convenient way to access NCC's decentralized APIs. It aims to simplify the integration process and streamline the development of Typescript applications that interact with NCC's dAPIs.
Downloads
1
Keywords
Readme
NCC dAPIs Typescript SDK
The NCC dAPIs SDK is a TypeScript library that provides a convenient way to access NCC's decentralized APIs. It aims to simplify the integration process and streamline the development of Typescript applications that interact with NCC's dAPIs.
Features
- Access NCC's decentralized APIs easily
- Currently supports the following workflows:
- Peels
- Users
- TTM
- Bricks
- Impression
- LiNR
- getAccessToken
- listAccounts
- Provides TypeScript typings for improved development experience
Installation
To use the NCC dAPIs SDK, follow these steps:
- Ensure that you have Node.js (version X.X.X) and npm (version X.X.X) installed on your machine.
- Clone the repository:
git clone https://github.com/thencc/dapi-lib.git
- Navigate to the project directory:
cd dapi-lib
- Install the dependencies:
npm install
Usage
Local development
Generating JS Schemas
To generate JavaScript schemas from the main branch of NCC_dAPIs comment stubs, follow these steps:
- Make sure you have Docker installed on your machine as a prerequisite.
- Have a personal access token with the
repo
andpackage
scopes enabled. Export it as anENV
variable namedGIT_ACCESS_TOKEN
. - Run the following command:
This command will generate the JS schemas based on the comment stubs in the main branch of NCC_dAPIs repository.npm run reschema
- Now, you can add new types to
src/model.ts
such as:// Note: a new URL path, aka "/new/valid-url" in the example, // will be auto-completed if it is a valid part of the generated schema export type NewParams = paths["/new/valid-url"]["post"]["requestBody"]["content"]["application/json"]; export type NewSuccessResponse = paths["/new/valid-url"]["post"]["responses"]["200"]["content"]["application/json"]; // Note: add your new param type definition to the "ValidParams" type export type ValidParams = AccessTokenParams | NewParams;
Running Tests
To run Jest tests for the NCC dAPIs SDK, follow these steps:
- Make sure you have a running Algorand sandbox node connected to the Testnet as a prerequisite.
- Run the following command:
This command will execute the Jest test suite for the SDK, ensuring its proper functionality.npm run test
Contributing
Contributions to the NCC dAPIs SDK are welcome! If you encounter any issues or have suggestions for improvements, please create a new issue or submit a pull request.