{"action":"created","issue":{"url":"https://api.github.com/repos/ethereum/interfaces/issues/16","repository_url":"https://api.github.com/repos/ethereum/interfaces","labels_url":"https://api.github.com/repos/ethereum/interfaces/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/ethereum/interfaces/issues/16/comments","events_url":"https://api.github.com/repos/ethereum/interfaces/issues/16/events","html_url":"https://github.com/ethereum/interfaces/issues/16","id":218164125,"number":16,"title":"ethereumProvider API","user":{"login":"frozeman","id":232662,"avatar_url":"https://avatars2.githubusercontent.com/u/232662?v=3","gravatar_id":"","url":"https://api.github.com/users/frozeman","html_url":"https://github.com/frozeman","followers_url":"https://api.github.com/users/frozeman/followers","following_url":"https://api.github.com/users/frozeman/following{/other_user}","gists_url":"https://api.github.com/users/frozeman/gists{/gist_id}","starred_url":"https://api.github.com/users/frozeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frozeman/subscriptions","organizations_url":"https://api.github.com/users/frozeman/orgs","repos_url":"https://api.github.com/users/frozeman/repos","events_url":"https://api.github.com/users/frozeman/events{/privacy}","received_events_url":"https://api.github.com/users/frozeman/received_events","type":"User","site_admin":false},"labels":[{"id":596556990,"url":"https://api.github.com/repos/ethereum/interfaces/labels/ERC","name":"ERC","color":"bfd4f2","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2017-03-30T11:20:58Z","updated_at":"2017-05-03T14:04:08Z","closed_at":null,"body":"### Abstract\r\n\r\nThis draft is to discuss the `ethereumProvider` API, an object exposed by ethereum native browsers and tools like Mist, MetaMask and status.im.\r\n\r\nThe API should be small and clean and allow all kind of libraries to attach to it.\r\n\r\n### API\r\n\r\nThe `ethereumProvider` should inherit from a [EventEmitter](https://nodejs.org/api/events.html) type class, and provide `add/removeListener`, `on/once/off` etc.\r\n\r\n```js\r\n// Will try to connect, the ethereumProvider should be already connected when the webpage is loaded and firse the \"connect\" event at start.\r\nethereumProvider.connect()\r\n> undefined\r\n```\r\n\r\n```js\r\n// payload: is a valid jsonrpc 2.0 object\r\n// callback: a error first callback\r\nethereumProvider.send(payload, callback)\r\n> undefined\r\n```\r\n\r\n\r\n```js\r\n// returns subscription notification,\r\nethereumProvider.on('data', handler)\r\n\r\n// The subscription received in the callback:\r\n> {\r\n  \"jsonrpc\":\"2.0\",\r\n   \"method\":\"eth_subscription\",\r\n   \"params\": {\r\n       \"subscription\":\"0x2acffa11d68280c2954daeb77cb849d9\",\r\n       \"result\": {...}\r\n    }\r\n}\r\n```\r\n\r\n```js\r\n// react on connection start\r\nethereumProvider.on('connect', handler)\r\n```\r\n\r\n```js\r\n// react on connection end\r\nethereumProvider.on('end', handler)\r\n```\r\n\r\n```js\r\n// react on connection error\r\nethereumProvider.on('error', handler)\r\n```\r\n\r\n```js\r\n// react on connection end\r\nethereumProvider.on('timeout', handler)\r\n```"},"comment":{"url":"https://api.github.com/repos/ethereum/interfaces/issues/comments/298920550","html_url":"https://github.com/ethereum/interfaces/issues/16#issuecomment-298920550","issue_url":"https://api.github.com/repos/ethereum/interfaces/issues/16","id":298920550,"user":{"login":"frozeman","id":232662,"avatar_url":"https://avatars2.githubusercontent.com/u/232662?v=3","gravatar_id":"","url":"https://api.github.com/users/frozeman","html_url":"https://github.com/frozeman","followers_url":"https://api.github.com/users/frozeman/followers","following_url":"https://api.github.com/users/frozeman/following{/other_user}","gists_url":"https://api.github.com/users/frozeman/gists{/gist_id}","starred_url":"https://api.github.com/users/frozeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frozeman/subscriptions","organizations_url":"https://api.github.com/users/frozeman/orgs","repos_url":"https://api.github.com/users/frozeman/repos","events_url":"https://api.github.com/users/frozeman/events{/privacy}","received_events_url":"https://api.github.com/users/frozeman/received_events","type":"User","site_admin":false},"created_at":"2017-05-03T14:04:08Z","updated_at":"2017-05-03T14:04:08Z","body":"I like the idea of `ethereumProvider.on(\"eth_subscription\", ...`, as we also have ` `ethereumProvider.on(\"shh_subscription\", ...` and so on. Will add this."}}
{"actor":{"display_login":"frozeman"}}