|
@@ 789-807 (lines=19) @@
|
| 786 |
|
force = false; |
| 787 |
|
} |
| 788 |
|
|
| 789 |
|
var deferred = q.defer(); |
| 790 |
|
deferred.promise.nodeify(cb); |
| 791 |
|
|
| 792 |
|
if (self.locked) { |
| 793 |
|
deferred.reject(new blocktrail.WalletDeleteError("Wallet needs to be unlocked to delete wallet")); |
| 794 |
|
return deferred.promise; |
| 795 |
|
} |
| 796 |
|
|
| 797 |
|
var checksum = self.primaryPrivateKey.getAddress(); |
| 798 |
|
var privBuf = self.primaryPrivateKey.keyPair.d.toBuffer(32); |
| 799 |
|
var signature = bitcoinMessage.sign(checksum, self.network.messagePrefix, privBuf, true).toString('base64'); |
| 800 |
|
|
| 801 |
|
deferred.resolve( |
| 802 |
|
self.sdk.deleteWallet(self.identifier, checksum, signature, force) |
| 803 |
|
.then(function(result) { |
| 804 |
|
return result.deleted; |
| 805 |
|
}) |
| 806 |
|
); |
| 807 |
|
|
| 808 |
|
return deferred.promise; |
| 809 |
|
}; |
| 810 |
|
|
|
@@ 867-882 (lines=16) @@
|
| 864 |
|
|
| 865 |
|
self.buildTransaction(pay, changeAddress, allowZeroConf, randomizeChangeIdx, feeStrategy, options) |
| 866 |
|
.then( |
| 867 |
|
function(r) { return r; }, |
| 868 |
|
function(e) { deferred.reject(e); }, |
| 869 |
|
function(progress) { |
| 870 |
|
deferred.notify(progress); |
| 871 |
|
} |
| 872 |
|
) |
| 873 |
|
.spread( |
| 874 |
|
function(tx, utxos) { |
| 875 |
|
|
| 876 |
|
deferred.notify(Wallet.PAY_PROGRESS_SEND); |
| 877 |
|
|
| 878 |
|
var data = { |
| 879 |
|
signed_transaction: tx.toHex(), |
| 880 |
|
base_transaction: tx.__toBuffer(null, null, false).toString('hex') |
| 881 |
|
}; |
| 882 |
|
|
| 883 |
|
return self.sendTransaction(data, utxos.map(function(utxo) { return utxo['path']; }), checkFee, twoFactorToken, options.prioboost) |
| 884 |
|
.then(function(result) { |
| 885 |
|
deferred.notify(Wallet.PAY_PROGRESS_DONE); |