Ref chain to coin. Adds create wallet
This commit is contained in:
parent
ac5ede702d
commit
2c33f186af
37 changed files with 90 additions and 89 deletions
|
|
@ -1,13 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('addressesController', function($scope, $log, $stateParams, $state, $timeout, $ionicHistory, $ionicScrollDelegate, configService, popupService, gettextCatalog, ongoingProcess, lodash, profileService, walletService, bwcError, platformInfo, appConfigService, txFormatService, feeService) {
|
||||
angular.module('copayApp.controllers').controller('addressesController', function($scope, $log, $stateParams, $state, $timeout, $ionicHistory, $ionicScrollDelegate, popupService, gettextCatalog, ongoingProcess, lodash, profileService, walletService, bwcError, platformInfo, appConfigService, txFormatService, feeService) {
|
||||
var UNUSED_ADDRESS_LIMIT = 5;
|
||||
var BALANCE_ADDRESS_LIMIT = 5;
|
||||
var config = configService.getSync().wallet.settings;
|
||||
var unitName = config.unitName;
|
||||
var unitToSatoshi = config.unitToSatoshi;
|
||||
var satToUnit = 1 / unitToSatoshi;
|
||||
var unitDecimals = config.unitDecimals;
|
||||
var withBalance, cachedWallet;
|
||||
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
$scope.nextStep = data.stateParams.nextStep;
|
||||
$scope.currency = data.stateParams.currency;
|
||||
$scope.forceCurrency = data.stateParams.forceCurrency;
|
||||
$scope.forceChain = data.stateParams.forceChain || null;
|
||||
$scope.chain = $scope.forceChain || data.stateParams.chain || 'BTC';
|
||||
$scope.forceCoin = data.stateParams.forceCoin;
|
||||
$scope.coin = data.stateParams.coin || 'btc';
|
||||
|
||||
$scope.showMenu = $ionicHistory.backView() && ($ionicHistory.backView().stateName == 'tabs.send' ||
|
||||
$ionicHistory.backView().stateName == 'tabs.bitpayCard');
|
||||
|
|
@ -125,10 +125,10 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
}
|
||||
};
|
||||
|
||||
$scope.toggleChain = function() {
|
||||
if ($scope.forceCurrency || $scope.forceChain) return;
|
||||
$scope.toggleCoin = function() {
|
||||
if ($scope.forceCurrency || $scope.forceCoin) return;
|
||||
|
||||
$scope.chain = $scope.chain == 'BTC' ? 'BCH' : 'BTC';
|
||||
$scope.coin = $scope.coin == 'btc' ? 'bch' : 'btc';
|
||||
};
|
||||
|
||||
function checkFontSize() {
|
||||
|
|
@ -234,8 +234,8 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
$state.transitionTo($scope.nextStep, {
|
||||
id: _id,
|
||||
amount: $scope.useSendMax ? null : _amount,
|
||||
currency: $scope.showAlternativeAmount ? $scope.alternativeIsoCode : $scope.chain,
|
||||
chain: $scope.chain,
|
||||
currency: $scope.showAlternativeAmount ? $scope.alternativeIsoCode : $scope.coin,
|
||||
coin: $scope.coin,
|
||||
useSendMax: $scope.useSendMax
|
||||
});
|
||||
} else {
|
||||
|
|
@ -247,7 +247,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
toName: $scope.toName,
|
||||
toEmail: $scope.toEmail,
|
||||
toColor: $scope.toColor,
|
||||
chain: $scope.chain,
|
||||
coin: $scope.coin,
|
||||
useSendMax: $scope.useSendMax
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController', functio
|
|||
onlyComplete: true,
|
||||
network: $scope.network,
|
||||
hasFunds: true,
|
||||
chain: 'BTC'
|
||||
coin: 'btc'
|
||||
});
|
||||
if (lodash.isEmpty($scope.wallets)) {
|
||||
showErrorAndBack(null, gettextCatalog.getString('No wallets available'));
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController', funct
|
|||
});
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.isFiat = data.stateParams.currency != 'BCH' && data.stateParams.currency != 'BTC' ? true : false;
|
||||
$scope.isFiat = data.stateParams.currency != 'BTC' ? true : false;
|
||||
amount = data.stateParams.amount;
|
||||
currency = data.stateParams.currency;
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController', funct
|
|||
$scope.wallets = profileService.getWallets({
|
||||
onlyComplete: true,
|
||||
network: $scope.network,
|
||||
chain: 'BTC'
|
||||
coin: 'btc'
|
||||
});
|
||||
|
||||
if (lodash.isEmpty($scope.wallets)) {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController', functi
|
|||
});
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.isFiat = data.stateParams.currency != 'BCH' && data.stateParams.currency != 'BTC' ? true : false;
|
||||
$scope.isFiat = data.stateParams.currency != 'BTC' ? true : false;
|
||||
amount = data.stateParams.amount;
|
||||
currency = data.stateParams.currency;
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController', functi
|
|||
$scope.wallets = profileService.getWallets({
|
||||
onlyComplete: true,
|
||||
network: $scope.network,
|
||||
chain: 'BTC'
|
||||
coin: 'btc'
|
||||
});
|
||||
|
||||
if (lodash.isEmpty($scope.wallets)) {
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ angular.module('copayApp.controllers').controller('buyMercadoLibreController', f
|
|||
$scope.wallets = profileService.getWallets({
|
||||
onlyComplete: true,
|
||||
network: $scope.network,
|
||||
chain: 'BTC'
|
||||
coin: 'btc'
|
||||
});
|
||||
if (lodash.isEmpty($scope.wallets)) {
|
||||
showErrorAndBack(null, gettextCatalog.getString('No wallets available'));
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
|
||||
function setWalletSelector(chain, network, minAmount, cb) {
|
||||
function setWalletSelector(coin, network, minAmount, cb) {
|
||||
|
||||
// no min amount? (sendMax) => look for no empty wallets
|
||||
minAmount = minAmount || 1;
|
||||
|
|
@ -77,7 +77,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
$scope.wallets = profileService.getWallets({
|
||||
onlyComplete: true,
|
||||
network: network,
|
||||
chain: chain
|
||||
coin: coin
|
||||
});
|
||||
|
||||
if (!$scope.wallets || !$scope.wallets.length) {
|
||||
|
|
@ -138,7 +138,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
toEmail: data.stateParams.toEmail,
|
||||
toColor: data.stateParams.toColor,
|
||||
network: (new bitcore.Address(data.stateParams.toAddress)).network.name,
|
||||
chain: data.stateParams.chain,
|
||||
coin: data.stateParams.coin,
|
||||
txp: {},
|
||||
};
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
|
||||
$scope.walletSelectorTitle = gettextCatalog.getString('Send from');
|
||||
|
||||
setWalletSelector(tx.chain, tx.network, tx.toAmount, function(err) {
|
||||
setWalletSelector(tx.coin, tx.network, tx.toAmount, function(err) {
|
||||
if (err) {
|
||||
return exitWithError('Could not update wallets');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ angular.module('copayApp.controllers').controller('customAmountController', func
|
|||
|
||||
$scope.address = addr;
|
||||
|
||||
$scope.chain = (data.stateParams.chain).toLowerCase();
|
||||
$scope.coin = (data.stateParams.coin).toLowerCase();
|
||||
var parsedAmount = txFormatService.parseAmount(
|
||||
$scope.wallet,
|
||||
data.stateParams.amount,
|
||||
|
|
@ -43,7 +43,7 @@ angular.module('copayApp.controllers').controller('customAmountController', func
|
|||
// Convert to BTC or BCH
|
||||
var config = configService.getSync().wallet.settings;
|
||||
var amountUnit = txFormatService.satToUnit(parsedAmount.amountSat);
|
||||
var btcParsedAmount = txFormatService.parseAmount($scope.wallet, amountUnit, $scope.wallet.chain);
|
||||
var btcParsedAmount = txFormatService.parseAmount($scope.wallet, amountUnit, $scope.wallet.coin);
|
||||
|
||||
$scope.amountBtc = btcParsedAmount.amount;
|
||||
$scope.altAmountStr = btcParsedAmount.amountUnitStr;
|
||||
|
|
@ -68,7 +68,7 @@ angular.module('copayApp.controllers').controller('customAmountController', func
|
|||
}
|
||||
|
||||
$scope.copyToClipboard = function() {
|
||||
return 'bitcoin:' + $scope.address + '?amount=' + $scope.amountBtc + '&chain=' + $scope.chain;
|
||||
return 'bitcoin:' + $scope.address + '?amount=' + $scope.amountBtc + '&coin=' + $scope.coin;
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController', func
|
|||
});
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.isFiat = data.stateParams.currency != 'BCH' && data.stateParams.currency != 'BTC' ? true : false;
|
||||
$scope.isFiat = data.stateParams.currency != 'BTC' ? true : false;
|
||||
amount = data.stateParams.amount;
|
||||
currency = data.stateParams.currency;
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController', func
|
|||
onlyComplete: true,
|
||||
network: $scope.network,
|
||||
hasFunds: true,
|
||||
chain: 'BTC'
|
||||
coin: 'btc'
|
||||
});
|
||||
|
||||
if (lodash.isEmpty($scope.wallets)) {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController', funct
|
|||
});
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.isFiat = data.stateParams.currency != 'BCH' && data.stateParams.currency != 'BTC' ? true : false;
|
||||
$scope.isFiat = data.stateParams.currency != 'BTC' ? true : false;
|
||||
amount = data.stateParams.amount;
|
||||
currency = data.stateParams.currency;
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController', funct
|
|||
onlyComplete: true,
|
||||
network: $scope.network,
|
||||
hasFunds: true,
|
||||
chain: 'BTC'
|
||||
coin: 'btc'
|
||||
});
|
||||
|
||||
if (lodash.isEmpty($scope.wallets)) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
$scope.requestSpecificAmount = function() {
|
||||
$state.go('tabs.paymentRequest.amount', {
|
||||
id: $scope.wallet.credentials.walletId,
|
||||
forceChain: $scope.wallet.chain
|
||||
coin: $scope.wallet.coin
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ angular.module('copayApp.controllers').controller('topUpController', function($s
|
|||
onlyComplete: true,
|
||||
network: bitpayService.getEnvironment().network,
|
||||
hasFunds: true,
|
||||
chain: 'BTC'
|
||||
coin: 'btc'
|
||||
});
|
||||
|
||||
if (lodash.isEmpty($scope.wallets)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue