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

rich-client-js

v1.2.1

Published

Rich_API_client_js is a library which provides abstraction to communicate with Rich_API

Downloads

18

Readme

ParallelChain F Rich API JavaScript Client Library (pchain-client-js).

This crate is a library that wraps networked interactions with ParallelChain F Rich APIs so that user code does not have to manually produce request bodies and hit HTTP endpoints.

Usage Example

    let client = new RichAPIClient("http://node.digitial-transaction.net");

Methods

RichAPIClient implements methods which queries blockchain information by sending HTTP request to the Rich API endpoint.

Blocks

    let order = "asc";
    let block_hash = "2jdtP11Mco8Fk1zwzl1Ivi5q1wnyRrUT0d6CfSHA3kY";
    let tx_hash = "c72Q4KpwDFVsRurgD_U_rzYi_A05qvZHM8Qma4nyfyc";
    let block_height = 451;

    let blocks = await rich_api_client.blocks.get_blocks("block_number", block_height.toString(), 5, order);
    println!(blocks);
    
    // Output 
    [
      {
        "header": {
          "app_id": 0,
          "block_hash": "EWPT6rZ7wvttVMkJK9QCYyAbpGQw9fWUD9YaDeZTC9k",
          "height": 0,
          "justify": {
            "view_number": 0,
            "block_hash": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
            "sigs": {
              "signatures": [
                null,
                null,
                null,
                null
              ],
              "count_some": 0
            }
          },
          "data_hash": "DzqBDlw4PuQWq_0TsMKCs0WxuPmhJwgMPBU-IrylVIo",
          "version_number": 0,
          "timestamp": 1672531200,
          "txs_hash": "B-6jdrGxeH-2BXunZVwh5oOE4Wjk4UPM4xO9LKqzgIk",
          "state_hash": "nWM0MM310GhtsTbAsiy36NhA5VoR7moGZIPfCYXqAGE",
          "receipts_hash": "BmgP8vssG41IAfsU9f7BskmNeY64IiYpzJvfDruLGtI"
        },
        "transactions": [
          {
            "from_address": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
            "to_address": "v7d8cqWDNt4uqpsSO1mDsK5KFnzmoC07k_uk6j7WSMc",
            "value": 100000000000000000,
            "tip": 0,
            "gas_limit": 0,
            "gas_price": 0,
            "data": "",
            "n_txs_on_chain_from_address": 0,
            "hash": "du4tRb5NGd1Mz_vR0n5iampNwe2D7zduVls7ap_UeBg",
            "signature": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
          },
          {
            "from_address": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
            "to_address": "YESSKvjZvHI9MH_RMMLsqrSBoHZ_56OA5IMsCwpu8lQ",
            "value": 100000000000000000,
            "tip": 0,
            "gas_limit": 0,
            "gas_price": 0,
            "data": "",
            "n_txs_on_chain_from_address": 0,
            "hash": "_66srKnRx9o4WzN9aREIW467BpEwLkJbp_xFtb2bRQo",
            "signature": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
          }
        ],
        "receipts": [
          {
            "status_code": 0,
            "gas_consumed": 0,
            "return_value": [],
            "events": []
          },
          {
            "status_code": 0,
            "gas_consumed": 0,
            "return_value": [],
            "events": []
          }
        ]
      }
    ]

Transactions

    let order = "asc".to_string();
    let tx_hash = "c72Q4KpwDFVsRurgD_U_rzYi_A05qvZHM8Qma4nyfyc";

    const txn_status_code = await richAPI.transactions.getTxnByStatusCode('latest', 'true', 0, 'all', 1, 'asc')
    println!(txn_status_code);

    // Output 
    {
      "transactions": [{
            "tx_num": 2,
            "transaction": {
            "from_address": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
            "to_address": "YESSKvjZvHI9MH_RMMLsqrSBoHZ_56OA5IMsCwpu8lQ",
            "value": 100000000000000000,
            "tip": 0,
            "gas_limit": 0,
            "gas_price": 0,
            "data": "",
            "n_txs_on_chain_from_address": 0,
            "hash": "_66srKnRx9o4WzN9aREIW467BpEwLkJbp_xFtb2bRQo",
            "signature": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
            },
            "receipt": {
            "status_code": 0,
            "gas_consumed": 0,
            "return_value": [],
              "events": []
          }
        }]
    }

    const public_address = 'YESSKvjZvHI9MH_RMMLsqrSBoHZ_56OA5IMsCwpu8lQ';
    let filter_map = new Map();
    filter_map.set("to_address", public_address)
    const txs = await richAPI.transactions.getTransactions('latest', 'true', filter_map, 'all', 1, 'asc')
    console.log(txs);

    // Output 
    {
        "transactions": [
        {
            "tx_num": 2,
            "transaction": {
            "from_address": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
            "to_address": "YESSKvjZvHI9MH_RMMLsqrSBoHZ_56OA5IMsCwpu8lQ",
            "value": 100000000000000000,
            "tip": 0,
            "gas_limit": 0,
            "gas_price": 0,
            "data": "",
            "n_txs_on_chain_from_address": 0,
            "hash": "_66srKnRx9o4WzN9aREIW467BpEwLkJbp_xFtb2bRQo",
            "signature": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
            },
            "receipt": {
            "status_code": 0,
            "gas_consumed": 0,
            "return_value": [],
            "events": []
            }
        }
    ]
    }

Summary of methods provided by RichAPIClient:

|Method|Description| |:---|:---| |getBlocks |filters blocks by identifier| |getBlockSummaries|filters block summaries by identifier| |getBlockHeaders|filters block headers by identifier| |getTxnByEventTopic|filters transactions by event topic| |getTxnSummariesByEventTopic| filter transaction summaries by event topic | |getTxnByStatusCode|get transactions by status code| |getTxnSummariesByStatusCode|filters transaction summaries by status code| |getTransactions|filters transactions by identifier| |getTxnSummariesByIdentifier|filters transaction summaries by identifier|