0.2.1 • Published 2 years ago

@timestope-official/network v0.2.1

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

@timestope-official/network

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

Installation

npm install @timestope-official/network

Usage

const { Messenger, HttpProvider, WSProvider } = require('@timestope-official/network');
const { ChainID, ChainType } = require('@timestope-official/utils');
const testnetHTTP = 'https://api.s0.b.timestope.net';
const testnetWS = 'wss://ws.s0.b.timestope.net';
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.Feechain, ChainID.FchTestnet); // for local ChainID.FchLocal
const customWSMessenger = new Messenger(ws, ChainType.Feechain, ChainID.FchTestnet); // for local ChainID.FchLocal