Adds bitcoin cash basic support (unit convertion, integrations, request specific amount, etc)
This commit is contained in:
parent
60ae2d2117
commit
94363704ab
24 changed files with 376 additions and 302 deletions
|
|
@ -35,39 +35,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController', funct
|
|||
}
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeLeave", function(event, data) {
|
||||
$ionicConfig.views.swipeBackEnabled(true);
|
||||
});
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data) {
|
||||
$ionicConfig.views.swipeBackEnabled(false);
|
||||
});
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.isFiat = data.stateParams.currency != 'bits' && data.stateParams.currency != 'BTC' ? true : false;
|
||||
var parsedAmount = txFormatService.parseAmount(
|
||||
data.stateParams.amount,
|
||||
data.stateParams.currency);
|
||||
|
||||
amount = parsedAmount.amount;
|
||||
currency = parsedAmount.currency;
|
||||
$scope.amountUnitStr = parsedAmount.amountUnitStr;
|
||||
|
||||
$scope.network = glideraService.getNetwork();
|
||||
$scope.wallets = profileService.getWallets({
|
||||
m: 1, // Only 1-signature wallet
|
||||
onlyComplete: true,
|
||||
network: $scope.network,
|
||||
hasFunds: true,
|
||||
minAmount: parsedAmount.amountSat
|
||||
});
|
||||
|
||||
if (lodash.isEmpty($scope.wallets)) {
|
||||
showErrorAndBack('Insufficient funds');
|
||||
return;
|
||||
}
|
||||
$scope.wallet = $scope.wallets[0]; // Default first wallet
|
||||
|
||||
var processPaymentInfo = function() {
|
||||
ongoingProcess.set('connectingGlidera', true);
|
||||
glideraService.init(function(err, data) {
|
||||
if (err) {
|
||||
|
|
@ -91,6 +59,35 @@ angular.module('copayApp.controllers').controller('sellGlideraController', funct
|
|||
$scope.sellInfo = sell;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeLeave", function(event, data) {
|
||||
$ionicConfig.views.swipeBackEnabled(true);
|
||||
});
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data) {
|
||||
$ionicConfig.views.swipeBackEnabled(false);
|
||||
});
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.isFiat = data.stateParams.currency != 'BCH' && data.stateParams.currency != 'BTC' ? true : false;
|
||||
amount = data.stateParams.amount;
|
||||
currency = data.stateParams.currency;
|
||||
|
||||
$scope.network = glideraService.getNetwork();
|
||||
$scope.wallets = profileService.getWallets({
|
||||
m: 1, // Only 1-signature wallet
|
||||
onlyComplete: true,
|
||||
network: $scope.network,
|
||||
hasFunds: true,
|
||||
chain: 'BTC'
|
||||
});
|
||||
|
||||
if (lodash.isEmpty($scope.wallets)) {
|
||||
showErrorAndBack('Insufficient funds');
|
||||
return;
|
||||
}
|
||||
$scope.onWalletSelect($scope.wallets[0]); // Default first wallet
|
||||
});
|
||||
|
||||
var ask2FaCode = function(mode, cb) {
|
||||
|
|
@ -108,7 +105,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController', funct
|
|||
popupService.showPrompt(title, message, null, function(twoFaCode) {
|
||||
if (typeof twoFaCode == 'undefined') return cb();
|
||||
return cb(twoFaCode);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
return cb();
|
||||
}
|
||||
|
|
@ -119,7 +116,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController', funct
|
|||
var okText = 'Confirm';
|
||||
var cancelText = 'Cancel';
|
||||
popupService.showConfirm(null, message, okText, cancelText, function(ok) {
|
||||
if (!ok) return;
|
||||
if (!ok) return;
|
||||
ongoingProcess.set('sellingBitcoin', true, statusChangeHandler);
|
||||
glideraService.get2faCode($scope.token, function(err, tfa) {
|
||||
if (err) {
|
||||
|
|
@ -231,6 +228,15 @@ angular.module('copayApp.controllers').controller('sellGlideraController', funct
|
|||
|
||||
$scope.onWalletSelect = function(wallet) {
|
||||
$scope.wallet = wallet;
|
||||
var parsedAmount = txFormatService.parseAmount(
|
||||
wallet,
|
||||
amount,
|
||||
currency);
|
||||
|
||||
amount = parsedAmount.amount;
|
||||
currency = parsedAmount.currency;
|
||||
$scope.amountUnitStr = parsedAmount.amountUnitStr;
|
||||
processPaymentInfo();
|
||||
};
|
||||
|
||||
$scope.goBackHome = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue