-
Notifications
You must be signed in to change notification settings - Fork 0
/
mint.go
45 lines (39 loc) · 903 Bytes
/
mint.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 kernel
import (
"encoding/json"
)
type Consensus struct {
Aggregator int `json:"aggregator"`
Node string `json:"node"`
Payee string `json:"payee"`
Signer string `json:"signer"`
Spaces []int64 `json:"spaces"`
State string `json:"state"`
Timestamp int64 `json:"timestamp"`
Transaction string `json:"transaction"`
Works []int64 `json:"works"`
}
type Graph struct {
Consensus []Consensus `json:"consensus"`
}
type Mint struct {
Batch int64 `json:"batch"`
Pledge string `json:"pledge"`
Pool string `json:"pool"`
}
type Info struct {
Mint Mint `json:"mint"`
Graph Graph `json:"graph"`
}
func (m *MixinNetwork) GetInfo() (*Info, error) {
b, err := m.callRPC("getinfo", []any{})
if err != nil || b == nil {
return nil, err
}
var i Info
err = json.Unmarshal(b, &i)
if err != nil {
return nil, err
}
return &i, nil
}