Skip to content

Commit

Permalink
Add NetworkInfo Inteface and remove addresses.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Cardona committed Jul 10, 2019
1 parent 1f8b1d6 commit fbb5f2e
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 75 deletions.
15 changes: 1 addition & 14 deletions dist/public/bitcoin-com-mainnet-rest-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -1083,19 +1083,6 @@
"excessutxocharge": {
"type": "number"
},
"localaddresses": [
{
"address": {
"type": "string"
},
"port": {
"type": "number"
},
"score": {
"type": "number"
}
}
],
"warnings": {
"type": "string"
}
Expand Down Expand Up @@ -1199,7 +1186,7 @@
"openapi": "3.0.0",
"info": {
"description": "rest.bitcoin.com is the REST layer for Bitcoin.com's Cloud. More info: [developer.bitcoin.com/rest](https://developer.bitcoin.com/rest). Chatroom [geni.us/CashDev](http://geni.us/CashDev)",
"version": "3.11.8",
"version": "3.11.9",
"title": "REST",
"license": {
"name": "MIT",
Expand Down
15 changes: 1 addition & 14 deletions dist/public/bitcoin-com-testnet-rest-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -1083,19 +1083,6 @@
"excessutxocharge": {
"type": "number"
},
"localaddresses": [
{
"address": {
"type": "string"
},
"port": {
"type": "number"
},
"score": {
"type": "number"
}
}
],
"warnings": {
"type": "string"
}
Expand Down Expand Up @@ -1199,7 +1186,7 @@
"openapi": "3.0.0",
"info": {
"description": "trest.bitcoin.com is the REST layer for Bitcoin.com's Cloud. More info: [developer.bitcoin.com/rest](https://developer.bitcoin.com/rest). Chatroom [geni.us/CashDev](http://geni.us/CashDev)",
"version": "3.11.8",
"version": "3.11.9",
"title": "REST",
"license": {
"name": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rest.bitcoin.com",
"version": "3.11.8",
"version": "3.11.9",
"description": "REST API for Bitcoin.com's Cloud",
"author": "Gabriel Cardona <[email protected]>",
"contributors": [
Expand Down
11 changes: 7 additions & 4 deletions src/routes/v2/control.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// imports
import { AxiosResponse } from "axios"
import * as express from "express"
import { InfoInterface } from "./interfaces/RESTInterfaces"
import {
InfoInterface,
NetworkInfoInterface
} from "./interfaces/RESTInterfaces"
import routeUtils = require("./route-utils")
import wlogger = require("../../util/winston-logging")

Expand Down Expand Up @@ -54,7 +57,6 @@ async function getInfo(
}
}


// Execute the RPC getinfo call.
async function getNetworkInfo(
req: express.Request,
Expand All @@ -69,9 +71,10 @@ async function getNetworkInfo(

try {
const response: AxiosResponse = await BitboxHTTP(requestConfig)
const info: InfoInterface = response.data.result
const networkInfo: NetworkInfoInterface = response.data.result
delete networkInfo.localaddresses

return res.json(info)
return res.json(networkInfo)
} catch (error) {
wlogger.error(`Error in control.ts/getNetworkInfo().`, error)

Expand Down
24 changes: 24 additions & 0 deletions src/routes/v2/interfaces/RESTInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,30 @@ export interface InfoInterface {
errors: string
}

export interface NetworkInfoInterface {
version: number
subversion: string
protocolversion: number
localservices: string
localrelay: boolean
timeoffset: number
networkactive: boolean
connections: number
networks: [
{
name: string
limited: boolean
reachable: boolean
proxy: string
proxy_randomize_credentials: boolean
}
]
relayfee: number
excessutxocharge: number
localaddresses?: []
warnings: string
}

export interface MiningInfoInterface {
blocks: number
currentblocksize: number
Expand Down
13 changes: 0 additions & 13 deletions swaggerJSONFiles/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -1065,19 +1065,6 @@
"excessutxocharge": {
"type": "number"
},
"localaddresses": [
{
"address": {
"type": "string"
},
"port": {
"type": "number"
},
"score": {
"type": "number"
}
}
],
"warnings": {
"type": "string"
}
Expand Down
2 changes: 1 addition & 1 deletion swaggerJSONFiles/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.0",
"info": {
"description": "The Bitcoin Cash JSON PRC over HTTP",
"version": "3.11.8",
"version": "3.11.9",
"title": "REST",
"license": {
"name": "MIT",
Expand Down
13 changes: 0 additions & 13 deletions swaggerJSONFilesBuilt/mainnet/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -1083,19 +1083,6 @@
"excessutxocharge": {
"type": "number"
},
"localaddresses": [
{
"address": {
"type": "string"
},
"port": {
"type": "number"
},
"score": {
"type": "number"
}
}
],
"warnings": {
"type": "string"
}
Expand Down
2 changes: 1 addition & 1 deletion swaggerJSONFilesBuilt/mainnet/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.0",
"info": {
"description": "rest.bitcoin.com is the REST layer for Bitcoin.com's Cloud. More info: [developer.bitcoin.com/rest](https://developer.bitcoin.com/rest). Chatroom [geni.us/CashDev](http://geni.us/CashDev)",
"version": "3.11.8",
"version": "3.11.9",
"title": "REST",
"license": {
"name": "MIT",
Expand Down
13 changes: 0 additions & 13 deletions swaggerJSONFilesBuilt/testnet/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -1083,19 +1083,6 @@
"excessutxocharge": {
"type": "number"
},
"localaddresses": [
{
"address": {
"type": "string"
},
"port": {
"type": "number"
},
"score": {
"type": "number"
}
}
],
"warnings": {
"type": "string"
}
Expand Down
2 changes: 1 addition & 1 deletion swaggerJSONFilesBuilt/testnet/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.0",
"info": {
"description": "trest.bitcoin.com is the REST layer for Bitcoin.com's Cloud. More info: [developer.bitcoin.com/rest](https://developer.bitcoin.com/rest). Chatroom [geni.us/CashDev](http://geni.us/CashDev)",
"version": "3.11.8",
"version": "3.11.9",
"title": "REST",
"license": {
"name": "MIT",
Expand Down

0 comments on commit fbb5f2e

Please sign in to comment.