You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
898 B
24 lines
898 B
# @woop-js/network
|
|
|
|
This package provides a collection of apis to create messengers (HTTP, WebSocket) to connect to blockchain networks.
|
|
|
|
## Installation
|
|
|
|
```
|
|
npm install @woop-js/network
|
|
```
|
|
|
|
## Usage
|
|
|
|
```javascript
|
|
const { Messenger, HttpProvider, WSProvider } = require('@woop-js/network');
|
|
const { ChainID, ChainType } = require('@woop-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.Woop, ChainID.WikiTestnet); // for local ChainID.WikiLocal
|
|
const customWSMessenger = new Messenger(ws, ChainType.Woop, ChainID.WikiTestnet); // for local ChainID.WikiLocal
|
|
``` |