keyring-agent-core 0.3.3 → 0.3.4

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
@@ -1614,8 +1614,8 @@ interface AgentConfig {
1614
1614
  /**
1615
1615
  * Base URL for the token/pool search gateway (default:
1616
1616
  * https://entry-gateway.backend-prod.api.uniswap.org). Separate from
1617
- * `baseUrl`: Uniswap moved SearchTokens to this host while ExploreStats
1618
- * and GraphQL stayed on the interface gateway.
1617
+ * `baseUrl`: Uniswap moved SearchTokens and the pool leaderboard to this
1618
+ * host while GraphQL stayed on the interface gateway.
1619
1619
  */
1620
1620
  searchBaseUrl?: string;
1621
1621
  /** Minimum USD value the user must supply to add liquidity. Default 10. */
@@ -5337,7 +5337,7 @@ declare class TransactionByHashTool extends BaseTool {
5337
5337
  * them.
5338
5338
  */
5339
5339
  /** Market kinds `/supply/v2` returns; see {@link PROTOCOLS}. */
5340
- type LendingProtocolType = 'aave-v3' | 'compound-v3' | 'spark' | 'spark-ethereum' | 'spark-l2-susds' | 'morpho-v2';
5340
+ type LendingProtocolType = 'aave-v3' | 'compound-v3' | 'spark' | 'spark-ethereum' | 'spark-l2-susds' | 'morpho-v2' | 'maple';
5341
5341
  /**
5342
5342
  * The per-chain facts a protocol needs — the numeric chain id, and nothing else.
5343
5343
  *
@@ -7397,13 +7397,12 @@ declare class PoolFallbackAiTool extends BaseTool {
7397
7397
  * UniswapService — Uniswap Explore API.
7398
7398
  *
7399
7399
  * Wraps the public endpoints that power https://app.uniswap.org/explore. These
7400
- * are Connect-RPC services: ExploreStats JSON-encodes its request into a
7401
- * `message` query parameter, search POSTs a JSON body; both answer plain JSON.
7400
+ * are Connect-RPC services that POST a JSON body and answer plain JSON.
7402
7401
  *
7403
- * Two gateways, deliberately: ExploreStats + GraphQL stay on
7404
- * `interface.gateway.uniswap.org`, while token/pool search moved to
7405
- * `entry-gateway.backend-prod.api.uniswap.org` — see
7406
- * {@link DEFAULT_SEARCH_BASE_URL}.
7402
+ * Two gateways, deliberately: pool leaderboards (ListPools) and token/pool
7403
+ * search live on `entry-gateway.backend-prod.api.uniswap.org`, while the
7404
+ * per-pool GraphQL detail queries remain on `interface.gateway.uniswap.org` —
7405
+ * see {@link DEFAULT_SEARCH_BASE_URL}.
7407
7406
  *
7408
7407
  * No SDK dependencies — uses native `fetch`.
7409
7408
  */
@@ -7414,12 +7413,19 @@ interface UniswapServiceConfig {
7414
7413
  * Base URL for the token/pool SEARCH gateway (default:
7415
7414
  * https://entry-gateway.backend-prod.api.uniswap.org).
7416
7415
  *
7417
- * Deliberately separate from {@link baseUrl}: Uniswap moved SearchTokens to
7418
- * this host while ExploreStats and GraphQL stayed on the interface gateway,
7419
- * so the two cannot share one origin. Kept configurable so the rest of the
7416
+ * Deliberately separate from {@link baseUrl}: Uniswap moved SearchTokens and
7417
+ * the pool leaderboard here while GraphQL stayed on the interface gateway, so
7418
+ * the two cannot share one origin. Kept configurable so the rest of the
7420
7419
  * migration can be followed without a code change.
7421
7420
  */
7422
7421
  searchBaseUrl?: string;
7422
+ /**
7423
+ * Base URL for the per-pool LIQUIDITY gateway (default:
7424
+ * https://liquidity.backend-prod.api.uniswap.org), which serves
7425
+ * version-agnostic pool detail. A third origin for the same reason
7426
+ * {@link searchBaseUrl} is a second one — see {@link DEFAULT_LIQUIDITY_BASE_URL}.
7427
+ */
7428
+ liquidityBaseUrl?: string;
7423
7429
  }
7424
7430
  type UniswapProtocolVersion = 'V2' | 'V3' | 'V4';
7425
7431
 
@@ -7458,10 +7464,10 @@ type TopPoolsToolConfig = UniswapServiceConfig & {
7458
7464
  /**
7459
7465
  * Tool: get-top-pools
7460
7466
  *
7461
- * Wraps Uniswap's ExploreStats endpoint
7462
- * (`uniswap.explore.v1.ExploreStatsService/ExploreStats`) to surface the
7463
- * top liquidity pools for a given EVM chain. Returns pools ranked by TVL by
7464
- * default; sorting can be switched to volume or transaction count.
7467
+ * Wraps Uniswap's ListPools endpoint (`data.v2.DataApiService/ListPools`) — the
7468
+ * source app.uniswap.org/explore reads — to surface the top liquidity pools for
7469
+ * a given EVM chain. Returns pools ranked by TVL by default; sorting can be
7470
+ * switched to 1d/30d volume or APR, all of which the endpoint ranks server-side.
7465
7471
  */
7466
7472
  declare class TopPoolsTool extends BaseTool {
7467
7473
  name: string;
@@ -7470,11 +7476,12 @@ declare class TopPoolsTool extends BaseTool {
7470
7476
  parameters: ToolParameter[];
7471
7477
  private service;
7472
7478
  /**
7473
- * The Graph subgraph client, used ONLY as a data fallback when Uniswap's
7474
- * ExploreStats has no V3 pools for a chain (e.g. Optimism / Polygon, which are
7475
- * V4-populated in Explore but still have rich V3 pools on the subgraph). This
7476
- * is a tool-layer data fallback — the pool agent's tool surface stays
7477
- * Uniswap-only; it never sees a subgraph tool.
7479
+ * The Graph subgraph client, used ONLY as a data fallback when Uniswap returns
7480
+ * no V3 pools for a chain. ListPools closed the old ExploreStats gap on
7481
+ * Optimism / Polygon, but thin chains still come back near-empty (Linea served
7482
+ * a single V3 pool at the time of writing), so the fallback stays. This is a
7483
+ * tool-layer data fallback — the pool agent's tool surface stays Uniswap-only;
7484
+ * it never sees a subgraph tool.
7478
7485
  */
7479
7486
  private subgraphFallback;
7480
7487
  /** Used ONLY to check add-liquidity (gateway) support per chain — see {@link PoolService.isAddLiquiditySupported}. */
@@ -7486,6 +7493,9 @@ declare class TopPoolsTool extends BaseTool {
7486
7493
  * numbers rather than the LLM's arithmetic. `volumeToTvlRatio` (24h volume ÷
7487
7494
  * TVL) is the single most informative LP-quality signal — capital efficiency /
7488
7495
  * how hard each dollar of liquidity is working.
7496
+ *
7497
+ * ListPools reports the ratio itself, so an upstream value is used as-is;
7498
+ * the local division only covers sources that don't (the subgraph fallback).
7489
7499
  */
7490
7500
  private withExpertSignals;
7491
7501
  /**
@@ -7528,8 +7538,7 @@ type PoolDetailToolConfig = UniswapServiceConfig & {
7528
7538
  * Always-search-then-detail flow for a single Uniswap V3 pool:
7529
7539
  * 1) call SearchTokens upstream to enumerate pools matching the user's input,
7530
7540
  * 2) filter the search result by token symbols and (optionally) fee tier,
7531
- * 3) if the filter narrows to exactly one pool, fetch its full detail via
7532
- * the V3Pool GraphQL operation,
7541
+ * 3) if the filter narrows to exactly one pool, fetch its full detail,
7533
7542
  * 4) otherwise return the candidates so the LLM can ask the user to pick one.
7534
7543
  *
7535
7544
  * The LLM never passes pool addresses — every address that reaches the detail
@@ -7577,15 +7586,6 @@ declare class PoolDetailTool extends BaseTool {
7577
7586
  * Never throws — returns `[]` on any miss so the detail view is unaffected.
7578
7587
  */
7579
7588
  private fetchPriceRanges;
7580
- /**
7581
- * Trim and enrich the GraphQL payload with derived metrics.
7582
- *
7583
- * `lpFeeShare` is the fraction of swap fees left to LPs after the pool's
7584
- * on-chain protocol fee; pass it so fees/APR are the LP-net figures rather
7585
- * than the gross `feeTier × volume` headline.
7586
- */
7587
- private formatPool;
7588
- private formatHistorical;
7589
7589
  }
7590
7590
 
7591
7591
  type PoolSearchToolConfig = UniswapServiceConfig & {
@@ -7614,6 +7614,12 @@ declare class PoolSearchTool extends BaseTool {
7614
7614
  private formatPool;
7615
7615
  }
7616
7616
 
7617
+ /** One point of the weekly volume series, in the shape the analyst reads. */
7618
+ interface PoolHistoricalVolumePoint {
7619
+ timestamp?: number;
7620
+ volumeUsd?: number;
7621
+ }
7622
+
7617
7623
  type PoolByAddressToolConfig = UniswapServiceConfig & {
7618
7624
  /** Hit production addresses endpoints (for add-liquidity gateway lookup). Default true. */
7619
7625
  isProduction?: boolean;
@@ -7627,7 +7633,9 @@ type PoolByAddressToolConfig = UniswapServiceConfig & {
7627
7633
  * with `searchType: "TOKEN"` — and dispatches based on which side returns
7628
7634
  * data:
7629
7635
  *
7630
- * - POOL hit → fetch the pool's full detail (V3Pool GraphQL).
7636
+ * - POOL hit → fetch the pool's full detail. One version-agnostic lookup
7637
+ * covers V2, V3 and V4, so a pasted address never has to be routed by a
7638
+ * version guessed before the pool was read.
7631
7639
  * - TOKEN hit → list pools that contain that token, ranked by 24h volume.
7632
7640
  * - Neither → return an error so the caller can ask the user to clarify.
7633
7641
  */
@@ -7664,12 +7672,10 @@ declare class PoolByAddressTool extends BaseTool {
7664
7672
  fees24hUsd: number | undefined;
7665
7673
  lpFeeShare: number;
7666
7674
  aprPercent: number | undefined;
7675
+ totalAprPercent: number | undefined;
7667
7676
  volumeToTvlRatio: number | undefined;
7668
7677
  txCount: number | undefined;
7669
- historicalVolumeWeek: {
7670
- timestamp: number | undefined;
7671
- volumeUsd: number | undefined;
7672
- }[] | undefined;
7678
+ historicalVolumeWeek: PoolHistoricalVolumePoint[] | undefined;
7673
7679
  token0: {
7674
7680
  address: string | undefined;
7675
7681
  symbol: string | undefined;
@@ -7679,6 +7685,8 @@ declare class PoolByAddressTool extends BaseTool {
7679
7685
  reserve: number | undefined;
7680
7686
  isSpam: boolean | undefined;
7681
7687
  safetyLevel: string | undefined;
7688
+ transferFeeBps: number | undefined;
7689
+ isUnrecognizedToken: true | undefined;
7682
7690
  } | undefined;
7683
7691
  token1: {
7684
7692
  address: string | undefined;
@@ -7689,6 +7697,8 @@ declare class PoolByAddressTool extends BaseTool {
7689
7697
  reserve: number | undefined;
7690
7698
  isSpam: boolean | undefined;
7691
7699
  safetyLevel: string | undefined;
7700
+ transferFeeBps: number | undefined;
7701
+ isUnrecognizedToken: true | undefined;
7692
7702
  } | undefined;
7693
7703
  };
7694
7704
  error?: undefined;
@@ -7735,9 +7745,6 @@ declare class PoolByAddressTool extends BaseTool {
7735
7745
  private findTokenByAddress;
7736
7746
  private formatToken;
7737
7747
  private formatPoolCandidate;
7738
- /** `lpFeeShare` is the fraction of swap fees LPs keep after the protocol fee. */
7739
- private formatPoolDetail;
7740
- private formatHistorical;
7741
7748
  }
7742
7749
 
7743
7750
  interface OpenAddLiquidityFormToolConfig extends UniswapServiceConfig {
@@ -7802,6 +7809,25 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
7802
7809
  * than risk showing an inverted (misleading) range.
7803
7810
  */
7804
7811
  private orientRangesToForm;
7812
+ /**
7813
+ * The "this pool exists, but it's a version we can't add liquidity to yet"
7814
+ * result. Distinct from `pool_not_found` on purpose: telling a user their pool
7815
+ * doesn't exist when it plainly does on Uniswap reads as a bug, so name the
7816
+ * version and point them at V3 instead.
7817
+ */
7818
+ private unsupportedVersionResult;
7819
+ /**
7820
+ * Look for the pool the user meant among the protocol versions this flow does
7821
+ * NOT support (V2 / V4), used only after the V3 search came back empty.
7822
+ *
7823
+ * Purpose is purely diagnostic: it lets the caller say "this is a V4 pool and
7824
+ * adding liquidity only supports V3" instead of the misleading "no pool found".
7825
+ * A pinned `poolAddress` wins when present — that address IS the pool the user
7826
+ * tapped; otherwise the pair (and fee tier, when given) identifies it. Returns
7827
+ * `undefined` on any error or miss, so the caller falls back to `pool_not_found`
7828
+ * exactly as it did before.
7829
+ */
7830
+ private findUnsupportedVersionPool;
7805
7831
  private matchesPairExact;
7806
7832
  private matchesPair;
7807
7833
  private symMatch;