-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
solana_key.go
43 lines (31 loc) · 900 Bytes
/
solana_key.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
package resolver
import (
"github.com/graph-gophers/graphql-go"
"github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/solkey"
)
type SolanaKeyResolver struct {
key solkey.Key
}
func NewSolanaKey(key solkey.Key) *SolanaKeyResolver {
return &SolanaKeyResolver{key: key}
}
func NewSolanaKeys(keys []solkey.Key) []*SolanaKeyResolver {
var resolvers []*SolanaKeyResolver
for _, k := range keys {
resolvers = append(resolvers, NewSolanaKey(k))
}
return resolvers
}
func (r *SolanaKeyResolver) ID() graphql.ID {
return graphql.ID(r.key.PublicKeyStr())
}
// -- GetSolanaKeys Query --
type SolanaKeysPayloadResolver struct {
keys []solkey.Key
}
func NewSolanaKeysPayload(keys []solkey.Key) *SolanaKeysPayloadResolver {
return &SolanaKeysPayloadResolver{keys: keys}
}
func (r *SolanaKeysPayloadResolver) Results() []*SolanaKeyResolver {
return NewSolanaKeys(r.keys)
}