JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q33978F
  • License MPL-2.0

JavaScript implementation of the Factomd API v2.0

Package Exports

  • factomdjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (factomdjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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