@dpos-info/peers
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

@dpos-info/peers

Latest Version License: MIT

A simple peer discovery client for ARK Core based blockchains.

Installation

yarn add @dpos-info/peers

Usage

Initialise with Network or Host

import { PeerDiscovery } from "@dpos-info/peers";

peerDiscovery = await PeerDiscovery.new("ark.devnet");

// or

peerDiscovery = await PeerDiscovery.new("http://dapi.ark.io/api");

Available networks:

  • ark.mainnet
  • ark.devnet
  • sxp.mainnet
  • sxp.testnet

Configure Version or Latency

peers = peerDiscovery.withVersion(">=3.0.0").withLatency(300);

Find Peers

peers = await peerDiscovery.findPeers();

// with additional options

peers = await peerDiscovery.findPeers({
	additional: ["ports"],
});

Find Peers with Plugin

peers = await peerDiscovery.findPeersWithPlugin("core-api");

// with plugin options

peers = await peerDiscovery.findPeersWithPlugin("core-api", {
	pluginOptions: { estimateTotalCount: false },
});

Refresh Peer List

Call refresh() to fetch a new peer list from the configured host.

await peerDiscovery.refresh();

Testing

yarn test

Security

If you discover a security vulnerability within this package, please send an e-mail to security@dpos.info.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @dpos-info/peers

Weekly Downloads

2

Version

0.0.3

License

MIT

Unpacked Size

59.9 kB

Total Files

22

Last publish

Collaborators

  • dated