ExchangeByID gRPC Method
Parâmetros
id
número inteiro
OBRIGATÓRIO
A carregar...
Devoluções
exchange_id
número inteiro
A carregar...
creator_address
cadeia de caracteres
A carregar...
create_time
número inteiro
A carregar...
first_token_id
cadeia de caracteres
A carregar...
first_token_balance
número inteiro
A carregar...
second_token_id
cadeia de caracteres
A carregar...
second_token_balance
número inteiro
A carregar...
Pedido
1pacote principal23importar (4"contexto"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 ponto final = "O_SEU_PONTO_DE_ACESSO:50051"2021tipo auth estrutura {22token cadeia de caracteres23}2425func (a *auth) GetRequestMetadata(ctx contexto.Context, uri ...string) (mapa[string]string, erro) {26retornar mapa[string]string{27"x-token": a.token,28}, nil29}3031func (a *auth) RequireTransportSecurity() bool {32retornar false33}3435func main() {3637opts := []grpc.DialOption{38grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),39grpc.WithPerRPCCredentials(&auth{token}),40}41conn := cliente.NewGrpcClient(ponto de extremidade)42if err := conn.Start(opts...); err != nil {43panic(err)44}45adiar conn.Conn.Fechar()4647id := int64(123)4849fmt.Printf("Querying exchange details for exchange ID: %d\n", id)5051exchange, err := conn.ExchangeByID(id)5253se 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}
1pacote principal23importar (4"contexto"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 ponto final = "O_SEU_PONTO_DE_ACESSO:50051"2021tipo auth estrutura {22token cadeia de caracteres23}2425func (a *auth) GetRequestMetadata(ctx contexto.Context, uri ...string) (mapa[string]string, erro) {26retornar mapa[string]string{27"x-token": a.token,28}, nil29}3031func (a *auth) RequireTransportSecurity() bool {32retornar false33}3435func main() {3637opts := []grpc.DialOption{38grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),39grpc.WithPerRPCCredentials(&auth{token}),40}41conn := cliente.NewGrpcClient(ponto de extremidade)42if err := conn.Start(opts...); err != nil {43panic(err)44}45adiar conn.Conn.Fechar()4647id := int64(123)4849fmt.Printf("Querying exchange details for exchange ID: %d\n", id)5051exchange, err := conn.ExchangeByID(id)5253se 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}
Ainda não tem uma conta?
Crie o seu ponto de extremidade Quicknode em segundos e comece a desenvolver
Comece gratuitamente