keyring-agent-core 0.2.48 → 0.2.50

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
@@ -673,6 +673,22 @@ interface WalletNftCardProps {
673
673
  image: string | null;
674
674
  /** Human-readable chain name, e.g. "Base". */
675
675
  chain: string;
676
+ /**
677
+ * Set only in PICKER mode (see {@link WalletNftListProps.mode}): the message
678
+ * submitted as the next user turn when this card is tapped. It carries the
679
+ * exact contract + token id, so the follow-up turn resolves to this one NFT.
680
+ * Absent in the default browse gallery — those cards are not tappable.
681
+ */
682
+ prompt?: string;
683
+ /**
684
+ * Collection name, shown under the token id ONLY when the cards in this picker
685
+ * span more than one collection. That happens when the user identified the NFT
686
+ * by token id alone ("send NFT id 5118938") and holds that id in several
687
+ * collections: the name and token id are then identical on every card, and the
688
+ * collection is the only thing that tells them apart. Omitted whenever the
689
+ * cards already read distinctly, to keep the gallery uncluttered.
690
+ */
691
+ collectionName?: string;
676
692
  }
677
693
  /** Props for the `WalletNftList` component — one collection's NFTs to display. */
678
694
  interface WalletNftListProps {
@@ -682,6 +698,13 @@ interface WalletNftListProps {
682
698
  collectionName: string;
683
699
  /** The NFTs to render, in display order. */
684
700
  nfts: WalletNftCardProps[];
701
+ /**
702
+ * `'browse'` (default) — a read-only gallery of what the wallet holds.
703
+ * `'picker'` — the user must choose ONE: every card carries a `prompt` and
704
+ * tapping it submits that prompt as the next turn (used by open-send-nft-form
705
+ * when the name the user gave matches several owned NFTs).
706
+ */
707
+ mode?: 'browse' | 'picker';
685
708
  }
686
709
  /** Identifies a chain in BE↔FE payloads. */
687
710
  interface ChainRef {
@@ -836,6 +859,88 @@ interface WalletActionProps {
836
859
  */
837
860
  parameters: Record<string, string>;
838
861
  }
862
+ /**
863
+ * The lending protocols a USDC supply can be routed to. Mirrors
864
+ * `LendingProtocolType` in `services/lending/protocols.ts` — the FE switches its
865
+ * deposit encoding on this, so the two MUST stay in step.
866
+ */
867
+ type SupplyProtocolType = 'aave-v3' | 'compound-v3' | 'spark' | 'spark-ethereum' | 'morpho-v2';
868
+ /**
869
+ * Props for the FE `SupplyUsdcForm` component — depositing USDC into one lending
870
+ * market to earn yield.
871
+ *
872
+ * Unlike the flat `WalletActionProps` forms, a supply needs the MARKET as a
873
+ * structured fact: which contract receives the deposit, and which protocol
874
+ * family it belongs to (the deposit calldata differs per protocol — Aave
875
+ * `supply(asset,amount,onBehalfOf,referralCode)`, Compound `supply(asset,amount)`,
876
+ * ERC-4626 `deposit(...)` for Spark and Morpho vaults). The core resolves and
877
+ * validates all of that; the FE owns the allowance check, the encoding and the
878
+ * signing, exactly as it does for every other in-chat action.
879
+ */
880
+ interface SupplyUsdcProps {
881
+ action: 'supply_usdc';
882
+ /** Hex chain id, e.g. "0x1", "0x2105". */
883
+ chainId: string;
884
+ /** Human-readable chain name for display, e.g. "Ethereum", "Base". */
885
+ chainName: string;
886
+ /** Connected wallet that will sign, and that receives the receipt token. */
887
+ walletAddress: string;
888
+ market: {
889
+ /** Display name of the market, e.g. "Aave v3 USDC". */
890
+ name: string;
891
+ /** Protocol family — selects the deposit encoding on the FE. */
892
+ type: SupplyProtocolType;
893
+ /** Protocol brand name, e.g. "Aave v3". */
894
+ protocol: string;
895
+ /** The protocol's site, as a full URL. Null when unknown. */
896
+ protocolUrl: string | null;
897
+ /** Pool / vault contract the deposit is sent to AND approved as spender. */
898
+ contract: string;
899
+ /** Receipt token received (aToken, Comet, vault share). */
900
+ token: string;
901
+ /** Live supply APY as a PERCENT (4.82 = 4.82%). Null when unavailable. */
902
+ apyPercent: number | null;
903
+ /**
904
+ * ERC-20 identity of the receipt token above — what "Est. Received" is
905
+ * denominated in, resolved here so the form never reads chain to display it.
906
+ */
907
+ receiptToken: {
908
+ /** e.g. "aBasUSDC", "cUSDCv3", "sUSDC". Null when the read failed. */
909
+ symbol: string | null;
910
+ /**
911
+ * The receipt's OWN decimals — 18 for Spark's `sUSDC` against USDC's 6, so
912
+ * the form must scale shares by this and not by `asset.decimals`. Null when
913
+ * the read failed; the form then falls back to the asset's.
914
+ */
915
+ decimals: number | null;
916
+ /**
917
+ * True when the receipt is denominated 1:1 in the supplied USDC (aToken,
918
+ * Comet) — the amount typed IS the amount received. False for an ERC-4626
919
+ * vault, which mints shares at its current rate and needs a preview.
920
+ */
921
+ isUnderlying: boolean;
922
+ };
923
+ };
924
+ /** The USDC being supplied on this chain. */
925
+ asset: {
926
+ address: string;
927
+ symbol: string;
928
+ decimals: number;
929
+ };
930
+ /** Amount to pre-fill, human-readable (e.g. "100.5"). Absent = user types it. */
931
+ prefillAmount?: string;
932
+ /**
933
+ * The wallet's USDC balance on this chain, human-readable — what the form's
934
+ * spendable line and its 25/50/75/100% chips are computed from. Unlike a
935
+ * native send there is no gas reserve to hold back: the fee is paid in the
936
+ * chain's native coin, not in the USDC being supplied, so the whole balance
937
+ * is spendable. Absent when balances could not be read; the form then hides
938
+ * the line and the chips rather than showing a wrong figure.
939
+ */
940
+ spendable?: string;
941
+ /** USD value of `spendable`, for the "(~$X)" hint. Absent when unpriced. */
942
+ spendableUsd?: string;
943
+ }
839
944
  /**
840
945
  * Props for the FE `X402PaymentRequired` component — a GENERIC paywall card for
841
946
  * any x402-gated API (HTTP 402 "pay-per-call"). The core already made the call,
@@ -1370,6 +1475,21 @@ interface AgentConfig {
1370
1475
  /** Pantograph API base URL for price enrichment */
1371
1476
  pantographUrl?: string;
1372
1477
  } | false;
1478
+ /**
1479
+ * USDC lending / supply tool config (`get-lending-markets` and
1480
+ * `get-wallet-lending-positions`). Set to `false` to skip registering them —
1481
+ * to keep the tools but stop routing to them, use `subagents.lending: false`.
1482
+ * Independent of `moralis`: the curated market list comes from the CoinPool
1483
+ * platform API and balances are read on-chain via `rpcUrls`.
1484
+ */
1485
+ lending?: {
1486
+ /** CoinPool API base url (`<base>/supply/v2`). Default https://api.coinpool.app. */
1487
+ coinPoolBaseUrl?: string;
1488
+ /** Aave v3 GraphQL endpoint used for supply-APY history. */
1489
+ aaveApiUrl?: string;
1490
+ /** Morpho GraphQL endpoint used for vault APY history. */
1491
+ morphoApiUrl?: string;
1492
+ } | false;
1373
1493
  /**
1374
1494
  * Enable/disable individual built-in subagents. Defaults to all-enabled.
1375
1495
  * Set any key to `false` to skip that subagent — it won't be created or
@@ -1380,6 +1500,11 @@ interface AgentConfig {
1380
1500
  subagents?: {
1381
1501
  wallet?: boolean;
1382
1502
  'wallet-action'?: boolean;
1503
+ /**
1504
+ * USDC lending expert: which markets to supply to and what the wallet
1505
+ * already supplies. Needs `lending` (its tools) to be enabled.
1506
+ */
1507
+ lending?: boolean;
1383
1508
  token?: boolean;
1384
1509
  nft?: boolean;
1385
1510
  /**
@@ -2457,7 +2582,7 @@ declare class Synthesizer {
2457
2582
  synthesise(userQuery: string, trace: ReActTrace, conversationHistory: ChatMessage[], language?: string): Promise<string>;
2458
2583
  }
2459
2584
 
2460
- declare const WALLET_AGENT_TOOL_NAMES: readonly ["get-wallet-token-balances", "get-wallet-history", "get-wallet-token-transfers", "get-wallet-nft-transfers", "get-wallet-pnl-summary", "get-wallet-pnl", "get-wallet-approvals", "get-wallet-defi-summary", "get-wallet-defi-positions", "get-wallet-defi-protocol-positions", "get-transaction-by-hash", "gemini-search-ai"];
2585
+ declare const WALLET_AGENT_TOOL_NAMES: readonly ["get-wallet-token-balances", "get-wallet-history", "get-wallet-token-transfers", "get-wallet-nft-transfers", "get-wallet-pnl-summary", "get-wallet-pnl", "get-wallet-approvals", "get-wallet-lending-positions", "get-wallet-defi-positions", "get-wallet-defi-protocol-positions", "get-transaction-by-hash", "gemini-search-ai"];
2461
2586
  declare function createWalletAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
2462
2587
 
2463
2588
  declare const TOKEN_AGENT_TOOL_NAMES: readonly ["get-token-info", "get-token-holders", "get-token-analytics", "get-token-score", "get-trending-tokens", "get-top-gainers", "gemini-search-ai"];
@@ -2479,7 +2604,7 @@ declare const WALLET_ACTION_AGENT_TOOL_NAMES: readonly ["open-send-native-form",
2479
2604
  declare function createWalletActionAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
2480
2605
 
2481
2606
  /** Built-in subagent ids. */
2482
- type DefaultSubagentName = 'wallet' | 'wallet-action' | 'token' | 'nft' | 'nfc' | 'pool' | 'pool-subgraph' | 'ai';
2607
+ type DefaultSubagentName = 'wallet' | 'wallet-action' | 'lending' | 'token' | 'nft' | 'nfc' | 'pool' | 'pool-subgraph' | 'ai';
2483
2608
  /**
2484
2609
  * Per-subagent enable flags. Default for every key is `true` EXCEPT
2485
2610
  * `pool-subgraph`, which defaults to `false` because it is mutually exclusive
@@ -4836,80 +4961,6 @@ declare class WalletApprovalsTool extends BaseTool {
4836
4961
  }>;
4837
4962
  }
4838
4963
 
4839
- type WalletDefiSummaryToolConfig = MoralisServiceConfig;
4840
- /**
4841
- * Tool: get-wallet-defi-summary
4842
- *
4843
- * Queries `GET /wallets/{address}/defi/summary` — a high-level DeFi overview
4844
- * for a wallet: total USD value, total unclaimed rewards, number of active
4845
- * protocols and positions, plus a per-protocol breakdown.
4846
- *
4847
- * Moralis docs: https://docs.moralis.com/data-api/evm/wallet/wallet-protocols
4848
- */
4849
- declare class WalletDefiSummaryTool extends BaseTool {
4850
- name: string;
4851
- description: string;
4852
- category: string;
4853
- parameters: ToolParameter[];
4854
- private service;
4855
- constructor(config?: WalletDefiSummaryToolConfig);
4856
- protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
4857
- error: string;
4858
- _instructions?: undefined;
4859
- walletAddress?: undefined;
4860
- chain?: undefined;
4861
- totalUsdValue?: undefined;
4862
- totalUnclaimedUsdValue?: undefined;
4863
- chains?: undefined;
4864
- } | {
4865
- activeProtocols: number;
4866
- totalPositions: number;
4867
- totalUsdValue: number;
4868
- totalUnclaimedUsdValue: number;
4869
- protocols: {
4870
- protocolName: string | undefined;
4871
- protocolId: string | undefined;
4872
- protocolUrl: string | undefined;
4873
- protocolLogo: string | undefined;
4874
- positions: number;
4875
- totalUsdValue: number;
4876
- totalUnclaimedUsdValue: number;
4877
- accountHealthFactor: number | null;
4878
- }[];
4879
- walletAddress: string;
4880
- chain: string;
4881
- error?: undefined;
4882
- _instructions?: undefined;
4883
- chains?: undefined;
4884
- } | {
4885
- _instructions: string;
4886
- walletAddress: string;
4887
- chain: string;
4888
- totalUsdValue: number;
4889
- totalUnclaimedUsdValue: number;
4890
- chains: {
4891
- activeProtocols: number;
4892
- totalPositions: number;
4893
- totalUsdValue: number;
4894
- totalUnclaimedUsdValue: number;
4895
- protocols: {
4896
- protocolName: string | undefined;
4897
- protocolId: string | undefined;
4898
- protocolUrl: string | undefined;
4899
- protocolLogo: string | undefined;
4900
- positions: number;
4901
- totalUsdValue: number;
4902
- totalUnclaimedUsdValue: number;
4903
- accountHealthFactor: number | null;
4904
- }[];
4905
- chain: string;
4906
- }[];
4907
- error?: undefined;
4908
- }>;
4909
- /** Map a single chain's raw summary into the tool's camelCase output fields. */
4910
- private summaryFields;
4911
- }
4912
-
4913
4964
  type WalletDefiPositionsToolConfig = MoralisServiceConfig;
