-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
64 lines (53 loc) · 1.13 KB
/
main.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
64
package main
import (
"HDWallet/database"
"HDWallet/wallet"
"fmt"
"log"
)
func main() {
db, err := database.ConnectDatabase()
if err != nil {
log.Fatalf("Some error occured. Err: %s", err)
}
tokens := getToken()
err = database.InsertTokenToTokenTable(db, tokens)
if err != nil {
log.Fatal(err)
}
}
func getToken() []wallet.Token {
numberAddress := 20
//mnemonic, err := wallet.NewMnemonic()
//if err != nil {
// log.Fatal(err)
//}
//
//fmt.Println(mnemonic)
mnemonic := "veteran picture assist ginger gap poet denial crime art action palm damage"
accoutnArray, err := wallet.GetWalletFromMnemonic(mnemonic, numberAddress)
if err != nil {
log.Fatal(err)
}
nonceSession, err := wallet.GetMultipleNonceAndSession(numberAddress)
if err != nil {
log.Fatal(err)
}
sig, err := wallet.GetMultipleSignature(nonceSession, accoutnArray)
if err != nil {
log.Fatal(err)
}
tokens, err := wallet.GetMultipleToken(sig)
if err != nil {
log.Fatal(err)
}
for _, token := range tokens {
tokenStr, err := token.String()
if err != nil {
fmt.Println(err)
continue
}
fmt.Println(tokenStr)
}
return tokens
}