ExchangeByID gRPC Method
パラメータ
id
整数
必須
読み込み中...
返品
exchange_id
整数
読み込み中...
作成者アドレス
文字列
読み込み中...
create_time
整数
読み込み中...
first_token_id
文字列
読み込み中...
first_token_balance
整数
読み込み中...
second_token_id
文字列
読み込み中...
second_token_balance
整数
読み込み中...
リクエスト
1パッケージ main23import (4「文脈」5"crypto/tls"6"encoding/json"7"fmt"8"github.com/fbsobreira/gotron-sdk/pkg/client"9"google.golang.org/grpc"10"google.golang.org/grpc/credentials"11)1213// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token14// For eg: QN Endpoint: https://docs-demo.tron-mainnet.quiknode.pro/abcde12345678915// endpoint will be: docs-demo.tron-mainnet.quiknode.pro:50051 {50051 is the port number for Tron gRPC}16// token will be : abcde1234567891718var token = "YOUR_TOKEN"19var endpoint = "YOUR_ENDPOINT:50051"2021type auth struct {22token string23}2425func (a *auth) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {26return map[string]string{27"x-token": a.token,28}, nil29}3031func (a *auth) RequireTransportSecurity() bool {32return false33}3435func main() {3637opts := []grpc.DialOption{38grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),39grpc.WithPerRPCCredentials(&auth{token}),40}41conn := client.NewGrpcClient(endpoint)42if err := conn.Start(opts...); err != nil {43panic(err)44}45defer conn.Conn.Close()4647id := int64(123)4849fmt.Printf("Querying exchange details for exchange ID: %d\n", id)5051exchange, err := conn.ExchangeByID(id)5253if err != nil {54fmt.Printf("Error retrieving exchange: %v\n", err)55return56}5758fmt.Println("Exchange details retrieved successfully:")59resultJSON, _ := json.MarshalIndent(exchange, "", " ")60fmt.Println(string(resultJSON))61}
1パッケージ main23import (4「文脈」5"crypto/tls"6"encoding/json"7"fmt"8"github.com/fbsobreira/gotron-sdk/pkg/client"9"google.golang.org/grpc"10"google.golang.org/grpc/credentials"11)1213// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token14// For eg: QN Endpoint: https://docs-demo.tron-mainnet.quiknode.pro/abcde12345678915// endpoint will be: docs-demo.tron-mainnet.quiknode.pro:50051 {50051 is the port number for Tron gRPC}16// token will be : abcde1234567891718var token = "YOUR_TOKEN"19var endpoint = "YOUR_ENDPOINT:50051"2021type auth struct {22token string23}2425func (a *auth) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {26return map[string]string{27"x-token": a.token,28}, nil29}3031func (a *auth) RequireTransportSecurity() bool {32return false33}3435func main() {3637opts := []grpc.DialOption{38grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),39grpc.WithPerRPCCredentials(&auth{token}),40}41conn := client.NewGrpcClient(endpoint)42if err := conn.Start(opts...); err != nil {43panic(err)44}45defer conn.Conn.Close()4647id := int64(123)4849fmt.Printf("Querying exchange details for exchange ID: %d\n", id)5051exchange, err := conn.ExchangeByID(id)5253if err != nil {54fmt.Printf("Error retrieving exchange: %v\n", err)55return56}5758fmt.Println("Exchange details retrieved successfully:")59resultJSON, _ := json.MarshalIndent(exchange, "", " ")60fmt.Println(string(resultJSON))61}