Awesome
Iroha2 JavaScript
JavaScript SDK for Iroha 2.
The Iroha 2 JavaScript library includes the following packages:
@iroha2/client
submits requests to the Iroha peer@iroha2/crypto-*
:@iroha2/crypto-core
provides unified crypto interface for Iroha 2@iroha2/crypto-target-node
provides compiled crypto WASM for the Node.js environment@iroha2/crypto-target-web
provides compiled crypto WASM for native Web (ESM)@iroha2/crypto-target-bundler
provides compiled crypto WASM to use with bundlers such as Webpack
@iroha2/data-model
provides SCALE codecs for Iroha 2 data model
Other packages you can find in this repository:
@iroha2/docs-recipes
contains code samples used in documentation@iroha2/data-model-schema
contains Iroha 2 Schema@iroha2/i64-fixnum
handles operations with fixed-point numbers
Installation
The packages are published under the @iroha2
scope into Iroha Nexus Registry. To install them using npm
/pnpm
, follow these steps:
-
Configure your package manager to fetch scoped packages from Nexus Registry:
# FILE: .npmrc @iroha2:registry=https://nexus.iroha.tech/repository/npm-group/
-
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
-
Update
packages/iroha-source/config.js
:export default { origin: 'https://github.com/hyperledger/iroha.git', rev: '52dc18cd81bdc1d1906ffeecb666dd9b2eb27955', }
-
Perform full-featured repo check, running:
pnpm jake run-all-checks
-
If something is broken, fix it!
-
If you are going to publish updated SDK, update
packages/client/README.md
andpackages/data-model/README.md
. In the beginning they have the following note:This package targets
hyperledger/iroha
at currentiroha2-lts
branch, which has a hashb783f10fa7de26ed1fdd4c526bd162f8636f1a65
.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.