Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@biut-block/biutjs-database

Package Overview
Dependencies
Maintainers
5
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@biut-block/biutjs-database

sec blockchain database middleware

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

JavaScript Style Guide

JavaScript Style Guide

SECDataBase

This package uses leveldb to store and handle data from SEC blockchain, this repository includes operations to four databases:

  • Token Block Chain Database
  • Token Tx Database
  • Transaction Block Chain Database
  • Transaction Tx Database
  • Account Database
  • Product Database

The databases contain following methods:

TokenBlockChainDB

Kind: global class

TxBlockChainDB

Kind: global class

AccountDB

Kind: global class

ProductDB

Kind: global class


TokenBlockChainDB Methods

new TokenBlockChainDB(config)

ParamTypeDescription
configObjectcontains the relative path for storing database

tokenBlockChainDB.writeTokenBlockToDB(tokenData, callback) ⇒ None

Write single token block or full token chain data to database

Kind: instance method of TokenBlockChainDB

ParamTypeDescription
tokenDataArray, Objectsingle token block data or full token block chain data
callbackfunctioncallback function, returns error if exist

tokenBlockChainDB.isTokenBlockChainDBEmpty(callback) ⇒ None

Check whether the token block chain database is empty

Kind: instance method of TokenBlockChainDB

ParamTypeDescription
callbackfunctioncallback function, callback arguments (err, emptyFlag)

tokenBlockChainDB.getTokenBlockChainDB(callback) ⇒ None

Get all the block datas from token block chain database

Kind: instance method of TokenBlockChainDB

ParamTypeDescription
callbackfunctioncallback function, callback arguments (err, block object array)

tokenBlockChainDB.getTokenBlockFromDB(blockHashArray, callback) ⇒ None

Get token blocks according to block hash values

Kind: instance method of TokenBlockChainDB

ParamTypeDescription
blockHashArrayString, Arrayblock hash values, string or array format
callbackfunctioncallback function, callback arguments (err, block object array)

tokenBlockChainDB.getTokenChain(minBlockNumber, maxBlockNumber, callback) ⇒ None

Get token block chain data, from number 'minBlockNumber' to number 'maxBlockNumber'

Kind: instance method of TokenBlockChainDB

ParamTypeDescription
minBlockNumberIntegerminimum block number
maxBlockNumberIntegermaximum block number
callbackfunctioncallback function, callback arguments (err, block object array)

tokenBlockChainDB.delBlocksFromHeight(blockHeight, callback) ⇒ None

Delete blocks which have a higher height than the input 'blockHeight' argument

Kind: instance method of TokenBlockChainDB

ParamTypeDescription
blockHeightIntegerblocks with larger height will be deleted from database
callbackfunctioncallback function, callback arguments (err)

tokenBlockChainDB.addUpdateBlock(pos, blockArray, callback) ⇒ None

Add new blocks from a specific position if the blocks does not exist
Update old blocks from a specific position if the blocks already exist

Kind: instance method of TokenBlockChainDB

ParamTypeDescription
posIntegerblock add/update starting position
blockArrayArrayarray of block data(json object)
callbackfunctioncallback function, callback arguments (err)

tokenBlockChainDB.findTxForUser(userAddress, callback) ⇒ None

Find all previous transactions for a user

Kind: instance method of TokenBlockChainDB

ParamTypeDescription
userAddressStringuser account address
callbackfunctioncallback function, callback arguments (txArray, err)

tokenBlockChainDB.findTx(txHash, callback) ⇒ None

Find a previous transactions for a user by transaction hash

Kind: instance method of TokenBlockChainDB

ParamTypeDescription
txHashStringtransaction hash
callbackfunctioncallback function, callback arguments (txArray, err)



TxBlockChainDB Methods

new TxBlockChainDB(config)

ParamTypeDescription
configObjectcontains the relative path for storing database

txBlockChainDB.writeTxBlockToDB(txData, callback) ⇒ None

Write single tx block or full transaction chain data to database

Kind: instance method of TxBlockChainDB

ParamTypeDescription
txDataArray, Objectsingle tx block data or full transaction block chain data
callbackfunctioncallback function, returns error if exist

txBlockChainDB.isTxBlockChainDBEmpty(callback) ⇒ None

Check whether the transaction block chain database is empty

Kind: instance method of TxBlockChainDB

