github.com/InjectiveLabs/sdk-go@v1.53.0/examples/explorer/9_PeggyWithdrawals/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  	sender := "inj14au322k9munkmx5wrchz9q30juf5wjgz2cfqku"
    23  
    24  	req := explorerPB.GetPeggyWithdrawalTxsRequest{
    25  		Sender: sender,
    26  	}
    27  
    28  	res, err := explorerClient.GetPeggyWithdrawals(ctx, &req)
    29  	if err != nil {
    30  		fmt.Println(err)
    31  	}
    32  
    33  	str, _ := json.MarshalIndent(res, "", " ")
    34  	fmt.Print(string(str))
    35  }