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

bubichain-js-query

v1.0.0

Published

A simple query module for the BUBI chain.

Downloads

1

Readme

bubichain-js-query

A simple query module for the BU chain.

js-standard-style

Install

$ npm install --save bubichain-js-query

Test

The tests can be run with Node.js

$ npm test

Usage

Create bubichain-js-query instance

const Query = require('bubichain-js-query')
const query = new Query({
  host: 'http://node.bubidev.cn',
  timeout: 1000 * 60
})

Get account info

const address = 'buQrH4ab27ZCD4WCxGJtmPpFQ5SubFg6t3bj'
const accountInfo = await query.getAccountInfo(address)
console.log(accountInfo)

// result:
// {
//   address: 'buQrH4ab27ZCD4WCxGJtmPpFQ5SubFg6t3bj',
//   balance: '100000000000000000',
//   nonce: '0',
//   assets: [],
//   priv: {
//    master_weight: '1',
//    thresholds: {
//     tx_threshold: '1'
//    }
//   }
// }

Get account metadata

const address = 'buQrH4ab27ZCD4WCxGJtmPpFQ5SubFg6t3bj'
const key = 'test'
const metadata = await query.getMetadata(address, key)
console.log(metadata)

// result:
// {
//   key: 'test',
//   value: 'value',
//   version: 1.0
// }

Get account balance

const address = 'buQrH4ab27ZCD4WCxGJtmPpFQ5SubFg6t3bj'
const balance = await query.getBalance(address)
console.log(balance)

// result:
// "100000000000000000"

Get account nonce

const address = 'buQrH4ab27ZCD4WCxGJtmPpFQ5SubFg6t3bj'
const nonce = await query.getNonce(address)
console.log(nonce)

// result:
// "0"

Get block info

const blockNumber = '100'
const blockInfo = await query.getBlockInfo(blockNumber)
console.log(blockInfo)

// result:
// {
//  closeTime: '1567997123667055',
//  number: '100',
//  txCount: '',
//  version: '1003' 
// }

Get get latest info

const blockInfo = await query.getLatestInfo()
console.log(blockInfo)

// result:
// {
//  closeTime: '1567997123667055',
//  number: '100',
//  txCount: '',
//  version: '1003' 
// }

Get validators for specific blockNumber

const blockNumber = '100'
const validators = await query.getValidators(blockNumber)
console.log(validators)

// result:
// [ 'buQBwe7LZYCYHfxiEGb1RE9XC9kN2qrGXWCY' ]

Get latest validators

const validators = await query.getLatestValidators()
console.log(validators)

// result:
// [ 'buQBwe7LZYCYHfxiEGb1RE9XC9kN2qrGXWCY' ]

Send transaction


const signedTransactionInfo = {
  items: [{
    transaction_blob: blob,
    signatures: signatures
  }]
}

const hash = await query.sendTransaction(signedTransactionInfo)
console.log(hash)

// result:
// '8bb1d61daac2ac2f7726fe5114d0d3747eedbb0e3764d046b8976f8d614982bb'