Open kenneyLee opened 7 months ago
I used BlockSubscribe, but found that there was no data output.But with the same endpoint, LogsSubscribe is running normally. `package main
import ( "context" "fmt" "math" "sync"
bin "github.com/gagliardetto/binary" "github.com/gagliardetto/solana-go" "github.com/gagliardetto/solana-go/programs/serum" "github.com/gagliardetto/solana-go/rpc" "github.com/gagliardetto/solana-go/programs/token" "github.com/gagliardetto/solana-go/rpc/ws"
)
func main() { client, err := ws.Connect(context.Background(), rpc.MainNetBeta_WS)
if err != nil { panic(err) } filter := ws.NewBlockSubscribeFilterAll() opts := &ws.BlockSubscribeOpts{ Commitment: rpc.CommitmentConfirmed, } sub, err := client.BlockSubscribe(filter, opts) if err != nil { panic(err) } defer sub.Unsubscribe() for { res, err := sub.Recv() if err != nil { fmt.Println("BlockSubscribe error:", err) panic(err) } fmt.Println("Received block:", res.Value.Block) for _, transaction := range res.Value.Block.Transactions { fmt.Println("Transaction:", transaction) } }
}`
https://solana.com/docs/rpc/websocket/blocksubscribe
I used BlockSubscribe, but found that there was no data output.But with the same endpoint, LogsSubscribe is running normally. `package main
import ( "context" "fmt" "math" "sync"
)
func main() { client, err := ws.Connect(context.Background(), rpc.MainNetBeta_WS)
}`