Skip to content

hyperledger-iroha/iroha-javascript

Repository files navigation

Iroha2 JavaScript

JavaScript SDK for Iroha 2.

The Iroha 2 JavaScript library includes the following packages:

Other packages you can find in this repository:

Installation

The packages are published under the @iroha2 scope into Iroha Nexus Registry. To install them using npm/pnpm, follow these steps:

  1. Configure your package manager to fetch scoped packages from Nexus Registry:

    # FILE: .npmrc
    @iroha2:registry=https://nexus.iroha.tech/repository/npm-group/
  2. Install these packages as any other NPM package:

    npm i @iroha2/client
    yarn add @iroha2/data-model
    pnpm add @iroha2/crypto-target-web

Get Started

Check out Hyperledger Iroha 2 Tutorial that introduces you to Iroha 2 concepts and features and provides you with a step-by-step guide for JavaScript/TypeScript.

Maintenance

Make sure you have installed Node.js v16.17 or v18. As for a package manager, this project uses PNPM.

Also make sure you have installed the following version of Rust toolchain:

rustup default nightly-2023-06-25

Before working with the repository, install the necessary packages:

pnpm install

Scripts

Most tasks are defined via Jake, a JavaScript build tool. To explore available tasks, run:

pnpm jake -t

However, some tasks are defined directly in package.json and could be run with pnpm run:

  • Check or fix lint errors:

    pnpm lint
    pnpm lint --fix
  • Fix formatting:

    pnpm format:fix

Each monorepo package might have its own scripts and tasks. You can find the package details in a README for that package.

Manually update reference Iroha version

  1. Update packages/iroha-source/config.js:

    export default {
      origin: 'https://github.com/hyperledger/iroha.git',
      rev: '52dc18cd81bdc1d1906ffeecb666dd9b2eb27955',
    }
  2. Perform full-featured repo check, running:

    pnpm jake run-all-checks
  3. If something is broken, fix it!

  4. If you are going to publish updated SDK, update packages/client/README.md and packages/data-model/README.md. In the beginning they have the following note:

    This package targets hyperledger/iroha at current iroha2-lts branch, which has a hash b783f10fa7de26ed1fdd4c526bd162f8636f1a65.

    Put here a new Iroha 2 reference commit information.

SDK Compatibility Matrix Tests

There are certain integration tests that are part of the Compatibility Matrix endeavour. To read more about it, follow the client Node integration tests.