GitHub PullRequestReviewCommentEvent at 2014-12-01 19:54:00
Repository: ripple-rest
Actor: geertweening
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/ripple/ripple-rest/pulls/comments/21114651","id":21114651,"diff_hunk":"@@ -10,162 +10,276 @@ var errors      = require('./../lib/errors.js');\n /**\n  *  Submit a normal ripple-lib transaction, blocking duplicates\n  *  for payments and orders.\n+ *  \n+ *  @param {Express.js Request} request   - Used to hold HTTP request data from client\n+ *  @param {Express.js Response} response - Used to send HTTP responses to the client\n+ *  @param {Function} next                - Used to pass control to error handler\n+ *  \n+ *  @param {Object} hooks - Used to hold methods defined by caller to customize transaction submit\n+ *  @param {ValidateOptionsHook} hooks.validateOptions\n+ *  @param {FormatTransactionResponseHook} hooks.formatTransactionResponse\n+ *  @param {SetTransactionParametersHook} hooks.setTransactionParameters\n+ *  @param {InitializeOptionsHook} [hooks.initializeOptions]\n+ *  @param {InitializeTransactionHook} [hooks.initializeTransaction]\n+ */\n+\n+/**\n+ *  Used to validate options object asyncronously\n+ *  @function ValidateOptionsHook\n+ *  @param {Object} options - Formatted parameters passed by client\n+ *  @param {Function} async_callback\n  *\n- *  @global\n- *  @param {Remote} remote\n- *  @param {/lib/db-interface} dbinterface\n+ *  @callback\n+ *  @param {Error} error\n+ */\n+\n+/**\n+ *  Used to format messages received from ripple-lib which will be returned to client\n+ *  @function FormatTransactionResponseHook\n+ *  @param {Object} message - Response object from ripple\n+ *  @param {Object} options - Formatted parameters passed by client\n+ *  @param {Object} meta    - Object that caller can use to save data across hooks\n+ *  @param {Function} async_callback\n+ *  \n+ *  @callback\n+ *  @param {Error} error\n+ *  @param {Object} result - Object that is returned to the client \n+ */\n+\n+/**\n+ *  Used to set appropriate parameters on transaction\n+ *  @function SetTransactionParametersHook\n+ *  @param {Transaction} transaction - Transaction object that is used to submit requests to ripple\n+ *  @param {Object} options          - Formatted parameters passed by client\n+ *  @param {Object} meta             - Object that caller can use to save data across hooks\n  *\n- *  @param {Transaction} data.transaction\n- *  @param {String} data.secret\n- *  @param {String} data.client_resource_id\n- *  @param {Boolean} data.validated Used to force ripple-rest to wait until rippled has validated a transaction before returning the result\n- *  @param {Number String} data.last_ledger_sequence\n- *  @param {Number String} data.max_fee\n- *  @param {Express.js Response} res Used to send error messages directly to the client\n- *  @param {Function} callback\n+ *  @returns undefined\n+ */\n+\n+/**\n+ *  Used to override default option initialization (Optional)\n+ *  @function InitializeOptionsHook\n+ *  @param {Express.js Request} request - Used to hold HTTP request data from the client\n+ *  \n+ *  @returns {Object} options - Formatted parameters passed by client\n+ */\n+\n+ /**\n+ *  Used to override default transaction initialization (Optional)\n+ *  @function InitializeTransactionHook\n+ *  @param {Object} options - Formatted parameters passed by client\n+ *  @param {Object} meta    - Object that caller can use to save data across hooks\n+ *  @param {Function} async_callback\n  *\n  *  @callback\n- *  @param {Error} error Submission Error\n- *  @param {submission response} response The response received from the 'proposed' event\n+ *  @param {Error} error\n+ *  @param {Transaction} transaction - Transaction object that is used to submit requests to ripple\n  */\n-function submitTransaction(data, response, callback) {\n-  function prepareTransaction(async_callback) {\n-    var ledgerIndex, maxFee = Number(data.max_fee);\n \n-    if (Number(data.last_ledger_sequence) > 0) {\n-      ledgerIndex = Number(data.last_ledger_sequence);\n-    } else {\n-      ledgerIndex = Number(remote._ledger_current_index) + module.exports.DEFAULT_LEDGER_BUFFER;\n-    }\n+function submitTransaction(request, response, next, hooks) {","path":"api/transactions.js","position":91,"original_position":91,"commit_id":"fcabaacb6f0ceac19a5aa78ce1598b1da0240836","original_commit_id":"fcabaacb6f0ceac19a5aa78ce1598b1da0240836","user":{"login":"geertweening","id":966236,"avatar_url":"https://avatars.githubusercontent.com/u/966236?v=3","gravatar_id":"","url":"https://api.github.com/users/geertweening","html_url":"https://github.com/geertweening","followers_url":"https://api.github.com/users/geertweening/followers","following_url":"https://api.github.com/users/geertweening/following{/other_user}","gists_url":"https://api.github.com/users/geertweening/gists{/gist_id}","starred_url":"https://api.github.com/users/geertweening/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geertweening/subscriptions","organizations_url":"https://api.github.com/users/geertweening/orgs","repos_url":"https://api.github.com/users/geertweening/repos","events_url":"https://api.github.com/users/geertweening/events{/privacy}","received_events_url":"https://api.github.com/users/geertweening/received_events","type":"User","site_admin":false},"body":"`#getAccountTransactions` also takes a response object, would take that out as well.\r\n\r\nCurrently the only method that should take a request and response object is `#getTransactionAndRespond`, since that method is exposed to the router. Preferably we separate that method out as well, and keep the transactions.js cleanly separated from any http objects, but that doesn't have to be part of this PR.","created_at":"2014-12-01T19:54:00Z","updated_at":"2014-12-01T19:54:00Z","html_url":"https://github.com/ripple/ripple-rest/pull/215#discussion_r21114651","pull_request_url":"https://api.github.com/repos/ripple/ripple-rest/pulls/215","_links":{"self":{"href":"https://api.github.com/repos/ripple/ripple-rest/pulls/comments/21114651"},"html":{"href":"https://github.com/ripple/ripple-rest/pull/215#discussion_r21114651"},"pull_request":{"href":"https://api.github.com/repos/ripple/ripple-rest/pulls/215"}}},"pull_request":{"url":"https://api.github.com/repos/ripple/ripple-rest/pulls/215","id":25112552,"html_url":"https://github.com/ripple/ripple-rest/pull/215","diff_url":"https://github.com/ripple/ripple-rest/pull/215.diff","patch_url":"https://github.com/ripple/ripple-rest/pull/215.patch","issue_url":"https://api.github.com/repos/ripple/ripple-rest/issues/215","number":215,"state":"open","locked":false,"title":"[TASK] consolidate transaction logic","user":{"login":"boxbag","id":719745,"avatar_url":"https://avatars.githubusercontent.com/u/719745?v=3","gravatar_id":"","url":"https://api.github.com/users/boxbag","html_url":"https://github.com/boxbag","followers_url":"https://api.github.com/users/boxbag/followers","following_url":"https://api.github.com/users/boxbag/following{/other_user}","gists_url":"https://api.github.com/users/boxbag/gists{/gist_id}","starred_url":"https://api.github.com/users/boxbag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boxbag/subscriptions","organizations_url":"https://api.github.com/users/boxbag/orgs","repos_url":"https://api.github.com/users/boxbag/repos","events_url":"https://api.github.com/users/boxbag/events{/privacy}","received_events_url":"https://api.github.com/users/boxbag/received_events","type":"User","site_admin":false},"body":"Major refactor of the way transactions are submitted","created_at":"2014-11-26T20:41:45Z","updated_at":"2014-12-01T19:54:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0701be288ea2491d270c5aa5477dd2db2a6b3d4a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ripple/ripple-rest/pulls/215/commits","review_comments_url":"https://api.github.com/repos/ripple/ripple-rest/pulls/215/comments","review_comment_url":"https://api.github.com/repos/ripple/ripple-rest/pulls/comments/{number}","comments_url":"https://api.github.com/repos/ripple/ripple-rest/issues/215/comments","statuses_url":"https://api.github.com/repos/ripple/ripple-rest/statuses/fcabaacb6f0ceac19a5aa78ce1598b1da0240836","head":{"label":"ripple:refactor-transactions","ref":"refactor-transactions","sha":"fcabaacb6f0ceac19a5aa78ce1598b1da0240836","user":{"login":"ripple","id":3165523,"avatar_url":"https://avatars.githubusercontent.com/u/3165523?v=3","gravatar_id":"","url":"https://api.github.com/users/ripple","html_url":"https://github.com/ripple","followers_url":"https://api.github.com/users/ripple/followers","following_url":"https://api.github.com/users/ripple/following{/other_user}","gists_url":"https://api.github.com/users/ripple/gists{/gist_id}","starred_url":"https://api.github.com/users/ripple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ripple/subscriptions","organizations_url":"https://api.github.com/users/ripple/orgs","repos_url":"https://api.github.com/users/ripple/repos","events_url":"https://api.github.com/users/ripple/events{/privacy}","received_events_url":"https://api.github.com/users/ripple/received_events","type":"Organization","site_admin":false},"repo":{"id":16561603,"name":"ripple-rest","full_name":"ripple/ripple-rest","owner":{"login":"ripple","id":3165523,"avatar_url":"https://avatars.githubusercontent.com/u/3165523?v=3","gravatar_id":"","url":"https://api.github.com/users/ripple","html_url":"https://github.com/ripple","followers_url":"https://api.github.com/users/ripple/followers","following_url":"https://api.github.com/users/ripple/following{/other_user}","gists_url":"https://api.github.com/users/ripple/gists{/gist_id}","starred_url":"https://api.github.com/users/ripple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ripple/subscriptions","organizations_url":"https://api.github.com/users/ripple/orgs","repos_url":"https://api.github.com/users/ripple/repos","events_url":"https://api.github.com/users/ripple/events{/privacy}","received_events_url":"https://api.github.com/users/ripple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ripple/ripple-rest","description":"A RESTful API for submitting payments and monitoring accounts on the Ripple Network","fork":false,"url":"https://api.github.com/repos/ripple/ripple-rest","forks_url":"https://api.github.com/repos/ripple/ripple-rest/forks","keys_url":"https://api.github.com/repos/ripple/ripple-rest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ripple/ripple-rest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ripple/ripple-rest/teams","hooks_url":"https://api.github.com/repos/ripple/ripple-rest/hooks","issue_events_url":"https://api.github.com/repos/ripple/ripple-rest/issues/events{/number}","events_url":"https://api.github.com/repos/ripple/ripple-rest/events","assignees_url":"https://api.github.com/repos/ripple/ripple-rest/assignees{/user}","branches_url":"https://api.github.com/repos/ripple/ripple-rest/branches{/branch}","tags_url":"https://api.github.com/repos/ripple/ripple-rest/tags","blobs_url":"https://api.github.com/repos/ripple/ripple-rest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ripple/ripple-rest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ripple/ripple-rest/git/refs{/sha}","trees_url":"https://api.github.com/repos/ripple/ripple-rest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ripple/ripple-rest/statuses/{sha}","languages_url":"https://api.github.com/repos/ripple/ripple-rest/languages","stargazers_url":"https://api.github.com/repos/ripple/ripple-rest/stargazers","contributors_url":"https://api.github.com/repos/ripple/ripple-rest/contributors","subscribers_url":"https://api.github.com/repos/ripple/ripple-rest/subscribers","subscription_url":"https://api.github.com/repos/ripple/ripple-rest/subscription","commits_url":"https://api.github.com/repos/ripple/ripple-rest/commits{/sha}","git_commits_url":"https://api.github.com/repos/ripple/ripple-rest/git/commits{/sha}","comments_url":"https://api.github.com/repos/ripple/ripple-rest/comments{/number}","issue_comment_url":"https://api.github.com/repos/ripple/ripple-rest/issues/comments/{number}","contents_url":"https://api.github.com/repos/ripple/ripple-rest/contents/{+path}","compare_url":"https://api.github.com/repos/ripple/ripple-rest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ripple/ripple-rest/merges","archive_url":"https://api.github.com/repos/ripple/ripple-rest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ripple/ripple-rest/downloads","issues_url":"https://api.github.com/repos/ripple/ripple-rest/issues{/number}","pulls_url":"https://api.github.com/repos/ripple/ripple-rest/pulls{/number}","milestones_url":"https://api.github.com/repos/ripple/ripple-rest/milestones{/number}","notifications_url":"https://api.github.com/repos/ripple/ripple-rest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ripple/ripple-rest/labels{/name}","releases_url":"https://api.github.com/repos/ripple/ripple-rest/releases{/id}","created_at":"2014-02-05T22:52:44Z","updated_at":"2014-12-01T18:25:01Z","pushed_at":"2014-12-01T19:00:26Z","git_url":"git://github.com/ripple/ripple-rest.git","ssh_url":"git@github.com:ripple/ripple-rest.git","clone_url":"https://github.com/ripple/ripple-rest.git","svn_url":"https://github.com/ripple/ripple-rest","homepage":"","size":7360,"stargazers_count":42,"watchers_count":42,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":51,"mirror_url":null,"open_issues_count":14,"forks":51,"open_issues":14,"watchers":42,"default_branch":"develop"}},"base":{"label":"ripple:develop","ref":"develop","sha":"d80d198e18f9c1f96adad8fba4be67b8ae26c4d5","user":{"login":"ripple","id":3165523,"avatar_url":"https://avatars.githubusercontent.com/u/3165523?v=3","gravatar_id":"","url":"https://api.github.com/users/ripple","html_url":"https://github.com/ripple","followers_url":"https://api.github.com/users/ripple/followers","following_url":"https://api.github.com/users/ripple/following{/other_user}","gists_url":"https://api.github.com/users/ripple/gists{/gist_id}","starred_url":"https://api.github.com/users/ripple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ripple/subscriptions","organizations_url":"https://api.github.com/users/ripple/orgs","repos_url":"https://api.github.com/users/ripple/repos","events_url":"https://api.github.com/users/ripple/events{/privacy}","received_events_url":"https://api.github.com/users/ripple/received_events","type":"Organization","site_admin":false},"repo":{"id":16561603,"name":"ripple-rest","full_name":"ripple/ripple-rest","owner":{"login":"ripple","id":3165523,"avatar_url":"https://avatars.githubusercontent.com/u/3165523?v=3","gravatar_id":"","url":"https://api.github.com/users/ripple","html_url":"https://github.com/ripple","followers_url":"https://api.github.com/users/ripple/followers","following_url":"https://api.github.com/users/ripple/following{/other_user}","gists_url":"https://api.github.com/users/ripple/gists{/gist_id}","starred_url":"https://api.github.com/users/ripple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ripple/subscriptions","organizations_url":"https://api.github.com/users/ripple/orgs","repos_url":"https://api.github.com/users/ripple/repos","events_url":"https://api.github.com/users/ripple/events{/privacy}","received_events_url":"https://api.github.com/users/ripple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ripple/ripple-rest","description":"A RESTful API for submitting payments and monitoring accounts on the Ripple Network","fork":false,"url":"https://api.github.com/repos/ripple/ripple-rest","forks_url":"https://api.github.com/repos/ripple/ripple-rest/forks","keys_url":"https://api.github.com/repos/ripple/ripple-rest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ripple/ripple-rest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ripple/ripple-rest/teams","hooks_url":"https://api.github.com/repos/ripple/ripple-rest/hooks","issue_events_url":"https://api.github.com/repos/ripple/ripple-rest/issues/events{/number}","events_url":"https://api.github.com/repos/ripple/ripple-rest/events","assignees_url":"https://api.github.com/repos/ripple/ripple-rest/assignees{/user}","branches_url":"https://api.github.com/repos/ripple/ripple-rest/branches{/branch}","tags_url":"https://api.github.com/repos/ripple/ripple-rest/tags","blobs_url":"https://api.github.com/repos/ripple/ripple-rest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ripple/ripple-rest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ripple/ripple-rest/git/refs{/sha}","trees_url":"https://api.github.com/repos/ripple/ripple-rest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ripple/ripple-rest/statuses/{sha}","languages_url":"https://api.github.com/repos/ripple/ripple-rest/languages","stargazers_url":"https://api.github.com/repos/ripple/ripple-rest/stargazers","contributors_url":"https://api.github.com/repos/ripple/ripple-rest/contributors","subscribers_url":"https://api.github.com/repos/ripple/ripple-rest/subscribers","subscription_url":"https://api.github.com/repos/ripple/ripple-rest/subscription","commits_url":"https://api.github.com/repos/ripple/ripple-rest/commits{/sha}","git_commits_url":"https://api.github.com/repos/ripple/ripple-rest/git/commits{/sha}","comments_url":"https://api.github.com/repos/ripple/ripple-rest/comments{/number}","issue_comment_url":"https://api.github.com/repos/ripple/ripple-rest/issues/comments/{number}","contents_url":"https://api.github.com/repos/ripple/ripple-rest/contents/{+path}","compare_url":"https://api.github.com/repos/ripple/ripple-rest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ripple/ripple-rest/merges","archive_url":"https://api.github.com/repos/ripple/ripple-rest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ripple/ripple-rest/downloads","issues_url":"https://api.github.com/repos/ripple/ripple-rest/issues{/number}","pulls_url":"https://api.github.com/repos/ripple/ripple-rest/pulls{/number}","milestones_url":"https://api.github.com/repos/ripple/ripple-rest/milestones{/number}","notifications_url":"https://api.github.com/repos/ripple/ripple-rest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ripple/ripple-rest/labels{/name}","releases_url":"https://api.github.com/repos/ripple/ripple-rest/releases{/id}","created_at":"2014-02-05T22:52:44Z","updated_at":"2014-12-01T18:25:01Z","pushed_at":"2014-12-01T19:00:26Z","git_url":"git://github.com/ripple/ripple-rest.git","ssh_url":"git@github.com:ripple/ripple-rest.git","clone_url":"https://github.com/ripple/ripple-rest.git","svn_url":"https://github.com/ripple/ripple-rest","homepage":"","size":7360,"stargazers_count":42,"watchers_count":42,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":51,"mirror_url":null,"open_issues_count":14,"forks":51,"open_issues":14,"watchers":42,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ripple/ripple-rest/pulls/215"},"html":{"href":"https://github.com/ripple/ripple-rest/pull/215"},"issue":{"href":"https://api.github.com/repos/ripple/ripple-rest/issues/215"},"comments":{"href":"https://api.github.com/repos/ripple/ripple-rest/issues/215/comments"},"review_comments":{"href":"https://api.github.com/repos/ripple/ripple-rest/pulls/215/comments"},"review_comment":{"href":"https://api.github.com/repos/ripple/ripple-rest/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/ripple/ripple-rest/pulls/215/commits"},"statuses":{"href":"https://api.github.com/repos/ripple/ripple-rest/statuses/fcabaacb6f0ceac19a5aa78ce1598b1da0240836"}}}}