@w3ux/utils 1.0.0-alpha.1 → 1.0.0
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/base.cjs +6 -0
- package/base.d.cts +23 -1
- package/base.d.ts +23 -1
- package/base.js +4 -0
- package/index.cjs +2 -24
- package/index.d.cts +2 -2
- package/index.d.ts +2 -2
- package/index.js +2 -23
- package/package.json +1 -1
- package/unit.cjs +0 -28
- package/unit.d.cts +1 -34
- package/unit.d.ts +1 -34
- package/unit.js +0 -25
package/base.cjs
CHANGED
|
@@ -26,6 +26,8 @@ __export(base_exports, {
|
|
|
26
26
|
eqSet: () => eqSet,
|
|
27
27
|
formatAccountSs58: () => formatAccountSs58,
|
|
28
28
|
isSuperset: () => isSuperset,
|
|
29
|
+
maxBigInt: () => maxBigInt,
|
|
30
|
+
minBigInt: () => minBigInt,
|
|
29
31
|
minDecimalPlaces: () => minDecimalPlaces,
|
|
30
32
|
pageFromUri: () => pageFromUri,
|
|
31
33
|
removeHexPrefix: () => removeHexPrefix,
|
|
@@ -152,6 +154,8 @@ var isSuperset = (set, subset) => {
|
|
|
152
154
|
}
|
|
153
155
|
return true;
|
|
154
156
|
};
|
|
157
|
+
var maxBigInt = (...values) => values.reduce((max, current) => current > max ? current : max);
|
|
158
|
+
var minBigInt = (...values) => values.reduce((min, current) => current < min ? current : min);
|
|
155
159
|
// Annotate the CommonJS export names for ESM import in node:
|
|
156
160
|
0 && (module.exports = {
|
|
157
161
|
appendOr,
|
|
@@ -161,6 +165,8 @@ var isSuperset = (set, subset) => {
|
|
|
161
165
|
eqSet,
|
|
162
166
|
formatAccountSs58,
|
|
163
167
|
isSuperset,
|
|
168
|
+
maxBigInt,
|
|
169
|
+
minBigInt,
|
|
164
170
|
minDecimalPlaces,
|
|
165
171
|
pageFromUri,
|
|
166
172
|
removeHexPrefix,
|
package/base.d.cts
CHANGED
|
@@ -78,5 +78,27 @@ declare const formatAccountSs58: (address: string, ss58Prefix: number) => string
|
|
|
78
78
|
declare const removeHexPrefix: (str: string) => string;
|
|
79
79
|
declare const eqSet: (xs: Set<any>, ys: Set<any>) => boolean;
|
|
80
80
|
declare const isSuperset: (set: Set<any>, subset: Set<any>) => boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Finds the maximum value among a list of BigInt values.
|
|
83
|
+
*
|
|
84
|
+
* @function maxBigInt
|
|
85
|
+
* @param {...bigint} values - A list of BigInt values to compare.
|
|
86
|
+
* @returns {bigint} The largest BigInt value in the provided list.
|
|
87
|
+
* @example
|
|
88
|
+
* // Returns the maximum BigInt value
|
|
89
|
+
* maxBigInt(10n, 50n, 30n, 100n, 20n); // 100n
|
|
90
|
+
*/
|
|
91
|
+
declare const maxBigInt: (...values: bigint[]) => bigint;
|
|
92
|
+
/**
|
|
93
|
+
* Finds the minimum value among a list of BigInt values.
|
|
94
|
+
*
|
|
95
|
+
* @function minBigInt
|
|
96
|
+
* @param {...bigint} values - A list of BigInt values to compare.
|
|
97
|
+
* @returns {bigint} The smallest BigInt value in the provided list.
|
|
98
|
+
* @example
|
|
99
|
+
* // Returns the minimum BigInt value
|
|
100
|
+
* minBigInt(10n, 50n, 30n, 100n, 20n); // 10n
|
|
101
|
+
*/
|
|
102
|
+
declare const minBigInt: (...values: bigint[]) => bigint;
|
|
81
103
|
|
|
82
|
-
export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout };
|
|
104
|
+
export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout };
|
package/base.d.ts
CHANGED
|
@@ -78,5 +78,27 @@ declare const formatAccountSs58: (address: string, ss58Prefix: number) => string
|
|
|
78
78
|
declare const removeHexPrefix: (str: string) => string;
|
|
79
79
|
declare const eqSet: (xs: Set<any>, ys: Set<any>) => boolean;
|
|
80
80
|
declare const isSuperset: (set: Set<any>, subset: Set<any>) => boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Finds the maximum value among a list of BigInt values.
|
|
83
|
+
*
|
|
84
|
+
* @function maxBigInt
|
|
85
|
+
* @param {...bigint} values - A list of BigInt values to compare.
|
|
86
|
+
* @returns {bigint} The largest BigInt value in the provided list.
|
|
87
|
+
* @example
|
|
88
|
+
* // Returns the maximum BigInt value
|
|
89
|
+
* maxBigInt(10n, 50n, 30n, 100n, 20n); // 100n
|
|
90
|
+
*/
|
|
91
|
+
declare const maxBigInt: (...values: bigint[]) => bigint;
|
|
92
|
+
/**
|
|
93
|
+
* Finds the minimum value among a list of BigInt values.
|
|
94
|
+
*
|
|
95
|
+
* @function minBigInt
|
|
96
|
+
* @param {...bigint} values - A list of BigInt values to compare.
|
|
97
|
+
* @returns {bigint} The smallest BigInt value in the provided list.
|
|
98
|
+
* @example
|
|
99
|
+
* // Returns the minimum BigInt value
|
|
100
|
+
* minBigInt(10n, 50n, 30n, 100n, 20n); // 10n
|
|
101
|
+
*/
|
|
102
|
+
declare const minBigInt: (...values: bigint[]) => bigint;
|
|
81
103
|
|
|
82
|
-
export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout };
|
|
104
|
+
export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout };
|
package/base.js
CHANGED
|
@@ -117,6 +117,8 @@ var isSuperset = (set, subset) => {
|
|
|
117
117
|
}
|
|
118
118
|
return true;
|
|
119
119
|
};
|
|
120
|
+
var maxBigInt = (...values) => values.reduce((max, current) => current > max ? current : max);
|
|
121
|
+
var minBigInt = (...values) => values.reduce((min, current) => current < min ? current : min);
|
|
120
122
|
export {
|
|
121
123
|
appendOr,
|
|
122
124
|
appendOrEmpty,
|
|
@@ -125,6 +127,8 @@ export {
|
|
|
125
127
|
eqSet,
|
|
126
128
|
formatAccountSs58,
|
|
127
129
|
isSuperset,
|
|
130
|
+
maxBigInt,
|
|
131
|
+
minBigInt,
|
|
128
132
|
minDecimalPlaces,
|
|
129
133
|
pageFromUri,
|
|
130
134
|
removeHexPrefix,
|
package/index.cjs
CHANGED
|
@@ -62,7 +62,6 @@ __export(src_exports, {
|
|
|
62
62
|
shuffle: () => shuffle,
|
|
63
63
|
snakeToCamel: () => snakeToCamel,
|
|
64
64
|
sortWithNull: () => sortWithNull,
|
|
65
|
-
transformToBaseUnit: () => transformToBaseUnit,
|
|
66
65
|
unescape: () => unescape,
|
|
67
66
|
unimplemented: () => unimplemented,
|
|
68
67
|
unitToPlanck: () => unitToPlanck,
|
|
@@ -190,6 +189,8 @@ var isSuperset = (set, subset) => {
|
|
|
190
189
|
}
|
|
191
190
|
return true;
|
|
192
191
|
};
|
|
192
|
+
var maxBigInt = (...values) => values.reduce((max, current) => current > max ? current : max);
|
|
193
|
+
var minBigInt = (...values) => values.reduce((min, current) => current < min ? current : min);
|
|
193
194
|
|
|
194
195
|
// ../../node_modules/@polkadot/x-textdecoder/node.js
|
|
195
196
|
var import_node_util = __toESM(require("util"), 1);
|
|
@@ -518,26 +519,6 @@ var makeCancelable = (promise) => {
|
|
|
518
519
|
}
|
|
519
520
|
};
|
|
520
521
|
};
|
|
521
|
-
var transformToBaseUnit = (estFee, chainDecimals) => {
|
|
522
|
-
const t = estFee.length - chainDecimals;
|
|
523
|
-
let s = "";
|
|
524
|
-
if (t < 0) {
|
|
525
|
-
for (let i = 0; i < Math.abs(t) - 1; i++) {
|
|
526
|
-
s += "0";
|
|
527
|
-
}
|
|
528
|
-
s = s + estFee;
|
|
529
|
-
for (let i = 0; i < s.length; i++) {
|
|
530
|
-
if (s.slice(s.length - 1) !== "0") {
|
|
531
|
-
break;
|
|
532
|
-
}
|
|
533
|
-
s = s.substring(0, s.length - 1);
|
|
534
|
-
}
|
|
535
|
-
s = "0." + s;
|
|
536
|
-
} else {
|
|
537
|
-
s = (parseInt(estFee) / 10 ** chainDecimals).toString();
|
|
538
|
-
}
|
|
539
|
-
return parseFloat(s) !== 0 ? s : "0";
|
|
540
|
-
};
|
|
541
522
|
var unimplemented = ({ ...props }) => {
|
|
542
523
|
};
|
|
543
524
|
var mergeDeep = (target, ...sources) => {
|
|
@@ -560,8 +541,6 @@ var mergeDeep = (target, ...sources) => {
|
|
|
560
541
|
}
|
|
561
542
|
return mergeDeep(target, ...sources);
|
|
562
543
|
};
|
|
563
|
-
var maxBigInt = (...values) => values.reduce((max, current) => current > max ? current : max);
|
|
564
|
-
var minBigInt = (...values) => values.reduce((min, current) => current < min ? current : min);
|
|
565
544
|
// Annotate the CommonJS export names for ESM import in node:
|
|
566
545
|
0 && (module.exports = {
|
|
567
546
|
addedTo,
|
|
@@ -597,7 +576,6 @@ var minBigInt = (...values) => values.reduce((min, current) => current < min ? c
|
|
|
597
576
|
shuffle,
|
|
598
577
|
snakeToCamel,
|
|
599
578
|
sortWithNull,
|
|
600
|
-
transformToBaseUnit,
|
|
601
579
|
unescape,
|
|
602
580
|
unimplemented,
|
|
603
581
|
unitToPlanck,
|
package/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout } from './base.cjs';
|
|
2
|
-
export { addedTo, applyWidthAsPadding, capitalizeFirstLetter, determinePoolDisplay, extractUrlValue, inChrome, isValidAddress, isValidHttpUrl, localStorageOrDefault, makeCancelable, matchedProperties,
|
|
1
|
+
export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout } from './base.cjs';
|
|
2
|
+
export { addedTo, applyWidthAsPadding, capitalizeFirstLetter, determinePoolDisplay, extractUrlValue, inChrome, isValidAddress, isValidHttpUrl, localStorageOrDefault, makeCancelable, matchedProperties, mergeDeep, planckToUnit, remToUnit, removeVarFromUrlHash, removedFrom, setStateWithRef, snakeToCamel, sortWithNull, unescape, unimplemented, unitToPlanck, varToUrlHash } from './unit.cjs';
|
|
3
3
|
import '@w3ux/types';
|
|
4
4
|
import 'react';
|
|
5
5
|
import './types.cjs';
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout } from './base.js';
|
|
2
|
-
export { addedTo, applyWidthAsPadding, capitalizeFirstLetter, determinePoolDisplay, extractUrlValue, inChrome, isValidAddress, isValidHttpUrl, localStorageOrDefault, makeCancelable, matchedProperties,
|
|
1
|
+
export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout } from './base.js';
|
|
2
|
+
export { addedTo, applyWidthAsPadding, capitalizeFirstLetter, determinePoolDisplay, extractUrlValue, inChrome, isValidAddress, isValidHttpUrl, localStorageOrDefault, makeCancelable, matchedProperties, mergeDeep, planckToUnit, remToUnit, removeVarFromUrlHash, removedFrom, setStateWithRef, snakeToCamel, sortWithNull, unescape, unimplemented, unitToPlanck, varToUrlHash } from './unit.js';
|
|
3
3
|
import '@w3ux/types';
|
|
4
4
|
import 'react';
|
|
5
5
|
import './types.js';
|
package/index.js
CHANGED
|
@@ -117,6 +117,8 @@ var isSuperset = (set, subset) => {
|
|
|
117
117
|
}
|
|
118
118
|
return true;
|
|
119
119
|
};
|
|
120
|
+
var maxBigInt = (...values) => values.reduce((max, current) => current > max ? current : max);
|
|
121
|
+
var minBigInt = (...values) => values.reduce((min, current) => current < min ? current : min);
|
|
120
122
|
|
|
121
123
|
// ../../node_modules/@polkadot/x-textdecoder/node.js
|
|
122
124
|
import util from "node:util";
|
|
@@ -445,26 +447,6 @@ var makeCancelable = (promise) => {
|
|
|
445
447
|
}
|
|
446
448
|
};
|
|
447
449
|
};
|
|
448
|
-
var transformToBaseUnit = (estFee, chainDecimals) => {
|
|
449
|
-
const t = estFee.length - chainDecimals;
|
|
450
|
-
let s = "";
|
|
451
|
-
if (t < 0) {
|
|
452
|
-
for (let i = 0; i < Math.abs(t) - 1; i++) {
|
|
453
|
-
s += "0";
|
|
454
|
-
}
|
|
455
|
-
s = s + estFee;
|
|
456
|
-
for (let i = 0; i < s.length; i++) {
|
|
457
|
-
if (s.slice(s.length - 1) !== "0") {
|
|
458
|
-
break;
|
|
459
|
-
}
|
|
460
|
-
s = s.substring(0, s.length - 1);
|
|
461
|
-
}
|
|
462
|
-
s = "0." + s;
|
|
463
|
-
} else {
|
|
464
|
-
s = (parseInt(estFee) / 10 ** chainDecimals).toString();
|
|
465
|
-
}
|
|
466
|
-
return parseFloat(s) !== 0 ? s : "0";
|
|
467
|
-
};
|
|
468
450
|
var unimplemented = ({ ...props }) => {
|
|
469
451
|
};
|
|
470
452
|
var mergeDeep = (target, ...sources) => {
|
|
@@ -487,8 +469,6 @@ var mergeDeep = (target, ...sources) => {
|
|
|
487
469
|
}
|
|
488
470
|
return mergeDeep(target, ...sources);
|
|
489
471
|
};
|
|
490
|
-
var maxBigInt = (...values) => values.reduce((max, current) => current > max ? current : max);
|
|
491
|
-
var minBigInt = (...values) => values.reduce((min, current) => current < min ? current : min);
|
|
492
472
|
export {
|
|
493
473
|
addedTo,
|
|
494
474
|
appendOr,
|
|
@@ -523,7 +503,6 @@ export {
|
|
|
523
503
|
shuffle,
|
|
524
504
|
snakeToCamel,
|
|
525
505
|
sortWithNull,
|
|
526
|
-
transformToBaseUnit,
|
|
527
506
|
unescape,
|
|
528
507
|
unimplemented,
|
|
529
508
|
unitToPlanck,
|
package/package.json
CHANGED
package/unit.cjs
CHANGED
|
@@ -40,9 +40,7 @@ __export(unit_exports, {
|
|
|
40
40
|
localStorageOrDefault: () => localStorageOrDefault,
|
|
41
41
|
makeCancelable: () => makeCancelable,
|
|
42
42
|
matchedProperties: () => matchedProperties,
|
|
43
|
-
maxBigInt: () => maxBigInt,
|
|
44
43
|
mergeDeep: () => mergeDeep,
|
|
45
|
-
minBigInt: () => minBigInt,
|
|
46
44
|
planckToUnit: () => planckToUnit,
|
|
47
45
|
remToUnit: () => remToUnit,
|
|
48
46
|
removeVarFromUrlHash: () => removeVarFromUrlHash,
|
|
@@ -50,7 +48,6 @@ __export(unit_exports, {
|
|
|
50
48
|
setStateWithRef: () => setStateWithRef,
|
|
51
49
|
snakeToCamel: () => snakeToCamel,
|
|
52
50
|
sortWithNull: () => sortWithNull,
|
|
53
|
-
transformToBaseUnit: () => transformToBaseUnit,
|
|
54
51
|
unescape: () => unescape,
|
|
55
52
|
unimplemented: () => unimplemented,
|
|
56
53
|
unitToPlanck: () => unitToPlanck,
|
|
@@ -414,26 +411,6 @@ var makeCancelable = (promise) => {
|
|
|
414
411
|
}
|
|
415
412
|
};
|
|
416
413
|
};
|
|
417
|
-
var transformToBaseUnit = (estFee, chainDecimals) => {
|
|
418
|
-
const t = estFee.length - chainDecimals;
|
|
419
|
-
let s = "";
|
|
420
|
-
if (t < 0) {
|
|
421
|
-
for (let i = 0; i < Math.abs(t) - 1; i++) {
|
|
422
|
-
s += "0";
|
|
423
|
-
}
|
|
424
|
-
s = s + estFee;
|
|
425
|
-
for (let i = 0; i < s.length; i++) {
|
|
426
|
-
if (s.slice(s.length - 1) !== "0") {
|
|
427
|
-
break;
|
|
428
|
-
}
|
|
429
|
-
s = s.substring(0, s.length - 1);
|
|
430
|
-
}
|
|
431
|
-
s = "0." + s;
|
|
432
|
-
} else {
|
|
433
|
-
s = (parseInt(estFee) / 10 ** chainDecimals).toString();
|
|
434
|
-
}
|
|
435
|
-
return parseFloat(s) !== 0 ? s : "0";
|
|
436
|
-
};
|
|
437
414
|
var unimplemented = ({ ...props }) => {
|
|
438
415
|
};
|
|
439
416
|
var mergeDeep = (target, ...sources) => {
|
|
@@ -456,8 +433,6 @@ var mergeDeep = (target, ...sources) => {
|
|
|
456
433
|
}
|
|
457
434
|
return mergeDeep(target, ...sources);
|
|
458
435
|
};
|
|
459
|
-
var maxBigInt = (...values) => values.reduce((max, current) => current > max ? current : max);
|
|
460
|
-
var minBigInt = (...values) => values.reduce((min, current) => current < min ? current : min);
|
|
461
436
|
// Annotate the CommonJS export names for ESM import in node:
|
|
462
437
|
0 && (module.exports = {
|
|
463
438
|
addedTo,
|
|
@@ -471,9 +446,7 @@ var minBigInt = (...values) => values.reduce((min, current) => current < min ? c
|
|
|
471
446
|
localStorageOrDefault,
|
|
472
447
|
makeCancelable,
|
|
473
448
|
matchedProperties,
|
|
474
|
-
maxBigInt,
|
|
475
449
|
mergeDeep,
|
|
476
|
-
minBigInt,
|
|
477
450
|
planckToUnit,
|
|
478
451
|
remToUnit,
|
|
479
452
|
removeVarFromUrlHash,
|
|
@@ -481,7 +454,6 @@ var minBigInt = (...values) => values.reduce((min, current) => current < min ? c
|
|
|
481
454
|
setStateWithRef,
|
|
482
455
|
snakeToCamel,
|
|
483
456
|
sortWithNull,
|
|
484
|
-
transformToBaseUnit,
|
|
485
457
|
unescape,
|
|
486
458
|
unimplemented,
|
|
487
459
|
unitToPlanck,
|
package/unit.d.cts
CHANGED
|
@@ -135,17 +135,6 @@ declare const makeCancelable: (promise: Promise<AnyObject>) => {
|
|
|
135
135
|
promise: Promise<unknown>;
|
|
136
136
|
cancel: () => void;
|
|
137
137
|
};
|
|
138
|
-
/**
|
|
139
|
-
* The transformToBaseUnit function is used to transform a given estimated
|
|
140
|
-
* fee value from its current representation to its base unit representation,
|
|
141
|
-
* considering the provided chain decimals. The function is designed to handle
|
|
142
|
-
* cases where the chain decimals are either greater or less than the length
|
|
143
|
-
* of the estimated fee.
|
|
144
|
-
* @param {string} estFee : The estimated fee value that needs to be transformed
|
|
145
|
-
* to its base unit representation.
|
|
146
|
-
* @param {number} chainDecimals: The number of decimal places used by the blockchain.
|
|
147
|
-
*/
|
|
148
|
-
declare const transformToBaseUnit: (estFee: string, chainDecimals: number) => string;
|
|
149
138
|
/**
|
|
150
139
|
* @name unimplemented
|
|
151
140
|
* @summary A placeholder function to signal a deliberate unimplementation.
|
|
@@ -160,27 +149,5 @@ declare const unimplemented: ({ ...props }: {
|
|
|
160
149
|
* @param ...sources
|
|
161
150
|
*/
|
|
162
151
|
declare const mergeDeep: (target: AnyObject, ...sources: AnyObject[]) => AnyObject;
|
|
163
|
-
/**
|
|
164
|
-
* Finds the maximum value among a list of BigInt values.
|
|
165
|
-
*
|
|
166
|
-
* @function maxBigInt
|
|
167
|
-
* @param {...bigint} values - A list of BigInt values to compare.
|
|
168
|
-
* @returns {bigint} The largest BigInt value in the provided list.
|
|
169
|
-
* @example
|
|
170
|
-
* // Returns the maximum BigInt value
|
|
171
|
-
* maxBigInt(10n, 50n, 30n, 100n, 20n); // 100n
|
|
172
|
-
*/
|
|
173
|
-
declare const maxBigInt: (...values: bigint[]) => bigint;
|
|
174
|
-
/**
|
|
175
|
-
* Finds the minimum value among a list of BigInt values.
|
|
176
|
-
*
|
|
177
|
-
* @function minBigInt
|
|
178
|
-
* @param {...bigint} values - A list of BigInt values to compare.
|
|
179
|
-
* @returns {bigint} The smallest BigInt value in the provided list.
|
|
180
|
-
* @example
|
|
181
|
-
* // Returns the minimum BigInt value
|
|
182
|
-
* minBigInt(10n, 50n, 30n, 100n, 20n); // 10n
|
|
183
|
-
*/
|
|
184
|
-
declare const minBigInt: (...values: bigint[]) => bigint;
|
|
185
152
|
|
|
186
|
-
export { addedTo, applyWidthAsPadding, capitalizeFirstLetter, determinePoolDisplay, extractUrlValue, inChrome, isValidAddress, isValidHttpUrl, localStorageOrDefault, makeCancelable, matchedProperties,
|
|
153
|
+
export { addedTo, applyWidthAsPadding, capitalizeFirstLetter, determinePoolDisplay, extractUrlValue, inChrome, isValidAddress, isValidHttpUrl, localStorageOrDefault, makeCancelable, matchedProperties, mergeDeep, planckToUnit, remToUnit, removeVarFromUrlHash, removedFrom, setStateWithRef, snakeToCamel, sortWithNull, unescape, unimplemented, unitToPlanck, varToUrlHash };
|
package/unit.d.ts
CHANGED
|
@@ -135,17 +135,6 @@ declare const makeCancelable: (promise: Promise<AnyObject>) => {
|
|
|
135
135
|
promise: Promise<unknown>;
|
|
136
136
|
cancel: () => void;
|
|
137
137
|
};
|
|
138
|
-
/**
|
|
139
|
-
* The transformToBaseUnit function is used to transform a given estimated
|
|
140
|
-
* fee value from its current representation to its base unit representation,
|
|
141
|
-
* considering the provided chain decimals. The function is designed to handle
|
|
142
|
-
* cases where the chain decimals are either greater or less than the length
|
|
143
|
-
* of the estimated fee.
|
|
144
|
-
* @param {string} estFee : The estimated fee value that needs to be transformed
|
|
145
|
-
* to its base unit representation.
|
|
146
|
-
* @param {number} chainDecimals: The number of decimal places used by the blockchain.
|
|
147
|
-
*/
|
|
148
|
-
declare const transformToBaseUnit: (estFee: string, chainDecimals: number) => string;
|
|
149
138
|
/**
|
|
150
139
|
* @name unimplemented
|
|
151
140
|
* @summary A placeholder function to signal a deliberate unimplementation.
|
|
@@ -160,27 +149,5 @@ declare const unimplemented: ({ ...props }: {
|
|
|
160
149
|
* @param ...sources
|
|
161
150
|
*/
|
|
162
151
|
declare const mergeDeep: (target: AnyObject, ...sources: AnyObject[]) => AnyObject;
|
|
163
|
-
/**
|
|
164
|
-
* Finds the maximum value among a list of BigInt values.
|
|
165
|
-
*
|
|
166
|
-
* @function maxBigInt
|
|
167
|
-
* @param {...bigint} values - A list of BigInt values to compare.
|
|
168
|
-
* @returns {bigint} The largest BigInt value in the provided list.
|
|
169
|
-
* @example
|
|
170
|
-
* // Returns the maximum BigInt value
|
|
171
|
-
* maxBigInt(10n, 50n, 30n, 100n, 20n); // 100n
|
|
172
|
-
*/
|
|
173
|
-
declare const maxBigInt: (...values: bigint[]) => bigint;
|
|
174
|
-
/**
|
|
175
|
-
* Finds the minimum value among a list of BigInt values.
|
|
176
|
-
*
|
|
177
|
-
* @function minBigInt
|
|
178
|
-
* @param {...bigint} values - A list of BigInt values to compare.
|
|
179
|
-
* @returns {bigint} The smallest BigInt value in the provided list.
|
|
180
|
-
* @example
|
|
181
|
-
* // Returns the minimum BigInt value
|
|
182
|
-
* minBigInt(10n, 50n, 30n, 100n, 20n); // 10n
|
|
183
|
-
*/
|
|
184
|
-
declare const minBigInt: (...values: bigint[]) => bigint;
|
|
185
152
|
|
|
186
|
-
export { addedTo, applyWidthAsPadding, capitalizeFirstLetter, determinePoolDisplay, extractUrlValue, inChrome, isValidAddress, isValidHttpUrl, localStorageOrDefault, makeCancelable, matchedProperties,
|
|
153
|
+
export { addedTo, applyWidthAsPadding, capitalizeFirstLetter, determinePoolDisplay, extractUrlValue, inChrome, isValidAddress, isValidHttpUrl, localStorageOrDefault, makeCancelable, matchedProperties, mergeDeep, planckToUnit, remToUnit, removeVarFromUrlHash, removedFrom, setStateWithRef, snakeToCamel, sortWithNull, unescape, unimplemented, unitToPlanck, varToUrlHash };
|
package/unit.js
CHANGED
|
@@ -354,26 +354,6 @@ var makeCancelable = (promise) => {
|
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
356
|
};
|
|
357
|
-
var transformToBaseUnit = (estFee, chainDecimals) => {
|
|
358
|
-
const t = estFee.length - chainDecimals;
|
|
359
|
-
let s = "";
|
|
360
|
-
if (t < 0) {
|
|
361
|
-
for (let i = 0; i < Math.abs(t) - 1; i++) {
|
|
362
|
-
s += "0";
|
|
363
|
-
}
|
|
364
|
-
s = s + estFee;
|
|
365
|
-
for (let i = 0; i < s.length; i++) {
|
|
366
|
-
if (s.slice(s.length - 1) !== "0") {
|
|
367
|
-
break;
|
|
368
|
-
}
|
|
369
|
-
s = s.substring(0, s.length - 1);
|
|
370
|
-
}
|
|
371
|
-
s = "0." + s;
|
|
372
|
-
} else {
|
|
373
|
-
s = (parseInt(estFee) / 10 ** chainDecimals).toString();
|
|
374
|
-
}
|
|
375
|
-
return parseFloat(s) !== 0 ? s : "0";
|
|
376
|
-
};
|
|
377
357
|
var unimplemented = ({ ...props }) => {
|
|
378
358
|
};
|
|
379
359
|
var mergeDeep = (target, ...sources) => {
|
|
@@ -396,8 +376,6 @@ var mergeDeep = (target, ...sources) => {
|
|
|
396
376
|
}
|
|
397
377
|
return mergeDeep(target, ...sources);
|
|
398
378
|
};
|
|
399
|
-
var maxBigInt = (...values) => values.reduce((max, current) => current > max ? current : max);
|
|
400
|
-
var minBigInt = (...values) => values.reduce((min, current) => current < min ? current : min);
|
|
401
379
|
export {
|
|
402
380
|
addedTo,
|
|
403
381
|
applyWidthAsPadding,
|
|
@@ -410,9 +388,7 @@ export {
|
|
|
410
388
|
localStorageOrDefault,
|
|
411
389
|
makeCancelable,
|
|
412
390
|
matchedProperties,
|
|
413
|
-
maxBigInt,
|
|
414
391
|
mergeDeep,
|
|
415
|
-
minBigInt,
|
|
416
392
|
planckToUnit,
|
|
417
393
|
remToUnit,
|
|
418
394
|
removeVarFromUrlHash,
|
|
@@ -420,7 +396,6 @@ export {
|
|
|
420
396
|
setStateWithRef,
|
|
421
397
|
snakeToCamel,
|
|
422
398
|
sortWithNull,
|
|
423
|
-
transformToBaseUnit,
|
|
424
399
|
unescape,
|
|
425
400
|
unimplemented,
|
|
426
401
|
unitToPlanck,
|