TRC20GetSymbol gRPC Method
Paramètres
contractAddress
chaîne de caractères
OBLIGATOIRE
Chargement en cours...
Retours
symbole
chaîne de caractères
Chargement en cours...
erreur
objet
Chargement en cours...
Demande
1paquet principal23import (4« contexte »5« crypto/tls »6« encoding/json »7« fmt »89« github.sdk »10« google.golang.grpc »11« google.golang.grpc »12)131415// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token16// For eg: QN Endpoint: https://docs-demo.tron-mainnet.quiknode.pro/abcde12345678917// endpoint will be: docs-demo.tron-mainnet.quiknode.pro:50051 {50051 is the port number for Tron gRPC}18// token will be : abcde1234567891920var jeton = "VOTRE_TOKEN"21var endpoint = "VOTRE_POINT_DE_FIN :50051"222324type auth struct {25jeton chaîne de caractères26}2728func (a *auth) GetRequestMetadata(ctx contexte.Context, uri ...chaîne) (carte[chaîne]chaîne, erreur) {29retour carte[chaîne]chaîne{30« x-token »: un.jeton,31}, nil32}3334func (a *auth) RequireTransportSecurity() bool {35retour false36}3738func main() {39opts := []grpc.DialOption{40grpc.WithTransportCredentials(informations d'authentification.NewTLS(&tls.Config{})),41grpc.Avec les identifiants RPCC(&auth{token}),42}43conn := client.NewGrpcClient(endpoint)44if err := conn.Start(opts...); err != nil {45panique(erreur)46}47reporter conn.Conn.Fermer()4849contractAddress := "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"5051symbolName, err := conn.TRC20GetSymbol(contractAddress)52si err != nil {53fmt.Printf("Error calling TRC20GetSymbol: %v\n", err)54retour55}56jsonData, _ := json.MarshalIndent(symbolName, "", " ")57fmt.Println(string(jsonData))5859}
1paquet principal23import (4« contexte »5« crypto/tls »6« encoding/json »7« fmt »89« github.sdk »10« google.golang.grpc »11« google.golang.grpc »12)131415// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token16// For eg: QN Endpoint: https://docs-demo.tron-mainnet.quiknode.pro/abcde12345678917// endpoint will be: docs-demo.tron-mainnet.quiknode.pro:50051 {50051 is the port number for Tron gRPC}18// token will be : abcde1234567891920var jeton = "VOTRE_TOKEN"21var endpoint = "VOTRE_POINT_DE_FIN :50051"222324type auth struct {25jeton chaîne de caractères26}2728func (a *auth) GetRequestMetadata(ctx contexte.Context, uri ...chaîne) (carte[chaîne]chaîne, erreur) {29retour carte[chaîne]chaîne{30« x-token »: un.jeton,31}, nil32}3334func (a *auth) RequireTransportSecurity() bool {35retour false36}3738func main() {39opts := []grpc.DialOption{40grpc.WithTransportCredentials(informations d'authentification.NewTLS(&tls.Config{})),41grpc.Avec les identifiants RPCC(&auth{token}),42}43conn := client.NewGrpcClient(endpoint)44if err := conn.Start(opts...); err != nil {45panique(erreur)46}47reporter conn.Conn.Fermer()4849contractAddress := "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"5051symbolName, err := conn.TRC20GetSymbol(contractAddress)52si err != nil {53fmt.Printf("Error calling TRC20GetSymbol: %v\n", err)54retour55}56jsonData, _ := json.MarshalIndent(symbolName, "", " ")57fmt.Println(string(jsonData))5859}
Vous n'avez pas encore de compte ?
Créez votreendpoint Quicknode endpoint quelques secondes et commencez à développer
Commencez gratuitement