@wishknish/knishio-client-ts 0.9.1 → 0.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/dist/index.cjs +28 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +28 -8
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +28 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/Wallet.ts +21 -2
- package/src/libraries/array.ts +6 -4
- package/src/libraries/strings.ts +12 -7
package/dist/index.iife.js
CHANGED
|
@@ -24213,11 +24213,15 @@ ${operationTypes.join("\n")}
|
|
|
24213
24213
|
try {
|
|
24214
24214
|
const cleanHex = hexString.replace(/^0x/i, "");
|
|
24215
24215
|
const bytes = hexStringToBuffer(cleanHex);
|
|
24216
|
-
if (typeof
|
|
24217
|
-
return btoa(String.fromCharCode(...bytes));
|
|
24218
|
-
} else {
|
|
24216
|
+
if (typeof Buffer !== "undefined") {
|
|
24219
24217
|
return Buffer.from(bytes).toString("base64");
|
|
24220
24218
|
}
|
|
24219
|
+
let binary = "";
|
|
24220
|
+
const CHUNK_SIZE = 32768;
|
|
24221
|
+
for (let i4 = 0; i4 < bytes.length; i4 += CHUNK_SIZE) {
|
|
24222
|
+
binary += String.fromCharCode(...bytes.subarray(i4, i4 + CHUNK_SIZE));
|
|
24223
|
+
}
|
|
24224
|
+
return btoa(binary);
|
|
24221
24225
|
} catch (error2) {
|
|
24222
24226
|
throw new Error(`Failed to convert hex to base64: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
24223
24227
|
}
|
|
@@ -27000,11 +27004,26 @@ ${operationTypes.join("\n")}
|
|
|
27000
27004
|
return new Uint8Array(decryptedContent);
|
|
27001
27005
|
}
|
|
27002
27006
|
serializeKey(key) {
|
|
27003
|
-
|
|
27007
|
+
if (typeof Buffer !== "undefined") {
|
|
27008
|
+
return Buffer.from(key).toString("base64");
|
|
27009
|
+
}
|
|
27010
|
+
let binary = "";
|
|
27011
|
+
const CHUNK_SIZE = 32768;
|
|
27012
|
+
for (let i4 = 0; i4 < key.length; i4 += CHUNK_SIZE) {
|
|
27013
|
+
binary += String.fromCharCode(...key.subarray(i4, i4 + CHUNK_SIZE));
|
|
27014
|
+
}
|
|
27015
|
+
return btoa(binary);
|
|
27004
27016
|
}
|
|
27005
27017
|
deserializeKey(serializedKey) {
|
|
27018
|
+
if (typeof Buffer !== "undefined") {
|
|
27019
|
+
return new Uint8Array(Buffer.from(serializedKey, "base64"));
|
|
27020
|
+
}
|
|
27006
27021
|
const binaryString = atob(serializedKey);
|
|
27007
|
-
|
|
27022
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
27023
|
+
for (let i4 = 0; i4 < binaryString.length; i4++) {
|
|
27024
|
+
bytes[i4] = binaryString.charCodeAt(i4);
|
|
27025
|
+
}
|
|
27026
|
+
return bytes;
|
|
27008
27027
|
}
|
|
27009
27028
|
};
|
|
27010
27029
|
|
|
@@ -27374,10 +27393,11 @@ ${operationTypes.join("\n")}
|
|
|
27374
27393
|
return r3 || o3;
|
|
27375
27394
|
}
|
|
27376
27395
|
function chunkArray(arr, size) {
|
|
27377
|
-
|
|
27378
|
-
|
|
27396
|
+
const chunks = [];
|
|
27397
|
+
for (let i4 = 0; i4 < arr.length; i4 += size) {
|
|
27398
|
+
chunks.push(arr.slice(i4, i4 + size));
|
|
27379
27399
|
}
|
|
27380
|
-
return
|
|
27400
|
+
return chunks;
|
|
27381
27401
|
}
|
|
27382
27402
|
function diff(...arrays) {
|
|
27383
27403
|
return [].concat(...arrays.map((arr, i4) => {
|