/
standard.go
40 lines (34 loc) · 1.14 KB
/
standard.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
package explorer
import (
tfcli "github.com/threefoldfoundation/tfchain/extensions/tfchain/client"
"github.com/threefoldtech/rivine/pkg/client"
)
// MainnetGroupedExplorer is a GroupedExplorer preconfigured for the official public testnet explorers
type MainnetGroupedExplorer struct {
*GroupedExplorer
}
// NewMainnetGroupedExplorer creates a preconfigured grouped explorer for the public testnet nodes
func NewMainnetGroupedExplorer() *MainnetGroupedExplorer {
mainnetUrls := []string{
"https://explorer.threefoldtoken.com",
"https://explorer2.threefoldtoken.com",
"https://explorer3.threefoldtoken.com",
"https://explorer4.threefoldtoken.com",
}
var explorers []*Explorer
for _, url := range mainnetUrls {
explorers = append(explorers, NewExplorer(url, "Rivine-Agent", ""))
}
explorer := &MainnetGroupedExplorer{NewGroupedExplorer(explorers...)}
// register transactions for standard network of tfchain
bc, err := client.NewBaseClient(explorer, nil)
if err != nil {
panic(err)
}
tfcli.RegisterStandardTransactions(bc)
return explorer
}
// Name of the backend
func (te *MainnetGroupedExplorer) Name() string {
return "standard"
}