Skip to content

Commit

Permalink
Document AddressDetails, AddressUtxo and Utxo models.
Browse files Browse the repository at this point in the history
  • Loading branch information
cloneearth committed May 20, 2018
1 parent 2211396 commit 0919a5c
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 6 deletions.
6 changes: 5 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,17 @@ app.use(function(req, res, next) {

// error handler
app.use(function(err, req, res, next) {

// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};

// render the error page
res.status(err.status || 500);
res.render('error');
res.json({
status: 500,
message: err.message
});
});

module.exports = app;
117 changes: 113 additions & 4 deletions public/bitbox-rest-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,16 @@
],
"responses": {
"200": {
"description": "successful response"
"description": "successful response",
"schema": {
"$ref": "#/definitions/AddressDetails"
}
},
"400": {
"description": "Invalid tag value"
"schema": {
"status": 500,
"message": "Received an invalid Bitcoin Cash address as input."
}
}
}
}
Expand Down Expand Up @@ -155,10 +161,16 @@
],
"responses": {
"200": {
"description": "successful response"
"description": "successful response",
"schema": {
"$ref": "#/definitions/AddressUtxo"
}
},
"400": {
"description": "Invalid tag value"
"schema": {
"status": 500,
"message": "Received an invalid Bitcoin Cash address as input."
}
}
}
}
Expand Down Expand Up @@ -1404,5 +1416,102 @@
}
}
}
},
"definitions": {
"AddressDetails": {
"type": "object",
"properties": {
"balance": {
"type": "number",
"format": "float"
},
"balanceSat": {
"type": "number",
"format": "float"
},
"totalReceived": {
"type": "number",
"format": "float"
},
"totalReceivedSat": {
"type": "number",
"format": "float"
},
"totalSent": {
"type": "number",
"format": "float"
},
"totalSentSat": {
"type": "number",
"format": "float"
},
"unconfirmedBalance": {
"type": "number",
"format": "float"
},
"unconfirmedBalanceSat": {
"type": "number",
"format": "float"
},
"unconfirmedTxApperances": {
"type": "number",
"format": "float"
},
"txApperances": {
"type": "number"
},
"transactions": {
"type": "array",
"items": {
"type": "string"
}
},
"legacyAddress": {
"type": "string"
},
"cashAddress": {
"type": "string"
}
}
},
"AddressUtxo": {
"type": "array",
"items": {
"$ref": "#/definitions/Utxo"
}
},
"Utxo": {
"type": "object",
"properties": {
"txid": {
"type": "string"
},
"vout": {
"type": "number"
},
"scriptPubKey": {
"type": "string"
},
"amount": {
"type": "number",
"format": "float"
},
"satoshis": {
"type": "number"
},
"height": {
"type": "number"
},
"confirmations": {
"type": "number"
},
"legacyAddress": {
"type": "string"
},
"cashAddress": {
"type": "string"
}
}
}
}
}
3 changes: 2 additions & 1 deletion routes/address.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ router.get('/details/:address', function(req, res, next) {
result.data.legacyAddress = BITBOX.Address.toLegacyAddress(req.params.address);
result.data.cashAddress = BITBOX.Address.toCashAddress(req.params.address);
res.json(result.data);
}, (err) => { console.log(err);
}, (err) => {
console.log(err);
});
}
});
Expand Down

0 comments on commit 0919a5c

Please sign in to comment.