🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@orbs-network/orbs-client

Package Overview
Dependencies
Maintainers
12
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orbs-network/orbs-client

Client side gateway to access ORBS nodes by IP randomly or round robin

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
12
Created
Source

orbs-client

Client side gateway to access ORBS nodes by IP randomly or round robin

Install

npm install @orbs-network/orbs-client

Get Started

const client = import "@orbs-network/orbs-client"

async function start(){
    await client.init();
    // get a live ORBS node IP
    const node = client.getRandomNode();
    // get nodes status
    const url = 'http://'+node.Ip+'/services/management-service/status';
    const response = await axios.get(url);
    console.log(`${node.Name} status`)
    console.log(response);
}

API

Node (type)

{
    "EthAddress": "0874bc1383958e2475df73dc68c4f09658e23777",
    "OrbsAddress": "067a8afdc6d7bafa0ccaa5bb2da867f454a34dfa",
    "Ip": "46.101.165.46",
    "Port": 0,
    "Name": "Wings Stiftung"
}

init

// optional array of seed HostNames of nodes
// if node provided- a hard coded array is used
const seed = [
    '54.95.108.148',
    '0xcore.orbs.network'
];
client.init(seed);

TODO: init with infura to get the committee from ethereum network

getRandomNode

// select weather to get any node or only a node from orbs 21 node committee
const committeeOnly = true;
// use random index to select the node.
const node = client.getRandomNode(committeeOnly)

getNextNode

// select weather to get any node or only a node from orbs 21 node committee
const committeeOnly = false;
// uses round robin to fetch next node
const node = client.getNextNode(committeeOnly)

Please notice the health of the node is checked every 10 minutes. Its the user's responsibility to call another node upon a failure.

FAQs

Package last updated on 23 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts