Code Monkey home page Code Monkey logo

pecunia-nodejs-api's Introduction

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.

pecunia-nodejs-api's People

Stargazers

 avatar

Watchers

 avatar

pecunia-nodejs-api's Issues

Node Setups and Deletions are needed

No worries! I'll create these sometime soon, just publishing the initial code I've built for the API while I take a break for a bit. Development will resume soon.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.