{"action":"created","comment":{"url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/pulls/comments/241598099","pull_request_review_id":184914135,"id":241598099,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MTU5ODA5OQ==","diff_hunk":"@@ -84,6 +90,8 @@ const handleSignUtxo = function(recoveryRequest, key, skipConfirm) {\n     throw new Error(`Unsupported coin: ${recoveryRequest.coin}`);\n   }\n \n+  const isBCH = recoveryRequest.coin === 'bch' || recoveryRequest.coin === 'tbch';\n+  const isZEC = recoveryRequest.coin === 'zec' || recoveryRequest.coin === 'tzec';","path":"app/sign.js","position":38,"original_position":38,"commit_id":"29620c587f35925ade3759643adeeb20d498748d","original_commit_id":"29620c587f35925ade3759643adeeb20d498748d","user":{"login":"cooncesean","id":47877,"node_id":"MDQ6VXNlcjQ3ODc3","avatar_url":"https://avatars0.githubusercontent.com/u/47877?v=4","gravatar_id":"","url":"https://api.github.com/users/cooncesean","html_url":"https://github.com/cooncesean","followers_url":"https://api.github.com/users/cooncesean/followers","following_url":"https://api.github.com/users/cooncesean/following{/other_user}","gists_url":"https://api.github.com/users/cooncesean/gists{/gist_id}","starred_url":"https://api.github.com/users/cooncesean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cooncesean/subscriptions","organizations_url":"https://api.github.com/users/cooncesean/orgs","repos_url":"https://api.github.com/users/cooncesean/repos","events_url":"https://api.github.com/users/cooncesean/events{/privacy}","received_events_url":"https://api.github.com/users/cooncesean/received_events","type":"User","site_admin":false},"body":"Perhaps out of the scope of this change request, but I could see this coin specific logic like this turning into a mess of spaghetti conditionals over time.\r\n\r\nAn alternative approach we might think about is to take a class based approach ... something along the lines of:\r\n\r\n_(excuse the sloppy typescript -- i'm not a js dev) ..._\r\n\r\n```typescript\r\nclass AbstractCoinSigner {\r\n  handleSignUtxo(recoveryRequest, key, skipConfirm) {\r\n    // keep all existing logic in this fcn\r\n\r\n    // provide hooks to allow subclasses to execute custom logic\r\n    transaction = this.optionalInputManipulation(transaction);\r\n  },\r\n\r\n   // this fcn is a no-op on the parent class\r\n   optionalInputManipulation(transaction) {\r\n     return transaction;\r\n   },\r\n}\r\n\r\nclass ZECSigner extends AbstractCoinSigner {\r\n\r\n   // The fcn is overidden to apply custom logic for ZEC\r\n   optionalInputManipulation(transaction) { \r\n\r\n     // Add the input values to each input, because input values must be signed\r\n     transaction.ins.forEach(function (input, i) {\r\n       transaction.ins[i].value = recoveryRequest.inputs[i].amount;\r\n     })\r\n\r\n     return transaction;\r\n   },\r\n}\r\n\r\n// Similar logic for BCH\r\n```\r\n\r\nWe'd have to do some mapping between the coin assoc'd the wallet being recovered and the classes that should be used in order to sign the recovery tx .... but it keeps the code isolated to its logical components and hopefully easier to reason about over time.\r\n\r\n@dacruz21 -- you have thoughts on this?","created_at":"2018-12-13T23:22:28Z","updated_at":"2018-12-13T23:23:35Z","html_url":"https://github.com/BitGo/key-recovery-service-v2/pull/39#discussion_r241598099","pull_request_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/pulls/39","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/BitGo/key-recovery-service-v2/pulls/comments/241598099"},"html":{"href":"https://github.com/BitGo/key-recovery-service-v2/pull/39#discussion_r241598099"},"pull_request":{"href":"https://api.github.com/repos/BitGo/key-recovery-service-v2/pulls/39"}}},"pull_request":{"url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/pulls/39","id":238528755,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM4NTI4NzU1","html_url":"https://github.com/BitGo/key-recovery-service-v2/pull/39","diff_url":"https://github.com/BitGo/key-recovery-service-v2/pull/39.diff","patch_url":"https://github.com/BitGo/key-recovery-service-v2/pull/39.patch","issue_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/issues/39","number":39,"state":"open","locked":false,"title":"[BG-9398] Support BCH and ZEC signing","user":{"login":"dannybitgo","id":43550949,"node_id":"MDQ6VXNlcjQzNTUwOTQ5","avatar_url":"https://avatars1.githubusercontent.com/u/43550949?v=4","gravatar_id":"","url":"https://api.github.com/users/dannybitgo","html_url":"https://github.com/dannybitgo","followers_url":"https://api.github.com/users/dannybitgo/followers","following_url":"https://api.github.com/users/dannybitgo/following{/other_user}","gists_url":"https://api.github.com/users/dannybitgo/gists{/gist_id}","starred_url":"https://api.github.com/users/dannybitgo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dannybitgo/subscriptions","organizations_url":"https://api.github.com/users/dannybitgo/orgs","repos_url":"https://api.github.com/users/dannybitgo/repos","events_url":"https://api.github.com/users/dannybitgo/events{/privacy}","received_events_url":"https://api.github.com/users/dannybitgo/received_events","type":"User","site_admin":false},"body":"The PR enables proper BCH and ZEC recovery signings. Tested with integration tests on Dev.","created_at":"2018-12-13T20:54:01Z","updated_at":"2018-12-13T23:23:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"24358368b8711c638d85f3dd190a9db00e1d6647","assignee":null,"assignees":[],"requested_reviewers":[{"login":"dacruz21","id":36964941,"node_id":"MDQ6VXNlcjM2OTY0OTQx","avatar_url":"https://avatars0.githubusercontent.com/u/36964941?v=4","gravatar_id":"","url":"https://api.github.com/users/dacruz21","html_url":"https://github.com/dacruz21","followers_url":"https://api.github.com/users/dacruz21/followers","following_url":"https://api.github.com/users/dacruz21/following{/other_user}","gists_url":"https://api.github.com/users/dacruz21/gists{/gist_id}","starred_url":"https://api.github.com/users/dacruz21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dacruz21/subscriptions","organizations_url":"https://api.github.com/users/dacruz21/orgs","repos_url":"https://api.github.com/users/dacruz21/repos","events_url":"https://api.github.com/users/dacruz21/events{/privacy}","received_events_url":"https://api.github.com/users/dacruz21/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/pulls/39/commits","review_comments_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/pulls/39/comments","review_comment_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/issues/39/comments","statuses_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/statuses/29620c587f35925ade3759643adeeb20d498748d","head":{"label":"BitGo:add-test-network-configs","ref":"add-test-network-configs","sha":"29620c587f35925ade3759643adeeb20d498748d","user":{"login":"BitGo","id":6267684,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyNjc2ODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/6267684?v=4","gravatar_id":"","url":"https://api.github.com/users/BitGo","html_url":"https://github.com/BitGo","followers_url":"https://api.github.com/users/BitGo/followers","following_url":"https://api.github.com/users/BitGo/following{/other_user}","gists_url":"https://api.github.com/users/BitGo/gists{/gist_id}","starred_url":"https://api.github.com/users/BitGo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BitGo/subscriptions","organizations_url":"https://api.github.com/users/BitGo/orgs","repos_url":"https://api.github.com/users/BitGo/repos","events_url":"https://api.github.com/users/BitGo/events{/privacy}","received_events_url":"https://api.github.com/users/BitGo/received_events","type":"Organization","site_admin":false},"repo":{"id":142051868,"node_id":"MDEwOlJlcG9zaXRvcnkxNDIwNTE4Njg=","name":"key-recovery-service-v2","full_name":"BitGo/key-recovery-service-v2","private":false,"owner":{"login":"BitGo","id":6267684,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyNjc2ODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/6267684?v=4","gravatar_id":"","url":"https://api.github.com/users/BitGo","html_url":"https://github.com/BitGo","followers_url":"https://api.github.com/users/BitGo/followers","following_url":"https://api.github.com/users/BitGo/following{/other_user}","gists_url":"https://api.github.com/users/BitGo/gists{/gist_id}","starred_url":"https://api.github.com/users/BitGo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BitGo/subscriptions","organizations_url":"https://api.github.com/users/BitGo/orgs","repos_url":"https://api.github.com/users/BitGo/repos","events_url":"https://api.github.com/users/BitGo/events{/privacy}","received_events_url":"https://api.github.com/users/BitGo/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/BitGo/key-recovery-service-v2","description":"Key Recovery Service server for all v2 coins and ERC20 tokens","fork":false,"url":"https://api.github.com/repos/BitGo/key-recovery-service-v2","forks_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/forks","keys_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/teams","hooks_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/hooks","issue_events_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/issues/events{/number}","events_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/events","assignees_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/assignees{/user}","branches_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/branches{/branch}","tags_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/tags","blobs_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/git/refs{/sha}","trees_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/statuses/{sha}","languages_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/languages","stargazers_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/stargazers","contributors_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/contributors","subscribers_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/subscribers","subscription_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/subscription","commits_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/commits{/sha}","git_commits_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/git/commits{/sha}","comments_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/comments{/number}","issue_comment_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/issues/comments{/number}","contents_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/contents/{+path}","compare_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/merges","archive_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/downloads","issues_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/issues{/number}","pulls_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/pulls{/number}","milestones_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/milestones{/number}","notifications_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/labels{/name}","releases_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/releases{/id}","deployments_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/deployments","created_at":"2018-07-23T18:14:51Z","updated_at":"2018-12-13T20:51:14Z","pushed_at":"2018-12-13T22:59:09Z","git_url":"git://github.com/BitGo/key-recovery-service-v2.git","ssh_url":"git@github.com:BitGo/key-recovery-service-v2.git","clone_url":"https://github.com/BitGo/key-recovery-service-v2.git","svn_url":"https://github.com/BitGo/key-recovery-service-v2","homepage":null,"size":402,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":5,"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":3,"open_issues":5,"watchers":4,"default_branch":"master"}},"base":{"label":"BitGo:master","ref":"master","sha":"5c8865b58a7d0dc5cbdb6749039472a2a9a6f669","user":{"login":"BitGo","id":6267684,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyNjc2ODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/6267684?v=4","gravatar_id":"","url":"https://api.github.com/users/BitGo","html_url":"https://github.com/BitGo","followers_url":"https://api.github.com/users/BitGo/followers","following_url":"https://api.github.com/users/BitGo/following{/other_user}","gists_url":"https://api.github.com/users/BitGo/gists{/gist_id}","starred_url":"https://api.github.com/users/BitGo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BitGo/subscriptions","organizations_url":"https://api.github.com/users/BitGo/orgs","repos_url":"https://api.github.com/users/BitGo/repos","events_url":"https://api.github.com/users/BitGo/events{/privacy}","received_events_url":"https://api.github.com/users/BitGo/received_events","type":"Organization","site_admin":false},"repo":{"id":142051868,"node_id":"MDEwOlJlcG9zaXRvcnkxNDIwNTE4Njg=","name":"key-recovery-service-v2","full_name":"BitGo/key-recovery-service-v2","private":false,"owner":{"login":"BitGo","id":6267684,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyNjc2ODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/6267684?v=4","gravatar_id":"","url":"https://api.github.com/users/BitGo","html_url":"https://github.com/BitGo","followers_url":"https://api.github.com/users/BitGo/followers","following_url":"https://api.github.com/users/BitGo/following{/other_user}","gists_url":"https://api.github.com/users/BitGo/gists{/gist_id}","starred_url":"https://api.github.com/users/BitGo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BitGo/subscriptions","organizations_url":"https://api.github.com/users/BitGo/orgs","repos_url":"https://api.github.com/users/BitGo/repos","events_url":"https://api.github.com/users/BitGo/events{/privacy}","received_events_url":"https://api.github.com/users/BitGo/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/BitGo/key-recovery-service-v2","description":"Key Recovery Service server for all v2 coins and ERC20 tokens","fork":false,"url":"https://api.github.com/repos/BitGo/key-recovery-service-v2","forks_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/forks","keys_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/teams","hooks_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/hooks","issue_events_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/issues/events{/number}","events_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/events","assignees_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/assignees{/user}","branches_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/branches{/branch}","tags_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/tags","blobs_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/git/refs{/sha}","trees_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/statuses/{sha}","languages_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/languages","stargazers_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/stargazers","contributors_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/contributors","subscribers_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/subscribers","subscription_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/subscription","commits_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/commits{/sha}","git_commits_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/git/commits{/sha}","comments_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/comments{/number}","issue_comment_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/issues/comments{/number}","contents_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/contents/{+path}","compare_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/merges","archive_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/downloads","issues_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/issues{/number}","pulls_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/pulls{/number}","milestones_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/milestones{/number}","notifications_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/labels{/name}","releases_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/releases{/id}","deployments_url":"https://api.github.com/repos/BitGo/key-recovery-service-v2/deployments","created_at":"2018-07-23T18:14:51Z","updated_at":"2018-12-13T20:51:14Z","pushed_at":"2018-12-13T22:59:09Z","git_url":"git://github.com/BitGo/key-recovery-service-v2.git","ssh_url":"git@github.com:BitGo/key-recovery-service-v2.git","clone_url":"https://github.com/BitGo/key-recovery-service-v2.git","svn_url":"https://github.com/BitGo/key-recovery-service-v2","homepage":null,"size":402,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":5,"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":3,"open_issues":5,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BitGo/key-recovery-service-v2/pulls/39"},"html":{"href":"https://github.com/BitGo/key-recovery-service-v2/pull/39"},"issue":{"href":"https://api.github.com/repos/BitGo/key-recovery-service-v2/issues/39"},"comments":{"href":"https://api.github.com/repos/BitGo/key-recovery-service-v2/issues/39/comments"},"review_comments":{"href":"https://api.github.com/repos/BitGo/key-recovery-service-v2/pulls/39/comments"},"review_comment":{"href":"https://api.github.com/repos/BitGo/key-recovery-service-v2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BitGo/key-recovery-service-v2/pulls/39/commits"},"statuses":{"href":"https://api.github.com/repos/BitGo/key-recovery-service-v2/statuses/29620c587f35925ade3759643adeeb20d498748d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"cooncesean"}}