Skip to content

Commit

Permalink
feat: enable gRPC HTTP gateway (#1085)
Browse files Browse the repository at this point in the history
# Related Github tickets

- #1083
- VolumeFi#1257

# Background

All custom modules have at least some HTTP API endpoints configured, but
none of them were enabled. This change makes sure all modules register
their endpoints accordingly. Make sure to set `api.enable` to `true` in
`~/.paloma/config/app.toml` by default the API is disabled.

# Testing completed

- [x] test coverage exists or has been added/updated
- [x] tested in a private testnet

# Breaking changes

- [x] I have checked my code for breaking changes
- [x] If there are breaking changes, there is a supporting migration.
  • Loading branch information
byte-bandit authored Feb 8, 2024
1 parent dd5d9a3 commit 605e12f
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions x/consensus/module.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package consensus

import (
"context"
"encoding/json"
"fmt"

Expand Down Expand Up @@ -74,6 +75,9 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil {
panic(err)
}
}

// GetTxCmd returns the capability module's root tx command.
Expand Down
4 changes: 4 additions & 0 deletions x/evm/module.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package evm

import (
"context"
"encoding/json"
"fmt"

Expand Down Expand Up @@ -74,6 +75,9 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil {
panic(err)
}
}

// GetTxCmd returns the capability module's root tx command.
Expand Down
4 changes: 4 additions & 0 deletions x/metrix/module.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package metrix

import (
"context"
"encoding/json"
"fmt"

Expand Down Expand Up @@ -76,6 +77,9 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil {
panic(err)
}
}

// GetTxCmd returns the capability module's root tx command.
Expand Down
4 changes: 4 additions & 0 deletions x/paloma/module.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package paloma

import (
"context"
"encoding/json"
"fmt"

Expand Down Expand Up @@ -74,6 +75,9 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil {
panic(err)
}
}

// GetTxCmd returns the capability module's root tx command.
Expand Down
4 changes: 4 additions & 0 deletions x/scheduler/module.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package scheduler

import (
"context"
"encoding/json"
"fmt"

Expand Down Expand Up @@ -74,6 +75,9 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil {
panic(err)
}
}

// GetTxCmd returns the capability module's root tx command.
Expand Down
4 changes: 4 additions & 0 deletions x/treasury/module.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package treasury

import (
"context"
"encoding/json"
"fmt"

Expand Down Expand Up @@ -74,6 +75,9 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil {
panic(err)
}
}

// GetTxCmd returns the capability module's root tx command.
Expand Down
4 changes: 4 additions & 0 deletions x/valset/module.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package valset

import (
"context"
"encoding/json"
"fmt"

Expand Down Expand Up @@ -74,6 +75,9 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil {
panic(err)
}
}

// GetTxCmd returns the capability module's root tx command.
Expand Down

0 comments on commit 605e12f

Please sign in to comment.