4914
4965
  /**
4915
4966
  * Tool: get-wallet-defi-positions
@@ -5180,6 +5231,617 @@ declare class TransactionByHashTool extends BaseTool {
5180
5231
  }>;
5181
5232
  }
5182
5233
 
5234
+ /** One read in a {@link multicallRead} batch: a target contract + full calldata. */
5235
+ interface MulticallRequest {
5236
+ /** Contract to call. A malformed address yields a `null` result. */
5237
+ target: string;
5238
+ /** Encoded calldata — selector + ABI-encoded args, 0x-prefixed. */
5239
+ callData: string;
5240
+ }
5241
+
5242
+ /**
5243
+ * One class per USDC lending protocol — everything that differs between Aave,
5244
+ * Compound, Spark and Morpho, and nothing that doesn't.
5245
+ *
5246
+ * ## Why these classes declare calls instead of making them
5247
+ *
5248
+ * The obvious shape for a protocol adapter is `async readState()` that goes to
5249
+ * chain itself, the way the CoinPool app's `useUsdcLendingData` hook does. This
5250
+ * service deliberately does NOT do that: listing Ethereum's 11 markets is a
5251
+ * single `aggregate3` round-trip, because every market's reads are batched into
5252
+ * one Multicall3 call. A protocol that fetched for itself would turn that one
5253
+ * round-trip into eleven.
5254
+ *
5255
+ * So the on-chain half of each protocol is split in two:
5256
+ *
5257
+ * 1. {@link LendingProtocol.sizeCall} / {@link LendingProtocol.liveRateCall} —
5258
+ * DECLARE the call, return a {@link MulticallRequest}, touch no network.
5259
+ * 2. {@link LendingProtocol.decodeSize} / {@link LendingProtocol.decodeLiveRate} —
5260
+ * turn that call's return data into a number.
5261
+ *
5262
+ * {@link file://../LendingService.ts} collects step 1 across every market on a
5263
+ * chain, fires ONE multicall, then hands each protocol its own slice back for
5264
+ * step 2. The protocols stay ignorant of batching; the batching stays ignorant
5265
+ * of protocols.
5266
+ *
5267
+ * The APY half ({@link LendingProtocol.fetchApy}) is a per-market HTTP call to a
5268
+ * different upstream per protocol, so there is nothing to batch and each class
5269
+ * simply does the fetch.
5270
+ */
5271
+ /** Market kinds `/supply/v2` returns; see {@link PROTOCOLS}. */
5272
+ type LendingProtocolType = 'aave-v3' | 'compound-v3' | 'spark' | 'spark-ethereum' | 'morpho-v2';
5273
+
5274
+ /**
5275
+ * Client for the CoinPool USDC **lending / supply** markets — the data behind
5276
+ * the app's "Supply" product (Aave v3, Compound v3, Spark, Morpho v2 vaults).
5277
+ *
5278
+ * A wallet's supplied balance is NOT read from an indexer: the receipt token
5279
+ * (aToken / Comet / ERC-4626 vault share) is read straight from chain through
5280
+ * Multicall3, so the number always matches what the app shows. Everything else
5281
+ * comes from the same sources the CoinPool web app itself uses — its
5282
+ * `useUsdcLendingData` hook, in the SEPARATE `coinpool-v2` repository
5283
+ * (`src/hooks/useUsdcLendingData.ts`), is the reference this service was checked
5284
+ * against protocol by protocol:
5285
+ *
5286
+ * - market list ................. CoinPool `GET /supply/v2?chainId=…`
5287
+ * - supply-APY history ......... Aave v3 GraphQL (`aave-v3`),
5288
+ * Morpho GraphQL (`morpho-v2`),
5289
+ * CoinPool `GET /supply/rates/history` (rest)
5290
+ * - supplied amount / market size on-chain via Multicall3
5291
+ *
5292
+ * Reported APY is the AVERAGE of the daily supply-APY samples of the last
5293
+ * {@link APY_HISTORY_DAYS} days plus the live rate — a spot rate swings with
5294
+ * borrow demand, so an average is what a supplier actually earns.
5295
+ *
5296
+ * ## Protocols differ; the pipeline does not
5297
+ *
5298
+ * The market kinds disagree on every input: where the market size lives, whether
5299
+ * the receipt token is 1:1 with USDC or an ERC-4626 share, which API knows the
5300
+ * rate history, and whether a live rate has to come off-chain. Each kind is a
5301
+ * class in {@link file://./lending/protocols.ts}; this file is the pipeline that
5302
+ * drives them and knows about no protocol by name.
5303
+ *
5304
+ * | | market size | balance | APY history | live APY |
5305
+ * |--------------|----------------|-------------|-------------|------------|
5306
+ * | aave-v3 | aToken supply | underlying | Aave API | on-chain |
5307
+ * | compound-v3 | Comet supply | underlying | CoinPool | newest row |
5308
+ * | spark* | totalAssets() | ERC-4626 | CoinPool | newest row |
5309
+ * | morpho-v2 | totalAssets() | ERC-4626 | Morpho API | from API |
5310
+ *
5311
+ * Two entries in that last column are worth stating outright, because the app
5312
+ * looks like it disagrees. The app derives EVERY protocol's live rate on-chain,
5313
+ * each with its own formula; here only Aave does. That is not a shortcut taken
5314
+ * blindly — CoinPool's history endpoint refreshes intraday and its newest row
5315
+ * was checked against chain to six decimals for all three protocols that use it
5316
+ * (see `fetchCoinPoolApy`). Aave is the one case where the API and the on-chain
5317
+ * figure genuinely differ, so it is the one case that pays for the extra call.
5318
+ *
5319
+ * Protocols DECLARE their on-chain calls rather than making them, so every
5320
+ * market on a chain still resolves in ONE Multicall3 round-trip regardless of
5321
+ * how many protocols are involved — see the protocols module for why.
5322
+ *
5323
+ * Independent of {@link file://./MoralisService.ts}: these markets are curated by the
5324
+ * CoinPool platform and an indexer neither knows the curated set nor the vault
5325
+ * share → USDC conversion.
5326
+ */
5327
+ interface LendingServiceConfig {
5328
+ /** Base URL of the CoinPool API. Defaults to `https://api.coinpool.app`. */
5329
+ coinPoolBaseUrl?: string;
5330
+ /** Aave v3 GraphQL endpoint (supply-APY history). */
5331
+ aaveApiUrl?: string;
5332
+ /** Morpho GraphQL endpoint (vault APY history + live net APY). */
5333
+ morphoApiUrl?: string;
5334
+ }
5335
+ /** One curated USDC lending market. */
5336
+ interface LendingMarket {
5337
+ /** Hex chain id the market lives on. */
5338
+ chain: string;
5339
+ /** Display name, e.g. "Aave v3 USDC" / "Spark USDC Savings Vault". */
5340
+ name: string;
5341
+ /** Protocol family, e.g. "AAVE" / "MORPHO". */
5342
+ protocol: string;
5343
+ /** Protocol app URL, when known. */
5344
+ protocolUrl: string | null;
5345
+ type: LendingProtocolType | string;
5346
+ /** Pool / vault contract — where a supply goes. */
5347
+ contract: string;
5348
+ /** Receipt token holding the user's balance (aToken, Comet, vault share). */
5349
+ token: string;
5350
+ /**
5351
+ * CoinPool's balanced score for the market, 0–10 (higher is better) — weighs
5352
+ * protocol safety, market size and yield. Null when the market is unscored.
5353
+ */
5354
+ platformScore: number | null;
5355
+ }
5356
+ /** One daily supply-APY sample (percent, e.g. `4.21` for 4.21%). */
5357
+ interface ApyPoint {
5358
+ /** UTC day, `YYYY-MM-DD`. */
5359
+ date: string;
5360
+ apyPercent: number;
5361
+ }
5362
+ /** A lending market plus its live rate and size — what you'd compare before supplying. */
5363
+ interface LendingMarketOverview extends LendingMarket {
5364
+ /** Total USDC supplied to this market by everyone (market size). */
5365
+ totalSuppliedUsdc: number | null;
5366
+ /** Mean of {@link apyHistory} — the headline APY. Null when history is unavailable. */
5367
+ avgApyPercent: number | null;
5368
+ /** Live supply APY. */
5369
+ currentApyPercent: number | null;
5370
+ /** Live APY minus the previous day's, in percentage points. */
5371
+ apyChangePercent: number | null;
5372
+ /** Daily APY samples, oldest first, last entry = today's live rate. */
5373
+ apyHistory: ApyPoint[];
5374
+ }
5375
+ /** A wallet's live supply position in one lending market. */
5376
+ interface LendingSupplyPosition extends LendingMarketOverview {
5377
+ /** Supplied USDC, receipt-token balance converted to underlying. */
5378
+ suppliedUsdc: number;
5379
+ /** `suppliedUsdc × avgApyPercent` — projected yearly earnings at the average rate. */
5380
+ estimatedAnnualYieldUsdc: number | null;
5381
+ }
5382
+ declare class LendingService {
5383
+ private readonly coinPoolBaseUrl;
5384
+ /** Passed to each protocol's `fetchApy`, so endpoints stay configurable. */
5385
+ private readonly apiEndpoints;
5386
+ /** Shared across chains, so a whole-catalogue scan stays within the cap. */
5387
+ private readonly apyLimiter;
5388
+ constructor(config?: LendingServiceConfig);
5389
+ /** Hex chain ids with USDC lending markets (intersected with the active set). */
5390
+ listSupportedChains(): string[];
5391
+ /** True when the given chain (any alias / hex / decimal form) has lending markets. */
5392
+ isSupported(chain?: string | null): boolean;
5393
+ /**
5394
+ * Every curated USDC lending market on a chain. Empty when the chain has none
5395
+ * or the API is unreachable — never throws.
5396
+ */
5397
+ getMarkets(chain: string): Promise<LendingMarket[]>;
5398
+ /** The USDC a supply on this chain moves. Null when the chain has no markets. */
5399
+ getUsdc(chain: string): {
5400
+ address: string;
5401
+ decimals: number;
5402
+ } | null;
5403
+ /**
5404
+ * The receipt token a supply into `market` credits — its own ERC-20 symbol and
5405
+ * decimals, read on chain in one multicall.
5406
+ *
5407
+ * This is what "Est. Received" is denominated in, and it is NOT the underlying:
5408
+ * Aave's is `aBasUSDC`, Compound's is `cUSDCv3`, and Spark's Base vault is
5409
+ * `sUSDC` with **18** decimals against USDC's 6. Scaling a share figure by the
5410
+ * asset's decimals overstates it by 10^12, so the form needs these to render a
5411
+ * correct number and an honest label.
5412
+ *
5413
+ * Resolved here, once, when the supply payload is built — the form is a pure
5414
+ * renderer and must never go to chain just to display what it was handed.
5415
+ *
5416
+ * Both fields are independently null when their call failed or decoded
5417
+ * implausibly; the caller then falls back to the underlying's metadata rather
5418
+ * than blocking a supply over a display detail.
5419
+ */
5420
+ readReceiptToken(chain: string, market: Pick<LendingMarket, 'token' | 'type'>): Promise<{
5421
+ symbol: string | null;
5422
+ decimals: number | null;
5423
+ isUnderlying: boolean;
5424
+ }>;
5425
+ /**
5426
+ * Resolve ONE market on a chain from a free-text reference — the market name,
5427
+ * the protocol, or the contract address — for the supply flow, which needs a
5428
+ * single unambiguous target rather than a ranked list.
5429
+ *
5430
+ * Returns every close match rather than guessing when the reference is
5431
+ * ambiguous ("Morpho" on a chain with several Morpho vaults): depositing into
5432
+ * the wrong vault is not something the user can undo, so the caller asks
5433
+ * instead of picking. An exact name or contract match always wins outright.
5434
+ */
5435
+ findMarket(chain: string, reference: string): Promise<LendingMarket[]>;
5436
+ /**
5437
+ * Size + APY for markets already resolved by {@link findMarket}, so the supply
5438
+ * flow can quote a rate without re-listing (and re-pricing) the whole chain.
5439
+ * Returns them in the order given; empty when the chain is unsupported.
5440
+ */
5441
+ describeResolvedMarkets(chain: string, markets: LendingMarket[]): Promise<LendingMarketOverview[]>;
5442
+ /**
5443
+ * Every curated market on `chains`, each with its size and APY — the "where
5444
+ * can I supply USDC?" view. Highest average APY first, unrated markets last.
5445
+ *
5446
+ * Chains are queried in parallel and contribute independently: a chain whose
5447
+ * API or RPC fails yields nothing rather than failing the whole call.
5448
+ */
5449
+ getMarketOverviews(params: {
5450
+ chains: readonly string[];
5451
+ }): Promise<LendingMarketOverview[]>;
5452
+ /**
5453
+ * Every lending market the wallet currently supplies to, across `chains`,
5454
+ * highest supplied amount first. Same parallelism and failure isolation as
5455
+ * {@link getMarketOverviews}; positions worth less than {@link DUST_USDC} are
5456
+ * dropped as withdrawal residue.
5457
+ */
5458
+ getSupplyPositions(params: {
5459
+ address: string;
5460
+ chains: readonly string[];
5461
+ }): Promise<LendingSupplyPosition[]>;
5462
+ /** Supply positions on ONE chain: market list → balances → supplied amount + overview. */
5463
+ private positionsForChain;
5464
+ /**
5465
+ * Attach market size and the APY series to each market — one batched on-chain
5466
+ * read plus one API call per market, both at once. Order is preserved, so
5467
+ * callers can zip the result with their own per-market data. Never throws.
5468
+ */
5469
+ private describeMarkets;
5470
+ /**
5471
+ * Every market's receipt-token balance + decimals in one batch, narrowed to the
5472
+ * markets the wallet actually holds something in — the step that decides how
5473
+ * much further work the rest of the flow has to do.
5474
+ */
5475
+ private readBalances;
5476
+ /**
5477
+ * On-chain state of each market, in ONE batch, aligned with `markets`: its size
5478
+ * and — for Aave alone — its live supply rate.
5479
+ *
5480
+ * This is where the batching lives. Each market's protocol only DECLARES the
5481
+ * calls it wants ({@link LendingProtocol.sizeCall}, {@link LendingProtocol.liveRateCall});
5482
+ * they are pooled here into a single multicall, and each protocol then decodes
5483
+ * its own slice of the result. Twenty markets across four protocols still cost
5484
+ * one RPC round-trip.
5485
+ *
5486
+ * Either field is null when its call failed or decoded implausibly.
5487
+ */
5488
+ private readMarketState;
5489
+ /**
5490
+ * Each held balance as USDC, aligned with `held`. A protocol whose receipt
5491
+ * token is an ERC-4626 share declares a `convertToAssets` call; one whose
5492
+ * balance is already underlying declares none. As with {@link readMarketState},
5493
+ * every conversion across every protocol shares ONE multicall.
5494
+ *
5495
+ * A vault whose conversion reverts falls back to the raw balance in the share
5496
+ * token's own decimals — an approximation that beats dropping the position
5497
+ * outright.
5498
+ */
5499
+ private convertToUnderlying;
5500
+ /**
5501
+ * Historical supply-APY samples for one market, from whichever upstream its
5502
+ * protocol queries, plus that source's own live rate where it reports one.
5503
+ *
5504
+ * Unlike the on-chain reads there is nothing to batch here — each protocol
5505
+ * talks to a different API, one request per market — so the protocol performs
5506
+ * the fetch itself. Never throws: an unreachable source yields no samples, so
5507
+ * the market is still listed, just without APY.
5508
+ */
5509
+ private fetchApySamples;
5510
+ }
5511
+
5512
+ type LendingMarketsToolConfig = LendingServiceConfig;
5513
+ /** How the list is ordered. Mirrors the `sort` parameter. */
5514
+ type SortKey = 'apy' | 'score' | 'size';
5515
+ /**
5516
+ * Tool: get-lending-markets
5517
+ *
5518
+ * The USDC lending markets a user CAN supply to — the catalogue side of the
5519
+ * lending domain, as opposed to `get-wallet-lending-positions` which reports
5520
+ * what a wallet already supplies. Each market carries its size, the protocol's
5521
+ * live supply APY — the rate the list is ranked on, and the one a depositor is
5522
+ * quoted today — and the average over the last week as a stability check on it.
5523
+ *
5524
+ * See {@link file://../../../services/LendingService.ts} for the data sources.
5525
+ */
5526
+ declare class LendingMarketsTool extends BaseTool {
5527
+ name: string;
5528
+ description: string;
5529
+ category: string;
5530
+ parameters: ToolParameter[];
5531
+ private service;
5532
+ constructor(config?: LendingMarketsToolConfig);
5533
+ protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
5534
+ _instructions: string;
5535
+ requestedProtocol: string;
5536
+ protocolSupported: boolean;
5537
+ supportedProtocols: string[];
5538
+ marketCount: number;
5539
+ markets: never[];
5540
+ } | {
5541
+ _instructions: string;
5542
+ chain: string;
5543
+ connectedChainHasNoMarkets: boolean;
5544
+ marketCount: number;
5545
+ markets: never[];
5546
+ chainsWithLendingMarkets: string[];
5547
+ requestedProtocol?: undefined;
5548
+ protocolsAvailable?: undefined;
5549
+ } | {
5550
+ _instructions: string;
5551
+ requestedProtocol: string;
5552
+ chain: string;
5553
+ marketCount: number;
5554
+ markets: never[];
5555
+ protocolsAvailable: string[];
5556
+ connectedChainHasNoMarkets?: undefined;
5557
+ chainsWithLendingMarkets?: undefined;
5558
+ } | {
5559
+ sortedBy: SortKey;
5560
+ marketCount: number;
5561
+ totalMarketsAvailable: number;
5562
+ markets: {
5563
+ marketName: string;
5564
+ protocol: string;
5565
+ protocolUrl: string | null;
5566
+ chain: string;
5567
+ avgApyPercent: number | null;
5568
+ avgApyDays: number;
5569
+ currentApyPercent: number | null;
5570
+ apyChangePercent: number | null;
5571
+ totalSuppliedUsdc: number | null;
5572
+ platformScore: number | null;
5573
+ }[];
5574
+ protocolFilter?: string | undefined;
5575
+ chain: string;
5576
+ chainsQueried: string[];
5577
+ actionButtons?: SuggestedAction[] | undefined;
5578
+ _instructions: string;
5579
+ connectedChainHasNoMarkets?: undefined;
5580
+ chainsWithLendingMarkets?: undefined;
5581
+ requestedProtocol?: undefined;
5582
+ protocolsAvailable?: undefined;
5583
+ }>;
5584
+ /**
5585
+ * The reply for a protocol we carry no markets for — whether it is a real one
5586
+ * we haven't integrated (Euler, Venus) or a name that resolved to nothing.
5587
+ *
5588
+ * Both land here because the user's next step is identical: hear that we don't
5589
+ * have it, and see what we do. They differ only in how the request is echoed —
5590
+ * a recognised protocol is named back properly ("Euler"), while an unrecognised
5591
+ * string is quoted as the user's own words and never called a protocol, since
5592
+ * calling it one would assert something we could not verify.
5593
+ */
5594
+ private unsupportedProtocol;
5595
+ /** Presentation contract for the synthesizer, tailored to what we found. */
5596
+ private instructions;
5597
+ }
5598
+
5599
+ type WalletLendingPositionsToolConfig = LendingServiceConfig;
5600
+ /**
5601
+ * Tool: get-wallet-lending-positions
5602
+ *
5603
+ * A wallet's USDC lending ("supply") positions in the curated markets the app
5604
+ * itself lists — Aave v3, Compound v3, Spark and Morpho v2 vaults. Balances are
5605
+ * read from chain (receipt token → underlying), so they match the app exactly;
5606
+ * the reported APY is the AVERAGE of the last week's daily supply-APY samples
5607
+ * rather than the spot rate, which swings with borrow demand.
5608
+ *
5609
+ * See {@link file://../../../services/LendingService.ts} for the data sources.
5610
+ */
5611
+ declare class WalletLendingPositionsTool extends BaseTool {
5612
+ name: string;
5613
+ description: string;
5614
+ category: string;
5615
+ parameters: ToolParameter[];
5616
+ private service;
5617
+ constructor(config?: WalletLendingPositionsToolConfig);
5618
+ protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
5619
+ error: string;
5620
+ _instructions?: undefined;
5621
+ walletAddress?: undefined;
5622
+ chain?: undefined;
5623
+ positionCount?: undefined;
5624
+ positions?: undefined;
5625
+ chainsWithLendingMarkets?: undefined;
5626
+ chainsQueried?: undefined;
5627
+ totals?: undefined;
5628
+ } | {
5629
+ _instructions: string;
5630
+ walletAddress: string;
5631
+ chain: string;
5632
+ positionCount: number;
5633
+ positions: never[];
5634
+ chainsWithLendingMarkets: string[];
5635
+ error?: undefined;
5636
+ chainsQueried?: undefined;
5637
+ totals?: undefined;
5638
+ } | {
5639
+ _instructions: string;
5640
+ walletAddress: string;
5641
+ chain: string;
5642
+ chainsQueried: string[];
5643
+ positionCount: number;
5644
+ totals: {
5645
+ suppliedUsdc: number;
5646
+ estimatedAnnualYieldUsdc: number;
5647
+ weightedAvgApyPercent: number | null;
5648
+ };
5649
+ positions: {
5650
+ marketName: string;
5651
+ protocol: string;
5652
+ protocolUrl: string | null;
5653
+ chain: string;
5654
+ suppliedUsdc: number;
5655
+ avgApyPercent: number | null;
5656
+ currentApyPercent: number | null;
5657
+ apyChangePercent: number | null;
5658
+ estimatedAnnualYieldUsdc: number | null;
5659
+ marketTotalSuppliedUsdc: number | null;
5660
+ apyHistory: ApyPoint[];
5661
+ platformScore: number | null;
5662
+ }[];
5663
+ error?: undefined;
5664
+ chainsWithLendingMarkets?: undefined;
5665
+ }>;
5666
+ /** Presentation contract for the synthesizer, tailored to what we found. */
5667
+ private instructions;
5668
+ }
5669
+
5670
+ interface OpenSupplyFormToolConfig extends LendingServiceConfig {
5671
+ /** Moralis config for the USDC balance shown on the form. */
5672
+ moralis?: MoralisServiceConfig;
5673
+ }
5674
+ /**
5675
+ * Tool: open-supply-usdc-form
5676
+ *
5677
+ * Opens the form that deposits USDC into ONE lending market. The counterpart to
5678
+ * `get-lending-markets`, which only lists what is available: this resolves the
5679
+ * market the user picked, checks their USDC balance, and hands the FE everything
5680
+ * it needs to run the approve → supply sequence itself.
5681
+ *
5682
+ * Like every wallet action in this core, the tool does NOT build or sign a
5683
+ * transaction — it resolves and validates, then emits a `SupplyUsdcForm` payload.
5684
+ * The FE owns the allowance check, the per-protocol encoding and the signing.
5685
+ */
5686
+ declare class OpenSupplyFormTool extends BaseTool {
5687
+ name: string;
5688
+ kind: ToolKind;
5689
+ category: string;
5690
+ description: string;
5691
+ parameters: ToolParameter[];
5692
+ private service;
5693
+ private moralis;
5694
+ constructor(config?: OpenSupplyFormToolConfig);
5695
+ protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
5696
+ error: string;
5697
+ _instructions: string;
5698
+ chain?: undefined;
5699
+ chainsWithLendingMarkets?: undefined;
5700
+ market?: undefined;
5701
+ candidates?: undefined;
5702
+ marketName?: undefined;
5703
+ protocol?: undefined;
5704
+ usdcBalance?: undefined;
5705
+ requestedAmount?: undefined;
5706
+ ui?: undefined;
5707
+ apyPercent?: undefined;
5708
+ } | {
5709
+ error: string;
5710
+ chain: string;
5711
+ chainsWithLendingMarkets: string[];
5712
+ _instructions: string;
5713
+ market?: undefined;
5714
+ candidates?: undefined;
5715
+ marketName?: undefined;
5716
+ protocol?: undefined;
5717
+ usdcBalance?: undefined;
5718
+ requestedAmount?: undefined;
5719
+ ui?: undefined;
5720
+ apyPercent?: undefined;
5721
+ } | {
5722
+ error: string;
5723
+ market: string;
5724
+ chain: string;
5725
+ _instructions: string;
5726
+ chainsWithLendingMarkets?: undefined;
5727
+ candidates?: undefined;
5728
+ marketName?: undefined;
5729
+ protocol?: undefined;
5730
+ usdcBalance?: undefined;
5731
+ requestedAmount?: undefined;
5732
+ ui?: undefined;
5733
+ apyPercent?: undefined;
5734
+ } | {
5735
+ error: string;
5736
+ market: string;
5737
+ chain: string;
5738
+ candidates: {
5739
+ marketName: string;
5740
+ protocol: string;
5741
+ }[];
5742
+ _instructions: string;
5743
+ chainsWithLendingMarkets?: undefined;
5744
+ marketName?: undefined;
5745
+ protocol?: undefined;
5746
+ usdcBalance?: undefined;
5747
+ requestedAmount?: undefined;
5748
+ ui?: undefined;
5749
+ apyPercent?: undefined;
5750
+ } | {
5751
+ error: string;
5752
+ marketName: string;
5753
+ protocol: string;
5754
+ _instructions: string;
5755
+ chain?: undefined;
5756
+ chainsWithLendingMarkets?: undefined;
5757
+ market?: undefined;
5758
+ candidates?: undefined;
5759
+ usdcBalance?: undefined;
5760
+ requestedAmount?: undefined;
5761
+ ui?: undefined;
5762
+ apyPercent?: undefined;
5763
+ } | {
5764
+ error: string;
5765
+ chain: string;
5766
+ _instructions: string;
5767
+ chainsWithLendingMarkets?: undefined;
5768
+ market?: undefined;
5769
+ candidates?: undefined;
5770
+ marketName?: undefined;
5771
+ protocol?: undefined;
5772
+ usdcBalance?: undefined;
5773
+ requestedAmount?: undefined;
5774
+ ui?: undefined;
5775
+ apyPercent?: undefined;
5776
+ } | {
5777
+ error: string;
5778
+ marketName: string;
5779
+ chain: string;
5780
+ usdcBalance: string;
5781
+ _instructions: string;
5782
+ chainsWithLendingMarkets?: undefined;
5783
+ market?: undefined;
5784
+ candidates?: undefined;
5785
+ protocol?: undefined;
5786
+ requestedAmount?: undefined;
5787
+ ui?: undefined;
5788
+ apyPercent?: undefined;
5789
+ } | {
5790
+ error: string;
5791
+ marketName: string;
5792
+ chain: string;
5793
+ requestedAmount: string | null;
5794
+ usdcBalance: string;
5795
+ _instructions: string;
5796
+ chainsWithLendingMarkets?: undefined;
5797
+ market?: undefined;
5798
+ candidates?: undefined;
5799
+ protocol?: undefined;
5800
+ ui?: undefined;
5801
+ apyPercent?: undefined;
5802
+ } | {
5803
+ ui: UIPayload<SupplyUsdcProps>;
5804
+ marketName: string;
5805
+ protocol: string;
5806
+ chain: string;
5807
+ apyPercent: number | null;
5808
+ usdcBalance: string | null;
5809
+ _instructions: string;
5810
+ error?: undefined;
5811
+ chainsWithLendingMarkets?: undefined;
5812
+ market?: undefined;
5813
+ candidates?: undefined;
5814
+ requestedAmount?: undefined;
5815
+ }>;
5816
+ /** Size + live APY for the one resolved market. Null when it can't be priced. */
5817
+ private describeOne;
5818
+ /**
5819
+ * The wallet's USDC on this chain, for the form's spendable line and the
5820
+ * balance checks above.
5821
+ *
5822
+ * The distinction that matters here is "the call FAILED" vs "the call
5823
+ * succeeded and reported nothing", which a bare null cannot express:
5824
+ *
5825
+ * - `null` — the balance is genuinely UNREADABLE (request failed or threw).
5826
+ * The form still opens: blocking a supply over a flaky call would be worse.
5827
+ * - `{ amount: '0' }` — the request SUCCEEDED and returned no USDC row.
5828
+ *
5829
+ * The second case is the one that was being missed. `getWalletTokenBalances`
5830
+ * serves portfolio LISTS, so it drops zero rows and anything worth under a
5831
+ * cent; we asked it for this one token, so a successful call with no row means
5832
+ * the wallet holds nothing spendable here — not that the read failed. Reporting
5833
+ * it as '0' is what lets the `no_usdc_balance` branch fire instead of opening a
5834
+ * form the user cannot submit.
5835
+ */
5836
+ private usdcBalance;
5837
+ /**
5838
+ * Presentation contract for the synthesizer. Only reached once the supply is
5839
+ * actually possible — an empty or short balance returns earlier with its own
5840
+ * message, so nothing here needs to warn about funds.
5841
+ */
5842
+ private instructions;
5843
+ }
5844
+
5183
5845
  type WalletNFTsToolConfig = MoralisServiceConfig;
