@gearbox-protocol/sdk 10.2.2 → 10.2.3

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.
@@ -21,13 +21,11 @@ __export(formatter_exports, {
21
21
  fmtBinaryMask: () => fmtBinaryMask,
22
22
  formatBN: () => formatBN,
23
23
  formatBNvalue: () => formatBNvalue,
24
- formatBn4dig: () => formatBn4dig,
25
24
  formatDuration: () => formatDuration,
26
25
  formatNumberToString_: () => formatNumberToString_,
27
26
  numberWithCommas: () => numberWithCommas,
28
27
  percentFmt: () => percentFmt,
29
- toBigInt: () => toBigInt,
30
- toHumanFormat: () => toHumanFormat
28
+ toBigInt: () => toBigInt
31
29
  });
32
30
  module.exports = __toCommonJS(formatter_exports);
33
31
  var import_date_fns = require("date-fns");
@@ -79,6 +77,9 @@ const limitNum = (n, d = 18) => {
79
77
  }
80
78
  };
81
79
  function toHumanFormat(num, precision = 2) {
80
+ if (num >= BigInt(1e18)) {
81
+ return `${formatBn4dig(num / BigInt(1e12), precision)}T`;
82
+ }
82
83
  if (num >= BigInt(1e15)) {
83
84
  return `${formatBn4dig(num / BigInt(1e9), precision)}Bn`;
84
85
  }
@@ -125,11 +126,9 @@ function formatNumberToString_(value) {
125
126
  fmtBinaryMask,
126
127
  formatBN,
127
128
  formatBNvalue,
128
- formatBn4dig,
129
129
  formatDuration,
130
130
  formatNumberToString_,
131
131
  numberWithCommas,
132
132
  percentFmt,
133
- toBigInt,
134
- toHumanFormat
133
+ toBigInt
135
134
  });
@@ -47,6 +47,9 @@ const limitNum = (n, d = 18) => {
47
47
  }
48
48
  };
49
49
  function toHumanFormat(num, precision = 2) {
50
+ if (num >= BigInt(1e18)) {
51
+ return `${formatBn4dig(num / BigInt(1e12), precision)}T`;
52
+ }
50
53
  if (num >= BigInt(1e15)) {
51
54
  return `${formatBn4dig(num / BigInt(1e9), precision)}Bn`;
52
55
  }
@@ -92,11 +95,9 @@ export {
92
95
  fmtBinaryMask,
93
96
  formatBN,
94
97
  formatBNvalue,
95
- formatBn4dig,
96
98
  formatDuration,
97
99
  formatNumberToString_,
98
100
  numberWithCommas,
99
101
  percentFmt,
100
- toBigInt,
101
- toHumanFormat
102
+ toBigInt
102
103
  };
@@ -5,8 +5,6 @@ export declare const toBigInt: (v: string | number | bigint | {
5
5
  export declare const percentFmt: (v: number | bigint | string, raw?: boolean) => string;
6
6
  export declare function formatBNvalue(num: number | bigint | string | undefined, decimals: number, precision?: number, raw?: boolean): string;
7
7
  export declare function formatBN(num: number | bigint | string | undefined, decimals: number, precision?: number): string;
8
- export declare function toHumanFormat(num: bigint, precision?: number): string;
9
- export declare function formatBn4dig(num: bigint, precision?: number): string;
10
8
  export declare function fmtBinaryMask(mask: bigint): string;
11
9
  export declare function numberWithCommas(x: number | bigint): string;
12
10
  export declare function formatDuration(seconds: number, raw?: boolean): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "10.2.2",
3
+ "version": "10.2.3",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",