refactor(blockchain.js): Refactored blockchain.js library [WIP]

This commit is contained in:
danielhumgon
2020-02-14 13:02:58 -04:00
parent e83aaad1e3
commit 380acbbfa4
2 changed files with 1478 additions and 1072 deletions
+17 -14
View File
@@ -36,19 +36,22 @@ class Blockchain {
this.router.get("/getBlockchainInfo", this.getBlockchainInfo) this.router.get("/getBlockchainInfo", this.getBlockchainInfo)
this.router.get("/getBlockCount", this.getBlockCount) this.router.get("/getBlockCount", this.getBlockCount)
this.router.get("/getBlockHeader/:hash", this.getBlockHeaderSingle) this.router.get("/getBlockHeader/:hash", this.getBlockHeaderSingle)
this.router.post("/getBlockHeader", getBlockHeaderBulk) this.router.post("/getBlockHeader", this.getBlockHeaderBulk)
this.router.get("/getChainTips", getChainTips) this.router.get("/getChainTips", this.getChainTips)
this.router.get("/getDifficulty", getDifficulty) this.router.get("/getDifficulty", this.getDifficulty)
this.router.get("/getMempoolEntry/:txid", getMempoolEntrySingle) this.router.get("/getMempoolEntry/:txid", this.getMempoolEntrySingle)
this.router.post("/getMempoolEntry", getMempoolEntryBulk) this.router.post("/getMempoolEntry", this.getMempoolEntryBulk)
this.router.get("/getMempoolAncestors/:txid", getMempoolAncestorsSingle) this.router.get(
this.router.get("/getMempoolInfo", getMempoolInfo) "/getMempoolAncestors/:txid",
this.router.get("/getRawMempool", getRawMempool) this.getMempoolAncestorsSingle
this.router.get("/getTxOut/:txid/:n", getTxOut) )
this.router.get("/getTxOutProof/:txid", getTxOutProofSingle) this.router.get("/getMempoolInfo", this.getMempoolInfo)
this.router.post("/getTxOutProof", getTxOutProofBulk) this.router.get("/getRawMempool", this.getRawMempool)
this.router.get("/verifyTxOutProof/:proof", verifyTxOutProofSingle) this.router.get("/getTxOut/:txid/:n", this.getTxOut)
this.router.post("/verifyTxOutProof", verifyTxOutProofBulk) this.router.get("/getTxOutProof/:txid", this.getTxOutProofSingle)
this.router.post("/getTxOutProof", this.getTxOutProofBulk)
this.router.get("/verifyTxOutProof/:proof", this.verifyTxOutProofSingle)
this.router.post("/verifyTxOutProof", this.verifyTxOutProofBulk)
} }
root(req, res, next) { root(req, res, next) {
@@ -532,7 +535,7 @@ class Blockchain {
options.data.method = "getmempoolancestors" options.data.method = "getmempoolancestors"
options.data.params = [txid, verbose] options.data.params = [txid, verbose]
const response = await this.axios.request(requestConfig) const response = await this.axios.request(options)
// console.log(`response: ${util.inspect(response)}`) // console.log(`response: ${util.inspect(response)}`)
return res.json(response.data.result) return res.json(response.data.result)
+1461 -1058
View File
File diff suppressed because it is too large Load Diff