@sec-block/secjs-datahandler
sec blockchain data handler lib
Last updated 7 months ago by zuweihan1992 .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @sec-block/secjs-datahandler 
SYNC missed versions from official npm registry.

JavaScript Style Guide

[JavaScript Style Guide]

SECDataHandler

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

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

The databases contain following methods:

TokenBlockChainDB

Kind: global class

AccountDB

Kind: global class

ProductDB

Kind: global class


TokenBlockChainDB Methods

new TokenBlockChainDB(config)

Param Type Description
config Object contains 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

Param Type Description
tokenData Array, Object single token block data or full token block chain data
callback function callback function, returns error if exist

tokenBlockChainDB.isTokenBlockChainDBEmpty(callback) ⇒ None

Check whether the token block chain database is empty

Kind: instance method of TokenBlockChainDB

Param Type Description
callback function callback function, callback arguments (err, emptyFlag)

tokenBlockChainDB.getTokenBlockChainDB(callback) ⇒ None

Get all the block datas from token block chain database

Kind: instance method of TokenBlockChainDB

Param Type Description
callback function callback 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

Param Type Description
blockHashArray String, Array block hash values, string or array format
callback function callback 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

Param Type Description
minBlockNumber Integer minimum block number
maxBlockNumber Integer maximum block number
callback function callback 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

Param Type Description
blockHeight Integer blocks with larger height will be deleted from database
callback function callback 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

Param Type Description
pos Integer block add/update starting position
blockArray Array array of block data(json object)
callback function callback function, callback arguments (err)

tokenBlockChainDB.findTxForUser(userAddress, callback) ⇒ None

Find all previous transactions for a user

Kind: instance method of TokenBlockChainDB

Param Type Description
userAddress String user account address
callback function callback 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

Param Type Description
txHash String transaction hash
callback function callback function, callback arguments (txArray, err)



AccountDB Methods

new AccountDB(config)

Param Type Description
config Object contains the relative path for storing database

accountDB.writeUserInfoToAccountDB(accDataList, callback) ⇒ None

Write user account information to account database

Kind: instance method of AccountDB

Param Type Description
accDataList Array, Object single user account info(json object) or a list of user account info
callback function callback 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

Param Type Description
accNameList Array, String single 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

Param Type Description
callback function callback function, callback arguments (err, emptyFlag)

accountDB.getAccountDB(callback) ⇒ None

Get all the data in account database

Kind: instance method of AccountDB

Param Type Description
callback function callback function, callback arguments (err, block object array)

accountDB.isAccountInAccountDB(accName, callback) ⇒ None

Check whether an account is in AccountDB

Kind: instance method of AccountDB

Param Type Description
accName String account name
callback function callback function, callback arguments (err, block object array)



ProductDB Methods

new ProductDB(config)

Param Type Description
config Object contains 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

Param Type Description
txData Array, Object single tx block data or full transaction block chain data
callback function callback function, returns error if exist

productDB.isProductDBEmpty(callback) ⇒ None

Check whether the product database is empty

Kind: instance method of ProductDB

Param Type Description
callback function callback function, callback arguments (err, emptyFlag)

productDB.getProductDB(callback) ⇒ None

Get all the data in product database

Kind: instance method of ProductDB

Param Type Description
callback function callback function, callback arguments (err, block object array)

Current Tags

  • 1.1.53                                ...           latest (7 months ago)

69 Versions

  • 1.1.53                                ...           7 months ago
  • 1.1.52                                ...           8 months ago
  • 1.1.51                                ...           8 months ago
  • 1.1.50                                ...           8 months ago
  • 1.1.49                                ...           8 months ago
  • 1.1.48                                ...           8 months ago
  • 1.1.47                                ...           8 months ago
  • 1.1.46                                ...           9 months ago
  • 1.1.45                                ...           9 months ago
  • 1.1.44                                ...           9 months ago
  • 1.1.43                                ...           9 months ago
  • 1.1.42                                ...           10 months ago
  • 1.1.41                                ...           10 months ago
  • 1.1.40                                ...           a year ago
  • 1.1.39                                ...           a year ago
  • 1.1.38                                ...           a year ago
  • 1.1.37                                ...           a year ago
  • 1.1.36                                ...           a year ago
  • 1.1.35                                ...           a year ago
  • 1.1.34                                ...           a year ago
  • 1.1.33                                ...           a year ago
  • 1.1.32                                ...           a year ago
  • 1.1.31                                ...           a year ago
  • 1.1.30                                ...           a year ago
  • 1.1.29                                ...           a year ago
  • 1.1.28                                ...           a year ago
  • 1.1.27                                ...           a year ago
  • 1.1.26                                ...           a year ago
  • 1.1.25                                ...           a year ago
  • 1.1.24                                ...           a year ago
  • 1.1.23                                ...           a year ago
  • 1.1.22                                ...           a year ago
  • 1.1.21                                ...           a year ago
  • 1.1.20                                ...           a year ago
  • 1.1.19                                ...           a year ago
  • 1.1.18                                ...           a year ago
  • 1.1.17                                ...           a year ago
  • 1.1.16                                ...           a year ago
  • 1.1.15                                ...           a year ago
  • 1.1.14                                ...           a year ago
  • 1.1.13                                ...           a year ago
  • 1.1.12                                ...           a year ago
  • 1.1.11                                ...           a year ago
  • 1.1.10                                ...           a year ago
  • 1.1.9                                ...           a year ago
  • 1.1.8                                ...           a year ago
  • 1.1.7                                ...           a year ago
  • 1.1.6                                ...           a year ago
  • 1.1.5                                ...           a year ago
  • 1.1.4                                ...           a year ago
  • 1.1.3                                ...           a year ago
  • 1.1.2                                ...           a year ago
  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.14                                ...           a year ago
  • 1.0.13                                ...           a year ago
  • 1.0.12                                ...           a year ago
  • 1.0.11                                ...           a year ago
  • 1.0.10                                ...           a year ago
  • 1.0.9                                ...           a year ago
  • 1.0.8                                ...           a year ago
  • 1.0.7                                ...           a year ago
  • 1.0.6                                ...           a year ago
  • 1.0.5                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Downloads
Today 0
This Week 0
This Month 141
Last Day 0
Last Week 140
Last Month 70
Dependencies (7)
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |