# muta-sdk

> Muta JavaScript SDK

Latest version **0.10.1** (published 2020-04-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install muta-sdk
pnpm add muta-sdk
yarn add muta-sdk
bun add muta-sdk
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.10.1 |
| Published | 2020-04-01 |
| First published | 2019-11-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=8.9 |
| Dependencies | 17 |
| Unpacked size | 292 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Maintainers | homura |

## Links

- npm: https://www.npmjs.com/package/muta-sdk
- Repository: https://github.com/nervosnetwork/muta-sdk-js
- npm.io page: https://npm.io/package/muta-sdk

## Dependencies (17)

- [rlp](https://npm.io/package/rlp.md) ^2.2.3
- [bip39](https://npm.io/package/bip39.md) ^3.0.2
- [debug](https://npm.io/package/debug.md) ^4.1.1
- [hdkey](https://npm.io/package/hdkey.md) ^1.1.1
- [keccak](https://npm.io/package/keccak.md) ^3.0.0
- [graphql](https://npm.io/package/graphql.md) ^14.5.8
- [secp256k1](https://npm.io/package/secp256k1.md) ^4.0.0
- [cross-fetch](https://npm.io/package/cross-fetch.md) ^3.0.4
- [graphql-tag](https://npm.io/package/graphql-tag.md) ^2.10.1
- [json-bigint](https://npm.io/package/json-bigint.md) ^0.3.0
- [randombytes](https://npm.io/package/randombytes.md) ^2.1.0
- [@types/debug](https://npm.io/package/@types/debug.md) ^4.1.5
- [bignumber.js](https://npm.io/package/bignumber.js.md) ^9.0.0
- [utility-types](https://npm.io/package/utility-types.md) ^3.9.0
- [graphql-request](https://npm.io/package/graphql-request.md) ^1.8.2
- [@types/secp256k1](https://npm.io/package/@types/secp256k1.md) ^3.5.3
- [@types/randombytes](https://npm.io/package/@types/randombytes.md) ^2.0.0

## Recent versions

- 0.10.1 (latest) — 2020-04-01
- 0.11.0-dev.4 (dev) — 2020-07-16
- 0.11.1-dev.0 (canary) — 2020-06-21
- 0.8.0-alpha.1 (alpha) — 2020-03-28
- 0.11.3-dev.0 — 2020-07-01
- 0.11.2-dev.0 — 2020-06-23
- 0.11.1-dev.2 — 2020-06-22
- 0.11.1-dev.1 — 2020-06-21
- 0.11.0-dev.3 — 2020-06-19
- 0.11.0-next.feature.1816be9 — 2020-06-18
- 0.11.0-dev.2 — 2020-06-18
- 0.11.0-dev.1 — 2020-06-03
- 0.11.0-dev.0 — 2020-05-29
- 0.11.0-alpha.14 — 2020-04-30
- 0.11.0-alpha.13 — 2020-04-29
- … 23 more at https://npm.io/package/muta-sdk/versions

## README

# Muta SDK(WIP)

The JS/TS SDK for [Muta](https://github.com/nervosnetwork/muta)(a High performance Blockchain framework). Allow you interact with Muta node's GraphQL service.

## Quick Start

```shell
npm install muta-sdk
```

## Example

The following code will shows

1. How to interact with `#[read]` service
2. How to sign a transaction
3. How to sendTransaction

```js
async function main() {
  // get metadata from the chain
  const metadataResponse = await client.queryServiceDyn({
    method: 'get_metadata',
    payload: '',
    serviceName: 'metadata',
  });

  console.log(metadataResponse);

  // Accounts with permission to modify metadata
  const admin = Muta.accountFromPrivateKey('0x...');

  // Preparing transaction
  const tx = await client.composeTransaction({
    method: 'update_metadata',
    payload: {
      // ...
    },
    serviceName: 'metadata',
  });
  const signedTx = admin.signTransaction(tx);
  const txHash = await client.sendTransaction(signedTx);
  const receipt = await client.getReceipt(txHash);

  console.log(receipt);
}
```

## Create Service Binding

Before we create our custom binding, learn about what is a [service](https://github.com/nervosnetwork/muta-docs) in Muta.
We'll still use [AssetService](https://github.com/HuobiGroup/huobi-chain/tree/master/services/asset/src) as an [example](https://github.com/homura/huobi-chain-sdk-js/blob/develop/src/services/AssetService.ts).

## Links

- [API Documentation](https://nervosnetwork.github.io/muta-sdk-js)
- [Muta](https://github.com/nervosnetwork/muta)

## Development

- nodejs >= 10
- typescript >= 3.7
- yarn

```shell
git clone https://github.com/nervosnetwork/muta-sdk-js
cd muta-sdk-js
yarn
yarn start
```

---
_Source: https://npm.io/package/muta-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
