@net-protocol/storage 0.1.6 → 0.1.8
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/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -655,7 +655,7 @@ function getChunkCount(data) {
|
|
|
655
655
|
const hexWithoutPrefix = dataBytes.slice(2);
|
|
656
656
|
return Math.max(1, Math.ceil(hexWithoutPrefix.length / (CHUNK_SIZE * 2)));
|
|
657
657
|
}
|
|
658
|
-
function assembleChunks(chunks) {
|
|
658
|
+
function assembleChunks(chunks, returnHex) {
|
|
659
659
|
try {
|
|
660
660
|
let assembled = chunks[0] || "0x";
|
|
661
661
|
for (let i = 1; i < chunks.length; i++) {
|
|
@@ -668,6 +668,9 @@ function assembleChunks(chunks) {
|
|
|
668
668
|
try {
|
|
669
669
|
const decompressed = pako.ungzip(bytes);
|
|
670
670
|
const hexString = Buffer.from(decompressed).toString("utf8");
|
|
671
|
+
if (returnHex) {
|
|
672
|
+
return hexString.startsWith("0x") ? hexString : `0x${hexString}`;
|
|
673
|
+
}
|
|
671
674
|
const result = hexToString(hexString);
|
|
672
675
|
return result;
|
|
673
676
|
} catch (error) {
|
|
@@ -1942,9 +1945,7 @@ var StorageClient = class {
|
|
|
1942
1945
|
const transactionConfigs = [];
|
|
1943
1946
|
for (const xmlChunk of params.xmlChunks) {
|
|
1944
1947
|
const chunks = chunkDataForStorage(xmlChunk);
|
|
1945
|
-
const chunkedHash = keccak256HashString(
|
|
1946
|
-
xmlChunk + params.operatorAddress
|
|
1947
|
-
);
|
|
1948
|
+
const chunkedHash = keccak256HashString(xmlChunk);
|
|
1948
1949
|
chunkedStorageHashes.push(chunkedHash);
|
|
1949
1950
|
const config = this.prepareChunkedPut({
|
|
1950
1951
|
key: chunkedHash,
|