ProposalsList gRPC Method
参数
该方法不接受任何参数
退货
提案
数组
正在加载...
提案编号
整数
正在加载...
提案人地址
字符串
正在加载...
parameters
对象
正在加载...
expiration_time
整数
正在加载...
create_time
整数
正在加载...
approvals
数组
正在加载...
状态
字符串
正在加载...
错误
对象
正在加载...
请求
1包 main23import (4"上下文"5"crypto/tls"6"encoding/json"7"fmt"89"github.com/fbsobreira/gotron-sdk/pkg/client"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 令牌 = "YOUR_TOKEN"21var endpoint = "YOUR_ENDPOINT:50051"222324类型 auth 结构体 {25token 字符串26}2728func (a *auth) GetRequestMetadata(ctx 上下文.Context, uri ...字符串) (map[字符串]字符串, error) {29返回 map[字符串]字符串{30“x-token”: a.令牌,31}, nil32}3334func (a *auth) RequireTransportSecurity() bool {35返回 false36}3738func main() {39opts := []grpc.DialOption{40grpc.WithTransportCredentials(凭证.NewTLS(&tls.配置{})),41grpc.WithPerRPCCredentials(&auth{令牌}),42}43conn := client.NewGrpcClient(endpoint)44if err := conn.Start(opts...); err != nil {45panic(err)46}4748fmt.Println("Listing all proposals:")49proposals, err := conn.ProposalsList()50如果 err != nil {51fmt.Printf("Error listing proposals: %v\n", err)52返回53}5455jsonPretty, _ := json.MarshalIndent(proposals, "", " ")56fmt.Println(string(jsonPretty))5758}
1包 main23import (4"上下文"5"crypto/tls"6"encoding/json"7"fmt"89"github.com/fbsobreira/gotron-sdk/pkg/client"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 令牌 = "YOUR_TOKEN"21var endpoint = "YOUR_ENDPOINT:50051"222324类型 auth 结构体 {25token 字符串26}2728func (a *auth) GetRequestMetadata(ctx 上下文.Context, uri ...字符串) (map[字符串]字符串, error) {29返回 map[字符串]字符串{30“x-token”: a.令牌,31}, nil32}3334func (a *auth) RequireTransportSecurity() bool {35返回 false36}3738func main() {39opts := []grpc.DialOption{40grpc.WithTransportCredentials(凭证.NewTLS(&tls.配置{})),41grpc.WithPerRPCCredentials(&auth{令牌}),42}43conn := client.NewGrpcClient(endpoint)44if err := conn.Start(opts...); err != nil {45panic(err)46}4748fmt.Println("Listing all proposals:")49proposals, err := conn.ProposalsList()50如果 err != nil {51fmt.Printf("Error listing proposals: %v\n", err)52返回53}5455jsonPretty, _ := json.MarshalIndent(proposals, "", " ")56fmt.Println(string(jsonPretty))5758}