@wishknish/knishio-client-ts 0.9.2 → 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 CHANGED
@@ -1849,11 +1849,15 @@ function hexToBase64(hexString) {
1849
1849
  try {
1850
1850
  const cleanHex = hexString.replace(/^0x/i, "");
1851
1851
  const bytes = hexStringToBuffer(cleanHex);
1852
- if (typeof btoa !== "undefined") {
1853
- return btoa(String.fromCharCode(...bytes));
1854
- } else {
1852
+ if (typeof Buffer !== "undefined") {
1855
1853
  return Buffer.from(bytes).toString("base64");
1856
1854
  }
1855
+ let binary = "";
1856
+ const CHUNK_SIZE = 32768;
1857
+ for (let i = 0; i < bytes.length; i += CHUNK_SIZE) {
1858
+ binary += String.fromCharCode(...bytes.subarray(i, i + CHUNK_SIZE));
1859
+ }
1860
+ return btoa(binary);
1857
1861
  } catch (error) {
1858
1862
  throw new Error(`Failed to convert hex to base64: ${error instanceof Error ? error.message : String(error)}`);
1859
1863
  }
@@ -3811,11 +3815,26 @@ var Wallet = class _Wallet {
3811
3815
  return new Uint8Array(decryptedContent);
3812
3816
  }
3813
3817
  serializeKey(key) {
3814
- return btoa(String.fromCharCode(...key));
3818
+ if (typeof Buffer !== "undefined") {
3819
+ return Buffer.from(key).toString("base64");
3820
+ }
3821
+ let binary = "";
3822
+ const CHUNK_SIZE = 32768;
3823
+ for (let i = 0; i < key.length; i += CHUNK_SIZE) {
3824
+ binary += String.fromCharCode(...key.subarray(i, i + CHUNK_SIZE));
3825
+ }
3826
+ return btoa(binary);
3815
3827
  }
3816
3828
  deserializeKey(serializedKey) {
3829
+ if (typeof Buffer !== "undefined") {
3830
+ return new Uint8Array(Buffer.from(serializedKey, "base64"));
3831
+ }
3817
3832
  const binaryString = atob(serializedKey);
3818
- return new Uint8Array([...binaryString].map((char) => char.charCodeAt(0)));
3833
+ const bytes = new Uint8Array(binaryString.length);
3834
+ for (let i = 0; i < binaryString.length; i++) {
3835
+ bytes[i] = binaryString.charCodeAt(i);
3836
+ }
3837
+ return bytes;
3819
3838
  }
3820
3839
  };
3821
3840
  var hexStringRegex = /^[0-9a-fA-F]+$/;
@@ -4182,10 +4201,11 @@ function deepCloning(o, h) {
4182
4201
  return r || o;
4183
4202
  }
4184
4203
  function chunkArray(arr, size) {
4185
- if (!arr.length) {
4186
- return [];
4204
+ const chunks = [];
4205
+ for (let i = 0; i < arr.length; i += size) {
4206
+ chunks.push(arr.slice(i, i + size));
4187
4207
  }
4188
- return [arr.slice(0, size)].concat(chunkArray(arr.slice(size), size));
4208
+ return chunks;
4189
4209
  }
4190
4210
  function diff(...arrays) {
4191
4211
  return [].concat(...arrays.map((arr, i) => {
@@ -7013,6 +7033,7 @@ var ValidationChainBuilder = class {
7013
7033
  constructor(service) {
7014
7034
  this.service = service;
7015
7035
  }
7036
+ service;
7016
7037
  validators = [];
7017
7038
  /**
7018
7039
  * Add a schema validation step