Code Duplication    Length = 16-19 lines in 2 locations

lib/wallet.js 2 locations

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