Eth_getTransactionByHash calls the eth_getTransactionByHash JSON-RPC method
(txHash string)
| 447 | |
| 448 | // Eth_getTransactionByHash calls the eth_getTransactionByHash JSON-RPC method |
| 449 | func (client *EthereumClient) Eth_getTransactionByHash(txHash string) (TransactionResult, error) { |
| 450 | var emptyResp = TransactionResult{} |
| 451 | |
| 452 | reqBody := JSONRPCRequest{ |
| 453 | JSONRPC: "2.0", |
| 454 | ID: 1, |
| 455 | Method: "eth_getTransactionByHash", |
| 456 | Params: []interface{}{txHash}, |
| 457 | } |
| 458 | |
| 459 | body, err := client.issueRequest(&reqBody) |
| 460 | if err != nil { |
| 461 | return emptyResp, err |
| 462 | } |
| 463 | |
| 464 | var clientResp TransactionResponse |
| 465 | err = json.Unmarshal(body, &clientResp) |
| 466 | if err != nil { |
| 467 | return emptyResp, err |
| 468 | } |
| 469 | |
| 470 | return clientResp.Result, nil |
| 471 | } |
| 472 | |
| 473 | // Eth_getBlockByNumber calls the eth_getBlockByNumber JSON-RPC method |
| 474 | func (client *EthereumClient) Eth_getBlockByNumber(blockNumber int, full bool) (*Block, error) { |
no test coverage detected