Clean code

This commit is contained in:
Gustavo Maximiliano Cortez 2017-01-03 12:44:50 -03:00
commit 49c01ca015
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
6 changed files with 0 additions and 873 deletions

View file

@ -1,175 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('buyCoinbaseController',
function($scope, $log, $ionicModal, $timeout, lodash, profileService, coinbaseService, addressService, ongoingProcess) {
var self = this;
this.init = function(testnet) {
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet');
var client = profileService.focusedClient;
if (client) {
$timeout(function() {
self.selectedWalletId = client.credentials.walletId;
self.selectedWalletName = client.credentials.walletName;
$scope.$apply();
}, 100);
}
};
this.getPaymentMethods = function(token) {
coinbaseService.getPaymentMethods(token, function(err, p) {
if (err) {
self.error = err;
return;
}
self.paymentMethods = [];
lodash.each(p.data, function(pm) {
if (pm.allow_buy) {
self.paymentMethods.push(pm);
}
if (pm.allow_buy && pm.primary_buy) {
$scope.selectedPaymentMethod = pm;
}
});
});
};
this.getPrice = function(token) {
var currency = 'USD';
coinbaseService.buyPrice(token, currency, function(err, b) {
if (err) return;
self.buyPrice = b.data || null;
});
};
$scope.openWalletsModal = function(wallets) {
self.error = null;
$scope.type = 'BUY';
$scope.wallets = wallets;
$scope.noColor = true;
$scope.self = self;
$ionicModal.fromTemplateUrl('views/modals/wallets.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.walletsModal = modal;
$scope.walletsModal.show();
});
$scope.$on('walletSelected', function(ev, walletId) {
$timeout(function() {
var client = profileService.getClient(walletId);
self.selectedWalletId = walletId;
self.selectedWalletName = client.credentials.walletName;
$scope.$apply();
}, 100);
$scope.walletsModal.hide();
});
};
this.buyRequest = function(token, account) {
self.error = null;
var accountId = account.id;
var amount = $scope.amount ? $scope.amount : $scope.fiat;
var currency = $scope.amount ? 'BTC' : 'USD';
if (!amount) return;
var dataSrc = {
amount: amount,
currency: currency,
payment_method: $scope.selectedPaymentMethod.id || null
};
ongoingProcess.set('Sending request...', true);
coinbaseService.buyRequest(token, accountId, dataSrc, function(err, data) {
ongoingProcess.set('Sending request...', false);
if (err) {
self.error = err;
return;
}
self.buyInfo = data.data;
});
};
this.confirmBuy = function(token, account, buy) {
self.error = null;
var accountId = account.id;
var buyId = buy.id;
ongoingProcess.set('Buying Bitcoin...', true);
coinbaseService.buyCommit(token, accountId, buyId, function(err, b) {
ongoingProcess.set('Buying Bitcoin...', false);
if (err) {
self.error = err;
return;
} else {
var tx = b.data.transaction;
if (!tx) return;
ongoingProcess.set('Fetching transaction...', true);
coinbaseService.getTransaction(token, accountId, tx.id, function(err, updatedTx) {
ongoingProcess.set('Fetching transaction...', false);
if (err) $log.debug(err);
addressService.getAddress(self.selectedWalletId, false, function(err, addr) {
if (err) {
self.error = {
errors: [{
message: 'Could not create address'
}]
};
return;
}
updatedTx.data['toAddr'] = addr;
coinbaseService.savePendingTransaction(updatedTx.data, {}, function(err) {
if (err) $log.debug(err);
if (updatedTx.data.status == 'completed') {
self.sendToCopay(token, account, updatedTx.data);
} else {
self.success = updatedTx.data;
$timeout(function() {
$scope.$emit('Local/CoinbaseTx');
}, 1000);
}
});
});
});
}
});
};
this.sendToCopay = function(token, account, tx) {
self.error = null;
var accountId = account.id;
ongoingProcess.set('Sending funds to Copay...', true);
var data = {
to: tx.toAddr,
amount: tx.amount.amount,
currency: tx.amount.currency,
description: 'Copay Wallet: ' + self.selectedWalletName
};
coinbaseService.sendTo(token, accountId, data, function(err, res) {
ongoingProcess.set('Sending funds to Copay...', false);
if (err) {
self.error = err;
} else {
self.receiveInfo = res.data;
if (!res.data.id) return;
coinbaseService.getTransaction(token, accountId, res.data.id, function(err, sendTx) {
coinbaseService.savePendingTransaction(tx, {
remove: true
}, function(err) {
coinbaseService.savePendingTransaction(sendTx.data, {}, function(err) {
$timeout(function() {
$scope.$emit('Local/CoinbaseTx');
}, 1000);
});
});
});
}
});
};
});

View file

@ -1,44 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('coinbaseUriController',
function($scope, $stateParams, $timeout, profileService, configService, coinbaseService, storageService, $state, ongoingProcess) {
this.submitOauthCode = function(code) {
var self = this;
var coinbaseTestnet = configService.getSync().coinbase.testnet;
var network = coinbaseTestnet ? 'testnet' : 'livenet';
ongoingProcess.set('connectingCoinbase', true);
this.error = null;
$timeout(function() {
coinbaseService.getToken(code, function(err, data) {
ongoingProcess.set('connectingCoinbase', false);
if (err) {
self.error = err;
$timeout(function() {
$scope.$apply();
}, 100);
} else if (data && data.access_token && data.refresh_token) {
storageService.setCoinbaseToken(network, data.access_token, function() {
storageService.setCoinbaseRefreshToken(network, data.refresh_token, function() {
$scope.$emit('Local/CoinbaseUpdated', data.access_token);
$timeout(function() {
$state.go('coinbase');
$scope.$apply();
}, 100);
});
});
}
});
}, 100);
};
this.checkCode = function() {
if ($stateParams.url) {
var match = $stateParams.url.match(/code=(.+)&/);
if (match && match[1]) {
this.code = match[1];
return this.submitOauthCode(this.code);
}
}
$log.error('Bad state: ' + JSON.stringify($stateParams));
}
});

View file

