-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathapi.go
57 lines (51 loc) · 1.06 KB
/
api.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
package node
import jsoniter "github.com/json-iterator/go"
var json = jsoniter.ConfigCompatibleWithStandardLibrary
// API -
type API interface {
BlockAPI
ChainAPI
ContextAPI
ConfigAPI
GeneralAPI
ProtocolsAPI
NetworkAPI
InjectAPI
}
// RPC -
type RPC struct {
*BlockRPC
*Chain
*Context
*Config
*General
*Protocols
*Network
*Inject
}
// NewRPC -
func NewRPC(baseURL, chainID string) *RPC {
return &RPC{
BlockRPC: NewBlockRPC(baseURL, chainID),
Chain: NewChain(baseURL, chainID),
Context: NewContext(baseURL, chainID),
Config: NewConfig(baseURL),
General: NewGeneral(baseURL),
Protocols: NewProtocols(baseURL),
Network: NewNetwork(baseURL),
Inject: NewInject(baseURL),
}
}
// NewMainRPC -
func NewMainRPC(baseURL string) *RPC {
return &RPC{
BlockRPC: NewMainBlockRPC(baseURL),
Chain: NewMainChain(baseURL),
Context: NewMainContext(baseURL),
Config: NewConfig(baseURL),
General: NewGeneral(baseURL),
Protocols: NewProtocols(baseURL),
Network: NewNetwork(baseURL),
Inject: NewInject(baseURL),
}
}