Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including @arkecosystem/peers with all npm packages installed. Try it out:

var peers = require("@arkecosystem/peers")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@arkecosystem/peers v0.3.0

A simple TypeScript peer discovery client for the ARK Blockchain.

@arkecosystem/peers

Latest Version Node Engine Build Status Codecov License: MIT

Lead Maintainer: Brian Faust

Installation

yarn add @arkecosystem/peers

Usage

Peers via GitHub

import { PeerDiscovery } from "@arkecosystem/peers";

peerDiscovery = await PeerDiscovery.new({
    networkOrHost: "devnet"
})

peers = peerDiscovery
    .withVersion(">=2.4.0-next.0")
    .withLatency(300)
    .sortBy("latency")
    .findPeersWithPlugin("core-api");

Peers via Relay

import { PeerDiscovery } from "@arkecosystem/peers";

peerDiscovery = await PeerDiscovery.new({
    networkOrHost: "http://dexplorer.ark.io/api/peers",
})

peers = peerDiscovery
    .withVersion(">=2.4.0-next.0")
    .withLatency(300)
    .sortBy("latency")
    .findPeersWithPlugin("core-api");

Testing

yarn test

Security

If you discover a security vulnerability within this package, please send an e-mail to security@ark.io. All security vulnerabilities will be promptly addressed.

Credits

This project exists thanks to all the people who contribute.

License

MIT © ARK Ecosystem

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free