Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

Commit a4570d3

Browse files
authored
Support /rpc route (#103)
1 parent 346eeef commit a4570d3

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

internal/start/private.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,14 @@ func PrivateMode() {
121121
r.GET("/ping", func(g *gin.Context) {
122122
g.Status(http.StatusOK)
123123
})
124-
r.POST(
125-
"/",
124+
handlers := []gin.HandlerFunc{
126125
relayer.FilterByClientID(),
127126
jsonrpc.Controller(client.NewRpcAdapter(c, d)),
128127
relayer.MapUserOpHashToClientID(),
129-
)
128+
}
129+
r.POST("/", handlers...)
130+
r.POST("/rpc", handlers...)
131+
130132
if err := r.Run(fmt.Sprintf(":%d", conf.Port)); err != nil {
131133
log.Fatal(err)
132134
}

internal/start/searcher.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ func SearcherMode() {
131131
r.GET("/ping", func(g *gin.Context) {
132132
g.Status(http.StatusOK)
133133
})
134-
r.POST("/", jsonrpc.Controller(client.NewRpcAdapter(c, d)))
134+
handlers := []gin.HandlerFunc{
135+
jsonrpc.Controller(client.NewRpcAdapter(c, d)),
136+
}
137+
r.POST("/", handlers...)
138+
r.POST("/rpc", handlers...)
135139
if err := r.Run(fmt.Sprintf(":%d", conf.Port)); err != nil {
136140
log.Fatal(err)
137141
}

0 commit comments

Comments
 (0)