split program source file

This commit is contained in:
thloyi
2026-01-28 14:11:34 +08:00
parent 35c5c83f4b
commit be86c888eb
29 changed files with 2792 additions and 2234 deletions

View File

@@ -11,7 +11,7 @@ import (
"github.com/gagliardetto/solana-go/rpc"
"github.com/samlior/libsam/pkg/shreder"
"github.com/samlior/libsam/v2/pkg/shreder"
)
func main() {
@@ -76,9 +76,9 @@ func main() {
cancel()
}()
// async read from shreder
txCh := make(chan shreder.TxSignalBatch, 1000)
txCh := make(chan shreder.TxSignal, 1000)
go func() {
err := shrederClient.ReadSync(ctx, txCh)
err := shrederClient.ReadEntriesSync(ctx, txCh)
if err != nil {
if !errors.Is(err, context.Canceled) {
panic(err)
@@ -90,14 +90,10 @@ func main() {
select {
case <-ctx.Done():
return
case txBatch := <-txCh:
//jsonData, _ := json.MarshalIndent(txBatch, "", " ")
for _, tx := range txBatch {
if tx.Label == "okxdexroutev2" || tx.Label == "jupiterv6" || tx.Label == "dflow" {
fmt.Println("===============", tx.TxHash, tx.Label, tx.Event, tx.Token0Address, "token:", tx.Token0Amount, "parse time:", tx.ParseEnd.Sub(tx.ParseStart))
}
case tx := <-txCh:
if tx.Label == "okxdexroutev2" || tx.Label == "jupiterv6" || tx.Label == "dflow" {
fmt.Println("===============", tx.TxHash, tx.Label, tx.Event, tx.Token0Address, "token:", tx.Token0Amount, "parse time:", tx.ParseEnd.Sub(tx.ParseStart))
}
//fmt.Println(txBatch[0].TxHash)
}
}
}