open-index/open-npm huggingface dataset:
npm package: @herajs/client
Description: Javascript client framework for aergo
Author: aergo team and contributors
Latest version: 2.1.3

# @herajs/client

[![npm](https://img.shields.io/npm/v/@herajs/client.svg)](https://www.npmjs.com/package/@herajs/client) [![readthedocs](https://readthedocs.org/projects/herajs/badge/)](https://herajs.readthedocs.io/)

- [Documentation](https://herajs.readthedocs.io/)
- [Changelog](./CHANGELOG.md)

This package includes the API client and common classes and utils.

This package supports both Node.js and Web platforms. Please refer to the documentation how to select the platform.

## Quick start

```console
npm install @herajs/client
```

You can import the module both as CommonJS (require) and ES module (import).

```javascript
import AergoClient from '@herajs/client';
let aergo = new AergoClient();
aergo.blockchain().then(result => {
    console.log('Current state', result);
});
```

Note that this by default imports the Node.js version which is not compatible with browsers. If you target web browsers, either `import AergoClient from '@herajs/client/dist/herajs.js';` or create an alias in your bundler configuration. Many bundlers like Webpack automatically pick the browser version, so you don't need to configure anything.

You can also directly import the pre-built bundle in HTML using `<script src="herajs/dist/herajs.min.js"></script>` and use the global `herajs` variable.

## Contribute

### Setup

Clone this repository and run

```console
npm install
```

### Scripts

Run tests (requires a local Aergo node running in `--testmode`, listening on port `7845`).

```console
npm run test
```

Regenerate GRPC type definitions

```console
npm run grpc
```

Development build with auto-update

```console
npm run dev
```

Build all targets for distribution

```console
npm run build
```
npm package: @herajs/crypto
Description: Cryptography tools for aergo
Author: AERGO team and contributors
Latest version: 2.1.3

# Multi-purpose javascript crypto library for aergo

[![npm](https://img.shields.io/npm/v/@herajs/crypto.svg)](https://www.npmjs.com/package/@herajs/crypto) [![readthedocs](https://readthedocs.org/projects/herajscrypto/badge/)](https://herajscrypto.readthedocs.io/)

- [Documentation](https://herajscrypto.readthedocs.io/)

It is used by Aergo dapps to manage keys and sign transactions offline.

Features:

- Key generation and importing
- Hashing
- Signing
- Simple AES-GCM encryption


## How to use

```shell
npm install --save @herajs/crypto
```

### Transaction signing

```js
import { createIdentity, signTransaction, hashTransaction } from '@herajs/crypto';

async () => {
    const identity = createIdentity();
    const tx = {
        nonce: 1,
        from: identity.address,
        to: identity.address,
        amount: '100 aer',
        payload: '',
    };
    tx.sign = await signTransaction(tx, identity.keyPair);
    tx.hash = await hashTransaction(tx);
    console.log(JSON.stringify(tx));
}()
```

### Arbitrary message signing

```js
import { createIdentity, signMessage, verifySignature, publicKeyFromAddress } from '@herajs/crypto';

async () => {
    const identity = createIdentity();
    const msg = Buffer.from('hello');
    const signature = await signMessage(msg, identity.keyPair);
    const pubkey = publicKeyFromAddress(identity.address);
    const check = await verifySignature(msg, pubkey, signature);
    console.log(check);
}()
```
npm package: @herajs/ledger-hw-app-aergo
Description: Ledger Hardware app for Aergo
Author: AERGO team and contributors
Latest version: 2.1.3

# Ledger Hardware Wallet Aergo JavaScript bindings

[![npm](https://img.shields.io/npm/v/@herajs/ledger-hw-app-aergo.svg)](https://www.npmjs.com/package/@herajs/ledger-hw-app-aergo)

## How to use

```shell
npm install --save @herajs/ledger-hw-app-aergo
```

### Getting address and signing transaction

```js
import LedgerAppAergo from '@herajs/ledger-hw-app-aergo';
// Pick a transport. See https://github.com/LedgerHQ/ledgerjs
import Transport from '@ledgerhq/hw-transport-node-hid';
import AergoClient, { Tx } from '@herajs/client';

async () => {
    const aergo = new AergoClient();
    const transport = await Transport.create(3000, 1500);
    const app = new LedgerAppAergo(transport);
    const path = "m/44'/441'/0'/0/" + i;
    const address = await app.getWalletAddress(path);
    const tx = {
        from: address,
        to: address,
        chainIdHash: await aergo.getChainIdHash(),
        type: Tx.Type.TRANSFER,
        nonce: await aergo.getNonce(address) + 1,
        limit: 100000,
        nonce: 1,
    };
    const result = await app.signTransaction(tx); // { hash, signature }
    tx.sign = result.signature;
    tx.hash = await hashTransaction(tx, 'bytes');
    const txHash = await aergo.sendSignedTransaction(tx);
    const txReceipt = await aergo.waitForTransactionReceipt(txHash); // { status: 'SUCCESS', blockno: number, ... }
}()
```
npm package: @herajs/wallet
Description: SDK for making Aergo wallet applications
Author: AERGO and contributors
Latest version: 2.1.3

# Herajs Wallet SDK

[![npm](https://img.shields.io/npm/v/@herajs/wallet.svg)](https://www.npmjs.com/package/@herajs/wallet) [![readthedocs](https://readthedocs.org/projects/herajswallet/badge/)](https://herajswallet.readthedocs.io/)

- [Documentation](https://herajswallet.readthedocs.io/)

This package includes everything you need to build a wallet application on Aergo.
It is useful for other kinds of dapps, too.

Features:

- Manage keys
- Easy to use interface for sending transactions
- Track accounts for new transactions (using a full node or other external APIs)
- Sign and verify
- Integrates with storages (supported out of the box: IndexedDB (for browsers), LevelDB (for Node.js), and in-memory storage)

In contrary to @herajs/client, which includes just the API client and useful classes and helpers,
@herajs/wallet includes managers that can keep, coordinate, and optionally persist state.

**Work in progress, please check back later for release**

## Getting started

Work in progress

## Development

Based on https://github.com/graup/rollup-typescript-babel

### Building the repo

```shell
npm run build
```

### Building only types

```shell
npm run build:types
```

### Type-Checking the repo

```shell
npm run type-check
```

And to run in --watch mode:

```shell
npm run type-check:watch
```