Commit 9e474442 authored by dev0tion's avatar dev0tion

Show correct abbreviation everywhere, prepare mainnet abbreviations

parent 8ff8f864
...@@ -126,7 +126,8 @@ export class LoginComponent implements OnInit { ...@@ -126,7 +126,8 @@ export class LoginComponent implements OnInit {
response => { response => {
if (response.status >= 200 && response.status < 400) { if (response.status >= 200 && response.status < 400) {
// Set Bitcoin as the default wallet // Set Bitcoin as the default wallet
this.globalService.setCoinName("Bitcoin"); this.globalService.setCoinName("TestBitcoin");
this.globalService.setCoinUnit("TBTC");
this.globalService.setWalletName(walletLoad.name); this.globalService.setWalletName(walletLoad.name);
this.globalService.setCoinType(1); this.globalService.setCoinType(1);
} }
......
...@@ -9,7 +9,6 @@ export class CoinNotationPipe implements PipeTransform { ...@@ -9,7 +9,6 @@ export class CoinNotationPipe implements PipeTransform {
this.setCoinUnit(); this.setCoinUnit();
} }
private coinName = this.globalService.getCoinName();
private coinUnit: string; private coinUnit: string;
private coinNotation: number; private coinNotation: number;
private decimalLimit = 8; private decimalLimit = 8;
...@@ -20,37 +19,51 @@ export class CoinNotationPipe implements PipeTransform { ...@@ -20,37 +19,51 @@ export class CoinNotationPipe implements PipeTransform {
switch (this.getCoinUnit()) { switch (this.getCoinUnit()) {
case "BTC": case "BTC":
temp = value / 100000000; temp = value / 100000000;
return temp.toFixed(this.decimalLimit) + " TBTC"; return temp.toFixed(this.decimalLimit) + " BTC";
case "mBTC": case "mBTC":
temp = value / 100000; temp = value / 100000;
return temp.toFixed(this.decimalLimit) + " TmBTC"; return temp.toFixed(this.decimalLimit) + " mBTC";
case "uBTC": case "uBTC":
temp = value / 100;
return temp.toFixed(this.decimalLimit) + " uBTC";
case "TBTC":
temp = value / 100000000;
return temp.toFixed(this.decimalLimit) + " TBTC";
case "TmBTC":
temp = value / 100000;
return temp.toFixed(this.decimalLimit) + " TmBTC";
case "TuBTC":
temp = value / 100; temp = value / 100;
return temp.toFixed(this.decimalLimit) + " TuBTC"; return temp.toFixed(this.decimalLimit) + " TuBTC";
case "STRAT": case "STRAT":
temp = value / 100000000; temp = value / 100000000;
return temp.toFixed(this.decimalLimit) + " TSTRAT"; return temp.toFixed(this.decimalLimit) + " STRAT";
case "mSTRAT": case "mSTRAT":
temp = value / 100000; temp = value / 100000;
return temp.toFixed(this.decimalLimit) + " TmSTRAT"; return temp.toFixed(this.decimalLimit) + " mSTRAT";
case "uSTRAT": case "uSTRAT":
temp = value / 100;
return temp.toFixed(this.decimalLimit) + " uSTRAT";
case "TSTRAT":
temp = value / 100000000;
return temp.toFixed(this.decimalLimit) + " TSTRAT";
case "TmSTRAT":
temp = value / 100000;
return temp.toFixed(this.decimalLimit) + " TmSTRAT";
case "TuSTRAT":
temp = value / 100; temp = value / 100;
return temp.toFixed(this.decimalLimit) + " TuSTRAT"; return temp.toFixed(this.decimalLimit) + " TuSTRAT";
} }
} }
} }
setCoinUnit() {
if (this.coinName === "Bitcoin") {
this.coinUnit = "BTC";
} else if (this.coinName === "Stratis") {
this.coinUnit = "STRAT"
}
};
getCoinUnit() { getCoinUnit() {
return this.coinUnit; return this.coinUnit;
} }
setCoinUnit() {
this.coinUnit = this.globalService.getCoinUnit();
};
} }
...@@ -32,9 +32,9 @@ export class ApiService { ...@@ -32,9 +32,9 @@ export class ApiService {
private getCurrentCoin() { private getCurrentCoin() {
let currentCoin = this.globalService.getCoinName(); let currentCoin = this.globalService.getCoinName();
if (currentCoin === "Bitcoin") { if (currentCoin === "Bitcoin" || currentCoin === "TestBitcoin") {
this.currentApiUrl = this.bitcoinApiUrl; this.currentApiUrl = this.bitcoinApiUrl;
} else if (currentCoin === "Stratis") { } else if (currentCoin === "Stratis" || currentCoin === "TestStratis") {
this.currentApiUrl = this.stratisApiUrl; this.currentApiUrl = this.stratisApiUrl;
} }
} }
......
...@@ -7,18 +7,24 @@ export class GlobalService { ...@@ -7,18 +7,24 @@ export class GlobalService {
private walletPath: string; private walletPath: string;
private currentWalletName: string; private currentWalletName: string;
private coinType: number = 0; private coinType: number = 0;
private coinName: string = "Bitcoin"; private coinName: string = "TestBitcoin";
private coinUnit: string = "TBTC";
private network: string = "TestNet";
getWalletPath() { getWalletPath() {
return this.walletPath; return this.walletPath;
} }
setWalletPath(walletPath: string) {
this.walletPath = walletPath;
}
getNetwork() { getNetwork() {
return "TestNet"; return this.network;
} }
setWalletPath(walletPath: string) { setNetwork(network: string) {
this.walletPath = walletPath; this.network = network;
} }
getWalletName() { getWalletName() {
...@@ -29,7 +35,7 @@ export class GlobalService { ...@@ -29,7 +35,7 @@ export class GlobalService {
this.currentWalletName = currentWalletName; this.currentWalletName = currentWalletName;
} }
getCoinType () { getCoinType() {
return this.coinType; return this.coinType;
} }
...@@ -37,11 +43,19 @@ export class GlobalService { ...@@ -37,11 +43,19 @@ export class GlobalService {
this.coinType = coinType; this.coinType = coinType;
} }
getCoinName () { getCoinName() {
return this.coinName; return this.coinName;
} }
setCoinName(coinName: string) { setCoinName(coinName: string) {
this.coinName = coinName; this.coinName = coinName;
} }
getCoinUnit() {
return this.coinUnit;
}
setCoinUnit(coinUnit: string) {
this.coinUnit = coinUnit;
}
} }
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</ul> </ul>
<ul class="list-inline row"> <ul class="list-inline row">
<li class="list-inline-item col blockLabel">Amount</li> <li class="list-inline-item col blockLabel">Amount</li>
<li class="list-inline-item col-9 blockText text-danger">-{{ transaction.amount | number:'1.8-8' }} TBTC</li> <li class="list-inline-item col-9 blockText text-danger">-{{ transaction.amount | number:'1.8-8' }} {{ coinUnit }}</li>
</ul> </ul>
<ul class="list-inline row"> <ul class="list-inline row">
<li class="list-inline-item col blockLabel">Destination</li> <li class="list-inline-item col blockLabel">Destination</li>
......
...@@ -2,6 +2,8 @@ import { Component, OnInit, Input } from '@angular/core'; ...@@ -2,6 +2,8 @@ import { Component, OnInit, Input } from '@angular/core';
import { NgbModal, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { GlobalService } from '../../../shared/services/global.service';
@Component({ @Component({
selector: 'app-send-confirmation', selector: 'app-send-confirmation',
templateUrl: './send-confirmation.component.html', templateUrl: './send-confirmation.component.html',
...@@ -10,12 +12,13 @@ import { NgbModal, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; ...@@ -10,12 +12,13 @@ import { NgbModal, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
export class SendConfirmationComponent implements OnInit { export class SendConfirmationComponent implements OnInit {
@Input() transaction: any; @Input() transaction: any;
constructor(public activeModal: NgbActiveModal) { } constructor(private globalService: GlobalService, public activeModal: NgbActiveModal) { }
private showDetails: boolean = false; private showDetails: boolean = false;
private coinUnit: string;
ngOnInit() { ngOnInit() {
console.log(this.transaction); this.coinUnit = this.globalService.getCoinUnit();
} }
toggleDetails() { toggleDetails() {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<div class="form-group clearfix"> <div class="form-group clearfix">
<label class="float-left" for="yourAddress">Amount</label> <label class="float-left" for="yourAddress">Amount</label>
<!--<span class="float-right"><a href="#">max</a></span>--> <!--<span class="float-right"><a href="#">max</a></span>-->
<input type="text" class="form-control form-control-danger" formControlName="amount" id="Amount" placeholder="0.00 BTC"> <input type="text" class="form-control form-control-danger" formControlName="amount" id="Amount" placeholder="0.00 {{ coinUnit }}">
<div *ngIf="formErrors.amount" class="form-control-feedback">{{ formErrors.amount }}</div> <div *ngIf="formErrors.amount" class="form-control-feedback">{{ formErrors.amount }}</div>
</div> </div>
<!--<div class="form-group has-success">--> <!--<div class="form-group has-success">-->
......
import { Component } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ApiService } from '../../shared/services/api.service'; import { ApiService } from '../../shared/services/api.service';
import { GlobalService } from '../../shared/services/global.service'; import { GlobalService } from '../../shared/services/global.service';
import { FormGroup, FormControl, Validators, FormBuilder } from '@angular/forms'; import { FormGroup, FormControl, Validators, FormBuilder } from '@angular/forms';
...@@ -16,7 +16,7 @@ import { SendConfirmationComponent } from './send-confirmation/send-confirmation ...@@ -16,7 +16,7 @@ import { SendConfirmationComponent } from './send-confirmation/send-confirmation
styleUrls: ['./send.component.css'], styleUrls: ['./send.component.css'],
}) })
export class SendComponent { export class SendComponent implements OnInit {
constructor(private apiService: ApiService, private globalService: GlobalService, private modalService: NgbModal, public activeModal: NgbActiveModal, private fb: FormBuilder) { constructor(private apiService: ApiService, private globalService: GlobalService, private modalService: NgbModal, public activeModal: NgbActiveModal, private fb: FormBuilder) {
this.buildSendForm(); this.buildSendForm();
} }
...@@ -24,8 +24,13 @@ export class SendComponent { ...@@ -24,8 +24,13 @@ export class SendComponent {
private sendForm: FormGroup; private sendForm: FormGroup;
private responseMessage: any; private responseMessage: any;
private errorMessage: string; private errorMessage: string;
private coinUnit: string;
private transaction: TransactionBuilding; private transaction: TransactionBuilding;
ngOnInit() {
this.coinUnit = this.globalService.getCoinUnit();
}
private buildSendForm(): void { private buildSendForm(): void {
this.sendForm = this.fb.group({ this.sendForm = this.fb.group({
"address": ["", Validators.required], "address": ["", Validators.required],
......
...@@ -16,22 +16,24 @@ export class SidebarComponent implements OnInit { ...@@ -16,22 +16,24 @@ export class SidebarComponent implements OnInit {
private bitcoinActive: Boolean; private bitcoinActive: Boolean;
ngOnInit() { ngOnInit() {
if (this.globalService.getCoinName() === "Bitcoin") { if (this.globalService.getCoinName() === "Bitcoin" || this.globalService.getCoinName() === "TestBitcoin") {
this.bitcoinActive = true; this.bitcoinActive = true;
} else if (this.globalService.getCoinName() === "Stratis") { } else if (this.globalService.getCoinName() === "Stratis" || this.globalService.getCoinName() === "TestStratis") {
this.bitcoinActive = false; this.bitcoinActive = false;
} }
} }
private loadBitcoinWallet() { private loadBitcoinWallet() {
this.toggleClass(); this.toggleClass();
this.globalService.setCoinName("Bitcoin"); this.globalService.setCoinName("TestBitcoin");
this.globalService.setCoinUnit("TBTC");
this.router.navigate(['/wallet']); this.router.navigate(['/wallet']);
} }
private loadStratisWallet() { private loadStratisWallet() {
this.toggleClass(); this.toggleClass();
this.globalService.setCoinName("Stratis"); this.globalService.setCoinName("TestStratis");
this.globalService.setCoinUnit("TSTRAT");
this.router.navigate(['/wallet/stratis-wallet']); this.router.navigate(['/wallet/stratis-wallet']);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment