neozip-cli 0.70.0-alpha → 0.75.0-beta

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.
@@ -6,9 +6,9 @@ var __commonJS = (cb, mod) => function __require() {
6
6
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
7
7
  };
8
8
 
9
- // neozipkit/dist/core/constants/Errors.js
9
+ // node_modules/neozipkit/dist/core/constants/Errors.js
10
10
  var require_Errors = __commonJS({
11
- "neozipkit/dist/core/constants/Errors.js"(exports2) {
11
+ "node_modules/neozipkit/dist/core/constants/Errors.js"(exports2) {
12
12
  "use strict";
13
13
  Object.defineProperty(exports2, "__esModule", { value: true });
14
14
  exports2.default = {
@@ -73,9 +73,9 @@ var require_Errors = __commonJS({
73
73
  }
74
74
  });
75
75
 
76
- // neozipkit/dist/core/constants/Headers.js
76
+ // node_modules/neozipkit/dist/core/constants/Headers.js
77
77
  var require_Headers = __commonJS({
78
- "neozipkit/dist/core/constants/Headers.js"(exports2) {
78
+ "node_modules/neozipkit/dist/core/constants/Headers.js"(exports2) {
79
79
  "use strict";
80
80
  Object.defineProperty(exports2, "__esModule", { value: true });
81
81
  exports2.DOS_FILE_ATTR = exports2.FILE_SYSTEM = exports2.HDR_ID = exports2.EXTENSIBLE_DATA_FIELDS = exports2.GP_FLAG = exports2.CMP_METHOD = exports2.ZIP64_CENTRAL_END = exports2.ZIP64_CENTRAL_DIR = exports2.CENTRAL_END = exports2.CENTRAL_DIR = exports2.DATA_DESC = exports2.ENCRYPT_HDR_SIZE = exports2.LOCAL_HDR = exports2.TOKENIZED_METADATA = exports2.TIMESTAMP_METADATA = exports2.TIMESTAMP_SUBMITTED = exports2.DATA_DESCRIPTOR = exports2.ZIP64_CENTRAL_DIRECTORY_END = exports2.ZIP64_CENTRAL_DIRECTORY_LOCATOR = exports2.CENTRAL_DIRECTORY_END = exports2.CENTRAL_FILE_HEADER = exports2.LOCAL_FILE_HEADER = void 0;
@@ -382,9 +382,9 @@ var require_Headers = __commonJS({
382
382
  }
383
383
  });
384
384
 
385
- // neozipkit/dist/core/components/Logger.js
385
+ // node_modules/neozipkit/dist/core/components/Logger.js
386
386
  var require_Logger = __commonJS({
387
- "neozipkit/dist/core/components/Logger.js"(exports2) {
387
+ "node_modules/neozipkit/dist/core/components/Logger.js"(exports2) {
388
388
  "use strict";
389
389
  Object.defineProperty(exports2, "__esModule", { value: true });
390
390
  exports2.Logger = void 0;
@@ -530,9 +530,9 @@ var require_Logger = __commonJS({
530
530
  }
531
531
  });
532
532
 
533
- // neozipkit/dist/core/encryption/types.js
533
+ // node_modules/neozipkit/dist/core/encryption/types.js
534
534
  var require_types = __commonJS({
535
- "neozipkit/dist/core/encryption/types.js"(exports2) {
535
+ "node_modules/neozipkit/dist/core/encryption/types.js"(exports2) {
536
536
  "use strict";
537
537
  Object.defineProperty(exports2, "__esModule", { value: true });
538
538
  exports2.EncryptionMethod = void 0;
@@ -544,9 +544,9 @@ var require_types = __commonJS({
544
544
  }
545
545
  });
546
546
 
547
- // neozipkit/dist/core/encryption/ZipCrypto.js
547
+ // node_modules/neozipkit/dist/core/encryption/ZipCrypto.js
548
548
  var require_ZipCrypto = __commonJS({
549
- "neozipkit/dist/core/encryption/ZipCrypto.js"(exports2) {
549
+ "node_modules/neozipkit/dist/core/encryption/ZipCrypto.js"(exports2) {
550
550
  "use strict";
551
551
  Object.defineProperty(exports2, "__esModule", { value: true });
552
552
  exports2.DecryptionStream = exports2.ZipCrypto = void 0;
@@ -1213,9 +1213,9 @@ var require_ZipCrypto = __commonJS({
1213
1213
  }
1214
1214
  });
1215
1215
 
1216
- // neozipkit/dist/core/ZipEntry.js
1216
+ // node_modules/neozipkit/dist/core/ZipEntry.js
1217
1217
  var require_ZipEntry = __commonJS({
1218
- "neozipkit/dist/core/ZipEntry.js"(exports2) {
1218
+ "node_modules/neozipkit/dist/core/ZipEntry.js"(exports2) {
1219
1219
  "use strict";
1220
1220
  var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
1221
1221
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -1283,8 +1283,10 @@ var require_ZipEntry = __commonJS({
1283
1283
  switch (this.platform) {
1284
1284
  case "darwin":
1285
1285
  return Headers_1.FILE_SYSTEM.DARWIN << 8 | VER_ENCODING;
1286
+ // macOS/Darwin
1286
1287
  case "win32":
1287
1288
  return Headers_1.FILE_SYSTEM.NTFS << 8 | VER_ENCODING;
1289
+ // Windows
1288
1290
  default:
1289
1291
  return Headers_1.FILE_SYSTEM.UNIX << 8 | VER_ENCODING;
1290
1292
  }
@@ -1699,10 +1701,13 @@ var require_ZipEntry = __commonJS({
1699
1701
  switch (this.bitFlags & 6) {
1700
1702
  case 0:
1701
1703
  return "Deflate-N";
1704
+ // Deflate Normal
1702
1705
  case 2:
1703
1706
  return "Deflate-M";
1707
+ // Deflate Maximum
1704
1708
  case 4:
1705
1709
  return "Deflate-F";
1710
+ // Deflate Fast
1706
1711
  case 6:
1707
1712
  return "Deflate-S";
1708
1713
  }
@@ -1933,9 +1938,9 @@ var require_ZipEntry = __commonJS({
1933
1938
  }
1934
1939
  });
1935
1940
 
1936
- // neozipkit/dist/types/index.js
1941
+ // node_modules/neozipkit/dist/types/index.js
1937
1942
  var require_types2 = __commonJS({
1938
- "neozipkit/dist/types/index.js"(exports2) {
1943
+ "node_modules/neozipkit/dist/types/index.js"(exports2) {
1939
1944
  "use strict";
1940
1945
  Object.defineProperty(exports2, "__esModule", { value: true });
1941
1946
  exports2.NEOZIPKIT_INFO = exports2.NETWORKS = void 0;
@@ -1972,54 +1977,158 @@ var require_types2 = __commonJS({
1972
1977
  }
1973
1978
  });
1974
1979
 
1975
- // neozipkit/dist/core/components/HashCalculator.js
1980
+ // node_modules/neozipkit/dist/core/ZstdManager.js
1981
+ var require_ZstdManager = __commonJS({
1982
+ "node_modules/neozipkit/dist/core/ZstdManager.js"(exports2) {
1983
+ "use strict";
1984
+ Object.defineProperty(exports2, "__esModule", { value: true });
1985
+ exports2.ZstdManager = void 0;
1986
+ var zstd_js_1 = require("@oneidentity/zstd-js");
1987
+ var ZstdCodecManager = class _ZstdCodecManager {
1988
+ static {
1989
+ __name(this, "ZstdCodecManager");
1990
+ }
1991
+ constructor() {
1992
+ this.codec = null;
1993
+ this.initPromise = null;
1994
+ this.operationQueue = Promise.resolve();
1995
+ }
1996
+ /**
1997
+ * Get the singleton instance of ZstdCodecManager
1998
+ */
1999
+ static getInstance() {
2000
+ if (!_ZstdCodecManager.instance) {
2001
+ _ZstdCodecManager.instance = new _ZstdCodecManager();
2002
+ }
2003
+ return _ZstdCodecManager.instance;
2004
+ }
2005
+ /**
2006
+ * Ensure the Zstd codec is initialized
2007
+ * This is called automatically before any compress/decompress operation
2008
+ */
2009
+ async ensureInitialized() {
2010
+ if (this.codec) {
2011
+ return;
2012
+ }
2013
+ if (this.initPromise) {
2014
+ return this.initPromise;
2015
+ }
2016
+ this.initPromise = (async () => {
2017
+ this.codec = await (0, zstd_js_1.ZstdInit)();
2018
+ })();
2019
+ return this.initPromise;
2020
+ }
2021
+ /**
2022
+ * Queue an operation to ensure sequential execution
2023
+ * This prevents concurrent operations from interfering with each other
2024
+ */
2025
+ async queueOperation(operation) {
2026
+ const promise = this.operationQueue.then(operation, operation);
2027
+ this.operationQueue = promise.catch(() => {
2028
+ });
2029
+ return promise;
2030
+ }
2031
+ /**
2032
+ * Compress data using Zstd
2033
+ * @param data - Data to compress (Uint8Array)
2034
+ * @param level - Compression level (1-22, default 6)
2035
+ * @returns Compressed data as Uint8Array
2036
+ */
2037
+ async compress(data, level = 6) {
2038
+ return this.queueOperation(async () => {
2039
+ await this.ensureInitialized();
2040
+ if (!this.codec) {
2041
+ throw new Error("Zstd codec not initialized");
2042
+ }
2043
+ return this.codec.ZstdSimple.compress(data, level);
2044
+ });
2045
+ }
2046
+ /**
2047
+ * Decompress data using Zstd
2048
+ * @param data - Compressed data (Uint8Array or Buffer)
2049
+ * @returns Decompressed data as Uint8Array
2050
+ */
2051
+ async decompress(data) {
2052
+ return this.queueOperation(async () => {
2053
+ await this.ensureInitialized();
2054
+ if (!this.codec) {
2055
+ throw new Error("Zstd codec not initialized");
2056
+ }
2057
+ const inputData = data instanceof Buffer ? new Uint8Array(data.buffer, data.byteOffset, data.byteLength) : data;
2058
+ return this.codec.ZstdSimple.decompress(inputData);
2059
+ });
2060
+ }
2061
+ /**
2062
+ * Reset the manager (for testing purposes)
2063
+ * @internal
2064
+ */
2065
+ static reset() {
2066
+ _ZstdCodecManager.instance = null;
2067
+ }
2068
+ };
2069
+ ZstdCodecManager.instance = null;
2070
+ exports2.ZstdManager = {
2071
+ /**
2072
+ * Compress data using Zstd
2073
+ * Operations are automatically queued to prevent interference
2074
+ */
2075
+ compress: /* @__PURE__ */ __name((data, level) => ZstdCodecManager.getInstance().compress(data, level), "compress"),
2076
+ /**
2077
+ * Decompress data using Zstd
2078
+ * Operations are automatically queued to prevent interference
2079
+ */
2080
+ decompress: /* @__PURE__ */ __name((data) => ZstdCodecManager.getInstance().decompress(data), "decompress"),
2081
+ /**
2082
+ * Reset the manager (for testing)
2083
+ * @internal
2084
+ */
2085
+ reset: /* @__PURE__ */ __name(() => ZstdCodecManager.reset(), "reset")
2086
+ };
2087
+ exports2.default = exports2.ZstdManager;
2088
+ }
2089
+ });
2090
+
2091
+ // node_modules/neozipkit/dist/core/components/HashCalculator.js
1976
2092
  var require_HashCalculator = __commonJS({
1977
- "neozipkit/dist/core/components/HashCalculator.js"(exports2) {
2093
+ "node_modules/neozipkit/dist/core/components/HashCalculator.js"(exports2) {
1978
2094
  "use strict";
1979
- var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
1980
- if (k2 === void 0)
1981
- k2 = k;
2095
+ var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
2096
+ if (k2 === void 0) k2 = k;
1982
2097
  var desc = Object.getOwnPropertyDescriptor(m, k);
1983
2098
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1984
- desc = { enumerable: true, get: function() {
2099
+ desc = { enumerable: true, get: /* @__PURE__ */ __name(function() {
1985
2100
  return m[k];
1986
- } };
2101
+ }, "get") };
1987
2102
  }
1988
2103
  Object.defineProperty(o, k2, desc);
1989
- } : function(o, m, k, k2) {
1990
- if (k2 === void 0)
1991
- k2 = k;
2104
+ }) : (function(o, m, k, k2) {
2105
+ if (k2 === void 0) k2 = k;
1992
2106
  o[k2] = m[k];
1993
- });
1994
- var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
2107
+ }));
2108
+ var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
1995
2109
  Object.defineProperty(o, "default", { enumerable: true, value: v });
1996
- } : function(o, v) {
2110
+ }) : function(o, v) {
1997
2111
  o["default"] = v;
1998
2112
  });
1999
- var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ function() {
2113
+ var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
2000
2114
  var ownKeys = /* @__PURE__ */ __name(function(o) {
2001
2115
  ownKeys = Object.getOwnPropertyNames || function(o2) {
2002
2116
  var ar = [];
2003
- for (var k in o2)
2004
- if (Object.prototype.hasOwnProperty.call(o2, k))
2005
- ar[ar.length] = k;
2117
+ for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
2006
2118
  return ar;
2007
2119
  };
2008
2120
  return ownKeys(o);
2009
2121
  }, "ownKeys");
2010
2122
  return function(mod) {
2011
- if (mod && mod.__esModule)
2012
- return mod;
2123
+ if (mod && mod.__esModule) return mod;
2013
2124
  var result = {};
2014
2125
  if (mod != null) {
2015
- for (var k = ownKeys(mod), i = 0; i < k.length; i++)
2016
- if (k[i] !== "default")
2017
- __createBinding2(result, mod, k[i]);
2126
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]);
2018
2127
  }
2019
2128
  __setModuleDefault(result, mod);
2020
2129
  return result;
2021
2130
  };
2022
- }();
2131
+ })();
2023
2132
  Object.defineProperty(exports2, "__esModule", { value: true });
2024
2133
  exports2.HashCalculator = void 0;
2025
2134
  var crypto = __importStar(require("crypto"));
@@ -2300,26 +2409,18 @@ var require_HashCalculator = __commonJS({
2300
2409
  }
2301
2410
  });
2302
2411
 
2303
- // neozipkit/dist/core/ZipCompress.js
2412
+ // node_modules/neozipkit/dist/core/ZipCompress.js
2304
2413
  var require_ZipCompress = __commonJS({
2305
- "neozipkit/dist/core/ZipCompress.js"(exports2) {
2414
+ "node_modules/neozipkit/dist/core/ZipCompress.js"(exports2) {
2306
2415
  "use strict";
2307
2416
  Object.defineProperty(exports2, "__esModule", { value: true });
2308
2417
  exports2.ZipCompress = void 0;
2309
2418
  var pako = require("pako");
2310
- var zstd_js_1 = require("@oneidentity/zstd-js");
2419
+ var ZstdManager_1 = require_ZstdManager();
2311
2420
  var Logger_1 = require_Logger();
2312
2421
  var Headers_1 = require_Headers();
2313
2422
  var HashCalculator_1 = require_HashCalculator();
2314
2423
  var ZipCrypto_1 = require_ZipCrypto();
2315
- var zstdCodec = null;
2316
- async function initZstd() {
2317
- if (!zstdCodec) {
2318
- zstdCodec = await (0, zstd_js_1.ZstdInit)();
2319
- }
2320
- return zstdCodec;
2321
- }
2322
- __name(initZstd, "initZstd");
2323
2424
  var ZipCompress = class _ZipCompress {
2324
2425
  static {
2325
2426
  __name(this, "ZipCompress");
@@ -2491,20 +2592,11 @@ var require_ZipCompress = __commonJS({
2491
2592
  if (typeof input === "object" && "totalSize" in input && "readChunk" in input) {
2492
2593
  throw new Error("Chunked reader mode not supported in ZipCompress");
2493
2594
  }
2494
- const zstdCodec2 = await initZstd();
2495
2595
  if (!input || input.length === 0) {
2496
2596
  throw new Error("ZSTD compression: empty input buffer");
2497
2597
  }
2498
2598
  const inputArray = new Uint8Array(input.buffer, input.byteOffset, input.byteLength);
2499
- if (input.length <= effectiveBufferSize) {
2500
- const compressed2 = zstdCodec2.ZstdSimple.compress(inputArray, level);
2501
- const compressedBuffer2 = Buffer.from(compressed2);
2502
- if (onOutputBuffer) {
2503
- await onOutputBuffer(compressedBuffer2);
2504
- }
2505
- return compressedBuffer2;
2506
- }
2507
- const compressed = zstdCodec2.ZstdSimple.compress(inputArray, level);
2599
+ const compressed = await ZstdManager_1.ZstdManager.compress(inputArray, level);
2508
2600
  const compressedBuffer = Buffer.from(compressed);
2509
2601
  if (onOutputBuffer) {
2510
2602
  await onOutputBuffer(compressedBuffer);
@@ -2559,28 +2651,20 @@ var require_ZipCompress = __commonJS({
2559
2651
  }
2560
2652
  });
2561
2653
 
2562
- // neozipkit/dist/core/ZipDecompress.js
2654
+ // node_modules/neozipkit/dist/core/ZipDecompress.js
2563
2655
  var require_ZipDecompress = __commonJS({
2564
- "neozipkit/dist/core/ZipDecompress.js"(exports2) {
2656
+ "node_modules/neozipkit/dist/core/ZipDecompress.js"(exports2) {
2565
2657
  "use strict";
2566
2658
  var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
2567
2659
  return mod && mod.__esModule ? mod : { "default": mod };
2568
2660
  };
2569
2661
  Object.defineProperty(exports2, "__esModule", { value: true });
2570
2662
  var pako = require("pako");
2571
- var zstd_js_1 = require("@oneidentity/zstd-js");
2663
+ var ZstdManager_1 = require_ZstdManager();
2572
2664
  var Logger_1 = require_Logger();
2573
2665
  var Errors_1 = __importDefault2(require_Errors());
2574
2666
  var Headers_1 = require_Headers();
2575
2667
  var ZipCrypto_1 = require_ZipCrypto();
2576
- var zstdCodec = null;
2577
- async function initZstd() {
2578
- if (!zstdCodec) {
2579
- zstdCodec = await (0, zstd_js_1.ZstdInit)();
2580
- }
2581
- return zstdCodec;
2582
- }
2583
- __name(initZstd, "initZstd");
2584
2668
  var ZipDecompress = class _ZipDecompress {
2585
2669
  static {
2586
2670
  __name(this, "ZipDecompress");
@@ -2594,7 +2678,6 @@ var require_ZipDecompress = __commonJS({
2594
2678
  }
2595
2679
  }
2596
2680
  constructor(zipkit) {
2597
- this.zstdCodec = null;
2598
2681
  this.zipkit = zipkit;
2599
2682
  this.debug = false;
2600
2683
  if (_ZipDecompress.loggingEnabled) {
@@ -2612,12 +2695,9 @@ var require_ZipDecompress = __commonJS({
2612
2695
  */
2613
2696
  async extract(entry, skipHashCheck) {
2614
2697
  if (!this.zipkit.hasInBuffer()) {
2615
- throw new Error("extract() requires Buffer-based ZIP. Use ZipkitServer.extractToFile() for file-based ZIP or call loadZip() first.");
2698
+ throw new Error("extract() requires Buffer-based ZIP. Use ZipkitNode.extractToFile() for file-based ZIP or call loadZip() first.");
2616
2699
  }
2617
2700
  this.log(`extract() called for entry: ${entry.filename}, method: ${entry.cmpMethod}, skipHashCheck: ${skipHashCheck}`);
2618
- if (entry.cmpMethod === Headers_1.CMP_METHOD.ZSTD && !this.zstdCodec) {
2619
- this.zstdCodec = await initZstd();
2620
- }
2621
2701
  const buffer = this.zipkit.ensureBuffer();
2622
2702
  let fdata = this.zipkit.parseLocalHeader(entry, buffer);
2623
2703
  if (entry.isEncrypted && this.zipkit?.password) {
@@ -2644,18 +2724,15 @@ var require_ZipDecompress = __commonJS({
2644
2724
  * ZSTD codec is guaranteed to be initialized via factory method
2645
2725
  * Internal method only
2646
2726
  */
2647
- zstdDecompressSync(data) {
2727
+ async zstdDecompressSync(data) {
2648
2728
  this.log(`zstdDecompressSync() called with ${data.length} bytes`);
2649
2729
  try {
2650
- if (!this.zstdCodec) {
2651
- throw new Error("ZSTD codec not initialized.");
2652
- }
2653
- const decompressed = this.zstdCodec.ZstdSimple.decompress(data);
2654
- this.log(`ZSTD synchronous decompression successful: ${data.length} bytes -> ${decompressed.length} bytes`);
2730
+ const decompressed = await ZstdManager_1.ZstdManager.decompress(data);
2731
+ this.log(`ZSTD decompression successful: ${data.length} bytes -> ${decompressed.length} bytes`);
2655
2732
  return Buffer.from(decompressed);
2656
2733
  } catch (error) {
2657
- this.log(`ZSTD synchronous decompression failed: ${error}`);
2658
- throw new Error(`ZSTD synchronous decompression failed: ${error instanceof Error ? error.message : String(error)}`);
2734
+ this.log(`ZSTD decompression failed: ${error}`);
2735
+ throw new Error(`ZSTD decompression failed: ${error instanceof Error ? error.message : String(error)}`);
2659
2736
  }
2660
2737
  }
2661
2738
  /**
@@ -2663,7 +2740,7 @@ var require_ZipDecompress = __commonJS({
2663
2740
  * Handles decompression and hash verification
2664
2741
  * Internal method only
2665
2742
  */
2666
- unCompress(compressedData, entry, skipHashCheck) {
2743
+ async unCompress(compressedData, entry, skipHashCheck) {
2667
2744
  this.log(`unCompress() called for entry: ${entry.filename}, method: ${entry.cmpMethod}, data length: ${compressedData.length}`);
2668
2745
  if (compressedData.length === 0) {
2669
2746
  return Buffer.alloc(0);
@@ -2674,7 +2751,7 @@ var require_ZipDecompress = __commonJS({
2674
2751
  } else if (entry.cmpMethod === Headers_1.CMP_METHOD.DEFLATED) {
2675
2752
  outBuf = this.inflate(compressedData);
2676
2753
  } else if (entry.cmpMethod === Headers_1.CMP_METHOD.ZSTD) {
2677
- outBuf = this.zstdDecompressSync(compressedData);
2754
+ outBuf = await this.zstdDecompressSync(compressedData);
2678
2755
  } else {
2679
2756
  throw new Error(`Unsupported compression method: ${entry.cmpMethod}`);
2680
2757
  }
@@ -2699,9 +2776,9 @@ var require_ZipDecompress = __commonJS({
2699
2776
  }
2700
2777
  });
2701
2778
 
2702
- // neozipkit/dist/core/Zipkit.js
2779
+ // node_modules/neozipkit/dist/core/Zipkit.js
2703
2780
  var require_Zipkit = __commonJS({
2704
- "neozipkit/dist/core/Zipkit.js"(exports2) {
2781
+ "node_modules/neozipkit/dist/core/Zipkit.js"(exports2) {
2705
2782
  "use strict";
2706
2783
  var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
2707
2784
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -2719,51 +2796,51 @@ var require_Zipkit = __commonJS({
2719
2796
  var ZipCrypto_1 = require_ZipCrypto();
2720
2797
  var HashCalculator_1 = __importDefault2(require_HashCalculator());
2721
2798
  var Headers_1 = require_Headers();
2722
- Object.defineProperty(exports2, "LOCAL_HDR", { enumerable: true, get: function() {
2799
+ Object.defineProperty(exports2, "LOCAL_HDR", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2723
2800
  return Headers_1.LOCAL_HDR;
2724
- } });
2725
- Object.defineProperty(exports2, "ENCRYPT_HDR_SIZE", { enumerable: true, get: function() {
2801
+ }, "get") });
2802
+ Object.defineProperty(exports2, "ENCRYPT_HDR_SIZE", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2726
2803
  return Headers_1.ENCRYPT_HDR_SIZE;
2727
- } });
2728
- Object.defineProperty(exports2, "CMP_METHOD", { enumerable: true, get: function() {
2804
+ }, "get") });
2805
+ Object.defineProperty(exports2, "CMP_METHOD", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2729
2806
  return Headers_1.CMP_METHOD;
2730
- } });
2731
- Object.defineProperty(exports2, "CENTRAL_END", { enumerable: true, get: function() {
2807
+ }, "get") });
2808
+ Object.defineProperty(exports2, "CENTRAL_END", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2732
2809
  return Headers_1.CENTRAL_END;
2733
- } });
2734
- Object.defineProperty(exports2, "CENTRAL_DIR", { enumerable: true, get: function() {
2810
+ }, "get") });
2811
+ Object.defineProperty(exports2, "CENTRAL_DIR", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2735
2812
  return Headers_1.CENTRAL_DIR;
2736
- } });
2737
- Object.defineProperty(exports2, "ZIP64_CENTRAL_END", { enumerable: true, get: function() {
2813
+ }, "get") });
2814
+ Object.defineProperty(exports2, "ZIP64_CENTRAL_END", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2738
2815
  return Headers_1.ZIP64_CENTRAL_END;
2739
- } });
2740
- Object.defineProperty(exports2, "ZIP64_CENTRAL_DIR", { enumerable: true, get: function() {
2816
+ }, "get") });
2817
+ Object.defineProperty(exports2, "ZIP64_CENTRAL_DIR", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2741
2818
  return Headers_1.ZIP64_CENTRAL_DIR;
2742
- } });
2743
- Object.defineProperty(exports2, "GP_FLAG", { enumerable: true, get: function() {
2819
+ }, "get") });
2820
+ Object.defineProperty(exports2, "GP_FLAG", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2744
2821
  return Headers_1.GP_FLAG;
2745
- } });
2746
- Object.defineProperty(exports2, "TIMESTAMP_SUBMITTED", { enumerable: true, get: function() {
2822
+ }, "get") });
2823
+ Object.defineProperty(exports2, "TIMESTAMP_SUBMITTED", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2747
2824
  return Headers_1.TIMESTAMP_SUBMITTED;
2748
- } });
2749
- Object.defineProperty(exports2, "TIMESTAMP_METADATA", { enumerable: true, get: function() {
2825
+ }, "get") });
2826
+ Object.defineProperty(exports2, "TIMESTAMP_METADATA", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2750
2827
  return Headers_1.TIMESTAMP_METADATA;
2751
- } });
2752
- Object.defineProperty(exports2, "TOKENIZED_METADATA", { enumerable: true, get: function() {
2828
+ }, "get") });
2829
+ Object.defineProperty(exports2, "TOKENIZED_METADATA", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2753
2830
  return Headers_1.TOKENIZED_METADATA;
2754
- } });
2755
- Object.defineProperty(exports2, "LOCAL_FILE_HEADER", { enumerable: true, get: function() {
2831
+ }, "get") });
2832
+ Object.defineProperty(exports2, "LOCAL_FILE_HEADER", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2756
2833
  return Headers_1.LOCAL_FILE_HEADER;
2757
- } });
2758
- Object.defineProperty(exports2, "CENTRAL_FILE_HEADER", { enumerable: true, get: function() {
2834
+ }, "get") });
2835
+ Object.defineProperty(exports2, "CENTRAL_FILE_HEADER", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2759
2836
  return Headers_1.CENTRAL_FILE_HEADER;
2760
- } });
2761
- Object.defineProperty(exports2, "CENTRAL_DIRECTORY_END", { enumerable: true, get: function() {
2837
+ }, "get") });
2838
+ Object.defineProperty(exports2, "CENTRAL_DIRECTORY_END", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2762
2839
  return Headers_1.CENTRAL_DIRECTORY_END;
2763
- } });
2764
- Object.defineProperty(exports2, "HDR_ID", { enumerable: true, get: function() {
2840
+ }, "get") });
2841
+ Object.defineProperty(exports2, "HDR_ID", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2765
2842
  return Headers_1.HDR_ID;
2766
- } });
2843
+ }, "get") });
2767
2844
  var Zipkit = class {
2768
2845
  static {
2769
2846
  __name(this, "Zipkit");
@@ -3310,9 +3387,9 @@ var require_Zipkit = __commonJS({
3310
3387
  }
3311
3388
  });
3312
3389
 
3313
- // neozipkit/dist/core/components/Support.js
3390
+ // node_modules/neozipkit/dist/core/components/Support.js
3314
3391
  var require_Support = __commonJS({
3315
- "neozipkit/dist/core/components/Support.js"(exports2) {
3392
+ "node_modules/neozipkit/dist/core/components/Support.js"(exports2) {
3316
3393
  "use strict";
3317
3394
  Object.defineProperty(exports2, "__esModule", { value: true });
3318
3395
  var Support = {
@@ -3365,9 +3442,9 @@ var require_Support = __commonJS({
3365
3442
  }
3366
3443
  });
3367
3444
 
3368
- // neozipkit/dist/core/components/Util.js
3445
+ // node_modules/neozipkit/dist/core/components/Util.js
3369
3446
  var require_Util = __commonJS({
3370
- "neozipkit/dist/core/components/Util.js"(exports2) {
3447
+ "node_modules/neozipkit/dist/core/components/Util.js"(exports2) {
3371
3448
  "use strict";
3372
3449
  var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
3373
3450
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -3441,9 +3518,9 @@ var require_Util = __commonJS({
3441
3518
  }
3442
3519
  });
3443
3520
 
3444
- // neozipkit/dist/core/components/ProgressTracker.js
3521
+ // node_modules/neozipkit/dist/core/components/ProgressTracker.js
3445
3522
  var require_ProgressTracker = __commonJS({
3446
- "neozipkit/dist/core/components/ProgressTracker.js"(exports2) {
3523
+ "node_modules/neozipkit/dist/core/components/ProgressTracker.js"(exports2) {
3447
3524
  "use strict";
3448
3525
  Object.defineProperty(exports2, "__esModule", { value: true });
3449
3526
  exports2.ProgressTracker = void 0;
@@ -3549,9 +3626,9 @@ var require_ProgressTracker = __commonJS({
3549
3626
  }
3550
3627
  });
3551
3628
 
3552
- // neozipkit/dist/core/encryption/Manager.js
3629
+ // node_modules/neozipkit/dist/core/encryption/Manager.js
3553
3630
  var require_Manager = __commonJS({
3554
- "neozipkit/dist/core/encryption/Manager.js"(exports2) {
3631
+ "node_modules/neozipkit/dist/core/encryption/Manager.js"(exports2) {
3555
3632
  "use strict";
3556
3633
  Object.defineProperty(exports2, "__esModule", { value: true });
3557
3634
  exports2.EncryptionManager = void 0;
@@ -3672,45 +3749,41 @@ var require_Manager = __commonJS({
3672
3749
  }
3673
3750
  });
3674
3751
 
3675
- // neozipkit/dist/core/version.js
3752
+ // node_modules/neozipkit/dist/core/version.js
3676
3753
  var require_version = __commonJS({
3677
- "neozipkit/dist/core/version.js"(exports2) {
3754
+ "node_modules/neozipkit/dist/core/version.js"(exports2) {
3678
3755
  "use strict";
3679
3756
  Object.defineProperty(exports2, "__esModule", { value: true });
3680
3757
  exports2.VERSION = void 0;
3681
3758
  var currentDate = /* @__PURE__ */ new Date();
3682
3759
  var releaseDate = `${String(currentDate.getMonth() + 1).padStart(2, "0")}-${String(currentDate.getDate()).padStart(2, "0")}-${currentDate.getFullYear()}`;
3683
3760
  exports2.VERSION = {
3684
- number: "0.3.0",
3761
+ number: "0.3.1",
3685
3762
  // packageJson.version,
3686
3763
  date: releaseDate
3687
3764
  };
3688
3765
  }
3689
3766
  });
3690
3767
 
3691
- // neozipkit/dist/core/index.js
3768
+ // node_modules/neozipkit/dist/core/index.js
3692
3769
  var require_core = __commonJS({
3693
- "neozipkit/dist/core/index.js"(exports2) {
3770
+ "node_modules/neozipkit/dist/core/index.js"(exports2) {
3694
3771
  "use strict";
3695
- var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
3696
- if (k2 === void 0)
3697
- k2 = k;
3772
+ var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
3773
+ if (k2 === void 0) k2 = k;
3698
3774
  var desc = Object.getOwnPropertyDescriptor(m, k);
3699
3775
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3700
- desc = { enumerable: true, get: function() {
3776
+ desc = { enumerable: true, get: /* @__PURE__ */ __name(function() {
3701
3777
  return m[k];
3702
- } };
3778
+ }, "get") };
3703
3779
  }
3704
3780
  Object.defineProperty(o, k2, desc);
3705
- } : function(o, m, k, k2) {
3706
- if (k2 === void 0)
3707
- k2 = k;
3781
+ }) : (function(o, m, k, k2) {
3782
+ if (k2 === void 0) k2 = k;
3708
3783
  o[k2] = m[k];
3709
- });
3784
+ }));
3710
3785
  var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) {
3711
- for (var p in m)
3712
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
3713
- __createBinding2(exports3, m, p);
3786
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p);
3714
3787
  };
3715
3788
  var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
3716
3789
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -3721,106 +3794,97 @@ var require_core = __commonJS({
3721
3794
  __exportStar2(require_Zipkit(), exports2);
3722
3795
  __exportStar2(require_ZipEntry(), exports2);
3723
3796
  var ZipCompress_1 = require_ZipCompress();
3724
- Object.defineProperty(exports2, "ZipCompress", { enumerable: true, get: function() {
3797
+ Object.defineProperty(exports2, "ZipCompress", { enumerable: true, get: /* @__PURE__ */ __name(function() {
3725
3798
  return ZipCompress_1.ZipCompress;
3726
- } });
3799
+ }, "get") });
3727
3800
  exports2.default = Zipkit_1.default;
3728
3801
  var HashCalculator_1 = require_HashCalculator();
3729
- Object.defineProperty(exports2, "HashCalculator", { enumerable: true, get: function() {
3802
+ Object.defineProperty(exports2, "HashCalculator", { enumerable: true, get: /* @__PURE__ */ __name(function() {
3730
3803
  return __importDefault2(HashCalculator_1).default;
3731
- } });
3732
- Object.defineProperty(exports2, "HashCalculatorClass", { enumerable: true, get: function() {
3804
+ }, "get") });
3805
+ Object.defineProperty(exports2, "HashCalculatorClass", { enumerable: true, get: /* @__PURE__ */ __name(function() {
3733
3806
  return HashCalculator_1.HashCalculator;
3734
- } });
3807
+ }, "get") });
3735
3808
  __exportStar2(require_Util(), exports2);
3736
3809
  __exportStar2(require_Support(), exports2);
3737
3810
  var ProgressTracker_1 = require_ProgressTracker();
3738
- Object.defineProperty(exports2, "ProgressTracker", { enumerable: true, get: function() {
3811
+ Object.defineProperty(exports2, "ProgressTracker", { enumerable: true, get: /* @__PURE__ */ __name(function() {
3739
3812
  return ProgressTracker_1.ProgressTracker;
3740
- } });
3813
+ }, "get") });
3741
3814
  var Manager_1 = require_Manager();
3742
- Object.defineProperty(exports2, "EncryptionManager", { enumerable: true, get: function() {
3815
+ Object.defineProperty(exports2, "EncryptionManager", { enumerable: true, get: /* @__PURE__ */ __name(function() {
3743
3816
  return Manager_1.EncryptionManager;
3744
- } });
3817
+ }, "get") });
3745
3818
  var ZipCrypto_1 = require_ZipCrypto();
3746
- Object.defineProperty(exports2, "ZipCrypto", { enumerable: true, get: function() {
3819
+ Object.defineProperty(exports2, "ZipCrypto", { enumerable: true, get: /* @__PURE__ */ __name(function() {
3747
3820
  return ZipCrypto_1.ZipCrypto;
3748
- } });
3749
- Object.defineProperty(exports2, "crc32", { enumerable: true, get: function() {
3821
+ }, "get") });
3822
+ Object.defineProperty(exports2, "crc32", { enumerable: true, get: /* @__PURE__ */ __name(function() {
3750
3823
  return ZipCrypto_1.crc32;
3751
- } });
3752
- Object.defineProperty(exports2, "crc32update", { enumerable: true, get: function() {
3824
+ }, "get") });
3825
+ Object.defineProperty(exports2, "crc32update", { enumerable: true, get: /* @__PURE__ */ __name(function() {
3753
3826
  return ZipCrypto_1.crc32update;
3754
- } });
3755
- Object.defineProperty(exports2, "sha256", { enumerable: true, get: function() {
3827
+ }, "get") });
3828
+ Object.defineProperty(exports2, "sha256", { enumerable: true, get: /* @__PURE__ */ __name(function() {
3756
3829
  return ZipCrypto_1.sha256;
3757
- } });
3830
+ }, "get") });
3758
3831
  __exportStar2(require_types2(), exports2);
3759
3832
  __exportStar2(require_Headers(), exports2);
3760
3833
  __exportStar2(require_Errors(), exports2);
3761
3834
  __exportStar2(require_version(), exports2);
3762
3835
  var Logger_1 = require_Logger();
3763
- Object.defineProperty(exports2, "Logger", { enumerable: true, get: function() {
3836
+ Object.defineProperty(exports2, "Logger", { enumerable: true, get: /* @__PURE__ */ __name(function() {
3764
3837
  return Logger_1.Logger;
3765
- } });
3766
- Object.defineProperty(exports2, "configureLoggerFromEnvironment", { enumerable: true, get: function() {
3838
+ }, "get") });
3839
+ Object.defineProperty(exports2, "configureLoggerFromEnvironment", { enumerable: true, get: /* @__PURE__ */ __name(function() {
3767
3840
  return Logger_1.configureLoggerFromEnvironment;
3768
- } });
3841
+ }, "get") });
3769
3842
  }
3770
3843
  });
3771
3844
 
3772
- // neozipkit/dist/browser/ZipkitBrowser.js
3845
+ // node_modules/neozipkit/dist/browser/ZipkitBrowser.js
3773
3846
  var require_ZipkitBrowser = __commonJS({
3774
- "neozipkit/dist/browser/ZipkitBrowser.js"(exports2) {
3847
+ "node_modules/neozipkit/dist/browser/ZipkitBrowser.js"(exports2) {
3775
3848
  "use strict";
3776
- var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
3777
- if (k2 === void 0)
3778
- k2 = k;
3849
+ var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
3850
+ if (k2 === void 0) k2 = k;
3779
3851
  var desc = Object.getOwnPropertyDescriptor(m, k);
3780
3852
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3781
- desc = { enumerable: true, get: function() {
3853
+ desc = { enumerable: true, get: /* @__PURE__ */ __name(function() {
3782
3854
  return m[k];
3783
- } };
3855
+ }, "get") };
3784
3856
  }
3785
3857
  Object.defineProperty(o, k2, desc);
3786
- } : function(o, m, k, k2) {
3787
- if (k2 === void 0)
3788
- k2 = k;
3858
+ }) : (function(o, m, k, k2) {
3859
+ if (k2 === void 0) k2 = k;
3789
3860
  o[k2] = m[k];
3790
- });
3791
- var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
3861
+ }));
3862
+ var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
3792
3863
  Object.defineProperty(o, "default", { enumerable: true, value: v });
3793
- } : function(o, v) {
3864
+ }) : function(o, v) {
3794
3865
  o["default"] = v;
3795
3866
  });
3796
- var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ function() {
3867
+ var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
3797
3868
  var ownKeys = /* @__PURE__ */ __name(function(o) {
3798
3869
  ownKeys = Object.getOwnPropertyNames || function(o2) {
3799
3870
  var ar = [];
3800
- for (var k in o2)
3801
- if (Object.prototype.hasOwnProperty.call(o2, k))
3802
- ar[ar.length] = k;
3871
+ for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
3803
3872
  return ar;
3804
3873
  };
3805
3874
  return ownKeys(o);
3806
3875
  }, "ownKeys");
3807
3876
  return function(mod) {
3808
- if (mod && mod.__esModule)
3809
- return mod;
3877
+ if (mod && mod.__esModule) return mod;
3810
3878
  var result = {};
3811
3879
  if (mod != null) {
3812
- for (var k = ownKeys(mod), i = 0; i < k.length; i++)
3813
- if (k[i] !== "default")
3814
- __createBinding2(result, mod, k[i]);
3880
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]);
3815
3881
  }
3816
3882
  __setModuleDefault(result, mod);
3817
3883
  return result;
3818
3884
  };
3819
- }();
3885
+ })();
3820
3886
  var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) {
3821
- for (var p in m)
3822
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
3823
- __createBinding2(exports3, m, p);
3887
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p);
3824
3888
  };
3825
3889
  var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
3826
3890
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -3836,13 +3900,13 @@ var require_ZipkitBrowser = __commonJS({
3836
3900
  exports2.Headers = Headers;
3837
3901
  var Headers_1 = require_Headers();
3838
3902
  var ZipCrypto_1 = require_ZipCrypto();
3839
- Object.defineProperty(exports2, "sha256", { enumerable: true, get: function() {
3903
+ Object.defineProperty(exports2, "sha256", { enumerable: true, get: /* @__PURE__ */ __name(function() {
3840
3904
  return ZipCrypto_1.sha256;
3841
- } });
3905
+ }, "get") });
3842
3906
  var Util_1 = require_Util();
3843
- Object.defineProperty(exports2, "getTypeOf", { enumerable: true, get: function() {
3907
+ Object.defineProperty(exports2, "getTypeOf", { enumerable: true, get: /* @__PURE__ */ __name(function() {
3844
3908
  return Util_1.getTypeOf;
3845
- } });
3909
+ }, "get") });
3846
3910
  __exportStar2(require_core(), exports2);
3847
3911
  var ZipkitBrowser = class extends core_12.default {
3848
3912
  static {
@@ -4025,14 +4089,36 @@ var require_ZipkitBrowser = __commonJS({
4025
4089
  isMetadataFile(filename) {
4026
4090
  return filename === Headers_1.TIMESTAMP_SUBMITTED || filename === Headers_1.TIMESTAMP_METADATA || filename === Headers_1.TOKENIZED_METADATA;
4027
4091
  }
4092
+ // --------------------------------------
4093
+ // Helper method: Add a file to the ZIP with compression
4094
+ // Simplifies the common workflow of creating entry + compressing
4095
+ async addFile(file, options) {
4096
+ const entry = this.createZipFileEntry(file);
4097
+ const fileBlob = file;
4098
+ const compressedData = await this.compressDataBlob(entry, fileBlob, options);
4099
+ entry.cmpData = compressedData;
4100
+ return entry;
4101
+ }
4102
+ // --------------------------------------
4103
+ // Verify a ZIP entry by attempting to extract it
4104
+ // Returns true if the entry is valid, false otherwise
4105
+ async verifyEntry(entry, skipHashCheck) {
4106
+ try {
4107
+ const blob = await this.extractBlob(entry, skipHashCheck);
4108
+ return blob !== null;
4109
+ } catch (error) {
4110
+ console.error(`Verification failed for ${entry.filename}:`, error);
4111
+ return false;
4112
+ }
4113
+ }
4028
4114
  };
4029
4115
  exports2.default = ZipkitBrowser;
4030
4116
  }
4031
4117
  });
4032
4118
 
4033
- // neozipkit/dist/blockchain/core/WalletManager.js
4119
+ // node_modules/neozipkit/dist/blockchain/core/WalletManager.js
4034
4120
  var require_WalletManager = __commonJS({
4035
- "neozipkit/dist/blockchain/core/WalletManager.js"(exports2) {
4121
+ "node_modules/neozipkit/dist/blockchain/core/WalletManager.js"(exports2) {
4036
4122
  "use strict";
4037
4123
  Object.defineProperty(exports2, "__esModule", { value: true });
4038
4124
  exports2.WalletAnalyzer = exports2.CoreWalletManager = void 0;
@@ -4070,6 +4156,13 @@ var require_WalletManager = __commonJS({
4070
4156
  }
4071
4157
  /**
4072
4158
  * Setup wallet with private key and connect to network
4159
+ *
4160
+ * SECURITY WARNING: This method accepts a private key as a parameter.
4161
+ * - Never hardcode private keys in source code
4162
+ * - Always use environment variables for private keys
4163
+ * - Use testnet keys for development/testing
4164
+ * - Use secure key management (HSMs, KMS) for production
4165
+ * - See SECURITY.md for complete security guidelines
4073
4166
  */
4074
4167
  async setupWallet(privateKey, network, mintToken = false) {
4075
4168
  try {
@@ -4387,9 +4480,286 @@ var require_WalletManager = __commonJS({
4387
4480
  }
4388
4481
  });
4389
4482
 
4390
- // neozipkit/dist/blockchain/core/contracts.js
4483
+ // node_modules/neozipkit/dist/blockchain/core/ContractVersionRegistry.js
4484
+ var require_ContractVersionRegistry = __commonJS({
4485
+ "node_modules/neozipkit/dist/blockchain/core/ContractVersionRegistry.js"(exports2) {
4486
+ "use strict";
4487
+ Object.defineProperty(exports2, "__esModule", { value: true });
4488
+ exports2.IMPLEMENTED_VERSIONS = exports2.VERSION_REGISTRY = void 0;
4489
+ exports2.getVersionCapabilities = getVersionCapabilities;
4490
+ exports2.isVersionSupported = isVersionSupported;
4491
+ exports2.normalizeVersion = normalizeVersion;
4492
+ exports2.getSupportedVersions = getSupportedVersions;
4493
+ exports2.VERSION_REGISTRY = {
4494
+ "2.0": {
4495
+ supportsEncryptedHash: false,
4496
+ supportsFileName: true,
4497
+ getZipFileInfoFields: ["fileName", "merkleRootHash", "ipfsHash", "creator", "creationTimestamp", "tokenizationTime", "blockNumber"],
4498
+ publicMintZipFileSignature: "v2.0",
4499
+ hasGetVersion: true,
4500
+ additionalFunctions: []
4501
+ },
4502
+ "2.10": {
4503
+ supportsEncryptedHash: false,
4504
+ supportsFileName: false,
4505
+ getZipFileInfoFields: ["merkleRootHash", "ipfsHash", "creator", "creationTimestamp", "tokenizationTime", "blockNumber"],
4506
+ publicMintZipFileSignature: "v2.10",
4507
+ hasGetVersion: true,
4508
+ additionalFunctions: []
4509
+ },
4510
+ "2.11": {
4511
+ supportsEncryptedHash: true,
4512
+ supportsFileName: false,
4513
+ getZipFileInfoFields: ["merkleRootHash", "encryptedHash", "ipfsHash", "creator", "creationTimestamp", "tokenizationTime", "blockNumber"],
4514
+ publicMintZipFileSignature: "v2.11",
4515
+ hasGetVersion: true,
4516
+ additionalFunctions: ["getEncryptedHash", "verifyEncryptedZipFile"]
4517
+ }
4518
+ };
4519
+ function getVersionCapabilities(version) {
4520
+ const normalizedVersion = normalizeVersion(version);
4521
+ if (normalizedVersion in exports2.VERSION_REGISTRY) {
4522
+ return exports2.VERSION_REGISTRY[normalizedVersion];
4523
+ }
4524
+ return null;
4525
+ }
4526
+ __name(getVersionCapabilities, "getVersionCapabilities");
4527
+ exports2.IMPLEMENTED_VERSIONS = ["2.10", "2.11"];
4528
+ function isVersionSupported(version) {
4529
+ const normalized = normalizeVersion(version);
4530
+ if (!normalized) {
4531
+ return false;
4532
+ }
4533
+ return getVersionCapabilities(normalized) !== null && exports2.IMPLEMENTED_VERSIONS.includes(normalized);
4534
+ }
4535
+ __name(isVersionSupported, "isVersionSupported");
4536
+ function normalizeVersion(version) {
4537
+ if (!version || version === "unknown" || version.trim() === "") {
4538
+ return "";
4539
+ }
4540
+ const parts = version.split(".");
4541
+ if (parts.length >= 2) {
4542
+ return `${parts[0]}.${parts[1]}`;
4543
+ }
4544
+ return version;
4545
+ }
4546
+ __name(normalizeVersion, "normalizeVersion");
4547
+ function getSupportedVersions() {
4548
+ return Object.keys(exports2.VERSION_REGISTRY);
4549
+ }
4550
+ __name(getSupportedVersions, "getSupportedVersions");
4551
+ }
4552
+ });
4553
+
4554
+ // node_modules/neozipkit/dist/blockchain/core/adapters/V2_10Adapter.js
4555
+ var require_V2_10Adapter = __commonJS({
4556
+ "node_modules/neozipkit/dist/blockchain/core/adapters/V2_10Adapter.js"(exports2) {
4557
+ "use strict";
4558
+ Object.defineProperty(exports2, "__esModule", { value: true });
4559
+ exports2.V2_10Adapter = void 0;
4560
+ var ethers_1 = require("ethers");
4561
+ var V2_10_ABI = [
4562
+ "function publicMintZipFile(string memory merkleRootHash, uint256 creationTimestamp, string memory ipfsHash, string memory metadataURI) public returns (uint256)",
4563
+ "function getZipFileInfo(uint256 tokenId) external view returns (tuple(string merkleRootHash, string ipfsHash, address creator, uint256 creationTimestamp, uint256 tokenizationTime, uint256 blockNumber))",
4564
+ "event ZipFileTokenized(uint256 indexed tokenId, address indexed creator, string merkleRootHash, uint256 creationTimestamp, string ipfsHash, uint256 tokenizationTime, uint256 blockNumber)"
4565
+ ];
4566
+ var iface = new ethers_1.Interface(V2_10_ABI);
4567
+ var V2_10Adapter = class {
4568
+ static {
4569
+ __name(this, "V2_10Adapter");
4570
+ }
4571
+ constructor() {
4572
+ this.version = "2.10";
4573
+ }
4574
+ async mintZipFile(contract, merkleRoot, encryptedHash, creationTimestamp, ipfsHash, metadataURI, gasOptions) {
4575
+ if (encryptedHash) {
4576
+ console.warn("[V2_10Adapter] encryptedHash provided but v2.10 contract does not support it - ignoring");
4577
+ }
4578
+ const contractTyped = contract;
4579
+ const args = [
4580
+ merkleRoot,
4581
+ creationTimestamp,
4582
+ ipfsHash,
4583
+ metadataURI
4584
+ ];
4585
+ if (gasOptions) {
4586
+ return await contractTyped.publicMintZipFile(...args, gasOptions);
4587
+ }
4588
+ return await contractTyped.publicMintZipFile(...args);
4589
+ }
4590
+ async getZipFileInfo(contract, tokenId) {
4591
+ const contractTyped = contract;
4592
+ const runner = contractTyped.runner || contractTyped.provider;
4593
+ const adapterContract = new ethers_1.Contract(contractTyped.target, V2_10_ABI, runner);
4594
+ const result = await adapterContract.getZipFileInfo(tokenId);
4595
+ return {
4596
+ merkleRootHash: result[0],
4597
+ ipfsHash: result[1],
4598
+ creator: result[2],
4599
+ creationTimestamp: result[3],
4600
+ tokenizationTime: result[4],
4601
+ blockNumber: result[5]
4602
+ // encryptedHash and fileName not available in v2.10
4603
+ };
4604
+ }
4605
+ parseZipFileTokenizedEvent(log) {
4606
+ const parsed = iface.parseLog({
4607
+ topics: log.topics,
4608
+ data: log.data
4609
+ });
4610
+ if (!parsed || parsed.name !== "ZipFileTokenized") {
4611
+ throw new Error("Invalid ZipFileTokenized event");
4612
+ }
4613
+ return {
4614
+ tokenId: parsed.args.tokenId,
4615
+ creator: parsed.args.creator,
4616
+ merkleRootHash: parsed.args.merkleRootHash,
4617
+ creationTimestamp: parsed.args.creationTimestamp,
4618
+ ipfsHash: parsed.args.ipfsHash,
4619
+ tokenizationTime: parsed.args.tokenizationTime,
4620
+ blockNumber: parsed.args.blockNumber
4621
+ // encryptedHash and fileName not in v2.10 event
4622
+ };
4623
+ }
4624
+ async estimateGasForMint(contract, merkleRoot, encryptedHash, creationTimestamp, ipfsHash, metadataURI) {
4625
+ const contractTyped = contract;
4626
+ return await contractTyped.publicMintZipFile.estimateGas(merkleRoot, creationTimestamp, ipfsHash, metadataURI);
4627
+ }
4628
+ };
4629
+ exports2.V2_10Adapter = V2_10Adapter;
4630
+ }
4631
+ });
4632
+
4633
+ // node_modules/neozipkit/dist/blockchain/core/adapters/V2_11Adapter.js
4634
+ var require_V2_11Adapter = __commonJS({
4635
+ "node_modules/neozipkit/dist/blockchain/core/adapters/V2_11Adapter.js"(exports2) {
4636
+ "use strict";
4637
+ Object.defineProperty(exports2, "__esModule", { value: true });
4638
+ exports2.V2_11Adapter = void 0;
4639
+ var ethers_1 = require("ethers");
4640
+ var V2_11_ABI = [
4641
+ "function publicMintZipFile(string memory merkleRootHash, string memory encryptedHash, uint256 creationTimestamp, string memory ipfsHash, string memory metadataURI) public returns (uint256)",
4642
+ "function getZipFileInfo(uint256 tokenId) external view returns (tuple(string merkleRootHash, string encryptedHash, string ipfsHash, address creator, uint256 creationTimestamp, uint256 tokenizationTime, uint256 blockNumber))",
4643
+ "event ZipFileTokenized(uint256 indexed tokenId, address indexed creator, string merkleRootHash, string encryptedHash, uint256 creationTimestamp, string ipfsHash, uint256 tokenizationTime, uint256 blockNumber)"
4644
+ ];
4645
+ var iface = new ethers_1.Interface(V2_11_ABI);
4646
+ var V2_11Adapter = class {
4647
+ static {
4648
+ __name(this, "V2_11Adapter");
4649
+ }
4650
+ constructor() {
4651
+ this.version = "2.11";
4652
+ }
4653
+ async mintZipFile(contract, merkleRoot, encryptedHash, creationTimestamp, ipfsHash, metadataURI, gasOptions) {
4654
+ const contractTyped = contract;
4655
+ const args = [
4656
+ merkleRoot,
4657
+ encryptedHash || "",
4658
+ creationTimestamp,
4659
+ ipfsHash,
4660
+ metadataURI
4661
+ ];
4662
+ if (gasOptions) {
4663
+ return await contractTyped.publicMintZipFile(...args, gasOptions);
4664
+ }
4665
+ return await contractTyped.publicMintZipFile(...args);
4666
+ }
4667
+ async getZipFileInfo(contract, tokenId) {
4668
+ const contractTyped = contract;
4669
+ const runner = contractTyped.runner || contractTyped.provider;
4670
+ const adapterContract = new ethers_1.Contract(contractTyped.target, V2_11_ABI, runner);
4671
+ const result = await adapterContract.getZipFileInfo(tokenId);
4672
+ return {
4673
+ merkleRootHash: result[0],
4674
+ encryptedHash: result[1] || void 0,
4675
+ // May be empty string
4676
+ ipfsHash: result[2],
4677
+ creator: result[3],
4678
+ creationTimestamp: result[4],
4679
+ tokenizationTime: result[5],
4680
+ blockNumber: result[6]
4681
+ // fileName not available in v2.11
4682
+ };
4683
+ }
4684
+ parseZipFileTokenizedEvent(log) {
4685
+ const parsed = iface.parseLog({
4686
+ topics: log.topics,
4687
+ data: log.data
4688
+ });
4689
+ if (!parsed || parsed.name !== "ZipFileTokenized") {
4690
+ throw new Error("Invalid ZipFileTokenized event");
4691
+ }
4692
+ return {
4693
+ tokenId: parsed.args.tokenId,
4694
+ creator: parsed.args.creator,
4695
+ merkleRootHash: parsed.args.merkleRootHash,
4696
+ encryptedHash: parsed.args.encryptedHash || void 0,
4697
+ // May be empty string
4698
+ creationTimestamp: parsed.args.creationTimestamp,
4699
+ ipfsHash: parsed.args.ipfsHash,
4700
+ tokenizationTime: parsed.args.tokenizationTime,
4701
+ blockNumber: parsed.args.blockNumber
4702
+ // fileName not in v2.11 event
4703
+ };
4704
+ }
4705
+ async estimateGasForMint(contract, merkleRoot, encryptedHash, creationTimestamp, ipfsHash, metadataURI) {
4706
+ const contractTyped = contract;
4707
+ return await contractTyped.publicMintZipFile.estimateGas(merkleRoot, encryptedHash || "", creationTimestamp, ipfsHash, metadataURI);
4708
+ }
4709
+ };
4710
+ exports2.V2_11Adapter = V2_11Adapter;
4711
+ }
4712
+ });
4713
+
4714
+ // node_modules/neozipkit/dist/blockchain/core/adapters/AdapterFactory.js
4715
+ var require_AdapterFactory = __commonJS({
4716
+ "node_modules/neozipkit/dist/blockchain/core/adapters/AdapterFactory.js"(exports2) {
4717
+ "use strict";
4718
+ Object.defineProperty(exports2, "__esModule", { value: true });
4719
+ exports2.getAdapter = getAdapter;
4720
+ exports2.getAdapterByChainId = getAdapterByChainId;
4721
+ var ContractVersionRegistry_1 = require_ContractVersionRegistry();
4722
+ var V2_10Adapter_1 = require_V2_10Adapter();
4723
+ var V2_11Adapter_1 = require_V2_11Adapter();
4724
+ function getAdapter(version) {
4725
+ const normalized = (0, ContractVersionRegistry_1.normalizeVersion)(version);
4726
+ if (!normalized) {
4727
+ throw new Error(`Invalid contract version: "${version}" (normalized to empty string)`);
4728
+ }
4729
+ if (!(0, ContractVersionRegistry_1.isVersionSupported)(normalized)) {
4730
+ throw new Error(`Unsupported contract version: "${version}" (normalized: "${normalized}"). Supported versions: 2.10, 2.11`);
4731
+ }
4732
+ switch (normalized) {
4733
+ case "2.10":
4734
+ return new V2_10Adapter_1.V2_10Adapter();
4735
+ case "2.11":
4736
+ return new V2_11Adapter_1.V2_11Adapter();
4737
+ default:
4738
+ throw new Error(`Unsupported contract version: "${version}" (normalized: "${normalized}"). Supported versions: 2.10, 2.11`);
4739
+ }
4740
+ }
4741
+ __name(getAdapter, "getAdapter");
4742
+ function getAdapterByChainId(chainId, version) {
4743
+ if (version) {
4744
+ return getAdapter(version);
4745
+ }
4746
+ const { getContractConfig } = require_contracts();
4747
+ const config = getContractConfig(chainId);
4748
+ if (!config) {
4749
+ throw new Error(`No contract config found for chainId: ${chainId}`);
4750
+ }
4751
+ if (!config.version) {
4752
+ throw new Error(`Contract version not specified for chainId: ${chainId}`);
4753
+ }
4754
+ return getAdapter(config.version);
4755
+ }
4756
+ __name(getAdapterByChainId, "getAdapterByChainId");
4757
+ }
4758
+ });
4759
+
4760
+ // node_modules/neozipkit/dist/blockchain/core/contracts.js
4391
4761
  var require_contracts = __commonJS({
4392
- "neozipkit/dist/blockchain/core/contracts.js"(exports2) {
4762
+ "node_modules/neozipkit/dist/blockchain/core/contracts.js"(exports2) {
4393
4763
  "use strict";
4394
4764
  Object.defineProperty(exports2, "__esModule", { value: true });
4395
4765
  exports2.isNetworkSupported = exports2.getSupportedNetworks = exports2.getContractConfig = exports2.CURRENT_DEPLOYMENT = exports2.DEFAULT_NETWORK = exports2.NZIP_CONTRACT_ABI_WEB3 = exports2.NZIP_CONTRACT_ABI = exports2.CONTRACT_CONFIGS = void 0;
@@ -4397,13 +4767,16 @@ var require_contracts = __commonJS({
4397
4767
  exports2.getChainIdByName = getChainIdByName;
4398
4768
  exports2.getNetworkByName = getNetworkByName;
4399
4769
  exports2.getSupportedNetworkNames = getSupportedNetworkNames;
4770
+ exports2.getContractAdapter = getContractAdapter;
4771
+ exports2.getContractAdapterByVersion = getContractAdapterByVersion;
4400
4772
  exports2.fuzzyMatchNetworkName = fuzzyMatchNetworkName;
4401
4773
  exports2.CONTRACT_CONFIGS = {
4402
- // Base Sepolia (Primary testnet) - DEFAULT
4774
+ // Base Sepolia (Primary testnet)
4403
4775
  84532: {
4404
4776
  // address: '0xFD76a5d420704F34d84b0767961835c43D7b30a8', // Production contract v2.0
4405
- address: "0xdAe9D83d7AC62197fAE7704abc66b13DA28D3143",
4406
- // Production contract v2.10
4777
+ // address: '0xdAe9D83d7AC62197fAE7704abc66b13DA28D3143', // Production contract v2.10
4778
+ address: "0xc88F1a9C32bC024Bd082BAe023E10a3BCC5c0e3e",
4779
+ // Production contract v2.11
4407
4780
  network: "Base Sepolia",
4408
4781
  chainId: 84532,
4409
4782
  explorerUrl: "https://sepolia.basescan.org",
@@ -4412,6 +4785,7 @@ var require_contracts = __commonJS({
4412
4785
  "https://base-sepolia-rpc.publicnode.com",
4413
4786
  "https://base-sepolia.gateway.tenderly.co"
4414
4787
  ],
4788
+ version: "2.11",
4415
4789
  nameAliases: ["base-sepolia", "base sepolia", "basesepolia", "base-sepolia-testnet"]
4416
4790
  },
4417
4791
  // Base Mainnet (Production)
@@ -4427,12 +4801,37 @@ var require_contracts = __commonJS({
4427
4801
  "https://base.drpc.org",
4428
4802
  "https://base.gateway.tenderly.co"
4429
4803
  ],
4804
+ version: "2.10",
4430
4805
  nameAliases: ["base-mainnet", "base mainnet", "basemainnet", "base"]
4431
4806
  },
4807
+ // Ethereum Sepolia (Testnet)
4808
+ // WARNING: Sepolia testnet has been experiencing instability since the Pectra upgrade (March 2025)
4809
+ // Network issues include transaction processing failures and RPC timeouts
4810
+ // Consider using Base Sepolia (84532) for more reliable testing
4811
+ 11155111: {
4812
+ // address: '0x2716c4609fD97DaEdF429BC4B4Ec2faa81e2cC60', // Production contract v2.10
4813
+ address: "0x007e8888D976b0b9B6073694Da32B7b6e393f890",
4814
+ // Production contract v2.11
4815
+ network: "Sepolia Testnet",
4816
+ chainId: 11155111,
4817
+ explorerUrl: "https://sepolia.etherscan.io",
4818
+ rpcUrls: [
4819
+ // Official Sepolia RPC endpoints (most reliable)
4820
+ "https://rpc.sepolia.ethpandaops.io",
4821
+ // Popular public RPC providers
4822
+ "https://eth-sepolia.public.blastapi.io",
4823
+ "https://ethereum-sepolia-rpc.publicnode.com",
4824
+ "https://sepolia.drpc.org",
4825
+ "https://1rpc.io/sepolia"
4826
+ ],
4827
+ version: "2.11",
4828
+ nameAliases: ["sepolia-testnet", "sepolia testnet", "sepoliatestnet", "sepolia", "ethereum-sepolia", "ethereum sepolia"]
4829
+ },
4432
4830
  // Arbitrum Sepolia (Testnet)
4433
4831
  421614: {
4434
- address: "0x2716c4609fD97DaEdF429BC4B4Ec2faa81e2cC60",
4435
- // Production contract v2.10
4832
+ // address: '0x2716c4609fD97DaEdF429BC4B4Ec2faa81e2cC60', // Production contract v2.10
4833
+ address: "0x3b99a72cCAc108037741cacb0D60d5571CF6412C",
4834
+ // Production contract v2.11
4436
4835
  network: "Arbitrum Sepolia",
4437
4836
  chainId: 421614,
4438
4837
  explorerUrl: "https://sepolia.arbiscan.io",
@@ -4440,6 +4839,7 @@ var require_contracts = __commonJS({
4440
4839
  "https://sepolia-rollup.arbitrum.io/rpc",
4441
4840
  "https://arbitrum-sepolia-rpc.publicnode.com"
4442
4841
  ],
4842
+ version: "2.11",
4443
4843
  nameAliases: ["arbitrum-sepolia", "arbitrum sepolia", "arbitrumsepolia", "arbitrum-sepolia-testnet"]
4444
4844
  },
4445
4845
  // Arbitrum One (Production)
@@ -4456,28 +4856,8 @@ var require_contracts = __commonJS({
4456
4856
  "https://arbitrum.llamarpc.com",
4457
4857
  "https://arbitrum.publicnode.com"
4458
4858
  ],
4859
+ version: "2.10",
4459
4860
  nameAliases: ["arbitrum-one", "arbitrum one", "arbitrumone", "arbitrum", "arbitrum-mainnet", "arbitrum mainnet"]
4460
- },
4461
- // Ethereum Sepolia (Testnet)
4462
- // WARNING: Sepolia testnet has been experiencing instability since the Pectra upgrade (March 2025)
4463
- // Network issues include transaction processing failures and RPC timeouts
4464
- // Consider using Base Sepolia (84532) for more reliable testing
4465
- 11155111: {
4466
- address: "0x2716c4609fD97DaEdF429BC4B4Ec2faa81e2cC60",
4467
- // Production contract v2.10
4468
- network: "Sepolia Testnet",
4469
- chainId: 11155111,
4470
- explorerUrl: "https://sepolia.etherscan.io",
4471
- rpcUrls: [
4472
- // Official Sepolia RPC endpoints (most reliable)
4473
- "https://rpc.sepolia.ethpandaops.io",
4474
- // Popular public RPC providers
4475
- "https://eth-sepolia.public.blastapi.io",
4476
- "https://ethereum-sepolia-rpc.publicnode.com",
4477
- "https://sepolia.drpc.org",
4478
- "https://1rpc.io/sepolia"
4479
- ],
4480
- nameAliases: ["sepolia-testnet", "sepolia testnet", "sepoliatestnet", "sepolia", "ethereum-sepolia", "ethereum sepolia"]
4481
4861
  }
4482
4862
  // Ethereum Mainnet (Production) - disabled until NZIP is deployed
4483
4863
  // 1: {
@@ -4489,10 +4869,15 @@ var require_contracts = __commonJS({
4489
4869
  // }
4490
4870
  };
4491
4871
  exports2.NZIP_CONTRACT_ABI = [
4492
- "function publicMintZipFile(string memory merkleRootHash, uint256 creationTimestamp, string memory ipfsHash, string memory metadataURI) public returns (uint256)",
4872
+ // Minting function (v2.11 signature with encryptedHash for new mints)
4873
+ "function publicMintZipFile(string memory merkleRootHash, string memory encryptedHash, uint256 creationTimestamp, string memory ipfsHash, string memory metadataURI) public returns (uint256)",
4493
4874
  "function totalSupply() external view returns (uint256)",
4494
4875
  "function getTokensByMerkleRoot(string memory merkleRoot) external view returns (uint256[])",
4495
4876
  "function getTokensByOwner(address owner) external view returns (uint256[])",
4877
+ // Minimal getZipFileInfo - only declares fields we need (works for both v2.10 and v2.11)
4878
+ // v2.10: returns (merkleRootHash, ipfsHash, creator, creationTimestamp, tokenizationTime, blockNumber)
4879
+ // v2.11: returns (merkleRootHash, encryptedHash, ipfsHash, creator, creationTimestamp, tokenizationTime, blockNumber)
4880
+ // By only declaring merkleRootHash and tokenizationTime, we can read both versions
4496
4881
  "function getZipFileInfo(uint256 tokenId) external view returns (tuple(string merkleRootHash, string ipfsHash, address creator, uint256 creationTimestamp, uint256 tokenizationTime, uint256 blockNumber))",
4497
4882
  "function ownerOf(uint256 tokenId) external view returns (address)",
4498
4883
  "function balanceOf(address owner) external view returns (uint256)",
@@ -4500,12 +4885,14 @@ var require_contracts = __commonJS({
4500
4885
  "function verifyZipFile(uint256 tokenId, string memory providedMerkleRoot) external view returns (bool isValid)",
4501
4886
  "function getVersion() external pure returns (string memory)",
4502
4887
  "event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)",
4503
- "event ZipFileTokenized(uint256 indexed tokenId, address indexed creator, string merkleRootHash, uint256 creationTimestamp, string ipfsHash, uint256 tokenizationTime, uint256 blockNumber)"
4888
+ // v2.11 event with encryptedHash (v2.10 doesn't emit this event during minting, only v2.11 does)
4889
+ "event ZipFileTokenized(uint256 indexed tokenId, address indexed creator, string merkleRootHash, string encryptedHash, uint256 creationTimestamp, string ipfsHash, uint256 tokenizationTime, uint256 blockNumber)"
4504
4890
  ];
4505
4891
  exports2.NZIP_CONTRACT_ABI_WEB3 = [
4506
4892
  {
4507
4893
  inputs: [
4508
4894
  { name: "merkleRootHash", type: "string" },
4895
+ { name: "encryptedHash", type: "string" },
4509
4896
  { name: "creationTimestamp", type: "uint256" },
4510
4897
  { name: "ipfsHash", type: "string" },
4511
4898
  { name: "metadataURI", type: "string" }
@@ -4536,6 +4923,7 @@ var require_contracts = __commonJS({
4536
4923
  {
4537
4924
  components: [
4538
4925
  { name: "merkleRootHash", type: "string" },
4926
+ { name: "encryptedHash", type: "string" },
4539
4927
  { name: "ipfsHash", type: "string" },
4540
4928
  { name: "creator", type: "address" },
4541
4929
  { name: "creationTimestamp", type: "uint256" },
@@ -4586,6 +4974,16 @@ var require_contracts = __commonJS({
4586
4974
  stateMutability: "view",
4587
4975
  type: "function"
4588
4976
  },
4977
+ {
4978
+ inputs: [
4979
+ { name: "tokenId", type: "uint256" },
4980
+ { name: "providedEncryptedHash", type: "string" }
4981
+ ],
4982
+ name: "verifyEncryptedZipFile",
4983
+ outputs: [{ name: "isValid", type: "bool" }],
4984
+ stateMutability: "view",
4985
+ type: "function"
4986
+ },
4589
4987
  {
4590
4988
  inputs: [],
4591
4989
  name: "getVersion",
@@ -4609,6 +5007,7 @@ var require_contracts = __commonJS({
4609
5007
  { indexed: true, name: "tokenId", type: "uint256" },
4610
5008
  { indexed: true, name: "creator", type: "address" },
4611
5009
  { indexed: false, name: "merkleRootHash", type: "string" },
5010
+ { indexed: false, name: "encryptedHash", type: "string" },
4612
5011
  { indexed: false, name: "creationTimestamp", type: "uint256" },
4613
5012
  { indexed: false, name: "ipfsHash", type: "string" },
4614
5013
  { indexed: false, name: "tokenizationTime", type: "uint256" },
@@ -4673,6 +5072,23 @@ var require_contracts = __commonJS({
4673
5072
  return names;
4674
5073
  }
4675
5074
  __name(getSupportedNetworkNames, "getSupportedNetworkNames");
5075
+ function getContractAdapter(chainId) {
5076
+ const config = (0, exports2.getContractConfig)(chainId);
5077
+ if (!config) {
5078
+ throw new Error(`No contract config found for chainId: ${chainId}`);
5079
+ }
5080
+ if (!config.version) {
5081
+ throw new Error(`Contract version not specified for chainId: ${chainId}`);
5082
+ }
5083
+ const { getAdapter } = require_AdapterFactory();
5084
+ return getAdapter(config.version);
5085
+ }
5086
+ __name(getContractAdapter, "getContractAdapter");
5087
+ function getContractAdapterByVersion(version) {
5088
+ const { getAdapter } = require_AdapterFactory();
5089
+ return getAdapter(version);
5090
+ }
5091
+ __name(getContractAdapterByVersion, "getContractAdapterByVersion");
4676
5092
  function fuzzyMatchNetworkName(networkName) {
4677
5093
  const normalized = normalizeNetworkName(networkName);
4678
5094
  const exactMatch = getNetworkByName(networkName);
@@ -4707,9 +5123,9 @@ var require_contracts = __commonJS({
4707
5123
  }
4708
5124
  });
4709
5125
 
4710
- // neozipkit/dist/blockchain/browser/WalletManagerBrowser.js
5126
+ // node_modules/neozipkit/dist/blockchain/browser/WalletManagerBrowser.js
4711
5127
  var require_WalletManagerBrowser = __commonJS({
4712
- "neozipkit/dist/blockchain/browser/WalletManagerBrowser.js"(exports2) {
5128
+ "node_modules/neozipkit/dist/blockchain/browser/WalletManagerBrowser.js"(exports2) {
4713
5129
  "use strict";
4714
5130
  Object.defineProperty(exports2, "__esModule", { value: true });
4715
5131
  exports2.WalletManagerBrowser = void 0;
@@ -5106,18 +5522,20 @@ Network Details:
5106
5522
  }
5107
5523
  });
5108
5524
 
5109
- // neozipkit/dist/blockchain/browser/ZipkitMinterBrowser.js
5525
+ // node_modules/neozipkit/dist/blockchain/browser/ZipkitMinterBrowser.js
5110
5526
  var require_ZipkitMinterBrowser = __commonJS({
5111
- "neozipkit/dist/blockchain/browser/ZipkitMinterBrowser.js"(exports2) {
5527
+ "node_modules/neozipkit/dist/blockchain/browser/ZipkitMinterBrowser.js"(exports2) {
5112
5528
  "use strict";
5113
5529
  Object.defineProperty(exports2, "__esModule", { value: true });
5114
5530
  exports2.ZipkitMinterBrowser = void 0;
5531
+ var contracts_1 = require_contracts();
5115
5532
  var ZipkitMinterBrowser = class {
5116
5533
  static {
5117
5534
  __name(this, "ZipkitMinterBrowser");
5118
5535
  }
5119
- constructor(merkleRoot, walletManager) {
5536
+ constructor(merkleRoot, walletManager, encryptedHash) {
5120
5537
  this.merkleRoot = merkleRoot;
5538
+ this.encryptedHash = encryptedHash || "";
5121
5539
  this.walletManager = walletManager;
5122
5540
  }
5123
5541
  /**
@@ -5189,9 +5607,14 @@ var require_ZipkitMinterBrowser = __commonJS({
5189
5607
  const creationTimestamp = Math.floor(Date.now() / 1e3);
5190
5608
  const ipfsHash = "";
5191
5609
  const tokenURI = "";
5610
+ const config = this.walletManager.getCurrentConfig();
5611
+ if (!config.version) {
5612
+ throw new Error(`Contract version not specified for network ${config.network}`);
5613
+ }
5614
+ const adapter = (0, contracts_1.getContractAdapterByVersion)(config.version);
5192
5615
  const GAS_ESTIMATION_TIMEOUT = 3e4;
5193
5616
  const gasEstimate = await Promise.race([
5194
- contractWithSigner.getFunction("publicMintZipFile").estimateGas(this.merkleRoot, creationTimestamp, ipfsHash, tokenURI),
5617
+ adapter.estimateGasForMint(contractWithSigner, this.merkleRoot, this.encryptedHash || void 0, creationTimestamp, ipfsHash, tokenURI),
5195
5618
  new Promise((_, reject) => setTimeout(() => reject(new Error("Gas estimation timeout")), GAS_ESTIMATION_TIMEOUT))
5196
5619
  ]);
5197
5620
  const readProvider = this.walletManager.getReadProvider();
@@ -5239,16 +5662,19 @@ var require_ZipkitMinterBrowser = __commonJS({
5239
5662
  console.log("\u{1F4E1} Submitting transaction to blockchain...");
5240
5663
  console.log(`\u{1F550} Creation timestamp: ${creationTimestamp}`);
5241
5664
  console.log("\u{1F512} Note: Filename is not stored on blockchain for privacy");
5242
- const functionCall = contractWithSigner.getFunction("publicMintZipFile");
5665
+ if (!config.version) {
5666
+ throw new Error(`Contract version not specified for network ${config.network}`);
5667
+ }
5668
+ const adapter = (0, contracts_1.getContractAdapterByVersion)(config.version);
5243
5669
  const TX_SEND_TIMEOUT = 6e4;
5244
5670
  console.log("\u23F3 Waiting for wallet approval...");
5245
5671
  const tx = await Promise.race([
5246
- functionCall(this.merkleRoot, creationTimestamp, ipfsHash, tokenURI),
5672
+ adapter.mintZipFile(contractWithSigner, this.merkleRoot, this.encryptedHash || void 0, creationTimestamp, ipfsHash, tokenURI),
5247
5673
  new Promise((_, reject) => setTimeout(() => reject(new Error("Transaction send timeout - wallet approval dialog may not have appeared. Please check your wallet.")), TX_SEND_TIMEOUT))
5248
5674
  ]);
5249
5675
  console.log(`\u{1F4DC} Transaction submitted: ${tx.hash}`);
5250
5676
  console.log("\u23F3 Waiting for confirmation...");
5251
- let receipt;
5677
+ let receipt = null;
5252
5678
  const CONFIRMATION_TIMEOUT = 12e4;
5253
5679
  try {
5254
5680
  const readProvider = this.walletManager.getReadProvider();
@@ -5279,40 +5705,45 @@ var require_ZipkitMinterBrowser = __commonJS({
5279
5705
  throw confirmationError;
5280
5706
  }
5281
5707
  }
5282
- console.log(`\u2705 Transaction confirmed in block: ${receipt?.blockNumber}`);
5708
+ if (!receipt) {
5709
+ throw new Error("Transaction receipt not available");
5710
+ }
5711
+ console.log(`\u2705 Transaction confirmed in block: ${receipt.blockNumber}`);
5283
5712
  let tokenId;
5284
- for (let i = 0; i < receipt.logs.length; i++) {
5285
- const log = receipt.logs[i];
5286
- try {
5287
- const parsed = contract.interface.parseLog(log);
5288
- if (parsed) {
5289
- if (parsed.name === "ZipFileTokenized") {
5290
- tokenId = parsed.args.tokenId.toString();
5291
- break;
5292
- } else if (parsed.name === "Transfer") {
5293
- const from = parsed.args.from;
5294
- const transferTokenId = parsed.args.tokenId;
5295
- if (from === "0x0000000000000000000000000000000000000000") {
5296
- tokenId = transferTokenId.toString();
5713
+ if (receipt.logs && Array.isArray(receipt.logs)) {
5714
+ for (let i = 0; i < receipt.logs.length; i++) {
5715
+ const log = receipt.logs[i];
5716
+ try {
5717
+ const parsed = contract.interface.parseLog(log);
5718
+ if (parsed) {
5719
+ if (parsed.name === "ZipFileTokenized") {
5720
+ tokenId = parsed.args.tokenId.toString();
5297
5721
  break;
5722
+ } else if (parsed.name === "Transfer") {
5723
+ const from = parsed.args.from;
5724
+ const transferTokenId = parsed.args.tokenId;
5725
+ if (from === "0x0000000000000000000000000000000000000000") {
5726
+ tokenId = transferTokenId.toString();
5727
+ break;
5728
+ }
5298
5729
  }
5299
5730
  }
5300
- }
5301
- } catch (parseError) {
5302
- console.warn(`\u26A0\uFE0F Could not parse log ${i}:`, parseError);
5303
- if (log.topics.length >= 4 && log.topics[0] === "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") {
5304
- try {
5305
- const from = log.topics[1];
5306
- const to = log.topics[2];
5307
- const transferTokenId = log.topics[3];
5308
- console.log(`\u{1F504} Manual Transfer parse: from=${from}, to=${to}, tokenId=${transferTokenId}`);
5309
- if (from === "0x0000000000000000000000000000000000000000000000000000000000000000") {
5310
- tokenId = parseInt(transferTokenId, 16).toString();
5311
- console.log(`\u{1F3AF} Found minting via manual parse with token ID: ${tokenId}`);
5312
- break;
5731
+ } catch (parseError) {
5732
+ console.warn(`\u26A0\uFE0F Could not parse log ${i}:`, parseError);
5733
+ if (log.topics && log.topics.length >= 4 && log.topics[0] === "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") {
5734
+ try {
5735
+ const from = log.topics[1];
5736
+ const to = log.topics[2];
5737
+ const transferTokenId = log.topics[3];
5738
+ console.log(`\u{1F504} Manual Transfer parse: from=${from}, to=${to}, tokenId=${transferTokenId}`);
5739
+ if (from === "0x0000000000000000000000000000000000000000000000000000000000000000") {
5740
+ tokenId = parseInt(transferTokenId, 16).toString();
5741
+ console.log(`\u{1F3AF} Found minting via manual parse with token ID: ${tokenId}`);
5742
+ break;
5743
+ }
5744
+ } catch (manualParseError) {
5745
+ console.warn(`\u26A0\uFE0F Manual parsing also failed:`, manualParseError);
5313
5746
  }
5314
- } catch (manualParseError) {
5315
- console.warn(`\u26A0\uFE0F Manual parsing also failed:`, manualParseError);
5316
5747
  }
5317
5748
  }
5318
5749
  }
@@ -5354,16 +5785,21 @@ var require_ZipkitMinterBrowser = __commonJS({
5354
5785
  createTokenMetadata(tokenId, transactionHash) {
5355
5786
  const now = /* @__PURE__ */ new Date();
5356
5787
  const config = this.walletManager.getCurrentConfig();
5788
+ if (!config.version) {
5789
+ throw new Error(`Contract version not specified for network ${config.network} (chainId: ${config.chainId})`);
5790
+ }
5357
5791
  return {
5358
- version: "1.0",
5359
5792
  tokenId,
5360
5793
  contractAddress: config.address,
5361
5794
  network: config.network,
5362
5795
  networkChainId: config.chainId,
5363
5796
  transactionHash,
5364
5797
  merkleRoot: this.merkleRoot,
5798
+ encryptedHash: this.encryptedHash || void 0,
5365
5799
  mintedAt: now.toISOString(),
5366
- creationTimestamp: Math.floor(now.getTime() / 1e3)
5800
+ creationTimestamp: Math.floor(now.getTime() / 1e3),
5801
+ contractVersion: config.version
5802
+ // Required - always set from config
5367
5803
  };
5368
5804
  }
5369
5805
  /**
@@ -5389,9 +5825,9 @@ var require_ZipkitMinterBrowser = __commonJS({
5389
5825
  }
5390
5826
  });
5391
5827
 
5392
- // neozipkit/dist/blockchain/browser/TokenVerifierBrowser.js
5828
+ // node_modules/neozipkit/dist/blockchain/browser/TokenVerifierBrowser.js
5393
5829
  var require_TokenVerifierBrowser = __commonJS({
5394
- "neozipkit/dist/blockchain/browser/TokenVerifierBrowser.js"(exports2) {
5830
+ "node_modules/neozipkit/dist/blockchain/browser/TokenVerifierBrowser.js"(exports2) {
5395
5831
  "use strict";
5396
5832
  Object.defineProperty(exports2, "__esModule", { value: true });
5397
5833
  exports2.TokenVerifierBrowser = void 0;
@@ -5486,9 +5922,6 @@ var require_TokenVerifierBrowser = __commonJS({
5486
5922
  const normalizedBlockchain = blockchainData.merkleRoot?.toLowerCase().trim() || "";
5487
5923
  const normalizedCalculated = calculatedMerkleRoot?.toLowerCase().trim() || "";
5488
5924
  const verificationPassed = normalizedBlockchain === normalizedCalculated;
5489
- if (!verificationPassed) {
5490
- console.warn(`[TokenVerifier] \u26A0\uFE0F Merkle root mismatch - Calculated: ${calculatedMerkleRoot}, Blockchain: ${blockchainData.merkleRoot}`);
5491
- }
5492
5925
  const enhancedTokenMetadata = {
5493
5926
  ...tokenMetadata,
5494
5927
  owner: blockchainData.owner || void 0
@@ -5515,9 +5948,31 @@ var require_TokenVerifierBrowser = __commonJS({
5515
5948
  }
5516
5949
  /**
5517
5950
  * Validates token metadata structure
5951
+ * Validates required fields: tokenId, contractAddress, network, merkleRoot, networkChainId, contractVersion
5518
5952
  */
5519
5953
  validateTokenInfo(tokenMetadata) {
5520
- return tokenMetadata && typeof tokenMetadata.version === "string" && typeof tokenMetadata.tokenId === "string" && typeof tokenMetadata.contractAddress === "string" && typeof tokenMetadata.network === "string" && typeof tokenMetadata.networkChainId === "number" && typeof tokenMetadata.transactionHash === "string" && typeof tokenMetadata.merkleRoot === "string" && typeof tokenMetadata.mintedAt === "string";
5954
+ if (!tokenMetadata || typeof tokenMetadata !== "object") {
5955
+ return false;
5956
+ }
5957
+ if (typeof tokenMetadata.tokenId !== "string" || !tokenMetadata.tokenId) {
5958
+ return false;
5959
+ }
5960
+ if (typeof tokenMetadata.contractAddress !== "string" || !tokenMetadata.contractAddress) {
5961
+ return false;
5962
+ }
5963
+ if (typeof tokenMetadata.network !== "string" || !tokenMetadata.network) {
5964
+ return false;
5965
+ }
5966
+ if (typeof tokenMetadata.merkleRoot !== "string" || !tokenMetadata.merkleRoot) {
5967
+ return false;
5968
+ }
5969
+ if (typeof tokenMetadata.networkChainId !== "number" || tokenMetadata.networkChainId === void 0) {
5970
+ return false;
5971
+ }
5972
+ if (typeof tokenMetadata.contractVersion !== "string" || !tokenMetadata.contractVersion) {
5973
+ return false;
5974
+ }
5975
+ return true;
5521
5976
  }
5522
5977
  /**
5523
5978
  * Calculates the merkle root excluding the token metadata file
@@ -5604,9 +6059,11 @@ var require_TokenVerifierBrowser = __commonJS({
5604
6059
  const contract = new ethers_1.ethers.Contract(tokenMetadata.contractAddress, CONTRACT_ABI, provider);
5605
6060
  const zipInfo = await contract.getZipFileInfo(tokenMetadata.tokenId);
5606
6061
  const owner = await contract.ownerOf(tokenMetadata.tokenId);
6062
+ const merkleRoot = zipInfo.merkleRootHash;
6063
+ const timestamp = Number(zipInfo.tokenizationTime);
5607
6064
  return {
5608
- merkleRoot: zipInfo.merkleRootHash,
5609
- timestamp: Number(zipInfo.tokenizationTime),
6065
+ merkleRoot,
6066
+ timestamp,
5610
6067
  owner
5611
6068
  };
5612
6069
  } catch (error) {
@@ -5659,53 +6116,49 @@ var require_TokenVerifierBrowser = __commonJS({
5659
6116
  }
5660
6117
  });
5661
6118
 
5662
- // neozipkit/dist/blockchain/browser/index.js
6119
+ // node_modules/neozipkit/dist/blockchain/browser/index.js
5663
6120
  var require_browser = __commonJS({
5664
- "neozipkit/dist/blockchain/browser/index.js"(exports2) {
6121
+ "node_modules/neozipkit/dist/blockchain/browser/index.js"(exports2) {
5665
6122
  "use strict";
5666
6123
  Object.defineProperty(exports2, "__esModule", { value: true });
5667
6124
  exports2.checkForTokenization = exports2.createTokenVerifier = exports2.TokenVerifierBrowser = exports2.ZipkitMinterBrowser = exports2.WalletManagerBrowser = void 0;
5668
6125
  var WalletManagerBrowser_1 = require_WalletManagerBrowser();
5669
- Object.defineProperty(exports2, "WalletManagerBrowser", { enumerable: true, get: function() {
6126
+ Object.defineProperty(exports2, "WalletManagerBrowser", { enumerable: true, get: /* @__PURE__ */ __name(function() {
5670
6127
  return WalletManagerBrowser_1.WalletManagerBrowser;
5671
- } });
6128
+ }, "get") });
5672
6129
  var ZipkitMinterBrowser_1 = require_ZipkitMinterBrowser();
5673
- Object.defineProperty(exports2, "ZipkitMinterBrowser", { enumerable: true, get: function() {
6130
+ Object.defineProperty(exports2, "ZipkitMinterBrowser", { enumerable: true, get: /* @__PURE__ */ __name(function() {
5674
6131
  return ZipkitMinterBrowser_1.ZipkitMinterBrowser;
5675
- } });
6132
+ }, "get") });
5676
6133
  var TokenVerifierBrowser_1 = require_TokenVerifierBrowser();
5677
- Object.defineProperty(exports2, "TokenVerifierBrowser", { enumerable: true, get: function() {
6134
+ Object.defineProperty(exports2, "TokenVerifierBrowser", { enumerable: true, get: /* @__PURE__ */ __name(function() {
5678
6135
  return TokenVerifierBrowser_1.TokenVerifierBrowser;
5679
- } });
5680
- Object.defineProperty(exports2, "createTokenVerifier", { enumerable: true, get: function() {
6136
+ }, "get") });
6137
+ Object.defineProperty(exports2, "createTokenVerifier", { enumerable: true, get: /* @__PURE__ */ __name(function() {
5681
6138
  return TokenVerifierBrowser_1.createTokenVerifier;
5682
- } });
5683
- Object.defineProperty(exports2, "checkForTokenization", { enumerable: true, get: function() {
6139
+ }, "get") });
6140
+ Object.defineProperty(exports2, "checkForTokenization", { enumerable: true, get: /* @__PURE__ */ __name(function() {
5684
6141
  return TokenVerifierBrowser_1.checkForTokenization;
5685
- } });
6142
+ }, "get") });
5686
6143
  }
5687
6144
  });
5688
6145
 
5689
- // neozipkit/dist/browser/index.js
5690
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
5691
- if (k2 === void 0)
5692
- k2 = k;
6146
+ // node_modules/neozipkit/dist/browser/index.js
6147
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
6148
+ if (k2 === void 0) k2 = k;
5693
6149
  var desc = Object.getOwnPropertyDescriptor(m, k);
5694
6150
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5695
- desc = { enumerable: true, get: function() {
6151
+ desc = { enumerable: true, get: /* @__PURE__ */ __name(function() {
5696
6152
  return m[k];
5697
- } };
6153
+ }, "get") };
5698
6154
  }
5699
6155
  Object.defineProperty(o, k2, desc);
5700
- } : function(o, m, k, k2) {
5701
- if (k2 === void 0)
5702
- k2 = k;
6156
+ }) : (function(o, m, k, k2) {
6157
+ if (k2 === void 0) k2 = k;
5703
6158
  o[k2] = m[k];
5704
- });
6159
+ }));
5705
6160
  var __exportStar = exports && exports.__exportStar || function(m, exports2) {
5706
- for (var p in m)
5707
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
5708
- __createBinding(exports2, m, p);
6161
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
5709
6162
  };
5710
6163
  var __importDefault = exports && exports.__importDefault || function(mod) {
5711
6164
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -5716,14 +6169,14 @@ __exportStar(require_core(), exports);
5716
6169
  var core_1 = __importDefault(require_core());
5717
6170
  exports.default = core_1.default;
5718
6171
  var ZipkitBrowser_1 = require_ZipkitBrowser();
5719
- Object.defineProperty(exports, "ZipkitBrowser", { enumerable: true, get: function() {
6172
+ Object.defineProperty(exports, "ZipkitBrowser", { enumerable: true, get: /* @__PURE__ */ __name(function() {
5720
6173
  return __importDefault(ZipkitBrowser_1).default;
5721
- } });
6174
+ }, "get") });
5722
6175
  __exportStar(require_browser(), exports);
5723
6176
  var browser_1 = require_browser();
5724
- Object.defineProperty(exports, "createTokenVerifier", { enumerable: true, get: function() {
6177
+ Object.defineProperty(exports, "createTokenVerifier", { enumerable: true, get: /* @__PURE__ */ __name(function() {
5725
6178
  return browser_1.createTokenVerifier;
5726
- } });
6179
+ }, "get") });
5727
6180
  exports.PlatformUtils = {
5728
6181
  // Browser detection
5729
6182
  isBrowser: typeof window !== "undefined" && typeof document !== "undefined",