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.
- package/AGENTS.md +93 -0
- package/CHANGELOG.md +117 -12
- package/DOCUMENTATION.md +33 -38
- package/README.md +137 -63
- package/dist/src/account/account-state.js +95 -0
- package/dist/src/account/format-account-status.js +62 -0
- package/dist/src/account/identity-provision.js +79 -0
- package/dist/src/account/identity-wrap.js +106 -0
- package/dist/src/account/profile-crypto.js +85 -0
- package/dist/src/account/profile-store.js +129 -0
- package/dist/src/account/require-account.js +32 -0
- package/dist/src/account/types.js +3 -0
- package/dist/src/account/wallet-evm.js +46 -0
- package/dist/src/account/wallet-setup.js +33 -0
- package/dist/src/archive/crypto-self.js +117 -0
- package/dist/src/archive/identity-key.js +217 -0
- package/dist/src/archive/recipient-lookup.js +61 -0
- package/dist/src/cli/output.js +100 -0
- package/dist/src/cli/params.js +122 -0
- package/dist/src/cli/schema.js +186 -0
- package/dist/src/cli/validate.js +119 -0
- package/dist/src/commands/mintTimestampProof.js +26 -14
- package/dist/src/config/ConfigSetup.js +82 -423
- package/dist/src/connect/command.js +364 -0
- package/dist/src/connection/bootstrap.js +50 -0
- package/dist/src/connection/cli-guidance.js +101 -0
- package/dist/src/connection/cli-prefs.js +180 -0
- package/dist/src/connection/cli-settings.js +140 -0
- package/dist/src/connection/cli-types.js +14 -0
- package/dist/src/connection/coordinator.js +83 -0
- package/dist/src/connection/credentials.js +33 -0
- package/dist/src/connection/crypto.js +96 -0
- package/dist/src/connection/dump.js +117 -0
- package/dist/src/connection/funding.js +187 -0
- package/dist/src/connection/incomplete-setup.js +89 -0
- package/dist/src/connection/interactive.js +871 -0
- package/dist/src/connection/legacy-profile-reader.js +87 -0
- package/dist/src/connection/magic-link.js +142 -0
- package/dist/src/connection/migrate.js +115 -0
- package/dist/src/connection/onboarding.js +616 -0
- package/dist/src/connection/origin.js +69 -0
- package/dist/src/connection/phase.js +101 -0
- package/dist/src/connection/phone.js +26 -0
- package/dist/src/connection/promote-active.js +56 -0
- package/dist/src/connection/reset.js +56 -0
- package/dist/src/connection/status-report.js +52 -0
- package/dist/src/connection/store.js +406 -0
- package/dist/src/connection/token-auth.js +44 -0
- package/dist/src/connection/types.js +3 -0
- package/dist/src/connection/wallet-json-migration.js +155 -0
- package/dist/src/connection/wallet-login.js +65 -0
- package/dist/src/connection/wallet-setup.js +83 -0
- package/dist/src/constants/wallet-identity.js +14 -0
- package/dist/src/exit-codes.js +54 -10
- package/dist/src/neolist.js +100 -10
- package/dist/src/neounzip.js +236 -65
- package/dist/src/neozip/blockchain.js +18 -18
- package/dist/src/neozip/createZip.js +118 -94
- package/dist/src/neozip/upgradeZip.js +14 -11
- package/dist/src/neozip.js +269 -91
- package/dist/src/skills/command.js +256 -0
- package/dist/src/skills/locate.js +99 -0
- package/dist/src/util/mask.js +34 -0
- package/dist/src/util/token-service-fetch.js +26 -0
- package/env.example +18 -85
- package/package.json +89 -73
- package/skills/neozip-connect/SKILL.md +95 -0
- package/skills/neozip-create/SKILL.md +57 -0
- package/skills/neozip-extract/SKILL.md +58 -0
- package/skills/neozip-legacy/SKILL.md +48 -0
- package/skills/neozip-list/SKILL.md +56 -0
- package/skills/neozip-shared/SKILL.md +60 -0
- package/dist/src/commands/verifyEmail.js +0 -146
- 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
|
|
51
|
+
const token_service_1 = require("neozip-blockchain/token-service");
|
|
52
52
|
const neozip_blockchain_1 = require("neozip-blockchain");
|
|
53
|
-
const
|
|
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
|
|
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,
|
|
101
|
+
const metadataResult = (0, token_service_1.findMetadataEntry)(entries);
|
|
93
102
|
if (!metadataResult) {
|
|
94
|
-
console.error('No
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
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:
|
|
266
|
+
serverUrl: serverUrl ?? '',
|
|
255
267
|
},
|
|
256
268
|
};
|
|
257
|
-
const metadataFiles = (0,
|
|
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
|
|
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)');
|