Updated significant digits of transaction fee (#722)

This commit is contained in:
Priyansh authored and GitHub committed 2021-08-18 16:27:35 +03:00
1 parent b66a5da9c2
commit 1da2c78b63
8 files changed
+36 -10

No files matched your search

@@ -0,0 +1,8 @@
import { FeeRoundingPipe } from './fee-rounding.pipe';
describe('FeeRoundingPipe', () => {
it('create an instance', () => {
const pipe = new FeeRoundingPipe();
expect(pipe).toBeTruthy();
});
});
@@ -0,0 +1,15 @@
import { Pipe, PipeTransform } from "@angular/core";
@Pipe({
name: "feeRounding",
})
export class FeeRoundingPipe implements PipeTransform {
transform(fee: number): string {
if (fee >= 100) {
return fee.toFixed(0);
} else if (fee < 10) {
return fee.toFixed(2);
}
return fee.toFixed(1);
}
}
+3
View File
@@ -5,6 +5,7 @@ import { ShortenStringPipe } from './pipes/shorten-string-pipe/shorten-string.pi
import { CeilPipe } from './pipes/math-ceil/math-ceil.pipe';
import { Hex2asciiPipe } from './pipes/hex2ascii/hex2ascii.pipe';
import { Decimal2HexPipe } from './pipes/decimal2hex/decimal2hex.pipe';
import { FeeRoundingPipe } from './pipes/fee-rounding/fee-rounding.pipe';
import { AsmStylerPipe } from './pipes/asm-styler/asm-styler.pipe';
import { AbsolutePipe } from './pipes/absolute/absolute.pipe';
import { RelativeUrlPipe } from './pipes/relative-url/relative-url.pipe';
@@ -44,6 +45,7 @@ import { ColoredPriceDirective } from './directives/colored-price.directive';
CeilPipe,
ShortenStringPipe,
Decimal2HexPipe,
FeeRoundingPipe,
ColoredPriceDirective,
],
imports: [
@@ -87,6 +89,7 @@ import { ColoredPriceDirective } from './directives/colored-price.directive';
CeilPipe,
ShortenStringPipe,
Decimal2HexPipe,
FeeRoundingPipe,
ColoredPriceDirective,
]
})