@posichain-js/network
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

@posichain-js/network

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

Installation

npm install @posichain-js/network

Usage

const { Messenger, HttpProvider, WSProvider } = require('@posichain-js/network');
const { ChainID, ChainType } = require('@posichain-js/utils');
const testnetHTTP = 'https://s0.posichain.org/';
const testnetWS = 'wss://ws.s0.posichain.org/';
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.PosiChain, ChainID.HmyTestnet); // for local ChainID.HmyLocal
const customWSMessenger = new Messenger(ws, ChainType.PosiChain, ChainID.HmyTestnet); // for local ChainID.HmyLocal

/@posichain-js/network/

    Package Sidebar

    Install

    npm i @posichain-js/network

    Weekly Downloads

    0

    Version

    0.0.5

    License

    MIT

    Unpacked Size

    278 kB

    Total Files

    121

    Last publish

    Collaborators

    • shin--position
    • justin_position