TotalTransaction gRPC Method
Paramètres
Cette méthode n'accepte aucun paramètre
Retours
num
entier
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"212223type auth struct {24jeton chaîne de caractères25}2627func (a *auth) GetRequestMetadata(ctx contexte.Context, uri ...chaîne) (carte[chaîne]chaîne, erreur) {28retour carte[chaîne]chaîne{29« x-token »: un.jeton,30}, nil31}3233func (a *auth) RequireTransportSecurity() bool {34retour false35}3637func main() {38opts := []grpc.DialOption{39grpc.WithTransportCredentials(informations d'authentification.NewTLS(&tls.Config{})),40grpc.Avec les identifiants RPCC(&auth{token}),41}42conn := client.NewGrpcClient(endpoint)43if err := conn.Start(opts...); err != nil {44panique(erreur)45}4647response, err := conn.TotalTransaction()48si err != nil {49fmt.Printf("Error getting total transactions: %v\n", err)50retour51}5253fmt.Printf("Total number of transactions on the TRON blockchain: %d\n", response.GetNum())5455}
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"212223type auth struct {24jeton chaîne de caractères25}2627func (a *auth) GetRequestMetadata(ctx contexte.Context, uri ...chaîne) (carte[chaîne]chaîne, erreur) {28retour carte[chaîne]chaîne{29« x-token »: un.jeton,30}, nil31}3233func (a *auth) RequireTransportSecurity() bool {34retour false35}3637func main() {38opts := []grpc.DialOption{39grpc.WithTransportCredentials(informations d'authentification.NewTLS(&tls.Config{})),40grpc.Avec les identifiants RPCC(&auth{token}),41}42conn := client.NewGrpcClient(endpoint)43if err := conn.Start(opts...); err != nil {44panique(erreur)45}4647response, err := conn.TotalTransaction()48si err != nil {49fmt.Printf("Error getting total transactions: %v\n", err)50retour51}5253fmt.Printf("Total number of transactions on the TRON blockchain: %d\n", response.GetNum())5455}
Vous n'avez pas encore de compte ?
Créez votreendpoint Quicknode endpoint quelques secondes et commencez à développer
Commencez gratuitement