diff --git a/package-lock.json b/package-lock.json index 4183ed5a..5ef7daa2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "rest-cloud", - "version": "0.1.2", + "version": "0.1.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/public/bitbox-rest-v1.json b/public/bitbox-rest-v1.json index e0e37f7e..c18fb6c0 100644 --- a/public/bitbox-rest-v1.json +++ b/public/bitbox-rest-v1.json @@ -1363,7 +1363,10 @@ ], "responses": { "200": { - "description": "successful operation" + "description": "successful operation", + "schema": { + "$ref": "#/definitions/transactionDetails" + } }, "400": { "description": "Invalid Command" @@ -1400,7 +1403,10 @@ ], "responses": { "200": { - "description": "successful operation" + "description": "successful operation", + "schema": { + "$ref": "#/definitions/CreateMultisig" + } }, "400": { "description": "Invalid Command" @@ -1430,7 +1436,10 @@ ], "responses": { "200": { - "description": "successful operation" + "description": "successful operation", + "schema": { + "$ref": "#/definitions/ValidateAddress" + } }, "400": { "description": "Invalid Command" @@ -1836,24 +1845,201 @@ }, } }, - "RawMempool": { + "RawMempool": { "type": "object", - "properties": { - "size": { + "properties": { + "size": { "type": "number" }, - "bytes": { + "bytes": { "type": "number" }, - "usage": { + "usage": { "type": "number" }, - "maxmempool": { + "maxmempool": { "type": "number" }, - "mempoolminfee": { + "mempoolminfee": { + "type": "number" + } + } + }, + "transactionDetails": { + "type": "object", + "properties": { + "txid": { + "type": "string" + }, + "version": { + "type": "number" + }, + "locktime": { + "type": "number" + }, + "vin": { + "type": "array", + "items": { + "type": "object", + "properties": { + "txid": { + "type": "string" + }, + "vout": { + "type": "number" + }, + "sequence": { + "type": "number" + }, + "n": { + "type": "number" + }, + "scriptSig": { + "type": "object", + "properties": { + "hex": { + "type": "string" + }, + "asm": { + "type": "string" + }, + "value": { + "type": "number" + }, + "legacyAddress": { + "type": "string" + }, + "cashAddress": { + "type": "string" + } + } + } + } + } + }, + "vout": { + "type": "array", + "items": { + "objects": { + "type": "object", + "properties": { + "value": { + "type": "number" + }, + "n": { + "type": "number" + }, + "scriptPubkey": { + "type": "object", + "properties": { + "hex": { + "type": "string" + }, + "asm": { + "type": "string" + }, + "addresses": { + "type": "array", + "items": { + "address": { + "type": "string" + } + } + }, + "type": { + "type": "string" + } + } + }, + "spentTxId": { + "type": "string" + }, + "spentIndex": { + "type": "number" + }, + "spentHeight": { + "type": "number" + } + } + }, + "type": "object", + "properties": { + "value": { + "type": "number" + }, + "n": { + "type": "number" + }, + "scriptPubkey": { + "type": "object", + "properties": { + "hex": { + "type": "string" + }, + "asm": { + "type": "string" + } + } + }, + "spentTxId": { + "type": "string" + }, + "spentIndex": { + "type": "number" + }, + "spentHeight": { + "type": "number" + } + } + } + }, + "blockhash": { + "type": "string" + }, + "blockheight": { "type": "number" }, + "confirmations": { + "type": "number" + }, + "time": { + "type": "blocktime" + }, + "valueOut": { + "type": "number" + }, + "size": { + "type": "number" + }, + "valueIn": { + "type": "number" + }, + "fees": { + "type": "number" + } + } + }, + "ValidateAddress": { + "type": "object", + "properties": { + "isvalid": { + "type": "boolean" + }, + "address": { + "type": "string" + }, + "scriptPubKey": { + "type": "string" + }, + "ismine": { + "type": "boolean" + }, + "iswatchonly": { + "type": "boolean" + }, + "isscript": { + "type": "boolean" + } } } } diff --git a/routes/util.js b/routes/util.js index cd9ded03..70c62f4c 100644 --- a/routes/util.js +++ b/routes/util.js @@ -17,7 +17,7 @@ router.get('/', function(req, res, next) { router.get('/estimateSmartFee/:nblocks', function(req, res, next) { BITBOX.Util.estimateSmartFee(parseInt(req.params.nblocks)) .then((result) => { - res.json({ result: result }); + res.json(result); }, (err) => { console.log(err); }); }); @@ -25,7 +25,7 @@ router.get('/estimateSmartFee/:nblocks', function(req, res, next) { router.get('/estimateSmartPriority/:nblocks', function(req, res, next) { BITBOX.Util.estimateSmartPriority(parseInt(req.params.nblocks)) .then((result) => { - res.json({ result: result }); + res.json(result); }, (err) => { console.log(err); }); }); @@ -33,7 +33,7 @@ router.get('/estimateSmartPriority/:nblocks', function(req, res, next) { router.get('/createMultisig/:nrequired/:keys', function(req, res, next) { BITBOX.Util.createMultisig(parseInt(req.params.nrequired), req.params.keys) .then((result) => { - res.json({ result: result }); + res.json(result); }, (err) => { console.log(err); }); }); @@ -54,26 +54,10 @@ router.get('/estimatePriority/:nblocks', function(req, res, next) { }); }); -router.get('/signMessageWithPrivKey/:privkey/:message', function(req, res, next) { - BITBOX.Util.signMessageWithPrivKey(req.params.privkey, req.params.message) - .then((result) => { - res.json(result); - }, (err) => { console.log(err); - }); -}); - router.get('/validateAddress/:address', function(req, res, next) { BITBOX.Util.validateAddress(req.params.address) .then((result) => { - res.json({ result: result }); - }, (err) => { console.log(err); - }); -}); - -router.get('/verifyMessage/:address/:signature/:message', function(req, res, next) { - BITBOX.Util.verifyMessage(req.params.address, req.params.signature, req.params.message) - .then((result) => { - res.json({ result: result }); + res.json(result); }, (err) => { console.log(err); }); });