Eth_getBlockByHash calls the eth_getBlockByHash JSON-RPC method
(blockHash string, full bool)
| 418 | |
| 419 | // Eth_getBlockByHash calls the eth_getBlockByHash JSON-RPC method |
| 420 | func (client *EthereumClient) Eth_getBlockByHash(blockHash string, full bool) (*Block, error) { |
| 421 | |
| 422 | reqBody := JSONRPCRequest{ |
| 423 | JSONRPC: "2.0", |
| 424 | ID: 1, |
| 425 | Method: "eth_getBlockByHash", |
| 426 | Params: []interface{}{blockHash, full}, |
| 427 | } |
| 428 | |
| 429 | body, err := client.issueRequest(&reqBody) |
| 430 | if err != nil { |
| 431 | return nil, err |
| 432 | } |
| 433 | |
| 434 | var clientResp BlockResponse |
| 435 | err = json.Unmarshal(body, &clientResp) |
| 436 | if err != nil { |
| 437 | return nil, err |
| 438 | } |
| 439 | |
| 440 | block, err := clientResp.Result.ToBlock() |
| 441 | if err != nil { |
| 442 | return nil, err |
| 443 | } |
| 444 | |
| 445 | return block, nil |
| 446 | } |
| 447 | |
| 448 | // Eth_getTransactionByHash calls the eth_getTransactionByHash JSON-RPC method |
| 449 | func (client *EthereumClient) Eth_getTransactionByHash(txHash string) (TransactionResult, error) { |
nothing calls this directly
no test coverage detected