/concordium-node-sdk-js

TypeScript SDK for using the Concordium blockchain

Primary LanguageTypeScriptApache License 2.0Apache-2.0

Concordium SDK for Javascript

Contributor Covenant

Wrappers for interacting with the Concordium node.

Table of Contents:

Documentation

Please see the documentation for more information

Packages

A collection of useful packages for building typescript/javascript applications within for the Concordium blockchain.

  • @concordium/web-sdk: Contains the actual SDK, which can used in both a web and NodeJS environment.

  • @concordium/rust-bindings: Contains bindings for Rust code, which is used by the SDK through WASM. This package is a utility package that should not be used directly, only through the usage of the SDK.

  • @concordium/ccd-js-gen: A library and CLI for generating smart contract clients for TypeScript and JavaScript

  • @concordium/wallet-connectors: Interfaces for interacting with wallets along with implementations for Browser Wallet and WalletConnect (v2). The library has no dependencies to any UI framework.

  • @concordium/react-components: React components and hooks for implementing features commonly needed by dApps. The components only manage React state and pass data to application components - no actual HTML is being rendered.

Install/updating dependencies

To install/update dependencies for the project, run

git submodule update --init --recursive

and

yarn

MacOS arm64

It may be necessary to install Xcode when installing dependencies on a mac.

On a mac with an arm64 processor, it might also be required to explicitly set the target architecture of dependencies to x64, as not all dependencies are available for the new mac processors. This is done by replacing the yarn command with

npm_config_target_arch=x64 yarn

Build

Building for a release

To build the project run

yarn build:all

This will build all the subprojects.

Building for development

To build the project quickly during development run

yarn build-dev:all

This will build all the subprojects. Note that this skips generating the grpc API and optimizing the wasm modules.

Making a new release

The following describes the requirements for creating a new release for each of the packages contained in this repository.

SDK

  • Bump the version in package.json.
  • Update the CHANGELOG describing the changes made.
  • Create a pull request to merge the changes into the target branch.
  • Pull and tag the merge commit for the release.
    • Tag should be sdk/x.y.z.
  • Push the tag
  • Have another code owner accept the deployment

rust-bindings

  • Bump the version in package.json.
  • Update the CHANGELOG describing the changes made.
  • Update the dependency to rust-bindings in the sdk
  • Update the CHANGELOG in the sdk
    • Add a change entry: Bumped @concordium/rust-bindings to x.y.z.
  • Create a pull request to merge the changes into the target branch.
  • Pull and tag the merge commit for the release.
    • Tag should be rust-bindings/x.y.z and sdk/x.y.z respectively.
  • Push the tags
  • Have another code owner accept the deployment

ccd-js-gen

  • Bump the version in package.json.
  • Update the CHANGELOG describing the changes made.
  • Create a pull request to merge the changes into the target branch.
  • Pull and tag the merge commit for the release.
    • Tag should be ccd-js-gen/x.y.z.
  • Push the tag
  • Have another code owner accept the deployment

wallet-connectors

  • Bump the version in package.json.
  • Update the CHANGELOG describing the changes made.
  • Create a pull request to merge the changes into the target branch.
  • Pull and tag the merge commit for the release.
    • Tag should be wallet-connectors/x.y.z.
  • Push the tag
  • Have another code owner accept the deployment

react-components

  • Bump the version in package.json.
  • Update the CHANGELOG describing the changes made.
  • Create a pull request to merge the changes into the target branch.
  • Pull and tag the merge commit for the release.
    • Tag should be react-components/x.y.z.
  • Push the tag
  • Have another code owner accept the deployment

Test

An automatic test suite is part of this project, and it is run by executing:

yarn test:all

This will run the tests for each package.

Note that the tests for nodejs require a locally running concordium-node on the testnet. Otherwise the tests will fail.