Merge pull request #3801 from bitpay/v1.7
Updating master with v1.7 patches
This commit is contained in:
commit
ec8f588e69
19 changed files with 341 additions and 357 deletions
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<widget id="com.bitpay.copay"
|
||||
version="1.7.1"
|
||||
android-versionCode="63"
|
||||
ios-CFBundleVersion="1.7.1">
|
||||
version="1.7.2"
|
||||
android-versionCode="64"
|
||||
ios-CFBundleVersion="1.7.2">
|
||||
<name>Copay</name>
|
||||
<description>
|
||||
A secure bitcoin wallet for friends and companies.
|
||||
|
|
|
|||
|
|
@ -57,11 +57,11 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.7.1</string>
|
||||
<string>1.7.2</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.7.1</string>
|
||||
<string>1.7.2</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSMainNibFile</key>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest">
|
||||
<Identity Name="18C7659D.CopayWallet" Publisher="CN=F89609D1-EB3E-45FD-A58A-C2E3895FCE7B" Version="1.7.1.0" />
|
||||
<Identity Name="18C7659D.CopayWallet" Publisher="CN=F89609D1-EB3E-45FD-A58A-C2E3895FCE7B" Version="1.7.2.0" />
|
||||
<mp:PhoneIdentity PhoneProductId="5381aa50-9069-11e4-84cc-293caf9cbdc8" PhonePublisherId="F89609D1-EB3E-45FD-A58A-C2E3895FCE7B" />
|
||||
<Properties>
|
||||
<DisplayName>Copay Bitcoin Wallet</DisplayName>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<Language code="es" />
|
||||
<Language code="ru" />
|
||||
</Languages>
|
||||
<App Author="Bitpay Inc." BitsPerPixel="32" Description="A multisignature Bitcoin Wallet" Genre="apps.normal" ProductID="{5381aa50-9069-11e4-84cc-293caf9cbdc8}" Publisher="Copay Bitcoin Wallet" PublisherID="{31cdd08b-457c-413d-b440-f6665eec847d}" RuntimeType="Silverlight" Title="Copay Bitcoin Wallet" Version="1.7.1.0" xmlns="" NotificationService="MPN">
|
||||
<App Author="Bitpay Inc." BitsPerPixel="32" Description="A multisignature Bitcoin Wallet" Genre="apps.normal" ProductID="{5381aa50-9069-11e4-84cc-293caf9cbdc8}" Publisher="Copay Bitcoin Wallet" PublisherID="{31cdd08b-457c-413d-b440-f6665eec847d}" RuntimeType="Silverlight" Title="Copay Bitcoin Wallet" Version="1.7.2.0" xmlns="" NotificationService="MPN">
|
||||
<IconPath IsRelative="true" IsResource="false">Assets\icon@2.png</IconPath>
|
||||
<Capabilities>
|
||||
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "copay",
|
||||
"description": "A multisignature wallet",
|
||||
"author": "BitPay",
|
||||
"version": "1.7.1",
|
||||
"version": "1.7.2",
|
||||
"keywords": [
|
||||
"wallet",
|
||||
"copay",
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@
|
|||
-->
|
||||
|
||||
<div ng-show="wordsC.step == 1">
|
||||
<div ng-show="wordsC.mnemonicWords || (wordsC.credentialsEncrypted && !wordsC.deleted)">
|
||||
<div ng-show="wordsC.mnemonicWords || (wordsC.credentialsEncrypted && !wordsC.deleted)" class="row">
|
||||
<h5 class="text-center" translate>Write your wallet seed</h5>
|
||||
<div class="size-14 text-gray" ng-show="(index.n>1 && index.m != index.n )">
|
||||
<div class="size-14 text-gray columns" ng-show="(index.n>1 && index.m != index.n )">
|
||||
<span translate>
|
||||
To restore this {{index.m}}-{{index.n}} <b>shared</b> wallet you will need
|
||||
</span>:
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
</ol>
|
||||
</span>
|
||||
</div>
|
||||
<div class="size-14 text-gray" ng-show="(index.n>1 && index.m == index.n )">
|
||||
<div class="size-14 text-gray columns" ng-show="(index.n>1 && index.m == index.n )">
|
||||
<span translate>
|
||||
To restore this {{index.m}}-{{index.n}} <b>shared</b> wallet you will need
|
||||
</span>:
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<span class="payment-proposal-to"
|
||||
ng-click="copyAddress(tx.toAddress)">
|
||||
<i class="fi-bitcoin left"></i>
|
||||
<contact ng-if="!tx.hasMultiplesOutputs" class="dib enable_text_select ellipsis m5t size-14" address="{{tx.toAddress}}"></contact>
|
||||
<contact ng-if="!tx.hasMultiplesOutputs" class="dib enable_text_select ellipsis m5t m5b size-14" address="{{tx.toAddress}}"></contact>
|
||||
<span ng-if="tx.hasMultiplesOutputs" translate>
|
||||
Multiple recipients
|
||||
</span>
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
</div>
|
||||
|
||||
<div class="oh p20t white" ng-if="tx.pendingForUs">
|
||||
<div class="large-6 medium-6 small-6 columns">
|
||||
<div class="large-6 medium-6 small-6 columns" ng-show="isShared">
|
||||
<button class="button outline round dark-gray expand" ng-click="reject(tx);"
|
||||
ng-disabled="loading">
|
||||
<i class="fi-x"></i>
|
||||
|
|
@ -170,12 +170,12 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="columns text-center m20t" ng-if="tx.canBeRemoved">
|
||||
<div class="text-gray size-12 m20b" ng-if="!tx.isGlidera && isShared" translate>
|
||||
<div class="columns text-center m20t" ng-if="tx.canBeRemoved || (tx.status == 'accepted' && !tx.broadcastedOn)">
|
||||
<div class="text-gray size-12 m20b" ng-show="!tx.isGlidera && isShared" translate>
|
||||
* A payment proposal can be deleted if 1) you are the creator, and no other copayer has signed, or 2) 24 hours have passed since the proposal was created.
|
||||
</div>
|
||||
<button class="tiny round outline dark-gray warning" ng-click="remove(tx)"
|
||||
ng-disabled="loading" ng-show="tx.canBeRemoved">
|
||||
ng-disabled="loading">
|
||||
<i class="fi-trash size-14 m5r"></i>
|
||||
<span translate>Delete Payment Proposal</span>
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -324,10 +324,10 @@
|
|||
<div class="large-12 columns">
|
||||
<h2 class="text-center m10t" translate>My Bitcoin address</h2>
|
||||
<div class="text-center" ng-click="home.copyAddress(home.addr[index.walletId])" ng-show="home.addr[index.walletId] || home.generatingAddress">
|
||||
<qrcode size="180" data="bitcoin:{{home.addr[index.walletId]}}"></qrcode>
|
||||
<div ng-show="home.generatingAddress" style="position:relative; top:-186px; height:0px">
|
||||
<div style="height:180px; width:180px; margin:auto; background: white">
|
||||
<div class="spinner" style="margin-top:60px">
|
||||
<qrcode size="220" data="bitcoin:{{home.addr[index.walletId]}}"></qrcode>
|
||||
<div ng-show="home.generatingAddress" style="position:relative; top:-226px; height:0px">
|
||||
<div style="height:220px; width:220px; margin:auto; background: white">
|
||||
<div class="spinner" style="margin-top:85px">
|
||||
<div class="rect1"></div>
|
||||
<div class="rect2"></div>
|
||||
<div class="rect3"></div>
|
||||
|
|
@ -364,7 +364,7 @@
|
|||
<span translate>Request a specific amount</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="small-12 columns" ng-show="index.isCordova">
|
||||
<div class="small-12 columns" ng-show="index.isCordova && !home.generatingAddress && home.addr[index.walletId]">
|
||||
<span class="button outline light-gray small round expand"
|
||||
ng-click="home.shareAddress(home.addr[index.walletId])">
|
||||
<span translate>Share address</span>
|
||||
|
|
|
|||
|
|
@ -784,12 +784,12 @@ textarea:focus
|
|||
}
|
||||
|
||||
.payment-proposal-to i {
|
||||
margin-right: 10px;
|
||||
position: absolute;
|
||||
left: 25px;
|
||||
padding-right: 10px;
|
||||
border-right: 1px solid;
|
||||
border-color: rgba(255, 255, 255, 0.1);
|
||||
font-size: 20px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
::-webkit-input-placeholder {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
angular.module('copayApp.controllers').controller('glideraController',
|
||||
function($rootScope, $scope, $timeout, $modal, profileService, configService, storageService, glideraService, isChromeApp, animationService, lodash) {
|
||||
|
||||
window.ignoreMobilePause = true;
|
||||
|
||||
this.getAuthenticateUrl = function() {
|
||||
return glideraService.getOauthCodeUrl();
|
||||
|
|
|
|||
|
|
@ -1463,20 +1463,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.setTab(tab, reset);
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/RequestTouchid', function(event, cb) {
|
||||
window.plugins.touchid.verifyFingerprint(
|
||||
gettextCatalog.getString('Scan your fingerprint please'),
|
||||
function(msg) {
|
||||
// OK
|
||||
return cb();
|
||||
},
|
||||
function(msg) {
|
||||
// ERROR
|
||||
return cb(gettext('Invalid Touch ID'));
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/NeedsPassword', function(event, isSetup, cb) {
|
||||
self.askPassword = {
|
||||
isSetup: isSetup,
|
||||
|
|
@ -1485,6 +1471,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
return cb(err, pass);
|
||||
},
|
||||
};
|
||||
$timeout(function() {
|
||||
$rootScope.$apply();
|
||||
});
|
||||
});
|
||||
|
||||
lodash.each(['NewCopayer', 'CopayerUpdated'], function(eventName) {
|
||||
|
|
|
|||
|
|
@ -43,9 +43,7 @@ angular.module('copayApp.controllers').controller('paymentUriController',
|
|||
|
||||
this.selectWallet = function(wid) {
|
||||
var self = this;
|
||||
if (wid != profileService.focusedClient.credentials.walletId) {
|
||||
profileService.setAndStoreFocus(wid, function() {});
|
||||
}
|
||||
profileService.setAndStoreFocus(wid, function() {});
|
||||
$timeout(function() {
|
||||
$rootScope.$emit('paymentUri', self.bitcoinURI);
|
||||
}, 1000);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('sellGlideraController',
|
||||
function($scope, $timeout, $log, $modal, configService, profileService, addressService, feeService, glideraService, bwsError, lodash, isChromeApp, animationService) {
|
||||
angular.module('copayApp.controllers').controller('sellGlideraController',
|
||||
function($scope, $timeout, $log, $modal, configService, profileService, addressService, feeService, glideraService, bwsError, lodash, isChromeApp, animationService, txSignService) {
|
||||
|
||||
var self = this;
|
||||
var config = configService.getSync();
|
||||
|
|
@ -38,7 +38,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
}, 100);
|
||||
}
|
||||
});
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
$log.debug(e);
|
||||
};
|
||||
};
|
||||
|
|
@ -57,12 +57,14 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
|
||||
$scope.selectWallet = function(walletId, walletName) {
|
||||
if (!profileService.getClient(walletId).isComplete()) {
|
||||
self.error = bwsError.msg({'code': 'WALLET_NOT_COMPLETE'}, 'Could not choose the wallet');
|
||||
self.error = bwsError.msg({
|
||||
'code': 'WALLET_NOT_COMPLETE'
|
||||
}, 'Could not choose the wallet');
|
||||
$modalInstance.dismiss('cancel');
|
||||
return;
|
||||
}
|
||||
$modalInstance.close({
|
||||
'walletId': walletId,
|
||||
'walletId': walletId,
|
||||
'walletName': walletName,
|
||||
});
|
||||
};
|
||||
|
|
@ -70,8 +72,8 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
|
||||
var modalInstance = $modal.open({
|
||||
templateUrl: 'views/modals/glidera-wallets.html',
|
||||
windowClass: animationService.modalAnimated.slideUp,
|
||||
controller: ModalInstanceCtrl,
|
||||
windowClass: animationService.modalAnimated.slideUp,
|
||||
controller: ModalInstanceCtrl,
|
||||
});
|
||||
|
||||
modalInstance.result.finally(function() {
|
||||
|
|
@ -101,24 +103,22 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
self.gettingSellPrice = false;
|
||||
if (err) {
|
||||
self.error = 'Could not get exchange information. Please, try again.';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
self.error = null;
|
||||
self.sellPrice = sellPrice;
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
this.get2faCode = function(token) {
|
||||
var self = this;
|
||||
this.loading = 'Sending 2FA code...';
|
||||
self.loading = 'Sending 2FA code...';
|
||||
$timeout(function() {
|
||||
glideraService.get2faCode(token, function(err, sent) {
|
||||
self.loading = null;
|
||||
if (err) {
|
||||
self.error = 'Could not send confirmation code to your phone';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
self.show2faCodeInput = sent;
|
||||
}
|
||||
});
|
||||
|
|
@ -129,107 +129,86 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
var self = this;
|
||||
self.error = null;
|
||||
|
||||
this.loading = 'Selling Bitcoin...';
|
||||
$timeout(function() {
|
||||
addressService.getAddress(fc.credentials.walletId, null, function(err, refundAddress) {
|
||||
if (!refundAddress) {
|
||||
self.loading = null;
|
||||
self.error = bwsError.msg(err, 'Could not create address');
|
||||
return;
|
||||
}
|
||||
glideraService.getSellAddress(token, function(error, sellAddress) {
|
||||
if (!sellAddress) {
|
||||
|
||||
txSignService.prepare(function(err) {
|
||||
if (err) {
|
||||
self.error = err;
|
||||
return;
|
||||
}
|
||||
self.loading = 'Selling Bitcoin...';
|
||||
$timeout(function() {
|
||||
addressService.getAddress(fc.credentials.walletId, null, function(err, refundAddress) {
|
||||
if (!refundAddress) {
|
||||
self.loading = null;
|
||||
self.error = 'Could not get the destination bitcoin address';
|
||||
self.error = bwsError.msg(err, 'Could not create address');
|
||||
return;
|
||||
}
|
||||
var amount = parseInt((self.sellPrice.qty * 100000000).toFixed(0));
|
||||
glideraService.getSellAddress(token, function(error, sellAddress) {
|
||||
if (!sellAddress) {
|
||||
self.loading = null;
|
||||
self.error = 'Could not get the destination bitcoin address';
|
||||
return;
|
||||
}
|
||||
var amount = parseInt((self.sellPrice.qty * 100000000).toFixed(0));
|
||||
|
||||
feeService.getCurrentFeeValue(self.currentFeeLevel, function(err, feePerKb) {
|
||||
if (err) $log.debug(err);
|
||||
fc.sendTxProposal({
|
||||
toAddress: sellAddress,
|
||||
amount: amount,
|
||||
message: 'Glidera transaction',
|
||||
customData: {'glideraToken': token},
|
||||
payProUrl: null,
|
||||
feePerKb: feePerKb,
|
||||
excludeUnconfirmedUtxos: self.currentSpendUnconfirmed ? false : true
|
||||
}, function(err, txp) {
|
||||
if (err) {
|
||||
profileService.lockFC();
|
||||
$log.error(err);
|
||||
$timeout(function() {
|
||||
self.loading = null;
|
||||
self.error = bwsError.msg(err, 'Error');
|
||||
}, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fc.canSign()) {
|
||||
self.loading = null;
|
||||
$log.info('No signing proposal: No private key');
|
||||
return;
|
||||
}
|
||||
|
||||
_signTx(txp, function(err, txp, rawTx) {
|
||||
profileService.lockFC();
|
||||
feeService.getCurrentFeeValue(self.currentFeeLevel, function(err, feePerKb) {
|
||||
if (err) $log.debug(err);
|
||||
fc.sendTxProposal({
|
||||
toAddress: sellAddress,
|
||||
amount: amount,
|
||||
message: 'Glidera transaction',
|
||||
customData: {
|
||||
'glideraToken': token
|
||||
},
|
||||
payProUrl: null,
|
||||
feePerKb: feePerKb,
|
||||
excludeUnconfirmedUtxos: self.currentSpendUnconfirmed ? false : true
|
||||
}, function(err, txp) {
|
||||
if (err) {
|
||||
self.loading = null;
|
||||
self.error = err;
|
||||
$scope.$apply();
|
||||
}
|
||||
else {
|
||||
var data = {
|
||||
refundAddress: refundAddress,
|
||||
signedTransaction: rawTx,
|
||||
priceUuid: self.sellPrice.priceUuid,
|
||||
useCurrentPrice: self.sellPrice.priceUuid ? false : true,
|
||||
ip: null
|
||||
};
|
||||
glideraService.sell(token, twoFaCode, data, function(err, data) {
|
||||
profileService.lockFC();
|
||||
$log.error(err);
|
||||
$timeout(function() {
|
||||
self.loading = null;
|
||||
if (err) {
|
||||
self.error = err;
|
||||
fc.removeTxProposal(txp, function(err, txpb) {
|
||||
$timeout(function() {
|
||||
$scope.$emit('Local/GlideraError');
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
else {
|
||||
self.success = data;
|
||||
$scope.$emit('Local/GlideraTx');
|
||||
}
|
||||
});
|
||||
self.error = bwsError.msg(err, 'Error');
|
||||
}, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
txSignService.sign(txp, function(err, txp) {
|
||||
if (err) {
|
||||
self.loading = null;
|
||||
self.error = err;
|
||||
$scope.$apply();
|
||||
} else {
|
||||
var rawTx = txp.raw;
|
||||
var data = {
|
||||
refundAddress: refundAddress,
|
||||
signedTransaction: rawTx,
|
||||
priceUuid: self.sellPrice.priceUuid,
|
||||
useCurrentPrice: self.sellPrice.priceUuid ? false : true,
|
||||
ip: null
|
||||
};
|
||||
glideraService.sell(token, twoFaCode, data, function(err, data) {
|
||||
self.loading = null;
|
||||
if (err) {
|
||||
self.error = err;
|
||||
fc.removeTxProposal(txp, function(err, txp) {
|
||||
$timeout(function() {
|
||||
$scope.$emit('Local/GlideraError');
|
||||
}, 100);
|
||||
});
|
||||
} else {
|
||||
self.success = data;
|
||||
$scope.$emit('Local/GlideraTx');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}, 100);
|
||||
|
||||
};
|
||||
|
||||
var _signTx = function(txp, cb) {
|
||||
var self = this;
|
||||
fc.signTxProposal(txp, function(err, signedTx) {
|
||||
profileService.lockFC();
|
||||
if (err) {
|
||||
err = bwsError.msg(err, 'Could not accept payment');
|
||||
return cb(err);
|
||||
}
|
||||
else {
|
||||
if (signedTx.status == 'accepted') {
|
||||
return cb(null, txp, signedTx.raw);
|
||||
|
||||
} else {
|
||||
return cb('The transaction could not be signed');
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $timeout, $filter, $modal, $log, notification, txStatus, isCordova, isMobile, profileService, lodash, configService, rateService, storageService, bitcore, isChromeApp, gettext, gettextCatalog, nodeWebkit, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService) {
|
||||
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $timeout, $filter, $modal, $log, notification, txStatus, isCordova, isMobile, profileService, lodash, configService, rateService, storageService, bitcore, isChromeApp, gettext, gettextCatalog, nodeWebkit, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, txSignService) {
|
||||
|
||||
var self = this;
|
||||
window.ignoreMobilePause = false;
|
||||
|
|
@ -87,16 +87,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$rootScope.hideMenuBar = false;
|
||||
});
|
||||
|
||||
var requestTouchid = function(cb) {
|
||||
var fc = profileService.focusedClient;
|
||||
config.touchIdFor = config.touchIdFor || {};
|
||||
if (window.touchidAvailable && config.touchIdFor[fc.credentials.walletId]) {
|
||||
$rootScope.$emit('Local/RequestTouchid', cb);
|
||||
} else {
|
||||
return cb();
|
||||
}
|
||||
};
|
||||
|
||||
this.onQrCodeScanned = function(data) {
|
||||
if (data) go.send();
|
||||
$rootScope.$emit('dataScanned', data);
|
||||
|
|
@ -335,72 +325,26 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
|
||||
$scope.sign = function(txp) {
|
||||
var fc = profileService.focusedClient;
|
||||
|
||||
if (!fc.canSign() && !fc.isPrivKeyExternal())
|
||||
return;
|
||||
|
||||
if (fc.isPrivKeyEncrypted()) {
|
||||
profileService.unlockFC(function(err) {
|
||||
if (err) {
|
||||
$scope.error = bwsError.msg(err);
|
||||
return;
|
||||
}
|
||||
return $scope.sign(txp);
|
||||
});
|
||||
return;
|
||||
};
|
||||
|
||||
self._setOngoingForSigning();
|
||||
$scope.loading = true;
|
||||
$scope.error = null;
|
||||
$timeout(function() {
|
||||
requestTouchid(function(err) {
|
||||
if (err) {
|
||||
self.setOngoingProcess();
|
||||
$scope.loading = false;
|
||||
profileService.lockFC();
|
||||
$scope.error = err;
|
||||
$scope.loading = true;
|
||||
|
||||
txSignService.prepareAndSignAndBroadcast(txp, {
|
||||
reporterFn: self.setOngoingProcess.bind(self)
|
||||
}, function(err, txp) {
|
||||
$scope.loading = false;
|
||||
$scope.$emit('UpdateTx');
|
||||
|
||||
if (err) {
|
||||
$scope.error = err;
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
return;
|
||||
}
|
||||
|
||||
profileService.signTxProposal(txp, function(err, txpsi) {
|
||||
self.setOngoingProcess();
|
||||
if (err) {
|
||||
$scope.$emit('UpdateTx');
|
||||
$scope.loading = false;
|
||||
$scope.error = bwsError.msg(err, gettextCatalog.getString('Could not accept payment'));
|
||||
$scope.$digest();
|
||||
} else {
|
||||
//if txp has required signatures then broadcast it
|
||||
var txpHasRequiredSignatures = txpsi.status == 'accepted';
|
||||
if (txpHasRequiredSignatures) {
|
||||
self.setOngoingProcess(gettextCatalog.getString('Broadcasting transaction'));
|
||||
$scope.loading = true;
|
||||
fc.broadcastTxProposal(txpsi, function(err, txpsb, memo) {
|
||||
self.setOngoingProcess();
|
||||
$scope.loading = false;
|
||||
if (err) {
|
||||
$scope.$emit('UpdateTx');
|
||||
$scope.error = bwsError.msg(err, gettextCatalog.getString('Could not broadcast payment'));
|
||||
$scope.$digest();
|
||||
} else {
|
||||
$log.debug('Transaction signed and broadcasted')
|
||||
if (memo)
|
||||
$log.info(memo);
|
||||
|
||||
refreshUntilItChanges = true;
|
||||
$modalInstance.close(txpsb);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$scope.loading = false;
|
||||
$modalInstance.close(txpsi);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
refreshUntilItChanges = true;
|
||||
$modalInstance.close(txp);
|
||||
return;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.reject = function(txp) {
|
||||
|
|
@ -833,6 +777,8 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
var currentSpendUnconfirmed = configWallet.spendUnconfirmed;
|
||||
var currentFeeLevel = walletSettings.feeLevel || 'normal';
|
||||
|
||||
this.resetError();
|
||||
|
||||
if (isCordova && this.isWindowsPhoneApp) {
|
||||
this.hideAddress = false;
|
||||
this.hideAmount = false;
|
||||
|
|
@ -844,14 +790,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
return;
|
||||
}
|
||||
|
||||
if (fc.isPrivKeyEncrypted()) {
|
||||
profileService.unlockFC(function(err) {
|
||||
if (err) return self.setSendError(err);
|
||||
return self.submitForm();
|
||||
});
|
||||
return;
|
||||
};
|
||||
|
||||
var comment = form.comment.$modelValue;
|
||||
|
||||
// ToDo: use a credential's (or fc's) function for this
|
||||
|
|
@ -869,7 +807,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
}
|
||||
};
|
||||
|
||||
self.setOngoingProcess(gettextCatalog.getString('Creating transaction'));
|
||||
$timeout(function() {
|
||||
var paypro = self._paypro;
|
||||
var address, amount;
|
||||
|
|
@ -877,17 +814,11 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
address = form.address.$modelValue;
|
||||
amount = parseInt((form.amount.$modelValue * unitToSat).toFixed(0));
|
||||
|
||||
requestTouchid(function(err) {
|
||||
txSignService.prepare(function(err) {
|
||||
if (err) {
|
||||
profileService.lockFC();
|
||||
self.setOngoingProcess();
|
||||
self.error = err;
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
}, 1);
|
||||
return;
|
||||
return self.setSendError(err);
|
||||
}
|
||||
|
||||
self.setOngoingProcess(gettextCatalog.getString('Creating transaction'));
|
||||
getFee(function(err, feePerKb) {
|
||||
if (err) $log.debug(err);
|
||||
fc.sendTxProposal({
|
||||
|
|
@ -900,13 +831,12 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
}, function(err, txp) {
|
||||
if (err) {
|
||||
self.setOngoingProcess();
|
||||
profileService.lockFC();
|
||||
return self.setSendError(err);
|
||||
}
|
||||
|
||||
if (!fc.canSign() && !fc.isPrivKeyExternal()) {
|
||||
$log.info('No signing proposal: No private key')
|
||||
self.setOngoingProcess();
|
||||
$log.info('No signing proposal: No private key')
|
||||
self.resetForm();
|
||||
txStatus.notify(txp, function() {
|
||||
return $scope.$emit('Local/TxProposalAction');
|
||||
|
|
@ -914,8 +844,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
return;
|
||||
}
|
||||
|
||||
self.signAndBroadcast(txp, function(err) {
|
||||
self.setOngoingProcess();
|
||||
txSignService.signAndBroadcast(txp, {
|
||||
reporterFn: self.setOngoingProcess.bind(self)
|
||||
}, function(err, txp) {
|
||||
self.resetForm();
|
||||
if (err) {
|
||||
self.error = err.message ? err.message : gettext('The payment was created but could not be completed. Please try again from home screen');
|
||||
|
|
@ -923,7 +854,12 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
}, 1);
|
||||
} else go.walletHome();
|
||||
} else {
|
||||
go.walletHome();
|
||||
txStatus.notify(txp, function() {
|
||||
$scope.$emit('Local/TxProposalAction', true);
|
||||
});
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -931,56 +867,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
}, 100);
|
||||
};
|
||||
|
||||
this._setOngoingForSigning = function() {
|
||||
var fc = profileService.focusedClient;
|
||||
|
||||
if (fc.isPrivKeyExternal() && fc.getPrivKeyExternalSourceName() == 'ledger') {
|
||||
self.setOngoingProcess(gettextCatalog.getString('Requesting Ledger Wallet to sign'));
|
||||
} else {
|
||||
self.setOngoingProcess(gettextCatalog.getString('Signing payment'));
|
||||
}
|
||||
};
|
||||
|
||||
this.signAndBroadcast = function(txp, cb) {
|
||||
var fc = profileService.focusedClient;
|
||||
|
||||
this._setOngoingForSigning();
|
||||
profileService.signTxProposal(txp, function(err, signedTx) {
|
||||
self.setOngoingProcess();
|
||||
if (err) {
|
||||
if (!lodash.isObject(err)) {
|
||||
err = { message: err};
|
||||
}
|
||||
err.message = bwsError.msg(err, gettextCatalog.getString('The payment was created but could not be signed. Please try again from home screen'));
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
if (signedTx.status == 'accepted') {
|
||||
self.setOngoingProcess(gettextCatalog.getString('Broadcasting transaction'));
|
||||
fc.broadcastTxProposal(signedTx, function(err, btx, memo) {
|
||||
self.setOngoingProcess();
|
||||
if (err) {
|
||||
err.message = bwsError.msg(err, gettextCatalog.getString('The payment was signed but could not be broadcasted. Please try again from home screen'));
|
||||
return cb(err);
|
||||
}
|
||||
if (memo)
|
||||
$log.info(memo);
|
||||
|
||||
txStatus.notify(btx, function() {
|
||||
$scope.$emit('Local/TxProposalAction', true);
|
||||
return cb();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
self.setOngoingProcess();
|
||||
txStatus.notify(signedTx, function() {
|
||||
$scope.$emit('Local/TxProposalAction');
|
||||
return cb();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.setForm = function(to, amount, comment) {
|
||||
var form = $scope.sendForm;
|
||||
if (to) {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ angular.element(document).ready(function() {
|
|||
}
|
||||
setTimeout(function() {
|
||||
var loc = window.location;
|
||||
var ignoreMobilePause = loc.toString().match(/(glidera|buy|sell)/) ? true : false;
|
||||
var ignoreMobilePause = loc.toString().match(/(buy|sell|uri-payment)/) ? true : false;
|
||||
window.ignoreMobilePause = ignoreMobilePause;
|
||||
}, 100);
|
||||
}, false);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.services')
|
||||
.factory('profileService', function profileServiceFactory($rootScope, $location, $timeout, $filter, $log, lodash, storageService, bwcService, configService, notificationService, isChromeApp, isCordova, gettext, gettextCatalog, nodeWebkit, bwsError, uxLanguage, ledger, bitcore, trezor) {
|
||||
.factory('profileService', function profileServiceFactory($rootScope, $location, $timeout, $filter, $log, lodash, storageService, bwcService, configService, notificationService, isChromeApp, isCordova, gettext, gettextCatalog, nodeWebkit, bwsError, uxLanguage, bitcore) {
|
||||
|
||||
var root = {};
|
||||
|
||||
|
|
@ -99,6 +99,11 @@ angular.module('copayApp.services')
|
|||
root.walletClients[credentials.walletId].started = true;
|
||||
root.walletClients[credentials.walletId].doNotVerifyPayPro = isChromeApp;
|
||||
|
||||
if (client.hasPrivKeyEncrypted() && !client.isPrivKeyEncrypted()) {
|
||||
$log.warn('Auto locking unlocked wallet:' + credentials.walletId);
|
||||
client.lock();
|
||||
}
|
||||
|
||||
client.initialize({}, function(err) {
|
||||
if (err) {
|
||||
$log.error('Could not init notifications err:', err);
|
||||
|
|
@ -110,8 +115,8 @@ angular.module('copayApp.services')
|
|||
|
||||
root.setWalletClients = function() {
|
||||
var credentials = root.profile.credentials;
|
||||
lodash.each(credentials, function(credentials) {
|
||||
root.setWalletClient(credentials);
|
||||
lodash.each(credentials, function(credential) {
|
||||
root.setWalletClient(credential);
|
||||
});
|
||||
$rootScope.$emit('Local/WalletListUpdated');
|
||||
};
|
||||
|
|
@ -630,6 +635,10 @@ angular.module('copayApp.services')
|
|||
|
||||
root.unlockFC = function(cb) {
|
||||
var fc = root.focusedClient;
|
||||
|
||||
if (!fc.isPrivKeyEncrypted())
|
||||
return cb();
|
||||
|
||||
$log.debug('Wallet is encrypted');
|
||||
$rootScope.$emit('Local/NeedsPassword', false, function(err2, password) {
|
||||
if (err2 || !password) {
|
||||
|
|
@ -645,12 +654,6 @@ angular.module('copayApp.services')
|
|||
message: gettext('Wrong password')
|
||||
});
|
||||
}
|
||||
$timeout(function() {
|
||||
if (fc.hasPrivKeyEncrypted()) {
|
||||
$log.debug('Locking wallet automatically');
|
||||
root.lockFC();
|
||||
};
|
||||
}, 2000);
|
||||
return cb();
|
||||
});
|
||||
};
|
||||
|
|
@ -680,59 +683,5 @@ angular.module('copayApp.services')
|
|||
return lodash.sortBy(ret, 'name');
|
||||
};
|
||||
|
||||
root._signWithLedger = function(txp, cb) {
|
||||
var fc = root.focusedClient;
|
||||
$log.info('Requesting Ledger Chrome app to sign the transaction');
|
||||
|
||||
ledger.signTx(txp, fc.credentials.account, function(result) {
|
||||
$log.debug('Ledger response', result);
|
||||
if (!result.success)
|
||||
return cb(result.message || result.error);
|
||||
|
||||
txp.signatures = lodash.map(result.signatures, function(s) {
|
||||
return s.substring(0, s.length - 2);
|
||||
});
|
||||
return fc.signTxProposal(txp, cb);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
root._signWithTrezor = function(txp, cb) {
|
||||
var fc = root.focusedClient;
|
||||
$log.info('Requesting Trezor to sign the transaction');
|
||||
|
||||
var xPubKeys = lodash.pluck(fc.credentials.publicKeyRing, 'xPubKey');
|
||||
trezor.signTx(xPubKeys, txp, fc.credentials.account, function(err, result) {
|
||||
if (err) return cb(err);
|
||||
|
||||
$log.debug('Trezor response', result);
|
||||
txp.signatures = result.signatures;
|
||||
return fc.signTxProposal(txp, cb);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
root.signTxProposal = function(txp, cb) {
|
||||
var fc = root.focusedClient;
|
||||
|
||||
if (fc.isPrivKeyExternal()) {
|
||||
switch (fc.getPrivKeyExternalSourceName()) {
|
||||
case 'ledger':
|
||||
return root._signWithLedger(txp, cb);
|
||||
case 'trezor':
|
||||
return root._signWithTrezor(txp, cb);
|
||||
default:
|
||||
var msg = 'Unsupported External Key:' + fc.getPrivKeyExternalSourceName();
|
||||
$log.error(msg);
|
||||
return cb(msg);
|
||||
}
|
||||
} else {
|
||||
return fc.signTxProposal(txp, function(err, signedTxp) {
|
||||
root.lockFC();
|
||||
return cb(err, signedTxp);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return root;
|
||||
});
|
||||
|
|
|
|||
184
src/js/services/txSignService.js
Normal file
184
src/js/services/txSignService.js
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('txSignService', function($rootScope, profileService, gettextCatalog, lodash, trezor, ledger, configService, bwsError, $log) {
|
||||
var root = {};
|
||||
var config = configService.getSync();
|
||||
|
||||
var reportSigningStatus = function(opts) {
|
||||
if (!opts.reporterFn) return;
|
||||
|
||||
var fc = profileService.focusedClient;
|
||||
|
||||
if (fc.isPrivKeyExternal()) {
|
||||
if (fc.getPrivKeyExternalSourceName() == 'ledger') {
|
||||
opts.reporterFn(gettextCatalog.getString('Requesting Ledger Wallet to sign'));
|
||||
} else if (fc.getPrivKeyExternalSourceName() == 'trezor') {
|
||||
opts.reporterFn(gettextCatalog.getString('Requesting Trezor Wallet to sign'));
|
||||
}
|
||||
} else {
|
||||
opts.reporterFn(gettextCatalog.getString('Signing payment'));
|
||||
}
|
||||
};
|
||||
|
||||
var reportBroadcastingStatus = function(opts) {
|
||||
if (!opts.reporterFn) return;
|
||||
|
||||
opts.reporterFn(gettextCatalog.getString('Broadcasting transaction'));
|
||||
};
|
||||
|
||||
var stopReport = function(opts) {
|
||||
if (!opts.reporterFn) return;
|
||||
|
||||
opts.reporterFn();
|
||||
};
|
||||
|
||||
var requestTouchId = function(cb) {
|
||||
try {
|
||||
window.plugins.touchid.verifyFingerprint(
|
||||
gettextCatalog.getString('Scan your fingerprint please'),
|
||||
function(msg) {
|
||||
$log.debug('Touch ID OK');
|
||||
return cb();
|
||||
},
|
||||
function(msg) {
|
||||
$log.debug('Touch ID Failed:' + msg);
|
||||
return cb(gettext('Touch ID Failed:') + msg);
|
||||
}
|
||||
);
|
||||
} catch (e) {
|
||||
$log.debug('Touch ID Failed:' + e);
|
||||
return cb(gettext('Touch ID Failed:') + e);
|
||||
};
|
||||
};
|
||||
|
||||
root.checkTouchId = function(cb) {
|
||||
var fc = profileService.focusedClient;
|
||||
config.touchIdFor = config.touchIdFor || {};
|
||||
if (window.touchidAvailable && config.touchIdFor[fc.credentials.walletId]) {
|
||||
requestTouchId(cb);
|
||||
} else {
|
||||
return cb();
|
||||
}
|
||||
};
|
||||
|
||||
root.prepare = function(cb) {
|
||||
var fc = profileService.focusedClient;
|
||||
if (!fc.canSign() && !fc.isPrivKeyExternal())
|
||||
return cb('Cannot sign'); // should never happen, no need to translate
|
||||
|
||||
root.checkTouchId(function(err) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
};
|
||||
|
||||
profileService.unlockFC(function(err) {
|
||||
if (err) {
|
||||
return cb(bwsError.msg(err));
|
||||
};
|
||||
|
||||
return cb();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
var _signWithLedger = function(txp, cb) {
|
||||
var fc = root.focusedClient;
|
||||
$log.info('Requesting Ledger Chrome app to sign the transaction');
|
||||
|
||||
ledger.signTx(txp, fc.credentials.account, function(result) {
|
||||
$log.debug('Ledger response', result);
|
||||
if (!result.success)
|
||||
return cb(result.message || result.error);
|
||||
|
||||
txp.signatures = lodash.map(result.signatures, function(s) {
|
||||
return s.substring(0, s.length - 2);
|
||||
});
|
||||
return fc.signTxProposal(txp, cb);
|
||||
});
|
||||
};
|
||||
|
||||
var _signWithTrezor = function(txp, cb) {
|
||||
var fc = root.focusedClient;
|
||||
$log.info('Requesting Trezor to sign the transaction');
|
||||
|
||||
var xPubKeys = lodash.pluck(fc.credentials.publicKeyRing, 'xPubKey');
|
||||
trezor.signTx(xPubKeys, txp, fc.credentials.account, function(err, result) {
|
||||
if (err) return cb(err);
|
||||
|
||||
$log.debug('Trezor response', result);
|
||||
txp.signatures = result.signatures;
|
||||
return fc.signTxProposal(txp, cb);
|
||||
});
|
||||
};
|
||||
|
||||
root.sign = function(txp, cb) {
|
||||
var fc = profileService.focusedClient;
|
||||
|
||||
if (fc.isPrivKeyExternal()) {
|
||||
switch (fc.getPrivKeyExternalSourceName()) {
|
||||
case 'ledger':
|
||||
return _signWithLedger(txp, cb);
|
||||
case 'trezor':
|
||||
return _signWithTrezor(txp, cb);
|
||||
default:
|
||||
var msg = 'Unsupported External Key:' + fc.getPrivKeyExternalSourceName();
|
||||
$log.error(msg);
|
||||
return cb(msg);
|
||||
}
|
||||
} else {
|
||||
fc.signTxProposal(txp, function(err, signedTxp) {
|
||||
profileService.lockFC();
|
||||
return cb(err, signedTxp);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
root.signAndBroadcast = function(txp, opts, cb) {
|
||||
reportSigningStatus(opts);
|
||||
|
||||
var fc = profileService.focusedClient;
|
||||
root.sign(txp, function(err, txp) {
|
||||
if (err) {
|
||||
stopReport(opts);
|
||||
return cb(bwsError.msg(err), gettextCatalog.getString('Could not accept payment'));
|
||||
};
|
||||
|
||||
if (txp.status != 'accepted')
|
||||
return (null, txp);
|
||||
|
||||
reportBroadcastingStatus(opts);
|
||||
fc.broadcastTxProposal(txp, function(err, txp, memo) {
|
||||
stopReport(opts);
|
||||
|
||||
if (err) {
|
||||
return cb(bwsError.msg(err, gettextCatalog.getString('Could not broadcast payment')));
|
||||
};
|
||||
|
||||
$log.debug('Transaction signed and broadcasted')
|
||||
|
||||
if (memo)
|
||||
$log.info(memo);
|
||||
|
||||
return cb(null, txp);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
root.prepareAndSignAndBroadcast = function(txp, opts, cb) {
|
||||
reportSigningStatus(opts);
|
||||
root.prepare(function(err) {
|
||||
if (err) {
|
||||
stopReport(opts);
|
||||
return cb(err);
|
||||
};
|
||||
root.signAndBroadcast(txp, opts, function(err, txp) {
|
||||
if (err) {
|
||||
stopReport(opts);
|
||||
return cb(err);
|
||||
};
|
||||
return cb(null, txp);
|
||||
});
|
||||
});
|
||||
};
|
||||
return root;
|
||||
});
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Version=1.7.1
|
||||
Version=1.7.2
|
||||
Name=Copay
|
||||
Comment=A multisignature wallet
|
||||
Exec=copay
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||
|
||||
#define MyAppName "Copay"
|
||||
#define MyAppVersion "1.7.1"
|
||||
#define MyAppVersion "1.7.2"
|
||||
#define MyAppPublisher "BitPay"
|
||||
#define MyAppURL "https://copay.io"
|
||||
#define MyAppExeName "Copay.exe"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue