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