New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mycrypto-eth-exists

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mycrypto-eth-exists

A library that helps check for available nodes / providers. Useful for when you want to check a list of providers and see which ones are online.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

eth-exists

A library that helps check for available nodes / providers. Useful for when you want to check a list of providers and see which ones are online.

Usage

import { exists } from 'mycrypto-eth-exists';

// a provider to see if they're online or not by sending a
// getNetVersion JSON-RPC request to them and checking for a response
const httpProviderToCheck: IHttpConfig = {
  type: 'http',
  addr: 'http://localhost',
  port: 8545,
  timeout: 5000,
};

// a provider to see if they're online or not by
// attempting to open a ws connection to that address
const wsProviderToCheck: IWSConfig = {
  type: 'ws',
  addr: 'ws://localhost',
  port: 8546,
  timeout: 5000,
};

// array of providers to check
const providersToCheck = [httpProviderToCheck, wsProviderToCheck];

// whether to include the default provider checks
const includeDefaults = false;

async function example() {
  // results will contain an array of providers with the same data as the initially declared
  // objects above, except they will now have a success parameter included to see if
  // they were succesfully connected to or not
  // and an error parameter of the error if it failed to connect
  const results = await exists(providersToCheck, includeDefaults);
}

Provider Check Defaults

const DEFAULT_WS: IWSConfig = {
  type: 'ws',
  addr: 'ws://localhost',
  port: 8546,
  timeout: 5000,
};

const DEFAULT_HTTP: IHttpConfig = {
  type: 'http',
  addr: 'http://localhost',
  port: 8545,
  timeout: 5000,
};

Keywords

FAQs

Package last updated on 12 Jun 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc