Merge
This commit is contained in:
commit
59b9167ff0
7 changed files with 47 additions and 29 deletions
|
|
@ -470,7 +470,7 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
||||||
amount: useSendMax ? undefined : satoshis,
|
amount: useSendMax ? undefined : satoshis,
|
||||||
fromWalletId: passthroughParams.fromWalletId,
|
fromWalletId: passthroughParams.fromWalletId,
|
||||||
sendMax: useSendMax,
|
sendMax: useSendMax,
|
||||||
toAddr: passthroughParams.toAddress,
|
toAddress: passthroughParams.toAddress,
|
||||||
toWalletId: passthroughParams.toWalletId
|
toWalletId: passthroughParams.toWalletId
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
|
||||||
defaults = configService.getDefaults();
|
defaults = configService.getDefaults();
|
||||||
originWalletId = data.stateParams.fromWalletId;
|
originWalletId = data.stateParams.fromWalletId;
|
||||||
satoshis = parseInt(data.stateParams.amount, 10);
|
satoshis = parseInt(data.stateParams.amount, 10);
|
||||||
toAddress = data.stateParams.toAddr;
|
toAddress = data.stateParams.toAddress;
|
||||||
|
|
||||||
vm.originWallet = profileService.getWallet(originWalletId);
|
vm.originWallet = profileService.getWallet(originWalletId);
|
||||||
vm.origin.currency = vm.originWallet.coin.toUpperCase();
|
vm.origin.currency = vm.originWallet.coin.toUpperCase();
|
||||||
|
|
@ -105,6 +105,10 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.approve = function() {
|
vm.approve = function() {
|
||||||
|
if (vm.thirdParty.id === 'shapeshift') {
|
||||||
|
shapeshiftService.shiftIt();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!tx || !vm.originWallet) return;
|
if (!tx || !vm.originWallet) return;
|
||||||
|
|
||||||
|
|
@ -218,7 +222,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
|
||||||
amount: parseInt(data.stateParams.amount),
|
amount: parseInt(data.stateParams.amount),
|
||||||
sendMax: data.stateParams.sendMax === 'true' ? true : false,
|
sendMax: data.stateParams.sendMax === 'true' ? true : false,
|
||||||
fromWalletId: data.stateParams.fromWalletId,
|
fromWalletId: data.stateParams.fromWalletId,
|
||||||
toAddress: data.stateParams.toAddr,
|
toAddress: data.stateParams.toAddress,
|
||||||
feeLevel: configFeeLevel,
|
feeLevel: configFeeLevel,
|
||||||
spendUnconfirmed: config.wallet.spendUnconfirmed,
|
spendUnconfirmed: config.wallet.spendUnconfirmed,
|
||||||
|
|
||||||
|
|
@ -594,7 +598,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
|
||||||
channel = "ga";
|
channel = "ga";
|
||||||
}
|
}
|
||||||
// When displaying Fiat, if the formatting fails, the crypto will be the primary amount.
|
// When displaying Fiat, if the formatting fails, the crypto will be the primary amount.
|
||||||
var amount = priceDisplayIsFiat ? vm.secondaryAmount || vm.primaryAmount : vm.primaryAmount;
|
var amount = unitFromSat * satoshis;
|
||||||
var log = new window.BitAnalytics.LogEvent("transfer_success", [{
|
var log = new window.BitAnalytics.LogEvent("transfer_success", [{
|
||||||
"coin": vm.originWallet.coin,
|
"coin": vm.originWallet.coin,
|
||||||
"type": "outgoing",
|
"type": "outgoing",
|
||||||
|
|
@ -678,7 +682,8 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
|
||||||
|
|
||||||
tx.sendMaxInfo = sendMaxInfo;
|
tx.sendMaxInfo = sendMaxInfo;
|
||||||
tx.amount = tx.sendMaxInfo.amount;
|
tx.amount = tx.sendMaxInfo.amount;
|
||||||
updateAmount();
|
satoshis = tx.amount;
|
||||||
|
updateSendAmounts();
|
||||||
ongoingProcess.set('calculatingFee', false);
|
ongoingProcess.set('calculatingFee', false);
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
showSendMaxWarning(wallet, sendMaxInfo);
|
showSendMaxWarning(wallet, sendMaxInfo);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
||||||
|
|
||||||
var fromWalletId = '';
|
var fromWalletId = '';
|
||||||
var priceDisplayAsFiat = false;
|
var priceDisplayAsFiat = false;
|
||||||
var requestedSatoshis = 0;
|
|
||||||
var unitDecimals = 0;
|
var unitDecimals = 0;
|
||||||
var unitsFromSatoshis = 0;
|
var unitsFromSatoshis = 0;
|
||||||
|
|
||||||
|
|
@ -39,8 +38,6 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
||||||
if ($scope.params.amount) { // There is an amount, so presume that it is a payment request
|
if ($scope.params.amount) { // There is an amount, so presume that it is a payment request
|
||||||
$scope.sendFlowTitle = gettextCatalog.getString('Payment Request');
|
$scope.sendFlowTitle = gettextCatalog.getString('Payment Request');
|
||||||
$scope.specificAmount = $scope.specificAlternativeAmount = '';
|
$scope.specificAmount = $scope.specificAlternativeAmount = '';
|
||||||
//requestedAmountCrypto = (($state.params.amount) * (1 / config.unitToSatoshi)).toFixed(config.unitDecimals);
|
|
||||||
requestedSatoshis = $state.params.amount;
|
|
||||||
$scope.isPaymentRequest = true;
|
$scope.isPaymentRequest = true;
|
||||||
}
|
}
|
||||||
if ($scope.params.thirdParty) {
|
if ($scope.params.thirdParty) {
|
||||||
|
|
@ -55,7 +52,6 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
||||||
|
|
||||||
if ($scope.thirdParty) {
|
if ($scope.thirdParty) {
|
||||||
// Third party services specific logic
|
// Third party services specific logic
|
||||||
handleThirdPartyIfBip70PaymentProtocol();
|
|
||||||
handleThirdPartyIfShapeshift();
|
handleThirdPartyIfShapeshift();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,11 +60,11 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
||||||
});
|
});
|
||||||
|
|
||||||
function formatRequestedAmount() {
|
function formatRequestedAmount() {
|
||||||
if (requestedSatoshis) {
|
if ($scope.params.amount) {
|
||||||
var cryptoAmount = (unitsFromSatoshis * requestedSatoshis).toFixed(unitDecimals);
|
var cryptoAmount = (unitsFromSatoshis * $scope.params.amount).toFixed(unitDecimals);
|
||||||
var cryptoCoin = $scope.coin.toUpperCase();
|
var cryptoCoin = $scope.coin.toUpperCase();
|
||||||
|
|
||||||
txFormatService.formatAlternativeStr($scope.coin, requestedSatoshis, function onFormatAlternativeStr(formatted){
|
txFormatService.formatAlternativeStr($scope.coin, $scope.params.amount, function onFormatAlternativeStr(formatted){
|
||||||
if (formatted) {
|
if (formatted) {
|
||||||
var fiatParts = formatted.split(' ');
|
var fiatParts = formatted.split(' ');
|
||||||
var fiatAmount = fiatParts[0];
|
var fiatAmount = fiatParts[0];
|
||||||
|
|
@ -105,12 +101,6 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleThirdPartyIfBip70PaymentProtocol() {
|
|
||||||
if ($scope.thirdParty.id === 'bitpay') {
|
|
||||||
console.log('paypro details:', $scope.thirdParty.details);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleThirdPartyIfShapeshift() {
|
function handleThirdPartyIfShapeshift() {
|
||||||
if ($scope.thirdParty.id === 'shapeshift' && $scope.type === 'destination') { // Shapeshift wants to know the
|
if ($scope.thirdParty.id === 'shapeshift' && $scope.type === 'destination') { // Shapeshift wants to know the
|
||||||
if ($scope.coin === 'bch') {
|
if ($scope.coin === 'bch') {
|
||||||
|
|
@ -169,8 +159,10 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ($scope.type === 'destination') {
|
} else if ($scope.type === 'destination') {
|
||||||
|
if (!$scope.coin) { // Allow for the coin to be set by a third party
|
||||||
$scope.fromWallet = profileService.getWallet(fromWalletId);
|
$scope.fromWallet = profileService.getWallet(fromWalletId);
|
||||||
$scope.coin = $scope.fromWallet.coin; // Only show wallets with the select origin wallet coin
|
$scope.coin = $scope.fromWallet.coin; // Only show wallets with the select origin wallet coin
|
||||||
|
}
|
||||||
$scope.headerTitle = gettextCatalog.getString('Choose a wallet to send to');
|
$scope.headerTitle = gettextCatalog.getString('Choose a wallet to send to');
|
||||||
|
|
||||||
if ($scope.coin === 'btc') { // if no specific coin is set or coin is set btc
|
if ($scope.coin === 'btc') { // if no specific coin is set or coin is set btc
|
||||||
|
|
|
||||||
|
|
@ -345,7 +345,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('tabs.send.review', {
|
.state('tabs.send.review', {
|
||||||
url: '/review/:thirdParty/:amount/:fromWalletId/:sendMax/:toAddr/:toWalletId',
|
url: '/review/:thirdParty/:amount/:fromWalletId/:sendMax/:toAddress/:toWalletId',
|
||||||
views: {
|
views: {
|
||||||
'tab-send@tabs': {
|
'tab-send@tabs': {
|
||||||
controller: 'reviewController',
|
controller: 'reviewController',
|
||||||
|
|
|
||||||
|
|
@ -423,8 +423,22 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
||||||
function handlePayPro(payProDetails, coin) {
|
function handlePayPro(payProDetails, coin) {
|
||||||
var thirdPartyData = {
|
var thirdPartyData = {
|
||||||
id: payProDetails.name,
|
id: payProDetails.name,
|
||||||
details: payProDetails
|
caName: payProDetails.caName,
|
||||||
|
caTrusted: payProDetails.caTrusted,
|
||||||
|
coin: coin,
|
||||||
|
domain: payProDetails.domain,
|
||||||
|
expires: payProDetails.expires,
|
||||||
|
id: 'bip70PaymentProtocol',
|
||||||
|
memo: payProDetails.memo,
|
||||||
|
merchant_data: payProDetails.merchant_data,
|
||||||
|
network: payProDetails.network,
|
||||||
|
requiredFeeRate: payProDetails.requiredFeeRate,
|
||||||
|
selfSigned: payProDetails.selfSigned,
|
||||||
|
time: payProDetails.time,
|
||||||
|
url: payProDetails.url,
|
||||||
|
verified: payProDetails.verified
|
||||||
};
|
};
|
||||||
|
|
||||||
var stateParams = {
|
var stateParams = {
|
||||||
amount: payProDetails.amount,
|
amount: payProDetails.amount,
|
||||||
toAddr: payProDetails.toAddress,
|
toAddr: payProDetails.toAddress,
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,32 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
angular.module('copayApp.services').factory('shapeshiftService', function($http, $log, lodash, moment, ongoingProcess, shapeshiftApiService, storageService, configService, platformInfo, servicesService) {
|
angular.module('copayApp.services').factory('shapeshiftService', function($http, $interval, $log, lodash, moment, ongoingProcess, shapeshiftApiService, storageService, configService, incomingData, platformInfo, servicesService) {
|
||||||
var root = {};
|
var root = {};
|
||||||
root.ShiftState = 'Shift';
|
root.ShiftState = 'Shift';
|
||||||
root.withdrawalAddress = ''
|
root.withdrawalAddress = ''
|
||||||
root.returnAddress = ''
|
root.returnAddress = ''
|
||||||
root.amount = '';
|
root.amount = '';
|
||||||
root.marketData = {}
|
root.marketData = {}
|
||||||
this.withdrawalAddress = function(address) {
|
root.withdrawalAddress = function(address) {
|
||||||
root.withdrawalAddress = address;
|
root.withdrawalAddress = address;
|
||||||
};
|
};
|
||||||
this.returnAddress = function(address) {
|
root.returnAddress = function(address) {
|
||||||
root.returnAddress = address;
|
root.returnAddress = address;
|
||||||
};
|
};
|
||||||
this.amount = function(amount) {
|
root.amount = function(amount) {
|
||||||
root.amount = amount;
|
root.amount = amount;
|
||||||
};
|
};
|
||||||
this.fromWalletId = function(id) {
|
root.fromWalletId = function(id) {
|
||||||
root.fromWalletId = id;
|
root.fromWalletId = id;
|
||||||
};
|
};
|
||||||
this.toWalletId = function(id) {
|
root.toWalletId = function(id) {
|
||||||
root.toWalletId = id;
|
root.toWalletId = id;
|
||||||
};
|
};
|
||||||
|
root.coinIn = function(coinIn) {
|
||||||
|
root.coinIn = coinIn.toUpperCase();
|
||||||
|
};
|
||||||
|
root.coinOut = function(coinOut) {
|
||||||
|
root.coinOut = coinOut.toUpperCase();
|
||||||
|
};
|
||||||
|
|
||||||
root.getMarketDataIn = function(coin) {
|
root.getMarketDataIn = function(coin) {
|
||||||
if(coin === root.coinOut) return root.getMarketData(root.coinOut, root.coinIn);
|
if(coin === root.coinOut) return root.getMarketData(root.coinOut, root.coinIn);
|
||||||
|
|
@ -104,6 +110,7 @@ angular.module('copayApp.services').factory('shapeshiftService', function($http,
|
||||||
|
|
||||||
var shapeshiftData = {
|
var shapeshiftData = {
|
||||||
fromWalletId: root.fromWalletId,
|
fromWalletId: root.fromWalletId,
|
||||||
|
toWalletId: root.toWalletId,
|
||||||
minAmount: root.marketData.minimum,
|
minAmount: root.marketData.minimum,
|
||||||
maxAmount: root.marketData.maxLimit,
|
maxAmount: root.marketData.maxLimit,
|
||||||
orderId: root.depositInfo.orderId
|
orderId: root.depositInfo.orderId
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.header.shapeshift {
|
.header.shapeshift {
|
||||||
background: url(../img/shapeshiftbg.jpg) center center no-repeat #28394d;
|
background: url(../img/shapeshiftbg.jpg) center center repeat #28394d;
|
||||||
opacity: 0.99;
|
opacity: 0.99;
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue