From 3c5c147e94585f158cfa1eb8ba88e5d702d08efd Mon Sep 17 00:00:00 2001 From: wang shuai <365089264@qq.com> Date: Wed, 17 Nov 2021 11:07:22 +0800 Subject: [PATCH 1/3] fixbug --- logs.go | 2 +- response.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/logs.go b/logs.go index 2aab41a..b674041 100644 --- a/logs.go +++ b/logs.go @@ -9,6 +9,6 @@ func (c *Client) GetLogs(address string, fromBlock string, toBlock string, topic "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"` } From de739dca198a247fa55b85aa0f6d39cc56c84f17 Mon Sep 17 00:00:00 2001 From: wang shuai <365089264@qq.com> Date: Thu, 18 Nov 2021 16:13:13 +0800 Subject: [PATCH 2/3] fixbug --- logs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logs.go b/logs.go index b674041..e9293fe 100644 --- a/logs.go +++ b/logs.go @@ -2,7 +2,7 @@ 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, From 20ae28d6ce923d08f9e469e308c127c7c751bce6 Mon Sep 17 00:00:00 2001 From: wang shuai <365089264@qq.com> Date: Thu, 18 Nov 2021 18:48:02 +0800 Subject: [PATCH 3/3] fixbug No records found --- client.go | 3 +++ 1 file changed, 3 insertions(+) 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