New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

bifchain-js-query

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bifchain-js-query

A simple query module for the BifChain.

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

bifchain-js-query

A simple query module for the Bif Core.

js-standard-style

Install

$ npm install --save bifchain-js-query

Test

The tests can be run with Node.js

$ npm test

Usage

Create bifchain-js-query instance

const Query = require('bifchain-js-query')
const query = new Query({
  host: 'https://seed1-node.bitfactory.cn',
  timeout: 1000 * 60
})

Get account info

const address = 'did:bid:efBpp9wSged1ZZrCufBm67JLUcRU9cu2'
const accountInfo = await query.getAccountInfo(address)
console.log(accountInfo)

Get account metadata

const address = 'did:bid:efBpp9wSged1ZZrCufBm67JLUcRU9cu2'
const key = 'test'
const metadata = await query.getMetadata(address, key)
console.log(metadata)

Get account balance

const address = 'did:bid:efBpp9wSged1ZZrCufBm67JLUcRU9cu2'
const balance = await query.getBalance(address)
console.log(balance)

Get account nonce

const address = 'did:bid:efBpp9wSged1ZZrCufBm67JLUcRU9cu2'
const nonce = await query.getNonce(address)
console.log(nonce)

Get block info

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

Get get latest info

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

Get validators for specific blockNumber

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

Get latest validators

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

Send transaction


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

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

FAQs

Package last updated on 22 Nov 2022

Did you know?

Socket

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