# @bnb-chain/zkbnb-js-sdk

> zkbnb JavaScript SDK

Latest version **4.8.0** (published 2023-06-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @bnb-chain/zkbnb-js-sdk
pnpm add @bnb-chain/zkbnb-js-sdk
yarn add @bnb-chain/zkbnb-js-sdk
bun add @bnb-chain/zkbnb-js-sdk
```

## Health

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

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

Warnings: low downloads; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.8.0 |
| Published | 2023-06-16 |
| First published | 2022-11-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16.0.0 |
| Dependencies | 3 |
| Unpacked size | 34.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | robot-ux |
| Keywords | zkbnb, crypto |

## Links

- npm: https://www.npmjs.com/package/@bnb-chain/zkbnb-js-sdk
- Repository: https://github.com/bnb-chain/zkbnb-js-sdk
- Homepage: https://github.com/bnb-chain/zkbnb-js-sdk#readme
- Issues: https://github.com/bnb-chain/zkbnb-js-sdk/issues
- npm.io page: https://npm.io/package/@bnb-chain/zkbnb-js-sdk

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [shelljs](https://npm.io/package/shelljs.md) ^0.8.5
- [@types/node](https://npm.io/package/@types/node.md) ^18.13.0

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 4.8.0 (latest) — 2023-06-16
- 4.7.0 — 2023-06-16
- 4.6.0 — 2023-06-16
- 4.5.0 — 2023-05-04
- 4.4.1 — 2023-04-04
- 4.4.0 — 2023-03-31
- 4.3.0 — 2023-02-20
- 4.2.0 — 2023-02-14
- 4.1.0 — 2022-12-07
- 4.0.0 — 2022-11-29

## README

<p align="center">
  <a href="https://www.npmjs.com/package/@bnb-chain/zkbnb-js-sdk"><img src="https://img.shields.io/npm/v/@bnb-chain/zkbnb-js-sdk" alt="Version"></a>
  <a href="https://www.npmjs.com/package/@bnb-chain/zkbnb-js-sdk"><img src="https://img.shields.io/npm/l/@bnb-chain/zkbnb-js-sdk" alt="License"></a>
</p>

# ZkBNB JavaScript SDK 

> [Go SDK](https://github.com/bnb-chain/zkbnb-go-sdk)

The ZkBNB JavaScript SDK provides a thin wrapper around thin all the apis provided by ZkBNB, including a simple key manager for signing txs and sending signed txs to ZkBNB.

## Install

Using npm:

```bash
> npm install @bnb-chain/zkbnb-js-sdk
```

Using yarn:

```bash
> yarn add @bnb-chain/zkbnb-js-sdk
```

Using pnpm:

```bash
> pnpm add @bnb-chain/zkbnb-js-sdk
```

Using jsDelivr CDN:

```html
<script src="https://cdn.jsdelivr.net/npm/@bnb-chain/zkbnb-js-sdk/dist/web/zk.js"></script>
```

Using unpkg CDN:

```html
<script src="https://unpkg.com/@bnb-chain/zkbnb-js-sdk/dist/web/zk.js"></script>
```

## Usage

### Browser

Use directly in the browser via script tag:

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <script src="https://cdn.jsdelivr.net/npm/@bnb-chain/zkbnb-js-sdk/dist/web/zk.js"></script>
</head>
<body>
  <script>
    const client = new Zk.Client('http://172.22.41.67:8888');

    (async () => {
      const res = await client.getAccountInfoByAccountIndex(1);
      console.log(res)
    })()
  </script>
</body>
</html>
```

### ESM

If you use module bundler such as [Webpack](https://webpack.js.org/), [Rollup](https://rollupjs.org/guide/en/), etc:

```typescript
import { Client } from '@bnb-chain/zkbnb-js-sdk';

const client = new Client('http://172.22.41.67:8888');

(async () => {
  const res = await client.getAccountInfoByAccountIndex(1);
  console.log(res)
})()
```

### CJS

Using SDK in Nodejs:

```javascript
const { Client } = require('@bnb-chain/zkbnb-js-sdk');

const client = new Client('http://172.22.41.67:8888');

(async () => {
  const res = await client.getAccountInfoByAccountIndex(1);
  console.log(res)
})()
```

## ZkBNB Crypto API

The wrapper for [zkbnb Crypto](https://github.com/bnb-chain/zkbnb-crypto).

## Usage

Because of [WASM](https://webassembly.org/) different usage scenarios, there are two packages:

### run on Node.js

```javascript
const { ZkCrypto } = require('@bnb-chain/zkbnb-js-sdk/zkCrypto');

console.log('getEddsaPublicKey:', ZkCrypto.getEddsaPublicKey('12312123123'))
```

### run on browser

```javascript
import { ZkCrypto } from '@bnb-chain/zkbnb-js-sdk/zkCrypto/web';

;(async () => {
  const { getEddsaPublicKey } = await ZkCrypto();
  console.log('getEddsaPublicKey:', getEddsaPublicKey('12312123123'));
})();
```

## CHANGELOG

[CHANGELOG](./docs/CHANGELOG.md)

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