neozip-cli 0.80.0 → 0.95.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 (74) hide show
  1. package/AGENTS.md +93 -0
  2. package/CHANGELOG.md +117 -12
  3. package/DOCUMENTATION.md +33 -38
  4. package/README.md +137 -63
  5. package/dist/src/account/account-state.js +95 -0
  6. package/dist/src/account/format-account-status.js +62 -0
  7. package/dist/src/account/identity-provision.js +79 -0
  8. package/dist/src/account/identity-wrap.js +106 -0
  9. package/dist/src/account/profile-crypto.js +85 -0
  10. package/dist/src/account/profile-store.js +129 -0
  11. package/dist/src/account/require-account.js +32 -0
  12. package/dist/src/account/types.js +3 -0
  13. package/dist/src/account/wallet-evm.js +46 -0
  14. package/dist/src/account/wallet-setup.js +33 -0
  15. package/dist/src/archive/crypto-self.js +117 -0
  16. package/dist/src/archive/identity-key.js +217 -0
  17. package/dist/src/archive/recipient-lookup.js +61 -0
  18. package/dist/src/cli/output.js +100 -0
  19. package/dist/src/cli/params.js +122 -0
  20. package/dist/src/cli/schema.js +186 -0
  21. package/dist/src/cli/validate.js +119 -0
  22. package/dist/src/commands/mintTimestampProof.js +26 -14
  23. package/dist/src/config/ConfigSetup.js +82 -423
  24. package/dist/src/connect/command.js +364 -0
  25. package/dist/src/connection/bootstrap.js +50 -0
  26. package/dist/src/connection/cli-guidance.js +101 -0
  27. package/dist/src/connection/cli-prefs.js +180 -0
  28. package/dist/src/connection/cli-settings.js +140 -0
  29. package/dist/src/connection/cli-types.js +14 -0
  30. package/dist/src/connection/coordinator.js +83 -0
  31. package/dist/src/connection/credentials.js +33 -0
  32. package/dist/src/connection/crypto.js +96 -0
  33. package/dist/src/connection/dump.js +117 -0
  34. package/dist/src/connection/funding.js +187 -0
  35. package/dist/src/connection/incomplete-setup.js +89 -0
  36. package/dist/src/connection/interactive.js +871 -0
  37. package/dist/src/connection/legacy-profile-reader.js +87 -0
  38. package/dist/src/connection/magic-link.js +142 -0
  39. package/dist/src/connection/migrate.js +115 -0
  40. package/dist/src/connection/onboarding.js +616 -0
  41. package/dist/src/connection/origin.js +69 -0
  42. package/dist/src/connection/phase.js +101 -0
  43. package/dist/src/connection/phone.js +26 -0
  44. package/dist/src/connection/promote-active.js +56 -0
  45. package/dist/src/connection/reset.js +56 -0
  46. package/dist/src/connection/status-report.js +52 -0
  47. package/dist/src/connection/store.js +406 -0
  48. package/dist/src/connection/token-auth.js +44 -0
  49. package/dist/src/connection/types.js +3 -0
  50. package/dist/src/connection/wallet-json-migration.js +155 -0
  51. package/dist/src/connection/wallet-login.js +65 -0
  52. package/dist/src/connection/wallet-setup.js +83 -0
  53. package/dist/src/constants/wallet-identity.js +14 -0
  54. package/dist/src/exit-codes.js +54 -10
  55. package/dist/src/neolist.js +100 -10
  56. package/dist/src/neounzip.js +236 -65
  57. package/dist/src/neozip/blockchain.js +18 -18
  58. package/dist/src/neozip/createZip.js +118 -94
  59. package/dist/src/neozip/upgradeZip.js +14 -11
  60. package/dist/src/neozip.js +269 -91
  61. package/dist/src/skills/command.js +256 -0
  62. package/dist/src/skills/locate.js +99 -0
  63. package/dist/src/util/mask.js +34 -0
  64. package/dist/src/util/token-service-fetch.js +26 -0
  65. package/env.example +18 -85
  66. package/package.json +89 -73
  67. package/skills/neozip-connect/SKILL.md +95 -0
  68. package/skills/neozip-create/SKILL.md +57 -0
  69. package/skills/neozip-extract/SKILL.md +58 -0
  70. package/skills/neozip-legacy/SKILL.md +48 -0
  71. package/skills/neozip-list/SKILL.md +56 -0
  72. package/skills/neozip-shared/SKILL.md +60 -0
  73. package/dist/src/commands/verifyEmail.js +0 -146
  74. package/dist/src/config/ConfigStore.js +0 -406
@@ -48,9 +48,11 @@ const os = __importStar(require("os"));
48
48
  const ethers_1 = require("ethers");
49
49
  const node_1 = __importDefault(require("neozipkit/node"));
50
50
  const node_2 = require("neozipkit/node");
51
- const zipstamp_server_1 = require("neozip-blockchain/zipstamp-server");
51
+ const token_service_1 = require("neozip-blockchain/token-service");
52
52
  const neozip_blockchain_1 = require("neozip-blockchain");
53
- const blockchain_1 = require("../neozip/blockchain");
53
+ const cli_guidance_1 = require("../connection/cli-guidance");
54
+ const funding_1 = require("../connection/funding");
55
+ const bootstrap_1 = require("../connection/bootstrap");
54
56
  const RPC_BY_CHAIN = {
55
57
  84532: 'https://sepolia.base.org',
56
58
  421614: 'https://sepolia-rollup.arbitrum.io/rpc',
@@ -78,27 +80,34 @@ function getErrorMessage(error) {
78
80
  */
79
81
  async function runMintTimestampProof(options) {
80
82
  const { inputPath, outputPath, walletKey: cliWalletKey, debug = false } = options;
83
+ const walletGuidance = (0, cli_guidance_1.requireConnectionReady)('On-chain mint', 'wallet');
84
+ if (walletGuidance) {
85
+ console.error(walletGuidance);
86
+ return false;
87
+ }
81
88
  if (!fs.existsSync(inputPath)) {
82
89
  console.error(`Error: ZIP file not found: ${inputPath}`);
83
90
  return false;
84
91
  }
85
- const walletKey = (0, blockchain_1.getWalletPasskey)(cliWalletKey, true);
92
+ const creds = (0, bootstrap_1.readCliConnectionCredentials)();
93
+ const walletKey = cliWalletKey || creds.walletKey;
86
94
  if (!walletKey) {
95
+ console.error('Error: No wallet key in connection store. Run: neozip connect');
87
96
  return false;
88
97
  }
89
98
  const zip = new node_1.default();
90
99
  await zip.loadZipFile(inputPath);
91
100
  const entries = zip.getDirectory() || [];
92
- const metadataResult = (0, zipstamp_server_1.findMetadataEntry)(entries);
101
+ const metadataResult = (0, token_service_1.findMetadataEntry)(entries);
93
102
  if (!metadataResult) {
94
- console.error('No Zipstamp timestamp found in ZIP file');
103
+ console.error('No Token Service timestamp found in ZIP file');
95
104
  return false;
96
105
  }
97
106
  if (metadataResult.type !== 'confirmed') {
98
107
  console.error('Archive must have confirmed timestamp (TIMESTAMP.NZIP). Run "neozip upgrade <archive>" first.');
99
108
  return false;
100
109
  }
101
- let timestampMetadata = await (0, zipstamp_server_1.extractTimestampData)(zip, metadataResult.entry);
110
+ let timestampMetadata = await (0, token_service_1.extractTimestampData)(zip, metadataResult.entry);
102
111
  if (!timestampMetadata || !timestampMetadata.digest) {
103
112
  // Fallback for file-based ZIPs where zip.extract() may not work
104
113
  try {
@@ -123,14 +132,16 @@ async function runMintTimestampProof(options) {
123
132
  }
124
133
  const chainId = timestampMetadata.chainId ?? 84532;
125
134
  const batchId = timestampMetadata.batchId ?? undefined;
135
+ const serverUrl = (0, bootstrap_1.resolveVerifyServerUrl)(timestampMetadata.serverUrl);
136
+ const tsOpts = { debug, serverUrl };
126
137
  console.log('Checking NFT status...');
127
- const nftStatus = await (0, zipstamp_server_1.checkNFTStatus)(timestampMetadata.digest, chainId, { debug });
138
+ const nftStatus = await (0, token_service_1.checkNFTStatus)(timestampMetadata.digest, chainId, tsOpts);
128
139
  if (nftStatus.isMinted && nftStatus.tokenId) {
129
140
  console.log(`Digest already minted as token #${nftStatus.tokenId}`);
130
141
  console.log('Proceeding to create TOKEN.NZIP with existing token data...');
131
142
  }
132
143
  console.log('Preparing mint data...');
133
- const prepareResult = await (0, zipstamp_server_1.prepareMint)(timestampMetadata.digest, chainId, batchId, { debug });
144
+ const prepareResult = await (0, token_service_1.prepareMint)(timestampMetadata.digest, chainId, batchId, tsOpts);
134
145
  if (!prepareResult.success || !prepareResult.mintData) {
135
146
  console.error(`Error: ${prepareResult.error || 'Failed to prepare mint data'}`);
136
147
  return false;
@@ -159,6 +170,7 @@ async function runMintTimestampProof(options) {
159
170
  const mintFeeWei = BigInt(mintData.mintFeeWei);
160
171
  if (balance < mintFeeWei) {
161
172
  console.error(`Error: Insufficient balance. Required: ${mintData.mintFee} ETH`);
173
+ console.error(` ${(0, funding_1.formatLowBalanceFundingHint)()}`);
162
174
  return false;
163
175
  }
164
176
  const nftContract = new ethers_1.ethers.Contract(mintData.nftContractAddress, neozip_blockchain_1.NZIP_CONTRACT_ABI_V250, wallet);
@@ -197,14 +209,14 @@ async function runMintTimestampProof(options) {
197
209
  let existingTokenId;
198
210
  let existingOwner;
199
211
  let existingBlockNumber;
200
- const existingStatus = await (0, zipstamp_server_1.checkNFTStatus)(timestampMetadata.digest, chainId, { debug });
212
+ const existingStatus = await (0, token_service_1.checkNFTStatus)(timestampMetadata.digest, chainId, tsOpts);
201
213
  if (existingStatus.isMinted && existingStatus.tokenId) {
202
214
  existingTokenId = existingStatus.tokenId;
203
215
  existingOwner = existingStatus.owner;
204
216
  existingBlockNumber = existingStatus.proofData?.batchBlockNumber;
205
217
  }
206
218
  if (!existingTokenId) {
207
- const verifyRes = await (0, zipstamp_server_1.verifyDigest)(timestampMetadata.digest, chainId, batchId ?? undefined, undefined, { debug });
219
+ const verifyRes = await (0, token_service_1.verifyDigest)(timestampMetadata.digest, chainId, batchId ?? undefined, undefined, tsOpts);
208
220
  if (verifyRes.verified && verifyRes.tokenId) {
209
221
  existingTokenId = verifyRes.tokenId;
210
222
  existingOwner = verifyRes.owner;
@@ -219,7 +231,7 @@ async function runMintTimestampProof(options) {
219
231
  console.log(`Using existing token #${tokenId}. Creating TOKEN.NZIP...`);
220
232
  }
221
233
  else {
222
- console.error('Mint failed: digest is already minted on-chain but token details could not be retrieved. Try the Zipstamp server or block explorer for this digest.');
234
+ console.error('Mint failed: digest is already minted on-chain but token details could not be retrieved. Try the Token Service or block explorer for this digest.');
223
235
  console.error(`Details: ${msg}`);
224
236
  return false;
225
237
  }
@@ -251,10 +263,10 @@ async function runMintTimestampProof(options) {
251
263
  batchTimestamp: mintData.batchTimestamp,
252
264
  registryAddress: mintData.registryAddress,
253
265
  nftContractAddress: mintData.nftContractAddress,
254
- serverUrl: (0, zipstamp_server_1.getZipStampServerUrl)(),
266
+ serverUrl: serverUrl ?? '',
255
267
  },
256
268
  };
257
- const metadataFiles = (0, zipstamp_server_1.getMetadataFileNames)();
269
+ const metadataFiles = (0, token_service_1.getMetadataFileNames)();
258
270
  const outPath = outputPath ?? inputPath.replace(/(\.nzip|\.zip)$/i, '-nft$1');
259
271
  const tempDir = path.dirname(outPath) || '.';
260
272
  const tempPath = path.join(tempDir, `.neozip-mint-${Date.now()}.tmp`);
@@ -286,7 +298,7 @@ async function runMintTimestampProof(options) {
286
298
  zipCopy.writeCentralDirectoryAndEOCD(destPath, allEntries, { zipComment: '' });
287
299
  fs.renameSync(destPath, outPath);
288
300
  console.log(`Output: ${outPath}`);
289
- // Summary matching Zipstamp verification style
301
+ // Summary matching Token Service verification style
290
302
  console.log('\nšŸ”— Mint complete:');
291
303
  console.log(' - Status: āœ… MINTED');
292
304
  console.log(' - Stamp type: NZIP-NFT (tokenized archive)');