Updated significant digits of transaction fee (#722)

This commit is contained in:
Priyansh
2021-08-18 18:57:35 +05:30
committed by GitHub
parent 58178f4563
commit e103fb5876
8 changed files with 36 additions and 10 deletions

View File

@@ -0,0 +1,8 @@
import { FeeRoundingPipe } from './fee-rounding.pipe';
describe('FeeRoundingPipe', () => {
it('create an instance', () => {
const pipe = new FeeRoundingPipe();
expect(pipe).toBeTruthy();
});
});

View File

@@ -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);
}
}

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,
]
})