Skip to content

Commit

Permalink
resolving merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
ericx2x committed May 21, 2018
2 parents 68413ad + 507b57a commit e6247b9
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 27 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rest-cloud",
"version": "0.1.6",
"version": "0.1.8",
"private": true,
"scripts": {
"start": "node ./bin/www"
Expand Down
121 changes: 108 additions & 13 deletions public/bitbox-rest-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,10 @@
],
"responses": {
"200": {
"description": "successful operation"
},
"400": {
"description": "Invalid tag value"
"description": "successful operation",
"schema": {
"$ref": "#/definitions/BlockCount"
}
}
}
}
Expand All @@ -390,10 +390,17 @@
],
"responses": {
"200": {
"description": "successful operation"
"description": "successful operation",
"schema": {
"$ref": "#/definitions/BlockHash"
}
},
"400": {
"description": "Invalid tag value"
"description": "Block not found",
"schema": {
"status": 500,
"message": "Block not found"
}
}
}
}
Expand Down Expand Up @@ -428,10 +435,17 @@
],
"responses": {
"200": {
"description": "successful operation"
"description": "successful operation",
"schema": {
"$ref": "#/definitions/BlockHeader"
}
},
"400": {
"description": "Invalid tag value"
"description": "Block not found",
"schema": {
"status": 500,
"message": "Block not found"
}
}
}
}
Expand Down Expand Up @@ -467,7 +481,10 @@
],
"responses": {
"200": {
"description": "successful operation"
"description": "successful operation",
"schema": {
"$ref": "#/definitions/Difficulty"
}
}
}
}
Expand Down Expand Up @@ -591,10 +608,10 @@
],
"responses": {
"200": {
"description": "successful operation"
},
"400": {
"description": "Invalid tag value"
"description": "successful operation",
"schema": {
"$ref": "#/definitions/MempoolInfo"
}
}
}
}
Expand Down Expand Up @@ -1771,6 +1788,84 @@
}
}
},
"BlockCount": {
"type": "number"
},
"BlockHash": {
"type": "string"
},
"BlockHeader": {
"type": "object",
"properties": {
"hash": {
"type": "string"
},
"confirmations": {
"type": "number"
},
"height": {
"type": "number"
},
"version": {
"type": "number"
},
"versionHex": {
"type": "string"
},
"merkleroot": {
"type": "string"
},
"time": {
"type": "number"
},
"mediantime": {
"type": "number"
},
"nonce": {
"type": "number"
},
"bits": {
"type": "string"
},
"difficulty": {
"type": "number",
"format": "float"
},
"chainwork": {
"type": "string"
},
"previousblockhash": {
"type": "string"
},
"nextblockhash": {
"type": "string"
}
}
},
"Difficulty": {
"type": "number",
"format": "float"
},
"MempoolInfo": {
"type": "object",
"properties": {
"size": {
"type": "number"
},
"bytes": {
"type": "number"
},
"usage": {
"type": "number"
},
"maxmempool": {
"type": "number"
},
"mempoolminfee": {
"type": "number"
},
}
},
"transactionDetails": {
"type": "object",
"properties": {
Expand Down
26 changes: 13 additions & 13 deletions routes/blockchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ router.get('/getBlockHeader/:hash', function(req, res, next) {
}
BITBOX.Blockchain.getBlockHeader(req.params.hash, verbose)
.then((result) => {
res.json({ result: result });
res.json(result);
}, (err) => { console.log(err);
});
});

router.get('/getChainTips', function(req, res, next) {
BITBOX.Blockchain.getChainTips()
.then((result) => {
res.json({result: result});
res.json(result);
}, (err) => { console.log(err);
});
});
Expand All @@ -93,7 +93,7 @@ router.get('/getMempoolAncestors/:txid', function(req, res, next) {
}
BITBOX.Blockchain.getMempoolAncestors(req.params.txid, verbose)
.then((result) => {
res.json({ result: result });
res.json(result);
}, (err) => { console.log(err);
});
});
Expand All @@ -105,23 +105,23 @@ router.get('/getMempoolDescendants/:txid', function(req, res, next) {
}
BITBOX.Blockchain.getMempoolDescendants(req.params.txid, verbose)
.then((result) => {
res.json({ result: result });
res.json(result);
}, (err) => { console.log(err);
});
});

router.get('/getMempoolEntry/:txid', function(req, res, next) {
BITBOX.Blockchain.getMempoolEntry(req.params.txid)
.then((result) => {
res.json({ result: result });
res.json(result);
}, (err) => { console.log(err);
});
});

router.get('/getMempoolInfo', function(req, res, next) {
BITBOX.Blockchain.getMempoolInfo()
.then((result) => {
res.json({ result: result });
res.json(result);
}, (err) => { console.log(err);
});
});
Expand All @@ -133,7 +133,7 @@ router.get('/getRawMempool', function(req, res, next) {
}
BITBOX.Blockchain.getRawMempool(verbose)
.then((result) => {
res.json({ result: result });
res.json(result);
}, (err) => { console.log(err);
});
});
Expand All @@ -145,7 +145,7 @@ router.get('/getTxOut/:txid/:n', function(req, res, next) {
}
BITBOX.Blockchain.getTxOut(req.params.txid, parseInt(req.params.n), include_mempool)
.then((result) => {
res.json({ result: result });
res.json(result);
}, (err) => { console.log(err);
});
});
Expand All @@ -154,31 +154,31 @@ router.get('/getTxOutProof/:txids', function(req, res, next) {
// TODO finish this
BITBOX.Blockchain.getTxOutProof(req.params.txids)
.then((result) => {
res.json({ result: result });
res.json(result);
}, (err) => { console.log(err);
});
});

router.get('/getTxOutSetInfo', function(req, res, next) {
BITBOX.Blockchain.getTxOutSetInfo()
.then((result) => {
res.json({ result: result });
res.json(result);
}, (err) => { console.log(err);
});
});

router.get('/preciousBlock/:hash', function(req, res, next) {
BITBOX.Blockchain.preciousBlock(req.params.hash)
.then((result) => {
res.json({ result: result });
res.json(result);
}, (err) => { console.log(err);
});
});

router.post('/pruneBlockchain/:height', function(req, res, next) {
BITBOX.Blockchain.pruneBlockchain(req.params.height)
.then((result) => {
res.json({ result: result });
res.json(result);
}, (err) => { console.log(err);
});
});
Expand All @@ -195,7 +195,7 @@ router.get('/verifyChain', function(req, res, next) {
router.get('/verifyTxOutProof/:proof', function(req, res, next) {
BITBOX.Blockchain.verifyTxOutProof(req.params.proof)
.then((result) => {
res.json({ result: result });
res.json(result);
}, (err) => { console.log(err);
});
});
Expand Down

0 comments on commit e6247b9

Please sign in to comment.