keyring-agent-core 0.2.24 → 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 +769 -140
- package/dist/index.js +168 -110
- package/dist/index.native.js +316 -258
- 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
|
/**
|
|
@@ -1437,11 +1490,18 @@ interface RewriteResult {
|
|
|
1437
1490
|
*/
|
|
1438
1491
|
language: string;
|
|
1439
1492
|
/**
|
|
1440
|
-
* The blockchain network
|
|
1441
|
-
*
|
|
1442
|
-
*
|
|
1443
|
-
*
|
|
1444
|
-
*
|
|
1493
|
+
* The blockchain network THIS turn refers to, NORMALIZED by the rewriter to a
|
|
1494
|
+
* CANONICAL name (see prompt RULE 6). The LLM resolves messy signals — explorer
|
|
1495
|
+
* URLs/domains ("optimistic.etherscan.io"), aliases, native coins, any language
|
|
1496
|
+
* — down to one of the supported canonical names (ethereum, optimism, bsc,
|
|
1497
|
+
* polygon, base, arbitrum, avalanche, linea), or the plain common name for an
|
|
1498
|
+
* unsupported EVM chain (e.g. "unichain"). Empty when the turn names no chain.
|
|
1499
|
+
*
|
|
1500
|
+
* Pushing chain resolution into the LLM keeps the deterministic alias table
|
|
1501
|
+
* lean (it only needs canonical names + a few common aliases as a safety net)
|
|
1502
|
+
* instead of enumerating every explorer/alias variant per chain. Lets the
|
|
1503
|
+
* orchestrator detect a request targeting an UNsupported chain even while the
|
|
1504
|
+
* wallet is connected to a supported one ("show my balance on Unichain").
|
|
1445
1505
|
*/
|
|
1446
1506
|
mentionedChain: string;
|
|
1447
1507
|
/**
|
|
@@ -1551,6 +1611,12 @@ declare class AgentCore {
|
|
|
1551
1611
|
* the clear. Null when no turn is in flight.
|
|
1552
1612
|
*/
|
|
1553
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;
|
|
1554
1620
|
/**
|
|
1555
1621
|
* Resolves once the initial persisted-history load attempt has finished
|
|
1556
1622
|
* (success or failure). Only meaningful when `persistHistory: true` and a
|
|
@@ -1632,7 +1698,19 @@ declare class AgentCore {
|
|
|
1632
1698
|
chat(userMessage: string, options?: {
|
|
1633
1699
|
generateSuggestions?: boolean;
|
|
1634
1700
|
language?: string;
|
|
1701
|
+
signal?: AbortSignal;
|
|
1635
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;
|
|
1636
1714
|
/**
|
|
1637
1715
|
* Build the host object the chat graph's nodes call into. Each method is a
|
|
1638
1716
|
* thin closure over an existing (private) helper, so the graph stays pure
|
|
@@ -1811,26 +1889,26 @@ declare class Synthesizer {
|
|
|
1811
1889
|
synthesise(userQuery: string, trace: ReActTrace, conversationHistory: ChatMessage[], language?: string): Promise<string>;
|
|
1812
1890
|
}
|
|
1813
1891
|
|
|
1814
|
-
declare const WALLET_AGENT_TOOL_NAMES: readonly ["get-wallet-token-balances", "get-wallet-history", "get-wallet-token-transfers", "get-wallet-nft-transfers", "get-wallet-
|
|
1892
|
+
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"];
|
|
1815
1893
|
declare function createWalletAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
|
|
1816
1894
|
|
|
1817
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"];
|
|
1818
1896
|
declare function createTokenAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
|
|
1819
1897
|
|
|
1820
|
-
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"];
|
|
1821
1899
|
declare function createNftAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
|
|
1822
1900
|
|
|
1823
1901
|
declare const AI_AGENT_TOOL_NAMES: readonly ["gemini-search-ai"];
|
|
1824
1902
|
declare function createAiAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
|
|
1825
1903
|
|
|
1826
|
-
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"];
|
|
1827
1905
|
declare function createPoolAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
|
|
1828
1906
|
|
|
1829
|
-
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"];
|
|
1830
1908
|
declare function createWalletActionAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
|
|
1831
1909
|
|
|
1832
1910
|
/** Built-in subagent ids. */
|
|
1833
|
-
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';
|
|
1834
1912
|
/**
|
|
1835
1913
|
* Per-subagent enable flags. Default for every key is `true` EXCEPT
|
|
1836
1914
|
* `pool-subgraph`, which defaults to `false` because it is mutually exclusive
|
|
@@ -1842,6 +1920,10 @@ type DefaultSubagentName = 'wallet' | 'wallet-action' | 'token' | 'nft' | 'pool'
|
|
|
1842
1920
|
* Turning `pool-subgraph` on automatically turns `pool` off unless the caller
|
|
1843
1921
|
* has explicitly enabled `pool: true`. This prevents two pool agents from
|
|
1844
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.
|
|
1845
1927
|
*/
|
|
1846
1928
|
type SubagentToggles = Partial<Record<DefaultSubagentName, boolean>>;
|
|
1847
1929
|
/**
|
|
@@ -1862,7 +1944,11 @@ declare class GeminiProvider implements LLMProvider {
|
|
|
1862
1944
|
private maxTokens;
|
|
1863
1945
|
private temperature;
|
|
1864
1946
|
private baseUrl;
|
|
1947
|
+
/** Per-turn signal applied to every request until cleared. See setRequestSignal. */
|
|
1948
|
+
private requestSignal?;
|
|
1865
1949
|
constructor(config: LLMProviderConfig);
|
|
1950
|
+
/** @see LLMProvider.setRequestSignal */
|
|
1951
|
+
setRequestSignal(signal?: AbortSignal): void;
|
|
1866
1952
|
chat(messages: ChatMessage[], tools?: ToolDefinition[], options?: ChatOptions): Promise<LLMResponse>;
|
|
1867
1953
|
private toContents;
|
|
1868
1954
|
private toFunctionDeclarations;
|
|
@@ -2209,23 +2295,6 @@ interface WalletHistoryResponse {
|
|
|
2209
2295
|
interface CortexResponse {
|
|
2210
2296
|
text: string;
|
|
2211
2297
|
}
|
|
2212
|
-
interface WalletNetWorthChainBreakdown {
|
|
2213
|
-
chain: string;
|
|
2214
|
-
native_balance: string;
|
|
2215
|
-
native_balance_formatted: string;
|
|
2216
|
-
native_balance_usd: string;
|
|
2217
|
-
token_balance_usd: string;
|
|
2218
|
-
networth_usd: string;
|
|
2219
|
-
}
|
|
2220
|
-
interface WalletNetWorthUnavailableChain {
|
|
2221
|
-
chain_id: string;
|
|
2222
|
-
}
|
|
2223
|
-
interface WalletNetWorthResponse {
|
|
2224
|
-
total_networth_usd: string;
|
|
2225
|
-
chains: WalletNetWorthChainBreakdown[];
|
|
2226
|
-
unsupported_chain_ids?: string[];
|
|
2227
|
-
unavailable_chains?: WalletNetWorthUnavailableChain[];
|
|
2228
|
-
}
|
|
2229
2298
|
type WalletPnlDaysWindow = 'all' | '7' | '30' | '60' | '90';
|
|
2230
2299
|
interface WalletPnlSummaryResponse {
|
|
2231
2300
|
total_count_of_trades: number;
|
|
@@ -2997,23 +3066,6 @@ declare class MoralisService {
|
|
|
2997
3066
|
address: string;
|
|
2998
3067
|
chain?: string;
|
|
2999
3068
|
}): Promise<MoralisApiResponse<TokenHoldersResponse>>;
|
|
3000
|
-
/**
|
|
3001
|
-
* Get a wallet's total net worth in USD, broken down per chain.
|
|
3002
|
-
*
|
|
3003
|
-
* URL: GET /api/moralis/proxy/wallets/{address}/net-worth
|
|
3004
|
-
*
|
|
3005
|
-
* Use to answer questions like:
|
|
3006
|
-
* - "What's my total wallet value?"
|
|
3007
|
-
* - "How much is my portfolio worth on each chain?"
|
|
3008
|
-
*/
|
|
3009
|
-
getWalletNetWorth(params: {
|
|
3010
|
-
address: string;
|
|
3011
|
-
chains?: string[];
|
|
3012
|
-
excludeSpam?: boolean;
|
|
3013
|
-
excludeUnverifiedContracts?: boolean;
|
|
3014
|
-
maxTokenInactivity?: number;
|
|
3015
|
-
minPairSideLiquidityUsd?: number;
|
|
3016
|
-
}): Promise<MoralisApiResponse<WalletNetWorthResponse>>;
|
|
3017
3069
|
/**
|
|
3018
3070
|
* Get aggregate profit-and-loss summary for a wallet.
|
|
3019
3071
|
*
|
|
@@ -3592,12 +3644,14 @@ declare class WalletHistoryTool extends BaseTool {
|
|
|
3592
3644
|
constructor(config?: WalletHistoryToolConfig);
|
|
3593
3645
|
protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
|
|
3594
3646
|
error: string;
|
|
3647
|
+
_instructions?: undefined;
|
|
3595
3648
|
walletAddress?: undefined;
|
|
3596
3649
|
chain?: undefined;
|
|
3597
3650
|
pagination?: undefined;
|
|
3598
3651
|
transactionCount?: undefined;
|
|
3599
3652
|
transactions?: undefined;
|
|
3600
3653
|
} | {
|
|
3654
|
+
_instructions: string;
|
|
3601
3655
|
walletAddress: string;
|
|
3602
3656
|
chain: string;
|
|
3603
3657
|
pagination: {
|
|
@@ -3605,7 +3659,44 @@ declare class WalletHistoryTool extends BaseTool {
|
|
|
3605
3659
|
hasMore: boolean;
|
|
3606
3660
|
};
|
|
3607
3661
|
transactionCount: number;
|
|
3608
|
-
transactions: WalletHistoryItem
|
|
3662
|
+
transactions: (WalletHistoryItem | {
|
|
3663
|
+
explorerUrl: string;
|
|
3664
|
+
hash: string;
|
|
3665
|
+
nonce?: string;
|
|
3666
|
+
transaction_index?: string;
|
|
3667
|
+
from_address: string;
|
|
3668
|
+
from_address_label?: string;
|
|
3669
|
+
to_address?: string;
|
|
3670
|
+
to_address_label?: string;
|
|
3671
|
+
value: string;
|
|
3672
|
+
gas?: string;
|
|
3673
|
+
gas_price?: string;
|
|
3674
|
+
receipt_cumulative_gas_used?: string;
|
|
3675
|
+
receipt_gas_used?: string;
|
|
3676
|
+
receipt_status?: string;
|
|
3677
|
+
receipt_contract_address?: string | null;
|
|
3678
|
+
block_timestamp: string;
|
|
3679
|
+
block_number: string;
|
|
3680
|
+
block_hash?: string;
|
|
3681
|
+
transaction_fee?: string;
|
|
3682
|
+
method_label?: string;
|
|
3683
|
+
category: WalletHistoryCategory | string;
|
|
3684
|
+
summary?: string;
|
|
3685
|
+
possible_spam?: boolean;
|
|
3686
|
+
native_transfers?: WalletHistoryNativeTransfer[];
|
|
3687
|
+
erc20_transfers?: WalletHistoryErc20Transfer[];
|
|
3688
|
+
nft_transfers?: WalletHistoryNftTransfer[];
|
|
3689
|
+
contract_interactions?: WalletHistoryContractInteraction;
|
|
3690
|
+
internal_transactions?: Array<{
|
|
3691
|
+
from: string;
|
|
3692
|
+
to: string;
|
|
3693
|
+
value: string;
|
|
3694
|
+
gas?: string;
|
|
3695
|
+
type?: string;
|
|
3696
|
+
input?: string;
|
|
3697
|
+
output?: string;
|
|
3698
|
+
}>;
|
|
3699
|
+
})[];
|
|
3609
3700
|
error?: undefined;
|
|
3610
3701
|
}>;
|
|
3611
3702
|
}
|
|
@@ -3797,47 +3888,6 @@ declare class WalletNftTransfersTool extends BaseTool {
|
|
|
3797
3888
|
private parseBlock;
|
|
3798
3889
|
}
|
|
3799
3890
|
|
|
3800
|
-
type WalletNetWorthToolConfig = MoralisServiceConfig;
|
|
3801
|
-
/**
|
|
3802
|
-
* Tool: get-wallet-net-worth
|
|
3803
|
-
*
|
|
3804
|
-
* Queries `GET /wallets/{address}/net-worth` to return a wallet's total USD
|
|
3805
|
-
* value across one or more chains. Response includes per-chain breakdown
|
|
3806
|
-
* (native + token USD value) plus a grand total.
|
|
3807
|
-
*/
|
|
3808
|
-
declare class WalletNetWorthTool extends BaseTool {
|
|
3809
|
-
name: string;
|
|
3810
|
-
description: string;
|
|
3811
|
-
category: string;
|
|
3812
|
-
parameters: ToolParameter[];
|
|
3813
|
-
private service;
|
|
3814
|
-
constructor(config?: WalletNetWorthToolConfig);
|
|
3815
|
-
protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
|
|
3816
|
-
error: string;
|
|
3817
|
-
walletAddress?: undefined;
|
|
3818
|
-
chainsQueried?: undefined;
|
|
3819
|
-
filters?: undefined;
|
|
3820
|
-
totalNetWorthUsd?: undefined;
|
|
3821
|
-
chains?: undefined;
|
|
3822
|
-
unsupportedChainIds?: undefined;
|
|
3823
|
-
unavailableChains?: undefined;
|
|
3824
|
-
} | {
|
|
3825
|
-
walletAddress: string;
|
|
3826
|
-
chainsQueried: string[];
|
|
3827
|
-
filters: {
|
|
3828
|
-
excludeSpam: boolean;
|
|
3829
|
-
excludeUnverifiedContracts: boolean | null;
|
|
3830
|
-
maxTokenInactivity: number | null;
|
|
3831
|
-
minPairSideLiquidityUsd: number | null;
|
|
3832
|
-
};
|
|
3833
|
-
totalNetWorthUsd: string;
|
|
3834
|
-
chains: WalletNetWorthChainBreakdown[];
|
|
3835
|
-
unsupportedChainIds: string[];
|
|
3836
|
-
unavailableChains: WalletNetWorthUnavailableChain[];
|
|
3837
|
-
error?: undefined;
|
|
3838
|
-
}>;
|
|
3839
|
-
}
|
|
3840
|
-
|
|
3841
3891
|
type WalletPnlSummaryToolConfig = MoralisServiceConfig;
|
|
3842
3892
|
/**
|
|
3843
3893
|
* Tool: get-wallet-pnl-summary
|
|
@@ -3860,6 +3910,8 @@ declare class WalletPnlSummaryTool extends BaseTool {
|
|
|
3860
3910
|
chain?: undefined;
|
|
3861
3911
|
days?: undefined;
|
|
3862
3912
|
summary?: undefined;
|
|
3913
|
+
_instructions?: undefined;
|
|
3914
|
+
chains?: undefined;
|
|
3863
3915
|
} | {
|
|
3864
3916
|
walletAddress: string;
|
|
3865
3917
|
chain: string;
|
|
@@ -3875,7 +3927,40 @@ declare class WalletPnlSummaryTool extends BaseTool {
|
|
|
3875
3927
|
totalSoldVolumeUsd: string;
|
|
3876
3928
|
};
|
|
3877
3929
|
error?: undefined;
|
|
3930
|
+
_instructions?: undefined;
|
|
3931
|
+
chains?: undefined;
|
|
3932
|
+
} | {
|
|
3933
|
+
_instructions: string;
|
|
3934
|
+
walletAddress: string;
|
|
3935
|
+
chain: string;
|
|
3936
|
+
days: WalletPnlDaysWindow;
|
|
3937
|
+
summary: {
|
|
3938
|
+
totalCountOfTrades: number;
|
|
3939
|
+
totalTradeVolume: number;
|
|
3940
|
+
totalRealizedProfitUsd: number;
|
|
3941
|
+
totalRealizedProfitPercentage: number;
|
|
3942
|
+
totalBuys: number;
|
|
3943
|
+
totalSells: number;
|
|
3944
|
+
totalBoughtVolumeUsd: number;
|
|
3945
|
+
totalSoldVolumeUsd: number;
|
|
3946
|
+
};
|
|
3947
|
+
chains: {
|
|
3948
|
+
chain: string;
|
|
3949
|
+
summary: {
|
|
3950
|
+
totalCountOfTrades: number;
|
|
3951
|
+
totalTradeVolume: string;
|
|
3952
|
+
totalRealizedProfitUsd: string;
|
|
3953
|
+
totalRealizedProfitPercentage: number;
|
|
3954
|
+
totalBuys: number;
|
|
3955
|
+
totalSells: number;
|
|
3956
|
+
totalBoughtVolumeUsd: string;
|
|
3957
|
+
totalSoldVolumeUsd: string;
|
|
3958
|
+
};
|
|
3959
|
+
}[];
|
|
3960
|
+
error?: undefined;
|
|
3878
3961
|
}>;
|
|
3962
|
+
/** Map a single chain's raw PnL summary into the tool's camelCase output. */
|
|
3963
|
+
private mapSummary;
|
|
3879
3964
|
}
|
|
3880
3965
|
|
|
3881
3966
|
type WalletPnlToolConfig = MoralisServiceConfig;
|
|
@@ -3894,6 +3979,8 @@ declare class WalletPnlTool extends BaseTool {
|
|
|
3894
3979
|
filters?: undefined;
|
|
3895
3980
|
tokenCount?: undefined;
|
|
3896
3981
|
tokens?: undefined;
|
|
3982
|
+
_instructions?: undefined;
|
|
3983
|
+
chains?: undefined;
|
|
3897
3984
|
} | {
|
|
3898
3985
|
walletAddress: string;
|
|
3899
3986
|
chain: string;
|
|
@@ -3905,11 +3992,41 @@ declare class WalletPnlTool extends BaseTool {
|
|
|
3905
3992
|
address: string;
|
|
3906
3993
|
}[] | null;
|
|
3907
3994
|
unresolvedSymbols: string[] | null;
|
|
3995
|
+
requestedSymbols?: undefined;
|
|
3996
|
+
requestedAddresses?: undefined;
|
|
3908
3997
|
};
|
|
3909
3998
|
tokenCount: number;
|
|
3910
3999
|
tokens: WalletPnlTokenItem[];
|
|
3911
4000
|
error?: undefined;
|
|
4001
|
+
_instructions?: undefined;
|
|
4002
|
+
chains?: undefined;
|
|
4003
|
+
} | {
|
|
4004
|
+
_instructions: string;
|
|
4005
|
+
walletAddress: string;
|
|
4006
|
+
chain: string;
|
|
4007
|
+
days: WalletPnlDaysWindow;
|
|
4008
|
+
filters: {
|
|
4009
|
+
requestedSymbols: string[] | null;
|
|
4010
|
+
requestedAddresses: string[] | null;
|
|
4011
|
+
tokenAddresses?: undefined;
|
|
4012
|
+
resolvedSymbols?: undefined;
|
|
4013
|
+
unresolvedSymbols?: undefined;
|
|
4014
|
+
};
|
|
4015
|
+
tokenCount: number;
|
|
4016
|
+
chains: {
|
|
4017
|
+
chain: string;
|
|
4018
|
+
tokenCount: number;
|
|
4019
|
+
tokens: WalletPnlTokenItem[];
|
|
4020
|
+
}[];
|
|
4021
|
+
error?: undefined;
|
|
4022
|
+
tokens?: undefined;
|
|
3912
4023
|
}>;
|
|
4024
|
+
/**
|
|
4025
|
+
* Fetch one chain's per-token PnL: resolve any token symbols to addresses ON
|
|
4026
|
+
* THAT chain, merge with raw addresses (capped), and call the API. Returns the
|
|
4027
|
+
* tokens plus the resolution detail (for the single-chain `filters` block).
|
|
4028
|
+
*/
|
|
4029
|
+
private fetchChainPnl;
|
|
3913
4030
|
/**
|
|
3914
4031
|
* Resolve a contract address from a token symbol.
|
|
3915
4032
|
* 1. Wallet balances (if wallet address available — most reliable)
|
|
@@ -4041,16 +4158,13 @@ declare class WalletDefiSummaryTool extends BaseTool {
|
|
|
4041
4158
|
constructor(config?: WalletDefiSummaryToolConfig);
|
|
4042
4159
|
protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
|
|
4043
4160
|
error: string;
|
|
4161
|
+
_instructions?: undefined;
|
|
4044
4162
|
walletAddress?: undefined;
|
|
4045
4163
|
chain?: undefined;
|
|
4046
|
-
activeProtocols?: undefined;
|
|
4047
|
-
totalPositions?: undefined;
|
|
4048
4164
|
totalUsdValue?: undefined;
|
|
4049
4165
|
totalUnclaimedUsdValue?: undefined;
|
|
4050
|
-
|
|
4166
|
+
chains?: undefined;
|
|
4051
4167
|
} | {
|
|
4052
|
-
walletAddress: string;
|
|
4053
|
-
chain: string;
|
|
4054
4168
|
activeProtocols: number;
|
|
4055
4169
|
totalPositions: number;
|
|
4056
4170
|
totalUsdValue: number;
|
|
@@ -4065,8 +4179,38 @@ declare class WalletDefiSummaryTool extends BaseTool {
|
|
|
4065
4179
|
totalUnclaimedUsdValue: number;
|
|
4066
4180
|
accountHealthFactor: number | null;
|
|
4067
4181
|
}[];
|
|
4182
|
+
walletAddress: string;
|
|
4183
|
+
chain: string;
|
|
4184
|
+
error?: undefined;
|
|
4185
|
+
_instructions?: undefined;
|
|
4186
|
+
chains?: undefined;
|
|
4187
|
+
} | {
|
|
4188
|
+
_instructions: string;
|
|
4189
|
+
walletAddress: string;
|
|
4190
|
+
chain: string;
|
|
4191
|
+
totalUsdValue: number;
|
|
4192
|
+
totalUnclaimedUsdValue: number;
|
|
4193
|
+
chains: {
|
|
4194
|
+
activeProtocols: number;
|
|
4195
|
+
totalPositions: number;
|
|
4196
|
+
totalUsdValue: number;
|
|
4197
|
+
totalUnclaimedUsdValue: number;
|
|
4198
|
+
protocols: {
|
|
4199
|
+
protocolName: string | undefined;
|
|
4200
|
+
protocolId: string | undefined;
|
|
4201
|
+
protocolUrl: string | undefined;
|
|
4202
|
+
protocolLogo: string | undefined;
|
|
4203
|
+
positions: number;
|
|
4204
|
+
totalUsdValue: number;
|
|
4205
|
+
totalUnclaimedUsdValue: number;
|
|
4206
|
+
accountHealthFactor: number | null;
|
|
4207
|
+
}[];
|
|
4208
|
+
chain: string;
|
|
4209
|
+
}[];
|
|
4068
4210
|
error?: undefined;
|
|
4069
4211
|
}>;
|
|
4212
|
+
/** Map a single chain's raw summary into the tool's camelCase output fields. */
|
|
4213
|
+
private summaryFields;
|
|
4070
4214
|
}
|
|
4071
4215
|
|
|
4072
4216
|
type WalletDefiPositionsToolConfig = MoralisServiceConfig;
|
|
@@ -4092,6 +4236,8 @@ declare class WalletDefiPositionsTool extends BaseTool {
|
|
|
4092
4236
|
chain?: undefined;
|
|
4093
4237
|
positionCount?: undefined;
|
|
4094
4238
|
positions?: undefined;
|
|
4239
|
+
_instructions?: undefined;
|
|
4240
|
+
chains?: undefined;
|
|
4095
4241
|
} | {
|
|
4096
4242
|
walletAddress: string;
|
|
4097
4243
|
chain: string;
|
|
@@ -4124,6 +4270,46 @@ declare class WalletDefiPositionsTool extends BaseTool {
|
|
|
4124
4270
|
};
|
|
4125
4271
|
}[];
|
|
4126
4272
|
error?: undefined;
|
|
4273
|
+
_instructions?: undefined;
|
|
4274
|
+
chains?: undefined;
|
|
4275
|
+
} | {
|
|
4276
|
+
_instructions: string;
|
|
4277
|
+
walletAddress: string;
|
|
4278
|
+
chain: string;
|
|
4279
|
+
positionCount: number;
|
|
4280
|
+
chains: {
|
|
4281
|
+
chain: string;
|
|
4282
|
+
positionCount: number;
|
|
4283
|
+
positions: {
|
|
4284
|
+
protocolName: string;
|
|
4285
|
+
protocolId: string;
|
|
4286
|
+
protocolUrl: string;
|
|
4287
|
+
protocolLogo: string;
|
|
4288
|
+
accountHealthFactor: number | null;
|
|
4289
|
+
position: {
|
|
4290
|
+
label: string;
|
|
4291
|
+
address: string | undefined;
|
|
4292
|
+
balanceUsd: number;
|
|
4293
|
+
totalUnclaimedUsdValue: number;
|
|
4294
|
+
tokens: {
|
|
4295
|
+
tokenType: string;
|
|
4296
|
+
name: string;
|
|
4297
|
+
symbol: string;
|
|
4298
|
+
contractAddress: string;
|
|
4299
|
+
decimals: number;
|
|
4300
|
+
logo: string | undefined;
|
|
4301
|
+
thumbnail: string | undefined;
|
|
4302
|
+
balance: string;
|
|
4303
|
+
balanceFormatted: string;
|
|
4304
|
+
usdPrice: number | undefined;
|
|
4305
|
+
usdValue: number | undefined;
|
|
4306
|
+
}[];
|
|
4307
|
+
details: DefiPositionDetails | null;
|
|
4308
|
+
};
|
|
4309
|
+
}[];
|
|
4310
|
+
}[];
|
|
4311
|
+
error?: undefined;
|
|
4312
|
+
positions?: undefined;
|
|
4127
4313
|
}>;
|
|
4128
4314
|
}
|
|
4129
4315
|
|
|
@@ -4146,20 +4332,13 @@ declare class WalletDefiProtocolPositionsTool extends BaseTool {
|
|
|
4146
4332
|
constructor(config?: WalletDefiProtocolPositionsToolConfig);
|
|
4147
4333
|
protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
|
|
4148
4334
|
error: string;
|
|
4335
|
+
_instructions?: undefined;
|
|
4149
4336
|
walletAddress?: undefined;
|
|
4150
4337
|
chain?: undefined;
|
|
4151
|
-
|
|
4152
|
-
protocolId?: undefined;
|
|
4153
|
-
protocolUrl?: undefined;
|
|
4154
|
-
protocolLogo?: undefined;
|
|
4338
|
+
protocol?: undefined;
|
|
4155
4339
|
totalUsdValue?: undefined;
|
|
4156
|
-
|
|
4157
|
-
accountHealthFactor?: undefined;
|
|
4158
|
-
positionCount?: undefined;
|
|
4159
|
-
positions?: undefined;
|
|
4340
|
+
chains?: undefined;
|
|
4160
4341
|
} | {
|
|
4161
|
-
walletAddress: string;
|
|
4162
|
-
chain: string;
|
|
4163
4342
|
protocolName: string;
|
|
4164
4343
|
protocolId: string;
|
|
4165
4344
|
protocolUrl: string;
|
|
@@ -4188,8 +4367,53 @@ declare class WalletDefiProtocolPositionsTool extends BaseTool {
|
|
|
4188
4367
|
}[];
|
|
4189
4368
|
details: DefiPositionDetails | null;
|
|
4190
4369
|
}[];
|
|
4370
|
+
walletAddress: string;
|
|
4371
|
+
chain: string;
|
|
4372
|
+
error?: undefined;
|
|
4373
|
+
_instructions?: undefined;
|
|
4374
|
+
protocol?: undefined;
|
|
4375
|
+
chains?: undefined;
|
|
4376
|
+
} | {
|
|
4377
|
+
_instructions: string;
|
|
4378
|
+
walletAddress: string;
|
|
4379
|
+
chain: string;
|
|
4380
|
+
protocol: string;
|
|
4381
|
+
totalUsdValue: number;
|
|
4382
|
+
chains: {
|
|
4383
|
+
protocolName: string;
|
|
4384
|
+
protocolId: string;
|
|
4385
|
+
protocolUrl: string;
|
|
4386
|
+
protocolLogo: string;
|
|
4387
|
+
totalUsdValue: number;
|
|
4388
|
+
totalUnclaimedUsdValue: number | null;
|
|
4389
|
+
accountHealthFactor: number | null;
|
|
4390
|
+
positionCount: number;
|
|
4391
|
+
positions: {
|
|
4392
|
+
label: string;
|
|
4393
|
+
address: string | undefined;
|
|
4394
|
+
balanceUsd: number;
|
|
4395
|
+
totalUnclaimedUsdValue: number;
|
|
4396
|
+
tokens: {
|
|
4397
|
+
tokenType: string;
|
|
4398
|
+
name: string;
|
|
4399
|
+
symbol: string;
|
|
4400
|
+
contractAddress: string;
|
|
4401
|
+
decimals: number;
|
|
4402
|
+
logo: string | undefined;
|
|
4403
|
+
thumbnail: string | undefined;
|
|
4404
|
+
balance: string;
|
|
4405
|
+
balanceFormatted: string;
|
|
4406
|
+
usdPrice: number | undefined;
|
|
4407
|
+
usdValue: number | undefined;
|
|
4408
|
+
}[];
|
|
4409
|
+
details: DefiPositionDetails | null;
|
|
4410
|
+
}[];
|
|
4411
|
+
chain: string;
|
|
4412
|
+
}[];
|
|
4191
4413
|
error?: undefined;
|
|
4192
4414
|
}>;
|
|
4415
|
+
/** Map a single chain's raw protocol-positions response into output fields. */
|
|
4416
|
+
private protocolFields;
|
|
4193
4417
|
}
|
|
4194
4418
|
|
|
4195
4419
|
type TransactionByHashToolConfig = MoralisServiceConfig;
|
|
@@ -4437,6 +4661,34 @@ interface UniswapServiceConfig {
|
|
|
4437
4661
|
}
|
|
4438
4662
|
type UniswapProtocolVersion = 'V2' | 'V3' | 'V4';
|
|
4439
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
|
+
|
|
4440
4692
|
type TopPoolsToolConfig = UniswapServiceConfig;
|
|
4441
4693
|
/**
|
|
4442
4694
|
* Tool: get-top-pools
|
|
@@ -4452,13 +4704,22 @@ declare class TopPoolsTool extends BaseTool {
|
|
|
4452
4704
|
category: string;
|
|
4453
4705
|
parameters: ToolParameter[];
|
|
4454
4706
|
private service;
|
|
4455
|
-
|
|
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);
|
|
4456
4716
|
protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
|
|
4457
4717
|
error: string;
|
|
4458
4718
|
_instructions?: undefined;
|
|
4459
4719
|
chain?: undefined;
|
|
4460
4720
|
protocolVersion?: undefined;
|
|
4461
4721
|
sortBy?: undefined;
|
|
4722
|
+
source?: undefined;
|
|
4462
4723
|
count?: undefined;
|
|
4463
4724
|
pools?: undefined;
|
|
4464
4725
|
} | {
|
|
@@ -4466,8 +4727,10 @@ declare class TopPoolsTool extends BaseTool {
|
|
|
4466
4727
|
chain: string;
|
|
4467
4728
|
protocolVersion: UniswapProtocolVersion;
|
|
4468
4729
|
sortBy: "tvl" | "volume1Day" | "volume1Week" | "volume30Day" | "txCount" | "apr";
|
|
4730
|
+
source: "uniswap" | "subgraph";
|
|
4469
4731
|
count: number;
|
|
4470
4732
|
pools: {
|
|
4733
|
+
uniswapUrl?: string;
|
|
4471
4734
|
apr: number | undefined;
|
|
4472
4735
|
address: string;
|
|
4473
4736
|
chain: string | undefined;
|
|
@@ -4475,6 +4738,7 @@ declare class TopPoolsTool extends BaseTool {
|
|
|
4475
4738
|
feeTierBps: number | undefined;
|
|
4476
4739
|
feeTierPercent: number | undefined;
|
|
4477
4740
|
tvlUsd: number | undefined;
|
|
4741
|
+
fee24hUsd: number | undefined;
|
|
4478
4742
|
volume1DayUsd: number | undefined;
|
|
4479
4743
|
volume1WeekUsd: number | undefined;
|
|
4480
4744
|
volume30DayUsd: number | undefined;
|
|
@@ -4485,6 +4749,8 @@ declare class TopPoolsTool extends BaseTool {
|
|
|
4485
4749
|
name: string | undefined;
|
|
4486
4750
|
decimals: number | undefined;
|
|
4487
4751
|
priceUsd: number | undefined;
|
|
4752
|
+
isSpam: boolean | undefined;
|
|
4753
|
+
safetyLevel: string | undefined;
|
|
4488
4754
|
} | undefined;
|
|
4489
4755
|
token1: {
|
|
4490
4756
|
address: string | undefined;
|
|
@@ -4492,16 +4758,68 @@ declare class TopPoolsTool extends BaseTool {
|
|
|
4492
4758
|
name: string | undefined;
|
|
4493
4759
|
decimals: number | undefined;
|
|
4494
4760
|
priceUsd: number | undefined;
|
|
4761
|
+
isSpam: boolean | undefined;
|
|
4762
|
+
safetyLevel: string | undefined;
|
|
4495
4763
|
} | undefined;
|
|
4764
|
+
volumeToTvlRatio?: number;
|
|
4496
4765
|
}[];
|
|
4497
4766
|
error?: undefined;
|
|
4498
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;
|
|
4499
4786
|
private parseProtocolVersion;
|
|
4500
4787
|
private parseSortKey;
|
|
4501
4788
|
/** Trim the upstream payload to the fields a downstream LLM actually needs. */
|
|
4502
4789
|
private formatPool;
|
|
4503
4790
|
}
|
|
4504
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
|
+
|
|
4505
4823
|
type PoolDetailToolConfig = UniswapServiceConfig;
|
|
4506
4824
|
/**
|
|
4507
4825
|
* Tool: get-pool-detail
|
|
@@ -4523,20 +4841,33 @@ declare class PoolDetailTool extends BaseTool {
|
|
|
4523
4841
|
category: string;
|
|
4524
4842
|
parameters: ToolParameter[];
|
|
4525
4843
|
private service;
|
|
4526
|
-
|
|
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);
|
|
4527
4852
|
protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
|
|
4528
4853
|
error: string;
|
|
4854
|
+
priceRanges?: undefined;
|
|
4529
4855
|
_instructions?: undefined;
|
|
4530
4856
|
pairOrderMatched?: undefined;
|
|
4531
4857
|
pool?: undefined;
|
|
4532
4858
|
chain?: undefined;
|
|
4859
|
+
multiFeeTier?: undefined;
|
|
4860
|
+
count?: undefined;
|
|
4861
|
+
pools?: undefined;
|
|
4533
4862
|
reason?: undefined;
|
|
4534
4863
|
missing?: undefined;
|
|
4535
4864
|
candidates?: undefined;
|
|
4536
4865
|
} | {
|
|
4866
|
+
priceRanges: CoinPoolPairSummary[];
|
|
4537
4867
|
_instructions: string;
|
|
4538
4868
|
pairOrderMatched: string;
|
|
4539
4869
|
pool: {
|
|
4870
|
+
uniswapUrl?: string;
|
|
4540
4871
|
address: string | undefined;
|
|
4541
4872
|
protocolVersion: UniswapProtocolVersion | undefined;
|
|
4542
4873
|
feeTierBps: number | undefined;
|
|
@@ -4546,6 +4877,7 @@ declare class PoolDetailTool extends BaseTool {
|
|
|
4546
4877
|
volume24hUsd: number | undefined;
|
|
4547
4878
|
fees24hUsd: number | undefined;
|
|
4548
4879
|
aprPercent: number | undefined;
|
|
4880
|
+
volumeToTvlRatio: number | undefined;
|
|
4549
4881
|
txCount: number | undefined;
|
|
4550
4882
|
historicalVolumeWeek: {
|
|
4551
4883
|
timestamp: number | undefined;
|
|
@@ -4574,6 +4906,59 @@ declare class PoolDetailTool extends BaseTool {
|
|
|
4574
4906
|
};
|
|
4575
4907
|
error?: undefined;
|
|
4576
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;
|
|
4577
4962
|
reason?: undefined;
|
|
4578
4963
|
missing?: undefined;
|
|
4579
4964
|
candidates?: undefined;
|
|
@@ -4584,6 +4969,7 @@ declare class PoolDetailTool extends BaseTool {
|
|
|
4584
4969
|
reason: string;
|
|
4585
4970
|
missing: string[];
|
|
4586
4971
|
candidates: {
|
|
4972
|
+
uniswapUrl?: string;
|
|
4587
4973
|
address: string | undefined;
|
|
4588
4974
|
protocolVersion: UniswapProtocolVersion | undefined;
|
|
4589
4975
|
feeTierBps: number | undefined;
|
|
@@ -4602,7 +4988,11 @@ declare class PoolDetailTool extends BaseTool {
|
|
|
4602
4988
|
} | undefined;
|
|
4603
4989
|
}[];
|
|
4604
4990
|
error?: undefined;
|
|
4991
|
+
priceRanges?: undefined;
|
|
4605
4992
|
pool?: undefined;
|
|
4993
|
+
multiFeeTier?: undefined;
|
|
4994
|
+
count?: undefined;
|
|
4995
|
+
pools?: undefined;
|
|
4606
4996
|
}>;
|
|
4607
4997
|
/**
|
|
4608
4998
|
* Filter predicate. `mode` controls pair-order matching when both symbols
|
|
@@ -4621,6 +5011,13 @@ declare class PoolDetailTool extends BaseTool {
|
|
|
4621
5011
|
private rankCandidates;
|
|
4622
5012
|
/** Compact view of a search candidate for the LLM to render as a picker. */
|
|
4623
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;
|
|
4624
5021
|
/** Trim and enrich the GraphQL payload with derived metrics. */
|
|
4625
5022
|
private formatPool;
|
|
4626
5023
|
private formatHistorical;
|
|
@@ -4665,7 +5062,9 @@ declare class PoolSearchTool extends BaseTool {
|
|
|
4665
5062
|
page: number;
|
|
4666
5063
|
size: number;
|
|
4667
5064
|
count: number;
|
|
4668
|
-
pools:
|
|
5065
|
+
pools: {
|
|
5066
|
+
uniswapUrl?: string;
|
|
5067
|
+
}[];
|
|
4669
5068
|
error?: undefined;
|
|
4670
5069
|
}>;
|
|
4671
5070
|
private parseProtocolFilter;
|
|
@@ -4706,6 +5105,7 @@ declare class PoolByAddressTool extends BaseTool {
|
|
|
4706
5105
|
chain: string;
|
|
4707
5106
|
protocolVersion: UniswapProtocolVersion;
|
|
4708
5107
|
pool: {
|
|
5108
|
+
uniswapUrl?: string;
|
|
4709
5109
|
address: string | undefined;
|
|
4710
5110
|
protocolVersion: UniswapProtocolVersion | undefined;
|
|
4711
5111
|
poolId: string | undefined;
|
|
@@ -4719,6 +5119,7 @@ declare class PoolByAddressTool extends BaseTool {
|
|
|
4719
5119
|
volume24hUsd: number | undefined;
|
|
4720
5120
|
fees24hUsd: number | undefined;
|
|
4721
5121
|
aprPercent: number | undefined;
|
|
5122
|
+
volumeToTvlRatio: number | undefined;
|
|
4722
5123
|
txCount: number | undefined;
|
|
4723
5124
|
historicalVolumeWeek: {
|
|
4724
5125
|
timestamp: number | undefined;
|
|
@@ -4731,6 +5132,8 @@ declare class PoolByAddressTool extends BaseTool {
|
|
|
4731
5132
|
decimals: number | undefined;
|
|
4732
5133
|
priceUsd: number | undefined;
|
|
4733
5134
|
reserve: number | undefined;
|
|
5135
|
+
isSpam: boolean | undefined;
|
|
5136
|
+
safetyLevel: string | undefined;
|
|
4734
5137
|
} | undefined;
|
|
4735
5138
|
token1: {
|
|
4736
5139
|
address: string | undefined;
|
|
@@ -4739,6 +5142,8 @@ declare class PoolByAddressTool extends BaseTool {
|
|
|
4739
5142
|
decimals: number | undefined;
|
|
4740
5143
|
priceUsd: number | undefined;
|
|
4741
5144
|
reserve: number | undefined;
|
|
5145
|
+
isSpam: boolean | undefined;
|
|
5146
|
+
safetyLevel: string | undefined;
|
|
4742
5147
|
} | undefined;
|
|
4743
5148
|
};
|
|
4744
5149
|
error?: undefined;
|
|
@@ -4767,6 +5172,7 @@ declare class PoolByAddressTool extends BaseTool {
|
|
|
4767
5172
|
};
|
|
4768
5173
|
poolCount: number;
|
|
4769
5174
|
pools: {
|
|
5175
|
+
uniswapUrl?: string;
|
|
4770
5176
|
address: string | undefined;
|
|
4771
5177
|
protocolVersion: UniswapProtocolVersion | undefined;
|
|
4772
5178
|
feeTierBps: number | undefined;
|
|
@@ -4800,6 +5206,8 @@ interface OpenAddLiquidityFormToolConfig extends UniswapServiceConfig {
|
|
|
4800
5206
|
pool?: PoolServiceConfig;
|
|
4801
5207
|
/** Min USD value the user must supply. Default 10. */
|
|
4802
5208
|
minProvideUsd?: number;
|
|
5209
|
+
/** CoinPool API config for the reference price-range suggestions. */
|
|
5210
|
+
coinPool?: CoinPoolServiceConfig;
|
|
4803
5211
|
}
|
|
4804
5212
|
/**
|
|
4805
5213
|
* Tool: open-add-liquidity-form
|
|
@@ -4825,6 +5233,7 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
|
4825
5233
|
parameters: ToolParameter[];
|
|
4826
5234
|
private uniswap;
|
|
4827
5235
|
private pool;
|
|
5236
|
+
private coinPool;
|
|
4828
5237
|
private minProvideUsd;
|
|
4829
5238
|
constructor(config?: OpenAddLiquidityFormToolConfig);
|
|
4830
5239
|
/**
|
|
@@ -4839,8 +5248,10 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
|
4839
5248
|
requestedToken?: undefined;
|
|
4840
5249
|
nativeSymbol?: undefined;
|
|
4841
5250
|
chainName?: undefined;
|
|
4842
|
-
|
|
5251
|
+
relatedPools?: undefined;
|
|
5252
|
+
count?: undefined;
|
|
4843
5253
|
ui?: undefined;
|
|
5254
|
+
suggestedRanges?: undefined;
|
|
4844
5255
|
summary?: undefined;
|
|
4845
5256
|
} | {
|
|
4846
5257
|
error: string;
|
|
@@ -4849,8 +5260,10 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
|
4849
5260
|
requestedToken?: undefined;
|
|
4850
5261
|
nativeSymbol?: undefined;
|
|
4851
5262
|
chainName?: undefined;
|
|
4852
|
-
|
|
5263
|
+
relatedPools?: undefined;
|
|
5264
|
+
count?: undefined;
|
|
4853
5265
|
ui?: undefined;
|
|
5266
|
+
suggestedRanges?: undefined;
|
|
4854
5267
|
summary?: undefined;
|
|
4855
5268
|
} | {
|
|
4856
5269
|
error: string;
|
|
@@ -4859,8 +5272,10 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
|
4859
5272
|
chainName: string;
|
|
4860
5273
|
_instructions: string;
|
|
4861
5274
|
chain?: undefined;
|
|
4862
|
-
|
|
5275
|
+
relatedPools?: undefined;
|
|
5276
|
+
count?: undefined;
|
|
4863
5277
|
ui?: undefined;
|
|
5278
|
+
suggestedRanges?: undefined;
|
|
4864
5279
|
summary?: undefined;
|
|
4865
5280
|
} | {
|
|
4866
5281
|
error: string;
|
|
@@ -4869,12 +5284,15 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
|
4869
5284
|
requestedToken?: undefined;
|
|
4870
5285
|
nativeSymbol?: undefined;
|
|
4871
5286
|
chainName?: undefined;
|
|
4872
|
-
|
|
5287
|
+
relatedPools?: undefined;
|
|
5288
|
+
count?: undefined;
|
|
4873
5289
|
ui?: undefined;
|
|
5290
|
+
suggestedRanges?: undefined;
|
|
4874
5291
|
summary?: undefined;
|
|
4875
5292
|
} | {
|
|
4876
|
-
|
|
5293
|
+
relatedPools: {
|
|
4877
5294
|
apr?: number | undefined;
|
|
5295
|
+
volumeToTvlRatio?: number | undefined;
|
|
4878
5296
|
address: string | undefined;
|
|
4879
5297
|
token0Symbol: string | undefined;
|
|
4880
5298
|
token1Symbol: string | undefined;
|
|
@@ -4883,6 +5301,7 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
|
4883
5301
|
volume24hUsd: number | undefined;
|
|
4884
5302
|
tvlUsd: number | undefined;
|
|
4885
5303
|
}[];
|
|
5304
|
+
count: number;
|
|
4886
5305
|
_instructions: string;
|
|
4887
5306
|
error?: undefined;
|
|
4888
5307
|
chain?: undefined;
|
|
@@ -4890,9 +5309,19 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
|
4890
5309
|
nativeSymbol?: undefined;
|
|
4891
5310
|
chainName?: undefined;
|
|
4892
5311
|
ui?: undefined;
|
|
5312
|
+
suggestedRanges?: undefined;
|
|
4893
5313
|
summary?: undefined;
|
|
4894
5314
|
} | {
|
|
4895
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
|
+
}[];
|
|
4896
5325
|
summary: string;
|
|
4897
5326
|
_instructions: string;
|
|
4898
5327
|
error?: undefined;
|
|
@@ -4900,8 +5329,32 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
|
4900
5329
|
requestedToken?: undefined;
|
|
4901
5330
|
nativeSymbol?: undefined;
|
|
4902
5331
|
chainName?: undefined;
|
|
4903
|
-
|
|
5332
|
+
relatedPools?: undefined;
|
|
5333
|
+
count?: undefined;
|
|
4904
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;
|
|
4905
5358
|
private matchesPairExact;
|
|
4906
5359
|
private matchesPair;
|
|
4907
5360
|
private symMatch;
|
|
@@ -4968,6 +5421,9 @@ declare class PreviewAddLiquidityTool extends BaseTool {
|
|
|
4968
5421
|
rawTickUpper?: undefined;
|
|
4969
5422
|
tickLower?: undefined;
|
|
4970
5423
|
tickUpper?: undefined;
|
|
5424
|
+
currentPrice?: undefined;
|
|
5425
|
+
requestedRange?: undefined;
|
|
5426
|
+
side?: undefined;
|
|
4971
5427
|
balanceWei?: undefined;
|
|
4972
5428
|
requiredWei?: undefined;
|
|
4973
5429
|
gasReserveWei?: undefined;
|
|
@@ -4981,6 +5437,9 @@ declare class PreviewAddLiquidityTool extends BaseTool {
|
|
|
4981
5437
|
rawTickUpper?: undefined;
|
|
4982
5438
|
tickLower?: undefined;
|
|
4983
5439
|
tickUpper?: undefined;
|
|
5440
|
+
currentPrice?: undefined;
|
|
5441
|
+
requestedRange?: undefined;
|
|
5442
|
+
side?: undefined;
|
|
4984
5443
|
balanceWei?: undefined;
|
|
4985
5444
|
requiredWei?: undefined;
|
|
4986
5445
|
gasReserveWei?: undefined;
|
|
@@ -4994,6 +5453,9 @@ declare class PreviewAddLiquidityTool extends BaseTool {
|
|
|
4994
5453
|
rawTickUpper?: undefined;
|
|
4995
5454
|
tickLower?: undefined;
|
|
4996
5455
|
tickUpper?: undefined;
|
|
5456
|
+
currentPrice?: undefined;
|
|
5457
|
+
requestedRange?: undefined;
|
|
5458
|
+
side?: undefined;
|
|
4997
5459
|
balanceWei?: undefined;
|
|
4998
5460
|
requiredWei?: undefined;
|
|
4999
5461
|
gasReserveWei?: undefined;
|
|
@@ -5007,6 +5469,28 @@ declare class PreviewAddLiquidityTool extends BaseTool {
|
|
|
5007
5469
|
tickLower: number;
|
|
5008
5470
|
tickUpper: number;
|
|
5009
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;
|
|
5010
5494
|
balanceWei?: undefined;
|
|
5011
5495
|
requiredWei?: undefined;
|
|
5012
5496
|
gasReserveWei?: undefined;
|
|
@@ -5023,6 +5507,9 @@ declare class PreviewAddLiquidityTool extends BaseTool {
|
|
|
5023
5507
|
rawTickUpper?: undefined;
|
|
5024
5508
|
tickLower?: undefined;
|
|
5025
5509
|
tickUpper?: undefined;
|
|
5510
|
+
currentPrice?: undefined;
|
|
5511
|
+
requestedRange?: undefined;
|
|
5512
|
+
side?: undefined;
|
|
5026
5513
|
ui?: undefined;
|
|
5027
5514
|
summary?: undefined;
|
|
5028
5515
|
} | {
|
|
@@ -5035,6 +5522,9 @@ declare class PreviewAddLiquidityTool extends BaseTool {
|
|
|
5035
5522
|
rawTickUpper?: undefined;
|
|
5036
5523
|
tickLower?: undefined;
|
|
5037
5524
|
tickUpper?: undefined;
|
|
5525
|
+
currentPrice?: undefined;
|
|
5526
|
+
requestedRange?: undefined;
|
|
5527
|
+
side?: undefined;
|
|
5038
5528
|
balanceWei?: undefined;
|
|
5039
5529
|
requiredWei?: undefined;
|
|
5040
5530
|
gasReserveWei?: undefined;
|
|
@@ -5106,6 +5596,7 @@ declare class EstimatePoolYieldTool extends BaseTool {
|
|
|
5106
5596
|
tvlUsd: number | undefined;
|
|
5107
5597
|
volume24hUsd: number | undefined;
|
|
5108
5598
|
fees24hUsd: number | undefined;
|
|
5599
|
+
volumeToTvlRatio: number | undefined;
|
|
5109
5600
|
aprPercent: number | undefined;
|
|
5110
5601
|
chain: string;
|
|
5111
5602
|
token0: {
|
|
@@ -5134,6 +5625,7 @@ declare class EstimatePoolYieldTool extends BaseTool {
|
|
|
5134
5625
|
tvlUsd: number | undefined;
|
|
5135
5626
|
volume24hUsd: number | undefined;
|
|
5136
5627
|
fees24hUsd: number | undefined;
|
|
5628
|
+
volumeToTvlRatio: number | undefined;
|
|
5137
5629
|
aprPercent: number | undefined;
|
|
5138
5630
|
chain: string;
|
|
5139
5631
|
token0: {
|
|
@@ -5161,33 +5653,80 @@ declare class EstimatePoolYieldTool extends BaseTool {
|
|
|
5161
5653
|
private describeQuery;
|
|
5162
5654
|
}
|
|
5163
5655
|
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
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
|
+
}>;
|
|
5173
5705
|
}
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
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
|
+
}>;
|
|
5189
5729
|
}
|
|
5190
|
-
type SubgraphSort = 'tvl' | 'volume' | 'apr' | 'fee' | 'liquidity';
|
|
5191
5730
|
|
|
5192
5731
|
type SubgraphPoolSearchToolConfig = SubgraphServiceConfig;
|
|
5193
5732
|
/**
|
|
@@ -5254,7 +5793,7 @@ declare class SubgraphPoolSearchTool extends BaseTool {
|
|
|
5254
5793
|
};
|
|
5255
5794
|
uniswapUrl: string;
|
|
5256
5795
|
}[];
|
|
5257
|
-
coinPoolPairs: (CoinPoolPairSummary & {
|
|
5796
|
+
coinPoolPairs: (CoinPoolPairSummary$1 & {
|
|
5258
5797
|
chain: string;
|
|
5259
5798
|
})[];
|
|
5260
5799
|
supportedChains?: undefined;
|
|
@@ -5354,7 +5893,7 @@ declare class SubgraphPoolByAddressTool extends BaseTool {
|
|
|
5354
5893
|
} | {
|
|
5355
5894
|
_instructions: string;
|
|
5356
5895
|
chain: string;
|
|
5357
|
-
coinPoolPairs: never[] | CoinPoolPairSummary[];
|
|
5896
|
+
coinPoolPairs: never[] | CoinPoolPairSummary$1[];
|
|
5358
5897
|
pool: {
|
|
5359
5898
|
pair: string;
|
|
5360
5899
|
poolAddress: string;
|
|
@@ -5607,7 +6146,7 @@ declare class SubgraphCoinPoolPairsTool extends BaseTool {
|
|
|
5607
6146
|
tokens: string[];
|
|
5608
6147
|
chain: string;
|
|
5609
6148
|
count: number;
|
|
5610
|
-
pairs: CoinPoolPairSummary[];
|
|
6149
|
+
pairs: CoinPoolPairSummary$1[];
|
|
5611
6150
|
error?: undefined;
|
|
5612
6151
|
unsupportedChains?: undefined;
|
|
5613
6152
|
supportedChains?: undefined;
|
|
@@ -5677,7 +6216,7 @@ declare class SubgraphAddPoolTool extends BaseTool {
|
|
|
5677
6216
|
};
|
|
5678
6217
|
uniswapUrl: string;
|
|
5679
6218
|
}[];
|
|
5680
|
-
coinPoolPairs: CoinPoolPairSummary[];
|
|
6219
|
+
coinPoolPairs: CoinPoolPairSummary$1[];
|
|
5681
6220
|
} | {
|
|
5682
6221
|
_instructions: string;
|
|
5683
6222
|
howTo: boolean;
|
|
@@ -6733,6 +7272,77 @@ declare class SendNftTool extends BaseWalletActionTool {
|
|
|
6733
7272
|
private paramsFromNft;
|
|
6734
7273
|
}
|
|
6735
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
|
+
|
|
6736
7346
|
/**
|
|
6737
7347
|
* Shared JSON-RPC client + default public RPC endpoints.
|
|
6738
7348
|
*
|
|
@@ -7141,4 +7751,23 @@ declare class Summarizer {
|
|
|
7141
7751
|
summarize(messages: ChatMessage[]): Promise<string>;
|
|
7142
7752
|
}
|
|
7143
7753
|
|
|
7144
|
-
|
|
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 };
|