forked from filecoin-project/lotus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: curio: jsonrpc in webui (filecoin-project#11904)
* curioweb: Setup jsonrpc communication * curioweb: Move chain state from SSE to rpc * appease the linter
- Loading branch information
Showing
6 changed files
with
331 additions
and
241 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package webrpc | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/gorilla/mux" | ||
logging "github.com/ipfs/go-log/v2" | ||
|
||
"github.com/filecoin-project/go-jsonrpc" | ||
|
||
"github.com/filecoin-project/lotus/build" | ||
"github.com/filecoin-project/lotus/cmd/curio/deps" | ||
) | ||
|
||
var log = logging.Logger("webrpc") | ||
|
||
type WebRPC struct { | ||
deps *deps.Deps | ||
} | ||
|
||
func (a *WebRPC) Version(context.Context) (string, error) { | ||
return build.UserVersion(), nil | ||
} | ||
|
||
func (a *WebRPC) BlockDelaySecs(context.Context) (uint64, error) { | ||
return build.BlockDelaySecs, nil | ||
} | ||
|
||
func Routes(r *mux.Router, deps *deps.Deps) { | ||
handler := &WebRPC{ | ||
deps: deps, | ||
} | ||
|
||
rpcSrv := jsonrpc.NewServer() | ||
rpcSrv.Register("CurioWeb", handler) | ||
r.Handle("/v0", rpcSrv) | ||
} |
Oops, something went wrong.