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.
- package/LICENSE +22 -0
- package/README.md +371 -200
- package/contracts/ABI.txt +889 -0
- package/contracts/Bytecode.txt +1 -0
- package/contracts/COMPILATION_NOTES.md +59 -0
- package/contracts/QUICK_DEPLOY.md +286 -0
- package/contracts/README.md +256 -0
- package/contracts/VERIFICATION.md +308 -0
- package/contracts/deploy-interactive.js +448 -0
- package/contracts/deployment-arbitrum-sepolia.json +12 -0
- package/contracts/deployment-arbitrum.json +12 -0
- package/contracts/deployment-eth-sepolia.json +12 -0
- package/contracts/hardhat.config.js +114 -0
- package/contracts/package.json +20 -0
- package/contracts/scripts/compile-and-extract.js +119 -0
- package/contracts/scripts/verify-contract.js +223 -0
- package/contracts/src/{NZIP-NFT-Private.sol → NZIP-NFT-v2.0.sol} +66 -151
- package/contracts/src/NZIP-NFT.sol +9 -15
- package/dist/{browser → blockchain/browser}/TokenVerifierBrowser.d.ts +11 -20
- package/dist/blockchain/browser/TokenVerifierBrowser.d.ts.map +1 -0
- package/dist/{browser → blockchain/browser}/TokenVerifierBrowser.js +106 -92
- package/dist/blockchain/browser/TokenVerifierBrowser.js.map +1 -0
- package/dist/blockchain/browser/WalletManagerBrowser.d.ts +98 -0
- package/dist/blockchain/browser/WalletManagerBrowser.d.ts.map +1 -0
- package/dist/blockchain/browser/WalletManagerBrowser.js +434 -0
- package/dist/blockchain/browser/WalletManagerBrowser.js.map +1 -0
- package/dist/blockchain/browser/ZipkitMinterBrowser.d.ts +58 -0
- package/dist/blockchain/browser/ZipkitMinterBrowser.d.ts.map +1 -0
- package/dist/blockchain/browser/ZipkitMinterBrowser.js +317 -0
- package/dist/blockchain/browser/ZipkitMinterBrowser.js.map +1 -0
- package/dist/blockchain/browser/index.d.ts +11 -0
- package/dist/blockchain/browser/index.d.ts.map +1 -0
- package/dist/blockchain/browser/index.js +16 -0
- package/dist/blockchain/browser/index.js.map +1 -0
- package/dist/{server/blockchain/WalletAnalyzer.d.ts → blockchain/core/WalletManager.d.ts} +69 -26
- package/dist/blockchain/core/WalletManager.d.ts.map +1 -0
- package/dist/{server/blockchain/WalletAnalyzer.js → blockchain/core/WalletManager.js} +172 -160
- package/dist/blockchain/core/WalletManager.js.map +1 -0
- package/dist/blockchain/core/ZipkitMinter.d.ts +141 -0
- package/dist/blockchain/core/ZipkitMinter.d.ts.map +1 -0
- package/dist/blockchain/core/ZipkitMinter.js +548 -0
- package/dist/blockchain/core/ZipkitMinter.js.map +1 -0
- package/dist/blockchain/core/ZipkitOTS.d.ts +126 -0
- package/dist/blockchain/core/ZipkitOTS.d.ts.map +1 -0
- package/dist/blockchain/core/ZipkitOTS.js +506 -0
- package/dist/blockchain/core/ZipkitOTS.js.map +1 -0
- package/dist/blockchain/core/ZipkitVerifier.d.ts +177 -0
- package/dist/blockchain/core/ZipkitVerifier.d.ts.map +1 -0
- package/dist/blockchain/core/ZipkitVerifier.js +632 -0
- package/dist/blockchain/core/ZipkitVerifier.js.map +1 -0
- package/dist/blockchain/core/contracts.d.ts +83 -0
- package/dist/blockchain/core/contracts.d.ts.map +1 -0
- package/dist/blockchain/core/contracts.js +341 -0
- package/dist/blockchain/core/contracts.js.map +1 -0
- package/dist/blockchain/core/index.d.ts +12 -0
- package/dist/blockchain/core/index.d.ts.map +1 -0
- package/dist/blockchain/core/index.js +59 -0
- package/dist/blockchain/core/index.js.map +1 -0
- package/dist/blockchain/index.d.ts +11 -0
- package/dist/blockchain/index.d.ts.map +1 -0
- package/dist/blockchain/index.js +34 -0
- package/dist/blockchain/index.js.map +1 -0
- package/dist/blockchain/node/WalletManagerNode.d.ts +47 -0
- package/dist/blockchain/node/WalletManagerNode.d.ts.map +1 -0
- package/dist/blockchain/node/WalletManagerNode.js +203 -0
- package/dist/blockchain/node/WalletManagerNode.js.map +1 -0
- package/dist/blockchain/node/index.d.ts +12 -0
- package/dist/blockchain/node/index.d.ts.map +1 -0
- package/dist/blockchain/node/index.js +24 -0
- package/dist/blockchain/node/index.js.map +1 -0
- package/dist/browser/ZipkitBrowser.d.ts +27 -0
- package/dist/browser/ZipkitBrowser.d.ts.map +1 -0
- package/dist/browser/{ZipKitBrowser.js → ZipkitBrowser.js} +96 -43
- package/dist/browser/ZipkitBrowser.js.map +1 -0
- package/dist/browser/index.d.ts +12 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +42 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser-esm/index.d.ts +12 -0
- package/dist/browser-esm/index.js +59559 -0
- package/dist/browser-esm/index.js.map +7 -0
- package/dist/browser-umd/index.d.ts +12 -0
- package/dist/browser-umd/index.js +59576 -0
- package/dist/browser-umd/index.js.map +7 -0
- package/dist/browser-umd/index.min.js +63 -0
- package/dist/browser.d.ts +8 -17
- package/dist/browser.js +13 -29
- package/dist/core/ZipCompress.d.ts +99 -0
- package/dist/core/ZipCompress.d.ts.map +1 -0
- package/dist/core/ZipCompress.js +309 -0
- package/dist/core/ZipCompress.js.map +1 -0
- package/dist/core/ZipDecompress.d.ts +58 -0
- package/dist/core/ZipDecompress.d.ts.map +1 -0
- package/dist/core/ZipDecompress.js +172 -0
- package/dist/core/ZipDecompress.js.map +1 -0
- package/dist/{shared → core}/ZipEntry.d.ts +8 -1
- package/dist/core/ZipEntry.d.ts.map +1 -0
- package/dist/{shared → core}/ZipEntry.js +224 -81
- package/dist/core/ZipEntry.js.map +1 -0
- package/dist/core/Zipkit.d.ts +315 -0
- package/dist/core/Zipkit.d.ts.map +1 -0
- package/dist/core/Zipkit.js +647 -0
- package/dist/core/Zipkit.js.map +1 -0
- package/dist/core/components/HashCalculator.d.ts +138 -0
- package/dist/core/components/HashCalculator.d.ts.map +1 -0
- package/dist/core/components/HashCalculator.js +360 -0
- package/dist/core/components/HashCalculator.js.map +1 -0
- package/dist/core/components/Logger.d.ts +73 -0
- package/dist/core/components/Logger.d.ts.map +1 -0
- package/dist/core/components/Logger.js +156 -0
- package/dist/core/components/Logger.js.map +1 -0
- package/dist/core/components/ProgressTracker.d.ts +43 -0
- package/dist/core/components/ProgressTracker.d.ts.map +1 -0
- package/dist/core/components/ProgressTracker.js +112 -0
- package/dist/core/components/ProgressTracker.js.map +1 -0
- package/dist/{shared → core}/components/Support.d.ts +1 -0
- package/dist/core/components/Support.d.ts.map +1 -0
- package/dist/{shared → core}/components/Support.js +1 -0
- package/dist/core/components/Support.js.map +1 -0
- package/dist/{shared → core}/components/Util.d.ts +7 -2
- package/dist/core/components/Util.d.ts.map +1 -0
- package/dist/{shared → core}/components/Util.js +14 -34
- package/dist/core/components/Util.js.map +1 -0
- package/dist/{shared → core}/constants/Errors.d.ts +1 -2
- package/dist/core/constants/Errors.d.ts.map +1 -0
- package/dist/{shared → core}/constants/Errors.js +1 -3
- package/dist/core/constants/Errors.js.map +1 -0
- package/dist/{shared → core}/constants/Headers.d.ts +3 -0
- package/dist/core/constants/Headers.d.ts.map +1 -0
- package/dist/{shared → core}/constants/Headers.js +20 -17
- package/dist/core/constants/Headers.js.map +1 -0
- package/dist/core/encryption/Manager.d.ts +58 -0
- package/dist/core/encryption/Manager.d.ts.map +1 -0
- package/dist/core/encryption/Manager.js +121 -0
- package/dist/core/encryption/Manager.js.map +1 -0
- package/dist/core/encryption/ZipCrypto.d.ts +172 -0
- package/dist/core/encryption/ZipCrypto.d.ts.map +1 -0
- package/dist/core/encryption/ZipCrypto.js +554 -0
- package/dist/core/encryption/ZipCrypto.js.map +1 -0
- package/dist/core/encryption/index.d.ts +9 -0
- package/dist/core/encryption/index.d.ts.map +1 -0
- package/dist/core/encryption/index.js +17 -0
- package/dist/core/encryption/index.js.map +1 -0
- package/dist/core/encryption/types.d.ts +29 -0
- package/dist/core/encryption/types.d.ts.map +1 -0
- package/dist/core/encryption/types.js +12 -0
- package/dist/core/encryption/types.js.map +1 -0
- package/dist/core/index.d.ts +24 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +57 -0
- package/dist/core/index.js.map +1 -0
- package/dist/{shared → core}/version.d.ts +1 -0
- package/dist/core/version.d.ts.map +1 -0
- package/dist/core/version.js +31 -0
- package/dist/core/version.js.map +1 -0
- package/dist/index.d.ts +8 -25
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -47
- package/dist/index.js.map +1 -0
- package/dist/node/ZipCompressNode.d.ts +123 -0
- package/dist/node/ZipCompressNode.d.ts.map +1 -0
- package/dist/node/ZipCompressNode.js +576 -0
- package/dist/node/ZipCompressNode.js.map +1 -0
- package/dist/node/ZipDecompressNode.d.ts +120 -0
- package/dist/node/ZipDecompressNode.d.ts.map +1 -0
- package/dist/node/ZipDecompressNode.js +461 -0
- package/dist/node/ZipDecompressNode.js.map +1 -0
- package/dist/node/ZipkitNode.d.ts +406 -0
- package/dist/node/ZipkitNode.d.ts.map +1 -0
- package/dist/node/ZipkitNode.js +1305 -0
- package/dist/node/ZipkitNode.js.map +1 -0
- package/dist/node/index.d.ts +26 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +65 -0
- package/dist/node/index.js.map +1 -0
- package/dist/types/index.d.ts +59 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +36 -1
- package/dist/types/index.js.map +1 -0
- package/examples/README.md +269 -0
- package/examples/blockchain-tokenize.ts +354 -0
- package/examples/create-zip.ts +172 -0
- package/examples/extract-zip.ts +158 -0
- package/examples/list-zip.ts +161 -0
- package/examples/test-files/data.json +116 -0
- package/examples/test-files/document.md +80 -0
- package/examples/test-files/document.txt +2 -0
- package/examples/test-files/file1.txt +48 -0
- package/examples/test-files/file2.txt +80 -0
- package/examples/tsconfig.json +44 -0
- package/examples/unzip-token.ts +6 -3
- package/examples/verify-tokenized-zip.ts +305 -0
- package/package.json +117 -23
- package/src/blockchain/README.md +222 -0
- package/src/{browser → blockchain/browser}/TokenVerifierBrowser.ts +125 -79
- package/src/blockchain/browser/WalletManagerBrowser.ts +486 -0
- package/src/blockchain/browser/ZipkitMinterBrowser.ts +400 -0
- package/src/blockchain/browser/index.ts +13 -0
- package/src/blockchain/core/WalletManager.ts +436 -0
- package/src/blockchain/core/ZipkitMinter.ts +716 -0
- package/src/blockchain/core/ZipkitOTS.ts +588 -0
- package/src/blockchain/core/ZipkitVerifier.ts +853 -0
- package/src/blockchain/core/contracts.ts +370 -0
- package/src/blockchain/core/index.ts +71 -0
- package/src/blockchain/index.ts +27 -0
- package/src/blockchain/node/WalletManagerNode.ts +171 -0
- package/src/blockchain/node/index.ts +40 -0
- package/src/browser/{ZipKitBrowser.ts → ZipkitBrowser.ts} +104 -41
- package/src/browser/index.esm.ts +37 -0
- package/src/browser/index.ts +25 -0
- package/src/core/ZipCompress.ts +398 -0
- package/src/core/ZipDecompress.ts +212 -0
- package/src/{shared → core}/ZipEntry.ts +239 -89
- package/src/core/Zipkit.ts +794 -0
- package/src/core/components/HashCalculator.ts +384 -0
- package/src/core/components/Logger.ts +180 -0
- package/src/core/components/ProgressTracker.ts +134 -0
- package/src/{shared → core}/components/Util.ts +12 -34
- package/src/{shared → core}/constants/Errors.ts +0 -4
- package/src/{shared → core}/constants/Headers.ts +19 -17
- package/src/core/encryption/Manager.ts +137 -0
- package/src/core/encryption/ZipCrypto.ts +650 -0
- package/src/core/encryption/index.ts +15 -0
- package/src/core/encryption/types.ts +33 -0
- package/src/core/index.ts +34 -0
- package/src/core/version.ts +33 -0
- package/src/index.ts +54 -32
- package/src/node/ZipCompressNode.ts +632 -0
- package/src/node/ZipDecompressNode.ts +508 -0
- package/src/node/ZipkitNode.ts +1559 -0
- package/src/node/index.ts +69 -0
- package/src/types/index.ts +131 -1
- package/src/types/opentimestamps.d.ts +1 -23
- package/contracts/Lock.sol +0 -34
- package/contracts/bytecode.txt +0 -1
- package/contracts/compile-contract.js +0 -168
- package/contracts/deploy/deploy-both-contracts.js +0 -286
- package/contracts/deploy/deploy-enhanced-contract.js +0 -197
- package/contracts/deploy/deploy-private-contract.js +0 -190
- package/contracts/deploy/deploy-public-clean.js +0 -1063
- package/contracts/deploy/deploy-public-contract.js +0 -1107
- package/contracts/deployment.config.example.js +0 -25
- package/contracts/remix-compile.js +0 -222
- package/contracts/setup-deployment.js +0 -51
- package/contracts/src/ZipFileNFT-DEPRECATED-6field.sol +0 -260
- package/contracts/src/ZipFileNFT-DEPRECATED-Enhanced.sol +0 -289
- package/dist/browser/CertificateGeneratorBrowser.d.ts +0 -75
- package/dist/browser/CertificateGeneratorBrowser.js +0 -433
- package/dist/browser/ZipKitBrowser.d.ts +0 -18
- package/dist/browser/ZipKitStampBrowser.d.ts +0 -2
- package/dist/browser/ZipKitStampBrowser.js +0 -12
- package/dist/browser-index.d.ts +0 -21
- package/dist/browser-index.js +0 -58
- package/dist/server/blockchain/CertificateToken.d.ts +0 -48
- package/dist/server/blockchain/CertificateToken.js +0 -386
- package/dist/server/blockchain/NFTMinter.d.ts +0 -41
- package/dist/server/blockchain/NFTMinter.js +0 -323
- package/dist/server/blockchain/TokenQuerier.d.ts +0 -31
- package/dist/server/blockchain/TokenQuerier.js +0 -259
- package/dist/server/blockchain/TokenVerifier.d.ts +0 -20
- package/dist/server/blockchain/TokenVerifier.js +0 -395
- package/dist/server/blockchain/WalletFormatter.d.ts +0 -39
- package/dist/server/blockchain/WalletFormatter.js +0 -196
- package/dist/server/blockchain/WalletManager.d.ts +0 -46
- package/dist/server/blockchain/WalletManager.js +0 -294
- package/dist/server/blockchain/ZipMetadata.d.ts +0 -27
- package/dist/server/blockchain/ZipMetadata.js +0 -131
- package/dist/server/blockchain/ZipTokenProcessor.d.ts +0 -44
- package/dist/server/blockchain/ZipTokenProcessor.js +0 -204
- package/dist/server/blockchain/constants.d.ts +0 -102
- package/dist/server/blockchain/constants.js +0 -968
- package/dist/server/blockchain/index.d.ts +0 -9
- package/dist/server/blockchain/index.js +0 -44
- package/dist/server/blockchain/test-certificate.d.ts +0 -8
- package/dist/server/blockchain/test-certificate.js +0 -100
- package/dist/server/blockchain/types.d.ts +0 -69
- package/dist/server/blockchain/types.js +0 -51
- package/dist/server/platform/server/ZipKitServer.d.ts +0 -105
- package/dist/server/platform/server/ZipKitServer.js +0 -437
- package/dist/server/platform/servercomponents/ZipKitOTS.d.ts +0 -91
- package/dist/server/platform/servercomponents/ZipKitOTS.js +0 -271
- package/dist/shared/ZipKit.d.ts +0 -249
- package/dist/shared/ZipKit.js +0 -789
- package/dist/shared/components/CertificateOTS.d.ts +0 -15
- package/dist/shared/components/CertificateOTS.js +0 -116
- package/dist/shared/components/FileSys.d.ts +0 -2
- package/dist/shared/components/FileSys.js +0 -113
- package/dist/shared/components/HashAccumulator.d.ts +0 -55
- package/dist/shared/components/HashAccumulator.js +0 -100
- package/dist/shared/components/ZipCrypto.d.ts +0 -3
- package/dist/shared/components/ZipCrypto.js +0 -78
- package/dist/shared/components/merkleTree.d.ts +0 -66
- package/dist/shared/components/merkleTree.js +0 -136
- package/dist/shared/types/index.d.ts +0 -21
- package/dist/shared/types/index.js +0 -3
- package/dist/shared/types.d.ts +0 -33
- package/dist/shared/types.js +0 -8
- package/dist/shared/version.js +0 -7
- package/src/browser/CertificateGeneratorBrowser.ts +0 -498
- package/src/browser/ZipKitStampBrowser.ts +0 -9
- package/src/browser-index.ts +0 -36
- package/src/server/blockchain/CertificateToken.ts +0 -444
- package/src/server/blockchain/NFTMinter.ts +0 -357
- package/src/server/blockchain/TokenQuerier.ts +0 -287
- package/src/server/blockchain/TokenVerifier.ts +0 -453
- package/src/server/blockchain/WalletAnalyzer.ts +0 -397
- package/src/server/blockchain/WalletFormatter.ts +0 -206
- package/src/server/blockchain/WalletManager.ts +0 -294
- package/src/server/blockchain/ZipMetadata.ts +0 -117
- package/src/server/blockchain/ZipTokenProcessor.ts +0 -234
- package/src/server/blockchain/constants.ts +0 -969
- package/src/server/blockchain/index.ts +0 -42
- package/src/server/blockchain/test-certificate.ts +0 -137
- package/src/server/blockchain/types.ts +0 -134
- package/src/server/platform/server/ZipKitServer.ts +0 -459
- package/src/server/platform/servercomponents/ZipKitOTS.ts +0 -313
- package/src/server/platform/servercomponents/opentimestamps.d.ts +0 -23
- package/src/shared/ZipKit.ts +0 -899
- package/src/shared/components/CertificateOTS.ts +0 -132
- package/src/shared/components/FileSys.ts +0 -87
- package/src/shared/components/HashAccumulator.ts +0 -113
- package/src/shared/components/ZipCrypto.ts +0 -91
- package/src/shared/components/merkleTree.ts +0 -162
- package/src/shared/types/index.ts +0 -25
- package/src/shared/types/modules.d.ts +0 -22
- package/src/shared/types/opentimestamps.d.ts +0 -23
- package/src/shared/types.d.ts +0 -8
- package/src/shared/types.ts +0 -43
- package/src/shared/version.ts +0 -4
- /package/src/{shared → core}/components/Support.ts +0 -0
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// Export all types
|
|
2
|
-
export * from './types';
|
|
3
|
-
|
|
4
|
-
// Export wallet management
|
|
5
|
-
export { WalletManager } from './WalletManager';
|
|
6
|
-
|
|
7
|
-
// Export NFT minting
|
|
8
|
-
export { NFTMinter } from './NFTMinter';
|
|
9
|
-
|
|
10
|
-
// Export main processor
|
|
11
|
-
export { ZipTokenProcessor } from './ZipTokenProcessor';
|
|
12
|
-
|
|
13
|
-
// Export ZIP metadata utilities
|
|
14
|
-
export { ZipMetadata } from './ZipMetadata';
|
|
15
|
-
|
|
16
|
-
// Export token verification utilities
|
|
17
|
-
export {
|
|
18
|
-
checkForTokenization,
|
|
19
|
-
TokenVerificationOptions,
|
|
20
|
-
TokenVerificationResult
|
|
21
|
-
} from './TokenVerifier';
|
|
22
|
-
|
|
23
|
-
// Export token querying utilities
|
|
24
|
-
export {
|
|
25
|
-
queryBlockchainForExistingToken,
|
|
26
|
-
queryWalletTokens,
|
|
27
|
-
ExistingTokenInfo,
|
|
28
|
-
TokenQueryOptions
|
|
29
|
-
} from './TokenQuerier';
|
|
30
|
-
|
|
31
|
-
// Export wallet analysis utilities
|
|
32
|
-
export {
|
|
33
|
-
WalletAnalyzer,
|
|
34
|
-
TokenInfo,
|
|
35
|
-
NZipTokenDetails,
|
|
36
|
-
WalletBasicInfo,
|
|
37
|
-
TokenScanResult,
|
|
38
|
-
CommonTokenConfig
|
|
39
|
-
} from './WalletAnalyzer';
|
|
40
|
-
|
|
41
|
-
// Export wallet formatting utilities
|
|
42
|
-
export { WalletFormatter } from './WalletFormatter';
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Test/Demo script for CertificateToken functionality
|
|
5
|
-
*
|
|
6
|
-
* This demonstrates how to generate certificates for tokenized ZIP files
|
|
7
|
-
* independently of the neozipkit integration.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
createTokenCertificate,
|
|
12
|
-
saveCertificate,
|
|
13
|
-
TokenInfo,
|
|
14
|
-
BlockchainVerification,
|
|
15
|
-
WalletInfo,
|
|
16
|
-
ZipFileInfo
|
|
17
|
-
} from './CertificateToken';
|
|
18
|
-
import { CURRENT_DEPLOYMENT } from './constants';
|
|
19
|
-
|
|
20
|
-
// Example token information
|
|
21
|
-
const sampleTokenInfo: TokenInfo = {
|
|
22
|
-
tokenId: "10",
|
|
23
|
-
contractAddress: CURRENT_DEPLOYMENT.address, // NZIP NFT Contract v2.0
|
|
24
|
-
network: "Base Sepolia",
|
|
25
|
-
transactionHash: "0x403331e67051b70c92af413ad9424e70f4e4cacb5512a2f6e6af46a6cb198340",
|
|
26
|
-
wallet: "0x1234567890123456789012345678901234567890",
|
|
27
|
-
timestamp: Math.floor(Date.now() / 1000),
|
|
28
|
-
note: "Test tokenized ZIP file for demonstration"
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
// Example blockchain verification results
|
|
32
|
-
const sampleVerification: BlockchainVerification = {
|
|
33
|
-
merkleRootMatches: true,
|
|
34
|
-
blockchainMerkleRoot: "abc123def456789012345678901234567890123456789012345678901234567890",
|
|
35
|
-
calculatedMerkleRoot: "abc123def456789012345678901234567890123456789012345678901234567890",
|
|
36
|
-
verificationStatus: 'PASSED',
|
|
37
|
-
verificationTime: Math.floor(Date.now() / 1000),
|
|
38
|
-
blockNumber: 12345678
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
// Example wallet information
|
|
42
|
-
const sampleWalletInfo: WalletInfo = {
|
|
43
|
-
address: "0x1234567890123456789012345678901234567890",
|
|
44
|
-
network: "Base Sepolia",
|
|
45
|
-
balance: "1.234 ETH",
|
|
46
|
-
ensName: "demo.eth"
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// Example file information
|
|
50
|
-
const sampleFiles: ZipFileInfo[] = [
|
|
51
|
-
{
|
|
52
|
-
filename: "README.md",
|
|
53
|
-
size: 1024,
|
|
54
|
-
date: "2025-01-10 12:00:00 UTC",
|
|
55
|
-
hash: "a1b2c3d4e5f6789012345678901234567890123456789012345678901234567890"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
filename: "document.pdf",
|
|
59
|
-
size: 2048576,
|
|
60
|
-
date: "2025-01-10 11:30:00 UTC",
|
|
61
|
-
hash: "b2c3d4e5f6a7890123456789012345678901234567890123456789012345678901"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
filename: "image.jpg",
|
|
65
|
-
size: 512000,
|
|
66
|
-
date: "2025-01-10 10:15:00 UTC",
|
|
67
|
-
hash: "c3d4e5f6a7b8901234567890123456789012345678901234567890123456789012"
|
|
68
|
-
}
|
|
69
|
-
];
|
|
70
|
-
|
|
71
|
-
function testCertificateGeneration() {
|
|
72
|
-
console.log('🧪 Testing Certificate Generation...');
|
|
73
|
-
console.log('=====================================');
|
|
74
|
-
|
|
75
|
-
try {
|
|
76
|
-
// Test with full information
|
|
77
|
-
console.log('1. Generating certificate with full information...');
|
|
78
|
-
const fullCertificate = createTokenCertificate(
|
|
79
|
-
sampleTokenInfo,
|
|
80
|
-
'test-archive.zip',
|
|
81
|
-
sampleVerification,
|
|
82
|
-
sampleWalletInfo,
|
|
83
|
-
sampleFiles
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
const fullCertPath = saveCertificate('test-archive.zip', fullCertificate, './certificates');
|
|
87
|
-
console.log(`✅ Full certificate saved: ${fullCertPath}`);
|
|
88
|
-
|
|
89
|
-
// Test with minimal information
|
|
90
|
-
console.log('\n2. Generating certificate with minimal information...');
|
|
91
|
-
const minimalVerification: BlockchainVerification = {
|
|
92
|
-
merkleRootMatches: false,
|
|
93
|
-
blockchainMerkleRoot: "different123456789012345678901234567890123456789012345678901234567890",
|
|
94
|
-
calculatedMerkleRoot: "calculated123456789012345678901234567890123456789012345678901234567890",
|
|
95
|
-
verificationStatus: 'FAILED'
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const minimalCertificate = createTokenCertificate(
|
|
99
|
-
sampleTokenInfo,
|
|
100
|
-
'minimal-archive.zip',
|
|
101
|
-
minimalVerification
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
const minimalCertPath = saveCertificate('minimal-archive.zip', minimalCertificate, './blockchain/output');
|
|
105
|
-
console.log(`✅ Minimal certificate saved: ${minimalCertPath}`);
|
|
106
|
-
|
|
107
|
-
// Test with unavailable verification
|
|
108
|
-
console.log('\n3. Generating certificate with unavailable verification...');
|
|
109
|
-
const unavailableVerification: BlockchainVerification = {
|
|
110
|
-
merkleRootMatches: false,
|
|
111
|
-
blockchainMerkleRoot: "N/A",
|
|
112
|
-
calculatedMerkleRoot: "calculated123456789012345678901234567890123456789012345678901234567890",
|
|
113
|
-
verificationStatus: 'UNAVAILABLE'
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const unavailableCertificate = createTokenCertificate(
|
|
117
|
-
sampleTokenInfo,
|
|
118
|
-
'unavailable-archive.zip',
|
|
119
|
-
unavailableVerification,
|
|
120
|
-
sampleWalletInfo
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
const unavailableCertPath = saveCertificate('unavailable-archive.zip', unavailableCertificate, './blockchain/output');
|
|
124
|
-
console.log(`✅ Unavailable verification certificate saved: ${unavailableCertPath}`);
|
|
125
|
-
|
|
126
|
-
console.log('\n🎉 All certificate tests completed successfully!');
|
|
127
|
-
console.log('Check the ./blockchain/output directory for generated certificates.');
|
|
128
|
-
|
|
129
|
-
} catch (error) {
|
|
130
|
-
console.error('❌ Error during certificate generation:', error);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Run the test
|
|
135
|
-
if (require.main === module) {
|
|
136
|
-
testCertificateGeneration();
|
|
137
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { ethers } from 'ethers';
|
|
2
|
-
import { TOKENIZED_METADATA } from '../../shared/constants/Headers';
|
|
3
|
-
|
|
4
|
-
// NFT Metadata types
|
|
5
|
-
export interface NFTAttribute {
|
|
6
|
-
trait_type: string;
|
|
7
|
-
value: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface NFTMetadata {
|
|
11
|
-
name: string;
|
|
12
|
-
description: string;
|
|
13
|
-
image: string;
|
|
14
|
-
attributes: NFTAttribute[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Wallet and network types
|
|
18
|
-
export interface WalletInfo {
|
|
19
|
-
address: string;
|
|
20
|
-
privateKey: string;
|
|
21
|
-
mnemonic: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface NetworkConfig {
|
|
25
|
-
name: string;
|
|
26
|
-
rpcUrl: string;
|
|
27
|
-
chainId: number;
|
|
28
|
-
explorerUrl: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface WalletSetupResult {
|
|
32
|
-
wallet: ethers.Wallet | null;
|
|
33
|
-
provider: ethers.JsonRpcProvider | null;
|
|
34
|
-
success: boolean;
|
|
35
|
-
message?: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Contract interaction types
|
|
39
|
-
export interface ContractInfo {
|
|
40
|
-
address: string;
|
|
41
|
-
abi: any[];
|
|
42
|
-
network: string;
|
|
43
|
-
deployer: string;
|
|
44
|
-
deploymentTime: string;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface MintingResult {
|
|
48
|
-
success: boolean;
|
|
49
|
-
message: string;
|
|
50
|
-
tokenId?: string;
|
|
51
|
-
txHash?: string;
|
|
52
|
-
creationTimestamp?: number;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// ZIP and minting specific types
|
|
56
|
-
export interface ZipTokenData {
|
|
57
|
-
zipFile: string;
|
|
58
|
-
merkleRoot: string;
|
|
59
|
-
fileName: string;
|
|
60
|
-
timestamp: string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface MintingOptions {
|
|
64
|
-
wallet?: string;
|
|
65
|
-
network: string;
|
|
66
|
-
mintToken: boolean;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Token information stored in ZIP file
|
|
70
|
-
export interface NZipTokenInfo {
|
|
71
|
-
version: string;
|
|
72
|
-
tokenId: string;
|
|
73
|
-
contractAddress: string;
|
|
74
|
-
network: string;
|
|
75
|
-
networkChainId: number;
|
|
76
|
-
transactionHash: string;
|
|
77
|
-
merkleRoot: string;
|
|
78
|
-
fileName: string;
|
|
79
|
-
mintedAt: string;
|
|
80
|
-
creationTimestamp?: number; // Unix timestamp when the token was created
|
|
81
|
-
blockNumber?: number;
|
|
82
|
-
ipfsHash?: string;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Network configuration
|
|
86
|
-
export const NETWORKS: Record<string, NetworkConfig> = {
|
|
87
|
-
'base': {
|
|
88
|
-
name: 'Base Mainnet',
|
|
89
|
-
rpcUrl: 'https://mainnet.base.org',
|
|
90
|
-
chainId: 8453,
|
|
91
|
-
explorerUrl: 'https://basescan.org'
|
|
92
|
-
},
|
|
93
|
-
'base-sepolia': {
|
|
94
|
-
name: 'Base Sepolia',
|
|
95
|
-
rpcUrl: 'https://sepolia.base.org',
|
|
96
|
-
chainId: 84532,
|
|
97
|
-
explorerUrl: 'https://sepolia.basescan.org'
|
|
98
|
-
},
|
|
99
|
-
'base-goerli': {
|
|
100
|
-
name: 'Base Goerli',
|
|
101
|
-
rpcUrl: 'https://goerli.base.org',
|
|
102
|
-
chainId: 84531,
|
|
103
|
-
explorerUrl: 'https://goerli.basescan.org'
|
|
104
|
-
},
|
|
105
|
-
'localhost': {
|
|
106
|
-
name: 'Localhost',
|
|
107
|
-
rpcUrl: 'http://localhost:8545',
|
|
108
|
-
chainId: 31337,
|
|
109
|
-
explorerUrl: 'http://localhost:8545'
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
// Token metadata constants - use TOKENIZED_METADATA from constants/Headers
|
|
114
|
-
|
|
115
|
-
// NFT Metadata template
|
|
116
|
-
export const NFT_METADATA_TEMPLATE: NFTMetadata = {
|
|
117
|
-
name: "NeoZip Archive Token",
|
|
118
|
-
description: "This NFT represents ownership of a timestamped and verified ZIP archive on Base",
|
|
119
|
-
image: "", // Will be set to IPFS hash of thumbnail
|
|
120
|
-
attributes: [
|
|
121
|
-
{
|
|
122
|
-
trait_type: "Archive Hash",
|
|
123
|
-
value: "" // Will be set to the Merkle root hash of the archive
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
trait_type: "Creation Date",
|
|
127
|
-
value: "" // Will be set to timestamp
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
trait_type: "Blockchain",
|
|
131
|
-
value: "Base" // Specify Base as the blockchain
|
|
132
|
-
}
|
|
133
|
-
]
|
|
134
|
-
};
|