diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js
index 0bb858229..37a21b51e 100644
--- a/src/js/controllers/amount.js
+++ b/src/js/controllers/amount.js
@@ -34,6 +34,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
$scope.minShapeshiftAmount = parseFloat(data.stateParams.minShapeshiftAmount);
$scope.maxShapeshiftAmount = parseFloat(data.stateParams.maxShapeshiftAmount);
$scope.shapeshiftOrderId = data.stateParams.shapeshiftOrderId;
+ $scope.fromWalletId = data.stateParams.fromWalletId;
}
var config = configService.getSync().wallet.settings;
@@ -427,6 +428,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
var shapeshiftOrderUrl = 'https://www.shapeshift.io/#/status/';
shapeshiftOrderUrl += $scope.shapeshiftOrderId;
confirmData.description = shapeshiftOrderUrl;
+ confirmData.fromWalletId = $scope.fromWalletId;
}
$state.transitionTo('tabs.send.confirm', confirmData);
diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js
index 7cbd06cc9..5f8388322 100644
--- a/src/js/controllers/confirm.js
+++ b/src/js/controllers/confirm.js
@@ -81,6 +81,14 @@ angular.module('copayApp.controllers').controller('confirmController', function(
coin: coin
});
+ if (tx.fromWalletId) {
+ $scope.wallets = lodash.filter($scope.wallets, function(w) {
+ return w.id == tx.fromWalletId;
+ });
+ }
+
+
+
if (!$scope.wallets || !$scope.wallets.length) {
setNoWallet(gettextCatalog.getString('No wallets available'), true);
return cb();
@@ -150,6 +158,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
tx = {
toAmount: parseInt(data.stateParams.toAmount),
sendMax: data.stateParams.useSendMax == 'true' ? true : false,
+ fromWalletId: data.stateParams.fromWalletId,
toAddress: data.stateParams.toAddress,
description: data.stateParams.description,
paypro: data.stateParams.paypro,
diff --git a/src/js/directives/shapeshiftCoinSelector.js b/src/js/directives/shapeshiftCoinSelector.js
index 93ac02c1b..0cf536536 100644
--- a/src/js/directives/shapeshiftCoinSelector.js
+++ b/src/js/directives/shapeshiftCoinSelector.js
@@ -13,6 +13,7 @@ angular.module('copayApp.directives').directive('shapeshiftCoinSelector', functi
amount:'=amount',
marketData:'=marketData',
coinAddress:'=coinAddress',
+ walletId:'=walletId',
direction:'=direction',
},
link: function(scope, element, attrs, controllers) {
@@ -35,6 +36,12 @@ angular.module('copayApp.directives').directive('shapeshiftCoinSelector', functi
scope.$watch('amount', function(newVal) {
coinTraderCtrl.amount(newVal)
});
+ scope.$watch('walletId', function(newVal) {
+ if(scope.direction === 'in')
+ coinTraderCtrl.fromWalletId(newVal);
+ else if(scope.direction === 'out')
+ coinTraderCtrl.toWalletId(newVal);
+ });
},
templateUrl: 'views/includes/shapeshift-coin-selector.html'
}
diff --git a/src/js/directives/shapeshiftCoinTrader.js b/src/js/directives/shapeshiftCoinTrader.js
index ea577bdf6..d5c62f431 100644
--- a/src/js/directives/shapeshiftCoinTrader.js
+++ b/src/js/directives/shapeshiftCoinTrader.js
@@ -19,6 +19,12 @@ angular.module('copayApp.directives').directive('shapeshiftCoinTrader', function
this.amount = function(amount) {
$scope.amount = amount;
};
+ this.fromWalletId = function(id) {
+ $scope.fromWalletId = id;
+ };
+ this.toWalletId = function(id) {
+ $scope.toWalletId = id;
+ };
$scope.getMarketDataIn = function(coin) {
if(coin === $scope.coinOut) return $scope.getMarketData($scope.coinOut, $scope.coinIn);
@@ -99,6 +105,7 @@ angular.module('copayApp.directives').directive('shapeshiftCoinTrader', function
sendAddress = sendAddress.replace('bitcoin cash', 'bitcoincash');
var shapeshiftData = {
+ fromWalletId: $scope.fromWalletId,
minAmount: $scope.marketData.minimum,
maxAmount: $scope.marketData.maxLimit,
orderId: $scope.depositInfo.orderId
diff --git a/src/js/routes.js b/src/js/routes.js
index c39f3b66b..59c243258 100644
--- a/src/js/routes.js
+++ b/src/js/routes.js
@@ -287,7 +287,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
*/
.state('tabs.send.amount', {
- url: '/amount/:recipientType/:toAddress/:toName/:toEmail/:toColor/:coin/:fixedUnit/:minShapeshiftAmount/:maxShapeshiftAmount/:shapeshiftOrderId',
+ url: '/amount/:recipientType/:toAddress/:toName/:toEmail/:toColor/:coin/:fixedUnit/:fromWalletId/:minShapeshiftAmount/:maxShapeshiftAmount/:shapeshiftOrderId',
views: {
'tab-send@tabs': {
controller: 'amountController',
@@ -296,7 +296,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
.state('tabs.send.confirm', {
- url: '/confirm/:recipientType/:toAddress/:toName/:toAmount/:toEmail/:toColor/:description/:coin/:useSendMax',
+ url: '/confirm/:recipientType/:toAddress/:toName/:toAmount/:toEmail/:toColor/:description/:coin/:useSendMax/:fromWalletId',
views: {
'tab-send@tabs': {
controller: 'confirmController',
diff --git a/src/js/services/incomingData.js b/src/js/services/incomingData.js
index 373bffd3b..87e4ac3c0 100644
--- a/src/js/services/incomingData.js
+++ b/src/js/services/incomingData.js
@@ -63,6 +63,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
} else {
var params = { toAddress: addr, coin: coin };
if (shapeshiftData) {
+ params['fromWalletId'] = shapeshiftData.fromWalletId;
params['minShapeshiftAmount'] = shapeshiftData.minAmount;
params['maxShapeshiftAmount'] = shapeshiftData.maxAmount;
params['shapeshiftOrderId'] = shapeshiftData.orderId;
diff --git a/www/views/shapeshift.html b/www/views/shapeshift.html
index 0f51b6bd3..490b3a9c4 100644
--- a/www/views/shapeshift.html
+++ b/www/views/shapeshift.html
@@ -67,13 +67,14 @@
-
@@ -84,6 +85,7 @@
get-market-data="getMarketDataOut"
selected-coin="toWallet.coin"
coin-address="toWalletAddress"
+ wallet-id="toWallet.id"
direction="'out'">