lotus/daemon/rpc.go
2019-07-08 22:51:18 +02:00

16 lines
349 B
Go

package daemon
import (
"net/http"
"github.com/filecoin-project/go-lotus/api"
"github.com/filecoin-project/go-lotus/lib/jsonrpc"
)
func serveRPC(api api.API, addr string) error {
rpcServer := jsonrpc.NewServer()
rpcServer.Register("Filecoin", api)
http.Handle("/rpc/v0", rpcServer)
return http.ListenAndServe(addr, http.DefaultServeMux)
}