nirium-cli 3.1.0 → 3.2.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 (3) hide show
  1. package/README.md +11 -10
  2. package/bin/nirium.js +25 -8
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -288,7 +288,11 @@ Signatures are accepted as base64 or hex, raw ed25519 or SEP-53
288
288
  short backoff first - a fresh pin can take a moment to propagate, so a
289
289
  404 there doesn't mean the CID is wrong, just not there *yet*. Any other
290
290
  failure (a real error, or a timed-out request) moves straight to the
291
- next gateway instead, since retrying the same one won't help:
291
+ next gateway instead, since retrying the same one won't help.
292
+
293
+ With no `--gateway`, it tries Filebase's dedicated gateway, then Pinata,
294
+ then `ipfs.io`, then `dweb.link`. Shared public gateways often answer
295
+ `429` under load, so the dedicated one goes first:
292
296
 
293
297
  ```bash
294
298
  nirium verify <cid> --gateway https://gateway.pinata.cloud --gateway https://ipfs.io --retries 3
@@ -296,7 +300,7 @@ nirium verify <cid> --gateway https://gateway.pinata.cloud --gateway https://ipf
296
300
 
297
301
  | Option | Purpose | Default |
298
302
  |---|---|---|
299
- | `-g, --gateway <url>` | IPFS gateway to fetch from - repeat for fallbacks | `https://gateway.pinata.cloud` |
303
+ | `-g, --gateway <url>` | IPFS gateway to fetch from - repeat for fallbacks | `nirium.myfilebase.com`, then `gateway.pinata.cloud`, `ipfs.io`, `dweb.link` |
300
304
  | `--retries <n>` | retries per gateway on a 404, with backoff | `2` |
301
305
  | `--timeout <ms>` | per-request timeout | `8000` |
302
306
  | `--json` | machine-readable result | off |
@@ -337,15 +341,12 @@ receipts by gateway, and anchor counts for the period. `report export
337
341
  <type>` pulls the underlying rows:
338
342
 
