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.
Dennis Won
463cfdfb68
|
4 years ago | |
---|---|---|
.. | ||
src | 4 years ago | |
LICENSE | 6 years ago | |
README.md | 4 years ago | |
package-lock.json | 4 years ago | |
package.json | 4 years ago | |
tsconfig.json | 5 years ago | |
tsconfig.test.json | 6 years ago |
README.md
@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
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