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

factomdjs

v0.4.1

Published

JavaScript implementation of the Factomd API v2.0

Downloads

45

Readme

factomdjs

JavaScript implementation of the factomd API v2.

Installation

$ npm install factomdjs --save

Usage

const factomdjs = require('factomdjs');

const factomd = new factomdjs.Factomd()


// By default the library connect to a courtesy node hosted by factom.com.
// Use setFactomNode to connect to a specific Factom Node.
// factomd.setFactomNode('http://localhost:8088/v2');

// Example to retrieve the content of an entry
factomd.entry('ce3df00a20b6aaaf14f8ff0a2c3efa854160245cf17ce9d36a8ff03090a1135e')
    .then(res => Buffer.from(res.content, 'hex').toString('utf8'))
    .then(console.log);

Table of Contents

setFactomNode

src/factomd.js:20-22

Set the URL of the factom node.

Parameters

  • url url of the factom node

setTimeout

src/factomd.js:29-31

Set the timeout of the JSON request to the factom node

Parameters

  • timeout Number Set the timeout in milliseconds

dispatch

src/factomd.js:39-52

Utility commands for dispatching JSON commands to the factom server.

Parameters

directoryBlock

src/factomd.js:62-70

The directory block head is the last known directory block by factom, or in other words, the most recently recorded block.

Parameters

directoryBlockHead

src/factomd.js:79-82

The directory block head is the last known directory block by factom, or in other words, the most recently recorded block.

Parameters

  • id Number arbitrary reference id

heights

src/factomd.js:91-94

Returns various heights that allows you to view the state of the blockchain. https://docs.factom.com/api#heights

Parameters

  • id Number arbitrary reference id

rawData

src/factomd.js:104-112

Retrieve an entry or transaction in raw format, the data is a hex encoded string. https://docs.factom.com/api#raw-data

Parameters

dblockByHeight

src/factomd.js:121-129

Retrieve a directory block given only its height.

Parameters

  • id Number arbitrary reference id
  • height Number height of block requested

ablockByHeight

src/factomd.js:138-146

Retrieve administrative blocks for any given height.

Parameters

  • id Number arbitrary reference id
  • height Number height of block requested

ecblockByHeight

src/factomd.js:156-164

Retrieve the entry credit block for any given height. These blocks contain entry credit transaction information.

Parameters

  • id Number arbitrary reference id
  • height Number height of block requested

fblockByHeight

src/factomd.js:173-181

Retrieve the factoid block for any given height. These blocks contain factoid arbitrary information.

Parameters

  • id Number arbitrary reference id
  • height Number height of block requested

factoidBlock

src/factomd.js:190-198

Retrieve a specified factoid block given its merkle root key.

Parameters

  • id Number arbitrary reference id
  • KeyMr String Merkle root key

entryCreditBlock

src/factomd.js:208-216

Retrieve a specified entrycredit block given its merkle root key. The numbers are minute markers.

Parameters

  • id Number arbitrary reference id
  • KeyMr String Merkle root key

adminBlock

src/factomd.js:225-233

Retrieve a specified admin block given its merkle root key.

Parameters

  • id Number arbitrary reference id
  • KeyMr String Merkle root key

entryBlock

src/factomd.js:243-251

Retrieve a specified entry block given its merkle root key. The entry block contains 0 to many entries

Parameters

  • id Number arbitrary reference id
  • KeyMr String Merkle root key

entry

src/factomd.js:260-268

Get an Entry from factomd specified by the Entry Hash.

Parameters

pendingEntries

src/factomd.js:277-284

Returns an array of the entries that have been submitted but have not been recoreded into the blockchain.

Parameters

  • id Number arbitrary reference id

transaction

src/factomd.js:296-304

Retrieve details of a factoid arbitrary using a transactions hash. Note that information regarding the directory block height, directory block keymr, and transaction block keymr are also included. The “blockheight” parameter in the reponse will always be 0 when using this call, refer to “includedindirectoryblockheight” if you need the height.

Parameters

  • id Number arbitrary reference id

ack

src/factomd.js:315-323

Find the status of a transaction, whether it be a factoid, reveal entry, or commit entry.

Parameters

receipt

src/factomd.js:334-342

Retrieve a reciept providing cryptographially verfiable proof that information was recorded in the factom blockchain and that this was subsequently anchored in the bitcoin blockchain.

Parameters

pendingTransactions

src/factomd.js:353-361

Retrieve a reciept providing cryptographially verfiable proof that information was recorded in the factom blockchain and that this was subsequently anchored in the bitcoin blockchain.

Parameters

chainHead

src/factomd.js:371-379

Return the keymr of the head of the chain for a chain ID (the unique hash created when the chain was created).

Parameters

entryCreditBalance

src/factomd.js:388-396

Return its current balance for a specific entry credit address.

Parameters

  • id Number arbitrary reference id
  • address String entry credit address

factoidBalance

src/factomd.js:406-414

This call returns the number of Factoshis (Factoids *10^-8) that are currently available at the address specified.

Parameters

  • id Number arbitrary reference id
  • address String factoid address

entryCreditRate

src/factomd.js:424-427

Returns the number of Factoshis (Factoids *10^-8) that purchase a single Entry Credit. The minimum factoid fees are also determined by this rate, along with how complex the factoid arbitrary is.

Parameters

  • id Number arbitrary reference id

properties

src/factomd.js:436-439

Retrieve current properties of the Factom system, including the software and the API versions.

Parameters

  • id Number arbitrary reference id

factoidSubmit

src/factomd.js:450-458

Submit a factoid arbitrary with hex encoded string documented here: https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#factoid-transaction A factoid-submit api call can be composed with factom_walletd.compose-transaction

Parameters

  • id Number arbitrary reference id
  • transaction String hex encoded string

commit_chain

src/factomd.js:470-478

Send a Chain Commit Message to factomd to create a new Chain The commit chain hex encoded string is documented here: https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#chain-commit https://docs.factom.com/api#factoid-submit

Parameters

  • id Number arbitrary reference id
  • message String hex encoded string

revealChain

src/factomd.js:490-498

Reveal the First Entry in a Chain to factomd after the Commit to compleate the Chain creation. The reveal chain hex encoded string is documented here: https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#entry https://docs.factom.com/api#factoid-submit

Parameters

  • id Number arbitrary reference id
  • entry String reveal chain hex encoded string

commitEntry

src/factomd.js:510-518

Send an Entry Commit Message to factom to create a new Entry. The entry commit hex encoded string is documented here: https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#entry-commit https://docs.factom.com/api#reveal-chain

Parameters

  • id Number arbitrary reference id
  • message String hex encoded string for entry

revealEntry

src/factomd.js:530-538

Reveal an Entry to factomd after the Commit to compleate the Entry creation. The reveal entry hex encoded string is documented here: https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#entry https://docs.factom.com/api#reveal-entry

Parameters

  • id Number arbitrary reference id
  • entry String hex encoded string for reveal entry

sendRawMessage

src/factomd.js:549-557

Send a raw hex encoded binary message to the Factom network. This is mostly just for debugging and testing. https://docs.factom.com/api#send-raw-message

Parameters

  • id Number arbitrary reference id
  • message String raw hex encoded string