-
Notifications
You must be signed in to change notification settings - Fork 41
/
example.go
37 lines (30 loc) · 895 Bytes
/
example.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"context"
"encoding/json"
"fmt"
explorerPB "github.com/InjectiveLabs/sdk-go/exchange/explorer_rpc/pb"
"github.com/InjectiveLabs/sdk-go/client/common"
exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange"
)
func main() {
//network := common.LoadNetwork("mainnet", "k8s")
network := common.LoadNetwork("testnet", "k8s")
exchangeClient, err := exchangeclient.NewExchangeClient(network.ExchangeGrpcEndpoint, common.OptionTLSCert(network.ExchangeTlsCert))
if err != nil {
fmt.Println(err)
}
address := "inj1akxycslq8cjt0uffw4rjmfm3echchptu52a2dq"
after := uint64(14112176)
req := explorerPB.GetAccountTxsRequest{
After: after,
Address: address,
}
ctx := context.Background()
res, err := exchangeClient.GetAccountTxs(ctx, req)
if err != nil {
fmt.Println(err)
}
str, _ := json.MarshalIndent(res, "", " ")
fmt.Print(string(str))
}