starknet 11.9.2 → 11.9.3
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 +3 -0
- package/dist/index.global.js +10 -4
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -840,17 +840,21 @@ function tryToBigInt(value) {
|
|
|
840
840
|
return value ? BigInt(value) : void 0;
|
|
841
841
|
}
|
|
842
842
|
function toHex(value) {
|
|
843
|
-
|
|
843
|
+
const bn = toBigInt(value);
|
|
844
|
+
if (bn < 0n) {
|
|
845
|
+
throw new Error(`Invalid input: ${bn} is negative, a hex-string cannot hold a sign`);
|
|
846
|
+
}
|
|
847
|
+
return addHexPrefix(bn.toString(16));
|
|
844
848
|
}
|
|
845
849
|
var toHexString = toHex;
|
|
846
850
|
function cleanHex(hex) {
|
|
847
851
|
return toHex(hex);
|
|
848
852
|
}
|
|
849
853
|
function toStorageKey(number) {
|
|
850
|
-
return addHexPrefix(
|
|
854
|
+
return addHexPrefix(removeHexPrefix(toHex(number)).padStart(64, "0"));
|
|
851
855
|
}
|
|
852
856
|
function toHex64(number) {
|
|
853
|
-
const res = addHexPrefix(
|
|
857
|
+
const res = addHexPrefix(removeHexPrefix(toHex(number)).padStart(64, "0"));
|
|
854
858
|
if (res.length !== 66) throw TypeError("number is too big for hex 0x(64) representation");
|
|
855
859
|
return res;
|
|
856
860
|
}
|
|
@@ -16013,14 +16017,16 @@ function identifyRevision({ types, domain }) {
|
|
|
16013
16017
|
return void 0;
|
|
16014
16018
|
}
|
|
16015
16019
|
function getHex(value) {
|
|
16020
|
+
let bn;
|
|
16016
16021
|
try {
|
|
16017
|
-
|
|
16022
|
+
bn = toBigInt(value);
|
|
16018
16023
|
} catch (e) {
|
|
16019
16024
|
if (isString(value)) {
|
|
16020
16025
|
return toHex(CairoBytes31.fromText(value).toBigInt());
|
|
16021
16026
|
}
|
|
16022
16027
|
throw new Error(`Invalid BigNumberish: ${value}`);
|
|
16023
16028
|
}
|
|
16029
|
+
return toHex(bn);
|
|
16024
16030
|
}
|
|
16025
16031
|
function validateTypedData(data) {
|
|
16026
16032
|
const typedData = data;
|