{"action":"created","comment":{"url":"https://api.github.com/repos/LedgerHQ/ledgerjs/pulls/comments/165478074","pull_request_review_id":93425883,"id":165478074,"diff_hunk":"@@ -166,6 +181,32 @@ export default class Btc {\n       .then(processOutputs);\n   }\n \n+  async getTrustedInputBIP143(indexLookup: number, transaction: Transaction) {\n+    if (!transaction) {\n+      throw new Error(\"getTrustedInputBIP143: missing tx\");\n+    }\n+    let sha = createHash(\"sha256\");\n+    sha.update(this.serializeTransaction(transaction, true));\n+    let hash = sha.digest();\n+    sha = createHash(\"sha256\");\n+    sha.update(hash);\n+    hash = sha.digest();\n+    const look1 = indexLookup & 0xff;\n+    const look2 = (indexLookup >> 8) & 0xff;\n+    const look3 = (indexLookup >> 16) & 0xff;\n+    const look4 = (indexLookup >> 24) & 0xff;\n+    let data = Buffer.from([look1, look2, look3, look4]);","path":"packages/hw-app-btc/src/Btc.js","position":110,"original_position":110,"commit_id":"e115da96c6c6c81e7c4ba8b6ab2ef7bb73ed19ea","original_commit_id":"e115da96c6c6c81e7c4ba8b6ab2ef7bb73ed19ea","user":{"login":"gre","id":211411,"avatar_url":"https://avatars1.githubusercontent.com/u/211411?v=4","gravatar_id":"","url":"https://api.github.com/users/gre","html_url":"https://github.com/gre","followers_url":"https://api.github.com/users/gre/followers","following_url":"https://api.github.com/users/gre/following{/other_user}","gists_url":"https://api.github.com/users/gre/gists{/gist_id}","starred_url":"https://api.github.com/users/gre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gre/subscriptions","organizations_url":"https://api.github.com/users/gre/orgs","repos_url":"https://api.github.com/users/gre/repos","events_url":"https://api.github.com/users/gre/events{/privacy}","received_events_url":"https://api.github.com/users/gre/received_events","type":"User","site_admin":false},"body":"not very important but I would suggest to use `data = Buffer.alloc(4);` and then do `data.writeUInt32LE(indexLookup, 0)` . it makes it a bit less error prone and simple. \r\n\r\n( ultimately in the future, i wish we can find an interesting abstraction so we don't directly deal with buffer but with a descriptive specification where we express the binary format )","created_at":"2018-02-01T20:27:15Z","updated_at":"2018-02-01T20:32:30Z","html_url":"https://github.com/LedgerHQ/ledgerjs/pull/58#discussion_r165478074","pull_request_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/pulls/58","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/LedgerHQ/ledgerjs/pulls/comments/165478074"},"html":{"href":"https://github.com/LedgerHQ/ledgerjs/pull/58#discussion_r165478074"},"pull_request":{"href":"https://api.github.com/repos/LedgerHQ/ledgerjs/pulls/58"}}},"pull_request":{"url":"https://api.github.com/repos/LedgerHQ/ledgerjs/pulls/58","id":166479017,"html_url":"https://github.com/LedgerHQ/ledgerjs/pull/58","diff_url":"https://github.com/LedgerHQ/ledgerjs/pull/58.diff","patch_url":"https://github.com/LedgerHQ/ledgerjs/pull/58.patch","issue_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/issues/58","number":58,"state":"open","locked":false,"title":"Feature/segwit","user":{"login":"amougel","id":14826906,"avatar_url":"https://avatars3.githubusercontent.com/u/14826906?v=4","gravatar_id":"","url":"https://api.github.com/users/amougel","html_url":"https://github.com/amougel","followers_url":"https://api.github.com/users/amougel/followers","following_url":"https://api.github.com/users/amougel/following{/other_user}","gists_url":"https://api.github.com/users/amougel/gists{/gist_id}","starred_url":"https://api.github.com/users/amougel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amougel/subscriptions","organizations_url":"https://api.github.com/users/amougel/orgs","repos_url":"https://api.github.com/users/amougel/repos","events_url":"https://api.github.com/users/amougel/events{/privacy}","received_events_url":"https://api.github.com/users/amougel/received_events","type":"User","site_admin":false},"body":"Add segwit support for creating payment transaction","created_at":"2018-02-01T09:07:02Z","updated_at":"2018-02-01T20:32:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b35afb83e68684e0d9728f3a6f59018e8f0f4c67","assignee":null,"assignees":[],"requested_reviewers":[{"login":"loeck","id":582703,"avatar_url":"https://avatars0.githubusercontent.com/u/582703?v=4","gravatar_id":"","url":"https://api.github.com/users/loeck","html_url":"https://github.com/loeck","followers_url":"https://api.github.com/users/loeck/followers","following_url":"https://api.github.com/users/loeck/following{/other_user}","gists_url":"https://api.github.com/users/loeck/gists{/gist_id}","starred_url":"https://api.github.com/users/loeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loeck/subscriptions","organizations_url":"https://api.github.com/users/loeck/orgs","repos_url":"https://api.github.com/users/loeck/repos","events_url":"https://api.github.com/users/loeck/events{/privacy}","received_events_url":"https://api.github.com/users/loeck/received_events","type":"User","site_admin":false}],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/pulls/58/commits","review_comments_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/pulls/58/comments","review_comment_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/issues/58/comments","statuses_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/statuses/e115da96c6c6c81e7c4ba8b6ab2ef7bb73ed19ea","head":{"label":"amougel:feature/segwit","ref":"feature/segwit","sha":"e115da96c6c6c81e7c4ba8b6ab2ef7bb73ed19ea","user":{"login":"amougel","id":14826906,"avatar_url":"https://avatars3.githubusercontent.com/u/14826906?v=4","gravatar_id":"","url":"https://api.github.com/users/amougel","html_url":"https://github.com/amougel","followers_url":"https://api.github.com/users/amougel/followers","following_url":"https://api.github.com/users/amougel/following{/other_user}","gists_url":"https://api.github.com/users/amougel/gists{/gist_id}","starred_url":"https://api.github.com/users/amougel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amougel/subscriptions","organizations_url":"https://api.github.com/users/amougel/orgs","repos_url":"https://api.github.com/users/amougel/repos","events_url":"https://api.github.com/users/amougel/events{/privacy}","received_events_url":"https://api.github.com/users/amougel/received_events","type":"User","site_admin":false},"repo":{"id":118607920,"name":"ledgerjs","full_name":"amougel/ledgerjs","owner":{"login":"amougel","id":14826906,"avatar_url":"https://avatars3.githubusercontent.com/u/14826906?v=4","gravatar_id":"","url":"https://api.github.com/users/amougel","html_url":"https://github.com/amougel","followers_url":"https://api.github.com/users/amougel/followers","following_url":"https://api.github.com/users/amougel/following{/other_user}","gists_url":"https://api.github.com/users/amougel/gists{/gist_id}","starred_url":"https://api.github.com/users/amougel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amougel/subscriptions","organizations_url":"https://api.github.com/users/amougel/orgs","repos_url":"https://api.github.com/users/amougel/repos","events_url":"https://api.github.com/users/amougel/events{/privacy}","received_events_url":"https://api.github.com/users/amougel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amougel/ledgerjs","description":"Ledger Nano / Nano S / Blue JavaScript APIs for Node.js and browsers","fork":true,"url":"https://api.github.com/repos/amougel/ledgerjs","forks_url":"https://api.github.com/repos/amougel/ledgerjs/forks","keys_url":"https://api.github.com/repos/amougel/ledgerjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amougel/ledgerjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amougel/ledgerjs/teams","hooks_url":"https://api.github.com/repos/amougel/ledgerjs/hooks","issue_events_url":"https://api.github.com/repos/amougel/ledgerjs/issues/events{/number}","events_url":"https://api.github.com/repos/amougel/ledgerjs/events","assignees_url":"https://api.github.com/repos/amougel/ledgerjs/assignees{/user}","branches_url":"https://api.github.com/repos/amougel/ledgerjs/branches{/branch}","tags_url":"https://api.github.com/repos/amougel/ledgerjs/tags","blobs_url":"https://api.github.com/repos/amougel/ledgerjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amougel/ledgerjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amougel/ledgerjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/amougel/ledgerjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amougel/ledgerjs/statuses/{sha}","languages_url":"https://api.github.com/repos/amougel/ledgerjs/languages","stargazers_url":"https://api.github.com/repos/amougel/ledgerjs/stargazers","contributors_url":"https://api.github.com/repos/amougel/ledgerjs/contributors","subscribers_url":"https://api.github.com/repos/amougel/ledgerjs/subscribers","subscription_url":"https://api.github.com/repos/amougel/ledgerjs/subscription","commits_url":"https://api.github.com/repos/amougel/ledgerjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/amougel/ledgerjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/amougel/ledgerjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/amougel/ledgerjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/amougel/ledgerjs/contents/{+path}","compare_url":"https://api.github.com/repos/amougel/ledgerjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amougel/ledgerjs/merges","archive_url":"https://api.github.com/repos/amougel/ledgerjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amougel/ledgerjs/downloads","issues_url":"https://api.github.com/repos/amougel/ledgerjs/issues{/number}","pulls_url":"https://api.github.com/repos/amougel/ledgerjs/pulls{/number}","milestones_url":"https://api.github.com/repos/amougel/ledgerjs/milestones{/number}","notifications_url":"https://api.github.com/repos/amougel/ledgerjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amougel/ledgerjs/labels{/name}","releases_url":"https://api.github.com/repos/amougel/ledgerjs/releases{/id}","deployments_url":"https://api.github.com/repos/amougel/ledgerjs/deployments","created_at":"2018-01-23T12:32:10Z","updated_at":"2018-01-23T12:32:12Z","pushed_at":"2018-02-01T10:26:40Z","git_url":"git://github.com/amougel/ledgerjs.git","ssh_url":"git@github.com:amougel/ledgerjs.git","clone_url":"https://github.com/amougel/ledgerjs.git","svn_url":"https://github.com/amougel/ledgerjs","homepage":"","size":775,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"LedgerHQ:master","ref":"master","sha":"882b29a5f830ec568d749aef6890cd436ef01b94","user":{"login":"LedgerHQ","id":9784193,"avatar_url":"https://avatars1.githubusercontent.com/u/9784193?v=4","gravatar_id":"","url":"https://api.github.com/users/LedgerHQ","html_url":"https://github.com/LedgerHQ","followers_url":"https://api.github.com/users/LedgerHQ/followers","following_url":"https://api.github.com/users/LedgerHQ/following{/other_user}","gists_url":"https://api.github.com/users/LedgerHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/LedgerHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LedgerHQ/subscriptions","organizations_url":"https://api.github.com/users/LedgerHQ/orgs","repos_url":"https://api.github.com/users/LedgerHQ/repos","events_url":"https://api.github.com/users/LedgerHQ/events{/privacy}","received_events_url":"https://api.github.com/users/LedgerHQ/received_events","type":"Organization","site_admin":false},"repo":{"id":33945868,"name":"ledgerjs","full_name":"LedgerHQ/ledgerjs","owner":{"login":"LedgerHQ","id":9784193,"avatar_url":"https://avatars1.githubusercontent.com/u/9784193?v=4","gravatar_id":"","url":"https://api.github.com/users/LedgerHQ","html_url":"https://github.com/LedgerHQ","followers_url":"https://api.github.com/users/LedgerHQ/followers","following_url":"https://api.github.com/users/LedgerHQ/following{/other_user}","gists_url":"https://api.github.com/users/LedgerHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/LedgerHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LedgerHQ/subscriptions","organizations_url":"https://api.github.com/users/LedgerHQ/orgs","repos_url":"https://api.github.com/users/LedgerHQ/repos","events_url":"https://api.github.com/users/LedgerHQ/events{/privacy}","received_events_url":"https://api.github.com/users/LedgerHQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/LedgerHQ/ledgerjs","description":"Ledger Nano / Nano S / Blue JavaScript APIs for Node.js and browsers","fork":false,"url":"https://api.github.com/repos/LedgerHQ/ledgerjs","forks_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/forks","keys_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/teams","hooks_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/hooks","issue_events_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/issues/events{/number}","events_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/events","assignees_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/assignees{/user}","branches_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/branches{/branch}","tags_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/tags","blobs_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/statuses/{sha}","languages_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/languages","stargazers_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/stargazers","contributors_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/contributors","subscribers_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/subscribers","subscription_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/subscription","commits_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/contents/{+path}","compare_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/merges","archive_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/downloads","issues_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/issues{/number}","pulls_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/pulls{/number}","milestones_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/milestones{/number}","notifications_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/labels{/name}","releases_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/releases{/id}","deployments_url":"https://api.github.com/repos/LedgerHQ/ledgerjs/deployments","created_at":"2015-04-14T17:16:09Z","updated_at":"2018-02-01T11:30:33Z","pushed_at":"2018-02-01T19:53:05Z","git_url":"git://github.com/LedgerHQ/ledgerjs.git","ssh_url":"git@github.com:LedgerHQ/ledgerjs.git","clone_url":"https://github.com/LedgerHQ/ledgerjs.git","svn_url":"https://github.com/LedgerHQ/ledgerjs","homepage":"http://ledgerhq.github.io/ledgerjs/","size":2119,"stargazers_count":58,"watchers_count":58,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":41,"mirror_url":null,"archived":false,"open_issues_count":16,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":41,"open_issues":16,"watchers":58,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/LedgerHQ/ledgerjs/pulls/58"},"html":{"href":"https://github.com/LedgerHQ/ledgerjs/pull/58"},"issue":{"href":"https://api.github.com/repos/LedgerHQ/ledgerjs/issues/58"},"comments":{"href":"https://api.github.com/repos/LedgerHQ/ledgerjs/issues/58/comments"},"review_comments":{"href":"https://api.github.com/repos/LedgerHQ/ledgerjs/pulls/58/comments"},"review_comment":{"href":"https://api.github.com/repos/LedgerHQ/ledgerjs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/LedgerHQ/ledgerjs/pulls/58/commits"},"statuses":{"href":"https://api.github.com/repos/LedgerHQ/ledgerjs/statuses/e115da96c6c6c81e7c4ba8b6ab2ef7bb73ed19ea"}},"author_association":"NONE"}}
{"actor":{"display_login":"gre"}}