Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add confirmation count to wallet-webhook setup #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions lib/api_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2102,13 +2102,26 @@ APIClient.prototype.sendTransaction = function(identifier, txHex, paths, checkFe
* @param identifier string the wallet identifier
* @param webhookIdentifier string identifier for the webhook
* @param url string URL to receive webhook events
* @param confirmations int Number of confirmations for which to receive webhook events (defaults to 6)
* @param [cb] function callback(err, webhook)
* @returns {q.Promise}
*/
APIClient.prototype.setupWalletWebhook = function(identifier, webhookIdentifier, url, cb) {
APIClient.prototype.setupWalletWebhook = function(identifier, webhookIdentifier, url, confirmations, cb) {
var self = this;

return self.blocktrailClient.post("/wallet/" + identifier + "/webhook", null, {url: url, identifier: webhookIdentifier}, cb);
// Include confirmations parameter - Backwards compatible
if (typeof confirmations === "function") {
cb = confirmations;
confirmations = null;
}

var params = {
url: url,
identifier: webhookIdentifier,
confirmations: confirmations
};

return self.blocktrailClient.post("/wallet/" + identifier + "/webhook", null, params, cb);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{url: url, identifier: webhookIdentifier} got missed in the response

};

/**
Expand Down