-
Notifications
You must be signed in to change notification settings - Fork 51
/
apis.go
80 lines (73 loc) · 1.68 KB
/
apis.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package api
import (
"github.com/ethereum/go-ethereum/rpc"
"github.com/tendermint/tendermint/libs/log"
sbchapi "github.com/smartbch/smartbch/api"
"github.com/smartbch/smartbch/rpc/api/filters"
)
const (
namespaceEth = "eth"
namespaceNet = "net"
namespaceWeb3 = "web3"
namespaceTxPool = "txpool"
namespaceSBCH = "sbch"
namespaceDebug = "debug"
apiVersion = "1.0"
)
// GetAPIs returns the list of all APIs from the Ethereum namespaces
func GetAPIs(backend sbchapi.BackendService,
logger log.Logger, testKeys []string) []rpc.API {
logger = logger.With("module", "json-rpc")
_ethAPI := newEthAPI(backend, testKeys, logger)
_netAPI := newNetAPI(backend.ChainId().Uint64(), logger)
_filterAPI := filters.NewAPI(backend, logger)
_web3API := newWeb3API(logger)
_txPoolAPI := newTxPoolAPI(logger)
_sbchAPI := newSbchAPI(backend, logger)
_debugAPI := newDebugAPI(_ethAPI, logger)
//_evmAPI := newEvmAPI(backend)
return []rpc.API{
{
Namespace: namespaceEth,
Version: apiVersion,
Service: _ethAPI,
Public: true,
},
{
Namespace: namespaceEth,
Version: apiVersion,
Service: _filterAPI,
Public: true,
},
{
Namespace: namespaceWeb3,
Version: apiVersion,
Service: _web3API,
Public: true,
},
{
Namespace: namespaceNet,
Version: apiVersion,
Service: _netAPI,
Public: true,
},
{
Namespace: namespaceTxPool,
Version: apiVersion,
Service: _txPoolAPI,
Public: true,
},
{
Namespace: namespaceSBCH,
Version: apiVersion,
Service: _sbchAPI,
Public: true,
},
{
Namespace: namespaceDebug,
Version: apiVersion,
Service: _debugAPI,
Public: true,
},
}
}