nansen-cli 1.45.0 → 2.0.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/CHANGELOG.md +172 -0
- package/README.md +158 -18
- package/docs/browser-login.md +117 -0
- package/package.json +11 -2
- package/scripts/postinstall.js +35 -30
- package/skills/nansen-agent-guide/SKILL.md +13 -2
- package/skills/nansen-alerts-webhook-listener/SKILL.md +5 -2
- package/skills/nansen-dca-tracker/SKILL.md +10 -2
- package/skills/nansen-defi-positions/SKILL.md +5 -2
- package/skills/nansen-exit-signals/SKILL.md +10 -2
- package/skills/nansen-fund-tracker/SKILL.md +10 -2
- package/skills/nansen-general-search/SKILL.md +10 -2
- package/skills/nansen-holder-analysis/SKILL.md +10 -2
- package/skills/nansen-limit-orders/SKILL.md +6 -3
- package/skills/nansen-perp-screener/SKILL.md +10 -2
- package/skills/nansen-perp-trader-profile/SKILL.md +10 -2
- package/skills/nansen-polymarket-deep-dive/SKILL.md +10 -2
- package/skills/nansen-polymarket-insider-scan/SKILL.md +10 -2
- package/skills/nansen-polymarket-trader-profile/SKILL.md +10 -2
- package/skills/nansen-portfolio-tracker/SKILL.md +10 -2
- package/skills/nansen-prediction-markets/SKILL.md +10 -2
- package/skills/nansen-sm-cross-chain-flows/SKILL.md +10 -2
- package/skills/nansen-smart-alerts/SKILL.md +9 -4
- package/skills/nansen-smart-money-alpha/SKILL.md +10 -2
- package/skills/nansen-smart-money-tracker/SKILL.md +10 -2
- package/skills/nansen-smart-money-trend/SKILL.md +10 -2
- package/skills/nansen-token-research/SKILL.md +10 -2
- package/skills/nansen-token-screener/SKILL.md +14 -4
- package/skills/nansen-token-transfer-analysis/SKILL.md +10 -2
- package/skills/nansen-trading/SKILL.md +27 -2
- package/skills/nansen-wallet-batch/SKILL.md +10 -2
- package/skills/nansen-wallet-clustering/SKILL.md +10 -2
- package/skills/nansen-wallet-deep-dive/SKILL.md +10 -2
- package/skills/nansen-wallet-keychain-migration/SKILL.md +23 -15
- package/skills/nansen-wallet-manager/SKILL.md +26 -10
- package/skills/nansen-wallet-profiler/SKILL.md +10 -2
- package/skills/nansen-web-fetcher/SKILL.md +5 -2
- package/skills/nansen-web-searcher/SKILL.md +5 -2
- package/src/api.js +319 -129
- package/src/auth-browser.js +16 -0
- package/src/auth-credentials.js +73 -0
- package/src/auth-device.js +242 -0
- package/src/auth-key-input.js +46 -0
- package/src/auth-login.js +90 -0
- package/src/auth-state.js +487 -0
- package/src/auth-store-native.js +20 -0
- package/src/auth-store-worker.js +64 -0
- package/src/auth-store.js +140 -0
- package/src/auto-paginate.js +272 -0
- package/src/bridge.js +309 -85
- package/src/cache-inspect.js +345 -0
- package/src/chain-ids.js +1 -2
- package/src/cli.js +779 -286
- package/src/commands/agent.js +20 -9
- package/src/commands/alerts.js +1 -1
- package/src/commands/completion.js +2 -15
- package/src/commands/mcp.js +22 -20
- package/src/commands/research.js +4 -2
- package/src/cost-cache.js +16 -2
- package/src/debug.js +348 -0
- package/src/doctor.js +22 -45
- package/src/ens.js +3 -1
- package/src/execute-guard.js +116 -0
- package/src/hl-action.js +41 -13
- package/src/limit-order.js +9 -1
- package/src/mcp-client-config.js +169 -0
- package/src/mcp-client-config.json +17 -0
- package/src/mcp-verify.js +6 -5
- package/src/perp.js +61 -9
- package/src/privy.js +12 -12
- package/src/query-options.js +38 -6
- package/src/response-meta.js +57 -2
- package/src/rpc-urls.js +9 -11
- package/src/schema.json +309 -30
- package/src/semver.js +23 -4
- package/src/swap-simulation.js +35 -30
- package/src/telemetry.js +20 -0
- package/src/trading.js +806 -40
- package/src/transfer.js +75 -9
- package/src/update-check.js +9 -1
- package/src/wallet.js +240 -20
- package/src/walletconnect-trading.js +29 -8
- package/src/walletconnect-x402.js +9 -5
- package/src/x402-svm.js +123 -64
- package/src/x402.js +46 -14
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache inspection and invalidation — the read and clear side of the caches
|
|
3
|
+
* the CLI already keeps under ~/.nansen. This module owns no cache of its own
|
|
4
|
+
* and never writes an entry; it only reports and deletes.
|
|
5
|
+
*
|
|
6
|
+
* responses ~/.nansen/cache/<digest>.json (api.js) TTL --cache-ttl, default 300s
|
|
7
|
+
* cost-map ~/.nansen/cost-map.json (cost-cache.js) TTL 24h
|
|
8
|
+
* update-check ~/.nansen/update-check.json (update-check.js) TTL 24h
|
|
9
|
+
*
|
|
10
|
+
* Privacy: stats extract each cache's timestamp metadata and never retain or
|
|
11
|
+
* render payload fields. Response cache filenames are digests of the request,
|
|
12
|
+
* and they are not printed either.
|
|
13
|
+
*
|
|
14
|
+
* Safety: clearing only ever unlinks regular files at the three paths above —
|
|
15
|
+
* `.json` entries directly inside the response cache directory, and the two
|
|
16
|
+
* named files. Directories and symlinks are skipped rather than followed, so a
|
|
17
|
+
* clear cannot reach outside the cache it was pointed at. Everything else under
|
|
18
|
+
* ~/.nansen (config.json, wallets/, quotes/, telemetry-id, saved auth) is never
|
|
19
|
+
* read or deleted by the inspector. CLI startup loads config separately.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import fs from 'fs';
|
|
23
|
+
import path from 'path';
|
|
24
|
+
|
|
25
|
+
import { getCacheDir, getConfigDir, DEFAULT_CACHE_TTL, NansenError, ErrorCode } from './api.js';
|
|
26
|
+
import { getCostMapFile, COST_MAP_TTL_MS } from './cost-cache.js';
|
|
27
|
+
import { getUpdateCheckFile, UPDATE_CHECK_TTL_MS } from './update-check.js';
|
|
28
|
+
|
|
29
|
+
const SECOND = 1000;
|
|
30
|
+
const RESPONSE_ENTRY = /^[0-9a-f]{64}\.json$/;
|
|
31
|
+
|
|
32
|
+
/** Cache names, in report order. */
|
|
33
|
+
export const CACHE_NAMES = ['responses', 'cost-map', 'update-check'];
|
|
34
|
+
|
|
35
|
+
/** Accepted `nansen cache clear` targets. */
|
|
36
|
+
export const CLEAR_TARGETS = [...CACHE_NAMES, 'all'];
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Descriptors for the known caches. Built per call rather than once at import
|
|
40
|
+
* so the paths always come from the modules that own them.
|
|
41
|
+
*/
|
|
42
|
+
function namespaces() {
|
|
43
|
+
return [
|
|
44
|
+
{
|
|
45
|
+
name: 'responses',
|
|
46
|
+
label: 'response cache',
|
|
47
|
+
description: 'API responses saved when --cache is passed',
|
|
48
|
+
kind: 'dir',
|
|
49
|
+
dirOrFile: getCacheDir(),
|
|
50
|
+
// The effective TTL is chosen per invocation by --cache-ttl.
|
|
51
|
+
ttlSeconds: null,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'cost-map',
|
|
55
|
+
label: 'credit cost map',
|
|
56
|
+
description: 'per-endpoint credit costs used to report what a call cost',
|
|
57
|
+
kind: 'file',
|
|
58
|
+
dirOrFile: getCostMapFile(),
|
|
59
|
+
timestampField: 'fetchedAt',
|
|
60
|
+
ttlSeconds: COST_MAP_TTL_MS / SECOND,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'update-check',
|
|
64
|
+
label: 'update check',
|
|
65
|
+
description: 'latest published CLI version, for the upgrade notice',
|
|
66
|
+
kind: 'file',
|
|
67
|
+
dirOrFile: getUpdateCheckFile(),
|
|
68
|
+
timestampField: 'checkedAt',
|
|
69
|
+
ttlSeconds: UPDATE_CHECK_TTL_MS / SECOND,
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Regular digest-named `.json` files directly inside `dir`, with size and,
|
|
76
|
+
* when requested, timestamp metadata. A missing directory is an empty cache,
|
|
77
|
+
* not an error. lstat (not stat) means symlinked entries are skipped; the
|
|
78
|
+
* directory itself is also rejected if it is a symlink.
|
|
79
|
+
*/
|
|
80
|
+
function fsError(action, target, error) {
|
|
81
|
+
const detail = error?.code ? `[${error.code}] ${error.message}` : String(error);
|
|
82
|
+
return new Error(`Cannot ${action} cache path ${target}: ${detail}`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function readTimestamp(file, field) {
|
|
86
|
+
let fd;
|
|
87
|
+
let raw;
|
|
88
|
+
try {
|
|
89
|
+
// O_NOFOLLOW prevents a final-component symlink replacement after lstat.
|
|
90
|
+
// Windows does not define it. There, only the earlier lstat check applies;
|
|
91
|
+
// opening with O_RDONLY does not prevent this race.
|
|
92
|
+
const flags = fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW ?? 0);
|
|
93
|
+
fd = fs.openSync(file, flags);
|
|
94
|
+
if (!fs.fstatSync(fd).isFile()) return { raced: true };
|
|
95
|
+
raw = fs.readFileSync(fd, 'utf8');
|
|
96
|
+
} catch (error) {
|
|
97
|
+
if (error?.code === 'ENOENT' || error?.code === 'ELOOP') return { raced: true };
|
|
98
|
+
throw fsError('read', file, error);
|
|
99
|
+
} finally {
|
|
100
|
+
if (fd !== undefined) fs.closeSync(fd);
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
const value = JSON.parse(raw)?.[field];
|
|
104
|
+
// Auxiliary cache readers treat a zero timestamp as missing metadata.
|
|
105
|
+
const valid = Number.isFinite(value) && (field === 'timestamp' || value !== 0);
|
|
106
|
+
return { timestampMs: valid ? value : null };
|
|
107
|
+
} catch {
|
|
108
|
+
// A corrupt cache is dead to its owner and therefore already expired.
|
|
109
|
+
return { timestampMs: null };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function listDirEntries(dir, { readMetadata = false } = {}) {
|
|
114
|
+
let names;
|
|
115
|
+
try {
|
|
116
|
+
const dirStat = fs.lstatSync(dir);
|
|
117
|
+
if (dirStat.isSymbolicLink()) {
|
|
118
|
+
throw new Error(`Refusing to use symlinked response cache directory: ${dir}`);
|
|
119
|
+
}
|
|
120
|
+
if (!dirStat.isDirectory()) {
|
|
121
|
+
throw new Error(`Response cache path is not a directory: ${dir}`);
|
|
122
|
+
}
|
|
123
|
+
names = fs.readdirSync(dir);
|
|
124
|
+
} catch (error) {
|
|
125
|
+
if (error?.code === 'ENOENT') return [];
|
|
126
|
+
if (error?.message?.startsWith('Refusing') || error?.message?.startsWith('Response cache')) throw error;
|
|
127
|
+
throw fsError('list', dir, error);
|
|
128
|
+
}
|
|
129
|
+
const entries = [];
|
|
130
|
+
for (const name of names) {
|
|
131
|
+
// `name` comes from this directory's own listing, not from a caller. The
|
|
132
|
+
// strict digest shape both identifies files written by api.js and prevents
|
|
133
|
+
// path separators or traversal segments from reaching path.join(). The
|
|
134
|
+
// lstat below then rejects a final-component symlink before any read/delete.
|
|
135
|
+
if (!RESPONSE_ENTRY.test(name)) continue;
|
|
136
|
+
const file = path.join(dir, name);
|
|
137
|
+
try {
|
|
138
|
+
const stat = fs.lstatSync(file);
|
|
139
|
+
if (!stat.isFile()) continue;
|
|
140
|
+
const metadata = readMetadata ? readTimestamp(file, 'timestamp') : {};
|
|
141
|
+
if (metadata.raced) continue;
|
|
142
|
+
entries.push({ file, bytes: stat.size, ...metadata });
|
|
143
|
+
} catch (error) {
|
|
144
|
+
if (error?.code === 'ENOENT') continue;
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return entries;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** The single file of a one-file cache, or nothing if it is absent. */
|
|
152
|
+
function listFileEntry(file, timestampField, { readMetadata = false } = {}) {
|
|
153
|
+
try {
|
|
154
|
+
const stat = fs.lstatSync(file);
|
|
155
|
+
if (!stat.isFile()) return [];
|
|
156
|
+
const metadata = readMetadata ? readTimestamp(file, timestampField) : {};
|
|
157
|
+
if (metadata.raced) return [];
|
|
158
|
+
return [{ file, bytes: stat.size, ...metadata }];
|
|
159
|
+
} catch (error) {
|
|
160
|
+
if (error?.code === 'ENOENT') return [];
|
|
161
|
+
throw error;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function listEntries(ns, options) {
|
|
166
|
+
return ns.kind === 'dir'
|
|
167
|
+
? listDirEntries(ns.dirOrFile, options)
|
|
168
|
+
: listFileEntry(ns.dirOrFile, ns.timestampField, options);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* What every cache holds right now: entry count, bytes on disk, the age of the
|
|
173
|
+
* oldest and newest entry, the effective TTL, and how many entries are already
|
|
174
|
+
* past it. `responseTtlSeconds` is the TTL this invocation would apply
|
|
175
|
+
* (--cache-ttl), so the expiry count matches what the next call would see.
|
|
176
|
+
*
|
|
177
|
+
* @param {object} [options]
|
|
178
|
+
* @param {number} [options.responseTtlSeconds] Non-negative safe integer seconds.
|
|
179
|
+
* Invalid TTL values use DEFAULT_CACHE_TTL. Zero disables response cache reads.
|
|
180
|
+
* @param {number} [options.now] Safe integer milliseconds since the Unix epoch.
|
|
181
|
+
* Invalid clock values throw INVALID_PARAMS before any file access.
|
|
182
|
+
*/
|
|
183
|
+
export function collectCacheStats({ responseTtlSeconds = DEFAULT_CACHE_TTL, now = Date.now() } = {}) {
|
|
184
|
+
if (!Number.isSafeInteger(responseTtlSeconds) || responseTtlSeconds < 0) {
|
|
185
|
+
responseTtlSeconds = DEFAULT_CACHE_TTL;
|
|
186
|
+
}
|
|
187
|
+
if (!Number.isSafeInteger(now)) {
|
|
188
|
+
throw new NansenError('now must be a safe integer timestamp in milliseconds.', ErrorCode.INVALID_PARAMS);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const caches = [];
|
|
192
|
+
let totalEntries = 0;
|
|
193
|
+
let totalBytes = 0;
|
|
194
|
+
|
|
195
|
+
for (const ns of namespaces()) {
|
|
196
|
+
const entries = listEntries(ns, { readMetadata: true });
|
|
197
|
+
const ttlSeconds = ns.name === 'responses' ? responseTtlSeconds : ns.ttlSeconds;
|
|
198
|
+
// A file stamped in the future (clock skew) is 0s old, never negative.
|
|
199
|
+
const rawAges = entries.map(e => e.timestampMs == null ? null : Math.max(0, (now - e.timestampMs) / SECOND));
|
|
200
|
+
let oldestAge = null;
|
|
201
|
+
let newestAge = null;
|
|
202
|
+
for (const age of rawAges) {
|
|
203
|
+
if (age == null) continue;
|
|
204
|
+
const roundedAge = Math.round(age);
|
|
205
|
+
oldestAge = oldestAge == null ? roundedAge : Math.max(oldestAge, roundedAge);
|
|
206
|
+
newestAge = newestAge == null ? roundedAge : Math.min(newestAge, roundedAge);
|
|
207
|
+
}
|
|
208
|
+
const bytes = entries.reduce((sum, e) => sum + e.bytes, 0);
|
|
209
|
+
|
|
210
|
+
totalEntries += entries.length;
|
|
211
|
+
totalBytes += bytes;
|
|
212
|
+
|
|
213
|
+
caches.push({
|
|
214
|
+
name: ns.name,
|
|
215
|
+
description: ns.description,
|
|
216
|
+
path: ns.dirOrFile,
|
|
217
|
+
entries: entries.length,
|
|
218
|
+
bytes,
|
|
219
|
+
ttl_seconds: ttlSeconds,
|
|
220
|
+
oldest_age_seconds: oldestAge,
|
|
221
|
+
newest_age_seconds: newestAge,
|
|
222
|
+
// Response reads allow an age equal to the TTL. Auxiliary caches refresh
|
|
223
|
+
// at that boundary. A response TTL of zero disables all cache reads.
|
|
224
|
+
expired_entries: rawAges.filter(age => (
|
|
225
|
+
age == null || ttlSeconds === 0 || (ns.kind === 'file' ? age >= ttlSeconds : age > ttlSeconds)
|
|
226
|
+
)).length,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return {
|
|
231
|
+
config_dir: getConfigDir(),
|
|
232
|
+
caches,
|
|
233
|
+
total_entries: totalEntries,
|
|
234
|
+
total_bytes: totalBytes,
|
|
235
|
+
// Hits and misses are decided in memory and nothing records them on disk,
|
|
236
|
+
// so there is no hit rate to report. Reported explicitly so the absence
|
|
237
|
+
// reads as a known fact rather than a missing field.
|
|
238
|
+
hit_miss_recorded: false,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Delete one cache, or all of them. Returns exactly what was removed so the
|
|
244
|
+
* caller can print it. An unknown target removes nothing.
|
|
245
|
+
*/
|
|
246
|
+
export function clearCaches(target) {
|
|
247
|
+
if (!CLEAR_TARGETS.includes(target)) {
|
|
248
|
+
throw new NansenError(
|
|
249
|
+
`Unknown cache clear target: ${target}. Use one of: ${CLEAR_TARGETS.join(', ')}`,
|
|
250
|
+
ErrorCode.INVALID_PARAMS,
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const wanted = target === 'all' ? CACHE_NAMES : [target];
|
|
255
|
+
const removed = [];
|
|
256
|
+
let totalEntries = 0;
|
|
257
|
+
let totalBytes = 0;
|
|
258
|
+
|
|
259
|
+
for (const ns of namespaces()) {
|
|
260
|
+
if (!wanted.includes(ns.name)) continue;
|
|
261
|
+
let entries = 0;
|
|
262
|
+
let bytes = 0;
|
|
263
|
+
for (const entry of listEntries(ns, { readMetadata: false })) {
|
|
264
|
+
try {
|
|
265
|
+
fs.unlinkSync(entry.file);
|
|
266
|
+
} catch (error) {
|
|
267
|
+
if (error?.code === 'ENOENT') continue;
|
|
268
|
+
throw fsError('delete', entry.file, error);
|
|
269
|
+
}
|
|
270
|
+
entries += 1;
|
|
271
|
+
bytes += entry.bytes;
|
|
272
|
+
}
|
|
273
|
+
totalEntries += entries;
|
|
274
|
+
totalBytes += bytes;
|
|
275
|
+
removed.push({ name: ns.name, label: ns.label, path: ns.dirOrFile, entries, bytes });
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return { target, removed, total_entries: totalEntries, total_bytes: totalBytes };
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// ============= Rendering =============
|
|
282
|
+
|
|
283
|
+
export function formatBytes(bytes) {
|
|
284
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
285
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
286
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export function formatAge(seconds) {
|
|
290
|
+
if (seconds == null) return '-';
|
|
291
|
+
if (seconds < 60) return `${seconds}s`;
|
|
292
|
+
if (seconds < 3600) return `${Math.round(seconds / 60)}m`;
|
|
293
|
+
// Hours up to two days: a 24h TTL reads better as "24h" than as "1d".
|
|
294
|
+
if (seconds < 172800) return `${Math.round(seconds / 3600)}h`;
|
|
295
|
+
return `${Math.round(seconds / 86400)}d`;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function entryCount(count) {
|
|
299
|
+
return `${count} ${count === 1 ? 'entry' : 'entries'}`;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Human-readable stats. Deliberately aggregate-only: no filenames, no endpoint
|
|
304
|
+
* paths, no parameters, nothing read out of a cached payload.
|
|
305
|
+
*/
|
|
306
|
+
export function formatCacheStats(stats) {
|
|
307
|
+
const lines = ['Cache stats', ''];
|
|
308
|
+
|
|
309
|
+
for (const cache of stats.caches) {
|
|
310
|
+
const cols = [
|
|
311
|
+
cache.name.padEnd(13),
|
|
312
|
+
entryCount(cache.entries).padStart(10),
|
|
313
|
+
formatBytes(cache.bytes).padStart(9),
|
|
314
|
+
`TTL ${formatAge(cache.ttl_seconds)}`.padEnd(8),
|
|
315
|
+
];
|
|
316
|
+
if (cache.entries > 0) {
|
|
317
|
+
cols.push(`oldest ${formatAge(cache.oldest_age_seconds)}`.padEnd(12));
|
|
318
|
+
cols.push(`newest ${formatAge(cache.newest_age_seconds)}`.padEnd(12));
|
|
319
|
+
if (cache.expired_entries > 0) cols.push(`${cache.expired_entries} expired`);
|
|
320
|
+
}
|
|
321
|
+
lines.push(` ${cols.join(' ').trimEnd()}`);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
lines.push('');
|
|
325
|
+
lines.push(` Total: ${entryCount(stats.total_entries)}, ${formatBytes(stats.total_bytes)} under ${stats.config_dir}`);
|
|
326
|
+
lines.push(' Hits and misses are not recorded on disk, so there is no hit rate to report.');
|
|
327
|
+
lines.push('');
|
|
328
|
+
lines.push(' Caching is off unless --cache is passed. --no-cache (or NANSEN_NO_CACHE=1) bypasses it.');
|
|
329
|
+
lines.push(` Clear with: nansen cache clear [${CLEAR_TARGETS.join('|')}]`);
|
|
330
|
+
|
|
331
|
+
return lines.join('\n');
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** What a clear actually removed, cache by cache. */
|
|
335
|
+
export function formatCacheClear(result) {
|
|
336
|
+
const lines = result.removed.map(
|
|
337
|
+
cache => cache.entries > 0
|
|
338
|
+
? `✓ Cleared ${entryCount(cache.entries)} (${formatBytes(cache.bytes)}) from the ${cache.label}\n ${cache.path}`
|
|
339
|
+
: `ℹ No entries to clear from the ${cache.label}\n ${cache.path}`
|
|
340
|
+
);
|
|
341
|
+
if (result.removed.length > 1) {
|
|
342
|
+
lines.push(` Total: ${entryCount(result.total_entries)}, ${formatBytes(result.total_bytes)}`);
|
|
343
|
+
}
|
|
344
|
+
return lines.join('\n');
|
|
345
|
+
}
|
package/src/chain-ids.js
CHANGED
|
@@ -19,7 +19,6 @@ export const EVM_CHAIN_IDS = {
|
|
|
19
19
|
avalanche: 43114,
|
|
20
20
|
bnb: 56,
|
|
21
21
|
linea: 59144,
|
|
22
|
-
scroll: 534352,
|
|
23
22
|
mantle: 5000,
|
|
24
23
|
};
|
|
25
24
|
|
|
@@ -30,6 +29,6 @@ export const EVM_CHAIN_IDS = {
|
|
|
30
29
|
*/
|
|
31
30
|
export const EVM_CHAINS = [
|
|
32
31
|
'ethereum', 'arbitrum', 'base', 'bnb', 'polygon', 'optimism',
|
|
33
|
-
'avalanche', 'linea', '
|
|
32
|
+
'avalanche', 'linea', 'mantle',
|
|
34
33
|
'sei', 'plasma', 'sonic', 'monad', 'hyperevm', 'iotaevm',
|
|
35
34
|
];
|