ParamTypeDescription
callbackfunctioncallback function, callback arguments (err, emptyFlag)

txBlockChainDB.getTxBlockChainDB(callback) ⇒ None

Get all the block datas from transaction block chain database

Kind: instance method of TxBlockChainDB

ParamTypeDescription
callbackfunctioncallback function, callback arguments (err, block object array)

txBlockChainDB.getTxBlockFromDB(blockHashArray, callback) ⇒ None

Get transaction blocks according to block hash values

Kind: instance method of TxBlockChainDB

ParamTypeDescription
blockHashArrayString, Arrayblock hash values, string or array format
callbackfunctioncallback function, callback arguments (err, block object array)

txBlockChainDB.getTxChain(minBlockNumber, maxBlockNumber, callback) ⇒ None

Get transaction block chain data, from number 'minBlockNumber' to number 'maxBlockNumber'

Kind: instance method of TxBlockChainDB

ParamTypeDescription
minBlockNumberIntegerminimum block number
maxBlockNumberIntegermaximum block number
callbackfunctioncallback function, callback arguments (err, block object array)

txBlockChainDB.delBlocksFromHeight(blockHeight, callback) ⇒ None

Delete blocks which have a higher height than the input 'blockHeight' argument

Kind: instance method of TxBlockChainDB

ParamTypeDescription
blockHeightIntegerblocks with larger height will be deleted from database
callbackfunctioncallback function, callback arguments (err)

txBlockChainDB.addUpdateBlock(pos, blockArray, callback) ⇒ None

Add new blocks from a specific position if the blocks does not exist
Update old blocks from a specific position if the blocks already exist

Kind: instance method of TxBlockChainDB

ParamTypeDescription
posIntegerblock add/update starting position
blockArrayArrayarray of block data(json object)
callbackfunctioncallback function, callback arguments (err)

TxBlockChainDB.findTxForUser(userAddress, callback) ⇒ None

Find all previous transactions for a user

Kind: instance method of TxBlockChainDB

ParamTypeDescription
userAddressStringuser account address
callbackfunctioncallback function, callback arguments (txArray, err)



AccountDB Methods

new AccountDB(config)

ParamTypeDescription
configObjectcontains the relative path for storing database

accountDB.writeUserInfoToAccountDB(accDataList, callback) ⇒ None

Write user account information to account database

Kind: instance method of AccountDB

ParamTypeDescription
accDataListArray, Objectsingle user account info(json object) or a list of user account info
callbackfunctioncallback function, returns error if exist

accountDB.readUserInfofromAccountDB(accNameList) ⇒ Promise Object

Read user account information from account database, returns a promise object

Kind: instance method of AccountDB

ParamTypeDescription
accNameListArray, Stringsingle user account address(string) or a list of user account addresses

accountDB.isAccountDBEmpty(callback) ⇒ None

Check whether the account database is empty

Kind: instance method of AccountDB

ParamTypeDescription
callbackfunctioncallback function, callback arguments (err, emptyFlag)

accountDB.getAccountDB(callback) ⇒ None

Get all the data in account database

Kind: instance method of AccountDB

ParamTypeDescription
callbackfunctioncallback function, callback arguments (err, block object array)

accountDB.isAccountInAccountDB(accName, callback) ⇒ None

Check whether an account is in AccountDB

Kind: instance method of AccountDB

ParamTypeDescription
accNameStringaccount name
callbackfunctioncallback function, callback arguments (err, block object array)



ProductDB Methods

new ProductDB(config)

ParamTypeDescription
configObjectcontains the relative path for storing database

productDB.writeTxBlockToDB(txData, callback) ⇒ None

Write single transaction block or full transaction chain data to product database

Kind: instance method of ProductDB

ParamTypeDescription
txDataArray, Objectsingle tx block data or full transaction block chain data
callbackfunctioncallback function, returns error if exist

productDB.isProductDBEmpty(callback) ⇒ None

Check whether the product database is empty

Kind: instance method of ProductDB

ParamTypeDescription
callbackfunctioncallback function, callback arguments (err, emptyFlag)

productDB.getProductDB(callback) ⇒ None

Get all the data in product database

Kind: instance method of ProductDB

ParamTypeDescription
callbackfunctioncallback function, callback arguments (err, block object array)

Keywords

FAQs

Package last updated on 26 May 2019

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc