Guest User

Untitled

a guest
Apr 24th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. func getLatestTxs() map[string]interface{}{} {
  2. fmt.Println("hello")
  3. resp, err := http.Get("http://api.etherscan.io/api?module=account&action=txlist&address=0x266ac31358d773af8278f625c4d4a35648953341&startblock=0&endblock=99999999&sort=asc&apikey=5UUVIZV5581ENPXKYWAUDGQTHI956A56MU")
  4. defer resp.Body.Close()
  5. body, _ := ioutil.ReadAll(resp.Body)
  6. if err != nil {
  7. fmt.Errorf("etherscan访问失败")
  8. }
  9. ret := map[string]interface{}{}
  10. json.Unmarshal(body, &ret)
  11. if ret["status"] == 1 {
  12. return ret["result"]
  13. }
  14. }
  15.  
  16. func getLatestTxs() map[string]interface{} {
  17. fmt.Println("hello")
  18. resp, err := http.Get("http://api.etherscan.io/api?module=account&action=txlist&address=0x266ac31358d773af8278f625c4d4a35648953341&startblock=0&endblock=99999999&sort=asc&apikey=5UUVIZV5581ENPXKYWAUDGQTHI956A56MU")
  19. defer resp.Body.Close()
  20. body, _ := ioutil.ReadAll(resp.Body)
  21. if err != nil {
  22. fmt.Errorf("etherscan访问失败")
  23. }
  24. ret := map[string]interface{}{}
  25. json.Unmarshal(body, &ret)
  26. if ret["status"] == 1 {
  27. return ret
  28. }
  29. return ret
  30. }
  31.  
  32. func getLatestTxs() interface{} {
  33. fmt.Println("hello")
  34. // function code .....
  35. //fmt.Println(ret["result"])
  36. return ret
  37. }
  38.  
  39.  
  40. ret.(map[string]interface{})
Add Comment
Please, Sign In to add comment