/muta-sdk-js

Muta JavaScript SDK

Primary LanguageTypeScriptMIT LicenseMIT

Muta SDK

The JS/TS SDK for Muta(a High performance Blockchain framework). Allow you to interact with Muta node's GraphQL service.

Quick Start

npm

npm install graphql@14 @mutadev/muta-sdk

yarn

yarn add graphql@14 @mutadev/muta-sdk

Note: The graphql is peerDependent by @mutadev/client-raw. So we need to install it manually. To avoid multiple graphql version conflict error, make sure there was only one graphql version in our system. If you are also a library contributor dependent on graphql module, you should consider whether to peerDependeies on graphql

Usage

var sdk = require('@mutadev/muta-sdk');

var muta = new sdk.Muta();

// Muta {
//   context: {
//     chainId: '0x...',
//     consensusInterval: 3000,
//     endpoint: 'http://127.0.0.1:8000/graphql',
//     timeoutGap: 20
//   }
// }
console.log(muta);

Modules

The repo root which organized via monorepo mode, that composed of the following modules

Links

Development

  • nodejs >= 10
  • yarn

To ensure that the test passes, please enable a muta-example chain before the test

git clone https://github.com/nervosnetwork/muta-sdk-js
cd muta-sdk-js
yarn
yarn test

About Package

All modules are under the packages folder which organized with similar structure

You can also create a muta-sdk-like project based on the template

- package-name
  - src
    - index.ts # export related modules
    - foo.ts # module impl
    - foo.test.ts # unit test for this module
    - foo.e2e.ts # e2e test for this module
  - README.md # some description for this module
  - package.json
  - tsconfig.json