open-index/open-npm huggingface dataset:
npm package: @plugjs/build
Description: Simple shared build using PlugJS
Author: Juit Developers
Latest version: 0.6.91

Simple shared build using PlugJS
================================

This repository contains a basic, default build system created with PlugJS.

The overall setup does the following:
* transpiles all TypeScript sources to ESM and CommonJS modules
* type-checks all TypeScript sources and produces `.d.ts` type definitions
* runs unit tests using the `Expect5` framework
* lints all sources with ESLint v9 and the PlugJS ESlint Plugin
* collects coverage and produces an HTML report from it.

To get started, simply run `npx '@plugjs/build'` in an empty directory. It
will create the required project layout and sample files.

```bash
$ npx '@plugjs/build'
$ npm install
$ npm run build
```

* [Copyright Notice](NOTICE.md)
* [License](LICENSE.md)
npm package: @plugjs/cov8
Description: V8 Coverage Plugin for the PlugJS Build System ==============================================
Author: Juit Developers
Latest version: 0.6.102

V8 Coverage Plugin for the PlugJS Build System
==============================================

This plugin analyzes the output of NodeJS V8 Coverage files and produces a
report (on console and as HTML) outlining the coverage of source files.

* [Copyright Notice](https://github.com/plugjs/plug/blob/main/NOTICE.md)
* [License](https://github.com/plugjs/plug/blob/main/LICENSE.md)
npm package: @plugjs/cov8-html
Description: Single-page-app to browse Cov8 reports
Author: Team Juit
Latest version: 0.1.167

PlugJS Cov8 HTML Report
=======================

This package exports a simple HTML file (a single-page-app created with Vue 3)
rendering our coverage reports.

* [Copyright Notice](NOTICE.md)
* [License](LICENSE.md)
npm package: @plugjs/eslint
Description: ESLint Plugin for the PlugJS Build System =========================================
Author: Juit Developers
Latest version: 0.6.102

ESLint Plugin for the PlugJS Build System
=========================================

This plugin uses ESLint v9 to analyize and produce linting report on sources.

* [Copyright Notice](https://github.com/plugjs/plug/blob/main/NOTICE.md)
* [License](https://github.com/plugjs/plug/blob/main/LICENSE.md)
npm package: @plugjs/eslint-plugin-vue
Description: Shared ESLint configurations and extras for Vue
Author: Team Juit
Latest version: 0.2.4

PlugJS ESLint (v9) Shared Configuration for Vue
===============================================

This package exports simple configurations for linting our Vue projects.

Just add in your `eslint.config.mjs` something similar to:

```javascript
import configurations from '@plugjs/eslint-plugin-vue'

export default [
  ...configurations,

  // ===== DEFINE THE LOCATION OF OUR TSCONFIG.JSON FILES ======================
  {
    name: 'local/options',

    languageOptions: {
      parserOptions: {
        createDefaultProgram: true,
        project: [
          './tsconfig.json',
          './tsconfig.app.json',
          './tsconfig.node.json',
        ],
      },
    },
  },

  // ===== PROJECT LOCAL RULES =================================================
  // Add any extra rule not tied to a specific "files" pattern here, e.g.:
  // {
  //   name: 'local/rules',
  //
  //   rules: {
  //     'camelcase': 'off',
  //   },
  // },

  // ===== IGNORED FILES =======================================================
  // REMEMBER! Ignores *must* be in its own configuration, they can not coexist
  // with "rules", "languageOptions", "files", ... or anything else, otherwise
  // ESLint will blaantly ignore the ignore files!
  {
    name: 'local/ignores',

    ignores: [
      'dist/',
      'public/',
    ],
  },
]
```


Legal Stuff
-----------

* [Copyright Notice](NOTICE.md)
* [License](LICENSE.md)
npm package: @plugjs/expect5
Description: Unit Testing for the PlugJS Build System ========================================
Author: Juit Developers
Latest version: 0.6.102

Unit Testing for the PlugJS Build System
========================================

This plugin provides both a test runner (somewhat similar to
[Mocha](https://www.npmjs.com/package/mocha)) and an assertion framework
(heavily inpired by [Chai](https://www.npmjs.com/package/chai) and
[Jasmine](https://www.npmjs.com/package/jasmine)), but supports TypeScript
out of the box (without the need to compile tests).

* [Copyright Notice](https://github.com/plugjs/plug/blob/main/NOTICE.md)
* [License](https://github.com/plugjs/plug/blob/main/LICENSE.md)
npm package: @plugjs/plug
Description: PlugJS Build System ===================
Author: Juit Developers
Latest version: 0.6.102

PlugJS Build System
===================

The core module of the PlugJS build system.

* [Copyright Notice](https://github.com/plugjs/plug/blob/main/NOTICE.md)
* [License](https://github.com/plugjs/plug/blob/main/LICENSE.md)
npm package: @plugjs/tsd
Description: Zip File Plugin for the PlugJS Build System ===========================================
Author: Juit Developers
Latest version: 0.6.102

Zip File Plugin for the PlugJS Build System
===========================================

This plugin wraps [TSD](https://www.npmjs.com/package/tsd) to allow testing
of TypeScript type definitions.

* [Copyright Notice](https://github.com/plugjs/plug/blob/main/NOTICE.md)
* [License](https://github.com/plugjs/plug/blob/main/LICENSE.md)
npm package: @plugjs/tsrun
Description: A simple TypeScript runner --------------------------
Author: Juit Developers
Latest version: 0.6.47

A simple TypeScript runner
--------------------------

Used extensively by the [PlugJS Build System](https://github.com/plugjs/plug),
`tsrun` is an extremely simple (but fast) script runner for TypeScript
supporting **EcmaScript** modules _and_ **CommonJS** modules.

Used as a command line utility, it offers few options:

```
tsrun [--options] script.ts [...script args]

Options:

    -h --help       Help! You're reading it now!
    -v --version    Version! This one: 0.4.0!
    -e --eval       Evaluate the script
    -p --print      Evaluate the script and print the result
       --force-esm  Force transpilation of ".ts" files to EcmaScript modules
       --force-cjs  Force transpilation of ".ts" files to CommonJS modules
```
npm package: @plugjs/typescript
Description: TypeScript plugin for the PlugJS Build System =============================================
Author: Juit Developers
Latest version: 0.6.102

TypeScript plugin for the PlugJS Build System
=============================================

Core TypeScript support (transpilation and type checking) for the PlugJS build
system.

* [Copyright Notice](https://github.com/plugjs/plug/blob/main/NOTICE.md)
* [License](https://github.com/plugjs/plug/blob/main/LICENSE.md)
npm package: @plugjs/zip
Description: Zip File Plugin for the PlugJS Build System ===========================================
Author: Juit Developers
Latest version: 0.6.102

Zip File Plugin for the PlugJS Build System
===========================================

This plugin allows the PlugJS build system to create `.zip` files, useful when
deploying (for example) on AWS Lambda.

* [Copyright Notice](https://github.com/plugjs/plug/blob/main/NOTICE.md)
* [License](https://github.com/plugjs/plug/blob/main/LICENSE.md)
npm package: @plugnet/api-contract
Description: Interfaces for interacting with contracts and contract ABIs
Author: Jaco Greeff
Latest version: 0.90.104

# @polkadot/api-contract

Interfaces to allow for the encoding and decoding of Substrate contract ABIs.

```js
import { Abi } from '@plugnet/api-contract';

const abi = new Abi(<...JSON ABI...>);

api.tx.contracts
  .call(<contract addr>, <value>, <max gas>, abi.messages.<method name>(<...params...>))
  .signAndSend(<keyring pair>, (result: SubmittableResult) => { ... });
```
npm package: @plugnet/dev
Description: A collection of shared CI scripts and development environment used by @plugnet projects
Author: Jaco Greeff
Latest version: 0.32.0

# @plugnet/dev

A collection of shared CI scripts and development environment (configuration, dependencies) used by [@plugnet](https://www.poweredbyplug.com/) projects. Included here -

- [style config](config/) Common configurations for [Babel](https://babeljs.io/), [ESLint](https://eslint.org/), [Jest](https://facebook.github.io/jest/).
- [flow definitions](flow-typed/) A collection of 3rd-party [flow](https://flow.org/) definitions used by libraries and projects.
- [build scripts](scripts/) Build scripts that take care of generating documentation, publishing to npm and other common tasks.
- [config skeleton](skeleton/) Standard configurations that allow for project bootstrap, done via `yarn plugnet-dev-copy-skeleton`
npm package: @plugnet/dev-react
Description: A collection of shared CI scripts and development environment used by @plugnet projects
Author: Jaco Greeff
Latest version: 0.32.0

# @plugnet/dev-react

A collection of shared CI scripts and development environment (configuration, dependencies) used by [@plugnet](https://www.poweredbyplug.com/) React projects. Included here -

- [style config](config/) Common configurations for [Babel](https://babeljs.io/), [ESLint](https://eslint.org/), [Jest](https://facebook.github.io/jest/) & [Stylelint](https://stylelint.io/).
- [flow definitions](flow-typed/) A collection of 3rd-party [flow](https://flow.org/) definitions used by libraries and projects.
- [config skeleton](skeleton/) Standard configurations that allow for project bootstrap, done via `yarn polkadot-dev-copy-skeleton`
npm package: @plugnet/jsonrpc
Description: Method definitions for the Plugnet RPC layer
Author: Jaco Greeff
Latest version: 0.90.104

# @plugnet/jsonrpc

A definition of all the methods exposed in a general Plugnet client application. These are used not only to provide a comprehensive code-generated document of the available methods, but are also used in the API to auto-generate endpoints with the required type-checking.

For a list of currently exposed methods, see the [method documentation](docs/METHODS_RPC.md).

## Usage

Installation -

```
yarn add @plugnet/jsonrpc
```

## Adding methods

As methods are added, simply adding the name, inputs & output will prepare it for use.

- Add the method to the correct file in [src/rpc/](src/rpc/) (Input/Output types as cross-referenced from the canonical implementation and match one-to-one)
- Should a new type be required, add it to the type list, [src/types.js](src/types.js) (Required for TSLint type checking)

## Classes

[Classes](SUMMARY.md)
npm package: @plugnet/keyring
Description: Keyring management
Author: Jaco Greeff
Latest version: 1.1.100

# @plugnet/keyring

Key management of user accounts including generation and retrieval of keyring pairs from a variety of input combinations.

## Usage

Installation -

```
yarn add @plugnet/keyring
```

Classes and Functions can be imported as follows:

```js
import Keyring from '@plugnet/keyring';
```

## Utilities

[Utilities](SUMMARY.md)
npm package: @plugnet/rpc-core
Description: A JavaScript wrapper for the Plugnet JsonRPC interface
Author: Jaco Greeff
Latest version: 0.90.104

# @plugnet/rpc-core

This library provides a clean wrapper around all the methods exposed by a Plugnet network client.

## Usage

Installation -

```
yarn add @plugnet/rpc-core
```

Initialisation -

```js
import Rpc from '@plugnet/rpc-core';
import WsProvider from '@plugnet/rpc-provider/ws';

const provider = new WsProvider('http://127.0.0.1:9944');
const rpc = new Rpc(provider);
```

Retrieving the block header object for a given block header hash (a 0x-prefixed hex string with length of 64) -

```js
rpc.chain
  .getHeader('0x1234567890')
  .subscribe(
    (header) => console.log(header),
    (error) => console.error('error:', error)
  );
```

Retrieving the best block number, parent hash, state root hash, extrinsics root hash, and digest (once-off) -

```js
rpc.chain
  .getHead()
  .pipe(
    switchMap((headerHash) => {
      return rpc.chain.getHeader(headerHash);
    })
  )
  .subscribe(
    (header) => {
      console.log(`best #${header.blockNumber.toString()}`);
      console.log(`parentHash: ${header.parentHash.toString()}`);
      console.log(`stateRoot: ${header.stateRoot.toString()}`);
      console.log(`extrinsicsRoot: ${header.extrinsicsRoot.toString()}`);
      console.log(`digest: ${header.digest.toString()}`);
    },
    (error) => {
      console.error('error:', error);
    }
  );
```

Retrieving best header via subscription -

```js
api.chain
rpc
  .subscribeNewHeads()
  .subscribe(
    (header) => {
      console.log(`best #${header.blockNumber}`);
    },
    (error) => {
      console.error('error subscribing:', error);
    }
  );
```

## Classes

[Classes](SUMMARY.md)
npm package: @plugnet/rpc-provider
Description: Transport providers for the API
Author: Jaco Greeff
Latest version: 0.90.104

# @plugnet/rpc-provider

Generic transport providers to handle the transport of method calls to and from Plugnet clients from applications interacting with it. It provides an interface to making RPC calls and is generally, unless you are operating at a low-level and taking care of encoding and decoding of parameters/results, it won't be directly used, rather only passed to a higher-level interface.

## Provider Selection

There are two flavours of the providers provided, one allowing for using HTTP as a transport mechanism, the other using WebSockets. It is generally recommended to use the [[WsProvider]] since in addition to standard calls, it allows for subscriptions where all changes to state can be pushed from the node to the client.

Both providers are usable (as is the API), in both browser-based and Node.js environments. Polyfills for unsupported functionality are automatically applied based on feature-detection.

## Usage

Installation -

```
yarn add @plugnet/rpc-provider
```

WebSocket Initialisation -

```javascript
import WsProvider from '@plugnet/rpc-provider/ws';

// this is the actual default endpoint
const provider = new WsProvider('ws://127.0.0.1:9944');
const version = await provider.send('client_version', []);

console.log('client version', version);
```

HTTP Initialisation -

```javascript
import { HttpProvider } from '@plugnet/rpc-provider';

// this is the actual default endpoint
const provider = new HttpProvider('http://127.0.0.1:9933');
const version = await provider.send('chain_getBlockHash', []);

console.log('latest block Hash', hash);
```

## Classes

[Classes](SUMMARY.md)
npm package: @plugnet/util
Description: A collection of useful utilities for @plugnet
Author: Jaco Greeff
Latest version: 1.1.100

# @plugnet/util

Various useful utility functions that are used across all projects in the [@plugnet](https://www.poweredbyplug.com/) namespace. It provides utility functions with additional safety checks, allowing not only for consistent coding, but also reducing the general boilerplate.

## Usage

Installation -

```
yarn add @plugnet/util
```

Functions can be imported directly from the package, e.g.

```js
import { isHex } from '@plugnet/util';
```

## Utilities

[Utilities](SUMMARY.md)
npm package: @plugnet/util-crypto
Description: A collection of useful crypto utilities for @plugnet
Author: Jaco Greeff
Latest version: 1.1.100

# @plugnet/util-crypto

Various useful cyrpto utility functions that are used across all projects in the [@plugnet](https://www.poweredbyplug.com/) namespace. It provides utility functions with additional safety checks, allowing not only for consistent coding, but also reducing the general boilerplate.

## Usage

Installation -

```
yarn add @plugnet/util-crypto
```

Functions can be imported as follows:

```js
import { mnemonicGenerate } from '@plugnet/util-crypto';
```

## Utilities

[Utilities](SUMMARY.md)
npm package: @plugnet/wallet
Description: wallet implementation for Plugnet
Author: ian.he
Latest version: 0.20.0

# `@plugnet/wallet`

> a wallet and raw payload signer implementation for plugnet

## Usage

### Create a Wallet with HD-Keyring

```
import {Wallet} from '@plugnet/wallet';

const wallet = new Wallet();
await wallet.createNewVault('a passphrase');
// By default it comes with a HD Keyring
// to specify hdPath of HDKeyring, 
await wallet.createNewVault('a passphrase', {hdPath: '...'});
```

### Backup your wallet

```
const backup = await wallet.export('a passphrase');
// [{mnemonic, numberOfAccounts，hdPath}]
```

### Reload your wallet
```
vault = wallet.vault;
wallet2 = new Wallet({vault});
//add keyringTypes: [HDKeyring, SimpleKeyring] if SimpleKeyring is used
await wallet2.unlock(<same passphrase>)
```

### Restore wallet and reset password
```
mnemonic='ready whisper vapor penalty load gesture elite brick select light caution clever';
hdKeyring=new HDKeyring({mnemonic});
wallet = new Wallet();
wallet.createNewVaultAndRestore('newpass', [hdKeyring]);
```

### Backup an account

```
const json = await wallet.exportAccount(address, passphrase);
```

### Import single account

```
const TEST_ACCOUNT = {
    seed: '0x3cf2ec6ffd26587529ab06c82ba9b33110198085f5c6b8d882653d056bf9e0d3',
    address: '5DHzypfuQH7FPhCsrqMxpxkBaPHe8QNhc5s1PwEMDc5p5Nb7',
    publicKey: '0x366010e706af618a6037731b07663d4b6f10eac201c7fdd5fb0bd4727742524d',
    mnemonic: 'insane push cradle toilet token gate chair trim spare blush rebuild top',
};
const keyring = new SimpleKeyring();
await keyring.addPair(alice);
//or
keyring.addFromSeed(hexToU8a(TEST_ACCOUNT.seed));
//or
keyring.addFromMnemonic(TEST_ACCOUNT.mnemonic);
await wallet.addKeyring(keyring);
```

### lock/unlock

```
await wallet.lock();
// methods marked as @requireUnlocked such as sign, addAccount and etc will fail
await wallet.unlock(passphrase);
```

### generate random account via the default keyring

```
const address = await wallet.addAccount();
```

### Sign a payload
```
const payload = {
type: 'payload',
data: '0x01a1f9000051',
address: ...[signing account address]
}

const signature = await wallet.sign(payload);
```