{"action":"created","comment":{"url":"https://api.github.com/repos/dgarage/dlc/pulls/comments/230271440","pull_request_review_id":170971955,"id":230271440,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMDI3MTQ0MA==","diff_hunk":"@@ -0,0 +1,69 @@\n+package wallet\n+\n+import (\n+\t\"github.com/adiabat/btcd/btcec\"\n+\t\"github.com/adiabat/btcd/txscript\"\n+\t\"github.com/btcsuite/btcutil\"\n+\t\"github.com/btcsuite/btcwallet/waddrmgr\"\n+\t\"github.com/btcsuite/btcwallet/walletdb\"\n+)\n+\n+func (w *wallet) NewPubkey() (pub *btcec.PublicKey, err error) {\n+\t// TODO: generate new pubkey and address using newAddress\n+\t_, err = w.newAddress(waddrmgr.KeyScopeBIP0084, []byte{}, uint32(1), uint32(1))\n+\tif err != nil {\n+\t\treturn\n+\t}\n+\treturn\n+}\n+\n+func (w *wallet) NewWitnessPubkeyScript() (pkScript []byte, err error) {\n+\tvar pub *btcec.PublicKey\n+\tpub, err = w.NewPubkey()\n+\tif err != nil {\n+\t\treturn\n+\t}\n+\treturn P2WPKHpkScript(pub)\n+}\n+\n+// P2WPKHpkScript creates a withenss script for given pubkey\n+func P2WPKHpkScript(pub *btcec.PublicKey) ([]byte, error) {\n+\tbuilder := txscript.NewScriptBuilder()\n+\tbuilder.AddOp(txscript.OP_0)\n+\tbuilder.AddData(btcutil.Hash160(pub.SerializeCompressed()))\n+\treturn builder.Script()\n+}\n+\n+// NewAddress returns a new ManagedAddress for a given scope and account number.\n+// NOTE: this function callsNextExternalAddresses to generate a ManagadAdddress.\n+func (w *wallet) newAddress(scope waddrmgr.KeyScope, privPass []byte,\n+\taccount uint32, numAddresses uint32) ([]waddrmgr.ManagedAddress, error) {","path":"internal/wallet/address.go","position":40,"original_position":40,"commit_id":"df46d7b2c30b644e14c77d07b7de05abb7cbdd94","original_commit_id":"df46d7b2c30b644e14c77d07b7de05abb7cbdd94","user":{"login":"Jwata","id":1701243,"node_id":"MDQ6VXNlcjE3MDEyNDM=","avatar_url":"https://avatars3.githubusercontent.com/u/1701243?v=4","gravatar_id":"","url":"https://api.github.com/users/Jwata","html_url":"https://github.com/Jwata","followers_url":"https://api.github.com/users/Jwata/followers","following_url":"https://api.github.com/users/Jwata/following{/other_user}","gists_url":"https://api.github.com/users/Jwata/gists{/gist_id}","starred_url":"https://api.github.com/users/Jwata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jwata/subscriptions","organizations_url":"https://api.github.com/users/Jwata/orgs","repos_url":"https://api.github.com/users/Jwata/repos","events_url":"https://api.github.com/users/Jwata/events{/privacy}","received_events_url":"https://api.github.com/users/Jwata/received_events","type":"User","site_admin":false},"body":"Store privPass and account to wallet struct at openning wallet.","created_at":"2018-11-02T05:10:32Z","updated_at":"2018-11-02T05:10:32Z","html_url":"https://github.com/dgarage/dlc/pull/45#discussion_r230271440","pull_request_url":"https://api.github.com/repos/dgarage/dlc/pulls/45","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/dgarage/dlc/pulls/comments/230271440"},"html":{"href":"https://github.com/dgarage/dlc/pull/45#discussion_r230271440"},"pull_request":{"href":"https://api.github.com/repos/dgarage/dlc/pulls/45"}}},"pull_request":{"url":"https://api.github.com/repos/dgarage/dlc/pulls/45","id":227539860,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3NTM5ODYw","html_url":"https://github.com/dgarage/dlc/pull/45","diff_url":"https://github.com/dgarage/dlc/pull/45.diff","patch_url":"https://github.com/dgarage/dlc/pull/45.patch","issue_url":"https://api.github.com/repos/dgarage/dlc/issues/45","number":45,"state":"open","locked":false,"title":"define wallet interface","user":{"login":"Jwata","id":1701243,"node_id":"MDQ6VXNlcjE3MDEyNDM=","avatar_url":"https://avatars3.githubusercontent.com/u/1701243?v=4","gravatar_id":"","url":"https://api.github.com/users/Jwata","html_url":"https://github.com/Jwata","followers_url":"https://api.github.com/users/Jwata/followers","following_url":"https://api.github.com/users/Jwata/following{/other_user}","gists_url":"https://api.github.com/users/Jwata/gists{/gist_id}","starred_url":"https://api.github.com/users/Jwata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jwata/subscriptions","organizations_url":"https://api.github.com/users/Jwata/orgs","repos_url":"https://api.github.com/users/Jwata/repos","events_url":"https://api.github.com/users/Jwata/events{/privacy}","received_events_url":"https://api.github.com/users/Jwata/received_events","type":"User","site_admin":false},"body":"* define `Wallet` interface and replace the original struct with it\r\n* add `wallet/address.go`, `wallet/utxo.go`\r\n* move test utilities to `wallet/test_util.go`\r\n\r\ncloses #36 ","created_at":"2018-11-01T07:53:27Z","updated_at":"2018-11-02T05:10:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"21c1b8c86d436224a23aadfb5171987a58f152bb","assignee":{"login":"Jwata","id":1701243,"node_id":"MDQ6VXNlcjE3MDEyNDM=","avatar_url":"https://avatars3.githubusercontent.com/u/1701243?v=4","gravatar_id":"","url":"https://api.github.com/users/Jwata","html_url":"https://github.com/Jwata","followers_url":"https://api.github.com/users/Jwata/followers","following_url":"https://api.github.com/users/Jwata/following{/other_user}","gists_url":"https://api.github.com/users/Jwata/gists{/gist_id}","starred_url":"https://api.github.com/users/Jwata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jwata/subscriptions","organizations_url":"https://api.github.com/users/Jwata/orgs","repos_url":"https://api.github.com/users/Jwata/repos","events_url":"https://api.github.com/users/Jwata/events{/privacy}","received_events_url":"https://api.github.com/users/Jwata/received_events","type":"User","site_admin":false},"assignees":[{"login":"Jwata","id":1701243,"node_id":"MDQ6VXNlcjE3MDEyNDM=","avatar_url":"https://avatars3.githubusercontent.com/u/1701243?v=4","gravatar_id":"","url":"https://api.github.com/users/Jwata","html_url":"https://github.com/Jwata","followers_url":"https://api.github.com/users/Jwata/followers","following_url":"https://api.github.com/users/Jwata/following{/other_user}","gists_url":"https://api.github.com/users/Jwata/gists{/gist_id}","starred_url":"https://api.github.com/users/Jwata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jwata/subscriptions","organizations_url":"https://api.github.com/users/Jwata/orgs","repos_url":"https://api.github.com/users/Jwata/repos","events_url":"https://api.github.com/users/Jwata/events{/privacy}","received_events_url":"https://api.github.com/users/Jwata/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1095372687,"node_id":"MDU6TGFiZWwxMDk1MzcyNjg3","url":"https://api.github.com/repos/dgarage/dlc/labels/in%20progress","name":"in progress","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dgarage/dlc/pulls/45/commits","review_comments_url":"https://api.github.com/repos/dgarage/dlc/pulls/45/comments","review_comment_url":"https://api.github.com/repos/dgarage/dlc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dgarage/dlc/issues/45/comments","statuses_url":"https://api.github.com/repos/dgarage/dlc/statuses/df46d7b2c30b644e14c77d07b7de05abb7cbdd94","head":{"label":"dgarage:refactor/wallet-interface","ref":"refactor/wallet-interface","sha":"df46d7b2c30b644e14c77d07b7de05abb7cbdd94","user":{"login":"dgarage","id":353608,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1MzYwOA==","avatar_url":"https://avatars3.githubusercontent.com/u/353608?v=4","gravatar_id":"","url":"https://api.github.com/users/dgarage","html_url":"https://github.com/dgarage","followers_url":"https://api.github.com/users/dgarage/followers","following_url":"https://api.github.com/users/dgarage/following{/other_user}","gists_url":"https://api.github.com/users/dgarage/gists{/gist_id}","starred_url":"https://api.github.com/users/dgarage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgarage/subscriptions","organizations_url":"https://api.github.com/users/dgarage/orgs","repos_url":"https://api.github.com/users/dgarage/repos","events_url":"https://api.github.com/users/dgarage/events{/privacy}","received_events_url":"https://api.github.com/users/dgarage/received_events","type":"Organization","site_admin":false},"repo":{"id":153416259,"node_id":"MDEwOlJlcG9zaXRvcnkxNTM0MTYyNTk=","name":"dlc","full_name":"dgarage/dlc","private":false,"owner":{"login":"dgarage","id":353608,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1MzYwOA==","avatar_url":"https://avatars3.githubusercontent.com/u/353608?v=4","gravatar_id":"","url":"https://api.github.com/users/dgarage","html_url":"https://github.com/dgarage","followers_url":"https://api.github.com/users/dgarage/followers","following_url":"https://api.github.com/users/dgarage/following{/other_user}","gists_url":"https://api.github.com/users/dgarage/gists{/gist_id}","starred_url":"https://api.github.com/users/dgarage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgarage/subscriptions","organizations_url":"https://api.github.com/users/dgarage/orgs","repos_url":"https://api.github.com/users/dgarage/repos","events_url":"https://api.github.com/users/dgarage/events{/privacy}","received_events_url":"https://api.github.com/users/dgarage/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/dgarage/dlc","description":"Discreet Log Contracts library","fork":false,"url":"https://api.github.com/repos/dgarage/dlc","forks_url":"https://api.github.com/repos/dgarage/dlc/forks","keys_url":"https://api.github.com/repos/dgarage/dlc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dgarage/dlc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dgarage/dlc/teams","hooks_url":"https://api.github.com/repos/dgarage/dlc/hooks","issue_events_url":"https://api.github.com/repos/dgarage/dlc/issues/events{/number}","events_url":"https://api.github.com/repos/dgarage/dlc/events","assignees_url":"https://api.github.com/repos/dgarage/dlc/assignees{/user}","branches_url":"https://api.github.com/repos/dgarage/dlc/branches{/branch}","tags_url":"https://api.github.com/repos/dgarage/dlc/tags","blobs_url":"https://api.github.com/repos/dgarage/dlc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dgarage/dlc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dgarage/dlc/git/refs{/sha}","trees_url":"https://api.github.com/repos/dgarage/dlc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dgarage/dlc/statuses/{sha}","languages_url":"https://api.github.com/repos/dgarage/dlc/languages","stargazers_url":"https://api.github.com/repos/dgarage/dlc/stargazers","contributors_url":"https://api.github.com/repos/dgarage/dlc/contributors","subscribers_url":"https://api.github.com/repos/dgarage/dlc/subscribers","subscription_url":"https://api.github.com/repos/dgarage/dlc/subscription","commits_url":"https://api.github.com/repos/dgarage/dlc/commits{/sha}","git_commits_url":"https://api.github.com/repos/dgarage/dlc/git/commits{/sha}","comments_url":"https://api.github.com/repos/dgarage/dlc/comments{/number}","issue_comment_url":"https://api.github.com/repos/dgarage/dlc/issues/comments{/number}","contents_url":"https://api.github.com/repos/dgarage/dlc/contents/{+path}","compare_url":"https://api.github.com/repos/dgarage/dlc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dgarage/dlc/merges","archive_url":"https://api.github.com/repos/dgarage/dlc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dgarage/dlc/downloads","issues_url":"https://api.github.com/repos/dgarage/dlc/issues{/number}","pulls_url":"https://api.github.com/repos/dgarage/dlc/pulls{/number}","milestones_url":"https://api.github.com/repos/dgarage/dlc/milestones{/number}","notifications_url":"https://api.github.com/repos/dgarage/dlc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dgarage/dlc/labels{/name}","releases_url":"https://api.github.com/repos/dgarage/dlc/releases{/id}","deployments_url":"https://api.github.com/repos/dgarage/dlc/deployments","created_at":"2018-10-17T07:44:17Z","updated_at":"2018-11-01T06:36:26Z","pushed_at":"2018-11-02T03:14:20Z","git_url":"git://github.com/dgarage/dlc.git","ssh_url":"git@github.com:dgarage/dlc.git","clone_url":"https://github.com/dgarage/dlc.git","svn_url":"https://github.com/dgarage/dlc","homepage":null,"size":82,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":20,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":20,"watchers":0,"default_branch":"master"}},"base":{"label":"dgarage:master","ref":"master","sha":"cbaf8cadd265653bea0259da1c6879810fc81116","user":{"login":"dgarage","id":353608,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1MzYwOA==","avatar_url":"https://avatars3.githubusercontent.com/u/353608?v=4","gravatar_id":"","url":"https://api.github.com/users/dgarage","html_url":"https://github.com/dgarage","followers_url":"https://api.github.com/users/dgarage/followers","following_url":"https://api.github.com/users/dgarage/following{/other_user}","gists_url":"https://api.github.com/users/dgarage/gists{/gist_id}","starred_url":"https://api.github.com/users/dgarage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgarage/subscriptions","organizations_url":"https://api.github.com/users/dgarage/orgs","repos_url":"https://api.github.com/users/dgarage/repos","events_url":"https://api.github.com/users/dgarage/events{/privacy}","received_events_url":"https://api.github.com/users/dgarage/received_events","type":"Organization","site_admin":false},"repo":{"id":153416259,"node_id":"MDEwOlJlcG9zaXRvcnkxNTM0MTYyNTk=","name":"dlc","full_name":"dgarage/dlc","private":false,"owner":{"login":"dgarage","id":353608,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1MzYwOA==","avatar_url":"https://avatars3.githubusercontent.com/u/353608?v=4","gravatar_id":"","url":"https://api.github.com/users/dgarage","html_url":"https://github.com/dgarage","followers_url":"https://api.github.com/users/dgarage/followers","following_url":"https://api.github.com/users/dgarage/following{/other_user}","gists_url":"https://api.github.com/users/dgarage/gists{/gist_id}","starred_url":"https://api.github.com/users/dgarage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgarage/subscriptions","organizations_url":"https://api.github.com/users/dgarage/orgs","repos_url":"https://api.github.com/users/dgarage/repos","events_url":"https://api.github.com/users/dgarage/events{/privacy}","received_events_url":"https://api.github.com/users/dgarage/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/dgarage/dlc","description":"Discreet Log Contracts library","fork":false,"url":"https://api.github.com/repos/dgarage/dlc","forks_url":"https://api.github.com/repos/dgarage/dlc/forks","keys_url":"https://api.github.com/repos/dgarage/dlc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dgarage/dlc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dgarage/dlc/teams","hooks_url":"https://api.github.com/repos/dgarage/dlc/hooks","issue_events_url":"https://api.github.com/repos/dgarage/dlc/issues/events{/number}","events_url":"https://api.github.com/repos/dgarage/dlc/events","assignees_url":"https://api.github.com/repos/dgarage/dlc/assignees{/user}","branches_url":"https://api.github.com/repos/dgarage/dlc/branches{/branch}","tags_url":"https://api.github.com/repos/dgarage/dlc/tags","blobs_url":"https://api.github.com/repos/dgarage/dlc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dgarage/dlc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dgarage/dlc/git/refs{/sha}","trees_url":"https://api.github.com/repos/dgarage/dlc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dgarage/dlc/statuses/{sha}","languages_url":"https://api.github.com/repos/dgarage/dlc/languages","stargazers_url":"https://api.github.com/repos/dgarage/dlc/stargazers","contributors_url":"https://api.github.com/repos/dgarage/dlc/contributors","subscribers_url":"https://api.github.com/repos/dgarage/dlc/subscribers","subscription_url":"https://api.github.com/repos/dgarage/dlc/subscription","commits_url":"https://api.github.com/repos/dgarage/dlc/commits{/sha}","git_commits_url":"https://api.github.com/repos/dgarage/dlc/git/commits{/sha}","comments_url":"https://api.github.com/repos/dgarage/dlc/comments{/number}","issue_comment_url":"https://api.github.com/repos/dgarage/dlc/issues/comments{/number}","contents_url":"https://api.github.com/repos/dgarage/dlc/contents/{+path}","compare_url":"https://api.github.com/repos/dgarage/dlc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dgarage/dlc/merges","archive_url":"https://api.github.com/repos/dgarage/dlc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dgarage/dlc/downloads","issues_url":"https://api.github.com/repos/dgarage/dlc/issues{/number}","pulls_url":"https://api.github.com/repos/dgarage/dlc/pulls{/number}","milestones_url":"https://api.github.com/repos/dgarage/dlc/milestones{/number}","notifications_url":"https://api.github.com/repos/dgarage/dlc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dgarage/dlc/labels{/name}","releases_url":"https://api.github.com/repos/dgarage/dlc/releases{/id}","deployments_url":"https://api.github.com/repos/dgarage/dlc/deployments","created_at":"2018-10-17T07:44:17Z","updated_at":"2018-11-01T06:36:26Z","pushed_at":"2018-11-02T03:14:20Z","git_url":"git://github.com/dgarage/dlc.git","ssh_url":"git@github.com:dgarage/dlc.git","clone_url":"https://github.com/dgarage/dlc.git","svn_url":"https://github.com/dgarage/dlc","homepage":null,"size":82,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":20,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":20,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dgarage/dlc/pulls/45"},"html":{"href":"https://github.com/dgarage/dlc/pull/45"},"issue":{"href":"https://api.github.com/repos/dgarage/dlc/issues/45"},"comments":{"href":"https://api.github.com/repos/dgarage/dlc/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/dgarage/dlc/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/dgarage/dlc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dgarage/dlc/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/dgarage/dlc/statuses/df46d7b2c30b644e14c77d07b7de05abb7cbdd94"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Jwata"}}