From f7c8bbc972ff4db31822962072ea4d921ba60d41 Mon Sep 17 00:00:00 2001 From: Thomas Kerin Date: Thu, 11 Oct 2018 11:23:48 +0200 Subject: [PATCH] require-activation flag --- lib/api_client.js | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/lib/api_client.js b/lib/api_client.js index 40f375b..9f75d93 100644 --- a/lib/api_client.js +++ b/lib/api_client.js @@ -1464,7 +1464,8 @@ APIClient.prototype._createNewWalletV1 = function(options) { options.storePrimaryMnemonic ? options.primaryMnemonic : false, checksum, keyIndex, - options.segwit || null + options.segwit || null, + options.require_activation || false ) .then(function(result) { deferred.notify(APIClient.CREATE_WALLET_PROGRESS_INIT); @@ -1574,7 +1575,8 @@ APIClient.prototype._createNewWalletV2 = function(options) { checksum, keyIndex, options.support_secret || null, - options.segwit || null + options.segwit || null, + options.require_activation || false ) .then( function(result) { @@ -1684,7 +1686,8 @@ APIClient.prototype._createNewWalletV3 = function(options) { checksum, keyIndex, options.support_secret || null, - options.segwit || null + options.segwit || null, + options.require_activation || false ) .then( // result, deferred, self(apiclient) @@ -1770,10 +1773,11 @@ function verifyPublicOnly(walletData, network) { * @param checksum string checksum to store * @param keyIndex int keyIndex that was used to create wallet * @param segwit bool + * @param requireActivation bool * @returns {q.Promise} */ APIClient.prototype.storeNewWalletV1 = function(identifier, primaryPublicKey, backupPublicKey, primaryMnemonic, - checksum, keyIndex, segwit) { + checksum, keyIndex, segwit, requireActivation) { var self = this; var postData = { @@ -1787,6 +1791,10 @@ APIClient.prototype.storeNewWalletV1 = function(identifier, primaryPublicKey, ba segwit: segwit }; + if (requireActivation) { + postData.require_activation = true + } + verifyPublicOnly(postData, self.network); return self.blocktrailClient.post("/wallet", null, postData); @@ -1805,10 +1813,11 @@ APIClient.prototype.storeNewWalletV1 = function(identifier, primaryPublicKey, ba * @param keyIndex int keyIndex that was used to create wallet * @param supportSecret string * @param segwit bool + * @param requireActivation bool * @returns {q.Promise} */ APIClient.prototype.storeNewWalletV2 = function(identifier, primaryPublicKey, backupPublicKey, encryptedPrimarySeed, encryptedSecret, - recoverySecret, checksum, keyIndex, supportSecret, segwit) { + recoverySecret, checksum, keyIndex, supportSecret, segwit, requireActivation) { var self = this; var postData = { @@ -1825,6 +1834,10 @@ APIClient.prototype.storeNewWalletV2 = function(identifier, primaryPublicKey, ba segwit: segwit }; + if (requireActivation) { + postData.require_activation = true + } + verifyPublicOnly(postData, self.network); return self.blocktrailClient.post("/wallet", null, postData); @@ -1843,10 +1856,11 @@ APIClient.prototype.storeNewWalletV2 = function(identifier, primaryPublicKey, ba * @param keyIndex int keyIndex that was used to create wallet * @param supportSecret string * @param segwit bool + * @param requireActivation bool * @returns {q.Promise} */ APIClient.prototype.storeNewWalletV3 = function(identifier, primaryPublicKey, backupPublicKey, encryptedPrimarySeed, encryptedSecret, - recoverySecret, checksum, keyIndex, supportSecret, segwit) { + recoverySecret, checksum, keyIndex, supportSecret, segwit, requireActivation) { var self = this; var postData = { @@ -1863,6 +1877,10 @@ APIClient.prototype.storeNewWalletV3 = function(identifier, primaryPublicKey, ba segwit: segwit }; + if (requireActivation) { + postData.require_activation = true + } + verifyPublicOnly(postData, self.network); return self.blocktrailClient.post("/wallet", null, postData);