Socket
Socket
Sign inDemoInstall

adamant-api

Package Overview
Dependencies
180
Maintainers
3
Versions
46
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    adamant-api

JavaScript API library for the ADAMANT Blockchain


Version published
Weekly downloads
40
decreased by-48.05%
Maintainers
3
Created
Weekly downloads
 

Changelog

Source

[2.3.0] - 2024-03-01

Added

  • transformTransactionQuery function:

    const transformed = transformTransactionQuery({
      fromHeight: 7585271,
      and: {
        toHeight: 7586280,
      },
      or: {
        senderId: 'U18132012621449491414',
      },
    });
    
    /**
     * {
     *   and:fromHeight: 7585271,
     *   and:toHeight: 7586280,
     *   or:senderId: 'U18132012621449491414'
     * }
     */
    console.log(transformed);
    

Fixed

  • TypeScript: id should have string type in the methods: api.getTransaction(), api.getQueuedTransaction(), api.getUnconfirmedTransaction()

  • Global installation of packages that use adamant-api as its dependency

  • Transaction query methods:

    const blocks = await api.getTransactions({
      fromHeight: 7585271,
      and: {
        toHeight: 7586280,
      },
      or: {
        senderId: 'U18132012621449491414',
      },
    });
    

Readme

Source

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
  • Creating a delegate
  • Voting for delegates
  • Caching public keys
  • Encrypting and decrypting of messages
  • Forming and signing transactions
  • Working with ADM key pairs
  • Generating crypto wallets (addresses 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

Install library from npm:

npm i adamant-api

Initialize the library:

const { AdamantApi } = require('adamant-api')

const nodes = [
  "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 = new AdamantApi({
  nodes,
});

Request example:

const response = await api.getBlocks()

console.log(response.data)

Documentation

See Wiki for documentation and usage.

Keywords

FAQs

Last updated on 26 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc