neozipkit 0.1.1 → 0.2.1
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 +52 -105
- package/contracts/INTEGRATION.md +338 -0
- package/contracts/NETWORKS.md +156 -0
- package/contracts/README.md +152 -0
- package/{src/server/blockchain → contracts}/constants.ts +5 -22
- package/contracts/deploy-bytecode.mjs +94 -0
- package/dist/blockchain/ZipKitMinter.d.ts +106 -0
- package/dist/blockchain/ZipKitMinter.js +347 -0
- package/dist/blockchain/ZipKitNFT.d.ts +3 -0
- package/dist/blockchain/ZipKitNFT.js +7 -0
- package/dist/blockchain/ZipKitOTS.d.ts +135 -0
- package/dist/blockchain/ZipKitOTS.js +564 -0
- package/dist/blockchain/ZipKitVerifier.d.ts +69 -0
- package/dist/blockchain/ZipKitVerifier.js +289 -0
- package/dist/{server/blockchain/WalletAnalyzer.d.ts → blockchain/ZipKitWallet.d.ts} +31 -43
- package/dist/{server/blockchain/WalletAnalyzer.js → blockchain/ZipKitWallet.js} +193 -161
- package/dist/blockchain/contracts.d.ts +14 -0
- package/dist/blockchain/contracts.js +77 -0
- package/dist/blockchain/index.d.ts +7 -0
- package/dist/blockchain/index.js +50 -0
- package/dist/{server/blockchain → blockchain}/types.d.ts +12 -34
- package/dist/{server/blockchain → blockchain}/types.js +1 -22
- package/dist/browser-index.d.ts +0 -3
- package/dist/browser-index.js +4 -5
- package/dist/browser.d.ts +0 -3
- package/dist/browser.js +4 -5
- package/dist/index.d.ts +8 -15
- package/dist/index.js +12 -24
- package/dist/server/{platform/server/ZipKitServer.d.ts → ZipKitServer.d.ts} +4 -35
- package/dist/server/{platform/server/ZipKitServer.js → ZipKitServer.js} +55 -182
- package/dist/shared/ZipEntry.js +1 -1
- package/dist/shared/ZipKit.d.ts +0 -6
- package/dist/shared/ZipKit.js +1 -18
- package/dist/shared/types.js +2 -2
- package/dist/shared/version.d.ts +2 -4
- package/dist/shared/version.js +4 -5
- package/package.json +13 -3
- package/src/blockchain/README.md +229 -0
- package/src/blockchain/ZipKitMinter.ts +470 -0
- package/src/blockchain/ZipKitNFT.ts +12 -0
- package/src/blockchain/ZipKitOTS.ts +622 -0
- package/src/blockchain/ZipKitVerifier.ts +382 -0
- package/src/blockchain/ZipKitWallet.ts +338 -0
- package/src/blockchain/contracts.ts +88 -0
- package/src/blockchain/index.ts +61 -0
- package/src/blockchain/types.ts +91 -0
- package/src/browser/{TokenVerifierBrowser.ts → TokenVerifierBrowser.ts-remove} +1 -1
- package/src/browser-index.ts +3 -3
- package/src/index.ts +10 -17
- package/src/server/README.md +25 -0
- package/src/server/ZipKitServer.ts +305 -0
- package/src/shared/ZipEntry.ts +1 -1
- package/src/shared/ZipKit.ts +1 -19
- package/src/shared/types.ts +3 -3
- package/src/shared/version.ts +3 -4
- package/src/types/modules.d.ts +11 -1
- package/contracts/Lock.sol +0 -34
- 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/TokenVerifierBrowser.d.ts +0 -76
- package/dist/browser/TokenVerifierBrowser.js +0 -299
- 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/platform/servercomponents/ZipKitOTS.d.ts +0 -91
- package/dist/server/platform/servercomponents/ZipKitOTS.js +0 -271
- package/examples/unzip-token.ts +0 -488
- package/examples/zip-token.ts +0 -604
- 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/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/contracts/{bytecode.txt → NZIP-NFT-bytecode.txt} +0 -0
- /package/dist/{server/blockchain → blockchain}/CertificateToken.d.ts +0 -0
- /package/dist/{server/blockchain → blockchain}/CertificateToken.js +0 -0
- /package/src/{server/blockchain → blockchain}/CertificateToken.ts +0 -0
- /package/src/browser/{CertificateGeneratorBrowser.ts → CertificateGeneratorBrowser.ts-remove} +0 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* ZipKitVerifier - Handles NFT token verification for ZIP files
|
|
5
|
+
* Verifier API for NZIP-NFT smart contract.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ZipKitVerifier = void 0;
|
|
9
|
+
const ethers_1 = require("ethers");
|
|
10
|
+
const contracts_1 = require("./contracts");
|
|
11
|
+
// Network configurations
|
|
12
|
+
const NETWORK_CONFIGS = {
|
|
13
|
+
'base-sepolia': {
|
|
14
|
+
name: 'Base Sepolia',
|
|
15
|
+
rpcUrl: 'https://sepolia.base.org',
|
|
16
|
+
contractAddress: contracts_1.CONTRACT_CONFIGS[84532].address, // Use real contract address
|
|
17
|
+
explorerUrl: 'https://sepolia.basescan.org',
|
|
18
|
+
chainId: 84532
|
|
19
|
+
},
|
|
20
|
+
'base-mainnet': {
|
|
21
|
+
name: 'Base Mainnet',
|
|
22
|
+
rpcUrl: 'https://mainnet.base.org',
|
|
23
|
+
contractAddress: contracts_1.CONTRACT_CONFIGS[8453].address, // Use real contract address
|
|
24
|
+
explorerUrl: 'https://basescan.org',
|
|
25
|
+
chainId: 8453
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Blockchain Token Verifier for ZIP files
|
|
30
|
+
*/
|
|
31
|
+
class ZipKitVerifier {
|
|
32
|
+
constructor(options = {}) {
|
|
33
|
+
this.debug = options.debug || false;
|
|
34
|
+
if (this.debug) {
|
|
35
|
+
console.log(`[DEBUG] ZipKitVerifier initialized`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Extract and validate token metadata from ZIP
|
|
40
|
+
*/
|
|
41
|
+
async extractTokenMetadata(tokenBuffer) {
|
|
42
|
+
try {
|
|
43
|
+
if (this.debug) {
|
|
44
|
+
console.log(`[DEBUG] Extracting token metadata from buffer (${tokenBuffer.length} bytes)`);
|
|
45
|
+
}
|
|
46
|
+
const tokenData = JSON.parse(tokenBuffer.toString('utf8'));
|
|
47
|
+
// Validate required fields
|
|
48
|
+
const requiredFields = ['tokenId', 'contractAddress', 'network'];
|
|
49
|
+
for (const field of requiredFields) {
|
|
50
|
+
if (!tokenData[field]) {
|
|
51
|
+
if (this.debug) {
|
|
52
|
+
console.log(`[DEBUG] Missing required field: ${field}`);
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
success: false,
|
|
56
|
+
error: `Missing required field: ${field}`
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (this.debug) {
|
|
61
|
+
console.log(`[DEBUG] Token metadata extracted successfully`);
|
|
62
|
+
console.log(`[DEBUG] Token ID: ${tokenData.tokenId}, Network: ${tokenData.network}`);
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
success: true,
|
|
66
|
+
metadata: tokenData
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
const errorMessage = error instanceof Error ? error.message : 'Invalid JSON format';
|
|
71
|
+
if (this.debug) {
|
|
72
|
+
console.log(`[DEBUG] Failed to parse token metadata: ${errorMessage}`);
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
success: false,
|
|
76
|
+
error: `Invalid token metadata format: ${errorMessage}`
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Map network name to RPC configuration
|
|
82
|
+
*/
|
|
83
|
+
getNetworkConfig(networkName) {
|
|
84
|
+
const normalizedName = networkName.toLowerCase();
|
|
85
|
+
if (this.debug) {
|
|
86
|
+
console.log(`[DEBUG] Looking up network config for: ${normalizedName}`);
|
|
87
|
+
}
|
|
88
|
+
// Map various network name variations to our configs
|
|
89
|
+
if (normalizedName.includes('sepolia')) {
|
|
90
|
+
return { success: true, config: NETWORK_CONFIGS['base-sepolia'] };
|
|
91
|
+
}
|
|
92
|
+
else if (normalizedName.includes('base') && !normalizedName.includes('sepolia')) {
|
|
93
|
+
return { success: true, config: NETWORK_CONFIGS['base-mainnet'] };
|
|
94
|
+
}
|
|
95
|
+
if (this.debug) {
|
|
96
|
+
console.log(`[DEBUG] Unsupported network: ${normalizedName}`);
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
success: false,
|
|
100
|
+
error: `Unsupported network: ${networkName}`
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Perform merkle root comparison
|
|
105
|
+
*/
|
|
106
|
+
compareMerkleRoots(calculated, declared) {
|
|
107
|
+
if (this.debug) {
|
|
108
|
+
console.log(`[DEBUG] Comparing merkle roots`);
|
|
109
|
+
console.log(`[DEBUG] Calculated: ${calculated || 'null'}`);
|
|
110
|
+
console.log(`[DEBUG] Declared: ${declared || 'null'}`);
|
|
111
|
+
}
|
|
112
|
+
if (!calculated) {
|
|
113
|
+
return {
|
|
114
|
+
success: false,
|
|
115
|
+
match: false,
|
|
116
|
+
error: 'Cannot calculate merkle root from archive contents'
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
if (!declared) {
|
|
120
|
+
return {
|
|
121
|
+
success: false,
|
|
122
|
+
match: false,
|
|
123
|
+
calculated,
|
|
124
|
+
error: 'No merkle root found in token metadata'
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const match = calculated === declared;
|
|
128
|
+
if (this.debug) {
|
|
129
|
+
console.log(`[DEBUG] Merkle root match: ${match}`);
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
success: true,
|
|
133
|
+
match,
|
|
134
|
+
calculated,
|
|
135
|
+
declared
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Verify token against blockchain
|
|
140
|
+
*/
|
|
141
|
+
async verifyOnChain(tokenId, contractAddress, networkConfig, merkleRoot) {
|
|
142
|
+
try {
|
|
143
|
+
if (this.debug) {
|
|
144
|
+
console.log(`[DEBUG] Starting on-chain verification`);
|
|
145
|
+
console.log(`[DEBUG] Token ID: ${tokenId}, Contract: ${contractAddress}`);
|
|
146
|
+
console.log(`[DEBUG] Network: ${networkConfig.name}, RPC: ${networkConfig.rpcUrl}`);
|
|
147
|
+
}
|
|
148
|
+
const provider = new ethers_1.ethers.JsonRpcProvider(networkConfig.rpcUrl);
|
|
149
|
+
const contract = new ethers_1.ethers.Contract(contractAddress, contracts_1.NZIP_CONTRACT_ABI, provider);
|
|
150
|
+
if (this.debug) {
|
|
151
|
+
console.log(`[DEBUG] Calling contract.verifyZipFile(${tokenId}, ${merkleRoot.substring(0, 10)}...)`);
|
|
152
|
+
}
|
|
153
|
+
const isValid = await contract.verifyZipFile(tokenId, merkleRoot);
|
|
154
|
+
if (this.debug) {
|
|
155
|
+
console.log(`[DEBUG] On-chain verification result: ${isValid}`);
|
|
156
|
+
}
|
|
157
|
+
return { success: true, isValid };
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
const errorMessage = error instanceof Error ? error.message : 'Network error';
|
|
161
|
+
if (this.debug) {
|
|
162
|
+
console.log(`[DEBUG] On-chain verification failed: ${errorMessage}`);
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
success: false,
|
|
166
|
+
error: errorMessage
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Complete verification process
|
|
172
|
+
*/
|
|
173
|
+
async verifyToken(tokenMetadata, calculatedMerkleRoot, options = {}) {
|
|
174
|
+
try {
|
|
175
|
+
if (this.debug) {
|
|
176
|
+
console.log(`[DEBUG] Starting complete token verification`);
|
|
177
|
+
}
|
|
178
|
+
// Get network configuration
|
|
179
|
+
const networkResult = this.getNetworkConfig(tokenMetadata.network);
|
|
180
|
+
if (!networkResult.success || !networkResult.config) {
|
|
181
|
+
return {
|
|
182
|
+
success: false,
|
|
183
|
+
message: networkResult.error || 'Unknown network error',
|
|
184
|
+
errorDetails: {
|
|
185
|
+
errorType: 'NETWORK_ERROR',
|
|
186
|
+
networkName: tokenMetadata.network
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
const networkConfig = networkResult.config;
|
|
191
|
+
const declaredMerkleRoot = tokenMetadata.merkleRoot;
|
|
192
|
+
// Compare merkle roots if hash verification is not skipped
|
|
193
|
+
if (!options.skipHash) {
|
|
194
|
+
const merkleComparison = this.compareMerkleRoots(calculatedMerkleRoot, declaredMerkleRoot);
|
|
195
|
+
if (!merkleComparison.success) {
|
|
196
|
+
return {
|
|
197
|
+
success: false,
|
|
198
|
+
message: merkleComparison.error || 'Merkle root verification failed',
|
|
199
|
+
errorDetails: {
|
|
200
|
+
errorType: 'MERKLE_ERROR',
|
|
201
|
+
merkleRoot: declaredMerkleRoot || 'null'
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (!merkleComparison.match) {
|
|
206
|
+
return {
|
|
207
|
+
success: false,
|
|
208
|
+
message: 'Archive integrity verification FAILED - merkle root mismatch',
|
|
209
|
+
errorDetails: {
|
|
210
|
+
errorType: 'MERKLE_ERROR',
|
|
211
|
+
merkleRoot: `calculated: ${merkleComparison.calculated}, declared: ${merkleComparison.declared}`
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
// Perform on-chain verification
|
|
217
|
+
const merkleToVerify = calculatedMerkleRoot;
|
|
218
|
+
if (!merkleToVerify) {
|
|
219
|
+
return {
|
|
220
|
+
success: false,
|
|
221
|
+
message: 'No merkle root available for verification',
|
|
222
|
+
errorDetails: {
|
|
223
|
+
errorType: 'MERKLE_ERROR'
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
const onChainResult = await this.verifyOnChain(tokenMetadata.tokenId, tokenMetadata.contractAddress, networkConfig, merkleToVerify);
|
|
228
|
+
if (!onChainResult.success) {
|
|
229
|
+
return {
|
|
230
|
+
success: false,
|
|
231
|
+
message: `Blockchain verification failed: ${onChainResult.error}`,
|
|
232
|
+
errorDetails: {
|
|
233
|
+
errorType: 'CONTRACT_ERROR',
|
|
234
|
+
networkName: tokenMetadata.network,
|
|
235
|
+
rpcUrl: networkConfig.rpcUrl,
|
|
236
|
+
contractAddress: tokenMetadata.contractAddress,
|
|
237
|
+
tokenId: tokenMetadata.tokenId
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
if (!onChainResult.isValid) {
|
|
242
|
+
return {
|
|
243
|
+
success: false,
|
|
244
|
+
message: 'Blockchain verification FAILED - token or merkle root invalid',
|
|
245
|
+
errorDetails: {
|
|
246
|
+
errorType: 'CONTRACT_ERROR',
|
|
247
|
+
tokenId: tokenMetadata.tokenId,
|
|
248
|
+
contractAddress: tokenMetadata.contractAddress,
|
|
249
|
+
merkleRoot: merkleToVerify
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
// Success - create verification details
|
|
254
|
+
const mintDate = tokenMetadata.mintDate ||
|
|
255
|
+
(tokenMetadata.creationTimestamp ? new Date(tokenMetadata.creationTimestamp * 1000).toLocaleString() : '') ||
|
|
256
|
+
'8/01/2025 at 1:00:00 PM'; // fallback
|
|
257
|
+
return {
|
|
258
|
+
success: true,
|
|
259
|
+
message: 'Archive integrity VERIFIED against blockchain records',
|
|
260
|
+
tokenMetadata,
|
|
261
|
+
verificationDetails: {
|
|
262
|
+
tokenId: tokenMetadata.tokenId,
|
|
263
|
+
network: tokenMetadata.network,
|
|
264
|
+
contractAddress: tokenMetadata.contractAddress,
|
|
265
|
+
merkleRoot: merkleToVerify,
|
|
266
|
+
mintDate,
|
|
267
|
+
calculatedMerkleRoot: calculatedMerkleRoot || undefined,
|
|
268
|
+
declaredMerkleRoot: declaredMerkleRoot || undefined,
|
|
269
|
+
merkleRootMatch: !options.skipHash ? calculatedMerkleRoot === declaredMerkleRoot : undefined,
|
|
270
|
+
onChainValid: true
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
catch (error) {
|
|
275
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown verification error';
|
|
276
|
+
if (this.debug) {
|
|
277
|
+
console.log(`[DEBUG] Verification process failed: ${errorMessage}`);
|
|
278
|
+
}
|
|
279
|
+
return {
|
|
280
|
+
success: false,
|
|
281
|
+
message: `Tokenization verification failed: ${errorMessage}`,
|
|
282
|
+
errorDetails: {
|
|
283
|
+
errorType: 'METADATA_ERROR'
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
exports.ZipKitVerifier = ZipKitVerifier;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
|
+
import { WalletSetupResult, MintingOptions } from './types';
|
|
3
|
+
export interface CommonTokenConfig {
|
|
4
|
+
address: string;
|
|
5
|
+
name: string;
|
|
6
|
+
symbol: string;
|
|
7
|
+
type: 'ERC20' | 'ERC721';
|
|
8
|
+
}
|
|
2
9
|
export interface TokenInfo {
|
|
3
10
|
address: string;
|
|
4
11
|
name: string;
|
|
@@ -7,17 +14,6 @@ export interface TokenInfo {
|
|
|
7
14
|
decimals?: number;
|
|
8
15
|
type: 'ERC20' | 'ERC721' | 'NZIP';
|
|
9
16
|
}
|
|
10
|
-
export interface NZipTokenDetails {
|
|
11
|
-
tokenId: string;
|
|
12
|
-
merkleRootHash: string;
|
|
13
|
-
fileName: string;
|
|
14
|
-
timestamp: number;
|
|
15
|
-
tokenURI?: string;
|
|
16
|
-
creator: string;
|
|
17
|
-
creationTimestamp: number;
|
|
18
|
-
tokenizationTime: number;
|
|
19
|
-
ipfsHash?: string;
|
|
20
|
-
}
|
|
21
17
|
export interface WalletBasicInfo {
|
|
22
18
|
ethBalance: string;
|
|
23
19
|
transactionCount: number;
|
|
@@ -29,53 +25,45 @@ export interface TokenScanResult {
|
|
|
29
25
|
foundTokens: number[];
|
|
30
26
|
searchMethod: 'recent-events' | 'iteration' | 'common-ids' | 'none';
|
|
31
27
|
}
|
|
32
|
-
export interface
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
export interface NZipTokenDetails {
|
|
29
|
+
tokenId: string;
|
|
30
|
+
merkleRootHash: string;
|
|
31
|
+
fileName: string;
|
|
32
|
+
timestamp: number;
|
|
33
|
+
tokenURI?: string;
|
|
34
|
+
creator: string;
|
|
35
|
+
creationTimestamp: number;
|
|
36
|
+
tokenizationTime: number;
|
|
37
|
+
ipfsHash?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare class ZipKitWallet {
|
|
40
|
+
private wallet;
|
|
41
|
+
private provider;
|
|
42
|
+
private promptUser;
|
|
43
|
+
private findExistingWallets;
|
|
44
|
+
private loadWalletFromFile;
|
|
45
|
+
setupWallet(options: MintingOptions): Promise<WalletSetupResult>;
|
|
46
|
+
private createNewWallet;
|
|
47
|
+
private connectToNetwork;
|
|
48
|
+
getWallet(): ethers.Wallet | null;
|
|
49
|
+
getProvider(): ethers.JsonRpcProvider | null;
|
|
50
|
+
isReady(): boolean;
|
|
51
|
+
isOnline(): boolean;
|
|
37
52
|
}
|
|
38
53
|
export declare class WalletAnalyzer {
|
|
39
54
|
private provider;
|
|
40
55
|
constructor(provider: ethers.JsonRpcProvider);
|
|
41
|
-
/**
|
|
42
|
-
* Get basic wallet information (balance, transaction count, etc.)
|
|
43
|
-
*/
|
|
44
56
|
getWalletBasics(address: string): Promise<WalletBasicInfo>;
|
|
45
|
-
/**
|
|
46
|
-
* Scan for NZIP tokens owned by an address using multiple methods
|
|
47
|
-
*/
|
|
48
57
|
scanForNZipTokens(contractAddress: string, ownerAddress: string): Promise<TokenScanResult>;
|
|
49
|
-
/**
|
|
50
|
-
* Get detailed information about NZIP tokens
|
|
51
|
-
*/
|
|
52
58
|
getNZipTokenDetails(contractAddress: string, tokenIds: number[]): Promise<NZipTokenDetails[]>;
|
|
53
|
-
/**
|
|
54
|
-
* Get contract information (name, symbol, total supply)
|
|
55
|
-
*/
|
|
56
59
|
getContractInfo(contractAddress: string): Promise<{
|
|
57
60
|
name: string;
|
|
58
61
|
symbol: string;
|
|
59
62
|
totalSupply: string;
|
|
60
63
|
} | null>;
|
|
61
|
-
/**
|
|
62
|
-
* Check ERC-20 token balances for common tokens
|
|
63
|
-
*/
|
|
64
64
|
checkERC20Tokens(ownerAddress: string, tokenConfigs: CommonTokenConfig[]): Promise<TokenInfo[]>;
|
|
65
|
-
/**
|
|
66
|
-
* Check NFT collection balances
|
|
67
|
-
*/
|
|
68
65
|
checkNFTCollections(ownerAddress: string, nftConfigs: CommonTokenConfig[]): Promise<TokenInfo[]>;
|
|
69
|
-
/**
|
|
70
|
-
* Detect NZIP contract from deployment file
|
|
71
|
-
*/
|
|
72
66
|
static detectNZipContract(): string | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* Get common token configurations for a network
|
|
75
|
-
*/
|
|
76
67
|
static getCommonTokens(network: string): CommonTokenConfig[];
|
|
77
|
-
/**
|
|
78
|
-
* Get common NFT configurations for a network
|
|
79
|
-
*/
|
|
80
68
|
static getCommonNFTs(network: string): CommonTokenConfig[];
|
|
81
69
|
}
|