GetTransaction gRPC Method
パラメータ
digest
文字列
必須
読み込み中...
read_mask
オブジェクト
読み込み中...
paths
array<string>
読み込み中...
返品
取引
オブジェクト
読み込み中...
digest
文字列
読み込み中...
取引
オブジェクト
読み込み中...
bcs
オブジェクト
読み込み中...
名前
文字列
読み込み中...
値
文字列
読み込み中...
digest
文字列
読み込み中...
バージョン
整数
読み込み中...
kind
オブジェクト
読み込み中...
programmableTransaction
オブジェクト
読み込み中...
入力
配列
読み込み中...
kind
文字列
読み込み中...
objectId
文字列
読み込み中...
バージョン
文字列
読み込み中...
可変
ブール値
読み込み中...
pure
文字列
読み込み中...
commands
配列
読み込み中...
moveCall
オブジェクト
読み込み中...
package
文字列
読み込み中...
module
文字列
読み込み中...
関数
文字列
読み込み中...
typeArguments
配列
読み込み中...
arguments
配列
読み込み中...
kind
文字列
読み込み中...
入力
整数
読み込み中...
結果
整数
読み込み中...
送信者
文字列
読み込み中...
gasPayment
オブジェクト
読み込み中...
objects
配列
読み込み中...
objectId
文字列
読み込み中...
バージョン
文字列
読み込み中...
digest
文字列
読み込み中...
所有者
文字列
読み込み中...
価格
文字列
読み込み中...
budget
文字列
読み込み中...
expiration
オブジェクト
読み込み中...
kind
文字列
読み込み中...
effects
オブジェクト
読み込み中...
bcs
オブジェクト
読み込み中...
名前
文字列
読み込み中...
値
文字列
読み込み中...
digest
文字列
読み込み中...
バージョン
整数
読み込み中...
ステータス
オブジェクト
読み込み中...
success
ブール値
読み込み中...
epoch
文字列
読み込み中...
gasUsed
オブジェクト
読み込み中...
computationCost
文字列
読み込み中...
storageCost
文字列
読み込み中...
storageRebate
文字列
読み込み中...
nonRefundableStorageFee
文字列
読み込み中...
transactionDigest
文字列
読み込み中...
gasObject
オブジェクト
読み込み中...
eventsDigest
文字列
読み込み中...
dependencies
配列
読み込み中...
digest
文字列
読み込み中...
lamportVersion
文字列
読み込み中...
changedObjects
配列
読み込み中...
unchangedConsensusObjects
配列
読み込み中...
unchangedSharedObjects
配列
読み込み中...
kind
文字列
読み込み中...
objectId
文字列
読み込み中...
バージョン
文字列
読み込み中...
digest
文字列
読み込み中...
イベント
オブジェクト
読み込み中...
bcs
オブジェクト
読み込み中...
名前
文字列
読み込み中...
値
文字列
読み込み中...
digest
文字列
読み込み中...
イベント
配列
読み込み中...
packageId
文字列
読み込み中...
module
文字列
読み込み中...
送信者
文字列
読み込み中...
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"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パッケージ main23import (4「文脈」5"crypto/tls"6"encoding/json"7"fmt"8「log」9"time"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 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}56defer conn.Close()5758client := pb.NewLedgerServiceClient(conn)5960txDigest := "HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G"6162fieldMask := &fieldmaskpb.FieldMask{63Paths: []string{"events", "effects"},64}6566req := &pb.GetTransactionRequest{67Digest: &txDigest,68ReadMask: fieldMask,69}7071ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)72defer cancel()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パッケージ main23import (4「文脈」5"crypto/tls"6"encoding/json"7"fmt"8「log」9"time"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 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}56defer conn.Close()5758client := pb.NewLedgerServiceClient(conn)5960txDigest := "HjuLoCGjS4wBC5KfqmExUa7GcF3yzaWRN1YoYpgxQC6G"6162fieldMask := &fieldmaskpb.FieldMask{63Paths: []string{"events", "effects"},64}6566req := &pb.GetTransactionRequest{67Digest: &txDigest,68ReadMask: fieldMask,69}7071ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)72defer cancel()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