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.
Files changed (85) hide show
  1. package/CHANGELOG.md +172 -0
  2. package/README.md +158 -18
  3. package/docs/browser-login.md +117 -0
  4. package/package.json +11 -2
  5. package/scripts/postinstall.js +35 -30
  6. package/skills/nansen-agent-guide/SKILL.md +13 -2
  7. package/skills/nansen-alerts-webhook-listener/SKILL.md +5 -2
  8. package/skills/nansen-dca-tracker/SKILL.md +10 -2
  9. package/skills/nansen-defi-positions/SKILL.md +5 -2
  10. package/skills/nansen-exit-signals/SKILL.md +10 -2
  11. package/skills/nansen-fund-tracker/SKILL.md +10 -2
  12. package/skills/nansen-general-search/SKILL.md +10 -2
  13. package/skills/nansen-holder-analysis/SKILL.md +10 -2
  14. package/skills/nansen-limit-orders/SKILL.md +6 -3
  15. package/skills/nansen-perp-screener/SKILL.md +10 -2
  16. package/skills/nansen-perp-trader-profile/SKILL.md +10 -2
  17. package/skills/nansen-polymarket-deep-dive/SKILL.md +10 -2
  18. package/skills/nansen-polymarket-insider-scan/SKILL.md +10 -2
  19. package/skills/nansen-polymarket-trader-profile/SKILL.md +10 -2
  20. package/skills/nansen-portfolio-tracker/SKILL.md +10 -2
  21. package/skills/nansen-prediction-markets/SKILL.md +10 -2
  22. package/skills/nansen-sm-cross-chain-flows/SKILL.md +10 -2
  23. package/skills/nansen-smart-alerts/SKILL.md +9 -4
  24. package/skills/nansen-smart-money-alpha/SKILL.md +10 -2
  25. package/skills/nansen-smart-money-tracker/SKILL.md +10 -2
  26. package/skills/nansen-smart-money-trend/SKILL.md +10 -2
  27. package/skills/nansen-token-research/SKILL.md +10 -2
  28. package/skills/nansen-token-screener/SKILL.md +14 -4
  29. package/skills/nansen-token-transfer-analysis/SKILL.md +10 -2
  30. package/skills/nansen-trading/SKILL.md +27 -2
  31. package/skills/nansen-wallet-batch/SKILL.md +10 -2
  32. package/skills/nansen-wallet-clustering/SKILL.md +10 -2
  33. package/skills/nansen-wallet-deep-dive/SKILL.md +10 -2
  34. package/skills/nansen-wallet-keychain-migration/SKILL.md +23 -15
  35. package/skills/nansen-wallet-manager/SKILL.md +26 -10
  36. package/skills/nansen-wallet-profiler/SKILL.md +10 -2
  37. package/skills/nansen-web-fetcher/SKILL.md +5 -2
  38. package/skills/nansen-web-searcher/SKILL.md +5 -2
  39. package/src/api.js +319 -129
  40. package/src/auth-browser.js +16 -0
  41. package/src/auth-credentials.js +73 -0
  42. package/src/auth-device.js +242 -0
  43. package/src/auth-key-input.js +46 -0
  44. package/src/auth-login.js +90 -0
  45. package/src/auth-state.js +487 -0
  46. package/src/auth-store-native.js +20 -0
  47. package/src/auth-store-worker.js +64 -0
  48. package/src/auth-store.js +140 -0
  49. package/src/auto-paginate.js +272 -0
  50. package/src/bridge.js +309 -85
  51. package/src/cache-inspect.js +345 -0
  52. package/src/chain-ids.js +1 -2
  53. package/src/cli.js +779 -286
  54. package/src/commands/agent.js +20 -9
  55. package/src/commands/alerts.js +1 -1
  56. package/src/commands/completion.js +2 -15
  57. package/src/commands/mcp.js +22 -20
  58. package/src/commands/research.js +4 -2
  59. package/src/cost-cache.js +16 -2
  60. package/src/debug.js +348 -0
  61. package/src/doctor.js +22 -45
  62. package/src/ens.js +3 -1
  63. package/src/execute-guard.js +116 -0
  64. package/src/hl-action.js +41 -13
  65. package/src/limit-order.js +9 -1
  66. package/src/mcp-client-config.js +169 -0
  67. package/src/mcp-client-config.json +17 -0
  68. package/src/mcp-verify.js +6 -5
  69. package/src/perp.js +61 -9
  70. package/src/privy.js +12 -12
  71. package/src/query-options.js +38 -6
  72. package/src/response-meta.js +57 -2
  73. package/src/rpc-urls.js +9 -11
  74. package/src/schema.json +309 -30
  75. package/src/semver.js +23 -4
  76. package/src/swap-simulation.js +35 -30
  77. package/src/telemetry.js +20 -0
  78. package/src/trading.js +806 -40
  79. package/src/transfer.js +75 -9
  80. package/src/update-check.js +9 -1
  81. package/src/wallet.js +240 -20
  82. package/src/walletconnect-trading.js +29 -8
  83. package/src/walletconnect-x402.js +9 -5
  84. package/src/x402-svm.js +123 -64
  85. package/src/x402.js +46 -14
@@ -4,8 +4,6 @@ description: Wallet management — create (local or Privy server-side), list, sh
4
4
  metadata:
5
5
  openclaw:
6
6
  requires:
7
- env:
8
- - NANSEN_API_KEY
9
7
  bins:
10
8
  - nansen
11
9
  primaryEnv: NANSEN_API_KEY
@@ -15,21 +13,25 @@ metadata:
15
13
  bins: [nansen]
16
14
  allowed-tools: Bash(nansen:*)
17
15
  ---
16
+ ## Authentication
17
+
18
+ Nansen account API calls accept a selected `nansen:api` browser session or conventional API key with the same permissions. `NANSEN_API_KEY` takes precedence; optional `primaryEnv` preserves configured-key injection. Run `nansen auth status` for offline selection. Cached access expiry alone permits automatic renewal during an authorized task. Stop on anonymous selection, invalid state, blocked/uncertain renewal or actual auth failure; never drop a credential or fall back to anonymous x402 payment. Browser login does not grant wallet signing, privileged service identity or a persistent MCP integration key. Preserve all confirmation, signing, sanctions and geographic checks below. Browser rollout acceptance is still pending.
19
+
20
+
18
21
 
19
22
  # Wallet
20
23
 
21
24
  ## Auth Setup
22
25
 
23
- ```bash
24
- # Save API key interactively
25
- nansen login --human
26
- # Or use NANSEN_API_KEY after provisioning it through your environment/secret manager
27
- nansen login
26
+ Use a selected nansen:api browser session or conventional API key for Nansen account API calls. Agents should inject `NANSEN_API_KEY` through their environment or secret manager and use commands directly; no login is needed to persist it. Human terminal users can use explicit `nansen login --human` for legacy key setup. With an already injected environment key, that explicit mode saves it without prompting and requires the native auth lock binding.
28
27
 
29
- # Verify
30
- nansen research profiler labels --address 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --chain ethereum
28
+ ```bash
29
+ # Free live check of the effective API credential
30
+ nansen account
31
31
  ```
32
32
 
33
+ Plain `nansen login` instead requests fresh browser approval. It does not save an environment key or grant wallet signing/RPC authority. Wallet custody and provider credentials below remain separate.
34
+
33
35
  ## Wallet Providers
34
36
 
35
37
  The CLI supports two wallet providers:
@@ -152,11 +154,23 @@ nansen wallet send --to <addr> --amount 1.0 --chain evm --dry-run
152
154
  ## Export & Delete
153
155
 
154
156
  ```bash
155
- # Password auto-resolved from keychain
157
+ # Default is REDACTED — shows addresses only, never private keys
156
158
  nansen wallet export <name>
159
+
160
+ # Write private keys to a file only the owner can read (0600, refuses to overwrite)
161
+ nansen wallet export <name> --file <path>
162
+
163
+ # Print private keys in plaintext to stdout (explicit acknowledgement required;
164
+ # warns on stderr when stdout is an interactive terminal)
165
+ nansen wallet export <name> --reveal
166
+
167
+ # Password auto-resolved from keychain (needed for --reveal / --file)
157
168
  nansen wallet delete <name>
158
169
  ```
159
170
 
171
+ Prefer `--file` over `--reveal`: plaintext on stdout ends up in terminal
172
+ scrollback, shell logs, and agent transcripts.
173
+
160
174
  ## Forget Password
161
175
 
162
176
  ```bash
