-
Notifications
You must be signed in to change notification settings - Fork 0
/
board.go
63 lines (57 loc) · 1.45 KB
/
board.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package main
import (
"clout/display"
"clout/keys"
"clout/models"
"clout/network"
"clout/session"
"encoding/json"
"fmt"
)
func HandleBoards() {
fmt.Println("")
fmt.Println("Boards are coins where you are one of the few significant")
fmt.Println("owners and have some responsibilities.")
fmt.Println("")
m := session.ReadAccounts()
for username, s := range m {
fmt.Println("")
fmt.Println("===========")
fmt.Println(username)
fmt.Println("===========")
pub58, _ := keys.ComputeKeysFromSeed(session.SeedBytes(s))
Pub58ToBoards(pub58)
}
fmt.Println("")
}
func Pub58ToBoards(key string) {
js := network.GetUsersStateless(key)
var us models.UsersStateless
json.Unmarshal([]byte(js), &us)
for _, thing := range us.UserList[0].UsersYouHODL {
coins := float64(thing.BalanceNanos) / 1000000000.0
if coins < 1 {
continue
}
fmt.Printf("%s %0.2f\n",
display.LeftAligned(thing.ProfileEntryResponse.Username, 30), coins)
js := network.GetHodlers(thing.ProfileEntryResponse.Username)
var hw models.HodlersWrap
json.Unmarshal([]byte(js), &hw)
for _, friend := range hw.Hodlers {
if friend.ProfileEntryResponse.PublicKeyBase58Check == key {
continue
}
coins := float64(friend.BalanceNanos) / 1000000000.0
if coins < 1 {
continue
}
username := friend.ProfileEntryResponse.Username
if username == "" {
username = "anonymous"
}
fmt.Printf(" %s %0.2f\n",
display.LeftAligned(username, 30), coins)
}
}
}