5184
5846
  /**
5185
5847
  * Tool: get-wallet-nfts
@@ -7491,15 +8153,19 @@ declare class SwapTokenTool extends BaseTool {
7491
8153
  * - contract_address + token_id → confirm ownership; emit form (image + name +
7492
8154
  * token_standard + maxAmount come from the wallet row). Not held → error.
7493
8155
  * - contract_address only → list the user's holdings in that collection.
7494
- * • 0 → error • 1 → form pre-filled • >1 → empty form.
8156
+ * • 0 → error • 1 → form pre-filled • >1 → picker gallery.
7495
8157
  * - token_id only → list all owned NFTs whose token_id matches.
7496
- * • 0 → error • 1 → form pre-filled • >1 → empty form.
8158
+ * • 0 → error • 1 → form pre-filled • >1 → picker gallery.
7497
8159
  * - nft_name only → fuzzy-match against owned NFTs' names.
7498
- * • 0 → error • 1 → form pre-filled • >1 → empty form.
8160
+ * • 0 → error • 1 → form pre-filled • >1 → picker gallery.
7499
8161
  *
7500
- * When more than one owned NFT matches we cannot safely pick one for the user,
7501
- * so we still open the form (carrying only what the user typed) and let the FE
7502
- * handle the selection.
8162
+ * When more than one owned NFT matches — the common case for a name-only request
8163
+ * ("send my Bored Ape"), since a collection's NFTs usually share one name — we
8164
+ * cannot safely pick one for the user. Instead of opening a half-blank form we
8165
+ * show the matches as the same `WalletNftList` gallery `get-wallet-nfts` renders,
8166
+ * in PICKER mode: each card carries a prompt naming that NFT's exact contract +
8167
+ * token id, so tapping one comes straight back here and resolves to a single
8168
+ * match, which then opens the pre-filled form.
7503
8169
  */
