0.0.12 • Published 3 years ago

@huobiwallet-js/network v0.0.12

Weekly downloads
2
License
MIT
Repository
-
Last release
3 years ago

@huobiwallet-js/network

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

Installation

npm install @huobiwallet-js/network

Usage

const { Messenger, HttpProvider, WSProvider } = require('@huobiwallet-js/network');
const { ChainID, ChainType } = require('@huobiwallet-js/utils');
const testnetHTTP = 'https://http-testnet.hecochain.com';
const testnetWS = 'wss://ws.s0.b.hmny.io';
const localHTTP = 'https://http-testnet.hecochain.com/';
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.Huobi, ChainID.HecoTestnet); // for local ChainID.HecoLocal
const customWSMessenger = new Messenger(ws, ChainType.Huobi, ChainID.HecoTestnet); // for local ChainID.HecoLocal