Enu API
Application programming interface to Enumivo blockchain nodes. This is for read-only API calls. If you need to sign transactions use enujs instead.
Include
- Install with:
npm install enujs-api
- Html script tag, see releases for the correct version and its matching script integrity hash.
See console object: EnuApi
EnuApi
Run enunode
Usage
EnuApi = // Or EnuApi = require('./src') enu = // // 127.0.0.1:8888 // Any API call without a callback parameter will print documentation: description,// parameters, return value, and possible errors. All methods and documentation// are created from JSON files in enujs/json/api/v1..enu // A Promise is returned if a callback is not provided.enuenu // For callbacks instead of Promises provide a callback {err ? console : console} // The server does not expect any parameters only the callback is neededenu // Parameters are added before the callbackenu // Parameters can be an objectenuenu
Configuration
EnuApi = // Or EnuApi = require('./src') // everything is optionaloptions = httpEndpoint: 'http://127.0.0.1:8888' // default, null for cold-storage verbose: false // API logging logger: // Default logging functions log: configverbose ? consolelog : null error: configverbose ? consoleerror : null fetchConfiguration: {} enu =
options.logger example
During testing, an error may be expected and checked as follows:
optionslogger = { assert }
options.fetchConfiguration example
optionsfetchConfiguration = credentials: 'same-origin'
Every enujs-api request will run fetch with this configuration:
Environment
Node and browser (es2015)