0

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

enter image description here

How do I subscribe to new full pending transactions?

fryyyyyyy
  • 11
  • 2
  • The feature was added in [v1.11.0](https://github.com/ethereum/go-ethereum/releases/tag/v1.11.0) (see also https://github.com/ethereum/go-ethereum/pull/25186) and it seems that `getblock.io` does not catch up. – Zeke Lu Jun 07 '23 at 01:52

0 Answers0