Fix Conflicts:
bower.json
This commit is contained in:
commit
8c2a784d86
20 changed files with 415 additions and 251 deletions
|
|
@ -47,19 +47,18 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
|
||||
var address = form.address.$modelValue;
|
||||
var amount = (form.amount.$modelValue * 100000000).toFixed(); // satoshi to string
|
||||
var comment = form.comment.$modelValue;
|
||||
|
||||
var w = $rootScope.wallet;
|
||||
w.createTx(address, amount,function() {
|
||||
w.createTx(address, amount, comment, function() {
|
||||
$scope.loading = false;
|
||||
$rootScope.$flashMessage = { message: 'The transaction proposal has been created', type: 'success'};
|
||||
$rootScope.$digest();
|
||||
});
|
||||
|
||||
// reset fields
|
||||
$scope.address = null;
|
||||
$scope.amount = null;
|
||||
form.address.$pristine = true;
|
||||
form.amount.$pristine = true;
|
||||
$scope.address = $scope.amount = $scope.comment = null;
|
||||
form.address.$pristine = form.amount.$pristine = form.comment.$pristine = true;
|
||||
};
|
||||
|
||||
// QR code Scanner
|
||||
|
|
|
|||
|
|
@ -122,55 +122,47 @@ angular.module('copayApp.directives')
|
|||
}
|
||||
}
|
||||
})
|
||||
.directive('highlightOnChange', function() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function(scope, element, attrs) {
|
||||
scope.$watch(attrs.highlightOnChange, function (newValue, oldValue) {
|
||||
element.addClass('highlight');
|
||||
setTimeout(function() { element.removeClass('highlight'); }, 500);
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
.directive('checkStrength', function() {
|
||||
return {
|
||||
replace: false,
|
||||
restrict: 'EACM',
|
||||
require: 'ngModel',
|
||||
link: function(scope, element, attrs) {
|
||||
var _grep = function(elems, callback, invert) {
|
||||
var callbackInverse,
|
||||
matches = [],
|
||||
i = 0,
|
||||
length = elems.length,
|
||||
callbackExpect = !invert;
|
||||
|
||||
// Go through the array, only saving the items
|
||||
// that pass the validator function
|
||||
for (; i < length; i++) {
|
||||
callbackInverse = !callback(elems[i], i);
|
||||
if (callbackInverse !== callbackExpect) {
|
||||
matches.push(elems[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return matches;
|
||||
};
|
||||
|
||||
var strength = {
|
||||
messages: ['too weak', 'weak', 'weak', 'medium', 'strong'],
|
||||
messages: ['very weak', 'weak', 'weak', 'medium', 'strong'],
|
||||
colors: ['#c0392b', '#e74c3c', '#d35400', '#f39c12', '#27ae60'],
|
||||
mesureStrength: function (p) {
|
||||
var _force = 0;
|
||||
var _regex = /[$-/:-?{-~!"^_`\[\]]/g;
|
||||
var _lowerLetters = /[a-z]+/.test(p);
|
||||
var _upperLetters = /[A-Z]+/.test(p);
|
||||
var _numbers = /[0-9]+/.test(p);
|
||||
var _symbols = _regex.test(p);
|
||||
var _flags = [_lowerLetters, _upperLetters, _numbers, _symbols];
|
||||
var _passedMatches = _grep(_flags, function (el) { return el === true; }).length;
|
||||
var force = 0;
|
||||
var regex = /[$-/:-?{-~!"^_`\[\]]/g;
|
||||
var lowerLetters = /[a-z]+/.test(p);
|
||||
var upperLetters = /[A-Z]+/.test(p);
|
||||
var numbers = /[0-9]+/.test(p);
|
||||
var symbols = regex.test(p);
|
||||
var flags = [lowerLetters, upperLetters, numbers, symbols];
|
||||
var passedMatches = flags.filter(function (el) { return !!el; }).length;
|
||||
|
||||
_force += 2 * p.length + ((p.length >= 10) ? 1 : 0);
|
||||
_force += _passedMatches * 10;
|
||||
force = 2 * p.length + (p.length >= 10 ? 1 : 0);
|
||||
force += passedMatches * 10;
|
||||
|
||||
// penality (short password)
|
||||
_force = (p.length <= 6) ? Math.min(_force, 10) : _force;
|
||||
force = (p.length <= 6) ? Math.min(force, 10) : force;
|
||||
|
||||
// penality (poor variety of characters)
|
||||
_force = (_passedMatches == 1) ? Math.min(_force, 10) : _force;
|
||||
_force = (_passedMatches == 2) ? Math.min(_force, 20) : _force;
|
||||
_force = (_passedMatches == 3) ? Math.min(_force, 40) : _force;
|
||||
return _force;
|
||||
force = (passedMatches == 1) ? Math.min(force, 10) : force;
|
||||
force = (passedMatches == 2) ? Math.min(force, 20) : force;
|
||||
force = (passedMatches == 3) ? Math.min(force, 40) : force;
|
||||
return force;
|
||||
},
|
||||
getColor: function (s) {
|
||||
var idx = 0;
|
||||
|
|
|
|||
|
|
@ -182,7 +182,6 @@ Insight.prototype._request = function(options, callback) {
|
|||
request.open(options.method, url, true);
|
||||
request.timeout = 5000;
|
||||
request.ontimeout = function() {
|
||||
console.log('Insight timeout...retrying');
|
||||
setTimeout(function() {
|
||||
return self._request(options,callback);
|
||||
}, self.retryDelay);
|
||||
|
|
@ -206,9 +205,7 @@ Insight.prototype._request = function(options, callback) {
|
|||
else {
|
||||
var err= 'Error code: ' + request.status + ' - Status: ' + request.statusText
|
||||
+ ' - Description: ' + request.responseText;
|
||||
console.log('Insight Temporary error (will retry):', err);
|
||||
setTimeout(function() {
|
||||
console.log('### Retrying Insight Request....'); //TODO
|
||||
return self._request(options,callback);
|
||||
}, self.retryDelay);
|
||||
return callback(new Error(err));
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ PrivateKey.prototype._getHK = function(path) {
|
|||
if (typeof path === 'undefined') {
|
||||
return this.bip;
|
||||
}
|
||||
return this.bip.derive(path);
|
||||
var ret = this.bip.derive(path);
|
||||
return ret;
|
||||
};
|
||||
|
||||
PrivateKey.prototype.getForPaths = function(paths) {
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ PublicKeyRing.prototype.nicknameForIndex = function(index) {
|
|||
};
|
||||
|
||||
PublicKeyRing.prototype.nicknameForCopayer = function(copayerId) {
|
||||
return this.nicknameFor[copayerId];
|
||||
return this.nicknameFor[copayerId] || 'NN';
|
||||
};
|
||||
|
||||
PublicKeyRing.prototype.addCopayer = function(newEpk, nickname) {
|
||||
|
|
@ -151,6 +151,7 @@ PublicKeyRing.prototype.getPubKeys = function(index, isChange) {
|
|||
pubKeys = pubKeys.map(function(s){return new Buffer(s,'hex');});
|
||||
}
|
||||
|
||||
|
||||
return pubKeys;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ function TxProposal(opts) {
|
|||
this.sentTs = opts.sentTs || null;
|
||||
this.sentTxid = opts.sentTxid || null;
|
||||
this.inputChainPaths = opts.inputChainPaths || [];
|
||||
this.comment = opts.comment || null;
|
||||
}
|
||||
|
||||
TxProposal.prototype.toObj = function() {
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) {
|
|||
try{
|
||||
hasChanged = this.publicKeyRing.merge(inPKR, true);
|
||||
} catch (e){
|
||||
console.log('## WALLET ERROR', e); //TODO
|
||||
this.log('## WALLET ERROR', e); //TODO
|
||||
this.emit('connectionError', e.message);
|
||||
return;
|
||||
}
|
||||
|
|
@ -620,7 +620,7 @@ Wallet.prototype.getUnspent = function(cb) {
|
|||
};
|
||||
|
||||
|
||||
Wallet.prototype.createTx = function(toAddress, amountSatStr, opts, cb) {
|
||||
Wallet.prototype.createTx = function(toAddress, amountSatStr, comment, opts, cb) {
|
||||
var self = this;
|
||||
if (typeof opts === 'function') {
|
||||
cb = opts;
|
||||
|
|
@ -633,7 +633,7 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, opts, cb) {
|
|||
}
|
||||
|
||||
this.getUnspent(function(err, safeUnspent) {
|
||||
var ntxid = self.createTxSync(toAddress, amountSatStr, safeUnspent, opts);
|
||||
var ntxid = self.createTxSync(toAddress, amountSatStr, comment, safeUnspent, opts);
|
||||
if (ntxid) {
|
||||
self.sendIndexes();
|
||||
self.sendTxProposals(null, ntxid);
|
||||
|
|
@ -644,7 +644,7 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, opts, cb) {
|
|||
});
|
||||
};
|
||||
|
||||
Wallet.prototype.createTxSync = function(toAddress, amountSatStr, utxos, opts) {
|
||||
Wallet.prototype.createTxSync = function(toAddress, amountSatStr, comment, utxos, opts) {
|
||||
var pkr = this.publicKeyRing;
|
||||
var priv = this.privateKey;
|
||||
opts = opts || {};
|
||||
|
|
@ -655,6 +655,10 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, utxos, opts) {
|
|||
throw new Error('publicKeyRing is not complete');
|
||||
}
|
||||
|
||||
if (comment && comment.length > 100) {
|
||||
throw new Error("comment can't be longer that 100 characters");
|
||||
}
|
||||
|
||||
if (!opts.remainderOut) {
|
||||
opts.remainderOut = {
|
||||
address: this._doGenerateAddress(true).toString()
|
||||
|
|
@ -695,6 +699,7 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, utxos, opts) {
|
|||
creator: myId,
|
||||
createdTs: now,
|
||||
builder: b,
|
||||
comment: comment
|
||||
};
|
||||
|
||||
var ntxid = this.txProposals.add(data);
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ angular.module('copayApp.services')
|
|||
|
||||
var myCopayerId = w.getMyCopayerId();
|
||||
var pendingForUs = 0;
|
||||
var inT = w.getTxProposals().sort(function(t1, t2) { return t1.createdTs < t2.createdTs });
|
||||
var inT = w.getTxProposals().sort(function(t1, t2) { return t2.createdTs - t1.createdTs });
|
||||
var txs = [];
|
||||
|
||||
inT.forEach(function(i, index){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue