-
Notifications
You must be signed in to change notification settings - Fork 1
/
actions_root.go
37 lines (32 loc) · 953 Bytes
/
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
package aurora
import (
"github.com/diamnet/go/protocols/aurora"
"github.com/diamnet/go/services/aurora/internal/actions"
"github.com/diamnet/go/services/aurora/internal/ledger"
"github.com/diamnet/go/services/aurora/internal/resourceadapter"
"github.com/diamnet/go/support/render/hal"
)
// Interface verification
var _ actions.JSONer = (*RootAction)(nil)
// RootAction provides a summary of the aurora instance and links to various
// useful endpoints
type RootAction struct {
Action
}
// JSON renders the json response for RootAction
func (action *RootAction) JSON() error {
var res aurora.Root
resourceadapter.PopulateRoot(
action.R.Context(),
&res,
ledger.CurrentState(),
action.App.auroraVersion,
action.App.coreVersion,
action.App.config.NetworkPassphrase,
action.App.currentProtocolVersion,
action.App.coreSupportedProtocolVersion,
action.App.config.FriendbotURL,
)
hal.Render(action.W, res)
return action.Err
}