Get the transaction count (nonce) for an account, which must be 0x prefixed
(addr string)
| 589 | |
| 590 | // Get the transaction count (nonce) for an account, which must be 0x prefixed |
| 591 | func (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 | |
| 612 | type TxResponse struct { |
| 613 | ResponseBase |
no test coverage detected