Sandwich Detector
Introduction
Plan
Tier 4
Tier 3
Tier 2
Tier 1
Tier 0
Request Parameters
Parameters
Mandatory
Format
Example
Remarks
Request Example
# without filter
grpcurl -plaintext=false -import-path /path/to/proto -proto solstream.proto -d '' solana.sandwich-detector.blockrazor.me:443 solstream.TxStreamService/SubscribeTxStream
# with filter
grpcurl -plaintext=false -import-path /path/to/proto -proto solstream.proto -d '{"relevantProgramId":"aa..bb"}' solana.sandwich-detector.blockrazor.me:443 solstream.TxStreamService/SubscribeTxStreampackage main
import (
"context"
"crypto/tls"
"log"
pb "solstream/proto/solstream"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
)
func main() {
for {
conn, err := grpc.Dial(
"solana.sandwich-detector.blockrazor.me:443",
grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),
grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) {
d := net.Dialer{DualStack: false}
return d.DialContext(ctx, "tcp4", addr)
}),
)
if err != nil {
log.Printf("Failed to connect: %v.\n", err)
continue
}
client := pb.NewTxStreamServiceClient(conn)
stream, err := client.SubscribeTxStream(context.Background(), &pb.TxFilter{
// Empty for no filter
Signer: "",
RelevantProgramId: "",
})
if err != nil {
log.Printf("Error subscribing to stream: %v.\n", err)
conn.Close()
continue
}
log.Println("Successfully subscribed to the stream.")
for {
resp, err := stream.Recv()
if err != nil {
log.Printf("Error receiving stream data: %v. Reconnecting...\n", err)
conn.Close()
break
}
log.Println(resp)
}
}
}Proto
Response Example
Last updated
Was this helpful?