@pioneer-platform/helpers 4.0.4 → 4.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- import { BigIntArithmetics, formatBigIntToSafeValue } from './bigIntArithmetics';
1
+ import { BigIntArithmetics, formatBigIntToSafeValue, toMultiplier } from './bigIntArithmetics';
2
2
 
3
3
  export type SwapKitValueType = BigIntArithmetics | string | number;
4
-
4
+ const DEFAULT_DECIMAL = 8;
5
5
  export class SwapKitNumber extends BigIntArithmetics {
6
6
  eq(value: SwapKitValueType) {
7
7
  return this.eqValue(value);
@@ -10,7 +10,7 @@ export class SwapKitNumber extends BigIntArithmetics {
10
10
  static fromBigInt(value: bigint, decimal?: number) {
11
11
  return new SwapKitNumber({
12
12
  decimal,
13
- value: formatBigIntToSafeValue({ value, bigIntDecimal: decimal, decimal }),
13
+ value: formatBigIntToSafeValue({ value, bigIntDecimal: toMultiplier(decimal || DEFAULT_DECIMAL), decimal }),
14
14
  });
15
15
  }
16
16
  }