This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
57 changed files
with
4,507 additions
and
3,298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict'; | ||
|
||
var Router = require('../../helpers/router'); | ||
var httpApi = require('../../helpers/httpApi'); | ||
var schema = require('../../schema/accounts.js'); | ||
|
||
// Constructor | ||
function AccountsHttpApi (accountsModule, app) { | ||
|
||
var router = new Router(); | ||
|
||
router.map(accountsModule.shared, { | ||
'post /open': 'open', | ||
'get /getBalance': 'getBalance', | ||
'get /getPublicKey': 'getPublickey', | ||
'post /generatePublicKey': 'generatePublicKey', | ||
'get /delegates': 'getDelegates', | ||
'get /delegates/fee': 'getDelegatesFee', | ||
'put /delegates': 'addDelegates', | ||
'get /': 'getAccount' | ||
}); | ||
|
||
router.map(accountsModule.internal, { | ||
'get /count': 'count' | ||
}); | ||
|
||
if (process.env.DEBUG && process.env.DEBUG.toUpperCase() === 'TRUE') { | ||
router.map(accountsModule.internal, {'get /getAllAccounts': 'getAllAccounts'}); | ||
} | ||
|
||
if (process.env.TOP && process.env.TOP.toUpperCase() === 'TRUE') { | ||
router.get('/top', httpApi.middleware.sanitize('query', schema.top, accountsModule.internal.top)); | ||
} | ||
|
||
httpApi.registerEndpoint('/api/accounts', app, router, accountsModule.isLoaded); | ||
} | ||
|
||
module.exports = AccountsHttpApi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
var Router = require('../../helpers/router'); | ||
var httpApi = require('../../helpers/httpApi'); | ||
|
||
// Constructor | ||
function BlocksHttpApi (blocksModule, app) { | ||
|
||
var router = new Router(); | ||
|
||
router.map(blocksModule.shared, { | ||
'get /get': 'getBlock', | ||
'get /': 'getBlocks', | ||
'get /getBroadhash': 'getBroadhash', | ||
'get /getEpoch': 'getEpoch', | ||
'get /getHeight': 'getHeight', | ||
'get /getNethash': 'getNethash', | ||
'get /getFee': 'getFee', | ||
'get /getFees': 'getFees', | ||
'get /getMilestone': 'getMilestone', | ||
'get /getReward': 'getReward', | ||
'get /getSupply': 'getSupply', | ||
'get /getStatus': 'getStatus' | ||
}); | ||
|
||
httpApi.registerEndpoint('/api/blocks', app, router, blocksModule.isLoaded); | ||
} | ||
|
||
module.exports = BlocksHttpApi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
|
||
var Router = require('../../helpers/router'); | ||
var httpApi = require('../../helpers/httpApi'); | ||
var schema = require('../../schema/dapps'); | ||
|
||
// Constructor | ||
function DappsHttpApi (dappsModule, app) { | ||
|
||
var router = new Router(); | ||
|
||
router.map(dappsModule.internal, { | ||
'get /categories': 'categories', | ||
'get /installed': 'installed', | ||
'get /installedIds': 'installedIds', | ||
'get /ismasterpasswordenabled': 'isMasterPasswordEnabled', | ||
'get /installing': 'installing', | ||
'get /uninstalling': 'uninstalling', | ||
'get /launched': 'launched', | ||
'post /launch': 'launch', | ||
'put /transaction': 'addTransactions', | ||
'put /withdrawal': 'sendWithdrawal' | ||
}); | ||
|
||
router.get('/', httpApi.middleware.sanitize('query', schema.list, dappsModule.internal.list)); | ||
router.put('/', httpApi.middleware.sanitize('body', schema.put, dappsModule.internal.put)); | ||
router.get('/get', httpApi.middleware.sanitize('query', schema.get, dappsModule.internal.get)); | ||
router.get('/search', httpApi.middleware.sanitize('query', schema.search, dappsModule.internal.search)); | ||
router.post('/install', httpApi.middleware.sanitize('body', schema.install, dappsModule.internal.install)); | ||
router.post('/uninstall', httpApi.middleware.sanitize('body', schema.uninstall, dappsModule.internal.uninstall)); | ||
router.post('/stop', httpApi.middleware.sanitize('body', schema.stop, dappsModule.internal.stop)); | ||
|
||
httpApi.registerEndpoint('/api/dapps', app, router, dappsModule.isLoaded); | ||
} | ||
|
||
module.exports = DappsHttpApi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use strict'; | ||
|
||
var Router = require('../../helpers/router'); | ||
var httpApi = require('../../helpers/httpApi'); | ||
|
||
// Constructor | ||
function DelegatesHttpApi (delegatesModule, app) { | ||
|
||
var router = new Router(); | ||
|
||
router.map(delegatesModule.shared, { | ||
'get /count': 'count', | ||
'get /search': 'search', | ||
'get /voters': 'getVoters', | ||
'get /get': 'getDelegate', | ||
'get /': 'getDelegates', | ||
'get /fee': 'getFee', | ||
'get /forging/getForgedByAccount': 'getForgedByAccount', | ||
'put /': 'addDelegate', | ||
'get /getNextForgers': 'getNextForgers' | ||
}); | ||
|
||
router.map(delegatesModule.internal, { | ||
'post /forging/enable': 'forgingEnable', | ||
'post /forging/disable': 'forgingDisable', | ||
'get /forging/status': 'forgingStatus' | ||
}); | ||
|
||
if (process.env.DEBUG) { | ||
router.map(delegatesModule.internal, { | ||
'get /forging/disableAll': 'forgingDisableAll', | ||
'get /forging/enableAll': 'forgingEnableAll' | ||
}); | ||
} | ||
|
||
httpApi.registerEndpoint('/api/delegates', app, router, delegatesModule.isLoaded); | ||
} | ||
|
||
module.exports = DelegatesHttpApi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict'; | ||
|
||
var Router = require('../../helpers/router'); | ||
var httpApi = require('../../helpers/httpApi'); | ||
|
||
// Constructor | ||
function LoaderHttpApi (loaderModule, app) { | ||
|
||
var router = new Router(); | ||
|
||
router.map(loaderModule.shared, { | ||
'get /status': 'status', | ||
'get /status/sync': 'sync' | ||
}); | ||
|
||
router.get('/status/ping', function (req, res) { | ||
var status = loaderModule.internal.statusPing(); | ||
return res.status(status ? 200 : 503).json({success: status}); | ||
}); | ||
|
||
httpApi.registerEndpoint('/api/loader', app, router, loaderModule.isLoaded); | ||
} | ||
|
||
module.exports = LoaderHttpApi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
var Router = require('../../helpers/router'); | ||
var httpApi = require('../../helpers/httpApi'); | ||
|
||
// Constructor | ||
function MultisignaturesHttpApi (mutlisignaturesModule, app) { | ||
|
||
var router = new Router(); | ||
|
||
router.map(mutlisignaturesModule.shared, { | ||
'get /pending': 'pending', | ||
'post /sign': 'sign', | ||
'put /': 'addMultisignature', | ||
'get /accounts': 'getAccounts' | ||
}); | ||
|
||
httpApi.registerEndpoint('/api/multisignatures', app, router, mutlisignaturesModule.isLoaded); | ||
} | ||
|
||
module.exports = MultisignaturesHttpApi; |
Oops, something went wrong.