Merge pull request #1706 from matiaspando/feature/selectWalletOnBIP21
Added page and controller to select wallet
This commit is contained in:
commit
e9c160bd4d
6 changed files with 98 additions and 2 deletions
27
js/controllers/paymentIntent.js
Normal file
27
js/controllers/paymentIntent.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
var bitcore = require('bitcore');
|
||||
|
||||
angular.module('copayApp.controllers').controller('PaymentIntentController', function($rootScope, $scope, $routeParams, $timeout, $location, controllerUtils) {
|
||||
|
||||
|
||||
$rootScope.title = 'Select the wallet that you will use to spend your bitcoins';
|
||||
$scope.wallets = [];
|
||||
|
||||
var wids = _.pluck($rootScope.iden.listWallets(), 'id');
|
||||
_.each(wids, function(wid) {
|
||||
var w = $rootScope.iden.getWalletById(wid);
|
||||
if (w && w.isReady()) {
|
||||
$scope.wallets.push(w);
|
||||
controllerUtils.updateBalance(w, function() {
|
||||
$rootScope.$digest();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$scope.switchWallet = function(wid) {
|
||||
//go to send page
|
||||
controllerUtils.setPaymentWallet(wid);
|
||||
};
|
||||
|
||||
});
|
||||
|
|
@ -4,6 +4,34 @@ var preconditions = require('preconditions').singleton();
|
|||
|
||||
angular.module('copayApp.controllers').controller('SendController',
|
||||
function($scope, $rootScope, $window, $timeout, $anchorScroll, $modal, isMobile, notification, controllerUtils, rateService) {
|
||||
|
||||
controllerUtils.redirIfNotComplete();
|
||||
|
||||
var w = $rootScope.wallet;
|
||||
preconditions.checkState(w);
|
||||
preconditions.checkState(w.settings.unitToSatoshi);
|
||||
|
||||
$rootScope.title = 'Send';
|
||||
$scope.loading = false;
|
||||
var satToUnit = 1 / w.settings.unitToSatoshi;
|
||||
$scope.defaultFee = bitcore.TransactionBuilder.FEE_PER_1000B_SAT * satToUnit;
|
||||
$scope.unitToBtc = w.settings.unitToSatoshi / bitcore.util.COIN;
|
||||
$scope.unitToSatoshi = w.settings.unitToSatoshi;
|
||||
|
||||
$scope.alternativeName = w.settings.alternativeName;
|
||||
$scope.alternativeIsoCode = w.settings.alternativeIsoCode;
|
||||
|
||||
$scope.isRateAvailable = false;
|
||||
$scope.rateService = rateService;
|
||||
|
||||
|
||||
|
||||
rateService.whenAvailable(function() {
|
||||
$scope.isRateAvailable = true;
|
||||
$scope.$digest();
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Setting the two related amounts as properties prevents an infinite
|
||||
* recursion for watches while preserving the original angular updates
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ angular.module('copayApp.controllers').controller('UriPaymentController', functi
|
|||
$rootScope.pendingPayment = new bitcore.BIP21(bitcoinURI);
|
||||
|
||||
$timeout(function() {
|
||||
$location.path('/send');
|
||||
console.log('Redirecting to /paymentIntent');
|
||||
$location.path('/paymentIntent');
|
||||
}, 1000);
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue