{"action":"created","issue":{"url":"https://api.github.com/repos/nanmu42/etherscan-api/issues/5","repository_url":"https://api.github.com/repos/nanmu42/etherscan-api","labels_url":"https://api.github.com/repos/nanmu42/etherscan-api/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/nanmu42/etherscan-api/issues/5/comments","events_url":"https://api.github.com/repos/nanmu42/etherscan-api/issues/5/events","html_url":"https://github.com/nanmu42/etherscan-api/issues/5","id":362990283,"node_id":"MDU6SXNzdWUzNjI5OTAyODM=","number":5,"title":"proxy methods not implemented","user":{"login":"BenKnigge","id":9598487,"node_id":"MDQ6VXNlcjk1OTg0ODc=","avatar_url":"https://avatars2.githubusercontent.com/u/9598487?v=4","gravatar_id":"","url":"https://api.github.com/users/BenKnigge","html_url":"https://github.com/BenKnigge","followers_url":"https://api.github.com/users/BenKnigge/followers","following_url":"https://api.github.com/users/BenKnigge/following{/other_user}","gists_url":"https://api.github.com/users/BenKnigge/gists{/gist_id}","starred_url":"https://api.github.com/users/BenKnigge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenKnigge/subscriptions","organizations_url":"https://api.github.com/users/BenKnigge/orgs","repos_url":"https://api.github.com/users/BenKnigge/repos","events_url":"https://api.github.com/users/BenKnigge/events{/privacy}","received_events_url":"https://api.github.com/users/BenKnigge/received_events","type":"User","site_admin":false},"labels":[{"id":1007514577,"node_id":"MDU6TGFiZWwxMDA3NTE0NTc3","url":"https://api.github.com/repos/nanmu42/etherscan-api/labels/enhancement","name":"enhancement","color":"a2eeef","default":true},{"id":1007514578,"node_id":"MDU6TGFiZWwxMDA3NTE0NTc4","url":"https://api.github.com/repos/nanmu42/etherscan-api/labels/help%20wanted","name":"help wanted","color":"008672","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-09-24T00:13:36Z","updated_at":"2018-12-21T14:55:08Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I noticed that the proxy methods were not implemented and wouldn't mind contributing if you're open to a pull request.\r\n\r\nThese are what I'm referring to.\r\n\r\nhttps://etherscan.io/apis#proxy\r\n\r\nIs there anything else omitted that you're aware of? "},"comment":{"url":"https://api.github.com/repos/nanmu42/etherscan-api/issues/comments/449409004","html_url":"https://github.com/nanmu42/etherscan-api/issues/5#issuecomment-449409004","issue_url":"https://api.github.com/repos/nanmu42/etherscan-api/issues/5","id":449409004,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0OTQwOTAwNA==","user":{"login":"GlenDC","id":3900482,"node_id":"MDQ6VXNlcjM5MDA0ODI=","avatar_url":"https://avatars2.githubusercontent.com/u/3900482?v=4","gravatar_id":"","url":"https://api.github.com/users/GlenDC","html_url":"https://github.com/GlenDC","followers_url":"https://api.github.com/users/GlenDC/followers","following_url":"https://api.github.com/users/GlenDC/following{/other_user}","gists_url":"https://api.github.com/users/GlenDC/gists{/gist_id}","starred_url":"https://api.github.com/users/GlenDC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GlenDC/subscriptions","organizations_url":"https://api.github.com/users/GlenDC/orgs","repos_url":"https://api.github.com/users/GlenDC/repos","events_url":"https://api.github.com/users/GlenDC/events{/privacy}","received_events_url":"https://api.github.com/users/GlenDC/received_events","type":"User","site_admin":false},"created_at":"2018-12-21T14:55:08Z","updated_at":"2018-12-21T14:55:08Z","author_association":"NONE","body":"While working on a quick prototype for some project I was using your API @nanmu42. Thank you for the work you did, saved me a lot of time. I already support in my local version one proxy call, the one I needed.\r\n\r\nThe thing (first difference) I did notice is that the result for the Proxy calls does not match the Envelope structure, but is instead a JSON RPC 2.0 result. So not sure what you would do with that in your client code. For now I just manually mapped from one to the other structure, but I guess if this is to become an actual solution you would need to map it properly.\r\n\r\nHere is the hack diff I did for now, to give some context and for those who are interested, with just enough work done so I could do my actual prototype:\r\n\r\n```diff\r\ndiff --git a/client.go b/client.go\r\nindex b981d59..b632469 100644\r\n--- a/client.go\r\n+++ b/client.go\r\n@@ -127,14 +127,34 @@ func (c *Client) call(module, action string, param map[string]interface{}, outco\r\n \t}\r\n \r\n \tvar envelope Envelope\r\n-\terr = json.Unmarshal(content.Bytes(), &envelope)\r\n-\tif err != nil {\r\n-\t\terr = wrapErr(err, \"json unmarshal envelope\")\r\n-\t\treturn\r\n-\t}\r\n-\tif envelope.Status != 1 {\r\n-\t\terr = fmt.Errorf(\"etherscan server: %s\", envelope.Message)\r\n-\t\treturn\r\n+\tif module == \"proxy\" {\r\n+\t\tvar jsonRPCResp struct {\r\n+\t\t\tJSONRPC string          `json:\"jsonrpc\"`\r\n+\t\t\tID      int             `json:\"id\"`\r\n+\t\t\tResult  json.RawMessage `json:\"result\"`\r\n+\t\t}\r\n+\t\terr = json.Unmarshal(content.Bytes(), &jsonRPCResp)\r\n+\t\tif err != nil {\r\n+\t\t\terr = wrapErr(err, \"json unmarshal JSON RPC 2.0 resp\")\r\n+\t\t\treturn\r\n+\t\t}\r\n+\t\t// TODO: validate resp\r\n+\t\t// map to envelope\r\n+\t\t// TODO: does this mapping need to be improved?\r\n+\t\tenvelope.Status = 1\r\n+\t\tenvelope.Message = \"OK\"\r\n+\t\tenvelope.Result = jsonRPCResp.Result\r\n+\t} else {\r\n+\t\terr = json.Unmarshal(content.Bytes(), &envelope)\r\n+\t\tif err != nil {\r\n+\t\t\terr = wrapErr(err, \"json unmarshal envelope\")\r\n+\t\t\treturn\r\n+\t\t}\r\n+\t\tif envelope.Status != 1 {\r\n+\t\t\tfmt.Println(\"env. status\", envelope.Status)\r\n+\t\t\terr = fmt.Errorf(\"etherscan server: %s\", envelope.Message)\r\n+\t\t\treturn\r\n+\t\t}\r\n \t}\r\n \r\n \t// workaround for missing tokenDecimal for some tokentx calls\r\ndiff --git a/proxy.go b/proxy.go\r\nnew file mode 100644\r\nindex 0000000..bf5b255\r\n--- /dev/null\r\n+++ b/proxy.go\r\n@@ -0,0 +1,15 @@\r\n+/*\r\n+ * Copyright (c) 2018 LI Zhennan\r\n+ *\r\n+ * Use of this work is governed by a MIT License.\r\n+ * You may find a license copy in project root.\r\n+ */\r\n+\r\n+package etherscan\r\n+\r\n+// ProxyGetTransactionByHash gets the information about a transaction requested by transaction hash.\r\n+func (c *Client) ProxyGetTransactionByHash(txHash string) (obj TransactionObject, err error) {\r\n+\tparam := M{\"txhash\": txHash}\r\n+\terr = c.call(\"proxy\", \"eth_getTransactionByHash\", param, &obj)\r\n+\treturn\r\n+}\r\ndiff --git a/response.go b/response.go\r\nindex b1338d3..b390942 100644\r\n--- a/response.go\r\n+++ b/response.go\r\n@@ -88,6 +88,23 @@ type ERC20Transfer struct {\r\n \tConfirmations     int     `json:\"confirmations,string\"`\r\n }\r\n \r\n+// TransactionObject holds info from Transaction Object\r\n+type TransactionObject struct {\r\n+\tBlockHash        string  `json:\"blockHash\"`\r\n+\tBlockNumber      string  `json:\"blockNumber\"`\r\n+\tFrom             string  `json:\"from\"`\r\n+\tGas              string  `json:\"gas\"`\r\n+\tGasPrice         *BigInt `json:\"gasPrice\"`\r\n+\tInput            string  `json:\"input\"`\r\n+\tNonce            string  `json:\"nonce\"`\r\n+\tTo               string  `json:\"to\"`\r\n+\tTransactionIndex string  `json:\"transactionIndex\"`\r\n+\tValue            *BigInt `json:\"value\"`\r\n+\tECDSARecoveryID  string  `json:\"v\"`\r\n+\tECDSASignatureR  string  `json:\"r\"`\r\n+\tECDSASignatureS  string  `json:\"s\"`\r\n+}\r\n+\r\n // MinedBlock holds info from query for mined block by address\r\n type MinedBlock struct {\r\n \tBlockNumber int     `json:\"blockNumber,string\"`\r\n```\r\n\r\nThe second difference is that the integers seemed to be hex-encoded and not just string-encoded, so the `int json:\"key,string\"` doesn't work here. So here you would need to (for best user experience) also need to ensure that you can return a final Response structure that has it nicely decoded as int, even though these integers are hex-encoded when returned from the Proxy call."}}
{"actor":{"display_login":"GlenDC"}}