diff --git a/client.go b/client.go index e69679a..2199ba6 100644 --- a/client.go +++ b/client.go @@ -166,13 +166,15 @@ func (c *Client) call(module, action string, param map[string]interface{}, outco return } + fixedContent := bytes.ReplaceAll(content.Bytes(), []byte(`"transactionIndex":""`), []byte(`"transactionIndex":"0"`)) + var envelope Envelope - err = json.Unmarshal(content.Bytes(), &envelope) + err = json.Unmarshal(fixedContent, &envelope) if err != nil { err = wrapErr(err, "json unmarshal envelope") return } - if envelope.Status != 1 { + if envelope.Status != "1" { err = fmt.Errorf("etherscan server: %s", envelope.Message) return } diff --git a/response.go b/response.go index 5c418cf..834803d 100644 --- a/response.go +++ b/response.go @@ -17,7 +17,7 @@ import ( // Envelope is the carrier of nearly every response type Envelope struct { // 1 for good, 0 for error - Status int `json:"status,string"` + Status json.Number `json:"status"` // OK for good, other words when Status equals 0 Message string `json:"message"` // where response lies @@ -200,6 +200,7 @@ type Log struct { Topics []string `json:"topics"` Data string `json:"data"` BlockNumber string `json:"blockNumber"` + Timestamp string `json:"timeStamp"` TransactionHash string `json:"transactionHash"` BlockHash string `json:"blockHash"` LogIndex string `json:"logIndex"`