fixed bug where user could send to shapeshift from wrong wallet

This commit is contained in:
Kadir Sekha 2018-01-02 15:38:40 +00:00
commit 64b11fba3a
7 changed files with 31 additions and 3 deletions

View file

@ -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'
}

View file

@ -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