TRC20ContractBalance gRPC Method
Paramètres
addr
chaîne de caractères
OBLIGATOIRE
Chargement en cours...
contractAddress
chaîne de caractères
OBLIGATOIRE
Chargement en cours...
Retours
solde
chaîne de caractères
Chargement en cours...
erreur
objet
Chargement en cours...
Demande
1paquet principal23import (4« contexte »5« crypto/tls »6« fmt »7« encoding/json »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()4849accountAddress := "TPyjyZfsYaXStgz2NmAraF1uZcMtkgNan5"50contractAddress := "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"5152balance, err := conn.TRC20ContractBalance(accountAddress, contractAddress)53si err != nil {54fmt.Printf("Error calling TRC20ContractBalance: %v\n", err)55retour56}5758jsonData, _ := json.MarshalIndent(balance, "", " ")59fmt.Println(string(jsonData))6061}
1paquet principal23import (4« contexte »5« crypto/tls »6« fmt »7« encoding/json »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()4849accountAddress := "TPyjyZfsYaXStgz2NmAraF1uZcMtkgNan5"50contractAddress := "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"5152balance, err := conn.TRC20ContractBalance(accountAddress, contractAddress)53si err != nil {54fmt.Printf("Error calling TRC20ContractBalance: %v\n", err)55retour56}5758jsonData, _ := json.MarshalIndent(balance, "", " ")59fmt.Println(string(jsonData))6061}
Vous n'avez pas encore de compte ?
Créez votreendpoint Quicknode endpoint quelques secondes et commencez à développer
Commencez gratuitement