diff --git a/client.go b/client.go index e69679a..b1a7b08 100644 --- a/client.go +++ b/client.go @@ -172,6 +172,9 @@ func (c *Client) call(module, action string, param map[string]interface{}, outco err = wrapErr(err, "json unmarshal envelope") return } + if envelope.Status == 0 && envelope.Message == "No records found" { + return + } if envelope.Status != 1 { err = fmt.Errorf("etherscan server: %s", envelope.Message) return diff --git a/logs.go b/logs.go index 2aab41a..e9293fe 100644 --- a/logs.go +++ b/logs.go @@ -2,13 +2,13 @@ package etherscan // GetLogs gets a list of log for a single address // startBlock and endBlock cann`t be nil -func (c *Client) GetLogs(address string, fromBlock string, toBlock string, topic0 string) (logs []Log, err error) { +func (c *Client) GetLogs(address *string, fromBlock string, toBlock string, topic0 string) (logs []Log, err error) { param := M{ "fromBlock": fromBlock, "toBlock": toBlock, "topic0": topic0, } compose(param, "address", address) - err = c.call("logs", "getLogs", param, logs) + err = c.call("logs", "getLogs", param, &logs) return } diff --git a/response.go b/response.go index cb6130f..c93782e 100644 --- a/response.go +++ b/response.go @@ -150,13 +150,13 @@ type Log struct { // but not secured by consensus. // block in which the transaction was included BlockNumber string `json:"blockNumber"` + TimeStamp string `json:"timeStamp"` GasPrice string `json:"gasPrice"` GasUsed string `json:"gasUsed"` - TimeStamp string `json:"timeStamp"` + // index of the log in the block + Index string `json:"logIndex"` // hash of the transaction TxHash string `json:"transactionHash"` // index of the transaction in the block TxIndex string `json:"transactionIndex"` - // index of the log in the block - Index string `json:"logIndex"` }