starknet 8.5.0 → 8.5.2
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 +12 -0
- package/dist/index.global.js +14 -50
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +14 -50
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -50
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [8.5.2](https://github.com/starknet-io/starknet.js/compare/v8.5.1...v8.5.2) (2025-08-27)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- preserve leading zeros for cairo bytes data ([5542a00](https://github.com/starknet-io/starknet.js/commit/5542a0015d0cc3cae186d63fe4258c9942ff07d2))
|
|
6
|
+
|
|
7
|
+
## [8.5.1](https://github.com/starknet-io/starknet.js/compare/v8.5.0...v8.5.1) (2025-08-27)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- preserve leading zeros for pending word within byte array ([5d7ab04](https://github.com/starknet-io/starknet.js/commit/5d7ab042ce1a81e4f31a5ec4488db758308e872a))
|
|
12
|
+
|
|
1
13
|
# [8.5.0](https://github.com/starknet-io/starknet.js/compare/v8.4.0...v8.5.0) (2025-08-18)
|
|
2
14
|
|
|
3
15
|
### Features
|
package/dist/index.global.js
CHANGED
|
@@ -5950,7 +5950,8 @@ ${indent}}` : "}";
|
|
|
5950
5950
|
return new TextDecoder().decode(this.data);
|
|
5951
5951
|
}
|
|
5952
5952
|
toHexString() {
|
|
5953
|
-
|
|
5953
|
+
const hexValue = this.data.length === 0 ? "0" : buf2hex(this.data);
|
|
5954
|
+
return addHexPrefix(hexValue);
|
|
5954
5955
|
}
|
|
5955
5956
|
static validate(data) {
|
|
5956
5957
|
const byteLength = _CairoBytes31.__processData(data).length;
|
|
@@ -6247,8 +6248,7 @@ ${indent}}` : "}";
|
|
|
6247
6248
|
}
|
|
6248
6249
|
decodeUtf8() {
|
|
6249
6250
|
const allBytes = this.reconstructBytes();
|
|
6250
|
-
|
|
6251
|
-
return new TextDecoder().decode(fullBytes);
|
|
6251
|
+
return new TextDecoder().decode(allBytes);
|
|
6252
6252
|
}
|
|
6253
6253
|
toBigInt() {
|
|
6254
6254
|
const allBytes = this.reconstructBytes();
|
|
@@ -6262,32 +6262,13 @@ ${indent}}` : "}";
|
|
|
6262
6262
|
return result;
|
|
6263
6263
|
}
|
|
6264
6264
|
toHexString() {
|
|
6265
|
-
|
|
6265
|
+
const allBytes = this.reconstructBytes();
|
|
6266
|
+
const hexValue = allBytes.length === 0 ? "0" : buf2hex(allBytes);
|
|
6267
|
+
return addHexPrefix(hexValue);
|
|
6266
6268
|
}
|
|
6267
6269
|
toBuffer() {
|
|
6268
6270
|
this.assertInitialized();
|
|
6269
|
-
const allBytes =
|
|
6270
|
-
this.data.forEach((chunk) => {
|
|
6271
|
-
const chunkBytes = chunk.data;
|
|
6272
|
-
for (let i = 0; i < chunkBytes.length; i += 1) {
|
|
6273
|
-
allBytes.push(chunkBytes[i]);
|
|
6274
|
-
}
|
|
6275
|
-
});
|
|
6276
|
-
const pendingLen = Number(this.pending_word_len.toBigInt());
|
|
6277
|
-
if (pendingLen > 0) {
|
|
6278
|
-
const hex = this.pending_word.toHexString();
|
|
6279
|
-
const hexWithoutPrefix = hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
6280
|
-
const paddedHex = hexWithoutPrefix.length % 2 === 0 ? hexWithoutPrefix : `0${hexWithoutPrefix}`;
|
|
6281
|
-
for (let i = 0; i < pendingLen; i += 1) {
|
|
6282
|
-
const byteHex = paddedHex.slice(i * 2, i * 2 + 2);
|
|
6283
|
-
if (byteHex.length >= 2) {
|
|
6284
|
-
const byteValue = parseInt(byteHex, 16);
|
|
6285
|
-
if (!Number.isNaN(byteValue)) {
|
|
6286
|
-
allBytes.push(byteValue);
|
|
6287
|
-
}
|
|
6288
|
-
}
|
|
6289
|
-
}
|
|
6290
|
-
}
|
|
6271
|
+
const allBytes = this.reconstructBytes();
|
|
6291
6272
|
return buffer_default.from(allBytes);
|
|
6292
6273
|
}
|
|
6293
6274
|
static validate(data) {
|
|
@@ -6351,32 +6332,15 @@ ${indent}}` : "}";
|
|
|
6351
6332
|
*/
|
|
6352
6333
|
reconstructBytes() {
|
|
6353
6334
|
this.assertInitialized();
|
|
6354
|
-
const
|
|
6355
|
-
this.data.forEach((chunk) => {
|
|
6356
|
-
const chunkBytes = chunk.data;
|
|
6357
|
-
for (let i = 0; i < chunkBytes.length; i += 1) {
|
|
6358
|
-
allBytes.push(chunkBytes[i]);
|
|
6359
|
-
}
|
|
6360
|
-
});
|
|
6335
|
+
const allChunks = this.data.flatMap((chunk) => chunk.data);
|
|
6361
6336
|
const pendingLen = Number(this.pending_word_len.toBigInt());
|
|
6362
|
-
if (pendingLen
|
|
6363
|
-
const
|
|
6364
|
-
const
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
const byteHex = paddedHex.slice(i * 2, i * 2 + 2);
|
|
6368
|
-
if (byteHex.length < 2) {
|
|
6369
|
-
allBytes.push(0);
|
|
6370
|
-
} else {
|
|
6371
|
-
const byteValue = parseInt(byteHex, 16);
|
|
6372
|
-
if (Number.isNaN(byteValue)) {
|
|
6373
|
-
throw new Error(`Invalid hex byte: ${byteHex}`);
|
|
6374
|
-
}
|
|
6375
|
-
allBytes.push(byteValue);
|
|
6376
|
-
}
|
|
6377
|
-
}
|
|
6337
|
+
if (pendingLen) {
|
|
6338
|
+
const pending = new Uint8Array(pendingLen);
|
|
6339
|
+
const paddingDifference = pendingLen - this.pending_word.data.length;
|
|
6340
|
+
pending.set(this.pending_word.data, paddingDifference);
|
|
6341
|
+
allChunks.push(pending);
|
|
6378
6342
|
}
|
|
6379
|
-
return
|
|
6343
|
+
return concatenateArrayBuffer(allChunks);
|
|
6380
6344
|
}
|
|
6381
6345
|
static factoryFromApiResponse(responseIterator) {
|
|
6382
6346
|
const data = Array.from(
|