@@ -182,6 +196,8 @@ For detailed migration steps (from `~/.nansen/.env`, `.credentials`, or env-var-
182
196
  | `--max` | Send entire balance |
183
197
  | `--dry-run` | Preview without broadcasting |
184
198
  | `--provider` | Wallet provider: `local` (default, encrypted on disk) or `privy` (server-side via Privy API) |
199
+ | `--reveal` | Export only: print private keys in plaintext to stdout (required acknowledgement) |
200
+ | `--file` | Export only: write private keys to this path (created 0600, refuses to overwrite) |
185
201
  | `--human` | Enable interactive prompts (human terminal use only — agents must NOT use this) |
186
202
  | `--unsafe-no-password` | Skip encryption (keys stored in plaintext — NOT recommended) |
187
203
 
@@ -4,8 +4,6 @@ description: Wallet profiler — balance, PnL, labels, transactions, counterpart
4
4
  metadata:
5
5
  openclaw:
6
6
  requires:
7
- env:
8
- - NANSEN_API_KEY
9
7
  bins:
10
8
  - nansen
11
9
  primaryEnv: NANSEN_API_KEY
@@ -15,6 +13,16 @@ metadata:
15
13
  bins: [nansen]
16
14
  allowed-tools: Bash(nansen:*)
17
15
  ---
16
+ ## Authentication
17
+
18
+ Browser login requests `nansen:api` for API-key-equivalent account API permissions; existing OAuth/MCP `nansen:read` semantics and separate wallet authorization are unchanged.
19
+
20
+ Before any research command or loop, require an explicitly selected API key or saved browser session. Run `nansen auth status` first. Its cached/unverified metadata does not prove credential validity or unlocked storage. Cached access-token expiry alone does not mean the session is unusable: the CLI normally renews a selected session automatically during an already-authorized research task, without another consent request or a separate account check. Stop on anonymous selection, invalid authentication state, blocked or uncertain renewal/cleanup, or an actual authentication failure, including rejected or expired refresh authority. Follow the CLI error guidance; use the free `nansen account` check when troubleshooting calls for it. Do not unset a failed key, erase a session or switch to anonymous access to retry.
21
+
22
+ Use `nansen login` for fresh browser approval when server admission and the supported platform cohort are enabled, or configure a conventional API key. `NANSEN_API_KEY` overrides the saved session. OpenClaw's optional `primaryEnv` mapping preserves configured API-key injection; it is not a required-key gate or proof of authentication. Normal credits and entitlements apply. Login does not purchase credits. Browser rollout acceptance is still pending.
23
+
24
+ API keys and browser sessions use the same automatic x402 payment behavior: a supported HTTP 402 challenge can spend funds from the configured wallet under existing wallet authorization, payment policy and spending limits. Each call, including calls in loops, can incur a payment. Authentication, authorization and session-renewal failures never trigger payment; login verification and `nansen account` never pay automatically. Anonymous x402 remains available as a separate paid workflow requiring explicit user intent and payment setup. Do not run this research workflow anonymously or switch to anonymous access after authentication fails.
25
+
18
26
 
19
27
  # Wallet Profiler
20
28
 
@@ -4,8 +4,6 @@ description: Fetch and analyze content from one or more URLs using AI (Gemini 2.
4
4
  metadata:
5
5
  openclaw:
6
6
  requires:
7
- env:
8
- - NANSEN_API_KEY
9
7
  bins:
10
8
  - nansen
11
9
  primaryEnv: NANSEN_API_KEY
@@ -15,6 +13,11 @@ metadata:
15
13
  bins: [nansen]
16
14
  allowed-tools: Bash(nansen:*)
17
15
  ---
16
+ ## Authentication
17
+
18
+ Nansen account API calls accept a selected `nansen:api` browser session or conventional API key with the same permissions. `NANSEN_API_KEY` takes precedence; optional `primaryEnv` preserves configured-key injection. Run `nansen auth status` for offline selection. Cached access expiry alone permits automatic renewal during an authorized task. Stop on anonymous selection, invalid state, blocked/uncertain renewal or actual auth failure; never drop a credential or fall back to anonymous x402 payment. Browser login does not grant wallet signing, privileged service identity or a persistent MCP integration key. Preserve all confirmation, signing, sanctions and geographic checks below. Browser rollout acceptance is still pending.
19
+
20
+
18
21
 
19
22
  # Web Fetch
20
23
 
@@ -4,8 +4,6 @@ description: Search the web for one or more queries in parallel. Use when you ne
4
4
  metadata:
5
5
  openclaw:
6
6
  requires:
7
- env:
8
- - NANSEN_API_KEY
9
7
  bins:
10
8
  - nansen
11
9
  primaryEnv: NANSEN_API_KEY
@@ -15,6 +13,11 @@ metadata:
15
13
  bins: [nansen]
16
14
  allowed-tools: Bash(nansen:*)
17
15
  ---
16
+ ## Authentication
17
+
18
+ Nansen account API calls accept a selected `nansen:api` browser session or conventional API key with the same permissions. `NANSEN_API_KEY` takes precedence; optional `primaryEnv` preserves configured-key injection. Run `nansen auth status` for offline selection. Cached access expiry alone permits automatic renewal during an authorized task. Stop on anonymous selection, invalid state, blocked/uncertain renewal or actual auth failure; never drop a credential or fall back to anonymous x402 payment. Browser login does not grant wallet signing, privileged service identity or a persistent MCP integration key. Preserve all confirmation, signing, sanctions and geographic checks below. Browser rollout acceptance is still pending.
19
+
20
+
18
21
 
19
22
  # Web Search
20
23