diff --git a/cmd/shreder/main.go b/cmd/shreder/main.go index da1a082..14973e3 100644 --- a/cmd/shreder/main.go +++ b/cmd/shreder/main.go @@ -9,10 +9,7 @@ import ( "os/signal" "syscall" - "github.com/samlior/libsam/pkg/logger" "github.com/samlior/libsam/pkg/shreder" - "github.com/samlior/libsam/pkg/types" - "github.com/samlior/libsam/third_party/shreder_protos" ) func main() { @@ -21,11 +18,9 @@ func main() { panic("URL is not set") } - logger := logger.NewEmptyLogger() shrederClient, cleanup, err := shreder.NewShrederClient( - logger, url, - map[string]*shreder_protos.SubscribeRequestFilterTransactions{ + map[string]*shreder.SubscribeRequestFilterTransactions{ "pumpfunamm": { AccountRequired: []string{ "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA", @@ -53,7 +48,7 @@ func main() { }() // async read from shreder - txCh := make(chan types.TxSignalBatch, 1000) + txCh := make(chan shreder.TxSignalBatch, 1000) go func() { err := shrederClient.ReadSync(ctx, txCh) if err != nil { diff --git a/pkg/shreder/shreder_client.go b/pkg/shreder/client.go similarity index 54% rename from pkg/shreder/shreder_client.go rename to pkg/shreder/client.go index efc1ceb..e0cbd8c 100644 --- a/pkg/shreder/shreder_client.go +++ b/pkg/shreder/client.go @@ -2,37 +2,34 @@ package shreder import ( "context" + "log/slog" - "github.com/samlior/libsam/pkg/logger" - "github.com/samlior/libsam/pkg/txparser" - "github.com/samlior/libsam/pkg/types" - "github.com/samlior/libsam/third_party/shreder_protos" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" ) -type ShrederClient struct { - log logger.Logger +type Client struct { + log *slog.Logger conn *grpc.ClientConn - client shreder_protos.ShrederServiceClient - subscription map[string]*shreder_protos.SubscribeRequestFilterTransactions + client ShrederServiceClient + subscription map[string]*SubscribeRequestFilterTransactions } func NewShrederClient( - logger logger.Logger, url string, - subscription map[string]*shreder_protos.SubscribeRequestFilterTransactions, -) (*ShrederClient, func(), error) { + subscription map[string]*SubscribeRequestFilterTransactions, +) (*Client, func(), error) { conn, err := grpc.NewClient(url, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return nil, func() {}, err } - s := &ShrederClient{ + logger := slog.Default() + s := &Client{ log: logger, conn: conn, - client: shreder_protos.NewShrederServiceClient(conn), + client: NewShrederServiceClient(conn), subscription: subscription, } @@ -41,24 +38,24 @@ func NewShrederClient( }, nil } -func (c *ShrederClient) Wait() { +func (c *Client) Wait() { c.log.Debug("waiting for shreder client to stop") err := c.conn.Close() if err != nil { - c.log.Errorf("failed to close connection: %v", err) + c.log.Error("failed to close connection: ", "err", err) } c.log.Debug("shreder client stopped") } -func (c *ShrederClient) ReadSync(ctx context.Context, txCh chan<- types.TxSignalBatch) error { +func (c *Client) ReadSync(ctx context.Context, txCh chan<- TxSignalBatch) error { stream, err := c.client.SubscribeTransactions(ctx) if err != nil { return err } - err = stream.Send(&shreder_protos.SubscribeTransactionsRequest{ + err = stream.Send(&SubscribeTransactionsRequest{ Transactions: c.subscription, }) if err != nil { @@ -71,7 +68,7 @@ func (c *ShrederClient) ReadSync(ctx context.Context, txCh chan<- types.TxSignal return err } - txBatch := txparser.ParseTransaction(response.Transaction) + txBatch := ParseTransaction(response.Transaction) if len(txBatch) == 0 { continue } diff --git a/pkg/shreder/shreder.pb.go b/pkg/shreder/shreder.pb.go new file mode 100644 index 0000000..64d67a3 --- /dev/null +++ b/pkg/shreder/shreder.pb.go @@ -0,0 +1,1015 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.33.0 +// protoc v6.33.1 +// source: shreder.proto + +package shreder + +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 SubscribeEntriesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SubscribeEntriesRequest) Reset() { + *x = SubscribeEntriesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_shreder_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscribeEntriesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeEntriesRequest) ProtoMessage() {} + +func (x *SubscribeEntriesRequest) ProtoReflect() protoreflect.Message { + mi := &file_shreder_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubscribeEntriesRequest.ProtoReflect.Descriptor instead. +func (*SubscribeEntriesRequest) Descriptor() ([]byte, []int) { + return file_shreder_proto_rawDescGZIP(), []int{0} +} + +type SubscribeTransactionsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Transactions map[string]*SubscribeRequestFilterTransactions `protobuf:"bytes,3,rep,name=transactions,proto3" json:"transactions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *SubscribeTransactionsRequest) Reset() { + *x = SubscribeTransactionsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_shreder_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscribeTransactionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeTransactionsRequest) ProtoMessage() {} + +func (x *SubscribeTransactionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_shreder_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubscribeTransactionsRequest.ProtoReflect.Descriptor instead. +func (*SubscribeTransactionsRequest) Descriptor() ([]byte, []int) { + return file_shreder_proto_rawDescGZIP(), []int{1} +} + +func (x *SubscribeTransactionsRequest) GetTransactions() map[string]*SubscribeRequestFilterTransactions { + if x != nil { + return x.Transactions + } + return nil +} + +type SubscribeTransactionsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Filters []string `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` + Transaction *SubscribeUpdateTransaction `protobuf:"bytes,4,opt,name=transaction,proto3" json:"transaction,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` +} + +func (x *SubscribeTransactionsResponse) Reset() { + *x = SubscribeTransactionsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_shreder_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscribeTransactionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeTransactionsResponse) ProtoMessage() {} + +func (x *SubscribeTransactionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_shreder_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubscribeTransactionsResponse.ProtoReflect.Descriptor instead. +func (*SubscribeTransactionsResponse) Descriptor() ([]byte, []int) { + return file_shreder_proto_rawDescGZIP(), []int{2} +} + +func (x *SubscribeTransactionsResponse) GetFilters() []string { + if x != nil { + return x.Filters + } + return nil +} + +func (x *SubscribeTransactionsResponse) GetTransaction() *SubscribeUpdateTransaction { + if x != nil { + return x.Transaction + } + return nil +} + +func (x *SubscribeTransactionsResponse) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +type SubscribeUpdateTransaction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Transaction *Transaction `protobuf:"bytes,1,opt,name=transaction,proto3" json:"transaction,omitempty"` + Slot uint64 `protobuf:"varint,2,opt,name=slot,proto3" json:"slot,omitempty"` +} + +func (x *SubscribeUpdateTransaction) Reset() { + *x = SubscribeUpdateTransaction{} + if protoimpl.UnsafeEnabled { + mi := &file_shreder_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscribeUpdateTransaction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeUpdateTransaction) ProtoMessage() {} + +func (x *SubscribeUpdateTransaction) ProtoReflect() protoreflect.Message { + mi := &file_shreder_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubscribeUpdateTransaction.ProtoReflect.Descriptor instead. +func (*SubscribeUpdateTransaction) Descriptor() ([]byte, []int) { + return file_shreder_proto_rawDescGZIP(), []int{3} +} + +func (x *SubscribeUpdateTransaction) GetTransaction() *Transaction { + if x != nil { + return x.Transaction + } + return nil +} + +func (x *SubscribeUpdateTransaction) GetSlot() uint64 { + if x != nil { + return x.Slot + } + return 0 +} + +type SubscribeRequestFilterTransactions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AccountInclude []string `protobuf:"bytes,3,rep,name=account_include,json=accountInclude,proto3" json:"account_include,omitempty"` + AccountExclude []string `protobuf:"bytes,4,rep,name=account_exclude,json=accountExclude,proto3" json:"account_exclude,omitempty"` + AccountRequired []string `protobuf:"bytes,6,rep,name=account_required,json=accountRequired,proto3" json:"account_required,omitempty"` +} + +func (x *SubscribeRequestFilterTransactions) Reset() { + *x = SubscribeRequestFilterTransactions{} + if protoimpl.UnsafeEnabled { + mi := &file_shreder_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscribeRequestFilterTransactions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeRequestFilterTransactions) ProtoMessage() {} + +func (x *SubscribeRequestFilterTransactions) ProtoReflect() protoreflect.Message { + mi := &file_shreder_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubscribeRequestFilterTransactions.ProtoReflect.Descriptor instead. +func (*SubscribeRequestFilterTransactions) Descriptor() ([]byte, []int) { + return file_shreder_proto_rawDescGZIP(), []int{4} +} + +func (x *SubscribeRequestFilterTransactions) GetAccountInclude() []string { + if x != nil { + return x.AccountInclude + } + return nil +} + +func (x *SubscribeRequestFilterTransactions) GetAccountExclude() []string { + if x != nil { + return x.AccountExclude + } + return nil +} + +func (x *SubscribeRequestFilterTransactions) GetAccountRequired() []string { + if x != nil { + return x.AccountRequired + } + return nil +} + +type Entry struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // the slot that the entry is from + Slot uint64 `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty"` + // Serialized bytes of Vec: https://docs.rs/solana-entry/latest/solana_entry/entry/struct.Entry.html + Entries []byte `protobuf:"bytes,2,opt,name=entries,proto3" json:"entries,omitempty"` +} + +func (x *Entry) Reset() { + *x = Entry{} + if protoimpl.UnsafeEnabled { + mi := &file_shreder_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Entry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Entry) ProtoMessage() {} + +func (x *Entry) ProtoReflect() protoreflect.Message { + mi := &file_shreder_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Entry.ProtoReflect.Descriptor instead. +func (*Entry) Descriptor() ([]byte, []int) { + return file_shreder_proto_rawDescGZIP(), []int{5} +} + +func (x *Entry) GetSlot() uint64 { + if x != nil { + return x.Slot + } + return 0 +} + +func (x *Entry) GetEntries() []byte { + if x != nil { + return x.Entries + } + return nil +} + +type MessageHeader struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NumRequiredSignatures uint32 `protobuf:"varint,1,opt,name=num_required_signatures,json=numRequiredSignatures,proto3" json:"num_required_signatures,omitempty"` + NumReadonlySignedAccounts uint32 `protobuf:"varint,2,opt,name=num_readonly_signed_accounts,json=numReadonlySignedAccounts,proto3" json:"num_readonly_signed_accounts,omitempty"` + NumReadonlyUnsignedAccounts uint32 `protobuf:"varint,3,opt,name=num_readonly_unsigned_accounts,json=numReadonlyUnsignedAccounts,proto3" json:"num_readonly_unsigned_accounts,omitempty"` +} + +func (x *MessageHeader) Reset() { + *x = MessageHeader{} + if protoimpl.UnsafeEnabled { + mi := &file_shreder_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageHeader) ProtoMessage() {} + +func (x *MessageHeader) ProtoReflect() protoreflect.Message { + mi := &file_shreder_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageHeader.ProtoReflect.Descriptor instead. +func (*MessageHeader) Descriptor() ([]byte, []int) { + return file_shreder_proto_rawDescGZIP(), []int{6} +} + +func (x *MessageHeader) GetNumRequiredSignatures() uint32 { + if x != nil { + return x.NumRequiredSignatures + } + return 0 +} + +func (x *MessageHeader) GetNumReadonlySignedAccounts() uint32 { + if x != nil { + return x.NumReadonlySignedAccounts + } + return 0 +} + +func (x *MessageHeader) GetNumReadonlyUnsignedAccounts() uint32 { + if x != nil { + return x.NumReadonlyUnsignedAccounts + } + return 0 +} + +type CompiledInstruction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProgramIdIndex uint32 `protobuf:"varint,1,opt,name=program_id_index,json=programIdIndex,proto3" json:"program_id_index,omitempty"` + Accounts []byte `protobuf:"bytes,2,opt,name=accounts,proto3" json:"accounts,omitempty"` + Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *CompiledInstruction) Reset() { + *x = CompiledInstruction{} + if protoimpl.UnsafeEnabled { + mi := &file_shreder_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CompiledInstruction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CompiledInstruction) ProtoMessage() {} + +func (x *CompiledInstruction) ProtoReflect() protoreflect.Message { + mi := &file_shreder_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CompiledInstruction.ProtoReflect.Descriptor instead. +func (*CompiledInstruction) Descriptor() ([]byte, []int) { + return file_shreder_proto_rawDescGZIP(), []int{7} +} + +func (x *CompiledInstruction) GetProgramIdIndex() uint32 { + if x != nil { + return x.ProgramIdIndex + } + return 0 +} + +func (x *CompiledInstruction) GetAccounts() []byte { + if x != nil { + return x.Accounts + } + return nil +} + +func (x *CompiledInstruction) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +type MessageAddressTableLookup struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AccountKey []byte `protobuf:"bytes,1,opt,name=account_key,json=accountKey,proto3" json:"account_key,omitempty"` + WritableIndexes []byte `protobuf:"bytes,2,opt,name=writable_indexes,json=writableIndexes,proto3" json:"writable_indexes,omitempty"` + ReadonlyIndexes []byte `protobuf:"bytes,3,opt,name=readonly_indexes,json=readonlyIndexes,proto3" json:"readonly_indexes,omitempty"` +} + +func (x *MessageAddressTableLookup) Reset() { + *x = MessageAddressTableLookup{} + if protoimpl.UnsafeEnabled { + mi := &file_shreder_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageAddressTableLookup) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageAddressTableLookup) ProtoMessage() {} + +func (x *MessageAddressTableLookup) ProtoReflect() protoreflect.Message { + mi := &file_shreder_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageAddressTableLookup.ProtoReflect.Descriptor instead. +func (*MessageAddressTableLookup) Descriptor() ([]byte, []int) { + return file_shreder_proto_rawDescGZIP(), []int{8} +} + +func (x *MessageAddressTableLookup) GetAccountKey() []byte { + if x != nil { + return x.AccountKey + } + return nil +} + +func (x *MessageAddressTableLookup) GetWritableIndexes() []byte { + if x != nil { + return x.WritableIndexes + } + return nil +} + +func (x *MessageAddressTableLookup) GetReadonlyIndexes() []byte { + if x != nil { + return x.ReadonlyIndexes + } + return nil +} + +type Message struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Header *MessageHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + AccountKeys [][]byte `protobuf:"bytes,2,rep,name=account_keys,json=accountKeys,proto3" json:"account_keys,omitempty"` + RecentBlockhash []byte `protobuf:"bytes,3,opt,name=recent_blockhash,json=recentBlockhash,proto3" json:"recent_blockhash,omitempty"` + Instructions []*CompiledInstruction `protobuf:"bytes,4,rep,name=instructions,proto3" json:"instructions,omitempty"` + Versioned bool `protobuf:"varint,5,opt,name=versioned,proto3" json:"versioned,omitempty"` + AddressTableLookups []*MessageAddressTableLookup `protobuf:"bytes,6,rep,name=address_table_lookups,json=addressTableLookups,proto3" json:"address_table_lookups,omitempty"` +} + +func (x *Message) Reset() { + *x = Message{} + if protoimpl.UnsafeEnabled { + mi := &file_shreder_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Message) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Message) ProtoMessage() {} + +func (x *Message) ProtoReflect() protoreflect.Message { + mi := &file_shreder_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Message.ProtoReflect.Descriptor instead. +func (*Message) Descriptor() ([]byte, []int) { + return file_shreder_proto_rawDescGZIP(), []int{9} +} + +func (x *Message) GetHeader() *MessageHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *Message) GetAccountKeys() [][]byte { + if x != nil { + return x.AccountKeys + } + return nil +} + +func (x *Message) GetRecentBlockhash() []byte { + if x != nil { + return x.RecentBlockhash + } + return nil +} + +func (x *Message) GetInstructions() []*CompiledInstruction { + if x != nil { + return x.Instructions + } + return nil +} + +func (x *Message) GetVersioned() bool { + if x != nil { + return x.Versioned + } + return false +} + +func (x *Message) GetAddressTableLookups() []*MessageAddressTableLookup { + if x != nil { + return x.AddressTableLookups + } + return nil +} + +type Transaction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Signatures [][]byte `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"` + Message *Message `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *Transaction) Reset() { + *x = Transaction{} + if protoimpl.UnsafeEnabled { + mi := &file_shreder_proto_msgTypes[10] + 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_shreder_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && 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_shreder_proto_rawDescGZIP(), []int{10} +} + +func (x *Transaction) GetSignatures() [][]byte { + if x != nil { + return x.Signatures + } + return nil +} + +func (x *Transaction) GetMessage() *Message { + if x != nil { + return x.Message + } + return nil +} + +var File_shreder_proto protoreflect.FileDescriptor + +var file_shreder_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x73, 0x68, 0x72, 0x65, 0x64, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x0b, 0x73, 0x68, 0x72, 0x65, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 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, 0x19, 0x0a, + 0x17, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xf1, 0x01, 0x0a, 0x1c, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x5f, 0x0a, 0x0c, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x3b, 0x2e, 0x73, 0x68, 0x72, 0x65, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x53, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0c, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x70, 0x0a, 0x11, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x45, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2f, 0x2e, 0x73, 0x68, 0x72, 0x65, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xbf, 0x01, 0x0a, + 0x1d, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x12, 0x49, 0x0a, 0x0b, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, + 0x73, 0x68, 0x72, 0x65, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x62, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, + 0x74, 0x18, 0x0b, 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, 0x6c, + 0x0a, 0x1a, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3a, 0x0a, 0x0b, + 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x68, 0x72, 0x65, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, + 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x22, 0xa1, 0x01, 0x0a, + 0x22, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, + 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x12, 0x27, 0x0a, 0x0f, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x78, + 0x63, 0x6c, 0x75, 0x64, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x0f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, + 0x22, 0x35, 0x0a, 0x05, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6c, 0x6f, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x18, 0x0a, + 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, + 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x22, 0xcd, 0x01, 0x0a, 0x0d, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x36, 0x0a, 0x17, 0x6e, 0x75, 0x6d, + 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, 0x6e, 0x75, 0x6d, 0x52, + 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x73, 0x12, 0x3f, 0x0a, 0x1c, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, + 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x19, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x61, 0x64, + 0x6f, 0x6e, 0x6c, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x73, 0x12, 0x43, 0x0a, 0x1e, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e, + 0x6c, 0x79, 0x5f, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x1b, 0x6e, 0x75, 0x6d, 0x52, + 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x55, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, 0x6f, 0x0a, 0x13, 0x43, 0x6f, 0x6d, 0x70, 0x69, + 0x6c, 0x65, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, + 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x5f, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, + 0x6d, 0x49, 0x64, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x92, 0x01, 0x0a, 0x19, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x54, 0x61, 0x62, 0x6c, 0x65, + 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x29, 0x0a, 0x10, 0x77, 0x72, 0x69, 0x74, 0x61, + 0x62, 0x6c, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0f, 0x77, 0x72, 0x69, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, + 0x65, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x5f, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x72, 0x65, + 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x22, 0xcb, 0x02, + 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x32, 0x0a, 0x06, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x73, 0x68, 0x72, 0x65, + 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, + 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x73, + 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x72, 0x65, 0x63, 0x65, + 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x68, 0x61, 0x73, 0x68, 0x12, 0x44, 0x0a, 0x0c, 0x69, + 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x68, 0x72, 0x65, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, + 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x64, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x64, 0x12, + 0x5a, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, + 0x5f, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, + 0x2e, 0x73, 0x68, 0x72, 0x65, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x54, 0x61, 0x62, 0x6c, 0x65, + 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x13, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x54, + 0x61, 0x62, 0x6c, 0x65, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x73, 0x22, 0x5d, 0x0a, 0x0b, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x2e, 0x0a, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x68, + 0x72, 0x65, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0xd4, 0x01, 0x0a, 0x0e, 0x53, + 0x68, 0x72, 0x65, 0x64, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4e, 0x0a, + 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, + 0x73, 0x12, 0x24, 0x2e, 0x73, 0x68, 0x72, 0x65, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x73, 0x68, 0x72, 0x65, 0x64, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x30, 0x01, 0x12, 0x72, 0x0a, + 0x15, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x29, 0x2e, 0x73, 0x68, 0x72, 0x65, 0x64, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2a, 0x2e, 0x73, 0x68, 0x72, 0x65, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x30, + 0x01, 0x42, 0x1b, 0x5a, 0x19, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x74, 0x68, 0x6c, 0x6f, 0x79, 0x69, 0x2f, 0x73, 0x68, 0x72, 0x65, 0x64, 0x65, 0x72, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_shreder_proto_rawDescOnce sync.Once + file_shreder_proto_rawDescData = file_shreder_proto_rawDesc +) + +func file_shreder_proto_rawDescGZIP() []byte { + file_shreder_proto_rawDescOnce.Do(func() { + file_shreder_proto_rawDescData = protoimpl.X.CompressGZIP(file_shreder_proto_rawDescData) + }) + return file_shreder_proto_rawDescData +} + +var file_shreder_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_shreder_proto_goTypes = []interface{}{ + (*SubscribeEntriesRequest)(nil), // 0: shredstream.SubscribeEntriesRequest + (*SubscribeTransactionsRequest)(nil), // 1: shredstream.SubscribeTransactionsRequest + (*SubscribeTransactionsResponse)(nil), // 2: shredstream.SubscribeTransactionsResponse + (*SubscribeUpdateTransaction)(nil), // 3: shredstream.SubscribeUpdateTransaction + (*SubscribeRequestFilterTransactions)(nil), // 4: shredstream.SubscribeRequestFilterTransactions + (*Entry)(nil), // 5: shredstream.Entry + (*MessageHeader)(nil), // 6: shredstream.MessageHeader + (*CompiledInstruction)(nil), // 7: shredstream.CompiledInstruction + (*MessageAddressTableLookup)(nil), // 8: shredstream.MessageAddressTableLookup + (*Message)(nil), // 9: shredstream.Message + (*Transaction)(nil), // 10: shredstream.Transaction + nil, // 11: shredstream.SubscribeTransactionsRequest.TransactionsEntry + (*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp +} +var file_shreder_proto_depIdxs = []int32{ + 11, // 0: shredstream.SubscribeTransactionsRequest.transactions:type_name -> shredstream.SubscribeTransactionsRequest.TransactionsEntry + 3, // 1: shredstream.SubscribeTransactionsResponse.transaction:type_name -> shredstream.SubscribeUpdateTransaction + 12, // 2: shredstream.SubscribeTransactionsResponse.created_at:type_name -> google.protobuf.Timestamp + 10, // 3: shredstream.SubscribeUpdateTransaction.transaction:type_name -> shredstream.Transaction + 6, // 4: shredstream.Message.header:type_name -> shredstream.MessageHeader + 7, // 5: shredstream.Message.instructions:type_name -> shredstream.CompiledInstruction + 8, // 6: shredstream.Message.address_table_lookups:type_name -> shredstream.MessageAddressTableLookup + 9, // 7: shredstream.Transaction.message:type_name -> shredstream.Message + 4, // 8: shredstream.SubscribeTransactionsRequest.TransactionsEntry.value:type_name -> shredstream.SubscribeRequestFilterTransactions + 0, // 9: shredstream.ShrederService.SubscribeEntries:input_type -> shredstream.SubscribeEntriesRequest + 1, // 10: shredstream.ShrederService.SubscribeTransactions:input_type -> shredstream.SubscribeTransactionsRequest + 5, // 11: shredstream.ShrederService.SubscribeEntries:output_type -> shredstream.Entry + 2, // 12: shredstream.ShrederService.SubscribeTransactions:output_type -> shredstream.SubscribeTransactionsResponse + 11, // [11:13] is the sub-list for method output_type + 9, // [9:11] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name +} + +func init() { file_shreder_proto_init() } +func file_shreder_proto_init() { + if File_shreder_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_shreder_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeEntriesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shreder_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeTransactionsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shreder_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeTransactionsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shreder_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeUpdateTransaction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shreder_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeRequestFilterTransactions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shreder_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Entry); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shreder_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageHeader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shreder_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CompiledInstruction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shreder_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageAddressTableLookup); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shreder_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Message); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shreder_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Transaction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_shreder_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_shreder_proto_goTypes, + DependencyIndexes: file_shreder_proto_depIdxs, + MessageInfos: file_shreder_proto_msgTypes, + }.Build() + File_shreder_proto = out.File + file_shreder_proto_rawDesc = nil + file_shreder_proto_goTypes = nil + file_shreder_proto_depIdxs = nil +} diff --git a/third_party/shreder_protos/shreder.proto b/pkg/shreder/shreder.proto similarity index 96% rename from third_party/shreder_protos/shreder.proto rename to pkg/shreder/shreder.proto index 41fc023..e0bfbb3 100644 --- a/third_party/shreder_protos/shreder.proto +++ b/pkg/shreder/shreder.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package shredstream; import "google/protobuf/timestamp.proto"; +option go_package = "github.com/samlior/libsam/pkg//shreder"; service ShrederService { rpc SubscribeEntries(SubscribeEntriesRequest) returns (stream Entry); diff --git a/third_party/shreder_protos/shreder_grpc.pb.go b/pkg/shreder/shreder_grpc.pb.go similarity index 50% rename from third_party/shreder_protos/shreder_grpc.pb.go rename to pkg/shreder/shreder_grpc.pb.go index 033a1f4..ce5f970 100644 --- a/third_party/shreder_protos/shreder_grpc.pb.go +++ b/pkg/shreder/shreder_grpc.pb.go @@ -1,10 +1,10 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.6.0 +// - protoc-gen-go-grpc v1.3.0 // - protoc v6.33.1 // source: shreder.proto -package shreder_protos +package shreder import ( context "context" @@ -15,8 +15,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 const ( ShrederService_SubscribeEntries_FullMethodName = "/shredstream.ShrederService/SubscribeEntries" @@ -27,8 +27,8 @@ const ( // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type ShrederServiceClient interface { - SubscribeEntries(ctx context.Context, in *SubscribeEntriesRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Entry], error) - SubscribeTransactions(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SubscribeTransactionsRequest, SubscribeTransactionsResponse], error) + SubscribeEntries(ctx context.Context, in *SubscribeEntriesRequest, opts ...grpc.CallOption) (ShrederService_SubscribeEntriesClient, error) + SubscribeTransactions(ctx context.Context, opts ...grpc.CallOption) (ShrederService_SubscribeTransactionsClient, error) } type shrederServiceClient struct { @@ -39,13 +39,12 @@ func NewShrederServiceClient(cc grpc.ClientConnInterface) ShrederServiceClient { return &shrederServiceClient{cc} } -func (c *shrederServiceClient) SubscribeEntries(ctx context.Context, in *SubscribeEntriesRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Entry], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &ShrederService_ServiceDesc.Streams[0], ShrederService_SubscribeEntries_FullMethodName, cOpts...) +func (c *shrederServiceClient) SubscribeEntries(ctx context.Context, in *SubscribeEntriesRequest, opts ...grpc.CallOption) (ShrederService_SubscribeEntriesClient, error) { + stream, err := c.cc.NewStream(ctx, &ShrederService_ServiceDesc.Streams[0], ShrederService_SubscribeEntries_FullMethodName, opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[SubscribeEntriesRequest, Entry]{ClientStream: stream} + x := &shrederServiceSubscribeEntriesClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -55,46 +54,74 @@ func (c *shrederServiceClient) SubscribeEntries(ctx context.Context, in *Subscri return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type ShrederService_SubscribeEntriesClient = grpc.ServerStreamingClient[Entry] +type ShrederService_SubscribeEntriesClient interface { + Recv() (*Entry, error) + grpc.ClientStream +} -func (c *shrederServiceClient) SubscribeTransactions(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SubscribeTransactionsRequest, SubscribeTransactionsResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &ShrederService_ServiceDesc.Streams[1], ShrederService_SubscribeTransactions_FullMethodName, cOpts...) +type shrederServiceSubscribeEntriesClient struct { + grpc.ClientStream +} + +func (x *shrederServiceSubscribeEntriesClient) Recv() (*Entry, error) { + m := new(Entry) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *shrederServiceClient) SubscribeTransactions(ctx context.Context, opts ...grpc.CallOption) (ShrederService_SubscribeTransactionsClient, error) { + stream, err := c.cc.NewStream(ctx, &ShrederService_ServiceDesc.Streams[1], ShrederService_SubscribeTransactions_FullMethodName, opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[SubscribeTransactionsRequest, SubscribeTransactionsResponse]{ClientStream: stream} + x := &shrederServiceSubscribeTransactionsClient{stream} return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type ShrederService_SubscribeTransactionsClient = grpc.BidiStreamingClient[SubscribeTransactionsRequest, SubscribeTransactionsResponse] +type ShrederService_SubscribeTransactionsClient interface { + Send(*SubscribeTransactionsRequest) error + Recv() (*SubscribeTransactionsResponse, error) + grpc.ClientStream +} + +type shrederServiceSubscribeTransactionsClient struct { + grpc.ClientStream +} + +func (x *shrederServiceSubscribeTransactionsClient) Send(m *SubscribeTransactionsRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *shrederServiceSubscribeTransactionsClient) Recv() (*SubscribeTransactionsResponse, error) { + m := new(SubscribeTransactionsResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // ShrederServiceServer is the server API for ShrederService service. // All implementations must embed UnimplementedShrederServiceServer -// for forward compatibility. +// for forward compatibility type ShrederServiceServer interface { - SubscribeEntries(*SubscribeEntriesRequest, grpc.ServerStreamingServer[Entry]) error - SubscribeTransactions(grpc.BidiStreamingServer[SubscribeTransactionsRequest, SubscribeTransactionsResponse]) error + SubscribeEntries(*SubscribeEntriesRequest, ShrederService_SubscribeEntriesServer) error + SubscribeTransactions(ShrederService_SubscribeTransactionsServer) error mustEmbedUnimplementedShrederServiceServer() } -// UnimplementedShrederServiceServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedShrederServiceServer struct{} - -func (UnimplementedShrederServiceServer) SubscribeEntries(*SubscribeEntriesRequest, grpc.ServerStreamingServer[Entry]) error { - return status.Error(codes.Unimplemented, "method SubscribeEntries not implemented") +// UnimplementedShrederServiceServer must be embedded to have forward compatible implementations. +type UnimplementedShrederServiceServer struct { } -func (UnimplementedShrederServiceServer) SubscribeTransactions(grpc.BidiStreamingServer[SubscribeTransactionsRequest, SubscribeTransactionsResponse]) error { - return status.Error(codes.Unimplemented, "method SubscribeTransactions not implemented") + +func (UnimplementedShrederServiceServer) SubscribeEntries(*SubscribeEntriesRequest, ShrederService_SubscribeEntriesServer) error { + return status.Errorf(codes.Unimplemented, "method SubscribeEntries not implemented") +} +func (UnimplementedShrederServiceServer) SubscribeTransactions(ShrederService_SubscribeTransactionsServer) error { + return status.Errorf(codes.Unimplemented, "method SubscribeTransactions not implemented") } func (UnimplementedShrederServiceServer) mustEmbedUnimplementedShrederServiceServer() {} -func (UnimplementedShrederServiceServer) testEmbeddedByValue() {} // UnsafeShrederServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ShrederServiceServer will @@ -104,13 +131,6 @@ type UnsafeShrederServiceServer interface { } func RegisterShrederServiceServer(s grpc.ServiceRegistrar, srv ShrederServiceServer) { - // If the following call panics, it indicates UnimplementedShrederServiceServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } s.RegisterService(&ShrederService_ServiceDesc, srv) } @@ -119,18 +139,47 @@ func _ShrederService_SubscribeEntries_Handler(srv interface{}, stream grpc.Serve if err := stream.RecvMsg(m); err != nil { return err } - return srv.(ShrederServiceServer).SubscribeEntries(m, &grpc.GenericServerStream[SubscribeEntriesRequest, Entry]{ServerStream: stream}) + return srv.(ShrederServiceServer).SubscribeEntries(m, &shrederServiceSubscribeEntriesServer{stream}) } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type ShrederService_SubscribeEntriesServer = grpc.ServerStreamingServer[Entry] +type ShrederService_SubscribeEntriesServer interface { + Send(*Entry) error + grpc.ServerStream +} + +type shrederServiceSubscribeEntriesServer struct { + grpc.ServerStream +} + +func (x *shrederServiceSubscribeEntriesServer) Send(m *Entry) error { + return x.ServerStream.SendMsg(m) +} func _ShrederService_SubscribeTransactions_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ShrederServiceServer).SubscribeTransactions(&grpc.GenericServerStream[SubscribeTransactionsRequest, SubscribeTransactionsResponse]{ServerStream: stream}) + return srv.(ShrederServiceServer).SubscribeTransactions(&shrederServiceSubscribeTransactionsServer{stream}) } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type ShrederService_SubscribeTransactionsServer = grpc.BidiStreamingServer[SubscribeTransactionsRequest, SubscribeTransactionsResponse] +type ShrederService_SubscribeTransactionsServer interface { + Send(*SubscribeTransactionsResponse) error + Recv() (*SubscribeTransactionsRequest, error) + grpc.ServerStream +} + +type shrederServiceSubscribeTransactionsServer struct { + grpc.ServerStream +} + +func (x *shrederServiceSubscribeTransactionsServer) Send(m *SubscribeTransactionsResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *shrederServiceSubscribeTransactionsServer) Recv() (*SubscribeTransactionsRequest, error) { + m := new(SubscribeTransactionsRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // ShrederService_ServiceDesc is the grpc.ServiceDesc for ShrederService service. // It's only intended for direct use with grpc.RegisterService, diff --git a/pkg/types/tx_signal.go b/pkg/shreder/tx.go similarity index 79% rename from pkg/types/tx_signal.go rename to pkg/shreder/tx.go index 4bfc8e3..ffc5c4b 100644 --- a/pkg/types/tx_signal.go +++ b/pkg/shreder/tx.go @@ -1,12 +1,16 @@ -package types +package shreder import ( "time" - "github.com/samlior/libsam/pkg/consts" "github.com/shopspring/decimal" ) +const ( + TokenDecimals = 6 + SolDecimals = 9 +) + type TxSignal struct { Source string `json:"source"` TxHash string `json:"tx_hash"` @@ -25,14 +29,16 @@ type TxSignal struct { IsMayhemMode bool `json:"is_mayhem_mode"` TxFee decimal.Decimal `json:"tx_fee"` + ExactSOL bool `json:"exact_in"` + // parsed values Token0AmountUint64 uint64 `json:"-"` Token1AmountUint64 uint64 `json:"-"` } func (t *TxSignal) Parse() *TxSignal { - t.Token0AmountUint64 = t.Token0Amount.Mul(decimal.New(1, consts.TokenDecimals)).BigInt().Uint64() - t.Token1AmountUint64 = t.Token1Amount.Mul(decimal.New(1, consts.SolDecimals)).BigInt().Uint64() + t.Token0AmountUint64 = t.Token0Amount.Mul(decimal.New(1, TokenDecimals)).BigInt().Uint64() + t.Token1AmountUint64 = t.Token1Amount.Mul(decimal.New(1, SolDecimals)).BigInt().Uint64() return t } diff --git a/pkg/txparser/txparser.go b/pkg/shreder/txparser.go similarity index 62% rename from pkg/txparser/txparser.go rename to pkg/shreder/txparser.go index ab01396..f835b55 100644 --- a/pkg/txparser/txparser.go +++ b/pkg/shreder/txparser.go @@ -1,16 +1,15 @@ -package txparser +package shreder import ( "bytes" "encoding/binary" "fmt" - "log" + "log/slog" "math/big" "github.com/gagliardetto/solana-go" + "github.com/mr-tron/base58" "github.com/near/borsh-go" - "github.com/samlior/libsam/pkg/types" - "github.com/samlior/libsam/third_party/shreder_protos" "github.com/shopspring/decimal" ) @@ -20,50 +19,70 @@ const ( ) // program ids -const ( - pumpProgramID = "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" - azczProgramID = "AzcZqCRUQgKEg5FTAgY7JacATABEYCEfMbjXEzspLYFB" - f5tfProgramID = "F5tfvbLog9VdGUPqBDTT8rgXvTTcq7e5UiGnupL1zvBq" - photonProgramID = "BSfD6SHZigAfDWSjzD5Q41jw8LmKwtmjskPH9XW1mrRW" - pumpAmmProgramID = "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" - _6hb1ProgramID = "6HB1VBBS8LrdQiR9MZcXV5VdpKFb7vjTMZuQQEQEPioC" - _8rsrProgramID = "8rsrfqvEQFKDm66uGx1swVJhkGf2fDet5Q7bygUjYYA3" - boboProgramID = "BobogA5N2KN2GG4XN3E3rNNRw3L8H1QPXp7QLxGrNHGM" - qtkvProgramID = "qtkvapJEvRWWrB7i5K6RaA1kvq5x3qmMKZ98ad71XQ7" - fjszProgramID = "FJsZbftBqRLfF7uqUKpm4s2goDr6xsQ5Q3mN7AFJB6hK" - flasProgramID = "FLASHX8DrLbgeR8FcfNV1F5krxYcYMUdBkrP1EPBtxB9" +var ( + pumpProgramID = solana.MustPublicKeyFromBase58("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P") + + // has no sell function with pump and pump.amm program + azczProgramID = solana.MustPublicKeyFromBase58("AzcZqCRUQgKEg5FTAgY7JacATABEYCEfMbjXEzspLYFB") + + // only buy function with pump program + f5tfProgramID = solana.MustPublicKeyFromBase58("F5tfvbLog9VdGUPqBDTT8rgXvTTcq7e5UiGnupL1zvBq") + + // only pump.fun function + photonProgramID = solana.MustPublicKeyFromBase58("BSfD6SHZigAfDWSjzD5Q41jw8LmKwtmjskPH9XW1mrRW") + + pumpAmmProgramID = solana.MustPublicKeyFromBase58("pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA") + + boboProgramID = solana.MustPublicKeyFromBase58("BobogA5N2KN2GG4XN3E3rNNRw3L8H1QPXp7QLxGrNHGM") + + qtkvProgramID = solana.MustPublicKeyFromBase58("qtkvapJEvRWWrB7i5K6RaA1kvq5x3qmMKZ98ad71XQ7") + + // only buy function with pump program + fjszProgramID = solana.MustPublicKeyFromBase58("FJsZbftBqRLfF7uqUKpm4s2goDr6xsQ5Q3mN7AFJB6hK") + + flasProgramID = solana.MustPublicKeyFromBase58("FLASHX8DrLbgeR8FcfNV1F5krxYcYMUdBkrP1EPBtxB9") + + terminalProgramID = solana.MustPublicKeyFromBase58("term9YPb9mzAsABaqN71A4xdbxHmpBNZavpBiQKZzN3") ) // instruction discriminators -const ( - pumpCreateCoinIX = uint8(24) - pumpCreateCoinV2IX = uint8(214) - pumpExtendedSellIX = uint8(51) - pumpBuyTokensIX = uint8(102) - - azczBuyTokensIX = uint8(11) - f5tfBuyTokensIX = uint8(0) - flasBuyTokensIX = uint8(0) - - pumpAmmBuyTokensIX = uint8(102) - _6hb1BuyTokensIX = uint8(0) - - qtkvBuyTokensIX = uint8(0x02) -) - var ( + pumpCreateCoinIX = []byte{24, 30, 200, 40, 5, 28, 7, 119} + pumpCreateCoinV2IX = []byte{214, 144, 76, 236, 95, 139, 49, 180} + pumpExtendedSellIX = []byte{51, 230, 133, 164, 1, 127, 131, 173} + pumpBuyTokensIX = []byte{102, 6, 61, 18, 1, 218, 235, 234} + pumpBuyV2TokensIX = []byte{56, 252, 116, 8, 158, 223, 205, 95} + + azczBuyTokensIX = []byte{11} + azczAmmBuyTokensIX = []byte{0xf} + + f5tfBuyTokensIX = []byte{0} + + flasBuyTokensIX = []byte{0x00, 0x1, 0x4} + flasSellTokensIX = []byte{0x01, 0x1, 0x3} + flasAmmBuyTokensIX = []byte{0x00, 0x2, 0x2} + flasAmmSellTokensIX = []byte{0x01, 0x2, 0x2} + + pumpAmmBuyTokensV2IX = []byte{198, 46, 21, 82, 180, 217, 232, 112} + pumpAmmBuyTokensIX = []byte{102, 6, 61, 18, 1, 218, 235, 234} + pumpAmmSellTokensIX = []byte{51, 230, 133, 164, 1, 127, 131, 173} + + qtkvBuyTokensIX = []byte{0x02} + qtkvSellTokensIX = []byte{0x03} + qtkvAmmSellTokensIX = []byte{0x05} + boboBuyPumpTokensIX = []byte{0xff, 0xe7, 0x11, 0x53, 0x15, 0xc5, 0xc3, 0xdf} fjszBuyTokensIX = []byte{0xe7, 0x3f, 0x99, 0x83, 0xf3, 0xed, 0xe3, 0x3c} - _8rsrBuyTokensIX = []byte{0xd9, 0xa1, 0x42, 0x0c, 0xbb, 0xc4, 0xe8, 0x30} photonBuyPumpTokensIX = []byte{0x52, 0xe1, 0x77, 0xe7, 0x4e, 0x1d, 0x2d, 0x46} photonSwapPumpAmmIX = []byte{0x2c, 0x77, 0xaf, 0xda, 0xc7, 0x4d, 0xc4, 0xeb} + + terminalBuyTokensIX = []byte{0xa6, 0x54, 0x14, 0x96, 0x9f, 0x77, 0x59, 0xca} + terminalSellTokensIX = []byte{0xbe, 0x84, 0xa2, 0x96, 0x93, 0x7c, 0xf8, 0x6b} + terminalAmmSellTokensIX = []byte{0x40, 0x64, 0x97, 0xb9, 0x16, 0xfa, 0xec, 0xb1} ) // table lookups const ( - _6hb1TableLookup1 = "GwME2SEvkgtiL5d2UeR2ZCsEecvg879majGF5pAA1aTS" - _6hb1TableLookup2 = "7RKtfATWCe98ChuwecNq8XCzAzfoK3DtZTprFsPMGtio" - _8rsrTableLookup1 = "DSaHkhDp17UexbZsg2VUnWjEuTwKNCJrnG4LW122ANfd" photonTableLookup = "3r6paeFSLpeUVmWtShb5uZtXYpcBE3729kUxkUS7xKi1" ) @@ -174,17 +193,17 @@ type fjszBuyArgs struct { } // ParseTransaction mirrors the Rust parse_transaction entry point. -func ParseTransaction(update *shreder_protos.SubscribeUpdateTransaction) []*types.TxSignal { +func ParseTransaction(update *SubscribeUpdateTransaction) []*TxSignal { versioned, err := toVersionedTransaction(update) if err != nil || versioned == nil || len(versioned.Signatures) == 0 { return nil } - txHash := versioned.Signatures[0].String() + txHash := versioned.Signatures[0] staticKeys := versioned.Message.StaticAccountKeys instructions := versioned.Message.Instructions - var parsed []*types.TxSignal + var parsed []*TxSignal for i := range instructions { inst := instructions[i] @@ -192,7 +211,7 @@ func ParseTransaction(update *shreder_protos.SubscribeUpdateTransaction) []*type continue } - programID := staticKeys[inst.ProgramIDIndex].String() + programID := staticKeys[inst.ProgramIDIndex] switch programID { case pumpProgramID: txRes, err := parsePumpInstruction(versioned, i) @@ -212,12 +231,6 @@ func ParseTransaction(update *shreder_protos.SubscribeUpdateTransaction) []*type case pumpAmmProgramID: txRes, err := parsePumpAmmInstruction(versioned, i) parsed = appendParsed(parsed, txRes, err, txHash, "pumpamm") - case _6hb1ProgramID: - txRes, err := parse6hb1Instruction(versioned, i) - parsed = appendParsed(parsed, txRes, err, txHash, "6hb1") - case _8rsrProgramID: - txRes, err := parse8rsrInstruction(versioned, i) - parsed = appendParsed(parsed, txRes, err, txHash, "8rsr") case boboProgramID: txRes, err := parseBoboInstruction(versioned, i) parsed = appendParsed(parsed, txRes, err, txHash, "bobo") @@ -227,15 +240,18 @@ func ParseTransaction(update *shreder_protos.SubscribeUpdateTransaction) []*type case fjszProgramID: txRes, err := parseFjszInstruction(versioned, i) parsed = appendParsed(parsed, txRes, err, txHash, "fjsz") + case terminalProgramID: + txRes, err := parseTermInstruction(versioned, i) + parsed = appendParsed(parsed, txRes, err, txHash, "terminal") } } return parsed } -func appendParsed(list []*types.TxSignal, parsed *types.TxSignal, err error, txHash string, label string) []*types.TxSignal { +func appendParsed(list []*TxSignal, parsed *TxSignal, err error, txHash [64]byte, label string) []*TxSignal { if err != nil { - log.Printf("txparser: failed to parse %s instruction: %v, tx_hash: %s", label, err, txHash) + slog.Error("txparser: failed to parse", "label", label, "instruction", err, "tx_hash", base58.Encode(txHash[:])) return list } if parsed != nil { @@ -244,7 +260,7 @@ func appendParsed(list []*types.TxSignal, parsed *types.TxSignal, err error, txH return list } -func toVersionedTransaction(update *shreder_protos.SubscribeUpdateTransaction) (*versionedTransaction, error) { +func toVersionedTransaction(update *SubscribeUpdateTransaction) (*versionedTransaction, error) { if update == nil || update.Transaction == nil || update.Transaction.Message == nil { return nil, fmt.Errorf("transaction is nil") } @@ -311,32 +327,31 @@ func getStaticKey(static []solana.PublicKey, index int) (solana.PublicKey, error return static[index], nil } -func parsePumpInstruction(tx *versionedTransaction, instructionIndex int) (*types.TxSignal, error) { +func parsePumpInstruction(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { msg := tx.Message if instructionIndex >= len(msg.Instructions) { return nil, fmt.Errorf("instruction index out of bounds") } instruction := msg.Instructions[instructionIndex] - if len(instruction.Data) == 0 { + if len(instruction.Data) < 8 { return nil, fmt.Errorf("data is empty") } - switch instruction.Data[0] { - case pumpBuyTokensIX: + if matchMethod(instruction.Data[0:8], pumpBuyV2TokensIX) || matchMethod(instruction.Data[0:8], pumpBuyTokensIX) { return parsePumpBuy(tx, &instruction) - case pumpExtendedSellIX: + } else if matchMethod(instruction.Data[0:8], pumpExtendedSellIX) { return parsePumpSell(tx, &instruction) - case pumpCreateCoinIX: + } else if matchMethod(instruction.Data[0:8], pumpCreateCoinIX) { return parsePumpCreate(tx, &instruction) - case pumpCreateCoinV2IX: + } else if matchMethod(instruction.Data[0:8], pumpCreateCoinV2IX) { return parsePumpCreateV2(tx, &instruction) - default: - return nil, nil } + return nil, nil + } -func parsePumpCreate(tx *versionedTransaction, instruction *compiledInstruction) (*types.TxSignal, error) { +func parsePumpCreate(tx *versionedTransaction, instruction *compiledInstruction) (*TxSignal, error) { if len(instruction.Accounts) < 8 { return nil, fmt.Errorf("accounts too short") } @@ -351,7 +366,7 @@ func parsePumpCreate(tx *versionedTransaction, instruction *compiledInstruction) return nil, err } - return &types.TxSignal{ + return &TxSignal{ TxHash: tx.Signatures[0].String(), Maker: creator.String(), Token0Address: mint.String(), @@ -368,7 +383,7 @@ func parsePumpCreate(tx *versionedTransaction, instruction *compiledInstruction) }, nil } -func parsePumpCreateV2(tx *versionedTransaction, instruction *compiledInstruction) (*types.TxSignal, error) { +func parsePumpCreateV2(tx *versionedTransaction, instruction *compiledInstruction) (*TxSignal, error) { if len(instruction.Accounts) < 8 { return nil, fmt.Errorf("accounts too short") } @@ -391,7 +406,7 @@ func parsePumpCreateV2(tx *versionedTransaction, instruction *compiledInstructio return nil, fmt.Errorf("failed to parse create coin v2 args: %w", err) } - return &types.TxSignal{ + return &TxSignal{ TxHash: tx.Signatures[0].String(), Maker: args.Creator.String(), Token0Address: mint.String(), @@ -427,11 +442,18 @@ func decodePumpBuyArgs(data []byte) (uint64, uint64, error) { return 0, 0, fmt.Errorf("failed to parse buy tokens args") } -func parsePumpBuy(tx *versionedTransaction, instruction *compiledInstruction) (*types.TxSignal, error) { - amount, maxSol, err := decodePumpBuyArgs(instruction.Data) +func parsePumpBuy(tx *versionedTransaction, instruction *compiledInstruction) (*TxSignal, error) { + amount, sol, err := decodePumpBuyArgs(instruction.Data) if err != nil { return nil, err } + exactIn := false + if matchMethod(instruction.Data, pumpBuyV2TokensIX) { + temp := amount + amount = sol + sol = temp + exactIn = true + } if len(instruction.Accounts) < 7 { return nil, fmt.Errorf("accounts too short") @@ -447,20 +469,21 @@ func parsePumpBuy(tx *versionedTransaction, instruction *compiledInstruction) (* return nil, err } - return &types.TxSignal{ + return &TxSignal{ TxHash: tx.Signatures[0].String(), Maker: buyer.String(), Token0Address: mint.String(), Token1Address: wsolMint, Token0Amount: formatTokenAmount(amount), - Token1Amount: formatSolAmount(maxSol), + Token1Amount: formatSolAmount(sol), Program: "Pump", Event: "buy", + ExactSOL: exactIn, IsToken2022: false, IsMayhemMode: false, Block: tx.Block, Token0AmountUint64: amount, - Token1AmountUint64: maxSol, + Token1AmountUint64: sol, }, nil } @@ -483,7 +506,7 @@ func decodePumpSellArgs(data []byte) (uint64, uint64, error) { return 0, 0, fmt.Errorf("failed to parse sell tokens args") } -func parsePumpSell(tx *versionedTransaction, instruction *compiledInstruction) (*types.TxSignal, error) { +func parsePumpSell(tx *versionedTransaction, instruction *compiledInstruction) (*TxSignal, error) { amount, minSol, err := decodePumpSellArgs(instruction.Data) if err != nil { return nil, err @@ -503,7 +526,7 @@ func parsePumpSell(tx *versionedTransaction, instruction *compiledInstruction) ( return nil, err } - return &types.TxSignal{ + return &TxSignal{ TxHash: tx.Signatures[0].String(), Maker: seller.String(), Token0Address: mint.String(), @@ -520,7 +543,7 @@ func parsePumpSell(tx *versionedTransaction, instruction *compiledInstruction) ( }, nil } -func parseAzczInstruction(tx *versionedTransaction, instructionIndex int) (*types.TxSignal, error) { +func parseAzczInstruction(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { msg := tx.Message if instructionIndex >= len(msg.Instructions) { return nil, fmt.Errorf("instruction index out of bounds") @@ -531,15 +554,61 @@ func parseAzczInstruction(tx *versionedTransaction, instructionIndex int) (*type return nil, fmt.Errorf("data is empty") } - if instruction.Data[0] != azczBuyTokensIX { - return nil, nil + if matchMethod(instruction.Data, azczBuyTokensIX) { + return parseAzczBuy(tx, instructionIndex) + } else if matchMethod(instruction.Data, azczAmmBuyTokensIX) { + return parseAzczAmmBuy(tx, instructionIndex) } + return nil, nil +} +func parseAzczAmmBuy(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { + instruction := tx.Message.Instructions[instructionIndex] if len(instruction.Accounts) < 8 { return nil, fmt.Errorf("accounts too short") } - staticKeys := msg.StaticAccountKeys + staticKeys := tx.Message.StaticAccountKeys + mint, err := getStaticKey(staticKeys, int(instruction.Accounts[3])) + if err != nil { + return nil, err + } + user, err := getStaticKey(staticKeys, int(instruction.Accounts[1])) + if err != nil { + return nil, err + } + + if len(instruction.Data) < 17 { + return nil, fmt.Errorf("data too short for buy args") + } + + solAmount := binary.LittleEndian.Uint64(instruction.Data[1:9]) + + return &TxSignal{ + TxHash: tx.Signatures[0].String(), + Maker: user.String(), + Token0Address: mint.String(), + Token1Address: wsolMint, + Token0Amount: decimal.Zero, + Token1Amount: formatSolAmount(solAmount), + Program: "Pump", + Event: "buy", + IsToken2022: false, + IsMayhemMode: false, + ExactSOL: true, + Block: tx.Block, + Token0AmountUint64: 0, + Token1AmountUint64: solAmount, + }, nil +} + +func parseAzczBuy(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { + instruction := tx.Message.Instructions[instructionIndex] + if len(instruction.Accounts) < 8 { + return nil, fmt.Errorf("accounts too short") + } + + staticKeys := tx.Message.StaticAccountKeys mint, err := getStaticKey(staticKeys, int(instruction.Accounts[3])) if err != nil { return nil, err @@ -558,7 +627,7 @@ func parseAzczInstruction(tx *versionedTransaction, instructionIndex int) (*type return nil, fmt.Errorf("failed to parse buy tokens args: %w", err) } - return &types.TxSignal{ + return &TxSignal{ TxHash: tx.Signatures[0].String(), Maker: user.String(), Token0Address: mint.String(), @@ -575,7 +644,7 @@ func parseAzczInstruction(tx *versionedTransaction, instructionIndex int) (*type }, nil } -func parseF5tfInstruction(tx *versionedTransaction, instructionIndex int) (*types.TxSignal, error) { +func parseF5tfInstruction(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { msg := tx.Message if instructionIndex >= len(msg.Instructions) { return nil, fmt.Errorf("instruction index out of bounds") @@ -585,8 +654,7 @@ func parseF5tfInstruction(tx *versionedTransaction, instructionIndex int) (*type if len(instruction.Data) == 0 { return nil, fmt.Errorf("data is empty") } - - if instruction.Data[0] != f5tfBuyTokensIX { + if !matchMethod(instruction.Data, f5tfBuyTokensIX) { return nil, nil } @@ -613,7 +681,7 @@ func parseF5tfInstruction(tx *versionedTransaction, instructionIndex int) (*type return nil, fmt.Errorf("failed to parse buy tokens args: %w", err) } - return &types.TxSignal{ + return &TxSignal{ TxHash: tx.Signatures[0].String(), Maker: user.String(), Token0Address: mint.String(), @@ -630,7 +698,7 @@ func parseF5tfInstruction(tx *versionedTransaction, instructionIndex int) (*type }, nil } -func parseFlasInstruction(tx *versionedTransaction, instructionIndex int) (*types.TxSignal, error) { +func parseFlasInstruction(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { msg := tx.Message if instructionIndex >= len(msg.Instructions) { return nil, fmt.Errorf("instruction index out of bounds") @@ -640,16 +708,148 @@ func parseFlasInstruction(tx *versionedTransaction, instructionIndex int) (*type if len(instruction.Data) == 0 { return nil, fmt.Errorf("data is empty") } - - if instruction.Data[0] != flasBuyTokensIX { + if len(instruction.Data) < 20 { + return nil, fmt.Errorf("data too short for args") + } + methodData := instruction.Data[17:20] + if !matchMethod(methodData, flasBuyTokensIX) { return nil, nil } + if matchMethod(methodData, f5tfBuyTokensIX) { + return parseFlasBuy(tx, instructionIndex) + } else if matchMethod(methodData, flasSellTokensIX) { + return parseFlasSell(tx, instructionIndex) + } else if matchMethod(methodData, flasAmmBuyTokensIX) { + return parseFlasAmmBuy(tx, instructionIndex) + } else if matchMethod(methodData, flasAmmSellTokensIX) { + return parseFlasAmmSell(tx, instructionIndex) + } + return nil, nil +} +func parseFlasAmmSell(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { + instruction := tx.Message.Instructions[instructionIndex] + if len(instruction.Accounts) < 10 { + return nil, fmt.Errorf("accounts too short") + } + + staticKeys := tx.Message.StaticAccountKeys + mint, err := getStaticKey(staticKeys, int(instruction.Accounts[9])) + if err != nil { + return nil, err + } + user, err := getStaticKey(staticKeys, int(instruction.Accounts[1])) + if err != nil { + return nil, err + } + + var args flasBuyArgs + if err := borsh.Deserialize(&args, instruction.Data[1:]); err != nil { + return nil, fmt.Errorf("failed to parse buy tokens args: %w", err) + } + + return &TxSignal{ + TxHash: tx.Signatures[0].String(), + Maker: user.String(), + Token0Address: mint.String(), + Token1Address: wsolMint, + Token0Amount: decimal.Zero, + Token1Amount: formatSolAmount(args.TokenAmount), + Program: "Pump", + Event: "sell", + IsToken2022: false, + IsMayhemMode: false, + ExactSOL: true, + Block: tx.Block, + Token0AmountUint64: 0, + Token1AmountUint64: args.TokenAmount, + }, nil +} + +func parseFlasAmmBuy(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { + instruction := tx.Message.Instructions[instructionIndex] + if len(instruction.Accounts) < 10 { + return nil, fmt.Errorf("accounts too short") + } + + staticKeys := tx.Message.StaticAccountKeys + mint, err := getStaticKey(staticKeys, int(instruction.Accounts[9])) + if err != nil { + return nil, err + } + user, err := getStaticKey(staticKeys, int(instruction.Accounts[1])) + if err != nil { + return nil, err + } + + var args flasBuyArgs + if err := borsh.Deserialize(&args, instruction.Data[1:]); err != nil { + return nil, fmt.Errorf("failed to parse buy tokens args: %w", err) + } + + return &TxSignal{ + TxHash: tx.Signatures[0].String(), + Maker: user.String(), + Token0Address: mint.String(), + Token1Address: wsolMint, + Token0Amount: decimal.Zero, + Token1Amount: formatSolAmount(args.TokenAmount), + Program: "Pump", + Event: "sell", + IsToken2022: false, + IsMayhemMode: false, + ExactSOL: true, + Block: tx.Block, + Token0AmountUint64: 0, + Token1AmountUint64: args.TokenAmount, + }, nil +} + +func parseFlasSell(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { + instruction := tx.Message.Instructions[instructionIndex] if len(instruction.Accounts) < 9 { return nil, fmt.Errorf("accounts too short") } - staticKeys := msg.StaticAccountKeys + staticKeys := tx.Message.StaticAccountKeys + mint, err := getStaticKey(staticKeys, int(instruction.Accounts[8])) + if err != nil { + return nil, err + } + user, err := getStaticKey(staticKeys, int(instruction.Accounts[1])) + if err != nil { + return nil, err + } + + var args flasBuyArgs + if err := borsh.Deserialize(&args, instruction.Data[1:]); err != nil { + return nil, fmt.Errorf("failed to parse buy tokens args: %w", err) + } + + return &TxSignal{ + TxHash: tx.Signatures[0].String(), + Maker: user.String(), + Token0Address: mint.String(), + Token1Address: wsolMint, + Token0Amount: formatTokenAmount(args.TokenAmount), + Token1Amount: formatSolAmount(args.SolAmount), + Program: "Pump", + Event: "sell", + IsToken2022: false, + IsMayhemMode: false, + Block: tx.Block, + Token0AmountUint64: args.TokenAmount, + Token1AmountUint64: args.SolAmount, + }, nil +} + +func parseFlasBuy(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { + instruction := tx.Message.Instructions[instructionIndex] + if len(instruction.Accounts) < 9 { + return nil, fmt.Errorf("accounts too short") + } + + staticKeys := tx.Message.StaticAccountKeys mint, err := getStaticKey(staticKeys, int(instruction.Accounts[8])) if err != nil { return nil, err @@ -659,16 +859,12 @@ func parseFlasInstruction(tx *versionedTransaction, instructionIndex int) (*type return nil, err } - if len(instruction.Data) < 2 { - return nil, fmt.Errorf("data too short for buy args") - } - var args flasBuyArgs if err := borsh.Deserialize(&args, instruction.Data[1:]); err != nil { return nil, fmt.Errorf("failed to parse buy tokens args: %w", err) } - return &types.TxSignal{ + return &TxSignal{ TxHash: tx.Signatures[0].String(), Maker: user.String(), Token0Address: mint.String(), @@ -679,13 +875,14 @@ func parseFlasInstruction(tx *versionedTransaction, instructionIndex int) (*type Event: "buy", IsToken2022: false, IsMayhemMode: false, + ExactSOL: true, Block: tx.Block, Token0AmountUint64: args.TokenAmount, Token1AmountUint64: args.SolAmount, }, nil } -func parsePhotonInstruction(tx *versionedTransaction, instructionIndex int) (*types.TxSignal, error) { +func parsePhotonInstruction(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { msg := tx.Message if instructionIndex >= len(msg.Instructions) { return nil, fmt.Errorf("instruction index out of bounds") @@ -709,7 +906,7 @@ func parsePhotonInstruction(tx *versionedTransaction, instructionIndex int) (*ty } } -func parsePhotonBuy(tx *versionedTransaction, instruction *compiledInstruction) (*types.TxSignal, error) { +func parsePhotonBuy(tx *versionedTransaction, instruction *compiledInstruction) (*TxSignal, error) { if len(instruction.Accounts) < 8 { return nil, fmt.Errorf("accounts too short") } @@ -733,7 +930,7 @@ func parsePhotonBuy(tx *versionedTransaction, instruction *compiledInstruction) } solAmount := args.SolAmount * (100000000 - 1234568) / 100000000 - return &types.TxSignal{ + return &TxSignal{ TxHash: tx.Signatures[0].String(), Maker: user.String(), Token0Address: mint.String(), @@ -750,7 +947,7 @@ func parsePhotonBuy(tx *versionedTransaction, instruction *compiledInstruction) }, nil } -func parsePhotonSwap(tx *versionedTransaction, instruction *compiledInstruction) (*types.TxSignal, error) { +func parsePhotonSwap(tx *versionedTransaction, instruction *compiledInstruction) (*TxSignal, error) { if len(instruction.Accounts) < 8 { return nil, fmt.Errorf("accounts too short") } @@ -789,7 +986,7 @@ func parsePhotonSwap(tx *versionedTransaction, instruction *compiledInstruction) } solAmount := args.FromAmount * (100000000 - 1234568) / 100000000 - return &types.TxSignal{ + return &TxSignal{ TxHash: tx.Signatures[0].String(), Maker: buyer.String(), Token0Address: base.String(), @@ -806,7 +1003,7 @@ func parsePhotonSwap(tx *versionedTransaction, instruction *compiledInstruction) }, nil } -func parsePumpAmmInstruction(tx *versionedTransaction, instructionIndex int) (*types.TxSignal, error) { +func parsePumpAmmInstruction(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { msg := tx.Message if instructionIndex >= len(msg.Instructions) { return nil, fmt.Errorf("instruction index out of bounds") @@ -817,11 +1014,143 @@ func parsePumpAmmInstruction(tx *versionedTransaction, instructionIndex int) (*t return nil, fmt.Errorf("data is empty") } - if instruction.Data[0] != pumpAmmBuyTokensIX { + if matchMethod(instruction.Data, pumpAmmBuyTokensIX) || matchMethod(instruction.Data, pumpAmmBuyTokensV2IX) { + return parsePumpAmmBuy(tx, &instruction) + } else if matchMethod(instruction.Data, pumpAmmSellTokensIX) { + return parsePumpAmmSell(tx, &instruction) + } + + return nil, nil + +} + +func parseTermInstruction(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { + msg := tx.Message + if instructionIndex >= len(msg.Instructions) { + return nil, fmt.Errorf("instruction index out of bounds") + } + + instruction := msg.Instructions[instructionIndex] + if len(instruction.Data) == 0 { + return nil, fmt.Errorf("data is empty") + } + if len(instruction.Data) < 24 { return nil, nil } - return parsePumpAmmBuy(tx, &instruction) + switch { + case bytes.Equal(instruction.Data[:8], terminalBuyTokensIX): + return parseTermBuy(tx, &instruction) + case bytes.Equal(instruction.Data[:8], terminalSellTokensIX): + return parseTermSell(tx, &instruction) + case bytes.Equal(instruction.Data[:8], terminalAmmSellTokensIX): + return parseTermAmmSell(tx, &instruction) + default: + return nil, nil + } +} + +func parseTermAmmSell(tx *versionedTransaction, instruction *compiledInstruction) (*TxSignal, error) { + if len(instruction.Accounts) < 8 { + return nil, fmt.Errorf("accounts too short") + } + staticKeys := tx.Message.StaticAccountKeys + mint, err := getStaticKey(staticKeys, int(instruction.Accounts[3])) + if err != nil { + return nil, err + } + user, err := getStaticKey(staticKeys, int(instruction.Accounts[1])) + if err != nil { + return nil, err + } + + solAmount := binary.LittleEndian.Uint64(instruction.Data[8:16]) + tokenAmount := binary.LittleEndian.Uint64(instruction.Data[16:24]) + + return &TxSignal{ + TxHash: tx.Signatures[0].String(), + Maker: user.String(), + Token0Address: mint.String(), + Token1Address: wsolMint, + Token0Amount: formatTokenAmount(tokenAmount), + Token1Amount: formatSolAmount(solAmount), + Program: "Pump", + Event: "buy", + IsToken2022: false, + IsMayhemMode: false, + ExactSOL: true, + Block: tx.Block, + Token0AmountUint64: tokenAmount, + Token1AmountUint64: solAmount, + }, nil +} + +func parseTermBuy(tx *versionedTransaction, instruction *compiledInstruction) (*TxSignal, error) { + if len(instruction.Accounts) < 8 { + return nil, fmt.Errorf("accounts too short") + } + staticKeys := tx.Message.StaticAccountKeys + mint, err := getStaticKey(staticKeys, int(instruction.Accounts[2])) + if err != nil { + return nil, err + } + user, err := getStaticKey(staticKeys, int(instruction.Accounts[6])) + if err != nil { + return nil, err + } + + solAmount := binary.LittleEndian.Uint64(instruction.Data[8:16]) + tokenAmount := binary.LittleEndian.Uint64(instruction.Data[16:24]) + + return &TxSignal{ + TxHash: tx.Signatures[0].String(), + Maker: user.String(), + Token0Address: mint.String(), + Token1Address: wsolMint, + Token0Amount: formatTokenAmount(tokenAmount), + Token1Amount: formatSolAmount(solAmount), + Program: "Pump", + Event: "buy", + IsToken2022: false, + IsMayhemMode: false, + Block: tx.Block, + Token0AmountUint64: tokenAmount, + Token1AmountUint64: solAmount, + }, nil +} + +func parseTermSell(tx *versionedTransaction, instruction *compiledInstruction) (*TxSignal, error) { + if len(instruction.Accounts) < 8 { + return nil, fmt.Errorf("accounts too short") + } + staticKeys := tx.Message.StaticAccountKeys + mint, err := getStaticKey(staticKeys, int(instruction.Accounts[2])) + if err != nil { + return nil, err + } + user, err := getStaticKey(staticKeys, int(instruction.Accounts[6])) + if err != nil { + return nil, err + } + + tokenAmount := binary.LittleEndian.Uint64(instruction.Data[8:16]) + solAmount := binary.LittleEndian.Uint64(instruction.Data[16:24]) + + return &TxSignal{ + TxHash: tx.Signatures[0].String(), + Maker: user.String(), + Token0Address: mint.String(), + Token1Address: wsolMint, + Token0Amount: formatTokenAmount(tokenAmount), + Token1Amount: formatSolAmount(solAmount), + Program: "Pump", + Event: "buy", + IsToken2022: false, + IsMayhemMode: false, + Block: tx.Block, + Token0AmountUint64: tokenAmount, + Token1AmountUint64: solAmount, + }, nil } func decodePumpAmmBuyArgs(data []byte) (uint64, uint64, error) { @@ -843,11 +1172,65 @@ func decodePumpAmmBuyArgs(data []byte) (uint64, uint64, error) { return 0, 0, fmt.Errorf("failed to parse buy tokens args") } -func parsePumpAmmBuy(tx *versionedTransaction, instruction *compiledInstruction) (*types.TxSignal, error) { +func parsePumpAmmBuy(tx *versionedTransaction, instruction *compiledInstruction) (*TxSignal, error) { amount, maxSol, err := decodePumpAmmBuyArgs(instruction.Data) if err != nil { return nil, err } + exactIn := false + if matchMethod(instruction.Data, pumpAmmBuyTokensV2IX) { + temp := amount + amount = maxSol + maxSol = temp + exactIn = true + } + + if len(instruction.Accounts) < 7 { + return nil, fmt.Errorf("accounts too short") + } + + staticKeys := tx.Message.StaticAccountKeys + base, err := getStaticKey(staticKeys, int(instruction.Accounts[3])) + if err != nil { + return nil, err + } + quoteIndex := int(instruction.Accounts[4]) + quote, err := resolveQuoteAccount(tx, quoteIndex, nil, 0) + if err != nil { + return nil, err + } + if quote != wsolMint { + return nil, nil + } + + buyer, err := getStaticKey(staticKeys, int(instruction.Accounts[1])) + if err != nil { + return nil, err + } + + return &TxSignal{ + TxHash: tx.Signatures[0].String(), + Maker: buyer.String(), + Token0Address: base.String(), + Token1Address: wsolMint, + Token0Amount: formatTokenAmount(amount), + Token1Amount: formatSolAmount(maxSol), + Program: "PumpAMM", + Event: "buy", + IsToken2022: false, + IsMayhemMode: false, + ExactSOL: exactIn, + Block: tx.Block, + Token0AmountUint64: amount, + Token1AmountUint64: maxSol, + }, nil +} + +func parsePumpAmmSell(tx *versionedTransaction, instruction *compiledInstruction) (*TxSignal, error) { + amount, minSol, err := decodePumpAmmBuyArgs(instruction.Data) + if err != nil { + return nil, err + } if len(instruction.Accounts) < 7 { return nil, fmt.Errorf("accounts too short") @@ -872,161 +1255,24 @@ func parsePumpAmmBuy(tx *versionedTransaction, instruction *compiledInstruction) return nil, err } - return &types.TxSignal{ + return &TxSignal{ TxHash: tx.Signatures[0].String(), Maker: buyer.String(), Token0Address: base.String(), Token1Address: wsolMint, Token0Amount: formatTokenAmount(amount), - Token1Amount: formatSolAmount(maxSol), + Token1Amount: formatSolAmount(minSol), Program: "PumpAMM", - Event: "buy", + Event: "sell", IsToken2022: false, IsMayhemMode: false, Block: tx.Block, Token0AmountUint64: amount, - Token1AmountUint64: maxSol, + Token1AmountUint64: minSol, }, nil } -func parse6hb1Instruction(tx *versionedTransaction, instructionIndex int) (*types.TxSignal, error) { - msg := tx.Message - if instructionIndex >= len(msg.Instructions) { - return nil, fmt.Errorf("instruction index out of bounds") - } - - instruction := msg.Instructions[instructionIndex] - if len(instruction.Data) == 0 { - return nil, fmt.Errorf("data is empty") - } - - if instruction.Data[0] != _6hb1BuyTokensIX { - return nil, nil - } - - return parse6hb1Buy(tx, &instruction) -} - -func parse6hb1Buy(tx *versionedTransaction, instruction *compiledInstruction) (*types.TxSignal, error) { - if len(instruction.Accounts) < 7 { - return nil, fmt.Errorf("accounts too short") - } - - staticKeys := tx.Message.StaticAccountKeys - base, err := getStaticKey(staticKeys, int(instruction.Accounts[3])) - if err != nil { - return nil, err - } - - quoteIndex := int(instruction.Accounts[4]) - quote, err := resolveQuoteAccount(tx, quoteIndex, []string{_6hb1TableLookup1, _6hb1TableLookup2}, 7) - if err != nil { - return nil, err - } - if quote != wsolMint { - return nil, nil - } - - buyer, err := getStaticKey(staticKeys, int(instruction.Accounts[1])) - if err != nil { - return nil, err - } - - if len(instruction.Data) < 2 { - return nil, fmt.Errorf("data too short for buy args") - } - - var args _6hb1BuyArgs - if err := borsh.Deserialize(&args, instruction.Data[1:]); err != nil { - return nil, fmt.Errorf("failed to parse buy tokens args: %w", err) - } - - return &types.TxSignal{ - TxHash: tx.Signatures[0].String(), - Maker: buyer.String(), - Token0Address: base.String(), - Token1Address: wsolMint, - Token0Amount: formatTokenAmount(args.TokenNumber), - Token1Amount: formatSolAmount(args.SolAmount), - Program: "PumpAMM", - Event: "buy", - IsToken2022: false, - IsMayhemMode: false, - Block: tx.Block, - Token0AmountUint64: args.TokenNumber, - Token1AmountUint64: args.SolAmount, - }, nil -} - -func parse8rsrInstruction(tx *versionedTransaction, instructionIndex int) (*types.TxSignal, error) { - msg := tx.Message - if instructionIndex >= len(msg.Instructions) { - return nil, fmt.Errorf("instruction index out of bounds") - } - - instruction := msg.Instructions[instructionIndex] - if len(instruction.Data) == 0 { - return nil, fmt.Errorf("data is empty") - } - - if len(instruction.Data) < 8 || !bytes.Equal(instruction.Data[:8], _8rsrBuyTokensIX) { - return nil, nil - } - - return parse8rsrBuy(tx, &instruction) -} - -func parse8rsrBuy(tx *versionedTransaction, instruction *compiledInstruction) (*types.TxSignal, error) { - if len(instruction.Accounts) < 7 { - return nil, fmt.Errorf("accounts too short") - } - if len(instruction.Data) < 16 { - return nil, fmt.Errorf("data too short for buy args") - } - - staticKeys := tx.Message.StaticAccountKeys - base, err := getStaticKey(staticKeys, int(instruction.Accounts[3])) - if err != nil { - return nil, err - } - - quoteIndex := int(instruction.Accounts[4]) - quote, err := resolveQuoteAccount(tx, quoteIndex, []string{_8rsrTableLookup1}, 1) - if err != nil { - return nil, err - } - if quote != wsolMint { - return nil, nil - } - - buyer, err := getStaticKey(staticKeys, int(instruction.Accounts[1])) - if err != nil { - return nil, err - } - - var args _8rsrBuyArgs - if err := borsh.Deserialize(&args, instruction.Data[8:]); err != nil { - return nil, fmt.Errorf("failed to parse buy tokens args: %w", err) - } - - return &types.TxSignal{ - TxHash: tx.Signatures[0].String(), - Maker: buyer.String(), - Token0Address: base.String(), - Token1Address: wsolMint, - Token0Amount: formatTokenAmount(args.TokenOut), - Token1Amount: formatSolAmount(args.SolIn), - Program: "PumpAMM", - Event: "buy", - IsToken2022: false, - IsMayhemMode: false, - Block: tx.Block, - Token0AmountUint64: args.TokenOut, - Token1AmountUint64: args.SolIn, - }, nil -} - -func parseBoboInstruction(tx *versionedTransaction, instructionIndex int) (*types.TxSignal, error) { +func parseBoboInstruction(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { msg := tx.Message if instructionIndex >= len(msg.Instructions) { return nil, fmt.Errorf("instruction index out of bounds") @@ -1062,7 +1308,7 @@ func parseBoboInstruction(tx *versionedTransaction, instructionIndex int) (*type return nil, fmt.Errorf("failed to parse buy tokens args: %w", err) } - return &types.TxSignal{ + return &TxSignal{ TxHash: tx.Signatures[0].String(), Maker: user.String(), Token0Address: mint.String(), @@ -1079,7 +1325,7 @@ func parseBoboInstruction(tx *versionedTransaction, instructionIndex int) (*type }, nil } -func parseQtkvInstruction(tx *versionedTransaction, instructionIndex int) (*types.TxSignal, error) { +func parseQtkvInstruction(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { msg := tx.Message if instructionIndex >= len(msg.Instructions) { return nil, fmt.Errorf("instruction index out of bounds") @@ -1090,12 +1336,95 @@ func parseQtkvInstruction(tx *versionedTransaction, instructionIndex int) (*type return nil, fmt.Errorf("data is empty") } - if instruction.Data[0] != qtkvBuyTokensIX { - return nil, nil + if matchMethod(instruction.Data, qtkvBuyTokensIX) { + return parseQtkvBuy(tx, instructionIndex) + } else if matchMethod(instruction.Data, qtkvAmmSellTokensIX) { + return parseQtkvAmmSell(tx, instructionIndex) + } else if matchMethod(instruction.Data, qtkvSellTokensIX) { + return parseQtkvSell(tx, instructionIndex) } - if len(instruction.Data) < 2 { - return nil, fmt.Errorf("data too short for buy args") + + return nil, nil +} + +func parseQtkvSell(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { + instruction := tx.Message.Instructions[instructionIndex] + if len(instruction.Accounts) < 11 { + return nil, fmt.Errorf("accounts too short") } + if len(instruction.Data) < 24 { + return nil, fmt.Errorf("data too short for sell args") + } + + staticKeys := tx.Message.StaticAccountKeys + mint, err := getStaticKey(staticKeys, int(instruction.Accounts[10])) + if err != nil { + return nil, err + } + user, err := getStaticKey(staticKeys, int(instruction.Accounts[0])) + if err != nil { + return nil, err + } + + // in sell, sol amount is not directly provided, so we set it to 0 + tokenAmount := binary.LittleEndian.Uint64(instruction.Data[19:25]) + return &TxSignal{ + TxHash: tx.Signatures[0].String(), + Maker: user.String(), + Token0Address: mint.String(), + Token1Address: wsolMint, + Token0Amount: formatTokenAmount(tokenAmount), + Token1Amount: decimal.Zero, + Program: "Pump", + Event: "sell", + IsToken2022: false, + IsMayhemMode: false, + Block: tx.Block, + Token0AmountUint64: tokenAmount, + Token1AmountUint64: 0, + }, nil +} + +func parseQtkvAmmSell(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { + instruction := tx.Message.Instructions[instructionIndex] + if len(instruction.Accounts) < 11 { + return nil, fmt.Errorf("accounts too short") + } + if len(instruction.Data) < 24 { + return nil, fmt.Errorf("data too short for sell args") + } + + staticKeys := tx.Message.StaticAccountKeys + mint, err := getStaticKey(staticKeys, int(instruction.Accounts[10])) + if err != nil { + return nil, err + } + user, err := getStaticKey(staticKeys, int(instruction.Accounts[0])) + if err != nil { + return nil, err + } + + // in sell, sol amount is not directly provided, so we set it to 0 + tokenAmount := binary.LittleEndian.Uint64(instruction.Data[19:25]) + return &TxSignal{ + TxHash: tx.Signatures[0].String(), + Maker: user.String(), + Token0Address: mint.String(), + Token1Address: wsolMint, + Token0Amount: formatTokenAmount(tokenAmount), + Token1Amount: decimal.Zero, + Program: "PumpAMM", + Event: "sell", + IsToken2022: false, + IsMayhemMode: false, + Block: tx.Block, + Token0AmountUint64: tokenAmount, + Token1AmountUint64: 0, + }, nil +} + +func parseQtkvBuy(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { + instruction := tx.Message.Instructions[instructionIndex] if len(instruction.Accounts) < 8 { return nil, fmt.Errorf("accounts too short") } @@ -1115,7 +1444,7 @@ func parseQtkvInstruction(tx *versionedTransaction, instructionIndex int) (*type return nil, fmt.Errorf("failed to parse buy tokens args: %w", err) } - return &types.TxSignal{ + return &TxSignal{ TxHash: tx.Signatures[0].String(), Maker: user.String(), Token0Address: mint.String(), @@ -1132,7 +1461,7 @@ func parseQtkvInstruction(tx *versionedTransaction, instructionIndex int) (*type }, nil } -func parseFjszInstruction(tx *versionedTransaction, instructionIndex int) (*types.TxSignal, error) { +func parseFjszInstruction(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { msg := tx.Message if instructionIndex >= len(msg.Instructions) { return nil, fmt.Errorf("instruction index out of bounds") @@ -1143,7 +1472,7 @@ func parseFjszInstruction(tx *versionedTransaction, instructionIndex int) (*type return nil, fmt.Errorf("data is empty") } - if len(instruction.Data) < 8 || !bytes.Equal(instruction.Data[:8], fjszBuyTokensIX) { + if !matchMethod(instruction.Data, fjszBuyTokensIX) { return nil, nil } if len(instruction.Accounts) < 7 { @@ -1168,7 +1497,7 @@ func parseFjszInstruction(tx *versionedTransaction, instructionIndex int) (*type return nil, fmt.Errorf("failed to parse buy tokens args: %w", err) } - return &types.TxSignal{ + return &TxSignal{ TxHash: tx.Signatures[0].String(), Maker: user.String(), Token0Address: mint.String(), @@ -1185,6 +1514,27 @@ func parseFjszInstruction(tx *versionedTransaction, instructionIndex int) (*type }, nil } +func parseTerminalInstruction(tx *versionedTransaction, instructionIndex int) (*TxSignal, error) { + msg := tx.Message + if instructionIndex >= len(msg.Instructions) { + return nil, fmt.Errorf("instruction index out of bounds") + } + + instruction := msg.Instructions[instructionIndex] + if len(instruction.Data) == 0 { + return nil, fmt.Errorf("data is empty") + } + if matchMethod(instruction.Data, terminalBuyTokensIX) { + return parseTermBuy(tx, &instruction) + } else if matchMethod(instruction.Data, terminalSellTokensIX) { + return parseTermSell(tx, &instruction) + } else if matchMethod(instruction.Data, terminalAmmSellTokensIX) { + return parseTermAmmSell(tx, &instruction) + } + + return nil, nil +} + func resolveQuoteAccount(tx *versionedTransaction, quoteIndex int, expectedTableKeys []string, targetIndex uint8) (string, error) { staticKeys := tx.Message.StaticAccountKeys if quoteIndex < len(staticKeys) { @@ -1230,3 +1580,10 @@ func indexOf(haystack []uint8, needle uint8) int { } return -1 } + +func matchMethod(data []byte, methods []byte) bool { + if len(data) < len(methods) { + return false + } + return bytes.Equal(data[0:len(methods)], methods) +} diff --git a/third_party/shreder_protos/shreder.pb.go b/third_party/shreder_protos/shreder.pb.go deleted file mode 100644 index 282401f..0000000 --- a/third_party/shreder_protos/shreder.pb.go +++ /dev/null @@ -1,773 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.11 -// protoc v6.33.1 -// source: shreder.proto - -package shreder_protos - -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" - 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) -) - -type SubscribeEntriesRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SubscribeEntriesRequest) Reset() { - *x = SubscribeEntriesRequest{} - mi := &file_shreder_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SubscribeEntriesRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubscribeEntriesRequest) ProtoMessage() {} - -func (x *SubscribeEntriesRequest) ProtoReflect() protoreflect.Message { - mi := &file_shreder_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 SubscribeEntriesRequest.ProtoReflect.Descriptor instead. -func (*SubscribeEntriesRequest) Descriptor() ([]byte, []int) { - return file_shreder_proto_rawDescGZIP(), []int{0} -} - -type SubscribeTransactionsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Transactions map[string]*SubscribeRequestFilterTransactions `protobuf:"bytes,3,rep,name=transactions,proto3" json:"transactions,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SubscribeTransactionsRequest) Reset() { - *x = SubscribeTransactionsRequest{} - mi := &file_shreder_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SubscribeTransactionsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubscribeTransactionsRequest) ProtoMessage() {} - -func (x *SubscribeTransactionsRequest) ProtoReflect() protoreflect.Message { - mi := &file_shreder_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 SubscribeTransactionsRequest.ProtoReflect.Descriptor instead. -func (*SubscribeTransactionsRequest) Descriptor() ([]byte, []int) { - return file_shreder_proto_rawDescGZIP(), []int{1} -} - -func (x *SubscribeTransactionsRequest) GetTransactions() map[string]*SubscribeRequestFilterTransactions { - if x != nil { - return x.Transactions - } - return nil -} - -type SubscribeTransactionsResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Filters []string `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` - Transaction *SubscribeUpdateTransaction `protobuf:"bytes,4,opt,name=transaction,proto3" json:"transaction,omitempty"` - CreatedAt *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SubscribeTransactionsResponse) Reset() { - *x = SubscribeTransactionsResponse{} - mi := &file_shreder_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SubscribeTransactionsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubscribeTransactionsResponse) ProtoMessage() {} - -func (x *SubscribeTransactionsResponse) ProtoReflect() protoreflect.Message { - mi := &file_shreder_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 SubscribeTransactionsResponse.ProtoReflect.Descriptor instead. -func (*SubscribeTransactionsResponse) Descriptor() ([]byte, []int) { - return file_shreder_proto_rawDescGZIP(), []int{2} -} - -func (x *SubscribeTransactionsResponse) GetFilters() []string { - if x != nil { - return x.Filters - } - return nil -} - -func (x *SubscribeTransactionsResponse) GetTransaction() *SubscribeUpdateTransaction { - if x != nil { - return x.Transaction - } - return nil -} - -func (x *SubscribeTransactionsResponse) GetCreatedAt() *timestamppb.Timestamp { - if x != nil { - return x.CreatedAt - } - return nil -} - -type SubscribeUpdateTransaction struct { - state protoimpl.MessageState `protogen:"open.v1"` - Transaction *Transaction `protobuf:"bytes,1,opt,name=transaction,proto3" json:"transaction,omitempty"` - Slot uint64 `protobuf:"varint,2,opt,name=slot,proto3" json:"slot,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SubscribeUpdateTransaction) Reset() { - *x = SubscribeUpdateTransaction{} - mi := &file_shreder_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SubscribeUpdateTransaction) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubscribeUpdateTransaction) ProtoMessage() {} - -func (x *SubscribeUpdateTransaction) ProtoReflect() protoreflect.Message { - mi := &file_shreder_proto_msgTypes[3] - 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 SubscribeUpdateTransaction.ProtoReflect.Descriptor instead. -func (*SubscribeUpdateTransaction) Descriptor() ([]byte, []int) { - return file_shreder_proto_rawDescGZIP(), []int{3} -} - -func (x *SubscribeUpdateTransaction) GetTransaction() *Transaction { - if x != nil { - return x.Transaction - } - return nil -} - -func (x *SubscribeUpdateTransaction) GetSlot() uint64 { - if x != nil { - return x.Slot - } - return 0 -} - -type SubscribeRequestFilterTransactions struct { - state protoimpl.MessageState `protogen:"open.v1"` - AccountInclude []string `protobuf:"bytes,3,rep,name=account_include,json=accountInclude,proto3" json:"account_include,omitempty"` - AccountExclude []string `protobuf:"bytes,4,rep,name=account_exclude,json=accountExclude,proto3" json:"account_exclude,omitempty"` - AccountRequired []string `protobuf:"bytes,6,rep,name=account_required,json=accountRequired,proto3" json:"account_required,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SubscribeRequestFilterTransactions) Reset() { - *x = SubscribeRequestFilterTransactions{} - mi := &file_shreder_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SubscribeRequestFilterTransactions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubscribeRequestFilterTransactions) ProtoMessage() {} - -func (x *SubscribeRequestFilterTransactions) ProtoReflect() protoreflect.Message { - mi := &file_shreder_proto_msgTypes[4] - 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 SubscribeRequestFilterTransactions.ProtoReflect.Descriptor instead. -func (*SubscribeRequestFilterTransactions) Descriptor() ([]byte, []int) { - return file_shreder_proto_rawDescGZIP(), []int{4} -} - -func (x *SubscribeRequestFilterTransactions) GetAccountInclude() []string { - if x != nil { - return x.AccountInclude - } - return nil -} - -func (x *SubscribeRequestFilterTransactions) GetAccountExclude() []string { - if x != nil { - return x.AccountExclude - } - return nil -} - -func (x *SubscribeRequestFilterTransactions) GetAccountRequired() []string { - if x != nil { - return x.AccountRequired - } - return nil -} - -type Entry struct { - state protoimpl.MessageState `protogen:"open.v1"` - // the slot that the entry is from - Slot uint64 `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty"` - // Serialized bytes of Vec: https://docs.rs/solana-entry/latest/solana_entry/entry/struct.Entry.html - Entries []byte `protobuf:"bytes,2,opt,name=entries,proto3" json:"entries,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Entry) Reset() { - *x = Entry{} - mi := &file_shreder_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Entry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Entry) ProtoMessage() {} - -func (x *Entry) ProtoReflect() protoreflect.Message { - mi := &file_shreder_proto_msgTypes[5] - 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 Entry.ProtoReflect.Descriptor instead. -func (*Entry) Descriptor() ([]byte, []int) { - return file_shreder_proto_rawDescGZIP(), []int{5} -} - -func (x *Entry) GetSlot() uint64 { - if x != nil { - return x.Slot - } - return 0 -} - -func (x *Entry) GetEntries() []byte { - if x != nil { - return x.Entries - } - return nil -} - -type MessageHeader struct { - state protoimpl.MessageState `protogen:"open.v1"` - NumRequiredSignatures uint32 `protobuf:"varint,1,opt,name=num_required_signatures,json=numRequiredSignatures,proto3" json:"num_required_signatures,omitempty"` - NumReadonlySignedAccounts uint32 `protobuf:"varint,2,opt,name=num_readonly_signed_accounts,json=numReadonlySignedAccounts,proto3" json:"num_readonly_signed_accounts,omitempty"` - NumReadonlyUnsignedAccounts uint32 `protobuf:"varint,3,opt,name=num_readonly_unsigned_accounts,json=numReadonlyUnsignedAccounts,proto3" json:"num_readonly_unsigned_accounts,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *MessageHeader) Reset() { - *x = MessageHeader{} - mi := &file_shreder_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *MessageHeader) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageHeader) ProtoMessage() {} - -func (x *MessageHeader) ProtoReflect() protoreflect.Message { - mi := &file_shreder_proto_msgTypes[6] - 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 MessageHeader.ProtoReflect.Descriptor instead. -func (*MessageHeader) Descriptor() ([]byte, []int) { - return file_shreder_proto_rawDescGZIP(), []int{6} -} - -func (x *MessageHeader) GetNumRequiredSignatures() uint32 { - if x != nil { - return x.NumRequiredSignatures - } - return 0 -} - -func (x *MessageHeader) GetNumReadonlySignedAccounts() uint32 { - if x != nil { - return x.NumReadonlySignedAccounts - } - return 0 -} - -func (x *MessageHeader) GetNumReadonlyUnsignedAccounts() uint32 { - if x != nil { - return x.NumReadonlyUnsignedAccounts - } - return 0 -} - -type CompiledInstruction struct { - state protoimpl.MessageState `protogen:"open.v1"` - ProgramIdIndex uint32 `protobuf:"varint,1,opt,name=program_id_index,json=programIdIndex,proto3" json:"program_id_index,omitempty"` - Accounts []byte `protobuf:"bytes,2,opt,name=accounts,proto3" json:"accounts,omitempty"` - Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CompiledInstruction) Reset() { - *x = CompiledInstruction{} - mi := &file_shreder_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CompiledInstruction) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CompiledInstruction) ProtoMessage() {} - -func (x *CompiledInstruction) ProtoReflect() protoreflect.Message { - mi := &file_shreder_proto_msgTypes[7] - 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 CompiledInstruction.ProtoReflect.Descriptor instead. -func (*CompiledInstruction) Descriptor() ([]byte, []int) { - return file_shreder_proto_rawDescGZIP(), []int{7} -} - -func (x *CompiledInstruction) GetProgramIdIndex() uint32 { - if x != nil { - return x.ProgramIdIndex - } - return 0 -} - -func (x *CompiledInstruction) GetAccounts() []byte { - if x != nil { - return x.Accounts - } - return nil -} - -func (x *CompiledInstruction) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -type MessageAddressTableLookup struct { - state protoimpl.MessageState `protogen:"open.v1"` - AccountKey []byte `protobuf:"bytes,1,opt,name=account_key,json=accountKey,proto3" json:"account_key,omitempty"` - WritableIndexes []byte `protobuf:"bytes,2,opt,name=writable_indexes,json=writableIndexes,proto3" json:"writable_indexes,omitempty"` - ReadonlyIndexes []byte `protobuf:"bytes,3,opt,name=readonly_indexes,json=readonlyIndexes,proto3" json:"readonly_indexes,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *MessageAddressTableLookup) Reset() { - *x = MessageAddressTableLookup{} - mi := &file_shreder_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *MessageAddressTableLookup) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageAddressTableLookup) ProtoMessage() {} - -func (x *MessageAddressTableLookup) ProtoReflect() protoreflect.Message { - mi := &file_shreder_proto_msgTypes[8] - 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 MessageAddressTableLookup.ProtoReflect.Descriptor instead. -func (*MessageAddressTableLookup) Descriptor() ([]byte, []int) { - return file_shreder_proto_rawDescGZIP(), []int{8} -} - -func (x *MessageAddressTableLookup) GetAccountKey() []byte { - if x != nil { - return x.AccountKey - } - return nil -} - -func (x *MessageAddressTableLookup) GetWritableIndexes() []byte { - if x != nil { - return x.WritableIndexes - } - return nil -} - -func (x *MessageAddressTableLookup) GetReadonlyIndexes() []byte { - if x != nil { - return x.ReadonlyIndexes - } - return nil -} - -type Message struct { - state protoimpl.MessageState `protogen:"open.v1"` - Header *MessageHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - AccountKeys [][]byte `protobuf:"bytes,2,rep,name=account_keys,json=accountKeys,proto3" json:"account_keys,omitempty"` - RecentBlockhash []byte `protobuf:"bytes,3,opt,name=recent_blockhash,json=recentBlockhash,proto3" json:"recent_blockhash,omitempty"` - Instructions []*CompiledInstruction `protobuf:"bytes,4,rep,name=instructions,proto3" json:"instructions,omitempty"` - Versioned bool `protobuf:"varint,5,opt,name=versioned,proto3" json:"versioned,omitempty"` - AddressTableLookups []*MessageAddressTableLookup `protobuf:"bytes,6,rep,name=address_table_lookups,json=addressTableLookups,proto3" json:"address_table_lookups,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Message) Reset() { - *x = Message{} - mi := &file_shreder_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Message) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Message) ProtoMessage() {} - -func (x *Message) ProtoReflect() protoreflect.Message { - mi := &file_shreder_proto_msgTypes[9] - 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 Message.ProtoReflect.Descriptor instead. -func (*Message) Descriptor() ([]byte, []int) { - return file_shreder_proto_rawDescGZIP(), []int{9} -} - -func (x *Message) GetHeader() *MessageHeader { - if x != nil { - return x.Header - } - return nil -} - -func (x *Message) GetAccountKeys() [][]byte { - if x != nil { - return x.AccountKeys - } - return nil -} - -func (x *Message) GetRecentBlockhash() []byte { - if x != nil { - return x.RecentBlockhash - } - return nil -} - -func (x *Message) GetInstructions() []*CompiledInstruction { - if x != nil { - return x.Instructions - } - return nil -} - -func (x *Message) GetVersioned() bool { - if x != nil { - return x.Versioned - } - return false -} - -func (x *Message) GetAddressTableLookups() []*MessageAddressTableLookup { - if x != nil { - return x.AddressTableLookups - } - return nil -} - -type Transaction struct { - state protoimpl.MessageState `protogen:"open.v1"` - Signatures [][]byte `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"` - Message *Message `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Transaction) Reset() { - *x = Transaction{} - mi := &file_shreder_proto_msgTypes[10] - 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_shreder_proto_msgTypes[10] - 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_shreder_proto_rawDescGZIP(), []int{10} -} - -func (x *Transaction) GetSignatures() [][]byte { - if x != nil { - return x.Signatures - } - return nil -} - -func (x *Transaction) GetMessage() *Message { - if x != nil { - return x.Message - } - return nil -} - -var File_shreder_proto protoreflect.FileDescriptor - -const file_shreder_proto_rawDesc = "" + - "\n" + - "\rshreder.proto\x12\vshredstream\x1a\x1fgoogle/protobuf/timestamp.proto\"\x19\n" + - "\x17SubscribeEntriesRequest\"\xf1\x01\n" + - "\x1cSubscribeTransactionsRequest\x12_\n" + - "\ftransactions\x18\x03 \x03(\v2;.shredstream.SubscribeTransactionsRequest.TransactionsEntryR\ftransactions\x1ap\n" + - "\x11TransactionsEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12E\n" + - "\x05value\x18\x02 \x01(\v2/.shredstream.SubscribeRequestFilterTransactionsR\x05value:\x028\x01\"\xbf\x01\n" + - "\x1dSubscribeTransactionsResponse\x12\x18\n" + - "\afilters\x18\x01 \x03(\tR\afilters\x12I\n" + - "\vtransaction\x18\x04 \x01(\v2'.shredstream.SubscribeUpdateTransactionR\vtransaction\x129\n" + - "\n" + - "created_at\x18\v \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\"l\n" + - "\x1aSubscribeUpdateTransaction\x12:\n" + - "\vtransaction\x18\x01 \x01(\v2\x18.shredstream.TransactionR\vtransaction\x12\x12\n" + - "\x04slot\x18\x02 \x01(\x04R\x04slot\"\xa1\x01\n" + - "\"SubscribeRequestFilterTransactions\x12'\n" + - "\x0faccount_include\x18\x03 \x03(\tR\x0eaccountInclude\x12'\n" + - "\x0faccount_exclude\x18\x04 \x03(\tR\x0eaccountExclude\x12)\n" + - "\x10account_required\x18\x06 \x03(\tR\x0faccountRequired\"5\n" + - "\x05Entry\x12\x12\n" + - "\x04slot\x18\x01 \x01(\x04R\x04slot\x12\x18\n" + - "\aentries\x18\x02 \x01(\fR\aentries\"\xcd\x01\n" + - "\rMessageHeader\x126\n" + - "\x17num_required_signatures\x18\x01 \x01(\rR\x15numRequiredSignatures\x12?\n" + - "\x1cnum_readonly_signed_accounts\x18\x02 \x01(\rR\x19numReadonlySignedAccounts\x12C\n" + - "\x1enum_readonly_unsigned_accounts\x18\x03 \x01(\rR\x1bnumReadonlyUnsignedAccounts\"o\n" + - "\x13CompiledInstruction\x12(\n" + - "\x10program_id_index\x18\x01 \x01(\rR\x0eprogramIdIndex\x12\x1a\n" + - "\baccounts\x18\x02 \x01(\fR\baccounts\x12\x12\n" + - "\x04data\x18\x03 \x01(\fR\x04data\"\x92\x01\n" + - "\x19MessageAddressTableLookup\x12\x1f\n" + - "\vaccount_key\x18\x01 \x01(\fR\n" + - "accountKey\x12)\n" + - "\x10writable_indexes\x18\x02 \x01(\fR\x0fwritableIndexes\x12)\n" + - "\x10readonly_indexes\x18\x03 \x01(\fR\x0freadonlyIndexes\"\xcb\x02\n" + - "\aMessage\x122\n" + - "\x06header\x18\x01 \x01(\v2\x1a.shredstream.MessageHeaderR\x06header\x12!\n" + - "\faccount_keys\x18\x02 \x03(\fR\vaccountKeys\x12)\n" + - "\x10recent_blockhash\x18\x03 \x01(\fR\x0frecentBlockhash\x12D\n" + - "\finstructions\x18\x04 \x03(\v2 .shredstream.CompiledInstructionR\finstructions\x12\x1c\n" + - "\tversioned\x18\x05 \x01(\bR\tversioned\x12Z\n" + - "\x15address_table_lookups\x18\x06 \x03(\v2&.shredstream.MessageAddressTableLookupR\x13addressTableLookups\"]\n" + - "\vTransaction\x12\x1e\n" + - "\n" + - "signatures\x18\x01 \x03(\fR\n" + - "signatures\x12.\n" + - "\amessage\x18\x02 \x01(\v2\x14.shredstream.MessageR\amessage2\xd4\x01\n" + - "\x0eShrederService\x12N\n" + - "\x10SubscribeEntries\x12$.shredstream.SubscribeEntriesRequest\x1a\x12.shredstream.Entry0\x01\x12r\n" + - "\x15SubscribeTransactions\x12).shredstream.SubscribeTransactionsRequest\x1a*.shredstream.SubscribeTransactionsResponse(\x010\x01b\x06proto3" - -var ( - file_shreder_proto_rawDescOnce sync.Once - file_shreder_proto_rawDescData []byte -) - -func file_shreder_proto_rawDescGZIP() []byte { - file_shreder_proto_rawDescOnce.Do(func() { - file_shreder_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_shreder_proto_rawDesc), len(file_shreder_proto_rawDesc))) - }) - return file_shreder_proto_rawDescData -} - -var file_shreder_proto_msgTypes = make([]protoimpl.MessageInfo, 12) -var file_shreder_proto_goTypes = []any{ - (*SubscribeEntriesRequest)(nil), // 0: shredstream.SubscribeEntriesRequest - (*SubscribeTransactionsRequest)(nil), // 1: shredstream.SubscribeTransactionsRequest - (*SubscribeTransactionsResponse)(nil), // 2: shredstream.SubscribeTransactionsResponse - (*SubscribeUpdateTransaction)(nil), // 3: shredstream.SubscribeUpdateTransaction - (*SubscribeRequestFilterTransactions)(nil), // 4: shredstream.SubscribeRequestFilterTransactions - (*Entry)(nil), // 5: shredstream.Entry - (*MessageHeader)(nil), // 6: shredstream.MessageHeader - (*CompiledInstruction)(nil), // 7: shredstream.CompiledInstruction - (*MessageAddressTableLookup)(nil), // 8: shredstream.MessageAddressTableLookup - (*Message)(nil), // 9: shredstream.Message - (*Transaction)(nil), // 10: shredstream.Transaction - nil, // 11: shredstream.SubscribeTransactionsRequest.TransactionsEntry - (*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp -} -var file_shreder_proto_depIdxs = []int32{ - 11, // 0: shredstream.SubscribeTransactionsRequest.transactions:type_name -> shredstream.SubscribeTransactionsRequest.TransactionsEntry - 3, // 1: shredstream.SubscribeTransactionsResponse.transaction:type_name -> shredstream.SubscribeUpdateTransaction - 12, // 2: shredstream.SubscribeTransactionsResponse.created_at:type_name -> google.protobuf.Timestamp - 10, // 3: shredstream.SubscribeUpdateTransaction.transaction:type_name -> shredstream.Transaction - 6, // 4: shredstream.Message.header:type_name -> shredstream.MessageHeader - 7, // 5: shredstream.Message.instructions:type_name -> shredstream.CompiledInstruction - 8, // 6: shredstream.Message.address_table_lookups:type_name -> shredstream.MessageAddressTableLookup - 9, // 7: shredstream.Transaction.message:type_name -> shredstream.Message - 4, // 8: shredstream.SubscribeTransactionsRequest.TransactionsEntry.value:type_name -> shredstream.SubscribeRequestFilterTransactions - 0, // 9: shredstream.ShrederService.SubscribeEntries:input_type -> shredstream.SubscribeEntriesRequest - 1, // 10: shredstream.ShrederService.SubscribeTransactions:input_type -> shredstream.SubscribeTransactionsRequest - 5, // 11: shredstream.ShrederService.SubscribeEntries:output_type -> shredstream.Entry - 2, // 12: shredstream.ShrederService.SubscribeTransactions:output_type -> shredstream.SubscribeTransactionsResponse - 11, // [11:13] is the sub-list for method output_type - 9, // [9:11] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name -} - -func init() { file_shreder_proto_init() } -func file_shreder_proto_init() { - if File_shreder_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_shreder_proto_rawDesc), len(file_shreder_proto_rawDesc)), - NumEnums: 0, - NumMessages: 12, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_shreder_proto_goTypes, - DependencyIndexes: file_shreder_proto_depIdxs, - MessageInfos: file_shreder_proto_msgTypes, - }.Build() - File_shreder_proto = out.File - file_shreder_proto_goTypes = nil - file_shreder_proto_depIdxs = nil -}