Skip to content

Commit ee15915

Browse files
committed
added network information and an endpoint to get this from the api
1 parent b5cb256 commit ee15915

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ Add connections to `config/connections.json`, and set the name of the network yo
7878
"connectApi": "ganache",
7979
"ganache":{
8080
"url": "http://127.0.0.1:7545",
81+
"networkId": "5777",
82+
"networkName": "ganache",
83+
"networkType": "testrpc",
8184
"token": {
8285
"ownerAddress": "0x451E62137891156215d9D58BeDdc6dE3f30218e7",
8386
"tokenContractAddress": "0x4c59b696552863429d25917b52263532af6e6078",
@@ -454,6 +457,12 @@ output
454457
"POST"
455458
]
456459
},
460+
{
461+
"path": "/api/network",
462+
"methods": [
463+
"GET"
464+
]
465+
},
457466
{
458467
"path": "/api/token",
459468
"methods": [
@@ -592,12 +601,6 @@ output
592601
"POST"
593602
]
594603
},
595-
{
596-
"path": "/api/eth/wallet",
597-
"methods": [
598-
"GET"
599-
]
600-
},
601604
{
602605
"path": "/api-endpoints",
603606
"methods": [

server/app/controllers/api.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
const web3 = require('../helpers/web3.js');
1+
const Web3 = require('../helpers/web3.js');
2+
const web3 = Web3.web3;
23
const ethereum = require('../helpers/ethereum.js');
34
const token = require('../helpers/token.js');
45

@@ -9,4 +10,7 @@ module.exports = {
910
postTest: function (req, res, next) {
1011
res.send(req.body);
1112
},
13+
networkInfo: function (req, res, next) {
14+
res.send(Web3.network)
15+
},
1216
}

server/app/routes/api.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ router.route('/')
1919
.get(api.getTest)
2020
.post(api.postTest)
2121

22+
router.get('/network', api.networkInfo);
23+
2224
module.exports = router;

0 commit comments

Comments
 (0)