MCPcopy Create free account
hub / github.com/GridPlus/client / Eth_getTransactionCount

Method Eth_getTransactionCount

src/rpc/web3.go:591–610  ·  view source on GitHub ↗

Get the transaction count (nonce) for an account, which must be 0x prefixed

(addr string)

Source from the content-addressed store, hash-verified

589
590// Get the transaction count (nonce) for an account, which must be 0x prefixed
591func (client *EthereumClient) Eth_getTransactionCount(addr string) (string, error) {
592 reqBody := JSONRPCRequest{
593 JSONRPC: "2.0",
594 ID: 1,
595 Method: "eth_getTransactionCount",
596 Params: []interface{}{addr, "latest"},
597 }
598
599 res, err := client.issueRequest(&reqBody)
600 if err != nil {
601 return "", err
602 }
603
604 var clientResp CallResponse // We can reuse this struct
605 err = json.Unmarshal(res, &clientResp)
606 if err != nil {
607 return "", err
608 }
609 return clientResp.Result, nil
610}
611
612type TxResponse struct {
613 ResponseBase

Callers 1

GetNonceFunction · 0.80

Calls 1

issueRequestMethod · 0.95

Tested by

no test coverage detected