starknet 11.7.0 → 11.7.1
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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.global.js +4 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [11.7.1](https://github.com/starknet-io/starknet.js/compare/v11.7.0...v11.7.1) (2026-11-17)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- units() rejects strk amounts with more than 18 decimals and keeps zero ([4c1e43f](https://github.com/starknet-io/starknet.js/commit/4c1e43f17f6ccf23b7ebc5ad3018751ffc830d0e)), closes [#1756](https://github.com/starknet-io/starknet.js/issues/1756)
|
|
6
|
+
|
|
1
7
|
# [11.7.0](https://github.com/starknet-io/starknet.js/compare/v11.6.3...v11.7.0) (2026-11-16)
|
|
2
8
|
|
|
3
9
|
### Features
|
package/dist/index.d.ts
CHANGED
|
@@ -18548,6 +18548,7 @@ declare function createTransactionReceipt(receipt: GetTxReceiptResponseWithoutHe
|
|
|
18548
18548
|
|
|
18549
18549
|
/**
|
|
18550
18550
|
* Convert strk to fri or fri to strk
|
|
18551
|
+
* @throws {Error} if a strk amount has more than 18 decimals (1 strk = 10^18 fri)
|
|
18551
18552
|
* @example
|
|
18552
18553
|
* ```typescript
|
|
18553
18554
|
* units(1000n, 'fri') // '0.000000000000001' strk
|
package/dist/index.global.js
CHANGED
|
@@ -27577,8 +27577,11 @@ ${indent}}` : "}";
|
|
|
27577
27577
|
}
|
|
27578
27578
|
}
|
|
27579
27579
|
const [integer, decimal = "0"] = numStr.split(".");
|
|
27580
|
+
if (decimal.length > 18) {
|
|
27581
|
+
throw new Error(`units: '${numStr}' strk has more than 18 decimals`);
|
|
27582
|
+
}
|
|
27580
27583
|
const pdec = decimal.padEnd(18, "0");
|
|
27581
|
-
return `${integer}${pdec}`.replace(/\b0
|
|
27584
|
+
return `${integer}${pdec}`.replace(/\b0+(?=\d)/g, "");
|
|
27582
27585
|
}
|
|
27583
27586
|
const bis = BigInt(amount).toString();
|
|
27584
27587
|
let strk;
|