From f2090ea732a5e25f81064f31799f4a00aebea2cf Mon Sep 17 00:00:00 2001 From: vinhphuctadang Date: Tue, 14 Mar 2023 23:04:27 +0700 Subject: [PATCH 1/2] chore: remove tcp prefix --- client/common/network.go | 2 +- .../explorer/12_GetWasmCodeById/example.go | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 examples/explorer/12_GetWasmCodeById/example.go diff --git a/client/common/network.go b/client/common/network.go index 16e197e8..e9e0992e 100644 --- a/client/common/network.go +++ b/client/common/network.go @@ -117,7 +117,7 @@ func LoadNetwork(name string, node string) Network { lcdEndpoint = "https://k8s.global.mainnet.lcd.injective.network" tmEndpoint = "https://k8s.global.mainnet.tm.injective.network:443" chainGrpcEndpoint = "k8s.global.mainnet.chain.grpc.injective.network:443" - exchangeGrpcEndpoint = "tcp://k8s.global.mainnet.exchange.grpc.injective.network:443" + exchangeGrpcEndpoint = "k8s.global.mainnet.exchange.grpc.injective.network:443" chainTlsCert = credentials.NewServerTLSFromCert(&tls.Certificate{}) explorerGrpcEndpoint = "tcp://k8s.mainnet.explorer.grpc.injective.network:443" exchangeTlsCert = credentials.NewServerTLSFromCert(&tls.Certificate{}) diff --git a/examples/explorer/12_GetWasmCodeById/example.go b/examples/explorer/12_GetWasmCodeById/example.go new file mode 100644 index 00000000..7a9e187d --- /dev/null +++ b/examples/explorer/12_GetWasmCodeById/example.go @@ -0,0 +1,34 @@ +package main + +import ( + "context" + "encoding/json" + "fmt" + + explorerPB "github.com/InjectiveLabs/sdk-go/exchange/explorer_rpc/pb" + + "github.com/InjectiveLabs/sdk-go/client/common" + explorerclient "github.com/InjectiveLabs/sdk-go/client/explorer" +) + +func main() { + network := common.LoadNetwork("testnet", "k8s") + explorerClient, err := explorerclient.NewExplorerClient(network.ExplorerGrpcEndpoint, common.OptionTLSCert(network.ExplorerTlsCert)) + if err != nil { + panic(err) + } + + ctx := context.Background() + + req := explorerPB.GetWasmCodeByIDRequest{ + CodeId: 10, + } + + res, err := explorerClient.GetWasmCodeByID(ctx, req) + if err != nil { + fmt.Println(err) + } + + str, _ := json.MarshalIndent(res, "", " ") + fmt.Print(string(str)) +} From a15275f109b122055ab9079aeb4ff0985b59537b Mon Sep 17 00:00:00 2001 From: vinhphuctadang Date: Tue, 14 Mar 2023 23:09:15 +0700 Subject: [PATCH 2/2] chore: clean up example --- .../explorer/12_GetWasmCodesById/example.go | 34 ------------------- 1 file changed, 34 deletions(-) delete mode 100644 examples/explorer/12_GetWasmCodesById/example.go diff --git a/examples/explorer/12_GetWasmCodesById/example.go b/examples/explorer/12_GetWasmCodesById/example.go deleted file mode 100644 index 7a9e187d..00000000 --- a/examples/explorer/12_GetWasmCodesById/example.go +++ /dev/null @@ -1,34 +0,0 @@ -package main - -import ( - "context" - "encoding/json" - "fmt" - - explorerPB "github.com/InjectiveLabs/sdk-go/exchange/explorer_rpc/pb" - - "github.com/InjectiveLabs/sdk-go/client/common" - explorerclient "github.com/InjectiveLabs/sdk-go/client/explorer" -) - -func main() { - network := common.LoadNetwork("testnet", "k8s") - explorerClient, err := explorerclient.NewExplorerClient(network.ExplorerGrpcEndpoint, common.OptionTLSCert(network.ExplorerTlsCert)) - if err != nil { - panic(err) - } - - ctx := context.Background() - - req := explorerPB.GetWasmCodeByIDRequest{ - CodeId: 10, - } - - res, err := explorerClient.GetWasmCodeByID(ctx, req) - if err != nil { - fmt.Println(err) - } - - str, _ := json.MarshalIndent(res, "", " ") - fmt.Print(string(str)) -}