{"action":"created","comment":{"url":"https://api.github.com/repos/iov-one/iov-core/pulls/comments/241837377","pull_request_review_id":185217038,"id":241837377,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MTgzNzM3Nw==","diff_hunk":"@@ -300,12 +306,102 @@ describe(\"EthereumConnection\", () => {\n \n     it(\"throws error from invalid block number\", async () => {\n       pendingWithoutEthereum();\n-      const connection = await EthereumConnection.establish(base);\n+      const connection = await EthereumConnection.establish(base, undefined);\n       await connection\n         .getBlockHeader(99999999999999)\n         .then(() => fail(\"promise must be rejected\"))\n         .catch(err => expect(err).toMatch(/Header 99999999999999 doesn't exist yet/));\n       connection.disconnect();\n     });\n   });\n+\n+  describe(\"feed\", () => {\n+    async function postTransaction(\n+      quantity: string,\n+      memo: string,\n+      connection: EthereumConnection,\n+    ): Promise<PostTxResponse> {\n+      const wallet = Secp256k1HdWallet.fromMnemonic(\n+        \"oxygen fall sure lava energy veteran enroll frown question detail include maximum\",\n+      );\n+      const mainIdentity = await wallet.createIdentity(HdPaths.bip44(60, 0, 0, 1));\n+\n+      const recipientAddress = \"0xE137f5264b6B528244E1643a2D570b37660B7F14\" as Address;\n+\n+      const sendTx: SendTransaction = {\n+        kind: \"bcp/send\",\n+        chainId: nodeChainId,\n+        signer: mainIdentity.pubkey,\n+        recipient: recipientAddress,\n+        amount: {\n+          quantity: quantity,\n+          fractionalDigits: 18,\n+          tokenTicker: \"ETH\" as TokenTicker,\n+        },\n+        gasPrice: {\n+          quantity: gasPrice,\n+          fractionalDigits: 18,\n+          tokenTicker: \"ETH\" as TokenTicker,\n+        },\n+        gasLimit: {\n+          quantity: gasLimit,\n+          fractionalDigits: 18,\n+          tokenTicker: \"ETH\" as TokenTicker,\n+        },\n+        memo: memo,\n+      };\n+      const senderAddress = ethereumCodec.keyToAddress(mainIdentity.pubkey);\n+      const nonceResp = await connection.getNonce({ address: senderAddress });\n+      const signingJob = ethereumCodec.bytesToSign(sendTx, nonceResp.data[0]);\n+      const signature = await wallet.createTransactionSignature(\n+        mainIdentity,\n+        signingJob.bytes,\n+        signingJob.prehashType,\n+        nodeChainId,\n+      );\n+\n+      const signedTransaction: SignedTransaction = {\n+        transaction: sendTx,\n+        primarySignature: {\n+          nonce: nonceResp.data[0],\n+          pubkey: mainIdentity.pubkey,\n+          signature: signature,\n+        },\n+        otherSignatures: [],\n+      };\n+      const bytesToPost = ethereumCodec.bytesToPost(signedTransaction);\n+\n+      const resultPost = await connection.postTx(bytesToPost);\n+      return resultPost;\n+    }\n+\n+    describe(\"watchBlockHeaders\", () => {\n+      it(\"watches headers with same data as getBlockHeader\", async () => {\n+        pendingWithoutEthereum();\n+        const connection = await EthereumConnection.establish(base, wsUrl);\n+        const events = new Array<BlockHeader>();\n+\n+        const subscription = connection.watchBlockHeaders().subscribe({\n+          next: info => {\n+            events.push(info);\n+            if (events.length === 2) {\n+              expect(events[0].height).toEqual(events[1].height - 1);\n+              connection.getBlockHeader(info.height).then(header => {\n+                expect(header).toEqual(events[1]);\n+                subscription.unsubscribe();\n+                connection.unwatchBlockHeaders();\n+                connection.disconnect();\n+              });\n+            }\n+          },\n+          complete: fail,\n+          error: fail,\n+        });\n+        // post transactions\n+        await postTransaction(\"5445500\", \"watch header test 1-\" + new Date(), connection);\n+        await postTransaction(\"5445500\", \"watch header test 2-\" + new Date(), connection);\n+        await sleep(100);","path":"packages/iov-ethereum/src/ethereumconnection.spec.ts","position":260,"original_position":260,"commit_id":"b518d4a5b5281e9dff4751ab9d1bee033b381179","original_commit_id":"b518d4a5b5281e9dff4751ab9d1bee033b381179","user":{"login":"LucasIsasmendi","id":4970546,"node_id":"MDQ6VXNlcjQ5NzA1NDY=","avatar_url":"https://avatars3.githubusercontent.com/u/4970546?v=4","gravatar_id":"","url":"https://api.github.com/users/LucasIsasmendi","html_url":"https://github.com/LucasIsasmendi","followers_url":"https://api.github.com/users/LucasIsasmendi/followers","following_url":"https://api.github.com/users/LucasIsasmendi/following{/other_user}","gists_url":"https://api.github.com/users/LucasIsasmendi/gists{/gist_id}","starred_url":"https://api.github.com/users/LucasIsasmendi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LucasIsasmendi/subscriptions","organizations_url":"https://api.github.com/users/LucasIsasmendi/orgs","repos_url":"https://api.github.com/users/LucasIsasmendi/repos","events_url":"https://api.github.com/users/LucasIsasmendi/events{/privacy}","received_events_url":"https://api.github.com/users/LucasIsasmendi/received_events","type":"User","site_admin":false},"body":"with ganache blocks are automatic, changed to \"waitForTx * 2\" (200 ms)","created_at":"2018-12-14T17:50:07Z","updated_at":"2018-12-14T17:50:07Z","html_url":"https://github.com/iov-one/iov-core/pull/613#discussion_r241837377","pull_request_url":"https://api.github.com/repos/iov-one/iov-core/pulls/613","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/iov-one/iov-core/pulls/comments/241837377"},"html":{"href":"https://github.com/iov-one/iov-core/pull/613#discussion_r241837377"},"pull_request":{"href":"https://api.github.com/repos/iov-one/iov-core/pulls/613"}},"in_reply_to_id":241833960},"pull_request":{"url":"https://api.github.com/repos/iov-one/iov-core/pulls/613","id":238523859,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM4NTIzODU5","html_url":"https://github.com/iov-one/iov-core/pull/613","diff_url":"https://github.com/iov-one/iov-core/pull/613.diff","patch_url":"https://github.com/iov-one/iov-core/pull/613.patch","issue_url":"https://api.github.com/repos/iov-one/iov-core/issues/613","number":613,"state":"open","locked":false,"title":"Eth newheaders subscription","user":{"login":"LucasIsasmendi","id":4970546,"node_id":"MDQ6VXNlcjQ5NzA1NDY=","avatar_url":"https://avatars3.githubusercontent.com/u/4970546?v=4","gravatar_id":"","url":"https://api.github.com/users/LucasIsasmendi","html_url":"https://github.com/LucasIsasmendi","followers_url":"https://api.github.com/users/LucasIsasmendi/followers","following_url":"https://api.github.com/users/LucasIsasmendi/following{/other_user}","gists_url":"https://api.github.com/users/LucasIsasmendi/gists{/gist_id}","starred_url":"https://api.github.com/users/LucasIsasmendi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LucasIsasmendi/subscriptions","organizations_url":"https://api.github.com/users/LucasIsasmendi/orgs","repos_url":"https://api.github.com/users/LucasIsasmendi/repos","events_url":"https://api.github.com/users/LucasIsasmendi/events{/privacy}","received_events_url":"https://api.github.com/users/LucasIsasmendi/received_events","type":"User","site_admin":false},"body":"Closes #407 ","created_at":"2018-12-13T20:35:12Z","updated_at":"2018-12-14T17:50:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"120c3ed693ed8445314e779d4cde080d31b7ca1c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/iov-one/iov-core/pulls/613/commits","review_comments_url":"https://api.github.com/repos/iov-one/iov-core/pulls/613/comments","review_comment_url":"https://api.github.com/repos/iov-one/iov-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/iov-one/iov-core/issues/613/comments","statuses_url":"https://api.github.com/repos/iov-one/iov-core/statuses/b518d4a5b5281e9dff4751ab9d1bee033b381179","head":{"label":"iov-one:eth-newheaders-subscription","ref":"eth-newheaders-subscription","sha":"b518d4a5b5281e9dff4751ab9d1bee033b381179","user":{"login":"iov-one","id":34400253,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NDAwMjUz","avatar_url":"https://avatars2.githubusercontent.com/u/34400253?v=4","gravatar_id":"","url":"https://api.github.com/users/iov-one","html_url":"https://github.com/iov-one","followers_url":"https://api.github.com/users/iov-one/followers","following_url":"https://api.github.com/users/iov-one/following{/other_user}","gists_url":"https://api.github.com/users/iov-one/gists{/gist_id}","starred_url":"https://api.github.com/users/iov-one/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iov-one/subscriptions","organizations_url":"https://api.github.com/users/iov-one/orgs","repos_url":"https://api.github.com/users/iov-one/repos","events_url":"https://api.github.com/users/iov-one/events{/privacy}","received_events_url":"https://api.github.com/users/iov-one/received_events","type":"Organization","site_admin":false},"repo":{"id":129950372,"node_id":"MDEwOlJlcG9zaXRvcnkxMjk5NTAzNzI=","name":"iov-core","full_name":"iov-one/iov-core","private":false,"owner":{"login":"iov-one","id":34400253,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NDAwMjUz","avatar_url":"https://avatars2.githubusercontent.com/u/34400253?v=4","gravatar_id":"","url":"https://api.github.com/users/iov-one","html_url":"https://github.com/iov-one","followers_url":"https://api.github.com/users/iov-one/followers","following_url":"https://api.github.com/users/iov-one/following{/other_user}","gists_url":"https://api.github.com/users/iov-one/gists{/gist_id}","starred_url":"https://api.github.com/users/iov-one/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iov-one/subscriptions","organizations_url":"https://api.github.com/users/iov-one/orgs","repos_url":"https://api.github.com/users/iov-one/repos","events_url":"https://api.github.com/users/iov-one/events{/privacy}","received_events_url":"https://api.github.com/users/iov-one/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/iov-one/iov-core","description":"Client library for secure key management and multi-blockchain communication","fork":false,"url":"https://api.github.com/repos/iov-one/iov-core","forks_url":"https://api.github.com/repos/iov-one/iov-core/forks","keys_url":"https://api.github.com/repos/iov-one/iov-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iov-one/iov-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iov-one/iov-core/teams","hooks_url":"https://api.github.com/repos/iov-one/iov-core/hooks","issue_events_url":"https://api.github.com/repos/iov-one/iov-core/issues/events{/number}","events_url":"https://api.github.com/repos/iov-one/iov-core/events","assignees_url":"https://api.github.com/repos/iov-one/iov-core/assignees{/user}","branches_url":"https://api.github.com/repos/iov-one/iov-core/branches{/branch}","tags_url":"https://api.github.com/repos/iov-one/iov-core/tags","blobs_url":"https://api.github.com/repos/iov-one/iov-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iov-one/iov-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iov-one/iov-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/iov-one/iov-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iov-one/iov-core/statuses/{sha}","languages_url":"https://api.github.com/repos/iov-one/iov-core/languages","stargazers_url":"https://api.github.com/repos/iov-one/iov-core/stargazers","contributors_url":"https://api.github.com/repos/iov-one/iov-core/contributors","subscribers_url":"https://api.github.com/repos/iov-one/iov-core/subscribers","subscription_url":"https://api.github.com/repos/iov-one/iov-core/subscription","commits_url":"https://api.github.com/repos/iov-one/iov-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/iov-one/iov-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/iov-one/iov-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/iov-one/iov-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/iov-one/iov-core/contents/{+path}","compare_url":"https://api.github.com/repos/iov-one/iov-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iov-one/iov-core/merges","archive_url":"https://api.github.com/repos/iov-one/iov-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iov-one/iov-core/downloads","issues_url":"https://api.github.com/repos/iov-one/iov-core/issues{/number}","pulls_url":"https://api.github.com/repos/iov-one/iov-core/pulls{/number}","milestones_url":"https://api.github.com/repos/iov-one/iov-core/milestones{/number}","notifications_url":"https://api.github.com/repos/iov-one/iov-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iov-one/iov-core/labels{/name}","releases_url":"https://api.github.com/repos/iov-one/iov-core/releases{/id}","deployments_url":"https://api.github.com/repos/iov-one/iov-core/deployments","created_at":"2018-04-17T18:46:16Z","updated_at":"2018-12-14T09:06:32Z","pushed_at":"2018-12-14T17:32:13Z","git_url":"git://github.com/iov-one/iov-core.git","ssh_url":"git@github.com:iov-one/iov-core.git","clone_url":"https://github.com/iov-one/iov-core.git","svn_url":"https://github.com/iov-one/iov-core","homepage":"https://iov-one.github.io/iov-core-docs/","size":4662,"stargazers_count":175,"watchers_count":175,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":45,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":8,"open_issues":45,"watchers":175,"default_branch":"master"}},"base":{"label":"iov-one:master","ref":"master","sha":"6f303fca6ba694f46504a97417582e7721b80721","user":{"login":"iov-one","id":34400253,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NDAwMjUz","avatar_url":"https://avatars2.githubusercontent.com/u/34400253?v=4","gravatar_id":"","url":"https://api.github.com/users/iov-one","html_url":"https://github.com/iov-one","followers_url":"https://api.github.com/users/iov-one/followers","following_url":"https://api.github.com/users/iov-one/following{/other_user}","gists_url":"https://api.github.com/users/iov-one/gists{/gist_id}","starred_url":"https://api.github.com/users/iov-one/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iov-one/subscriptions","organizations_url":"https://api.github.com/users/iov-one/orgs","repos_url":"https://api.github.com/users/iov-one/repos","events_url":"https://api.github.com/users/iov-one/events{/privacy}","received_events_url":"https://api.github.com/users/iov-one/received_events","type":"Organization","site_admin":false},"repo":{"id":129950372,"node_id":"MDEwOlJlcG9zaXRvcnkxMjk5NTAzNzI=","name":"iov-core","full_name":"iov-one/iov-core","private":false,"owner":{"login":"iov-one","id":34400253,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NDAwMjUz","avatar_url":"https://avatars2.githubusercontent.com/u/34400253?v=4","gravatar_id":"","url":"https://api.github.com/users/iov-one","html_url":"https://github.com/iov-one","followers_url":"https://api.github.com/users/iov-one/followers","following_url":"https://api.github.com/users/iov-one/following{/other_user}","gists_url":"https://api.github.com/users/iov-one/gists{/gist_id}","starred_url":"https://api.github.com/users/iov-one/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iov-one/subscriptions","organizations_url":"https://api.github.com/users/iov-one/orgs","repos_url":"https://api.github.com/users/iov-one/repos","events_url":"https://api.github.com/users/iov-one/events{/privacy}","received_events_url":"https://api.github.com/users/iov-one/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/iov-one/iov-core","description":"Client library for secure key management and multi-blockchain communication","fork":false,"url":"https://api.github.com/repos/iov-one/iov-core","forks_url":"https://api.github.com/repos/iov-one/iov-core/forks","keys_url":"https://api.github.com/repos/iov-one/iov-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iov-one/iov-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iov-one/iov-core/teams","hooks_url":"https://api.github.com/repos/iov-one/iov-core/hooks","issue_events_url":"https://api.github.com/repos/iov-one/iov-core/issues/events{/number}","events_url":"https://api.github.com/repos/iov-one/iov-core/events","assignees_url":"https://api.github.com/repos/iov-one/iov-core/assignees{/user}","branches_url":"https://api.github.com/repos/iov-one/iov-core/branches{/branch}","tags_url":"https://api.github.com/repos/iov-one/iov-core/tags","blobs_url":"https://api.github.com/repos/iov-one/iov-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iov-one/iov-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iov-one/iov-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/iov-one/iov-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iov-one/iov-core/statuses/{sha}","languages_url":"https://api.github.com/repos/iov-one/iov-core/languages","stargazers_url":"https://api.github.com/repos/iov-one/iov-core/stargazers","contributors_url":"https://api.github.com/repos/iov-one/iov-core/contributors","subscribers_url":"https://api.github.com/repos/iov-one/iov-core/subscribers","subscription_url":"https://api.github.com/repos/iov-one/iov-core/subscription","commits_url":"https://api.github.com/repos/iov-one/iov-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/iov-one/iov-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/iov-one/iov-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/iov-one/iov-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/iov-one/iov-core/contents/{+path}","compare_url":"https://api.github.com/repos/iov-one/iov-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iov-one/iov-core/merges","archive_url":"https://api.github.com/repos/iov-one/iov-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iov-one/iov-core/downloads","issues_url":"https://api.github.com/repos/iov-one/iov-core/issues{/number}","pulls_url":"https://api.github.com/repos/iov-one/iov-core/pulls{/number}","milestones_url":"https://api.github.com/repos/iov-one/iov-core/milestones{/number}","notifications_url":"https://api.github.com/repos/iov-one/iov-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iov-one/iov-core/labels{/name}","releases_url":"https://api.github.com/repos/iov-one/iov-core/releases{/id}","deployments_url":"https://api.github.com/repos/iov-one/iov-core/deployments","created_at":"2018-04-17T18:46:16Z","updated_at":"2018-12-14T09:06:32Z","pushed_at":"2018-12-14T17:32:13Z","git_url":"git://github.com/iov-one/iov-core.git","ssh_url":"git@github.com:iov-one/iov-core.git","clone_url":"https://github.com/iov-one/iov-core.git","svn_url":"https://github.com/iov-one/iov-core","homepage":"https://iov-one.github.io/iov-core-docs/","size":4662,"stargazers_count":175,"watchers_count":175,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":45,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":8,"open_issues":45,"watchers":175,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/iov-one/iov-core/pulls/613"},"html":{"href":"https://github.com/iov-one/iov-core/pull/613"},"issue":{"href":"https://api.github.com/repos/iov-one/iov-core/issues/613"},"comments":{"href":"https://api.github.com/repos/iov-one/iov-core/issues/613/comments"},"review_comments":{"href":"https://api.github.com/repos/iov-one/iov-core/pulls/613/comments"},"review_comment":{"href":"https://api.github.com/repos/iov-one/iov-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/iov-one/iov-core/pulls/613/commits"},"statuses":{"href":"https://api.github.com/repos/iov-one/iov-core/statuses/b518d4a5b5281e9dff4751ab9d1bee033b381179"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"LucasIsasmendi"}}