NetworkMinGasPrice gRPC Method
參數
此方法不接受任何參數
退貨
network_min_gas_price
整數
載入中...
請求
1套件 主函式23匯入 (4"上下文"5"crypto/tls"6"encoding/json"7"fmt"8"log"9「時間」1011"google.golang.grpc"12"google.golang.grpc"1314minfeetypes "celestia-grpc/celestia/minfee/v1"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延後 延遲連接.關閉()5152client := minfeetypes.NewQueryClient(conn)5354ctx, 取消 := context.WithTimeout(context.背景(), 10*時間.第二)55延後 延後()5657resp, err := client.NetworkMinGasPrice(ctx, &minfeetypes.QueryNetworkMinGasPrice{})58如果 err != nil {59log.Fatalf("Failed to query network min gas price: %v", err)60}6162jsonData, err := json.MarshalIndent(resp, "", " ")63如果 err != nil {64log.Printf("Error converting to JSON: %v", err)65} else {66fmt.Println("\nOutput:")67fmt.PrintlnPrintln字串(jsonData))68}69}
1套件 主函式23匯入 (4"上下文"5"crypto/tls"6"encoding/json"7"fmt"8"log"9「時間」1011"google.golang.grpc"12"google.golang.grpc"1314minfeetypes "celestia-grpc/celestia/minfee/v1"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延後 延遲連接.關閉()5152client := minfeetypes.NewQueryClient(conn)5354ctx, 取消 := context.WithTimeout(context.背景(), 10*時間.第二)55延後 延後()5657resp, err := client.NetworkMinGasPrice(ctx, &minfeetypes.QueryNetworkMinGasPrice{})58如果 err != nil {59log.Fatalf("Failed to query network min gas price: %v", err)60}6162jsonData, err := json.MarshalIndent(resp, "", " ")63如果 err != nil {64log.Printf("Error converting to JSON: %v", err)65} else {66fmt.Println("\nOutput:")67fmt.PrintlnPrintln字串(jsonData))68}69}