TxStatus gRPC Method
매개변수
tx_id
문자열
필수
로딩 중...
반품
높이
정수
로딩 중...
목차
정수
로딩 중...
execution_code
정수
로딩 중...
오류
문자열
로딩 중...
상태
문자열
로딩 중...
요청
1패키지 main23가져오기 (4"문맥"5"crypto/tls"6"encoding/json"7"fmt"8"로그"9"시간"1011"google.golang.grpc"12"google.golang.grpc"1314txtypes "celestia-grpc/celestia/core/v1/tx"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 토큰 token = "YOUR_TOKEN"23var endpoint = "YOUR_ENDPOINT:9090"2425유형 auth struct {26토큰 문자열27}2829func (a *auth) GetRequestMetadata(ctx 컨텍스트.Context, uri ...문자열) (map[문자열]문자열, error) {30돌아가기 맵[문자열]문자열{31"x-token": a.토큰,32}, nil33}3435func (a *auth) RequireTransportSecurity() bool {36return false37}3839func main() {40opts := []grpc.DialOption{41grpc.WithTransportCredentialsWithTransportCredentials (인증 정보.NewTLS(&tls.Config{})),42grpc.WithPerRPCCredentials(&auth{token}),43}4445// Create gRPC connection46conn, err := grpc.Dial(endpoint, opts...)47만약 err != nil {48로그.Fatalf(" Celestia gRPC 연결하지 못했습니다: %v", err)49}50이연 conn.닫기()5152client := txtypes.NewTxClient(conn)5354ctx, 취소 := context.WithTimeout(컨텍스트.Background(), 10*시간.두 번째)55연기 연기()5657// Example transaction hash (64 characters hex string)58// Replace with an actual transaction hash59txHash := "3ae0d131ce0e50de8fedf4041ae2ca4bc7be0d208cd7e39baad526ac3794fe09"6061resp, err := client.TxStatus(ctx, &txtypes.TxStatusRequest{62TxId: txHash,63})64만약 err != nil {65log.Fatalf("Failed to query transaction status: %v", err)66}6768jsonData, err := json.MarshalIndent(resp, "", " ")69만약 err != nil {70log.Printf("Error converting to JSON: %v", err)71} else {72fmt.Println("\nOutput:")73fmt.PrintlnPrintlnstring(jsonData))74}75}
1패키지 main23가져오기 (4"문맥"5"crypto/tls"6"encoding/json"7"fmt"8"로그"9"시간"1011"google.golang.grpc"12"google.golang.grpc"1314txtypes "celestia-grpc/celestia/core/v1/tx"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 토큰 token = "YOUR_TOKEN"23var endpoint = "YOUR_ENDPOINT:9090"2425유형 auth struct {26토큰 문자열27}2829func (a *auth) GetRequestMetadata(ctx 컨텍스트.Context, uri ...문자열) (map[문자열]문자열, error) {30돌아가기 맵[문자열]문자열{31"x-token": a.토큰,32}, nil33}3435func (a *auth) RequireTransportSecurity() bool {36return false37}3839func main() {40opts := []grpc.DialOption{41grpc.WithTransportCredentialsWithTransportCredentials (인증 정보.NewTLS(&tls.Config{})),42grpc.WithPerRPCCredentials(&auth{token}),43}4445// Create gRPC connection46conn, err := grpc.Dial(endpoint, opts...)47만약 err != nil {48로그.Fatalf(" Celestia gRPC 연결하지 못했습니다: %v", err)49}50이연 conn.닫기()5152client := txtypes.NewTxClient(conn)5354ctx, 취소 := context.WithTimeout(컨텍스트.Background(), 10*시간.두 번째)55연기 연기()5657// Example transaction hash (64 characters hex string)58// Replace with an actual transaction hash59txHash := "3ae0d131ce0e50de8fedf4041ae2ca4bc7be0d208cd7e39baad526ac3794fe09"6061resp, err := client.TxStatus(ctx, &txtypes.TxStatusRequest{62TxId: txHash,63})64만약 err != nil {65log.Fatalf("Failed to query transaction status: %v", err)66}6768jsonData, err := json.MarshalIndent(resp, "", " ")69만약 err != nil {70log.Printf("Error converting to JSON: %v", err)71} else {72fmt.Println("\nOutput:")73fmt.PrintlnPrintlnstring(jsonData))74}75}