-
Notifications
You must be signed in to change notification settings - Fork 901
/
bindings.go
73 lines (62 loc) · 1.47 KB
/
bindings.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
package gateway
import (
"fmt"
"net/http"
)
func (h *Handler) RegisterEndpoints(rpc *Server) {
// state endpoints
rpc.RegisterHandlerFunc(
fmt.Sprintf("%s/{%s}", balanceEndpoint, addrKey),
h.handleBalanceRequest,
http.MethodGet,
)
rpc.RegisterHandlerFunc(
submitTxEndpoint,
h.handleSubmitTx,
http.MethodPost,
)
rpc.RegisterHandlerFunc(
healthEndpoint,
h.handleHealthRequest,
http.MethodGet,
)
// share endpoints
rpc.RegisterHandlerFunc(
fmt.Sprintf(
"%s/{%s}/height/{%s}",
namespacedSharesEndpoint,
namespaceKey,
heightKey,
),
h.handleSharesByNamespaceRequest,
http.MethodGet,
)
rpc.RegisterHandlerFunc(
fmt.Sprintf("%s/{%s}", namespacedSharesEndpoint, namespaceKey),
h.handleSharesByNamespaceRequest,
http.MethodGet,
)
rpc.RegisterHandlerFunc(
fmt.Sprintf("%s/{%s}/height/{%s}", namespacedDataEndpoint, namespaceKey, heightKey),
h.handleDataByNamespaceRequest,
http.MethodGet,
)
rpc.RegisterHandlerFunc(
fmt.Sprintf("%s/{%s}", namespacedDataEndpoint, namespaceKey),
h.handleDataByNamespaceRequest,
http.MethodGet,
)
// DAS endpoints
rpc.RegisterHandlerFunc(
fmt.Sprintf("%s/{%s}", heightAvailabilityEndpoint, heightKey),
h.handleHeightAvailabilityRequest,
http.MethodGet,
)
// header endpoints
rpc.RegisterHandlerFunc(
fmt.Sprintf("%s/{%s}", headerByHeightEndpoint, heightKey),
h.handleHeaderRequest,
http.MethodGet,
)
rpc.RegisterHandlerFunc(headEndpoint, h.handleHeadRequest, http.MethodGet)
}