Updated significant digits of transaction fee (#722)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user