getVersion gRPC Method - Solana gRPC
Solana gRPC is included with Scale plans and up. Learn more on our pricing page.
매개변수
이 메서드는 매개변수를 받지 않습니다.
반품
버전
객체
로딩 중...
package
문자열
로딩 중...
버전
문자열
로딩 중...
proto
문자열
로딩 중...
solana
문자열
로딩 중...
git
문자열
로딩 중...
rustc
문자열
로딩 중...
buildts
문자열
로딩 중...
extra
객체
로딩 중...
hostname
문자열
로딩 중...
요청
1패키지 main23가져오기 (4"문맥"5"crypto/tls"6"fmt"7"로그"8"시간"910pb "yellowstone/proto"111213"google.golang.grpc"14"google.golang.grpc"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:443 {443 is the port number for gRPC}22// token will be : abcde1234567892324var (25endpoint = "YOUR_QN_ENDPOINT:443"26token = "YOUR_TOKEN_NUMBER"27)2829var kacp = keepalive.ClientParameters{30Time: 10 * time.Second,31Timeout: time.Second,32PermitWithoutStream: true,33}3435type tokenAuth struct {36토큰 문자열37}3839func (t tokenAuth) GetRequestMetadata(ctx context.Context, in ...string) (map[string]string, error) {40돌아가기 맵[문자열]문자열{41"x-token": t.token,42}, nil43}4445func (tokenAuth) RequireTransportSecurity() bool {46return true47}4849func main() {50opts := []grpc.DialOption{51grpc.WithTransportCredentialsWithTransportCredentials (인증 정보.NewTLS(&tls.Config{})),52grpc.WithKeepaliveParams(kacp),53grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1024*1024*1024), grpc.UseCompressor(gzip.Name)),54grpc.WithPerRPCCredentials(tokenAuth{token: token}),55}5657conn, err := grpc.NewClient(endpoint, opts...)58만약 err != nil {59log.Fatalf("Failed to connect: %v", err)60}61이연 conn.닫기()6263client := pb.NewGeyserClient(conn)6465ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)66defer cancel()6768version, err := client.GetVersion(ctx, &pb.GetVersionRequest{})69만약 err != nil {70log.Fatalf("Failed to get version: %v", err)71}7273fmt.Printf("Yellowstone gRPC Version:\n")74fmt.Printf(" GeyserGrpc: %s\n", version.GetVersion())7576}77
1패키지 main23가져오기 (4"문맥"5"crypto/tls"6"fmt"7"로그"8"시간"910pb "yellowstone/proto"111213"google.golang.grpc"14"google.golang.grpc"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:443 {443 is the port number for gRPC}22// token will be : abcde1234567892324var (25endpoint = "YOUR_QN_ENDPOINT:443"26token = "YOUR_TOKEN_NUMBER"27)2829var kacp = keepalive.ClientParameters{30Time: 10 * time.Second,31Timeout: time.Second,32PermitWithoutStream: true,33}3435type tokenAuth struct {36토큰 문자열37}3839func (t tokenAuth) GetRequestMetadata(ctx context.Context, in ...string) (map[string]string, error) {40돌아가기 맵[문자열]문자열{41"x-token": t.token,42}, nil43}4445func (tokenAuth) RequireTransportSecurity() bool {46return true47}4849func main() {50opts := []grpc.DialOption{51grpc.WithTransportCredentialsWithTransportCredentials (인증 정보.NewTLS(&tls.Config{})),52grpc.WithKeepaliveParams(kacp),53grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1024*1024*1024), grpc.UseCompressor(gzip.Name)),54grpc.WithPerRPCCredentials(tokenAuth{token: token}),55}5657conn, err := grpc.NewClient(endpoint, opts...)58만약 err != nil {59log.Fatalf("Failed to connect: %v", err)60}61이연 conn.닫기()6263client := pb.NewGeyserClient(conn)6465ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)66defer cancel()6768version, err := client.GetVersion(ctx, &pb.GetVersionRequest{})69만약 err != nil {70log.Fatalf("Failed to get version: %v", err)71}7273fmt.Printf("Yellowstone gRPC Version:\n")74fmt.Printf(" GeyserGrpc: %s\n", version.GetVersion())7576}77
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: https://docs-demo.solana-mainnet.quiknode.pro:443 {443 is the port number for gRPC}6// token will be : abcde12345678978const ENDPOINT = "https://YOUR_QN_ENDPOINT:443";9const TOKEN = "YOUR_TOKEN_NUMBER";1011async 함수 main() {12const client = new Client(ENDPOINT, TOKEN, {13grpcDefaultCompressionAlgorithm: 0, // 0 = gzip, 1 = zstd14});15await client.connect();1617try {18const version = await client.getVersion();19console.log("Solana Version Information:");20console.log(`getVersion: ${version.version}`);21} catch (error) {22console.error("Error fetching version:", error);23}24}2526main()27.catch((err) => {28console.error("Unhandled error:", err);29process.exit(1);30});31
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: https://docs-demo.solana-mainnet.quiknode.pro:443 {443 is the port number for gRPC}6// token will be : abcde12345678978const ENDPOINT = "https://YOUR_QN_ENDPOINT:443";9const TOKEN = "YOUR_TOKEN_NUMBER";1011async 함수 main() {12const client = new Client(ENDPOINT, TOKEN, {13grpcDefaultCompressionAlgorithm: 0, // 0 = gzip, 1 = zstd14});15await client.connect();1617try {18const version = await client.getVersion();19console.log("Solana Version Information:");20console.log(`getVersion: ${version.version}`);21} catch (error) {22console.error("Error fetching version:", error);23}24}2526main()27.catch((err) => {28console.error("Unhandled error:", err);29process.exit(1);30});31