# @harmony-js/network

> network suites for harmony

Latest version **0.1.56** (published 2020-11-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @harmony-js/network
pnpm add @harmony-js/network
yarn add @harmony-js/network
bun add @harmony-js/network
```

## 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.1.56 |
| Published | 2020-11-22 |
| First published | 2019-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 238.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | neeboo@firestack.one |
| Maintainers | gupadhyaya, jhwon0820, ghostcorn |

## Links

- npm: https://www.npmjs.com/package/@harmony-js/network
- npm.io page: https://npm.io/package/@harmony-js/network

## Dependencies (4)

- [mitt](https://npm.io/package/mitt.md) ^1.2.0
- [websocket](https://npm.io/package/websocket.md) ^1.0.28
- [cross-fetch](https://npm.io/package/cross-fetch.md) ^3.0.2
- [@harmony-js/utils](https://npm.io/package/@harmony-js/utils.md) 0.1.56

## Recent versions

- 0.1.56 (latest) — 2020-11-22
- 0.1.58 (next) — 2022-07-06
- 0.1.41-alpha.1 (canary) — 2020-05-04
- 0.1.55 — 2020-09-29
- 0.1.54 — 2020-09-07
- 0.1.51 — 2020-08-06
- 0.1.48 — 2020-07-13
- 0.1.45 — 2020-06-06
- 0.1.43 — 2020-05-04
- 0.1.40 — 2020-05-04
- 0.1.35 — 2019-11-27
- 0.1.31 — 2019-10-25
- 0.1.29 — 2019-10-15
- 0.1.28 — 2019-10-10
- 0.1.27 — 2019-10-10
- … 53 more at https://npm.io/package/@harmony-js/network/versions

## README

# @harmony-js/network

This package provides a collection of apis to create messengers (HTTP, WebSocket) to connect to blockchain networks.

## Installation

```
npm install @harmony-js/network
```

## Usage

```javascript
const { Messenger, HttpProvider, WSProvider } = require('@harmony-js/network');
const { ChainID, ChainType } = require('@harmony-js/utils');
const testnetHTTP = 'https://api.s0.b.hmny.io';
const testnetWS = 'wss://ws.s0.b.hmny.io';
const localHTTP = 'http://localhost:9500/';
const localWS = 'http://localhost:9800/';
const http = new HttpProvider(testnetHTTP); // for local use localHTTP
const ws = new WSProvider(testnetWS); // for local use testnetWS
const customHTTPMessenger = new Messenger(http, ChainType.Harmony, ChainID.HmyTestnet); // for local ChainID.HmyLocal
const customWSMessenger = new Messenger(ws, ChainType.Harmony, ChainID.HmyTestnet); // for local ChainID.HmyLocal
```

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