-
Notifications
You must be signed in to change notification settings - Fork 0
/
actions_root.go
38 lines (32 loc) · 1.09 KB
/
actions_root.go
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
package horizon
import (
"gitlab.com/tokend/go/xdr"
"gitlab.com/tokend/horizon/ledger"
"gitlab.com/tokend/horizon/render/hal"
"gitlab.com/tokend/horizon/render/problem"
"gitlab.com/tokend/horizon/resource"
)
// RootAction provides a summary of the horizon instance and links to various
// useful endpoints
type RootAction struct {
Action
}
// JSON renders the json response for RootAction
func (action *RootAction) JSON() {
action.App.UpdateCoreInfo()
if action.App.CoreInfo == nil {
action.Err = &problem.ServerOverCapacity
return
}
var res resource.Root
res.PopulateLedgerState(action.Ctx, ledger.CurrentState())
res.NetworkPassphrase = action.App.CoreInfo.NetworkPassphrase
res.AdminAccountID = action.App.CoreInfo.AdminAccountID
res.MasterAccountID = action.App.CoreInfo.AdminAccountID
res.MasterExchangeName = action.App.CoreInfo.MasterExchangeName
res.EnvironmentName = action.App.CoreInfo.MasterExchangeName
res.TxExpirationPeriod = action.App.CoreInfo.TxExpirationPeriod
res.XDRRevision = xdr.Revision
res.HorizonRevision = action.App.horizonVersion
hal.Render(action.W, res)
}