bwc
This commit is contained in:
parent
04fb7ba032
commit
320de62f13
348 changed files with 7745 additions and 30874 deletions
59
src/js/controllers/preferencesUnit.js
Normal file
59
src/js/controllers/preferencesUnit.js
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesUnitController',
|
||||
function($rootScope, $scope, configService, go) {
|
||||
var config = configService.getSync();
|
||||
this.unitName = config.wallet.settings.unitName;
|
||||
this.unitOpts = [
|
||||
// TODO : add Satoshis to bitcore-wallet-client formatAmount()
|
||||
// {
|
||||
// name: 'Satoshis (100,000,000 satoshis = 1BTC)',
|
||||
// shortName: 'SAT',
|
||||
// value: 1,
|
||||
// decimals: 0,
|
||||
// code: 'sat',
|
||||
// },
|
||||
{
|
||||
name: 'bits (1,000,000 bits = 1BTC)',
|
||||
shortName: 'bits',
|
||||
value: 100,
|
||||
decimals: 2,
|
||||
code: 'bit',
|
||||
}
|
||||
// TODO : add mBTC to bitcore-wallet-client formatAmount()
|
||||
// ,{
|
||||
// name: 'mBTC (1,000 mBTC = 1BTC)',
|
||||
// shortName: 'mBTC',
|
||||
// value: 100000,
|
||||
// decimals: 5,
|
||||
// code: 'mbtc',
|
||||
// }
|
||||
, {
|
||||
name: 'BTC',
|
||||
shortName: 'BTC',
|
||||
value: 100000000,
|
||||
decimals: 8,
|
||||
code: 'btc',
|
||||
}
|
||||
];
|
||||
|
||||
this.save = function(newUnit) {
|
||||
var opts = {
|
||||
wallet: {
|
||||
settings: {
|
||||
unitName: newUnit.shortName,
|
||||
unitToSatoshi: newUnit.value,
|
||||
unitDecimals: newUnit.decimals,
|
||||
unitCode: newUnit.code,
|
||||
}
|
||||
}
|
||||
};
|
||||
this.unitName = newUnit.shortName;
|
||||
|
||||
configService.set(opts, function(err) {
|
||||
if (err) console.log(err);
|
||||
$scope.$emit('Local/ConfigurationUpdated');
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue