Error handling for Shapeshift, and UI for destination wallet.

This commit is contained in:
Brendon Duncan 2018-08-07 14:48:43 +12:00
commit db7eee984b
2 changed files with 19 additions and 4 deletions

View file

@ -470,11 +470,26 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
}
var toWallet = profileService.getWallet(destinationWalletId);
vm.destination.name = toWallet.name;
vm.destination.color = toWallet.color;
vm.destination.currency = toWallet.coin.toUpperCase();
$ionicLoading.show();
walletService.getAddress(vm.originWallet, false, function onWalletAddress(err, returnAddr) {
walletService.getAddress(toWallet, false, function onWalletAddress(err, withdrawalAddr) {
walletService.getAddress(vm.originWallet, false, function onReturnWalletAddress(err, returnAddr) {
if (err) {
$ionicLoading.hide();
shapeshiftService.shiftIt(vm.originWallet.coin, toWallet.coin, withdrawalAddr, returnAddr, function(shapeshiftData) {
popupService.showAlert(gettextCatalog.getString('Shapeshift Error'), err.toString());
return;
}
walletService.getAddress(toWallet, false, function onWithdrawalWalletAddress(err, withdrawalAddr) {
if (err) {
$ionicLoading.hide();
popupService.showAlert(gettextCatalog.getString('Shapeshift Error'), err.toString());
return;
}
$ionicLoading.hide();
shapeshiftService.shiftIt(vm.originWallet.coin, toWallet.coin, withdrawalAddr, returnAddr, function onShiftIt(shapeshiftData) {
vm.memo = 'ShapeShift Order:\nhttps://www.shapeshift.io/#/status/' + shapeshiftData.orderId;
toAddress = shapeshiftData.toAddress;
vm.destination.address = toAddress;

View file

@ -37,7 +37,7 @@
<div class="item item-compact" translate>To:</div>
<div class="item item-gutterless item-complex item-avatar">
<div class="item-content item-content-avatar"
ng-if="vm.destination.kind === 'contact' || vm.destination.kind === 'wallet'">
ng-if="vm.destination.kind === 'contact' || vm.destination.kind === 'wallet' || vm.destination.kind == 'shapeshift'">
<img src="img/contact-placeholder.svg" class="bg" ng-if="vm.destination.kind === 'contact'">
<i class="icon big-icon-svg theme-circle theme-circle-services" ng-if="vm.destination.kind === 'wallet' || vm.destination.kind === 'shapeshift'">
<div class="bg icon-wallet"