github.com/InjectiveLabs/sdk-go@v1.53.0/examples/explorer/12_GetWasmCodeById/example.go (about) 1 package main 2 3 import ( 4 "context" 5 "encoding/json" 6 "fmt" 7 8 explorerPB "github.com/InjectiveLabs/sdk-go/exchange/explorer_rpc/pb" 9 10 "github.com/InjectiveLabs/sdk-go/client/common" 11 explorerclient "github.com/InjectiveLabs/sdk-go/client/explorer" 12 ) 13 14 func main() { 15 network := common.LoadNetwork("testnet", "lb") 16 explorerClient, err := explorerclient.NewExplorerClient(network) 17 if err != nil { 18 panic(err) 19 } 20 21 ctx := context.Background() 22 23 req := explorerPB.GetWasmCodeByIDRequest{ 24 CodeId: 10, 25 } 26 27 res, err := explorerClient.GetWasmCodeByID(ctx, &req) 28 if err != nil { 29 fmt.Println(err) 30 } 31 32 str, _ := json.MarshalIndent(res, "", " ") 33 fmt.Print(string(str)) 34 }