{"action":"created","comment":{"url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/pulls/comments/233914325","pull_request_review_id":175423354,"id":233914325,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzkxNDMyNQ==","diff_hunk":"@@ -21,41 +21,103 @@ import { Button, ButtonLink, Input, Select } from '../../../components/forms';\n import { Entry } from '../../../components/guide/entry';\n import { Guide } from '../../../components/guide/guide';\n import Header from '../../../components/header/Header';\n+import { load } from '../../../decorators/load';\n import { translate, TranslateProps } from '../../../decorators/translate';\n import { apiPost } from '../../../utils/request';\n \n+const COIN_AND_ACCOUNT_CODES = {\n+    'btc-p2wpkh-p2sh': {\n+        name: 'Bitcoin',\n+        coinCode: 'btc',\n+        scriptType: 'p2wpkh-p2sh',\n+    },\n+    'btc-p2wpkh': {\n+        name: 'Bitcoin: bech32',\n+        coinCode: 'btc',\n+        scriptType: 'p2wpkh',\n+    },\n+    'btc-p2pkh': {\n+        name: 'Bitcoin Legacy',\n+        coinCode: 'btc',\n+        scriptType: 'p2pkh',\n+    },\n+    'ltc-p2wpkh-p2sh': {\n+        name: 'Litecoin',\n+        coinCode: 'ltc',\n+        scriptType: 'p2wpkh-p2sh',\n+    },\n+    'ltc-p2wpkh': {\n+        name: 'Litecoin: bech32',\n+        coinCode: 'ltc',\n+        scriptType: 'p2wpkh',\n+    },\n+    // Testnet\n+    'tbtc-p2wpkh-p2sh': {\n+        name: 'Bitcoin Testnet',\n+        coinCode: 'tbtc',\n+        scriptType: 'p2wpkh-p2sh',\n+    },\n+    'tbtc-p2wpkh': {\n+        name: 'Bitcoin Testnet: bech32',\n+        coinCode: 'tbtc',\n+        scriptType: 'p2wpkh',\n+    },\n+    'tbtc-p2pkh': {\n+        name: 'Bitcoin Testnet Legacy',\n+        coinCode: 'tbtc',\n+        scriptType: 'p2pkh',\n+    },\n+    'tltc-p2wpkh-p2sh': {\n+        name: 'Litecoin Testnet',\n+        coinCode: 'tltc',\n+        scriptType: 'p2wpkh-p2sh',\n+    },\n+    'tltc-p2wpkh': {\n+        name: 'Litecoin Testnet: bech32',\n+        coinCode: 'tltc',\n+        scriptType: 'p2wpkh',\n+    },\n+};\n+\n+\n+\n interface State {\n-    coinCode: string;\n-    scriptType: string;\n+    value: string;\n     accountName: string;\n     extendedPublicKey: string;\n }\n \n-class AddAccount extends Component<TranslateProps, State> {\n-    constructor(props: TranslateProps) {\n+interface TestingProps {\n+    testing?: boolean;\n+}\n+\n+type Props = TestingProps & TranslateProps;\n+\n+class AddAccount extends Component<Props, State> {\n+    constructor(props: Props) {\n         super(props);\n \n         this.state = {\n-            coinCode: 'tbtc',\n-            scriptType: 'p2wpkh-p2sh',\n+            value: props.testing ? 'tbtc-p2wpkh-p2sh' : 'btc-p2wpkh-p2sh',\n             accountName: '',\n             extendedPublicKey: '',\n         };\n     }\n \n     private submit = () => {\n-        const body = {\n-            coinCode: this.state.coinCode,\n-            scriptType: this.state.scriptType,\n+        const { coinCode, scriptType } = COIN_AND_ACCOUNT_CODES[this.state.value];","path":"frontends/web/src/routes/account/add/addaccount.tsx","position":97,"original_position":97,"commit_id":"9a76b2cecd515d9bf49a01664c204879f383e132","original_commit_id":"9a76b2cecd515d9bf49a01664c204879f383e132","user":{"login":"KasparEtter","id":16501371,"node_id":"MDQ6VXNlcjE2NTAxMzcx","avatar_url":"https://avatars3.githubusercontent.com/u/16501371?v=4","gravatar_id":"","url":"https://api.github.com/users/KasparEtter","html_url":"https://github.com/KasparEtter","followers_url":"https://api.github.com/users/KasparEtter/followers","following_url":"https://api.github.com/users/KasparEtter/following{/other_user}","gists_url":"https://api.github.com/users/KasparEtter/gists{/gist_id}","starred_url":"https://api.github.com/users/KasparEtter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KasparEtter/subscriptions","organizations_url":"https://api.github.com/users/KasparEtter/orgs","repos_url":"https://api.github.com/users/KasparEtter/repos","events_url":"https://api.github.com/users/KasparEtter/events{/privacy}","received_events_url":"https://api.github.com/users/KasparEtter/received_events","type":"User","site_admin":false},"body":"I'm not sure whether `coinCode, scriptType` are typed here. Please verify in IDE by hovering over the names. If not, we could/should improve the typing of `COIN_AND_ACCOUNT_CODES`. But maybe typing `this.state.value` as suggested above already helped.","created_at":"2018-11-15T16:26:43Z","updated_at":"2018-11-15T16:30:00Z","html_url":"https://github.com/digitalbitbox/bitbox-wallet-app/pull/222#discussion_r233914325","pull_request_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/pulls/222","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/pulls/comments/233914325"},"html":{"href":"https://github.com/digitalbitbox/bitbox-wallet-app/pull/222#discussion_r233914325"},"pull_request":{"href":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/pulls/222"}}},"pull_request":{"url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/pulls/222","id":231223855,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxMjIzODU1","html_url":"https://github.com/digitalbitbox/bitbox-wallet-app/pull/222","diff_url":"https://github.com/digitalbitbox/bitbox-wallet-app/pull/222.diff","patch_url":"https://github.com/digitalbitbox/bitbox-wallet-app/pull/222.patch","issue_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/issues/222","number":222,"state":"open","locked":false,"title":"frontend: unify coin and script type into one dropdown","user":{"login":"thisconnect","id":546900,"node_id":"MDQ6VXNlcjU0NjkwMA==","avatar_url":"https://avatars3.githubusercontent.com/u/546900?v=4","gravatar_id":"","url":"https://api.github.com/users/thisconnect","html_url":"https://github.com/thisconnect","followers_url":"https://api.github.com/users/thisconnect/followers","following_url":"https://api.github.com/users/thisconnect/following{/other_user}","gists_url":"https://api.github.com/users/thisconnect/gists{/gist_id}","starred_url":"https://api.github.com/users/thisconnect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thisconnect/subscriptions","organizations_url":"https://api.github.com/users/thisconnect/orgs","repos_url":"https://api.github.com/users/thisconnect/repos","events_url":"https://api.github.com/users/thisconnect/events{/privacy}","received_events_url":"https://api.github.com/users/thisconnect/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-11-15T14:58:16Z","updated_at":"2018-11-15T16:30:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f02f9e537bb6839e917dc9bca570f6fb5c54ebfd","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/pulls/222/commits","review_comments_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/pulls/222/comments","review_comment_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/issues/222/comments","statuses_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/statuses/9a76b2cecd515d9bf49a01664c204879f383e132","head":{"label":"thisconnect:frontend-addaccount-combine-dropdown","ref":"frontend-addaccount-combine-dropdown","sha":"9a76b2cecd515d9bf49a01664c204879f383e132","user":{"login":"thisconnect","id":546900,"node_id":"MDQ6VXNlcjU0NjkwMA==","avatar_url":"https://avatars3.githubusercontent.com/u/546900?v=4","gravatar_id":"","url":"https://api.github.com/users/thisconnect","html_url":"https://github.com/thisconnect","followers_url":"https://api.github.com/users/thisconnect/followers","following_url":"https://api.github.com/users/thisconnect/following{/other_user}","gists_url":"https://api.github.com/users/thisconnect/gists{/gist_id}","starred_url":"https://api.github.com/users/thisconnect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thisconnect/subscriptions","organizations_url":"https://api.github.com/users/thisconnect/orgs","repos_url":"https://api.github.com/users/thisconnect/repos","events_url":"https://api.github.com/users/thisconnect/events{/privacy}","received_events_url":"https://api.github.com/users/thisconnect/received_events","type":"User","site_admin":false},"repo":{"id":143622850,"node_id":"MDEwOlJlcG9zaXRvcnkxNDM2MjI4NTA=","name":"bitbox-wallet-app","full_name":"thisconnect/bitbox-wallet-app","private":false,"owner":{"login":"thisconnect","id":546900,"node_id":"MDQ6VXNlcjU0NjkwMA==","avatar_url":"https://avatars3.githubusercontent.com/u/546900?v=4","gravatar_id":"","url":"https://api.github.com/users/thisconnect","html_url":"https://github.com/thisconnect","followers_url":"https://api.github.com/users/thisconnect/followers","following_url":"https://api.github.com/users/thisconnect/following{/other_user}","gists_url":"https://api.github.com/users/thisconnect/gists{/gist_id}","starred_url":"https://api.github.com/users/thisconnect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thisconnect/subscriptions","organizations_url":"https://api.github.com/users/thisconnect/orgs","repos_url":"https://api.github.com/users/thisconnect/repos","events_url":"https://api.github.com/users/thisconnect/events{/privacy}","received_events_url":"https://api.github.com/users/thisconnect/received_events","type":"User","site_admin":false},"html_url":"https://github.com/thisconnect/bitbox-wallet-app","description":null,"fork":true,"url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app","forks_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/forks","keys_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/teams","hooks_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/hooks","issue_events_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/issues/events{/number}","events_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/events","assignees_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/assignees{/user}","branches_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/branches{/branch}","tags_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/tags","blobs_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/git/refs{/sha}","trees_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/statuses/{sha}","languages_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/languages","stargazers_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/stargazers","contributors_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/contributors","subscribers_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/subscribers","subscription_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/subscription","commits_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/commits{/sha}","git_commits_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/git/commits{/sha}","comments_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/comments{/number}","issue_comment_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/issues/comments{/number}","contents_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/contents/{+path}","compare_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/merges","archive_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/downloads","issues_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/issues{/number}","pulls_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/pulls{/number}","milestones_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/milestones{/number}","notifications_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/labels{/name}","releases_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/releases{/id}","deployments_url":"https://api.github.com/repos/thisconnect/bitbox-wallet-app/deployments","created_at":"2018-08-05T15:05:45Z","updated_at":"2018-11-15T12:56:23Z","pushed_at":"2018-11-15T14:57:50Z","git_url":"git://github.com/thisconnect/bitbox-wallet-app.git","ssh_url":"git@github.com:thisconnect/bitbox-wallet-app.git","clone_url":"https://github.com/thisconnect/bitbox-wallet-app.git","svn_url":"https://github.com/thisconnect/bitbox-wallet-app","homepage":"https://shiftcrypto.ch","size":24684,"stargazers_count":0,"watchers_count":0,"language":"Go","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":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"digitalbitbox:master","ref":"master","sha":"f748bd8a8ae6cb35295d3121d75641809a36cdfe","user":{"login":"digitalbitbox","id":12703801,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyNzAzODAx","avatar_url":"https://avatars3.githubusercontent.com/u/12703801?v=4","gravatar_id":"","url":"https://api.github.com/users/digitalbitbox","html_url":"https://github.com/digitalbitbox","followers_url":"https://api.github.com/users/digitalbitbox/followers","following_url":"https://api.github.com/users/digitalbitbox/following{/other_user}","gists_url":"https://api.github.com/users/digitalbitbox/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalbitbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalbitbox/subscriptions","organizations_url":"https://api.github.com/users/digitalbitbox/orgs","repos_url":"https://api.github.com/users/digitalbitbox/repos","events_url":"https://api.github.com/users/digitalbitbox/events{/privacy}","received_events_url":"https://api.github.com/users/digitalbitbox/received_events","type":"Organization","site_admin":false},"repo":{"id":143284695,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMyODQ2OTU=","name":"bitbox-wallet-app","full_name":"digitalbitbox/bitbox-wallet-app","private":false,"owner":{"login":"digitalbitbox","id":12703801,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyNzAzODAx","avatar_url":"https://avatars3.githubusercontent.com/u/12703801?v=4","gravatar_id":"","url":"https://api.github.com/users/digitalbitbox","html_url":"https://github.com/digitalbitbox","followers_url":"https://api.github.com/users/digitalbitbox/followers","following_url":"https://api.github.com/users/digitalbitbox/following{/other_user}","gists_url":"https://api.github.com/users/digitalbitbox/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalbitbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalbitbox/subscriptions","organizations_url":"https://api.github.com/users/digitalbitbox/orgs","repos_url":"https://api.github.com/users/digitalbitbox/repos","events_url":"https://api.github.com/users/digitalbitbox/events{/privacy}","received_events_url":"https://api.github.com/users/digitalbitbox/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/digitalbitbox/bitbox-wallet-app","description":null,"fork":false,"url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app","forks_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/forks","keys_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/teams","hooks_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/hooks","issue_events_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/issues/events{/number}","events_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/events","assignees_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/assignees{/user}","branches_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/branches{/branch}","tags_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/tags","blobs_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/git/refs{/sha}","trees_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/statuses/{sha}","languages_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/languages","stargazers_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/stargazers","contributors_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/contributors","subscribers_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/subscribers","subscription_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/subscription","commits_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/commits{/sha}","git_commits_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/git/commits{/sha}","comments_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/comments{/number}","issue_comment_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/issues/comments{/number}","contents_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/contents/{+path}","compare_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/merges","archive_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/downloads","issues_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/issues{/number}","pulls_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/pulls{/number}","milestones_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/milestones{/number}","notifications_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/labels{/name}","releases_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/releases{/id}","deployments_url":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/deployments","created_at":"2018-08-02T11:17:59Z","updated_at":"2018-11-15T14:49:35Z","pushed_at":"2018-11-15T14:58:17Z","git_url":"git://github.com/digitalbitbox/bitbox-wallet-app.git","ssh_url":"git@github.com:digitalbitbox/bitbox-wallet-app.git","clone_url":"https://github.com/digitalbitbox/bitbox-wallet-app.git","svn_url":"https://github.com/digitalbitbox/bitbox-wallet-app","homepage":"https://shiftcrypto.ch","size":24659,"stargazers_count":19,"watchers_count":19,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":16,"open_issues":9,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/pulls/222"},"html":{"href":"https://github.com/digitalbitbox/bitbox-wallet-app/pull/222"},"issue":{"href":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/issues/222"},"comments":{"href":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/issues/222/comments"},"review_comments":{"href":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/pulls/222/comments"},"review_comment":{"href":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/pulls/222/commits"},"statuses":{"href":"https://api.github.com/repos/digitalbitbox/bitbox-wallet-app/statuses/9a76b2cecd515d9bf49a01664c204879f383e132"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"KasparEtter"}}