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

Add txpool_content method to builtin Go RPC client #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ethclient/ethclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,15 @@ func (ec *Client) SendTransaction(ctx context.Context, tx *types.Transaction) er
return ec.c.CallContext(ctx, nil, "eth_sendRawTransaction", common.ToHex(data))
}

// TxPoolContent returns the current contents of the pending pool. The return
// value is a map of the form:
// { "pending"|"queued": { <sender_addr>: { <nonce>: Transaction }}}
func (ec *Client) TxPoolContent(ctx context.Context) (map[string]map[string]map[string]*types.Transaction, error) {
var res map[string]map[string]map[string]*types.Transaction
err := ec.c.CallContext(ctx, &res, "txpool_content")
return res, err
}

func toCallArg(msg ethereum.CallMsg) interface{} {
arg := map[string]interface{}{
"from": msg.From,
Expand Down