keyring-agent-core 0.2.43 → 0.2.45

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/dist/index.d.ts CHANGED
@@ -564,12 +564,6 @@ interface ChatMessage {
564
564
  * Only set on role === 'assistant' (the final user-facing answer).
565
565
  */
566
566
  subagents?: string[];
567
- /**
568
- * Suggested follow-up prompts attached to this assistant turn. Persisted with
569
- * history so that when a session is restored, the FE can re-render the same
570
- * suggestion chips next to the message. Only set on role === 'assistant'.
571
- */
572
- suggestedPrompts?: string[];
573
567
  /**
574
568
  * UI payloads (forms / confirms / result widgets) emitted by tools during
575
569
  * this turn. Persisted with history so the FE can re-render these widgets
@@ -597,6 +591,20 @@ interface ChatMessage {
597
591
  _intermediate?: boolean;
598
592
  timestamp: number;
599
593
  }
594
+ /**
595
+ * Message to return instead of a tool's form, keyed by tool name.
596
+ *
597
+ * The value is the text the assistant should convey to the user — write it in
598
+ * whatever wording you want them to hear (a link is fine). The model still
599
+ * translates it into the user's language, so plain English works.
600
+ *
601
+ * @example
602
+ * {
603
+ * 'open-swap-token-form': 'You can swap tokens directly in the app: https://app.example',
604
+ * 'open-buy-token-form': 'Buying is available in the app.',
605
+ * }
606
+ */
607
+ type NoFormToolMessages = Record<string, string>;
600
608
  /** Describes a parameter for a tool */
601
609
  interface ToolParameter {
602
610
  name: string;
@@ -628,14 +636,6 @@ interface ToolDefinition {
628
636
  category?: string;
629
637
  /** Whether this tool returns plain data, a UI payload, or an unsigned action. Default 'data'. */
630
638
  kind?: ToolKind;
631
- /**
632
- * When true, AgentCore skips generating `suggestedPrompts` for any turn in
633
- * which this tool was executed. Use on tools that already drive the user to
634
- * a concrete next step (e.g. pool action forms, wallet-action forms) where
635
- * generic suggestions add noise instead of helping.
636
- * Default false.
637
- */
638
- noSuggestions?: boolean;
639
639
  }
640
640
  /**
641
641
  * UI payload emitted by a tool. The FE has pre-built components keyed by
@@ -658,6 +658,31 @@ interface UIPayload<TProps = Record<string, unknown>> {
658
658
  */
659
659
  language?: string;
660
660
  }
661
+ /** One NFT card in the {@link WalletNftListProps} gallery. */
662
+ interface WalletNftCardProps {
663
+ /** Display name, e.g. "Bored Ape #1234" (falls back to "#<tokenId>"). */
664
+ name: string;
665
+ /** Token id as a decimal string. */
666
+ tokenId: string;
667
+ /** Collection contract address (0x…). */
668
+ contractAddress: string;
669
+ /**
670
+ * Loadable image: an http(s) URL or a `data:` URI (incl. `data:image/svg+xml`).
671
+ * `null` when no image could be resolved — the FE shows a placeholder card.
672
+ */
673
+ image: string | null;
674
+ /** Human-readable chain name, e.g. "Base". */
675
+ chain: string;
676
+ }
677
+ /** Props for the `WalletNftList` component — one collection's NFTs to display. */
678
+ interface WalletNftListProps {
679
+ /** Wallet whose NFTs these are (0x…). */
680
+ walletAddress: string;
681
+ /** Collection name shown as the gallery heading. */
682
+ collectionName: string;
683
+ /** The NFTs to render, in display order. */
684
+ nfts: WalletNftCardProps[];
685
+ }
661
686
  /** Identifies a chain in BE↔FE payloads. */
662
687
  interface ChainRef {
663
688
  /** Hex chain id, e.g. "0x2105" for Base */
@@ -799,6 +824,9 @@ interface WalletActionProps {
799
824
  action: WalletActionType;
800
825
  /** Hex chain id, e.g. "0x1", "0x2105". Falls back to userContext.chain. */
801
826
  chainId: string;
827
+ /** Human-readable chain name for display, e.g. "Ethereum", "Base". Derived
828
+ * from `chainId` via `chainLabel`; falls back to the raw id when unknown. */
829
+ chainName: string;
802
830
  /** Connected wallet that will sign the tx. */
803
831
  walletAddress: string;
804
832
  /**
@@ -838,10 +866,21 @@ interface X402PaymentRequiredProps {
838
866
  };
839
867
  /** Human-readable fields for the card (display only). */
840
868
  display: {
841
- /** Amount in smallest unit, e.g. "10000". */
869
+ /**
870
+ * Amount ALREADY formatted by the token's on-chain `decimals()`, e.g.
871
+ * "0.01" — render this as-is, never re-scale it. Falls back to the raw
872
+ * smallest-unit string when the token could not be read on-chain (then
873
+ * `decimals` is null).
874
+ */
842
875
  amount: string;
843
- /** Asset symbol, e.g. "USDC". */
876
+ /** Asset symbol read on-chain via `symbol()`, e.g. "USDC". */
844
877
  asset: string;
878
+ /** Amount in smallest unit, exactly as the 402 demanded it, e.g. "10000". */
879
+ amountRaw: string;
880
+ /** The token's on-chain `decimals()`, or null when it could not be read. */
881
+ decimals: number | null;
882
+ /** Payment token contract address. */
883
+ assetAddress: string;
845
884
  /** CAIP-2 network id, e.g. "eip155:84532". */
846
885
  network: string;
847
886
  /** Network name, e.g. "Base Sepolia". */
@@ -1009,10 +1048,8 @@ interface ConfirmAddLiquidityTxProps {
1009
1048
  * button below the assistant message. When the user clicks, the FE submits
1010
1049
  * `prompt` as the next user message.
1011
1050
  *
1012
- * Distinct from `AgentResponse.suggestedPrompts`: those are LLM-generated
1013
- * generic follow-ups; these are deterministic, tool-emitted picker / disambig
1014
- * buttons (e.g. "Send USDC", "Send WETH" when the user said "send token"
1015
- * without naming one).
1051
+ * These are deterministic, tool-emitted picker / disambig buttons (e.g.
1052
+ * "Send USDC", "Send WETH" when the user said "send token" without naming one).
1016
1053
  */
1017
1054
  interface SuggestedAction {
1018
1055
  /** Button label shown to the user. */
@@ -1226,17 +1263,32 @@ interface LLMProviderConfig {
1226
1263
  maxTokens?: number;
1227
1264
  /** Temperature (0-2) */
1228
1265
  temperature?: number;
1229
- /** Base URL for the Gemini API proxy. Defaults to "https://nft.keyring.app/api/gemini-stable" */
1266
+ /**
1267
+ * Bring-your-own Gemini API key. When set, the core talks DIRECTLY to
1268
+ * `https://generativelanguage.googleapis.com` with this key instead of
1269
+ * routing through the Keyring proxy — and the {@link AgentConfig.secretKey}
1270
+ * licence gate is skipped, since no Keyring-hosted resource is consumed.
1271
+ * Omit it to use the proxy (which requires a valid `secretKey`).
1272
+ */
1273
+ apiKey?: string;
1274
+ /**
1275
+ * Base URL override. Defaults to the Keyring proxy
1276
+ * ("https://nft.keyring.app/api/gemini-stable"), or to
1277
+ * "https://generativelanguage.googleapis.com" when {@link apiKey} is set.
1278
+ */
1230
1279
  baseUrl?: string;
1231
1280
  }
1232
1281
  interface AgentConfig {
1233
1282
  /**
1234
- * License gate. AgentCore refuses to construct unless this value exactly
1235
- * matches the `SECRET_KEY` environment variable present at runtime. Required —
1236
- * omitting it (or passing a value that does not match `process.env.SECRET_KEY`)
1237
- * throws from the constructor before any provider/tool is initialised.
1283
+ * License gate for the Keyring-hosted Gemini proxy. Validated on the first
1284
+ * `chat()` call: if it does not match the key this bundle was built with, the
1285
+ * call throws before any LLM request is made.
1286
+ *
1287
+ * Optional ONLY in bring-your-own-key mode — when {@link LLMProviderConfig.apiKey}
1288
+ * is set the core calls the Gemini API directly and the gate is skipped.
1289
+ * Without an `llm.apiKey`, this is required.
1238
1290
  */
1239
- secretKey: string;
1291
+ secretKey?: string;
1240
1292
  /** LLM provider configuration */
1241
1293
  llm: LLMProviderConfig;
1242
1294
  /**
@@ -1309,12 +1361,6 @@ interface AgentConfig {
1309
1361
  * around 0.7 typically gives better KB recall in production.
1310
1362
  */
1311
1363
  kbAnswerThreshold?: number;
1312
- /**
1313
- * Whether to generate suggested follow-up prompts after each answer.
1314
- * Default true. Set to false to skip the extra LLM call and omit
1315
- * `suggestedPrompts` from every response.
1316
- */
1317
- generateSuggestions?: boolean;
1318
1364
  /** Moralis AI tool config. Set to false to disable the built-in Moralis tool. */
1319
1365
  moralis?: {
1320
1366
  /** Base URL for Moralis proxy (default: https://nft.keyring.app) */
@@ -1334,14 +1380,6 @@ interface AgentConfig {
1334
1380
  subagents?: {
1335
1381
  wallet?: boolean;
1336
1382
  'wallet-action'?: boolean;
1337
- /**
1338
- * Redirect-only variant of `wallet-action`. Instead of emitting in-chat
1339
- * forms, every tool just tells the user they can perform the action
1340
- * directly in the app (using `walletActionAppLink` when set). Mutually
1341
- * exclusive with `wallet-action`: enabling this (true) turns
1342
- * `wallet-action` off. Defaults to false.
1343
- */
1344
- 'wallet-action-app'?: boolean;
1345
1383
  token?: boolean;
1346
1384
  nft?: boolean;
1347
1385
  /**
@@ -1398,22 +1436,24 @@ interface AgentConfig {
1398
1436
  isProduction?: boolean;
1399
1437
  } | false;
1400
1438
  /**
1401
- * Website link for the NFT notice tools (`get-wallet-nfts`,
1402
- * `get-nft-metadata`, `get-nft-contract-info`). Supplied at AgentCore
1403
- * construction.
1439
+ * Tools that must NOT open a form in this deployment, mapped to the message
1440
+ * the user gets instead (e.g. "you can swap in the app: <link>").
1404
1441
  *
1405
- * Each tool emits a fixed message containing the phrase "this website". When
1406
- * this URL is set, that phrase is rendered as a Markdown link to it; when
1407
- * omitted, it stays as plain text. A single link is shared by all NFT tools.
1408
- */
1409
- nftLink?: string;
1410
- /**
1411
- * Link to the app where wallet actions are performed, used ONLY by the
1412
- * redirect-only `wallet-action-app` subagent. When set, its tools surface
1413
- * this URL as plain text so the user can open the app; when omitted, they
1414
- * just tell the user the action is done in the app.
1442
+ * Use this when a deployment exposes a smaller surface than the full one —
1443
+ * say an app build with no in-chat swap/buy. A named tool keeps its name and
1444
+ * routing (so the intent still lands on it) but collects nothing and never
1445
+ * runs: it just relays your message, translated into the user's language.
1446
+ *
1447
+ * Any registered tool can be named. Tools left out behave normally, and
1448
+ * omitting this entirely leaves every tool as-is.
1449
+ *
1450
+ * @example
1451
+ * noFormTools: {
1452
+ * 'open-swap-token-form': 'You can swap tokens in the app: https://app.example',
1453
+ * 'open-buy-token-form': 'Buying is available in the app.',
1454
+ * }
1415
1455
  */
1416
- walletActionAppLink?: string;
1456
+ noFormTools?: NoFormToolMessages;
1417
1457
  }
1418
1458
  interface LLMToolCall {
1419
1459
  toolName: string;
@@ -1678,8 +1718,6 @@ interface AgentResponse {
1678
1718
  * Format: 8-char hex derived from timestamp + random — unique within a session.
1679
1719
  */
1680
1720
  messageId: string;
1681
- /** Suggested follow-up prompts for the user */
1682
- suggestedPrompts?: string[];
1683
1721
  /**
1684
1722
  * UI components the FE should render this turn. Each entry is emitted by a
1685
1723
  * tool with kind='ui' or 'action'. Order preserved (subagent execution order).
@@ -1688,8 +1726,7 @@ interface AgentResponse {
1688
1726
  uiActions?: UIPayload[];
1689
1727
  /**
1690
1728
  * Tool-emitted clickable buttons aggregated across all subagent tool calls
1691
- * this turn. Distinct from `suggestedPrompts` (LLM-generated generic
1692
- * follow-ups) — these are deterministic disambiguation / picker buttons.
1729
+ * this turn — deterministic disambiguation / picker buttons.
1693
1730
  */
1694
1731
  actionButtons?: SuggestedAction[];
1695
1732
  /** Full ReAct trace (for debugging / logging) — flattened across all subagents */
@@ -1727,6 +1764,11 @@ declare class AgentCore {
1727
1764
  private debug;
1728
1765
  /** Caller-supplied license key; validated lazily on first chat() via assertLicense(). */
1729
1766
  private readonly secretKey;
1767
+ /**
1768
+ * True when the caller supplied their own Gemini API key (`llm.apiKey`), so
1769
+ * every LLM call goes straight to Google and the licence gate does not apply.
1770
+ */
1771
+ private readonly ownGeminiKey;
1730
1772
  /** True once the license has passed, so we only hash-check once. */
1731
1773
  private licenseChecked;
1732
1774
  private userContext;
@@ -1744,7 +1786,6 @@ declare class AgentCore {
1744
1786
  private vectorKBAutoIngestPromise;
1745
1787
  private autoIngestEnabled;
1746
1788
  private kbAnswerThreshold;
1747
- private suggestionsEnabled;
1748
1789
  private historyLoaded;
1749
1790
  private historyLoadingPromise;
1750
1791
  /**
@@ -1808,8 +1849,8 @@ declare class AgentCore {
1808
1849
  * args (e.g. a token-info screen that always calls `get-token-info`). Versus
1809
1850
  * `chat()` it saves ~3-4 LLM calls (no rewrite, no router, no per-tool ReAct
1810
1851
  * reasoning) and removes the risk of the LLM mis-parsing args, while still
1811
- * turning the raw tool DATA into a natural-language answer (+ suggestions,
1812
- * uiActions, actionButtons) so the FE renders it exactly like a chat turn.
1852
+ * turning the raw tool DATA into a natural-language answer (+ uiActions,
1853
+ * actionButtons) so the FE renders it exactly like a chat turn.
1813
1854
  *
1814
1855
  * Differs from {@link invokeTool}: invokeTool returns the tool's own `summary`
1815
1856
  * (+ UI) with NO LLM pass — right for action/UI tools (forms, redirects).
@@ -1822,7 +1863,6 @@ declare class AgentCore {
1822
1863
  */
1823
1864
  runTool(name: string, args: Record<string, unknown>, options?: {
1824
1865
  userMessage?: string;
1825
- generateSuggestions?: boolean;
1826
1866
  language?: string;
1827
1867
  signal?: AbortSignal;
1828
1868
  }): Promise<AgentResponse>;
@@ -1842,7 +1882,6 @@ declare class AgentCore {
1842
1882
  * `challenge` is the opaque blob from `X402PaymentRequiredProps.challenge`.
1843
1883
  */
1844
1884
  submitX402Payment(challenge: unknown, signature: string, options?: {
1845
- generateSuggestions?: boolean;
1846
1885
  userQuery?: string;
1847
1886
  }): Promise<AgentResponse>;
1848
1887
  /** Turn paid-API data into a natural-language answer for the original question. */
@@ -1878,17 +1917,21 @@ declare class AgentCore {
1878
1917
  private persistHistory;
1879
1918
  /**
1880
1919
  * Validate the license key against the hash baked into this bundle at build
1881
- * time (`__AGENT_LICENSE_HASH__`, set by tsup). We compare hashes, never the
1882
- * raw key, so the bundle never contains the key itself. When no key was baked
1883
- * in (local dev build with no SECRET_KEY) the hash is empty and the gate is a
1884
- * no-op. Cached after the first pass so we only hash once.
1920
+ * time (`__AGENT_LICENSE_HASH__`, set by tsup from `SECRET_KEY_HASH`). The
1921
+ * app passes the raw key; we hash it here and compare hash-to-hash, so
1922
+ * neither the bundle nor the repo ever holds the key itself. When no hash was
1923
+ * baked in (local dev build with no `SECRET_KEY_HASH`) the gate is a no-op.
1924
+ * Cached after the first pass so we only hash once.
1925
+ *
1926
+ * The gate exists to protect the Keyring-hosted Gemini proxy. A caller that
1927
+ * brings their own Gemini API key (`llm.apiKey`) talks to Google directly and
1928
+ * consumes nothing of ours, so no secretKey is required in that mode.
1885
1929
  */
1886
1930
  private assertLicense;
1887
1931
  /**
1888
1932
  * Process a user message and return an answer. Main entry point.
1889
1933
  */
1890
1934
  chat(userMessage: string, options?: {
1891
- generateSuggestions?: boolean;
1892
1935
  language?: string;
1893
1936
  signal?: AbortSignal;
1894
1937
  }): Promise<AgentResponse>;
@@ -1914,13 +1957,6 @@ declare class AgentCore {
1914
1957
  * 'action' attach a `ui` field to their ToolResult; the FE renders one
1915
1958
  * component per entry in the order they were produced.
1916
1959
  */
1917
- /**
1918
- * Return true when ANY tool successfully executed across the dispatched
1919
- * subagents carries `noSuggestions: true` in its registry definition. Used to
1920
- * skip the suggester for turns where the user is already pointed at a
1921
- * concrete next action (a form / preview).
1922
- */
1923
- private subResultsTriggerNoSuggestions;
1924
1960
  /**
1925
1961
  * Aggregate `actionButtons` emitted by tools across all subagent tool calls
1926
1962
  * this turn (e.g. a token-picker after the user said "send token" without
@@ -1997,7 +2033,6 @@ declare class AgentCore {
1997
2033
  private synthesiserHistory;
1998
2034
  private mergeTrace;
1999
2035
  private finaliseAnswer;
2000
- private generateSuggestions;
2001
2036
  getHistory(): ChatMessage[];
2002
2037
  /**
2003
2038
  * History filtered down to user-facing messages only — the user's prompts
@@ -2007,13 +2042,6 @@ declare class AgentCore {
2007
2042
  * (a pure tool-call turn). Use this to seed a chat UI on mount.
2008
2043
  */
2009
2044
  getDisplayHistory(): ChatMessage[];
2010
- /**
2011
- * Suggested follow-up prompts attached to the most recent final assistant
2012
- * turn, or `[]` if none. Used to re-seed suggestion chips after restoring
2013
- * a persisted session — the chips travel with the assistant message in
2014
- * storage, so this just locates the last one.
2015
- */
2016
- getLastSuggestions(): string[];
2017
2045
  clearHistory(): Promise<void>;
2018
2046
  restoreHistory(data: {
2019
2047
  messages: ChatMessage[];
@@ -2419,7 +2447,7 @@ declare const WALLET_ACTION_AGENT_TOOL_NAMES: readonly ["open-send-native-form",
2419
2447
  declare function createWalletActionAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
2420
2448
 
2421
2449
  /** Built-in subagent ids. */
2422
- type DefaultSubagentName = 'wallet' | 'wallet-action' | 'wallet-action-app' | 'token' | 'nft' | 'nfc' | 'pool' | 'pool-subgraph' | 'ai';
2450
+ type DefaultSubagentName = 'wallet' | 'wallet-action' | 'token' | 'nft' | 'nfc' | 'pool' | 'pool-subgraph' | 'ai';
2423
2451
  /**
2424
2452
  * Per-subagent enable flags. Default for every key is `true` EXCEPT
2425
2453
  * `pool-subgraph`, which defaults to `false` because it is mutually exclusive
@@ -2431,10 +2459,6 @@ type DefaultSubagentName = 'wallet' | 'wallet-action' | 'wallet-action-app' | 't
2431
2459
  * Turning `pool-subgraph` on automatically turns `pool` off unless the caller
2432
2460
  * has explicitly enabled `pool: true`. This prevents two pool agents from
2433
2461
  * competing for the same user query.
2434
- *
2435
- * Similarly, `wallet-action-app` (default off) is the redirect-only variant of
2436
- * `wallet-action`: enabling it turns `wallet-action` off. The two are mutually
2437
- * exclusive — only one wallet-action agent ever exists.
2438
2462
  */
2439
2463
  type SubagentToggles = Partial<Record<DefaultSubagentName, boolean>>;
2440
2464
  /**
@@ -2447,17 +2471,27 @@ type SubagentToggles = Partial<Record<DefaultSubagentName, boolean>>;
2447
2471
  declare function createDefaultSubagents(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions, toggles?: SubagentToggles): Subagent[];
2448
2472
 
2449
2473
  /**
2450
- * LLM provider that calls the Gemini-compatible proxy via fetch.
2451
- * No API key required — the proxy handles authentication.
2474
+ * LLM provider for the Gemini generateContent API. Two transports:
2475
+ *
2476
+ * • **Direct** — when `config.apiKey` is set, requests go straight to
2477
+ * {@link DIRECT_BASE_URL} authenticated with that key (`x-goog-api-key`).
2478
+ * • **Proxy** (default) — no key needed; {@link PROXY_BASE_URL} authenticates
2479
+ * on our behalf. Gated by the AgentCore licence check.
2480
+ *
2481
+ * The wire format is identical either way, so only the URL + headers differ.
2452
2482
  */
2453
2483
  declare class GeminiProvider implements LLMProvider {
2454
2484
  private model;
2455
2485
  private maxTokens;
2456
2486
  private temperature;
2457
2487
  private baseUrl;
2488
+ /** Caller's own Gemini key. Empty when running through the proxy. */
2489
+ private apiKey;
2458
2490
  /** Per-turn signal applied to every request until cleared. See setRequestSignal. */
2459
2491
  private requestSignal?;
2460
2492
  constructor(config: LLMProviderConfig);
2493
+ /** True when talking to Google directly with the caller's own key. */
2494
+ get isDirect(): boolean;
2461
2495
  /** @see LLMProvider.setRequestSignal */
2462
2496
  setRequestSignal(signal?: AbortSignal): void;
2463
2497
  chat(messages: ChatMessage[], tools?: ToolDefinition[], options?: ChatOptions): Promise<LLMResponse>;
@@ -2479,6 +2513,37 @@ declare abstract class BaseTool implements Tool {
2479
2513
  execute(args: Record<string, unknown>, userContext?: UserContext): Promise<ToolResult>;
2480
2514
  }
2481
2515
 
2516
+ /**
2517
+ * Replaces a tool that would open a form with one that just delivers a message.
2518
+ *
2519
+ * Some deployments expose a smaller surface than others — e.g. an app build with
2520
+ * no swap/buy screens in chat. Rather than maintaining a parallel set of
2521
+ * redirect-only tools (which drifts out of sync with the real ones), the real
2522
+ * tool is swapped out for this wrapper at registration time.
2523
+ *
2524
+ * It deliberately keeps the wrapped tool's `name` and `description` so the
2525
+ * router still picks it for the same intents, but drops the parameters (nothing
2526
+ * is collected) and never runs the original tool — so no API calls, no chain
2527
+ * reads, and no chance of a failure in work whose result would be discarded.
2528
+ */
2529
+ declare class NoFormTool implements Tool {
2530
+ readonly name: string;
2531
+ readonly description: string;
2532
+ readonly category?: string;
2533
+ /** Nothing is collected — the tool only relays a message. */
2534
+ readonly parameters: ToolParameter[];
2535
+ private readonly message;
2536
+ constructor(tool: Tool, message: string);
2537
+ execute(): Promise<ToolResult>;
2538
+ }
2539
+ /**
2540
+ * Register `tool`, or — when `messages` names it — a {@link NoFormTool} standing
2541
+ * in for it. Centralizes the check so every call site stays a one-liner.
2542
+ */
2543
+ declare function registerMaybeNoForm(registry: {
2544
+ register: (tool: Tool) => void;
2545
+ }, tool: Tool, messages?: NoFormToolMessages): void;
2546
+
2482
2547
  /**
2483
2548
  * MoralisService — Moralis Web3 API + Cortex AI proxy.
2484
2549
  *
@@ -2604,6 +2669,22 @@ interface NFTItem {
2604
2669
  collection_logo?: string;
2605
2670
  collection_banner_image?: string;
2606
2671
  }
2672
+ /**
2673
+ * One row of `GET /{address}/nft/collections` — an NFT collection the wallet
2674
+ * holds, rather than an individual token.
2675
+ */
2676
+ interface NFTCollectionItem {
2677
+ token_address: string;
2678
+ contract_type: 'ERC721' | 'ERC1155' | string;
2679
+ name?: string;
2680
+ symbol?: string;
2681
+ /** How many tokens of this collection the wallet holds. */
2682
+ count?: number;
2683
+ possible_spam?: boolean;
2684
+ verified_collection?: boolean;
2685
+ collection_logo?: string;
2686
+ collection_banner_image?: string;
2687
+ }
2607
2688
  type NFTContractMetadata = {
2608
2689
  token_address: string;
2609
2690
  name: string;
@@ -3108,6 +3189,31 @@ interface WalletDefiSummaryResponse {
3108
3189
  total_unclaimed_usd_value: number;
3109
3190
  protocols: DefiProtocolSummary[];
3110
3191
  }
3192
+ /** Raw response from v1 GET /wallets/{address}/defi/summary */
3193
+ interface WalletDefiSummaryV1Response {
3194
+ meta: {
3195
+ syncedAt?: Record<string, number | string>;
3196
+ unsupportedChains?: string[];
3197
+ failedChains?: string[];
3198
+ };
3199
+ result: {
3200
+ activeProtocols?: number;
3201
+ totalPositions?: number;
3202
+ totalUsd?: number;
3203
+ totalUnclaimedUsd?: number | null;
3204
+ protocols?: Array<{
3205
+ protocolId?: string;
3206
+ protocolName?: string;
3207
+ protocolUrl?: string;
3208
+ protocolLogo?: string;
3209
+ chainId?: string;
3210
+ positionCount?: number;
3211
+ totalUsd?: number;
3212
+ totalUnclaimedUsd?: number | null;
3213
+ accountHealthFactor?: number | null;
3214
+ }>;
3215
+ };
3216
+ }
3111
3217
  /**
3112
3218
  * A single token line inside a DeFi position (supplied, borrowed, reward, …).
3113
3219
  * Mirrors Moralis's `defiPositionToken` shape.
@@ -3443,7 +3549,16 @@ declare class MoralisService {
3443
3549
  chain?: string;
3444
3550
  }): Promise<MoralisApiResponse<TokenMetadata>>;
3445
3551
  /**
3446
- * Get NFTs owned by a wallet.
3552
+ * Get NFTs owned by a wallet, following Moralis' cursor pagination to the END
3553
+ * and aggregating every page into ONE `result` array — so callers get the
3554
+ * wallet's complete set (for the chain / collection filter) in a single call
3555
+ * rather than just the first page. Paging starts from the caller-supplied
3556
+ * `cursor` when given, and stops when Moralis returns no next cursor or the
3557
+ * {@link MAX_NFT_PAGES} safety cap is reached (the trailing `cursor` in the
3558
+ * response is then non-empty, so a caller could resume if it ever needs to).
3559
+ *
3560
+ * A page that fails after we've already gathered rows returns what we have
3561
+ * (best-effort); a failure on the very first page surfaces the error.
3447
3562
  */
3448
3563
  getWalletNFTs(params: {
3449
3564
  address: string;
@@ -3460,6 +3575,32 @@ declare class MoralisService {
3460
3575
  page?: number;
3461
3576
  page_size?: number;
3462
3577
  }>>;
3578
+ /**
3579
+ * Fetch ONE page of a wallet's NFTs, with retry/backoff. Internal helper for
3580
+ * {@link getWalletNFTs} — the cursor-following loop lives there; this just
3581
+ * resolves a single page (or a failure). A 400 is a deterministic client error,
3582
+ * so it breaks out of the retry loop immediately.
3583
+ */
3584
+ private fetchWalletNftsPage;
3585
+ /**
3586
+ * Get the NFT collections a wallet holds — one row per collection rather than
3587
+ * one per token. Used to let the user pick a collection before we fetch the
3588
+ * individual NFTs inside it.
3589
+ *
3590
+ * Moralis docs: https://docs.moralis.com/data-api/evm/wallet/nft-collections
3591
+ */
3592
+ getWalletNftCollections(params: {
3593
+ address: string;
3594
+ chain?: string;
3595
+ limit?: number;
3596
+ excludeSpam?: boolean;
3597
+ cursor?: string;
3598
+ }): Promise<MoralisApiResponse<{
3599
+ result: NFTCollectionItem[];
3600
+ cursor?: string;
3601
+ page?: number;
3602
+ page_size?: number;
3603
+ }>>;
3463
3604
  /**
3464
3605
  * Get the full metadata for a single NFT identified by its contract address
3465
3606
  * and token id via the Moralis `GET /nft/{address}/{token_id}` endpoint.
@@ -5007,51 +5148,63 @@ declare class TransactionByHashTool extends BaseTool {
5007
5148
  }>;
5008
5149
  }
5009
5150
 
5010
- /** Config for an NFT message tool — the optional website link it points to. */
5011
- interface NftMessageToolConfig {
5012
- /**
5013
- * Destination URL. When set, the "this website" phrase in the message becomes
5014
- * a Markdown link to it; when omitted/blank, the phrase stays plain text.
5015
- */
5016
- url?: string;
5017
- }
5018
- /**
5019
- * Shared base for the canned-message NFT notice tools (`get-wallet-nfts`,
5020
- * `get-nft-metadata`, `get-nft-contract-info`).
5021
- *
5022
- * Each tool emits one fixed sentence that points the user at a website. The
5023
- * phrase "this website" is rendered as a Markdown link to `config.url` when one
5024
- * was supplied at AgentCore construction; otherwise it stays plain text. The
5025
- * tool takes no arguments — it returns the fully-built Markdown message plus
5026
- * `_instructions` telling the agent to reply with it verbatim.
5027
- */
5028
- declare abstract class BaseNftMessageTool extends BaseTool {
5029
- kind: ToolKind;
5030
- category: string;
5031
- noSuggestions: boolean;
5032
- parameters: ToolParameter[];
5033
- /** The phrase inside the template that links to the website. */
5034
- protected readonly linkPhrase = "this website";
5035
- /** Message template containing the literal `{link}` placeholder. */
5036
- protected abstract readonly template: string;
5037
- /** Resolved (trimmed) URL, or undefined when none was configured. */
5038
- protected readonly url?: string;
5039
- constructor(config?: NftMessageToolConfig);
5040
- protected run(): Promise<unknown>;
5041
- }
5042
-
5043
- type WalletNFTsToolConfig = NftMessageToolConfig;
5151
+ type WalletNFTsToolConfig = MoralisServiceConfig;
5044
5152
  /**
5045
5153
  * Tool: get-wallet-nfts
5046
5154
  *
5047
- * Points the user to the NFT website instead of returning on-chain holdings.
5048
- * Emits a fixed NFT website notice; "this website" links to the configured
5049
- * `nftLink` URL when set, otherwise it stays plain text.
5155
+ * Two-step NFT browser. Only ERC-721 is reported in either step; ERC-1155
5156
+ * (editions / semi-fungibles) is filtered out.
5157
+ *
5158
+ * 1. No collection named ("show my NFTs") → list the wallet's COLLECTIONS via
5159
+ * `GET /{address}/nft/collections` and render one picker button per
5160
+ * collection, labelled with just the collection name.
5161
+ * 2. A collection named (the user typed it, or clicked a button, which submits
5162
+ * the collection name + contract address) → list the NFTs inside it via
5163
+ * `GET /{address}/nft`, each with image, name and token id.
5164
+ *
5165
+ * Moralis docs:
5166
+ * https://docs.moralis.com/data-api/evm/wallet/nft-collections
5167
+ * https://docs.moralis.com/data-api/evm/wallet/nft-balances
5050
5168
  */
5051
- declare class WalletNFTsTool extends BaseNftMessageTool {
5169
+ declare class WalletNFTsTool extends BaseTool {
5052
5170
  name: string;
5053
5171
  description: string;
5054
- protected readonly template = "Please view your NFT collection on {link} for more details";
5172
+ category: string;
5173
+ parameters: ToolParameter[];
5174
+ private service;
5175
+ constructor(config?: WalletNFTsToolConfig);
5176
+ protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
5177
+ ui: UIPayload<WalletNftListProps>;
5178
+ _instructions: string;
5179
+ walletAddress: string;
5180
+ collectionName: string;
5181
+ nftCount: number;
5182
+ error?: undefined;
5183
+ } | {
5184
+ error: string;
5185
+ } | {
5186
+ actionButtons?: SuggestedAction[] | undefined;
5187
+ _instructions: string;
5188
+ walletAddress: string;
5189
+ collectionCount: number;
5190
+ collections: {
5191
+ name: string;
5192
+ contractAddress: string;
5193
+ chain: string;
5194
+ nftCount: number | null;
5195
+ }[];
5196
+ error?: undefined;
5197
+ }>;
5198
+ private listCollections;
5199
+ private listNfts;
5200
+ /**
5201
+ * Resolve the image of every matched NFT from its on-chain `tokenURI`, grouped
5202
+ * by chain so each chain costs a single Multicall3 round-trip. Returns an array
5203
+ * positionally aligned with `matched`; each entry is a loadable image URL or
5204
+ * `null` when the on-chain URI was missing/unresolvable. Best-effort — any
5205
+ * failure degrades to `null` (and thus the Moralis fallback), never throwing.
5206
+ */
5207
+ private resolveOnchainImages;
5055
5208
  }
5056
5209
 
5057
5210
  /**
@@ -5140,7 +5293,6 @@ declare class NfcBuyTool extends BaseTool {
5140
5293
  kind: ToolKind;
5141
5294
  name: string;
5142
5295
  category: string;
5143
- noSuggestions: boolean;
5144
5296
  description: string;
5145
5297
  parameters: ToolParameter[];
5146
5298
  private llm?;
@@ -5624,7 +5776,6 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
5624
5776
  name: string;
5625
5777
  kind: ToolKind;
5626
5778
  category: string;
5627
- noSuggestions: boolean;
5628
5779
  description: string;
5629
5780
  parameters: ToolParameter[];
5630
5781
  private uniswap;
@@ -5709,7 +5860,6 @@ declare class PreviewAddLiquidityTool extends BaseTool {
5709
5860
  name: string;
5710
5861
  kind: ToolKind;
5711
5862
  category: string;
5712
- noSuggestions: boolean;
5713
5863
  description: string;
5714
5864
  parameters: ToolParameter[];
5715
5865
  private pool;
@@ -5756,7 +5906,6 @@ declare class PoolPriceRangesTool extends BaseTool {
5756
5906
  name: string;
5757
5907
  description: string;
5758
5908
  category: string;
5759
- noSuggestions: boolean;
5760
5909
  parameters: ToolParameter[];
5761
5910
  private service;
5762
5911
  constructor(config?: PoolPriceRangesToolConfig);
@@ -5778,7 +5927,6 @@ declare class ManageLiquidityRedirectTool extends BaseTool {
5778
5927
  name: string;
5779
5928
  description: string;
5780
5929
  category: string;
5781
- noSuggestions: boolean;
5782
5930
  parameters: ToolParameter[];
5783
5931
  protected run(args: Record<string, unknown>): Promise<{
5784
5932
  _instructions: string;
@@ -5801,7 +5949,6 @@ declare class SubgraphPoolSearchTool extends BaseTool {
5801
5949
  name: string;
5802
5950
  description: string;
5803
5951
  category: string;
5804
- noSuggestions: boolean;
5805
5952
  parameters: ToolParameter[];
5806
5953
  private service;
5807
5954
  constructor(config?: SubgraphPoolSearchToolConfig);
@@ -5876,7 +6023,6 @@ declare class SubgraphTrendingPoolsTool extends BaseTool {
5876
6023
  name: string;
5877
6024
  description: string;
5878
6025
  category: string;
5879
- noSuggestions: boolean;
5880
6026
  parameters: ToolParameter[];
5881
6027
  private service;
5882
6028
  constructor(config?: SubgraphTrendingPoolsToolConfig);
@@ -5929,7 +6075,6 @@ declare class SubgraphPoolByAddressTool extends BaseTool {
5929
6075
  name: string;
5930
6076
  description: string;
5931
6077
  category: string;
5932
- noSuggestions: boolean;
5933
6078
  parameters: ToolParameter[];
5934
6079
  private service;
5935
6080
  constructor(config?: SubgraphPoolByAddressToolConfig);
@@ -5993,7 +6138,6 @@ declare class SubgraphPoolByPositionIdTool extends BaseTool {
5993
6138
  name: string;
5994
6139
  description: string;
5995
6140
  category: string;
5996
- noSuggestions: boolean;
5997
6141
  parameters: ToolParameter[];
5998
6142
  private service;
5999
6143
  constructor(config?: SubgraphPoolByPositionIdToolConfig);
@@ -6069,7 +6213,6 @@ declare class SubgraphPositionDetailTool extends BaseTool {
6069
6213
  name: string;
6070
6214
  description: string;
6071
6215
  category: string;
6072
- noSuggestions: boolean;
6073
6216
  parameters: ToolParameter[];
6074
6217
  private service;
6075
6218
  constructor(config?: SubgraphPositionDetailToolConfig);
@@ -6178,7 +6321,6 @@ declare class SubgraphCoinPoolPairsTool extends BaseTool {
6178
6321
  name: string;
6179
6322
  description: string;
6180
6323
  category: string;
6181
- noSuggestions: boolean;
6182
6324
  parameters: ToolParameter[];
6183
6325
  private service;
6184
6326
  constructor(config?: SubgraphCoinPoolPairsToolConfig);
@@ -6243,7 +6385,6 @@ declare class SubgraphAddPoolTool extends BaseTool {
6243
6385
  name: string;
6244
6386
  description: string;
6245
6387
  category: string;
6246
- noSuggestions: boolean;
6247
6388
  parameters: ToolParameter[];
6248
6389
  private service;
6249
6390
  private linkAddLiquidity?;
@@ -6421,9 +6562,23 @@ interface ResolvedToken {
6421
6562
  declare abstract class BaseWalletActionTool extends BaseTool {
6422
6563
  kind: ToolKind;
6423
6564
  category: string;
6424
- noSuggestions: boolean;
6425
6565
  protected abstract readonly actionType: WalletActionType;
6426
6566
  protected abstract readonly component: string;
6567
+ /**
6568
+ * Build the UI payload the FE renders for this action. The default wraps the
6569
+ * resolved `parameters` in the shared {@link WalletActionProps} shape under
6570
+ * this tool's own `component` — which is all the send/approve forms need.
6571
+ *
6572
+ * Override to emit a component with a DIFFERENT props shape (the way
6573
+ * BuyTokenTool / SwapTokenTool ship their own): return any `UIPayload` and
6574
+ * the base forwards it untouched. `parameters` stays the tool's own resolved
6575
+ * map, so an override can pick from it or ignore it entirely.
6576
+ */
6577
+ protected buildUI(input: {
6578
+ parameters: Record<string, string>;
6579
+ chainId: string;
6580
+ walletAddress: string;
6581
+ }): UIPayload<unknown>;
6427
6582
  /**
6428
6583
  * The fields the *user* is expected to fill in the form, with a friendly,
6429
6584
  * user-facing label (in English — the LLM translates to the user's language).
@@ -6686,25 +6841,36 @@ declare class SendTokenTool extends BaseWalletActionTool {
6686
6841
  * Resolve the user's named token from their wallet balances in ONE call,
6687
6842
  * which doubles as the ownership check: a token to send must be held.
6688
6843
  *
6689
- * - Found with a non-zero balance → `{ token }` (address + symbol + decimals).
6844
+ * - Found with a non-zero balance → `{ token, spendable }` (address + symbol
6845
+ * + decimals, plus the held balance the form caps the amount against).
6690
6846
  * - Found but zero / not held → `{ error: 'no_balance' }`.
6691
6847
  * - Balances unavailable (no moralis / no wallet) → fall back to
6692
6848
  * {@link BaseWalletActionTool.resolveTokenRef} so resolution still works;
6693
- * we can't verify ownership in that case, so we don't block.
6849
+ * we can't verify ownership in that case, so we don't block. No balance was
6850
+ * read, so `spendable` is omitted.
6694
6851
  */
6695
6852
  private findOwnedTokenForSend;
6696
6853
  /**
6697
6854
  * Build a token-picker click-prompt from the LLM-supplied, already-localized
6698
6855
  * template (in the user's language) by substituting placeholders:
6699
6856
  * {symbol} → token symbol {amount} → the amount (or '') {to} → recipient 0x… (or '')
6700
- * The localized verb ("send"/"gửi"/…) and the "to" preposition live INSIDE
6701
- * the template, so we only ever substitute concrete values. The click-prompt
6702
- * is re-submitted as a fresh user turn, so keeping it in the user's language
6703
- * keeps that follow-up turn in the same language. Falls back to an English
6704
- * template when the LLM omits one. The full "{to}"-phrase is dropped when no
6705
- * recipient is known, so a trailing "đến"/"to" never dangles.
6857
+ * {chain} → chain name (or dropped)
6858
+ * The localized verb ("send"/"gửi"/…), the "to" preposition, and the "on
6859
+ * <chain>" preposition live INSIDE the template, so we only ever substitute
6860
+ * concrete values. The click-prompt is re-submitted as a fresh user turn, so
6861
+ * keeping it in the user's language keeps that follow-up turn in the same
6862
+ * language. Falls back to an English template when the LLM omits one. The full
6863
+ * "{to}"/"{chain}"-phrase (placeholder + its adjacent preposition) is dropped
6864
+ * when its value is unknown, so a trailing "đến"/"to"/"on" never dangles.
6706
6865
  */
6707
6866
  private buildSendPrompt;
6867
+ /**
6868
+ * Substitute a placeholder with its value, or — when the value is missing —
6869
+ * drop the placeholder together with its adjacent preposition token, which may
6870
+ * sit BEFORE it ("... to {to}", "... on {chain}") or AFTER it in languages with
6871
+ * postpositions ("{chain} で ..."). Try both, then remove any stray brace.
6872
+ */
6873
+ private fillOrDropPhrase;
6708
6874
  }
6709
6875
 
6710
6876
  /**
@@ -6778,7 +6944,6 @@ declare class BuyTokenTool extends BaseTool {
6778
6944
  name: string;
6779
6945
  kind: ToolKind;
6780
6946
  category: string;
6781
- noSuggestions: boolean;
6782
6947
  private readonly moralis?;
6783
6948
  /** Trending tokens come from Pantograph (top-gainers), not Moralis. */
6784
6949
  private readonly pantograph?;
@@ -7086,7 +7251,6 @@ declare class SwapTokenTool extends BaseTool {
7086
7251
  name: string;
7087
7252
  kind: ToolKind;
7088
7253
  category: string;
7089
- noSuggestions: boolean;
7090
7254
  private readonly moralis?;
7091
7255
  /** Trending tokens come from Pantograph (top-gainers), not Moralis. */
7092
7256
  private readonly pantograph?;
@@ -7269,10 +7433,6 @@ declare class SwapTokenTool extends BaseTool {
7269
7433
  private formatPrice;
7270
7434
  }
7271
7435
 
7272
- /** Optional NFT website link, shown when more than one owned NFT matches. */
7273
- interface SendNftToolConfig {
7274
- url?: string;
7275
- }
7276
7436
  /**
7277
7437
  * Tool: open-send-nft-form
7278
7438
  *
@@ -7281,20 +7441,20 @@ interface SendNftToolConfig {
7281
7441
  * { contract_address, token_id, to_address, token_standard, amount, maxAmount, nft_name }
7282
7442
  *
7283
7443
  * Resolution rules (in order):
7284
- * - No identifier at all → emit a fixed "no NFT specified" notice.
7444
+ * - No identifier at all → ask the user for the contract, token id and
7445
+ * recipient; nothing to pre-fill, so no form is opened.
7285
7446
  * - contract_address + token_id → confirm ownership; emit form (image + name +
7286
7447
  * token_standard + maxAmount come from the wallet row). Not held → error.
7287
7448
  * - contract_address only → list the user's holdings in that collection.
7288
- * • 0 → error • 1 → form • >1 → website notice.
7449
+ * • 0 → error • 1 → form pre-filled • >1 → empty form.
7289
7450
  * - token_id only → list all owned NFTs whose token_id matches.
7290
- * • 0 → error • 1 → form • >1 → website notice.
7451
+ * • 0 → error • 1 → form pre-filled • >1 → empty form.
7291
7452
  * - nft_name only → fuzzy-match against owned NFTs' names.
7292
- * • 0 → error • 1 → form • >1 → website notice.
7453
+ * • 0 → error • 1 → form pre-filled • >1 → empty form.
7293
7454
  *
7294
7455
  * When more than one owned NFT matches we cannot safely pick one for the user,
7295
- * so we return a fixed notice pointing them to the NFT website (Markdown link
7296
- * when `url` is configured, plain text otherwise) — matching the pattern used
7297
- * by the other NFT notice tools.
7456
+ * so we still open the form (carrying only what the user typed) and let the FE
7457
+ * handle the selection.
7298
7458
  */
7299
7459
  declare class SendNftTool extends BaseWalletActionTool {
7300
7460
  name: string;
@@ -7304,25 +7464,9 @@ declare class SendNftTool extends BaseWalletActionTool {
7304
7464
  readonly key: "to_address";
7305
7465
  readonly label: "the recipient address";
7306
7466
  }];
7307
- /** Resolved (trimmed) NFT website URL, used when >1 owned NFTs match. */
7308
- private readonly url?;
7309
- constructor(config?: MoralisServiceConfig, options?: SendNftToolConfig);
7310
7467
  description: string;
7311
7468
  parameters: ToolParameter[];
7312
- protected buildParameters(args: Record<string, unknown>, userContext?: UserContext): Promise<Record<string, string> | {
7313
- error: "no_nft_specified" | "multiple_nfts_matched";
7314
- message: string;
7315
- _instructions: string;
7316
- }>;
7317
- /**
7318
- * Fixed "go to the NFT website" notice. Used whenever we cannot safely
7319
- * resolve a single NFT to pre-fill the form — either the user named none
7320
- * (`no_nft_specified`) or more than one owned NFT matched
7321
- * (`multiple_nfts_matched`). The phrase "this website" becomes a Markdown
7322
- * link when a URL is configured; otherwise it stays plain text. Mirrors the
7323
- * pattern used by the other NFT notice tools.
7324
- */
7325
- private websiteNotice;
7469
+ protected buildParameters(args: Record<string, unknown>, userContext?: UserContext): Promise<Record<string, string>>;
7326
7470
  private normaliseString;
7327
7471
  private normaliseTokenId;
7328
7472
  private normaliseAmountInt;
@@ -7332,77 +7476,6 @@ declare class SendNftTool extends BaseWalletActionTool {
7332
7476
  private paramsFromNft;
7333
7477
  }
7334
7478
 
7335
- /**
7336
- * Config for the redirect-only wallet-action tools used by the
7337
- * `wallet-action-app` subagent.
7338
- */
7339
- interface WalletActionAppToolConfig {
7340
- /**
7341
- * Optional link to the app where the user performs the action. When set, the
7342
- * tool surfaces it as plain text so the user can open the app directly. When
7343
- * omitted, the tool just tells the user the action is done in the app.
7344
- */
7345
- appLink?: string;
7346
- /**
7347
- * Optional NFT website link, used ONLY by the send-NFT tool. Mirrors the
7348
- * `wallet-action` SendNftTool: when set, the notice carries a clickable
7349
- * Markdown link to this URL; when omitted, the website phrase stays plain
7350
- * text. Separate from `appLink` because sending an NFT is done on the NFT
7351
- * website, not the wallet-action app.
7352
- */
7353
- nftLink?: string;
7354
- }
7355
- interface ActionSpec {
7356
- /** Tool name — mirrors the matching `wallet-action` form tool it replaces. */
7357
- name: string;
7358
- /** Routing description so the agent picks this tool for the matching intent. */
7359
- description: string;
7360
- /** Human phrase used in the redirect message, e.g. "send a token". */
7361
- what: string;
7362
- /**
7363
- * Which link the redirect points to. `'app'` (default) → the wallet-action
7364
- * app (`appLink`); `'nft'` → the NFT website (`nftLink`), matching how the
7365
- * `wallet-action` SendNftTool points NFT sends to the NFT site.
7366
- */
7367
- linkKind?: 'app' | 'nft';
7368
- }
7369
- /**
7370
- * Redirect-only wallet-action tool.
7371
- *
7372
- * The `wallet-action-app` subagent is a variant of `wallet-action` for
7373
- * deployments where the action is NOT performed in chat. Instead of emitting a
7374
- * pre-filled form, every tool returns a static instruction telling the user
7375
- * they can perform the action directly in the app. No API calls, no chain
7376
- * reads, no parameters.
7377
- */
7378
- declare class WalletActionAppTool extends BaseTool {
7379
- name: string;
7380
- description: string;
7381
- category: string;
7382
- noSuggestions: boolean;
7383
- parameters: ToolParameter[];
7384
- private readonly what;
7385
- private readonly linkKind;
7386
- private readonly appLink?;
7387
- private readonly nftLink?;
7388
- constructor(spec: ActionSpec, config?: WalletActionAppToolConfig);
7389
- protected run(): Promise<{
7390
- message: string;
7391
- _instructions: string;
7392
- } | {
7393
- url?: string | undefined;
7394
- _instructions: string;
7395
- }>;
7396
- /**
7397
- * Fixed "go to the NFT website" notice — byte-for-byte the same pattern as
7398
- * the `wallet-action` SendNftTool: the website phrase becomes a clickable
7399
- * Markdown link when `nftLink` is configured, plain text otherwise.
7400
- */
7401
- private nftWebsiteNotice;
7402
- }
7403
- /** Create the full set of redirect-only wallet-action tools. */
7404
- declare function createWalletActionAppTools(config?: WalletActionAppToolConfig): WalletActionAppTool[];
7405
-
7406
7479
  /**
7407
7480
  * Shared JSON-RPC client + default public RPC endpoints.
7408
7481
  *
@@ -7467,8 +7540,8 @@ interface X402RetryContext {
7467
7540
  headers?: Record<string, string>;
7468
7541
  }
7469
7542
  /**
7470
- * Resolve a 402 challenge into the header(s) to retry with (e.g.
7471
- * `{ 'PAYMENT-SIGNATURE': '…' }`), or `null` to give up (caller sees the 402).
7543
+ * Resolve a 402 challenge into the header(s) to retry with — `PAYMENT-SIGNATURE`
7544
+ * for x402 v2, `X-PAYMENT` for v1 — or `null` to give up (caller sees the 402).
7472
7545
  */
7473
7546
  type X402RetryHandler = (response: ApiResponse, ctx: X402RetryContext) => Promise<Record<string, string> | null>;
7474
7547
  type RequestOptions = Omit<AxiosRequestConfig, 'url' | 'method' | 'data' | 'baseURL'>;
@@ -7489,17 +7562,36 @@ declare const apiClient: ApiClient;
7489
7562
  /**
7490
7563
  * Generic x402 (HTTP 402 "pay-per-call") client for the agent core.
7491
7564
  *
7492
- * The core makes the outbound HTTP call. When a resource answers `402` with a
7493
- * `PAYMENT-REQUIRED` header, the core does NOT hold a private key, so it builds
7494
- * the payment authorization + the EIP-712 typed data and hands the typed data to
7495
- * the FE to SIGN. The FE returns just the signature; the core then re-issues the
7496
- * request with the `PAYMENT-SIGNATURE` header and returns the unlocked result.
7497
- *
7498
- * Supports the x402 v2 "exact" EVM scheme (EIP-3009 `TransferWithAuthorization`),
7499
- * which covers USDC-style assets. No crypto library is needed here — signing
7500
- * happens on the FE; the core only does JSON + base64 + a random nonce.
7565
+ * The core makes the outbound HTTP call. When a resource answers `402`, the core
7566
+ * does NOT hold a private key, so it builds the payment authorization + the
7567
+ * EIP-712 typed data and hands the typed data to the FE to SIGN. The FE returns
7568
+ * just the signature; the core then re-issues the request with the payment
7569
+ * header and returns the unlocked result.
7570
+ *
7571
+ * Supports BOTH protocol versions of the "exact" EVM scheme (EIP-3009
7572
+ * `TransferWithAuthorization`), which covers USDC-style assets. The cryptography
7573
+ * is identical across versions — only the transport and field names differ:
7574
+ *
7575
+ * | | v1 | v2 |
7576
+ * |---|---|---|
7577
+ * | challenge | 402 + JSON **body** | 402 + `PAYMENT-REQUIRED` header (base64) |
7578
+ * | retry header | `X-PAYMENT` | `PAYMENT-SIGNATURE` |
7579
+ * | price field | `maxAmountRequired` | `amount` |
7580
+ * | network | `"base-sepolia"` | CAIP-2 `"eip155:84532"` |
7581
+ * | payload | flat `{scheme, network, payload}` | `{accepted, resource, payload}` |
7582
+ * | receipt | `X-PAYMENT-RESPONSE` | `PAYMENT-RESPONSE` |
7583
+ *
7584
+ * The version is DETECTED from the 402 (never assumed), normalized into one
7585
+ * internal shape, and re-encoded in the detected version's wire format on retry.
7586
+ * No crypto library is needed here — signing happens on the FE; the core only
7587
+ * does JSON + base64 + a random nonce.
7588
+ *
7589
+ * @see specs/x402-specification-v1.md + specs/transports-v1/http.md
7590
+ * @see specs/x402-specification-v2.md + specs/transports-v2/http.md
7501
7591
  */
7502
7592
  type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
7593
+ /** Protocol version of a challenge. Detected from the 402, never assumed. */
7594
+ type X402Version = 1 | 2;
7503
7595
  /** A request the core wants to make (and replay after payment). */
7504
7596
  interface X402RequestSpec {
7505
7597
  url: string;
@@ -7511,10 +7603,19 @@ interface X402RequestSpec {
7511
7603
  /** Extra request headers (the payment header is added on retry). */
7512
7604
  headers?: Record<string, string>;
7513
7605
  }
7514
- /** Selected payment requirement from the 402 challenge (accepts[0]). */
7606
+ /**
7607
+ * A payment requirement from the 402 challenge, NORMALIZED across versions.
7608
+ *
7609
+ * `network` and `amount` are always kept VERBATIM as the server sent them, so
7610
+ * the retry echoes back exactly what the facilitator expects to match (v1
7611
+ * facilitators compare `network` string-equal against `"base-sepolia"`). The
7612
+ * derived, version-independent values live in `chainId` / `amountRaw`.
7613
+ */
7515
7614
  interface X402Requirements {
7516
7615
  scheme: string;
7616
+ /** Verbatim from the server: v1 `"base-sepolia"`, v2 CAIP-2 `"eip155:84532"`. */
7517
7617
  network: string;
7618
+ /** Smallest unit, e.g. "10000" = 0.01 USDC (6 dp). v1 sends it as `maxAmountRequired`. */
7518
7619
  amount: string;
7519
7620
  asset: string;
7520
7621
  payTo: string;
@@ -7524,6 +7625,11 @@ interface X402Requirements {
7524
7625
  version?: string;
7525
7626
  [k: string]: unknown;
7526
7627
  };
7628
+ /** v1-only fields, preserved so the retry can echo the requirement verbatim. */
7629
+ resource?: string;
7630
+ description?: string;
7631
+ mimeType?: string;
7632
+ outputSchema?: unknown;
7527
7633
  }
7528
7634
  /** EIP-712 typed data the FE must sign with the connected wallet. */
7529
7635
  interface X402TypedData {
@@ -7560,19 +7666,16 @@ interface X402Challenge {
7560
7666
  body?: unknown;
7561
7667
  headers?: Record<string, string>;
7562
7668
  };
7669
+ /** Protocol version detected from the 402 — decides the retry wire format. */
7670
+ x402Version: X402Version;
7563
7671
  requirements: X402Requirements;
7564
7672
  authorization: X402Authorization;
7565
7673
  typedData: X402TypedData;
7566
- /** The signed wire payload, missing only `payload.signature`. */
7567
- paymentDraft: {
7568
- x402Version: number;
7569
- payload: {
7570
- authorization: X402Authorization;
7571
- };
7572
- resource?: unknown;
7573
- accepted: X402Requirements;
7574
- extensions?: unknown;
7575
- };
7674
+ /** EVM chain id resolved from `requirements.network` (both version formats). */
7675
+ chainId: number;
7676
+ /** v2-only passthrough: the `resource` / `extensions` objects echoed on retry. */
7677
+ resource?: unknown;
7678
+ extensions?: unknown;
7576
7679
  /** The user's original question, so phase 2 can synthesize an answer. */
7577
7680
  userQuery?: string;
7578
7681
  }
@@ -7583,7 +7686,38 @@ type X402Outcome = {
7583
7686
  status: 'payment_required';
7584
7687
  challenge: X402Challenge;
7585
7688
  };
7586
- /** Build the challenge (authorization + typed data + replay payload) from a 402. */
7689
+ /** Settlement receipt the server returns after a successful paid request. */
7690
+ interface X402Receipt {
7691
+ success: boolean;
7692
+ errorReason?: string;
7693
+ transaction: string;
7694
+ network: string;
7695
+ payer: string;
7696
+ }
7697
+ /** The 402 challenge as it arrives on the wire, before normalization. */
7698
+ interface RawPaymentRequired {
7699
+ x402Version?: number;
7700
+ accepts?: Array<Record<string, unknown>>;
7701
+ resource?: unknown;
7702
+ extensions?: unknown;
7703
+ error?: string;
7704
+ }
7705
+ /**
7706
+ * Read the 402 challenge from EITHER transport and report which version it is.
7707
+ *
7708
+ * v2 puts a base64 `PaymentRequired` in the `PAYMENT-REQUIRED` header; v1 puts a
7709
+ * plain-JSON `PaymentRequirementsResponse` in the response BODY. The header is
7710
+ * checked first because it is unambiguous — a v2 server may also write a body,
7711
+ * but a v1 server never writes that header.
7712
+ *
7713
+ * Returns `null` when the response carries no x402 challenge at all (so a plain
7714
+ * 402 from a non-x402 API is passed through untouched rather than misread).
7715
+ */
7716
+ declare function readPaymentRequired(res: ApiResponse): {
7717
+ version: X402Version;
7718
+ payload: RawPaymentRequired;
7719
+ } | null;
7720
+ /** Build the challenge (authorization + typed data) from a 402, for either version. */
7587
7721
  declare function buildChallenge(res: ApiResponse, req: X402RequestSpec, payer: string, userQuery?: string): X402Challenge;
7588
7722
  /**
7589
7723
  * Make the request. Returns the data when free/already-paid, or a challenge to
@@ -7595,18 +7729,99 @@ declare function requestWithX402(client: ApiClient, req: X402RequestSpec, payer:
7595
7729
  * return the unlocked data. Throws with the facilitator's reason on failure.
7596
7730
  */
7597
7731
  declare function completeX402(client: ApiClient, challenge: X402Challenge, signature: string): Promise<unknown>;
7598
- /** Encode the signed payment as the `PAYMENT-SIGNATURE` retry header. */
7732
+ /**
7733
+ * Does this response carry an x402 challenge? True for either transport — the v2
7734
+ * `PAYMENT-REQUIRED` header or a v1 JSON body with an `accepts` array.
7735
+ *
7736
+ * Use this to tell "the resource wants payment" apart from an ordinary 402
7737
+ * (a quota error, a proxy's own 402) that must NOT open a payment prompt.
7738
+ */
7739
+ declare function isPaymentRequired(res: ApiResponse): boolean;
7740
+ /**
7741
+ * Why a paid retry was rejected, from whichever channel the server used: the
7742
+ * settlement receipt's `errorReason` (e.g. "insufficient_funds") or the
7743
+ * re-issued challenge's `error` (e.g. "invalid_exact_evm_insufficient_balance").
7744
+ * Covers both versions, since each carries these in a different place.
7745
+ *
7746
+ * Returns the bare reason, or `null` when the response explains nothing — see
7747
+ * {@link paymentFailureReason} for the caller-facing, prefixed message.
7748
+ */
7749
+ declare function readPaymentError(res: ApiResponse): string | null;
7750
+ /**
7751
+ * Encode the signed payment as the retry header for the challenge's version.
7752
+ *
7753
+ * v1 → `X-PAYMENT` with a FLAT payload (`{x402Version, scheme, network, payload}`).
7754
+ * v2 → `PAYMENT-SIGNATURE` with the nested payload (`{accepted, resource, payload}`).
7755
+ *
7756
+ * `scheme` / `network` / `accepted` are echoed exactly as the server sent them,
7757
+ * because facilitators match the retry against the original requirement.
7758
+ */
7599
7759
  declare function encodeSignedHeader(challenge: X402Challenge, signature: string): Record<string, string>;
7760
+ /**
7761
+ * Decode the settlement receipt the server returns on a successful paid call
7762
+ * (`PAYMENT-RESPONSE` in v2, `X-PAYMENT-RESPONSE` in v1). Returns `null` when
7763
+ * the server sent none — the receipt is informational, never required.
7764
+ */
7765
+ declare function readReceipt(res: ApiResponse): X402Receipt | null;
7600
7766
  /** Human-readable payment details for a confirmation UI, derived from a challenge. */
7601
- declare function displayFromChallenge(challenge: X402Challenge): {
7767
+ interface X402Display {
7768
+ /** Human amount, already scaled by the token's on-chain `decimals()` (e.g. "0.01"). */
7602
7769
  amount: string;
7770
+ /** The payment token's on-chain `symbol()`, falling back to the 402's domain name. */
7603
7771
  asset: string;
7772
+ /** Raw smallest-unit amount, exactly as the resource demanded it. */
7773
+ amountRaw: string;
7774
+ /** On-chain `decimals()`, or null when the token could not be read. */
7775
+ decimals: number | null;
7776
+ /** Payment token contract address. */
7777
+ assetAddress: string;
7778
+ /**
7779
+ * CANONICAL CAIP-2 network id (`"eip155:8453"`), normalized so a v1 and a v2
7780
+ * challenge for the same chain produce the same value. Falls back to the raw
7781
+ * identifier only when the chain could not be resolved.
7782
+ *
7783
+ * This is NOT what the server sent for v1 (which uses names like
7784
+ * `"base-sepolia"`) — see {@link networkRaw} for that. Display code should
7785
+ * prefer {@link networkLabel}, and chain logic {@link chainId}.
7786
+ */
7604
7787
  network: string;
7788
+ /**
7789
+ * The network id exactly as the server sent it — v1 `"base-sepolia"`, v2
7790
+ * `"eip155:84532"`. For debugging and echoing back only; never key on it,
7791
+ * since its format depends on the protocol version.
7792
+ */
7793
+ networkRaw: string;
7794
+ /**
7795
+ * Decimal EVM chain id, already resolved from EITHER protocol version's
7796
+ * network format (v2 CAIP-2 or a v1 legacy name).
7797
+ *
7798
+ * Hosts should key on THIS rather than parsing `network` themselves: the two
7799
+ * versions encode the chain differently, so a host-side parser would need to
7800
+ * know both formats and the v1 name table to avoid silently failing on one of
7801
+ * them. Typed nullable for forward compatibility with non-EVM schemes; for a
7802
+ * challenge from {@link buildChallenge} it is always set, since a network that
7803
+ * cannot be resolved is rejected before a challenge is produced.
7804
+ */
7805
+ chainId: number | null;
7605
7806
  networkLabel: string;
7606
7807
  payTo: string;
7607
7808
  description?: string;
7608
7809
  resourceUrl?: string;
7609
- };
7810
+ }
7811
+ /**
7812
+ * Build the confirmation-UI payload for a challenge.
7813
+ *
7814
+ * The 402 states its price in the token's SMALLEST unit and does not carry the
7815
+ * token's symbol (`extra.name` is the EIP-712 domain name — "USD Coin", not
7816
+ * "USDC" — and is absent on many tokens). So this reads `symbol()` + `decimals()`
7817
+ * for the payment token in ONE Multicall3 round-trip and formats the amount by
7818
+ * those decimals, rather than showing "10000" or assuming 6-dp USDC.
7819
+ *
7820
+ * Best-effort: if the chain is unknown to the RPC layer or the reads fail, the
7821
+ * amount stays the raw smallest-unit string and `decimals` is null, so a wrong
7822
+ * scale is never shown as if it were a real price.
7823
+ */
7824
+ declare function displayFromChallenge(challenge: X402Challenge): Promise<X402Display>;
7610
7825
  /**
7611
7826
  * Build a global {@link X402RetryHandler} for {@link setX402Handler}: on a 402 it
7612
7827
  * builds the challenge, asks the host signer to sign, and returns the
@@ -8018,4 +8233,4 @@ declare class AbortError extends Error {
8018
8233
  */
8019
8234
  declare function isAbortError(err: unknown): boolean;
8020
8235
 
8021
- export { AI_AGENT_TOOL_NAMES, AbortError, type AddLiquidityFormProps, type AddLiquiditySummary, type AffiliateFee, type AgentConfig, AgentCore, type AgentResponse, ApproveTokenTool, BaseNftAiTool, BaseNftMessageTool, BaseSwapService, BaseTool, BaseWalletActionTool, type BuyTokenConfirmTxProps, type BuyTokenSide, BuyTokenTool, type ChainMeta, type ChainRef, type ChainSelector, ChatHistory, type ChatMessage, type ChatOptions, type ChatRole, type CheckApprovalParams, type CheckApprovalResult, type ConfirmAddLiquidityTxProps, type CortexResponse, DEFAULT_CHAIN, DEFAULT_PROVIDER, DEFAULT_RPC_BY_CHAIN, DebridgeAdapter, type DecodedCall, type DecodedEvent, type DecodedParam, type DefaultSubagentName, type DefiPosition, type DefiPositionDetails, type DefiPositionToken, type DefiProtocolSummary, EstimatePoolYieldTool, type EstimatePoolYieldToolConfig, type ExchangeProviderConfig, type ExecuteSwapParams, type ExecuteSwapResult, GeminiProvider, GeminiSearchAiTool, type GeminiSearchAiToolConfig, HEX_TO_PANTOGRAPH, type HolderChangePeriod, type HolderSupplyTier, type HttpMethod, type IngestKnowledgeBaseInput, type IngestKnowledgeBaseResult, type InputTokenInfo, type KBSearchResult, KnowledgeBase, type KnowledgeBaseEntry, type KnowledgeBaseProvider, type LLMProvider, type LLMProviderConfig, type LLMResponse, type LLMToolCall, ManageLiquidityRedirectTool, type MarketplaceLink, type MoralisApiResponse, MoralisService, type MoralisServiceConfig, NFC_AGENT_TOOL_NAMES, NFC_AMAZON_DEFAULT_DOMAIN, NFC_AMAZON_DOMAINS, NFTContractInfoTool, type NFTContractMetadata, type NFTItem, type NFTLastSale, type NFTMetadata, NFTMetadataTool, NFT_AGENT_TOOL_NAMES, type NativeTokenInfo, NfcBuyTool, NfcInfoTool, type NftMessageToolConfig, type NftTransferLastSale, OpenAddLiquidityFormTool, type OpenAddLiquidityFormToolConfig, POOL_AGENT_TOOL_NAMES, PantographService, type PantographServiceConfig, type PaymentToken, PoolByAddressTool, type PoolByAddressToolConfig, PoolDetailTool, type PoolDetailToolConfig, type PoolDisplayInfo, PoolFallbackAiTool, type PoolFallbackAiToolConfig, type PoolOnchainInfo, PoolPriceRangesTool, type PoolPriceRangesToolConfig, PoolSearchTool, type PoolSearchToolConfig, PoolService, type PoolServiceConfig, type PresetInputs, PreviewAddLiquidityTool, type PreviewAddLiquidityToolConfig, type PriceBounds, type PriceRangePrefill, type ProviderName, type QuickRate, type RangePreset, type ReActPhase, type ReActStep, type ReActTrace, RelayAdapter, type ResolvedRange, Router, type RouterAssignment, type RouterDecision, SUPPORTED_CHAINS, SUPPORTED_CHAINS_LABEL, SWAP_PROVIDER_CONFIG, SendNativeTool, SendNftTool, SendTokenTool, type StorageProvider, Subagent, type SubagentCard, type SubagentOptions, type SubagentParams, type SubagentResult, type SubagentTask, type SubagentToggles, SubgraphAddPoolTool, type SubgraphAddPoolToolConfig, SubgraphCoinPoolPairsTool, type SubgraphCoinPoolPairsToolConfig, SubgraphPoolByAddressTool, type SubgraphPoolByAddressToolConfig, SubgraphPoolByPositionIdTool, type SubgraphPoolByPositionIdToolConfig, SubgraphPoolSearchTool, type SubgraphPoolSearchToolConfig, SubgraphPositionDetailTool, type SubgraphPositionDetailToolConfig, SubgraphTrendingPoolsTool, type SubgraphTrendingPoolsToolConfig, type SuggestedAction, Summarizer, type SupportedChainId, type SupportedChainName, type SwapQuoteParams, type SwapQuoteResult, type SwapServiceConfig, SwapServiceFactory, type SwapTokenConfirmTxProps, SwapTokenTool, type SwapTxData, Synthesizer, TOKEN_AGENT_TOOL_NAMES, TRANSFER_TOPIC, TRENDING_DEFAULT_BY_HEX_CHAIN, type TokenAnalyticsResponse, type TokenAnalyticsTimeframeBuckets, TokenAnalyticsTool, type TokenAnalyticsToolConfig, type TokenApproval, type TokenApprovalSpender, type TokenApprovalToken, type TokenBalance, type TokenDisplay, type TokenHoldersResponse, TokenHoldersTool, type TokenHoldersToolConfig, TokenInfoTool, type TokenInfoToolConfig, type TokenMetadata, type TokenScoreMetrics, type TokenScoreResponse, type TokenScoreSupply, type TokenScoreTimeframeBuckets, TokenScoreTool, type TokenScoreToolConfig, type Tool, type ToolDefinition, type ToolKind, type ToolParameter, ToolRegistry, type ToolResult, type TopGainerTimeFrames, type TopGainerToken, type TopGainersTimeFrame, TopGainersTool, type TopGainersToolConfig, TopPoolsTool, type TopPoolsToolConfig, type TrackStatus, type TrackTransactionParams, type TrackTransactionResult, type TransactionByHashResponse, TransactionByHashTool, type TransactionByHashToolConfig, type TransactionLog, type TransactionReceipt, type TransactionReceiptLog, type TrendingToken, type TrendingTokenTimeframeBuckets, TrendingTokensTool, type TrendingTokensToolConfig, type UIPayload, UNISWAP_CHAIN_SLUG, type UnsignedTx, type UpstashEmbedStrategy, type UpstashFusionAlgorithm, type UpstashKBUpsertEntry, UpstashKnowledgeBase, type UpstashKnowledgeBaseConfig, type UserContext, type VectorKBConfig, WALLET_ACTION_AGENT_TOOL_NAMES, WALLET_AGENT_TOOL_NAMES, WalletActionAppTool, type WalletActionAppToolConfig, type WalletActionProps, type WalletActionType, type WalletApprovalsResponse, WalletApprovalsTool, type WalletApprovalsToolConfig, type WalletDefiPositionSummary, WalletDefiPositionsTool, type WalletDefiPositionsToolConfig, type WalletDefiPositionsV1Response, type WalletDefiProtocolPositionsResponse, WalletDefiProtocolPositionsTool, type WalletDefiProtocolPositionsToolConfig, type WalletDefiProtocolPositionsV1Response, type WalletDefiSummaryResponse, WalletDefiSummaryTool, type WalletDefiSummaryToolConfig, type WalletHistoryCategory, type WalletHistoryContractInteraction, type WalletHistoryErc20Transfer, type WalletHistoryItem, type WalletHistoryNativeTransfer, type WalletHistoryNftTransfer, type WalletHistoryResponse, WalletHistoryTool, type WalletHistoryToolConfig, WalletNFTsTool, type WalletNFTsToolConfig, type WalletNftTransferItem, type WalletNftTransfersResponse, WalletNftTransfersTool, type WalletNftTransfersToolConfig, type WalletPnlDaysWindow, type WalletPnlResponse, type WalletPnlSummaryResponse, WalletPnlSummaryTool, type WalletPnlSummaryToolConfig, type WalletPnlTokenItem, WalletPnlTool, type WalletPnlToolConfig, WalletTokenBalancesTool, type WalletTokenBalancesToolConfig, type WalletTokenTransferItem, type WalletTokenTransfersResponse, WalletTokenTransfersTool, type WalletTokenTransfersToolConfig, type WebsiteTrustExtraData, type WebsiteTrustInput, WebsiteTrustKeyringAgent, type WebsiteTrustKeyringAgentConfig, type WebsiteTrustResult, type X402Authorization, type X402Challenge, type X402Outcome, type X402PaymentRequiredProps, type X402RequestSpec, type X402Requirements, type X402SignRequest, type X402Signer, type X402TypedData, ZERO_ADDRESS, amazonDomainForLanguage, apiClient, buildChallenge, buildRangePresets, buildUniswapPoolUrl, clampTick, completeX402, configureSupportedChains, createAiAgent, createDefaultSubagents, createNfcAgent, createNftAgent, createPoolAgent, createTokenAgent, createWalletActionAgent, createWalletActionAppTools, createWalletAgent, createX402SignatureProvider, displayFromChallenge, encodeSignedHeader, ethCallAt, ethCallByChain, fetchTopMarketplaces, getAffiliateFee, getChainMeta, getDefaultRpcUrl, getGatewayAddress, getGatewayChains, getNativeTokenInfo, getPositionManagerAddress, getProviderByChain, ingestKnowledgeBase, isAbortError, nfcAmazonSearchUrl, normaliseCountry, normalizePriceRangeToPool, priceToTick, requestWithX402, resolveNfcShopLinks, resolveRpcUrl, roundTickToSpacing, rpcCall, setRpcOverrides, swapServiceFactory, tickToPrice, toPantographChain };
8236
+ export { AI_AGENT_TOOL_NAMES, AbortError, type AddLiquidityFormProps, type AddLiquiditySummary, type AffiliateFee, type AgentConfig, AgentCore, type AgentResponse, ApproveTokenTool, BaseNftAiTool, BaseSwapService, BaseTool, BaseWalletActionTool, type BuyTokenConfirmTxProps, type BuyTokenSide, BuyTokenTool, type ChainMeta, type ChainRef, type ChainSelector, ChatHistory, type ChatMessage, type ChatOptions, type ChatRole, type CheckApprovalParams, type CheckApprovalResult, type ConfirmAddLiquidityTxProps, type CortexResponse, DEFAULT_CHAIN, DEFAULT_PROVIDER, DEFAULT_RPC_BY_CHAIN, DebridgeAdapter, type DecodedCall, type DecodedEvent, type DecodedParam, type DefaultSubagentName, type DefiPosition, type DefiPositionDetails, type DefiPositionToken, type DefiProtocolSummary, EstimatePoolYieldTool, type EstimatePoolYieldToolConfig, type ExchangeProviderConfig, type ExecuteSwapParams, type ExecuteSwapResult, GeminiProvider, GeminiSearchAiTool, type GeminiSearchAiToolConfig, HEX_TO_PANTOGRAPH, type HolderChangePeriod, type HolderSupplyTier, type HttpMethod, type IngestKnowledgeBaseInput, type IngestKnowledgeBaseResult, type InputTokenInfo, type KBSearchResult, KnowledgeBase, type KnowledgeBaseEntry, type KnowledgeBaseProvider, type LLMProvider, type LLMProviderConfig, type LLMResponse, type LLMToolCall, ManageLiquidityRedirectTool, type MarketplaceLink, type MoralisApiResponse, MoralisService, type MoralisServiceConfig, NFC_AGENT_TOOL_NAMES, NFC_AMAZON_DEFAULT_DOMAIN, NFC_AMAZON_DOMAINS, type NFTCollectionItem, NFTContractInfoTool, type NFTContractMetadata, type NFTItem, type NFTLastSale, type NFTMetadata, NFTMetadataTool, NFT_AGENT_TOOL_NAMES, type NativeTokenInfo, NfcBuyTool, NfcInfoTool, type NftTransferLastSale, NoFormTool, type NoFormToolMessages, OpenAddLiquidityFormTool, type OpenAddLiquidityFormToolConfig, POOL_AGENT_TOOL_NAMES, PantographService, type PantographServiceConfig, type PaymentToken, PoolByAddressTool, type PoolByAddressToolConfig, PoolDetailTool, type PoolDetailToolConfig, type PoolDisplayInfo, PoolFallbackAiTool, type PoolFallbackAiToolConfig, type PoolOnchainInfo, PoolPriceRangesTool, type PoolPriceRangesToolConfig, PoolSearchTool, type PoolSearchToolConfig, PoolService, type PoolServiceConfig, type PresetInputs, PreviewAddLiquidityTool, type PreviewAddLiquidityToolConfig, type PriceBounds, type PriceRangePrefill, type ProviderName, type QuickRate, type RangePreset, type ReActPhase, type ReActStep, type ReActTrace, RelayAdapter, type ResolvedRange, Router, type RouterAssignment, type RouterDecision, SUPPORTED_CHAINS, SUPPORTED_CHAINS_LABEL, SWAP_PROVIDER_CONFIG, SendNativeTool, SendNftTool, SendTokenTool, type StorageProvider, Subagent, type SubagentCard, type SubagentOptions, type SubagentParams, type SubagentResult, type SubagentTask, type SubagentToggles, SubgraphAddPoolTool, type SubgraphAddPoolToolConfig, SubgraphCoinPoolPairsTool, type SubgraphCoinPoolPairsToolConfig, SubgraphPoolByAddressTool, type SubgraphPoolByAddressToolConfig, SubgraphPoolByPositionIdTool, type SubgraphPoolByPositionIdToolConfig, SubgraphPoolSearchTool, type SubgraphPoolSearchToolConfig, SubgraphPositionDetailTool, type SubgraphPositionDetailToolConfig, SubgraphTrendingPoolsTool, type SubgraphTrendingPoolsToolConfig, type SuggestedAction, Summarizer, type SupportedChainId, type SupportedChainName, type SwapQuoteParams, type SwapQuoteResult, type SwapServiceConfig, SwapServiceFactory, type SwapTokenConfirmTxProps, SwapTokenTool, type SwapTxData, Synthesizer, TOKEN_AGENT_TOOL_NAMES, TRANSFER_TOPIC, TRENDING_DEFAULT_BY_HEX_CHAIN, type TokenAnalyticsResponse, type TokenAnalyticsTimeframeBuckets, TokenAnalyticsTool, type TokenAnalyticsToolConfig, type TokenApproval, type TokenApprovalSpender, type TokenApprovalToken, type TokenBalance, type TokenDisplay, type TokenHoldersResponse, TokenHoldersTool, type TokenHoldersToolConfig, TokenInfoTool, type TokenInfoToolConfig, type TokenMetadata, type TokenScoreMetrics, type TokenScoreResponse, type TokenScoreSupply, type TokenScoreTimeframeBuckets, TokenScoreTool, type TokenScoreToolConfig, type Tool, type ToolDefinition, type ToolKind, type ToolParameter, ToolRegistry, type ToolResult, type TopGainerTimeFrames, type TopGainerToken, type TopGainersTimeFrame, TopGainersTool, type TopGainersToolConfig, TopPoolsTool, type TopPoolsToolConfig, type TrackStatus, type TrackTransactionParams, type TrackTransactionResult, type TransactionByHashResponse, TransactionByHashTool, type TransactionByHashToolConfig, type TransactionLog, type TransactionReceipt, type TransactionReceiptLog, type TrendingToken, type TrendingTokenTimeframeBuckets, TrendingTokensTool, type TrendingTokensToolConfig, type UIPayload, UNISWAP_CHAIN_SLUG, type UnsignedTx, type UpstashEmbedStrategy, type UpstashFusionAlgorithm, type UpstashKBUpsertEntry, UpstashKnowledgeBase, type UpstashKnowledgeBaseConfig, type UserContext, type VectorKBConfig, WALLET_ACTION_AGENT_TOOL_NAMES, WALLET_AGENT_TOOL_NAMES, type WalletActionProps, type WalletActionType, type WalletApprovalsResponse, WalletApprovalsTool, type WalletApprovalsToolConfig, type WalletDefiPositionSummary, WalletDefiPositionsTool, type WalletDefiPositionsToolConfig, type WalletDefiPositionsV1Response, type WalletDefiProtocolPositionsResponse, WalletDefiProtocolPositionsTool, type WalletDefiProtocolPositionsToolConfig, type WalletDefiProtocolPositionsV1Response, type WalletDefiSummaryResponse, WalletDefiSummaryTool, type WalletDefiSummaryToolConfig, type WalletDefiSummaryV1Response, type WalletHistoryCategory, type WalletHistoryContractInteraction, type WalletHistoryErc20Transfer, type WalletHistoryItem, type WalletHistoryNativeTransfer, type WalletHistoryNftTransfer, type WalletHistoryResponse, WalletHistoryTool, type WalletHistoryToolConfig, WalletNFTsTool, type WalletNFTsToolConfig, type WalletNftCardProps, type WalletNftListProps, type WalletNftTransferItem, type WalletNftTransfersResponse, WalletNftTransfersTool, type WalletNftTransfersToolConfig, type WalletPnlDaysWindow, type WalletPnlResponse, type WalletPnlSummaryResponse, WalletPnlSummaryTool, type WalletPnlSummaryToolConfig, type WalletPnlTokenItem, WalletPnlTool, type WalletPnlToolConfig, WalletTokenBalancesTool, type WalletTokenBalancesToolConfig, type WalletTokenTransferItem, type WalletTokenTransfersResponse, WalletTokenTransfersTool, type WalletTokenTransfersToolConfig, type WebsiteTrustExtraData, type WebsiteTrustInput, WebsiteTrustKeyringAgent, type WebsiteTrustKeyringAgentConfig, type WebsiteTrustResult, type X402Authorization, type X402Challenge, type X402Display, type X402Outcome, type X402PaymentRequiredProps, type X402Receipt, type X402RequestSpec, type X402Requirements, type X402SignRequest, type X402Signer, type X402TypedData, type X402Version, ZERO_ADDRESS, amazonDomainForLanguage, apiClient, buildChallenge, buildRangePresets, buildUniswapPoolUrl, clampTick, completeX402, configureSupportedChains, createAiAgent, createDefaultSubagents, createNfcAgent, createNftAgent, createPoolAgent, createTokenAgent, createWalletActionAgent, createWalletAgent, createX402SignatureProvider, displayFromChallenge, encodeSignedHeader, ethCallAt, ethCallByChain, fetchTopMarketplaces, getAffiliateFee, getChainMeta, getDefaultRpcUrl, getGatewayAddress, getGatewayChains, getNativeTokenInfo, getPositionManagerAddress, getProviderByChain, ingestKnowledgeBase, isAbortError, isPaymentRequired, nfcAmazonSearchUrl, normaliseCountry, normalizePriceRangeToPool, priceToTick, readPaymentError, readPaymentRequired, readReceipt, registerMaybeNoForm, requestWithX402, resolveNfcShopLinks, resolveRpcUrl, roundTickToSpacing, rpcCall, setRpcOverrides, swapServiceFactory, tickToPrice, toPantographChain };