7504
8170
  declare class SendNftTool extends BaseWalletActionTool {
7505
8171
  name: string;
@@ -7511,11 +8177,67 @@ declare class SendNftTool extends BaseWalletActionTool {
7511
8177
  }];
7512
8178
  description: string;
7513
8179
  parameters: ToolParameter[];
7514
- protected buildParameters(args: Record<string, unknown>, userContext?: UserContext): Promise<Record<string, string>>;
8180
+ protected buildParameters(args: Record<string, unknown>, userContext?: UserContext): Promise<Record<string, string> | {
8181
+ ui: UIPayload;
8182
+ _instructions: string;
8183
+ matchCount: number;
8184
+ }>;
8185
+ /**
8186
+ * Render the ambiguous matches as a `WalletNftList` in picker mode — the same
8187
+ * component `get-wallet-nfts` uses, so a "which one?" gallery looks identical
8188
+ * to a browse gallery.
8189
+ *
8190
+ * Each card's prompt carries the NFT's exact token id and contract address
8191
+ * (see {@link buildPickPrompt}), which is what makes the follow-up turn
8192
+ * unambiguous: `matchNfts` then filters on contract + token_id (the strong
8193
+ * keys) and lands on exactly one row. The recipient and amount the user
8194
+ * ALREADY gave are carried through too, so picking an NFT doesn't lose them
8195
+ * and re-ask.
8196
+ *
8197
+ * Images come from the same on-chain `tokenURI` resolution as the browse
8198
+ * gallery, so the user recognises the artwork they are choosing between; they
8199
+ * travel inside `ui.props` and never enter the LLM prompt.
8200
+ */
8201
+ private buildPicker;
8202
+ /**
8203
+ * The message submitted when a picker card is tapped, e.g.
8204
+ *
8205
+ * send my Uniswap - 0.3% - LINK/WETH - 176.22<>239.30 Token id: 5118938
8206
+ * (collection contract: 0x03a5…34f1)
8207
+ *
8208
+ * The action + name come from the LLM's already-localized template, so the
8209
+ * sentence stays in the user's language. Everything after it is a LABELLED
8210
+ * value: a send prompt can carry TWO addresses (the collection and the
8211
+ * recipient) and position alone is not a reliable cue for which is which —
8212
+ * mixing them up would send the NFT to the collection contract. The labels are
8213
+ * fixed English keywords rather than prose, so they survive any template
8214
+ * language.
8215
+ *
8216
+ * The token id trails the name unbracketed because it reads as part of how an
8217
+ * NFT is named; the addresses stay parenthesised so they are unmistakably
8218
+ * machine values and never get parsed as part of the name — which matters here,
8219
+ * since names like the Uniswap LP one above contain their own dashes, slashes
8220
+ * and numbers.
8221
+ */
8222
+ private buildPickPrompt;
8223
+ /**
8224
+ * Each NFT's image from its on-chain `tokenURI` (one multicall for the chain).
8225
+ * Positionally aligned with `nfts`; `null` where nothing resolved, letting the
8226
+ * caller fall back to the Moralis-derived image. Best-effort — any failure
8227
+ * degrades to all-null rather than breaking the picker.
8228
+ */
8229
+ private resolveImages;
7515
8230
  private normaliseString;
