Merge branch 'master' of github.com:bitpay/copay into feature/copay-shell
This commit is contained in:
commit
4dbad23eac
16 changed files with 283 additions and 162 deletions
|
|
@ -20,8 +20,6 @@ angular.module('copay.header').controller('HeaderController',
|
|||
'icon': 'fi-archive',
|
||||
'link': '#/backup'
|
||||
}];
|
||||
|
||||
var beep = new Audio('sound/transaction.mp3');
|
||||
|
||||
$http.get('https://api.github.com/repos/bitpay/copay/tags').success(function(data){
|
||||
var toInt = function (s) { return parseInt(s); };
|
||||
|
|
@ -54,6 +52,7 @@ angular.module('copay.header').controller('HeaderController',
|
|||
}
|
||||
}
|
||||
if (currentAddr) {
|
||||
var beep = new Audio('sound/transaction.mp3');
|
||||
$notification.funds('Received fund', currentAddr, receivedFund);
|
||||
beep.play();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ angular.module('copay.import').controller('ImportController',
|
|||
if (!backupFile && !backupText) {
|
||||
$scope.loading = false;
|
||||
$rootScope.$flashMessage = { message: 'Please, select your backup file or paste the text', type: 'error'};
|
||||
$scope.loading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@ angular.module('copay.signin').controller('SigninController',
|
|||
$scope.selectedWalletId = $scope.wallets.length ? $scope.wallets[0].id : null;
|
||||
$scope.openPassword = '';
|
||||
|
||||
$scope.create = function(form) {
|
||||
$location.path('setup');
|
||||
};
|
||||
|
||||
$scope.open = function(form) {
|
||||
if (form && form.$invalid) {
|
||||
$rootScope.$flashMessage = { message: 'Please, enter required fields', type: 'error'};
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ function Wallet(opts) {
|
|||
//required params
|
||||
['storage', 'network', 'blockchain',
|
||||
'requiredCopayers', 'totalCopayers', 'spendUnconfirmed',
|
||||
'publicKeyRing', 'txProposals', 'privateKey', 'version'
|
||||
'publicKeyRing', 'txProposals', 'privateKey', 'version',
|
||||
'reconnectDelay'
|
||||
].forEach(function(k) {
|
||||
if (typeof opts[k] === 'undefined')
|
||||
throw new Error('missing required option for Wallet: ' + k);
|
||||
|
|
@ -64,7 +65,7 @@ Wallet.prototype.seedCopayer = function(pubKey) {
|
|||
Wallet.prototype.connectToAll = function() {
|
||||
|
||||
var all = this.publicKeyRing.getAllCopayerIds();
|
||||
console.log('[Wallet.js.58] connecting'); //TODO
|
||||
console.log('[Wallet.js.58] connecting'); //TODO
|
||||
this.network.connectToCopayers(all);
|
||||
if (this.seededCopayerId) {
|
||||
this.sendWalletReady(this.seededCopayerId);
|
||||
|
|
@ -100,7 +101,7 @@ Wallet.prototype._handleTxProposals = function(senderId, data, isInbound) {
|
|||
var inTxp = copay.TxProposals.fromObj(data.txProposals);
|
||||
var ids = inTxp.getNtxids();
|
||||
|
||||
if (ids.lenght>1) {
|
||||
if (ids.lenght > 1) {
|
||||
this.emit('badMessage', senderId);
|
||||
this.log('Received BAD TxProposal messsage FROM:', senderId); //TODO
|
||||
return;
|
||||
|
|
@ -164,12 +165,13 @@ Wallet.prototype._optsToObj = function() {
|
|||
spendUnconfirmed: this.spendUnconfirmed,
|
||||
requiredCopayers: this.requiredCopayers,
|
||||
totalCopayers: this.totalCopayers,
|
||||
reconnectDelay: this.reconnectDelay,
|
||||
name: this.name,
|
||||
netKey: this.netKey,
|
||||
version: this.version,
|
||||
};
|
||||
|
||||
if (this.token){
|
||||
if (this.token) {
|
||||
obj.token = this.token;
|
||||
obj.tokenTime = new Date().getTime();
|
||||
}
|
||||
|
|
@ -243,18 +245,26 @@ Wallet.prototype.netStart = function() {
|
|||
net.start(startOpts, function() {
|
||||
self.emit('ready', net.getPeer());
|
||||
self.token = net.peer.options.token;
|
||||
setTimeout(function(){
|
||||
setTimeout(function() {
|
||||
console.log('[EMIT publicKeyRingUpdated:]'); //TODO
|
||||
self.emit('publicKeyRingUpdated', true);
|
||||
console.log('[CONNECT:]'); //TODO
|
||||
self.connectToAll();
|
||||
self.scheduleConnect();
|
||||
console.log('[EMIT TxProposal]'); //TODO
|
||||
self.emit('txProposalsUpdated');
|
||||
self.store();
|
||||
},10);
|
||||
}, 10);
|
||||
});
|
||||
};
|
||||
|
||||
Wallet.prototype.scheduleConnect = function() {
|
||||
var self = this;
|
||||
if (self.network.isOnline()) {
|
||||
self.connectToAll();
|
||||
setTimeout(self.scheduleConnect.bind(self), self.reconnectDelay);
|
||||
}
|
||||
}
|
||||
|
||||
Wallet.prototype.getOnlinePeerIDs = function() {
|
||||
return this.network.getOnlinePeerIDs();
|
||||
};
|
||||
|
|
@ -331,7 +341,7 @@ Wallet.prototype.sendTxProposals = function(recipients, ntxid) {
|
|||
|
||||
var last = toSend[toSend];
|
||||
|
||||
for(var i in toSend) {
|
||||
for (var i in toSend) {
|
||||
var id = toSend[i];
|
||||
var lastInBatch = (i == toSend.length - 1);
|
||||
this.network.send(recipients, {
|
||||
|
|
@ -445,7 +455,7 @@ Wallet.prototype.sign = function(ntxid, cb) {
|
|||
ret = true;
|
||||
}
|
||||
if (cb) return cb(ret);
|
||||
},10);
|
||||
}, 10);
|
||||
};
|
||||
|
||||
Wallet.prototype.sendTx = function(ntxid, cb) {
|
||||
|
|
@ -625,7 +635,7 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, utxos, opts) {
|
|||
}]);
|
||||
|
||||
var selectedUtxos = b.getSelectedUnspent();
|
||||
|
||||
|
||||
var inputChainPaths = selectedUtxos.map(function(utxo) {
|
||||
return pkr.pathForAddress(utxo.address);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ WalletFactory.prototype.create = function(opts) {
|
|||
opts.verbose = this.verbose;
|
||||
|
||||
opts.spendUnconfirmed = opts.spendUnconfirmed || this.walletDefaults.spendUnconfirmed;
|
||||
opts.reconnectDelay = opts.reconnectDelay || this.walletDefaults.reconnectDelay;
|
||||
opts.requiredCopayers = requiredCopayers;
|
||||
opts.totalCopayers = totalCopayers;
|
||||
opts.version = opts.version || this.version;
|
||||
|
|
@ -146,7 +147,6 @@ WalletFactory.prototype.open = function(walletId, opts) {
|
|||
this.storage._setPassphrase(opts.passphrase);
|
||||
|
||||
var w = this.read(walletId);
|
||||
|
||||
if (w) {
|
||||
this._checkVersion(w.version);
|
||||
w.store();
|
||||
|
|
|
|||
|
|
@ -313,8 +313,8 @@ Network.prototype.setCopayerId = function(copayerId) {
|
|||
};
|
||||
|
||||
|
||||
// TODO cache this.
|
||||
Network.prototype.peerFromCopayer = function(hex) {
|
||||
// TODO cache this.
|
||||
var SIN = bitcore.SIN;
|
||||
return new SIN(new Buffer(hex,'hex')).toString();
|
||||
};
|
||||
|
|
@ -409,6 +409,10 @@ Network.prototype.send = function(copayerIds, payload, cb) {
|
|||
};
|
||||
|
||||
|
||||
Network.prototype.isOnline = function() {
|
||||
return !!this.peer;
|
||||
};
|
||||
|
||||
Network.prototype.connectTo = function(copayerId) {
|
||||
var self = this;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue