Fix btc/bch icons. Adds coin param to createWallet method

This commit is contained in:
Gustavo Maximiliano Cortez 2017-08-27 18:00:39 -03:00
commit ac5ede702d
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
20 changed files with 36 additions and 20 deletions

View file

@ -27,6 +27,7 @@ angular.module('copayApp.controllers').controller('createController',
$scope.formData.bwsurl = defaults.bws.url; $scope.formData.bwsurl = defaults.bws.url;
$scope.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1); $scope.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1);
$scope.formData.derivationPath = derivationPathHelper.default; $scope.formData.derivationPath = derivationPathHelper.default;
$scope.formData.coin = 'btc';
$scope.setTotalCopayers(tc); $scope.setTotalCopayers(tc);
updateRCSelect(tc); updateRCSelect(tc);
resetPasswordFields(); resetPasswordFields();
@ -137,6 +138,7 @@ angular.module('copayApp.controllers').controller('createController',
bwsurl: $scope.formData.bwsurl, bwsurl: $scope.formData.bwsurl,
singleAddress: $scope.formData.singleAddressEnabled, singleAddress: $scope.formData.singleAddressEnabled,
walletPrivKey: $scope.formData._walletPrivKey, // Only for testing walletPrivKey: $scope.formData._walletPrivKey, // Only for testing
coin: $scope.formData.coin
}; };
var setSeed = $scope.formData.seedSource.id == 'set'; var setSeed = $scope.formData.seedSource.id == 'set';

View file

@ -89,7 +89,10 @@ angular.module('copayApp.services')
wallet.copayerId = wallet.credentials.copayerId; wallet.copayerId = wallet.credentials.copayerId;
wallet.m = wallet.credentials.m; wallet.m = wallet.credentials.m;
wallet.n = wallet.credentials.n; wallet.n = wallet.credentials.n;
wallet.chain = wallet.credentials.chain; wallet.chain = wallet.credentials.chain ? (wallet.credentials.chain).toUpperCase() : 'BTC';
// TODO: Should return "chain" = "BTC" or "BCH"
client.credentials.chain = 'BTC';
root.updateWalletSettings(wallet); root.updateWalletSettings(wallet);
root.wallet[walletId] = wallet; root.wallet[walletId] = wallet;
@ -227,8 +230,7 @@ angular.module('copayApp.services')
bwsurl: getBWSURL(credentials.walletId), bwsurl: getBWSURL(credentials.walletId),
}); });
// TODO: Should return "chain" = "BTC" or "BCH"
client.credentials.chain = 'BTC';
var skipKeyValidation = shouldSkipValidation(credentials.walletId); var skipKeyValidation = shouldSkipValidation(credentials.walletId);
if (!skipKeyValidation) if (!skipKeyValidation)
@ -395,6 +397,7 @@ angular.module('copayApp.services')
network: opts.networkName, network: opts.networkName,
singleAddress: opts.singleAddress, singleAddress: opts.singleAddress,
walletPrivKey: opts.walletPrivKey, walletPrivKey: opts.walletPrivKey,
coin: opts.coin
}, function(err, secret) { }, function(err, secret) {
if (err) return bwcError.cb(err, gettextCatalog.getString('Error creating wallet'), cb); if (err) return bwcError.cb(err, gettextCatalog.getString('Error creating wallet'), cb);
return cb(null, walletClient, secret); return cb(null, walletClient, secret);
@ -687,6 +690,7 @@ angular.module('copayApp.services')
opts.m = 1; opts.m = 1;
opts.n = 1; opts.n = 1;
opts.networkName = 'livenet'; opts.networkName = 'livenet';
opts.coin = 'btc';
root.createWallet(opts, cb); root.createWallet(opts, cb);
}; };

View file

@ -29,7 +29,7 @@
<div class="label" translate>From</div> <div class="label" translate>From</div>
<div class="wallet"> <div class="wallet">
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg"> <img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg">
</i> </i>
{{wallet ? wallet.name : '...'}} {{wallet ? wallet.name : '...'}}
</div> </div>

View file

@ -38,7 +38,7 @@
<div class="label">Receive in</div> <div class="label">Receive in</div>
<div class="wallet"> <div class="wallet">
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg"> <img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg">
</i> </i>
{{wallet ? wallet.name : '...'}} {{wallet ? wallet.name : '...'}}
</div> </div>

View file

@ -30,7 +30,7 @@
<div class="label">Receive in</div> <div class="label">Receive in</div>
<div class="wallet"> <div class="wallet">
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-style="{'background-color': wallet.color}" class="bg"> <img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-style="{'background-color': wallet.color}" class="bg">
</i> </i>
{{wallet ? wallet.name : '...'}} {{wallet ? wallet.name : '...'}}
</div> </div>

View file

@ -28,7 +28,7 @@
<div class="label" translate>From</div> <div class="label" translate>From</div>
<div class="wallet"> <div class="wallet">
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg"> <img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg">
</i> </i>
{{wallet ? wallet.name : '...'}} {{wallet ? wallet.name : '...'}}
</div> </div>

View file

@ -39,7 +39,7 @@
<div class="item single-line"> <div class="item single-line">
<div class="wallet"> <div class="wallet">
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg"> <img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg">
</i> </i>
{{wallet.name}} {{wallet.name}}
</div> </div>

View file

@ -1,6 +1,6 @@
<div class="wallet-item"> <div class="wallet-item">
<i class="icon big-icon-svg circle"> <i class="icon big-icon-svg circle">
<img src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg"/> <img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg"/>
</i> </i>
<div class="name"> <div class="name">
{{wallet.name || wallet.id}} {{wallet.name || wallet.id}}

View file

@ -7,7 +7,7 @@
ng-click="selectWallet(w)" ng-click="selectWallet(w)"
> >
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/{{w.network == 'testnet' ? 'icon-wallet-testnet' : (w.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !w.color}" ng-style="{'background-color': w.color}" class="bg"> <img ng-src="img/{{w.network == 'testnet' ? 'icon-wallet-testnet' : (w.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !w.color}" ng-style="{'background-color': w.color}" class="bg">
</i> </i>
<div class="wallet-inner"> <div class="wallet-inner">
<div class="wallet-details"> <div class="wallet-details">

View file

@ -74,7 +74,7 @@
<span class="label" translate>From</span> <span class="label" translate>From</span>
<div class="wallet"> <div class="wallet">
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg"/> <img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg"/>
</i> </i>
<div>{{wallet.name}}</div> <div>{{wallet.name}}</div>
</div> </div>

View file

@ -24,7 +24,7 @@
<div class="list card" ng-click="showWalletSelector()" ng-if="wallets[0]"> <div class="list card" ng-click="showWalletSelector()" ng-if="wallets[0]">
<a ng-if="wallet" class="item item-sub item-icon-left item-big-icon-left item-icon-right"> <a ng-if="wallet" class="item item-sub item-icon-left item-big-icon-left item-icon-right">
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg wallet"/> <img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg wallet"/>
</i> </i>
<span> <span>
{{wallet.name || wallet.id}} {{wallet.name || wallet.id}}

View file

@ -29,7 +29,7 @@
<div class="label">From</div> <div class="label">From</div>
<div class="wallet"> <div class="wallet">
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg"> <img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg">
</i> </i>
{{wallet ? wallet.name : '...'}} {{wallet ? wallet.name : '...'}}
</div> </div>

View file

@ -30,7 +30,7 @@
<div class="label">From</div> <div class="label">From</div>
<div class="wallet"> <div class="wallet">
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-style="{'background-color': wallet.color}" class="bg"> <img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-style="{'background-color': wallet.color}" class="bg">
</i> </i>
{{wallet ? wallet.name : '...'}} {{wallet ? wallet.name : '...'}}
</div> </div>

View file

@ -19,6 +19,16 @@
required> required>
</label> </label>
<label class="item item-input item-select">
<div class="input-label" translate>
Coin
</div>
<select ng-model="formData.coin">
<option value="btc">BTC</option>
<option value="bch">BCH</option>
</select>
</label>
<div class="item item-divider"></div> <div class="item item-divider"></div>
<a class="item" ng-click="showAdvChange()"> <a class="item" ng-click="showAdvChange()">

View file

@ -81,7 +81,7 @@
class="item item-sub item-icon-left item-big-icon-left item-icon-right wallet" class="item item-sub item-icon-left item-big-icon-left item-icon-right wallet"
ng-click="openWallet(wallet)"> ng-click="openWallet(wallet)">
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg wallet"/> <img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg wallet"/>
</i> </i>
<span> <span>
{{wallet.name || wallet.id}} {{wallet.name || wallet.id}}

View file

@ -63,7 +63,7 @@
<div class="wallet-selector" ng-click="showWalletSelector()" ng-if="wallets[0] && wallet"> <div class="wallet-selector" ng-click="showWalletSelector()" ng-if="wallets[0] && wallet">
<a ng-if="wallet" class="item item-sub item-icon-left item-big-icon-left item-icon-right"> <a ng-if="wallet" class="item item-sub item-icon-left item-big-icon-left item-icon-right">
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg wallet"/> <img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg wallet"/>
</i> </i>
<span> <span>
{{wallet.name || wallet.id}} {{wallet.name || wallet.id}}

View file

@ -69,7 +69,7 @@
<div class="list"> <div class="list">
<a class="item item-icon-left item-icon-right" ng-repeat="item in list" ng-if="hasWallets && item.recipientType == 'wallet'" ng-click="goToAmount(item)"> <a class="item item-icon-left item-icon-right" ng-repeat="item in list" ng-if="hasWallets && item.recipientType == 'wallet'" ng-click="goToAmount(item)">
<i class="icon big-icon-svg" ng-if="item.recipientType == 'wallet'"> <i class="icon big-icon-svg" ng-if="item.recipientType == 'wallet'">
<img src="img/{{item.network == 'testnet' ? 'icon-wallet-testnet' : (item.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !item.color}" ng-style="{'background-color': item.color}" class="bg"/> <img ng-src="img/{{item.network == 'testnet' ? 'icon-wallet-testnet' : (item.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !item.color}" ng-style="{'background-color': item.color}" class="bg"/>
</i> </i>
{{item.name}} {{item.name}}
<i class="icon bp-arrow-right"></i> <i class="icon bp-arrow-right"></i>

View file

@ -95,7 +95,7 @@
ui-sref="tabs.preferences({'walletId': item.id})" ui-sref="tabs.preferences({'walletId': item.id})"
ng-repeat="item in wallets track by $index"> ng-repeat="item in wallets track by $index">
<i class="icon big-icon-svg circle"> <i class="icon big-icon-svg circle">
<img src="img/{{item.network == 'testnet' ? 'icon-wallet-testnet' : (item.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !item.color}" ng-style="{'background-color': item.color}" class="bg"/> <img ng-src="img/{{item.network == 'testnet' ? 'icon-wallet-testnet' : (item.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !item.color}" ng-style="{'background-color': item.color}" class="bg"/>
</i> </i>
<span> <span>
{{item.name || item.id}} {{item.name || item.id}}

View file

@ -34,7 +34,7 @@
<div class="label" translate>From {{wallet.chain}}</div> <div class="label" translate>From {{wallet.chain}}</div>
<div class="wallet"> <div class="wallet">
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg"> <img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg">
</i> </i>
{{wallet ? wallet.name : '...'}} {{wallet ? wallet.name : '...'}}
</div> </div>

View file

@ -53,7 +53,7 @@
<span class="label" ng-if="btx.action !== 'sent'" translate>To</span> <span class="label" ng-if="btx.action !== 'sent'" translate>To</span>
<div class="wallet"> <div class="wallet">
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg"/> <img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.chain == 'BTC' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg"/>
</i> </i>
<div>{{wallet.name}}</div> <div>{{wallet.name}}</div>
</div> </div>