@dpos-info/peers
v0.0.3
Published
A simple peer discovery client for the ARK Core based blockchains.
Downloads
6
Readme
@dpos-info/peers
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 [email protected].