neozipkit 0.1.1 → 0.3.0

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.
Files changed (330) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +371 -200
  3. package/contracts/ABI.txt +889 -0
  4. package/contracts/Bytecode.txt +1 -0
  5. package/contracts/COMPILATION_NOTES.md +59 -0
  6. package/contracts/QUICK_DEPLOY.md +286 -0
  7. package/contracts/README.md +256 -0
  8. package/contracts/VERIFICATION.md +308 -0
  9. package/contracts/deploy-interactive.js +448 -0
  10. package/contracts/deployment-arbitrum-sepolia.json +12 -0
  11. package/contracts/deployment-arbitrum.json +12 -0
  12. package/contracts/deployment-eth-sepolia.json +12 -0
  13. package/contracts/hardhat.config.js +114 -0
  14. package/contracts/package.json +20 -0
  15. package/contracts/scripts/compile-and-extract.js +119 -0
  16. package/contracts/scripts/verify-contract.js +223 -0
  17. package/contracts/src/{NZIP-NFT-Private.sol → NZIP-NFT-v2.0.sol} +66 -151
  18. package/contracts/src/NZIP-NFT.sol +9 -15
  19. package/dist/{browser → blockchain/browser}/TokenVerifierBrowser.d.ts +11 -20
  20. package/dist/blockchain/browser/TokenVerifierBrowser.d.ts.map +1 -0
  21. package/dist/{browser → blockchain/browser}/TokenVerifierBrowser.js +106 -92
  22. package/dist/blockchain/browser/TokenVerifierBrowser.js.map +1 -0
  23. package/dist/blockchain/browser/WalletManagerBrowser.d.ts +98 -0
  24. package/dist/blockchain/browser/WalletManagerBrowser.d.ts.map +1 -0
  25. package/dist/blockchain/browser/WalletManagerBrowser.js +434 -0
  26. package/dist/blockchain/browser/WalletManagerBrowser.js.map +1 -0
  27. package/dist/blockchain/browser/ZipkitMinterBrowser.d.ts +58 -0
  28. package/dist/blockchain/browser/ZipkitMinterBrowser.d.ts.map +1 -0
  29. package/dist/blockchain/browser/ZipkitMinterBrowser.js +317 -0
  30. package/dist/blockchain/browser/ZipkitMinterBrowser.js.map +1 -0
  31. package/dist/blockchain/browser/index.d.ts +11 -0
  32. package/dist/blockchain/browser/index.d.ts.map +1 -0
  33. package/dist/blockchain/browser/index.js +16 -0
  34. package/dist/blockchain/browser/index.js.map +1 -0
  35. package/dist/{server/blockchain/WalletAnalyzer.d.ts → blockchain/core/WalletManager.d.ts} +69 -26
  36. package/dist/blockchain/core/WalletManager.d.ts.map +1 -0
  37. package/dist/{server/blockchain/WalletAnalyzer.js → blockchain/core/WalletManager.js} +172 -160
  38. package/dist/blockchain/core/WalletManager.js.map +1 -0
  39. package/dist/blockchain/core/ZipkitMinter.d.ts +141 -0
  40. package/dist/blockchain/core/ZipkitMinter.d.ts.map +1 -0
  41. package/dist/blockchain/core/ZipkitMinter.js +548 -0
  42. package/dist/blockchain/core/ZipkitMinter.js.map +1 -0
  43. package/dist/blockchain/core/ZipkitOTS.d.ts +126 -0
  44. package/dist/blockchain/core/ZipkitOTS.d.ts.map +1 -0
  45. package/dist/blockchain/core/ZipkitOTS.js +506 -0
  46. package/dist/blockchain/core/ZipkitOTS.js.map +1 -0
  47. package/dist/blockchain/core/ZipkitVerifier.d.ts +177 -0
  48. package/dist/blockchain/core/ZipkitVerifier.d.ts.map +1 -0
  49. package/dist/blockchain/core/ZipkitVerifier.js +632 -0
  50. package/dist/blockchain/core/ZipkitVerifier.js.map +1 -0
  51. package/dist/blockchain/core/contracts.d.ts +83 -0
  52. package/dist/blockchain/core/contracts.d.ts.map +1 -0
  53. package/dist/blockchain/core/contracts.js +341 -0
  54. package/dist/blockchain/core/contracts.js.map +1 -0
  55. package/dist/blockchain/core/index.d.ts +12 -0
  56. package/dist/blockchain/core/index.d.ts.map +1 -0
  57. package/dist/blockchain/core/index.js +59 -0
  58. package/dist/blockchain/core/index.js.map +1 -0
  59. package/dist/blockchain/index.d.ts +11 -0
  60. package/dist/blockchain/index.d.ts.map +1 -0
  61. package/dist/blockchain/index.js +34 -0
  62. package/dist/blockchain/index.js.map +1 -0
  63. package/dist/blockchain/node/WalletManagerNode.d.ts +47 -0
  64. package/dist/blockchain/node/WalletManagerNode.d.ts.map +1 -0
  65. package/dist/blockchain/node/WalletManagerNode.js +203 -0
  66. package/dist/blockchain/node/WalletManagerNode.js.map +1 -0
  67. package/dist/blockchain/node/index.d.ts +12 -0
  68. package/dist/blockchain/node/index.d.ts.map +1 -0
  69. package/dist/blockchain/node/index.js +24 -0
  70. package/dist/blockchain/node/index.js.map +1 -0
  71. package/dist/browser/ZipkitBrowser.d.ts +27 -0
  72. package/dist/browser/ZipkitBrowser.d.ts.map +1 -0
  73. package/dist/browser/{ZipKitBrowser.js → ZipkitBrowser.js} +96 -43
  74. package/dist/browser/ZipkitBrowser.js.map +1 -0
  75. package/dist/browser/index.d.ts +12 -0
  76. package/dist/browser/index.d.ts.map +1 -0
  77. package/dist/browser/index.js +42 -0
  78. package/dist/browser/index.js.map +1 -0
  79. package/dist/browser-esm/index.d.ts +12 -0
  80. package/dist/browser-esm/index.js +59559 -0
  81. package/dist/browser-esm/index.js.map +7 -0
  82. package/dist/browser-umd/index.d.ts +12 -0
  83. package/dist/browser-umd/index.js +59576 -0
  84. package/dist/browser-umd/index.js.map +7 -0
  85. package/dist/browser-umd/index.min.js +63 -0
  86. package/dist/browser.d.ts +8 -17
  87. package/dist/browser.js +13 -29
  88. package/dist/core/ZipCompress.d.ts +99 -0
  89. package/dist/core/ZipCompress.d.ts.map +1 -0
  90. package/dist/core/ZipCompress.js +309 -0
  91. package/dist/core/ZipCompress.js.map +1 -0
  92. package/dist/core/ZipDecompress.d.ts +58 -0
  93. package/dist/core/ZipDecompress.d.ts.map +1 -0
  94. package/dist/core/ZipDecompress.js +172 -0
  95. package/dist/core/ZipDecompress.js.map +1 -0
  96. package/dist/{shared → core}/ZipEntry.d.ts +8 -1
  97. package/dist/core/ZipEntry.d.ts.map +1 -0
  98. package/dist/{shared → core}/ZipEntry.js +224 -81
  99. package/dist/core/ZipEntry.js.map +1 -0
  100. package/dist/core/Zipkit.d.ts +315 -0
  101. package/dist/core/Zipkit.d.ts.map +1 -0
  102. package/dist/core/Zipkit.js +647 -0
  103. package/dist/core/Zipkit.js.map +1 -0
  104. package/dist/core/components/HashCalculator.d.ts +138 -0
  105. package/dist/core/components/HashCalculator.d.ts.map +1 -0
  106. package/dist/core/components/HashCalculator.js +360 -0
  107. package/dist/core/components/HashCalculator.js.map +1 -0
  108. package/dist/core/components/Logger.d.ts +73 -0
  109. package/dist/core/components/Logger.d.ts.map +1 -0
  110. package/dist/core/components/Logger.js +156 -0
  111. package/dist/core/components/Logger.js.map +1 -0
  112. package/dist/core/components/ProgressTracker.d.ts +43 -0
  113. package/dist/core/components/ProgressTracker.d.ts.map +1 -0
  114. package/dist/core/components/ProgressTracker.js +112 -0
  115. package/dist/core/components/ProgressTracker.js.map +1 -0
  116. package/dist/{shared → core}/components/Support.d.ts +1 -0
  117. package/dist/core/components/Support.d.ts.map +1 -0
  118. package/dist/{shared → core}/components/Support.js +1 -0
  119. package/dist/core/components/Support.js.map +1 -0
  120. package/dist/{shared → core}/components/Util.d.ts +7 -2
  121. package/dist/core/components/Util.d.ts.map +1 -0
  122. package/dist/{shared → core}/components/Util.js +14 -34
  123. package/dist/core/components/Util.js.map +1 -0
  124. package/dist/{shared → core}/constants/Errors.d.ts +1 -2
  125. package/dist/core/constants/Errors.d.ts.map +1 -0
  126. package/dist/{shared → core}/constants/Errors.js +1 -3
  127. package/dist/core/constants/Errors.js.map +1 -0
  128. package/dist/{shared → core}/constants/Headers.d.ts +3 -0
  129. package/dist/core/constants/Headers.d.ts.map +1 -0
  130. package/dist/{shared → core}/constants/Headers.js +20 -17
  131. package/dist/core/constants/Headers.js.map +1 -0
  132. package/dist/core/encryption/Manager.d.ts +58 -0
  133. package/dist/core/encryption/Manager.d.ts.map +1 -0
  134. package/dist/core/encryption/Manager.js +121 -0
  135. package/dist/core/encryption/Manager.js.map +1 -0
  136. package/dist/core/encryption/ZipCrypto.d.ts +172 -0
  137. package/dist/core/encryption/ZipCrypto.d.ts.map +1 -0
  138. package/dist/core/encryption/ZipCrypto.js +554 -0
  139. package/dist/core/encryption/ZipCrypto.js.map +1 -0
  140. package/dist/core/encryption/index.d.ts +9 -0
  141. package/dist/core/encryption/index.d.ts.map +1 -0
  142. package/dist/core/encryption/index.js +17 -0
  143. package/dist/core/encryption/index.js.map +1 -0
  144. package/dist/core/encryption/types.d.ts +29 -0
  145. package/dist/core/encryption/types.d.ts.map +1 -0
  146. package/dist/core/encryption/types.js +12 -0
  147. package/dist/core/encryption/types.js.map +1 -0
  148. package/dist/core/index.d.ts +24 -0
  149. package/dist/core/index.d.ts.map +1 -0
  150. package/dist/core/index.js +57 -0
  151. package/dist/core/index.js.map +1 -0
  152. package/dist/{shared → core}/version.d.ts +1 -0
  153. package/dist/core/version.d.ts.map +1 -0
  154. package/dist/core/version.js +31 -0
  155. package/dist/core/version.js.map +1 -0
  156. package/dist/index.d.ts +8 -25
  157. package/dist/index.d.ts.map +1 -0
  158. package/dist/index.js +29 -47
  159. package/dist/index.js.map +1 -0
  160. package/dist/node/ZipCompressNode.d.ts +123 -0
  161. package/dist/node/ZipCompressNode.d.ts.map +1 -0
  162. package/dist/node/ZipCompressNode.js +576 -0
  163. package/dist/node/ZipCompressNode.js.map +1 -0
  164. package/dist/node/ZipDecompressNode.d.ts +120 -0
  165. package/dist/node/ZipDecompressNode.d.ts.map +1 -0
  166. package/dist/node/ZipDecompressNode.js +461 -0
  167. package/dist/node/ZipDecompressNode.js.map +1 -0
  168. package/dist/node/ZipkitNode.d.ts +406 -0
  169. package/dist/node/ZipkitNode.d.ts.map +1 -0
  170. package/dist/node/ZipkitNode.js +1305 -0
  171. package/dist/node/ZipkitNode.js.map +1 -0
  172. package/dist/node/index.d.ts +26 -0
  173. package/dist/node/index.d.ts.map +1 -0
  174. package/dist/node/index.js +65 -0
  175. package/dist/node/index.js.map +1 -0
  176. package/dist/types/index.d.ts +59 -0
  177. package/dist/types/index.d.ts.map +1 -0
  178. package/dist/types/index.js +36 -1
  179. package/dist/types/index.js.map +1 -0
  180. package/examples/README.md +269 -0
  181. package/examples/blockchain-tokenize.ts +354 -0
  182. package/examples/create-zip.ts +172 -0
  183. package/examples/extract-zip.ts +158 -0
  184. package/examples/list-zip.ts +161 -0
  185. package/examples/test-files/data.json +116 -0
  186. package/examples/test-files/document.md +80 -0
  187. package/examples/test-files/document.txt +2 -0
  188. package/examples/test-files/file1.txt +48 -0
  189. package/examples/test-files/file2.txt +80 -0
  190. package/examples/tsconfig.json +44 -0
  191. package/examples/unzip-token.ts +6 -3
  192. package/examples/verify-tokenized-zip.ts +305 -0
  193. package/package.json +117 -23
  194. package/src/blockchain/README.md +222 -0
  195. package/src/{browser → blockchain/browser}/TokenVerifierBrowser.ts +125 -79
  196. package/src/blockchain/browser/WalletManagerBrowser.ts +486 -0
  197. package/src/blockchain/browser/ZipkitMinterBrowser.ts +400 -0
  198. package/src/blockchain/browser/index.ts +13 -0
  199. package/src/blockchain/core/WalletManager.ts +436 -0
  200. package/src/blockchain/core/ZipkitMinter.ts +716 -0
  201. package/src/blockchain/core/ZipkitOTS.ts +588 -0
  202. package/src/blockchain/core/ZipkitVerifier.ts +853 -0
  203. package/src/blockchain/core/contracts.ts +370 -0
  204. package/src/blockchain/core/index.ts +71 -0
  205. package/src/blockchain/index.ts +27 -0
  206. package/src/blockchain/node/WalletManagerNode.ts +171 -0
  207. package/src/blockchain/node/index.ts +40 -0
  208. package/src/browser/{ZipKitBrowser.ts → ZipkitBrowser.ts} +104 -41
  209. package/src/browser/index.esm.ts +37 -0
  210. package/src/browser/index.ts +25 -0
  211. package/src/core/ZipCompress.ts +398 -0
  212. package/src/core/ZipDecompress.ts +212 -0
  213. package/src/{shared → core}/ZipEntry.ts +239 -89
  214. package/src/core/Zipkit.ts +794 -0
  215. package/src/core/components/HashCalculator.ts +384 -0
  216. package/src/core/components/Logger.ts +180 -0
  217. package/src/core/components/ProgressTracker.ts +134 -0
  218. package/src/{shared → core}/components/Util.ts +12 -34
  219. package/src/{shared → core}/constants/Errors.ts +0 -4
  220. package/src/{shared → core}/constants/Headers.ts +19 -17
  221. package/src/core/encryption/Manager.ts +137 -0
  222. package/src/core/encryption/ZipCrypto.ts +650 -0
  223. package/src/core/encryption/index.ts +15 -0
  224. package/src/core/encryption/types.ts +33 -0
  225. package/src/core/index.ts +34 -0
  226. package/src/core/version.ts +33 -0
  227. package/src/index.ts +54 -32
  228. package/src/node/ZipCompressNode.ts +632 -0
  229. package/src/node/ZipDecompressNode.ts +508 -0
  230. package/src/node/ZipkitNode.ts +1559 -0
  231. package/src/node/index.ts +69 -0
  232. package/src/types/index.ts +131 -1
  233. package/src/types/opentimestamps.d.ts +1 -23
  234. package/contracts/Lock.sol +0 -34
  235. package/contracts/bytecode.txt +0 -1
  236. package/contracts/compile-contract.js +0 -168
  237. package/contracts/deploy/deploy-both-contracts.js +0 -286
  238. package/contracts/deploy/deploy-enhanced-contract.js +0 -197
  239. package/contracts/deploy/deploy-private-contract.js +0 -190
  240. package/contracts/deploy/deploy-public-clean.js +0 -1063
  241. package/contracts/deploy/deploy-public-contract.js +0 -1107
  242. package/contracts/deployment.config.example.js +0 -25
  243. package/contracts/remix-compile.js +0 -222
  244. package/contracts/setup-deployment.js +0 -51
  245. package/contracts/src/ZipFileNFT-DEPRECATED-6field.sol +0 -260
  246. package/contracts/src/ZipFileNFT-DEPRECATED-Enhanced.sol +0 -289
  247. package/dist/browser/CertificateGeneratorBrowser.d.ts +0 -75
  248. package/dist/browser/CertificateGeneratorBrowser.js +0 -433
  249. package/dist/browser/ZipKitBrowser.d.ts +0 -18
  250. package/dist/browser/ZipKitStampBrowser.d.ts +0 -2
  251. package/dist/browser/ZipKitStampBrowser.js +0 -12
  252. package/dist/browser-index.d.ts +0 -21
  253. package/dist/browser-index.js +0 -58
  254. package/dist/server/blockchain/CertificateToken.d.ts +0 -48
  255. package/dist/server/blockchain/CertificateToken.js +0 -386
  256. package/dist/server/blockchain/NFTMinter.d.ts +0 -41
  257. package/dist/server/blockchain/NFTMinter.js +0 -323
  258. package/dist/server/blockchain/TokenQuerier.d.ts +0 -31
  259. package/dist/server/blockchain/TokenQuerier.js +0 -259
  260. package/dist/server/blockchain/TokenVerifier.d.ts +0 -20
  261. package/dist/server/blockchain/TokenVerifier.js +0 -395
  262. package/dist/server/blockchain/WalletFormatter.d.ts +0 -39
  263. package/dist/server/blockchain/WalletFormatter.js +0 -196
  264. package/dist/server/blockchain/WalletManager.d.ts +0 -46
  265. package/dist/server/blockchain/WalletManager.js +0 -294
  266. package/dist/server/blockchain/ZipMetadata.d.ts +0 -27
  267. package/dist/server/blockchain/ZipMetadata.js +0 -131
  268. package/dist/server/blockchain/ZipTokenProcessor.d.ts +0 -44
  269. package/dist/server/blockchain/ZipTokenProcessor.js +0 -204
  270. package/dist/server/blockchain/constants.d.ts +0 -102
  271. package/dist/server/blockchain/constants.js +0 -968
  272. package/dist/server/blockchain/index.d.ts +0 -9
  273. package/dist/server/blockchain/index.js +0 -44
  274. package/dist/server/blockchain/test-certificate.d.ts +0 -8
  275. package/dist/server/blockchain/test-certificate.js +0 -100
  276. package/dist/server/blockchain/types.d.ts +0 -69
  277. package/dist/server/blockchain/types.js +0 -51
  278. package/dist/server/platform/server/ZipKitServer.d.ts +0 -105
  279. package/dist/server/platform/server/ZipKitServer.js +0 -437
  280. package/dist/server/platform/servercomponents/ZipKitOTS.d.ts +0 -91
  281. package/dist/server/platform/servercomponents/ZipKitOTS.js +0 -271
  282. package/dist/shared/ZipKit.d.ts +0 -249
  283. package/dist/shared/ZipKit.js +0 -789
  284. package/dist/shared/components/CertificateOTS.d.ts +0 -15
  285. package/dist/shared/components/CertificateOTS.js +0 -116
  286. package/dist/shared/components/FileSys.d.ts +0 -2
  287. package/dist/shared/components/FileSys.js +0 -113
  288. package/dist/shared/components/HashAccumulator.d.ts +0 -55
  289. package/dist/shared/components/HashAccumulator.js +0 -100
  290. package/dist/shared/components/ZipCrypto.d.ts +0 -3
  291. package/dist/shared/components/ZipCrypto.js +0 -78
  292. package/dist/shared/components/merkleTree.d.ts +0 -66
  293. package/dist/shared/components/merkleTree.js +0 -136
  294. package/dist/shared/types/index.d.ts +0 -21
  295. package/dist/shared/types/index.js +0 -3
  296. package/dist/shared/types.d.ts +0 -33
  297. package/dist/shared/types.js +0 -8
  298. package/dist/shared/version.js +0 -7
  299. package/src/browser/CertificateGeneratorBrowser.ts +0 -498
  300. package/src/browser/ZipKitStampBrowser.ts +0 -9
  301. package/src/browser-index.ts +0 -36
  302. package/src/server/blockchain/CertificateToken.ts +0 -444
  303. package/src/server/blockchain/NFTMinter.ts +0 -357
  304. package/src/server/blockchain/TokenQuerier.ts +0 -287
  305. package/src/server/blockchain/TokenVerifier.ts +0 -453
  306. package/src/server/blockchain/WalletAnalyzer.ts +0 -397
  307. package/src/server/blockchain/WalletFormatter.ts +0 -206
  308. package/src/server/blockchain/WalletManager.ts +0 -294
  309. package/src/server/blockchain/ZipMetadata.ts +0 -117
  310. package/src/server/blockchain/ZipTokenProcessor.ts +0 -234
  311. package/src/server/blockchain/constants.ts +0 -969
  312. package/src/server/blockchain/index.ts +0 -42
  313. package/src/server/blockchain/test-certificate.ts +0 -137
  314. package/src/server/blockchain/types.ts +0 -134
  315. package/src/server/platform/server/ZipKitServer.ts +0 -459
  316. package/src/server/platform/servercomponents/ZipKitOTS.ts +0 -313
  317. package/src/server/platform/servercomponents/opentimestamps.d.ts +0 -23
  318. package/src/shared/ZipKit.ts +0 -899
  319. package/src/shared/components/CertificateOTS.ts +0 -132
  320. package/src/shared/components/FileSys.ts +0 -87
  321. package/src/shared/components/HashAccumulator.ts +0 -113
  322. package/src/shared/components/ZipCrypto.ts +0 -91
  323. package/src/shared/components/merkleTree.ts +0 -162
  324. package/src/shared/types/index.ts +0 -25
  325. package/src/shared/types/modules.d.ts +0 -22
  326. package/src/shared/types/opentimestamps.d.ts +0 -23
  327. package/src/shared/types.d.ts +0 -8
  328. package/src/shared/types.ts +0 -43
  329. package/src/shared/version.ts +0 -4
  330. /package/src/{shared → core}/components/Support.ts +0 -0
