forked from ett126/insight-api-xpchain
-
Notifications
You must be signed in to change notification settings - Fork 1
/
routes.js
86 lines (67 loc) · 2.86 KB
/
routes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
'use strict';
/**
* Module dependencies.
*/
var config = require('./config');
module.exports = function(app) {
var apiPrefix = config.apiPrefix;
//Block routes
var blocks = require('../app/controllers/blocks');
app.get(apiPrefix + '/blocks', blocks.list);
app.get(apiPrefix + '/block/:blockHash', blocks.show);
app.param('blockHash', blocks.block);
app.get(apiPrefix + '/block-index/:height', blocks.blockindex);
app.param('height', blocks.blockindex);
// Transaction routes
var transactions = require('../app/controllers/transactions');
app.get(apiPrefix + '/tx/:txid', transactions.show);
app.param('txid', transactions.transaction);
app.get(apiPrefix + '/txs', transactions.list);
app.post(apiPrefix + '/tx/send', transactions.send);
// Raw Routes
app.get(apiPrefix + '/rawtx/:txid', transactions.showRaw);
app.param('txid', transactions.rawTransaction);
// Address routes
var addresses = require('../app/controllers/addresses');
app.get(apiPrefix + '/addr/:addr', addresses.show);
app.get(apiPrefix + '/addr/:addr/utxo', addresses.utxo);
app.get(apiPrefix + '/addr/:addr/utxoExt', addresses.utxoExt);
app.get(apiPrefix + '/addrs/:addrs/utxo', addresses.multiutxo);
app.post(apiPrefix + '/addrs/utxo', addresses.multiutxo);
app.get(apiPrefix + '/addrs/:addrs/txs', addresses.multitxs);
app.post(apiPrefix + '/addrs/txs', addresses.multitxs);
// Address property routes
app.get(apiPrefix + '/addr/:addr/balance', addresses.balance);
app.get(apiPrefix + '/addr/:addr/totalReceived', addresses.totalReceived);
app.get(apiPrefix + '/addr/:addr/totalSent', addresses.totalSent);
app.get(apiPrefix + '/addr/:addr/unconfirmedBalance', addresses.unconfirmedBalance);
// Status route
var st = require('../app/controllers/status');
app.get(apiPrefix + '/status', st.show);
app.get(apiPrefix + '/sync', st.sync);
app.get(apiPrefix + '/peer', st.peer);
// Utils route
var utils = require('../app/controllers/utils');
app.get(apiPrefix + '/utils/estimatefee', utils.estimateFee);
// Currency
var currency = require('../app/controllers/currency');
app.get(apiPrefix + '/currency', currency.index);
// Email store plugin
if (config.enableEmailstore) {
var emailPlugin = require('../plugins/emailstore');
app.get(apiPrefix + '/email/retrieve', emailPlugin.retrieve);
}
// Currency rates plugin
if (config.enableCurrencyRates) {
var currencyRatesPlugin = require('../plugins/currencyrates');
app.get(apiPrefix + '/rates/:code', currencyRatesPlugin.getRate);
}
// Address routes
var messages = require('../app/controllers/messages');
app.get(apiPrefix + '/messages/verify', messages.verify);
app.post(apiPrefix + '/messages/verify', messages.verify);
//Home route
var index = require('../app/controllers/index');
app.get(apiPrefix + '/version', index.version);
app.get('*', index.render);
};