Skip to content

Commit

Permalink
API endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
vasylNaumenko committed Aug 23, 2024
1 parent 3448148 commit fa003a4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions example/wasm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/server/api"
srvconfig "github.com/cosmos/cosmos-sdk/server/config"
servergrpc "github.com/cosmos/cosmos-sdk/server/grpc"
"github.com/cosmos/cosmos-sdk/testutil/sims"
Expand Down Expand Up @@ -178,6 +179,19 @@ func WasmCreator() vm.AppCreator {
return servergrpc.StartGRPCServer(ctx, logger.With("module", "grpc-server"), grpcCfg, grpcSrv)
})

apiAddr := "tcp://localhost:1317"
srvCfg.API = srvconfig.APIConfig{
Enable: true,
Swagger: true,
EnableUnsafeCORS: true,
Address: apiAddr,
}
apiSrv := api.New(clientCtx, logger.With(log.ModuleKey, "api-server"), grpcSrv)
wasmApp.RegisterAPIRoutes(apiSrv, srvCfg.API)
g.Go(func() error {
return apiSrv.Start(ctx, srvCfg)
})

return server.NewCometABCIWrapper(wasmApp), nil
}
}
Expand Down

0 comments on commit fa003a4

Please sign in to comment.