nansen-cli 1.45.0 → 1.46.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 +64 -0
- package/README.md +29 -4
- package/package.json +1 -1
- package/skills/nansen-trading/SKILL.md +20 -1
- package/skills/nansen-wallet-keychain-migration/SKILL.md +18 -13
- package/skills/nansen-wallet-manager/SKILL.md +15 -1
- package/src/api.js +118 -26
- package/src/bridge.js +187 -68
- package/src/chain-ids.js +1 -2
- package/src/cli.js +314 -94
- package/src/commands/agent.js +5 -2
- package/src/commands/alerts.js +1 -1
- package/src/commands/mcp.js +2 -2
- package/src/commands/research.js +4 -2
- package/src/ens.js +3 -1
- package/src/execute-guard.js +116 -0
- package/src/limit-order.js +9 -1
- package/src/perp.js +20 -9
- package/src/query-options.js +38 -6
- package/src/response-meta.js +1 -1
- package/src/schema.json +124 -22
- package/src/trading.js +545 -16
- package/src/transfer.js +22 -3
- package/src/wallet.js +133 -3
- package/src/walletconnect-trading.js +5 -3
- package/src/walletconnect-x402.js +9 -5
package/src/commands/agent.js
CHANGED
|
@@ -74,8 +74,11 @@ export async function consumeSSEStream(response, callbacks = {}) {
|
|
|
74
74
|
|
|
75
75
|
const processFrame = (frame) => {
|
|
76
76
|
for (const line of frame.split('\n')) {
|
|
77
|
-
if (!line.startsWith('data:
|
|
78
|
-
|
|
77
|
+
if (!line.startsWith('data:')) continue;
|
|
78
|
+
// SSE permits `data:value` and `data: value`; discard at most the one
|
|
79
|
+
// optional space after the colon before parsing the field value.
|
|
80
|
+
const fieldValue = line.slice(5);
|
|
81
|
+
const payload = fieldValue.startsWith(' ') ? fieldValue.slice(1) : fieldValue;
|
|
79
82
|
if (payload === '[DONE]') { done = true; return; }
|
|
80
83
|
|
|
81
84
|
let event;
|
package/src/commands/alerts.js
CHANGED
|
@@ -132,7 +132,7 @@ function parseFiniteNumber(raw, name) {
|
|
|
132
132
|
/**
|
|
133
133
|
* Validate a single-value string filter option (e.g. --chain, --token-address).
|
|
134
134
|
* Empty string/undefined mean "not provided"; any other non-string value
|
|
135
|
-
* (e.g. `--chain
|
|
135
|
+
* (e.g. `--chain '{}'`, from parseArgs' JSON.parse of option values) is
|
|
136
136
|
* rejected instead of crashing on .toLowerCase() or being silently dropped
|
|
137
137
|
* by a falsy check.
|
|
138
138
|
*/
|
package/src/commands/mcp.js
CHANGED
|
@@ -233,8 +233,8 @@ export function buildMcpCommands(deps = {}) {
|
|
|
233
233
|
if (flags['api-key']) {
|
|
234
234
|
throw new CommandError('--api-key requires a value. Usage: nansen mcp verify --api-key <key>', 'MISSING_PARAM');
|
|
235
235
|
}
|
|
236
|
-
// parseArgs
|
|
237
|
-
//
|
|
236
|
+
// parseArgs turns a repeated flag into an array and a JSON object/array
|
|
237
|
+
// value into an object - both must fail, not fall back.
|
|
238
238
|
if ('api-key' in options && typeof options['api-key'] !== 'string') {
|
|
239
239
|
throw new CommandError('--api-key must be a single key string. Usage: nansen mcp verify --api-key <key>', 'INVALID_PARAMS');
|
|
240
240
|
}
|
package/src/commands/research.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { NansenError, ErrorCode } from '../api.js';
|
|
8
|
-
import { parseSort, rejectBlankOption } from '../query-options.js';
|
|
8
|
+
import { parseSort, rejectBlankOption, parseObjectOption } from '../query-options.js';
|
|
9
9
|
|
|
10
10
|
// Research subcommands validate --page strictly. The shared helper in
|
|
11
11
|
// src/query-options.js clamps an invalid page to 1 for the category commands,
|
|
@@ -79,6 +79,8 @@ function parseTimeframeDays(value) {
|
|
|
79
79
|
function parseBooleanOption(options, flags, key) {
|
|
80
80
|
const value = options[key] ?? flags[key];
|
|
81
81
|
if (value === undefined) return undefined;
|
|
82
|
+
// Bare flags arrive through `flags` as true; explicit values arrive through
|
|
83
|
+
// `options` as strings (for example, `--apply-blacklist-filter false`).
|
|
82
84
|
if (typeof value === 'boolean') return value;
|
|
83
85
|
if (value === 'true' || value === '1') return true;
|
|
84
86
|
if (value === 'false' || value === '0') return false;
|
|
@@ -254,7 +256,7 @@ export function buildResearchCommands(deps = {}) {
|
|
|
254
256
|
|
|
255
257
|
const orderBy = parseSort(options.sort, options['order-by']);
|
|
256
258
|
const pagination = buildPagination(options);
|
|
257
|
-
const filters = options.filters
|
|
259
|
+
const filters = parseObjectOption(options.filters, 'filters');
|
|
258
260
|
const { fromDate, toDate } = resolveDateRange(options);
|
|
259
261
|
const asOfDate = options['as-of-date'];
|
|
260
262
|
|
package/src/ens.js
CHANGED
|
@@ -35,7 +35,9 @@ export async function resolveAddress(addressOrName, chain = 'ethereum') {
|
|
|
35
35
|
return { address: trimmed };
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
// 'all' lets the API route by address format; a resolved .eth name is an
|
|
39
|
+
// EVM address, so it resolves the same way an explicit EVM chain does.
|
|
40
|
+
if (chain !== 'all' && !EVM_CHAINS.includes(chain)) {
|
|
39
41
|
throw new Error(`ENS names can only be resolved on EVM chains, not ${chain}`);
|
|
40
42
|
}
|
|
41
43
|
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Acknowledgement gate shared by the commands that move funds on-chain
|
|
3
|
+
* (`trade execute`, `bridge execute`).
|
|
4
|
+
*
|
|
5
|
+
* Two independent switches, both resolved in the command layer:
|
|
6
|
+
* --dry-run run the validation the command normally runs, print the plan,
|
|
7
|
+
* and stop before anything is signed or broadcast (exit 0).
|
|
8
|
+
* --yes / -y skip the confirmation. `NANSEN_YES=1` is the environment
|
|
9
|
+
* equivalent, for callers that cannot add a flag.
|
|
10
|
+
*
|
|
11
|
+
* The confirmation is only ever shown when stdin is an interactive terminal.
|
|
12
|
+
* Agents, CI jobs and pipes (stdin not a TTY) keep today's behaviour exactly:
|
|
13
|
+
* the command proceeds without asking, so no automated workflow can hang on a
|
|
14
|
+
* question nobody is there to answer. `--yes` is still accepted there and is
|
|
15
|
+
* simply a no-op. Declining the prompt exits 1 with nothing signed.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { CommandError } from './api.js';
|
|
19
|
+
|
|
20
|
+
// Accepted spellings for NANSEN_YES. Anything else (unset, "0", "false", an
|
|
21
|
+
// empty string) leaves the confirmation in place.
|
|
22
|
+
const TRUTHY_ENV_VALUES = new Set(['1', 'true', 'yes', 'on']);
|
|
23
|
+
|
|
24
|
+
export function isYesEnvSet(env = process.env) {
|
|
25
|
+
const raw = env?.NANSEN_YES;
|
|
26
|
+
return typeof raw === 'string' && TRUTHY_ENV_VALUES.has(raw.trim().toLowerCase());
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Read the guard's inputs off the parsed flags. `-y` arrives as `flags.y`
|
|
31
|
+
* because single-dash tokens are always parsed as valueless flags.
|
|
32
|
+
*/
|
|
33
|
+
export function resolveExecuteGuard(flags = {}, { env = process.env, isTTY = false } = {}) {
|
|
34
|
+
return {
|
|
35
|
+
dryRun: Boolean(flags['dry-run']),
|
|
36
|
+
assumeYes: Boolean(flags.yes || flags.y) || isYesEnvSet(env),
|
|
37
|
+
isTTY: Boolean(isTTY),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Render `[label, value]` pairs as an aligned block. Pairs whose value is
|
|
43
|
+
* null/undefined/'' are dropped, so callers can list optional fields inline.
|
|
44
|
+
*/
|
|
45
|
+
export function formatPlan(title, rows = [], notes = []) {
|
|
46
|
+
const shown = rows.filter(([, value]) => value !== undefined && value !== null && value !== '');
|
|
47
|
+
const width = shown.reduce((max, [label]) => Math.max(max, label.length + 1), 0);
|
|
48
|
+
return [
|
|
49
|
+
`\n ${title}`,
|
|
50
|
+
...shown.map(([label, value]) => ` ${`${label}:`.padEnd(width)} ${value}`),
|
|
51
|
+
...notes.map(note => ` ${note}`),
|
|
52
|
+
].join('\n');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function isAffirmative(answer) {
|
|
56
|
+
return /^y(es)?$/i.test(String(answer ?? '').trim());
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Print the plan and decide whether the caller may proceed to sign/broadcast.
|
|
61
|
+
*
|
|
62
|
+
* Returns true to continue, false when a dry run has finished (the caller
|
|
63
|
+
* returns without signing). Throws CONFIRMATION_DECLINED when an interactive
|
|
64
|
+
* user answers anything but yes.
|
|
65
|
+
*/
|
|
66
|
+
export async function guardExecution({
|
|
67
|
+
plan,
|
|
68
|
+
dryRun = false,
|
|
69
|
+
assumeYes = false,
|
|
70
|
+
isTTY = false,
|
|
71
|
+
promptFn,
|
|
72
|
+
log = () => {},
|
|
73
|
+
confirmationLog = log,
|
|
74
|
+
question = 'Broadcast this transaction? [y/N] ',
|
|
75
|
+
}) {
|
|
76
|
+
if (dryRun) {
|
|
77
|
+
log(plan);
|
|
78
|
+
log('\n DRY RUN — nothing was broadcast. No transaction was signed and the quote was not consumed.');
|
|
79
|
+
log(' Re-run without --dry-run to sign and broadcast it.\n');
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Non-interactive stdin (agents, CI, pipes): unchanged, deterministic, never
|
|
84
|
+
// blocked on a prompt. --yes is accepted here and does nothing.
|
|
85
|
+
if (!isTTY || assumeYes) return true;
|
|
86
|
+
|
|
87
|
+
if (typeof promptFn !== 'function') {
|
|
88
|
+
throw new CommandError(
|
|
89
|
+
'Cannot request confirmation because no interactive prompt is available. Pass --yes to proceed or --dry-run to preview.',
|
|
90
|
+
'CONFIRMATION_UNAVAILABLE',
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Keep the plan on the same visible terminal channel as the question. In
|
|
95
|
+
// particular, stdin can still be a TTY when stdout is redirected to a file;
|
|
96
|
+
// writing the plan through `log` there would ask the user to approve a plan
|
|
97
|
+
// they cannot see. Dry-run output deliberately remains on `log`/stdout above
|
|
98
|
+
// because it is automation-friendly command output rather than a prompt.
|
|
99
|
+
confirmationLog(plan);
|
|
100
|
+
const answer = await promptFn(question);
|
|
101
|
+
if (!isAffirmative(answer)) {
|
|
102
|
+
const error = new CommandError(
|
|
103
|
+
'Aborted at the confirmation prompt — nothing was signed or broadcast. '
|
|
104
|
+
+ 'Pass --yes (or set NANSEN_YES=1) to skip this confirmation, or --dry-run to preview without broadcasting.',
|
|
105
|
+
'CONFIRMATION_DECLINED',
|
|
106
|
+
);
|
|
107
|
+
// The interactive user is looking at the same terminal channel as the
|
|
108
|
+
// prompt, so report the decline there exactly once. runCLI sees `reported`
|
|
109
|
+
// and does not also serialize an agent-oriented JSON envelope to stdout.
|
|
110
|
+
// Direct callers still receive the complete CommandError below.
|
|
111
|
+
confirmationLog(error.message);
|
|
112
|
+
error.reported = true;
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
}
|
package/src/limit-order.js
CHANGED
|
@@ -711,7 +711,15 @@ EXAMPLES:
|
|
|
711
711
|
const tokenInfo = await getTokenInfo(CHAIN_RPCS.solana, from);
|
|
712
712
|
decimals = tokenInfo.decimals;
|
|
713
713
|
}
|
|
714
|
-
|
|
714
|
+
try {
|
|
715
|
+
amountBaseUnits = String(parseAmount(String(amount), decimals));
|
|
716
|
+
} catch (err) {
|
|
717
|
+
// parseAmount rejects an amount that truncates to zero base units at
|
|
718
|
+
// this token's precision — a decimals problem only in name.
|
|
719
|
+
log(`Error: ${err.message}`);
|
|
720
|
+
exit(1);
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
715
723
|
} catch (err) {
|
|
716
724
|
log(`Error: Could not resolve decimals for ${from}: ${err.message}`);
|
|
717
725
|
exit(1);
|
package/src/perp.js
CHANGED
|
@@ -175,10 +175,8 @@ function resolveWalletAddress(walletName) {
|
|
|
175
175
|
// response that doesn't cover every requested address all abort the trade
|
|
176
176
|
// before signing, never trade through.
|
|
177
177
|
|
|
178
|
-
//
|
|
179
|
-
//
|
|
180
|
-
// screen sits in that path). Worth lifting into its own module if a third caller
|
|
181
|
-
// appears.
|
|
178
|
+
// Shared with bridge.js and trading.js, whose direct signing/broadcast paths do
|
|
179
|
+
// not have a server-side screen after this checkpoint.
|
|
182
180
|
export async function screenOrThrow(apiInstance, addresses) {
|
|
183
181
|
let result;
|
|
184
182
|
try {
|
|
@@ -196,7 +194,9 @@ export async function screenOrThrow(apiInstance, addresses) {
|
|
|
196
194
|
}
|
|
197
195
|
|
|
198
196
|
const results = Array.isArray(result?.results) ? result.results : [];
|
|
199
|
-
const sanctioned = results
|
|
197
|
+
const sanctioned = results
|
|
198
|
+
.filter(r => r && r.sanctioned === true)
|
|
199
|
+
.map(r => r.address);
|
|
200
200
|
if (sanctioned.length > 0) {
|
|
201
201
|
throw new CommandError(
|
|
202
202
|
`Wallet address is on the compliance blocklist and cannot trade: ${sanctioned.join(', ')}`,
|
|
@@ -204,10 +204,21 @@ export async function screenOrThrow(apiInstance, addresses) {
|
|
|
204
204
|
);
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
// A 200 that omitted a requested address
|
|
208
|
-
// than assume the
|
|
209
|
-
|
|
210
|
-
|
|
207
|
+
// A 200 that omitted a requested address or did not return a boolean verdict
|
|
208
|
+
// is unverifiable — fail closed rather than assume the address is clean.
|
|
209
|
+
// EVM addresses are case-insensitive; base58 addresses (including Solana)
|
|
210
|
+
// are case-sensitive and must match exactly. Lowercasing every result here
|
|
211
|
+
// would let a verdict for a different Solana address satisfy the gate.
|
|
212
|
+
const addressKey = (address) => {
|
|
213
|
+
const value = String(address);
|
|
214
|
+
return /^0x[0-9a-f]{40}$/i.test(value) ? value.toLowerCase() : value;
|
|
215
|
+
};
|
|
216
|
+
const screened = new Set(
|
|
217
|
+
results
|
|
218
|
+
.filter(r => r && typeof r.sanctioned === 'boolean' && r.address != null)
|
|
219
|
+
.map(r => addressKey(r.address)),
|
|
220
|
+
);
|
|
221
|
+
const missing = addresses.filter(a => !screened.has(addressKey(a)));
|
|
211
222
|
if (missing.length > 0) {
|
|
212
223
|
throw new CommandError(
|
|
213
224
|
`Compliance screening did not cover all addresses, so the trade was not submitted: ${missing.join(', ')}`,
|
package/src/query-options.js
CHANGED
|
@@ -25,9 +25,22 @@ export function parseSort(sortOption, orderByOption) {
|
|
|
25
25
|
// If --order-by is provided, use it (full JSON control)
|
|
26
26
|
if (orderByOption) return orderByOption;
|
|
27
27
|
if (!sortOption) return undefined;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
if (typeof sortOption !== 'string') {
|
|
29
|
+
throw new NansenError('--sort must be "field" or "field:direction"', ErrorCode.INVALID_PARAMS);
|
|
30
|
+
}
|
|
31
|
+
const parts = sortOption.split(':');
|
|
32
|
+
const field = parts[0].trim();
|
|
33
|
+
const rawDirection = (parts[1] || '').trim();
|
|
34
|
+
const direction = (rawDirection || 'desc').toUpperCase();
|
|
35
|
+
if (!field) {
|
|
36
|
+
throw new NansenError('--sort needs a field name, e.g. --sort value_usd:desc', ErrorCode.INVALID_PARAMS);
|
|
37
|
+
}
|
|
38
|
+
if (direction !== 'ASC' && direction !== 'DESC') {
|
|
39
|
+
throw new NansenError(
|
|
40
|
+
`--sort direction must be asc or desc, got "${rawDirection}" (e.g. --sort ${field}:desc)`,
|
|
41
|
+
ErrorCode.INVALID_PARAMS,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
31
44
|
return [{ field, direction }];
|
|
32
45
|
}
|
|
33
46
|
|
|
@@ -35,8 +48,8 @@ export function parseSort(sortOption, orderByOption) {
|
|
|
35
48
|
* Normalise a comma-separated-string-or-array CLI option into an array of
|
|
36
49
|
* strings, or undefined if absent. Accepts either a single "a,b,c" string or
|
|
37
50
|
* an array (parseArgs collects repeated flags, e.g. `--tag a --tag b`, into
|
|
38
|
-
* one), and rejects non-string values/elements (e.g. `--flag
|
|
39
|
-
* parsed by parseArgs as
|
|
51
|
+
* one), and rejects non-string values/elements (e.g. `--flag '{}'` is
|
|
52
|
+
* parsed by parseArgs as a JSON object) with an actionable
|
|
40
53
|
* INVALID_PARAMS error instead of crashing on .split()/.trim().
|
|
41
54
|
*/
|
|
42
55
|
export function parseCsvOption(val, name) {
|
|
@@ -45,7 +58,9 @@ export function parseCsvOption(val, name) {
|
|
|
45
58
|
if (!val.every(v => typeof v === 'string')) {
|
|
46
59
|
throw new NansenError(`--${name} values must be strings`, ErrorCode.INVALID_PARAMS);
|
|
47
60
|
}
|
|
48
|
-
|
|
61
|
+
// A repeated flag may itself carry a list (`--tags defi,nft --tags sports`),
|
|
62
|
+
// so split each element the same way a single value is split.
|
|
63
|
+
return val.flatMap(v => v.split(',')).map(v => v.trim()).filter(Boolean);
|
|
49
64
|
}
|
|
50
65
|
if (typeof val !== 'string') {
|
|
51
66
|
throw new NansenError(`--${name} must be a string`, ErrorCode.INVALID_PARAMS);
|
|
@@ -53,6 +68,23 @@ export function parseCsvOption(val, name) {
|
|
|
53
68
|
return val.split(',').map(s => s.trim()).filter(Boolean);
|
|
54
69
|
}
|
|
55
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Normalise a `--filters '<json>'` option into a plain object, or `{}` when
|
|
73
|
+
* absent. parseArgs already JSON-parses the value, so anything that is not a
|
|
74
|
+
* plain object here (`--filters '[]'`, `--filters abc`, a repeated flag) would
|
|
75
|
+
* otherwise go straight into the request body and fail upstream with a 422.
|
|
76
|
+
*/
|
|
77
|
+
export function parseObjectOption(val, name) {
|
|
78
|
+
if (val === undefined || val === '') return {};
|
|
79
|
+
if (val === null || typeof val !== 'object' || Array.isArray(val)) {
|
|
80
|
+
throw new NansenError(
|
|
81
|
+
`--${name} must be a JSON object, e.g. --${name} '{"key": "value"}'`,
|
|
82
|
+
ErrorCode.INVALID_PARAMS,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
return val;
|
|
86
|
+
}
|
|
87
|
+
|
|
56
88
|
/** Reject explicit blank strings before a handler selects an omitted-option default. */
|
|
57
89
|
export function rejectBlankOption(value, name, example) {
|
|
58
90
|
if (typeof value === 'string' && value.trim() === '') {
|
package/src/response-meta.js
CHANGED
|
@@ -43,7 +43,7 @@ function intHeader(response, name) {
|
|
|
43
43
|
* Read a header as a trimmed non-empty string, or null when absent.
|
|
44
44
|
* Tolerates any header bag with a .get() — a real Headers, or a Map in tests.
|
|
45
45
|
*/
|
|
46
|
-
function stringHeader(response, name) {
|
|
46
|
+
export function stringHeader(response, name) {
|
|
47
47
|
const raw = response?.headers?.get?.(name);
|
|
48
48
|
if (raw == null) return null;
|
|
49
49
|
const value = String(raw).trim();
|
package/src/schema.json
CHANGED
|
@@ -387,10 +387,23 @@
|
|
|
387
387
|
"nonce": {
|
|
388
388
|
"type": "string",
|
|
389
389
|
"description": "Sign at this nonce instead of the next one, to replace a stuck transaction (EVM deposit legs only)"
|
|
390
|
+
},
|
|
391
|
+
"dry-run": {
|
|
392
|
+
"type": "boolean",
|
|
393
|
+
"description": "Run every sign-free preflight available from the cached quote, its public signer address and read-only RPC calls; print the transfer that would be signed; then stop before wallet credentials and the first signature. Nothing is broadcast, no wallet password is needed, and the quote stays usable. Real execution still resolves and revalidates the live signer. Exits 0."
|
|
394
|
+
},
|
|
395
|
+
"yes": {
|
|
396
|
+
"type": "boolean",
|
|
397
|
+
"description": "Skip the confirmation prompt (alias: -y, or set NANSEN_YES=1). The prompt is only shown when stdin is an interactive terminal; when stdin is not a terminal (agents, CI, pipes) the command proceeds unprompted whether or not this is passed. Declining the prompt exits 1 with nothing signed."
|
|
390
398
|
}
|
|
391
399
|
},
|
|
400
|
+
"examples": [
|
|
401
|
+
"nansen bridge execute --quote bridge-1708900000000-abc123",
|
|
402
|
+
"nansen bridge execute --quote bridge-1708900000000-abc123 --dry-run",
|
|
403
|
+
"nansen bridge execute --quote bridge-1708900000000-abc123 --yes"
|
|
404
|
+
],
|
|
392
405
|
"prerequisites": [
|
|
393
|
-
"A wallet must be configured.
|
|
406
|
+
"A wallet must be configured for real execution. Dry-run can use the public signer saved in the cached quote."
|
|
394
407
|
]
|
|
395
408
|
},
|
|
396
409
|
"status": {
|
|
@@ -2026,6 +2039,9 @@
|
|
|
2026
2039
|
"subcommands": {
|
|
2027
2040
|
"quote": {
|
|
2028
2041
|
"description": "Get a DEX swap quote (same-chain or cross-chain). Explicitly blank --swap-mode, --wallet, --to-chain, --aggregator, and --amount-unit values are rejected.",
|
|
2042
|
+
"apiEndpoints": [
|
|
2043
|
+
"/api/v1/sanctions/screen"
|
|
2044
|
+
],
|
|
2029
2045
|
"options": {
|
|
2030
2046
|
"chain": {
|
|
2031
2047
|
"type": "string",
|
|
@@ -2091,11 +2107,15 @@
|
|
|
2091
2107
|
}
|
|
2092
2108
|
},
|
|
2093
2109
|
"prerequisites": [
|
|
2094
|
-
"A local wallet must be configured. Run: nansen wallet create"
|
|
2110
|
+
"A local wallet must be configured. Run: nansen wallet create",
|
|
2111
|
+
"API access is required for pre-trade compliance screening. Run: nansen login (or set NANSEN_API_KEY)"
|
|
2095
2112
|
]
|
|
2096
2113
|
},
|
|
2097
2114
|
"execute": {
|
|
2098
2115
|
"description": "Sign and broadcast a quoted trade. Explicitly blank --wallet values are rejected.",
|
|
2116
|
+
"apiEndpoints": [
|
|
2117
|
+
"/api/v1/sanctions/screen"
|
|
2118
|
+
],
|
|
2099
2119
|
"options": {
|
|
2100
2120
|
"quote": {
|
|
2101
2121
|
"type": "string",
|
|
@@ -2130,8 +2150,24 @@
|
|
|
2130
2150
|
"no-revoke-excessive-allowance": {
|
|
2131
2151
|
"type": "boolean",
|
|
2132
2152
|
"description": "Skip revoking an existing on-chain ERC-20 allowance before re-approving when it exceeds 10x this trade's scoped amount. By default, an oversized or legacy allowance is revoked to zero and a fresh trade-scoped allowance is granted. WalletConnect users will see separate wallet prompts for the revoke and re-approval."
|
|
2153
|
+
},
|
|
2154
|
+
"dry-run": {
|
|
2155
|
+
"type": "boolean",
|
|
2156
|
+
"description": "Run every sign-free preflight available from the cached quote, its public signer address and read-only RPC calls; plan the approval and print what would be sent; then stop before wallet credentials or signing. Nothing is signed or broadcast, no wallet password is needed, and the quote stays usable. Real execution still resolves and revalidates the live signer. On EVM preview also reads the current allowance and runs the pre-broadcast revert simulation when no approval is outstanding. Exits 0."
|
|
2157
|
+
},
|
|
2158
|
+
"yes": {
|
|
2159
|
+
"type": "boolean",
|
|
2160
|
+
"description": "Skip the confirmation prompt (alias: -y, or set NANSEN_YES=1). The prompt is only shown when stdin is an interactive terminal; when stdin is not a terminal (agents, CI, pipes) the command proceeds unprompted whether or not this is passed. Declining the prompt exits 1 with nothing signed."
|
|
2133
2161
|
}
|
|
2134
|
-
}
|
|
2162
|
+
},
|
|
2163
|
+
"examples": [
|
|
2164
|
+
"nansen trade execute --quote 1708900000000-abc123",
|
|
2165
|
+
"nansen trade execute --quote 1708900000000-abc123 --dry-run",
|
|
2166
|
+
"nansen trade execute --quote 1708900000000-abc123 --yes"
|
|
2167
|
+
],
|
|
2168
|
+
"prerequisites": [
|
|
2169
|
+
"API access is required for pre-trade compliance screening. Run: nansen login (or set NANSEN_API_KEY)"
|
|
2170
|
+
]
|
|
2135
2171
|
},
|
|
2136
2172
|
"bridge-status": {
|
|
2137
2173
|
"description": "Check cross-chain bridge transaction status. Aggregator (Li.Fi or Relay) is auto-detected from a local tx record saved at execute time (kept 30 days); pass --aggregator to override when polling from a different machine.",
|
|
@@ -2309,10 +2345,18 @@
|
|
|
2309
2345
|
"type": "boolean",
|
|
2310
2346
|
"description": "Skip encryption; private keys are stored unencrypted on disk (local only)"
|
|
2311
2347
|
}
|
|
2312
|
-
}
|
|
2348
|
+
},
|
|
2349
|
+
"examples": [
|
|
2350
|
+
"nansen wallet create --name trading",
|
|
2351
|
+
"nansen wallet create --name agent-wallet --provider privy"
|
|
2352
|
+
]
|
|
2313
2353
|
},
|
|
2314
2354
|
"list": {
|
|
2315
|
-
"description": "List all wallets"
|
|
2355
|
+
"description": "List all wallets",
|
|
2356
|
+
"examples": [
|
|
2357
|
+
"nansen wallet list",
|
|
2358
|
+
"nansen wallet list --pretty"
|
|
2359
|
+
]
|
|
2316
2360
|
},
|
|
2317
2361
|
"show": {
|
|
2318
2362
|
"description": "Show wallet details",
|
|
@@ -2320,7 +2364,10 @@
|
|
|
2320
2364
|
"name": {
|
|
2321
2365
|
"description": "Wallet name"
|
|
2322
2366
|
}
|
|
2323
|
-
}
|
|
2367
|
+
},
|
|
2368
|
+
"examples": [
|
|
2369
|
+
"nansen wallet show <name>"
|
|
2370
|
+
]
|
|
2324
2371
|
},
|
|
2325
2372
|
"send": {
|
|
2326
2373
|
"description": "Send tokens or native currency. Explicitly blank --token and --wallet values are rejected; omit them for native currency and the default wallet.",
|
|
@@ -2344,16 +2391,53 @@
|
|
|
2344
2391
|
"type": "boolean",
|
|
2345
2392
|
"description": "Send the entire spendable balance instead of --amount"
|
|
2346
2393
|
}
|
|
2347
|
-
}
|
|
2394
|
+
},
|
|
2395
|
+
"examples": [
|
|
2396
|
+
"nansen wallet send --to <address> --amount 1.5 --chain evm",
|
|
2397
|
+
"nansen wallet send --to <address> --max --chain solana"
|
|
2398
|
+
]
|
|
2348
2399
|
},
|
|
2349
2400
|
"export": {
|
|
2350
|
-
"description": "Export private keys"
|
|
2401
|
+
"description": "Export private keys (redacted by default; pass --reveal or --file <path> for the actual keys)",
|
|
2402
|
+
"options": {
|
|
2403
|
+
"reveal": {
|
|
2404
|
+
"type": "boolean",
|
|
2405
|
+
"description": "Print private keys in plaintext to stdout (explicit acknowledgement; warns on interactive terminals)"
|
|
2406
|
+
},
|
|
2407
|
+
"file": {
|
|
2408
|
+
"type": "string",
|
|
2409
|
+
"description": "Write private keys to this path instead of stdout (created with 0600 permissions, refuses to overwrite)"
|
|
2410
|
+
}
|
|
2411
|
+
},
|
|
2412
|
+
"examples": [
|
|
2413
|
+
"nansen wallet export <name>",
|
|
2414
|
+
"nansen wallet export <name> --file backup.json"
|
|
2415
|
+
]
|
|
2351
2416
|
},
|
|
2352
2417
|
"delete": {
|
|
2353
|
-
"description": "Delete a wallet"
|
|
2418
|
+
"description": "Delete a wallet",
|
|
2419
|
+
"examples": [
|
|
2420
|
+
"nansen wallet delete <name>"
|
|
2421
|
+
]
|
|
2354
2422
|
},
|
|
2355
2423
|
"default": {
|
|
2356
|
-
"description": "Set default wallet"
|
|
2424
|
+
"description": "Set default wallet",
|
|
2425
|
+
"examples": [
|
|
2426
|
+
"nansen wallet default <name>"
|
|
2427
|
+
]
|
|
2428
|
+
},
|
|
2429
|
+
"forget-password": {
|
|
2430
|
+
"description": "Forget the saved wallet password, removing it from the OS keychain and from the local credentials file. Later commands fall back to NANSEN_WALLET_PASSWORD or an interactive prompt (--human).",
|
|
2431
|
+
"examples": [
|
|
2432
|
+
"nansen wallet forget-password"
|
|
2433
|
+
]
|
|
2434
|
+
},
|
|
2435
|
+
"secure": {
|
|
2436
|
+
"description": "Move a wallet password that is held in the local credentials file or in NANSEN_WALLET_PASSWORD into the OS keychain, then delete the plaintext copy. Verifies the password against the stored hash first, reports success when it is already in the keychain, and fails with KEYCHAIN_UNAVAILABLE when no OS keychain is reachable.",
|
|
2437
|
+
"examples": [
|
|
2438
|
+
"nansen wallet secure",
|
|
2439
|
+
"NANSEN_WALLET_PASSWORD=<password> nansen wallet secure"
|
|
2440
|
+
]
|
|
2357
2441
|
}
|
|
2358
2442
|
}
|
|
2359
2443
|
},
|
|
@@ -2640,24 +2724,42 @@
|
|
|
2640
2724
|
}
|
|
2641
2725
|
},
|
|
2642
2726
|
"chains": [
|
|
2643
|
-
"
|
|
2644
|
-
"
|
|
2645
|
-
"base",
|
|
2646
|
-
"bnb",
|
|
2727
|
+
"algorand",
|
|
2728
|
+
"aptos",
|
|
2647
2729
|
"arbitrum",
|
|
2648
|
-
"
|
|
2649
|
-
"optimism",
|
|
2730
|
+
"arc",
|
|
2650
2731
|
"avalanche",
|
|
2732
|
+
"base",
|
|
2733
|
+
"bitcoin",
|
|
2734
|
+
"bitlayer",
|
|
2735
|
+
"bnb",
|
|
2736
|
+
"chiliz",
|
|
2737
|
+
"citrea",
|
|
2738
|
+
"ethereum",
|
|
2739
|
+
"gravity",
|
|
2740
|
+
"hyperevm",
|
|
2741
|
+
"hyperliquid",
|
|
2742
|
+
"injective",
|
|
2743
|
+
"iotaevm",
|
|
2651
2744
|
"linea",
|
|
2652
|
-
"scroll",
|
|
2653
2745
|
"mantle",
|
|
2654
|
-
"
|
|
2655
|
-
"
|
|
2746
|
+
"mantra",
|
|
2747
|
+
"monad",
|
|
2748
|
+
"near",
|
|
2749
|
+
"optimism",
|
|
2656
2750
|
"plasma",
|
|
2751
|
+
"polygon",
|
|
2752
|
+
"robinhood",
|
|
2753
|
+
"sei",
|
|
2754
|
+
"solana",
|
|
2657
2755
|
"sonic",
|
|
2658
|
-
"
|
|
2659
|
-
"
|
|
2660
|
-
"
|
|
2756
|
+
"stacks",
|
|
2757
|
+
"starknet",
|
|
2758
|
+
"stellar",
|
|
2759
|
+
"sui",
|
|
2760
|
+
"ton",
|
|
2761
|
+
"tron",
|
|
2762
|
+
"viction"
|
|
2661
2763
|
],
|
|
2662
2764
|
"smartMoneyLabels": [
|
|
2663
2765
|
"Fund",
|