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 {
response => {
if (response.status >= 200 && response.status < 400) {
// 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.setCoinType(1);
}
......
......@@ -9,7 +9,6 @@ export class CoinNotationPipe implements PipeTransform {
this.setCoinUnit();
}
private coinName = this.globalService.getCoinName();
private coinUnit: string;
private coinNotation: number;
private decimalLimit = 8;
......@@ -20,37 +19,51 @@ export class CoinNotationPipe implements PipeTransform {
switch (this.getCoinUnit()) {
case "BTC":
temp = value / 100000000;
return temp.toFixed(this.decimalLimit) + " TBTC";
return temp.toFixed(this.decimalLimit) + " BTC";
case "mBTC":
temp = value / 100000;
return temp.toFixed(this.decimalLimit) + " TmBTC";
return temp.toFixed(this.decimalLimit) + " mBTC";
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;
return temp.toFixed(this.decimalLimit) + " TuBTC";
case "STRAT":
temp = value / 100000000;
return temp.toFixed(this.decimalLimit) + " TSTRAT";
return temp.toFixed(this.decimalLimit) + " STRAT";
case "mSTRAT":
temp = value / 100000;
return temp.toFixed(this.decimalLimit) + " TmSTRAT";
return temp.toFixed(this.decimalLimit) + " mSTRAT";
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;
return temp.toFixed(this.decimalLimit) + " TuSTRAT";
}
}
}
setCoinUnit() {
if (this.coinName === "Bitcoin") {
this.coinUnit = "BTC";
} else if (this.coinName === "Stratis") {
this.coinUnit = "STRAT"
}
};
getCoinUnit() {
return this.coinUnit;
}
setCoinUnit() {
this.coinUnit = this.globalService.getCoinUnit();
};
}
......@@ -32,9 +32,9 @@ export class ApiService {
private getCurrentCoin() {
let currentCoin = this.globalService.getCoinName();
if (currentCoin === "Bitcoin") {
if (currentCoin === "Bitcoin" || currentCoin === "TestBitcoin") {
this.currentApiUrl = this.bitcoinApiUrl;
} else if (currentCoin === "Stratis") {
} else if (currentCoin === "Stratis" || currentCoin === "TestStratis") {
this.currentApiUrl = this.stratisApiUrl;
}
}
......
......@@ -7,18 +7,24 @@ export class GlobalService {
private walletPath: string;
private currentWalletName: string;
private coinType: number = 0;
private coinName: string = "Bitcoin";
private coinName: string = "TestBitcoin";
private coinUnit: string = "TBTC";
private network: string = "TestNet";
getWalletPath() {
return this.walletPath;
}
setWalletPath(walletPath: string) {
this.walletPath = walletPath;
}
getNetwork() {
return "TestNet";
return this.network;
}
setWalletPath(walletPath: string) {
this.walletPath = walletPath;
setNetwork(network: string) {
this.network = network;
}
getWalletName() {
......@@ -29,7 +35,7 @@ export class GlobalService {
this.currentWalletName = currentWalletName;
}
getCoinType () {
getCoinType() {
return this.coinType;
}
......@@ -37,11 +43,19 @@ export class GlobalService {
this.coinType = coinType;
}
getCoinName () {
getCoinName() {
return this.coinName;
}
setCoinName(coinName: string) {
this.coinName = coinName;
}
getCoinUnit() {
return this.coinUnit;
}
setCoinUnit(coinUnit: string) {
this.coinUnit = coinUnit;
}
}
......@@ -18,7 +18,7 @@
</ul>
<ul class="list-inline row">
<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 class="list-inline row">
<li class="list-inline-item col blockLabel">Destination</li>
......
......@@ -2,6 +2,8 @@ import { Component, OnInit, Input } from '@angular/core';
import { NgbModal, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { GlobalService } from '../../../shared/services/global.service';
@Component({
selector: 'app-send-confirmation',
templateUrl: './send-confirmation.component.html',
......@@ -10,12 +12,13 @@ import { NgbModal, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
export class SendConfirmationComponent implements OnInit {
@Input() transaction: any;
constructor(public activeModal: NgbActiveModal) { }
constructor(private globalService: GlobalService, public activeModal: NgbActiveModal) { }
private showDetails: boolean = false;
private coinUnit: string;
ngOnInit() {
console.log(this.transaction);
this.coinUnit = this.globalService.getCoinUnit();
}
toggleDetails() {
......
......@@ -11,7 +11,7 @@
<div class="form-group clearfix">
<label class="float-left" for="yourAddress">Amount</label>
<!--<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>
<!--<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 { GlobalService } from '../../shared/services/global.service';
import { FormGroup, FormControl, Validators, FormBuilder } from '@angular/forms';
......@@ -16,7 +16,7 @@ import { SendConfirmationComponent } from './send-confirmation/send-confirmation
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) {
this.buildSendForm();
}
......@@ -24,8 +24,13 @@ export class SendComponent {
private sendForm: FormGroup;
private responseMessage: any;
private errorMessage: string;
private coinUnit: string;
private transaction: TransactionBuilding;
ngOnInit() {
this.coinUnit = this.globalService.getCoinUnit();
}
private buildSendForm(): void {
this.sendForm = this.fb.group({
"address": ["", Validators.required],
......
......@@ -16,22 +16,24 @@ export class SidebarComponent implements OnInit {
private bitcoinActive: Boolean;
ngOnInit() {
if (this.globalService.getCoinName() === "Bitcoin") {
if (this.globalService.getCoinName() === "Bitcoin" || this.globalService.getCoinName() === "TestBitcoin") {
this.bitcoinActive = true;
} else if (this.globalService.getCoinName() === "Stratis") {
} else if (this.globalService.getCoinName() === "Stratis" || this.globalService.getCoinName() === "TestStratis") {
this.bitcoinActive = false;
}
}
private loadBitcoinWallet() {
this.toggleClass();
this.globalService.setCoinName("Bitcoin");
this.globalService.setCoinName("TestBitcoin");
this.globalService.setCoinUnit("TBTC");
this.router.navigate(['/wallet']);
}
private loadStratisWallet() {
this.toggleClass();
this.globalService.setCoinName("Stratis");
this.globalService.setCoinName("TestStratis");
this.globalService.setCoinUnit("TSTRAT");
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