Commit b7bc79ba authored by dev0tion's avatar dev0tion

Add Stratis to coin notation pipe

parent 7c08b643
import { Pipe, PipeTransform } from '@angular/core'; import { Pipe, PipeTransform } from '@angular/core';
import { GlobalService } from '../services/global.service';
@Pipe({ @Pipe({
name: 'coinNotation' name: 'coinNotation'
}) })
export class CoinNotationPipe implements PipeTransform { export class CoinNotationPipe implements PipeTransform {
constructor (private globalService: GlobalService) {
this.setCoinUnit();
}
private coinUnit = "BTC"; private coinName = this.globalService.getCoinName();
private coinUnit: string;
private coinNotation: number; private coinNotation: number;
private decimalLimit = 8; private decimalLimit = 8;
...@@ -22,10 +27,27 @@ export class CoinNotationPipe implements PipeTransform { ...@@ -22,10 +27,27 @@ export class CoinNotationPipe implements PipeTransform {
case "uBTC": case "uBTC":
temp = value / 100; temp = value / 100;
return temp.toFixed(this.decimalLimit) + " TuBTC"; return temp.toFixed(this.decimalLimit) + " TuBTC";
case "STRAT":
temp = value / 100000000;
return temp.toFixed(this.decimalLimit) + " TSTRAT";
case "mSTRAT":
temp = value / 100000;
return temp.toFixed(this.decimalLimit) + " TmSTRAT";
case "uSTRAT":
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() { getCoinUnit() {
return this.coinUnit; return this.coinUnit;
} }
......
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