@ -1,261 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('sellCoinbaseController',
function($rootScope, $scope, $log, $timeout, $ionicModal, lodash, profileService, coinbaseService, configService, walletService, fingerprintService, ongoingProcess, go) {
var self = this;
var client;
$scope.priceSensitivity = [
{
value: 0.5,
name: '0.5%'
},
{
value: 1,
name: '1%'
},
{
value: 2,
name: '2%'
},
{
value: 5,
name: '5%'
},
{
value: 10,
name: '10%'
}
];
$scope.selectedPriceSensitivity = $scope.priceSensitivity[1];
this.init = function(testnet) {
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet', 1);
client = profileService.focusedClient;
if (client && client.credentials.m == 1) {
$timeout(function() {
self.selectedWalletId = client.credentials.walletId;
self.selectedWalletName = client.credentials.walletName;
$scope.$apply();
}, 100);
}
};
this.getPaymentMethods = function(token) {
coinbaseService.getPaymentMethods(token, function(err, p) {
if (err) {
self.error = err;
return;
}
self.paymentMethods = [];
lodash.each(p.data, function(pm) {
if (pm.allow_sell) {
self.paymentMethods.push(pm);
}
if (pm.allow_sell && pm.primary_sell) {
$scope.selectedPaymentMethod = pm;
}
});
});
};
this.getPrice = function(token) {
var currency = 'USD';
coinbaseService.sellPrice(token, currency, function(err, s) {
if (err) return;
self.sellPrice = s.data || null;
});
};
$scope.openWalletsModal = function(wallets) {
self.error = null;
$scope.type = 'SELL';
$scope.wallets = wallets;
$scope.noColor = true;
$scope.self = self;
$ionicModal.fromTemplateUrl('views/modals/wallets.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.walletsModal = modal;
$scope.walletsModal.show();
});
$scope.$on('walletSelected', function(ev, walletId) {
$timeout(function() {
client = profileService.getClient(walletId);
self.selectedWalletId = walletId;
self.selectedWalletName = client.credentials.walletName;
$scope.$apply();
}, 100);
$scope.walletsModal.hide();
});
};
this.depositFunds = function(token, account) {
self.error = null;
if ($scope.amount) {
this.createTx(token, account, $scope.amount)
} else if ($scope.fiat) {
var btcValue = ($scope.fiat / self.sellPrice.amount).toFixed(8);
this.createTx(token, account, btcValue);
}
};
this.sellRequest = function(token, account, ctx) {
self.error = null;
if (!ctx.amount) return;
var accountId = account.id;
var data = ctx.amount;
data['payment_method'] = $scope.selectedPaymentMethod.id || null;
ongoingProcess.set('Sending request...', true);
coinbaseService.sellRequest(token, accountId, data, function(err, sell) {
ongoingProcess.set('Sending request...', false);
if (err) {
self.error = err;
return;
}
self.sellInfo = sell.data;
});
};
this.confirmSell = function(token, account, sell) {
self.error = null;
var accountId = account.id;
var sellId = sell.id;
ongoingProcess.set('Selling Bitcoin...', true);
coinbaseService.sellCommit(token, accountId, sellId, function(err, data) {
ongoingProcess.set('Selling Bitcoin...', false);
if (err) {
self.error = err;
return;
}
self.success = data.data;
$scope.$emit('Local/CoinbaseTx');
});
};
this.createTx = function(token, account, amount) {
self.error = null;
if (!client) {
self.error = 'No wallet selected';
return;
}
var accountId = account.id;
var dataSrc = {
name: 'Received from Copay: ' + self.selectedWalletName
};
var outputs = [];
var config = configService.getSync();
var configWallet = config.wallet;
var walletSettings = configWallet.settings;
ongoingProcess.set('Creating Transaction...', true);
$timeout(function() {
coinbaseService.createAddress(token, accountId, dataSrc, function(err, data) {
if (err) {
ongoingProcess.set('Creating Transaction...', false);
self.error = err;
return;
}
var address, comment;
address = data.data.address;
amount = parseInt((amount * 100000000).toFixed(0));
comment = 'Send funds to Coinbase Account: ' + account.name;
outputs.push({
'toAddress': address,
'amount': amount,
'message': comment
});
var txp = {
toAddress: address,
amount: amount,
outputs: outputs,
message: comment,
payProUrl: null,
excludeUnconfirmedUtxos: configWallet.spendUnconfirmed ? false : true,
feeLevel: walletSettings.feeLevel || 'normal'
};
walletService.createTx(client, txp, function(err, createdTxp) {
if (err) {
$log.debug(err);
ongoingProcess.set('Creating Transaction...', false);
self.error = {
errors: [{
message: 'Could not create transaction: ' + err.message
}]
};
$scope.$apply();
return;
}
ongoingProcess.set('Creating Transaction...', false);
$scope.$emit('Local/NeedsConfirmation', createdTxp, function(accept) {
if (accept) {
self.confirmTx(createdTxp, function(err, tx) {
ongoingProcess.clear();
if (err) {
self.error = {
errors: [{
message: 'Could not create transaction: ' + err.message
}]
};
return;
}
ongoingProcess.set('Checking Transaction...', false);
coinbaseService.getTransactions(token, accountId, function(err, ctxs) {
if (err) {
$log.debug(err);
return;
}
lodash.each(ctxs.data, function(ctx) {
if (ctx.type == 'send' && ctx.from) {
ongoingProcess.clear();
if (ctx.status == 'completed') {
self.sellRequest(token, account, ctx);
} else {
// Save to localstorage
ctx['price_sensitivity'] = $scope.selectedPriceSensitivity;
ctx['sell_price_amount'] = self.sellPrice ? self.sellPrice.amount : '';
ctx['sell_price_currency'] = self.sellPrice ? self.sellPrice.currency : 'USD';
ctx['description'] = 'Copay Wallet: ' + client.credentials.walletName;
coinbaseService.savePendingTransaction(ctx, null, function(err) {
if (err) $log.debug(err);
self.sendInfo = ctx;
$timeout(function() {
$scope.$emit('Local/CoinbaseTx');
}, 1000);
});
}
return false;
}
});
});
});
} else {
go.path('coinbase');
}
});
});
});
}, 100);
};
this.confirmTx = function(txp, cb) {
// TODO see walletService createAndPublish
};
});

