9
"github.com/fbsobreira/gotron-sdk/pkg/client"10
"google.golang.org/grpc"11
"google.golang.org/grpc/credentials"19
var token = "YOUR_TOKEN"20
var 端点 = "YOUR_ENDPOINT:50051"26
func (a *auth) GetRequestMetadata(ctx 上下文.上下文, uri ...字符串) (map[字符串]字符串, error) {32
func (a *auth) RequireTransportSecurity() bool {38
opts := []grpc.DialOption{39
grpc.WithTransportCredentials(凭证.NewTLS(&tls.配置{})),40
grpc.WithPerRPC凭据(&auth{令牌}),42
conn := client.NewGrpcClient(endpoint)43
if err := conn.Start(opts...); err != nil {48
txID := "675d304be4dbc5b68554ecc60a2aebac137209910e82fa9ee1210ecccbe79bde"49
fmt.Println("Getting transaction with ID:", txID)51
tx, err := conn.GetTransactionByID(txID)53
fmt.Printf("Error: %v\n", err)56
fmt.Println("Transaction Response:")57
txJSON, err := json.MarshalIndent(tx, "", " ")59
fmt.Printf("Error marshaling to JSON: %v\n", err)62
fmt.Println(string(txJSON))
9
"github.com/fbsobreira/gotron-sdk/pkg/client"10
"google.golang.org/grpc"11
"google.golang.org/grpc/credentials"19
var token = "YOUR_TOKEN"20
var 端点 = "YOUR_ENDPOINT:50051"26
func (a *auth) GetRequestMetadata(ctx 上下文.上下文, uri ...字符串) (map[字符串]字符串, error) {32
func (a *auth) RequireTransportSecurity() bool {38
opts := []grpc.DialOption{39
grpc.WithTransportCredentials(凭证.NewTLS(&tls.配置{})),40
grpc.WithPerRPC凭据(&auth{令牌}),42
conn := client.NewGrpcClient(endpoint)43
if err := conn.Start(opts...); err != nil {48
txID := "675d304be4dbc5b68554ecc60a2aebac137209910e82fa9ee1210ecccbe79bde"49
fmt.Println("Getting transaction with ID:", txID)51
tx, err := conn.GetTransactionByID(txID)53
fmt.Printf("Error: %v\n", err)56
fmt.Println("Transaction Response:")57
txJSON, err := json.MarshalIndent(tx, "", " ")59
fmt.Printf("Error marshaling to JSON: %v\n", err)62
fmt.Println(string(txJSON))