|
@@ 789-807 (lines=19) @@
|
| 786 |
|
|
| 787 |
|
return [addressFromServer, path]; |
| 788 |
|
}) |
| 789 |
|
); |
| 790 |
|
|
| 791 |
|
return deferred.promise; |
| 792 |
|
}; |
| 793 |
|
|
| 794 |
|
/** |
| 795 |
|
* get the balance for the wallet |
| 796 |
|
* |
| 797 |
|
* @param [cb] function callback(err, confirmed, unconfirmed) |
| 798 |
|
* @returns {q.Promise} |
| 799 |
|
*/ |
| 800 |
|
Wallet.prototype.getBalance = function(cb) { |
| 801 |
|
var self = this; |
| 802 |
|
|
| 803 |
|
var deferred = q.defer(); |
| 804 |
|
deferred.promise.spreadNodeify(cb); |
| 805 |
|
|
| 806 |
|
deferred.resolve( |
| 807 |
|
self.sdk.getWalletBalance(self.identifier) |
| 808 |
|
.then(function(result) { |
| 809 |
|
return [result.confirmed, result.unconfirmed]; |
| 810 |
|
}) |
|
@@ 867-882 (lines=16) @@
|
| 864 |
|
return result.deleted; |
| 865 |
|
}) |
| 866 |
|
); |
| 867 |
|
|
| 868 |
|
return deferred.promise; |
| 869 |
|
}; |
| 870 |
|
|
| 871 |
|
/** |
| 872 |
|
* create, sign and send a transaction |
| 873 |
|
* |
| 874 |
|
* @param pay array {'address': (int)value} coins to send |
| 875 |
|
* @param [changeAddress] bool change address to use (auto generated if NULL) |
| 876 |
|
* @param [allowZeroConf] bool allow zero confirmation unspent outputs to be used in coin selection |
| 877 |
|
* @param [randomizeChangeIdx] bool randomize the index of the change output (default TRUE, only disable if you have a good reason to) |
| 878 |
|
* @param [feeStrategy] string defaults to Wallet.FEE_STRATEGY_OPTIMAL |
| 879 |
|
* @param [twoFactorToken] string 2FA token |
| 880 |
|
* @param options |
| 881 |
|
* @param [cb] function callback(err, txHash) |
| 882 |
|
* @returns {q.Promise} |
| 883 |
|
*/ |
| 884 |
|
Wallet.prototype.pay = function(pay, changeAddress, allowZeroConf, randomizeChangeIdx, feeStrategy, twoFactorToken, options, cb) { |
| 885 |
|
|