View file

@ -1,169 +0,0 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Buy'; goBackToState = 'coinbase'; noColor = true">
</div>
<div class="content coinbase" ng-controller="buyCoinbaseController as buy">
<div class="row m20t" ng-show="buy.error || index.coinbaseError" ng-click="buy.error = null">
<div class="columns">
<div class="box-notification">
<ul class="no-bullet m0 size-12 text-warning">
<li ng-repeat="err in (buy.error.errors || index.coinbaseError.errors)" ng-bind-html="err.message"></li>
</ul>
</div>
</div>
</div>
<div class="row m20ti"
ng-show="index.coinbaseAccount && !buy.buyInfo && !buy.receiveInfo">
<div class="columns">
<form name="buyCoinbaseForm"
ng-submit="buy.buyRequest(index.coinbaseToken, index.coinbaseAccount)" novalidate>
<div ng-if="index.coinbaseToken" ng-init="buy.getPaymentMethods(index.coinbaseToken)">
<label>Payment method</label>
<select
ng-model="selectedPaymentMethod.id"
ng-options="item.id as item.name for item in buy.paymentMethods">
</select>
</div>
<label>Amount
<span
ng-if="index.coinbaseToken"
ng-init="buy.getPrice(index.coinbaseToken)"
ng-show="buy.buyPrice"
class="size-11 text-light right">
1 BTC <i class="icon-arrow-right"></i> {{buy.buyPrice.amount}} {{buy.buyPrice.currency}}
</span>
</label>
<div class="input">
<input ng-show="!showAlternative" type="number" id="amount" ignore-mouse-wheel
name="amount" ng-attr-placeholder="{{'Amount in ' + (showAlternative ? 'USD' : 'BTC')}}"
ng-minlength="0.00000001" ng-maxlength="10000000000"
ng-model="amount" autocomplete="off" ng-disabled="buy.loading">
<input ng-show="showAlternative" type="number" id="fiat" ignore-mouse-wheel
name="fiat" ng-attr-placeholder="{{'Amount in ' + (showAlternative ? 'USD' : 'BTC')}}"
ng-model="fiat" autocomplete="off" ng-disabled="buy.loading">
<a ng-show="!showAlternative" class="postfix button"
ng-click="showAlternative = true; amount = null">BTC</a>
<a ng-show="showAlternative" class="postfix button black"
ng-click="showAlternative = false; fiat = null">USD</a>
</div>
<div class="text-center text-gray size-12 m10b">
<span ng-show="!(amount || fiat)">
Enter the amount to get the exchange rate
</span>
<span ng-show="!buy.buyPrice && (amount || fiat)">
Not available
</span>
<span ng-show="buy.buyPrice && amount && !fiat">
~ {{buy.buyPrice.amount * amount | currency : 'USD ' : 2}}
</span>
</div>
<div class="text-center">
<i class="db fi-arrow-down size-24 m10v"></i>
</div>
<div
ng-if="index.coinbaseToken"
ng-init="buy.init(index.coinbaseTestnet)"
ng-click="openWalletsModal(buy.allWallets)">
<label>Copay Wallet</label>
<div class="input">
<input type="text" id="address" name="address" ng-disabled="buy.selectedWalletId"
ng-attr-placeholder="{{'Choose a wallet to receive bitcoin'}}" ng-model="buy.selectedWalletName" required>
<a class="postfix size-12 m0 text-gray">
<i class="icon-wallet size-18"></i>
</a>
</div>
</div>
<div class="input m20t">
<input class="button black expand round"
ng-disabled="buy.loading || (!amount && !fiat) || !selectedPaymentMethod"
ng-style="{'background-color': '#2b71b1'}"
type="submit" value="{{'Continue'}}">
</div>
</form>
</div>
</div>
<div class="m20ti row" ng-show="buy.receiveInfo && !buy.sellInfo && !buy.success">
<div class="columns">
<h1>Funds sent to Copay Wallet</h1>
<p class="size-12 text-gray">
Buy confirmed. Funds will be send soon to your selected Copay Wallet
</p>
<button class="m20t outline black round expand"
ng-style="{'background-color': '#2b71b1'}"
href ui-sref="coinbase">OK</button>
</div>
</div>
<div ng-show="buy.buyInfo && !buy.receiveInfo && !buy.success">
<h4 class="title">Confirm transaction</h4>
<ul class="no-bullet m10t size-12 white">
<li class="line-b line-t p15">
<span class="m10 text-normal text-bold">Amount</span>
<span class="right text-gray">{{buy.buyInfo.amount.amount}} {{buy.buyInfo.amount.currency}}</span>
</li>
<li class="line-b oh p15">
<span class="m10 text-normal text-bold">Fees</span>
<span class="right text-gray">
<div ng-repeat="fee in buy.buyInfo.fees">
<b>{{fee.type}}</b> {{fee.amount.amount}} {{fee.amount.currency}}
</div>
</span>
</li>
<li class="line-b p15">
<span class="m10 text-normal text-bold">Subtotal</span>
<span class="right text-gray">{{buy.buyInfo.subtotal.amount}} {{buy.buyInfo.subtotal.currency}}</span>
</li>
<li class="line-b p15">
<span class="m10 text-normal text-bold">Total</span>
<span class="right text-gray">{{buy.buyInfo.total.amount}} {{buy.buyInfo.total.currency}}</span>
</li>
<li class="line-b p15">
<span class="m10 text-normal text-bold">Payout at</span>
<span class="right text-gray">{{buy.buyInfo.payout_at | amCalendar}}</span>
</li>
<li class="line-b p15">
<span class="m10 text-normal text-bold">Deposit into Copay Wallet</span>
<span class="right text-gray">{{buy.selectedWalletName}}</span>
</li>
</ul>
<div class="row">
<div class="columns">
<button class="button black round expand"
ng-style="{'background-color': '#2b71b1'}"
ng-click="buy.confirmBuy(index.coinbaseToken, index.coinbaseAccount, buy.buyInfo)"
ng-disabled="buy.loading">
Buy
</button>
</div>
</div>
</div>
<div class="m20t row text-center" ng-show="buy.success">
<div class="columns">
<h1>Purchase initiated</h1>
<p class="text-gray">
Bitcoin purchase completed. Coinbase has queued the transfer to your selected Copay wallet.
</p>
<button class="outline dark-gray round expand" href ui-sref="coinbase">OK</button>
</div>
</div>
</div>
<div class="extra-margin-bottom"></div>

