neozip-cli 0.70.0-alpha → 0.75.1-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.
@@ -1,13 +1,13 @@
1
1
  // Main neozipkit wrapper - re-exports from core and blockchain bundles
2
2
  const core = require('../neozipkit-bundles/core.js');
3
3
  const blockchain = require('../neozipkit-bundles/blockchain.js');
4
- const server = require('../neozipkit-bundles/server.js');
4
+ const node = require('../neozipkit-bundles/node.js');
5
5
 
6
6
  // Merge all exports
7
7
  module.exports = {
8
8
  ...core,
9
9
  ...blockchain,
10
- ...server,
10
+ ...node,
11
11
  // Ensure default export is available
12
12
  default: core.default || core
13
13
  };
@@ -0,0 +1,2 @@
1
+ // Node.js neozipkit wrapper - re-exports from node bundle
2
+ module.exports = require('../../neozipkit-bundles/node.js');
@@ -41,7 +41,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.ConfigSetup = void 0;
42
42
  const readline = __importStar(require("readline"));
43
43
  const ConfigStore_1 = require("./ConfigStore");
44
- const contracts_1 = require('../../neozipkit-wrappers/blockchain/core/contracts');
44
+ const blockchain_1 = require("neozipkit/blockchain");
45
45
  class ConfigSetup {
46
46
  constructor() {
47
47
  this.rl = readline.createInterface({
@@ -148,7 +148,7 @@ class ConfigSetup {
148
148
  // Dynamically build network options from CONTRACT_CONFIGS
149
149
  // CONTRACT_CONFIGS is already ordered correctly: Base (testnet/mainnet), Arbitrum (testnet/mainnet), Ethereum
150
150
  const networkOptions = [];
151
- const networkConfigs = Object.values(contracts_1.CONTRACT_CONFIGS);
151
+ const networkConfigs = Object.values(blockchain_1.CONTRACT_CONFIGS);
152
152
  // Verify we're loading networks
153
153
  if (networkConfigs.length === 0) {
154
154
  console.error('❌ Error: No networks found in CONTRACT_CONFIGS');
@@ -160,7 +160,7 @@ class ConfigSetup {
160
160
  // Use the primary alias (first nameAlias) or network name as value
161
161
  const primaryAlias = config.nameAliases && config.nameAliases.length > 0
162
162
  ? config.nameAliases[0]
163
- : (0, contracts_1.normalizeNetworkName)(config.network);
163
+ : (0, blockchain_1.normalizeNetworkName)(config.network);
164
164
  // Determine description based on network type
165
165
  const isTestnet = config.network.toLowerCase().includes('testnet') ||
166
166
  config.network.toLowerCase().includes('sepolia');
@@ -188,7 +188,7 @@ class ConfigSetup {
188
188
  }
189
189
  if (useCustomRpc === 'y') {
190
190
  // Get the selected network config to show default RPC
191
- const selectedNetworkConfig = (0, contracts_1.getNetworkByName)(network);
191
+ const selectedNetworkConfig = (0, blockchain_1.getNetworkByName)(network);
192
192
  // Prompt for RPC URL for the selected network
193
193
  if (selectedNetworkConfig) {
194
194
  const defaultRpc = selectedNetworkConfig.rpcUrls && selectedNetworkConfig.rpcUrls.length > 0
@@ -197,12 +197,12 @@ class ConfigSetup {
197
197
  // Use primary alias as RPC key for consistency (or normalized network name as fallback)
198
198
  const rpcKey = (selectedNetworkConfig.nameAliases && selectedNetworkConfig.nameAliases.length > 0)
199
199
  ? selectedNetworkConfig.nameAliases[0]
200
- : (0, contracts_1.normalizeNetworkName)(selectedNetworkConfig.network);
200
+ : (0, blockchain_1.normalizeNetworkName)(selectedNetworkConfig.network);
201
201
  // Check both new format and legacy format for backward compatibility
202
202
  const existingRpc = rpcConfig[rpcKey]
203
- || rpcConfig[(0, contracts_1.normalizeNetworkName)(selectedNetworkConfig.network).replace(/\s+/g, '')]
203
+ || rpcConfig[(0, blockchain_1.normalizeNetworkName)(selectedNetworkConfig.network).replace(/\s+/g, '')]
204
204
  || existingConfig?.rpc?.[rpcKey]
205
- || existingConfig?.rpc?.[(0, contracts_1.normalizeNetworkName)(selectedNetworkConfig.network).replace(/\s+/g, '')];
205
+ || existingConfig?.rpc?.[(0, blockchain_1.normalizeNetworkName)(selectedNetworkConfig.network).replace(/\s+/g, '')];
206
206
  const customRpc = await this.prompt(` ${selectedNetworkConfig.network} RPC URL`, existingRpc || defaultRpc);
207
207
  if (customRpc) {
208
208
  rpcConfig[rpcKey] = customRpc;
@@ -218,21 +218,21 @@ class ConfigSetup {
218
218
  // Skip the already configured network
219
219
  const configAlias = config.nameAliases && config.nameAliases.length > 0
220
220
  ? config.nameAliases[0]
221
- : (0, contracts_1.normalizeNetworkName)(config.network);
221
+ : (0, blockchain_1.normalizeNetworkName)(config.network);
222
222
  if (configAlias === network)
223
223
  continue;
224
224
  // Use primary alias as RPC key for consistency (or normalized network name as fallback)
225
225
  const rpcKey = (config.nameAliases && config.nameAliases.length > 0)
226
226
  ? config.nameAliases[0]
227
- : (0, contracts_1.normalizeNetworkName)(config.network);
227
+ : (0, blockchain_1.normalizeNetworkName)(config.network);
228
228
  const defaultRpc = config.rpcUrls && config.rpcUrls.length > 0
229
229
  ? config.rpcUrls[0]
230
230
  : '';
231
231
  // Check both new format and legacy format for backward compatibility
232
232
  const existingRpc = rpcConfig[rpcKey]
233
- || rpcConfig[(0, contracts_1.normalizeNetworkName)(config.network).replace(/\s+/g, '')]
233
+ || rpcConfig[(0, blockchain_1.normalizeNetworkName)(config.network).replace(/\s+/g, '')]
234
234
  || existingConfig?.rpc?.[rpcKey]
235
- || existingConfig?.rpc?.[(0, contracts_1.normalizeNetworkName)(config.network).replace(/\s+/g, '')];
235
+ || existingConfig?.rpc?.[(0, blockchain_1.normalizeNetworkName)(config.network).replace(/\s+/g, '')];
236
236
  const customRpc = await this.prompt(` ${config.network} RPC URL`, existingRpc || defaultRpc);
237
237
  if (customRpc) {
238
238
  rpcConfig[rpcKey] = customRpc;
@@ -42,7 +42,7 @@ exports.ConfigStore = void 0;
42
42
  const fs = __importStar(require("fs"));
43
43
  const path = __importStar(require("path"));
44
44
  const os = __importStar(require("os"));
45
- const contracts_1 = require('../../neozipkit-wrappers/blockchain/core/contracts');
45
+ const blockchain_1 = require("neozipkit/blockchain");
46
46
  const DEFAULTS = {
47
47
  network: 'base-sepolia',
48
48
  rpcUrls: {
@@ -198,7 +198,7 @@ class ConfigStore {
198
198
  * Validate network name (uses nameAliases from CONTRACT_CONFIGS)
199
199
  */
200
200
  static validateNetwork(network) {
201
- return (0, contracts_1.getChainIdByName)(network) !== null;
201
+ return (0, blockchain_1.getChainIdByName)(network) !== null;
202
202
  }
203
203
  /**
204
204
  * Update a specific configuration value
@@ -223,7 +223,7 @@ class ConfigStore {
223
223
  }
224
224
  else if (parts[1] === 'network') {
225
225
  if (!this.validateNetwork(value)) {
226
- const supportedNetworks = (0, contracts_1.getSupportedNetworkNames)();
226
+ const supportedNetworks = (0, blockchain_1.getSupportedNetworkNames)();
227
227
  console.error(`❌ Invalid network: "${value}"`);
228
228
  console.error(`Supported networks: ${supportedNetworks.join(', ')}`);
229
229
  return false;
@@ -46,8 +46,8 @@ exports.parseArgs = parseArgs;
46
46
  exports.showHelp = showHelp;
47
47
  exports.showExtendedHelp = showExtendedHelp;
48
48
  const fs = __importStar(require("fs"));
49
- const server_1 = require('../neozipkit-wrappers/server');
50
- const src_1 = require('../neozipkit-wrappers');
49
+ const neozipkit_1 = require("neozipkit");
50
+ const node_1 = __importDefault(require("neozipkit/node"));
51
51
  const chalk_1 = __importDefault(require("chalk"));
52
52
  const ora_1 = __importDefault(require("ora"));
53
53
  const version_1 = require("./version");
@@ -248,14 +248,14 @@ function getActualCompressedSize(entry) {
248
248
  * Format entry name for display (handles blockchain metadata)
249
249
  */
250
250
  function formatEntryName(entry) {
251
- if (entry.filename === src_1.TOKENIZED_METADATA) {
252
- return `${src_1.TOKENIZED_METADATA} (NFT Token)`;
251
+ if (entry.filename === neozipkit_1.TOKENIZED_METADATA) {
252
+ return `${neozipkit_1.TOKENIZED_METADATA} (NFT Token)`;
253
253
  }
254
- if (entry.filename === src_1.TIMESTAMP_METADATA) {
255
- return `${src_1.TIMESTAMP_METADATA} (Timestamp Metadata)`;
254
+ if (entry.filename === neozipkit_1.TIMESTAMP_METADATA) {
255
+ return `${neozipkit_1.TIMESTAMP_METADATA} (Timestamp Metadata)`;
256
256
  }
257
- if (entry.filename === src_1.TIMESTAMP_SUBMITTED) {
258
- return `${src_1.TIMESTAMP_SUBMITTED} (Timestamp Submitted)`;
257
+ if (entry.filename === neozipkit_1.TIMESTAMP_SUBMITTED) {
258
+ return `${neozipkit_1.TIMESTAMP_SUBMITTED} (Timestamp Submitted)`;
259
259
  }
260
260
  return entry.filename;
261
261
  }
@@ -268,8 +268,8 @@ async function readArchiveEntries(archivePath, debugMode = false, quiet = false,
268
268
  if (!quiet) {
269
269
  spinner = (0, ora_1.default)('Reading archive...').start();
270
270
  }
271
- // Create ZipkitServer instance
272
- const zip = new server_1.ZipkitServer();
271
+ // Create ZipkitNode instance
272
+ const zip = new node_1.default();
273
273
  let entries;
274
274
  if (inMemory) {
275
275
  // For Buffer-based loading, read the entire file into buffer and get entries in one call
@@ -47,11 +47,9 @@ exports.showExtendedHelp = showExtendedHelp;
47
47
  // No environment variables needed for neounzip
48
48
  const fs = __importStar(require("fs"));
49
49
  const path = __importStar(require("path"));
50
- const src_1 = require('../neozipkit-wrappers');
51
- const server_1 = require('../neozipkit-wrappers/server');
52
- const blockchain_1 = require('../neozipkit-wrappers/blockchain');
53
- const Logger_1 = require('../neozipkit-wrappers/core/components/Logger');
54
- const HashCalculator_1 = __importDefault(require('../neozipkit-wrappers/core/components/HashCalculator'));
50
+ const neozipkit_1 = require("neozipkit");
51
+ const blockchain_1 = require("neozipkit/blockchain");
52
+ const node_1 = __importDefault(require("neozipkit/node"));
55
53
  const readline = __importStar(require("readline"));
56
54
  const version_1 = require("./version");
57
55
  const exit_codes_1 = require("./exit-codes");
@@ -396,7 +394,7 @@ async function pipeArchive(zip, options, filePatterns) {
396
394
  });
397
395
  });
398
396
  }
399
- // Apply include/exclude filtering using ZipkitServer.filterEntries()
397
+ // Apply include/exclude filtering using ZipkitNode.filterEntries()
400
398
  const finalEntries = zip.filterEntries(filteredEntries, {
401
399
  include: options.include,
402
400
  exclude: options.exclude,
@@ -545,15 +543,15 @@ async function testArchive(zip, options) {
545
543
  const fileBased = isFileBased(zip);
546
544
  const bufferBased = isBufferBased(zip);
547
545
  // For merkle root calculation: collect verified SHA-256 hashes during test extraction
548
- const hashAccumulator = new HashCalculator_1.default({ enableAccumulation: true });
546
+ const hashAccumulator = new neozipkit_1.HashCalculator({ enableAccumulation: true });
549
547
  let allFilesValid = true;
550
548
  const failedFiles = [];
551
549
  // Filter out metadata files for merkle root calculation
552
550
  const contentEntriesForMerkle = entries.filter(entry => {
553
551
  const filename = entry.filename || '';
554
- return filename !== src_1.TOKENIZED_METADATA &&
555
- filename !== src_1.TIMESTAMP_METADATA &&
556
- filename !== src_1.TIMESTAMP_SUBMITTED &&
552
+ return filename !== neozipkit_1.TOKENIZED_METADATA &&
553
+ filename !== neozipkit_1.TIMESTAMP_METADATA &&
554
+ filename !== neozipkit_1.TIMESTAMP_SUBMITTED &&
557
555
  !entry.isDirectory;
558
556
  });
559
557
  for (const entry of entries) {
@@ -567,34 +565,26 @@ async function testArchive(zip, options) {
567
565
  }
568
566
  try {
569
567
  if (bufferBased) {
570
- // Buffer-based: use extract() which performs CRC/SHA checks
568
+ // Buffer-based: use extract() which performs CRC/SHA checks and returns data in memory
571
569
  await extractEntry(zip, entry, options.skipBlockchain);
572
570
  }
573
571
  else if (fileBased) {
574
- // File-based: use extractToFile() to a temporary file for testing
575
- // extractToFile() performs CRC/SHA checks during extraction
576
- const tmpPath = path.join(require('os').tmpdir(), `neounzip-test-${Date.now()}-${entry.filename?.replace(/[^a-zA-Z0-9]/g, '_') || 'file'}`);
577
- try {
578
- await zip.extractToFile(entry, tmpPath, {
579
- skipHashCheck: options.skipBlockchain
580
- });
581
- // If extraction succeeds, verification passed (CRC/SHA checks are done during extraction)
582
- // Clean up temporary file
583
- if (fs.existsSync(tmpPath)) {
584
- fs.unlinkSync(tmpPath);
585
- }
586
- }
587
- catch (extractErr) {
588
- // Clean up temporary file on error
589
- if (fs.existsSync(tmpPath)) {
590
- try {
591
- fs.unlinkSync(tmpPath);
592
- }
593
- catch {
594
- // Ignore cleanup errors
595
- }
572
+ // File-based: use testEntry() to validate without extracting to disk
573
+ // testEntry() now returns the verified hash, eliminating the need for temp files
574
+ const testResult = await zip.testEntry(entry, {
575
+ skipHashCheck: options.skipBlockchain
576
+ });
577
+ // Collect verified SHA-256 hash for merkle root calculation if available
578
+ if (testResult.verifiedHash && !options.skipBlockchain) {
579
+ const isContentFile = name !== neozipkit_1.TOKENIZED_METADATA &&
580
+ name !== neozipkit_1.TIMESTAMP_METADATA &&
581
+ name !== neozipkit_1.TIMESTAMP_SUBMITTED &&
582
+ !entry.isDirectory;
583
+ if (isContentFile) {
584
+ // Use the verified hash returned from testEntry()
585
+ const hashBuffer = Buffer.from(testResult.verifiedHash, 'hex');
586
+ hashAccumulator.addHash(hashBuffer);
596
587
  }
597
- throw extractErr;
598
588
  }
599
589
  }
600
590
  else {
@@ -603,16 +593,6 @@ async function testArchive(zip, options) {
603
593
  // Report success
604
594
  if (entry.sha256 && !options.skipBlockchain) {
605
595
  console.log(`testing: ${name} ...OK SHA-256`);
606
- // Collect verified SHA-256 hash for merkle root calculation (single pass - no double check)
607
- const isContentFile = name !== src_1.TOKENIZED_METADATA &&
608
- name !== src_1.TIMESTAMP_METADATA &&
609
- name !== src_1.TIMESTAMP_SUBMITTED &&
610
- !entry.isDirectory;
611
- if (isContentFile && entry.sha256) {
612
- // Use the verified hash from the entry (already verified during extraction)
613
- const hashBuffer = Buffer.from(entry.sha256, 'hex');
614
- hashAccumulator.addHash(hashBuffer);
615
- }
616
596
  }
617
597
  else if (entry.sha256 && options.skipBlockchain) {
618
598
  console.log(`testing: ${name} ...OK (SHA-256 skipped)`);
@@ -628,9 +608,9 @@ async function testArchive(zip, options) {
628
608
  // Check bitFlags for encryption flag (bit 0)
629
609
  const isEncrypted = entry.isEncrypted || (entry.bitFlags & 0x01) !== 0;
630
610
  // Track failed files for merkle root calculation
631
- const isContentFile = name !== src_1.TOKENIZED_METADATA &&
632
- name !== src_1.TIMESTAMP_METADATA &&
633
- name !== src_1.TIMESTAMP_SUBMITTED &&
611
+ const isContentFile = name !== neozipkit_1.TOKENIZED_METADATA &&
612
+ name !== neozipkit_1.TIMESTAMP_METADATA &&
613
+ name !== neozipkit_1.TIMESTAMP_SUBMITTED &&
634
614
  !entry.isDirectory;
635
615
  if (isEncrypted) {
636
616
  // For encrypted files, decompression errors after decryption usually mean wrong password
@@ -750,7 +730,7 @@ async function preVerifyArchive(zip, archiveName, options) {
750
730
  let verificationSuccess = false;
751
731
  let verificationError;
752
732
  try {
753
- const verifier = new src_1.ZipkitVerifier({
733
+ const verifier = new neozipkit_1.ZipkitVerifier({
754
734
  debug: options.verbose,
755
735
  skipHash: options.skipBlockchain
756
736
  });
@@ -918,7 +898,7 @@ async function extractArchive(zip, destination, options) {
918
898
  zip.password = options.password;
919
899
  }
920
900
  const entries = await getDirectory(zip, false);
921
- // Filter entries using ZipkitServer.filterEntries()
901
+ // Filter entries using ZipkitNode.filterEntries()
922
902
  const filteredEntries = zip.filterEntries(entries, {
923
903
  include: options.include,
924
904
  exclude: options.exclude,
@@ -940,15 +920,15 @@ async function extractArchive(zip, destination, options) {
940
920
  let processedFiles = 0;
941
921
  const totalEntries = filteredEntries.length;
942
922
  // For merkle root calculation: collect verified SHA-256 hashes during extraction
943
- const hashAccumulator = new HashCalculator_1.default({ enableAccumulation: true });
923
+ const hashAccumulator = new neozipkit_1.HashCalculator({ enableAccumulation: true });
944
924
  let allFilesValid = true;
945
925
  const failedFiles = [];
946
926
  // Filter out metadata files for merkle root calculation
947
927
  const contentEntriesForMerkle = filteredEntries.filter(entry => {
948
928
  const filename = entry.filename || '';
949
- return filename !== src_1.TOKENIZED_METADATA &&
950
- filename !== src_1.TIMESTAMP_METADATA &&
951
- filename !== src_1.TIMESTAMP_SUBMITTED &&
929
+ return filename !== neozipkit_1.TOKENIZED_METADATA &&
930
+ filename !== neozipkit_1.TIMESTAMP_METADATA &&
931
+ filename !== neozipkit_1.TIMESTAMP_SUBMITTED &&
952
932
  !entry.isDirectory;
953
933
  });
954
934
  for (const entry of filteredEntries) {
@@ -967,11 +947,11 @@ async function extractArchive(zip, destination, options) {
967
947
  if (options.showFiles && !options.quiet) {
968
948
  log(`extracting: ${filename}`, options);
969
949
  }
970
- // Prepare extraction path using ZipkitServer.prepareExtractionPath()
950
+ // Prepare extraction path using ZipkitNode.prepareExtractionPath()
971
951
  const outPath = zip.prepareExtractionPath(entry, destination, {
972
952
  junkPaths: options.junkPaths
973
953
  });
974
- // Determine if entry should be extracted using ZipkitServer.shouldExtractEntry()
954
+ // Determine if entry should be extracted using ZipkitNode.shouldExtractEntry()
975
955
  const shouldExtract = await zip.shouldExtractEntry(entry, outPath, {
976
956
  overwrite: options.overwrite || alwaysOverwrite,
977
957
  never: options.never,
@@ -999,7 +979,7 @@ async function extractArchive(zip, destination, options) {
999
979
  }
1000
980
  continue;
1001
981
  }
1002
- // Extract entry using ZipkitServer.extractEntryToPath()
982
+ // Extract entry using ZipkitNode.extractEntryToPath()
1003
983
  const result = await zip.extractEntryToPath(entry, outPath, {
1004
984
  skipHashCheck: options.skipBlockchain,
1005
985
  preserveTimestamps: true, // Always preserve timestamps
@@ -1025,9 +1005,9 @@ async function extractArchive(zip, destination, options) {
1025
1005
  // Collect verified SHA-256 hash for merkle root calculation (single pass - no double check)
1026
1006
  // Only if this is a content file (not metadata) and SHA-256 verification was performed
1027
1007
  if (!options.skipBlockchain && hasSha) {
1028
- const isContentFile = filename !== src_1.TOKENIZED_METADATA &&
1029
- filename !== src_1.TIMESTAMP_METADATA &&
1030
- filename !== src_1.TIMESTAMP_SUBMITTED &&
1008
+ const isContentFile = filename !== neozipkit_1.TOKENIZED_METADATA &&
1009
+ filename !== neozipkit_1.TIMESTAMP_METADATA &&
1010
+ filename !== neozipkit_1.TIMESTAMP_SUBMITTED &&
1031
1011
  !entry.isDirectory;
1032
1012
  if (isContentFile && entry.sha256) {
1033
1013
  // Use the verified hash from the entry (already verified during extraction)
@@ -1039,9 +1019,9 @@ async function extractArchive(zip, destination, options) {
1039
1019
  else {
1040
1020
  log(`error: ${filename} (${result.error || 'unknown error'})`, options);
1041
1021
  // Track failed files for merkle root calculation
1042
- const isContentFile = filename !== src_1.TOKENIZED_METADATA &&
1043
- filename !== src_1.TIMESTAMP_METADATA &&
1044
- filename !== src_1.TIMESTAMP_SUBMITTED &&
1022
+ const isContentFile = filename !== neozipkit_1.TOKENIZED_METADATA &&
1023
+ filename !== neozipkit_1.TIMESTAMP_METADATA &&
1024
+ filename !== neozipkit_1.TIMESTAMP_SUBMITTED &&
1045
1025
  !entry.isDirectory;
1046
1026
  if (isContentFile && !options.skipBlockchain) {
1047
1027
  // Check if failure was due to SHA-256 mismatch
@@ -1083,7 +1063,7 @@ async function verifyTokenization(zip, archiveName, options, extractionResult) {
1083
1063
  return;
1084
1064
  }
1085
1065
  // Initialize blockchain verifier
1086
- const verifier = new src_1.ZipkitVerifier({
1066
+ const verifier = new neozipkit_1.ZipkitVerifier({
1087
1067
  debug: options.verbose, // Enable debug output in verbose mode
1088
1068
  skipHash: options.skipBlockchain
1089
1069
  });
@@ -1171,13 +1151,13 @@ async function verifyTokenization(zip, archiveName, options, extractionResult) {
1171
1151
  // No pre-calculated result (e.g., list-only mode) - extract files once to calculate merkle root
1172
1152
  try {
1173
1153
  console.log(' Calculating merkle root from actual file contents...');
1174
- const hashAccumulator = new HashCalculator_1.default({ enableAccumulation: true });
1154
+ const hashAccumulator = new neozipkit_1.HashCalculator({ enableAccumulation: true });
1175
1155
  // Filter out blockchain metadata files to ensure consistent Merkle Root calculation
1176
1156
  const contentEntries = entries.filter(entry => {
1177
1157
  const filename = entry.filename || '';
1178
- return filename !== src_1.TOKENIZED_METADATA &&
1179
- filename !== src_1.TIMESTAMP_METADATA &&
1180
- filename !== src_1.TIMESTAMP_SUBMITTED &&
1158
+ return filename !== neozipkit_1.TOKENIZED_METADATA &&
1159
+ filename !== neozipkit_1.TIMESTAMP_METADATA &&
1160
+ filename !== neozipkit_1.TIMESTAMP_SUBMITTED &&
1181
1161
  !entry.isDirectory; // Skip directories
1182
1162
  });
1183
1163
  // Extract each file once and verify SHA-256 during extraction
@@ -1540,7 +1520,7 @@ async function verifyAndUpgradeOts(zip, archiveName, options) {
1540
1520
  if (!otsEntry) {
1541
1521
  return;
1542
1522
  }
1543
- const res = await (0, src_1.verifyOtsZip)(zip);
1523
+ const res = await (0, neozipkit_1.verifyOtsZip)(zip);
1544
1524
  console.log('\n🕐 OpenTimestamps Verification:');
1545
1525
  if (res.status === 'none') {
1546
1526
  console.log(' - Status: No OpenTimestamps found');
@@ -2020,7 +2000,7 @@ async function main() {
2020
2000
  // Use exdir option if provided, otherwise use destination
2021
2001
  const extractDestination = options.exdir || destination;
2022
2002
  // Load the ZIP file
2023
- zip = new server_1.ZipkitServer();
2003
+ zip = new node_1.default();
2024
2004
  if (options.inMemory) {
2025
2005
  // Use Buffer-based loading (browser compatible)
2026
2006
  const data = fs.readFileSync(archive);
@@ -2048,7 +2028,7 @@ async function main() {
2048
2028
  if (options.debug) {
2049
2029
  // Set global Logger level to 'debug' for debug output
2050
2030
  // Note: Individual class logging is controlled by their loggingEnabled static property
2051
- Logger_1.Logger.setLevel('debug');
2031
+ neozipkit_1.Logger.setLevel('debug');
2052
2032
  logDebug('Debug mode enabled', options);
2053
2033
  logDebug(`Command line arguments: ${process.argv.join(' ')}`, options);
2054
2034
  logDebug(`Working directory: ${process.cwd()}`, options);
@@ -40,16 +40,15 @@ exports.isSupportedNetwork = isSupportedNetwork;
40
40
  exports.getWalletPasskey = getWalletPasskey;
41
41
  exports.addTokenMetaToZip = addTokenMetaToZip;
42
42
  exports.handleTokenMinting = handleTokenMinting;
43
- const src_1 = require('../../neozipkit-wrappers');
44
- const blockchain_1 = require('../../neozipkit-wrappers/blockchain');
45
- const contracts_1 = require('../../neozipkit-wrappers/blockchain/core/contracts');
43
+ const neozipkit_1 = require("neozipkit");
44
+ const blockchain_1 = require("neozipkit/blockchain");
46
45
  const ConfigStore_1 = require("../config/ConfigStore");
47
46
  const readline = __importStar(require("readline"));
48
47
  /**
49
48
  * Check if the network is supported (uses nameAliases from CONTRACT_CONFIGS)
50
49
  */
51
50
  function isSupportedNetwork(network) {
52
- return (0, contracts_1.getChainIdByName)(network) !== null;
51
+ return (0, blockchain_1.getChainIdByName)(network) !== null;
53
52
  }
54
53
  /**
55
54
  * Check if the required wallet passkey is available and valid
@@ -95,14 +94,14 @@ function getWalletPasskey(cliWalletKey, showError = true) {
95
94
  async function addTokenMetaToZip(zip, tokenMeta) {
96
95
  const tokenContent = JSON.stringify(tokenMeta, null, 2);
97
96
  const tokenBuffer = Buffer.from(tokenContent, 'utf8');
98
- const tokenPath = src_1.TOKENIZED_METADATA;
97
+ const tokenPath = neozipkit_1.TOKENIZED_METADATA;
99
98
  // Create new token entry
100
99
  const tokenEntry = zip.createZipEntry(tokenPath);
101
100
  tokenEntry.timeDateDOS = tokenEntry.setDateTime(new Date());
102
101
  tokenEntry.compressedSize = tokenBuffer.length;
103
102
  tokenEntry.uncompressedSize = tokenBuffer.length;
104
103
  tokenEntry.cmpMethod = 0; // STORED
105
- tokenEntry.crc = (0, src_1.crc32)(tokenBuffer);
104
+ tokenEntry.crc = (0, neozipkit_1.crc32)(tokenBuffer);
106
105
  tokenEntry.fileBuffer = tokenBuffer;
107
106
  tokenEntry.isUpdated = true;
108
107
  console.log('✅ Token metadata prepared for ZIP');
@@ -194,7 +193,7 @@ async function handleTokenMinting(initialMinter, zip, nonInteractive = false, in
194
193
  else {
195
194
  // ZipkitMinter uses getChainIdByName internally which handles all nameAliases
196
195
  // So we can pass the original network name directly
197
- minter = new src_1.ZipkitMinter(merkleRoot, {
196
+ minter = new neozipkit_1.ZipkitMinter(merkleRoot, {
198
197
  network: network,
199
198
  walletPrivateKey: walletPrivateKey,
200
199
  verbose: verbose,
@@ -224,14 +223,19 @@ async function handleTokenMinting(initialMinter, zip, nonInteractive = false, in
224
223
  console.log(` Contract: ${mintResult.tokenMetadata?.contractAddress}`);
225
224
  // Create TokenMetadata from minting result
226
225
  if (mintResult.tokenMetadata) {
226
+ // Determine contract version: v2.11+ has version in config, prior versions are "unknown"
227
+ const versionStr = networkConfig?.version || '0';
228
+ const versionNum = parseFloat(versionStr);
229
+ const contractVersion = versionNum >= 2.11 ? versionStr : 'unknown';
227
230
  const tokenMeta = {
228
- version: '1.0',
231
+ contractVersion: contractVersion,
229
232
  tokenId: mintResult.tokenMetadata.tokenId,
230
233
  contractAddress: mintResult.tokenMetadata.contractAddress,
231
234
  network: mintResult.tokenMetadata.network,
232
235
  networkChainId: mintResult.tokenMetadata.networkChainId || networkConfig?.chainId || 84532,
233
236
  transactionHash: mintResult.tokenMetadata.transactionHash,
234
237
  merkleRoot: mintResult.tokenMetadata.merkleRoot,
238
+ encryptedHash: mintResult.tokenMetadata.encryptedHash, // Currently unused, but preserve if present
235
239
  mintedAt: mintResult.tokenMetadata.mintDate
236
240
  };
237
241
  // Cleanup before returning