neozip-blockchain 0.5.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/LICENSE +22 -0
- package/README.md +189 -0
- package/dist/browser/TokenVerifierBrowser.d.ts +63 -0
- package/dist/browser/TokenVerifierBrowser.d.ts.map +1 -0
- package/dist/browser/TokenVerifierBrowser.js +358 -0
- package/dist/browser/TokenVerifierBrowser.js.map +1 -0
- package/dist/browser/WalletManagerBrowser.d.ts +99 -0
- package/dist/browser/WalletManagerBrowser.d.ts.map +1 -0
- package/dist/browser/WalletManagerBrowser.js +434 -0
- package/dist/browser/WalletManagerBrowser.js.map +1 -0
- package/dist/browser/ZipkitMinterBrowser.d.ts +59 -0
- package/dist/browser/ZipkitMinterBrowser.d.ts.map +1 -0
- package/dist/browser/ZipkitMinterBrowser.js +337 -0
- package/dist/browser/ZipkitMinterBrowser.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 +19 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/constants/index.d.ts +5 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +21 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/metadata.d.ts +18 -0
- package/dist/constants/metadata.d.ts.map +1 -0
- package/dist/constants/metadata.js +33 -0
- package/dist/constants/metadata.js.map +1 -0
- package/dist/constants/servers.d.ts +38 -0
- package/dist/constants/servers.d.ts.map +1 -0
- package/dist/constants/servers.js +54 -0
- package/dist/constants/servers.js.map +1 -0
- package/dist/core/ContractVersionRegistry.d.ts +63 -0
- package/dist/core/ContractVersionRegistry.d.ts.map +1 -0
- package/dist/core/ContractVersionRegistry.js +128 -0
- package/dist/core/ContractVersionRegistry.js.map +1 -0
- package/dist/core/WalletManager.d.ts +123 -0
- package/dist/core/WalletManager.d.ts.map +1 -0
- package/dist/core/WalletManager.js +360 -0
- package/dist/core/WalletManager.js.map +1 -0
- package/dist/core/ZipkitMinter.d.ts +155 -0
- package/dist/core/ZipkitMinter.d.ts.map +1 -0
- package/dist/core/ZipkitMinter.js +625 -0
- package/dist/core/ZipkitMinter.js.map +1 -0
- package/dist/core/ZipkitVerifier.d.ts +252 -0
- package/dist/core/ZipkitVerifier.d.ts.map +1 -0
- package/dist/core/ZipkitVerifier.js +1370 -0
- package/dist/core/ZipkitVerifier.js.map +1 -0
- package/dist/core/adapters/AdapterFactory.d.ts +22 -0
- package/dist/core/adapters/AdapterFactory.d.ts.map +1 -0
- package/dist/core/adapters/AdapterFactory.js +62 -0
- package/dist/core/adapters/AdapterFactory.js.map +1 -0
- package/dist/core/adapters/ContractVersionAdapter.d.ts +96 -0
- package/dist/core/adapters/ContractVersionAdapter.d.ts.map +1 -0
- package/dist/core/adapters/ContractVersionAdapter.js +9 -0
- package/dist/core/adapters/ContractVersionAdapter.js.map +1 -0
- package/dist/core/adapters/V2_10Adapter.d.ts +24 -0
- package/dist/core/adapters/V2_10Adapter.d.ts.map +1 -0
- package/dist/core/adapters/V2_10Adapter.js +87 -0
- package/dist/core/adapters/V2_10Adapter.js.map +1 -0
- package/dist/core/adapters/V2_11Adapter.d.ts +24 -0
- package/dist/core/adapters/V2_11Adapter.d.ts.map +1 -0
- package/dist/core/adapters/V2_11Adapter.js +87 -0
- package/dist/core/adapters/V2_11Adapter.js.map +1 -0
- package/dist/core/adapters/V2_50Adapter.d.ts +105 -0
- package/dist/core/adapters/V2_50Adapter.d.ts.map +1 -0
- package/dist/core/adapters/V2_50Adapter.js +263 -0
- package/dist/core/adapters/V2_50Adapter.js.map +1 -0
- package/dist/core/contracts.d.ts +169 -0
- package/dist/core/contracts.d.ts.map +1 -0
- package/dist/core/contracts.js +731 -0
- package/dist/core/contracts.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 +82 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/node/WalletManagerNode.d.ts +47 -0
- package/dist/node/WalletManagerNode.d.ts.map +1 -0
- package/dist/node/WalletManagerNode.js +203 -0
- package/dist/node/WalletManagerNode.js.map +1 -0
- package/dist/node/index.d.ts +12 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +21 -0
- package/dist/node/index.js.map +1 -0
- package/dist/ots/ZipkitOTS.d.ts +152 -0
- package/dist/ots/ZipkitOTS.d.ts.map +1 -0
- package/dist/ots/ZipkitOTS.js +544 -0
- package/dist/ots/ZipkitOTS.js.map +1 -0
- package/dist/ots/index.d.ts +9 -0
- package/dist/ots/index.d.ts.map +1 -0
- package/dist/ots/index.js +25 -0
- package/dist/ots/index.js.map +1 -0
- package/dist/types/index.d.ts +84 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +37 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/Logger.d.ts +73 -0
- package/dist/utils/Logger.d.ts.map +1 -0
- package/dist/utils/Logger.js +156 -0
- package/dist/utils/Logger.js.map +1 -0
- package/dist/utils/crc32.d.ts +6 -0
- package/dist/utils/crc32.d.ts.map +1 -0
- package/dist/utils/crc32.js +23 -0
- package/dist/utils/crc32.js.map +1 -0
- package/dist/zipstamp-server/CalendarManager.d.ts +238 -0
- package/dist/zipstamp-server/CalendarManager.d.ts.map +1 -0
- package/dist/zipstamp-server/CalendarManager.js +364 -0
- package/dist/zipstamp-server/CalendarManager.js.map +1 -0
- package/dist/zipstamp-server/ZipstampServerAPI.d.ts +427 -0
- package/dist/zipstamp-server/ZipstampServerAPI.d.ts.map +1 -0
- package/dist/zipstamp-server/ZipstampServerAPI.js +696 -0
- package/dist/zipstamp-server/ZipstampServerAPI.js.map +1 -0
- package/dist/zipstamp-server/ZipstampServerClient.d.ts +590 -0
- package/dist/zipstamp-server/ZipstampServerClient.d.ts.map +1 -0
- package/dist/zipstamp-server/ZipstampServerClient.js +433 -0
- package/dist/zipstamp-server/ZipstampServerClient.js.map +1 -0
- package/dist/zipstamp-server/ZipstampServerHelpers.d.ts +430 -0
- package/dist/zipstamp-server/ZipstampServerHelpers.d.ts.map +1 -0
- package/dist/zipstamp-server/ZipstampServerHelpers.js +503 -0
- package/dist/zipstamp-server/ZipstampServerHelpers.js.map +1 -0
- package/dist/zipstamp-server/index.d.ts +24 -0
- package/dist/zipstamp-server/index.d.ts.map +1 -0
- package/dist/zipstamp-server/index.js +67 -0
- package/dist/zipstamp-server/index.js.map +1 -0
- package/package.json +117 -0
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zipstamp Server Helpers
|
|
3
|
+
*
|
|
4
|
+
* High-level convenience functions for interacting with the Zipstamp server API.
|
|
5
|
+
* These functions provide a simplified interface for common operations like
|
|
6
|
+
* submitting digests, verifying timestamps, polling for confirmation, and NFT operations.
|
|
7
|
+
*
|
|
8
|
+
* This module wraps the core ZipstampServerClient with convenience functions
|
|
9
|
+
* and response type transformations for easier use in applications.
|
|
10
|
+
*/
|
|
11
|
+
import { ZipstampServerClient, type PrepareMintResponse, type NFTStatusResponse, type NFTContractInfoResponse } from './ZipstampServerClient';
|
|
12
|
+
import { getZipStampServerUrl } from '../constants/servers';
|
|
13
|
+
/**
|
|
14
|
+
* Response from submitting a digest to the Zipstamp server.
|
|
15
|
+
*
|
|
16
|
+
* Returned by `submitDigest` function after submitting a digest for timestamping.
|
|
17
|
+
*/
|
|
18
|
+
export interface SubmitDigestResponse {
|
|
19
|
+
success: boolean;
|
|
20
|
+
digest: string;
|
|
21
|
+
batchId?: string | null;
|
|
22
|
+
batchNumber?: number;
|
|
23
|
+
chainId?: number;
|
|
24
|
+
network?: string;
|
|
25
|
+
status: 'pending' | 'minting' | 'confirmed';
|
|
26
|
+
error?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Response from verifying a digest with the Zipstamp server.
|
|
30
|
+
*
|
|
31
|
+
* Returned by `verifyDigest` and `pollForConfirmation` functions after checking
|
|
32
|
+
* timestamp status. Contains detailed blockchain information if confirmed.
|
|
33
|
+
*/
|
|
34
|
+
export interface VerifyDigestResponse {
|
|
35
|
+
success: boolean;
|
|
36
|
+
verified: boolean;
|
|
37
|
+
digest: string;
|
|
38
|
+
tokenId?: string;
|
|
39
|
+
contractAddress?: string;
|
|
40
|
+
network?: string;
|
|
41
|
+
chainId?: number;
|
|
42
|
+
transactionHash?: string;
|
|
43
|
+
blockNumber?: number;
|
|
44
|
+
timestamp?: number;
|
|
45
|
+
merkleRoot?: string;
|
|
46
|
+
merkleProof?: string[];
|
|
47
|
+
batchId?: string;
|
|
48
|
+
batchNumber?: number;
|
|
49
|
+
status?: 'pending' | 'confirmed';
|
|
50
|
+
error?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Timestamp metadata format stored in ZIP files
|
|
54
|
+
* Extended version with all fields needed for examples and verification
|
|
55
|
+
*/
|
|
56
|
+
export interface TimestampMetadata {
|
|
57
|
+
digest: string;
|
|
58
|
+
batchId?: string | null;
|
|
59
|
+
batchNumber?: number;
|
|
60
|
+
chainId?: number;
|
|
61
|
+
network?: string;
|
|
62
|
+
status?: 'pending' | 'confirmed';
|
|
63
|
+
serverUrl: string;
|
|
64
|
+
submittedAt: string;
|
|
65
|
+
merkleProof?: string[];
|
|
66
|
+
merkleRoot?: string;
|
|
67
|
+
transactionHash?: string;
|
|
68
|
+
blockNumber?: number;
|
|
69
|
+
timestamp?: number;
|
|
70
|
+
contractAddress?: string;
|
|
71
|
+
tokenId?: string;
|
|
72
|
+
confirmedAt?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Extended Token Metadata (compatible with neozipkit TokenMetadata)
|
|
76
|
+
*
|
|
77
|
+
* This interface extends the base TokenMetadata with timestamp proof information
|
|
78
|
+
* for NFTs minted from timestamped ZIP files via the Zipstamp server.
|
|
79
|
+
*
|
|
80
|
+
* The timestampProof section links the NFT to the original timestamp batch,
|
|
81
|
+
* proving both NFT ownership AND timestamp verification.
|
|
82
|
+
*/
|
|
83
|
+
export interface ExtendedTokenMetadata {
|
|
84
|
+
tokenId: string;
|
|
85
|
+
contractAddress: string;
|
|
86
|
+
network: string;
|
|
87
|
+
merkleRoot: string;
|
|
88
|
+
networkChainId: number;
|
|
89
|
+
contractVersion: string;
|
|
90
|
+
transactionHash?: string;
|
|
91
|
+
blockNumber?: number;
|
|
92
|
+
owner?: string;
|
|
93
|
+
mintedAt?: string;
|
|
94
|
+
timestampProof: {
|
|
95
|
+
digest: string;
|
|
96
|
+
merkleProof: string[];
|
|
97
|
+
batchMerkleRoot: string;
|
|
98
|
+
batchNumber: number;
|
|
99
|
+
batchTransactionHash: string;
|
|
100
|
+
batchBlockNumber: number;
|
|
101
|
+
batchTimestamp: number;
|
|
102
|
+
registryAddress: string;
|
|
103
|
+
nftContractAddress: string;
|
|
104
|
+
serverUrl: string;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export type { PrepareMintResponse, NFTStatusResponse, NFTContractInfoResponse } from './ZipstampServerClient';
|
|
108
|
+
/**
|
|
109
|
+
* Options for Zipstamp server helper functions.
|
|
110
|
+
*
|
|
111
|
+
* Common configuration options used across helper functions in ZipstampServerHelpers.
|
|
112
|
+
* Stamping requires a verified email in the request (no API key).
|
|
113
|
+
*/
|
|
114
|
+
export interface ZipstampServerHelperOptions {
|
|
115
|
+
/** Zipstamp server URL (defaults to library constant / ZIPSTAMP_SERVER_URL or TOKEN_SERVER_URL env) */
|
|
116
|
+
serverUrl?: string;
|
|
117
|
+
/** Key into ZIPSTAMP_SERVER_URLS (e.g. "default", "staging") */
|
|
118
|
+
serverKey?: string;
|
|
119
|
+
/** Enable debug logging */
|
|
120
|
+
debug?: boolean;
|
|
121
|
+
}
|
|
122
|
+
/** Re-export for callers that need to resolve server URL (single source: constants/servers.ts) */
|
|
123
|
+
export { getZipStampServerUrl };
|
|
124
|
+
/**
|
|
125
|
+
* Submits a digest to the Zipstamp server for blockchain timestamping.
|
|
126
|
+
*
|
|
127
|
+
* Sends a SHA-256 digest (merkle root) to the Zipstamp server API to be included
|
|
128
|
+
* in the next batch for blockchain timestamping. The digest is typically the
|
|
129
|
+
* merkle root of a ZIP file's contents.
|
|
130
|
+
*
|
|
131
|
+
* Stamping requires a verified email (include email in the request; user must
|
|
132
|
+
* have verified via POST /auth/register and POST /auth/verify first).
|
|
133
|
+
*
|
|
134
|
+
* @param digest - SHA-256 hash as a 64-character hexadecimal string (no '0x' prefix)
|
|
135
|
+
* @param email - Email address (must be verified on the server)
|
|
136
|
+
* @param chainId - Optional chain ID hint (server may use this to select the network)
|
|
137
|
+
* @param options - Optional configuration
|
|
138
|
+
* @param options.serverUrl - Zipstamp server URL (defaults to `ZIPSTAMP_SERVER_URL` env var or `https://zipstamp-dev.neozip.io`)
|
|
139
|
+
* @param options.debug - Enable debug logging (defaults to `false`)
|
|
140
|
+
* @returns Promise resolving to response containing batch information and status
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```typescript
|
|
144
|
+
* const response = await submitDigest(
|
|
145
|
+
* 'a1b2c3d4e5f6...', // 64-char hex string
|
|
146
|
+
* 'user@example.com',
|
|
147
|
+
* undefined, // Let server choose chain
|
|
148
|
+
* { debug: true }
|
|
149
|
+
* );
|
|
150
|
+
*
|
|
151
|
+
* if (response.success) {
|
|
152
|
+
* console.log('Submitted to batch:', response.batchId);
|
|
153
|
+
* console.log('Status:', response.status); // 'pending' | 'minting' | 'confirmed'
|
|
154
|
+
* }
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
export declare function submitDigest(digest: string, email?: string, chainId?: number, options?: ZipstampServerHelperOptions): Promise<SubmitDigestResponse>;
|
|
158
|
+
/**
|
|
159
|
+
* Verifies a digest using the Zipstamp server API.
|
|
160
|
+
*
|
|
161
|
+
* Checks with the Zipstamp server whether a digest has been confirmed on the blockchain.
|
|
162
|
+
* Returns detailed verification information including transaction hash, block number,
|
|
163
|
+
* and merkle proof data if the timestamp is confirmed.
|
|
164
|
+
*
|
|
165
|
+
* @param digest - The SHA-256 digest (64-character hex string) to verify
|
|
166
|
+
* @param chainId - Optional chain ID hint to help server select the correct network
|
|
167
|
+
* @param batchId - Optional batch ID hint to help server disambiguate if digest appears in multiple batches
|
|
168
|
+
* @param client - Optional pre-configured ZipstampServerClient instance (useful for polling with custom timeout/retry settings)
|
|
169
|
+
* @param options - Optional configuration
|
|
170
|
+
* @param options.serverUrl - Zipstamp server URL (defaults to `ZIPSTAMP_SERVER_URL` env var or `https://zipstamp-dev.neozip.io`)
|
|
171
|
+
* @param options.debug - Enable debug logging (defaults to `false`)
|
|
172
|
+
* @returns Promise resolving to verification response with status and blockchain details
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```typescript
|
|
176
|
+
* const response = await verifyDigest(
|
|
177
|
+
* 'a1b2c3d4e5f6...',
|
|
178
|
+
* 84532, // Base Sepolia
|
|
179
|
+
* 'base-sep-v0.90-n7', // Batch ID from metadata
|
|
180
|
+
* undefined, // Use default client
|
|
181
|
+
* { debug: true }
|
|
182
|
+
* );
|
|
183
|
+
*
|
|
184
|
+
* if (response.verified) {
|
|
185
|
+
* console.log('✅ Confirmed on blockchain');
|
|
186
|
+
* console.log('Transaction:', response.transactionHash);
|
|
187
|
+
* console.log('Block:', response.blockNumber);
|
|
188
|
+
* console.log('Merkle proof available:', !!response.merkleProof);
|
|
189
|
+
* } else {
|
|
190
|
+
* console.log('⏳ Pending confirmation');
|
|
191
|
+
* }
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
export declare function verifyDigest(digest: string, chainId?: number, batchId?: string, client?: ZipstampServerClient, options?: ZipstampServerHelperOptions): Promise<VerifyDigestResponse>;
|
|
195
|
+
/**
|
|
196
|
+
* Polls the Zipstamp server for confirmation of a digest.
|
|
197
|
+
*
|
|
198
|
+
* Continuously checks the Zipstamp server API until the digest is confirmed on the
|
|
199
|
+
* blockchain or the timeout is reached. Uses deadline-aware polling with per-request
|
|
200
|
+
* timeouts to ensure proper exit behavior.
|
|
201
|
+
*
|
|
202
|
+
* **Use cases:**
|
|
203
|
+
* - Wait for batch confirmation after submitting a digest
|
|
204
|
+
* - Upgrade pending timestamps to confirmed status
|
|
205
|
+
* - Monitor timestamp status in real-time
|
|
206
|
+
*
|
|
207
|
+
* @param digest - The SHA-256 digest (64-character hex string) to poll for
|
|
208
|
+
* @param chainId - Optional chain ID hint
|
|
209
|
+
* @param batchId - Optional batch ID hint to help server disambiguate
|
|
210
|
+
* @param timeout - Maximum time to poll in milliseconds (default: 300000 = 5 minutes)
|
|
211
|
+
* @param interval - Time between polling attempts in milliseconds (default: 5000 = 5 seconds)
|
|
212
|
+
* @param options - Optional configuration
|
|
213
|
+
* @param options.serverUrl - Zipstamp server URL (defaults to `ZIPSTAMP_SERVER_URL` env var or `https://zipstamp-dev.neozip.io`)
|
|
214
|
+
* @param options.debug - Enable debug logging (defaults to `false`)
|
|
215
|
+
* @returns Promise resolving to verification response if confirmed, or `null` if timeout reached
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* // Submit digest
|
|
220
|
+
* const submitResponse = await submitDigest(digest, email);
|
|
221
|
+
*
|
|
222
|
+
* // Poll until confirmed (or 5 minutes timeout)
|
|
223
|
+
* const confirmed = await pollForConfirmation(
|
|
224
|
+
* digest,
|
|
225
|
+
* undefined, // chainId
|
|
226
|
+
* submitResponse.batchId,
|
|
227
|
+
* 300000, // 5 minutes
|
|
228
|
+
* 5000, // Check every 5 seconds
|
|
229
|
+
* { debug: true }
|
|
230
|
+
* );
|
|
231
|
+
*
|
|
232
|
+
* if (confirmed && confirmed.verified) {
|
|
233
|
+
* console.log('✅ Confirmed! Transaction:', confirmed.transactionHash);
|
|
234
|
+
* } else {
|
|
235
|
+
* console.log('⏰ Timeout - batch not yet confirmed');
|
|
236
|
+
* }
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
export declare function pollForConfirmation(digest: string, chainId?: number, batchId?: string, timeout?: number, // 5 minutes default
|
|
240
|
+
interval?: number, // 5 seconds default
|
|
241
|
+
options?: ZipstampServerHelperOptions): Promise<VerifyDigestResponse | null>;
|
|
242
|
+
/**
|
|
243
|
+
* Prepares mint data for NFT proof token minting.
|
|
244
|
+
*
|
|
245
|
+
* Retrieves all data needed to call `mintProof()` on the TimestampProofNFT contract.
|
|
246
|
+
* This includes the merkle proof, batch information, contract addresses, and minting fee.
|
|
247
|
+
*
|
|
248
|
+
* **Use this before minting an NFT:**
|
|
249
|
+
* 1. Call `prepareMint()` to get mint data
|
|
250
|
+
* 2. Check `mintData.mintFeeWei` to ensure user has enough ETH
|
|
251
|
+
* 3. Call `mintProof(digest, merkleProof, batchMerkleRoot)` on the contract with the returned data
|
|
252
|
+
*
|
|
253
|
+
* @param digest - The SHA-256 digest (64-character hex string) to prepare mint data for
|
|
254
|
+
* @param chainId - Optional chain ID hint
|
|
255
|
+
* @param batchId - Optional batch ID from TIMESTAMP.NZIP metadata to ensure the correct batch is used
|
|
256
|
+
* @param options - Optional configuration
|
|
257
|
+
* @param options.serverUrl - Zipstamp server URL (defaults to `ZIPSTAMP_SERVER_URL` env var or `https://zipstamp-dev.neozip.io`)
|
|
258
|
+
* @param options.debug - Enable debug logging (defaults to `false`)
|
|
259
|
+
* @returns Promise resolving to mint data response containing all parameters needed for contract call
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```typescript
|
|
263
|
+
* const mintData = await prepareMint(
|
|
264
|
+
* digest,
|
|
265
|
+
* 84532, // Base Sepolia
|
|
266
|
+
* 'base-sep-v0.90-n7'
|
|
267
|
+
* );
|
|
268
|
+
*
|
|
269
|
+
* if (mintData.success && mintData.mintData) {
|
|
270
|
+
* const { digest, merkleProof, batchMerkleRoot, mintFeeWei, nftContractAddress } = mintData.mintData;
|
|
271
|
+
*
|
|
272
|
+
* // Call contract
|
|
273
|
+
* const tx = await contract.mintProof(digest, merkleProof, batchMerkleRoot, {
|
|
274
|
+
* value: mintFeeWei
|
|
275
|
+
* });
|
|
276
|
+
* await tx.wait();
|
|
277
|
+
* }
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
export declare function prepareMint(digest: string, chainId?: number, batchId?: string, options?: ZipstampServerHelperOptions): Promise<PrepareMintResponse>;
|
|
281
|
+
/**
|
|
282
|
+
* Checks if a digest has already been minted as an NFT proof token.
|
|
283
|
+
*
|
|
284
|
+
* Queries the Zipstamp server to determine if a digest has been minted as an NFT
|
|
285
|
+
* on the TimestampProofNFT contract. Returns token information if minted, including
|
|
286
|
+
* token ID, owner, and proof data.
|
|
287
|
+
*
|
|
288
|
+
* @param digest - The SHA-256 digest (64-character hex string) to check
|
|
289
|
+
* @param chainId - Optional chain ID hint
|
|
290
|
+
* @param options - Optional configuration
|
|
291
|
+
* @param options.serverUrl - Zipstamp server URL (defaults to `ZIPSTAMP_SERVER_URL` env var or `https://zipstamp-dev.neozip.io`)
|
|
292
|
+
* @param options.debug - Enable debug logging (defaults to `false`)
|
|
293
|
+
* @returns Promise resolving to NFT status response indicating if minted and token details
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```typescript
|
|
297
|
+
* const status = await checkNFTStatus(digest, 84532);
|
|
298
|
+
*
|
|
299
|
+
* if (status.isMinted) {
|
|
300
|
+
* console.log('✅ Already minted as NFT');
|
|
301
|
+
* console.log('Token ID:', status.tokenId);
|
|
302
|
+
* console.log('Owner:', status.owner);
|
|
303
|
+
* } else {
|
|
304
|
+
* console.log('Not yet minted - can proceed with minting');
|
|
305
|
+
* }
|
|
306
|
+
* ```
|
|
307
|
+
*/
|
|
308
|
+
export declare function checkNFTStatus(digest: string, chainId?: number, options?: ZipstampServerHelperOptions): Promise<NFTStatusResponse>;
|
|
309
|
+
/**
|
|
310
|
+
* Retrieves NFT contract information from the Zipstamp server.
|
|
311
|
+
*
|
|
312
|
+
* Gets details about the TimestampProofNFT contract for a given network,
|
|
313
|
+
* including contract address, registry address, minting fee, and version.
|
|
314
|
+
*
|
|
315
|
+
* @param chainId - Optional chain ID hint (if not provided, server uses default network)
|
|
316
|
+
* @param options - Optional configuration
|
|
317
|
+
* @param options.serverUrl - Zipstamp server URL (defaults to `ZIPSTAMP_SERVER_URL` env var or `https://zipstamp-dev.neozip.io`)
|
|
318
|
+
* @param options.debug - Enable debug logging (defaults to `false`)
|
|
319
|
+
* @returns Promise resolving to contract information response
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```typescript
|
|
323
|
+
* const info = await getNFTContractInfo(84532); // Base Sepolia
|
|
324
|
+
*
|
|
325
|
+
* if (info.success) {
|
|
326
|
+
* console.log('NFT Contract:', info.contractAddress);
|
|
327
|
+
* console.log('Registry:', info.registryAddress);
|
|
328
|
+
* console.log('Mint Fee:', info.mintFee, 'ETH');
|
|
329
|
+
* console.log('Version:', info.contractVersion);
|
|
330
|
+
* }
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
export declare function getNFTContractInfo(chainId?: number, options?: ZipstampServerHelperOptions): Promise<NFTContractInfoResponse>;
|
|
334
|
+
import type { RegisterResponse, VerifyEmailResponse, CalendarIdentity, HealthCheckResponse } from './ZipstampServerClient';
|
|
335
|
+
export type { RegisterRequest, RegisterResponse, VerifyEmailRequest, VerifyEmailResponse, CalendarIdentity, CalendarChainInfo, HealthCheckResponse, ComponentHealth, } from './ZipstampServerClient';
|
|
336
|
+
/**
|
|
337
|
+
* Register an email address with a calendar server.
|
|
338
|
+
*
|
|
339
|
+
* This is the first step of the authentication flow. After calling this,
|
|
340
|
+
* the user will receive an email with a verification code. Use `verifyEmailCode`
|
|
341
|
+
* to complete registration.
|
|
342
|
+
*
|
|
343
|
+
* PUBLIC: No API key required.
|
|
344
|
+
*
|
|
345
|
+
* @param email - Email address to register
|
|
346
|
+
* @param options - Optional configuration
|
|
347
|
+
* @param options.serverUrl - Zipstamp server URL
|
|
348
|
+
* @returns Promise resolving to registration response
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```typescript
|
|
352
|
+
* const result = await registerEmail('user@example.com', {
|
|
353
|
+
* serverUrl: 'https://calendar.neozip.io'
|
|
354
|
+
* });
|
|
355
|
+
*
|
|
356
|
+
* if (result.success) {
|
|
357
|
+
* console.log('Check your email for the verification code');
|
|
358
|
+
* }
|
|
359
|
+
* ```
|
|
360
|
+
*/
|
|
361
|
+
export declare function registerEmail(email: string, options?: ZipstampServerHelperOptions): Promise<RegisterResponse>;
|
|
362
|
+
/**
|
|
363
|
+
* Verify email with code.
|
|
364
|
+
*
|
|
365
|
+
* This is the second step of the authentication flow. After calling `registerEmail`,
|
|
366
|
+
* the user receives a verification code via email. Submit that code here to complete
|
|
367
|
+
* registration. After verification, the user can submit digests by including their
|
|
368
|
+
* email in stamp requests.
|
|
369
|
+
*
|
|
370
|
+
* PUBLIC: No API key required.
|
|
371
|
+
*
|
|
372
|
+
* @param email - Email address that was registered
|
|
373
|
+
* @param code - Verification code from email
|
|
374
|
+
* @param options - Optional configuration
|
|
375
|
+
* @param options.serverUrl - Zipstamp server URL
|
|
376
|
+
* @returns Promise resolving to verification response
|
|
377
|
+
*/
|
|
378
|
+
export declare function verifyEmailCode(email: string, code: string, options?: ZipstampServerHelperOptions): Promise<VerifyEmailResponse>;
|
|
379
|
+
/**
|
|
380
|
+
* Get calendar server identity and capabilities.
|
|
381
|
+
*
|
|
382
|
+
* Returns information about the calendar server including its unique ID,
|
|
383
|
+
* supported chains, capabilities, and current status.
|
|
384
|
+
*
|
|
385
|
+
* PUBLIC: No API key required.
|
|
386
|
+
*
|
|
387
|
+
* @param options - Optional configuration
|
|
388
|
+
* @param options.serverUrl - Zipstamp server URL
|
|
389
|
+
* @returns Promise resolving to calendar identity information
|
|
390
|
+
*
|
|
391
|
+
* @example
|
|
392
|
+
* ```typescript
|
|
393
|
+
* const calendar = await getCalendarIdentity({
|
|
394
|
+
* serverUrl: 'https://calendar.neozip.io'
|
|
395
|
+
* });
|
|
396
|
+
*
|
|
397
|
+
* console.log('Calendar ID:', calendar.id);
|
|
398
|
+
* console.log('Status:', calendar.status);
|
|
399
|
+
* console.log('Chains:', calendar.chains.map(c => c.network).join(', '));
|
|
400
|
+
* ```
|
|
401
|
+
*/
|
|
402
|
+
export declare function getCalendarIdentity(options?: ZipstampServerHelperOptions): Promise<CalendarIdentity>;
|
|
403
|
+
/**
|
|
404
|
+
* Check health of a calendar server.
|
|
405
|
+
*
|
|
406
|
+
* Returns the current health status of the calendar server.
|
|
407
|
+
* Use this to check if a server is available before submitting timestamps.
|
|
408
|
+
*
|
|
409
|
+
* PUBLIC: No API key required.
|
|
410
|
+
*
|
|
411
|
+
* @param options - Optional configuration
|
|
412
|
+
* @param options.serverUrl - Zipstamp server URL
|
|
413
|
+
* @param full - If true, returns detailed component health (default: false)
|
|
414
|
+
* @returns Promise resolving to health check response
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* ```typescript
|
|
418
|
+
* const health = await checkCalendarHealth({
|
|
419
|
+
* serverUrl: 'https://calendar.neozip.io'
|
|
420
|
+
* });
|
|
421
|
+
*
|
|
422
|
+
* if (health.status === 'healthy') {
|
|
423
|
+
* console.log('Calendar is available');
|
|
424
|
+
* } else {
|
|
425
|
+
* console.log('Calendar status:', health.status);
|
|
426
|
+
* }
|
|
427
|
+
* ```
|
|
428
|
+
*/
|
|
429
|
+
export declare function checkCalendarHealth(options?: ZipstampServerHelperOptions, full?: boolean): Promise<HealthCheckResponse>;
|
|
430
|
+
//# sourceMappingURL=ZipstampServerHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZipstampServerHelpers.d.ts","sourceRoot":"","sources":["../../src/zipstamp-server/ZipstampServerHelpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,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