http-api: Normalize API calls, fix getCoins by addr/addresses

This commit is contained in:
Node 2017-08-04 03:17:54 +04:00
parent bb6110c609
commit e6120039fc
No known key found for this signature in database
GPG Key ID: 8E1B4DC29040BD90
2 changed files with 5 additions and 5 deletions

View File

@ -318,8 +318,8 @@ HTTPClient.prototype.getInfo = function getInfo() {
* @returns {Promise} - Returns {@link Coin}[]. * @returns {Promise} - Returns {@link Coin}[].
*/ */
HTTPClient.prototype.getCoinsByAddress = function getCoinsByAddress(address) { HTTPClient.prototype.getCoinsByAddress = function getCoinsByAddress(addresses) {
return this._post('/coin/address', { address }); return this._post('/coin/address', { addresses });
}; };
/** /**
@ -341,8 +341,8 @@ HTTPClient.prototype.getCoin = function getCoin(hash, index) {
* @returns {Promise} - Returns {@link TX}[]. * @returns {Promise} - Returns {@link TX}[].
*/ */
HTTPClient.prototype.getTXByAddress = function getTXByAddress(address) { HTTPClient.prototype.getTXByAddress = function getTXByAddress(addresses) {
return this._post('/tx/address', { address }); return this._post('/tx/address', { addresses });
}; };
/** /**

View File

@ -235,7 +235,7 @@ HTTPServer.prototype.initRouter = function initRouter() {
// Bulk read TXs // Bulk read TXs
this.post('/tx/address', async (req, res) => { this.post('/tx/address', async (req, res) => {
const valid = req.valid(); const valid = req.valid();
const address = valid.array('address'); const address = valid.array('addresses');
enforce(address, 'Address is required.'); enforce(address, 'Address is required.');
enforce(!this.chain.options.spv, 'Cannot get TX in SPV mode.'); enforce(!this.chain.options.spv, 'Cannot get TX in SPV mode.');