Giter VIP home page Giter VIP logo

dapi-lib's Introduction

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:

  1. Ensure that you have Node.js (version X.X.X) and npm (version X.X.X) installed on your machine.
  2. Clone the repository:
    git clone https://github.com/thencc/dapi-lib.git
  3. Navigate to the project directory:
    cd dapi-lib
  4. 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:

  1. Make sure you have Docker installed on your machine as a prerequisite.
  2. Have a personal access token with the repo and package scopes enabled. Export it as an ENV variable named GIT_ACCESS_TOKEN.
  3. Run the following command:
    npm run reschema
    This command will generate the JS schemas based on the comment stubs in the main branch of NCC_dAPIs repository.
  4. 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:

  1. Make sure you have a running Algorand sandbox node connected to the Testnet as a prerequisite.
  2. Run the following command:
    npm run test
    This command will execute the Jest test suite for the SDK, ensuring its proper functionality.

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.

dapi-lib's People

Contributors

lanidelrey avatar

Watchers

Aubrey Anderson avatar spencer cap avatar  avatar

dapi-lib's Issues

Peels endpoints

The Peels endpoints will correspond to cloud functions, and most likely be automatically handled by the OpenAPI spec. Mark this issue as resolved when they exist โ€” make a new issue for any bug or new feature.

Fix publish-docs Github workflow job

fatal: Authentication failed for 'https://github.com/thencc/NCC_dAPIs.git/'
The command '/bin/sh -c git clone https://${GIT_ACCESS_TOKEN}:@github.com/thencc/NCC_dAPIs.git /repo && rm -rf /repo/.git && rm /repo/workers/ncc-dapis/package.json && mv /repo/workers/ncc-dapis/autodocs-package.json /repo/workers/ncc-dapis/package.json && cp -R /repo/workers/ncc-dapis .' returned a non-zero code: 128

Running tests in parallel fails more than serially

Fix tests to run in parallel

To reproduce the issue:

  1. Remove the --runInBand option from the package definition of the test script. This runs the tests in parallel, which is the default configuration.
    2.npm run test

To run the tests serially, add the --runInBand option back into the package definition

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.