github.com/InjectiveLabs/sdk-go@v1.53.0/examples/exchange/meta/3_Info/example.go (about)

     1  package main
     2  
     3  import (
     4  	"context"
     5  	"encoding/json"
     6  	"fmt"
     7  
     8  	"github.com/InjectiveLabs/sdk-go/client/common"
     9  	exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange"
    10  	metaPB "github.com/InjectiveLabs/sdk-go/exchange/meta_rpc/pb"
    11  )
    12  
    13  func main() {
    14  	// network := common.LoadNetwork("mainnet", "k8s")
    15  	network := common.LoadNetwork("testnet", "lb")
    16  	exchangeClient, err := exchangeclient.NewExchangeClient(network)
    17  	if err != nil {
    18  		panic(err)
    19  	}
    20  
    21  	ctx := context.Background()
    22  
    23  	req := metaPB.InfoRequest{}
    24  
    25  	res, err := exchangeClient.GetInfo(ctx, &req)
    26  	if err != nil {
    27  		fmt.Println(err)
    28  	}
    29  
    30  	str, _ := json.MarshalIndent(res, "", " ")
    31  	fmt.Print(string(str))
    32  }