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.
- package/README.md +12 -12
- package/dist/neozipkit-bundles/blockchain.js +1491 -857
- package/dist/neozipkit-bundles/browser.js +755 -302
- package/dist/neozipkit-bundles/core.js +235 -162
- package/dist/neozipkit-bundles/{server.js → node.js} +4415 -1681
- package/dist/neozipkit-wrappers/index.js +2 -2
- package/dist/neozipkit-wrappers/node/index.js +2 -0
- package/package.json +7 -8
- package/dist/neozipkit-wrappers/server/index.js +0 -2
- package/dist/src/config/ConfigSetup.js +0 -455
- package/dist/src/config/ConfigStore.js +0 -373
- package/dist/src/config/ConfigWizard.js +0 -453
- package/dist/src/config/WalletConfig.js +0 -372
- package/dist/src/exit-codes.js +0 -210
- package/dist/src/index.js +0 -141
- package/dist/src/neolist.js +0 -1194
- package/dist/src/neounzip.js +0 -2177
- package/dist/src/neozip/CommentManager.js +0 -240
- package/dist/src/neozip/blockchain.js +0 -383
- package/dist/src/neozip/createZip.js +0 -2273
- package/dist/src/neozip/file-operations.js +0 -920
- package/dist/src/neozip/types.js +0 -6
- package/dist/src/neozip/user-interaction.js +0 -256
- package/dist/src/neozip/utils.js +0 -96
- package/dist/src/neozip.js +0 -785
- package/dist/src/server/CommentManager.js +0 -240
- package/dist/src/version.js +0 -59
|
@@ -26,9 +26,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
|
|
29
|
-
// neozipkit/dist/types/index.js
|
|
29
|
+
// node_modules/neozipkit/dist/types/index.js
|
|
30
30
|
var require_types = __commonJS({
|
|
31
|
-
"neozipkit/dist/types/index.js"(exports2) {
|
|
31
|
+
"node_modules/neozipkit/dist/types/index.js"(exports2) {
|
|
32
32
|
"use strict";
|
|
33
33
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
34
34
|
exports2.NEOZIPKIT_INFO = exports2.NETWORKS = void 0;
|
|
@@ -65,9 +65,286 @@ var require_types = __commonJS({
|
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
// neozipkit/dist/blockchain/core/
|
|
68
|
+
// node_modules/neozipkit/dist/blockchain/core/ContractVersionRegistry.js
|
|
69
|
+
var require_ContractVersionRegistry = __commonJS({
|
|
70
|
+
"node_modules/neozipkit/dist/blockchain/core/ContractVersionRegistry.js"(exports2) {
|
|
71
|
+
"use strict";
|
|
72
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
73
|
+
exports2.IMPLEMENTED_VERSIONS = exports2.VERSION_REGISTRY = void 0;
|
|
74
|
+
exports2.getVersionCapabilities = getVersionCapabilities;
|
|
75
|
+
exports2.isVersionSupported = isVersionSupported;
|
|
76
|
+
exports2.normalizeVersion = normalizeVersion;
|
|
77
|
+
exports2.getSupportedVersions = getSupportedVersions;
|
|
78
|
+
exports2.VERSION_REGISTRY = {
|
|
79
|
+
"2.0": {
|
|
80
|
+
supportsEncryptedHash: false,
|
|
81
|
+
supportsFileName: true,
|
|
82
|
+
getZipFileInfoFields: ["fileName", "merkleRootHash", "ipfsHash", "creator", "creationTimestamp", "tokenizationTime", "blockNumber"],
|
|
83
|
+
publicMintZipFileSignature: "v2.0",
|
|
84
|
+
hasGetVersion: true,
|
|
85
|
+
additionalFunctions: []
|
|
86
|
+
},
|
|
87
|
+
"2.10": {
|
|
88
|
+
supportsEncryptedHash: false,
|
|
89
|
+
supportsFileName: false,
|
|
90
|
+
getZipFileInfoFields: ["merkleRootHash", "ipfsHash", "creator", "creationTimestamp", "tokenizationTime", "blockNumber"],
|
|
91
|
+
publicMintZipFileSignature: "v2.10",
|
|
92
|
+
hasGetVersion: true,
|
|
93
|
+
additionalFunctions: []
|
|
94
|
+
},
|
|
95
|
+
"2.11": {
|
|
96
|
+
supportsEncryptedHash: true,
|
|
97
|
+
supportsFileName: false,
|
|
98
|
+
getZipFileInfoFields: ["merkleRootHash", "encryptedHash", "ipfsHash", "creator", "creationTimestamp", "tokenizationTime", "blockNumber"],
|
|
99
|
+
publicMintZipFileSignature: "v2.11",
|
|
100
|
+
hasGetVersion: true,
|
|
101
|
+
additionalFunctions: ["getEncryptedHash", "verifyEncryptedZipFile"]
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
function getVersionCapabilities(version) {
|
|
105
|
+
const normalizedVersion = normalizeVersion(version);
|
|
106
|
+
if (normalizedVersion in exports2.VERSION_REGISTRY) {
|
|
107
|
+
return exports2.VERSION_REGISTRY[normalizedVersion];
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
__name(getVersionCapabilities, "getVersionCapabilities");
|
|
112
|
+
exports2.IMPLEMENTED_VERSIONS = ["2.10", "2.11"];
|
|
113
|
+
function isVersionSupported(version) {
|
|
114
|
+
const normalized = normalizeVersion(version);
|
|
115
|
+
if (!normalized) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
return getVersionCapabilities(normalized) !== null && exports2.IMPLEMENTED_VERSIONS.includes(normalized);
|
|
119
|
+
}
|
|
120
|
+
__name(isVersionSupported, "isVersionSupported");
|
|
121
|
+
function normalizeVersion(version) {
|
|
122
|
+
if (!version || version === "unknown" || version.trim() === "") {
|
|
123
|
+
return "";
|
|
124
|
+
}
|
|
125
|
+
const parts = version.split(".");
|
|
126
|
+
if (parts.length >= 2) {
|
|
127
|
+
return `${parts[0]}.${parts[1]}`;
|
|
128
|
+
}
|
|
129
|
+
return version;
|
|
130
|
+
}
|
|
131
|
+
__name(normalizeVersion, "normalizeVersion");
|
|
132
|
+
function getSupportedVersions() {
|
|
133
|
+
return Object.keys(exports2.VERSION_REGISTRY);
|
|
134
|
+
}
|
|
135
|
+
__name(getSupportedVersions, "getSupportedVersions");
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// node_modules/neozipkit/dist/blockchain/core/adapters/V2_10Adapter.js
|
|
140
|
+
var require_V2_10Adapter = __commonJS({
|
|
141
|
+
"node_modules/neozipkit/dist/blockchain/core/adapters/V2_10Adapter.js"(exports2) {
|
|
142
|
+
"use strict";
|
|
143
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
144
|
+
exports2.V2_10Adapter = void 0;
|
|
145
|
+
var ethers_1 = require("ethers");
|
|
146
|
+
var V2_10_ABI = [
|
|
147
|
+
"function publicMintZipFile(string memory merkleRootHash, uint256 creationTimestamp, string memory ipfsHash, string memory metadataURI) public returns (uint256)",
|
|
148
|
+
"function getZipFileInfo(uint256 tokenId) external view returns (tuple(string merkleRootHash, string ipfsHash, address creator, uint256 creationTimestamp, uint256 tokenizationTime, uint256 blockNumber))",
|
|
149
|
+
"event ZipFileTokenized(uint256 indexed tokenId, address indexed creator, string merkleRootHash, uint256 creationTimestamp, string ipfsHash, uint256 tokenizationTime, uint256 blockNumber)"
|
|
150
|
+
];
|
|
151
|
+
var iface = new ethers_1.Interface(V2_10_ABI);
|
|
152
|
+
var V2_10Adapter = class {
|
|
153
|
+
static {
|
|
154
|
+
__name(this, "V2_10Adapter");
|
|
155
|
+
}
|
|
156
|
+
constructor() {
|
|
157
|
+
this.version = "2.10";
|
|
158
|
+
}
|
|
159
|
+
async mintZipFile(contract, merkleRoot, encryptedHash, creationTimestamp, ipfsHash, metadataURI, gasOptions) {
|
|
160
|
+
if (encryptedHash) {
|
|
161
|
+
console.warn("[V2_10Adapter] encryptedHash provided but v2.10 contract does not support it - ignoring");
|
|
162
|
+
}
|
|
163
|
+
const contractTyped = contract;
|
|
164
|
+
const args = [
|
|
165
|
+
merkleRoot,
|
|
166
|
+
creationTimestamp,
|
|
167
|
+
ipfsHash,
|
|
168
|
+
metadataURI
|
|
169
|
+
];
|
|
170
|
+
if (gasOptions) {
|
|
171
|
+
return await contractTyped.publicMintZipFile(...args, gasOptions);
|
|
172
|
+
}
|
|
173
|
+
return await contractTyped.publicMintZipFile(...args);
|
|
174
|
+
}
|
|
175
|
+
async getZipFileInfo(contract, tokenId) {
|
|
176
|
+
const contractTyped = contract;
|
|
177
|
+
const runner = contractTyped.runner || contractTyped.provider;
|
|
178
|
+
const adapterContract = new ethers_1.Contract(contractTyped.target, V2_10_ABI, runner);
|
|
179
|
+
const result = await adapterContract.getZipFileInfo(tokenId);
|
|
180
|
+
return {
|
|
181
|
+
merkleRootHash: result[0],
|
|
182
|
+
ipfsHash: result[1],
|
|
183
|
+
creator: result[2],
|
|
184
|
+
creationTimestamp: result[3],
|
|
185
|
+
tokenizationTime: result[4],
|
|
186
|
+
blockNumber: result[5]
|
|
187
|
+
// encryptedHash and fileName not available in v2.10
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
parseZipFileTokenizedEvent(log) {
|
|
191
|
+
const parsed = iface.parseLog({
|
|
192
|
+
topics: log.topics,
|
|
193
|
+
data: log.data
|
|
194
|
+
});
|
|
195
|
+
if (!parsed || parsed.name !== "ZipFileTokenized") {
|
|
196
|
+
throw new Error("Invalid ZipFileTokenized event");
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
tokenId: parsed.args.tokenId,
|
|
200
|
+
creator: parsed.args.creator,
|
|
201
|
+
merkleRootHash: parsed.args.merkleRootHash,
|
|
202
|
+
creationTimestamp: parsed.args.creationTimestamp,
|
|
203
|
+
ipfsHash: parsed.args.ipfsHash,
|
|
204
|
+
tokenizationTime: parsed.args.tokenizationTime,
|
|
205
|
+
blockNumber: parsed.args.blockNumber
|
|
206
|
+
// encryptedHash and fileName not in v2.10 event
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
async estimateGasForMint(contract, merkleRoot, encryptedHash, creationTimestamp, ipfsHash, metadataURI) {
|
|
210
|
+
const contractTyped = contract;
|
|
211
|
+
return await contractTyped.publicMintZipFile.estimateGas(merkleRoot, creationTimestamp, ipfsHash, metadataURI);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
exports2.V2_10Adapter = V2_10Adapter;
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// node_modules/neozipkit/dist/blockchain/core/adapters/V2_11Adapter.js
|
|
219
|
+
var require_V2_11Adapter = __commonJS({
|
|
220
|
+
"node_modules/neozipkit/dist/blockchain/core/adapters/V2_11Adapter.js"(exports2) {
|
|
221
|
+
"use strict";
|
|
222
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
223
|
+
exports2.V2_11Adapter = void 0;
|
|
224
|
+
var ethers_1 = require("ethers");
|
|
225
|
+
var V2_11_ABI = [
|
|
226
|
+
"function publicMintZipFile(string memory merkleRootHash, string memory encryptedHash, uint256 creationTimestamp, string memory ipfsHash, string memory metadataURI) public returns (uint256)",
|
|
227
|
+
"function getZipFileInfo(uint256 tokenId) external view returns (tuple(string merkleRootHash, string encryptedHash, string ipfsHash, address creator, uint256 creationTimestamp, uint256 tokenizationTime, uint256 blockNumber))",
|
|
228
|
+
"event ZipFileTokenized(uint256 indexed tokenId, address indexed creator, string merkleRootHash, string encryptedHash, uint256 creationTimestamp, string ipfsHash, uint256 tokenizationTime, uint256 blockNumber)"
|
|
229
|
+
];
|
|
230
|
+
var iface = new ethers_1.Interface(V2_11_ABI);
|
|
231
|
+
var V2_11Adapter = class {
|
|
232
|
+
static {
|
|
233
|
+
__name(this, "V2_11Adapter");
|
|
234
|
+
}
|
|
235
|
+
constructor() {
|
|
236
|
+
this.version = "2.11";
|
|
237
|
+
}
|
|
238
|
+
async mintZipFile(contract, merkleRoot, encryptedHash, creationTimestamp, ipfsHash, metadataURI, gasOptions) {
|
|
239
|
+
const contractTyped = contract;
|
|
240
|
+
const args = [
|
|
241
|
+
merkleRoot,
|
|
242
|
+
encryptedHash || "",
|
|
243
|
+
creationTimestamp,
|
|
244
|
+
ipfsHash,
|
|
245
|
+
metadataURI
|
|
246
|
+
];
|
|
247
|
+
if (gasOptions) {
|
|
248
|
+
return await contractTyped.publicMintZipFile(...args, gasOptions);
|
|
249
|
+
}
|
|
250
|
+
return await contractTyped.publicMintZipFile(...args);
|
|
251
|
+
}
|
|
252
|
+
async getZipFileInfo(contract, tokenId) {
|
|
253
|
+
const contractTyped = contract;
|
|
254
|
+
const runner = contractTyped.runner || contractTyped.provider;
|
|
255
|
+
const adapterContract = new ethers_1.Contract(contractTyped.target, V2_11_ABI, runner);
|
|
256
|
+
const result = await adapterContract.getZipFileInfo(tokenId);
|
|
257
|
+
return {
|
|
258
|
+
merkleRootHash: result[0],
|
|
259
|
+
encryptedHash: result[1] || void 0,
|
|
260
|
+
// May be empty string
|
|
261
|
+
ipfsHash: result[2],
|
|
262
|
+
creator: result[3],
|
|
263
|
+
creationTimestamp: result[4],
|
|
264
|
+
tokenizationTime: result[5],
|
|
265
|
+
blockNumber: result[6]
|
|
266
|
+
// fileName not available in v2.11
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
parseZipFileTokenizedEvent(log) {
|
|
270
|
+
const parsed = iface.parseLog({
|
|
271
|
+
topics: log.topics,
|
|
272
|
+
data: log.data
|
|
273
|
+
});
|
|
274
|
+
if (!parsed || parsed.name !== "ZipFileTokenized") {
|
|
275
|
+
throw new Error("Invalid ZipFileTokenized event");
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
tokenId: parsed.args.tokenId,
|
|
279
|
+
creator: parsed.args.creator,
|
|
280
|
+
merkleRootHash: parsed.args.merkleRootHash,
|
|
281
|
+
encryptedHash: parsed.args.encryptedHash || void 0,
|
|
282
|
+
// May be empty string
|
|
283
|
+
creationTimestamp: parsed.args.creationTimestamp,
|
|
284
|
+
ipfsHash: parsed.args.ipfsHash,
|
|
285
|
+
tokenizationTime: parsed.args.tokenizationTime,
|
|
286
|
+
blockNumber: parsed.args.blockNumber
|
|
287
|
+
// fileName not in v2.11 event
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
async estimateGasForMint(contract, merkleRoot, encryptedHash, creationTimestamp, ipfsHash, metadataURI) {
|
|
291
|
+
const contractTyped = contract;
|
|
292
|
+
return await contractTyped.publicMintZipFile.estimateGas(merkleRoot, encryptedHash || "", creationTimestamp, ipfsHash, metadataURI);
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
exports2.V2_11Adapter = V2_11Adapter;
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
// node_modules/neozipkit/dist/blockchain/core/adapters/AdapterFactory.js
|
|
300
|
+
var require_AdapterFactory = __commonJS({
|
|
301
|
+
"node_modules/neozipkit/dist/blockchain/core/adapters/AdapterFactory.js"(exports2) {
|
|
302
|
+
"use strict";
|
|
303
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
304
|
+
exports2.getAdapter = getAdapter;
|
|
305
|
+
exports2.getAdapterByChainId = getAdapterByChainId;
|
|
306
|
+
var ContractVersionRegistry_1 = require_ContractVersionRegistry();
|
|
307
|
+
var V2_10Adapter_1 = require_V2_10Adapter();
|
|
308
|
+
var V2_11Adapter_1 = require_V2_11Adapter();
|
|
309
|
+
function getAdapter(version) {
|
|
310
|
+
const normalized = (0, ContractVersionRegistry_1.normalizeVersion)(version);
|
|
311
|
+
if (!normalized) {
|
|
312
|
+
throw new Error(`Invalid contract version: "${version}" (normalized to empty string)`);
|
|
313
|
+
}
|
|
314
|
+
if (!(0, ContractVersionRegistry_1.isVersionSupported)(normalized)) {
|
|
315
|
+
throw new Error(`Unsupported contract version: "${version}" (normalized: "${normalized}"). Supported versions: 2.10, 2.11`);
|
|
316
|
+
}
|
|
317
|
+
switch (normalized) {
|
|
318
|
+
case "2.10":
|
|
319
|
+
return new V2_10Adapter_1.V2_10Adapter();
|
|
320
|
+
case "2.11":
|
|
321
|
+
return new V2_11Adapter_1.V2_11Adapter();
|
|
322
|
+
default:
|
|
323
|
+
throw new Error(`Unsupported contract version: "${version}" (normalized: "${normalized}"). Supported versions: 2.10, 2.11`);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
__name(getAdapter, "getAdapter");
|
|
327
|
+
function getAdapterByChainId(chainId, version) {
|
|
328
|
+
if (version) {
|
|
329
|
+
return getAdapter(version);
|
|
330
|
+
}
|
|
331
|
+
const { getContractConfig } = require_contracts();
|
|
332
|
+
const config = getContractConfig(chainId);
|
|
333
|
+
if (!config) {
|
|
334
|
+
throw new Error(`No contract config found for chainId: ${chainId}`);
|
|
335
|
+
}
|
|
336
|
+
if (!config.version) {
|
|
337
|
+
throw new Error(`Contract version not specified for chainId: ${chainId}`);
|
|
338
|
+
}
|
|
339
|
+
return getAdapter(config.version);
|
|
340
|
+
}
|
|
341
|
+
__name(getAdapterByChainId, "getAdapterByChainId");
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
// node_modules/neozipkit/dist/blockchain/core/contracts.js
|
|
69
346
|
var require_contracts = __commonJS({
|
|
70
|
-
"neozipkit/dist/blockchain/core/contracts.js"(exports2) {
|
|
347
|
+
"node_modules/neozipkit/dist/blockchain/core/contracts.js"(exports2) {
|
|
71
348
|
"use strict";
|
|
72
349
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
73
350
|
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;
|
|
@@ -75,13 +352,16 @@ var require_contracts = __commonJS({
|
|
|
75
352
|
exports2.getChainIdByName = getChainIdByName;
|
|
76
353
|
exports2.getNetworkByName = getNetworkByName;
|
|
77
354
|
exports2.getSupportedNetworkNames = getSupportedNetworkNames;
|
|
355
|
+
exports2.getContractAdapter = getContractAdapter;
|
|
356
|
+
exports2.getContractAdapterByVersion = getContractAdapterByVersion;
|
|
78
357
|
exports2.fuzzyMatchNetworkName = fuzzyMatchNetworkName;
|
|
79
358
|
exports2.CONTRACT_CONFIGS = {
|
|
80
|
-
// Base Sepolia (Primary testnet)
|
|
359
|
+
// Base Sepolia (Primary testnet)
|
|
81
360
|
84532: {
|
|
82
361
|
// address: '0xFD76a5d420704F34d84b0767961835c43D7b30a8', // Production contract v2.0
|
|
83
|
-
address:
|
|
84
|
-
|
|
362
|
+
// address: '0xdAe9D83d7AC62197fAE7704abc66b13DA28D3143', // Production contract v2.10
|
|
363
|
+
address: "0xc88F1a9C32bC024Bd082BAe023E10a3BCC5c0e3e",
|
|
364
|
+
// Production contract v2.11
|
|
85
365
|
network: "Base Sepolia",
|
|
86
366
|
chainId: 84532,
|
|
87
367
|
explorerUrl: "https://sepolia.basescan.org",
|
|
@@ -90,6 +370,7 @@ var require_contracts = __commonJS({
|
|
|
90
370
|
"https://base-sepolia-rpc.publicnode.com",
|
|
91
371
|
"https://base-sepolia.gateway.tenderly.co"
|
|
92
372
|
],
|
|
373
|
+
version: "2.11",
|
|
93
374
|
nameAliases: ["base-sepolia", "base sepolia", "basesepolia", "base-sepolia-testnet"]
|
|
94
375
|
},
|
|
95
376
|
// Base Mainnet (Production)
|
|
@@ -105,12 +386,37 @@ var require_contracts = __commonJS({
|
|
|
105
386
|
"https://base.drpc.org",
|
|
106
387
|
"https://base.gateway.tenderly.co"
|
|
107
388
|
],
|
|
389
|
+
version: "2.10",
|
|
108
390
|
nameAliases: ["base-mainnet", "base mainnet", "basemainnet", "base"]
|
|
109
391
|
},
|
|
392
|
+
// Ethereum Sepolia (Testnet)
|
|
393
|
+
// WARNING: Sepolia testnet has been experiencing instability since the Pectra upgrade (March 2025)
|
|
394
|
+
// Network issues include transaction processing failures and RPC timeouts
|
|
395
|
+
// Consider using Base Sepolia (84532) for more reliable testing
|
|
396
|
+
11155111: {
|
|
397
|
+
// address: '0x2716c4609fD97DaEdF429BC4B4Ec2faa81e2cC60', // Production contract v2.10
|
|
398
|
+
address: "0x007e8888D976b0b9B6073694Da32B7b6e393f890",
|
|
399
|
+
// Production contract v2.11
|
|
400
|
+
network: "Sepolia Testnet",
|
|
401
|
+
chainId: 11155111,
|
|
402
|
+
explorerUrl: "https://sepolia.etherscan.io",
|
|
403
|
+
rpcUrls: [
|
|
404
|
+
// Official Sepolia RPC endpoints (most reliable)
|
|
405
|
+
"https://rpc.sepolia.ethpandaops.io",
|
|
406
|
+
// Popular public RPC providers
|
|
407
|
+
"https://eth-sepolia.public.blastapi.io",
|
|
408
|
+
"https://ethereum-sepolia-rpc.publicnode.com",
|
|
409
|
+
"https://sepolia.drpc.org",
|
|
410
|
+
"https://1rpc.io/sepolia"
|
|
411
|
+
],
|
|
412
|
+
version: "2.11",
|
|
413
|
+
nameAliases: ["sepolia-testnet", "sepolia testnet", "sepoliatestnet", "sepolia", "ethereum-sepolia", "ethereum sepolia"]
|
|
414
|
+
},
|
|
110
415
|
// Arbitrum Sepolia (Testnet)
|
|
111
416
|
421614: {
|
|
112
|
-
address:
|
|
113
|
-
|
|
417
|
+
// address: '0x2716c4609fD97DaEdF429BC4B4Ec2faa81e2cC60', // Production contract v2.10
|
|
418
|
+
address: "0x3b99a72cCAc108037741cacb0D60d5571CF6412C",
|
|
419
|
+
// Production contract v2.11
|
|
114
420
|
network: "Arbitrum Sepolia",
|
|
115
421
|
chainId: 421614,
|
|
116
422
|
explorerUrl: "https://sepolia.arbiscan.io",
|
|
@@ -118,6 +424,7 @@ var require_contracts = __commonJS({
|
|
|
118
424
|
"https://sepolia-rollup.arbitrum.io/rpc",
|
|
119
425
|
"https://arbitrum-sepolia-rpc.publicnode.com"
|
|
120
426
|
],
|
|
427
|
+
version: "2.11",
|
|
121
428
|
nameAliases: ["arbitrum-sepolia", "arbitrum sepolia", "arbitrumsepolia", "arbitrum-sepolia-testnet"]
|
|
122
429
|
},
|
|
123
430
|
// Arbitrum One (Production)
|
|
@@ -134,28 +441,8 @@ var require_contracts = __commonJS({
|
|
|
134
441
|
"https://arbitrum.llamarpc.com",
|
|
135
442
|
"https://arbitrum.publicnode.com"
|
|
136
443
|
],
|
|
444
|
+
version: "2.10",
|
|
137
445
|
nameAliases: ["arbitrum-one", "arbitrum one", "arbitrumone", "arbitrum", "arbitrum-mainnet", "arbitrum mainnet"]
|
|
138
|
-
},
|
|
139
|
-
// Ethereum Sepolia (Testnet)
|
|
140
|
-
// WARNING: Sepolia testnet has been experiencing instability since the Pectra upgrade (March 2025)
|
|
141
|
-
// Network issues include transaction processing failures and RPC timeouts
|
|
142
|
-
// Consider using Base Sepolia (84532) for more reliable testing
|
|
143
|
-
11155111: {
|
|
144
|
-
address: "0x2716c4609fD97DaEdF429BC4B4Ec2faa81e2cC60",
|
|
145
|
-
// Production contract v2.10
|
|
146
|
-
network: "Sepolia Testnet",
|
|
147
|
-
chainId: 11155111,
|
|
148
|
-
explorerUrl: "https://sepolia.etherscan.io",
|
|
149
|
-
rpcUrls: [
|
|
150
|
-
// Official Sepolia RPC endpoints (most reliable)
|
|
151
|
-
"https://rpc.sepolia.ethpandaops.io",
|
|
152
|
-
// Popular public RPC providers
|
|
153
|
-
"https://eth-sepolia.public.blastapi.io",
|
|
154
|
-
"https://ethereum-sepolia-rpc.publicnode.com",
|
|
155
|
-
"https://sepolia.drpc.org",
|
|
156
|
-
"https://1rpc.io/sepolia"
|
|
157
|
-
],
|
|
158
|
-
nameAliases: ["sepolia-testnet", "sepolia testnet", "sepoliatestnet", "sepolia", "ethereum-sepolia", "ethereum sepolia"]
|
|
159
446
|
}
|
|
160
447
|
// Ethereum Mainnet (Production) - disabled until NZIP is deployed
|
|
161
448
|
// 1: {
|
|
@@ -167,10 +454,15 @@ var require_contracts = __commonJS({
|
|
|
167
454
|
// }
|
|
168
455
|
};
|
|
169
456
|
exports2.NZIP_CONTRACT_ABI = [
|
|
170
|
-
|
|
457
|
+
// Minting function (v2.11 signature with encryptedHash for new mints)
|
|
458
|
+
"function publicMintZipFile(string memory merkleRootHash, string memory encryptedHash, uint256 creationTimestamp, string memory ipfsHash, string memory metadataURI) public returns (uint256)",
|
|
171
459
|
"function totalSupply() external view returns (uint256)",
|
|
172
460
|
"function getTokensByMerkleRoot(string memory merkleRoot) external view returns (uint256[])",
|
|
173
461
|
"function getTokensByOwner(address owner) external view returns (uint256[])",
|
|
462
|
+
// Minimal getZipFileInfo - only declares fields we need (works for both v2.10 and v2.11)
|
|
463
|
+
// v2.10: returns (merkleRootHash, ipfsHash, creator, creationTimestamp, tokenizationTime, blockNumber)
|
|
464
|
+
// v2.11: returns (merkleRootHash, encryptedHash, ipfsHash, creator, creationTimestamp, tokenizationTime, blockNumber)
|
|
465
|
+
// By only declaring merkleRootHash and tokenizationTime, we can read both versions
|
|
174
466
|
"function getZipFileInfo(uint256 tokenId) external view returns (tuple(string merkleRootHash, string ipfsHash, address creator, uint256 creationTimestamp, uint256 tokenizationTime, uint256 blockNumber))",
|
|
175
467
|
"function ownerOf(uint256 tokenId) external view returns (address)",
|
|
176
468
|
"function balanceOf(address owner) external view returns (uint256)",
|
|
@@ -178,12 +470,14 @@ var require_contracts = __commonJS({
|
|
|
178
470
|
"function verifyZipFile(uint256 tokenId, string memory providedMerkleRoot) external view returns (bool isValid)",
|
|
179
471
|
"function getVersion() external pure returns (string memory)",
|
|
180
472
|
"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)",
|
|
181
|
-
|
|
473
|
+
// v2.11 event with encryptedHash (v2.10 doesn't emit this event during minting, only v2.11 does)
|
|
474
|
+
"event ZipFileTokenized(uint256 indexed tokenId, address indexed creator, string merkleRootHash, string encryptedHash, uint256 creationTimestamp, string ipfsHash, uint256 tokenizationTime, uint256 blockNumber)"
|
|
182
475
|
];
|
|
183
476
|
exports2.NZIP_CONTRACT_ABI_WEB3 = [
|
|
184
477
|
{
|
|
185
478
|
inputs: [
|
|
186
479
|
{ name: "merkleRootHash", type: "string" },
|
|
480
|
+
{ name: "encryptedHash", type: "string" },
|
|
187
481
|
{ name: "creationTimestamp", type: "uint256" },
|
|
188
482
|
{ name: "ipfsHash", type: "string" },
|
|
189
483
|
{ name: "metadataURI", type: "string" }
|
|
@@ -214,6 +508,7 @@ var require_contracts = __commonJS({
|
|
|
214
508
|
{
|
|
215
509
|
components: [
|
|
216
510
|
{ name: "merkleRootHash", type: "string" },
|
|
511
|
+
{ name: "encryptedHash", type: "string" },
|
|
217
512
|
{ name: "ipfsHash", type: "string" },
|
|
218
513
|
{ name: "creator", type: "address" },
|
|
219
514
|
{ name: "creationTimestamp", type: "uint256" },
|
|
@@ -264,6 +559,16 @@ var require_contracts = __commonJS({
|
|
|
264
559
|
stateMutability: "view",
|
|
265
560
|
type: "function"
|
|
266
561
|
},
|
|
562
|
+
{
|
|
563
|
+
inputs: [
|
|
564
|
+
{ name: "tokenId", type: "uint256" },
|
|
565
|
+
{ name: "providedEncryptedHash", type: "string" }
|
|
566
|
+
],
|
|
567
|
+
name: "verifyEncryptedZipFile",
|
|
568
|
+
outputs: [{ name: "isValid", type: "bool" }],
|
|
569
|
+
stateMutability: "view",
|
|
570
|
+
type: "function"
|
|
571
|
+
},
|
|
267
572
|
{
|
|
268
573
|
inputs: [],
|
|
269
574
|
name: "getVersion",
|
|
@@ -287,6 +592,7 @@ var require_contracts = __commonJS({
|
|
|
287
592
|
{ indexed: true, name: "tokenId", type: "uint256" },
|
|
288
593
|
{ indexed: true, name: "creator", type: "address" },
|
|
289
594
|
{ indexed: false, name: "merkleRootHash", type: "string" },
|
|
595
|
+
{ indexed: false, name: "encryptedHash", type: "string" },
|
|
290
596
|
{ indexed: false, name: "creationTimestamp", type: "uint256" },
|
|
291
597
|
{ indexed: false, name: "ipfsHash", type: "string" },
|
|
292
598
|
{ indexed: false, name: "tokenizationTime", type: "uint256" },
|
|
@@ -351,6 +657,23 @@ var require_contracts = __commonJS({
|
|
|
351
657
|
return names;
|
|
352
658
|
}
|
|
353
659
|
__name(getSupportedNetworkNames, "getSupportedNetworkNames");
|
|
660
|
+
function getContractAdapter(chainId) {
|
|
661
|
+
const config = (0, exports2.getContractConfig)(chainId);
|
|
662
|
+
if (!config) {
|
|
663
|
+
throw new Error(`No contract config found for chainId: ${chainId}`);
|
|
664
|
+
}
|
|
665
|
+
if (!config.version) {
|
|
666
|
+
throw new Error(`Contract version not specified for chainId: ${chainId}`);
|
|
667
|
+
}
|
|
668
|
+
const { getAdapter } = require_AdapterFactory();
|
|
669
|
+
return getAdapter(config.version);
|
|
670
|
+
}
|
|
671
|
+
__name(getContractAdapter, "getContractAdapter");
|
|
672
|
+
function getContractAdapterByVersion(version) {
|
|
673
|
+
const { getAdapter } = require_AdapterFactory();
|
|
674
|
+
return getAdapter(version);
|
|
675
|
+
}
|
|
676
|
+
__name(getContractAdapterByVersion, "getContractAdapterByVersion");
|
|
354
677
|
function fuzzyMatchNetworkName(networkName) {
|
|
355
678
|
const normalized = normalizeNetworkName(networkName);
|
|
356
679
|
const exactMatch = getNetworkByName(networkName);
|
|
@@ -385,9 +708,9 @@ var require_contracts = __commonJS({
|
|
|
385
708
|
}
|
|
386
709
|
});
|
|
387
710
|
|
|
388
|
-
// neozipkit/dist/blockchain/core/ZipkitMinter.js
|
|
711
|
+
// node_modules/neozipkit/dist/blockchain/core/ZipkitMinter.js
|
|
389
712
|
var require_ZipkitMinter = __commonJS({
|
|
390
|
-
"neozipkit/dist/blockchain/core/ZipkitMinter.js"(exports2) {
|
|
713
|
+
"node_modules/neozipkit/dist/blockchain/core/ZipkitMinter.js"(exports2) {
|
|
391
714
|
"use strict";
|
|
392
715
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
393
716
|
exports2.ZipkitMinter = void 0;
|
|
@@ -400,6 +723,7 @@ var require_ZipkitMinter = __commonJS({
|
|
|
400
723
|
}
|
|
401
724
|
constructor(merkleRoot, options) {
|
|
402
725
|
this.merkleRoot = merkleRoot;
|
|
726
|
+
this.encryptedHash = options.encryptedHash || "";
|
|
403
727
|
this.debug = options.debug || false;
|
|
404
728
|
this.rpcUrlIndex = options.rpcUrlIndex ?? 0;
|
|
405
729
|
const chainId = (0, contracts_1.getChainIdByName)(options.network);
|
|
@@ -441,7 +765,8 @@ var require_ZipkitMinter = __commonJS({
|
|
|
441
765
|
return {
|
|
442
766
|
address: this.wallet.address,
|
|
443
767
|
balance: balanceInEth,
|
|
444
|
-
networkName: this.networkConfig.network
|
|
768
|
+
networkName: this.networkConfig.network,
|
|
769
|
+
chainId: this.networkConfig.chainId
|
|
445
770
|
};
|
|
446
771
|
}
|
|
447
772
|
/**
|
|
@@ -532,8 +857,11 @@ var require_ZipkitMinter = __commonJS({
|
|
|
532
857
|
async estimateGasCosts() {
|
|
533
858
|
const creationTimestamp = Math.floor(Date.now() / 1e3);
|
|
534
859
|
const metadata = this.createTokenMetadataString();
|
|
535
|
-
const
|
|
860
|
+
const adapter = (0, contracts_1.getContractAdapter)(this.networkConfig.chainId);
|
|
861
|
+
const gasLimit = await adapter.estimateGasForMint(
|
|
862
|
+
this.contract,
|
|
536
863
|
this.merkleRoot,
|
|
864
|
+
this.encryptedHash || void 0,
|
|
537
865
|
creationTimestamp,
|
|
538
866
|
"",
|
|
539
867
|
// ipfsHash
|
|
@@ -568,16 +896,23 @@ var require_ZipkitMinter = __commonJS({
|
|
|
568
896
|
*/
|
|
569
897
|
createTokenMetadata(tokenId, transactionHash, blockNumber) {
|
|
570
898
|
const now = /* @__PURE__ */ new Date();
|
|
899
|
+
if (!this.networkConfig.version) {
|
|
900
|
+
throw new Error(`Contract version not specified for network ${this.networkConfig.network} (chainId: ${this.networkConfig.chainId})`);
|
|
901
|
+
}
|
|
571
902
|
return {
|
|
572
903
|
tokenId,
|
|
573
904
|
network: this.networkConfig.network,
|
|
574
905
|
networkChainId: this.networkConfig.chainId,
|
|
575
906
|
contractAddress: this.networkConfig.address,
|
|
576
907
|
merkleRoot: this.merkleRoot,
|
|
908
|
+
encryptedHash: this.encryptedHash || void 0,
|
|
909
|
+
// Include encrypted hash if present (v2.11+)
|
|
577
910
|
mintDate: now.toLocaleDateString("en-US") + " at " + now.toLocaleTimeString("en-US"),
|
|
578
911
|
creationTimestamp: Math.floor(now.getTime() / 1e3),
|
|
579
912
|
transactionHash,
|
|
580
|
-
blockNumber
|
|
913
|
+
blockNumber,
|
|
914
|
+
contractVersion: this.networkConfig.version
|
|
915
|
+
// Required - always set from networkConfig
|
|
581
916
|
};
|
|
582
917
|
}
|
|
583
918
|
/**
|
|
@@ -600,10 +935,13 @@ var require_ZipkitMinter = __commonJS({
|
|
|
600
935
|
}
|
|
601
936
|
let gasLimit;
|
|
602
937
|
let gasPrice;
|
|
938
|
+
const adapter = (0, contracts_1.getContractAdapter)(this.networkConfig.chainId);
|
|
603
939
|
try {
|
|
604
940
|
const gasEstimate = await Promise.race([
|
|
605
|
-
|
|
941
|
+
adapter.estimateGasForMint(
|
|
942
|
+
this.contract,
|
|
606
943
|
this.merkleRoot,
|
|
944
|
+
this.encryptedHash || void 0,
|
|
607
945
|
creationTimestamp,
|
|
608
946
|
"",
|
|
609
947
|
// ipfsHash
|
|
@@ -643,8 +981,10 @@ var require_ZipkitMinter = __commonJS({
|
|
|
643
981
|
console.log(`[DEBUG] Submitting transaction with gas limit: ${gasLimit.toString()}, gas price: ${ethers_1.ethers.formatUnits(gasPrice, "gwei")} gwei`);
|
|
644
982
|
}
|
|
645
983
|
const tx = await Promise.race([
|
|
646
|
-
|
|
984
|
+
adapter.mintZipFile(
|
|
985
|
+
this.contract,
|
|
647
986
|
this.merkleRoot,
|
|
987
|
+
this.encryptedHash || void 0,
|
|
648
988
|
creationTimestamp,
|
|
649
989
|
"",
|
|
650
990
|
// ipfsHash (empty since we store in ZIP)
|
|
@@ -696,17 +1036,17 @@ var require_ZipkitMinter = __commonJS({
|
|
|
696
1036
|
let actualTokenId = tokenId;
|
|
697
1037
|
if (receipt.logs && receipt.logs.length > 0) {
|
|
698
1038
|
try {
|
|
699
|
-
const iface = new ethers_1.ethers.Interface(contracts_1.NZIP_CONTRACT_ABI);
|
|
700
1039
|
for (const log of receipt.logs) {
|
|
701
1040
|
try {
|
|
702
|
-
const
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
1041
|
+
const parsedEvent = adapter.parseZipFileTokenizedEvent({
|
|
1042
|
+
topics: log.topics,
|
|
1043
|
+
data: log.data
|
|
1044
|
+
});
|
|
1045
|
+
actualTokenId = parsedEvent.tokenId.toString();
|
|
1046
|
+
if (this.debug) {
|
|
1047
|
+
console.log(`[DEBUG] Actual token ID from contract event: ${actualTokenId}`);
|
|
709
1048
|
}
|
|
1049
|
+
break;
|
|
710
1050
|
} catch (e) {
|
|
711
1051
|
}
|
|
712
1052
|
}
|
|
@@ -819,6 +1159,59 @@ var require_ZipkitMinter = __commonJS({
|
|
|
819
1159
|
}
|
|
820
1160
|
}
|
|
821
1161
|
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Mint token with retry logic and exponential backoff
|
|
1164
|
+
* @param maxRetries Maximum number of retry attempts (default: 3)
|
|
1165
|
+
* @returns Minting result with retry information
|
|
1166
|
+
*/
|
|
1167
|
+
async mintTokenWithRetry(maxRetries = 3) {
|
|
1168
|
+
let lastError = null;
|
|
1169
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
1170
|
+
try {
|
|
1171
|
+
console.log(`\u{1F504} Minting attempt ${attempt}/${maxRetries}`);
|
|
1172
|
+
const result = await this.mintToken();
|
|
1173
|
+
if (result.success) {
|
|
1174
|
+
console.log(`\u2705 Minting successful on attempt ${attempt}`);
|
|
1175
|
+
return result;
|
|
1176
|
+
}
|
|
1177
|
+
lastError = new Error(result.message || "Minting failed");
|
|
1178
|
+
} catch (error) {
|
|
1179
|
+
lastError = error instanceof Error ? error : new Error("Unknown error");
|
|
1180
|
+
console.warn(`\u274C Minting attempt ${attempt} failed:`, lastError.message);
|
|
1181
|
+
if (attempt < maxRetries) {
|
|
1182
|
+
const delay = Math.pow(2, attempt) * 1e3;
|
|
1183
|
+
console.log(`\u23F3 Waiting ${delay}ms before retry...`);
|
|
1184
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
return {
|
|
1189
|
+
success: false,
|
|
1190
|
+
message: `Minting failed after ${maxRetries} attempts: ${lastError?.message || "Unknown error"}`
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Batch minting for multiple archives
|
|
1195
|
+
* @param archives Array of archive objects with name and merkleRoot
|
|
1196
|
+
* @returns Array of minting results
|
|
1197
|
+
*/
|
|
1198
|
+
async mintBatch(archives) {
|
|
1199
|
+
const results = [];
|
|
1200
|
+
for (const archive of archives) {
|
|
1201
|
+
try {
|
|
1202
|
+
this.merkleRoot = archive.merkleRoot;
|
|
1203
|
+
const result = await this.mintToken();
|
|
1204
|
+
results.push(result);
|
|
1205
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
1206
|
+
} catch (error) {
|
|
1207
|
+
results.push({
|
|
1208
|
+
success: false,
|
|
1209
|
+
message: `Failed to mint ${archive.name}: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
return results;
|
|
1214
|
+
}
|
|
822
1215
|
};
|
|
823
1216
|
exports2.ZipkitMinter = ZipkitMinter;
|
|
824
1217
|
function validatePrivateKey(privateKey) {
|
|
@@ -833,24 +1226,160 @@ var require_ZipkitMinter = __commonJS({
|
|
|
833
1226
|
}
|
|
834
1227
|
});
|
|
835
1228
|
|
|
836
|
-
// neozipkit/dist/blockchain/core/ZipkitVerifier.js
|
|
1229
|
+
// node_modules/neozipkit/dist/blockchain/core/ZipkitVerifier.js
|
|
837
1230
|
var require_ZipkitVerifier = __commonJS({
|
|
838
|
-
"neozipkit/dist/blockchain/core/ZipkitVerifier.js"(exports2) {
|
|
1231
|
+
"node_modules/neozipkit/dist/blockchain/core/ZipkitVerifier.js"(exports2) {
|
|
839
1232
|
"use strict";
|
|
840
1233
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
841
1234
|
exports2.ZipkitVerifier = void 0;
|
|
842
1235
|
var ethers_1 = require("ethers");
|
|
843
1236
|
var contracts_1 = require_contracts();
|
|
844
|
-
var
|
|
1237
|
+
var AdapterFactory_1 = require_AdapterFactory();
|
|
1238
|
+
var ContractVersionRegistry_1 = require_ContractVersionRegistry();
|
|
1239
|
+
var ZipkitVerifier = class _ZipkitVerifier {
|
|
845
1240
|
static {
|
|
846
1241
|
__name(this, "ZipkitVerifier");
|
|
847
1242
|
}
|
|
848
1243
|
constructor(options = {}) {
|
|
849
1244
|
this.debug = options.debug || false;
|
|
1245
|
+
this.maxRetries = options.maxRetries || 3;
|
|
1246
|
+
this.retryDelay = options.retryDelay || 1e3;
|
|
1247
|
+
this.batchDelay = options.batchDelay || 500;
|
|
850
1248
|
if (this.debug) {
|
|
851
1249
|
console.log(`[DEBUG] ZipkitVerifier initialized`);
|
|
852
1250
|
}
|
|
853
1251
|
}
|
|
1252
|
+
/**
|
|
1253
|
+
* Extracts and normalizes token metadata from a tokenized ZIP archive.
|
|
1254
|
+
*
|
|
1255
|
+
* Handles field name variations across different token versions:
|
|
1256
|
+
* - chainId vs networkChainId
|
|
1257
|
+
* - timestamp vs mintedAt
|
|
1258
|
+
* - Validates required fields
|
|
1259
|
+
*
|
|
1260
|
+
* @param zipkit - ZipkitNode instance with loaded archive
|
|
1261
|
+
* @returns Normalized TokenMetadata or null if not tokenized
|
|
1262
|
+
* @throws Error if TOKEN file exists but is invalid
|
|
1263
|
+
*
|
|
1264
|
+
* @example
|
|
1265
|
+
* ```typescript
|
|
1266
|
+
* import { ZipkitNode } from 'neozipkit/node';
|
|
1267
|
+
* import { ZipkitVerifier } from 'neozipkit/blockchain';
|
|
1268
|
+
*
|
|
1269
|
+
* const zipkit = new ZipkitNode();
|
|
1270
|
+
* await zipkit.loadZipFile('archive.nzip');
|
|
1271
|
+
* const metadata = await ZipkitVerifier.extractTokenMetadata(zipkit);
|
|
1272
|
+
* if (metadata) {
|
|
1273
|
+
* console.log(`Token ID: ${metadata.tokenId}`);
|
|
1274
|
+
* console.log(`Network: ${metadata.network}`);
|
|
1275
|
+
* }
|
|
1276
|
+
* ```
|
|
1277
|
+
*/
|
|
1278
|
+
static async extractTokenMetadata(zipkit) {
|
|
1279
|
+
try {
|
|
1280
|
+
const tokenEntry = zipkit.getZipEntry("META-INF/NZIP.TOKEN");
|
|
1281
|
+
if (!tokenEntry) {
|
|
1282
|
+
return null;
|
|
1283
|
+
}
|
|
1284
|
+
const tokenDataBuffer = await zipkit.extractToBuffer(tokenEntry, {
|
|
1285
|
+
skipHashCheck: false
|
|
1286
|
+
});
|
|
1287
|
+
const tokenData = tokenDataBuffer.toString("utf-8");
|
|
1288
|
+
const rawMetadata = JSON.parse(tokenData);
|
|
1289
|
+
const chainId = rawMetadata.chainId ?? rawMetadata.networkChainId;
|
|
1290
|
+
const timestamp = rawMetadata.timestamp ?? rawMetadata.mintedAt;
|
|
1291
|
+
let networkChainId = chainId;
|
|
1292
|
+
let contractVersion = rawMetadata.contractVersion;
|
|
1293
|
+
if (!networkChainId && rawMetadata.network) {
|
|
1294
|
+
const networkConfig = (0, contracts_1.getNetworkByName)(rawMetadata.network);
|
|
1295
|
+
if (networkConfig) {
|
|
1296
|
+
networkChainId = networkConfig.chainId;
|
|
1297
|
+
console.warn(`[WARNING] TOKEN file missing networkChainId - inferred ${networkChainId} from network name "${rawMetadata.network}"`);
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
if (!networkChainId) {
|
|
1301
|
+
throw new Error('Invalid token metadata: missing required field "networkChainId" (and could not infer from network name)');
|
|
1302
|
+
}
|
|
1303
|
+
if (!contractVersion) {
|
|
1304
|
+
console.warn(`[WARNING] TOKEN file missing contractVersion (common for v2.10 files) - verification will try all versions automatically`);
|
|
1305
|
+
contractVersion = "unknown";
|
|
1306
|
+
}
|
|
1307
|
+
const metadata = {
|
|
1308
|
+
tokenId: rawMetadata.tokenId,
|
|
1309
|
+
contractAddress: rawMetadata.contractAddress,
|
|
1310
|
+
network: rawMetadata.network,
|
|
1311
|
+
networkChainId,
|
|
1312
|
+
// Required - now guaranteed to be set
|
|
1313
|
+
contractVersion,
|
|
1314
|
+
// Required - now guaranteed to be set
|
|
1315
|
+
merkleRoot: rawMetadata.merkleRoot,
|
|
1316
|
+
creationTimestamp: rawMetadata.blockNumber || rawMetadata.creationTimestamp,
|
|
1317
|
+
transactionHash: rawMetadata.transactionHash,
|
|
1318
|
+
owner: rawMetadata.owner || rawMetadata.ownerAddress,
|
|
1319
|
+
encryptedHash: rawMetadata.encryptedHash,
|
|
1320
|
+
mintedAt: rawMetadata.mintedAt || rawMetadata.mintDate,
|
|
1321
|
+
mintDate: rawMetadata.mintDate || rawMetadata.mintedAt,
|
|
1322
|
+
ipfsHash: rawMetadata.ipfsHash,
|
|
1323
|
+
blockNumber: rawMetadata.blockNumber
|
|
1324
|
+
};
|
|
1325
|
+
if (!metadata.tokenId || !metadata.contractAddress || !metadata.merkleRoot) {
|
|
1326
|
+
throw new Error("Invalid token metadata: missing required fields (tokenId, contractAddress, or merkleRoot)");
|
|
1327
|
+
}
|
|
1328
|
+
return metadata;
|
|
1329
|
+
} catch (error) {
|
|
1330
|
+
if (error instanceof Error && error.message.includes("Invalid token metadata")) {
|
|
1331
|
+
throw error;
|
|
1332
|
+
}
|
|
1333
|
+
return null;
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* Instance method for convenience - extracts token metadata from loaded archive
|
|
1338
|
+
* @param zipkit - ZipkitNode instance with loaded archive
|
|
1339
|
+
* @returns Normalized TokenMetadata or null if not tokenized
|
|
1340
|
+
*/
|
|
1341
|
+
async getTokenMetadata(zipkit) {
|
|
1342
|
+
return _ZipkitVerifier.extractTokenMetadata(zipkit);
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* Query contract version from blockchain
|
|
1346
|
+
* @param contractAddress - Contract address
|
|
1347
|
+
* @param networkConfig - Network configuration with RPC URLs
|
|
1348
|
+
* @param rpcUrlIndex - Optional RPC URL index (default: 0)
|
|
1349
|
+
* @returns Contract version string or null if query fails
|
|
1350
|
+
*/
|
|
1351
|
+
async queryContractVersion(contractAddress, networkConfig, rpcUrlIndex = 0) {
|
|
1352
|
+
const rpcUrls = networkConfig.rpcUrls.length > 0 ? networkConfig.rpcUrls : [];
|
|
1353
|
+
if (rpcUrls.length === 0 || rpcUrlIndex >= rpcUrls.length) {
|
|
1354
|
+
return null;
|
|
1355
|
+
}
|
|
1356
|
+
const rpcUrl = rpcUrls[rpcUrlIndex];
|
|
1357
|
+
let provider = null;
|
|
1358
|
+
try {
|
|
1359
|
+
provider = new ethers_1.ethers.JsonRpcProvider(rpcUrl);
|
|
1360
|
+
const contract = new ethers_1.ethers.Contract(contractAddress, contracts_1.NZIP_CONTRACT_ABI, provider);
|
|
1361
|
+
const version = await Promise.race([
|
|
1362
|
+
contract.getVersion(),
|
|
1363
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error("getVersion timeout after 10 seconds")), 1e4))
|
|
1364
|
+
]);
|
|
1365
|
+
if (this.debug) {
|
|
1366
|
+
console.log(`[DEBUG] Contract version queried from blockchain: ${version}`);
|
|
1367
|
+
}
|
|
1368
|
+
return version;
|
|
1369
|
+
} catch (error) {
|
|
1370
|
+
if (this.debug) {
|
|
1371
|
+
console.log(`[DEBUG] Failed to query contract version: ${error.message || String(error)}`);
|
|
1372
|
+
}
|
|
1373
|
+
return null;
|
|
1374
|
+
} finally {
|
|
1375
|
+
try {
|
|
1376
|
+
if (provider) {
|
|
1377
|
+
provider.destroy();
|
|
1378
|
+
}
|
|
1379
|
+
} catch (cleanupError) {
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
854
1383
|
/**
|
|
855
1384
|
* Extract and validate token metadata from ZIP
|
|
856
1385
|
*/
|
|
@@ -860,7 +1389,7 @@ var require_ZipkitVerifier = __commonJS({
|
|
|
860
1389
|
console.log(`[DEBUG] Extracting token metadata from buffer (${tokenBuffer.length} bytes)`);
|
|
861
1390
|
}
|
|
862
1391
|
const tokenData = JSON.parse(tokenBuffer.toString("utf8"));
|
|
863
|
-
const requiredFields = ["tokenId", "contractAddress", "network"];
|
|
1392
|
+
const requiredFields = ["tokenId", "contractAddress", "network", "merkleRoot"];
|
|
864
1393
|
for (const field of requiredFields) {
|
|
865
1394
|
if (!tokenData[field]) {
|
|
866
1395
|
if (this.debug) {
|
|
@@ -872,16 +1401,85 @@ var require_ZipkitVerifier = __commonJS({
|
|
|
872
1401
|
};
|
|
873
1402
|
}
|
|
874
1403
|
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
1404
|
+
let networkChainId = tokenData.networkChainId ?? tokenData.chainId;
|
|
1405
|
+
let contractVersion = tokenData.contractVersion;
|
|
1406
|
+
if (!networkChainId && tokenData.network) {
|
|
1407
|
+
const networkConfig = (0, contracts_1.getNetworkByName)(tokenData.network);
|
|
1408
|
+
if (networkConfig) {
|
|
1409
|
+
networkChainId = networkConfig.chainId;
|
|
1410
|
+
if (this.debug) {
|
|
1411
|
+
console.log(`[DEBUG] TOKEN file missing networkChainId - inferred ${networkChainId} from network name "${tokenData.network}"`);
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
878
1414
|
}
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
1415
|
+
if (!networkChainId) {
|
|
1416
|
+
return {
|
|
1417
|
+
success: false,
|
|
1418
|
+
error: "Missing required field: networkChainId (and could not infer from network name)"
|
|
1419
|
+
};
|
|
1420
|
+
}
|
|
1421
|
+
if (!contractVersion && networkChainId && tokenData.contractAddress) {
|
|
1422
|
+
const networkConfig = (0, contracts_1.getContractConfig)(networkChainId);
|
|
1423
|
+
if (networkConfig) {
|
|
1424
|
+
if (this.debug) {
|
|
1425
|
+
console.log(`[DEBUG] TOKEN file missing contractVersion - attempting to query from blockchain...`);
|
|
1426
|
+
}
|
|
1427
|
+
try {
|
|
1428
|
+
const blockchainVersion = await this.queryContractVersion(tokenData.contractAddress, networkConfig, 0);
|
|
1429
|
+
if (blockchainVersion) {
|
|
1430
|
+
const normalized = (0, ContractVersionRegistry_1.normalizeVersion)(blockchainVersion);
|
|
1431
|
+
if (normalized && (0, ContractVersionRegistry_1.isVersionSupported)(normalized)) {
|
|
1432
|
+
contractVersion = normalized;
|
|
1433
|
+
if (this.debug) {
|
|
1434
|
+
console.log(`[DEBUG] Successfully queried contractVersion from blockchain: ${contractVersion}`);
|
|
1435
|
+
}
|
|
1436
|
+
} else {
|
|
1437
|
+
if (this.debug) {
|
|
1438
|
+
console.log(`[DEBUG] Queried version ${blockchainVersion} (normalized: ${normalized}) is not supported`);
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
} catch (queryError) {
|
|
1443
|
+
if (this.debug) {
|
|
1444
|
+
console.log(`[DEBUG] Failed to query contract version from blockchain: ${queryError.message || String(queryError)}`);
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
if (!contractVersion) {
|
|
1450
|
+
if (this.debug) {
|
|
1451
|
+
console.log(`[DEBUG] \u26A0\uFE0F Contract version not found in TOKEN file or blockchain. Will try all versions during verification.`);
|
|
1452
|
+
}
|
|
1453
|
+
contractVersion = "unknown";
|
|
1454
|
+
}
|
|
1455
|
+
const metadata = {
|
|
1456
|
+
tokenId: tokenData.tokenId,
|
|
1457
|
+
contractAddress: tokenData.contractAddress,
|
|
1458
|
+
network: tokenData.network,
|
|
1459
|
+
networkChainId,
|
|
1460
|
+
// Required - now guaranteed to be set
|
|
1461
|
+
contractVersion,
|
|
1462
|
+
// Required - now guaranteed to be set
|
|
1463
|
+
merkleRoot: tokenData.merkleRoot,
|
|
1464
|
+
transactionHash: tokenData.transactionHash,
|
|
1465
|
+
blockNumber: tokenData.blockNumber,
|
|
1466
|
+
owner: tokenData.owner || tokenData.ownerAddress,
|
|
1467
|
+
encryptedHash: tokenData.encryptedHash,
|
|
1468
|
+
mintedAt: tokenData.mintedAt || tokenData.mintDate,
|
|
1469
|
+
mintDate: tokenData.mintDate || tokenData.mintedAt,
|
|
1470
|
+
creationTimestamp: tokenData.creationTimestamp || tokenData.blockNumber,
|
|
1471
|
+
ipfsHash: tokenData.ipfsHash
|
|
1472
|
+
};
|
|
1473
|
+
if (this.debug) {
|
|
1474
|
+
console.log(`[DEBUG] Token metadata extracted successfully`);
|
|
1475
|
+
console.log(`[DEBUG] Token ID: ${metadata.tokenId}, Network: ${metadata.network}, ChainId: ${metadata.networkChainId}, Version: ${metadata.contractVersion}`);
|
|
1476
|
+
}
|
|
1477
|
+
return {
|
|
1478
|
+
success: true,
|
|
1479
|
+
metadata
|
|
1480
|
+
};
|
|
1481
|
+
} catch (error) {
|
|
1482
|
+
const errorMessage = error instanceof Error ? error.message : "Invalid JSON format";
|
|
885
1483
|
if (this.debug) {
|
|
886
1484
|
console.log(`[DEBUG] Failed to parse token metadata: ${errorMessage}`);
|
|
887
1485
|
}
|
|
@@ -1005,43 +1603,82 @@ var require_ZipkitVerifier = __commonJS({
|
|
|
1005
1603
|
if (this.debug) {
|
|
1006
1604
|
console.log(`[DEBUG] Calling contract.verifyZipFile(${tokenId}, ${merkleRoot.substring(0, 10)}...)`);
|
|
1007
1605
|
}
|
|
1606
|
+
const versionsToTry = [];
|
|
1607
|
+
if (networkConfig.version && networkConfig.version !== "unknown") {
|
|
1608
|
+
versionsToTry.push(networkConfig.version);
|
|
1609
|
+
} else {
|
|
1610
|
+
versionsToTry.push("2.10");
|
|
1611
|
+
}
|
|
1612
|
+
if (versionsToTry.length === 0) {
|
|
1613
|
+
return {
|
|
1614
|
+
success: false,
|
|
1615
|
+
error: "No contract versions available to try. No versions implemented or detected."
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1008
1618
|
let onChainMerkleRoot;
|
|
1009
1619
|
let onChainTokenizationTime;
|
|
1010
1620
|
let onChainCreator;
|
|
1011
1621
|
let onChainBlockNumber;
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1622
|
+
let onChainEncryptedHash;
|
|
1623
|
+
let lastError;
|
|
1624
|
+
let successfulVersion;
|
|
1625
|
+
for (const version of versionsToTry) {
|
|
1626
|
+
try {
|
|
1627
|
+
if (this.debug) {
|
|
1628
|
+
console.log(`[DEBUG] Trying contract version: ${version}`);
|
|
1629
|
+
}
|
|
1630
|
+
const adapter = (0, AdapterFactory_1.getAdapter)(version);
|
|
1631
|
+
const zipFileInfo = await Promise.race([
|
|
1632
|
+
adapter.getZipFileInfo(contract, BigInt(tokenId)),
|
|
1633
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error("getZipFileInfo timeout after 10 seconds")), 1e4))
|
|
1634
|
+
]);
|
|
1635
|
+
onChainMerkleRoot = zipFileInfo.merkleRootHash;
|
|
1636
|
+
onChainTokenizationTime = Number(zipFileInfo.tokenizationTime);
|
|
1637
|
+
onChainCreator = zipFileInfo.creator;
|
|
1638
|
+
onChainBlockNumber = Number(zipFileInfo.blockNumber);
|
|
1639
|
+
onChainEncryptedHash = zipFileInfo.encryptedHash || void 0;
|
|
1640
|
+
successfulVersion = version;
|
|
1641
|
+
if (this.debug) {
|
|
1642
|
+
console.log(`[DEBUG] Successfully queried token info using version ${version}`);
|
|
1643
|
+
console.log(`[DEBUG] Token ${tokenId} exists`);
|
|
1644
|
+
console.log(`[DEBUG] On-chain merkle root: ${onChainMerkleRoot}`);
|
|
1645
|
+
console.log(`[DEBUG] On-chain tokenization time: ${onChainTokenizationTime} (${new Date(onChainTokenizationTime * 1e3).toLocaleString()})`);
|
|
1646
|
+
console.log(`[DEBUG] On-chain creator: ${onChainCreator}`);
|
|
1647
|
+
console.log(`[DEBUG] On-chain block number: ${onChainBlockNumber}`);
|
|
1648
|
+
console.log(`[DEBUG] Calculated merkle root: ${merkleRoot}`);
|
|
1649
|
+
}
|
|
1650
|
+
break;
|
|
1651
|
+
} catch (infoError) {
|
|
1652
|
+
const errorMsg = infoError.message || String(infoError);
|
|
1653
|
+
lastError = errorMsg;
|
|
1654
|
+
if (this.debug) {
|
|
1655
|
+
console.log(`[DEBUG] Version ${version} failed: ${errorMsg}`);
|
|
1656
|
+
}
|
|
1657
|
+
if (errorMsg.includes("nonexistent token") || errorMsg.includes("ERC721: invalid token ID")) {
|
|
1658
|
+
return {
|
|
1659
|
+
success: false,
|
|
1660
|
+
error: `Token ${tokenId} does not exist on contract ${contractAddress}`
|
|
1661
|
+
};
|
|
1662
|
+
}
|
|
1663
|
+
if (errorMsg.includes("out of result range") || errorMsg.includes("data out-of-bounds")) {
|
|
1664
|
+
if (this.debug) {
|
|
1665
|
+
console.log(`[DEBUG] Version ${version} incompatible (wrong return structure), trying next version...`);
|
|
1666
|
+
}
|
|
1667
|
+
continue;
|
|
1668
|
+
}
|
|
1669
|
+
continue;
|
|
1039
1670
|
}
|
|
1671
|
+
}
|
|
1672
|
+
if (!onChainMerkleRoot) {
|
|
1673
|
+
const triedVersions = versionsToTry.join(", ");
|
|
1040
1674
|
return {
|
|
1041
1675
|
success: false,
|
|
1042
|
-
error: `Failed to get token info: ${
|
|
1676
|
+
error: `Failed to get token info after trying all versions (${triedVersions}). Last error: ${lastError || "Unknown error"}`
|
|
1043
1677
|
};
|
|
1044
1678
|
}
|
|
1679
|
+
if (this.debug && successfulVersion && successfulVersion !== networkConfig.version) {
|
|
1680
|
+
console.log(`[DEBUG] \u26A0\uFE0F Contract version mismatch: network config says "${networkConfig.version || "unknown"}", but "${successfulVersion}" worked. Consider updating network config.`);
|
|
1681
|
+
}
|
|
1045
1682
|
const merkleRootMatch = onChainMerkleRoot && onChainMerkleRoot.toLowerCase() === merkleRoot.toLowerCase();
|
|
1046
1683
|
if (this.debug) {
|
|
1047
1684
|
console.log(`[DEBUG] Merkle root match: ${merkleRootMatch}`);
|
|
@@ -1126,7 +1763,14 @@ var require_ZipkitVerifier = __commonJS({
|
|
|
1126
1763
|
}
|
|
1127
1764
|
};
|
|
1128
1765
|
}
|
|
1129
|
-
const
|
|
1766
|
+
const configToUse = { ...networkConfig };
|
|
1767
|
+
if (!tokenMetadata.contractVersion || tokenMetadata.contractVersion === "unknown") {
|
|
1768
|
+
if (this.debug) {
|
|
1769
|
+
console.log(`[DEBUG] TOKEN file missing contractVersion - overriding network config version to default to v2.10`);
|
|
1770
|
+
}
|
|
1771
|
+
configToUse.version = "unknown";
|
|
1772
|
+
}
|
|
1773
|
+
const onChainResult = await this.verifyOnChain(tokenMetadata.tokenId, tokenMetadata.contractAddress, configToUse, calculatedMerkleRoot, rpcUrlIndex);
|
|
1130
1774
|
if (!onChainResult.success) {
|
|
1131
1775
|
return {
|
|
1132
1776
|
success: false,
|
|
@@ -1215,14 +1859,203 @@ var require_ZipkitVerifier = __commonJS({
|
|
|
1215
1859
|
};
|
|
1216
1860
|
}
|
|
1217
1861
|
}
|
|
1862
|
+
/**
|
|
1863
|
+
* Verify token with retry logic and exponential backoff
|
|
1864
|
+
* @param tokenMetadata Token metadata to verify
|
|
1865
|
+
* @param calculatedMerkleRoot Calculated merkle root from archive
|
|
1866
|
+
* @param maxRetries Maximum number of retry attempts (default: uses instance maxRetries)
|
|
1867
|
+
* @returns Enhanced verification result with retry information
|
|
1868
|
+
*/
|
|
1869
|
+
async verifyTokenWithRetry(tokenMetadata, calculatedMerkleRoot, maxRetries) {
|
|
1870
|
+
const startTime = Date.now();
|
|
1871
|
+
const retries = maxRetries || this.maxRetries;
|
|
1872
|
+
let lastError = null;
|
|
1873
|
+
for (let attempt = 1; attempt <= retries; attempt++) {
|
|
1874
|
+
try {
|
|
1875
|
+
console.log(`\u{1F504} Verification attempt ${attempt}/${retries} for token ${tokenMetadata.tokenId}`);
|
|
1876
|
+
const result = await this.verifyToken(tokenMetadata, calculatedMerkleRoot);
|
|
1877
|
+
if (result.success) {
|
|
1878
|
+
console.log(`\u2705 Verification successful on attempt ${attempt} for token ${tokenMetadata.tokenId}`);
|
|
1879
|
+
return {
|
|
1880
|
+
...result,
|
|
1881
|
+
retryAttempts: attempt,
|
|
1882
|
+
processingTime: Date.now() - startTime,
|
|
1883
|
+
timestamp: Date.now()
|
|
1884
|
+
};
|
|
1885
|
+
}
|
|
1886
|
+
lastError = new Error(result.message || "Verification failed");
|
|
1887
|
+
} catch (error) {
|
|
1888
|
+
lastError = error instanceof Error ? error : new Error("Unknown verification error");
|
|
1889
|
+
console.warn(`\u274C Verification attempt ${attempt} failed for token ${tokenMetadata.tokenId}:`, lastError.message);
|
|
1890
|
+
if (attempt < retries) {
|
|
1891
|
+
const delay = this.calculateRetryDelay(attempt);
|
|
1892
|
+
console.log(`\u23F3 Waiting ${delay}ms before retry...`);
|
|
1893
|
+
await this.delay(delay);
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
return {
|
|
1898
|
+
success: false,
|
|
1899
|
+
message: `Verification failed after ${retries} attempts: ${lastError?.message || "Unknown error"}`,
|
|
1900
|
+
retryAttempts: retries,
|
|
1901
|
+
processingTime: Date.now() - startTime,
|
|
1902
|
+
timestamp: Date.now()
|
|
1903
|
+
};
|
|
1904
|
+
}
|
|
1905
|
+
/**
|
|
1906
|
+
* Batch verification for multiple tokens with rate limiting
|
|
1907
|
+
* @param tokens Array of token metadata and merkle roots to verify
|
|
1908
|
+
* @param options Batch processing options
|
|
1909
|
+
* @returns Batch verification result
|
|
1910
|
+
*/
|
|
1911
|
+
async verifyBatch(tokens, options = {}) {
|
|
1912
|
+
const startTime = Date.now();
|
|
1913
|
+
const { parallel = false, maxConcurrent = 3 } = options;
|
|
1914
|
+
console.log(`\u{1F504} Starting batch verification for ${tokens.length} tokens (parallel: ${parallel})`);
|
|
1915
|
+
let results = [];
|
|
1916
|
+
if (parallel) {
|
|
1917
|
+
results = await this.verifyBatchParallel(tokens, maxConcurrent);
|
|
1918
|
+
} else {
|
|
1919
|
+
results = await this.verifyBatchSequential(tokens);
|
|
1920
|
+
}
|
|
1921
|
+
const successfulVerifications = results.filter((r) => r.success).length;
|
|
1922
|
+
const failedVerifications = results.length - successfulVerifications;
|
|
1923
|
+
console.log(`\u2705 Batch verification completed: ${successfulVerifications}/${tokens.length} successful`);
|
|
1924
|
+
return {
|
|
1925
|
+
success: failedVerifications === 0,
|
|
1926
|
+
totalTokens: tokens.length,
|
|
1927
|
+
successfulVerifications,
|
|
1928
|
+
failedVerifications,
|
|
1929
|
+
results,
|
|
1930
|
+
processingTime: Date.now() - startTime
|
|
1931
|
+
};
|
|
1932
|
+
}
|
|
1933
|
+
/**
|
|
1934
|
+
* Verify tokens in parallel with concurrency control
|
|
1935
|
+
*/
|
|
1936
|
+
async verifyBatchParallel(tokens, maxConcurrent) {
|
|
1937
|
+
const results = [];
|
|
1938
|
+
const chunks = [];
|
|
1939
|
+
for (let i = 0; i < tokens.length; i += maxConcurrent) {
|
|
1940
|
+
chunks.push(tokens.slice(i, i + maxConcurrent));
|
|
1941
|
+
}
|
|
1942
|
+
for (const chunk of chunks) {
|
|
1943
|
+
const chunkPromises = chunk.map((token) => this.verifyTokenWithRetry(token.tokenMetadata, token.calculatedMerkleRoot));
|
|
1944
|
+
const chunkResults = await Promise.all(chunkPromises);
|
|
1945
|
+
results.push(...chunkResults);
|
|
1946
|
+
if (chunks.indexOf(chunk) < chunks.length - 1) {
|
|
1947
|
+
await this.delay(this.batchDelay);
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
return results;
|
|
1951
|
+
}
|
|
1952
|
+
/**
|
|
1953
|
+
* Verify tokens sequentially with rate limiting
|
|
1954
|
+
*/
|
|
1955
|
+
async verifyBatchSequential(tokens) {
|
|
1956
|
+
const results = [];
|
|
1957
|
+
for (const token of tokens) {
|
|
1958
|
+
const result = await this.verifyTokenWithRetry(token.tokenMetadata, token.calculatedMerkleRoot);
|
|
1959
|
+
results.push(result);
|
|
1960
|
+
if (tokens.indexOf(token) < tokens.length - 1) {
|
|
1961
|
+
await this.delay(this.batchDelay);
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
return results;
|
|
1965
|
+
}
|
|
1966
|
+
/**
|
|
1967
|
+
* Process verification jobs with priority queue
|
|
1968
|
+
* @param jobs Array of verification jobs
|
|
1969
|
+
* @param options Processing options
|
|
1970
|
+
* @returns Batch verification result
|
|
1971
|
+
*/
|
|
1972
|
+
async processVerificationJobs(jobs, options = {}) {
|
|
1973
|
+
const { maxConcurrent = 3, priorityOrder = true, getTokenMetadata, getCalculatedMerkleRoot } = options;
|
|
1974
|
+
if (!getTokenMetadata || !getCalculatedMerkleRoot) {
|
|
1975
|
+
return {
|
|
1976
|
+
success: false,
|
|
1977
|
+
totalTokens: jobs.length,
|
|
1978
|
+
successfulVerifications: 0,
|
|
1979
|
+
failedVerifications: jobs.length,
|
|
1980
|
+
results: [],
|
|
1981
|
+
processingTime: 0
|
|
1982
|
+
};
|
|
1983
|
+
}
|
|
1984
|
+
const sortedJobs = priorityOrder ? this.sortJobsByPriority(jobs) : jobs;
|
|
1985
|
+
const tokens = [];
|
|
1986
|
+
for (const job of sortedJobs) {
|
|
1987
|
+
const tokenMetadata = await getTokenMetadata(job.tokenId);
|
|
1988
|
+
const calculatedMerkleRoot = await getCalculatedMerkleRoot(job.tokenId);
|
|
1989
|
+
if (tokenMetadata) {
|
|
1990
|
+
tokens.push({
|
|
1991
|
+
tokenMetadata,
|
|
1992
|
+
calculatedMerkleRoot: calculatedMerkleRoot || null
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
return this.verifyBatch(tokens, { parallel: true, maxConcurrent });
|
|
1997
|
+
}
|
|
1998
|
+
/**
|
|
1999
|
+
* Sort verification jobs by priority
|
|
2000
|
+
*/
|
|
2001
|
+
sortJobsByPriority(jobs) {
|
|
2002
|
+
const priorityOrder = { high: 0, normal: 1, low: 2 };
|
|
2003
|
+
return jobs.sort((a, b) => {
|
|
2004
|
+
const aPriority = priorityOrder[a.priority || "normal"];
|
|
2005
|
+
const bPriority = priorityOrder[b.priority || "normal"];
|
|
2006
|
+
if (aPriority !== bPriority) {
|
|
2007
|
+
return aPriority - bPriority;
|
|
2008
|
+
}
|
|
2009
|
+
return (a.retryCount || 0) - (b.retryCount || 0);
|
|
2010
|
+
});
|
|
2011
|
+
}
|
|
2012
|
+
/**
|
|
2013
|
+
* Calculate retry delay with exponential backoff
|
|
2014
|
+
*/
|
|
2015
|
+
calculateRetryDelay(attempt) {
|
|
2016
|
+
return Math.min(this.retryDelay * Math.pow(2, attempt - 1), 3e4);
|
|
2017
|
+
}
|
|
2018
|
+
/**
|
|
2019
|
+
* Utility method for delays
|
|
2020
|
+
*/
|
|
2021
|
+
async delay(ms) {
|
|
2022
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2023
|
+
}
|
|
2024
|
+
/**
|
|
2025
|
+
* Get verification statistics
|
|
2026
|
+
*/
|
|
2027
|
+
getVerificationStats() {
|
|
2028
|
+
return {
|
|
2029
|
+
maxRetries: this.maxRetries,
|
|
2030
|
+
retryDelay: this.retryDelay,
|
|
2031
|
+
batchDelay: this.batchDelay
|
|
2032
|
+
};
|
|
2033
|
+
}
|
|
2034
|
+
/**
|
|
2035
|
+
* Update verification configuration
|
|
2036
|
+
*/
|
|
2037
|
+
updateConfig(config) {
|
|
2038
|
+
if (config.maxRetries !== void 0) {
|
|
2039
|
+
this.maxRetries = config.maxRetries;
|
|
2040
|
+
}
|
|
2041
|
+
if (config.retryDelay !== void 0) {
|
|
2042
|
+
this.retryDelay = config.retryDelay;
|
|
2043
|
+
}
|
|
2044
|
+
if (config.batchDelay !== void 0) {
|
|
2045
|
+
this.batchDelay = config.batchDelay;
|
|
2046
|
+
}
|
|
2047
|
+
if (this.debug) {
|
|
2048
|
+
console.log("\u{1F527} ZipkitVerifier configuration updated:", this.getVerificationStats());
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
1218
2051
|
};
|
|
1219
2052
|
exports2.ZipkitVerifier = ZipkitVerifier;
|
|
1220
2053
|
}
|
|
1221
2054
|
});
|
|
1222
2055
|
|
|
1223
|
-
// neozipkit/dist/core/components/Logger.js
|
|
2056
|
+
// node_modules/neozipkit/dist/core/components/Logger.js
|
|
1224
2057
|
var require_Logger = __commonJS({
|
|
1225
|
-
"neozipkit/dist/core/components/Logger.js"(exports2) {
|
|
2058
|
+
"node_modules/neozipkit/dist/core/components/Logger.js"(exports2) {
|
|
1226
2059
|
"use strict";
|
|
1227
2060
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1228
2061
|
exports2.Logger = void 0;
|
|
@@ -1368,9 +2201,9 @@ var require_Logger = __commonJS({
|
|
|
1368
2201
|
}
|
|
1369
2202
|
});
|
|
1370
2203
|
|
|
1371
|
-
// neozipkit/dist/blockchain/core/WalletManager.js
|
|
2204
|
+
// node_modules/neozipkit/dist/blockchain/core/WalletManager.js
|
|
1372
2205
|
var require_WalletManager = __commonJS({
|
|
1373
|
-
"neozipkit/dist/blockchain/core/WalletManager.js"(exports2) {
|
|
2206
|
+
"node_modules/neozipkit/dist/blockchain/core/WalletManager.js"(exports2) {
|
|
1374
2207
|
"use strict";
|
|
1375
2208
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1376
2209
|
exports2.WalletAnalyzer = exports2.CoreWalletManager = void 0;
|
|
@@ -1408,6 +2241,13 @@ var require_WalletManager = __commonJS({
|
|
|
1408
2241
|
}
|
|
1409
2242
|
/**
|
|
1410
2243
|
* Setup wallet with private key and connect to network
|
|
2244
|
+
*
|
|
2245
|
+
* SECURITY WARNING: This method accepts a private key as a parameter.
|
|
2246
|
+
* - Never hardcode private keys in source code
|
|
2247
|
+
* - Always use environment variables for private keys
|
|
2248
|
+
* - Use testnet keys for development/testing
|
|
2249
|
+
* - Use secure key management (HSMs, KMS) for production
|
|
2250
|
+
* - See SECURITY.md for complete security guidelines
|
|
1411
2251
|
*/
|
|
1412
2252
|
async setupWallet(privateKey, network, mintToken = false) {
|
|
1413
2253
|
try {
|
|
@@ -1725,12 +2565,12 @@ var require_WalletManager = __commonJS({
|
|
|
1725
2565
|
}
|
|
1726
2566
|
});
|
|
1727
2567
|
|
|
1728
|
-
//
|
|
2568
|
+
// node_modules/moment/moment.js
|
|
1729
2569
|
var require_moment = __commonJS({
|
|
1730
|
-
"
|
|
2570
|
+
"node_modules/moment/moment.js"(exports2, module2) {
|
|
1731
2571
|
(function(global, factory) {
|
|
1732
2572
|
typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global.moment = factory();
|
|
1733
|
-
})(exports2, function() {
|
|
2573
|
+
})(exports2, (function() {
|
|
1734
2574
|
"use strict";
|
|
1735
2575
|
var hookCallback;
|
|
1736
2576
|
function hooks() {
|
|
@@ -2485,8 +3325,13 @@ var require_moment = __commonJS({
|
|
|
2485
3325
|
return void (isUTC ? d.setUTCHours(value) : d.setHours(value));
|
|
2486
3326
|
case "Date":
|
|
2487
3327
|
return void (isUTC ? d.setUTCDate(value) : d.setDate(value));
|
|
3328
|
+
// case 'Day': // Not real
|
|
3329
|
+
// return void (isUTC ? d.setUTCDay(value) : d.setDay(value));
|
|
3330
|
+
// case 'Month': // Not used because we need to pass two variables
|
|
3331
|
+
// return void (isUTC ? d.setUTCMonth(value) : d.setMonth(value));
|
|
2488
3332
|
case "FullYear":
|
|
2489
3333
|
break;
|
|
3334
|
+
// See below ...
|
|
2490
3335
|
default:
|
|
2491
3336
|
return;
|
|
2492
3337
|
}
|
|
@@ -4639,18 +5484,23 @@ var require_moment = __commonJS({
|
|
|
4639
5484
|
case "second":
|
|
4640
5485
|
output = (this - that) / 1e3;
|
|
4641
5486
|
break;
|
|
5487
|
+
// 1000
|
|
4642
5488
|
case "minute":
|
|
4643
5489
|
output = (this - that) / 6e4;
|
|
4644
5490
|
break;
|
|
5491
|
+
// 1000 * 60
|
|
4645
5492
|
case "hour":
|
|
4646
5493
|
output = (this - that) / 36e5;
|
|
4647
5494
|
break;
|
|
5495
|
+
// 1000 * 60 * 60
|
|
4648
5496
|
case "day":
|
|
4649
5497
|
output = (this - that - zoneDelta) / 864e5;
|
|
4650
5498
|
break;
|
|
5499
|
+
// 1000 * 60 * 60 * 24, negate dst
|
|
4651
5500
|
case "week":
|
|
4652
5501
|
output = (this - that - zoneDelta) / 6048e5;
|
|
4653
5502
|
break;
|
|
5503
|
+
// 1000 * 60 * 60 * 24 * 7, negate dst
|
|
4654
5504
|
default:
|
|
4655
5505
|
output = this - that;
|
|
4656
5506
|
}
|
|
@@ -5421,7 +6271,7 @@ var require_moment = __commonJS({
|
|
|
5421
6271
|
proto.toISOString = toISOString;
|
|
5422
6272
|
proto.inspect = inspect;
|
|
5423
6273
|
if (typeof Symbol !== "undefined" && Symbol.for != null) {
|
|
5424
|
-
proto[Symbol.for("nodejs.util.inspect.custom")] = function() {
|
|
6274
|
+
proto[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = function() {
|
|
5425
6275
|
return "Moment<" + this.format() + ">";
|
|
5426
6276
|
};
|
|
5427
6277
|
}
|
|
@@ -5621,10 +6471,10 @@ var require_moment = __commonJS({
|
|
|
5621
6471
|
}
|
|
5622
6472
|
],
|
|
5623
6473
|
dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
|
|
5624
|
-
ordinal: function(number) {
|
|
6474
|
+
ordinal: /* @__PURE__ */ __name(function(number) {
|
|
5625
6475
|
var b = number % 10, output = toInt(number % 100 / 10) === 1 ? "th" : b === 1 ? "st" : b === 2 ? "nd" : b === 3 ? "rd" : "th";
|
|
5626
6476
|
return number + output;
|
|
5627
|
-
}
|
|
6477
|
+
}, "ordinal")
|
|
5628
6478
|
});
|
|
5629
6479
|
hooks.lang = deprecate(
|
|
5630
6480
|
"moment.lang is deprecated. Use moment.locale instead.",
|
|
@@ -5737,6 +6587,7 @@ var require_moment = __commonJS({
|
|
|
5737
6587
|
return days2 * 1440 + milliseconds2 / 6e4;
|
|
5738
6588
|
case "second":
|
|
5739
6589
|
return days2 * 86400 + milliseconds2 / 1e3;
|
|
6590
|
+
// Math.floor prevents floating point math errors here
|
|
5740
6591
|
case "millisecond":
|
|
5741
6592
|
return Math.floor(days2 * 864e5) + milliseconds2;
|
|
5742
6593
|
default:
|
|
@@ -5980,13 +6831,13 @@ var require_moment = __commonJS({
|
|
|
5980
6831
|
// <input type="month" />
|
|
5981
6832
|
};
|
|
5982
6833
|
return hooks;
|
|
5983
|
-
});
|
|
6834
|
+
}));
|
|
5984
6835
|
}
|
|
5985
6836
|
});
|
|
5986
6837
|
|
|
5987
|
-
//
|
|
6838
|
+
// node_modules/moment-timezone/moment-timezone.js
|
|
5988
6839
|
var require_moment_timezone = __commonJS({
|
|
5989
|
-
"
|
|
6840
|
+
"node_modules/moment-timezone/moment-timezone.js"(exports2, module2) {
|
|
5990
6841
|
(function(root, factory) {
|
|
5991
6842
|
"use strict";
|
|
5992
6843
|
if (typeof module2 === "object" && module2.exports) {
|
|
@@ -6102,27 +6953,27 @@ var require_moment_timezone = __commonJS({
|
|
|
6102
6953
|
}
|
|
6103
6954
|
__name(closest, "closest");
|
|
6104
6955
|
Zone.prototype = {
|
|
6105
|
-
_set: function(unpacked) {
|
|
6956
|
+
_set: /* @__PURE__ */ __name(function(unpacked) {
|
|
6106
6957
|
this.name = unpacked.name;
|
|
6107
6958
|
this.abbrs = unpacked.abbrs;
|
|
6108
6959
|
this.untils = unpacked.untils;
|
|
6109
6960
|
this.offsets = unpacked.offsets;
|
|
6110
6961
|
this.population = unpacked.population;
|
|
6111
|
-
},
|
|
6112
|
-
_index: function(timestamp) {
|
|
6962
|
+
}, "_set"),
|
|
6963
|
+
_index: /* @__PURE__ */ __name(function(timestamp) {
|
|
6113
6964
|
var target = +timestamp, untils = this.untils, i;
|
|
6114
6965
|
i = closest(target, untils);
|
|
6115
6966
|
if (i >= 0) {
|
|
6116
6967
|
return i;
|
|
6117
6968
|
}
|
|
6118
|
-
},
|
|
6119
|
-
countries: function() {
|
|
6969
|
+
}, "_index"),
|
|
6970
|
+
countries: /* @__PURE__ */ __name(function() {
|
|
6120
6971
|
var zone_name = this.name;
|
|
6121
6972
|
return Object.keys(countries).filter(function(country_code) {
|
|
6122
6973
|
return countries[country_code].zones.indexOf(zone_name) !== -1;
|
|
6123
6974
|
});
|
|
6124
|
-
},
|
|
6125
|
-
parse: function(timestamp) {
|
|
6975
|
+
}, "countries"),
|
|
6976
|
+
parse: /* @__PURE__ */ __name(function(timestamp) {
|
|
6126
6977
|
var target = +timestamp, offsets = this.offsets, untils = this.untils, max = untils.length - 1, offset, offsetNext, offsetPrev, i;
|
|
6127
6978
|
for (i = 0; i < max; i++) {
|
|
6128
6979
|
offset = offsets[i];
|
|
@@ -6138,17 +6989,17 @@ var require_moment_timezone = __commonJS({
|
|
|
6138
6989
|
}
|
|
6139
6990
|
}
|
|
6140
6991
|
return offsets[max];
|
|
6141
|
-
},
|
|
6142
|
-
abbr: function(mom) {
|
|
6992
|
+
}, "parse"),
|
|
6993
|
+
abbr: /* @__PURE__ */ __name(function(mom) {
|
|
6143
6994
|
return this.abbrs[this._index(mom)];
|
|
6144
|
-
},
|
|
6145
|
-
offset: function(mom) {
|
|
6995
|
+
}, "abbr"),
|
|
6996
|
+
offset: /* @__PURE__ */ __name(function(mom) {
|
|
6146
6997
|
logError("zone.offset has been deprecated in favor of zone.utcOffset");
|
|
6147
6998
|
return this.offsets[this._index(mom)];
|
|
6148
|
-
},
|
|
6149
|
-
utcOffset: function(mom) {
|
|
6999
|
+
}, "offset"),
|
|
7000
|
+
utcOffset: /* @__PURE__ */ __name(function(mom) {
|
|
6150
7001
|
return this.offsets[this._index(mom)];
|
|
6151
|
-
}
|
|
7002
|
+
}, "utcOffset")
|
|
6152
7003
|
};
|
|
6153
7004
|
function Country(country_name, zone_names) {
|
|
6154
7005
|
this.name = country_name;
|
|
@@ -6367,8 +7218,7 @@ var require_moment_timezone = __commonJS({
|
|
|
6367
7218
|
__name(addLink, "addLink");
|
|
6368
7219
|
function addCountries(data) {
|
|
6369
7220
|
var i, country_code, country_zones, split;
|
|
6370
|
-
if (!data || !data.length)
|
|
6371
|
-
return;
|
|
7221
|
+
if (!data || !data.length) return;
|
|
6372
7222
|
for (i = 0; i < data.length; i++) {
|
|
6373
7223
|
split = data[i].split("|");
|
|
6374
7224
|
country_code = split[0].toUpperCase();
|
|
@@ -6387,8 +7237,7 @@ var require_moment_timezone = __commonJS({
|
|
|
6387
7237
|
__name(getCountry, "getCountry");
|
|
6388
7238
|
function zonesForCountry(country, with_offset) {
|
|
6389
7239
|
country = getCountry(country);
|
|
6390
|
-
if (!country)
|
|
6391
|
-
return null;
|
|
7240
|
+
if (!country) return null;
|
|
6392
7241
|
var zones2 = country.zones.sort();
|
|
6393
7242
|
if (with_offset) {
|
|
6394
7243
|
return zones2.map(function(zone_name) {
|
|
@@ -6519,8 +7368,7 @@ var require_moment_timezone = __commonJS({
|
|
|
6519
7368
|
__name(resetZoneWrap, "resetZoneWrap");
|
|
6520
7369
|
function resetZoneWrap2(old) {
|
|
6521
7370
|
return function() {
|
|
6522
|
-
if (arguments.length > 0)
|
|
6523
|
-
this._z = null;
|
|
7371
|
+
if (arguments.length > 0) this._z = null;
|
|
6524
7372
|
return old.apply(this, arguments);
|
|
6525
7373
|
};
|
|
6526
7374
|
}
|
|
@@ -6549,9 +7397,9 @@ var require_moment_timezone = __commonJS({
|
|
|
6549
7397
|
}
|
|
6550
7398
|
});
|
|
6551
7399
|
|
|
6552
|
-
//
|
|
7400
|
+
// node_modules/moment-timezone/data/packed/latest.json
|
|
6553
7401
|
var require_latest = __commonJS({
|
|
6554
|
-
"
|
|
7402
|
+
"node_modules/moment-timezone/data/packed/latest.json"(exports2, module2) {
|
|
6555
7403
|
module2.exports = {
|
|
6556
7404
|
version: "2025b",
|
|
6557
7405
|
zones: [
|
|
@@ -7408,17 +8256,17 @@ var require_latest = __commonJS({
|
|
|
7408
8256
|
}
|
|
7409
8257
|
});
|
|
7410
8258
|
|
|
7411
|
-
//
|
|
8259
|
+
// node_modules/moment-timezone/index.js
|
|
7412
8260
|
var require_moment_timezone2 = __commonJS({
|
|
7413
|
-
"
|
|
8261
|
+
"node_modules/moment-timezone/index.js"(exports2, module2) {
|
|
7414
8262
|
var moment = module2.exports = require_moment_timezone();
|
|
7415
8263
|
moment.tz.load(require_latest());
|
|
7416
8264
|
}
|
|
7417
8265
|
});
|
|
7418
8266
|
|
|
7419
|
-
// neozipkit/dist/core/constants/Errors.js
|
|
8267
|
+
// node_modules/neozipkit/dist/core/constants/Errors.js
|
|
7420
8268
|
var require_Errors = __commonJS({
|
|
7421
|
-
"neozipkit/dist/core/constants/Errors.js"(exports2) {
|
|
8269
|
+
"node_modules/neozipkit/dist/core/constants/Errors.js"(exports2) {
|
|
7422
8270
|
"use strict";
|
|
7423
8271
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7424
8272
|
exports2.default = {
|
|
@@ -7483,9 +8331,9 @@ var require_Errors = __commonJS({
|
|
|
7483
8331
|
}
|
|
7484
8332
|
});
|
|
7485
8333
|
|
|
7486
|
-
// neozipkit/dist/core/constants/Headers.js
|
|
8334
|
+
// node_modules/neozipkit/dist/core/constants/Headers.js
|
|
7487
8335
|
var require_Headers = __commonJS({
|
|
7488
|
-
"neozipkit/dist/core/constants/Headers.js"(exports2) {
|
|
8336
|
+
"node_modules/neozipkit/dist/core/constants/Headers.js"(exports2) {
|
|
7489
8337
|
"use strict";
|
|
7490
8338
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7491
8339
|
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;
|
|
@@ -7792,9 +8640,9 @@ var require_Headers = __commonJS({
|
|
|
7792
8640
|
}
|
|
7793
8641
|
});
|
|
7794
8642
|
|
|
7795
|
-
// neozipkit/dist/core/encryption/types.js
|
|
8643
|
+
// node_modules/neozipkit/dist/core/encryption/types.js
|
|
7796
8644
|
var require_types2 = __commonJS({
|
|
7797
|
-
"neozipkit/dist/core/encryption/types.js"(exports2) {
|
|
8645
|
+
"node_modules/neozipkit/dist/core/encryption/types.js"(exports2) {
|
|
7798
8646
|
"use strict";
|
|
7799
8647
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7800
8648
|
exports2.EncryptionMethod = void 0;
|
|
@@ -7806,9 +8654,9 @@ var require_types2 = __commonJS({
|
|
|
7806
8654
|
}
|
|
7807
8655
|
});
|
|
7808
8656
|
|
|
7809
|
-
// neozipkit/dist/core/encryption/ZipCrypto.js
|
|
8657
|
+
// node_modules/neozipkit/dist/core/encryption/ZipCrypto.js
|
|
7810
8658
|
var require_ZipCrypto = __commonJS({
|
|
7811
|
-
"neozipkit/dist/core/encryption/ZipCrypto.js"(exports2) {
|
|
8659
|
+
"node_modules/neozipkit/dist/core/encryption/ZipCrypto.js"(exports2) {
|
|
7812
8660
|
"use strict";
|
|
7813
8661
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7814
8662
|
exports2.DecryptionStream = exports2.ZipCrypto = void 0;
|
|
@@ -8475,9 +9323,9 @@ var require_ZipCrypto = __commonJS({
|
|
|
8475
9323
|
}
|
|
8476
9324
|
});
|
|
8477
9325
|
|
|
8478
|
-
// neozipkit/dist/core/ZipEntry.js
|
|
9326
|
+
// node_modules/neozipkit/dist/core/ZipEntry.js
|
|
8479
9327
|
var require_ZipEntry = __commonJS({
|
|
8480
|
-
"neozipkit/dist/core/ZipEntry.js"(exports2) {
|
|
9328
|
+
"node_modules/neozipkit/dist/core/ZipEntry.js"(exports2) {
|
|
8481
9329
|
"use strict";
|
|
8482
9330
|
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
8483
9331
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
@@ -8545,8 +9393,10 @@ var require_ZipEntry = __commonJS({
|
|
|
8545
9393
|
switch (this.platform) {
|
|
8546
9394
|
case "darwin":
|
|
8547
9395
|
return Headers_1.FILE_SYSTEM.DARWIN << 8 | VER_ENCODING;
|
|
9396
|
+
// macOS/Darwin
|
|
8548
9397
|
case "win32":
|
|
8549
9398
|
return Headers_1.FILE_SYSTEM.NTFS << 8 | VER_ENCODING;
|
|
9399
|
+
// Windows
|
|
8550
9400
|
default:
|
|
8551
9401
|
return Headers_1.FILE_SYSTEM.UNIX << 8 | VER_ENCODING;
|
|
8552
9402
|
}
|
|
@@ -8961,10 +9811,13 @@ var require_ZipEntry = __commonJS({
|
|
|
8961
9811
|
switch (this.bitFlags & 6) {
|
|
8962
9812
|
case 0:
|
|
8963
9813
|
return "Deflate-N";
|
|
9814
|
+
// Deflate Normal
|
|
8964
9815
|
case 2:
|
|
8965
9816
|
return "Deflate-M";
|
|
9817
|
+
// Deflate Maximum
|
|
8966
9818
|
case 4:
|
|
8967
9819
|
return "Deflate-F";
|
|
9820
|
+
// Deflate Fast
|
|
8968
9821
|
case 6:
|
|
8969
9822
|
return "Deflate-S";
|
|
8970
9823
|
}
|
|
@@ -9195,63 +10048,167 @@ var require_ZipEntry = __commonJS({
|
|
|
9195
10048
|
}
|
|
9196
10049
|
});
|
|
9197
10050
|
|
|
9198
|
-
// neozipkit/dist/core/
|
|
9199
|
-
var
|
|
9200
|
-
"neozipkit/dist/core/
|
|
10051
|
+
// node_modules/neozipkit/dist/core/ZstdManager.js
|
|
10052
|
+
var require_ZstdManager = __commonJS({
|
|
10053
|
+
"node_modules/neozipkit/dist/core/ZstdManager.js"(exports2) {
|
|
9201
10054
|
"use strict";
|
|
9202
|
-
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
9203
|
-
if (k2 === void 0)
|
|
9204
|
-
k2 = k;
|
|
9205
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9206
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9207
|
-
desc = { enumerable: true, get: function() {
|
|
9208
|
-
return m[k];
|
|
9209
|
-
} };
|
|
9210
|
-
}
|
|
9211
|
-
Object.defineProperty(o, k2, desc);
|
|
9212
|
-
} : function(o, m, k, k2) {
|
|
9213
|
-
if (k2 === void 0)
|
|
9214
|
-
k2 = k;
|
|
9215
|
-
o[k2] = m[k];
|
|
9216
|
-
});
|
|
9217
|
-
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
9218
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
9219
|
-
} : function(o, v) {
|
|
9220
|
-
o["default"] = v;
|
|
9221
|
-
});
|
|
9222
|
-
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ function() {
|
|
9223
|
-
var ownKeys = /* @__PURE__ */ __name(function(o) {
|
|
9224
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
9225
|
-
var ar = [];
|
|
9226
|
-
for (var k in o2)
|
|
9227
|
-
if (Object.prototype.hasOwnProperty.call(o2, k))
|
|
9228
|
-
ar[ar.length] = k;
|
|
9229
|
-
return ar;
|
|
9230
|
-
};
|
|
9231
|
-
return ownKeys(o);
|
|
9232
|
-
}, "ownKeys");
|
|
9233
|
-
return function(mod) {
|
|
9234
|
-
if (mod && mod.__esModule)
|
|
9235
|
-
return mod;
|
|
9236
|
-
var result = {};
|
|
9237
|
-
if (mod != null) {
|
|
9238
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++)
|
|
9239
|
-
if (k[i] !== "default")
|
|
9240
|
-
__createBinding2(result, mod, k[i]);
|
|
9241
|
-
}
|
|
9242
|
-
__setModuleDefault(result, mod);
|
|
9243
|
-
return result;
|
|
9244
|
-
};
|
|
9245
|
-
}();
|
|
9246
10055
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
9247
|
-
exports2.
|
|
9248
|
-
var
|
|
9249
|
-
var
|
|
9250
|
-
var HashCalculator = class _HashCalculator {
|
|
10056
|
+
exports2.ZstdManager = void 0;
|
|
10057
|
+
var zstd_js_1 = require("@oneidentity/zstd-js");
|
|
10058
|
+
var ZstdCodecManager = class _ZstdCodecManager {
|
|
9251
10059
|
static {
|
|
9252
|
-
__name(this, "
|
|
10060
|
+
__name(this, "ZstdCodecManager");
|
|
9253
10061
|
}
|
|
9254
|
-
|
|
10062
|
+
constructor() {
|
|
10063
|
+
this.codec = null;
|
|
10064
|
+
this.initPromise = null;
|
|
10065
|
+
this.operationQueue = Promise.resolve();
|
|
10066
|
+
}
|
|
10067
|
+
/**
|
|
10068
|
+
* Get the singleton instance of ZstdCodecManager
|
|
10069
|
+
*/
|
|
10070
|
+
static getInstance() {
|
|
10071
|
+
if (!_ZstdCodecManager.instance) {
|
|
10072
|
+
_ZstdCodecManager.instance = new _ZstdCodecManager();
|
|
10073
|
+
}
|
|
10074
|
+
return _ZstdCodecManager.instance;
|
|
10075
|
+
}
|
|
10076
|
+
/**
|
|
10077
|
+
* Ensure the Zstd codec is initialized
|
|
10078
|
+
* This is called automatically before any compress/decompress operation
|
|
10079
|
+
*/
|
|
10080
|
+
async ensureInitialized() {
|
|
10081
|
+
if (this.codec) {
|
|
10082
|
+
return;
|
|
10083
|
+
}
|
|
10084
|
+
if (this.initPromise) {
|
|
10085
|
+
return this.initPromise;
|
|
10086
|
+
}
|
|
10087
|
+
this.initPromise = (async () => {
|
|
10088
|
+
this.codec = await (0, zstd_js_1.ZstdInit)();
|
|
10089
|
+
})();
|
|
10090
|
+
return this.initPromise;
|
|
10091
|
+
}
|
|
10092
|
+
/**
|
|
10093
|
+
* Queue an operation to ensure sequential execution
|
|
10094
|
+
* This prevents concurrent operations from interfering with each other
|
|
10095
|
+
*/
|
|
10096
|
+
async queueOperation(operation) {
|
|
10097
|
+
const promise = this.operationQueue.then(operation, operation);
|
|
10098
|
+
this.operationQueue = promise.catch(() => {
|
|
10099
|
+
});
|
|
10100
|
+
return promise;
|
|
10101
|
+
}
|
|
10102
|
+
/**
|
|
10103
|
+
* Compress data using Zstd
|
|
10104
|
+
* @param data - Data to compress (Uint8Array)
|
|
10105
|
+
* @param level - Compression level (1-22, default 6)
|
|
10106
|
+
* @returns Compressed data as Uint8Array
|
|
10107
|
+
*/
|
|
10108
|
+
async compress(data, level = 6) {
|
|
10109
|
+
return this.queueOperation(async () => {
|
|
10110
|
+
await this.ensureInitialized();
|
|
10111
|
+
if (!this.codec) {
|
|
10112
|
+
throw new Error("Zstd codec not initialized");
|
|
10113
|
+
}
|
|
10114
|
+
return this.codec.ZstdSimple.compress(data, level);
|
|
10115
|
+
});
|
|
10116
|
+
}
|
|
10117
|
+
/**
|
|
10118
|
+
* Decompress data using Zstd
|
|
10119
|
+
* @param data - Compressed data (Uint8Array or Buffer)
|
|
10120
|
+
* @returns Decompressed data as Uint8Array
|
|
10121
|
+
*/
|
|
10122
|
+
async decompress(data) {
|
|
10123
|
+
return this.queueOperation(async () => {
|
|
10124
|
+
await this.ensureInitialized();
|
|
10125
|
+
if (!this.codec) {
|
|
10126
|
+
throw new Error("Zstd codec not initialized");
|
|
10127
|
+
}
|
|
10128
|
+
const inputData = data instanceof Buffer ? new Uint8Array(data.buffer, data.byteOffset, data.byteLength) : data;
|
|
10129
|
+
return this.codec.ZstdSimple.decompress(inputData);
|
|
10130
|
+
});
|
|
10131
|
+
}
|
|
10132
|
+
/**
|
|
10133
|
+
* Reset the manager (for testing purposes)
|
|
10134
|
+
* @internal
|
|
10135
|
+
*/
|
|
10136
|
+
static reset() {
|
|
10137
|
+
_ZstdCodecManager.instance = null;
|
|
10138
|
+
}
|
|
10139
|
+
};
|
|
10140
|
+
ZstdCodecManager.instance = null;
|
|
10141
|
+
exports2.ZstdManager = {
|
|
10142
|
+
/**
|
|
10143
|
+
* Compress data using Zstd
|
|
10144
|
+
* Operations are automatically queued to prevent interference
|
|
10145
|
+
*/
|
|
10146
|
+
compress: /* @__PURE__ */ __name((data, level) => ZstdCodecManager.getInstance().compress(data, level), "compress"),
|
|
10147
|
+
/**
|
|
10148
|
+
* Decompress data using Zstd
|
|
10149
|
+
* Operations are automatically queued to prevent interference
|
|
10150
|
+
*/
|
|
10151
|
+
decompress: /* @__PURE__ */ __name((data) => ZstdCodecManager.getInstance().decompress(data), "decompress"),
|
|
10152
|
+
/**
|
|
10153
|
+
* Reset the manager (for testing)
|
|
10154
|
+
* @internal
|
|
10155
|
+
*/
|
|
10156
|
+
reset: /* @__PURE__ */ __name(() => ZstdCodecManager.reset(), "reset")
|
|
10157
|
+
};
|
|
10158
|
+
exports2.default = exports2.ZstdManager;
|
|
10159
|
+
}
|
|
10160
|
+
});
|
|
10161
|
+
|
|
10162
|
+
// node_modules/neozipkit/dist/core/components/HashCalculator.js
|
|
10163
|
+
var require_HashCalculator = __commonJS({
|
|
10164
|
+
"node_modules/neozipkit/dist/core/components/HashCalculator.js"(exports2) {
|
|
10165
|
+
"use strict";
|
|
10166
|
+
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
10167
|
+
if (k2 === void 0) k2 = k;
|
|
10168
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10169
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10170
|
+
desc = { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
10171
|
+
return m[k];
|
|
10172
|
+
}, "get") };
|
|
10173
|
+
}
|
|
10174
|
+
Object.defineProperty(o, k2, desc);
|
|
10175
|
+
}) : (function(o, m, k, k2) {
|
|
10176
|
+
if (k2 === void 0) k2 = k;
|
|
10177
|
+
o[k2] = m[k];
|
|
10178
|
+
}));
|
|
10179
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
10180
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
10181
|
+
}) : function(o, v) {
|
|
10182
|
+
o["default"] = v;
|
|
10183
|
+
});
|
|
10184
|
+
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
|
|
10185
|
+
var ownKeys = /* @__PURE__ */ __name(function(o) {
|
|
10186
|
+
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
10187
|
+
var ar = [];
|
|
10188
|
+
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
10189
|
+
return ar;
|
|
10190
|
+
};
|
|
10191
|
+
return ownKeys(o);
|
|
10192
|
+
}, "ownKeys");
|
|
10193
|
+
return function(mod) {
|
|
10194
|
+
if (mod && mod.__esModule) return mod;
|
|
10195
|
+
var result = {};
|
|
10196
|
+
if (mod != null) {
|
|
10197
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]);
|
|
10198
|
+
}
|
|
10199
|
+
__setModuleDefault(result, mod);
|
|
10200
|
+
return result;
|
|
10201
|
+
};
|
|
10202
|
+
})();
|
|
10203
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
10204
|
+
exports2.HashCalculator = void 0;
|
|
10205
|
+
var crypto = __importStar(require("crypto"));
|
|
10206
|
+
var ZipCrypto_1 = require_ZipCrypto();
|
|
10207
|
+
var HashCalculator = class _HashCalculator {
|
|
10208
|
+
static {
|
|
10209
|
+
__name(this, "HashCalculator");
|
|
10210
|
+
}
|
|
10211
|
+
/**
|
|
9255
10212
|
* Creates a new HashCalculator instance
|
|
9256
10213
|
* @param options - Configuration options:
|
|
9257
10214
|
* - useSHA256: Enable SHA-256 calculation for incremental mode (default: false)
|
|
@@ -9523,26 +10480,18 @@ var require_HashCalculator = __commonJS({
|
|
|
9523
10480
|
}
|
|
9524
10481
|
});
|
|
9525
10482
|
|
|
9526
|
-
// neozipkit/dist/core/ZipCompress.js
|
|
10483
|
+
// node_modules/neozipkit/dist/core/ZipCompress.js
|
|
9527
10484
|
var require_ZipCompress = __commonJS({
|
|
9528
|
-
"neozipkit/dist/core/ZipCompress.js"(exports2) {
|
|
10485
|
+
"node_modules/neozipkit/dist/core/ZipCompress.js"(exports2) {
|
|
9529
10486
|
"use strict";
|
|
9530
10487
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
9531
10488
|
exports2.ZipCompress = void 0;
|
|
9532
10489
|
var pako = require("pako");
|
|
9533
|
-
var
|
|
10490
|
+
var ZstdManager_1 = require_ZstdManager();
|
|
9534
10491
|
var Logger_1 = require_Logger();
|
|
9535
10492
|
var Headers_1 = require_Headers();
|
|
9536
10493
|
var HashCalculator_1 = require_HashCalculator();
|
|
9537
10494
|
var ZipCrypto_1 = require_ZipCrypto();
|
|
9538
|
-
var zstdCodec = null;
|
|
9539
|
-
async function initZstd() {
|
|
9540
|
-
if (!zstdCodec) {
|
|
9541
|
-
zstdCodec = await (0, zstd_js_1.ZstdInit)();
|
|
9542
|
-
}
|
|
9543
|
-
return zstdCodec;
|
|
9544
|
-
}
|
|
9545
|
-
__name(initZstd, "initZstd");
|
|
9546
10495
|
var ZipCompress = class _ZipCompress {
|
|
9547
10496
|
static {
|
|
9548
10497
|
__name(this, "ZipCompress");
|
|
@@ -9714,20 +10663,11 @@ var require_ZipCompress = __commonJS({
|
|
|
9714
10663
|
if (typeof input === "object" && "totalSize" in input && "readChunk" in input) {
|
|
9715
10664
|
throw new Error("Chunked reader mode not supported in ZipCompress");
|
|
9716
10665
|
}
|
|
9717
|
-
const zstdCodec2 = await initZstd();
|
|
9718
10666
|
if (!input || input.length === 0) {
|
|
9719
10667
|
throw new Error("ZSTD compression: empty input buffer");
|
|
9720
10668
|
}
|
|
9721
10669
|
const inputArray = new Uint8Array(input.buffer, input.byteOffset, input.byteLength);
|
|
9722
|
-
|
|
9723
|
-
const compressed2 = zstdCodec2.ZstdSimple.compress(inputArray, level);
|
|
9724
|
-
const compressedBuffer2 = Buffer.from(compressed2);
|
|
9725
|
-
if (onOutputBuffer) {
|
|
9726
|
-
await onOutputBuffer(compressedBuffer2);
|
|
9727
|
-
}
|
|
9728
|
-
return compressedBuffer2;
|
|
9729
|
-
}
|
|
9730
|
-
const compressed = zstdCodec2.ZstdSimple.compress(inputArray, level);
|
|
10670
|
+
const compressed = await ZstdManager_1.ZstdManager.compress(inputArray, level);
|
|
9731
10671
|
const compressedBuffer = Buffer.from(compressed);
|
|
9732
10672
|
if (onOutputBuffer) {
|
|
9733
10673
|
await onOutputBuffer(compressedBuffer);
|
|
@@ -9782,28 +10722,20 @@ var require_ZipCompress = __commonJS({
|
|
|
9782
10722
|
}
|
|
9783
10723
|
});
|
|
9784
10724
|
|
|
9785
|
-
// neozipkit/dist/core/ZipDecompress.js
|
|
10725
|
+
// node_modules/neozipkit/dist/core/ZipDecompress.js
|
|
9786
10726
|
var require_ZipDecompress = __commonJS({
|
|
9787
|
-
"neozipkit/dist/core/ZipDecompress.js"(exports2) {
|
|
10727
|
+
"node_modules/neozipkit/dist/core/ZipDecompress.js"(exports2) {
|
|
9788
10728
|
"use strict";
|
|
9789
10729
|
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
9790
10730
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
9791
10731
|
};
|
|
9792
10732
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
9793
10733
|
var pako = require("pako");
|
|
9794
|
-
var
|
|
10734
|
+
var ZstdManager_1 = require_ZstdManager();
|
|
9795
10735
|
var Logger_1 = require_Logger();
|
|
9796
10736
|
var Errors_1 = __importDefault(require_Errors());
|
|
9797
10737
|
var Headers_1 = require_Headers();
|
|
9798
10738
|
var ZipCrypto_1 = require_ZipCrypto();
|
|
9799
|
-
var zstdCodec = null;
|
|
9800
|
-
async function initZstd() {
|
|
9801
|
-
if (!zstdCodec) {
|
|
9802
|
-
zstdCodec = await (0, zstd_js_1.ZstdInit)();
|
|
9803
|
-
}
|
|
9804
|
-
return zstdCodec;
|
|
9805
|
-
}
|
|
9806
|
-
__name(initZstd, "initZstd");
|
|
9807
10739
|
var ZipDecompress = class _ZipDecompress {
|
|
9808
10740
|
static {
|
|
9809
10741
|
__name(this, "ZipDecompress");
|
|
@@ -9817,7 +10749,6 @@ var require_ZipDecompress = __commonJS({
|
|
|
9817
10749
|
}
|
|
9818
10750
|
}
|
|
9819
10751
|
constructor(zipkit) {
|
|
9820
|
-
this.zstdCodec = null;
|
|
9821
10752
|
this.zipkit = zipkit;
|
|
9822
10753
|
this.debug = false;
|
|
9823
10754
|
if (_ZipDecompress.loggingEnabled) {
|
|
@@ -9835,12 +10766,9 @@ var require_ZipDecompress = __commonJS({
|
|
|
9835
10766
|
*/
|
|
9836
10767
|
async extract(entry, skipHashCheck) {
|
|
9837
10768
|
if (!this.zipkit.hasInBuffer()) {
|
|
9838
|
-
throw new Error("extract() requires Buffer-based ZIP. Use
|
|
10769
|
+
throw new Error("extract() requires Buffer-based ZIP. Use ZipkitNode.extractToFile() for file-based ZIP or call loadZip() first.");
|
|
9839
10770
|
}
|
|
9840
10771
|
this.log(`extract() called for entry: ${entry.filename}, method: ${entry.cmpMethod}, skipHashCheck: ${skipHashCheck}`);
|
|
9841
|
-
if (entry.cmpMethod === Headers_1.CMP_METHOD.ZSTD && !this.zstdCodec) {
|
|
9842
|
-
this.zstdCodec = await initZstd();
|
|
9843
|
-
}
|
|
9844
10772
|
const buffer = this.zipkit.ensureBuffer();
|
|
9845
10773
|
let fdata = this.zipkit.parseLocalHeader(entry, buffer);
|
|
9846
10774
|
if (entry.isEncrypted && this.zipkit?.password) {
|
|
@@ -9867,18 +10795,15 @@ var require_ZipDecompress = __commonJS({
|
|
|
9867
10795
|
* ZSTD codec is guaranteed to be initialized via factory method
|
|
9868
10796
|
* Internal method only
|
|
9869
10797
|
*/
|
|
9870
|
-
zstdDecompressSync(data) {
|
|
10798
|
+
async zstdDecompressSync(data) {
|
|
9871
10799
|
this.log(`zstdDecompressSync() called with ${data.length} bytes`);
|
|
9872
10800
|
try {
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
}
|
|
9876
|
-
const decompressed = this.zstdCodec.ZstdSimple.decompress(data);
|
|
9877
|
-
this.log(`ZSTD synchronous decompression successful: ${data.length} bytes -> ${decompressed.length} bytes`);
|
|
10801
|
+
const decompressed = await ZstdManager_1.ZstdManager.decompress(data);
|
|
10802
|
+
this.log(`ZSTD decompression successful: ${data.length} bytes -> ${decompressed.length} bytes`);
|
|
9878
10803
|
return Buffer.from(decompressed);
|
|
9879
10804
|
} catch (error) {
|
|
9880
|
-
this.log(`ZSTD
|
|
9881
|
-
throw new Error(`ZSTD
|
|
10805
|
+
this.log(`ZSTD decompression failed: ${error}`);
|
|
10806
|
+
throw new Error(`ZSTD decompression failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
9882
10807
|
}
|
|
9883
10808
|
}
|
|
9884
10809
|
/**
|
|
@@ -9886,7 +10811,7 @@ var require_ZipDecompress = __commonJS({
|
|
|
9886
10811
|
* Handles decompression and hash verification
|
|
9887
10812
|
* Internal method only
|
|
9888
10813
|
*/
|
|
9889
|
-
unCompress(compressedData, entry, skipHashCheck) {
|
|
10814
|
+
async unCompress(compressedData, entry, skipHashCheck) {
|
|
9890
10815
|
this.log(`unCompress() called for entry: ${entry.filename}, method: ${entry.cmpMethod}, data length: ${compressedData.length}`);
|
|
9891
10816
|
if (compressedData.length === 0) {
|
|
9892
10817
|
return Buffer.alloc(0);
|
|
@@ -9897,7 +10822,7 @@ var require_ZipDecompress = __commonJS({
|
|
|
9897
10822
|
} else if (entry.cmpMethod === Headers_1.CMP_METHOD.DEFLATED) {
|
|
9898
10823
|
outBuf = this.inflate(compressedData);
|
|
9899
10824
|
} else if (entry.cmpMethod === Headers_1.CMP_METHOD.ZSTD) {
|
|
9900
|
-
outBuf = this.zstdDecompressSync(compressedData);
|
|
10825
|
+
outBuf = await this.zstdDecompressSync(compressedData);
|
|
9901
10826
|
} else {
|
|
9902
10827
|
throw new Error(`Unsupported compression method: ${entry.cmpMethod}`);
|
|
9903
10828
|
}
|
|
@@ -9922,9 +10847,9 @@ var require_ZipDecompress = __commonJS({
|
|
|
9922
10847
|
}
|
|
9923
10848
|
});
|
|
9924
10849
|
|
|
9925
|
-
// neozipkit/dist/core/Zipkit.js
|
|
10850
|
+
// node_modules/neozipkit/dist/core/Zipkit.js
|
|
9926
10851
|
var require_Zipkit = __commonJS({
|
|
9927
|
-
"neozipkit/dist/core/Zipkit.js"(exports2) {
|
|
10852
|
+
"node_modules/neozipkit/dist/core/Zipkit.js"(exports2) {
|
|
9928
10853
|
"use strict";
|
|
9929
10854
|
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
9930
10855
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
@@ -9942,51 +10867,51 @@ var require_Zipkit = __commonJS({
|
|
|
9942
10867
|
var ZipCrypto_1 = require_ZipCrypto();
|
|
9943
10868
|
var HashCalculator_1 = __importDefault(require_HashCalculator());
|
|
9944
10869
|
var Headers_1 = require_Headers();
|
|
9945
|
-
Object.defineProperty(exports2, "LOCAL_HDR", { enumerable: true, get: function() {
|
|
10870
|
+
Object.defineProperty(exports2, "LOCAL_HDR", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
9946
10871
|
return Headers_1.LOCAL_HDR;
|
|
9947
|
-
} });
|
|
9948
|
-
Object.defineProperty(exports2, "ENCRYPT_HDR_SIZE", { enumerable: true, get: function() {
|
|
10872
|
+
}, "get") });
|
|
10873
|
+
Object.defineProperty(exports2, "ENCRYPT_HDR_SIZE", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
9949
10874
|
return Headers_1.ENCRYPT_HDR_SIZE;
|
|
9950
|
-
} });
|
|
9951
|
-
Object.defineProperty(exports2, "CMP_METHOD", { enumerable: true, get: function() {
|
|
10875
|
+
}, "get") });
|
|
10876
|
+
Object.defineProperty(exports2, "CMP_METHOD", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
9952
10877
|
return Headers_1.CMP_METHOD;
|
|
9953
|
-
} });
|
|
9954
|
-
Object.defineProperty(exports2, "CENTRAL_END", { enumerable: true, get: function() {
|
|
10878
|
+
}, "get") });
|
|
10879
|
+
Object.defineProperty(exports2, "CENTRAL_END", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
9955
10880
|
return Headers_1.CENTRAL_END;
|
|
9956
|
-
} });
|
|
9957
|
-
Object.defineProperty(exports2, "CENTRAL_DIR", { enumerable: true, get: function() {
|
|
10881
|
+
}, "get") });
|
|
10882
|
+
Object.defineProperty(exports2, "CENTRAL_DIR", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
9958
10883
|
return Headers_1.CENTRAL_DIR;
|
|
9959
|
-
} });
|
|
9960
|
-
Object.defineProperty(exports2, "ZIP64_CENTRAL_END", { enumerable: true, get: function() {
|
|
10884
|
+
}, "get") });
|
|
10885
|
+
Object.defineProperty(exports2, "ZIP64_CENTRAL_END", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
9961
10886
|
return Headers_1.ZIP64_CENTRAL_END;
|
|
9962
|
-
} });
|
|
9963
|
-
Object.defineProperty(exports2, "ZIP64_CENTRAL_DIR", { enumerable: true, get: function() {
|
|
10887
|
+
}, "get") });
|
|
10888
|
+
Object.defineProperty(exports2, "ZIP64_CENTRAL_DIR", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
9964
10889
|
return Headers_1.ZIP64_CENTRAL_DIR;
|
|
9965
|
-
} });
|
|
9966
|
-
Object.defineProperty(exports2, "GP_FLAG", { enumerable: true, get: function() {
|
|
10890
|
+
}, "get") });
|
|
10891
|
+
Object.defineProperty(exports2, "GP_FLAG", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
9967
10892
|
return Headers_1.GP_FLAG;
|
|
9968
|
-
} });
|
|
9969
|
-
Object.defineProperty(exports2, "TIMESTAMP_SUBMITTED", { enumerable: true, get: function() {
|
|
10893
|
+
}, "get") });
|
|
10894
|
+
Object.defineProperty(exports2, "TIMESTAMP_SUBMITTED", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
9970
10895
|
return Headers_1.TIMESTAMP_SUBMITTED;
|
|
9971
|
-
} });
|
|
9972
|
-
Object.defineProperty(exports2, "TIMESTAMP_METADATA", { enumerable: true, get: function() {
|
|
10896
|
+
}, "get") });
|
|
10897
|
+
Object.defineProperty(exports2, "TIMESTAMP_METADATA", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
9973
10898
|
return Headers_1.TIMESTAMP_METADATA;
|
|
9974
|
-
} });
|
|
9975
|
-
Object.defineProperty(exports2, "TOKENIZED_METADATA", { enumerable: true, get: function() {
|
|
10899
|
+
}, "get") });
|
|
10900
|
+
Object.defineProperty(exports2, "TOKENIZED_METADATA", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
9976
10901
|
return Headers_1.TOKENIZED_METADATA;
|
|
9977
|
-
} });
|
|
9978
|
-
Object.defineProperty(exports2, "LOCAL_FILE_HEADER", { enumerable: true, get: function() {
|
|
10902
|
+
}, "get") });
|
|
10903
|
+
Object.defineProperty(exports2, "LOCAL_FILE_HEADER", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
9979
10904
|
return Headers_1.LOCAL_FILE_HEADER;
|
|
9980
|
-
} });
|
|
9981
|
-
Object.defineProperty(exports2, "CENTRAL_FILE_HEADER", { enumerable: true, get: function() {
|
|
10905
|
+
}, "get") });
|
|
10906
|
+
Object.defineProperty(exports2, "CENTRAL_FILE_HEADER", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
9982
10907
|
return Headers_1.CENTRAL_FILE_HEADER;
|
|
9983
|
-
} });
|
|
9984
|
-
Object.defineProperty(exports2, "CENTRAL_DIRECTORY_END", { enumerable: true, get: function() {
|
|
10908
|
+
}, "get") });
|
|
10909
|
+
Object.defineProperty(exports2, "CENTRAL_DIRECTORY_END", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
9985
10910
|
return Headers_1.CENTRAL_DIRECTORY_END;
|
|
9986
|
-
} });
|
|
9987
|
-
Object.defineProperty(exports2, "HDR_ID", { enumerable: true, get: function() {
|
|
10911
|
+
}, "get") });
|
|
10912
|
+
Object.defineProperty(exports2, "HDR_ID", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
9988
10913
|
return Headers_1.HDR_ID;
|
|
9989
|
-
} });
|
|
10914
|
+
}, "get") });
|
|
9990
10915
|
var Zipkit = class {
|
|
9991
10916
|
static {
|
|
9992
10917
|
__name(this, "Zipkit");
|
|
@@ -10533,9 +11458,9 @@ var require_Zipkit = __commonJS({
|
|
|
10533
11458
|
}
|
|
10534
11459
|
});
|
|
10535
11460
|
|
|
10536
|
-
// neozipkit/dist/core/components/Support.js
|
|
11461
|
+
// node_modules/neozipkit/dist/core/components/Support.js
|
|
10537
11462
|
var require_Support = __commonJS({
|
|
10538
|
-
"neozipkit/dist/core/components/Support.js"(exports2) {
|
|
11463
|
+
"node_modules/neozipkit/dist/core/components/Support.js"(exports2) {
|
|
10539
11464
|
"use strict";
|
|
10540
11465
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
10541
11466
|
var Support = {
|
|
@@ -10588,9 +11513,9 @@ var require_Support = __commonJS({
|
|
|
10588
11513
|
}
|
|
10589
11514
|
});
|
|
10590
11515
|
|
|
10591
|
-
// neozipkit/dist/core/components/Util.js
|
|
11516
|
+
// node_modules/neozipkit/dist/core/components/Util.js
|
|
10592
11517
|
var require_Util = __commonJS({
|
|
10593
|
-
"neozipkit/dist/core/components/Util.js"(exports2) {
|
|
11518
|
+
"node_modules/neozipkit/dist/core/components/Util.js"(exports2) {
|
|
10594
11519
|
"use strict";
|
|
10595
11520
|
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
10596
11521
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
@@ -10664,9 +11589,9 @@ var require_Util = __commonJS({
|
|
|
10664
11589
|
}
|
|
10665
11590
|
});
|
|
10666
11591
|
|
|
10667
|
-
// neozipkit/dist/core/components/ProgressTracker.js
|
|
11592
|
+
// node_modules/neozipkit/dist/core/components/ProgressTracker.js
|
|
10668
11593
|
var require_ProgressTracker = __commonJS({
|
|
10669
|
-
"neozipkit/dist/core/components/ProgressTracker.js"(exports2) {
|
|
11594
|
+
"node_modules/neozipkit/dist/core/components/ProgressTracker.js"(exports2) {
|
|
10670
11595
|
"use strict";
|
|
10671
11596
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
10672
11597
|
exports2.ProgressTracker = void 0;
|
|
@@ -10772,9 +11697,9 @@ var require_ProgressTracker = __commonJS({
|
|
|
10772
11697
|
}
|
|
10773
11698
|
});
|
|
10774
11699
|
|
|
10775
|
-
// neozipkit/dist/core/encryption/Manager.js
|
|
11700
|
+
// node_modules/neozipkit/dist/core/encryption/Manager.js
|
|
10776
11701
|
var require_Manager = __commonJS({
|
|
10777
|
-
"neozipkit/dist/core/encryption/Manager.js"(exports2) {
|
|
11702
|
+
"node_modules/neozipkit/dist/core/encryption/Manager.js"(exports2) {
|
|
10778
11703
|
"use strict";
|
|
10779
11704
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
10780
11705
|
exports2.EncryptionManager = void 0;
|
|
@@ -10895,45 +11820,41 @@ var require_Manager = __commonJS({
|
|
|
10895
11820
|
}
|
|
10896
11821
|
});
|
|
10897
11822
|
|
|
10898
|
-
// neozipkit/dist/core/version.js
|
|
11823
|
+
// node_modules/neozipkit/dist/core/version.js
|
|
10899
11824
|
var require_version = __commonJS({
|
|
10900
|
-
"neozipkit/dist/core/version.js"(exports2) {
|
|
11825
|
+
"node_modules/neozipkit/dist/core/version.js"(exports2) {
|
|
10901
11826
|
"use strict";
|
|
10902
11827
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
10903
11828
|
exports2.VERSION = void 0;
|
|
10904
11829
|
var currentDate = /* @__PURE__ */ new Date();
|
|
10905
11830
|
var releaseDate = `${String(currentDate.getMonth() + 1).padStart(2, "0")}-${String(currentDate.getDate()).padStart(2, "0")}-${currentDate.getFullYear()}`;
|
|
10906
11831
|
exports2.VERSION = {
|
|
10907
|
-
number: "0.3.
|
|
11832
|
+
number: "0.3.1",
|
|
10908
11833
|
// packageJson.version,
|
|
10909
11834
|
date: releaseDate
|
|
10910
11835
|
};
|
|
10911
11836
|
}
|
|
10912
11837
|
});
|
|
10913
11838
|
|
|
10914
|
-
// neozipkit/dist/core/index.js
|
|
11839
|
+
// node_modules/neozipkit/dist/core/index.js
|
|
10915
11840
|
var require_core = __commonJS({
|
|
10916
|
-
"neozipkit/dist/core/index.js"(exports2) {
|
|
11841
|
+
"node_modules/neozipkit/dist/core/index.js"(exports2) {
|
|
10917
11842
|
"use strict";
|
|
10918
|
-
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
10919
|
-
if (k2 === void 0)
|
|
10920
|
-
k2 = k;
|
|
11843
|
+
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
11844
|
+
if (k2 === void 0) k2 = k;
|
|
10921
11845
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10922
11846
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10923
|
-
desc = { enumerable: true, get: function() {
|
|
11847
|
+
desc = { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
10924
11848
|
return m[k];
|
|
10925
|
-
} };
|
|
11849
|
+
}, "get") };
|
|
10926
11850
|
}
|
|
10927
11851
|
Object.defineProperty(o, k2, desc);
|
|
10928
|
-
} : function(o, m, k, k2) {
|
|
10929
|
-
if (k2 === void 0)
|
|
10930
|
-
k2 = k;
|
|
11852
|
+
}) : (function(o, m, k, k2) {
|
|
11853
|
+
if (k2 === void 0) k2 = k;
|
|
10931
11854
|
o[k2] = m[k];
|
|
10932
|
-
});
|
|
11855
|
+
}));
|
|
10933
11856
|
var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
10934
|
-
for (var p in m)
|
|
10935
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
|
|
10936
|
-
__createBinding2(exports3, m, p);
|
|
11857
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p);
|
|
10937
11858
|
};
|
|
10938
11859
|
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
10939
11860
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
@@ -10944,59 +11865,59 @@ var require_core = __commonJS({
|
|
|
10944
11865
|
__exportStar2(require_Zipkit(), exports2);
|
|
10945
11866
|
__exportStar2(require_ZipEntry(), exports2);
|
|
10946
11867
|
var ZipCompress_1 = require_ZipCompress();
|
|
10947
|
-
Object.defineProperty(exports2, "ZipCompress", { enumerable: true, get: function() {
|
|
11868
|
+
Object.defineProperty(exports2, "ZipCompress", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
10948
11869
|
return ZipCompress_1.ZipCompress;
|
|
10949
|
-
} });
|
|
11870
|
+
}, "get") });
|
|
10950
11871
|
exports2.default = Zipkit_1.default;
|
|
10951
11872
|
var HashCalculator_1 = require_HashCalculator();
|
|
10952
|
-
Object.defineProperty(exports2, "HashCalculator", { enumerable: true, get: function() {
|
|
11873
|
+
Object.defineProperty(exports2, "HashCalculator", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
10953
11874
|
return __importDefault(HashCalculator_1).default;
|
|
10954
|
-
} });
|
|
10955
|
-
Object.defineProperty(exports2, "HashCalculatorClass", { enumerable: true, get: function() {
|
|
11875
|
+
}, "get") });
|
|
11876
|
+
Object.defineProperty(exports2, "HashCalculatorClass", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
10956
11877
|
return HashCalculator_1.HashCalculator;
|
|
10957
|
-
} });
|
|
11878
|
+
}, "get") });
|
|
10958
11879
|
__exportStar2(require_Util(), exports2);
|
|
10959
11880
|
__exportStar2(require_Support(), exports2);
|
|
10960
11881
|
var ProgressTracker_1 = require_ProgressTracker();
|
|
10961
|
-
Object.defineProperty(exports2, "ProgressTracker", { enumerable: true, get: function() {
|
|
11882
|
+
Object.defineProperty(exports2, "ProgressTracker", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
10962
11883
|
return ProgressTracker_1.ProgressTracker;
|
|
10963
|
-
} });
|
|
11884
|
+
}, "get") });
|
|
10964
11885
|
var Manager_1 = require_Manager();
|
|
10965
|
-
Object.defineProperty(exports2, "EncryptionManager", { enumerable: true, get: function() {
|
|
11886
|
+
Object.defineProperty(exports2, "EncryptionManager", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
10966
11887
|
return Manager_1.EncryptionManager;
|
|
10967
|
-
} });
|
|
11888
|
+
}, "get") });
|
|
10968
11889
|
var ZipCrypto_1 = require_ZipCrypto();
|
|
10969
|
-
Object.defineProperty(exports2, "ZipCrypto", { enumerable: true, get: function() {
|
|
11890
|
+
Object.defineProperty(exports2, "ZipCrypto", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
10970
11891
|
return ZipCrypto_1.ZipCrypto;
|
|
10971
|
-
} });
|
|
10972
|
-
Object.defineProperty(exports2, "crc32", { enumerable: true, get: function() {
|
|
11892
|
+
}, "get") });
|
|
11893
|
+
Object.defineProperty(exports2, "crc32", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
10973
11894
|
return ZipCrypto_1.crc32;
|
|
10974
|
-
} });
|
|
10975
|
-
Object.defineProperty(exports2, "crc32update", { enumerable: true, get: function() {
|
|
11895
|
+
}, "get") });
|
|
11896
|
+
Object.defineProperty(exports2, "crc32update", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
10976
11897
|
return ZipCrypto_1.crc32update;
|
|
10977
|
-
} });
|
|
10978
|
-
Object.defineProperty(exports2, "sha256", { enumerable: true, get: function() {
|
|
11898
|
+
}, "get") });
|
|
11899
|
+
Object.defineProperty(exports2, "sha256", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
10979
11900
|
return ZipCrypto_1.sha256;
|
|
10980
|
-
} });
|
|
11901
|
+
}, "get") });
|
|
10981
11902
|
__exportStar2(require_types(), exports2);
|
|
10982
11903
|
__exportStar2(require_Headers(), exports2);
|
|
10983
11904
|
__exportStar2(require_Errors(), exports2);
|
|
10984
11905
|
__exportStar2(require_version(), exports2);
|
|
10985
11906
|
var Logger_1 = require_Logger();
|
|
10986
|
-
Object.defineProperty(exports2, "Logger", { enumerable: true, get: function() {
|
|
11907
|
+
Object.defineProperty(exports2, "Logger", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
10987
11908
|
return Logger_1.Logger;
|
|
10988
|
-
} });
|
|
10989
|
-
Object.defineProperty(exports2, "configureLoggerFromEnvironment", { enumerable: true, get: function() {
|
|
11909
|
+
}, "get") });
|
|
11910
|
+
Object.defineProperty(exports2, "configureLoggerFromEnvironment", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
10990
11911
|
return Logger_1.configureLoggerFromEnvironment;
|
|
10991
|
-
} });
|
|
11912
|
+
}, "get") });
|
|
10992
11913
|
}
|
|
10993
11914
|
});
|
|
10994
11915
|
|
|
10995
|
-
// neozipkit/dist/blockchain/core/ZipkitOTS.js
|
|
11916
|
+
// node_modules/neozipkit/dist/blockchain/core/ZipkitOTS.js
|
|
10996
11917
|
var require_ZipkitOTS = __commonJS({
|
|
10997
|
-
"neozipkit/dist/blockchain/core/ZipkitOTS.js"(exports2) {
|
|
10998
|
-
"use strict";
|
|
11918
|
+
"node_modules/neozipkit/dist/blockchain/core/ZipkitOTS.js"(exports2) {
|
|
10999
11919
|
"use server";
|
|
11920
|
+
"use strict";
|
|
11000
11921
|
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
11001
11922
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
11002
11923
|
};
|
|
@@ -11375,128 +12296,124 @@ var require_ZipkitOTS = __commonJS({
|
|
|
11375
12296
|
}
|
|
11376
12297
|
});
|
|
11377
12298
|
|
|
11378
|
-
// neozipkit/dist/blockchain/core/index.js
|
|
12299
|
+
// node_modules/neozipkit/dist/blockchain/core/index.js
|
|
11379
12300
|
var require_core2 = __commonJS({
|
|
11380
|
-
"neozipkit/dist/blockchain/core/index.js"(exports2) {
|
|
12301
|
+
"node_modules/neozipkit/dist/blockchain/core/index.js"(exports2) {
|
|
11381
12302
|
"use strict";
|
|
11382
|
-
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
11383
|
-
if (k2 === void 0)
|
|
11384
|
-
k2 = k;
|
|
12303
|
+
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
12304
|
+
if (k2 === void 0) k2 = k;
|
|
11385
12305
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11386
12306
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11387
|
-
desc = { enumerable: true, get: function() {
|
|
12307
|
+
desc = { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11388
12308
|
return m[k];
|
|
11389
|
-
} };
|
|
12309
|
+
}, "get") };
|
|
11390
12310
|
}
|
|
11391
12311
|
Object.defineProperty(o, k2, desc);
|
|
11392
|
-
} : function(o, m, k, k2) {
|
|
11393
|
-
if (k2 === void 0)
|
|
11394
|
-
k2 = k;
|
|
12312
|
+
}) : (function(o, m, k, k2) {
|
|
12313
|
+
if (k2 === void 0) k2 = k;
|
|
11395
12314
|
o[k2] = m[k];
|
|
11396
|
-
});
|
|
12315
|
+
}));
|
|
11397
12316
|
var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
11398
|
-
for (var p in m)
|
|
11399
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
|
|
11400
|
-
__createBinding2(exports3, m, p);
|
|
12317
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m, p);
|
|
11401
12318
|
};
|
|
11402
12319
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
11403
12320
|
exports2.verifyOtsZip = exports2.verifyOts = exports2.getMerkleRootSafe = exports2.getOtsBuffer = exports2.getOtsEntry = exports2.bufferToArrayBuffer = exports2.createOtsMetadataEntry = exports2.upgradeOTS = exports2.parseVerifyResult = exports2.deserializeOts = exports2.createTimestamp = exports2.normalizeNetworkName = exports2.getNetworkByName = exports2.getSupportedNetworkNames = exports2.getChainIdByName = exports2.isNetworkSupported = exports2.getSupportedNetworks = exports2.getContractConfig = exports2.DEFAULT_NETWORK = exports2.CURRENT_DEPLOYMENT = exports2.CONTRACT_CONFIGS = exports2.NZIP_CONTRACT_ABI_WEB3 = exports2.NZIP_CONTRACT_ABI = exports2.WalletAnalyzer = exports2.CoreWalletManager = exports2.ZipkitVerifier = exports2.validatePrivateKey = exports2.ZipkitMinter = void 0;
|
|
11404
12321
|
__exportStar2(require_types(), exports2);
|
|
11405
12322
|
var ZipkitMinter_1 = require_ZipkitMinter();
|
|
11406
|
-
Object.defineProperty(exports2, "ZipkitMinter", { enumerable: true, get: function() {
|
|
12323
|
+
Object.defineProperty(exports2, "ZipkitMinter", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11407
12324
|
return ZipkitMinter_1.ZipkitMinter;
|
|
11408
|
-
} });
|
|
11409
|
-
Object.defineProperty(exports2, "validatePrivateKey", { enumerable: true, get: function() {
|
|
12325
|
+
}, "get") });
|
|
12326
|
+
Object.defineProperty(exports2, "validatePrivateKey", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11410
12327
|
return ZipkitMinter_1.validatePrivateKey;
|
|
11411
|
-
} });
|
|
12328
|
+
}, "get") });
|
|
11412
12329
|
var ZipkitVerifier_1 = require_ZipkitVerifier();
|
|
11413
|
-
Object.defineProperty(exports2, "ZipkitVerifier", { enumerable: true, get: function() {
|
|
12330
|
+
Object.defineProperty(exports2, "ZipkitVerifier", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11414
12331
|
return ZipkitVerifier_1.ZipkitVerifier;
|
|
11415
|
-
} });
|
|
12332
|
+
}, "get") });
|
|
11416
12333
|
var WalletManager_1 = require_WalletManager();
|
|
11417
|
-
Object.defineProperty(exports2, "CoreWalletManager", { enumerable: true, get: function() {
|
|
12334
|
+
Object.defineProperty(exports2, "CoreWalletManager", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11418
12335
|
return WalletManager_1.CoreWalletManager;
|
|
11419
|
-
} });
|
|
11420
|
-
Object.defineProperty(exports2, "WalletAnalyzer", { enumerable: true, get: function() {
|
|
12336
|
+
}, "get") });
|
|
12337
|
+
Object.defineProperty(exports2, "WalletAnalyzer", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11421
12338
|
return WalletManager_1.WalletAnalyzer;
|
|
11422
|
-
} });
|
|
12339
|
+
}, "get") });
|
|
11423
12340
|
var contracts_1 = require_contracts();
|
|
11424
|
-
Object.defineProperty(exports2, "NZIP_CONTRACT_ABI", { enumerable: true, get: function() {
|
|
12341
|
+
Object.defineProperty(exports2, "NZIP_CONTRACT_ABI", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11425
12342
|
return contracts_1.NZIP_CONTRACT_ABI;
|
|
11426
|
-
} });
|
|
11427
|
-
Object.defineProperty(exports2, "NZIP_CONTRACT_ABI_WEB3", { enumerable: true, get: function() {
|
|
12343
|
+
}, "get") });
|
|
12344
|
+
Object.defineProperty(exports2, "NZIP_CONTRACT_ABI_WEB3", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11428
12345
|
return contracts_1.NZIP_CONTRACT_ABI_WEB3;
|
|
11429
|
-
} });
|
|
11430
|
-
Object.defineProperty(exports2, "CONTRACT_CONFIGS", { enumerable: true, get: function() {
|
|
12346
|
+
}, "get") });
|
|
12347
|
+
Object.defineProperty(exports2, "CONTRACT_CONFIGS", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11431
12348
|
return contracts_1.CONTRACT_CONFIGS;
|
|
11432
|
-
} });
|
|
11433
|
-
Object.defineProperty(exports2, "CURRENT_DEPLOYMENT", { enumerable: true, get: function() {
|
|
12349
|
+
}, "get") });
|
|
12350
|
+
Object.defineProperty(exports2, "CURRENT_DEPLOYMENT", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11434
12351
|
return contracts_1.CURRENT_DEPLOYMENT;
|
|
11435
|
-
} });
|
|
11436
|
-
Object.defineProperty(exports2, "DEFAULT_NETWORK", { enumerable: true, get: function() {
|
|
12352
|
+
}, "get") });
|
|
12353
|
+
Object.defineProperty(exports2, "DEFAULT_NETWORK", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11437
12354
|
return contracts_1.DEFAULT_NETWORK;
|
|
11438
|
-
} });
|
|
11439
|
-
Object.defineProperty(exports2, "getContractConfig", { enumerable: true, get: function() {
|
|
12355
|
+
}, "get") });
|
|
12356
|
+
Object.defineProperty(exports2, "getContractConfig", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11440
12357
|
return contracts_1.getContractConfig;
|
|
11441
|
-
} });
|
|
11442
|
-
Object.defineProperty(exports2, "getSupportedNetworks", { enumerable: true, get: function() {
|
|
12358
|
+
}, "get") });
|
|
12359
|
+
Object.defineProperty(exports2, "getSupportedNetworks", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11443
12360
|
return contracts_1.getSupportedNetworks;
|
|
11444
|
-
} });
|
|
11445
|
-
Object.defineProperty(exports2, "isNetworkSupported", { enumerable: true, get: function() {
|
|
12361
|
+
}, "get") });
|
|
12362
|
+
Object.defineProperty(exports2, "isNetworkSupported", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11446
12363
|
return contracts_1.isNetworkSupported;
|
|
11447
|
-
} });
|
|
11448
|
-
Object.defineProperty(exports2, "getChainIdByName", { enumerable: true, get: function() {
|
|
12364
|
+
}, "get") });
|
|
12365
|
+
Object.defineProperty(exports2, "getChainIdByName", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11449
12366
|
return contracts_1.getChainIdByName;
|
|
11450
|
-
} });
|
|
11451
|
-
Object.defineProperty(exports2, "getSupportedNetworkNames", { enumerable: true, get: function() {
|
|
12367
|
+
}, "get") });
|
|
12368
|
+
Object.defineProperty(exports2, "getSupportedNetworkNames", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11452
12369
|
return contracts_1.getSupportedNetworkNames;
|
|
11453
|
-
} });
|
|
11454
|
-
Object.defineProperty(exports2, "getNetworkByName", { enumerable: true, get: function() {
|
|
12370
|
+
}, "get") });
|
|
12371
|
+
Object.defineProperty(exports2, "getNetworkByName", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11455
12372
|
return contracts_1.getNetworkByName;
|
|
11456
|
-
} });
|
|
11457
|
-
Object.defineProperty(exports2, "normalizeNetworkName", { enumerable: true, get: function() {
|
|
12373
|
+
}, "get") });
|
|
12374
|
+
Object.defineProperty(exports2, "normalizeNetworkName", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11458
12375
|
return contracts_1.normalizeNetworkName;
|
|
11459
|
-
} });
|
|
12376
|
+
}, "get") });
|
|
11460
12377
|
var ZipkitOTS_1 = require_ZipkitOTS();
|
|
11461
|
-
Object.defineProperty(exports2, "createTimestamp", { enumerable: true, get: function() {
|
|
12378
|
+
Object.defineProperty(exports2, "createTimestamp", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11462
12379
|
return ZipkitOTS_1.createTimestamp;
|
|
11463
|
-
} });
|
|
11464
|
-
Object.defineProperty(exports2, "deserializeOts", { enumerable: true, get: function() {
|
|
12380
|
+
}, "get") });
|
|
12381
|
+
Object.defineProperty(exports2, "deserializeOts", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11465
12382
|
return ZipkitOTS_1.deserializeOts;
|
|
11466
|
-
} });
|
|
11467
|
-
Object.defineProperty(exports2, "parseVerifyResult", { enumerable: true, get: function() {
|
|
12383
|
+
}, "get") });
|
|
12384
|
+
Object.defineProperty(exports2, "parseVerifyResult", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11468
12385
|
return ZipkitOTS_1.parseVerifyResult;
|
|
11469
|
-
} });
|
|
11470
|
-
Object.defineProperty(exports2, "upgradeOTS", { enumerable: true, get: function() {
|
|
12386
|
+
}, "get") });
|
|
12387
|
+
Object.defineProperty(exports2, "upgradeOTS", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11471
12388
|
return ZipkitOTS_1.upgradeOTS;
|
|
11472
|
-
} });
|
|
11473
|
-
Object.defineProperty(exports2, "createOtsMetadataEntry", { enumerable: true, get: function() {
|
|
12389
|
+
}, "get") });
|
|
12390
|
+
Object.defineProperty(exports2, "createOtsMetadataEntry", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11474
12391
|
return ZipkitOTS_1.createOtsMetadataEntry;
|
|
11475
|
-
} });
|
|
11476
|
-
Object.defineProperty(exports2, "bufferToArrayBuffer", { enumerable: true, get: function() {
|
|
12392
|
+
}, "get") });
|
|
12393
|
+
Object.defineProperty(exports2, "bufferToArrayBuffer", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11477
12394
|
return ZipkitOTS_1.bufferToArrayBuffer;
|
|
11478
|
-
} });
|
|
11479
|
-
Object.defineProperty(exports2, "getOtsEntry", { enumerable: true, get: function() {
|
|
12395
|
+
}, "get") });
|
|
12396
|
+
Object.defineProperty(exports2, "getOtsEntry", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11480
12397
|
return ZipkitOTS_1.getOtsEntry;
|
|
11481
|
-
} });
|
|
11482
|
-
Object.defineProperty(exports2, "getOtsBuffer", { enumerable: true, get: function() {
|
|
12398
|
+
}, "get") });
|
|
12399
|
+
Object.defineProperty(exports2, "getOtsBuffer", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11483
12400
|
return ZipkitOTS_1.getOtsBuffer;
|
|
11484
|
-
} });
|
|
11485
|
-
Object.defineProperty(exports2, "getMerkleRootSafe", { enumerable: true, get: function() {
|
|
12401
|
+
}, "get") });
|
|
12402
|
+
Object.defineProperty(exports2, "getMerkleRootSafe", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11486
12403
|
return ZipkitOTS_1.getMerkleRootSafe;
|
|
11487
|
-
} });
|
|
11488
|
-
Object.defineProperty(exports2, "verifyOts", { enumerable: true, get: function() {
|
|
12404
|
+
}, "get") });
|
|
12405
|
+
Object.defineProperty(exports2, "verifyOts", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11489
12406
|
return ZipkitOTS_1.verifyOts;
|
|
11490
|
-
} });
|
|
11491
|
-
Object.defineProperty(exports2, "verifyOtsZip", { enumerable: true, get: function() {
|
|
12407
|
+
}, "get") });
|
|
12408
|
+
Object.defineProperty(exports2, "verifyOtsZip", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
11492
12409
|
return ZipkitOTS_1.verifyOtsZip;
|
|
11493
|
-
} });
|
|
12410
|
+
}, "get") });
|
|
11494
12411
|
}
|
|
11495
12412
|
});
|
|
11496
12413
|
|
|
11497
|
-
// neozipkit/dist/blockchain/browser/WalletManagerBrowser.js
|
|
12414
|
+
// node_modules/neozipkit/dist/blockchain/browser/WalletManagerBrowser.js
|
|
11498
12415
|
var require_WalletManagerBrowser = __commonJS({
|
|
11499
|
-
"neozipkit/dist/blockchain/browser/WalletManagerBrowser.js"(exports2) {
|
|
12416
|
+
"node_modules/neozipkit/dist/blockchain/browser/WalletManagerBrowser.js"(exports2) {
|
|
11500
12417
|
"use strict";
|
|
11501
12418
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
11502
12419
|
exports2.WalletManagerBrowser = void 0;
|
|
@@ -11893,18 +12810,20 @@ Network Details:
|
|
|
11893
12810
|
}
|
|
11894
12811
|
});
|
|
11895
12812
|
|
|
11896
|
-
// neozipkit/dist/blockchain/browser/ZipkitMinterBrowser.js
|
|
12813
|
+
// node_modules/neozipkit/dist/blockchain/browser/ZipkitMinterBrowser.js
|
|
11897
12814
|
var require_ZipkitMinterBrowser = __commonJS({
|
|
11898
|
-
"neozipkit/dist/blockchain/browser/ZipkitMinterBrowser.js"(exports2) {
|
|
12815
|
+
"node_modules/neozipkit/dist/blockchain/browser/ZipkitMinterBrowser.js"(exports2) {
|
|
11899
12816
|
"use strict";
|
|
11900
12817
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
11901
12818
|
exports2.ZipkitMinterBrowser = void 0;
|
|
12819
|
+
var contracts_1 = require_contracts();
|
|
11902
12820
|
var ZipkitMinterBrowser = class {
|
|
11903
12821
|
static {
|
|
11904
12822
|
__name(this, "ZipkitMinterBrowser");
|
|
11905
12823
|
}
|
|
11906
|
-
constructor(merkleRoot, walletManager) {
|
|
12824
|
+
constructor(merkleRoot, walletManager, encryptedHash) {
|
|
11907
12825
|
this.merkleRoot = merkleRoot;
|
|
12826
|
+
this.encryptedHash = encryptedHash || "";
|
|
11908
12827
|
this.walletManager = walletManager;
|
|
11909
12828
|
}
|
|
11910
12829
|
/**
|
|
@@ -11976,9 +12895,14 @@ var require_ZipkitMinterBrowser = __commonJS({
|
|
|
11976
12895
|
const creationTimestamp = Math.floor(Date.now() / 1e3);
|
|
11977
12896
|
const ipfsHash = "";
|
|
11978
12897
|
const tokenURI = "";
|
|
12898
|
+
const config = this.walletManager.getCurrentConfig();
|
|
12899
|
+
if (!config.version) {
|
|
12900
|
+
throw new Error(`Contract version not specified for network ${config.network}`);
|
|
12901
|
+
}
|
|
12902
|
+
const adapter = (0, contracts_1.getContractAdapterByVersion)(config.version);
|
|
11979
12903
|
const GAS_ESTIMATION_TIMEOUT = 3e4;
|
|
11980
12904
|
const gasEstimate = await Promise.race([
|
|
11981
|
-
|
|
12905
|
+
adapter.estimateGasForMint(contractWithSigner, this.merkleRoot, this.encryptedHash || void 0, creationTimestamp, ipfsHash, tokenURI),
|
|
11982
12906
|
new Promise((_, reject) => setTimeout(() => reject(new Error("Gas estimation timeout")), GAS_ESTIMATION_TIMEOUT))
|
|
11983
12907
|
]);
|
|
11984
12908
|
const readProvider = this.walletManager.getReadProvider();
|
|
@@ -12026,16 +12950,19 @@ var require_ZipkitMinterBrowser = __commonJS({
|
|
|
12026
12950
|
console.log("\u{1F4E1} Submitting transaction to blockchain...");
|
|
12027
12951
|
console.log(`\u{1F550} Creation timestamp: ${creationTimestamp}`);
|
|
12028
12952
|
console.log("\u{1F512} Note: Filename is not stored on blockchain for privacy");
|
|
12029
|
-
|
|
12953
|
+
if (!config.version) {
|
|
12954
|
+
throw new Error(`Contract version not specified for network ${config.network}`);
|
|
12955
|
+
}
|
|
12956
|
+
const adapter = (0, contracts_1.getContractAdapterByVersion)(config.version);
|
|
12030
12957
|
const TX_SEND_TIMEOUT = 6e4;
|
|
12031
12958
|
console.log("\u23F3 Waiting for wallet approval...");
|
|
12032
12959
|
const tx = await Promise.race([
|
|
12033
|
-
|
|
12960
|
+
adapter.mintZipFile(contractWithSigner, this.merkleRoot, this.encryptedHash || void 0, creationTimestamp, ipfsHash, tokenURI),
|
|
12034
12961
|
new Promise((_, reject) => setTimeout(() => reject(new Error("Transaction send timeout - wallet approval dialog may not have appeared. Please check your wallet.")), TX_SEND_TIMEOUT))
|
|
12035
12962
|
]);
|
|
12036
12963
|
console.log(`\u{1F4DC} Transaction submitted: ${tx.hash}`);
|
|
12037
12964
|
console.log("\u23F3 Waiting for confirmation...");
|
|
12038
|
-
let receipt;
|
|
12965
|
+
let receipt = null;
|
|
12039
12966
|
const CONFIRMATION_TIMEOUT = 12e4;
|
|
12040
12967
|
try {
|
|
12041
12968
|
const readProvider = this.walletManager.getReadProvider();
|
|
@@ -12066,40 +12993,45 @@ var require_ZipkitMinterBrowser = __commonJS({
|
|
|
12066
12993
|
throw confirmationError;
|
|
12067
12994
|
}
|
|
12068
12995
|
}
|
|
12069
|
-
|
|
12996
|
+
if (!receipt) {
|
|
12997
|
+
throw new Error("Transaction receipt not available");
|
|
12998
|
+
}
|
|
12999
|
+
console.log(`\u2705 Transaction confirmed in block: ${receipt.blockNumber}`);
|
|
12070
13000
|
let tokenId;
|
|
12071
|
-
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
|
|
12076
|
-
if (parsed
|
|
12077
|
-
|
|
12078
|
-
|
|
12079
|
-
} else if (parsed.name === "Transfer") {
|
|
12080
|
-
const from = parsed.args.from;
|
|
12081
|
-
const transferTokenId = parsed.args.tokenId;
|
|
12082
|
-
if (from === "0x0000000000000000000000000000000000000000") {
|
|
12083
|
-
tokenId = transferTokenId.toString();
|
|
13001
|
+
if (receipt.logs && Array.isArray(receipt.logs)) {
|
|
13002
|
+
for (let i = 0; i < receipt.logs.length; i++) {
|
|
13003
|
+
const log = receipt.logs[i];
|
|
13004
|
+
try {
|
|
13005
|
+
const parsed = contract.interface.parseLog(log);
|
|
13006
|
+
if (parsed) {
|
|
13007
|
+
if (parsed.name === "ZipFileTokenized") {
|
|
13008
|
+
tokenId = parsed.args.tokenId.toString();
|
|
12084
13009
|
break;
|
|
13010
|
+
} else if (parsed.name === "Transfer") {
|
|
13011
|
+
const from = parsed.args.from;
|
|
13012
|
+
const transferTokenId = parsed.args.tokenId;
|
|
13013
|
+
if (from === "0x0000000000000000000000000000000000000000") {
|
|
13014
|
+
tokenId = transferTokenId.toString();
|
|
13015
|
+
break;
|
|
13016
|
+
}
|
|
12085
13017
|
}
|
|
12086
13018
|
}
|
|
12087
|
-
}
|
|
12088
|
-
|
|
12089
|
-
|
|
12090
|
-
|
|
12091
|
-
|
|
12092
|
-
|
|
12093
|
-
|
|
12094
|
-
|
|
12095
|
-
|
|
12096
|
-
|
|
12097
|
-
|
|
12098
|
-
|
|
12099
|
-
|
|
13019
|
+
} catch (parseError) {
|
|
13020
|
+
console.warn(`\u26A0\uFE0F Could not parse log ${i}:`, parseError);
|
|
13021
|
+
if (log.topics && log.topics.length >= 4 && log.topics[0] === "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") {
|
|
13022
|
+
try {
|
|
13023
|
+
const from = log.topics[1];
|
|
13024
|
+
const to = log.topics[2];
|
|
13025
|
+
const transferTokenId = log.topics[3];
|
|
13026
|
+
console.log(`\u{1F504} Manual Transfer parse: from=${from}, to=${to}, tokenId=${transferTokenId}`);
|
|
13027
|
+
if (from === "0x0000000000000000000000000000000000000000000000000000000000000000") {
|
|
13028
|
+
tokenId = parseInt(transferTokenId, 16).toString();
|
|
13029
|
+
console.log(`\u{1F3AF} Found minting via manual parse with token ID: ${tokenId}`);
|
|
13030
|
+
break;
|
|
13031
|
+
}
|
|
13032
|
+
} catch (manualParseError) {
|
|
13033
|
+
console.warn(`\u26A0\uFE0F Manual parsing also failed:`, manualParseError);
|
|
12100
13034
|
}
|
|
12101
|
-
} catch (manualParseError) {
|
|
12102
|
-
console.warn(`\u26A0\uFE0F Manual parsing also failed:`, manualParseError);
|
|
12103
13035
|
}
|
|
12104
13036
|
}
|
|
12105
13037
|
}
|
|
@@ -12141,16 +13073,21 @@ var require_ZipkitMinterBrowser = __commonJS({
|
|
|
12141
13073
|
createTokenMetadata(tokenId, transactionHash) {
|
|
12142
13074
|
const now = /* @__PURE__ */ new Date();
|
|
12143
13075
|
const config = this.walletManager.getCurrentConfig();
|
|
13076
|
+
if (!config.version) {
|
|
13077
|
+
throw new Error(`Contract version not specified for network ${config.network} (chainId: ${config.chainId})`);
|
|
13078
|
+
}
|
|
12144
13079
|
return {
|
|
12145
|
-
version: "1.0",
|
|
12146
13080
|
tokenId,
|
|
12147
13081
|
contractAddress: config.address,
|
|
12148
13082
|
network: config.network,
|
|
12149
13083
|
networkChainId: config.chainId,
|
|
12150
13084
|
transactionHash,
|
|
12151
13085
|
merkleRoot: this.merkleRoot,
|
|
13086
|
+
encryptedHash: this.encryptedHash || void 0,
|
|
12152
13087
|
mintedAt: now.toISOString(),
|
|
12153
|
-
creationTimestamp: Math.floor(now.getTime() / 1e3)
|
|
13088
|
+
creationTimestamp: Math.floor(now.getTime() / 1e3),
|
|
13089
|
+
contractVersion: config.version
|
|
13090
|
+
// Required - always set from config
|
|
12154
13091
|
};
|
|
12155
13092
|
}
|
|
12156
13093
|
/**
|
|
@@ -12176,9 +13113,9 @@ var require_ZipkitMinterBrowser = __commonJS({
|
|
|
12176
13113
|
}
|
|
12177
13114
|
});
|
|
12178
13115
|
|
|
12179
|
-
// neozipkit/dist/blockchain/browser/TokenVerifierBrowser.js
|
|
13116
|
+
// node_modules/neozipkit/dist/blockchain/browser/TokenVerifierBrowser.js
|
|
12180
13117
|
var require_TokenVerifierBrowser = __commonJS({
|
|
12181
|
-
"neozipkit/dist/blockchain/browser/TokenVerifierBrowser.js"(exports2) {
|
|
13118
|
+
"node_modules/neozipkit/dist/blockchain/browser/TokenVerifierBrowser.js"(exports2) {
|
|
12182
13119
|
"use strict";
|
|
12183
13120
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12184
13121
|
exports2.TokenVerifierBrowser = void 0;
|
|
@@ -12273,9 +13210,6 @@ var require_TokenVerifierBrowser = __commonJS({
|
|
|
12273
13210
|
const normalizedBlockchain = blockchainData.merkleRoot?.toLowerCase().trim() || "";
|
|
12274
13211
|
const normalizedCalculated = calculatedMerkleRoot?.toLowerCase().trim() || "";
|
|
12275
13212
|
const verificationPassed = normalizedBlockchain === normalizedCalculated;
|
|
12276
|
-
if (!verificationPassed) {
|
|
12277
|
-
console.warn(`[TokenVerifier] \u26A0\uFE0F Merkle root mismatch - Calculated: ${calculatedMerkleRoot}, Blockchain: ${blockchainData.merkleRoot}`);
|
|
12278
|
-
}
|
|
12279
13213
|
const enhancedTokenMetadata = {
|
|
12280
13214
|
...tokenMetadata,
|
|
12281
13215
|
owner: blockchainData.owner || void 0
|
|
@@ -12302,9 +13236,31 @@ var require_TokenVerifierBrowser = __commonJS({
|
|
|
12302
13236
|
}
|
|
12303
13237
|
/**
|
|
12304
13238
|
* Validates token metadata structure
|
|
13239
|
+
* Validates required fields: tokenId, contractAddress, network, merkleRoot, networkChainId, contractVersion
|
|
12305
13240
|
*/
|
|
12306
13241
|
validateTokenInfo(tokenMetadata) {
|
|
12307
|
-
|
|
13242
|
+
if (!tokenMetadata || typeof tokenMetadata !== "object") {
|
|
13243
|
+
return false;
|
|
13244
|
+
}
|
|
13245
|
+
if (typeof tokenMetadata.tokenId !== "string" || !tokenMetadata.tokenId) {
|
|
13246
|
+
return false;
|
|
13247
|
+
}
|
|
13248
|
+
if (typeof tokenMetadata.contractAddress !== "string" || !tokenMetadata.contractAddress) {
|
|
13249
|
+
return false;
|
|
13250
|
+
}
|
|
13251
|
+
if (typeof tokenMetadata.network !== "string" || !tokenMetadata.network) {
|
|
13252
|
+
return false;
|
|
13253
|
+
}
|
|
13254
|
+
if (typeof tokenMetadata.merkleRoot !== "string" || !tokenMetadata.merkleRoot) {
|
|
13255
|
+
return false;
|
|
13256
|
+
}
|
|
13257
|
+
if (typeof tokenMetadata.networkChainId !== "number" || tokenMetadata.networkChainId === void 0) {
|
|
13258
|
+
return false;
|
|
13259
|
+
}
|
|
13260
|
+
if (typeof tokenMetadata.contractVersion !== "string" || !tokenMetadata.contractVersion) {
|
|
13261
|
+
return false;
|
|
13262
|
+
}
|
|
13263
|
+
return true;
|
|
12308
13264
|
}
|
|
12309
13265
|
/**
|
|
12310
13266
|
* Calculates the merkle root excluding the token metadata file
|
|
@@ -12391,9 +13347,11 @@ var require_TokenVerifierBrowser = __commonJS({
|
|
|
12391
13347
|
const contract = new ethers_1.ethers.Contract(tokenMetadata.contractAddress, CONTRACT_ABI, provider);
|
|
12392
13348
|
const zipInfo = await contract.getZipFileInfo(tokenMetadata.tokenId);
|
|
12393
13349
|
const owner = await contract.ownerOf(tokenMetadata.tokenId);
|
|
13350
|
+
const merkleRoot = zipInfo.merkleRootHash;
|
|
13351
|
+
const timestamp = Number(zipInfo.tokenizationTime);
|
|
12394
13352
|
return {
|
|
12395
|
-
merkleRoot
|
|
12396
|
-
timestamp
|
|
13353
|
+
merkleRoot,
|
|
13354
|
+
timestamp,
|
|
12397
13355
|
owner
|
|
12398
13356
|
};
|
|
12399
13357
|
} catch (error) {
|
|
@@ -12446,406 +13404,84 @@ var require_TokenVerifierBrowser = __commonJS({
|
|
|
12446
13404
|
}
|
|
12447
13405
|
});
|
|
12448
13406
|
|
|
12449
|
-
// neozipkit/dist/blockchain/browser/index.js
|
|
13407
|
+
// node_modules/neozipkit/dist/blockchain/browser/index.js
|
|
12450
13408
|
var require_browser = __commonJS({
|
|
12451
|
-
"neozipkit/dist/blockchain/browser/index.js"(exports2) {
|
|
13409
|
+
"node_modules/neozipkit/dist/blockchain/browser/index.js"(exports2) {
|
|
12452
13410
|
"use strict";
|
|
12453
13411
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12454
13412
|
exports2.checkForTokenization = exports2.createTokenVerifier = exports2.TokenVerifierBrowser = exports2.ZipkitMinterBrowser = exports2.WalletManagerBrowser = void 0;
|
|
12455
13413
|
var WalletManagerBrowser_1 = require_WalletManagerBrowser();
|
|
12456
|
-
Object.defineProperty(exports2, "WalletManagerBrowser", { enumerable: true, get: function() {
|
|
13414
|
+
Object.defineProperty(exports2, "WalletManagerBrowser", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
12457
13415
|
return WalletManagerBrowser_1.WalletManagerBrowser;
|
|
12458
|
-
} });
|
|
13416
|
+
}, "get") });
|
|
12459
13417
|
var ZipkitMinterBrowser_1 = require_ZipkitMinterBrowser();
|
|
12460
|
-
Object.defineProperty(exports2, "ZipkitMinterBrowser", { enumerable: true, get: function() {
|
|
13418
|
+
Object.defineProperty(exports2, "ZipkitMinterBrowser", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
12461
13419
|
return ZipkitMinterBrowser_1.ZipkitMinterBrowser;
|
|
12462
|
-
} });
|
|
13420
|
+
}, "get") });
|
|
12463
13421
|
var TokenVerifierBrowser_1 = require_TokenVerifierBrowser();
|
|
12464
|
-
Object.defineProperty(exports2, "TokenVerifierBrowser", { enumerable: true, get: function() {
|
|
13422
|
+
Object.defineProperty(exports2, "TokenVerifierBrowser", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
12465
13423
|
return TokenVerifierBrowser_1.TokenVerifierBrowser;
|
|
12466
|
-
} });
|
|
12467
|
-
Object.defineProperty(exports2, "createTokenVerifier", { enumerable: true, get: function() {
|
|
13424
|
+
}, "get") });
|
|
13425
|
+
Object.defineProperty(exports2, "createTokenVerifier", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
12468
13426
|
return TokenVerifierBrowser_1.createTokenVerifier;
|
|
12469
|
-
} });
|
|
12470
|
-
Object.defineProperty(exports2, "checkForTokenization", { enumerable: true, get: function() {
|
|
13427
|
+
}, "get") });
|
|
13428
|
+
Object.defineProperty(exports2, "checkForTokenization", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
12471
13429
|
return TokenVerifierBrowser_1.checkForTokenization;
|
|
12472
|
-
} });
|
|
12473
|
-
}
|
|
12474
|
-
});
|
|
12475
|
-
|
|
12476
|
-
// neozipkit/dist/blockchain/server/ZipkitMinterServer.js
|
|
12477
|
-
var require_ZipkitMinterServer = __commonJS({
|
|
12478
|
-
"neozipkit/dist/blockchain/server/ZipkitMinterServer.js"(exports2) {
|
|
12479
|
-
"use strict";
|
|
12480
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12481
|
-
exports2.ZipkitMinterServer = void 0;
|
|
12482
|
-
var ZipkitMinter_1 = require_ZipkitMinter();
|
|
12483
|
-
var ZipkitMinterServer = class extends ZipkitMinter_1.ZipkitMinter {
|
|
12484
|
-
static {
|
|
12485
|
-
__name(this, "ZipkitMinterServer");
|
|
12486
|
-
}
|
|
12487
|
-
constructor(merkleRoot, options) {
|
|
12488
|
-
super(merkleRoot, options);
|
|
12489
|
-
}
|
|
12490
|
-
/**
|
|
12491
|
-
* Server-specific minting with enhanced error handling
|
|
12492
|
-
*/
|
|
12493
|
-
async mintTokenWithRetry(maxRetries = 3) {
|
|
12494
|
-
let lastError = null;
|
|
12495
|
-
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
12496
|
-
try {
|
|
12497
|
-
console.log(`\u{1F504} Minting attempt ${attempt}/${maxRetries}`);
|
|
12498
|
-
const result = await this.mintToken();
|
|
12499
|
-
if (result.success) {
|
|
12500
|
-
console.log(`\u2705 Minting successful on attempt ${attempt}`);
|
|
12501
|
-
return result;
|
|
12502
|
-
}
|
|
12503
|
-
lastError = new Error(result.message || "Minting failed");
|
|
12504
|
-
} catch (error) {
|
|
12505
|
-
lastError = error instanceof Error ? error : new Error("Unknown error");
|
|
12506
|
-
console.warn(`\u274C Minting attempt ${attempt} failed:`, lastError.message);
|
|
12507
|
-
if (attempt < maxRetries) {
|
|
12508
|
-
const delay = Math.pow(2, attempt) * 1e3;
|
|
12509
|
-
console.log(`\u23F3 Waiting ${delay}ms before retry...`);
|
|
12510
|
-
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
12511
|
-
}
|
|
12512
|
-
}
|
|
12513
|
-
}
|
|
12514
|
-
return {
|
|
12515
|
-
success: false,
|
|
12516
|
-
message: `Minting failed after ${maxRetries} attempts: ${lastError?.message || "Unknown error"}`
|
|
12517
|
-
};
|
|
12518
|
-
}
|
|
12519
|
-
/**
|
|
12520
|
-
* Batch minting for multiple archives
|
|
12521
|
-
*/
|
|
12522
|
-
async mintBatch(archives) {
|
|
12523
|
-
const results = [];
|
|
12524
|
-
for (const archive of archives) {
|
|
12525
|
-
try {
|
|
12526
|
-
this.merkleRoot = archive.merkleRoot;
|
|
12527
|
-
const result = await this.mintToken();
|
|
12528
|
-
results.push(result);
|
|
12529
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
12530
|
-
} catch (error) {
|
|
12531
|
-
results.push({
|
|
12532
|
-
success: false,
|
|
12533
|
-
message: `Failed to mint ${archive.name}: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
12534
|
-
});
|
|
12535
|
-
}
|
|
12536
|
-
}
|
|
12537
|
-
return results;
|
|
12538
|
-
}
|
|
12539
|
-
};
|
|
12540
|
-
exports2.ZipkitMinterServer = ZipkitMinterServer;
|
|
12541
|
-
}
|
|
12542
|
-
});
|
|
12543
|
-
|
|
12544
|
-
// neozipkit/dist/blockchain/server/ZipkitVerifierServer.js
|
|
12545
|
-
var require_ZipkitVerifierServer = __commonJS({
|
|
12546
|
-
"neozipkit/dist/blockchain/server/ZipkitVerifierServer.js"(exports2) {
|
|
12547
|
-
"use strict";
|
|
12548
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12549
|
-
exports2.ZipkitVerifierServer = void 0;
|
|
12550
|
-
var ZipkitVerifier_1 = require_ZipkitVerifier();
|
|
12551
|
-
var ZipkitVerifierServer = class extends ZipkitVerifier_1.ZipkitVerifier {
|
|
12552
|
-
static {
|
|
12553
|
-
__name(this, "ZipkitVerifierServer");
|
|
12554
|
-
}
|
|
12555
|
-
constructor(options = {}) {
|
|
12556
|
-
super(options);
|
|
12557
|
-
this.maxRetries = options.maxRetries || 3;
|
|
12558
|
-
this.retryDelay = options.retryDelay || 1e3;
|
|
12559
|
-
this.batchDelay = options.batchDelay || 500;
|
|
12560
|
-
}
|
|
12561
|
-
/**
|
|
12562
|
-
* Server-specific verification with enhanced error handling and retry logic
|
|
12563
|
-
*/
|
|
12564
|
-
async verifyTokenWithRetry(tokenId, expectedMerkleRoot, maxRetries) {
|
|
12565
|
-
const startTime = Date.now();
|
|
12566
|
-
const retries = maxRetries || this.maxRetries;
|
|
12567
|
-
let lastError = null;
|
|
12568
|
-
for (let attempt = 1; attempt <= retries; attempt++) {
|
|
12569
|
-
try {
|
|
12570
|
-
console.log(`\u{1F504} Verification attempt ${attempt}/${retries} for token ${tokenId}`);
|
|
12571
|
-
const result = await this.verifyTokenById(tokenId, expectedMerkleRoot);
|
|
12572
|
-
if (result.success) {
|
|
12573
|
-
console.log(`\u2705 Verification successful on attempt ${attempt} for token ${tokenId}`);
|
|
12574
|
-
return {
|
|
12575
|
-
...result,
|
|
12576
|
-
retryAttempts: attempt,
|
|
12577
|
-
processingTime: Date.now() - startTime,
|
|
12578
|
-
serverTimestamp: Date.now()
|
|
12579
|
-
};
|
|
12580
|
-
}
|
|
12581
|
-
lastError = new Error(result.message || "Verification failed");
|
|
12582
|
-
} catch (error) {
|
|
12583
|
-
lastError = error instanceof Error ? error : new Error("Unknown verification error");
|
|
12584
|
-
console.warn(`\u274C Verification attempt ${attempt} failed for token ${tokenId}:`, lastError.message);
|
|
12585
|
-
if (attempt < retries) {
|
|
12586
|
-
const delay = this.calculateRetryDelay(attempt);
|
|
12587
|
-
console.log(`\u23F3 Waiting ${delay}ms before retry...`);
|
|
12588
|
-
await this.delay(delay);
|
|
12589
|
-
}
|
|
12590
|
-
}
|
|
12591
|
-
}
|
|
12592
|
-
return {
|
|
12593
|
-
success: false,
|
|
12594
|
-
message: `Verification failed after ${retries} attempts: ${lastError?.message || "Unknown error"}`,
|
|
12595
|
-
retryAttempts: retries,
|
|
12596
|
-
processingTime: Date.now() - startTime,
|
|
12597
|
-
serverTimestamp: Date.now()
|
|
12598
|
-
};
|
|
12599
|
-
}
|
|
12600
|
-
/**
|
|
12601
|
-
* Batch verification for multiple tokens with rate limiting
|
|
12602
|
-
*/
|
|
12603
|
-
async verifyBatch(tokens, options = {}) {
|
|
12604
|
-
const startTime = Date.now();
|
|
12605
|
-
const { parallel = false, maxConcurrent = 3 } = options;
|
|
12606
|
-
console.log(`\u{1F504} Starting batch verification for ${tokens.length} tokens (parallel: ${parallel})`);
|
|
12607
|
-
let results = [];
|
|
12608
|
-
if (parallel) {
|
|
12609
|
-
results = await this.verifyBatchParallel(tokens, maxConcurrent);
|
|
12610
|
-
} else {
|
|
12611
|
-
results = await this.verifyBatchSequential(tokens);
|
|
12612
|
-
}
|
|
12613
|
-
const successfulVerifications = results.filter((r) => r.success).length;
|
|
12614
|
-
const failedVerifications = results.length - successfulVerifications;
|
|
12615
|
-
console.log(`\u2705 Batch verification completed: ${successfulVerifications}/${tokens.length} successful`);
|
|
12616
|
-
return {
|
|
12617
|
-
success: failedVerifications === 0,
|
|
12618
|
-
totalTokens: tokens.length,
|
|
12619
|
-
successfulVerifications,
|
|
12620
|
-
failedVerifications,
|
|
12621
|
-
results,
|
|
12622
|
-
processingTime: Date.now() - startTime
|
|
12623
|
-
};
|
|
12624
|
-
}
|
|
12625
|
-
/**
|
|
12626
|
-
* Verify tokens in parallel with concurrency control
|
|
12627
|
-
*/
|
|
12628
|
-
async verifyBatchParallel(tokens, maxConcurrent) {
|
|
12629
|
-
const results = [];
|
|
12630
|
-
const chunks = [];
|
|
12631
|
-
for (let i = 0; i < tokens.length; i += maxConcurrent) {
|
|
12632
|
-
chunks.push(tokens.slice(i, i + maxConcurrent));
|
|
12633
|
-
}
|
|
12634
|
-
for (const chunk of chunks) {
|
|
12635
|
-
const chunkPromises = chunk.map((token) => this.verifyTokenWithRetry(token.tokenId, token.merkleRoot));
|
|
12636
|
-
const chunkResults = await Promise.all(chunkPromises);
|
|
12637
|
-
results.push(...chunkResults);
|
|
12638
|
-
if (chunks.indexOf(chunk) < chunks.length - 1) {
|
|
12639
|
-
await this.delay(this.batchDelay);
|
|
12640
|
-
}
|
|
12641
|
-
}
|
|
12642
|
-
return results;
|
|
12643
|
-
}
|
|
12644
|
-
/**
|
|
12645
|
-
* Verify tokens sequentially with rate limiting
|
|
12646
|
-
*/
|
|
12647
|
-
async verifyBatchSequential(tokens) {
|
|
12648
|
-
const results = [];
|
|
12649
|
-
for (const token of tokens) {
|
|
12650
|
-
const result = await this.verifyTokenWithRetry(token.tokenId, token.merkleRoot);
|
|
12651
|
-
results.push(result);
|
|
12652
|
-
if (tokens.indexOf(token) < tokens.length - 1) {
|
|
12653
|
-
await this.delay(this.batchDelay);
|
|
12654
|
-
}
|
|
12655
|
-
}
|
|
12656
|
-
return results;
|
|
12657
|
-
}
|
|
12658
|
-
/**
|
|
12659
|
-
* Verify a token by ID (server-specific implementation)
|
|
12660
|
-
*/
|
|
12661
|
-
async verifyTokenById(tokenId, expectedMerkleRoot) {
|
|
12662
|
-
try {
|
|
12663
|
-
const tokenMetadata = await this.getTokenMetadata(tokenId);
|
|
12664
|
-
if (!tokenMetadata) {
|
|
12665
|
-
return {
|
|
12666
|
-
success: false,
|
|
12667
|
-
message: `Token ${tokenId} not found or metadata unavailable`
|
|
12668
|
-
};
|
|
12669
|
-
}
|
|
12670
|
-
return await this.verifyToken(tokenMetadata, expectedMerkleRoot || tokenMetadata.merkleRoot);
|
|
12671
|
-
} catch (error) {
|
|
12672
|
-
console.error(`Token verification failed for ${tokenId}:`, error);
|
|
12673
|
-
return {
|
|
12674
|
-
success: false,
|
|
12675
|
-
message: `Token verification failed: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
12676
|
-
};
|
|
12677
|
-
}
|
|
12678
|
-
}
|
|
12679
|
-
/**
|
|
12680
|
-
* Get token metadata from contract
|
|
12681
|
-
*/
|
|
12682
|
-
async getTokenMetadata(tokenId) {
|
|
12683
|
-
try {
|
|
12684
|
-
return {
|
|
12685
|
-
tokenId,
|
|
12686
|
-
merkleRoot: "",
|
|
12687
|
-
// Would be fetched from contract
|
|
12688
|
-
mintedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12689
|
-
contractAddress: "",
|
|
12690
|
-
// Would be fetched from contract
|
|
12691
|
-
network: "unknown"
|
|
12692
|
-
};
|
|
12693
|
-
} catch (error) {
|
|
12694
|
-
console.error(`Failed to get metadata for token ${tokenId}:`, error);
|
|
12695
|
-
return null;
|
|
12696
|
-
}
|
|
12697
|
-
}
|
|
12698
|
-
/**
|
|
12699
|
-
* Verify a single token with enhanced error handling
|
|
12700
|
-
*/
|
|
12701
|
-
async verifyTokenEnhanced(tokenId, expectedMerkleRoot) {
|
|
12702
|
-
const startTime = Date.now();
|
|
12703
|
-
try {
|
|
12704
|
-
console.log(`\u{1F50D} Starting enhanced verification for token ${tokenId}`);
|
|
12705
|
-
const result = await this.verifyTokenById(tokenId, expectedMerkleRoot);
|
|
12706
|
-
return {
|
|
12707
|
-
...result,
|
|
12708
|
-
retryAttempts: 1,
|
|
12709
|
-
processingTime: Date.now() - startTime,
|
|
12710
|
-
serverTimestamp: Date.now()
|
|
12711
|
-
};
|
|
12712
|
-
} catch (error) {
|
|
12713
|
-
console.error(`\u274C Enhanced verification failed for token ${tokenId}:`, error);
|
|
12714
|
-
return {
|
|
12715
|
-
success: false,
|
|
12716
|
-
message: `Enhanced verification failed: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
12717
|
-
retryAttempts: 1,
|
|
12718
|
-
processingTime: Date.now() - startTime,
|
|
12719
|
-
serverTimestamp: Date.now()
|
|
12720
|
-
};
|
|
12721
|
-
}
|
|
12722
|
-
}
|
|
12723
|
-
/**
|
|
12724
|
-
* Process verification jobs with priority queue
|
|
12725
|
-
*/
|
|
12726
|
-
async processVerificationJobs(jobs, options = {}) {
|
|
12727
|
-
const { maxConcurrent = 3, priorityOrder = true } = options;
|
|
12728
|
-
const sortedJobs = priorityOrder ? this.sortJobsByPriority(jobs) : jobs;
|
|
12729
|
-
const tokens = sortedJobs.map((job) => ({
|
|
12730
|
-
tokenId: job.tokenId,
|
|
12731
|
-
merkleRoot: job.merkleRoot
|
|
12732
|
-
}));
|
|
12733
|
-
return this.verifyBatch(tokens, { parallel: true, maxConcurrent });
|
|
12734
|
-
}
|
|
12735
|
-
/**
|
|
12736
|
-
* Sort verification jobs by priority
|
|
12737
|
-
*/
|
|
12738
|
-
sortJobsByPriority(jobs) {
|
|
12739
|
-
const priorityOrder = { high: 0, normal: 1, low: 2 };
|
|
12740
|
-
return jobs.sort((a, b) => {
|
|
12741
|
-
const aPriority = priorityOrder[a.priority || "normal"];
|
|
12742
|
-
const bPriority = priorityOrder[b.priority || "normal"];
|
|
12743
|
-
if (aPriority !== bPriority) {
|
|
12744
|
-
return aPriority - bPriority;
|
|
12745
|
-
}
|
|
12746
|
-
return (a.retryCount || 0) - (b.retryCount || 0);
|
|
12747
|
-
});
|
|
12748
|
-
}
|
|
12749
|
-
/**
|
|
12750
|
-
* Calculate retry delay with exponential backoff
|
|
12751
|
-
*/
|
|
12752
|
-
calculateRetryDelay(attempt) {
|
|
12753
|
-
return Math.min(this.retryDelay * Math.pow(2, attempt - 1), 3e4);
|
|
12754
|
-
}
|
|
12755
|
-
/**
|
|
12756
|
-
* Utility method for delays
|
|
12757
|
-
*/
|
|
12758
|
-
async delay(ms) {
|
|
12759
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
12760
|
-
}
|
|
12761
|
-
/**
|
|
12762
|
-
* Get verification statistics
|
|
12763
|
-
*/
|
|
12764
|
-
getVerificationStats() {
|
|
12765
|
-
return {
|
|
12766
|
-
maxRetries: this.maxRetries,
|
|
12767
|
-
retryDelay: this.retryDelay,
|
|
12768
|
-
batchDelay: this.batchDelay
|
|
12769
|
-
};
|
|
12770
|
-
}
|
|
12771
|
-
/**
|
|
12772
|
-
* Update verification configuration
|
|
12773
|
-
*/
|
|
12774
|
-
updateConfig(config) {
|
|
12775
|
-
if (config.maxRetries !== void 0) {
|
|
12776
|
-
this.maxRetries = config.maxRetries;
|
|
12777
|
-
}
|
|
12778
|
-
if (config.retryDelay !== void 0) {
|
|
12779
|
-
this.retryDelay = config.retryDelay;
|
|
12780
|
-
}
|
|
12781
|
-
if (config.batchDelay !== void 0) {
|
|
12782
|
-
this.batchDelay = config.batchDelay;
|
|
12783
|
-
}
|
|
12784
|
-
console.log("\u{1F527} ServerZipkitVerifier configuration updated:", this.getVerificationStats());
|
|
12785
|
-
}
|
|
12786
|
-
};
|
|
12787
|
-
exports2.ZipkitVerifierServer = ZipkitVerifierServer;
|
|
13430
|
+
}, "get") });
|
|
12788
13431
|
}
|
|
12789
13432
|
});
|
|
12790
13433
|
|
|
12791
|
-
// neozipkit/dist/blockchain/
|
|
12792
|
-
var
|
|
12793
|
-
"neozipkit/dist/blockchain/
|
|
13434
|
+
// node_modules/neozipkit/dist/blockchain/node/WalletManagerNode.js
|
|
13435
|
+
var require_WalletManagerNode = __commonJS({
|
|
13436
|
+
"node_modules/neozipkit/dist/blockchain/node/WalletManagerNode.js"(exports2) {
|
|
12794
13437
|
"use strict";
|
|
12795
|
-
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
12796
|
-
if (k2 === void 0)
|
|
12797
|
-
k2 = k;
|
|
13438
|
+
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
13439
|
+
if (k2 === void 0) k2 = k;
|
|
12798
13440
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12799
13441
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12800
|
-
desc = { enumerable: true, get: function() {
|
|
13442
|
+
desc = { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
12801
13443
|
return m[k];
|
|
12802
|
-
} };
|
|
13444
|
+
}, "get") };
|
|
12803
13445
|
}
|
|
12804
13446
|
Object.defineProperty(o, k2, desc);
|
|
12805
|
-
} : function(o, m, k, k2) {
|
|
12806
|
-
if (k2 === void 0)
|
|
12807
|
-
k2 = k;
|
|
13447
|
+
}) : (function(o, m, k, k2) {
|
|
13448
|
+
if (k2 === void 0) k2 = k;
|
|
12808
13449
|
o[k2] = m[k];
|
|
12809
|
-
});
|
|
12810
|
-
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
13450
|
+
}));
|
|
13451
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
12811
13452
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
12812
|
-
} : function(o, v) {
|
|
13453
|
+
}) : function(o, v) {
|
|
12813
13454
|
o["default"] = v;
|
|
12814
13455
|
});
|
|
12815
|
-
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ function() {
|
|
13456
|
+
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
|
|
12816
13457
|
var ownKeys = /* @__PURE__ */ __name(function(o) {
|
|
12817
13458
|
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
12818
13459
|
var ar = [];
|
|
12819
|
-
for (var k in o2)
|
|
12820
|
-
if (Object.prototype.hasOwnProperty.call(o2, k))
|
|
12821
|
-
ar[ar.length] = k;
|
|
13460
|
+
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
12822
13461
|
return ar;
|
|
12823
13462
|
};
|
|
12824
13463
|
return ownKeys(o);
|
|
12825
13464
|
}, "ownKeys");
|
|
12826
13465
|
return function(mod) {
|
|
12827
|
-
if (mod && mod.__esModule)
|
|
12828
|
-
return mod;
|
|
13466
|
+
if (mod && mod.__esModule) return mod;
|
|
12829
13467
|
var result = {};
|
|
12830
13468
|
if (mod != null) {
|
|
12831
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++)
|
|
12832
|
-
if (k[i] !== "default")
|
|
12833
|
-
__createBinding2(result, mod, k[i]);
|
|
13469
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]);
|
|
12834
13470
|
}
|
|
12835
13471
|
__setModuleDefault(result, mod);
|
|
12836
13472
|
return result;
|
|
12837
13473
|
};
|
|
12838
|
-
}();
|
|
13474
|
+
})();
|
|
12839
13475
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12840
|
-
exports2.ZipkitWallet = exports2.
|
|
13476
|
+
exports2.ZipkitWallet = exports2.WalletManagerNode = void 0;
|
|
12841
13477
|
var fs = __importStar(require("fs"));
|
|
12842
13478
|
var path = __importStar(require("path"));
|
|
12843
13479
|
var ethers_1 = require("ethers");
|
|
12844
13480
|
var WalletManager_1 = require_WalletManager();
|
|
12845
13481
|
var Logger_1 = require_Logger();
|
|
12846
|
-
var
|
|
13482
|
+
var WalletManagerNode = class extends WalletManager_1.CoreWalletManager {
|
|
12847
13483
|
static {
|
|
12848
|
-
__name(this, "
|
|
13484
|
+
__name(this, "WalletManagerNode");
|
|
12849
13485
|
}
|
|
12850
13486
|
constructor() {
|
|
12851
13487
|
super();
|
|
@@ -12916,6 +13552,12 @@ var require_WalletManagerServer = __commonJS({
|
|
|
12916
13552
|
}
|
|
12917
13553
|
/**
|
|
12918
13554
|
* Load wallet from file
|
|
13555
|
+
*
|
|
13556
|
+
* SECURITY WARNING: This method reads private keys from disk.
|
|
13557
|
+
* - Only use for development/testing
|
|
13558
|
+
* - Wallet files are automatically excluded from git via .gitignore
|
|
13559
|
+
* - Wallet files are excluded from NPM packages via .npmignore
|
|
13560
|
+
* - Use secure key management (HSMs, KMS) for production
|
|
12919
13561
|
*/
|
|
12920
13562
|
loadWalletFromFile(filePath) {
|
|
12921
13563
|
try {
|
|
@@ -12941,6 +13583,13 @@ var require_WalletManagerServer = __commonJS({
|
|
|
12941
13583
|
}
|
|
12942
13584
|
/**
|
|
12943
13585
|
* Create a new wallet and save to file
|
|
13586
|
+
*
|
|
13587
|
+
* SECURITY WARNING: This method saves private keys to disk.
|
|
13588
|
+
* - Only use for development/testing
|
|
13589
|
+
* - Never commit wallet files to version control
|
|
13590
|
+
* - Use secure key management for production
|
|
13591
|
+
* - Wallet files are automatically excluded via .gitignore and .npmignore
|
|
13592
|
+
* - Protect file system permissions on wallet files
|
|
12944
13593
|
*/
|
|
12945
13594
|
async createNewWallet() {
|
|
12946
13595
|
Logger_1.Logger.log("Creating a new wallet...");
|
|
@@ -12957,7 +13606,10 @@ var require_WalletManagerServer = __commonJS({
|
|
|
12957
13606
|
fs.writeFileSync(walletFilePath, JSON.stringify(walletInfo, null, 2));
|
|
12958
13607
|
Logger_1.Logger.log(`New wallet created and saved to ${walletFilePath}`);
|
|
12959
13608
|
Logger_1.Logger.log(`Wallet address: ${newWallet.address}`);
|
|
12960
|
-
Logger_1.Logger.log(`IMPORTANT: Please fund this wallet with
|
|
13609
|
+
Logger_1.Logger.log(`IMPORTANT: Please fund this wallet with testnet ETH to use for minting NFTs!`);
|
|
13610
|
+
Logger_1.Logger.log(`SECURITY: Wallet file is automatically excluded from git (.gitignore) and NPM packages (.npmignore)`);
|
|
13611
|
+
Logger_1.Logger.log(`SECURITY: Never commit wallet files to version control`);
|
|
13612
|
+
Logger_1.Logger.log(`SECURITY: Use secure key management (HSMs, KMS) for production applications`);
|
|
12961
13613
|
return newWallet.privateKey;
|
|
12962
13614
|
}
|
|
12963
13615
|
/**
|
|
@@ -12976,102 +13628,84 @@ var require_WalletManagerServer = __commonJS({
|
|
|
12976
13628
|
return void 0;
|
|
12977
13629
|
}
|
|
12978
13630
|
};
|
|
12979
|
-
exports2.
|
|
12980
|
-
exports2.ZipkitWallet =
|
|
13631
|
+
exports2.WalletManagerNode = WalletManagerNode;
|
|
13632
|
+
exports2.ZipkitWallet = WalletManagerNode;
|
|
12981
13633
|
}
|
|
12982
13634
|
});
|
|
12983
13635
|
|
|
12984
|
-
// neozipkit/dist/blockchain/
|
|
12985
|
-
var
|
|
12986
|
-
"neozipkit/dist/blockchain/
|
|
13636
|
+
// node_modules/neozipkit/dist/blockchain/node/index.js
|
|
13637
|
+
var require_node = __commonJS({
|
|
13638
|
+
"node_modules/neozipkit/dist/blockchain/node/index.js"(exports2) {
|
|
12987
13639
|
"use strict";
|
|
12988
13640
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12989
|
-
exports2.verifyOtsZip = exports2.verifyOts = exports2.createTimestamp = exports2.WalletAnalyzer = exports2.CoreWalletManager = exports2.ZipkitVerifier = exports2.ZipkitMinter = exports2.ZipkitWallet = exports2.
|
|
12990
|
-
var
|
|
12991
|
-
Object.defineProperty(exports2, "
|
|
12992
|
-
return
|
|
12993
|
-
} });
|
|
12994
|
-
|
|
12995
|
-
|
|
12996
|
-
|
|
12997
|
-
} });
|
|
12998
|
-
var WalletManagerServer_1 = require_WalletManagerServer();
|
|
12999
|
-
Object.defineProperty(exports2, "WalletManagerServer", { enumerable: true, get: function() {
|
|
13000
|
-
return WalletManagerServer_1.WalletManagerServer;
|
|
13001
|
-
} });
|
|
13002
|
-
Object.defineProperty(exports2, "ZipkitWallet", { enumerable: true, get: function() {
|
|
13003
|
-
return WalletManagerServer_1.ZipkitWallet;
|
|
13004
|
-
} });
|
|
13641
|
+
exports2.verifyOtsZip = exports2.verifyOts = exports2.createTimestamp = exports2.WalletAnalyzer = exports2.CoreWalletManager = exports2.ZipkitVerifier = exports2.ZipkitMinter = exports2.ZipkitWallet = exports2.WalletManagerNode = void 0;
|
|
13642
|
+
var WalletManagerNode_1 = require_WalletManagerNode();
|
|
13643
|
+
Object.defineProperty(exports2, "WalletManagerNode", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
13644
|
+
return WalletManagerNode_1.WalletManagerNode;
|
|
13645
|
+
}, "get") });
|
|
13646
|
+
Object.defineProperty(exports2, "ZipkitWallet", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
13647
|
+
return WalletManagerNode_1.ZipkitWallet;
|
|
13648
|
+
}, "get") });
|
|
13005
13649
|
var core_12 = require_core2();
|
|
13006
|
-
Object.defineProperty(exports2, "ZipkitMinter", { enumerable: true, get: function() {
|
|
13650
|
+
Object.defineProperty(exports2, "ZipkitMinter", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
13007
13651
|
return core_12.ZipkitMinter;
|
|
13008
|
-
} });
|
|
13009
|
-
Object.defineProperty(exports2, "ZipkitVerifier", { enumerable: true, get: function() {
|
|
13652
|
+
}, "get") });
|
|
13653
|
+
Object.defineProperty(exports2, "ZipkitVerifier", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
13010
13654
|
return core_12.ZipkitVerifier;
|
|
13011
|
-
} });
|
|
13012
|
-
Object.defineProperty(exports2, "CoreWalletManager", { enumerable: true, get: function() {
|
|
13655
|
+
}, "get") });
|
|
13656
|
+
Object.defineProperty(exports2, "CoreWalletManager", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
13013
13657
|
return core_12.CoreWalletManager;
|
|
13014
|
-
} });
|
|
13015
|
-
Object.defineProperty(exports2, "WalletAnalyzer", { enumerable: true, get: function() {
|
|
13658
|
+
}, "get") });
|
|
13659
|
+
Object.defineProperty(exports2, "WalletAnalyzer", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
13016
13660
|
return core_12.WalletAnalyzer;
|
|
13017
|
-
} });
|
|
13018
|
-
Object.defineProperty(exports2, "createTimestamp", { enumerable: true, get: function() {
|
|
13661
|
+
}, "get") });
|
|
13662
|
+
Object.defineProperty(exports2, "createTimestamp", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
13019
13663
|
return core_12.createTimestamp;
|
|
13020
|
-
} });
|
|
13021
|
-
Object.defineProperty(exports2, "verifyOts", { enumerable: true, get: function() {
|
|
13664
|
+
}, "get") });
|
|
13665
|
+
Object.defineProperty(exports2, "verifyOts", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
13022
13666
|
return core_12.verifyOts;
|
|
13023
|
-
} });
|
|
13024
|
-
Object.defineProperty(exports2, "verifyOtsZip", { enumerable: true, get: function() {
|
|
13667
|
+
}, "get") });
|
|
13668
|
+
Object.defineProperty(exports2, "verifyOtsZip", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
13025
13669
|
return core_12.verifyOtsZip;
|
|
13026
|
-
} });
|
|
13670
|
+
}, "get") });
|
|
13027
13671
|
}
|
|
13028
13672
|
});
|
|
13029
13673
|
|
|
13030
|
-
// neozipkit/dist/blockchain/index.js
|
|
13031
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
13032
|
-
if (k2 === void 0)
|
|
13033
|
-
k2 = k;
|
|
13674
|
+
// node_modules/neozipkit/dist/blockchain/index.js
|
|
13675
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
13676
|
+
if (k2 === void 0) k2 = k;
|
|
13034
13677
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13035
13678
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13036
|
-
desc = { enumerable: true, get: function() {
|
|
13679
|
+
desc = { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
13037
13680
|
return m[k];
|
|
13038
|
-
} };
|
|
13681
|
+
}, "get") };
|
|
13039
13682
|
}
|
|
13040
13683
|
Object.defineProperty(o, k2, desc);
|
|
13041
|
-
} : function(o, m, k, k2) {
|
|
13042
|
-
if (k2 === void 0)
|
|
13043
|
-
k2 = k;
|
|
13684
|
+
}) : (function(o, m, k, k2) {
|
|
13685
|
+
if (k2 === void 0) k2 = k;
|
|
13044
13686
|
o[k2] = m[k];
|
|
13045
|
-
});
|
|
13687
|
+
}));
|
|
13046
13688
|
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
|
13047
|
-
for (var p in m)
|
|
13048
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
13049
|
-
__createBinding(exports2, m, p);
|
|
13689
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
|
|
13050
13690
|
};
|
|
13051
13691
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13052
|
-
exports.configureLoggerFromEnvironment = exports.Logger = exports.ZipkitWallet = exports.
|
|
13692
|
+
exports.configureLoggerFromEnvironment = exports.Logger = exports.ZipkitWallet = exports.WalletManagerNode = void 0;
|
|
13053
13693
|
__exportStar(require_core2(), exports);
|
|
13054
13694
|
__exportStar(require_browser(), exports);
|
|
13055
|
-
var
|
|
13056
|
-
Object.defineProperty(exports, "
|
|
13057
|
-
return
|
|
13058
|
-
} });
|
|
13059
|
-
Object.defineProperty(exports, "
|
|
13060
|
-
return
|
|
13061
|
-
} });
|
|
13062
|
-
Object.defineProperty(exports, "WalletManagerServer", { enumerable: true, get: function() {
|
|
13063
|
-
return server_1.WalletManagerServer;
|
|
13064
|
-
} });
|
|
13065
|
-
Object.defineProperty(exports, "ZipkitWallet", { enumerable: true, get: function() {
|
|
13066
|
-
return server_1.ZipkitWallet;
|
|
13067
|
-
} });
|
|
13695
|
+
var node_1 = require_node();
|
|
13696
|
+
Object.defineProperty(exports, "WalletManagerNode", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
13697
|
+
return node_1.WalletManagerNode;
|
|
13698
|
+
}, "get") });
|
|
13699
|
+
Object.defineProperty(exports, "ZipkitWallet", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
13700
|
+
return node_1.ZipkitWallet;
|
|
13701
|
+
}, "get") });
|
|
13068
13702
|
var core_1 = require_core();
|
|
13069
|
-
Object.defineProperty(exports, "Logger", { enumerable: true, get: function() {
|
|
13703
|
+
Object.defineProperty(exports, "Logger", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
13070
13704
|
return core_1.Logger;
|
|
13071
|
-
} });
|
|
13072
|
-
Object.defineProperty(exports, "configureLoggerFromEnvironment", { enumerable: true, get: function() {
|
|
13705
|
+
}, "get") });
|
|
13706
|
+
Object.defineProperty(exports, "configureLoggerFromEnvironment", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
13073
13707
|
return core_1.configureLoggerFromEnvironment;
|
|
13074
|
-
} });
|
|
13708
|
+
}, "get") });
|
|
13075
13709
|
/*! Bundled license information:
|
|
13076
13710
|
|
|
13077
13711
|
moment/moment.js:
|