7516
8231
  private normaliseTokenId;
7517
8232
  private normaliseAmountInt;
7518
8233
  private nftDisplayName;
8234
+ /**
8235
+ * Label for the collection a picker card belongs to, used only when the picker
8236
+ * spans several collections. Falls back to a shortened contract address when
8237
+ * the collection is unnamed — the whole point of the label is to tell two
8238
+ * otherwise-identical cards apart, so it can never be blank.
8239
+ */
8240
+ private collectionLabel;
7519
8241
  private matchNfts;
7520
8242
  private paramsFromInputs;
7521
8243
  private paramsFromNft;
@@ -7879,6 +8601,150 @@ declare function createX402SignatureProvider(opts: {
7879
8601
  getSigner: () => X402Signer | null | undefined;
7880
8602
  }): X402RetryHandler;
7881
8603
 
8604
+ /**
8605
+ * USD valuation for yield-bearing wallet tokens.
8606
+ *
8607
+ * A wallet's token list shows a balance and a price, and normally the USD value
8608
+ * is just the product of the two. For yield-bearing tokens that is wrong often
8609
+ * enough to matter, and the reason splits the tagged tokens into two kinds:
8610
+ *
8611
+ * - **Share-based vaults** (`spark`, `spark-ethereum`, `morpho-v2`) — `balanceOf`
8612
+ * returns ERC-4626 SHARES, while the price the token API quotes belongs to the
8613
+ * vault's UNDERLYING asset. A share is worth more than one unit of underlying
8614
+ * and drifts further up as yield accrues (measured live: 1 steakUSDC = 1.0354
8615
+ * USDC, 1 Spark sUSDC = 1.1051 USDC). The two are not even in the same unit —
8616
+ * shares carry the vault's own decimals, usually 18, against the underlying's
8617
+ * 6 for USDC. `convertToAssets(shares)` answers both problems at once: it
8618
+ * returns the position denominated in exactly what the price describes.
8619
+ *
8620
+ * - **Rebasing tokens** (`aave-v3`, `compound-v3`) — the balance is ALREADY the
8621
+ * underlying (their decimals match it) and yield arrives as a growing
8622
+ * `balanceOf`. Converting these would be a bug, so they are left untouched.
8623
+ *
8624
+ * The split is already encoded on the protocol classes as `balanceIsUnderlying`,
8625
+ * and this module reuses it rather than restating the protocol list.
8626
+ *
8627
+ * ## Why this returns calls instead of making them
8628
+ *
8629
+ * Same reasoning as {@link LendingProtocol}: the caller owns the transport. The
8630
+ * wallet app already has its own RPC stack — ranked endpoints, failover, a
8631
+ * Multicall3 batcher, and rate-limit-aware pacing for chains without Multicall3 —
8632
+ * and duplicating it here would mean a second, worse copy. So
8633
+ * {@link planYieldTokenConversions} declares the reads, the caller executes them
8634
+ * however it likes, and {@link applyYieldConversions} folds the answers back in.
8635
+ * Both halves are pure and synchronous, which also makes them trivial to test.
8636
+ */
8637
+
8638
+ /**
8639
+ * Whether a `yieldProtocol` denominates balances in vault SHARES rather than the
8640
+ * underlying asset.
8641
+ *
8642
+ * Exported so callers can explain a decision — logging why a tagged token was
8643
+ * skipped, say — without keeping their own copy of the list, which would drift.
8644
+ * This answers only the protocol question: use {@link isShareBasedYieldToken}
8645
+ * for whether a specific token is actually convertible, since that also needs a
8646
+ * price and the underlying's decimals.
8647
+ */
8648
+ declare function isShareBasedProtocol(yieldProtocol?: string | null): yieldProtocol is string;
8649
+ /**
8650
+ * A wallet token as the caller already knows it. Field names mirror what the
8651
+ * Keyring/Pantograph token API returns, so a caller can pass its rows nearly
8652
+ * as-is.
8653
+ */
8654
+ interface YieldTokenInput {
8655
+ /** Caller's own identifier, echoed back untouched so results can be re-joined. */
8656
+ key: string;
8657
+ /** The token contract — the vault itself for a share-based position. */
8658
+ address: string;
8659
+ /** Raw on-chain balance, unscaled. */
8660
+ rawBalance: bigint;
8661
+ /** The token's own decimals (vault share decimals, usually 18). */
8662
+ decimals: number;
8663
+ /**
8664
+ * Price quoted by the token API — for a vault, the UNDERLYING's price.
8665
+ * Missing, zero or non-finite disables conversion for this token; see
8666
+ * {@link isShareBasedYieldToken}.
8667
+ */
8668
+ priceUSD: number;
8669
+ /** `yieldProtocol` from the token API; anything untagged is left alone. */
8670
+ yieldProtocol?: string | null;
8671
+ /** `yieldAsset` from the token API. Present only for share-based vaults. */
8672
+ yieldAsset?: {
8673
+ address?: string;
8674
+ decimals?: number;
8675
+ } | null;
8676
+ }
8677
+ /** One declared `convertToAssets` read, tagged with the token it belongs to. */
8678
+ interface YieldConversionCall extends MulticallRequest {
8679
+ /** {@link YieldTokenInput.key} of the token this call resolves. */
8680
+ key: string;
8681
+ }
8682
+ /** What {@link planYieldTokenConversions} worked out, ready to execute. */
8683
+ interface YieldConversionPlan {
8684
+ /** Reads to perform, in order. Empty when nothing needs converting. */
8685
+ calls: YieldConversionCall[];
8686
+ }
8687
+ /** A token's corrected valuation. */
8688
+ interface YieldTokenValue {
8689
+ /** Position size in UNDERLYING units (e.g. USDC), not shares. */
8690
+ underlyingAmount: number;
8691
+ /** `underlyingAmount × priceUSD`. */
8692
+ valueUSD: number;
8693
+ /**
8694
+ * Value per SHARE — `valueUSD / balanceFormatted`.
8695
+ *
8696
+ * Worth storing alongside the total: it keeps a row's displayed unit price
8697
+ * consistent with its total, and lets a later balance-only refresh recompute
8698
+ * `balance × price` correctly without re-reading the chain.
8699
+ */
8700
+ pricePerTokenUSD: number;
8701
+ /** True when an on-chain conversion produced this. See {@link applyYieldConversions}. */
8702
+ converted: boolean;
8703
+ }
8704
+ /**
8705
+ * True when a token's balance is ERC-4626 shares that must be converted.
8706
+ *
8707
+ * Deliberately stricter than {@link protocolFor} alone, which falls back to an
8708
+ * ERC-4626 protocol for unrecognised types — the right default when listing
8709
+ * lending markets, but not here, where guessing wrong silently corrupts a
8710
+ * balance. Conversion requires ALL of:
8711
+ *
8712
+ * 1. a known share-based protocol (rebasing receipts are already underlying);
8713
+ * 2. `yieldAsset.decimals`, the scale the returned assets must be read at —
8714
+ * without it the result is an unscaled integer, not an amount;
8715
+ * 3. a usable `priceUSD` (finite and > 0). The conversion's whole purpose is to
8716
+ * produce a USD value, and with no price there is none to produce — the
8717
+ * read would cost an RPC call to compute `x × 0`. Worse, reporting a
8718
+ * converted price of 0 would overwrite the caller's own last-known-price
8719
+ * fallback, turning a priced row into a valueless one that dust filters then
8720
+ * hide. Leaving it untouched keeps whatever the caller already had.
8721
+ *
8722
+ * Anything failing these — rebasing, untagged, unpriced, or incompletely
8723
+ * described — is passed through on its existing `balance × price`.
8724
+ */
8725
+ declare function isShareBasedYieldToken(token: YieldTokenInput): boolean;
8726
+ /**
8727
+ * Declare the `convertToAssets` reads needed to value `tokens` correctly.
8728
+ *
8729
+ * Only share-based holdings with a non-zero balance produce a call, so a wallet
8730
+ * holding no vault tokens plans nothing and costs no RPC.
8731
+ */
8732
+ declare function planYieldTokenConversions(tokens: YieldTokenInput[]): YieldConversionPlan;
8733
+ /**
8734
+ * Fold executed conversion results back into per-token valuations.
8735
+ *
8736
+ * `returns` must align with {@link YieldConversionPlan.calls} — entry `i` is the
8737
+ * raw return data of call `i`, or `null` if that read failed. The returned map is
8738
+ * keyed by {@link YieldTokenInput.key} and contains an entry for every input
8739
+ * token, converted or not, so the caller can apply it uniformly.
8740
+ *
8741
+ * A failed or undecodable read is never destructive: that token falls back to
8742
+ * `balance × price` — the value it would have had anyway — and is reported with
8743
+ * `converted: false`, so a flaky RPC understates a position at worst instead of
8744
+ * zeroing it.
8745
+ */
8746
+ declare function applyYieldConversions(tokens: YieldTokenInput[], plan: YieldConversionPlan, returns: Array<string | null>): Map<string, YieldTokenValue>;
8747
+
7882
8748
  /**
7883
8749
  * PantographService — Pantograph API client.
7884
8750
  *
@@ -8278,4 +9144,4 @@ declare class AbortError extends Error {
8278
9144
  */
8279
9145
  declare function isAbortError(err: unknown): boolean;
8280
9146
 
8281
- 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 };
9147
+ export { AI_AGENT_TOOL_NAMES, AbortError, type AddLiquidityFormProps, type AddLiquiditySummary, type AffiliateFee, type AgentConfig, AgentCore, type AgentResponse, ApproveTokenTool, type ApyPoint, 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, type LendingMarket, type LendingMarketOverview, LendingMarketsTool, type LendingMarketsToolConfig, type LendingProtocolType, LendingService, type LendingServiceConfig, type LendingSupplyPosition, 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, OpenSupplyFormTool, type OpenSupplyFormToolConfig, 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 SupplyProtocolType, type SupplyUsdcProps, 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, type WalletDefiSummaryV1Response, type WalletHistoryCategory, type WalletHistoryContractInteraction, type WalletHistoryErc20Transfer, type WalletHistoryItem, type WalletHistoryNativeTransfer, type WalletHistoryNftTransfer, type WalletHistoryResponse, WalletHistoryTool, type WalletHistoryToolConfig, WalletLendingPositionsTool, type WalletLendingPositionsToolConfig, 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, type YieldConversionCall, type YieldConversionPlan, type YieldTokenInput, type YieldTokenValue, ZERO_ADDRESS, amazonDomainForLanguage, apiClient, applyYieldConversions, 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, isShareBasedProtocol, isShareBasedYieldToken, nfcAmazonSearchUrl, normaliseCountry, normalizePriceRangeToPool, planYieldTokenConversions, priceToTick, readPaymentError, readPaymentRequired, readReceipt, registerMaybeNoForm, requestWithX402, resolveNfcShopLinks, resolveRpcUrl, roundTickToSpacing, rpcCall, setRpcOverrides, swapServiceFactory, tickToPrice, toPantographChain };