@cmts-dev/carmentis-sdk-core 1.2.9 → 1.2.11
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.
|
@@ -1089,10 +1089,15 @@ var pn = /* @__PURE__ */ function(e) {
|
|
|
1089
1089
|
mul(t) {
|
|
1090
1090
|
return e.createAtomic(this.getAmountAsAtomic() * t);
|
|
1091
1091
|
}
|
|
1092
|
-
toString(t = pn.TOKEN) {
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
case pn.
|
|
1092
|
+
toString(t = pn.TOKEN, n = {}) {
|
|
1093
|
+
let r = this.getAmountAsCMTS();
|
|
1094
|
+
switch (n.locale = n.locale === "system" ? void 0 : n.locale || "en-EN", t) {
|
|
1095
|
+
case pn.TOKEN: return `${Intl.NumberFormat(n.locale, {
|
|
1096
|
+
minimumFractionDigits: n.decimalPlaces === void 0 ? 0 : n.decimalPlaces,
|
|
1097
|
+
maximumFractionDigits: n.decimalPlaces === void 0 ? 8 : n.decimalPlaces,
|
|
1098
|
+
useGrouping: n.grouping || !1
|
|
1099
|
+
}).format(r)} ${e.getUnitLabel(t)}`;
|
|
1100
|
+
case pn.ATOMIC: return `${r} ${e.getUnitLabel(t)}`;
|
|
1096
1101
|
default: throw new y();
|
|
1097
1102
|
}
|
|
1098
1103
|
}
|
|
@@ -12054,9 +12059,7 @@ var { NEVER: hx, ALWAYS: gx, DECIMAL_ROUND: _x, DECIMAL_FIT: vx } = Rb, yx = 204
|
|
|
12054
12059
|
return e;
|
|
12055
12060
|
}
|
|
12056
12061
|
async getMicroblock(e) {
|
|
12057
|
-
this.logger.debug(`Accessing microblock at height ${e} of vb`);
|
|
12058
|
-
for (let e of this.microblockHashByHeight.entries()) this.logger.debug(`\t- Height ${e[0]}: ${k.binaryToHexa(e[1])}`);
|
|
12059
|
-
if (e < 1) throw new i(`Cannot retrieve microblock at height strictly lower than 1: got ${e}`);
|
|
12062
|
+
if (this.logger.debug(`Accessing microblock at height ${e} of vb`), e < 1) throw new i(`Cannot retrieve microblock at height strictly lower than 1: got ${e}`);
|
|
12060
12063
|
if (this.getHeight() < e) return await this.microblockSearchFailureFallback.onMicroblockSearchFailureForExceedingHeight(this, e);
|
|
12061
12064
|
let t = this.microblockByHeight.get(e);
|
|
12062
12065
|
if (t !== void 0) return t;
|
|
@@ -153,9 +153,20 @@ export declare class CMTSToken implements Currency {
|
|
|
153
153
|
* Converts the object to a string representation combining the amount and its unit label.
|
|
154
154
|
* The returned string typically includes the numerical value and its corresponding unit.
|
|
155
155
|
*
|
|
156
|
-
* @
|
|
156
|
+
* @param unit - The unit in which the value should be represented: either TokenUnit.TOKEN (default) or TokenUnit.ATOMIC
|
|
157
|
+
* @param options - Optional formatting configuration applied only when `unit === TokenUnit.TOKEN`.
|
|
158
|
+
* @param options.decimalPlaces - Fixed number of decimal places to display. No formatting if undefined (default).
|
|
159
|
+
* @param options.grouping - Whether to enable digit grouping (defaults to false)
|
|
160
|
+
* @param options.locale - BCP 47 locale string used for number formatting
|
|
161
|
+
* - If set to `"system"`, the runtime default locale is used.
|
|
162
|
+
* - If omitted, defaults to `"en-EN"`.
|
|
163
|
+
* @return {string} A string representation of the object in the format `"{amount} {unitLabel}"`.
|
|
157
164
|
*/
|
|
158
|
-
toString(unit?: TokenUnit
|
|
165
|
+
toString(unit?: TokenUnit, options?: {
|
|
166
|
+
decimalPlaces?: number;
|
|
167
|
+
grouping?: boolean;
|
|
168
|
+
locale?: string;
|
|
169
|
+
}): string;
|
|
159
170
|
/**
|
|
160
171
|
* Retrieves the label corresponding to the current unit of the token.
|
|
161
172
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/economics/currencies/token.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAIpC;;;;;;;;;;;;;GAaG;AACH,oBAAY,SAAS;IACjB,KAAK,SAAU,CAAQ,SAA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