339
343
  - Without `--csv`, rows print one per line on stdout. For `export
340
- anchors` specifically, that line is **just the CID** - nothing else -
341
- so it pipes straight into `nirium verify`:
342
-
343
- ```bash
344
- nirium report export anchors --from 2026-10-01 | xargs -n1 nirium verify
345
- ```
344
+ anchors`, each line is the anchor's date and network, tab-separated.
345
+ There is no CID: the public Reporting export doesn't return them (an
346
+ anchor's CID belongs to whoever made it). If you anchored something,
347
+ you already have its CID - check it with `nirium verify <cid>`.
346
348
 
347
- The row count and disclaimer print to **stderr**, not stdout, so they
348
- never end up in that pipe.
349
+ The row count and disclaimer print to **stderr**, not stdout.
349
350
  - With `--csv <file>`, the server's CSV is written to that file instead
350
351
  (nothing on stdout but a confirmation).
351
352
  - `--json` prints the full response (`type`, `period`, `rowCount`,
package/bin/nirium.js CHANGED
@@ -158,11 +158,22 @@ program
158
158
  }
159
159
  });
160
160
 
161
+ // Tried in order when no --gateway is given. ipfs.io and dweb.link answer 429
162
+ // for healthy CIDs under load (#185), and Pinata serves our pins but often
163
+ // takes 5-7s, so a dedicated gateway goes first. Same chain as the
164
+ // verify-audit-cid Action (#259), plus Pinata.
165
+ const DEFAULT_GATEWAYS = [
166
+ 'https://nirium.myfilebase.com',
167
+ 'https://gateway.pinata.cloud',
168
+ 'https://ipfs.io',
169
+ 'https://dweb.link',
170
+ ];
171
+
161
172
  // --- COMMAND: verify ---
162
173
  program
163
174
  .command('verify')
164
175
  .argument('<cid>', 'IPFS Content Identifier (CID) of the audit document')
165
- .option('-g, --gateway <url>', 'IPFS gateway URL - repeatable, tried in order as fallbacks', (val, prev) => [...(prev || []), val], [])
176
+ .option('-g, --gateway <url>', 'IPFS gateway URL - repeatable, tried in order as fallbacks (default: Filebase, Pinata, ipfs.io, dweb.link)', (val, prev) => [...(prev || []), val], [])
166
177
  .option('--retries <n>', 'Retries per gateway on a 404 (content may not be propagated yet), with backoff', '2')
167
178
  .option('--timeout <ms>', 'Per-request timeout in milliseconds', '8000')
168
179
  .option('--json', 'Output result as JSON')
@@ -191,7 +202,7 @@ program
191
202
  process.exit(1);
192
203
  }
193
204
 
194
- const gateways = options.gateway.length > 0 ? options.gateway : ['https://gateway.pinata.cloud'];
205
+ const gateways = options.gateway.length > 0 ? options.gateway : DEFAULT_GATEWAYS;
195
206
  const result = await fetchAndVerifyCid(cid, gateways, globalThis.fetch, { expectedHash, retries, timeoutMs });
196
207
  if (options.json) {
197
208
  console.log(JSON.stringify(result, null, 2));
@@ -2004,7 +2015,12 @@ async function executeReportSummaryCommand(options) {
2004
2015
  console.log(` ${asset}: ${amount}`);
2005
2016
  }
2006
2017
  console.log(` Payments: ${data.payments?.count ?? 0} receipt(s), ${data.payments?.totalUsdc ?? '0'} USDC total`);
2007
- console.log(` Anchors: ${data.anchors?.count ?? 0} (latest: ${data.anchors?.latestCid || 'none'})`);
2018
+ // Nodes since 8 Nov 2026 send lastAnchoredAt instead of latestCid (the latest
2019
+ // anchor is usually someone else's evidence). Older nodes still send latestCid.
2020
+ const lastAnchor = data.anchors?.lastAnchoredAt
2021
+ ? `last: ${String(data.anchors.lastAnchoredAt).slice(0, 10)}`
2022
+ : `latest: ${data.anchors?.latestCid || 'none'}`;
2023
+ console.log(` Anchors: ${data.anchors?.count ?? 0} (${lastAnchor})`);
2008
2024
  if (Array.isArray(data.warnings) && data.warnings.length > 0) {
2009
2025
  console.log(' ⚠ Warnings:');
2010
2026
  for (const w of data.warnings) console.log(` - ${w}`);
@@ -2079,12 +2095,13 @@ async function executeReportExportCommand(type, options) {
2079
2095
  return;
2080
2096
  }
2081
2097
 
2082
- // `export anchors` prints exactly one CID per line on stdout - nothing
2083
- // else - so it pipes straight into `nirium verify` (xargs -n1 or a
2084
- // while-read loop). Row count and the disclaimer go to stderr instead
2085
- // of stdout for the same reason: stdout must stay pure for piping.
2098
+ // `export anchors` prints one line per anchor: when and on which network,
2099
+ // tab-separated. No CID: the public Reporting export stopped returning them
2100
+ // on 8 Nov 2026 (an anchor's CID belongs to whoever made it), and this never
2101
+ // prints one even if an older node still sends it. Row count and the
2102
+ // disclaimer go to stderr so stdout stays clean for piping.
2086
2103
  for (const row of data.rows || []) {
2087
- console.log(type === 'anchors' ? (row.cid || '') : JSON.stringify(row));
2104
+ console.log(type === 'anchors' ? `${row.anchored_at || ''}\t${row.network || ''}` : JSON.stringify(row));
2088
2105
  }
2089
2106
  console.error(`# ${data.rowCount ?? (data.rows || []).length} row(s). ${data.disclaimer || ''}`);
2090
2107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nirium-cli",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "Nirium CLI \u2014 scaffold Stellar agent projects and check agent status",
5
5
  "main": "bin/nirium.js",
6
6
  "type": "module",