Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newPendingTransactions support in ethclient.go #22916

Closed
huahuayu opened this issue May 21, 2021 · 7 comments
Closed

newPendingTransactions support in ethclient.go #22916

huahuayu opened this issue May 21, 2021 · 7 comments

Comments

@huahuayu
Copy link
Contributor

huahuayu commented May 21, 2021

hi, for eth_subscribe method, I wonder why the client only supports newHeads

func (ec *Client) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error) {

but don't supportnewPendingTransactions in ethclient.go

they are all be mentioned in the same place in the document: https://geth.ethereum.org/docs/rpc/pubsub

but if I want to subscribe newPendingTransactions I have to use underlaying rpc client. Since it's not exported, so I have to instantiation a *rpc.Client besides an *ethclient.Client

type Client struct {	c *rpc.Client}
@huahuayu
Copy link
Contributor Author

another issue is newPendingTransactions only returns tx hash, I have to do another query to get tx data, is it possible to return verbose tx content when subscribe?

@huahuayu
Copy link
Contributor Author

huahuayu commented May 24, 2021

@fjl @karalabe how do you think?

@MariusVanDerWijden
Copy link
Member

eth_subscribe is a non-standard api and should therefore not be in ethclient but rather in the gethclient. I think supporting newPendingTransactions in the gethclient would be okay. Do you want to move and implement it?

@fjl
Copy link
Contributor

fjl commented Nov 4, 2021

This is not entirely true. We do have support for eth_subscribe APIs in ethclient, just not for pending transactions.

@MariusVanDerWijden
Copy link
Member

I know, but it should not be in ethclient imo as it is not part of the json-rpc api standard

@senthilsamrat
Copy link

https://geth.ethereum.org/docs/rpc/pubsub

can you post a sample code for subscribing to pending transaction. I am new to Go and Geth. Please it would help me a lot for my project. Thanks in advance!

@s1na
Copy link
Contributor

s1na commented Dec 8, 2022

Fixed via #25186. gethclient has now SubscribePendingTransactions and SubscribeFullPendingTransactions.

@s1na s1na closed this as completed Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants