MCPcopy Create free account
hub / github.com/ethstorage/es-node / newRPCServer

Function newRPCServer

ethstorage/node/server.go:31–62  ·  view source on GitHub ↗
(
	ctx context.Context,
	rpcCfg *RPCConfig,
	chainId *big.Int,
	sm *ethstorage.StorageManager,
	dl *downloader.Downloader,
	lg log.Logger,
	appVersion string,
)

Source from the content-addressed store, hash-verified

29}
30
31func newRPCServer(
32 ctx context.Context,
33 rpcCfg *RPCConfig,
34 chainId *big.Int,
35 sm *ethstorage.StorageManager,
36 dl *downloader.Downloader,
37 lg log.Logger,
38 appVersion string,
39) (*rpcServer, error) {
40 esAPI := NewESAPI(rpcCfg, sm, dl, lg)
41 ethApi := NewETHAPI(rpcCfg, chainId, lg)
42
43 endpoint := net.JoinHostPort(rpcCfg.ListenAddr, strconv.Itoa(rpcCfg.ListenPort))
44 r := &rpcServer{
45 endpoint: endpoint,
46 apis: []rpc.API{
47 {
48 Namespace: "es",
49 Service: esAPI,
50 Authenticated: false,
51 },
52 {
53 Namespace: "eth",
54 Service: ethApi,
55 Authenticated: false,
56 },
57 },
58 appVersion: appVersion,
59 lg: lg,
60 }
61 return r, nil
62}
63
64func (s *rpcServer) Start() error {
65 srv := rpc.NewServer()

Callers 1

initRPCServerMethod · 0.85

Calls 2

NewESAPIFunction · 0.85
NewETHAPIFunction · 0.85

Tested by

no test coverage detected