diff --git a/lib/api_client.js b/lib/api_client.js index c639220..6469c15 100644 --- a/lib/api_client.js +++ b/lib/api_client.js @@ -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); }; /**