ExchangeByID gRPC Method
Parameters
id
integer
REQUIRED
Loading...
Returns
exchange_id
integer
Loading...
creator_address
string
Loading...
create_time
integer
Loading...
first_token_id
string
Loading...
first_token_balance
integer
Loading...
second_token_id
string
Loading...
second_token_balance
integer
Loading...
Request
1package main23import (4"context"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}
1package main23import (4"context"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}
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free