From f7c03850463f5f2e667bdc1776dd5cceb6ca6c8d Mon Sep 17 00:00:00 2001 From: Alessandro Lo Manto Date: Tue, 18 Jun 2024 18:43:39 +0200 Subject: [PATCH] Added grpc endpoint as a config variable --- config.json | 1 + domain/config.go | 1 + router/usecase/pools/cosmwasm_utils.go | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config.json b/config.json index 593648caf..fc2c96d0d 100644 --- a/config.json +++ b/config.json @@ -5,6 +5,7 @@ "logger-is-production": true, "logger-level": "info", "grpc-gateway-endpoint": "http://localhost:26657", + "grpc-endpoint": "http://localhost:9090", "chain-id": "osmosis-1", "chain-registry-assets-url": "https://raw.githubusercontent.com/osmosis-labs/assetlists/main/osmosis-1/generated/frontend/assetlist.json", "router": { diff --git a/domain/config.go b/domain/config.go index 237d34593..8cf7fbcf2 100644 --- a/domain/config.go +++ b/domain/config.go @@ -13,6 +13,7 @@ type Config struct { LoggerLevel string `mapstructure:"logger-level"` ChainGRPCGatewayEndpoint string `mapstructure:"grpc-gateway-endpoint"` + ChainGRPCEndpoint string `mapstructure:"grpc-endpoint"` ChainID string `mapstructure:"chain-id"` // Chain registry assets URL. diff --git a/router/usecase/pools/cosmwasm_utils.go b/router/usecase/pools/cosmwasm_utils.go index 483be3951..94b43f479 100644 --- a/router/usecase/pools/cosmwasm_utils.go +++ b/router/usecase/pools/cosmwasm_utils.go @@ -6,17 +6,19 @@ import ( wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" "github.com/cosmos/cosmos-sdk/client" "github.com/osmosis-labs/sqs/sqsdomain/json" + "github.com/osmosis-labs/sqs/domain" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/metadata" ) +var config domain.Config // initializeWasmClient initializes the wasm client given the node URI // Returns error if fails to initialize the client func initializeWasmClient(nodeURI string) (wasmtypes.QueryClient, error) { clientContext := client.Context{} - grpcClient, err := grpc.NewClient("osmosis:9090", + grpcClient, err := grpc.NewClient(config.ChainGRPCEndpoint, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithStatsHandler(otelgrpc.NewClientHandler()), )