View file

@ -1,22 +0,0 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Coinbase'; closeToHome = true">
</div>
<div class="content coinbase" ng-controller="coinbaseUriController as coinbase" ng-init="coinbase.checkCode()">
<div class="row m20t">
<div class="large-12 columns">
<div class="text-center">
<img src="img/coinbase-logo.png"
ng-click="index.updateCoinbase()" width="100">
</div>
<div class="m10t text-center" ng-show="coinbase.error">
<div class="notification m10b size-12 text-warning">{{coinbase.error}}</div>
<button class="outline dark-gray tiny round" ng-click="coinbase.submitOauthCode(coinbase.code)">Try again</button>
</div>
</div>
</div>
</div>

View file

@ -1,202 +0,0 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Sell'; goBackToState = 'coinbase'; noColor = true">
</div>
<div class="content coinbase" ng-controller="sellCoinbaseController as sell">
<div class="row m20t" ng-show="sell.error || index.coinbaseError" ng-click="sell.error = null">
<div class="columns">
<div class="box-notification">
<ul class="no-bullet m0 size-12 text-warning">
<li ng-repeat="err in (sell.error.errors || index.coinbaseError.errors)" ng-bind-html="err.message"></li>
</ul>
</div>
</div>
</div>
<div class="row m20ti"
ng-show="index.coinbaseAccount && !sell.sellInfo && !sell.sendInfo">
<div class="columns">
<form
name="sellCoinbaseForm"
ng-submit="sell.depositFunds(index.coinbaseToken, index.coinbaseAccount)"
novalidate>
<div ng-show="!showPriceSensitivity">
<div
ng-if="index.coinbaseToken"
ng-init="sell.init(index.coinbaseTestnet)"
ng-click="openWalletsModal(sell.allWallets)">
<label>Copay Wallet</label>
<div class="input">
<input type="text" id="address" name="address" ng-disabled="sell.selectedWalletId"
ng-attr-placeholder="{{'Choose your source wallet'}}"
ng-model="sell.selectedWalletName" required>
<a class="postfix size-12 m0 text-gray">
<i class="icon-wallet size-18"></i>
</a>
</div>
</div>
<label>
Amount
<span
ng-if="index.coinbaseToken"
ng-init="sell.getPrice(index.coinbaseToken)"
ng-show="sell.sellPrice"
class="size-11 text-light right">
1 BTC <i class="icon-arrow-right"></i> {{sell.sellPrice.amount}} {{sell.sellPrice.currency}}
</span>
</label>
<div class="input">
<input ng-show="!showAlternative" type="number" id="amount" ignore-mouse-wheel
name="amount" ng-attr-placeholder="{{'Amount in ' + (showAlternative ? 'USD' : 'BTC')}}"
ng-minlength="0.00000001" ng-maxlength="10000000000"
ng-model="amount" autocomplete="off">
<input ng-show="showAlternative" type="number" id="fiat" ignore-mouse-wheel
name="fiat" ng-attr-placeholder="{{'Amount in ' + (showAlternative ? 'USD' : 'BTC')}}"
ng-model="fiat" autocomplete="off">
<a ng-show="!showAlternative" class="postfix button"
ng-click="showAlternative = true; amount = null">BTC</a>
<a ng-show="showAlternative" class="postfix button black"
ng-click="showAlternative = false; fiat = null">USD</a>
</div>
<div class="text-center text-gray size-12 m10b">
<span ng-show="!(amount || fiat)">
Enter the amount to get the exchange rate
</span>
<span ng-show="!sell.sellPrice && (amount || fiat)">
Not available
</span>
<span ng-show="sell.sellPrice && amount && !fiat">
~ {{sell.sellPrice.amount * amount | currency : 'USD ' : 2}}
</span>
</div>
<div class="text-center">
<i class="db fi-arrow-down size-24 m10v"></i>
</div>
<div ng-if="index.coinbaseToken" ng-init="sell.getPaymentMethods(index.coinbaseToken)">
<label>Deposit into</label>
<select
ng-model="selectedPaymentMethod.id"
ng-options="item.id as item.name for item in sell.paymentMethods">
</select>
</div>
<div class="input m20t">
<a href class="button black expand round"
ng-disabled=" (!amount && !fiat) || !sell.sellPrice.amount"
ng-style="{'background-color': '#2b71b1'}"
ng-click="showPriceSensitivity = true">Continue</a>
</div>
</div>
<div ng-show="showPriceSensitivity">
<h1>Price Sensitivity</h1>
<p class="size-14 text-gray">
Coinbase has not yet implemented an immediate method to sell bitcoin from a wallet. To make this sale, funds
will be sent to your Coinbase account, and sold when Coinbase accepts the transaction (usually one
hour).
</p>
<label>At what percentage lower price would you accept to sell?</label>
<select
ng-model="selectedPriceSensitivity"
ng-options="item as item.name for item in priceSensitivity track by item.value">
</select>
<p class="size-12 text-gray">
Estimated sale value: {{sell.sellPrice.amount * amount | currency : 'USD ' : 2}} <br>
Still sell if price fall until:
{{(sell.sellPrice.amount - (selectedPriceSensitivity.value / 100) * sell.sellPrice.amount) * amount | currency : 'USD ' : 2}}
</p>
<div class="input m20t row">
<div class="columns large-6 medium-6 small-6">
<a href class="button outline dark-gray expand round" ng-click="showPriceSensitivity = false">Back</a>
</div>
<div class="columns large-6 medium-6 small-6">
<input class="button black expand round"
ng-disabled="(!amount && !fiat) || !sell.sellPrice.amount"
ng-style="{'background-color': '#2b71b1'}"
type="submit" value="Confirm">
</div>
</div>
</div>
</form>
</div>
</div>
<div class="m20ti row" ng-show="sell.sendInfo && !sell.sellInfo && !sell.success">
<div class="columns">
<h1>Funds sent to Coinbase Account</h1>
<p class="size-12 text-gray">
The transaction is not yet confirmed, and will show as "Processing" in your Activity. The bitcoin sale will be completed automatically once it is confirmed by Coinbase.
</p>
<button class="m20t outline black round expand"
ng-style="{'background-color': '#2b71b1'}"
ng-click="$root.go('coinbase')">OK</button>
</div>
</div>
<div ng-show="sell.sellInfo && !sell.sendInfo && !sell.success">
<h4 class="title">Confirm transaction</h4>
<ul class="no-bullet m10t size-12 white">
<li class="line-b line-t p15">
<span class="m10 text-normal text-bold">Amount</span>
<span class="right text-gray">{{sell.sellInfo.amount.amount}} {{sell.sellInfo.amount.currency}}</span>
</li>
<li class="line-b oh p15">
<span class="m10 text-normal text-bold">Fees</span>
<span class="right text-gray">
<div ng-repeat="fee in sell.sellInfo.fees">
<b>{{fee.type}}</b> {{fee.amount.amount}} {{fee.amount.currency}}
</div>
</span>
</li>
<li class="line-b p15">
<span class="m10 text-normal text-bold">Subtotal</span>
<span class="right text-gray">{{sell.sellInfo.subtotal.amount}} {{sell.sellInfo.subtotal.currency}}</span>
</li>
<li class="line-b p15">
<span class="m10 text-normal text-bold">Total</span>
<span class="right text-gray">{{sell.sellInfo.total.amount}} {{sell.sellInfo.total.currency}}</span>
</li>
<li class="line-b p15">
<span class="m10 text-normal text-bold">Payout at</span>
<span class="right text-gray">{{sell.sellInfo.payout_at | amCalendar}}</span>
</li>
</ul>
<div class="row">
<div class="columns">
<button class="button black round expand"
ng-style="{'background-color': '#2b71b1'}"
ng-click="sell.confirmSell(index.coinbaseToken, index.coinbaseAccount, sell.sellInfo)"
>
Sell
</button>
</div>
</div>
</div>
<div class="m20t row text-center" ng-show="sell.success">
<div class="columns">
<h1>Sale initiated</h1>
<p class="text-gray">
A transfer has been initiated to your bank account and should arrive at {{sell.success.payout_at | amCalendar}}.
</p>
<button class="outline dark-gray round expand"
ng-click="$root.go('coinbase')">OK</button>
</div>
</div>
</div>
<div class="extra-margin-bottom"></div>