keyring-agent-core 0.2.25 → 0.2.26
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 +527 -43
- package/dist/index.js +149 -102
- package/dist/index.native.js +299 -252
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
declare function tickToPrice(tick: number, token0Decimals: number, token1Decimals: number): number;
|
|
3
3
|
/** price (token1 per token0, decimal-adjusted) → tick */
|
|
4
4
|
declare function priceToTick(price: number, token0Decimals: number, token1Decimals: number): number;
|
|
5
|
+
/**
|
|
6
|
+
* Normalize a user-supplied price range to the pool's token1-per-token0 unit.
|
|
7
|
+
*
|
|
8
|
+
* A human (or the LLM transcribing them) may express a range in EITHER
|
|
9
|
+
* orientation — the pool's internal token1/token0 unit (e.g. ~0.0006 WETH per
|
|
10
|
+
* USDC) or its reciprocal (~1700 USDC per WETH) — and which one is "natural"
|
|
11
|
+
* depends on token ordering the user can't see. Since an add-liquidity range is
|
|
12
|
+
* meant to bracket the live price, we resolve the orientation generically: pick
|
|
13
|
+
* whichever reading — as-given or reciprocal — actually brackets `currentPrice`
|
|
14
|
+
* (and, when that's ambiguous, whichever sits closest to it in log-space).
|
|
15
|
+
*
|
|
16
|
+
* This is orientation-only: it never rescales by powers of ten or otherwise
|
|
17
|
+
* invents numbers. A range that brackets the price in neither orientation is
|
|
18
|
+
* returned untouched (the caller then reports a genuine out-of-range).
|
|
19
|
+
*
|
|
20
|
+
* `minPrice <= 0` (a full-range lower bound) or a non-positive/!finite current
|
|
21
|
+
* price can't be reasoned about, so the input is returned as-is.
|
|
22
|
+
*/
|
|
23
|
+
declare function normalizePriceRangeToPool(minPrice: number, maxPrice: number, currentPrice: number): {
|
|
24
|
+
minPrice: number;
|
|
25
|
+
maxPrice: number;
|
|
26
|
+
inverted: boolean;
|
|
27
|
+
};
|
|
5
28
|
/** Round a tick to the nearest valid tick respecting tickSpacing */
|
|
6
29
|
declare function roundTickToSpacing(tick: number, tickSpacing: number, direction?: 'down' | 'up' | 'nearest'): number;
|
|
7
30
|
declare function clampTick(tick: number): number;
|
|
@@ -840,6 +863,8 @@ interface SwapTokenConfirmTxProps {
|
|
|
840
863
|
/** Human-readable summary of an add-liquidity tx, shown above the Confirm button. */
|
|
841
864
|
interface AddLiquiditySummary {
|
|
842
865
|
nativeIn: number;
|
|
866
|
+
/** Native coin symbol for the pool's chain (ETH / BNB / POL / AVAX …) — for display. */
|
|
867
|
+
nativeSymbol: string;
|
|
843
868
|
nativeInUsd: number | null;
|
|
844
869
|
ratio: {
|
|
845
870
|
token0Percent: number;
|
|
@@ -1198,6 +1223,14 @@ interface AgentConfig {
|
|
|
1198
1223
|
subagents?: {
|
|
1199
1224
|
wallet?: boolean;
|
|
1200
1225
|
'wallet-action'?: boolean;
|
|
1226
|
+
/**
|
|
1227
|
+
* Redirect-only variant of `wallet-action`. Instead of emitting in-chat
|
|
1228
|
+
* forms, every tool just tells the user they can perform the action
|
|
1229
|
+
* directly in the app (using `walletActionAppLink` when set). Mutually
|
|
1230
|
+
* exclusive with `wallet-action`: enabling this (true) turns
|
|
1231
|
+
* `wallet-action` off. Defaults to false.
|
|
1232
|
+
*/
|
|
1233
|
+
'wallet-action-app'?: boolean;
|
|
1201
1234
|
token?: boolean;
|
|
1202
1235
|
nft?: boolean;
|
|
1203
1236
|
pool?: boolean;
|
|
@@ -1257,6 +1290,13 @@ interface AgentConfig {
|
|
|
1257
1290
|
* omitted, it stays as plain text. A single link is shared by all NFT tools.
|
|
1258
1291
|
*/
|
|
1259
1292
|
nftLink?: string;
|
|
1293
|
+
/**
|
|
1294
|
+
* Link to the app where wallet actions are performed, used ONLY by the
|
|
1295
|
+
* redirect-only `wallet-action-app` subagent. When set, its tools surface
|
|
1296
|
+
* this URL as plain text so the user can open the app; when omitted, they
|
|
1297
|
+
* just tell the user the action is done in the app.
|
|
1298
|
+
*/
|
|
1299
|
+
walletActionAppLink?: string;
|
|
1260
1300
|
}
|
|
1261
1301
|
interface LLMToolCall {
|
|
1262
1302
|
toolName: string;
|
|
@@ -1289,10 +1329,23 @@ interface ChatOptions {
|
|
|
1289
1329
|
* Ignored when no tools are passed.
|
|
1290
1330
|
*/
|
|
1291
1331
|
forceToolUse?: boolean;
|
|
1332
|
+
/**
|
|
1333
|
+
* Cancels this request when aborted. Takes precedence over any per-turn signal
|
|
1334
|
+
* set on the provider via {@link LLMProvider.setRequestSignal}. The in-flight
|
|
1335
|
+
* HTTP request is aborted and no further retries are attempted.
|
|
1336
|
+
*/
|
|
1337
|
+
signal?: AbortSignal;
|
|
1292
1338
|
}
|
|
1293
1339
|
interface LLMProvider {
|
|
1294
1340
|
/** Send messages to the LLM and get a response */
|
|
1295
1341
|
chat(messages: ChatMessage[], tools?: ToolDefinition[], options?: ChatOptions): Promise<LLMResponse>;
|
|
1342
|
+
/**
|
|
1343
|
+
* Set (or clear, with `undefined`) the signal applied to every subsequent
|
|
1344
|
+
* request until changed. AgentCore sets this for the duration of a `chat()`
|
|
1345
|
+
* turn so cancellation reaches each LLM round-trip without threading a signal
|
|
1346
|
+
* through every call site. Optional — providers that cannot cancel may omit it.
|
|
1347
|
+
*/
|
|
1348
|
+
setRequestSignal?(signal?: AbortSignal): void;
|
|
1296
1349
|
}
|
|
1297
1350
|
|
|
1298
1351
|
/**
|
|
@@ -1558,6 +1611,12 @@ declare class AgentCore {
|
|
|
1558
1611
|
* the clear. Null when no turn is in flight.
|
|
1559
1612
|
*/
|
|
1560
1613
|
private inFlightTurn;
|
|
1614
|
+
/**
|
|
1615
|
+
* Aborts the in-flight chat() turn when the caller invokes {@link stop} (or the
|
|
1616
|
+
* caller-supplied signal aborts). Null when no turn is running. Each turn owns
|
|
1617
|
+
* its own controller so a late stop() from a previous turn can't cancel the next.
|
|
1618
|
+
*/
|
|
1619
|
+
private currentAbortController;
|
|
1561
1620
|
/**
|
|
1562
1621
|
* Resolves once the initial persisted-history load attempt has finished
|
|
1563
1622
|
* (success or failure). Only meaningful when `persistHistory: true` and a
|
|
@@ -1639,7 +1698,19 @@ declare class AgentCore {
|
|
|
1639
1698
|
chat(userMessage: string, options?: {
|
|
1640
1699
|
generateSuggestions?: boolean;
|
|
1641
1700
|
language?: string;
|
|
1701
|
+
signal?: AbortSignal;
|
|
1642
1702
|
}): Promise<AgentResponse>;
|
|
1703
|
+
/**
|
|
1704
|
+
* Cancel the in-flight {@link chat} turn, if any. The pending `chat()` promise
|
|
1705
|
+
* rejects with an `AbortError` (`err.name === 'AbortError'`) — the in-flight LLM
|
|
1706
|
+
* request is aborted and no further nodes/tools run. No-op when idle.
|
|
1707
|
+
*
|
|
1708
|
+
* History is rolled back to its pre-turn state, so a stopped turn leaves no
|
|
1709
|
+
* orphan messages behind. Safe to call repeatedly.
|
|
1710
|
+
*/
|
|
1711
|
+
stop(): void;
|
|
1712
|
+
/** True while a {@link chat} turn is running (and can be {@link stop}ped). */
|
|
1713
|
+
isBusy(): boolean;
|
|
1643
1714
|
/**
|
|
1644
1715
|
* Build the host object the chat graph's nodes call into. Each method is a
|
|
1645
1716
|
* thin closure over an existing (private) helper, so the graph stays pure
|
|
@@ -1824,20 +1895,20 @@ declare function createWalletAgent(llm: LLMProvider, registry: ToolRegistry, opt
|
|
|
1824
1895
|
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"];
|
|
1825
1896
|
declare function createTokenAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
|
|
1826
1897
|
|
|
1827
|
-
declare const NFT_AGENT_TOOL_NAMES: readonly ["get-wallet-nfts", "get-nft-metadata", "get-nft-contract-info", "
|
|
1898
|
+
declare const NFT_AGENT_TOOL_NAMES: readonly ["get-wallet-nfts", "get-nft-metadata", "get-nft-contract-info", "gemini-search-ai"];
|
|
1828
1899
|
declare function createNftAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
|
|
1829
1900
|
|
|
1830
1901
|
declare const AI_AGENT_TOOL_NAMES: readonly ["gemini-search-ai"];
|
|
1831
1902
|
declare function createAiAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
|
|
1832
1903
|
|
|
1833
|
-
declare const POOL_AGENT_TOOL_NAMES: readonly ["get-top-pools", "get-pool-detail", "search-pools", "lookup-pool-by-address", "open-add-liquidity-form", "preview-add-liquidity", "
|
|
1904
|
+
declare const POOL_AGENT_TOOL_NAMES: readonly ["get-top-pools", "get-pool-detail", "search-pools", "lookup-pool-by-address", "open-add-liquidity-form", "preview-add-liquidity", "estimate-pool-yield", "get-pool-price-ranges", "manage-liquidity-redirect", "pool-fallback-ai"];
|
|
1834
1905
|
declare function createPoolAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
|
|
1835
1906
|
|
|
1836
|
-
declare const WALLET_ACTION_AGENT_TOOL_NAMES: readonly ["open-send-native-form", "open-send-token-form", "open-buy-token-form", "open-swap-token-form", "open-approve-token-form"];
|
|
1907
|
+
declare const WALLET_ACTION_AGENT_TOOL_NAMES: readonly ["open-send-native-form", "open-send-token-form", "open-send-nft-form", "open-buy-token-form", "open-swap-token-form", "open-approve-token-form"];
|
|
1837
1908
|
declare function createWalletActionAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
|
|
1838
1909
|
|
|
1839
1910
|
/** Built-in subagent ids. */
|
|
1840
|
-
type DefaultSubagentName = 'wallet' | 'wallet-action' | 'token' | 'nft' | 'pool' | 'pool-subgraph' | 'ai';
|
|
1911
|
+
type DefaultSubagentName = 'wallet' | 'wallet-action' | 'wallet-action-app' | 'token' | 'nft' | 'pool' | 'pool-subgraph' | 'ai';
|
|
1841
1912
|
/**
|
|
1842
1913
|
* Per-subagent enable flags. Default for every key is `true` EXCEPT
|
|
1843
1914
|
* `pool-subgraph`, which defaults to `false` because it is mutually exclusive
|
|
@@ -1849,6 +1920,10 @@ type DefaultSubagentName = 'wallet' | 'wallet-action' | 'token' | 'nft' | 'pool'
|
|
|
1849
1920
|
* Turning `pool-subgraph` on automatically turns `pool` off unless the caller
|
|
1850
1921
|
* has explicitly enabled `pool: true`. This prevents two pool agents from
|
|
1851
1922
|
* competing for the same user query.
|
|
1923
|
+
*
|
|
1924
|
+
* Similarly, `wallet-action-app` (default off) is the redirect-only variant of
|
|
1925
|
+
* `wallet-action`: enabling it turns `wallet-action` off. The two are mutually
|
|
1926
|
+
* exclusive — only one wallet-action agent ever exists.
|
|
1852
1927
|
*/
|
|
1853
1928
|
type SubagentToggles = Partial<Record<DefaultSubagentName, boolean>>;
|
|
1854
1929
|
/**
|
|
@@ -1869,7 +1944,11 @@ declare class GeminiProvider implements LLMProvider {
|
|
|
1869
1944
|
private maxTokens;
|
|
1870
1945
|
private temperature;
|
|
1871
1946
|
private baseUrl;
|
|
1947
|
+
/** Per-turn signal applied to every request until cleared. See setRequestSignal. */
|
|
1948
|
+
private requestSignal?;
|
|
1872
1949
|
constructor(config: LLMProviderConfig);
|
|
1950
|
+
/** @see LLMProvider.setRequestSignal */
|
|
1951
|
+
setRequestSignal(signal?: AbortSignal): void;
|
|
1873
1952
|
chat(messages: ChatMessage[], tools?: ToolDefinition[], options?: ChatOptions): Promise<LLMResponse>;
|
|
1874
1953
|
private toContents;
|
|
1875
1954
|
private toFunctionDeclarations;
|
|
@@ -4582,6 +4661,34 @@ interface UniswapServiceConfig {
|
|
|
4582
4661
|
}
|
|
4583
4662
|
type UniswapProtocolVersion = 'V2' | 'V3' | 'V4';
|
|
4584
4663
|
|
|
4664
|
+
interface SubgraphServiceConfig {
|
|
4665
|
+
/** The Graph API key. Falls back to a public demo key. */
|
|
4666
|
+
theGraphApiKey?: string;
|
|
4667
|
+
/** CoinPool pair API base url (`/pair/v2`). */
|
|
4668
|
+
coinPoolBaseUrl?: string;
|
|
4669
|
+
/** @deprecated No longer used — CoinPool `/pair/v2` returns APR + ranges directly. */
|
|
4670
|
+
keyringPoolBaseUrl?: string;
|
|
4671
|
+
/** Override a subgraph URL by chain hex id. */
|
|
4672
|
+
subgraphUrls?: Record<string, string>;
|
|
4673
|
+
}
|
|
4674
|
+
interface CoinPoolPairSummary$1 {
|
|
4675
|
+
poolId: string;
|
|
4676
|
+
pair: string;
|
|
4677
|
+
fee: string;
|
|
4678
|
+
apr: number | null;
|
|
4679
|
+
aprAvg: number | null;
|
|
4680
|
+
token0Price: number;
|
|
4681
|
+
token1Price: number;
|
|
4682
|
+
priceRange: {
|
|
4683
|
+
minPrice: number;
|
|
4684
|
+
maxPrice: number;
|
|
4685
|
+
currentPrice: number;
|
|
4686
|
+
baseToken: string;
|
|
4687
|
+
quoteToken: string;
|
|
4688
|
+
};
|
|
4689
|
+
}
|
|
4690
|
+
type SubgraphSort = 'tvl' | 'volume' | 'apr' | 'fee' | 'liquidity';
|
|
4691
|
+
|
|
4585
4692
|
type TopPoolsToolConfig = UniswapServiceConfig;
|
|
4586
4693
|
/**
|
|
4587
4694
|
* Tool: get-top-pools
|
|
@@ -4597,13 +4704,22 @@ declare class TopPoolsTool extends BaseTool {
|
|
|
4597
4704
|
category: string;
|
|
4598
4705
|
parameters: ToolParameter[];
|
|
4599
4706
|
private service;
|
|
4600
|
-
|
|
4707
|
+
/**
|
|
4708
|
+
* The Graph subgraph client, used ONLY as a data fallback when Uniswap's
|
|
4709
|
+
* ExploreStats has no V3 pools for a chain (e.g. Optimism / Polygon, which are
|
|
4710
|
+
* V4-populated in Explore but still have rich V3 pools on the subgraph). This
|
|
4711
|
+
* is a tool-layer data fallback — the pool agent's tool surface stays
|
|
4712
|
+
* Uniswap-only; it never sees a subgraph tool.
|
|
4713
|
+
*/
|
|
4714
|
+
private subgraphFallback;
|
|
4715
|
+
constructor(config?: TopPoolsToolConfig, subgraphConfig?: SubgraphServiceConfig);
|
|
4601
4716
|
protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
|
|
4602
4717
|
error: string;
|
|
4603
4718
|
_instructions?: undefined;
|
|
4604
4719
|
chain?: undefined;
|
|
4605
4720
|
protocolVersion?: undefined;
|
|
4606
4721
|
sortBy?: undefined;
|
|
4722
|
+
source?: undefined;
|
|
4607
4723
|
count?: undefined;
|
|
4608
4724
|
pools?: undefined;
|
|
4609
4725
|
} | {
|
|
@@ -4611,8 +4727,10 @@ declare class TopPoolsTool extends BaseTool {
|
|
|
4611
4727
|
chain: string;
|
|
4612
4728
|
protocolVersion: UniswapProtocolVersion;
|
|
4613
4729
|
sortBy: "tvl" | "volume1Day" | "volume1Week" | "volume30Day" | "txCount" | "apr";
|
|
4730
|
+
source: "uniswap" | "subgraph";
|
|
4614
4731
|
count: number;
|
|
4615
4732
|
pools: {
|
|
4733
|
+
uniswapUrl?: string;
|
|
4616
4734
|
apr: number | undefined;
|
|
4617
4735
|
address: string;
|
|
4618
4736
|
chain: string | undefined;
|
|
@@ -4620,6 +4738,7 @@ declare class TopPoolsTool extends BaseTool {
|
|
|
4620
4738
|
feeTierBps: number | undefined;
|
|
4621
4739
|
feeTierPercent: number | undefined;
|
|
4622
4740
|
tvlUsd: number | undefined;
|
|
4741
|
+
fee24hUsd: number | undefined;
|
|
4623
4742
|
volume1DayUsd: number | undefined;
|
|
4624
4743
|
volume1WeekUsd: number | undefined;
|
|
4625
4744
|
volume30DayUsd: number | undefined;
|
|
@@ -4630,6 +4749,8 @@ declare class TopPoolsTool extends BaseTool {
|
|
|
4630
4749
|
name: string | undefined;
|
|
4631
4750
|
decimals: number | undefined;
|
|
4632
4751
|
priceUsd: number | undefined;
|
|
4752
|
+
isSpam: boolean | undefined;
|
|
4753
|
+
safetyLevel: string | undefined;
|
|
4633
4754
|
} | undefined;
|
|
4634
4755
|
token1: {
|
|
4635
4756
|
address: string | undefined;
|
|
@@ -4637,16 +4758,68 @@ declare class TopPoolsTool extends BaseTool {
|
|
|
4637
4758
|
name: string | undefined;
|
|
4638
4759
|
decimals: number | undefined;
|
|
4639
4760
|
priceUsd: number | undefined;
|
|
4761
|
+
isSpam: boolean | undefined;
|
|
4762
|
+
safetyLevel: string | undefined;
|
|
4640
4763
|
} | undefined;
|
|
4764
|
+
volumeToTvlRatio?: number;
|
|
4641
4765
|
}[];
|
|
4642
4766
|
error?: undefined;
|
|
4643
4767
|
}>;
|
|
4768
|
+
/**
|
|
4769
|
+
* Attach deterministic expert signals so the analysis is grounded in real
|
|
4770
|
+
* numbers rather than the LLM's arithmetic. `volumeToTvlRatio` (24h volume ÷
|
|
4771
|
+
* TVL) is the single most informative LP-quality signal — capital efficiency /
|
|
4772
|
+
* how hard each dollar of liquidity is working.
|
|
4773
|
+
*/
|
|
4774
|
+
private withExpertSignals;
|
|
4775
|
+
/**
|
|
4776
|
+
* Fetch the V3 pool leaderboard from The Graph subgraph and shape it to match
|
|
4777
|
+
* {@link formatPool}'s output, so a downstream LLM renders it identically to a
|
|
4778
|
+
* native Uniswap result. Returns `[]` on any error (the caller then surfaces an
|
|
4779
|
+
* empty list, same as before this fallback existed).
|
|
4780
|
+
*/
|
|
4781
|
+
private fetchV3Fallback;
|
|
4782
|
+
/** Sort key resolver for the subgraph fallback (only TVL / 24h volume / APR are available). */
|
|
4783
|
+
private fallbackSortValue;
|
|
4784
|
+
/** Map a subgraph V3 pool to the same shape {@link formatPool} produces. */
|
|
4785
|
+
private formatSubgraphPool;
|
|
4644
4786
|
private parseProtocolVersion;
|
|
4645
4787
|
private parseSortKey;
|
|
4646
4788
|
/** Trim the upstream payload to the fields a downstream LLM actually needs. */
|
|
4647
4789
|
private formatPool;
|
|
4648
4790
|
}
|
|
4649
4791
|
|
|
4792
|
+
/**
|
|
4793
|
+
* Standalone client for the CoinPool platform's concentrated-liquidity
|
|
4794
|
+
* price-range API (`/pair/v2`). This is the CoinPool product — NOT The Graph
|
|
4795
|
+
* subgraph and NOT the Uniswap interface gateway. It is intentionally
|
|
4796
|
+
* independent of {@link UniswapSubgraphService} so the Uniswap-backed
|
|
4797
|
+
* `pool-agent` can surface CoinPool range suggestions without pulling in any
|
|
4798
|
+
* subgraph code (the two pool stacks are mutually exclusive and kept separate).
|
|
4799
|
+
*/
|
|
4800
|
+
interface CoinPoolServiceConfig {
|
|
4801
|
+
/** Base URL of the CoinPool API. Defaults to `https://api.coinpool.app`. */
|
|
4802
|
+
coinPoolBaseUrl?: string;
|
|
4803
|
+
}
|
|
4804
|
+
/** A single concentrated-liquidity price-range candidate from CoinPool. */
|
|
4805
|
+
interface CoinPoolPairSummary {
|
|
4806
|
+
poolId: string;
|
|
4807
|
+
pair: string;
|
|
4808
|
+
fee: string;
|
|
4809
|
+
/** APR earned ONLY within this specific price range (not the overall pool APR). */
|
|
4810
|
+
apr: number | null;
|
|
4811
|
+
aprAvg: number | null;
|
|
4812
|
+
token0Price: number;
|
|
4813
|
+
token1Price: number;
|
|
4814
|
+
priceRange: {
|
|
4815
|
+
minPrice: number;
|
|
4816
|
+
maxPrice: number;
|
|
4817
|
+
currentPrice: number;
|
|
4818
|
+
baseToken: string;
|
|
4819
|
+
quoteToken: string;
|
|
4820
|
+
};
|
|
4821
|
+
}
|
|
4822
|
+
|
|
4650
4823
|
type PoolDetailToolConfig = UniswapServiceConfig;
|
|
4651
4824
|
/**
|
|
4652
4825
|
* Tool: get-pool-detail
|
|
@@ -4668,20 +4841,33 @@ declare class PoolDetailTool extends BaseTool {
|
|
|
4668
4841
|
category: string;
|
|
4669
4842
|
parameters: ToolParameter[];
|
|
4670
4843
|
private service;
|
|
4671
|
-
|
|
4844
|
+
/**
|
|
4845
|
+
* CoinPool client (separate platform — its own API, not the subgraph). When a
|
|
4846
|
+
* pool resolves to exactly one match we also pull its concentrated-liquidity
|
|
4847
|
+
* price-range candidates so the detail view shows ranges inline, without the
|
|
4848
|
+
* user having to ask separately.
|
|
4849
|
+
*/
|
|
4850
|
+
private coinPool;
|
|
4851
|
+
constructor(config?: PoolDetailToolConfig, coinPoolConfig?: CoinPoolServiceConfig);
|
|
4672
4852
|
protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
|
|
4673
4853
|
error: string;
|
|
4854
|
+
priceRanges?: undefined;
|
|
4674
4855
|
_instructions?: undefined;
|
|
4675
4856
|
pairOrderMatched?: undefined;
|
|
4676
4857
|
pool?: undefined;
|
|
4677
4858
|
chain?: undefined;
|
|
4859
|
+
multiFeeTier?: undefined;
|
|
4860
|
+
count?: undefined;
|
|
4861
|
+
pools?: undefined;
|
|
4678
4862
|
reason?: undefined;
|
|
4679
4863
|
missing?: undefined;
|
|
4680
4864
|
candidates?: undefined;
|
|
4681
4865
|
} | {
|
|
4866
|
+
priceRanges: CoinPoolPairSummary[];
|
|
4682
4867
|
_instructions: string;
|
|
4683
4868
|
pairOrderMatched: string;
|
|
4684
4869
|
pool: {
|
|
4870
|
+
uniswapUrl?: string;
|
|
4685
4871
|
address: string | undefined;
|
|
4686
4872
|
protocolVersion: UniswapProtocolVersion | undefined;
|
|
4687
4873
|
feeTierBps: number | undefined;
|
|
@@ -4691,6 +4877,7 @@ declare class PoolDetailTool extends BaseTool {
|
|
|
4691
4877
|
volume24hUsd: number | undefined;
|
|
4692
4878
|
fees24hUsd: number | undefined;
|
|
4693
4879
|
aprPercent: number | undefined;
|
|
4880
|
+
volumeToTvlRatio: number | undefined;
|
|
4694
4881
|
txCount: number | undefined;
|
|
4695
4882
|
historicalVolumeWeek: {
|
|
4696
4883
|
timestamp: number | undefined;
|
|
@@ -4719,6 +4906,59 @@ declare class PoolDetailTool extends BaseTool {
|
|
|
4719
4906
|
};
|
|
4720
4907
|
error?: undefined;
|
|
4721
4908
|
chain?: undefined;
|
|
4909
|
+
multiFeeTier?: undefined;
|
|
4910
|
+
count?: undefined;
|
|
4911
|
+
pools?: undefined;
|
|
4912
|
+
reason?: undefined;
|
|
4913
|
+
missing?: undefined;
|
|
4914
|
+
candidates?: undefined;
|
|
4915
|
+
} | {
|
|
4916
|
+
_instructions: string;
|
|
4917
|
+
chain: string;
|
|
4918
|
+
pairOrderMatched: string;
|
|
4919
|
+
multiFeeTier: boolean;
|
|
4920
|
+
count: number;
|
|
4921
|
+
pools: {
|
|
4922
|
+
uniswapUrl?: string;
|
|
4923
|
+
address: string | undefined;
|
|
4924
|
+
protocolVersion: UniswapProtocolVersion | undefined;
|
|
4925
|
+
feeTierBps: number | undefined;
|
|
4926
|
+
feeTierPercent: number | undefined;
|
|
4927
|
+
tvlUsd: number | undefined;
|
|
4928
|
+
tvlChange24hPercent: number | undefined;
|
|
4929
|
+
volume24hUsd: number | undefined;
|
|
4930
|
+
fees24hUsd: number | undefined;
|
|
4931
|
+
aprPercent: number | undefined;
|
|
4932
|
+
volumeToTvlRatio: number | undefined;
|
|
4933
|
+
txCount: number | undefined;
|
|
4934
|
+
historicalVolumeWeek: {
|
|
4935
|
+
timestamp: number | undefined;
|
|
4936
|
+
volumeUsd: number | undefined;
|
|
4937
|
+
}[] | undefined;
|
|
4938
|
+
token0: {
|
|
4939
|
+
address: string | undefined;
|
|
4940
|
+
symbol: string | undefined;
|
|
4941
|
+
name: string | undefined;
|
|
4942
|
+
decimals: number | undefined;
|
|
4943
|
+
priceUsd: number | undefined;
|
|
4944
|
+
reserve: number | undefined;
|
|
4945
|
+
isSpam: boolean | undefined;
|
|
4946
|
+
safetyLevel: string | undefined;
|
|
4947
|
+
} | undefined;
|
|
4948
|
+
token1: {
|
|
4949
|
+
address: string | undefined;
|
|
4950
|
+
symbol: string | undefined;
|
|
4951
|
+
name: string | undefined;
|
|
4952
|
+
decimals: number | undefined;
|
|
4953
|
+
priceUsd: number | undefined;
|
|
4954
|
+
reserve: number | undefined;
|
|
4955
|
+
isSpam: boolean | undefined;
|
|
4956
|
+
safetyLevel: string | undefined;
|
|
4957
|
+
} | undefined;
|
|
4958
|
+
}[];
|
|
4959
|
+
error?: undefined;
|
|
4960
|
+
priceRanges?: undefined;
|
|
4961
|
+
pool?: undefined;
|
|
4722
4962
|
reason?: undefined;
|
|
4723
4963
|
missing?: undefined;
|
|
4724
4964
|
candidates?: undefined;
|
|
@@ -4729,6 +4969,7 @@ declare class PoolDetailTool extends BaseTool {
|
|
|
4729
4969
|
reason: string;
|
|
4730
4970
|
missing: string[];
|
|
4731
4971
|
candidates: {
|
|
4972
|
+
uniswapUrl?: string;
|
|
4732
4973
|
address: string | undefined;
|
|
4733
4974
|
protocolVersion: UniswapProtocolVersion | undefined;
|
|
4734
4975
|
feeTierBps: number | undefined;
|
|
@@ -4747,7 +4988,11 @@ declare class PoolDetailTool extends BaseTool {
|
|
|
4747
4988
|
} | undefined;
|
|
4748
4989
|
}[];
|
|
4749
4990
|
error?: undefined;
|
|
4991
|
+
priceRanges?: undefined;
|
|
4750
4992
|
pool?: undefined;
|
|
4993
|
+
multiFeeTier?: undefined;
|
|
4994
|
+
count?: undefined;
|
|
4995
|
+
pools?: undefined;
|
|
4751
4996
|
}>;
|
|
4752
4997
|
/**
|
|
4753
4998
|
* Filter predicate. `mode` controls pair-order matching when both symbols
|
|
@@ -4766,6 +5011,13 @@ declare class PoolDetailTool extends BaseTool {
|
|
|
4766
5011
|
private rankCandidates;
|
|
4767
5012
|
/** Compact view of a search candidate for the LLM to render as a picker. */
|
|
4768
5013
|
private formatCandidate;
|
|
5014
|
+
/**
|
|
5015
|
+
* Best-effort CoinPool price-range candidates for the resolved pool. Tries the
|
|
5016
|
+
* exact pool address first (most precise); if CoinPool has no entry for that
|
|
5017
|
+
* pool, falls back to the token pair so the user still sees relevant ranges.
|
|
5018
|
+
* Never throws — returns `[]` on any miss so the detail view is unaffected.
|
|
5019
|
+
*/
|
|
5020
|
+
private fetchPriceRanges;
|
|
4769
5021
|
/** Trim and enrich the GraphQL payload with derived metrics. */
|
|
4770
5022
|
private formatPool;
|
|
4771
5023
|
private formatHistorical;
|
|
@@ -4810,7 +5062,9 @@ declare class PoolSearchTool extends BaseTool {
|
|
|
4810
5062
|
page: number;
|
|
4811
5063
|
size: number;
|
|
4812
5064
|
count: number;
|
|
4813
|
-
pools:
|
|
5065
|
+
pools: {
|
|
5066
|
+
uniswapUrl?: string;
|
|
5067
|
+
}[];
|
|
4814
5068
|
error?: undefined;
|
|
4815
5069
|
}>;
|
|
4816
5070
|
private parseProtocolFilter;
|
|
@@ -4851,6 +5105,7 @@ declare class PoolByAddressTool extends BaseTool {
|
|
|
4851
5105
|
chain: string;
|
|
4852
5106
|
protocolVersion: UniswapProtocolVersion;
|
|
4853
5107
|
pool: {
|
|
5108
|
+
uniswapUrl?: string;
|
|
4854
5109
|
address: string | undefined;
|
|
4855
5110
|
protocolVersion: UniswapProtocolVersion | undefined;
|
|
4856
5111
|
poolId: string | undefined;
|
|
@@ -4864,6 +5119,7 @@ declare class PoolByAddressTool extends BaseTool {
|
|
|
4864
5119
|
volume24hUsd: number | undefined;
|
|
4865
5120
|
fees24hUsd: number | undefined;
|
|
4866
5121
|
aprPercent: number | undefined;
|
|
5122
|
+
volumeToTvlRatio: number | undefined;
|
|
4867
5123
|
txCount: number | undefined;
|
|
4868
5124
|
historicalVolumeWeek: {
|
|
4869
5125
|
timestamp: number | undefined;
|
|
@@ -4876,6 +5132,8 @@ declare class PoolByAddressTool extends BaseTool {
|
|
|
4876
5132
|
decimals: number | undefined;
|
|
4877
5133
|
priceUsd: number | undefined;
|
|
4878
5134
|
reserve: number | undefined;
|
|
5135
|
+
isSpam: boolean | undefined;
|
|
5136
|
+
safetyLevel: string | undefined;
|
|
4879
5137
|
} | undefined;
|
|
4880
5138
|
token1: {
|
|
4881
5139
|
address: string | undefined;
|
|
@@ -4884,6 +5142,8 @@ declare class PoolByAddressTool extends BaseTool {
|
|
|
4884
5142
|
decimals: number | undefined;
|
|
4885
5143
|
priceUsd: number | undefined;
|
|
4886
5144
|
reserve: number | undefined;
|
|
5145
|
+
isSpam: boolean | undefined;
|
|
5146
|
+
safetyLevel: string | undefined;
|
|
4887
5147
|
} | undefined;
|
|
4888
5148
|
};
|
|
4889
5149
|
error?: undefined;
|
|
@@ -4912,6 +5172,7 @@ declare class PoolByAddressTool extends BaseTool {
|
|
|
4912
5172
|
};
|
|
4913
5173
|
poolCount: number;
|
|
4914
5174
|
pools: {
|
|
5175
|
+
uniswapUrl?: string;
|
|
4915
5176
|
address: string | undefined;
|
|
4916
5177
|
protocolVersion: UniswapProtocolVersion | undefined;
|
|
4917
5178
|
feeTierBps: number | undefined;
|
|
@@ -4945,6 +5206,8 @@ interface OpenAddLiquidityFormToolConfig extends UniswapServiceConfig {
|
|
|
4945
5206
|
pool?: PoolServiceConfig;
|
|
4946
5207
|
/** Min USD value the user must supply. Default 10. */
|
|
4947
5208
|
minProvideUsd?: number;
|
|
5209
|
+
/** CoinPool API config for the reference price-range suggestions. */
|
|
5210
|
+
coinPool?: CoinPoolServiceConfig;
|
|
4948
5211
|
}
|
|
4949
5212
|
/**
|
|
4950
5213
|
* Tool: open-add-liquidity-form
|
|
@@ -4970,6 +5233,7 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
|
4970
5233
|
parameters: ToolParameter[];
|
|
4971
5234
|
private uniswap;
|
|
4972
5235
|
private pool;
|
|
5236
|
+
private coinPool;
|
|
4973
5237
|
private minProvideUsd;
|
|
4974
5238
|
constructor(config?: OpenAddLiquidityFormToolConfig);
|
|
4975
5239
|
/**
|
|
@@ -4984,8 +5248,10 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
|
4984
5248
|
requestedToken?: undefined;
|
|
4985
5249
|
nativeSymbol?: undefined;
|
|
4986
5250
|
chainName?: undefined;
|
|
4987
|
-
|
|
5251
|
+
relatedPools?: undefined;
|
|
5252
|
+
count?: undefined;
|
|
4988
5253
|
ui?: undefined;
|
|
5254
|
+
suggestedRanges?: undefined;
|
|
4989
5255
|
summary?: undefined;
|
|
4990
5256
|
} | {
|
|
4991
5257
|
error: string;
|
|
@@ -4994,8 +5260,10 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
|
4994
5260
|
requestedToken?: undefined;
|
|
4995
5261
|
nativeSymbol?: undefined;
|
|
4996
5262
|
chainName?: undefined;
|
|
4997
|
-
|
|
5263
|
+
relatedPools?: undefined;
|
|
5264
|
+
count?: undefined;
|
|
4998
5265
|
ui?: undefined;
|
|
5266
|
+
suggestedRanges?: undefined;
|
|
4999
5267
|
summary?: undefined;
|
|
5000
5268
|
} | {
|
|
5001
5269
|
error: string;
|
|
@@ -5004,8 +5272,10 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
|
5004
5272
|
chainName: string;
|
|
5005
5273
|
_instructions: string;
|
|
5006
5274
|
chain?: undefined;
|
|
5007
|
-
|
|
5275
|
+
relatedPools?: undefined;
|
|
5276
|
+
count?: undefined;
|
|
5008
5277
|
ui?: undefined;
|
|
5278
|
+
suggestedRanges?: undefined;
|
|
5009
5279
|
summary?: undefined;
|
|
5010
5280
|
} | {
|
|
5011
5281
|
error: string;
|
|
@@ -5014,12 +5284,15 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
|
5014
5284
|
requestedToken?: undefined;
|
|
5015
5285
|
nativeSymbol?: undefined;
|
|
5016
5286
|
chainName?: undefined;
|
|
5017
|
-
|
|
5287
|
+
relatedPools?: undefined;
|
|
5288
|
+
count?: undefined;
|
|
5018
5289
|
ui?: undefined;
|
|
5290
|
+
suggestedRanges?: undefined;
|
|
5019
5291
|
summary?: undefined;
|
|
5020
5292
|
} | {
|
|
5021
|
-
|
|
5293
|
+
relatedPools: {
|
|
5022
5294
|
apr?: number | undefined;
|
|
5295
|
+
volumeToTvlRatio?: number | undefined;
|
|
5023
5296
|
address: string | undefined;
|
|
5024
5297
|
token0Symbol: string | undefined;
|
|
5025
5298
|
token1Symbol: string | undefined;
|
|
@@ -5028,6 +5301,7 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
|
5028
5301
|
volume24hUsd: number | undefined;
|
|
5029
5302
|
tvlUsd: number | undefined;
|
|
5030
5303
|
}[];
|
|
5304
|
+
count: number;
|
|
5031
5305
|
_instructions: string;
|
|
5032
5306
|
error?: undefined;
|
|
5033
5307
|
chain?: undefined;
|
|
@@ -5035,9 +5309,19 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
|
5035
5309
|
nativeSymbol?: undefined;
|
|
5036
5310
|
chainName?: undefined;
|
|
5037
5311
|
ui?: undefined;
|
|
5312
|
+
suggestedRanges?: undefined;
|
|
5038
5313
|
summary?: undefined;
|
|
5039
5314
|
} | {
|
|
5040
5315
|
ui: UIPayload<AddLiquidityFormProps>;
|
|
5316
|
+
suggestedRanges: {
|
|
5317
|
+
fee: string;
|
|
5318
|
+
apr: number | null;
|
|
5319
|
+
minPrice: number;
|
|
5320
|
+
maxPrice: number;
|
|
5321
|
+
currentPrice: number;
|
|
5322
|
+
baseSymbol?: string;
|
|
5323
|
+
quoteSymbol?: string;
|
|
5324
|
+
}[];
|
|
5041
5325
|
summary: string;
|
|
5042
5326
|
_instructions: string;
|
|
5043
5327
|
error?: undefined;
|
|
@@ -5045,8 +5329,32 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
|
5045
5329
|
requestedToken?: undefined;
|
|
5046
5330
|
nativeSymbol?: undefined;
|
|
5047
5331
|
chainName?: undefined;
|
|
5048
|
-
|
|
5332
|
+
relatedPools?: undefined;
|
|
5333
|
+
count?: undefined;
|
|
5049
5334
|
}>;
|
|
5335
|
+
/**
|
|
5336
|
+
* Best-effort CoinPool in-range price-range candidates for the resolved pool,
|
|
5337
|
+
* offered to the user as a reference when filling the form's range inputs.
|
|
5338
|
+
* Tries the exact pool address first (most precise); falls back to the token
|
|
5339
|
+
* pair when CoinPool has no entry for that pool. Never throws — returns `[]`
|
|
5340
|
+
* on any miss so the add-liquidity form is unaffected. The CoinPool service
|
|
5341
|
+
* already drops out-of-range entries, so every candidate here is in-range.
|
|
5342
|
+
*/
|
|
5343
|
+
private fetchPriceRanges;
|
|
5344
|
+
/**
|
|
5345
|
+
* Re-express CoinPool range candidates in the form's price unit (token1 per
|
|
5346
|
+
* token0, decimal-adjusted — the same unit as `pool.currentPrice` and the
|
|
5347
|
+
* min/max inputs). CoinPool orients each entry by its own `selectorAddress`,
|
|
5348
|
+
* which may pick EITHER token as the base, so a USDC/WETH pool can come back
|
|
5349
|
+
* as ~1600 (USDC per WETH) while the form shows ~0.0006 (WETH per USDC).
|
|
5350
|
+
*
|
|
5351
|
+
* For each candidate we pick the reading — as-is or reciprocal — whose current
|
|
5352
|
+
* price is closer (in log space) to the pool's actual on-chain current price,
|
|
5353
|
+
* then label base = token0, quote = token1 to match the form. When the pool
|
|
5354
|
+
* price is unknown we cannot orient safely, so we drop the suggestions rather
|
|
5355
|
+
* than risk showing an inverted (misleading) range.
|
|
5356
|
+
*/
|
|
5357
|
+
private orientRangesToForm;
|
|
5050
5358
|
private matchesPairExact;
|
|
5051
5359
|
private matchesPair;
|
|
5052
5360
|
private symMatch;
|
|
@@ -5113,6 +5421,9 @@ declare class PreviewAddLiquidityTool extends BaseTool {
|
|
|
5113
5421
|
rawTickUpper?: undefined;
|
|
5114
5422
|
tickLower?: undefined;
|
|
5115
5423
|
tickUpper?: undefined;
|
|
5424
|
+
currentPrice?: undefined;
|
|
5425
|
+
requestedRange?: undefined;
|
|
5426
|
+
side?: undefined;
|
|
5116
5427
|
balanceWei?: undefined;
|
|
5117
5428
|
requiredWei?: undefined;
|
|
5118
5429
|
gasReserveWei?: undefined;
|
|
@@ -5126,6 +5437,9 @@ declare class PreviewAddLiquidityTool extends BaseTool {
|
|
|
5126
5437
|
rawTickUpper?: undefined;
|
|
5127
5438
|
tickLower?: undefined;
|
|
5128
5439
|
tickUpper?: undefined;
|
|
5440
|
+
currentPrice?: undefined;
|
|
5441
|
+
requestedRange?: undefined;
|
|
5442
|
+
side?: undefined;
|
|
5129
5443
|
balanceWei?: undefined;
|
|
5130
5444
|
requiredWei?: undefined;
|
|
5131
5445
|
gasReserveWei?: undefined;
|
|
@@ -5139,6 +5453,9 @@ declare class PreviewAddLiquidityTool extends BaseTool {
|
|
|
5139
5453
|
rawTickUpper?: undefined;
|
|
5140
5454
|
tickLower?: undefined;
|
|
5141
5455
|
tickUpper?: undefined;
|
|
5456
|
+
currentPrice?: undefined;
|
|
5457
|
+
requestedRange?: undefined;
|
|
5458
|
+
side?: undefined;
|
|
5142
5459
|
balanceWei?: undefined;
|
|
5143
5460
|
requiredWei?: undefined;
|
|
5144
5461
|
gasReserveWei?: undefined;
|
|
@@ -5152,6 +5469,28 @@ declare class PreviewAddLiquidityTool extends BaseTool {
|
|
|
5152
5469
|
tickLower: number;
|
|
5153
5470
|
tickUpper: number;
|
|
5154
5471
|
chain?: undefined;
|
|
5472
|
+
currentPrice?: undefined;
|
|
5473
|
+
requestedRange?: undefined;
|
|
5474
|
+
side?: undefined;
|
|
5475
|
+
balanceWei?: undefined;
|
|
5476
|
+
requiredWei?: undefined;
|
|
5477
|
+
gasReserveWei?: undefined;
|
|
5478
|
+
ui?: undefined;
|
|
5479
|
+
summary?: undefined;
|
|
5480
|
+
} | {
|
|
5481
|
+
error: string;
|
|
5482
|
+
_instructions: string;
|
|
5483
|
+
currentPrice: number;
|
|
5484
|
+
requestedRange: {
|
|
5485
|
+
minPrice: number;
|
|
5486
|
+
maxPrice: number;
|
|
5487
|
+
};
|
|
5488
|
+
side: string;
|
|
5489
|
+
chain?: undefined;
|
|
5490
|
+
rawTickLower?: undefined;
|
|
5491
|
+
rawTickUpper?: undefined;
|
|
5492
|
+
tickLower?: undefined;
|
|
5493
|
+
tickUpper?: undefined;
|
|
5155
5494
|
balanceWei?: undefined;
|
|
5156
5495
|
requiredWei?: undefined;
|
|
5157
5496
|
gasReserveWei?: undefined;
|
|
@@ -5168,6 +5507,9 @@ declare class PreviewAddLiquidityTool extends BaseTool {
|
|
|
5168
5507
|
rawTickUpper?: undefined;
|
|
5169
5508
|
tickLower?: undefined;
|
|
5170
5509
|
tickUpper?: undefined;
|
|
5510
|
+
currentPrice?: undefined;
|
|
5511
|
+
requestedRange?: undefined;
|
|
5512
|
+
side?: undefined;
|
|
5171
5513
|
ui?: undefined;
|
|
5172
5514
|
summary?: undefined;
|
|
5173
5515
|
} | {
|
|
@@ -5180,6 +5522,9 @@ declare class PreviewAddLiquidityTool extends BaseTool {
|
|
|
5180
5522
|
rawTickUpper?: undefined;
|
|
5181
5523
|
tickLower?: undefined;
|
|
5182
5524
|
tickUpper?: undefined;
|
|
5525
|
+
currentPrice?: undefined;
|
|
5526
|
+
requestedRange?: undefined;
|
|
5527
|
+
side?: undefined;
|
|
5183
5528
|
balanceWei?: undefined;
|
|
5184
5529
|
requiredWei?: undefined;
|
|
5185
5530
|
gasReserveWei?: undefined;
|
|
@@ -5251,6 +5596,7 @@ declare class EstimatePoolYieldTool extends BaseTool {
|
|
|
5251
5596
|
tvlUsd: number | undefined;
|
|
5252
5597
|
volume24hUsd: number | undefined;
|
|
5253
5598
|
fees24hUsd: number | undefined;
|
|
5599
|
+
volumeToTvlRatio: number | undefined;
|
|
5254
5600
|
aprPercent: number | undefined;
|
|
5255
5601
|
chain: string;
|
|
5256
5602
|
token0: {
|
|
@@ -5279,6 +5625,7 @@ declare class EstimatePoolYieldTool extends BaseTool {
|
|
|
5279
5625
|
tvlUsd: number | undefined;
|
|
5280
5626
|
volume24hUsd: number | undefined;
|
|
5281
5627
|
fees24hUsd: number | undefined;
|
|
5628
|
+
volumeToTvlRatio: number | undefined;
|
|
5282
5629
|
aprPercent: number | undefined;
|
|
5283
5630
|
chain: string;
|
|
5284
5631
|
token0: {
|
|
@@ -5306,33 +5653,80 @@ declare class EstimatePoolYieldTool extends BaseTool {
|
|
|
5306
5653
|
private describeQuery;
|
|
5307
5654
|
}
|
|
5308
5655
|
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5656
|
+
type PoolPriceRangesToolConfig = CoinPoolServiceConfig;
|
|
5657
|
+
/**
|
|
5658
|
+
* Tool: get-pool-price-ranges
|
|
5659
|
+
*
|
|
5660
|
+
* Returns concentrated-liquidity price-range candidates from the CoinPool
|
|
5661
|
+
* platform for a token pair on a chain. Each entry is a SPECIFIC price range
|
|
5662
|
+
* with its own APR (NOT the overall pool APR). Used by the Uniswap-backed
|
|
5663
|
+
* `pool-agent` to suggest which range to provide liquidity in.
|
|
5664
|
+
*
|
|
5665
|
+
* Backed by the CoinPool `/pair/v2` API — independent of The Graph subgraph and
|
|
5666
|
+
* of the Uniswap interface gateway. Returns an empty list when the chain is not
|
|
5667
|
+
* served by CoinPool.
|
|
5668
|
+
*/
|
|
5669
|
+
declare class PoolPriceRangesTool extends BaseTool {
|
|
5670
|
+
name: string;
|
|
5671
|
+
description: string;
|
|
5672
|
+
category: string;
|
|
5673
|
+
noSuggestions: boolean;
|
|
5674
|
+
parameters: ToolParameter[];
|
|
5675
|
+
private service;
|
|
5676
|
+
constructor(config?: PoolPriceRangesToolConfig);
|
|
5677
|
+
protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
|
|
5678
|
+
error: string;
|
|
5679
|
+
_instructions?: undefined;
|
|
5680
|
+
unsupportedChains?: undefined;
|
|
5681
|
+
supportedChains?: undefined;
|
|
5682
|
+
tokens?: undefined;
|
|
5683
|
+
chain?: undefined;
|
|
5684
|
+
count?: undefined;
|
|
5685
|
+
pairs?: undefined;
|
|
5686
|
+
} | {
|
|
5687
|
+
_instructions: string;
|
|
5688
|
+
unsupportedChains: string[];
|
|
5689
|
+
supportedChains: string[];
|
|
5690
|
+
error?: undefined;
|
|
5691
|
+
tokens?: undefined;
|
|
5692
|
+
chain?: undefined;
|
|
5693
|
+
count?: undefined;
|
|
5694
|
+
pairs?: undefined;
|
|
5695
|
+
} | {
|
|
5696
|
+
_instructions: string;
|
|
5697
|
+
tokens: string[];
|
|
5698
|
+
chain: string;
|
|
5699
|
+
count: number;
|
|
5700
|
+
pairs: CoinPoolPairSummary[];
|
|
5701
|
+
error?: undefined;
|
|
5702
|
+
unsupportedChains?: undefined;
|
|
5703
|
+
supportedChains?: undefined;
|
|
5704
|
+
}>;
|
|
5318
5705
|
}
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5706
|
+
|
|
5707
|
+
/**
|
|
5708
|
+
* Tool: manage-liquidity-redirect
|
|
5709
|
+
*
|
|
5710
|
+
* The agent can OPEN an add-liquidity flow in-app, but managing an EXISTING
|
|
5711
|
+
* position — collecting earned fees or closing/removing the pair — is not
|
|
5712
|
+
* supported in-app yet. For those actions we point the user to the CoinPool
|
|
5713
|
+
* web app (https://coinpool.app/my-liquidity), which lists their positions and
|
|
5714
|
+
* exposes the collect / close controls.
|
|
5715
|
+
*
|
|
5716
|
+
* Returns a static instruction only — no API calls, no chain reads.
|
|
5717
|
+
*/
|
|
5718
|
+
declare class ManageLiquidityRedirectTool extends BaseTool {
|
|
5719
|
+
name: string;
|
|
5720
|
+
description: string;
|
|
5721
|
+
category: string;
|
|
5722
|
+
noSuggestions: boolean;
|
|
5723
|
+
parameters: ToolParameter[];
|
|
5724
|
+
protected run(args: Record<string, unknown>): Promise<{
|
|
5725
|
+
_instructions: string;
|
|
5726
|
+
url: string;
|
|
5727
|
+
action: string | undefined;
|
|
5728
|
+
}>;
|
|
5334
5729
|
}
|
|
5335
|
-
type SubgraphSort = 'tvl' | 'volume' | 'apr' | 'fee' | 'liquidity';
|
|
5336
5730
|
|
|
5337
5731
|
type SubgraphPoolSearchToolConfig = SubgraphServiceConfig;
|
|
5338
5732
|
/**
|
|
@@ -5399,7 +5793,7 @@ declare class SubgraphPoolSearchTool extends BaseTool {
|
|
|
5399
5793
|
};
|
|
5400
5794
|
uniswapUrl: string;
|
|
5401
5795
|
}[];
|
|
5402
|
-
coinPoolPairs: (CoinPoolPairSummary & {
|
|
5796
|
+
coinPoolPairs: (CoinPoolPairSummary$1 & {
|
|
5403
5797
|
chain: string;
|
|
5404
5798
|
})[];
|
|
5405
5799
|
supportedChains?: undefined;
|
|
@@ -5499,7 +5893,7 @@ declare class SubgraphPoolByAddressTool extends BaseTool {
|
|
|
5499
5893
|
} | {
|
|
5500
5894
|
_instructions: string;
|
|
5501
5895
|
chain: string;
|
|
5502
|
-
coinPoolPairs: never[] | CoinPoolPairSummary[];
|
|
5896
|
+
coinPoolPairs: never[] | CoinPoolPairSummary$1[];
|
|
5503
5897
|
pool: {
|
|
5504
5898
|
pair: string;
|
|
5505
5899
|
poolAddress: string;
|
|
@@ -5752,7 +6146,7 @@ declare class SubgraphCoinPoolPairsTool extends BaseTool {
|
|
|
5752
6146
|
tokens: string[];
|
|
5753
6147
|
chain: string;
|
|
5754
6148
|
count: number;
|
|
5755
|
-
pairs: CoinPoolPairSummary[];
|
|
6149
|
+
pairs: CoinPoolPairSummary$1[];
|
|
5756
6150
|
error?: undefined;
|
|
5757
6151
|
unsupportedChains?: undefined;
|
|
5758
6152
|
supportedChains?: undefined;
|
|
@@ -5822,7 +6216,7 @@ declare class SubgraphAddPoolTool extends BaseTool {
|
|
|
5822
6216
|
};
|
|
5823
6217
|
uniswapUrl: string;
|
|
5824
6218
|
}[];
|
|
5825
|
-
coinPoolPairs: CoinPoolPairSummary[];
|
|
6219
|
+
coinPoolPairs: CoinPoolPairSummary$1[];
|
|
5826
6220
|
} | {
|
|
5827
6221
|
_instructions: string;
|
|
5828
6222
|
howTo: boolean;
|
|
@@ -6878,6 +7272,77 @@ declare class SendNftTool extends BaseWalletActionTool {
|
|
|
6878
7272
|
private paramsFromNft;
|
|
6879
7273
|
}
|
|
6880
7274
|
|
|
7275
|
+
/**
|
|
7276
|
+
* Config for the redirect-only wallet-action tools used by the
|
|
7277
|
+
* `wallet-action-app` subagent.
|
|
7278
|
+
*/
|
|
7279
|
+
interface WalletActionAppToolConfig {
|
|
7280
|
+
/**
|
|
7281
|
+
* Optional link to the app where the user performs the action. When set, the
|
|
7282
|
+
* tool surfaces it as plain text so the user can open the app directly. When
|
|
7283
|
+
* omitted, the tool just tells the user the action is done in the app.
|
|
7284
|
+
*/
|
|
7285
|
+
appLink?: string;
|
|
7286
|
+
/**
|
|
7287
|
+
* Optional NFT website link, used ONLY by the send-NFT tool. Mirrors the
|
|
7288
|
+
* `wallet-action` SendNftTool: when set, the notice carries a clickable
|
|
7289
|
+
* Markdown link to this URL; when omitted, the website phrase stays plain
|
|
7290
|
+
* text. Separate from `appLink` because sending an NFT is done on the NFT
|
|
7291
|
+
* website, not the wallet-action app.
|
|
7292
|
+
*/
|
|
7293
|
+
nftLink?: string;
|
|
7294
|
+
}
|
|
7295
|
+
interface ActionSpec {
|
|
7296
|
+
/** Tool name — mirrors the matching `wallet-action` form tool it replaces. */
|
|
7297
|
+
name: string;
|
|
7298
|
+
/** Routing description so the agent picks this tool for the matching intent. */
|
|
7299
|
+
description: string;
|
|
7300
|
+
/** Human phrase used in the redirect message, e.g. "send a token". */
|
|
7301
|
+
what: string;
|
|
7302
|
+
/**
|
|
7303
|
+
* Which link the redirect points to. `'app'` (default) → the wallet-action
|
|
7304
|
+
* app (`appLink`); `'nft'` → the NFT website (`nftLink`), matching how the
|
|
7305
|
+
* `wallet-action` SendNftTool points NFT sends to the NFT site.
|
|
7306
|
+
*/
|
|
7307
|
+
linkKind?: 'app' | 'nft';
|
|
7308
|
+
}
|
|
7309
|
+
/**
|
|
7310
|
+
* Redirect-only wallet-action tool.
|
|
7311
|
+
*
|
|
7312
|
+
* The `wallet-action-app` subagent is a variant of `wallet-action` for
|
|
7313
|
+
* deployments where the action is NOT performed in chat. Instead of emitting a
|
|
7314
|
+
* pre-filled form, every tool returns a static instruction telling the user
|
|
7315
|
+
* they can perform the action directly in the app. No API calls, no chain
|
|
7316
|
+
* reads, no parameters.
|
|
7317
|
+
*/
|
|
7318
|
+
declare class WalletActionAppTool extends BaseTool {
|
|
7319
|
+
name: string;
|
|
7320
|
+
description: string;
|
|
7321
|
+
category: string;
|
|
7322
|
+
noSuggestions: boolean;
|
|
7323
|
+
parameters: ToolParameter[];
|
|
7324
|
+
private readonly what;
|
|
7325
|
+
private readonly linkKind;
|
|
7326
|
+
private readonly appLink?;
|
|
7327
|
+
private readonly nftLink?;
|
|
7328
|
+
constructor(spec: ActionSpec, config?: WalletActionAppToolConfig);
|
|
7329
|
+
protected run(): Promise<{
|
|
7330
|
+
message: string;
|
|
7331
|
+
_instructions: string;
|
|
7332
|
+
} | {
|
|
7333
|
+
url?: string | undefined;
|
|
7334
|
+
_instructions: string;
|
|
7335
|
+
}>;
|
|
7336
|
+
/**
|
|
7337
|
+
* Fixed "go to the NFT website" notice — byte-for-byte the same pattern as
|
|
7338
|
+
* the `wallet-action` SendNftTool: the website phrase becomes a clickable
|
|
7339
|
+
* Markdown link when `nftLink` is configured, plain text otherwise.
|
|
7340
|
+
*/
|
|
7341
|
+
private nftWebsiteNotice;
|
|
7342
|
+
}
|
|
7343
|
+
/** Create the full set of redirect-only wallet-action tools. */
|
|
7344
|
+
declare function createWalletActionAppTools(config?: WalletActionAppToolConfig): WalletActionAppTool[];
|
|
7345
|
+
|
|
6881
7346
|
/**
|
|
6882
7347
|
* Shared JSON-RPC client + default public RPC endpoints.
|
|
6883
7348
|
*
|
|
@@ -7286,4 +7751,23 @@ declare class Summarizer {
|
|
|
7286
7751
|
summarize(messages: ChatMessage[]): Promise<string>;
|
|
7287
7752
|
}
|
|
7288
7753
|
|
|
7289
|
-
|
|
7754
|
+
/**
|
|
7755
|
+
* Cancellation helpers shared by AgentCore and the LLM provider.
|
|
7756
|
+
*
|
|
7757
|
+
* A turn is cancelled by aborting an `AbortSignal`. We surface every cancellation
|
|
7758
|
+
* as an {@link AbortError} (`name === 'AbortError'`) so consumers can branch on it
|
|
7759
|
+
* uniformly, regardless of whether the abort originated from our own check or from
|
|
7760
|
+
* the underlying HTTP client (axios throws a `CanceledError` with `code` of
|
|
7761
|
+
* `'ERR_CANCELED'`).
|
|
7762
|
+
*/
|
|
7763
|
+
/** Error thrown when a chat turn is cancelled via its AbortSignal. */
|
|
7764
|
+
declare class AbortError extends Error {
|
|
7765
|
+
constructor(message?: string);
|
|
7766
|
+
}
|
|
7767
|
+
/**
|
|
7768
|
+
* True when `err` represents a cancellation — either our own {@link AbortError},
|
|
7769
|
+
* a DOMException AbortError, or axios's `CanceledError` (`code: 'ERR_CANCELED'`).
|
|
7770
|
+
*/
|
|
7771
|
+
declare function isAbortError(err: unknown): boolean;
|
|
7772
|
+
|
|
7773
|
+
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 IngestKnowledgeBaseInput, type IngestKnowledgeBaseResult, type InputTokenInfo, type KBSearchResult, KnowledgeBase, type KnowledgeBaseEntry, type KnowledgeBaseProvider, type LLMProvider, type LLMProviderConfig, type LLMResponse, type LLMToolCall, ManageLiquidityRedirectTool, type MoralisApiResponse, MoralisService, type MoralisServiceConfig, NFTContractInfoTool, type NFTContractMetadata, type NFTItem, type NFTLastSale, type NFTMetadata, NFTMetadataTool, NFT_AGENT_TOOL_NAMES, type NativeTokenInfo, 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, ZERO_ADDRESS, buildRangePresets, buildUniswapPoolUrl, clampTick, configureSupportedChains, createAiAgent, createDefaultSubagents, createNftAgent, createPoolAgent, createTokenAgent, createWalletActionAgent, createWalletActionAppTools, createWalletAgent, ethCallAt, ethCallByChain, getAffiliateFee, getChainMeta, getDefaultRpcUrl, getGatewayAddress, getNativeTokenInfo, getPositionManagerAddress, getProviderByChain, ingestKnowledgeBase, isAbortError, normalizePriceRangeToPool, priceToTick, resolveRpcUrl, roundTickToSpacing, rpcCall, setRpcOverrides, swapServiceFactory, tickToPrice, toPantographChain };
|