npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eal-sdk

v0.0.1

Published

EAL SDK for Node.JS and the Browser

Downloads

1

Readme

Coiin EAL JS SDK

Talk to your Coiin EAL chain.

Docs

Full docs for the SDK can be found here.

Installation

npm i coiin-eal-sdk --save

Initialize The Client

const sdk = require('coiin-eal-sdk');

const main = async () => {
  const client = await sdk.createClient({
    coiinEalId: 'c2dffKwiGj6AGg4zHkNswgEcyHeQaGr4Cm5SzsFVceVv'
  });
  // Do something with the client here
};

main()
  .then(console.log)
  .catch(console.error);

GetBlock

const call = await client.getBlock({ blockId: '56841' });

if (call.ok) {
  console.log('Successful call!');
  console.log(`Block: ${call.response}`);
} else {
  console.error('Something went wrong!');
  console.error(`HTTP status code from chain: ${call.status}`);
  console.error(`Error response from chain: ${call.response}`);
}

Configuration

In order to use this SDK, you need to have an Auth Key as well as an Auth Key ID for a given Coiin EAL ID. It is also strongly suggested that you supply an endpoint locally so that a remote service isn't called to automatically discover your coiin eal endpoint. These can be loaded into the sdk in various ways, and are checked in the following order of precedence:

  1. The createClient method can be initialized with an object containing the parameters coiinEalId: <ID>, authKey: <KEY>, authKeyId: <KEY_ID>, and endpoint: <URL>

  2. The environment variables COIIN_EAL_ID, AUTH_KEY, AUTH_KEY_ID, and COIIN_EAL_ENDPOINT, can be set with the appropriate values

  3. An ini-style credentials file can be provided at ~/.coiin-eal/credentials (or on Windows: %LOCALAPPDATA%\coiin-eal\credentials) where the section name is the coiin eal id, with values for auth_key, auth_key_id, and endpoint. Additionally, you can supply a value for coiin_eal_id in the default section to initialize the client for a specific chain without supplying an ID any other way

[default]
coiin_eal_id = c2dffKwiGj6AGg4zHkNswgEcyHeQaGr4Cm5SzsFVceVv

[c2dffKwiGj6AGg4zHkNswgEcyHeQaGr4Cm5SzsFVceVv]
auth_key_id = JSDMWFUJDVTC
auth_key = n3hlldsFxFdP2De0yMu6A4MFRh1HGzFvn6rJ0ICZzkE
endpoint = https://35a7371c-a20a-4830-9a59-5d654fcd0a4a.eal.coiin.io

[28VhSgtPhwkhKBgmQSW6vrsir7quEYHdCjqsW6aAYbfrw]
auth_key_id = OGNHGLYIFVUA
auth_key = aS73Si7agvX9gfxnLMh6ack9DEuidKiwQxkqBudXl81
endpoint = https://28567017-6412-44b6-80b2-12876fb3d4f5.eal.coiin.io

Logging

In order to get the logging output of the sdk, a logger must be set (by default all logging is ignored).

In order to set the logger, simply call .setLogger on the root of the require/import. For example, if you just wanted to log with console (i.e. stdout, stderr, etc), you can set the logger like the following:

const sdk = require('coiin-eal-sdk');
sdk.setLogger(console);

In that example, console can be replaced with any custom logger as long as it implements log, info, warn, debug, and error functions.

To reset the logger back to default (so it doesn't output anymore), simply called setLogger() with no params.