{"action":"created","comment":{"url":"https://api.github.com/repos/ethereum/solc-js/pulls/comments/64788952","id":64788952,"diff_hunk":"@@ -45,11 +45,25 @@ function setupMethods (soljson){\n \t\treturn JSON.parse(result);\n \t}\n \n+        var link = function(bytecode, libraries) {\n+                for (var libraryName in libraries) {\n+                        var libLabel = '__' + libraryName + Array(39 - libraryName.length).join('_');\n+                        var hexAddress = libraries[libraryName];\n+                        hexAddress = Array(40 - hexAddress.length + 1).join('0') + hexAddress;\n+                        while (bytecode.indexOf(libLabel) >= 0) {\n+                                bytecode = bytecode.replace(libLabel, hexAddress);\n+                        }\n+                }\n+\n+\t\treturn bytecode;\n+        };\n+\n \tvar version = soljson.cwrap(\"version\", \"string\", []);\n \n \treturn {\n \t\tversion: version,\n \t\tcompile: compile,\n+\t\tlink: link,","path":"index.js","position":22,"original_position":22,"commit_id":"a348b6ca501fce895ee7bccbd3df89f220033927","original_commit_id":"a348b6ca501fce895ee7bccbd3df89f220033927","user":{"login":"axic","id":20340,"avatar_url":"https://avatars.githubusercontent.com/u/20340?v=3","gravatar_id":"","url":"https://api.github.com/users/axic","html_url":"https://github.com/axic","followers_url":"https://api.github.com/users/axic/followers","following_url":"https://api.github.com/users/axic/following{/other_user}","gists_url":"https://api.github.com/users/axic/gists{/gist_id}","starred_url":"https://api.github.com/users/axic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/axic/subscriptions","organizations_url":"https://api.github.com/users/axic/orgs","repos_url":"https://api.github.com/users/axic/repos","events_url":"https://api.github.com/users/axic/events{/privacy}","received_events_url":"https://api.github.com/users/axic/received_events","type":"User","site_admin":false},"body":"I don't have any good candidate. `linkBytecode`? `\r\n","created_at":"2016-05-26T17:45:53Z","updated_at":"2016-05-26T17:45:53Z","html_url":"https://github.com/ethereum/solc-js/pull/8#discussion_r64788952","pull_request_url":"https://api.github.com/repos/ethereum/solc-js/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/ethereum/solc-js/pulls/comments/64788952"},"html":{"href":"https://github.com/ethereum/solc-js/pull/8#discussion_r64788952"},"pull_request":{"href":"https://api.github.com/repos/ethereum/solc-js/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/ethereum/solc-js/pulls/8","id":69748511,"html_url":"https://github.com/ethereum/solc-js/pull/8","diff_url":"https://github.com/ethereum/solc-js/pull/8.diff","patch_url":"https://github.com/ethereum/solc-js/pull/8.patch","issue_url":"https://api.github.com/repos/ethereum/solc-js/issues/8","number":8,"state":"open","locked":false,"title":"Import basic bytecode linking code from browser-solidity","user":{"login":"axic","id":20340,"avatar_url":"https://avatars.githubusercontent.com/u/20340?v=3","gravatar_id":"","url":"https://api.github.com/users/axic","html_url":"https://github.com/axic","followers_url":"https://api.github.com/users/axic/followers","following_url":"https://api.github.com/users/axic/following{/other_user}","gists_url":"https://api.github.com/users/axic/gists{/gist_id}","starred_url":"https://api.github.com/users/axic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/axic/subscriptions","organizations_url":"https://api.github.com/users/axic/orgs","repos_url":"https://api.github.com/users/axic/repos","events_url":"https://api.github.com/users/axic/events{/privacy}","received_events_url":"https://api.github.com/users/axic/received_events","type":"User","site_admin":false},"body":"This is only the internal part of the linker, which replaces library references with addresses in a given bytecode. Code taken form browser-solidity. First step to implement #4.\r\n\r\nThe higher level method will need to support JSON input and perhaps handle multiple versions of the same library name.\r\n\r\n","created_at":"2016-05-11T21:51:16Z","updated_at":"2016-05-26T17:45:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7be1427e3685365160b44a74d978643d04b12ce6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ethereum/solc-js/pulls/8/commits","review_comments_url":"https://api.github.com/repos/ethereum/solc-js/pulls/8/comments","review_comment_url":"https://api.github.com/repos/ethereum/solc-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ethereum/solc-js/issues/8/comments","statuses_url":"https://api.github.com/repos/ethereum/solc-js/statuses/a348b6ca501fce895ee7bccbd3df89f220033927","head":{"label":"ethereum:feature/linker","ref":"feature/linker","sha":"a348b6ca501fce895ee7bccbd3df89f220033927","user":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"repo":{"id":55413578,"name":"solc-js","full_name":"ethereum/solc-js","owner":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ethereum/solc-js","description":"Javascript bindings for the solidity compiler","fork":false,"url":"https://api.github.com/repos/ethereum/solc-js","forks_url":"https://api.github.com/repos/ethereum/solc-js/forks","keys_url":"https://api.github.com/repos/ethereum/solc-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ethereum/solc-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ethereum/solc-js/teams","hooks_url":"https://api.github.com/repos/ethereum/solc-js/hooks","issue_events_url":"https://api.github.com/repos/ethereum/solc-js/issues/events{/number}","events_url":"https://api.github.com/repos/ethereum/solc-js/events","assignees_url":"https://api.github.com/repos/ethereum/solc-js/assignees{/user}","branches_url":"https://api.github.com/repos/ethereum/solc-js/branches{/branch}","tags_url":"https://api.github.com/repos/ethereum/solc-js/tags","blobs_url":"https://api.github.com/repos/ethereum/solc-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ethereum/solc-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ethereum/solc-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/ethereum/solc-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ethereum/solc-js/statuses/{sha}","languages_url":"https://api.github.com/repos/ethereum/solc-js/languages","stargazers_url":"https://api.github.com/repos/ethereum/solc-js/stargazers","contributors_url":"https://api.github.com/repos/ethereum/solc-js/contributors","subscribers_url":"https://api.github.com/repos/ethereum/solc-js/subscribers","subscription_url":"https://api.github.com/repos/ethereum/solc-js/subscription","commits_url":"https://api.github.com/repos/ethereum/solc-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/ethereum/solc-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/ethereum/solc-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/ethereum/solc-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/ethereum/solc-js/contents/{+path}","compare_url":"https://api.github.com/repos/ethereum/solc-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ethereum/solc-js/merges","archive_url":"https://api.github.com/repos/ethereum/solc-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ethereum/solc-js/downloads","issues_url":"https://api.github.com/repos/ethereum/solc-js/issues{/number}","pulls_url":"https://api.github.com/repos/ethereum/solc-js/pulls{/number}","milestones_url":"https://api.github.com/repos/ethereum/solc-js/milestones{/number}","notifications_url":"https://api.github.com/repos/ethereum/solc-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ethereum/solc-js/labels{/name}","releases_url":"https://api.github.com/repos/ethereum/solc-js/releases{/id}","deployments_url":"https://api.github.com/repos/ethereum/solc-js/deployments","created_at":"2016-04-04T13:32:01Z","updated_at":"2016-05-19T22:41:35Z","pushed_at":"2016-05-25T08:09:52Z","git_url":"git://github.com/ethereum/solc-js.git","ssh_url":"git@github.com:ethereum/solc-js.git","clone_url":"https://github.com/ethereum/solc-js.git","svn_url":"https://github.com/ethereum/solc-js","homepage":null,"size":20,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":6,"forks":6,"open_issues":6,"watchers":6,"default_branch":"master"}},"base":{"label":"ethereum:master","ref":"master","sha":"b532db0a0ce966cdc2e43639064a13ad4642b19b","user":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"repo":{"id":55413578,"name":"solc-js","full_name":"ethereum/solc-js","owner":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ethereum/solc-js","description":"Javascript bindings for the solidity compiler","fork":false,"url":"https://api.github.com/repos/ethereum/solc-js","forks_url":"https://api.github.com/repos/ethereum/solc-js/forks","keys_url":"https://api.github.com/repos/ethereum/solc-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ethereum/solc-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ethereum/solc-js/teams","hooks_url":"https://api.github.com/repos/ethereum/solc-js/hooks","issue_events_url":"https://api.github.com/repos/ethereum/solc-js/issues/events{/number}","events_url":"https://api.github.com/repos/ethereum/solc-js/events","assignees_url":"https://api.github.com/repos/ethereum/solc-js/assignees{/user}","branches_url":"https://api.github.com/repos/ethereum/solc-js/branches{/branch}","tags_url":"https://api.github.com/repos/ethereum/solc-js/tags","blobs_url":"https://api.github.com/repos/ethereum/solc-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ethereum/solc-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ethereum/solc-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/ethereum/solc-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ethereum/solc-js/statuses/{sha}","languages_url":"https://api.github.com/repos/ethereum/solc-js/languages","stargazers_url":"https://api.github.com/repos/ethereum/solc-js/stargazers","contributors_url":"https://api.github.com/repos/ethereum/solc-js/contributors","subscribers_url":"https://api.github.com/repos/ethereum/solc-js/subscribers","subscription_url":"https://api.github.com/repos/ethereum/solc-js/subscription","commits_url":"https://api.github.com/repos/ethereum/solc-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/ethereum/solc-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/ethereum/solc-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/ethereum/solc-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/ethereum/solc-js/contents/{+path}","compare_url":"https://api.github.com/repos/ethereum/solc-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ethereum/solc-js/merges","archive_url":"https://api.github.com/repos/ethereum/solc-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ethereum/solc-js/downloads","issues_url":"https://api.github.com/repos/ethereum/solc-js/issues{/number}","pulls_url":"https://api.github.com/repos/ethereum/solc-js/pulls{/number}","milestones_url":"https://api.github.com/repos/ethereum/solc-js/milestones{/number}","notifications_url":"https://api.github.com/repos/ethereum/solc-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ethereum/solc-js/labels{/name}","releases_url":"https://api.github.com/repos/ethereum/solc-js/releases{/id}","deployments_url":"https://api.github.com/repos/ethereum/solc-js/deployments","created_at":"2016-04-04T13:32:01Z","updated_at":"2016-05-19T22:41:35Z","pushed_at":"2016-05-25T08:09:52Z","git_url":"git://github.com/ethereum/solc-js.git","ssh_url":"git@github.com:ethereum/solc-js.git","clone_url":"https://github.com/ethereum/solc-js.git","svn_url":"https://github.com/ethereum/solc-js","homepage":null,"size":20,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":6,"forks":6,"open_issues":6,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ethereum/solc-js/pulls/8"},"html":{"href":"https://github.com/ethereum/solc-js/pull/8"},"issue":{"href":"https://api.github.com/repos/ethereum/solc-js/issues/8"},"comments":{"href":"https://api.github.com/repos/ethereum/solc-js/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/ethereum/solc-js/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/ethereum/solc-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ethereum/solc-js/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/ethereum/solc-js/statuses/a348b6ca501fce895ee7bccbd3df89f220033927"}}}}
{"actor":{"display_login":"axic"}}