Skip to content

Cypherock/sdk

Repository files navigation

Cypherock SDK

Table of contents

  1. Prerequisites
  2. Understanding the directory structure
  3. Development Setup
  4. Local setup
  5. Other commands
  6. Contributing

Prerequisites

Before you get started, please make sure you have the following setup -

  • Node.js v16 (use nvm if already using a different Node version).
  • pnpm
    npm i -g pnpm
    
  • Install protoc
  • Python >=3.6
    • Download and install the latest Python version.
    • Run npm config set python /path/to/executable/python to configure.
  • Install and set up node-gyp -
  • pip3 install -r requirements.txt

Understanding the directory structure

├── apps                # Contains all the applications
│   └── browser             # Browser application to test sdk
│   └── node                # Nodejs application to test sdk
│   └── docs                # Documentation for sdk
│
├── packages            # Holds packages required for sdk
│   └── app-manager         # Manager application containing all
│   └── core                # Handles low level communication protocol necessary for device communication
│   └── hw-hid              # Handles device connection with HID protocol
│   └── hw-serialport       # Handles device connection with SerialPort protocol
│   └── hw-webusb           # Handles device connection with WebUSB protocol
│   └── interfaces          # Contains common interfaces between other packages
│   └── util-*              # Common utilities shared between packages
│
├── submodules          # Contains all submodules required for sdk
│   └── common              # Common configs and protobufs shared between device and sdk
│
├── package.json

Development Setup

The repository contains submodules, which need to be downloaded as well. Clone the repository along with its submodules using -

git clone [email protected]:Cypherock/sdk.git --recurse-submodules

Local setup

Once you have cloned the repository, follow these steps -

pnpm i        # Install packages
pnpm build        # build all modules

Other commands

  • pnpm start:node: Start demo app on nodejs
  • pnpm start:browser: Start demo app on browser
  • pnpm test: Run all tests
  • pnpm lint: Lint all files
  • pnpm pretty: Prettify all files

Turorepo Remote Caching

  • Create a new file .turbo/config.json and add the following content -
    {
      "teamid": "team_<TEAMID>",
      "apiurl": "<CACHE API URL>"
    }
  • Set the TURBO_TOKEN=yourToken environment variable

Contributing

Please consider making a contribution to the project. Contributions can include bug fixes, feature proposal, or optimizations to the current code.