From 23f4caf10c981908194ac5f27dd80d009db2f215 Mon Sep 17 00:00:00 2001 From: Eduard Voiculescu Date: Thu, 23 Jan 2025 10:07:08 -0500 Subject: [PATCH] adding v1_old block proto to fix transaction status and transaction hash and update tools documentation --- cmd/firestellar/main.go | 1 + cmd/firestellar/tool_create_account.go | 2 +- cmd/firestellar/tool_decode_block.go | 17 +- cmd/firestellar/tool_decode_seed.go | 2 +- cmd/firestellar/tool_fix_blocks.go | 192 ++ cmd/firestellar/tool_issue_asset.go | 2 +- cmd/firestellar/tool_send_payment.go | 2 +- cmd/firestellar/tool_send_payment_asset.go | 2 +- pb/sf/stellar/type/v1_old/block.pb.go | 386 ++++ pb/sf/stellar/type/v1_old/block_vtproto.pb.go | 2042 +++++++++++++++++ proto/sf/stellar/type/v1_old/block.proto | 32 + rpc/fetcher.go | 8 +- 12 files changed, 2668 insertions(+), 20 deletions(-) create mode 100644 cmd/firestellar/tool_fix_blocks.go create mode 100644 pb/sf/stellar/type/v1_old/block.pb.go create mode 100644 pb/sf/stellar/type/v1_old/block_vtproto.pb.go create mode 100644 proto/sf/stellar/type/v1_old/block.proto diff --git a/cmd/firestellar/main.go b/cmd/firestellar/main.go index 6a12cbf..1070d4c 100644 --- a/cmd/firestellar/main.go +++ b/cmd/firestellar/main.go @@ -27,6 +27,7 @@ func init() { rootCmd.AddCommand(NewToolIssueAssetCmd()) rootCmd.AddCommand(NewToolSendPaymentAssetCmd()) rootCmd.AddCommand(NewToolDecodeSeedCmd()) + rootCmd.AddCommand(NewToolFixBlocksCmd()) } func main() { diff --git a/cmd/firestellar/tool_create_account.go b/cmd/firestellar/tool_create_account.go index 82b3293..2c45390 100644 --- a/cmd/firestellar/tool_create_account.go +++ b/cmd/firestellar/tool_create_account.go @@ -13,7 +13,7 @@ import ( func NewToolCreateAccountCmd() *cobra.Command { cmd := &cobra.Command{ Use: "tool-create-account", - Short: "Firehose Stellar tool to an create account", + Short: "Tool to create account", Args: cobra.ExactArgs(0), RunE: toolCreateAccountRunE, } diff --git a/cmd/firestellar/tool_decode_block.go b/cmd/firestellar/tool_decode_block.go index d5bde62..e3933b9 100644 --- a/cmd/firestellar/tool_decode_block.go +++ b/cmd/firestellar/tool_decode_block.go @@ -1,7 +1,6 @@ package main import ( - "encoding/base64" "encoding/hex" "errors" "fmt" @@ -25,7 +24,7 @@ import ( func NewToolDecodeBlockCmd() *cobra.Command { cmd := &cobra.Command{ Use: "tool-decode-block ", - Short: "Firehose Stellar tool to decode a firehose block", + Short: "Tool to decode a firehose block", Args: cobra.ExactArgs(2), RunE: runDecodeBlockE, } @@ -148,14 +147,14 @@ func marshalTransaction(e *jsontext.Encoder, value *pbstellar.Transaction, optio ResultXdr *xdrTypes.TransactionResult } - // FIXME: once the transaction hash is fixed, we can remove this - fixHash := base64.StdEncoding.EncodeToString(value.Hash) - fixHashB, err := hex.DecodeString(fixHash) - if err != nil { - return fmt.Errorf("unable to decode hash: %w", err) - } + // // FIXME: once the transaction hash is fixed, we can remove this + // fixHash := base64.StdEncoding.EncodeToString(value.Hash) + // fixHashB, err := hex.DecodeString(fixHash) + // if err != nil { + // return fmt.Errorf("unable to decode hash: %w", err) + // } trx := &DecodedTransaction{ - Hash: fixHashB, + Hash: value.Hash, Status: value.Status, CreatedAt: value.CreatedAt, ApplicationOrder: value.ApplicationOrder, diff --git a/cmd/firestellar/tool_decode_seed.go b/cmd/firestellar/tool_decode_seed.go index 93fc0dd..ec1e4d4 100644 --- a/cmd/firestellar/tool_decode_seed.go +++ b/cmd/firestellar/tool_decode_seed.go @@ -10,7 +10,7 @@ import ( func NewToolDecodeSeedCmd() *cobra.Command { cmd := &cobra.Command{ Use: "tool-decode-seed ", - Short: "Firehose Stellar tool to decode seed", + Short: "Tool to decode seed", Args: cobra.ExactArgs(1), RunE: toolDecodeSeedRunE, } diff --git a/cmd/firestellar/tool_fix_blocks.go b/cmd/firestellar/tool_fix_blocks.go new file mode 100644 index 0000000..f2f0700 --- /dev/null +++ b/cmd/firestellar/tool_fix_blocks.go @@ -0,0 +1,192 @@ +package main + +import ( + "encoding/base64" + "encoding/hex" + "errors" + "fmt" + "io" + "os" + "strconv" + + "github.com/spf13/cobra" + "github.com/streamingfast/bstream" + "github.com/streamingfast/dstore" + firecore "github.com/streamingfast/firehose-core" + pbstellarv1 "github.com/streamingfast/firehose-stellar/pb/sf/stellar/type/v1" + pbstellarv1_old "github.com/streamingfast/firehose-stellar/pb/sf/stellar/type/v1_old" + "github.com/streamingfast/firehose-stellar/utils" + + "go.uber.org/zap" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/anypb" +) + +func NewToolFixBlocksCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "tool-fix-blocks ", + Short: "Tool to fix blocks", + Args: cobra.ExactArgs(4), + RunE: toolFixBlockRunE, + } + return cmd +} + +func toolFixBlockRunE(cmd *cobra.Command, args []string) error { + ctx := cmd.Context() + firstStreamableBlock, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return fmt.Errorf("converting first streamable block to uint64: %w", err) + } + + stopBlock, err := strconv.ParseUint(args[1], 10, 64) + if err != nil { + return fmt.Errorf("converting stop block to uint64: %w", err) + } + + srcStore, err := dstore.NewDBinStore(args[2]) + if err != nil { + return fmt.Errorf("unable to create source store: %w", err) + } + + destStore, err := dstore.NewDBinStore(args[3]) + if err != nil { + return fmt.Errorf("unable to create destination store: %w", err) + } + + logger.Debug( + "starting fix unknown type blocks", + zap.String("source_blocks_store", srcStore.BaseURL().String()), + zap.String("destination_blocks_store", destStore.BaseURL().String()), + zap.Uint64("first_streamable_block", firstStreamableBlock), + zap.Uint64("stop_block", stopBlock), + ) + + mergeWriter := &firecore.MergedBlocksWriter{ + Store: destStore, + LowBlockNum: firstStreamableBlock, + StopBlockNum: stopBlock, + Logger: logger, + Cmd: cmd, + } + var lastFilename string + var blockCount = 0 + err = srcStore.WalkFrom(ctx, "", fmt.Sprintf("%010d", firstStreamableBlock), func(filename string) error { + var fileReader io.Reader + fileReader, err = srcStore.OpenObject(ctx, filename) + if err != nil { + return fmt.Errorf("creating reader: %w", err) + } + + var blockReader *bstream.DBinBlockReader + blockReader, err = bstream.NewDBinBlockReader(fileReader) + if err != nil { + return fmt.Errorf("creating block reader: %w", err) + } + + // the source store is a merged file store + for { + currentBlock, err := blockReader.Read() + if err != nil { + if err == io.EOF { + fmt.Fprintf(os.Stderr, "Total blocks: %d\n", blockCount) + break + } + return fmt.Errorf("error receiving blocks: %w", err) + } + + blockCount++ + + stellarBlock := &pbstellarv1_old.Block{} + err = proto.Unmarshal(currentBlock.Payload.Value, stellarBlock) + if err != nil { + return fmt.Errorf("unmarshaling block: %w", err) + } + + convertedTransactions, err := convertOldTransactions(stellarBlock.Transactions) + if err != nil { + return fmt.Errorf("converting old transactions: %w", err) + } + + fixedStellarBlock := &pbstellarv1.Block{ + Number: stellarBlock.Number, + Hash: stellarBlock.Hash, + Header: convertOldHeader(stellarBlock.Header), + Transactions: convertedTransactions, + CreatedAt: stellarBlock.CreatedAt, + } + + payload, err := anypb.New(fixedStellarBlock) + if err != nil { + return fmt.Errorf("creating payload: %w", err) + } + + currentBlock.Payload = payload + if err = mergeWriter.ProcessBlock(currentBlock, nil); err != nil { + return fmt.Errorf("processing block: %w", err) + } + } + + lastFilename = filename + return nil + }) + + mergeWriter.Logger = mergeWriter.Logger.With(zap.String("last_filename", lastFilename), zap.Int("block_count", blockCount)) + if err != nil { + if errors.Is(err, dstore.StopIteration) { + err = mergeWriter.WriteBundle() + if err != nil { + return fmt.Errorf("writing bundle: %w", err) + } + fmt.Println("done") + return nil + } + if errors.Is(err, io.EOF) { + fmt.Println("done") + return nil + } + return fmt.Errorf("walking source store: %w", err) + } + + fmt.Println("Done fixing blocks") + return nil +} + +func convertOldHeader(oldHeader *pbstellarv1_old.Header) *pbstellarv1.Header { + return &pbstellarv1.Header{ + LedgerVersion: oldHeader.LedgerVersion, + PreviousLedgerHash: oldHeader.PreviousLedgerHash, + TotalCoins: oldHeader.TotalCoins, + BaseFee: oldHeader.BaseFee, + BaseReserve: oldHeader.BaseReserve, + } +} + +func convertOldTransactions(oldTransactions []*pbstellarv1_old.Transaction) ([]*pbstellarv1.Transaction, error) { + var transactions []*pbstellarv1.Transaction + for _, oldTransaction := range oldTransactions { + convertedTransaction, err := convertOldTransaction(oldTransaction) + if err != nil { + return nil, fmt.Errorf("converting transaction: %w", err) + } + transactions = append(transactions, convertedTransaction) + } + return transactions, nil +} + +func convertOldTransaction(oldTransaction *pbstellarv1_old.Transaction) (*pbstellarv1.Transaction, error) { + fixHash := base64.StdEncoding.EncodeToString(oldTransaction.Hash) + txHashbytes, err := hex.DecodeString(fixHash) + if err != nil { + return nil, fmt.Errorf("decoding transaction hash: %w", err) + } + return &pbstellarv1.Transaction{ + Hash: txHashbytes, + Status: utils.ConvertTransactionStatus(oldTransaction.Status), + CreatedAt: oldTransaction.CreatedAt, + ApplicationOrder: oldTransaction.ApplicationOrder, + EnvelopeXdr: oldTransaction.EnvelopeXdr, + ResultMetaXdr: oldTransaction.ResultMetaXdr, + ResultXdr: oldTransaction.ResultXdr, + }, nil +} diff --git a/cmd/firestellar/tool_issue_asset.go b/cmd/firestellar/tool_issue_asset.go index 3bb9326..9a1b147 100644 --- a/cmd/firestellar/tool_issue_asset.go +++ b/cmd/firestellar/tool_issue_asset.go @@ -14,7 +14,7 @@ import ( func NewToolIssueAssetCmd() *cobra.Command { cmd := &cobra.Command{ Use: "tool-issue-asset ", - Short: "Firehose Stellar tool to issue asset", + Short: "Tool to issue asset", Args: cobra.ExactArgs(3), RunE: toolIssueAssetRunE, } diff --git a/cmd/firestellar/tool_send_payment.go b/cmd/firestellar/tool_send_payment.go index 11f228e..f441464 100644 --- a/cmd/firestellar/tool_send_payment.go +++ b/cmd/firestellar/tool_send_payment.go @@ -16,7 +16,7 @@ import ( func NewToolSendPaymentCmd() *cobra.Command { cmd := &cobra.Command{ Use: "tool-send-payment ", - Short: "Firehose Stellar tool to send payment", + Short: "Tool to send payment", Args: cobra.ExactArgs(3), RunE: toolSendPaymentRunE, Example: cli.Dedent(` diff --git a/cmd/firestellar/tool_send_payment_asset.go b/cmd/firestellar/tool_send_payment_asset.go index 4802645..74b9286 100644 --- a/cmd/firestellar/tool_send_payment_asset.go +++ b/cmd/firestellar/tool_send_payment_asset.go @@ -16,7 +16,7 @@ import ( func NewToolSendPaymentAssetCmd() *cobra.Command { cmd := &cobra.Command{ Use: "tool-send-payment-asset ", - Short: "Firehose Stellar tool to send payment", + Short: "Tool to send payment", Args: cobra.ExactArgs(4), RunE: toolSendPaymentAssetRunE, Example: cli.Dedent(` diff --git a/pb/sf/stellar/type/v1_old/block.pb.go b/pb/sf/stellar/type/v1_old/block.pb.go new file mode 100644 index 0000000..07b89ff --- /dev/null +++ b/pb/sf/stellar/type/v1_old/block.pb.go @@ -0,0 +1,386 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc (unknown) +// source: sf/stellar/type/v1_old/block.proto + +package pbstellar + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Block struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number uint64 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` + Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` + Header *Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` + Transactions []*Transaction `protobuf:"bytes,6,rep,name=transactions,proto3" json:"transactions,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` +} + +func (x *Block) Reset() { + *x = Block{} + mi := &file_sf_stellar_type_v1_old_block_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Block) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Block) ProtoMessage() {} + +func (x *Block) ProtoReflect() protoreflect.Message { + mi := &file_sf_stellar_type_v1_old_block_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Block.ProtoReflect.Descriptor instead. +func (*Block) Descriptor() ([]byte, []int) { + return file_sf_stellar_type_v1_old_block_proto_rawDescGZIP(), []int{0} +} + +func (x *Block) GetNumber() uint64 { + if x != nil { + return x.Number + } + return 0 +} + +func (x *Block) GetHash() []byte { + if x != nil { + return x.Hash + } + return nil +} + +func (x *Block) GetHeader() *Header { + if x != nil { + return x.Header + } + return nil +} + +func (x *Block) GetTransactions() []*Transaction { + if x != nil { + return x.Transactions + } + return nil +} + +func (x *Block) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +type Header struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LedgerVersion uint32 `protobuf:"varint,1,opt,name=ledger_version,json=ledgerVersion,proto3" json:"ledger_version,omitempty"` + PreviousLedgerHash []byte `protobuf:"bytes,2,opt,name=previous_ledger_hash,json=previousLedgerHash,proto3" json:"previous_ledger_hash,omitempty"` + TotalCoins int64 `protobuf:"varint,3,opt,name=total_coins,json=totalCoins,proto3" json:"total_coins,omitempty"` // The amount of stroops in existence at the end of the ledger + BaseFee uint32 `protobuf:"varint,4,opt,name=base_fee,json=baseFee,proto3" json:"base_fee,omitempty"` + BaseReserve uint32 `protobuf:"varint,5,opt,name=base_reserve,json=baseReserve,proto3" json:"base_reserve,omitempty"` +} + +func (x *Header) Reset() { + *x = Header{} + mi := &file_sf_stellar_type_v1_old_block_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Header) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Header) ProtoMessage() {} + +func (x *Header) ProtoReflect() protoreflect.Message { + mi := &file_sf_stellar_type_v1_old_block_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Header.ProtoReflect.Descriptor instead. +func (*Header) Descriptor() ([]byte, []int) { + return file_sf_stellar_type_v1_old_block_proto_rawDescGZIP(), []int{1} +} + +func (x *Header) GetLedgerVersion() uint32 { + if x != nil { + return x.LedgerVersion + } + return 0 +} + +func (x *Header) GetPreviousLedgerHash() []byte { + if x != nil { + return x.PreviousLedgerHash + } + return nil +} + +func (x *Header) GetTotalCoins() int64 { + if x != nil { + return x.TotalCoins + } + return 0 +} + +func (x *Header) GetBaseFee() uint32 { + if x != nil { + return x.BaseFee + } + return 0 +} + +func (x *Header) GetBaseReserve() uint32 { + if x != nil { + return x.BaseReserve + } + return 0 +} + +type Transaction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + ApplicationOrder uint64 `protobuf:"varint,5,opt,name=application_order,json=applicationOrder,proto3" json:"application_order,omitempty"` + EnvelopeXdr []byte `protobuf:"bytes,6,opt,name=envelope_xdr,json=envelopeXdr,proto3" json:"envelope_xdr,omitempty"` + ResultMetaXdr []byte `protobuf:"bytes,7,opt,name=result_meta_xdr,json=resultMetaXdr,proto3" json:"result_meta_xdr,omitempty"` + ResultXdr []byte `protobuf:"bytes,8,opt,name=result_xdr,json=resultXdr,proto3" json:"result_xdr,omitempty"` +} + +func (x *Transaction) Reset() { + *x = Transaction{} + mi := &file_sf_stellar_type_v1_old_block_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Transaction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Transaction) ProtoMessage() {} + +func (x *Transaction) ProtoReflect() protoreflect.Message { + mi := &file_sf_stellar_type_v1_old_block_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Transaction.ProtoReflect.Descriptor instead. +func (*Transaction) Descriptor() ([]byte, []int) { + return file_sf_stellar_type_v1_old_block_proto_rawDescGZIP(), []int{2} +} + +func (x *Transaction) GetHash() []byte { + if x != nil { + return x.Hash + } + return nil +} + +func (x *Transaction) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *Transaction) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *Transaction) GetApplicationOrder() uint64 { + if x != nil { + return x.ApplicationOrder + } + return 0 +} + +func (x *Transaction) GetEnvelopeXdr() []byte { + if x != nil { + return x.EnvelopeXdr + } + return nil +} + +func (x *Transaction) GetResultMetaXdr() []byte { + if x != nil { + return x.ResultMetaXdr + } + return nil +} + +func (x *Transaction) GetResultXdr() []byte { + if x != nil { + return x.ResultXdr + } + return nil +} + +var File_sf_stellar_type_v1_old_block_proto protoreflect.FileDescriptor + +var file_sf_stellar_type_v1_old_block_proto_rawDesc = []byte{ + 0x0a, 0x22, 0x73, 0x66, 0x2f, 0x73, 0x74, 0x65, 0x6c, 0x6c, 0x61, 0x72, 0x2f, 0x74, 0x79, 0x70, + 0x65, 0x2f, 0x76, 0x31, 0x5f, 0x6f, 0x6c, 0x64, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x73, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6c, 0x6c, 0x61, 0x72, + 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x31, 0x5f, 0x6f, 0x6c, 0x64, 0x1a, 0x1f, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xef, 0x01, + 0x0a, 0x05, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, + 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, + 0x61, 0x73, 0x68, 0x12, 0x36, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6c, 0x6c, 0x61, 0x72, + 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x31, 0x5f, 0x6f, 0x6c, 0x64, 0x2e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x47, 0x0a, 0x0c, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x23, 0x2e, 0x73, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6c, 0x6c, 0x61, 0x72, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x2e, 0x76, 0x31, 0x5f, 0x6f, 0x6c, 0x64, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, + 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, + 0xc0, 0x01, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x6c, 0x65, + 0x64, 0x67, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x0d, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x30, 0x0a, 0x14, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x6c, 0x65, + 0x64, 0x67, 0x65, 0x72, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x12, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x4c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x48, + 0x61, 0x73, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x69, + 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, + 0x6f, 0x69, 0x6e, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x66, 0x65, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x62, 0x61, 0x73, 0x65, 0x46, 0x65, 0x65, 0x12, + 0x21, 0x0a, 0x0c, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x22, 0x8b, 0x02, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x39, + 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x65, 0x6e, 0x76, 0x65, 0x6c, 0x6f, + 0x70, 0x65, 0x5f, 0x78, 0x64, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x65, 0x6e, + 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x58, 0x64, 0x72, 0x12, 0x26, 0x0a, 0x0f, 0x72, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x78, 0x64, 0x72, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x58, 0x64, + 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x78, 0x64, 0x72, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x58, 0x64, 0x72, + 0x42, 0x4f, 0x5a, 0x4d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x66, 0x61, 0x73, 0x74, 0x2f, 0x66, 0x69, 0x72, + 0x65, 0x68, 0x6f, 0x73, 0x65, 0x2d, 0x73, 0x74, 0x65, 0x6c, 0x6c, 0x61, 0x72, 0x2f, 0x70, 0x62, + 0x2f, 0x73, 0x66, 0x2f, 0x73, 0x74, 0x65, 0x6c, 0x6c, 0x61, 0x72, 0x2f, 0x74, 0x79, 0x70, 0x65, + 0x2f, 0x76, 0x31, 0x5f, 0x6f, 0x6c, 0x64, 0x3b, 0x70, 0x62, 0x73, 0x74, 0x65, 0x6c, 0x6c, 0x61, + 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_sf_stellar_type_v1_old_block_proto_rawDescOnce sync.Once + file_sf_stellar_type_v1_old_block_proto_rawDescData = file_sf_stellar_type_v1_old_block_proto_rawDesc +) + +func file_sf_stellar_type_v1_old_block_proto_rawDescGZIP() []byte { + file_sf_stellar_type_v1_old_block_proto_rawDescOnce.Do(func() { + file_sf_stellar_type_v1_old_block_proto_rawDescData = protoimpl.X.CompressGZIP(file_sf_stellar_type_v1_old_block_proto_rawDescData) + }) + return file_sf_stellar_type_v1_old_block_proto_rawDescData +} + +var file_sf_stellar_type_v1_old_block_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_sf_stellar_type_v1_old_block_proto_goTypes = []any{ + (*Block)(nil), // 0: sf.stellar.type.v1_old.Block + (*Header)(nil), // 1: sf.stellar.type.v1_old.Header + (*Transaction)(nil), // 2: sf.stellar.type.v1_old.Transaction + (*timestamppb.Timestamp)(nil), // 3: google.protobuf.Timestamp +} +var file_sf_stellar_type_v1_old_block_proto_depIdxs = []int32{ + 1, // 0: sf.stellar.type.v1_old.Block.header:type_name -> sf.stellar.type.v1_old.Header + 2, // 1: sf.stellar.type.v1_old.Block.transactions:type_name -> sf.stellar.type.v1_old.Transaction + 3, // 2: sf.stellar.type.v1_old.Block.created_at:type_name -> google.protobuf.Timestamp + 3, // 3: sf.stellar.type.v1_old.Transaction.created_at:type_name -> google.protobuf.Timestamp + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_sf_stellar_type_v1_old_block_proto_init() } +func file_sf_stellar_type_v1_old_block_proto_init() { + if File_sf_stellar_type_v1_old_block_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sf_stellar_type_v1_old_block_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_sf_stellar_type_v1_old_block_proto_goTypes, + DependencyIndexes: file_sf_stellar_type_v1_old_block_proto_depIdxs, + MessageInfos: file_sf_stellar_type_v1_old_block_proto_msgTypes, + }.Build() + File_sf_stellar_type_v1_old_block_proto = out.File + file_sf_stellar_type_v1_old_block_proto_rawDesc = nil + file_sf_stellar_type_v1_old_block_proto_goTypes = nil + file_sf_stellar_type_v1_old_block_proto_depIdxs = nil +} diff --git a/pb/sf/stellar/type/v1_old/block_vtproto.pb.go b/pb/sf/stellar/type/v1_old/block_vtproto.pb.go new file mode 100644 index 0000000..4721f6a --- /dev/null +++ b/pb/sf/stellar/type/v1_old/block_vtproto.pb.go @@ -0,0 +1,2042 @@ +// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. +// protoc-gen-go-vtproto version: v0.6.0 +// source: sf/stellar/type/v1_old/block.proto + +package pbstellar + +import ( + fmt "fmt" + protohelpers "github.com/planetscale/vtprotobuf/protohelpers" + timestamppb1 "github.com/planetscale/vtprotobuf/types/known/timestamppb" + proto "google.golang.org/protobuf/proto" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + io "io" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +func (m *Block) CloneVT() *Block { + if m == nil { + return (*Block)(nil) + } + r := new(Block) + r.Number = m.Number + r.Header = m.Header.CloneVT() + r.CreatedAt = (*timestamppb.Timestamp)((*timestamppb1.Timestamp)(m.CreatedAt).CloneVT()) + if rhs := m.Hash; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.Hash = tmpBytes + } + if rhs := m.Transactions; rhs != nil { + tmpContainer := make([]*Transaction, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Transactions = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Block) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *Header) CloneVT() *Header { + if m == nil { + return (*Header)(nil) + } + r := new(Header) + r.LedgerVersion = m.LedgerVersion + r.TotalCoins = m.TotalCoins + r.BaseFee = m.BaseFee + r.BaseReserve = m.BaseReserve + if rhs := m.PreviousLedgerHash; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.PreviousLedgerHash = tmpBytes + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Header) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *Transaction) CloneVT() *Transaction { + if m == nil { + return (*Transaction)(nil) + } + r := new(Transaction) + r.Status = m.Status + r.CreatedAt = (*timestamppb.Timestamp)((*timestamppb1.Timestamp)(m.CreatedAt).CloneVT()) + r.ApplicationOrder = m.ApplicationOrder + if rhs := m.Hash; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.Hash = tmpBytes + } + if rhs := m.EnvelopeXdr; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.EnvelopeXdr = tmpBytes + } + if rhs := m.ResultMetaXdr; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.ResultMetaXdr = tmpBytes + } + if rhs := m.ResultXdr; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.ResultXdr = tmpBytes + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Transaction) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (this *Block) EqualVT(that *Block) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Number != that.Number { + return false + } + if string(this.Hash) != string(that.Hash) { + return false + } + if !this.Header.EqualVT(that.Header) { + return false + } + if len(this.Transactions) != len(that.Transactions) { + return false + } + for i, vx := range this.Transactions { + vy := that.Transactions[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &Transaction{} + } + if q == nil { + q = &Transaction{} + } + if !p.EqualVT(q) { + return false + } + } + } + if !(*timestamppb1.Timestamp)(this.CreatedAt).EqualVT((*timestamppb1.Timestamp)(that.CreatedAt)) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Block) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Block) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *Header) EqualVT(that *Header) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.LedgerVersion != that.LedgerVersion { + return false + } + if string(this.PreviousLedgerHash) != string(that.PreviousLedgerHash) { + return false + } + if this.TotalCoins != that.TotalCoins { + return false + } + if this.BaseFee != that.BaseFee { + return false + } + if this.BaseReserve != that.BaseReserve { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Header) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Header) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *Transaction) EqualVT(that *Transaction) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if string(this.Hash) != string(that.Hash) { + return false + } + if this.Status != that.Status { + return false + } + if !(*timestamppb1.Timestamp)(this.CreatedAt).EqualVT((*timestamppb1.Timestamp)(that.CreatedAt)) { + return false + } + if this.ApplicationOrder != that.ApplicationOrder { + return false + } + if string(this.EnvelopeXdr) != string(that.EnvelopeXdr) { + return false + } + if string(this.ResultMetaXdr) != string(that.ResultMetaXdr) { + return false + } + if string(this.ResultXdr) != string(that.ResultXdr) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Transaction) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Transaction) + if !ok { + return false + } + return this.EqualVT(that) +} +func (m *Block) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Block) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Block) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.CreatedAt != nil { + size, err := (*timestamppb1.Timestamp)(m.CreatedAt).MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x4a + } + if len(m.Transactions) > 0 { + for iNdEx := len(m.Transactions) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Transactions[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 + } + } + if m.Header != nil { + size, err := m.Header.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0x12 + } + if m.Number != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Number)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Header) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Header) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Header) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.BaseReserve != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.BaseReserve)) + i-- + dAtA[i] = 0x28 + } + if m.BaseFee != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.BaseFee)) + i-- + dAtA[i] = 0x20 + } + if m.TotalCoins != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.TotalCoins)) + i-- + dAtA[i] = 0x18 + } + if len(m.PreviousLedgerHash) > 0 { + i -= len(m.PreviousLedgerHash) + copy(dAtA[i:], m.PreviousLedgerHash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PreviousLedgerHash))) + i-- + dAtA[i] = 0x12 + } + if m.LedgerVersion != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.LedgerVersion)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Transaction) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Transaction) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Transaction) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.ResultXdr) > 0 { + i -= len(m.ResultXdr) + copy(dAtA[i:], m.ResultXdr) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ResultXdr))) + i-- + dAtA[i] = 0x42 + } + if len(m.ResultMetaXdr) > 0 { + i -= len(m.ResultMetaXdr) + copy(dAtA[i:], m.ResultMetaXdr) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ResultMetaXdr))) + i-- + dAtA[i] = 0x3a + } + if len(m.EnvelopeXdr) > 0 { + i -= len(m.EnvelopeXdr) + copy(dAtA[i:], m.EnvelopeXdr) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.EnvelopeXdr))) + i-- + dAtA[i] = 0x32 + } + if m.ApplicationOrder != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ApplicationOrder)) + i-- + dAtA[i] = 0x28 + } + if m.CreatedAt != nil { + size, err := (*timestamppb1.Timestamp)(m.CreatedAt).MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if len(m.Status) > 0 { + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0x12 + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Block) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Block) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *Block) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.CreatedAt != nil { + size, err := (*timestamppb1.Timestamp)(m.CreatedAt).MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x4a + } + if len(m.Transactions) > 0 { + for iNdEx := len(m.Transactions) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Transactions[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 + } + } + if m.Header != nil { + size, err := m.Header.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0x12 + } + if m.Number != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Number)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Header) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Header) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *Header) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.BaseReserve != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.BaseReserve)) + i-- + dAtA[i] = 0x28 + } + if m.BaseFee != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.BaseFee)) + i-- + dAtA[i] = 0x20 + } + if m.TotalCoins != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.TotalCoins)) + i-- + dAtA[i] = 0x18 + } + if len(m.PreviousLedgerHash) > 0 { + i -= len(m.PreviousLedgerHash) + copy(dAtA[i:], m.PreviousLedgerHash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PreviousLedgerHash))) + i-- + dAtA[i] = 0x12 + } + if m.LedgerVersion != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.LedgerVersion)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Transaction) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Transaction) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *Transaction) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.ResultXdr) > 0 { + i -= len(m.ResultXdr) + copy(dAtA[i:], m.ResultXdr) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ResultXdr))) + i-- + dAtA[i] = 0x42 + } + if len(m.ResultMetaXdr) > 0 { + i -= len(m.ResultMetaXdr) + copy(dAtA[i:], m.ResultMetaXdr) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ResultMetaXdr))) + i-- + dAtA[i] = 0x3a + } + if len(m.EnvelopeXdr) > 0 { + i -= len(m.EnvelopeXdr) + copy(dAtA[i:], m.EnvelopeXdr) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.EnvelopeXdr))) + i-- + dAtA[i] = 0x32 + } + if m.ApplicationOrder != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ApplicationOrder)) + i-- + dAtA[i] = 0x28 + } + if m.CreatedAt != nil { + size, err := (*timestamppb1.Timestamp)(m.CreatedAt).MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if len(m.Status) > 0 { + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0x12 + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Block) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Number != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Number)) + } + l = len(m.Hash) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Header != nil { + l = m.Header.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if len(m.Transactions) > 0 { + for _, e := range m.Transactions { + l = e.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + } + if m.CreatedAt != nil { + l = (*timestamppb1.Timestamp)(m.CreatedAt).SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Header) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.LedgerVersion != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.LedgerVersion)) + } + l = len(m.PreviousLedgerHash) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.TotalCoins != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.TotalCoins)) + } + if m.BaseFee != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.BaseFee)) + } + if m.BaseReserve != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.BaseReserve)) + } + n += len(m.unknownFields) + return n +} + +func (m *Transaction) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Status) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.CreatedAt != nil { + l = (*timestamppb1.Timestamp)(m.CreatedAt).SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.ApplicationOrder != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.ApplicationOrder)) + } + l = len(m.EnvelopeXdr) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.ResultMetaXdr) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.ResultXdr) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Block) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Block: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Block: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType) + } + m.Number = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Number |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Header == nil { + m.Header = &Header{} + } + if err := m.Header.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Transactions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Transactions = append(m.Transactions, &Transaction{}) + if err := m.Transactions[len(m.Transactions)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CreatedAt == nil { + m.CreatedAt = ×tamppb.Timestamp{} + } + if err := (*timestamppb1.Timestamp)(m.CreatedAt).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Header) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Header: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LedgerVersion", wireType) + } + m.LedgerVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LedgerVersion |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreviousLedgerHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PreviousLedgerHash = append(m.PreviousLedgerHash[:0], dAtA[iNdEx:postIndex]...) + if m.PreviousLedgerHash == nil { + m.PreviousLedgerHash = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalCoins", wireType) + } + m.TotalCoins = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalCoins |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseFee", wireType) + } + m.BaseFee = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BaseFee |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseReserve", wireType) + } + m.BaseReserve = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BaseReserve |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Transaction) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Transaction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Transaction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Status = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CreatedAt == nil { + m.CreatedAt = ×tamppb.Timestamp{} + } + if err := (*timestamppb1.Timestamp)(m.CreatedAt).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ApplicationOrder", wireType) + } + m.ApplicationOrder = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ApplicationOrder |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EnvelopeXdr", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EnvelopeXdr = append(m.EnvelopeXdr[:0], dAtA[iNdEx:postIndex]...) + if m.EnvelopeXdr == nil { + m.EnvelopeXdr = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResultMetaXdr", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResultMetaXdr = append(m.ResultMetaXdr[:0], dAtA[iNdEx:postIndex]...) + if m.ResultMetaXdr == nil { + m.ResultMetaXdr = []byte{} + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResultXdr", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResultXdr = append(m.ResultXdr[:0], dAtA[iNdEx:postIndex]...) + if m.ResultXdr == nil { + m.ResultXdr = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Block) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Block: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Block: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType) + } + m.Number = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Number |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = dAtA[iNdEx:postIndex] + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Header == nil { + m.Header = &Header{} + } + if err := m.Header.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Transactions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Transactions = append(m.Transactions, &Transaction{}) + if err := m.Transactions[len(m.Transactions)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CreatedAt == nil { + m.CreatedAt = ×tamppb.Timestamp{} + } + if err := (*timestamppb1.Timestamp)(m.CreatedAt).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Header) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Header: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LedgerVersion", wireType) + } + m.LedgerVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LedgerVersion |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreviousLedgerHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PreviousLedgerHash = dAtA[iNdEx:postIndex] + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalCoins", wireType) + } + m.TotalCoins = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalCoins |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseFee", wireType) + } + m.BaseFee = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BaseFee |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseReserve", wireType) + } + m.BaseReserve = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BaseReserve |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Transaction) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Transaction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Transaction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = dAtA[iNdEx:postIndex] + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.Status = stringValue + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CreatedAt == nil { + m.CreatedAt = ×tamppb.Timestamp{} + } + if err := (*timestamppb1.Timestamp)(m.CreatedAt).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ApplicationOrder", wireType) + } + m.ApplicationOrder = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ApplicationOrder |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EnvelopeXdr", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EnvelopeXdr = dAtA[iNdEx:postIndex] + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResultMetaXdr", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResultMetaXdr = dAtA[iNdEx:postIndex] + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResultXdr", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResultXdr = dAtA[iNdEx:postIndex] + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} diff --git a/proto/sf/stellar/type/v1_old/block.proto b/proto/sf/stellar/type/v1_old/block.proto new file mode 100644 index 0000000..fca3e9a --- /dev/null +++ b/proto/sf/stellar/type/v1_old/block.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; +package sf.stellar.type.v1_old; + +option go_package = "github.com/streamingfast/firehose-stellar/pb/sf/stellar/type/v1_old;pbstellar"; +import "google/protobuf/timestamp.proto"; + +message Block { + uint64 number = 1; + bytes hash = 2; + Header header = 3; + + repeated Transaction transactions = 6; + google.protobuf.Timestamp created_at = 9; +} + +message Header { + uint32 ledger_version = 1; + bytes previous_ledger_hash = 2; + int64 total_coins = 3; // The amount of stroops in existence at the end of the ledger + uint32 base_fee = 4; + uint32 base_reserve = 5; +} + +message Transaction { + bytes hash = 1; + string status = 2; + google.protobuf.Timestamp created_at = 3; + uint64 application_order = 5; + bytes envelope_xdr = 6; + bytes result_meta_xdr = 7; + bytes result_xdr = 8; +} diff --git a/rpc/fetcher.go b/rpc/fetcher.go index 5cc5f5a..4fdad9d 100644 --- a/rpc/fetcher.go +++ b/rpc/fetcher.go @@ -3,6 +3,7 @@ package rpc import ( "context" "encoding/base64" + "encoding/hex" "fmt" "strconv" "time" @@ -98,12 +99,7 @@ func (f *Fetcher) Fetch(ctx context.Context, client *Client, requestBlockNum uin transactionMeta := make([]*types.TransactionMeta, 0) for _, trx := range transactions { - // FIXME: change to use txHashBytes with the hex encoding - // txHashbytes, err := hex.DecodeString(trx.TxHash) - // if err != nil { - // return nil, false, fmt.Errorf("decoding transaction hash: %w", err) - // } - txHashBytes, err := base64.StdEncoding.DecodeString(trx.TxHash) + txHashBytes, err := hex.DecodeString(trx.TxHash) if err != nil { return nil, false, fmt.Errorf("decoding transaction hash: %w", err) }