Skip to content
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
30 changes: 24 additions & 6 deletions lib/api_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 = {
Expand All @@ -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);
Expand All @@ -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 = {
Expand All @@ -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);
Expand All @@ -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 = {
Expand All @@ -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);
Expand Down