ADAMANT JavaScript API library
ADAMANT JavaScript API is a library intended to interact with ADAMANT blockchain for JavaScript developers. Also ADAMANT Console and ADAMANT node Direct API are available.
Features:
- High reliability
- GET-requests to the blockchain
- Sending tokens
- Sending messages
- Caching public keys
- Encrypting and decrypting of messages
- Forming and signing transactions
- Working with ADM key pairs
- Generating ETH crypto address and keys, bound to ADM account
- Working with ADAMANT epoch time
- Support for WebSocket connections
- Logging warnings, errors, info
Reliability
JS API shows decentralization in action—if a network node cannot fulfill your request, the library will redirect it to another node, and so on several times. You will get the result and you do not need to think about processing the request.
Health Check system pings all nodes in the list using /status
endpoint, and connects to a node with actual height. When the library unable to process request with current node, it forces to re-initialize Health Check.
Usage
Add current version of ADAMANT JavaScript API library in project's package.json
in dependencies
section:
"dependencies": {
"adamant-api": "^1.0.0-beta.2",
Or install library from npm:
npm i adamant-api
Initialize the library:
const nodesList = [
"http://localhost:36666",
"https://endless.adamant.im",
"https://clown.adamant.im",
"http://23.226.231.225:36666",
"http://88.198.156.44:36666",
"https://lake.adamant.im"
];
const api = require('adamant-api')({ node: nodesList, logLevel: 'info' });
Request example:
api.get('blocks').then(response => {
console.log(response.data)
})
Documentation
See Wiki for documentation and usage.