-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
cosmos_chain.go
45 lines (38 loc) · 1.13 KB
/
cosmos_chain.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
39
40
41
42
43
44
45
package presenters
import (
"github.com/smartcontractkit/chainlink-common/pkg/types"
)
// CosmosChainResource is an Cosmos chain JSONAPI resource.
type CosmosChainResource struct {
ChainResource
}
// GetName implements the api2go EntityNamer interface
func (r CosmosChainResource) GetName() string {
return "cosmos_chain"
}
// NewCosmosChainResource returns a new CosmosChainResource for chain.
func NewCosmosChainResource(chain types.ChainStatus) CosmosChainResource {
return CosmosChainResource{ChainResource{
JAID: NewJAID(chain.ID),
Config: chain.Config,
Enabled: chain.Enabled,
}}
}
// CosmosNodeResource is a Cosmos node JSONAPI resource.
type CosmosNodeResource struct {
NodeResource
}
// GetName implements the api2go EntityNamer interface
func (r CosmosNodeResource) GetName() string {
return "cosmos_node"
}
// NewCosmosNodeResource returns a new CosmosNodeResource for node.
func NewCosmosNodeResource(node types.NodeStatus) CosmosNodeResource {
return CosmosNodeResource{NodeResource{
JAID: NewJAID(node.Name),
ChainID: node.ChainID,
Name: node.Name,
State: node.State,
Config: node.Config,
}}
}