open-index/open-npm huggingface dataset:
npm package: @statechannels/channel-client
Description: Browser-compatible JS client implementing the State Channels Client API
Author: snario
Latest version: 0.3.0-hyperspace

# 🖥️ Channel Client

Javascript class exposing the statechannels wallet API. Used in conjunction with @statechannels/iframe-channel-provider.

See https://docs.statechannels.org

### API report

We use `@microsoft/api-extractor` to generate an [API report](./channel-client.api.md).
npm package: @statechannels/channel-provider
Description: It exposes a global object called `channelProvider` that implements the [EIP 1193](https://github.com/ryanio/EIPs/blob/master/EIPS/eip-1193.md) standard.
Latest version: 0.0.5

# 🔌 Channel Provider

It exposes a global object called `channelProvider` that implements the [EIP 1193](https://github.com/ryanio/EIPs/blob/master/EIPS/eip-1193.md) standard.

In the near future, it'll feature-detect if a wallet such as MetaMask has state channels support. If it does, the package does nothing; if it doesn't, it'll plug in the Embedded Wallet into a dApp.

## Usage

Include the `channel-provider.min.js` file in your app via a `script` tag:

```html
<script src="node_modules/@statechannels/channel-provider/dist/channel-provider.min.js"></script>
```

Then, enable the provider, passing on an URL to where the Wallet UI hosted.

> _This isn't final behavior. Eventually, the UI will be integrated inside a wallet like MetaMask, and the URL won't be necessary.
> Right now, we need this because of the usage of the `.postMessage()` API + CORS requirements._

```js
window.channelProvider.mountWalletComponent('http://xstate-wallet.statechannels.org');
```

In order for the wallet connection to be useful, you'll want to enable it by calling `.enable()`. This method tells the wallet to establish a connection with the user's Web3 provider.

### API

| Method                                                                      | Description                                                                                                       |
| --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `mountWalletComponent(url?: string)`                                                      | Configures the dApp to be able to send/receive JSON-RPC messages.                                                 |
| `enable()`                                                      | Sends an `EthereumEnable` API call to the wallet.                                                 |
| `send<ResultType>(method: string, params?: any[]`): Promise<ResultType>     | Sends a message to the wallet using JSON-RPC and returns the result, if any.                                      |
| `on(eventNameOrSubscriptionId: string, callback?: Function): void`          | Allows to register for events or subscriptions received from the wallet.                                       |
| `off(eventNameOrSubscriptionId: string, callback?: Function): void`         | Allows to un-register for events or subscriptions received from the wallet.                                       |
| `subscribe(subscriptionType: string, callback?: Function): Promise<string>` | Allows to subscribe to an event feed, returns a `subscriptionId` that can be used later with `.on()` or `.off()`. |
| `unsubscribe(subscriptionId: string)`                                       | Removes all event listeners tied to a given `subscriptionId` and stops listening events on the requested feed.    |
npm package: @statechannels/client-api-schema
Description: JSON-RPC Schema and TypeScript typings for the State Channels Client API
Author: snario
Latest version: 0.10.2

# 📋 Client API schema

Defines TypeScript types for handling JSON-RPC messages passed between an application and a state channels wallet.

Also defines a schema (derived from the typescript types) and validation code for checking whether messages conform to the schema.

For more information see https://docs.statechannels.org
npm package: @statechannels/iframe-channel-provider
Description: It exposes a global object called `channelProvider` that implements the [EIP 1193](https://github.com/ryanio/EIPs/blob/master/EIPS/eip-1193.md) standard.
Latest version: 0.3.0-hyperspace-patch-0

# 🔌 IFrame Channel Provider

It exposes a global object called `channelProvider` that implements the [EIP 1193](https://github.com/ryanio/EIPs/blob/master/EIPS/eip-1193.md) standard.

## Usage

Include the `iframe-channel-provider.min.js` file in your app via a `script` tag:

```html
<script src="node_modules/@statechannels/iframe-channel-provider/dist/iframe-channel-provider.js"></script>
```

Then, enable the provider, passing on an URL to where the Wallet UI hosted.

```js
window.channelProvider.mountWalletComponent('http://xstate-wallet.statechannels.org');
```

In order for the wallet connection to be useful, you'll want to enable it by calling `.enable()`. This method tells the wallet to establish a connection with the user's Web3 provider.

For more information see https://docs.statechannels.org
npm package: @statechannels/jest-gas-reporter
Description: A jest reporter that reports the gas used by various calls to ethereum contracts.
Author: Alex Gap
Latest version: 0.4.10

# jest-gas-reporter

A simple jest reporter that reports the gas used by various calls to ethereum contracts.

It uses the `json` files compiled by truffle parse transactions that occured on `ganache` and show gas usage of different contract functions.

```
Test Suites: 1 passed, 1 total
Tests:       49 passed, 49 total
Snapshots:   0 total
Time:        58.388s

Gas Usage:
Contract Name         Method Name                 Calls  Min Gas  Max Gas  Average Gas
--------------------  --------------------------  -----  -------  -------  -----------
TestContract          deposit                     20     31032    46032    35532
TestContract          withdraw                    5      30800    74499    42586
```

## Configuration

Just add jest-gas-reporter to reporters in your jest config. By default `@statechannels/jest-gas-reporter` assume that contract json files are located in `./build/contracts`

```
 "reporters": ["default","@statechannels/jest-gas-reporter"]
```

If you want specify a folder where the contracts are located. `@statechannels/jest-gas-reporter` accepts a `contractArtifactFolder` option.

```js
"reporters": [
  "default",
  [
    "@statechannels/jest-gas-reporter",
    { "contractArtifactFolder":"output/contract" }
  ]
]
```
npm package: @statechannels/native-utils
Description: This repository contains native Node.js utilities to speed up encoding and hashing states, signing states and recovering signer addresses from signed states.
Author: Jannis Pohlmann
Latest version: 0.1.6-asset

# @statechannels/native-utils

This repository contains native Node.js utilities to speed up encoding and
hashing states, signing states and recovering signer addresses from signed
states.

This package is tries to build native Node.js bindings if Rust is available. If
this is not the case, it falls back to `@statechannels/wasm-utils`.

# License

Copyright &copy; 2020 State Channel contributors.

Licensed under the [MIT License](LICENSE).
npm package: @statechannels/server-wallet
Description: http server statechannel wallet
Latest version: 1.25.2

# Unit testing and running the server locally

## Setup

### postgresql

The simplest way to get this going on a mac is to install the [postgres app](https://postgresapp.com)

### .env

TODO: switch to SC_ENV files

You'll notice a set files with the `.env` prefix. The `.env` file contains environment variables that apply to all users across all environments. To add an environment variable specific to your local setup, add the variable to `.env.NODE_ENV.local` where NODE_ENV can be test, development, etc.

#### Example local env file

TODO: switch to SC_ENV files

If you have `NODE_ENV=development`, you'd have a local file named `.env.development.local` with similar content to the following:

```
SERVER_DB_HOST=localhost
# assuming your postgres instance is open on port 5432
SERVER_DB_PORT=5432
```

## Testing

For any environment variables specific to local setup, such as postgres host or port, do not modify `.env` files checked into the repository. Instead, add the variables to `.env.test.local` (or to other local `.env` files). Specifically, you might want to override `SERVER_DB_USER`, `SERVER_DB_HOST` and `SERVER_DB_PORT`.

```
echo "SERVER_DB_USER=postgres" > .env.test.local # you probably need to do at least this (if you're on a mac)
yarn install
NODE_ENV=test yarn db:create
NODE_ENV=test yarn db:migrate
yarn test:ci
```

### Note on `POSTGRES_USER`

On CircleCI we use `POSTGRES_USER` as `root`, as set in the [CircleCI configuration file](../../.circleci/config.yml) in the monorepo root. Since `NODE_ENV` is set to `test` in that environment, `.env.test` is used, which points to `root` as `SERVER_DB_USER`. When testing locally, however, we expect that `NODE_ENV` is `development`, so `.env.development` is used, which uses `postgres` for `SERVER_DB_USER`. We could unite these two by syncronizing CircleCI and our local environments to both use `postgres` as the user.
npm package: @statechannels/wasm-utils
Description: This repository contains WASM utilities to speed up encoding and hashing states, signing states and recovering signer addresses from signed states.
Latest version: 0.1.8

# @statechannels/wasm-utils

This repository contains WASM utilities to speed up encoding and hashing
states, signing states and recovering signer addresses from signed states.

This package is not intended to be consumed directly. It is recommended to
depend on `@statechannels/native-utils`, which will try to use native Node.js
bindings for the same utilities, and fall back to WASM if the native bindings
cannot be built.

# License

Copyright &copy; 2020 State Channel contributors.

Licensed under the [MIT License](LICENSE).
npm package: @statechannels/xstate-wallet
Description: State channel wallet using xstate.
Author: Alex Gap
Latest version: 0.3.0-hyperspace

# 🌐 Browser wallet

State channels wallet.

Currently, an application should run this wallet inside an iFrame and communicate with it via @statechannels/[iframe-channel-provider](https://www.npmjs.com/package/@statechannels/iframe-channel-provider) and [@statechannels/channel-client](https://www.npmjs.com/package/@statechannels/channel-client).

See https://docs.statechannels.org

[![Netlify Status](https://api.netlify.com/api/v1/badges/fe975674-cea9-44ed-b9f4-685c03d9f17c/deploy-status)](https://app.netlify.com/sites/xstate-wallet/deploys)

## Configurable Environment Variables

| Variable                  | Possible Values        | Description                                                      |
| ------------------------- | ---------------------- | ---------------------------------------------------------------- |
| LOG_DESTINATION           | "console", a file name | When running tests, use `console.log` or to a file               |
| USE_INDEXED_DB            | empty, or truthy value | If truthy, uses IndexedDB in the browser and in-memory otherwise |
| CLEAR_STORAGE_ON_START    | empty, or truthy value | If truthy, clears any data in the store before start             |
| NITRO_ADJUDICATOR_ADDRESS | address                | Address of NitroAdjudicator contract on-chain                    |
| ETH_ASSET_HOLDER_ADDRESS  | address                | Address of ETHAssetHolder contract on-chain                      |
| HUB_ADDRESS               | address                | Signing address of firebase:simple-hub participant               |
| HUB_DESTINATION           | empty or bytes32       | Destination of firebase:simple-hub participant                   |
| CHAIN_NETWORK_ID          | string or integer      | Chain identifier e.g., 3 for Ropsten                             |

### Why are webpack loaders in `dependencies`?

Currently the [`e2e-tests`](http://github.com/statechannels/apps/blob/master/packages/e2e-tests) package relies on `xstate-wallet` to run. Since we use environment variables as configuration options, and these are baked into the webpack builds at compile-time, we instead distribute the entire webpack dev server environment over `npm` to simplify things. We should move configuration options to be something declared at runtime.
npm package: @stated-library/base
Description: Simplified state
Author: Bradford Lemley
Latest version: 1.0.6

A base class for [`Stated Libraries`](https://github.com/bradfordlemley/stated-library)

[![License][license-badge]][license] [![Build Status][build-badge]][build] [![Code Coverage][coverage-badge]][coverage]

[build]: https://dev.azure.com/bradfordlemley/stated-library/_build/latest?definitionId=1&branchName=master
[build-badge]: https://img.shields.io/azure-devops/build/bradfordlemley/stated-library/1/master.svg
[coverage]: https://codecov.io/github/bradfordlemley/stated-library/branch/master
[coverage-badge]: https://img.shields.io/codecov/c/gh/bradfordlemley/stated-library/master.svg
[coverage-badge-az]: https://img.shields.io/azure-devops/coverage/bradfordlemley/stated-library/1/master.svg
[license-badge]: https://img.shields.io/github/license/bradfordlemley/stated-library.svg
[license]: https://github.com/bradfordlemley/stated-library/blob/master/LICENSE

[![size][size-badge]][unpkg] [![size][gzip-size-badge]][unpkg]

[unpkg]: https://unpkg.com/@stated-library/base/
[size-badge]: http://img.badgesize.io/https://unpkg.com/@stated-library/base/dist/index.umd.production.js?label=size&style=flat-square
[gzip-size-badge]: http://img.badgesize.io/https://unpkg.com/@stated-library/base/dist/index.umd.production.js?compression=gzip&label=gzip%20size&style=flat-square
npm package: @stated-library/core
Description: Core functionality for [`Stated Libraries`](https://github.com/bradfordlemley/stated-library)
Author: Bradford Lemley
Latest version: 1.0.6

Core functionality for [`Stated Libraries`](https://github.com/bradfordlemley/stated-library)

[![License][license-badge]][license] [![Build Status][build-badge]][build] [![Code Coverage][coverage-badge]][coverage]

[build]: https://dev.azure.com/bradfordlemley/stated-library/_build/latest?definitionId=1&branchName=master
[build-badge]: https://img.shields.io/azure-devops/build/bradfordlemley/stated-library/1/master.svg
[coverage]: https://codecov.io/github/bradfordlemley/stated-library/branch/master
[coverage-badge]: https://img.shields.io/codecov/c/gh/bradfordlemley/stated-library/master.svg
[coverage-badge-az]: https://img.shields.io/azure-devops/coverage/bradfordlemley/stated-library/1/master.svg
[license-badge]: https://img.shields.io/github/license/bradfordlemley/stated-library.svg
[license]: https://github.com/bradfordlemley/stated-library/blob/master/LICENSE

[![size][size-badge]][unpkg] [![size][gzip-size-badge]][unpkg]

[unpkg]: https://unpkg.com/@stated-library/core/
[size-badge]: http://img.badgesize.io/https://unpkg.com/@stated-library/core/dist/index.umd.production.js?label=size&style=flat-square
[gzip-size-badge]: http://img.badgesize.io/https://unpkg.com/@stated-library/core/dist/index.umd.production.js?compression=gzip&label=gzip%20size&style=flat-square
npm package: @stated-library/react
Description: React bindings for [`Stated Libraries`](https://github.com/bradfordlemley/stated-library)
Author: Bradford Lemley
Latest version: 1.0.6

React bindings for [`Stated Libraries`](https://github.com/bradfordlemley/stated-library)

[![License][license-badge]][license] [![Build Status][build-badge]][build] [![Code Coverage][coverage-badge]][coverage]

[build]: https://dev.azure.com/bradfordlemley/stated-library/_build/latest?definitionId=1&branchName=master
[build-badge]: https://img.shields.io/azure-devops/build/bradfordlemley/stated-library/1/master.svg
[coverage]: https://codecov.io/github/bradfordlemley/stated-library/branch/master
[coverage-badge]: https://img.shields.io/codecov/c/gh/bradfordlemley/stated-library/master.svg
[coverage-badge-az]: https://img.shields.io/azure-devops/coverage/bradfordlemley/stated-library/1/master.svg
[license-badge]: https://img.shields.io/github/license/bradfordlemley/stated-library.svg
[license]: https://github.com/bradfordlemley/stated-library/blob/master/LICENSE

[![size][size-badge]][unpkg] [![size][gzip-size-badge]][unpkg]

[unpkg]: https://unpkg.com/@stated-library/react/
[size-badge]: http://img.badgesize.io/https://unpkg.com/@stated-library/react/dist/index.umd.production.js?label=size&style=flat-square
[gzip-size-badge]: http://img.badgesize.io/https://unpkg.com/@stated-library/react/dist/index.umd.production.js?compression=gzip&label=gzip%20size&style=flat-square
npm package: @stated-library/rxjs
Description: This package runs tests to help ensure [`Stated Libraries`](https://github.com/bradfordlemley/stated-library) are compatility with RxJs. It is not intended to be used.
Author: Bradford Lemley
Latest version: 1.0.6

This package runs tests to help ensure [`Stated Libraries`](https://github.com/bradfordlemley/stated-library) are compatility with RxJs. It is not intended to be used.