I'm trying to subscribe to pending transaction in Ethereum. Whilest I know how to do in web3.js
const subscription = web3.eth.subscribe("pendingTransactions", (err, res) => {
if (err) console.error(err);
});
I haven't been able to find any method to do in Go. For instance, this method doesn't exist:
import (
"context"
"fmt"
"log"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
)
//........
client, err := ethclient.Dial("<URL>")
gethClient := gethclient.New(rpcClient)
//.....
logs := make(chan types.Log)
sub, err := gethClient.SubscribePendingTransactions(context.Background(), logs) // doesn't exit
client.SubscribePendingTransactions undefined (type *ethclient.Client has no field or method SubscribePendingTransactions)
What's the method for that?