this is code(go-ethereum v1.12.0). but error" too many arguments, want at most 1". when postman tried, the error was still "too many arguments and wanted at most 1".
How do I subscribe to new full pending transactions?
package main
import (
"context"
"fmt"
"log"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient/gethclient"
"github.com/ethereum/go-ethereum/rpc"
)
func main() {
const rawUrl = "wss://bsc.getblock.io/xxxxxxxxx/mainnet/"
const txChCap = 30
rpcClient, rpcErr := rpc.Dial(rawUrl)
if rpcErr != nil {
log.Fatal(rpcErr)
}
client := gethclient.New(rpcClient)
txCh := make(chan *types.Transaction, txChCap)
sub, subErr := client.SubscribeFullPendingTransactions(context.Background(), txCh)
if subErr != nil {
log.Fatal(subErr)
}
defer sub.Unsubscribe()
for {
select {
case tx := <-txCh:
fmt.Printf("New tx: %v\n", tx)
case err := <-sub.Err():
log.Fatal(err)
}
}
}
How do I subscribe to new full pending transactions?