forked from stellar/go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
info_response.go
34 lines (30 loc) · 1.01 KB
/
info_response.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
package stellarcore
// InfoResponse is the json response returned from stellar-core's /info
// endpoint.
type InfoResponse struct {
Info struct {
Build string `json:"build"`
Network string `json:"network"`
ProtocolVersion int `json:"protocol_version"`
State string `json:"state"`
Ledger LedgerInfo `json:"ledger"`
// TODO: all the other fields
}
}
// LedgerInfo is the part of the stellar-core's info json response.
// It's returned under `ledger` key
type LedgerInfo struct {
Age int `json:"age"`
BaseFee int `json:"baseFee"`
BaseReserve int `json:"baseReserve"`
CloseTime int `json:"closeTime"`
Hash string `json:"hash"`
MaxTxSetSize int `json:"maxTxSetSize"`
Num int `json:"num"`
Version int `json:"version"`
}
// IsSynced returns a boolean indicating whether stellarcore is synced with the
// network.
func (resp *InfoResponse) IsSynced() bool {
return resp.Info.State == "Synced!"
}