@morpho-org/blue-sdk 1.10.2 → 1.10.4
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.
|
@@ -38,17 +38,26 @@ declare global {
|
|
|
38
38
|
insert(index: number, substr: string, fillWith?: string): string;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
43
|
+
*/
|
|
41
44
|
export declare abstract class BaseFormatter {
|
|
42
45
|
protected abstract _options: FormatOptions;
|
|
43
46
|
constructor();
|
|
44
47
|
of(value: bigint, decimals: number): string;
|
|
45
48
|
of(value: number): string;
|
|
46
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
52
|
+
*/
|
|
47
53
|
export declare class HexFormatter extends BaseFormatter {
|
|
48
54
|
protected _options: {
|
|
49
55
|
format: Format;
|
|
50
56
|
};
|
|
51
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
60
|
+
*/
|
|
52
61
|
export declare abstract class CommonFormatter extends BaseFormatter {
|
|
53
62
|
protected abstract _options: BaseFormatOptions;
|
|
54
63
|
digits(_d: number): this;
|
|
@@ -60,19 +69,34 @@ export declare abstract class CommonFormatter extends BaseFormatter {
|
|
|
60
69
|
unit(_u: string): this;
|
|
61
70
|
locale(_l: string): this;
|
|
62
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
74
|
+
*/
|
|
63
75
|
export declare class NumberFormatter extends CommonFormatter {
|
|
64
76
|
protected _options: FormatNumberOptions;
|
|
65
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
80
|
+
*/
|
|
66
81
|
export declare class CommasFormatter extends CommonFormatter {
|
|
67
82
|
protected _options: FormatCommasOptions;
|
|
68
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
86
|
+
*/
|
|
69
87
|
export declare class ShortFormatter extends CommonFormatter {
|
|
70
88
|
protected _options: FormatShortOptions;
|
|
71
89
|
smallValuesWithCommas(): this;
|
|
72
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
93
|
+
*/
|
|
73
94
|
export declare class PercentFormatter extends CommonFormatter {
|
|
74
95
|
protected _options: FormatPercentOptions;
|
|
75
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
99
|
+
*/
|
|
76
100
|
export declare const format: {
|
|
77
101
|
/**
|
|
78
102
|
* Return the value as an integer in hex format
|
|
@@ -153,6 +153,9 @@ function formatBI(bi, decimals, formatOptions = { format: Format.hex }) {
|
|
|
153
153
|
}
|
|
154
154
|
return formattedValue;
|
|
155
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
158
|
+
*/
|
|
156
159
|
class BaseFormatter {
|
|
157
160
|
constructor() { }
|
|
158
161
|
of(value, decimals) {
|
|
@@ -169,10 +172,16 @@ class BaseFormatter {
|
|
|
169
172
|
}
|
|
170
173
|
}
|
|
171
174
|
exports.BaseFormatter = BaseFormatter;
|
|
175
|
+
/**
|
|
176
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
177
|
+
*/
|
|
172
178
|
class HexFormatter extends BaseFormatter {
|
|
173
179
|
_options = { format: Format.hex };
|
|
174
180
|
}
|
|
175
181
|
exports.HexFormatter = HexFormatter;
|
|
182
|
+
/**
|
|
183
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
184
|
+
*/
|
|
176
185
|
class CommonFormatter extends BaseFormatter {
|
|
177
186
|
digits(_d) {
|
|
178
187
|
this._options.digits = _d;
|
|
@@ -208,14 +217,23 @@ class CommonFormatter extends BaseFormatter {
|
|
|
208
217
|
}
|
|
209
218
|
}
|
|
210
219
|
exports.CommonFormatter = CommonFormatter;
|
|
220
|
+
/**
|
|
221
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
222
|
+
*/
|
|
211
223
|
class NumberFormatter extends CommonFormatter {
|
|
212
224
|
_options = { format: Format.number };
|
|
213
225
|
}
|
|
214
226
|
exports.NumberFormatter = NumberFormatter;
|
|
227
|
+
/**
|
|
228
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
229
|
+
*/
|
|
215
230
|
class CommasFormatter extends CommonFormatter {
|
|
216
231
|
_options = { format: Format.commas };
|
|
217
232
|
}
|
|
218
233
|
exports.CommasFormatter = CommasFormatter;
|
|
234
|
+
/**
|
|
235
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
236
|
+
*/
|
|
219
237
|
class ShortFormatter extends CommonFormatter {
|
|
220
238
|
_options = { format: Format.short };
|
|
221
239
|
smallValuesWithCommas() {
|
|
@@ -224,10 +242,16 @@ class ShortFormatter extends CommonFormatter {
|
|
|
224
242
|
}
|
|
225
243
|
}
|
|
226
244
|
exports.ShortFormatter = ShortFormatter;
|
|
245
|
+
/**
|
|
246
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
247
|
+
*/
|
|
227
248
|
class PercentFormatter extends CommonFormatter {
|
|
228
249
|
_options = { format: Format.percent };
|
|
229
250
|
}
|
|
230
251
|
exports.PercentFormatter = PercentFormatter;
|
|
252
|
+
/**
|
|
253
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
254
|
+
*/
|
|
231
255
|
exports.format = {
|
|
232
256
|
/**
|
|
233
257
|
* Return the value as an integer in hex format
|
package/lib/helpers/locale.d.ts
CHANGED
|
@@ -8,10 +8,14 @@ export type LocaleParts = LocaleSymbols & {
|
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* @returns the locale symbols for the given locale defaulting to en-US
|
|
11
|
+
*
|
|
12
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
11
13
|
*/
|
|
12
14
|
export declare const getLocaleSymbols: (locale: string) => LocaleSymbols;
|
|
13
15
|
/**
|
|
14
16
|
* @returns the effective browser locale
|
|
17
|
+
*
|
|
18
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
15
19
|
*/
|
|
16
20
|
export declare const getEffectiveLocale: () => string;
|
|
17
21
|
/**
|
|
@@ -19,18 +23,24 @@ export declare const getEffectiveLocale: () => string;
|
|
|
19
23
|
* @param numStr the number as a string in the "from" locale (e.g. "1,2345.6" for en-US)
|
|
20
24
|
* @param from the locale the numStr is in (e.g. "en-US")
|
|
21
25
|
* @param to the locale to convert to (e.g. "fr-FR")
|
|
26
|
+
*
|
|
27
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
22
28
|
*/
|
|
23
29
|
export declare const convertNumStrToLocal: (numStr: string, from: string, to: string) => string;
|
|
24
30
|
/**
|
|
25
31
|
* @returns the value as a string in the effective browser locale
|
|
26
32
|
* @param numStr the number as a string in the effective browser locale (e.g. "1,2345.6" for en-US)
|
|
27
33
|
* @param to the locale to use (e.g. "fr-FR")
|
|
34
|
+
*
|
|
35
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
28
36
|
*/
|
|
29
37
|
export declare const convertNumStrFromEffectiveTo: (numStr: string, to: string) => string;
|
|
30
38
|
/**
|
|
31
39
|
* @returns the value as a string with the given locale symbols either from the given locale or the effective browser locale
|
|
32
40
|
* @param numStr the number as a string in english format (e.g. "1,2345.6")
|
|
33
41
|
* @param locale optional - the locale to use (e.g. "fr-FR")
|
|
42
|
+
*
|
|
43
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
34
44
|
*/
|
|
35
45
|
export declare const getEnUSNumberToLocalParts: (numStr: string, locale?: string) => LocaleParts;
|
|
36
46
|
export {};
|
package/lib/helpers/locale.js
CHANGED
|
@@ -9,6 +9,8 @@ const _convertEnNumStrToLocale = (numStr, localSymbols) => {
|
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* @returns the locale symbols for the given locale defaulting to en-US
|
|
12
|
+
*
|
|
13
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
12
14
|
*/
|
|
13
15
|
const getLocaleSymbols = (locale) => {
|
|
14
16
|
let formatter;
|
|
@@ -31,6 +33,8 @@ const getLocaleSymbols = (locale) => {
|
|
|
31
33
|
exports.getLocaleSymbols = getLocaleSymbols;
|
|
32
34
|
/**
|
|
33
35
|
* @returns the effective browser locale
|
|
36
|
+
*
|
|
37
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
34
38
|
*/
|
|
35
39
|
const getEffectiveLocale = () => {
|
|
36
40
|
if (typeof window !== "undefined") {
|
|
@@ -51,6 +55,8 @@ exports.getEffectiveLocale = getEffectiveLocale;
|
|
|
51
55
|
* @param numStr the number as a string in the "from" locale (e.g. "1,2345.6" for en-US)
|
|
52
56
|
* @param from the locale the numStr is in (e.g. "en-US")
|
|
53
57
|
* @param to the locale to convert to (e.g. "fr-FR")
|
|
58
|
+
*
|
|
59
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
54
60
|
*/
|
|
55
61
|
const convertNumStrToLocal = (numStr, from, to) => {
|
|
56
62
|
const fromSymbols = (0, exports.getLocaleSymbols)(from);
|
|
@@ -66,6 +72,8 @@ exports.convertNumStrToLocal = convertNumStrToLocal;
|
|
|
66
72
|
* @returns the value as a string in the effective browser locale
|
|
67
73
|
* @param numStr the number as a string in the effective browser locale (e.g. "1,2345.6" for en-US)
|
|
68
74
|
* @param to the locale to use (e.g. "fr-FR")
|
|
75
|
+
*
|
|
76
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
69
77
|
*/
|
|
70
78
|
const convertNumStrFromEffectiveTo = (numStr, to) => {
|
|
71
79
|
const from = (0, exports.getEffectiveLocale)();
|
|
@@ -76,6 +84,8 @@ exports.convertNumStrFromEffectiveTo = convertNumStrFromEffectiveTo;
|
|
|
76
84
|
* @returns the value as a string with the given locale symbols either from the given locale or the effective browser locale
|
|
77
85
|
* @param numStr the number as a string in english format (e.g. "1,2345.6")
|
|
78
86
|
* @param locale optional - the locale to use (e.g. "fr-FR")
|
|
87
|
+
*
|
|
88
|
+
* @deprecated Import from `@morpho-org/morpho-ts`
|
|
79
89
|
*/
|
|
80
90
|
const getEnUSNumberToLocalParts = (numStr, locale) => {
|
|
81
91
|
const _locale = locale || (0, exports.getEffectiveLocale)();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morpho-org/blue-sdk",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.4",
|
|
4
4
|
"author": "Morpho Association <contact@morpho.org>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"keccak256": "^1.0.6"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@morpho-org/morpho-test": "^1.10.
|
|
20
|
-
"@morpho-org/morpho-ts": "^1.10.
|
|
19
|
+
"@morpho-org/morpho-test": "^1.10.4",
|
|
20
|
+
"@morpho-org/morpho-ts": "^1.10.4",
|
|
21
21
|
"@types/jest": "^29.5.12",
|
|
22
22
|
"@types/node": "^22.1.0",
|
|
23
23
|
"jest": "^29.7.0",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"typescript": "^5.4.5"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@morpho-org/morpho-ts": "^1.10.
|
|
28
|
+
"@morpho-org/morpho-ts": "^1.10.4"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
],
|
|
50
50
|
"preset": "ts-jest"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "50753fe1540d0a4d29c9cd1892dde759c773651d"
|
|
53
53
|
}
|