-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
solana_chain.go
45 lines (38 loc) · 1.15 KB
/
solana_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"
)
// SolanaChainResource is an Solana chain JSONAPI resource.
type SolanaChainResource struct {
ChainResource
}
// GetName implements the api2go EntityNamer interface
func (r SolanaChainResource) GetName() string {
return "solana_chain"
}
// NewSolanaChainResource returns a new SolanaChainResource for chain.
func NewSolanaChainResource(chain types.ChainStatus) SolanaChainResource {
return SolanaChainResource{ChainResource{
JAID: NewJAID(chain.ID),
Config: chain.Config,
Enabled: chain.Enabled,
}}
}
// SolanaNodeResource is a Solana node JSONAPI resource.
type SolanaNodeResource struct {
NodeResource
}
// GetName implements the api2go EntityNamer interface
func (r SolanaNodeResource) GetName() string {
return "solana_node"
}
// NewSolanaNodeResource returns a new SolanaNodeResource for node.
func NewSolanaNodeResource(node types.NodeStatus) SolanaNodeResource {
return SolanaNodeResource{NodeResource{
JAID: NewPrefixedJAID(node.Name, node.ChainID),
ChainID: node.ChainID,
Name: node.Name,
State: node.State,
Config: node.Config,
}}
}