GetWitnessBrokerage gRPC Method
Paramètres
witness
chaîne de caractères
OBLIGATOIRE
Chargement en cours...
Retours
brokerage
nombre
Chargement en cours...
erreur
objet
Chargement en cours...
Demande
1paquet principal23import (4« contexte »5« crypto/tls »6« fmt »78« github.sdk »9« google.golang.grpc »10« google.golang.grpc »11)121314// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token15// For eg: QN Endpoint: https://docs-demo.tron-mainnet.quiknode.pro/abcde12345678916// endpoint will be: docs-demo.tron-mainnet.quiknode.pro:50051 {50051 is the port number for Tron gRPC}17// token will be : abcde1234567891819var jeton = "VOTRE_TOKEN"20var endpoint = "VOTRE_POINT_DE_FIN :50051"2122type auth struct {23jeton chaîne de caractères24}2526func (a *auth) GetRequestMetadata(ctx contexte.Context, uri ...chaîne) (carte[chaîne]chaîne, erreur) {27retour carte[chaîne]chaîne{28« x-token »: un.jeton,29}, nil30}3132func (a *auth) RequireTransportSecurity() bool {33retour false34}3536func main() {37opts := []grpc.DialOption{38grpc.WithTransportCredentials(informations d'authentification.NewTLS(&tls.Config{})),39grpc.Avec les identifiants RPCC(&auth{token}),40}41conn := client.NewGrpcClient(endpoint)42if err := conn.Start(opts...); err != nil {43panique(erreur)44}4546witnessAddr := "TGj1Ej1qRzL9feLTLhjwgxXF4Ct6GTWg2U"4748fmt.Printf("Getting brokerage for witness: %s\n", witnessAddr)49brokerage, err := conn.GetWitnessBrokerage(witnessAddr)50si err != nil {51fmt.Printf("Error fetching witness brokerage: %v\n", err)52retour53}5455fmt.Printf("Witness brokerage: %.0f%%\n", brokerage)5657}
1paquet principal23import (4« contexte »5« crypto/tls »6« fmt »78« github.sdk »9« google.golang.grpc »10« google.golang.grpc »11)121314// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token15// For eg: QN Endpoint: https://docs-demo.tron-mainnet.quiknode.pro/abcde12345678916// endpoint will be: docs-demo.tron-mainnet.quiknode.pro:50051 {50051 is the port number for Tron gRPC}17// token will be : abcde1234567891819var jeton = "VOTRE_TOKEN"20var endpoint = "VOTRE_POINT_DE_FIN :50051"2122type auth struct {23jeton chaîne de caractères24}2526func (a *auth) GetRequestMetadata(ctx contexte.Context, uri ...chaîne) (carte[chaîne]chaîne, erreur) {27retour carte[chaîne]chaîne{28« x-token »: un.jeton,29}, nil30}3132func (a *auth) RequireTransportSecurity() bool {33retour false34}3536func main() {37opts := []grpc.DialOption{38grpc.WithTransportCredentials(informations d'authentification.NewTLS(&tls.Config{})),39grpc.Avec les identifiants RPCC(&auth{token}),40}41conn := client.NewGrpcClient(endpoint)42if err := conn.Start(opts...); err != nil {43panique(erreur)44}4546witnessAddr := "TGj1Ej1qRzL9feLTLhjwgxXF4Ct6GTWg2U"4748fmt.Printf("Getting brokerage for witness: %s\n", witnessAddr)49brokerage, err := conn.GetWitnessBrokerage(witnessAddr)50si err != nil {51fmt.Printf("Error fetching witness brokerage: %v\n", err)52retour53}5455fmt.Printf("Witness brokerage: %.0f%%\n", brokerage)5657}
Vous n'avez pas encore de compte ?
Créez votreendpoint Quicknode endpoint quelques secondes et commencez à développer
Commencez gratuitement