1.0.43 • Published 2 years ago

@biut-block/biutjs-datahandler v1.0.43

Weekly downloads
81
License
ISC
Repository
github
Last release
2 years ago

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

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)
1.0.43

2 years ago

1.0.42

3 years ago

1.0.41

3 years ago

1.0.40

3 years ago

1.0.39

3 years ago

1.0.38

3 years ago

1.0.37

3 years ago

1.0.36

3 years ago

1.0.35

3 years ago

1.0.34

3 years ago

1.0.33

3 years ago

1.0.32

3 years ago

1.0.31

3 years ago

1.0.30

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.27

3 years ago

1.0.26

3 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago