GetTransaction gRPC Method
매개변수
digest
문자열
필수
로딩 중...
read_mask
객체
로딩 중...
paths
array<string>
로딩 중...
반품
거래
객체
로딩 중...
digest
문자열
로딩 중...
거래
객체
로딩 중...
bcs
객체
로딩 중...
이름
문자열
로딩 중...
값
문자열
로딩 중...
digest
문자열
로딩 중...
버전
정수
로딩 중...
kind
객체
로딩 중...
programmableTransaction
객체
로딩 중...
inputs
배열
로딩 중...
kind
문자열
로딩 중...
objectId
문자열
로딩 중...
버전
문자열
로딩 중...
mutable
부울
로딩 중...
순수한
문자열
로딩 중...
commands
배열
로딩 중...
moveCall
객체
로딩 중...
package
문자열
로딩 중...
module
문자열
로딩 중...
function
문자열
로딩 중...
typeArguments
배열
로딩 중...
arguments
배열
로딩 중...
kind
문자열
로딩 중...
입력
정수
로딩 중...
결과
정수
로딩 중...
sender
문자열
로딩 중...
gasPayment
객체
로딩 중...
objects
배열
로딩 중...
objectId
문자열
로딩 중...
버전
문자열
로딩 중...
digest
문자열
로딩 중...
소유자
문자열
로딩 중...
price
문자열
로딩 중...
budget
문자열
로딩 중...
만료
객체
로딩 중...
kind
문자열
로딩 중...
effects
객체
로딩 중...
bcs
객체
로딩 중...
이름
문자열
로딩 중...
값
문자열
로딩 중...
digest
문자열
로딩 중...
버전
정수
로딩 중...
상태
객체
로딩 중...
성공
부울
로딩 중...
epoch
문자열
로딩 중...
가스 사용량
객체
로딩 중...
computationCost
문자열
로딩 중...
storageCost
문자열
로딩 중...
storageRebate
문자열
로딩 중...
nonRefundableStorageFee
문자열
로딩 중...
transactionDigest
문자열
로딩 중...
gasObject
객체
로딩 중...
eventsDigest
문자열
로딩 중...
dependencies
배열
로딩 중...
digest
문자열
로딩 중...
lamportVersion
문자열
로딩 중...
changedObjects
배열
로딩 중...
unchangedConsensusObjects
배열
로딩 중...
unchangedSharedObjects
배열
로딩 중...
kind
문자열
로딩 중...
objectId
문자열
로딩 중...
버전
문자열
로딩 중...
digest
문자열
로딩 중...
행사
객체
로딩 중...
bcs
객체
로딩 중...
이름
문자열
로딩 중...
값
문자열
로딩 중...
digest
문자열
로딩 중...
행사
배열
로딩 중...
packageId
문자열
로딩 중...
module
문자열
로딩 중...
sender
문자열
로딩 중...
eventType
문자열
로딩 중...
contents
객체
로딩 중...
이름
문자열
로딩 중...
값
문자열
로딩 중...
json
객체
로딩 중...
balanceManagerId
문자열
로딩 중...
baseAssetQuantityCanceled
문자열
로딩 중...
clientOrderId
문자열
로딩 중...
isBid
부울
로딩 중...
orderId
문자열
로딩 중...
originalQuantity
문자열
로딩 중...
poolId
문자열
로딩 중...
price
문자열
로딩 중...
타임스탬프
문자열
로딩 중...
trader
문자열
로딩 중...
타임스탬프
문자열
로딩 중...
요청
1grpcurl \2-import-path . \3-proto sui/rpc/v2/ledger_service.proto \4-H "x-token: YOUR_TOKEN_VALUE" \5-d '{6"digest": "HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G",7"read_mask": {8"paths": [9"digest",10"transaction",11"effects",12"events"13]14}15}' \16docs-demo.sui-mainnet.quiknode.pro:9000 \17sui.rpc.v2.LedgerService/GetTransaction
1grpcurl \2-import-path . \3-proto sui/rpc/v2/ledger_service.proto \4-H "x-token: YOUR_TOKEN_VALUE" \5-d '{6"digest": "HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G",7"read_mask": {8"paths": [9"digest",10"transaction",11"effects",12"events"13]14}15}' \16docs-demo.sui-mainnet.quiknode.pro:9000 \17sui.rpc.v2.LedgerService/GetTransaction
1패키지 main23가져오기 (4"문맥"5"crypto/tls"6"encoding/json"7"fmt"8"로그"9"시간"1011"google.golang.grpc"12"google.golang.grpc"13"google.golang.org/protobuf/encoding/protojson"14"google.golang.org/protobuf/types/known/fieldmaskpb"1516pb "sui-grpc/sui/rpc/v2" // Your Generated .pb.go files path17)1819// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token20// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678921// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}22// token will be : abcde1234567892324var (25token = "YOUR_TOKEN_NUMBER"26endpoint = "YOUR_QN_ENDPOINT:9000"27)2829// Auth structure for x-token30유형 auth struct {31토큰 문자열32}3334func (a *auth) GetRequestMetadata(ctx 컨텍스트.Context, uri ...문자열) (map[문자열]문자열, error) {35돌아가기 맵[문자열]문자열{36"x-token": a.토큰,37}, nil38}3940func (a *auth) RequireTransportSecurity() bool {41return true42}4344func main() {45// TLS credentials46creds := credentials.NewTLS(&tls.Config{})47opts := []grpc.DialOption{48grpc.WithTransportCredentials(creds),49grpc.WithPerRPCCredentials(&auth{token}),50}5152conn, err := grpc.Dial(endpoint, opts...)53만약 err != nil {54log.Fatalf("Failed to connect: %v", err)55}56이연 conn.닫기()5758client := pb.NewLedgerServiceClient(conn)5960txDigest := "HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G"6162fieldMask := &fieldmaskpb.FieldMask{63Paths: []string{"events", "effects"},64}6566req := &pb.GetTransactionRequest{67Digest: &txDigest,68ReadMask: fieldMask,69}7071ctx, 취소 := context.WithTimeout(컨텍스트.Background(), 10*시간.두 번째)72연기 연기()7374resp, err := client.GetTransaction(ctx, req)75만약 err != nil {76log.Fatalf("GetTransaction failed: %v", err)77}7879marshaler := protojson.MarshalOptions{80UseProtoNames: true,81EmitUnpopulated: true,82Indent: " ",83}8485jsonBytes, err := marshaler.Marshal(resp)86만약 err != nil {87log.Fatalf("Failed to marshal response to JSON: %v", err)88}8990var prettyJSON map[string]interface{}91if err := json.Unmarshal(jsonBytes, &prettyJSON); err != nil {92log.Fatalf("Failed to unmarshal JSON: %v", err)93}9495prettyJSONBytes, err := json.MarshalIndent(prettyJSON, "", " ")96만약 err != nil {97log.Fatalf("Failed to format JSON: %v", err)98}99100fmt.Println(string(prettyJSONBytes))101}102
1패키지 main23가져오기 (4"문맥"5"crypto/tls"6"encoding/json"7"fmt"8"로그"9"시간"1011"google.golang.grpc"12"google.golang.grpc"13"google.golang.org/protobuf/encoding/protojson"14"google.golang.org/protobuf/types/known/fieldmaskpb"1516pb "sui-grpc/sui/rpc/v2" // Your Generated .pb.go files path17)1819// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token20// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678921// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}22// token will be : abcde1234567892324var (25token = "YOUR_TOKEN_NUMBER"26endpoint = "YOUR_QN_ENDPOINT:9000"27)2829// Auth structure for x-token30유형 auth struct {31토큰 문자열32}3334func (a *auth) GetRequestMetadata(ctx 컨텍스트.Context, uri ...문자열) (map[문자열]문자열, error) {35돌아가기 맵[문자열]문자열{36"x-token": a.토큰,37}, nil38}3940func (a *auth) RequireTransportSecurity() bool {41return true42}4344func main() {45// TLS credentials46creds := credentials.NewTLS(&tls.Config{})47opts := []grpc.DialOption{48grpc.WithTransportCredentials(creds),49grpc.WithPerRPCCredentials(&auth{token}),50}5152conn, err := grpc.Dial(endpoint, opts...)53만약 err != nil {54log.Fatalf("Failed to connect: %v", err)55}56이연 conn.닫기()5758client := pb.NewLedgerServiceClient(conn)5960txDigest := "HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G"6162fieldMask := &fieldmaskpb.FieldMask{63Paths: []string{"events", "effects"},64}6566req := &pb.GetTransactionRequest{67Digest: &txDigest,68ReadMask: fieldMask,69}7071ctx, 취소 := context.WithTimeout(컨텍스트.Background(), 10*시간.두 번째)72연기 연기()7374resp, err := client.GetTransaction(ctx, req)75만약 err != nil {76log.Fatalf("GetTransaction failed: %v", err)77}7879marshaler := protojson.MarshalOptions{80UseProtoNames: true,81EmitUnpopulated: true,82Indent: " ",83}8485jsonBytes, err := marshaler.Marshal(resp)86만약 err != nil {87log.Fatalf("Failed to marshal response to JSON: %v", err)88}8990var prettyJSON map[string]interface{}91if err := json.Unmarshal(jsonBytes, &prettyJSON); err != nil {92log.Fatalf("Failed to unmarshal JSON: %v", err)93}9495prettyJSONBytes, err := json.MarshalIndent(prettyJSON, "", " ")96만약 err != nil {97log.Fatalf("Failed to format JSON: %v", err)98}99100fmt.Println(string(prettyJSONBytes))101}102
1import * as grpc from '@grpc/grpc-js';2import * as protoLoader from '@grpc/proto-loader';3import * as path from 'path';45// Path to the proto file6const PROTO_PATH = path.join(__dirname, 'protos/proto/sui/rpc/v2/ledger_service.proto');78// Load the proto definition9const packageDefinition = protoLoader.loadSync(PROTO_PATH, {10keepCase: true,11longs: String,12enums: String,13defaults: true,14oneofs: true,15includeDirs: [path.join(__dirname, 'protos/proto')],16});1718const proto = grpc.loadPackageDefinition(packageDefinition) as any;19const LedgerService = proto.sui.rpc.v2.LedgerService;2021// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token22// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678923// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}24// token will be : abcde1234567892526const endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';27const token = 'abcde123456789';2829// Create client with TLS30const client = new LedgerService(endpoint, grpc.credentials.createSsl());3132// Prepare metadata33const metadata = new grpc.Metadata();34metadata.add('x-token', token);3536// Replace this with your actual transaction digest37const txDigest = 'HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G';3839// Prepare request40const request = {41digest: txDigest,42read_mask: {43paths: ['digest', 'transaction', 'effects', 'events', 'timestamp'],44},45};4647// Make the call48client.GetTransaction(request, metadata, (err: any, response: any) => {49if (err) {50console.error('Error:', err);51} else {52console.log('Response:', JSON.stringify(response, null, 2));53}54});55
1import * as grpc from '@grpc/grpc-js';2import * as protoLoader from '@grpc/proto-loader';3import * as path from 'path';45// Path to the proto file6const PROTO_PATH = path.join(__dirname, 'protos/proto/sui/rpc/v2/ledger_service.proto');78// Load the proto definition9const packageDefinition = protoLoader.loadSync(PROTO_PATH, {10keepCase: true,11longs: String,12enums: String,13defaults: true,14oneofs: true,15includeDirs: [path.join(__dirname, 'protos/proto')],16});1718const proto = grpc.loadPackageDefinition(packageDefinition) as any;19const LedgerService = proto.sui.rpc.v2.LedgerService;2021// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token22// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678923// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}24// token will be : abcde1234567892526const endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';27const token = 'abcde123456789';2829// Create client with TLS30const client = new LedgerService(endpoint, grpc.credentials.createSsl());3132// Prepare metadata33const metadata = new grpc.Metadata();34metadata.add('x-token', token);3536// Replace this with your actual transaction digest37const txDigest = 'HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G';3839// Prepare request40const request = {41digest: txDigest,42read_mask: {43paths: ['digest', 'transaction', 'effects', 'events', 'timestamp'],44},45};4647// Make the call48client.GetTransaction(request, metadata, (err: any, response: any) => {49if (err) {50console.error('Error:', err);51} else {52console.log('Response:', JSON.stringify(response, null, 2));53}54});55
1import grpc2import json3from google.protobuf.field_mask_pb2 import FieldMask4from google.protobuf.json_format import MessageToDict5from sui.rpc.v2 import ledger_service_pb2, ledger_service_pb2_grpc678def get_transaction():9# Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token10# For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678911# endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}12# token will be: abcde1234567891314endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';15token = 'abcde123456789';1617channel = grpc.secure_channel(endpoint, grpc.ssl_channel_credentials())18stub = ledger_service_pb2_grpc.LedgerServiceStub(channel)1920# Specify the transaction digest you want to retrieve21# Replace with an actual Sui transaction digest22tx_digest = "HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G"2324# Create a field mask to specify which fields to include in the response25read_mask = FieldMask(paths=[26"digest",27"transaction",28"effects",29"events",30"timestamp"31])3233# Prepare the GetTransactionRequest34request = ledger_service_pb2.GetTransactionRequest(35digest=tx_digest,36read_mask=read_mask37)3839metadata = [("x-token", token)]4041return stub.GetTransaction(request, metadata=metadata)424344def parse_response_to_json(response):45return json.dumps(46MessageToDict(response, preserving_proto_field_name=True),47indent=248)495051def main():52try:53response = get_transaction()54print(parse_response_to_json(response))55except grpc.RpcError as e:56print(f"{e.code().name}: {e.details()}")575859if __name__ == "__main__":60main()61
1import grpc2import json3from google.protobuf.field_mask_pb2 import FieldMask4from google.protobuf.json_format import MessageToDict5from sui.rpc.v2 import ledger_service_pb2, ledger_service_pb2_grpc678def get_transaction():9# Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token10# For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678911# endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}12# token will be: abcde1234567891314endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';15token = 'abcde123456789';1617channel = grpc.secure_channel(endpoint, grpc.ssl_channel_credentials())18stub = ledger_service_pb2_grpc.LedgerServiceStub(channel)1920# Specify the transaction digest you want to retrieve21# Replace with an actual Sui transaction digest22tx_digest = "HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G"2324# Create a field mask to specify which fields to include in the response25read_mask = FieldMask(paths=[26"digest",27"transaction",28"effects",29"events",30"timestamp"31])3233# Prepare the GetTransactionRequest34request = ledger_service_pb2.GetTransactionRequest(35digest=tx_digest,36read_mask=read_mask37)3839metadata = [("x-token", token)]4041return stub.GetTransaction(request, metadata=metadata)424344def parse_response_to_json(response):45return json.dumps(46MessageToDict(response, preserving_proto_field_name=True),47indent=248)495051def main():52try:53response = get_transaction()54print(parse_response_to_json(response))55except grpc.RpcError as e:56print(f"{e.code().name}: {e.details()}")575859if __name__ == "__main__":60main()61