add shreder sell decode

This commit is contained in:
thloyi
2025-12-30 11:03:11 +08:00
parent 2c0cbd574a
commit 20702a493f
8 changed files with 1743 additions and 1096 deletions

View File

@@ -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 {

View File

@@ -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
}

1015
pkg/shreder/shreder.pb.go Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -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);

View File

@@ -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,

View File

@@ -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
}

File diff suppressed because it is too large Load Diff

View File

@@ -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<Entry>: 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
}