AnnualProvisionsgRPC
參數
此方法不接受任何參數
退貨
年度撥備
字串
載入中...
請求
1套件 主函式23匯入 (4"上下文"5"crypto/tls"6"encoding/json"7"fmt"8"log"9「時間」1011"google.golang.grpc"12"google.golang.grpc"1314薄荷幣種 "celestia"15)1617// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token18// For eg: QN Endpoint: https://docs-demo.celestia-mainnet.quiknode.pro/abcde12345678919// endpoint will be: docs-demo.celestia-mainnet.quiknode.pro:9090 {9090 is the port number for Celestia gRPC}20// token will be : abcde1234567892122var 代幣 = "您的_代幣"23var endpoint = "您的端點:9090"2425類型 auth 結構體 {26代幣 字串27}2829func (a *auth) GetRequestMetadata(ctx 上下文.Context, uri ...字串) (map[字串]字串, 錯誤) {30返回 地圖[字串]字串{31「x-token」: a.token,32}, nil33}3435func (a *auth) RequireTransportSecurity() bool {36返回 false37}3839func main() {40opts := []grpc.DialOption{41grpc.WithTransportCredentials(憑證.NewTLS(&tls.Config{})),42grpc.WithPerRPC憑證(&auth{token}),43}4445// Create gRPC connection46conn, err := grpc.撥號(endpoint, opts...)47如果 err != nil {48log.Fatalf("無法連線至Celestia gRPC :%v", err)49}50延後 延遲連接.關閉()5152客戶 := 貨幣種類.NewQueryClient(conn)5354ctx, 取消 := context.WithTimeout(context.背景(), 10*時間.第二)55延後 延後()5657provisionsResp, err := client.AnnualProvisions(ctx, &minttypes.QueryAnnualProvisionsRequest{})58如果 err != nil {59log.Printf("查詢年度撥款失敗:%v", err)60} else {61jsonData, _ := json.MarshalIndent(provisionsResp, "", " ")62fmt.PrintlnPrintln字串(jsonData))63}64}
1套件 主函式23匯入 (4"上下文"5"crypto/tls"6"encoding/json"7"fmt"8"log"9「時間」1011"google.golang.grpc"12"google.golang.grpc"1314薄荷幣種 "celestia"15)1617// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token18// For eg: QN Endpoint: https://docs-demo.celestia-mainnet.quiknode.pro/abcde12345678919// endpoint will be: docs-demo.celestia-mainnet.quiknode.pro:9090 {9090 is the port number for Celestia gRPC}20// token will be : abcde1234567892122var 代幣 = "您的_代幣"23var endpoint = "您的端點:9090"2425類型 auth 結構體 {26代幣 字串27}2829func (a *auth) GetRequestMetadata(ctx 上下文.Context, uri ...字串) (map[字串]字串, 錯誤) {30返回 地圖[字串]字串{31「x-token」: a.token,32}, nil33}3435func (a *auth) RequireTransportSecurity() bool {36返回 false37}3839func main() {40opts := []grpc.DialOption{41grpc.WithTransportCredentials(憑證.NewTLS(&tls.Config{})),42grpc.WithPerRPC憑證(&auth{token}),43}4445// Create gRPC connection46conn, err := grpc.撥號(endpoint, opts...)47如果 err != nil {48log.Fatalf("無法連線至Celestia gRPC :%v", err)49}50延後 延遲連接.關閉()5152客戶 := 貨幣種類.NewQueryClient(conn)5354ctx, 取消 := context.WithTimeout(context.背景(), 10*時間.第二)55延後 延後()5657provisionsResp, err := client.AnnualProvisions(ctx, &minttypes.QueryAnnualProvisionsRequest{})58如果 err != nil {59log.Printf("查詢年度撥款失敗:%v", err)60} else {61jsonData, _ := json.MarshalIndent(provisionsResp, "", " ")62fmt.PrintlnPrintln字串(jsonData))63}64}