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

pecunia-api

v1.0.1

Published

The Pecunia Node.js API

Downloads

26

Readme

Pecunia Node.js API

JavaScript Style Guide

Notice: This module and API is in early development and may change in the future.

Pecunia Official Website

Getting Started

Install the Pecunia NPM Package with:

npm i pecunia-api

Also, require the module in your Node.js application with:

const pecunia = require("pecunia-api")

Using the API

Authentication

To authenticate with Pecunia, visit the Pecunia API Page and generate an API key. The key will be sent via email, once you've obtained it, throw it into a credentials object like the following:

// Pecunia Credentials Object, enter your Api_Key in the "key" pair
const creds = {
  key: "xxxxx"
}

Supported Coins

An endpoint that gets an object containing the total Pecunia Listed coins, and an array of them.

pecunia.supported(creds).then(coins => {
  if (!coins || coins === undefined || !coins.data[0]) return console.error("No coins found on Pecunia") // This would be a strange error 🤨
  console.log("Supported coins: " + coins.total) // coins.data[0... 1... 2... ect] would access data for each coin individually
})

All Nodes

An endpoint that gets an array containing all nodes ran under the API key's account.

// Credentials object first, hosting platform second
pecunia.nodes(creds, "99HOST").then(nodes => {
  if (!nodes || nodes === undefined || !nodes[0]) return console.error("No nodes found on Pecunia")
  console.log("Nodes found: " + nodes.length + "\n\nNode 1: \nID: " + nodes[0].id + "\nBlockchain: " + nodes[0].nodeId + "\nHosting Type: " + nodes[0].platform)
})

Single Node

An endpoint that gets a node specified by it's "nodeId".

// Credentials object first, hosting platform second, nodeId third for the specific node you want to view
pecunia.node(creds, "99HOST", "39ceda96-ed1d-4291-9fdf-879937616454").then(node => {
  if (!node || node === undefined) return console.error("No node found on Pecunia")
  console.log("ID: " + node.id + "\nBlockchain: " + node.nodeId + "\nHosting Type: " + node.platform)
})

Example Node.js files can be found in the /examples directory within the repository.