{"action":"created","issue":{"url":"https://api.github.com/repos/inzhoop-co/LETH/issues/56","repository_url":"https://api.github.com/repos/inzhoop-co/LETH","labels_url":"https://api.github.com/repos/inzhoop-co/LETH/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/inzhoop-co/LETH/issues/56/comments","events_url":"https://api.github.com/repos/inzhoop-co/LETH/issues/56/events","html_url":"https://github.com/inzhoop-co/LETH/issues/56","id":298059841,"number":56,"title":"Constant functions return empty results in LETH when they work with MetaMask","user":{"login":"grishick","id":1310940,"avatar_url":"https://avatars2.githubusercontent.com/u/1310940?v=4","gravatar_id":"","url":"https://api.github.com/users/grishick","html_url":"https://github.com/grishick","followers_url":"https://api.github.com/users/grishick/followers","following_url":"https://api.github.com/users/grishick/following{/other_user}","gists_url":"https://api.github.com/users/grishick/gists{/gist_id}","starred_url":"https://api.github.com/users/grishick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grishick/subscriptions","organizations_url":"https://api.github.com/users/grishick/orgs","repos_url":"https://api.github.com/users/grishick/repos","events_url":"https://api.github.com/users/grishick/events{/privacy}","received_events_url":"https://api.github.com/users/grishick/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-18T05:14:25Z","updated_at":"2018-02-18T08:50:18Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"My Solidity contract has the following function\r\n\r\n```\r\n    function getFriend(address _friend) public view returns (bytes32 friendName) {\r\n        require(_friend != address(0));\r\n        return addressBook[msg.sender][_friend];\r\n    }\r\n```\r\nIn my LETH DApp I have a call to this function that looks like this:\r\n\r\n```\r\ndappContract.getFriend(addr, function(error, friendName) {\r\n                if(error) {\r\n                    console.log(\"Error in getFriend: \", error)\r\n                    if(cb) {\r\n                        cb(error, null);\r\n                    }\r\n                } else {\r\n                    console.log(\"Received friend name in hex\", friendName);\r\n                }\r\n            });\r\n```\r\n\r\ncalling this code, results in the following network trace in Chrome Developer console:\r\n\r\nRequest:\r\n`{\"jsonrpc\":\"2.0\",\"id\":269,\"method\":\"eth_call\",\"params\":[{\"to\":\"0xd2c92e41106ae0cc0e573d19ed739b433bcc33ae\",\"data\":\"0x30ead4690000000000000000000000006a0c0b023cafd4a1f7b6f16575329b7ac0d59fcc\"},\"latest\"]}`\r\n\r\nResponse:\r\n`{\"jsonrpc\":\"2.0\",\"id\":269,\"result\":\"0x0000000000000000000000000000000000000000000000000000000000000000\"}`\r\n\r\nThe response is incorrect, because \"addressBook\" contains the element that should be returned. In this case, the element's value is \"0x4163633300000000000000000000000000000000000000000000000000000000\".\r\n\r\nWhen I enable MetaMask extension, unlock the wallet in MetaMask and reload LETH web app, MetaMask injects its own web3 provider instead of LETH's. With MetaMask's web3 provider the same call works correctly:\r\n\r\nRequest:\r\n\r\n`{\"jsonrpc\":\"2.0\",\"id\":38,\"method\":\"eth_call\",\"params\":[{\"to\":\"0xd2c92e41106ae0cc0e573d19ed739b433bcc33ae\",\"data\":\"0x30ead4690000000000000000000000006a0c0b023cafd4a1f7b6f16575329b7ac0d59fcc\",\"from\":\"0x9451def8ca3662d40b5569dc9181383789515748\"},\"latest\"]`\r\n\r\nResponse:\r\n`{\"jsonrpc\":\"2.0\",\"id\":38,\"result\":\"0x4163633300000000000000000000000000000000000000000000000000000000\"}`"},"comment":{"url":"https://api.github.com/repos/inzhoop-co/LETH/issues/comments/366501282","html_url":"https://github.com/inzhoop-co/LETH/issues/56#issuecomment-366501282","issue_url":"https://api.github.com/repos/inzhoop-co/LETH/issues/56","id":366501282,"user":{"login":"hacktar","id":11939542,"avatar_url":"https://avatars2.githubusercontent.com/u/11939542?v=4","gravatar_id":"","url":"https://api.github.com/users/hacktar","html_url":"https://github.com/hacktar","followers_url":"https://api.github.com/users/hacktar/followers","following_url":"https://api.github.com/users/hacktar/following{/other_user}","gists_url":"https://api.github.com/users/hacktar/gists{/gist_id}","starred_url":"https://api.github.com/users/hacktar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hacktar/subscriptions","organizations_url":"https://api.github.com/users/hacktar/orgs","repos_url":"https://api.github.com/users/hacktar/repos","events_url":"https://api.github.com/users/hacktar/events{/privacy}","received_events_url":"https://api.github.com/users/hacktar/received_events","type":"User","site_admin":false},"created_at":"2018-02-18T08:50:18Z","updated_at":"2018-02-18T08:50:18Z","author_association":"CONTRIBUTOR","body":"maybe could be due to different web3 version used, i will check"}}
{"actor":{"display_login":"hacktar"}}