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

@appchain/plugin

v0.20.1

Published

Promise based [CITA RPC](https://docs.nervos.org/cita/#/rpc_guide/rpc) toolkit.

Downloads

15

Readme

Build Status npm (scoped) MIT AppChain

AppChain-Plugin

Promise based CITA RPC toolkit.

Features

  • Supports the Promise API

Installing

$ yarn add @appchain/plugin

Example

import appchainPlugin from '@appchain/plugin'

const SERVER = 'localhost:1337'

const { appchain } = appchainPlugin({ server: SERVER })

/**
 * @function metadata
 * @description request metadata of specified chain
 * @param {{blockNumber}}
 * @return {Metadata}
 */
appchain.metadata({ blockNumer: '0x0' }).then(metadata => console.log(metadata))

/**
 * @function netPeerCount
 * @description request net peer count
 * @param null
 * @returns {string} peerCount
 */
appchain.netPeerCount().then(count => console.log(count))

/**
 * @function getBlockByNumber
 * @description request block by block number
 * @param {string} quantity - quantity is the current block height of CITA
 * @param {boolean} detialed - return transaction list if true, otherwise return hash of transaction
 * @returns {object} block
 */
appchain
  .getBlockByNumber({
    quantity: blockNumber,
    detailed: true,
  })
  .then(block => console.log(block))

/**
 * @function getBlockByHash
 * @description request block by block hash
 * @param {string} hash - block hash
 * @param {boolean} detailed - return transaction list if true, otherwise return hash of transaction
 * @returns {object} block
 */
appchain
  .getBlockByHash({
    hash: blockHash,
    detailed: true,
  })
  .then(block => console.log(block))

/**
 * @function getBlockHistory
 * @description retrieve blocks of height from (by - count + 1) to by
 * @param {by: string, count: number} - by: the startpoint of history, count: the count of records to retrieve
 * @return {array} list of block
 */
appchain
  .getBlockHistory({
    by: '0x4bb99',
    count: 5,
  })
  .then(blocks => console.log(blocks))

/**
 * @function getTransaction
 * @description request transaction detail
 * @param {string} transactionHash
 * @return {object} Transaction
 */
appchain.getTransaction('0x...').then(transaction => console.log(transaction))

/**
 * @function getLogs
 * @description requestion log on specified block
 * @param {{topics: Topic[]}}
 * @return {object} Logs
 */
appchain.getLogs({ topics: [] }).then(logs => console.log(logs))

/**
 * @function getBalance
 * @description get balance of specified address
 * @param {{addr}} - addr: specified address
 * @return {Balance}
 */
appchain.getBalance({ addr: '0x...' }).then(balance => console.log(balance))

/**
 * @function getTransactionCount
 * @description get transaction count of specified addr
 * @param {{addr, blockNumber}}
 * @return {TransactionCount}
 */
appchain.getTransactionCount({ addr: '0x..', blockNumber: 'latest' }).then(count => console.log(count))

/**
 * @function getTransactionProof
 * @description get transaction proof of specified transaction hash
 * @param {string} trasnactionHash
 * @return {string} transaction proof
 */

appchain.getTransactionProof('0x...').then(proof => console.log(proof))

/**
 * @function newFilter
 * @desc create new filter
 * @param {Array<topic>} topics
 * @return {string} filterId
 */
appchain.newFilter([])

/**
 * @function newBlockFilter
 * @desc create new block filter
 * @param None
 * @return {string} filterId
 */
appchain.newBlockFilter()

/**
 * @function uninstallFilter
 * @desc uninstall filter
 * @param {string} filterId
 * @return {boolean} success
 */

appchain.uninstallFilter(id)

/**
 * @function getFilterChanges
 * @desc get filter changes
 * @param {string} filterId
 * @return {Array<Result>} logArray
 */
appchain.getFilterChanges(id)

/**
 * @function sendSignedTransaction
 * @desc send signed transaction
 * @param {string} signedTransaction
 * @return {object}
 */
appchain.sendSignedTransaction(signedTransaction)

/**
 * @function setServer
 * @description set server
 * @param {string} server
 * @return undefined
 */

appchain.setServer('http://localhost:1301')