@@ -1,1063 +0,0 @@
1
- const { ethers } = require('ethers');
2
- const fs = require('fs');
3
- const path = require('path');
4
-
5
- /**
6
- * Clean NZIP NFT Public Contract Deployment Script
7
- * Reads bytecode from external file to avoid issues with large strings
8
- */
9
-
10
- // Configuration - Load from environment variables or config file
11
- function loadConfig() {
12
- let config = {};
13
-
14
- try {
15
- config = require('../deployment.config.js');
16
- console.log('📁 Loaded configuration from deployment.config.js');
17
- } catch (err) {
18
- console.log('📁 No deployment.config.js found, using environment variables');
19
- }
20
-
21
- const CHAIN_ID = process.env.CHAIN_ID ? parseInt(process.env.CHAIN_ID) : (config.CHAIN_ID || 84532);
22
- const PRIVATE_KEY = process.env.PRIVATE_KEY || config.PRIVATE_KEY;
23
-
24
- return { CHAIN_ID, PRIVATE_KEY, EXISTING_CONTRACT: config.EXISTING_CONTRACT };
25
- }
26
-
27
- const { CHAIN_ID, PRIVATE_KEY, EXISTING_CONTRACT } = loadConfig();
28
-
29
- // Network configurations
30
- const NETWORK_CONFIG = {
31
- 84532: {
32
- name: 'Base Sepolia',
33
- rpcUrl: 'https://sepolia.base.org',
34
- explorer: 'https://sepolia.basescan.org'
35
- },
36
- 8453: {
37
- name: 'Base Mainnet',
38
- rpcUrl: 'https://mainnet.base.org',
39
- explorer: 'https://basescan.org'
40
- }
41
- };
42
-
43
- // Load bytecode and ABI from files
44
- function loadContractData() {
45
- const bytecodePath = path.join(__dirname, '../bytecode.txt');
46
-
47
- if (!fs.existsSync(bytecodePath)) {
48
- throw new Error('❌ bytecode.txt file not found. Please create it and paste your compiled bytecode.');
49
- }
50
-
51
- const bytecode = fs.readFileSync(bytecodePath, 'utf8').trim();
52
-
53
- if (!bytecode || bytecode === 'PASTE_YOUR_COMPILED_BYTECODE_HERE') {
54
- throw new Error('❌ Please paste your compiled bytecode into contracts/bytecode.txt');
55
- }
56
-
57
- const abi = [
58
- {
59
- "inputs": [],
60
- "stateMutability": "nonpayable",
61
- "type": "constructor"
62
- },
63
- {
64
- "inputs": [
65
- {
66
- "internalType": "address",
67
- "name": "sender",
68
- "type": "address"
69
- },
70
- {
71
- "internalType": "uint256",
72
- "name": "tokenId",
73
- "type": "uint256"
74
- },
75
- {
76
- "internalType": "address",
77
- "name": "owner",
78
- "type": "address"
79
- }
80
- ],
81
- "name": "ERC721IncorrectOwner",
82
- "type": "error"
83
- },
84
- {
85
- "inputs": [
86
- {
87
- "internalType": "address",
88
- "name": "operator",
89
- "type": "address"
90
- },
91
- {
92
- "internalType": "uint256",
93
- "name": "tokenId",
94
- "type": "uint256"
95
- }
96
- ],
97
- "name": "ERC721InsufficientApproval",
98
- "type": "error"
99
- },
100
- {
101
- "inputs": [
102
- {
103
- "internalType": "address",
104
- "name": "approver",
105
- "type": "address"
106
- }
107
- ],
108
- "name": "ERC721InvalidApprover",
109
- "type": "error"
110
- },
111
- {
112
- "inputs": [
113
- {
114
- "internalType": "address",
115
- "name": "operator",
116
- "type": "address"
117
- }
118
- ],
119
- "name": "ERC721InvalidOperator",
120
- "type": "error"
121
- },
122
- {
123
- "inputs": [
124
- {
125
- "internalType": "address",
126
- "name": "owner",
127
- "type": "address"
128
- }
129
- ],
130
- "name": "ERC721InvalidOwner",
131
- "type": "error"
132
- },
133
- {
134
- "inputs": [
135
- {
136
- "internalType": "address",
137
- "name": "receiver",
138
- "type": "address"
139
- }
140
- ],
141
- "name": "ERC721InvalidReceiver",
142
- "type": "error"
143
- },
144
- {
145
- "inputs": [
146
- {
147
- "internalType": "address",
148
- "name": "sender",
149
- "type": "address"
150
- }
151
- ],
152
- "name": "ERC721InvalidSender",
153
- "type": "error"
154
- },
155
- {
156
- "inputs": [
157
- {
158
- "internalType": "uint256",
159
- "name": "tokenId",
160
- "type": "uint256"
161
- }
162
- ],
163
- "name": "ERC721NonexistentToken",
164
- "type": "error"
165
- },
166
- {
167
- "inputs": [
168
- {
169
- "internalType": "address",
170
- "name": "owner",
171
- "type": "address"
172
- }
173
- ],
174
- "name": "OwnableInvalidOwner",
175
- "type": "error"
176
- },
177
- {
178
- "inputs": [
179
- {
180
- "internalType": "address",
181
- "name": "account",
182
- "type": "address"
183
- }
184
- ],
185
- "name": "OwnableUnauthorizedAccount",
186
- "type": "error"
187
- },
188
- {
189
- "anonymous": false,
190
- "inputs": [
191
- {
192
- "indexed": true,
193
- "internalType": "address",
194
- "name": "owner",
195
- "type": "address"
196
- },
197
- {
198
- "indexed": true,
199
- "internalType": "address",
200
- "name": "approved",
201
- "type": "address"
202
- },
203
- {
204
- "indexed": true,
205
- "internalType": "uint256",
206
- "name": "tokenId",
207
- "type": "uint256"
208
- }
209
- ],
210
- "name": "Approval",
211
- "type": "event"
212
- },
213
- {
214
- "anonymous": false,
215
- "inputs": [
216
- {
217
- "indexed": true,
218
- "internalType": "address",
219
- "name": "owner",
220
- "type": "address"
221
- },
222
- {
223
- "indexed": true,
224
- "internalType": "address",
225
- "name": "operator",
226
- "type": "address"
227
- },
228
- {
229
- "indexed": false,
230
- "internalType": "bool",
231
- "name": "approved",
232
- "type": "bool"
233
- }
234
- ],
235
- "name": "ApprovalForAll",
236
- "type": "event"
237
- },
238
- {
239
- "anonymous": false,
240
- "inputs": [
241
- {
242
- "indexed": false,
243
- "internalType": "uint256",
244
- "name": "_fromTokenId",
245
- "type": "uint256"
246
- },
247
- {
248
- "indexed": false,
249
- "internalType": "uint256",
250
- "name": "_toTokenId",
251
- "type": "uint256"
252
- }
253
- ],
254
- "name": "BatchMetadataUpdate",
255
- "type": "event"
256
- },
257
- {
258
- "anonymous": false,
259
- "inputs": [
260
- {
261
- "indexed": false,
262
- "internalType": "uint256",
263
- "name": "_tokenId",
264
- "type": "uint256"
265
- }
266
- ],
267
- "name": "MetadataUpdate",
268
- "type": "event"
269
- },
270
- {
271
- "anonymous": false,
272
- "inputs": [
273
- {
274
- "indexed": true,
275
- "internalType": "address",
276
- "name": "previousOwner",
277
- "type": "address"
278
- },
279
- {
280
- "indexed": true,
281
- "internalType": "address",
282
- "name": "newOwner",
283
- "type": "address"
284
- }
285
- ],
286
- "name": "OwnershipTransferred",
287
- "type": "event"
288
- },
289
- {
290
- "anonymous": false,
291
- "inputs": [
292
- {
293
- "indexed": true,
294
- "internalType": "address",
295
- "name": "from",
296
- "type": "address"
297
- },
298
- {
299
- "indexed": true,
300
- "internalType": "address",
301
- "name": "to",
302
- "type": "address"
303
- },
304
- {
305
- "indexed": true,
306
- "internalType": "uint256",
307
- "name": "tokenId",
308
- "type": "uint256"
309
- }
310
- ],
311
- "name": "Transfer",
312
- "type": "event"
313
- },
314
- {
315
- "anonymous": false,
316
- "inputs": [
317
- {
318
- "indexed": true,
319
- "internalType": "uint256",
320
- "name": "tokenId",
321
- "type": "uint256"
322
- },
323
- {
324
- "indexed": true,
325
- "internalType": "address",
326
- "name": "creator",
327
- "type": "address"
328
- },
329
- {
330
- "indexed": false,
331
- "internalType": "string",
332
- "name": "fileName",
333
- "type": "string"
334
- },
335
- {
336
- "indexed": false,
337
- "internalType": "string",
338
- "name": "merkleRootHash",
339
- "type": "string"
340
- },
341
- {
342
- "indexed": false,
343
- "internalType": "uint256",
344
- "name": "creationTimestamp",
345
- "type": "uint256"
346
- },
347
- {
348
- "indexed": false,
349
- "internalType": "string",
350
- "name": "ipfsHash",
351
- "type": "string"
352
- },
353
- {
354
- "indexed": false,
355
- "internalType": "uint256",
356
- "name": "tokenizationTime",
357
- "type": "uint256"
358
- },
359
- {
360
- "indexed": false,
361
- "internalType": "uint256",
362
- "name": "blockNumber",
363
- "type": "uint256"
364
- }
365
- ],
366
- "name": "ZipFileTokenized",
367
- "type": "event"
368
- },
369
- {
370
- "inputs": [
371
- {
372
- "internalType": "address",
373
- "name": "to",
374
- "type": "address"
375
- },
376
- {
377
- "internalType": "uint256",
378
- "name": "tokenId",
379
- "type": "uint256"
380
- }
381
- ],
382
- "name": "approve",
383
- "outputs": [],
384
- "stateMutability": "nonpayable",
385
- "type": "function"
386
- },
387
- {
388
- "inputs": [
389
- {
390
- "internalType": "address",
391
- "name": "owner",
392
- "type": "address"
393
- }
394
- ],
395
- "name": "balanceOf",
396
- "outputs": [
397
- {
398
- "internalType": "uint256",
399
- "name": "",
400
- "type": "uint256"
401
- }
402
- ],
403
- "stateMutability": "view",
404
- "type": "function"
405
- },
406
- {
407
- "inputs": [
408
- {
409
- "internalType": "bytes32",
410
- "name": "",
411
- "type": "bytes32"
412
- }
413
- ],
414
- "name": "compositeKeyToTokenId",
415
- "outputs": [
416
- {
417
- "internalType": "uint256",
418
- "name": "",
419
- "type": "uint256"
420
- }
421
- ],
422
- "stateMutability": "view",
423
- "type": "function"
424
- },
425
- {
426
- "inputs": [
427
- {
428
- "internalType": "string",
429
- "name": "merkleRootHash",
430
- "type": "string"
431
- },
432
- {
433
- "internalType": "uint256",
434
- "name": "creationTimestamp",
435
- "type": "uint256"
436
- }
437
- ],
438
- "name": "generateCompositeKey",
439
- "outputs": [
440
- {
441
- "internalType": "bytes32",
442
- "name": "",
443
- "type": "bytes32"
444
- }
445
- ],
446
- "stateMutability": "pure",
447
- "type": "function"
448
- },
449
- {
450
- "inputs": [
451
- {
452
- "internalType": "uint256",
453
- "name": "tokenId",
454
- "type": "uint256"
455
- }
456
- ],
457
- "name": "getApproved",
458
- "outputs": [
459
- {
460
- "internalType": "address",
461
- "name": "",
462
- "type": "address"
463
- }
464
- ],
465
- "stateMutability": "view",
466
- "type": "function"
467
- },
468
- {
469
- "inputs": [
470
- {
471
- "internalType": "uint256",
472
- "name": "tokenId",
473
- "type": "uint256"
474
- }
475
- ],
476
- "name": "getBlockchainMetadata",
477
- "outputs": [
478
- {
479
- "internalType": "uint256",
480
- "name": "blockNumber",
481
- "type": "uint256"
482
- },
483
- {
484
- "internalType": "uint256",
485
- "name": "tokenizationTime",
486
- "type": "uint256"
487
- }
488
- ],
489
- "stateMutability": "view",
490
- "type": "function"
491
- },
492
- {
493
- "inputs": [
494
- {
495
- "internalType": "string",
496
- "name": "merkleRoot",
497
- "type": "string"
498
- }
499
- ],
500
- "name": "getTokensByMerkleRoot",
501
- "outputs": [
502
- {
503
- "internalType": "uint256[]",
504
- "name": "",
505
- "type": "uint256[]"
506
- }
507
- ],
508
- "stateMutability": "view",
509
- "type": "function"
510
- },
511
- {
512
- "inputs": [],
513
- "name": "getVersion",
514
- "outputs": [
515
- {
516
- "internalType": "string",
517
- "name": "",
518
- "type": "string"
519
- }
520
- ],
521
- "stateMutability": "pure",
522
- "type": "function"
523
- },
524
- {
525
- "inputs": [
526
- {
527
- "internalType": "uint256",
528
- "name": "tokenId",
529
- "type": "uint256"
530
- }
531
- ],
532
- "name": "getZipFileInfo",
533
- "outputs": [
534
- {
535
- "components": [
536
- {
537
- "internalType": "string",
538
- "name": "fileName",
539
- "type": "string"
540
- },
541
- {
542
- "internalType": "string",
543
- "name": "merkleRootHash",
544
- "type": "string"
545
- },
546
- {
547
- "internalType": "string",
548
- "name": "ipfsHash",
549
- "type": "string"
550
- },
551
- {
552
- "internalType": "address",
553
- "name": "creator",
554
- "type": "address"
555
- },
556
- {
557
- "internalType": "uint256",
558
- "name": "creationTimestamp",
559
- "type": "uint256"
560
- },
561
- {
562
- "internalType": "uint256",
563
- "name": "tokenizationTime",
564
- "type": "uint256"
565
- },
566
- {
567
- "internalType": "uint256",
568
- "name": "blockNumber",
569
- "type": "uint256"
570
- }
571
- ],
572
- "internalType": "struct ZipFileNFT.ZipFileInfo",
573
- "name": "",
574
- "type": "tuple"
575
- }
576
- ],
577
- "stateMutability": "view",
578
- "type": "function"
579
- },
580
- {
581
- "inputs": [
582
- {
583
- "internalType": "address",
584
- "name": "owner",
585
- "type": "address"
586
- },
587
- {
588
- "internalType": "address",
589
- "name": "operator",
590
- "type": "address"
591
- }
592
- ],
593
- "name": "isApprovedForAll",
594
- "outputs": [
595
- {
596
- "internalType": "bool",
597
- "name": "",
598
- "type": "bool"
599
- }
600
- ],
601
- "stateMutability": "view",
602
- "type": "function"
603
- },
604
- {
605
- "inputs": [
606
- {
607
- "internalType": "string",
608
- "name": "merkleRootHash",
609
- "type": "string"
610
- },
611
- {
612
- "internalType": "uint256",
613
- "name": "creationTimestamp",
614
- "type": "uint256"
615
- }
616
- ],
617
- "name": "isZipFileTokenized",
618
- "outputs": [
619
- {
620
- "internalType": "bool",
621
- "name": "exists",
622
- "type": "bool"
623
- },
624
- {
625
- "internalType": "uint256",
626
- "name": "tokenId",
627
- "type": "uint256"
628
- }
629
- ],
630
- "stateMutability": "view",
631
- "type": "function"
632
- },
633
- {
634
- "inputs": [],
635
- "name": "name",
636
- "outputs": [
637
- {
638
- "internalType": "string",
639
- "name": "",
640
- "type": "string"
641
- }
642
- ],
643
- "stateMutability": "view",
644
- "type": "function"
645
- },
646
- {
647
- "inputs": [],
648
- "name": "owner",
649
- "outputs": [
650
- {
651
- "internalType": "address",
652
- "name": "",
653
- "type": "address"
654
- }
655
- ],
656
- "stateMutability": "view",
657
- "type": "function"
658
- },
659
- {
660
- "inputs": [
661
- {
662
- "internalType": "uint256",
663
- "name": "tokenId",
664
- "type": "uint256"
665
- }
666
- ],
667
- "name": "ownerOf",
668
- "outputs": [
669
- {
670
- "internalType": "address",
671
- "name": "",
672
- "type": "address"
673
- }
674
- ],
675
- "stateMutability": "view",
676
- "type": "function"
677
- },
678
- {
679
- "inputs": [
680
- {
681
- "internalType": "string",
682
- "name": "fileName",
683
- "type": "string"
684
- },
685
- {
686
- "internalType": "string",
687
- "name": "merkleRootHash",
688
- "type": "string"
689
- },
690
- {
691
- "internalType": "uint256",
692
- "name": "creationTimestamp",
693
- "type": "uint256"
694
- },
695
- {
696
- "internalType": "string",
697
- "name": "ipfsHash",
698
- "type": "string"
699
- },
700
- {
701
- "internalType": "string",
702
- "name": "metadataURI",
703
- "type": "string"
704
- }
705
- ],
706
- "name": "publicMintZipFile",
707
- "outputs": [
708
- {
709
- "internalType": "uint256",
710
- "name": "",
711
- "type": "uint256"
712
- }
713
- ],
714
- "stateMutability": "nonpayable",
715
- "type": "function"
716
- },
717
- {
718
- "inputs": [],
719
- "name": "renounceOwnership",
720
- "outputs": [],
721
- "stateMutability": "nonpayable",
722
- "type": "function"
723
- },
724
- {
725
- "inputs": [
726
- {
727
- "internalType": "address",
728
- "name": "from",
729
- "type": "address"
730
- },
731
- {
732
- "internalType": "address",
733
- "name": "to",
734
- "type": "address"
735
- },
736
- {
737
- "internalType": "uint256",
738
- "name": "tokenId",
739
- "type": "uint256"
740
- }
741
- ],
742
- "name": "safeTransferFrom",
743
- "outputs": [],
744
- "stateMutability": "nonpayable",
745
- "type": "function"
746
- },
747
- {
748
- "inputs": [
749
- {
750
- "internalType": "address",
751
- "name": "from",
752
- "type": "address"
753
- },
754
- {
755
- "internalType": "address",
756
- "name": "to",
757
- "type": "address"
758
- },
759
- {
760
- "internalType": "uint256",
761
- "name": "tokenId",
762
- "type": "uint256"
763
- },
764
- {
765
- "internalType": "bytes",
766
- "name": "data",
767
- "type": "bytes"
768
- }
769
- ],
770
- "name": "safeTransferFrom",
771
- "outputs": [],
772
- "stateMutability": "nonpayable",
773
- "type": "function"
774
- },
775
- {
776
- "inputs": [
777
- {
778
- "internalType": "address",
779
- "name": "operator",
780
- "type": "address"
781
- },
782
- {
783
- "internalType": "bool",
784
- "name": "approved",
785
- "type": "bool"
786
- }
787
- ],
788
- "name": "setApprovalForAll",
789
- "outputs": [],
790
- "stateMutability": "nonpayable",
791
- "type": "function"
792
- },
793
- {
794
- "inputs": [
795
- {
796
- "internalType": "bytes4",
797
- "name": "interfaceId",
798
- "type": "bytes4"
799
- }
800
- ],
801
- "name": "supportsInterface",
802
- "outputs": [
803
- {
804
- "internalType": "bool",
805
- "name": "",
806
- "type": "bool"
807
- }
808
- ],
809
- "stateMutability": "view",
810
- "type": "function"
811
- },
812
- {
813
- "inputs": [],
814
- "name": "symbol",
815
- "outputs": [
816
- {
817
- "internalType": "string",
818
- "name": "",
819
- "type": "string"
820
- }
821
- ],
822
- "stateMutability": "view",
823
- "type": "function"
824
- },
825
- {
826
- "inputs": [
827
- {
828
- "internalType": "uint256",
829
- "name": "tokenId",
830
- "type": "uint256"
831
- }
832
- ],
833
- "name": "tokenURI",
834
- "outputs": [
835
- {
836
- "internalType": "string",
837
- "name": "",
838
- "type": "string"
839
- }
840
- ],
841
- "stateMutability": "view",
842
- "type": "function"
843
- },
844
- {
845
- "inputs": [],
846
- "name": "totalSupply",
847
- "outputs": [
848
- {
849
- "internalType": "uint256",
850
- "name": "",
851
- "type": "uint256"
852
- }
853
- ],
854
- "stateMutability": "view",
855
- "type": "function"
856
- },
857
- {
858
- "inputs": [
859
- {
860
- "internalType": "address",
861
- "name": "from",
862
- "type": "address"
863
- },
864
- {
865
- "internalType": "address",
866
- "name": "to",
867
- "type": "address"
868
- },
869
- {
870
- "internalType": "uint256",
871
- "name": "tokenId",
872
- "type": "uint256"
873
- }
874
- ],
875
- "name": "transferFrom",
876
- "outputs": [],
877
- "stateMutability": "nonpayable",
878
- "type": "function"
879
- },
880
- {
881
- "inputs": [
882
- {
883
- "internalType": "address",
884
- "name": "newOwner",
885
- "type": "address"
886
- }
887
- ],
888
- "name": "transferOwnership",
889
- "outputs": [],
890
- "stateMutability": "nonpayable",
891
- "type": "function"
892
- },
893
- {
894
- "inputs": [
895
- {
896
- "internalType": "uint256",
897
- "name": "tokenId",
898
- "type": "uint256"
899
- },
900
- {
901
- "internalType": "string",
902
- "name": "providedMerkleRoot",
903
- "type": "string"
904
- }
905
- ],
906
- "name": "verifyZipFile",
907
- "outputs": [
908
- {
909
- "internalType": "bool",
910
- "name": "isValid",
911
- "type": "bool"
912
- }
913
- ],
914
- "stateMutability": "view",
915
- "type": "function"
916
- },
917
- {
918
- "inputs": [
919
- {
920
- "internalType": "uint256",
921
- "name": "",
922
- "type": "uint256"
923
- }
924
- ],
925
- "name": "zipFileInfo",
926
- "outputs": [
927
- {
928
- "internalType": "string",
929
- "name": "fileName",
930
- "type": "string"
931
- },
932
- {
933
- "internalType": "string",
934
- "name": "merkleRootHash",
935
- "type": "string"
936
- },
937
- {
938
- "internalType": "string",
939
- "name": "ipfsHash",
940
- "type": "string"
941
- },
942
- {
943
- "internalType": "address",
944
- "name": "creator",
945
- "type": "address"
946
- },
947
- {
948
- "internalType": "uint256",
949
- "name": "creationTimestamp",
950
- "type": "uint256"
951
- },
952
- {
953
- "internalType": "uint256",
954
- "name": "tokenizationTime",
955
- "type": "uint256"
956
- },
957
- {
958
- "internalType": "uint256",
959
- "name": "blockNumber",
960
- "type": "uint256"
961
- }
962
- ],
963
- "stateMutability": "view",
964
- "type": "function"
965
- }
966
- ];
967
-
968
- return { bytecode, abi };
969
- }
970
-
971
- async function deployContract() {
972
- console.log('🌐 NZIP NFT Public Contract Deployment');
973
- console.log('=====================================');
974
-
975
- // Check if user has a deprecated contract configured
976
- if (EXISTING_CONTRACT) {
977
- console.log(`⚠️ Deprecated contract detected in config: ${EXISTING_CONTRACT}`);
978
- console.log('📋 This contract is no longer supported and should not be used.');
979
- console.log('📋 Proceeding with new contract deployment...\n');
980
- }
981
-
982
- // Validate configuration
983
- if (!PRIVATE_KEY) {
984
- console.log('❌ PRIVATE_KEY is required for deployment.');
985
- console.log('📁 Set it in environment variable or deployment.config.js');
986
- console.log('📁 Example: PRIVATE_KEY=your_private_key_without_0x_prefix');
987
- throw new Error('❌ PRIVATE_KEY environment variable is required');
988
- }
989
-
990
- if (!NETWORK_CONFIG[CHAIN_ID]) {
991
- throw new Error(`❌ Unsupported chain ID: ${CHAIN_ID}`);
992
- }
993
-
994
- const networkConfig = NETWORK_CONFIG[CHAIN_ID];
995
- console.log(`🌐 Network: ${networkConfig.name}`);
996
- console.log(`🔗 RPC URL: ${networkConfig.rpcUrl}`);
997
- console.log(`🔍 Explorer: ${networkConfig.explorer}\n`);
998
-
999
- // Load contract data
1000
- console.log('📋 Loading contract bytecode...');
1001
- const { bytecode, abi } = loadContractData();
1002
- console.log(`✅ Bytecode loaded (${bytecode.length} characters)`);
1003
-
1004
- // Setup provider and wallet
1005
- const provider = new ethers.JsonRpcProvider(networkConfig.rpcUrl);
1006
- const wallet = new ethers.Wallet(PRIVATE_KEY, provider);
1007
-
1008
- console.log(`👤 Deployer address: ${wallet.address}`);
1009
-
1010
- // Check balance
1011
- const balance = await provider.getBalance(wallet.address);
1012
- console.log(`💰 Balance: ${ethers.formatEther(balance)} ETH`);
1013
-
1014
- if (balance === 0n) {
1015
- throw new Error('❌ Insufficient balance for deployment');
1016
- }
1017
-
1018
- // Create contract factory
1019
- const contractFactory = new ethers.ContractFactory(abi, bytecode, wallet);
1020
-
1021
- console.log('\n🚀 Deploying contract...');
1022
-
1023
- // Deploy the contract
1024
- const contract = await contractFactory.deploy();
1025
-
1026
- console.log(`📝 Transaction hash: ${contract.deploymentTransaction().hash}`);
1027
- console.log('⏳ Waiting for deployment confirmation...');
1028
-
1029
- // Wait for deployment
1030
- await contract.waitForDeployment();
1031
-
1032
- const contractAddress = await contract.getAddress();
1033
-
1034
- console.log('\n🎉 Contract deployed successfully!');
1035
- console.log('=====================================');
1036
- console.log(`📍 Contract Address: ${contractAddress}`);
1037
- console.log(`🌐 Network: ${networkConfig.name}`);
1038
- console.log(`🔍 Explorer: ${networkConfig.explorer}/address/${contractAddress}`);
1039
-
1040
- // Test the contract
1041
- try {
1042
- const version = await contract.getVersion();
1043
- console.log(`📋 Contract Version: ${version}`);
1044
- } catch (err) {
1045
- console.log('⚠️ Warning: Could not verify contract version');
1046
- }
1047
-
1048
- console.log('\n✅ Deployment completed successfully!');
1049
- console.log(`📋 Save this address: ${contractAddress}`);
1050
-
1051
- return contractAddress;
1052
- }
1053
-
1054
- // Run deployment
1055
- deployContract()
1056
- .then((address) => {
1057
- console.log(`\n🎯 Final contract address: ${address}`);
1058
- process.exit(0);
1059
- })
1060
- .catch((error) => {
1061
- console.error('\n❌ Deployment failed:', error.message);
1062
- process.exit(1);
1063
- });