github.com/InjectiveLabs/sdk-go@v1.53.0/examples/exchange/auction/2_Auctions/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  )
    11  
    12  func main() {
    13  	network := common.LoadNetwork("testnet", "lb")
    14  	exchangeClient, err := exchangeclient.NewExchangeClient(network)
    15  	if err != nil {
    16  		panic(err)
    17  	}
    18  
    19  	ctx := context.Background()
    20  	res, err := exchangeClient.GetAuctions(ctx)
    21  	if err != nil {
    22  		fmt.Println(err)
    23  	}
    24  
    25  	str, _ := json.MarshalIndent(res, "", " ")
    26  	fmt.Print(string(str))
    27  }