getVersion gRPC Method - Solana gRPC
Solana gRPC is included with Scale and Business plans. On Build and Accelerate plans, it remains available via the Solana gRPC add-on.
参数
该方法不接受任何参数
退货
版本
对象
正在加载...
package
字符串
正在加载...
版本
字符串
正在加载...
proto
字符串
正在加载...
solana
字符串
正在加载...
git
字符串
正在加载...
rustc
字符串
正在加载...
buildts
字符串
正在加载...
额外
对象
正在加载...
hostname
字符串
正在加载...
请求
1包 main23导入 (4"上下文"5"crypto/tls"6"fmt"7"日志"8"time"910pb "yellowstone/proto"111213"google.golang.org/grpc"14"google.golang.org/grpc/credentials"15"google.golang.org/grpc/encoding/gzip"16"google.golang.org/grpc/keepalive"17)1819// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token20// For eg: QN Endpoint: https://docs-demo.solana-mainnet.quiknode.pro/abcde12345678921// endpoint will be: docs-demo.solana-mainnet.quiknode.pro:10000 {10000 is the port number for gRPC}22// token will be : abcde1234567892324var (25endpoint = "YOUR_QN_ENDPOINT:10000"26token = "YOUR_TOKEN_NUMBER"27)2829func main() {30opts := []grpc.DialOption{31grpc.WithTransportCredentials(凭证.NewTLS(&tls.配置{})),32grpc.WithKeepaliveParams(kacp),33grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1024*1024*1024), grpc.UseCompressor(gzip.Name)),34grpc.WithPerRPCCredentials(tokenAuth{token: token}),35}3637conn, err := grpc.NewClient(endpoint, opts...)38如果 err != nil {39log.Fatalf("Failed to connect: %v", err)40}41defer conn.Close()4243client := pb.NewGeyserClient(conn)4445ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)46defer cancel()4748version, err := client.GetVersion(ctx, &pb.GetVersionRequest{})49如果 err != nil {50log.Fatalf("Failed to get version: %v", err)51}5253fmt.Printf("Yellowstone gRPC Version:\n")54fmt.Printf(" GeyserGrpc: %s\n", version.GetVersion())5556}
1包 main23导入 (4"上下文"5"crypto/tls"6"fmt"7"日志"8"time"910pb "yellowstone/proto"111213"google.golang.org/grpc"14"google.golang.org/grpc/credentials"15"google.golang.org/grpc/encoding/gzip"16"google.golang.org/grpc/keepalive"17)1819// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token20// For eg: QN Endpoint: https://docs-demo.solana-mainnet.quiknode.pro/abcde12345678921// endpoint will be: docs-demo.solana-mainnet.quiknode.pro:10000 {10000 is the port number for gRPC}22// token will be : abcde1234567892324var (25endpoint = "YOUR_QN_ENDPOINT:10000"26token = "YOUR_TOKEN_NUMBER"27)2829func main() {30opts := []grpc.DialOption{31grpc.WithTransportCredentials(凭证.NewTLS(&tls.配置{})),32grpc.WithKeepaliveParams(kacp),33grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1024*1024*1024), grpc.UseCompressor(gzip.Name)),34grpc.WithPerRPCCredentials(tokenAuth{token: token}),35}3637conn, err := grpc.NewClient(endpoint, opts...)38如果 err != nil {39log.Fatalf("Failed to connect: %v", err)40}41defer conn.Close()4243client := pb.NewGeyserClient(conn)4445ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)46defer cancel()4748version, err := client.GetVersion(ctx, &pb.GetVersionRequest{})49如果 err != nil {50log.Fatalf("Failed to get version: %v", err)51}5253fmt.Printf("Yellowstone gRPC Version:\n")54fmt.Printf(" GeyserGrpc: %s\n", version.GetVersion())5556}
1import Client from "@triton-one/yellowstone-grpc";23// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token4// For eg: QN Endpoint: https://docs-demo.solana-mainnet.quiknode.pro/abcde1234567895// endpoint will be: docs-demo.solana-mainnet.quiknode.pro:10000 {10000 is the port number for gRPC}6// token will be : abcde12345678978const ENDPOINT = "YOUR_QN_ENDPOINT:10000";9const TOKEN = "YOUR_TOKEN_NUMBER";1011async 函数 main() {12const client = new Client(ENDPOINT, TOKEN, {});1314try {15const version = await client.getVersion();16console.log("Solana Version Information:");17console.log(`getVersion: ${version}`);18} catch (error) {19console.error("Error fetching version:", error);20}21}2223main()24.catch((err) => {25console.error("Unhandled error:", err);26process.exit(1);27});
1import Client from "@triton-one/yellowstone-grpc";23// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token4// For eg: QN Endpoint: https://docs-demo.solana-mainnet.quiknode.pro/abcde1234567895// endpoint will be: docs-demo.solana-mainnet.quiknode.pro:10000 {10000 is the port number for gRPC}6// token will be : abcde12345678978const ENDPOINT = "YOUR_QN_ENDPOINT:10000";9const TOKEN = "YOUR_TOKEN_NUMBER";1011async 函数 main() {12const client = new Client(ENDPOINT, TOKEN, {});1314try {15const version = await client.getVersion();16console.log("Solana Version Information:");17console.log(`getVersion: ${version}`);18} catch (error) {19console.error("Error fetching version:", error);20}21}2223main()24.catch((err) => {25console.error("Unhandled error:", err);26process.exit(1);27});