BatchGetTransactions gRPC Method
매개변수
digests
배열
필수
로딩 중...
read_mask
객체
로딩 중...
paths
배열
로딩 중...
반품
거래
배열
로딩 중...
요약
문자열
로딩 중...
거래
객체
로딩 중...
bcs
객체
로딩 중...
이름
문자열
로딩 중...
값
문자열
로딩 중...
요약
문자열
로딩 중...
버전
정수
로딩 중...
종류
객체
로딩 중...
programmableTransaction
객체
로딩 중...
입력값
배열
로딩 중...
종류
문자열
로딩 중...
objectId
문자열
로딩 중...
변경 가능
부울
로딩 중...
pure
문자열
로딩 중...
버전
문자열
로딩 중...
요약
문자열
로딩 중...
commands
배열
로딩 중...
moveCall
객체
로딩 중...
패키지
문자열
로딩 중...
모듈
문자열
로딩 중...
함수
문자열
로딩 중...
typeArguments
배열
로딩 중...
arguments
배열
로딩 중...
종류
문자열
로딩 중...
입력
정수
로딩 중...
결과
정수
로딩 중...
발신자
문자열
로딩 중...
gasPayment
객체
로딩 중...
objects
배열
로딩 중...
objectId
문자열
로딩 중...
버전
문자열
로딩 중...
요약
문자열
로딩 중...
소유자
문자열
로딩 중...
가격
문자열
로딩 중...
예산
문자열
로딩 중...
expiration
객체
로딩 중...
종류
문자열
로딩 중...
효과
객체
로딩 중...
bcs
객체
로딩 중...
이름
문자열
로딩 중...
값
문자열
로딩 중...
요약
문자열
로딩 중...
버전
정수
로딩 중...
상태
객체
로딩 중...
success
부울
로딩 중...
epoch
문자열
로딩 중...
가스 사용량
객체
로딩 중...
계산 비용
문자열
로딩 중...
저장 비용
문자열
로딩 중...
저장 할인
문자열
로딩 중...
환불 불가 보관 수수료
문자열
로딩 중...
트랜잭션 다이제스트
문자열
로딩 중...
gasObject
객체
로딩 중...
objectId
문자열
로딩 중...
inputState
문자열
로딩 중...
inputVersion
문자열
로딩 중...
inputDigest
문자열
로딩 중...
inputOwner
객체
로딩 중...
종류
문자열
로딩 중...
주소
문자열
로딩 중...
outputState
문자열
로딩 중...
outputVersion
문자열
로딩 중...
outputDigest
문자열
로딩 중...
outputOwner
객체
로딩 중...
종류
문자열
로딩 중...
주소
문자열
로딩 중...
idOperation
문자열
로딩 중...
이벤트 요약
문자열
로딩 중...
dependencies
배열
로딩 중...
lamportVersion
문자열
로딩 중...
changedObjects
배열
로딩 중...
objectId
문자열
로딩 중...
inputState
문자열
로딩 중...
inputVersion
문자열
로딩 중...
inputDigest
문자열
로딩 중...
inputOwner
객체
로딩 중...
종류
문자열
로딩 중...
주소
문자열
로딩 중...
outputState
문자열
로딩 중...
outputVersion
문자열
로딩 중...
outputDigest
문자열
로딩 중...
outputOwner
객체
로딩 중...
종류
문자열
로딩 중...
주소
문자열
로딩 중...
idOperation
문자열
로딩 중...
객체 유형
문자열
로딩 중...
unchangedConsensusObjects
배열
로딩 중...
종류
문자열
로딩 중...
objectId
문자열
로딩 중...
버전
문자열
로딩 중...
요약
문자열
로딩 중...
행사
객체
로딩 중...
bcs
객체
로딩 중...
이름
문자열
로딩 중...
값
문자열
로딩 중...
요약
문자열
로딩 중...
행사
배열
로딩 중...
packageId
문자열
로딩 중...
모듈
문자열
로딩 중...
발신자
문자열
로딩 중...
eventType
문자열
로딩 중...
contents
객체
로딩 중...
이름
문자열
로딩 중...
값
문자열
로딩 중...
json
객체
로딩 중...
balanceManagerId
문자열
로딩 중...
baseAssetQuantityCanceled
문자열
로딩 중...
clientOrderId
문자열
로딩 중...
isBid
부울
로딩 중...
orderId
문자열
로딩 중...
originalQuantity
문자열
로딩 중...
poolId
문자열
로딩 중...
가격
문자열
로딩 중...
타임스탬프
문자열
로딩 중...
trader
문자열
로딩 중...
요청
1grpcurl \2-import-path . \3-proto sui/rpc/v2/ledger_service.proto \4-H "x-token: YOUR_TOKEN_VALUE" \5-d '{6"digests": [7"HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G"8],9"read_mask": {10"paths": [11"digest",12"transaction",13"effects",14"events"15]16}17}' \18docs-demo.sui-mainnet.quiknode.pro:9000 \19sui.rpc.v2.LedgerService/BatchGetTransactions
1grpcurl \2-import-path . \3-proto sui/rpc/v2/ledger_service.proto \4-H "x-token: YOUR_TOKEN_VALUE" \5-d '{6"digests": [7"HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G"8],9"read_mask": {10"paths": [11"digest",12"transaction",13"effects",14"events"15]16}17}' \18docs-demo.sui-mainnet.quiknode.pro:9000 \19sui.rpc.v2.LedgerService/BatchGetTransactions
1패키지 main23import (4"문맥"5"crypto/tls"6"encoding/json"7"fmt"8"로그"9"시간"1011"google.golang.org/grpc"12"google.golang.org/grpc/credentials"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-token30type auth struct {31token string32}3334func (a *auth) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {35return map[string]string{36"x-token": a.token,37}, nil38}3940func (a *auth) RequireTransportSecurity() bool {41return true42}4344func main() {45// TLS credentials and x-token auth46creds := 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}56defer conn.Close()5758client := pb.NewLedgerServiceClient(conn)5960// Digest array61digests := []string{62"HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G",63}6465// FieldMask to restrict returned fields66readMask := &fieldmaskpb.FieldMask{67Paths: []string{"digest", "transaction", "effects", "events"},68}6970req := &pb.BatchGetTransactionsRequest{71Digests: digests,72ReadMask: readMask,73}7475ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)76defer cancel()7778resp, err := client.BatchGetTransactions(ctx, req)79만약 err != nil {80log.Fatalf("BatchGetTransactions failed: %v", err)81}8283// Format response as pretty JSON84marshaler := protojson.MarshalOptions{85UseProtoNames: true,86EmitUnpopulated: true,87Indent: " ",88}8990jsonBytes, err := marshaler.Marshal(resp)91만약 err != nil {92log.Fatalf("Failed to marshal response: %v", err)93}9495var pretty map[string]interface{}96if err := json.Unmarshal(jsonBytes, &pretty); err != nil {97log.Fatalf("Failed to parse JSON: %v", err)98}99100formatted, _ := json.MarshalIndent(pretty, "", " ")101fmt.Println(string(formatted))102}103
1패키지 main23import (4"문맥"5"crypto/tls"6"encoding/json"7"fmt"8"로그"9"시간"1011"google.golang.org/grpc"12"google.golang.org/grpc/credentials"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-token30type auth struct {31token string32}3334func (a *auth) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {35return map[string]string{36"x-token": a.token,37}, nil38}3940func (a *auth) RequireTransportSecurity() bool {41return true42}4344func main() {45// TLS credentials and x-token auth46creds := 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}56defer conn.Close()5758client := pb.NewLedgerServiceClient(conn)5960// Digest array61digests := []string{62"HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G",63}6465// FieldMask to restrict returned fields66readMask := &fieldmaskpb.FieldMask{67Paths: []string{"digest", "transaction", "effects", "events"},68}6970req := &pb.BatchGetTransactionsRequest{71Digests: digests,72ReadMask: readMask,73}7475ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)76defer cancel()7778resp, err := client.BatchGetTransactions(ctx, req)79만약 err != nil {80log.Fatalf("BatchGetTransactions failed: %v", err)81}8283// Format response as pretty JSON84marshaler := protojson.MarshalOptions{85UseProtoNames: true,86EmitUnpopulated: true,87Indent: " ",88}8990jsonBytes, err := marshaler.Marshal(resp)91만약 err != nil {92log.Fatalf("Failed to marshal response: %v", err)93}9495var pretty map[string]interface{}96if err := json.Unmarshal(jsonBytes, &pretty); err != nil {97log.Fatalf("Failed to parse JSON: %v", err)98}99100formatted, _ := json.MarshalIndent(pretty, "", " ")101fmt.Println(string(formatted))102}103
1import * as grpc from '@grpc/grpc-js';2import * as protoLoader from '@grpc/proto-loader';3import * as path from 'path';45const PROTO_PATH = path.join(__dirname, 'protos/proto/sui/rpc/v2/ledger_service.proto');67// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token8// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde1234567899// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}10// token will be : abcde1234567891112const endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';13const token = 'abcde123456789';1415// Load proto definition16const 패키지 정의 = protoLoader.loadSync(PROTO_PATH, {17keepCase: true,18longs: String,19enums: String,20defaults: true,21oneofs: true,22includeDirs: [path.join(__dirname, 'protos/proto')],23});24const proto = grpc.loadPackageDefinition(packageDefinition) as any;25const LedgerService = proto.sui.rpc.v2.LedgerService;2627// Create gRPC client with TLS28const client = new LedgerService(endpoint, grpc.credentials.createSsl());2930// Metadata for authentication31const metadata = new grpc.Metadata();32metadata.add('x-token', token);3334// Request setup35const request = {36digests: ['HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G'], // Replace with valid digests37read_mask: {38paths: ['digest', 'transaction', 'effects', 'events'], // FieldMask39},40};4142// Invoke BatchGetTransactions43client.BatchGetTransactions(request, metadata, (err: grpc.ServiceError | null, response: any) => {44if (err) {45console.error('gRPC Error:', {46code: err.code,47message: err.message,48details: err.details,49});50} else {51console.log('BatchGetTransactions Response:');52console.log(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';45const PROTO_PATH = path.join(__dirname, 'protos/proto/sui/rpc/v2/ledger_service.proto');67// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token8// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde1234567899// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}10// token will be : abcde1234567891112const endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';13const token = 'abcde123456789';1415// Load proto definition16const 패키지 정의 = protoLoader.loadSync(PROTO_PATH, {17keepCase: true,18longs: String,19enums: String,20defaults: true,21oneofs: true,22includeDirs: [path.join(__dirname, 'protos/proto')],23});24const proto = grpc.loadPackageDefinition(packageDefinition) as any;25const LedgerService = proto.sui.rpc.v2.LedgerService;2627// Create gRPC client with TLS28const client = new LedgerService(endpoint, grpc.credentials.createSsl());2930// Metadata for authentication31const metadata = new grpc.Metadata();32metadata.add('x-token', token);3334// Request setup35const request = {36digests: ['HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G'], // Replace with valid digests37read_mask: {38paths: ['digest', 'transaction', 'effects', 'events'], // FieldMask39},40};4142// Invoke BatchGetTransactions43client.BatchGetTransactions(request, metadata, (err: grpc.ServiceError | null, response: any) => {44if (err) {45console.error('gRPC Error:', {46code: err.code,47message: err.message,48details: err.details,49});50} else {51console.log('BatchGetTransactions Response:');52console.log(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_batch_transactions():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)1920tx_digests = [21"HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G"22]2324read_mask = FieldMask(paths=[25"digest",26"transaction",27"effects",28"events"29])3031request = ledger_service_pb2.BatchGetTransactionsRequest(32digests=tx_digests,33read_mask=read_mask34)3536metadata = [("x-token", token)]3738return stub.BatchGetTransactions(request, metadata=metadata)394041def parse_response_to_json(response):42return json.dumps(43MessageToDict(response, preserving_proto_field_name=True),44indent=245)464748def main():49시도해 보세요:50response = get_batch_transactions()51print(parse_response_to_json(response))52except grpc.RpcError as e:53print(f"{e.code().name}: {e.details()}")545556if __name__ == "__main__":57main()58
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_batch_transactions():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)1920tx_digests = [21"HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G"22]2324read_mask = FieldMask(paths=[25"digest",26"transaction",27"effects",28"events"29])3031request = ledger_service_pb2.BatchGetTransactionsRequest(32digests=tx_digests,33read_mask=read_mask34)3536metadata = [("x-token", token)]3738return stub.BatchGetTransactions(request, metadata=metadata)394041def parse_response_to_json(response):42return json.dumps(43MessageToDict(response, preserving_proto_field_name=True),44indent=245)464748def main():49시도해 보세요:50response = get_batch_transactions()51print(parse_response_to_json(response))52except grpc.RpcError as e:53print(f"{e.code().name}: {e.details()}")545556if __name__ == "__main__":57main()58