@provex/utils 1.3.2-rc.20260422044634.cd00525 → 1.3.2
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.
- package/dist/stats.js +3 -2
- package/dist/stats.test.js +2 -2
- package/dist/units.test.js +2 -1
- package/package.json +1 -1
package/dist/stats.js
CHANGED
|
@@ -32,11 +32,12 @@ export const statEvent = {
|
|
|
32
32
|
// so median/percentile can be computed per time bucket.
|
|
33
33
|
fillTime: 'fill-time',
|
|
34
34
|
};
|
|
35
|
+
const statEventValues = new Set(Object.values(statEvent));
|
|
35
36
|
/**
|
|
36
37
|
* Type guard to check if a string is a valid stat event type.
|
|
37
38
|
*/
|
|
38
39
|
export const isStatEvent = (event) => {
|
|
39
|
-
return event
|
|
40
|
+
return statEventValues.has(event);
|
|
40
41
|
};
|
|
41
42
|
/**
|
|
42
43
|
* Stat actions represent different types of liquidity movements.
|
|
@@ -49,5 +50,5 @@ export const statAction = statEvent;
|
|
|
49
50
|
* @returns True if the action is a valid StatAction
|
|
50
51
|
*/
|
|
51
52
|
export const isStatAction = (action) => {
|
|
52
|
-
return action
|
|
53
|
+
return statEventValues.has(action);
|
|
53
54
|
};
|
package/dist/stats.test.js
CHANGED
|
@@ -18,9 +18,9 @@ describe('stats', () => {
|
|
|
18
18
|
it('should define dust event', () => {
|
|
19
19
|
assert.equal(statEvent.dust, 'dust');
|
|
20
20
|
});
|
|
21
|
-
it('should have exactly
|
|
21
|
+
it('should have exactly 10 event types', () => {
|
|
22
22
|
const eventCount = Object.keys(statEvent).length;
|
|
23
|
-
assert.equal(eventCount,
|
|
23
|
+
assert.equal(eventCount, 10);
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
26
|
describe('isStatEvent', () => {
|
package/dist/units.test.js
CHANGED
|
@@ -312,9 +312,10 @@ describe('timestampToDate', () => {
|
|
|
312
312
|
describe('formatAmount', () => {
|
|
313
313
|
const mockToken = { decimals: 6, symbol: 'USDC' };
|
|
314
314
|
it('should format amount with token decimals', () => {
|
|
315
|
+
// Single-digit integer part gets 4 decimals to keep small differences visible.
|
|
315
316
|
const result = formatAmount(mockToken, 1234567n);
|
|
316
317
|
assert.ok(result);
|
|
317
|
-
assert.equal(result, '1.
|
|
318
|
+
assert.equal(result, '1.2345');
|
|
318
319
|
});
|
|
319
320
|
it('should return null for null amount', () => {
|
|
320
321
|
assert.equal(formatAmount(mockToken, null), null);
|