keyring-agent-core 0.2.1 → 0.2.3
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 +6692 -27
- package/dist/index.js +877 -70
- package/package.json +6 -4
- package/dist/agent/AgentCore.d.ts +0 -256
- package/dist/agent/AgentCore.d.ts.map +0 -1
- package/dist/agent/AgentCore.js +0 -1093
- package/dist/agent/AgentCore.js.map +0 -1
- package/dist/agent/QueryRewriter.d.ts +0 -84
- package/dist/agent/QueryRewriter.d.ts.map +0 -1
- package/dist/agent/QueryRewriter.js +0 -306
- package/dist/agent/QueryRewriter.js.map +0 -1
- package/dist/agent/Router.d.ts +0 -33
- package/dist/agent/Router.d.ts.map +0 -1
- package/dist/agent/Router.js +0 -229
- package/dist/agent/Router.js.map +0 -1
- package/dist/agent/Subagent.d.ts +0 -80
- package/dist/agent/Subagent.d.ts.map +0 -1
- package/dist/agent/Subagent.js +0 -272
- package/dist/agent/Subagent.js.map +0 -1
- package/dist/agent/Synthesizer.d.ts +0 -11
- package/dist/agent/Synthesizer.d.ts.map +0 -1
- package/dist/agent/Synthesizer.js +0 -86
- package/dist/agent/Synthesizer.js.map +0 -1
- package/dist/agent/chatGraph.d.ts +0 -364
- package/dist/agent/chatGraph.d.ts.map +0 -1
- package/dist/agent/chatGraph.js +0 -184
- package/dist/agent/chatGraph.js.map +0 -1
- package/dist/agent/index.d.ts +0 -10
- package/dist/agent/index.d.ts.map +0 -1
- package/dist/agent/index.js +0 -24
- package/dist/agent/index.js.map +0 -1
- package/dist/agent/subagents/AiAgent.d.ts +0 -6
- package/dist/agent/subagents/AiAgent.d.ts.map +0 -1
- package/dist/agent/subagents/AiAgent.js +0 -52
- package/dist/agent/subagents/AiAgent.js.map +0 -1
- package/dist/agent/subagents/NftAgent.d.ts +0 -6
- package/dist/agent/subagents/NftAgent.d.ts.map +0 -1
- package/dist/agent/subagents/NftAgent.js +0 -79
- package/dist/agent/subagents/NftAgent.js.map +0 -1
- package/dist/agent/subagents/PoolAgent.d.ts +0 -6
- package/dist/agent/subagents/PoolAgent.d.ts.map +0 -1
- package/dist/agent/subagents/PoolAgent.js +0 -184
- package/dist/agent/subagents/PoolAgent.js.map +0 -1
- package/dist/agent/subagents/PoolSubgraphAgent.d.ts +0 -6
- package/dist/agent/subagents/PoolSubgraphAgent.d.ts.map +0 -1
- package/dist/agent/subagents/PoolSubgraphAgent.js +0 -117
- package/dist/agent/subagents/PoolSubgraphAgent.js.map +0 -1
- package/dist/agent/subagents/TokenAgent.d.ts +0 -6
- package/dist/agent/subagents/TokenAgent.d.ts.map +0 -1
- package/dist/agent/subagents/TokenAgent.js +0 -76
- package/dist/agent/subagents/TokenAgent.js.map +0 -1
- package/dist/agent/subagents/WalletActionAgent.d.ts +0 -6
- package/dist/agent/subagents/WalletActionAgent.d.ts.map +0 -1
- package/dist/agent/subagents/WalletActionAgent.js +0 -55
- package/dist/agent/subagents/WalletActionAgent.js.map +0 -1
- package/dist/agent/subagents/WalletAgent.d.ts +0 -6
- package/dist/agent/subagents/WalletAgent.d.ts.map +0 -1
- package/dist/agent/subagents/WalletAgent.js +0 -93
- package/dist/agent/subagents/WalletAgent.js.map +0 -1
- package/dist/agent/subagents/index.d.ts +0 -34
- package/dist/agent/subagents/index.d.ts.map +0 -1
- package/dist/agent/subagents/index.js +0 -69
- package/dist/agent/subagents/index.js.map +0 -1
- package/dist/constants/abi.d.ts +0 -551
- package/dist/constants/abi.d.ts.map +0 -1
- package/dist/constants/abi.js +0 -690
- package/dist/constants/abi.js.map +0 -1
- package/dist/functions/pool.d.ts +0 -25
- package/dist/functions/pool.d.ts.map +0 -1
- package/dist/functions/pool.js +0 -151
- package/dist/functions/pool.js.map +0 -1
- package/dist/functions/web3.d.ts +0 -31
- package/dist/functions/web3.d.ts.map +0 -1
- package/dist/functions/web3.js +0 -232
- package/dist/functions/web3.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/llm/GeminiProvider.d.ts +0 -16
- package/dist/llm/GeminiProvider.d.ts.map +0 -1
- package/dist/llm/GeminiProvider.js +0 -329
- package/dist/llm/GeminiProvider.js.map +0 -1
- package/dist/llm/index.d.ts +0 -2
- package/dist/llm/index.d.ts.map +0 -1
- package/dist/llm/index.js +0 -6
- package/dist/llm/index.js.map +0 -1
- package/dist/memory/ChatHistory.d.ts +0 -83
- package/dist/memory/ChatHistory.d.ts.map +0 -1
- package/dist/memory/ChatHistory.js +0 -143
- package/dist/memory/ChatHistory.js.map +0 -1
- package/dist/memory/KnowledgeBase.d.ts +0 -38
- package/dist/memory/KnowledgeBase.d.ts.map +0 -1
- package/dist/memory/KnowledgeBase.js +0 -139
- package/dist/memory/KnowledgeBase.js.map +0 -1
- package/dist/memory/Summarizer.d.ts +0 -12
- package/dist/memory/Summarizer.d.ts.map +0 -1
- package/dist/memory/Summarizer.js +0 -39
- package/dist/memory/Summarizer.js.map +0 -1
- package/dist/memory/UpstashKnowledgeBase.d.ts +0 -124
- package/dist/memory/UpstashKnowledgeBase.d.ts.map +0 -1
- package/dist/memory/UpstashKnowledgeBase.js +0 -152
- package/dist/memory/UpstashKnowledgeBase.js.map +0 -1
- package/dist/memory/historyUtils.d.ts +0 -58
- package/dist/memory/historyUtils.d.ts.map +0 -1
- package/dist/memory/historyUtils.js +0 -190
- package/dist/memory/historyUtils.js.map +0 -1
- package/dist/memory/index.d.ts +0 -7
- package/dist/memory/index.d.ts.map +0 -1
- package/dist/memory/index.js +0 -12
- package/dist/memory/index.js.map +0 -1
- package/dist/memory/ingestKnowledgeBase.d.ts +0 -17
- package/dist/memory/ingestKnowledgeBase.d.ts.map +0 -1
- package/dist/memory/ingestKnowledgeBase.js +0 -35
- package/dist/memory/ingestKnowledgeBase.js.map +0 -1
- package/dist/services/MoralisService.d.ts +0 -1328
- package/dist/services/MoralisService.d.ts.map +0 -1
- package/dist/services/MoralisService.js +0 -1239
- package/dist/services/MoralisService.js.map +0 -1
- package/dist/services/PantographService.d.ts +0 -98
- package/dist/services/PantographService.d.ts.map +0 -1
- package/dist/services/PantographService.js +0 -451
- package/dist/services/PantographService.js.map +0 -1
- package/dist/services/PoolService.d.ts +0 -238
- package/dist/services/PoolService.d.ts.map +0 -1
- package/dist/services/PoolService.js +0 -485
- package/dist/services/PoolService.js.map +0 -1
- package/dist/services/UniswapService.d.ts +0 -289
- package/dist/services/UniswapService.d.ts.map +0 -1
- package/dist/services/UniswapService.js +0 -585
- package/dist/services/UniswapService.js.map +0 -1
- package/dist/services/UniswapSubgraphService.d.ts +0 -144
- package/dist/services/UniswapSubgraphService.d.ts.map +0 -1
- package/dist/services/UniswapSubgraphService.js +0 -606
- package/dist/services/UniswapSubgraphService.js.map +0 -1
- package/dist/services/rpc.d.ts +0 -35
- package/dist/services/rpc.d.ts.map +0 -1
- package/dist/services/rpc.js +0 -110
- package/dist/services/rpc.js.map +0 -1
- package/dist/services/swap/BaseSwapService.d.ts +0 -17
- package/dist/services/swap/BaseSwapService.d.ts.map +0 -1
- package/dist/services/swap/BaseSwapService.js +0 -19
- package/dist/services/swap/BaseSwapService.js.map +0 -1
- package/dist/services/swap/DebridgeAdapter.d.ts +0 -37
- package/dist/services/swap/DebridgeAdapter.d.ts.map +0 -1
- package/dist/services/swap/DebridgeAdapter.js +0 -243
- package/dist/services/swap/DebridgeAdapter.js.map +0 -1
- package/dist/services/swap/RelayAdapter.d.ts +0 -19
- package/dist/services/swap/RelayAdapter.d.ts.map +0 -1
- package/dist/services/swap/RelayAdapter.js +0 -189
- package/dist/services/swap/RelayAdapter.js.map +0 -1
- package/dist/services/swap/SwapServiceFactory.d.ts +0 -25
- package/dist/services/swap/SwapServiceFactory.d.ts.map +0 -1
- package/dist/services/swap/SwapServiceFactory.js +0 -79
- package/dist/services/swap/SwapServiceFactory.js.map +0 -1
- package/dist/services/swap/addresses.d.ts +0 -3
- package/dist/services/swap/addresses.d.ts.map +0 -1
- package/dist/services/swap/addresses.js +0 -68
- package/dist/services/swap/addresses.js.map +0 -1
- package/dist/services/swap/affiliate.d.ts +0 -17
- package/dist/services/swap/affiliate.d.ts.map +0 -1
- package/dist/services/swap/affiliate.js +0 -126
- package/dist/services/swap/affiliate.js.map +0 -1
- package/dist/services/swap/config.d.ts +0 -9
- package/dist/services/swap/config.d.ts.map +0 -1
- package/dist/services/swap/config.js +0 -19
- package/dist/services/swap/config.js.map +0 -1
- package/dist/services/swap/index.d.ts +0 -10
- package/dist/services/swap/index.d.ts.map +0 -1
- package/dist/services/swap/index.js +0 -22
- package/dist/services/swap/index.js.map +0 -1
- package/dist/services/swap/types.d.ts +0 -89
- package/dist/services/swap/types.d.ts.map +0 -1
- package/dist/services/swap/types.js +0 -6
- package/dist/services/swap/types.js.map +0 -1
- package/dist/tools/BaseTool.d.ts +0 -15
- package/dist/tools/BaseTool.d.ts.map +0 -1
- package/dist/tools/BaseTool.js +0 -35
- package/dist/tools/BaseTool.js.map +0 -1
- package/dist/tools/ToolRegistry.d.ts +0 -27
- package/dist/tools/ToolRegistry.d.ts.map +0 -1
- package/dist/tools/ToolRegistry.js +0 -80
- package/dist/tools/ToolRegistry.js.map +0 -1
- package/dist/tools/builtin/ai/GeminiSearchAiTool.d.ts +0 -36
- package/dist/tools/builtin/ai/GeminiSearchAiTool.d.ts.map +0 -1
- package/dist/tools/builtin/ai/GeminiSearchAiTool.js +0 -91
- package/dist/tools/builtin/ai/GeminiSearchAiTool.js.map +0 -1
- package/dist/tools/builtin/ai/index.d.ts +0 -3
- package/dist/tools/builtin/ai/index.d.ts.map +0 -1
- package/dist/tools/builtin/ai/index.js +0 -6
- package/dist/tools/builtin/ai/index.js.map +0 -1
- package/dist/tools/builtin/index.d.ts +0 -8
- package/dist/tools/builtin/index.d.ts.map +0 -1
- package/dist/tools/builtin/index.js +0 -24
- package/dist/tools/builtin/index.js.map +0 -1
- package/dist/tools/builtin/nft/BaseNftMessageTool.d.ts +0 -35
- package/dist/tools/builtin/nft/BaseNftMessageTool.d.ts.map +0 -1
- package/dist/tools/builtin/nft/BaseNftMessageTool.js +0 -45
- package/dist/tools/builtin/nft/BaseNftMessageTool.js.map +0 -1
- package/dist/tools/builtin/nft/NFTContractInfoTool.d.ts +0 -15
- package/dist/tools/builtin/nft/NFTContractInfoTool.d.ts.map +0 -1
- package/dist/tools/builtin/nft/NFTContractInfoTool.js +0 -19
- package/dist/tools/builtin/nft/NFTContractInfoTool.js.map +0 -1
- package/dist/tools/builtin/nft/NFTMetadataTool.d.ts +0 -15
- package/dist/tools/builtin/nft/NFTMetadataTool.d.ts.map +0 -1
- package/dist/tools/builtin/nft/NFTMetadataTool.js +0 -20
- package/dist/tools/builtin/nft/NFTMetadataTool.js.map +0 -1
- package/dist/tools/builtin/nft/SendNftTool.d.ts +0 -14
- package/dist/tools/builtin/nft/SendNftTool.d.ts.map +0 -1
- package/dist/tools/builtin/nft/SendNftTool.js +0 -20
- package/dist/tools/builtin/nft/SendNftTool.js.map +0 -1
- package/dist/tools/builtin/nft/WalletNFTsTool.d.ts +0 -15
- package/dist/tools/builtin/nft/WalletNFTsTool.d.ts.map +0 -1
- package/dist/tools/builtin/nft/WalletNFTsTool.js +0 -20
- package/dist/tools/builtin/nft/WalletNFTsTool.js.map +0 -1
- package/dist/tools/builtin/nft/index.d.ts +0 -7
- package/dist/tools/builtin/nft/index.d.ts.map +0 -1
- package/dist/tools/builtin/nft/index.js +0 -10
- package/dist/tools/builtin/nft/index.js.map +0 -1
- package/dist/tools/builtin/pool/EstimatePoolYieldTool.d.ts +0 -124
- package/dist/tools/builtin/pool/EstimatePoolYieldTool.d.ts.map +0 -1
- package/dist/tools/builtin/pool/EstimatePoolYieldTool.js +0 -236
- package/dist/tools/builtin/pool/EstimatePoolYieldTool.js.map +0 -1
- package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.d.ts +0 -128
- package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.d.ts.map +0 -1
- package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.js +0 -520
- package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.js.map +0 -1
- package/dist/tools/builtin/pool/PoolByAddressTool.d.ts +0 -127
- package/dist/tools/builtin/pool/PoolByAddressTool.d.ts.map +0 -1
- package/dist/tools/builtin/pool/PoolByAddressTool.js +0 -238
- package/dist/tools/builtin/pool/PoolByAddressTool.js.map +0 -1
- package/dist/tools/builtin/pool/PoolDetailTool.d.ts +0 -127
- package/dist/tools/builtin/pool/PoolDetailTool.d.ts.map +0 -1
- package/dist/tools/builtin/pool/PoolDetailTool.js +0 -273
- package/dist/tools/builtin/pool/PoolDetailTool.js.map +0 -1
- package/dist/tools/builtin/pool/PoolSearchTool.d.ts +0 -50
- package/dist/tools/builtin/pool/PoolSearchTool.d.ts.map +0 -1
- package/dist/tools/builtin/pool/PoolSearchTool.js +0 -160
- package/dist/tools/builtin/pool/PoolSearchTool.js.map +0 -1
- package/dist/tools/builtin/pool/PreviewAddLiquidityTool.d.ts +0 -124
- package/dist/tools/builtin/pool/PreviewAddLiquidityTool.d.ts.map +0 -1
- package/dist/tools/builtin/pool/PreviewAddLiquidityTool.js +0 -382
- package/dist/tools/builtin/pool/PreviewAddLiquidityTool.js.map +0 -1
- package/dist/tools/builtin/pool/TopPoolsTool.d.ts +0 -68
- package/dist/tools/builtin/pool/TopPoolsTool.d.ts.map +0 -1
- package/dist/tools/builtin/pool/TopPoolsTool.js +0 -159
- package/dist/tools/builtin/pool/TopPoolsTool.js.map +0 -1
- package/dist/tools/builtin/pool/index.d.ts +0 -15
- package/dist/tools/builtin/pool/index.d.ts.map +0 -1
- package/dist/tools/builtin/pool/index.js +0 -18
- package/dist/tools/builtin/pool/index.js.map +0 -1
- package/dist/tools/builtin/pool-subgraph/SubgraphCoinPoolPairsTool.d.ts +0 -54
- package/dist/tools/builtin/pool-subgraph/SubgraphCoinPoolPairsTool.d.ts.map +0 -1
- package/dist/tools/builtin/pool-subgraph/SubgraphCoinPoolPairsTool.js +0 -98
- package/dist/tools/builtin/pool-subgraph/SubgraphCoinPoolPairsTool.js.map +0 -1
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolByAddressTool.d.ts +0 -63
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolByAddressTool.d.ts.map +0 -1
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolByAddressTool.js +0 -82
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolByAddressTool.js.map +0 -1
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolByPositionIdTool.d.ts +0 -79
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolByPositionIdTool.d.ts.map +0 -1
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolByPositionIdTool.js +0 -97
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolByPositionIdTool.js.map +0 -1
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolSearchTool.d.ts +0 -77
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolSearchTool.d.ts.map +0 -1
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolSearchTool.js +0 -190
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolSearchTool.js.map +0 -1
- package/dist/tools/builtin/pool-subgraph/SubgraphPositionDetailTool.d.ts +0 -107
- package/dist/tools/builtin/pool-subgraph/SubgraphPositionDetailTool.d.ts.map +0 -1
- package/dist/tools/builtin/pool-subgraph/SubgraphPositionDetailTool.js +0 -92
- package/dist/tools/builtin/pool-subgraph/SubgraphPositionDetailTool.js.map +0 -1
- package/dist/tools/builtin/pool-subgraph/SubgraphTrendingPoolsTool.d.ts +0 -56
- package/dist/tools/builtin/pool-subgraph/SubgraphTrendingPoolsTool.d.ts.map +0 -1
- package/dist/tools/builtin/pool-subgraph/SubgraphTrendingPoolsTool.js +0 -94
- package/dist/tools/builtin/pool-subgraph/SubgraphTrendingPoolsTool.js.map +0 -1
- package/dist/tools/builtin/pool-subgraph/index.d.ts +0 -13
- package/dist/tools/builtin/pool-subgraph/index.d.ts.map +0 -1
- package/dist/tools/builtin/pool-subgraph/index.js +0 -18
- package/dist/tools/builtin/pool-subgraph/index.js.map +0 -1
- package/dist/tools/builtin/token/TokenAnalyticsTool.d.ts +0 -71
- package/dist/tools/builtin/token/TokenAnalyticsTool.d.ts.map +0 -1
- package/dist/tools/builtin/token/TokenAnalyticsTool.js +0 -147
- package/dist/tools/builtin/token/TokenAnalyticsTool.js.map +0 -1
- package/dist/tools/builtin/token/TokenHoldersTool.d.ts +0 -81
- package/dist/tools/builtin/token/TokenHoldersTool.d.ts.map +0 -1
- package/dist/tools/builtin/token/TokenHoldersTool.js +0 -139
- package/dist/tools/builtin/token/TokenHoldersTool.js.map +0 -1
- package/dist/tools/builtin/token/TokenInfoTool.d.ts +0 -40
- package/dist/tools/builtin/token/TokenInfoTool.d.ts.map +0 -1
- package/dist/tools/builtin/token/TokenInfoTool.js +0 -221
- package/dist/tools/builtin/token/TokenInfoTool.js.map +0 -1
- package/dist/tools/builtin/token/TokenScoreTool.d.ts +0 -63
- package/dist/tools/builtin/token/TokenScoreTool.d.ts.map +0 -1
- package/dist/tools/builtin/token/TokenScoreTool.js +0 -148
- package/dist/tools/builtin/token/TokenScoreTool.js.map +0 -1
- package/dist/tools/builtin/token/TopGainersTool.d.ts +0 -37
- package/dist/tools/builtin/token/TopGainersTool.d.ts.map +0 -1
- package/dist/tools/builtin/token/TopGainersTool.js +0 -100
- package/dist/tools/builtin/token/TopGainersTool.js.map +0 -1
- package/dist/tools/builtin/token/TopLosersTool.d.ts +0 -66
- package/dist/tools/builtin/token/TopLosersTool.d.ts.map +0 -1
- package/dist/tools/builtin/token/TopLosersTool.js +0 -129
- package/dist/tools/builtin/token/TopLosersTool.js.map +0 -1
- package/dist/tools/builtin/token/TrendingTokensTool.d.ts +0 -39
- package/dist/tools/builtin/token/TrendingTokensTool.d.ts.map +0 -1
- package/dist/tools/builtin/token/TrendingTokensTool.js +0 -83
- package/dist/tools/builtin/token/TrendingTokensTool.js.map +0 -1
- package/dist/tools/builtin/token/index.d.ts +0 -13
- package/dist/tools/builtin/token/index.d.ts.map +0 -1
- package/dist/tools/builtin/token/index.js +0 -16
- package/dist/tools/builtin/token/index.js.map +0 -1
- package/dist/tools/builtin/wallet/TransactionByHashTool.d.ts +0 -70
- package/dist/tools/builtin/wallet/TransactionByHashTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet/TransactionByHashTool.js +0 -111
- package/dist/tools/builtin/wallet/TransactionByHashTool.js.map +0 -1
- package/dist/tools/builtin/wallet/WalletApprovalsTool.d.ts +0 -107
- package/dist/tools/builtin/wallet/WalletApprovalsTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet/WalletApprovalsTool.js +0 -164
- package/dist/tools/builtin/wallet/WalletApprovalsTool.js.map +0 -1
- package/dist/tools/builtin/wallet/WalletDefiPositionsTool.d.ts +0 -61
- package/dist/tools/builtin/wallet/WalletDefiPositionsTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet/WalletDefiPositionsTool.js +0 -100
- package/dist/tools/builtin/wallet/WalletDefiPositionsTool.js.map +0 -1
- package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.d.ts +0 -68
- package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.js +0 -115
- package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.js.map +0 -1
- package/dist/tools/builtin/wallet/WalletDefiSummaryTool.d.ts +0 -50
- package/dist/tools/builtin/wallet/WalletDefiSummaryTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet/WalletDefiSummaryTool.js +0 -80
- package/dist/tools/builtin/wallet/WalletDefiSummaryTool.js.map +0 -1
- package/dist/tools/builtin/wallet/WalletHistoryTool.d.ts +0 -31
- package/dist/tools/builtin/wallet/WalletHistoryTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet/WalletHistoryTool.js +0 -154
- package/dist/tools/builtin/wallet/WalletHistoryTool.js.map +0 -1
- package/dist/tools/builtin/wallet/WalletNetWorthTool.d.ts +0 -44
- package/dist/tools/builtin/wallet/WalletNetWorthTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet/WalletNetWorthTool.js +0 -122
- package/dist/tools/builtin/wallet/WalletNetWorthTool.js.map +0 -1
- package/dist/tools/builtin/wallet/WalletNftTransfersTool.d.ts +0 -86
- package/dist/tools/builtin/wallet/WalletNftTransfersTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet/WalletNftTransfersTool.js +0 -265
- package/dist/tools/builtin/wallet/WalletNftTransfersTool.js.map +0 -1
- package/dist/tools/builtin/wallet/WalletPnlSummaryTool.d.ts +0 -43
- package/dist/tools/builtin/wallet/WalletPnlSummaryTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet/WalletPnlSummaryTool.js +0 -89
- package/dist/tools/builtin/wallet/WalletPnlSummaryTool.js.map +0 -1
- package/dist/tools/builtin/wallet/WalletPnlTool.d.ts +0 -43
- package/dist/tools/builtin/wallet/WalletPnlTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet/WalletPnlTool.js +0 -175
- package/dist/tools/builtin/wallet/WalletPnlTool.js.map +0 -1
- package/dist/tools/builtin/wallet/WalletTokenBalancesTool.d.ts +0 -35
- package/dist/tools/builtin/wallet/WalletTokenBalancesTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet/WalletTokenBalancesTool.js +0 -68
- package/dist/tools/builtin/wallet/WalletTokenBalancesTool.js.map +0 -1
- package/dist/tools/builtin/wallet/WalletTokenTransfersTool.d.ts +0 -109
- package/dist/tools/builtin/wallet/WalletTokenTransfersTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet/WalletTokenTransfersTool.js +0 -354
- package/dist/tools/builtin/wallet/WalletTokenTransfersTool.js.map +0 -1
- package/dist/tools/builtin/wallet/index.d.ts +0 -28
- package/dist/tools/builtin/wallet/index.d.ts.map +0 -1
- package/dist/tools/builtin/wallet/index.js +0 -32
- package/dist/tools/builtin/wallet/index.js.map +0 -1
- package/dist/tools/builtin/wallet-action/ApproveTokenTool.d.ts +0 -25
- package/dist/tools/builtin/wallet-action/ApproveTokenTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet-action/ApproveTokenTool.js +0 -98
- package/dist/tools/builtin/wallet-action/ApproveTokenTool.js.map +0 -1
- package/dist/tools/builtin/wallet-action/BaseWalletActionTool.d.ts +0 -211
- package/dist/tools/builtin/wallet-action/BaseWalletActionTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet-action/BaseWalletActionTool.js +0 -499
- package/dist/tools/builtin/wallet-action/BaseWalletActionTool.js.map +0 -1
- package/dist/tools/builtin/wallet-action/BuyTokenTool.d.ts +0 -240
- package/dist/tools/builtin/wallet-action/BuyTokenTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet-action/BuyTokenTool.js +0 -1257
- package/dist/tools/builtin/wallet-action/BuyTokenTool.js.map +0 -1
- package/dist/tools/builtin/wallet-action/SendNativeTool.d.ts +0 -41
- package/dist/tools/builtin/wallet-action/SendNativeTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet-action/SendNativeTool.js +0 -127
- package/dist/tools/builtin/wallet-action/SendNativeTool.js.map +0 -1
- package/dist/tools/builtin/wallet-action/SendTokenTool.d.ts +0 -63
- package/dist/tools/builtin/wallet-action/SendTokenTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet-action/SendTokenTool.js +0 -294
- package/dist/tools/builtin/wallet-action/SendTokenTool.js.map +0 -1
- package/dist/tools/builtin/wallet-action/SwapTokenTool.d.ts +0 -247
- package/dist/tools/builtin/wallet-action/SwapTokenTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet-action/SwapTokenTool.js +0 -1258
- package/dist/tools/builtin/wallet-action/SwapTokenTool.js.map +0 -1
- package/dist/tools/builtin/wallet-action/UnwrapNativeTool.d.ts +0 -20
- package/dist/tools/builtin/wallet-action/UnwrapNativeTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet-action/UnwrapNativeTool.js +0 -36
- package/dist/tools/builtin/wallet-action/UnwrapNativeTool.js.map +0 -1
- package/dist/tools/builtin/wallet-action/WrapNativeTool.d.ts +0 -23
- package/dist/tools/builtin/wallet-action/WrapNativeTool.d.ts.map +0 -1
- package/dist/tools/builtin/wallet-action/WrapNativeTool.js +0 -54
- package/dist/tools/builtin/wallet-action/WrapNativeTool.js.map +0 -1
- package/dist/tools/builtin/wallet-action/amountSpec.d.ts +0 -62
- package/dist/tools/builtin/wallet-action/amountSpec.d.ts.map +0 -1
- package/dist/tools/builtin/wallet-action/amountSpec.js +0 -93
- package/dist/tools/builtin/wallet-action/amountSpec.js.map +0 -1
- package/dist/tools/builtin/wallet-action/gasReserve.d.ts +0 -42
- package/dist/tools/builtin/wallet-action/gasReserve.d.ts.map +0 -1
- package/dist/tools/builtin/wallet-action/gasReserve.js +0 -103
- package/dist/tools/builtin/wallet-action/gasReserve.js.map +0 -1
- package/dist/tools/builtin/wallet-action/index.d.ts +0 -9
- package/dist/tools/builtin/wallet-action/index.d.ts.map +0 -1
- package/dist/tools/builtin/wallet-action/index.js +0 -20
- package/dist/tools/builtin/wallet-action/index.js.map +0 -1
- package/dist/tools/chainResolver.d.ts +0 -98
- package/dist/tools/chainResolver.d.ts.map +0 -1
- package/dist/tools/chainResolver.js +0 -302
- package/dist/tools/chainResolver.js.map +0 -1
- package/dist/tools/index.d.ts +0 -4
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -23
- package/dist/tools/index.js.map +0 -1
- package/dist/types/index.d.ts +0 -777
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -6
- package/dist/types/index.js.map +0 -1
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { BaseTool } from '../../BaseTool';
|
|
2
|
-
import type { AddLiquidityFormProps, ToolKind, ToolParameter, ToolResult, UIPayload, UserContext } from '../../../types';
|
|
3
|
-
import { type UniswapServiceConfig } from '../../../services/UniswapService';
|
|
4
|
-
import { type PoolServiceConfig } from '../../../services/PoolService';
|
|
5
|
-
export interface OpenAddLiquidityFormToolConfig extends UniswapServiceConfig {
|
|
6
|
-
pool?: PoolServiceConfig;
|
|
7
|
-
/** Min USD value the user must supply. Default 10. */
|
|
8
|
-
minProvideUsd?: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Tool: open-add-liquidity-form
|
|
12
|
-
*
|
|
13
|
-
* Resolves a pool from token symbols + fee tier, reads the pool's on-chain
|
|
14
|
-
* state, checks the user's native balance on that chain, and returns a UI
|
|
15
|
-
* payload telling the FE to render the AddLiquidityForm component.
|
|
16
|
-
*
|
|
17
|
-
* Native-only: this gateway flow ALWAYS swaps the chain's native coin into
|
|
18
|
-
* both pool tokens via deBridge — there is no token-in selector. The form
|
|
19
|
-
* props expose only the native token; the FE must enforce the same.
|
|
20
|
-
*
|
|
21
|
-
* The tool DOES NOT build a transaction — it just sets up the form. The
|
|
22
|
-
* user picks a strategy + amount, then the agent calls
|
|
23
|
-
* `build-add-liquidity-tx` for the actual unsigned mint.
|
|
24
|
-
*/
|
|
25
|
-
export declare class OpenAddLiquidityFormTool extends BaseTool {
|
|
26
|
-
name: string;
|
|
27
|
-
kind: ToolKind;
|
|
28
|
-
category: string;
|
|
29
|
-
noSuggestions: boolean;
|
|
30
|
-
description: string;
|
|
31
|
-
parameters: ToolParameter[];
|
|
32
|
-
private uniswap;
|
|
33
|
-
private pool;
|
|
34
|
-
private minProvideUsd;
|
|
35
|
-
constructor(config?: OpenAddLiquidityFormToolConfig);
|
|
36
|
-
/**
|
|
37
|
-
* Override execute to forward our `ui` payload from `run()` into the
|
|
38
|
-
* ToolResult envelope (BaseTool only copies `data`).
|
|
39
|
-
*/
|
|
40
|
-
execute(args: Record<string, unknown>, userContext?: UserContext): Promise<ToolResult>;
|
|
41
|
-
protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
|
|
42
|
-
error: string;
|
|
43
|
-
_instructions: string;
|
|
44
|
-
chain?: undefined;
|
|
45
|
-
requestedToken?: undefined;
|
|
46
|
-
nativeSymbol?: undefined;
|
|
47
|
-
chainName?: undefined;
|
|
48
|
-
candidates?: undefined;
|
|
49
|
-
ui?: undefined;
|
|
50
|
-
summary?: undefined;
|
|
51
|
-
} | {
|
|
52
|
-
error: string;
|
|
53
|
-
chain: string;
|
|
54
|
-
_instructions: string;
|
|
55
|
-
requestedToken?: undefined;
|
|
56
|
-
nativeSymbol?: undefined;
|
|
57
|
-
chainName?: undefined;
|
|
58
|
-
candidates?: undefined;
|
|
59
|
-
ui?: undefined;
|
|
60
|
-
summary?: undefined;
|
|
61
|
-
} | {
|
|
62
|
-
error: string;
|
|
63
|
-
requestedToken: string;
|
|
64
|
-
nativeSymbol: string;
|
|
65
|
-
chainName: string;
|
|
66
|
-
_instructions: string;
|
|
67
|
-
chain?: undefined;
|
|
68
|
-
candidates?: undefined;
|
|
69
|
-
ui?: undefined;
|
|
70
|
-
summary?: undefined;
|
|
71
|
-
} | {
|
|
72
|
-
error: string;
|
|
73
|
-
_instructions?: undefined;
|
|
74
|
-
chain?: undefined;
|
|
75
|
-
requestedToken?: undefined;
|
|
76
|
-
nativeSymbol?: undefined;
|
|
77
|
-
chainName?: undefined;
|
|
78
|
-
candidates?: undefined;
|
|
79
|
-
ui?: undefined;
|
|
80
|
-
summary?: undefined;
|
|
81
|
-
} | {
|
|
82
|
-
candidates: {
|
|
83
|
-
apr?: number | undefined;
|
|
84
|
-
address: string | undefined;
|
|
85
|
-
token0Symbol: string | undefined;
|
|
86
|
-
token1Symbol: string | undefined;
|
|
87
|
-
feeTier: number | undefined;
|
|
88
|
-
feeTierPercent: number | undefined;
|
|
89
|
-
volume24hUsd: number | undefined;
|
|
90
|
-
tvlUsd: number | undefined;
|
|
91
|
-
}[];
|
|
92
|
-
_instructions: string;
|
|
93
|
-
error?: undefined;
|
|
94
|
-
chain?: undefined;
|
|
95
|
-
requestedToken?: undefined;
|
|
96
|
-
nativeSymbol?: undefined;
|
|
97
|
-
chainName?: undefined;
|
|
98
|
-
ui?: undefined;
|
|
99
|
-
summary?: undefined;
|
|
100
|
-
} | {
|
|
101
|
-
ui: UIPayload<AddLiquidityFormProps>;
|
|
102
|
-
summary: string;
|
|
103
|
-
_instructions: string;
|
|
104
|
-
error?: undefined;
|
|
105
|
-
chain?: undefined;
|
|
106
|
-
requestedToken?: undefined;
|
|
107
|
-
nativeSymbol?: undefined;
|
|
108
|
-
chainName?: undefined;
|
|
109
|
-
candidates?: undefined;
|
|
110
|
-
}>;
|
|
111
|
-
private matchesPairExact;
|
|
112
|
-
private matchesPair;
|
|
113
|
-
private symMatch;
|
|
114
|
-
private parseRangeStrategy;
|
|
115
|
-
/**
|
|
116
|
-
* Decide which (minPrice, maxPrice) to prefill in the form. Order:
|
|
117
|
-
* 1. Explicit minPrice + maxPrice (user-supplied numbers) — clamp to priceBounds.
|
|
118
|
-
* 2. rangeStrategy = "stable" → buildRangePresets() stable preset.
|
|
119
|
-
* 3. rangeStrategy = "wide" → buildRangePresets() wide preset.
|
|
120
|
-
* 4. rangeStrategy = "full" → priceBounds.min / priceBounds.max.
|
|
121
|
-
* 5. nothing → null (FE shows empty inputs + preset chips like before).
|
|
122
|
-
*
|
|
123
|
-
* The FE keeps the inputs editable in all cases — this is just a pre-fill.
|
|
124
|
-
*/
|
|
125
|
-
private computePrefillRange;
|
|
126
|
-
private buildSummary;
|
|
127
|
-
}
|
|
128
|
-
//# sourceMappingURL=OpenAddLiquidityFormTool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAddLiquidityFormTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/builtin/pool/OpenAddLiquidityFormTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,KAAK,EACV,qBAAqB,EAKrB,QAAQ,EACR,aAAa,EACb,UAAU,EACV,SAAS,EACT,WAAW,EACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAyC,KAAK,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACpH,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,+BAA+B,CAAC;AAKvC,MAAM,WAAW,8BAA+B,SAAQ,oBAAoB;IAC1E,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAID;;;;;;;;;;;;;;GAcG;AACH,qBAAa,wBAAyB,SAAQ,QAAQ;IACpD,IAAI,SAA6B;IACjC,IAAI,EAAE,QAAQ,CAAQ;IACtB,QAAQ,SAAiB;IACzB,aAAa,UAAQ;IACrB,WAAW,SAakE;IAE7E,UAAU,EAAE,aAAa,EAAE,CAqGzB;IAEF,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,aAAa,CAAS;gBAElB,MAAM,CAAC,EAAE,8BAA8B;IAOnD;;;OAGG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;cA2B5E,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAuS5E,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,kBAAkB;IAO1B;;;;;;;;;OASG;IACH,OAAO,CAAC,mBAAmB;IAwC3B,OAAO,CAAC,YAAY;CAgBrB"}
|
|
@@ -1,520 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OpenAddLiquidityFormTool = void 0;
|
|
4
|
-
const BaseTool_1 = require("../../BaseTool");
|
|
5
|
-
const chainResolver_1 = require("../../chainResolver");
|
|
6
|
-
const UniswapService_1 = require("../../../services/UniswapService");
|
|
7
|
-
const PoolService_1 = require("../../../services/PoolService");
|
|
8
|
-
const pool_1 = require("../../../functions/pool");
|
|
9
|
-
const EVM_ADDRESS_RE = /^0x[a-fA-F0-9]{40}$/;
|
|
10
|
-
/**
|
|
11
|
-
* Tool: open-add-liquidity-form
|
|
12
|
-
*
|
|
13
|
-
* Resolves a pool from token symbols + fee tier, reads the pool's on-chain
|
|
14
|
-
* state, checks the user's native balance on that chain, and returns a UI
|
|
15
|
-
* payload telling the FE to render the AddLiquidityForm component.
|
|
16
|
-
*
|
|
17
|
-
* Native-only: this gateway flow ALWAYS swaps the chain's native coin into
|
|
18
|
-
* both pool tokens via deBridge — there is no token-in selector. The form
|
|
19
|
-
* props expose only the native token; the FE must enforce the same.
|
|
20
|
-
*
|
|
21
|
-
* The tool DOES NOT build a transaction — it just sets up the form. The
|
|
22
|
-
* user picks a strategy + amount, then the agent calls
|
|
23
|
-
* `build-add-liquidity-tx` for the actual unsigned mint.
|
|
24
|
-
*/
|
|
25
|
-
class OpenAddLiquidityFormTool extends BaseTool_1.BaseTool {
|
|
26
|
-
name = 'open-add-liquidity-form';
|
|
27
|
-
kind = 'ui';
|
|
28
|
-
category = 'pool-action';
|
|
29
|
-
noSuggestions = true;
|
|
30
|
-
description = 'Open the Add-Liquidity form for a specific Uniswap V3 pool. Use this when the user wants to ' +
|
|
31
|
-
'provide liquidity / add LP / farm / stake / deposit into a pool — natural-language verbs in ' +
|
|
32
|
-
'any language all map here. Resolves the pool by token symbols (and optional fee tier), reads ' +
|
|
33
|
-
"on-chain state, checks the connected wallet's NATIVE balance, then returns a UI payload that " +
|
|
34
|
-
'the FE renders as the form (with two preset ranges: Stable ±3 ticks and Wide -50%/+100%). ' +
|
|
35
|
-
"CONSTRAINT: the gateway only accepts the chain's NATIVE coin as input (ETH on Ethereum/Base/" +
|
|
36
|
-
'Arbitrum/Optimism/Linea, BNB on BSC, MATIC on Polygon, AVAX on Avalanche). The native amount ' +
|
|
37
|
-
'is auto-split via deBridge into both pool tokens — the user never selects a different input. ' +
|
|
38
|
-
'If the user asks to add liquidity using a NON-NATIVE token amount (e.g. "add pool with 5 USDT", ' +
|
|
39
|
-
'"thêm 100 USDC"), pass that symbol via `requestedNonNativeToken` so the tool can return ' +
|
|
40
|
-
'error="unsupported_input_token" — never silently convert their non-native amount into native or USD. ' +
|
|
41
|
-
'PRECONDITION: a connected wallet (userContext.walletAddress). If absent, the tool returns ' +
|
|
42
|
-
'error="wallet_not_connected" and the agent must ask the user to connect.';
|
|
43
|
-
parameters = [
|
|
44
|
-
{
|
|
45
|
-
name: 'token0Symbol',
|
|
46
|
-
type: 'string',
|
|
47
|
-
description: 'Symbol of one of the pool\'s tokens (e.g. "USDC"). Pair order does not matter.',
|
|
48
|
-
required: true,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: 'token1Symbol',
|
|
52
|
-
type: 'string',
|
|
53
|
-
description: 'Symbol of the other pool token (e.g. "WETH"). Required to uniquely identify the pool.',
|
|
54
|
-
required: true,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: 'feeTier',
|
|
58
|
-
type: 'number',
|
|
59
|
-
description: 'Fee tier in basis points: 100 = 0.01%, 500 = 0.05%, 3000 = 0.30%, 10000 = 1.00%. ' +
|
|
60
|
-
'Omit when unknown — the tool will resolve the best match automatically.',
|
|
61
|
-
required: false,
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: 'chain',
|
|
65
|
-
type: 'string',
|
|
66
|
-
description: 'Hex chain ID: "0x1" Ethereum, "0xa" Optimism, "0x38" BSC, "0x89" Polygon, "0x2105" Base, ' +
|
|
67
|
-
'"0xa4b1" Arbitrum, "0xa86a" Avalanche, "0xe708" Linea. ONLY set this when the user EXPLICITLY names a chain; otherwise OMIT it so the connected wallet chain is used.',
|
|
68
|
-
required: false,
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
name: 'prefillNativeAmount',
|
|
72
|
-
type: 'number',
|
|
73
|
-
description: "Optional NATIVE-COIN amount (human-readable) to pre-fill the form's input field. " +
|
|
74
|
-
"ONLY pass this when the user named an amount in the chain's native coin itself — ETH on Ethereum/Base/Arbitrum/Optimism/Linea, " +
|
|
75
|
-
'BNB on BSC, MATIC on Polygon, AVAX on Avalanche. Example: "add 0.1 ETH to USDC/WETH on Base". ' +
|
|
76
|
-
'Pass the plain decimal number (e.g. 0.1 for 0.1 ETH). ' +
|
|
77
|
-
'DO NOT convert a non-native amount (USDC, USDT, DAI, WBTC, …) into native here — pass `requestedNonNativeToken` instead so the tool can reject. ' +
|
|
78
|
-
'Mutually exclusive with prefillUsdAmount — pass one or neither.',
|
|
79
|
-
required: false,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
name: 'prefillUsdAmount',
|
|
83
|
-
type: 'number',
|
|
84
|
-
description: "Optional USD amount to pre-fill the form's input field. " +
|
|
85
|
-
'Use this ONLY when the user explicitly speaks in USD/dollars — e.g. "add $10 to this pool", "10 dollars", "10 đô". ' +
|
|
86
|
-
'The tool converts the USD value to native amount automatically using the current native-token price. ' +
|
|
87
|
-
'DO NOT use this as a workaround for non-native token amounts (e.g. "5 USDT" is NOT $5 — USDT may de-peg, and even if 1:1 the user asked for a token, not USD). ' +
|
|
88
|
-
'For non-native token amounts pass `requestedNonNativeToken` instead. ' +
|
|
89
|
-
'Mutually exclusive with prefillNativeAmount — pass one or neither.',
|
|
90
|
-
required: false,
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: 'requestedNonNativeToken',
|
|
94
|
-
type: 'string',
|
|
95
|
-
description: 'Set this ONLY when the user named an AMOUNT in a non-native token — e.g. "add pool with 5 USDT", ' +
|
|
96
|
-
'"add 100 USDC to USDC/WETH", "thêm 5 USDT vào pool". The trigger is "<number> <non-native-symbol>" in the user\'s message, ' +
|
|
97
|
-
'NOT the mere appearance of the symbol. Pass the symbol the user attached the amount to (e.g. "USDT", "USDC", "DAI"). ' +
|
|
98
|
-
'CRITICAL: If the user also names a NATIVE amount in the same message (e.g. "add USDC/WETH with 0.1 ETH", ' +
|
|
99
|
-
'"thêm pool USDC/WETH 0.3% với 0.000005 ETH"), the native amount is the input — leave this EMPTY and use prefillNativeAmount. ' +
|
|
100
|
-
'The pool pair symbols (the two tokens after "pool" / "to") are NEVER the input token by themselves — they only identify which pool. ' +
|
|
101
|
-
'The tool will return error="unsupported_input_token" so the agent can tell the user that only the chain\'s native coin ' +
|
|
102
|
-
"is accepted as input. DO NOT silently convert the user's non-native amount into a native amount or USD amount — " +
|
|
103
|
-
'the user explicitly named a different asset and must be informed, not auto-corrected. ' +
|
|
104
|
-
'Leave empty when the user did name a native amount, a USD amount, or no amount at all.',
|
|
105
|
-
required: false,
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
name: 'rangeStrategy',
|
|
109
|
-
type: 'string',
|
|
110
|
-
description: 'Optional preset that pre-fills the min/max price inputs (FE keeps them editable). One of: ' +
|
|
111
|
-
'"stable" — ±3 tickSpacing around the current price (narrow, higher yield, higher out-of-range risk; pick for stablecoin / low-volatility pairs and when the user says "safe", "tight", "high yield", "tập trung"); ' +
|
|
112
|
-
'"wide" — currentPrice × [0.5, 2.0] (broad, lower yield, less rebalancing; pick when the user says "wide", "set and forget", "rộng"); ' +
|
|
113
|
-
'"full" — full V3 tick range (V2-style, lowest yield, never goes out of range; pick when the user says "full range", "v2-style", "không lo out of range"). ' +
|
|
114
|
-
'Omit when the user did not signal a preference AND did not provide explicit minPrice/maxPrice. ' +
|
|
115
|
-
'Mutually exclusive with minPrice/maxPrice — if both are passed, explicit prices win.',
|
|
116
|
-
required: false,
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
name: 'minPrice',
|
|
120
|
-
type: 'number',
|
|
121
|
-
description: 'Optional explicit lower bound for the price range, in token1-per-token0 units ' +
|
|
122
|
-
'(same unit as pool.currentPrice — decimal-adjusted). ' +
|
|
123
|
-
'Pass when the user named a concrete number, e.g. "range 1800 to 2200" → minPrice=1800. ' +
|
|
124
|
-
'Must be paired with maxPrice. When set, overrides rangeStrategy.',
|
|
125
|
-
required: false,
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
name: 'maxPrice',
|
|
129
|
-
type: 'number',
|
|
130
|
-
description: 'Optional explicit upper bound for the price range, in token1-per-token0 units ' +
|
|
131
|
-
'(same unit as pool.currentPrice — decimal-adjusted). ' +
|
|
132
|
-
'Pass when the user named a concrete number, e.g. "range 1800 to 2200" → maxPrice=2200. ' +
|
|
133
|
-
'Must be paired with minPrice. When set, overrides rangeStrategy.',
|
|
134
|
-
required: false,
|
|
135
|
-
},
|
|
136
|
-
];
|
|
137
|
-
uniswap;
|
|
138
|
-
pool;
|
|
139
|
-
minProvideUsd;
|
|
140
|
-
constructor(config) {
|
|
141
|
-
super();
|
|
142
|
-
this.uniswap = new UniswapService_1.UniswapService(config);
|
|
143
|
-
this.pool = new PoolService_1.PoolService(config?.pool);
|
|
144
|
-
this.minProvideUsd = config?.minProvideUsd ?? 0.01;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Override execute to forward our `ui` payload from `run()` into the
|
|
148
|
-
* ToolResult envelope (BaseTool only copies `data`).
|
|
149
|
-
*/
|
|
150
|
-
async execute(args, userContext) {
|
|
151
|
-
const callId = `call_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
152
|
-
const start = Date.now();
|
|
153
|
-
try {
|
|
154
|
-
const out = (await this.run(args, userContext));
|
|
155
|
-
const result = {
|
|
156
|
-
toolName: this.name,
|
|
157
|
-
callId,
|
|
158
|
-
success: true,
|
|
159
|
-
data: out,
|
|
160
|
-
duration: Date.now() - start,
|
|
161
|
-
};
|
|
162
|
-
if (out && typeof out === 'object' && out.ui) {
|
|
163
|
-
result.ui = out.ui;
|
|
164
|
-
}
|
|
165
|
-
return result;
|
|
166
|
-
}
|
|
167
|
-
catch (err) {
|
|
168
|
-
return {
|
|
169
|
-
toolName: this.name,
|
|
170
|
-
callId,
|
|
171
|
-
success: false,
|
|
172
|
-
error: err instanceof Error ? err.message : String(err),
|
|
173
|
-
duration: Date.now() - start,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
async run(args, userContext) {
|
|
178
|
-
const chain = (0, chainResolver_1.resolveChain)(args.chain, userContext);
|
|
179
|
-
const token0Symbol = typeof args.token0Symbol === 'string' ? args.token0Symbol.trim() : '';
|
|
180
|
-
const token1Symbol = typeof args.token1Symbol === 'string' ? args.token1Symbol.trim() : '';
|
|
181
|
-
const feeTier = typeof args.feeTier === 'number' && Number.isFinite(args.feeTier) ? Math.floor(args.feeTier) : undefined;
|
|
182
|
-
const prefillNativeAmountInput = typeof args.prefillNativeAmount === 'number' &&
|
|
183
|
-
Number.isFinite(args.prefillNativeAmount) &&
|
|
184
|
-
args.prefillNativeAmount > 0
|
|
185
|
-
? args.prefillNativeAmount
|
|
186
|
-
: null;
|
|
187
|
-
const prefillUsdAmount = typeof args.prefillUsdAmount === 'number' && Number.isFinite(args.prefillUsdAmount) && args.prefillUsdAmount > 0
|
|
188
|
-
? args.prefillUsdAmount
|
|
189
|
-
: null;
|
|
190
|
-
const requestedNonNativeTokenRaw = typeof args.requestedNonNativeToken === 'string' && args.requestedNonNativeToken.trim()
|
|
191
|
-
? args.requestedNonNativeToken.trim()
|
|
192
|
-
: null;
|
|
193
|
-
// Guard: when the LLM sets requestedNonNativeToken to one of the pair
|
|
194
|
-
// symbols AND the user also named a native amount (prefillNativeAmount),
|
|
195
|
-
// it's almost certainly a misfire — the symbol came from the pool name,
|
|
196
|
-
// not from an input amount. Drop it so the flow proceeds normally.
|
|
197
|
-
const requestedNonNativeToken = requestedNonNativeTokenRaw &&
|
|
198
|
-
prefillNativeAmountInput != null &&
|
|
199
|
-
(requestedNonNativeTokenRaw.toLowerCase() === token0Symbol.toLowerCase() ||
|
|
200
|
-
requestedNonNativeTokenRaw.toLowerCase() === token1Symbol.toLowerCase())
|
|
201
|
-
? null
|
|
202
|
-
: requestedNonNativeTokenRaw;
|
|
203
|
-
const rangeStrategy = this.parseRangeStrategy(args.rangeStrategy);
|
|
204
|
-
const explicitMinPrice = typeof args.minPrice === 'number' && Number.isFinite(args.minPrice) && args.minPrice > 0 ? args.minPrice : null;
|
|
205
|
-
const explicitMaxPrice = typeof args.maxPrice === 'number' && Number.isFinite(args.maxPrice) && args.maxPrice > 0 ? args.maxPrice : null;
|
|
206
|
-
if (!token0Symbol || !token1Symbol) {
|
|
207
|
-
return {
|
|
208
|
-
error: 'missing_pool_identifier',
|
|
209
|
-
_instructions: 'token0Symbol and token1Symbol are required. Ask the user for the missing token symbol.',
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
const meta = (0, PoolService_1.getChainMeta)(chain);
|
|
213
|
-
if (!meta) {
|
|
214
|
-
return {
|
|
215
|
-
error: 'unsupported_chain',
|
|
216
|
-
chain,
|
|
217
|
-
_instructions: `Chain ${chain} is not supported by the add-liquidity flow.`,
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
const nativeMeta = (0, PoolService_1.getNativeTokenInfo)(chain);
|
|
221
|
-
if (requestedNonNativeToken &&
|
|
222
|
-
nativeMeta &&
|
|
223
|
-
requestedNonNativeToken.toLowerCase() !== nativeMeta.symbol.toLowerCase()) {
|
|
224
|
-
return {
|
|
225
|
-
error: 'unsupported_input_token',
|
|
226
|
-
requestedToken: requestedNonNativeToken,
|
|
227
|
-
nativeSymbol: nativeMeta.symbol,
|
|
228
|
-
chainName: meta.name,
|
|
229
|
-
_instructions: `The user asked to add liquidity using ${requestedNonNativeToken}, but this app only supports the chain's native coin ` +
|
|
230
|
-
`(${nativeMeta.symbol} on ${meta.name}) as the input. Tell the user this in their language and ask them to either ` +
|
|
231
|
-
`restate the amount in ${nativeMeta.symbol} or in USD. DO NOT silently convert their ${requestedNonNativeToken} amount, ` +
|
|
232
|
-
`do NOT pre-fill the form, and do NOT call this tool again until the user provides a native or USD amount.`,
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
const gateway = await this.pool.getGatewayAddress(chain);
|
|
236
|
-
if (!gateway) {
|
|
237
|
-
return {
|
|
238
|
-
error: 'no_gateway_configured',
|
|
239
|
-
chain,
|
|
240
|
-
_instructions: `No gateway contract is configured for chain ${chain} (${meta.name}). ` +
|
|
241
|
-
'Tell the user this chain is not yet supported for add-liquidity in this app.',
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
const walletAddress = userContext?.walletAddress;
|
|
245
|
-
if (!walletAddress) {
|
|
246
|
-
return {
|
|
247
|
-
error: 'wallet_not_connected',
|
|
248
|
-
_instructions: 'The user is not connected. Ask them to connect their wallet before adding liquidity. Do NOT render the form.',
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
// ---- Step 1: resolve pool address via search ----
|
|
252
|
-
const search = await this.uniswap.searchPools({
|
|
253
|
-
query: `${token0Symbol} ${token1Symbol}`,
|
|
254
|
-
chain,
|
|
255
|
-
page: 1,
|
|
256
|
-
size: 100,
|
|
257
|
-
protocolVersion: 'V3',
|
|
258
|
-
feeTier,
|
|
259
|
-
});
|
|
260
|
-
if (!search.success) {
|
|
261
|
-
return { error: search.error || 'pool_search_failed' };
|
|
262
|
-
}
|
|
263
|
-
const all = search.data ?? [];
|
|
264
|
-
// ---- Step 2: resolve a single pool from the results ----
|
|
265
|
-
// Priority: exact symbol match → single fuzzy match → ask user to pick.
|
|
266
|
-
const exactMatch = all.find((p) => this.matchesPairExact(p, token0Symbol, token1Symbol, feeTier));
|
|
267
|
-
const fuzzyMatches = exactMatch ? [] : all.filter((p) => this.matchesPair(p, token0Symbol, token1Symbol, feeTier));
|
|
268
|
-
if (!exactMatch && fuzzyMatches.length === 0) {
|
|
269
|
-
return {
|
|
270
|
-
error: 'pool_not_found',
|
|
271
|
-
_instructions: `No V3 pool found for ${token0Symbol}/${token1Symbol}${feeTier != null ? ` at ${feeTier}bps` : ''} on ${meta.name}. Verify the inputs with the user.`,
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
if (!exactMatch && fuzzyMatches.length > 1) {
|
|
275
|
-
return {
|
|
276
|
-
candidates: fuzzyMatches.map((p) => ({
|
|
277
|
-
address: p.id,
|
|
278
|
-
token0Symbol: p.token0?.symbol,
|
|
279
|
-
token1Symbol: p.token1?.symbol,
|
|
280
|
-
feeTier: p.feeTier,
|
|
281
|
-
feeTierPercent: p.feeTier != null ? p.feeTier / 10_000 : undefined,
|
|
282
|
-
volume24hUsd: p.volume1DayUsd ?? p.volumeUsd24hr,
|
|
283
|
-
tvlUsd: p.tvlUsd,
|
|
284
|
-
...(p.apr ? { apr: p.apr } : undefined),
|
|
285
|
-
})),
|
|
286
|
-
_instructions: 'Multiple pools matched. Present them as a numbered list (pair, fee %, TVL, 24h volume, address, apr) ' +
|
|
287
|
-
"and ask the user to pick one. Then re-call this tool with the chosen pool's exact token0Symbol, token1Symbol, and feeTier.",
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
// Exactly one match (exact or single fuzzy) — proceed.
|
|
291
|
-
const candidate = exactMatch ?? fuzzyMatches[0];
|
|
292
|
-
if (!candidate.id || !EVM_ADDRESS_RE.test(candidate.id)) {
|
|
293
|
-
return { error: 'invalid_pool_address' };
|
|
294
|
-
}
|
|
295
|
-
// ---- Step 2: read on-chain state ----
|
|
296
|
-
const onchain = await this.pool.readPoolOnchain(chain, candidate.id);
|
|
297
|
-
// ---- Step 3: balance + gas + price ----
|
|
298
|
-
const [balanceWei, gasReserveWei, nativePriceUsd] = await Promise.all([
|
|
299
|
-
this.pool.getNativeBalance(chain, walletAddress),
|
|
300
|
-
this.pool.estimateGasReserveWei(chain),
|
|
301
|
-
this.pool.getNativePriceUsd(chain),
|
|
302
|
-
]);
|
|
303
|
-
const spendableWei = balanceWei > gasReserveWei ? balanceWei - gasReserveWei : 0n;
|
|
304
|
-
const native = (0, PoolService_1.getNativeTokenInfo)(chain);
|
|
305
|
-
const spendable = Number(spendableWei) / 10 ** native.decimals;
|
|
306
|
-
const balance = Number(balanceWei) / 10 ** native.decimals;
|
|
307
|
-
const spendableUsd = nativePriceUsd != null ? spendable * nativePriceUsd : null;
|
|
308
|
-
// ---- Step 4: token decimals + price-input bounds ----
|
|
309
|
-
// The form lets the user TYPE a min/max price (token1 per token0). Compute
|
|
310
|
-
// the absolute decimal-adjusted window that maps to the V3 valid tick range,
|
|
311
|
-
// so the FE can clamp inputs and show a sane upper limit.
|
|
312
|
-
const [token0Decimals, token1Decimals] = await Promise.all([
|
|
313
|
-
this.pool.readErc20Decimals(chain, onchain.token0),
|
|
314
|
-
this.pool.readErc20Decimals(chain, onchain.token1),
|
|
315
|
-
]);
|
|
316
|
-
const priceBounds = {
|
|
317
|
-
min: (0, PoolService_1.tickToPrice)(pool_1.MIN_TICK, token0Decimals, token1Decimals),
|
|
318
|
-
max: (0, PoolService_1.tickToPrice)(pool_1.MAX_TICK, token0Decimals, token1Decimals),
|
|
319
|
-
};
|
|
320
|
-
// ---- Step 5: warning ----
|
|
321
|
-
let warning = null;
|
|
322
|
-
if (balanceWei === 0n) {
|
|
323
|
-
warning = 'no_balance';
|
|
324
|
-
}
|
|
325
|
-
else if (spendableUsd != null && spendableUsd < this.minProvideUsd) {
|
|
326
|
-
warning = 'insufficient_balance';
|
|
327
|
-
}
|
|
328
|
-
// ---- Step 6: candidate token info from search payload (icons/symbols) ----
|
|
329
|
-
const t0Info = candidate.token0;
|
|
330
|
-
const t1Info = candidate.token1;
|
|
331
|
-
// ---- Step 7: input-token block — self-contained for the FE input field ----
|
|
332
|
-
// Everything the FE needs to render the "amount in" input lives here:
|
|
333
|
-
// identity, decimals, price, balance, gas reserve, spendable, quick-pick
|
|
334
|
-
// rates (25/50/75/100% of spendable), USD value, warning, and an optional
|
|
335
|
-
// pre-fill amount (when the user named an amount before picking the pool).
|
|
336
|
-
const quickRates = [25, 50, 75, 100].map((pct) => ({
|
|
337
|
-
percent: pct,
|
|
338
|
-
amountWei: ((spendableWei * BigInt(pct)) / 100n).toString(),
|
|
339
|
-
amount: spendable * (pct / 100),
|
|
340
|
-
}));
|
|
341
|
-
let prefillAmountWei = null;
|
|
342
|
-
let prefillAmount = null;
|
|
343
|
-
if (prefillNativeAmountInput != null) {
|
|
344
|
-
prefillAmount = prefillNativeAmountInput;
|
|
345
|
-
const weiBig = BigInt(Math.floor(prefillAmount * 10 ** native.decimals));
|
|
346
|
-
if (weiBig > 0n)
|
|
347
|
-
prefillAmountWei = weiBig.toString();
|
|
348
|
-
}
|
|
349
|
-
else if (prefillUsdAmount != null && nativePriceUsd != null && nativePriceUsd > 0) {
|
|
350
|
-
prefillAmount = prefillUsdAmount / nativePriceUsd;
|
|
351
|
-
const weiBig = BigInt(Math.floor(prefillAmount * 10 ** native.decimals));
|
|
352
|
-
if (weiBig > 0n)
|
|
353
|
-
prefillAmountWei = weiBig.toString();
|
|
354
|
-
}
|
|
355
|
-
const inputToken = {
|
|
356
|
-
address: PoolService_1.ZERO_ADDRESS,
|
|
357
|
-
isNative: true,
|
|
358
|
-
symbol: native.symbol,
|
|
359
|
-
name: native.name,
|
|
360
|
-
decimals: native.decimals,
|
|
361
|
-
priceUsd: nativePriceUsd,
|
|
362
|
-
balanceWei: balanceWei.toString(),
|
|
363
|
-
balance,
|
|
364
|
-
gasReserveWei: gasReserveWei.toString(),
|
|
365
|
-
spendableWei: spendableWei.toString(),
|
|
366
|
-
spendable,
|
|
367
|
-
spendableUsd,
|
|
368
|
-
quickRates,
|
|
369
|
-
minProvideUsd: this.minProvideUsd,
|
|
370
|
-
warning,
|
|
371
|
-
warningMessage: warning === 'no_balance'
|
|
372
|
-
? `You have no ${native.symbol} on ${meta.name}. Top up to add liquidity.`
|
|
373
|
-
: warning === 'insufficient_balance'
|
|
374
|
-
? `Spendable ${native.symbol} is below the $${this.minProvideUsd} minimum.`
|
|
375
|
-
: null,
|
|
376
|
-
prefillAmount,
|
|
377
|
-
prefillAmountWei,
|
|
378
|
-
};
|
|
379
|
-
// ---- Step 8: price-range prefill — explicit prices win over strategy presets ----
|
|
380
|
-
const prefillRange = this.computePrefillRange({
|
|
381
|
-
explicitMinPrice,
|
|
382
|
-
explicitMaxPrice,
|
|
383
|
-
rangeStrategy,
|
|
384
|
-
currentTick: onchain.currentTick,
|
|
385
|
-
tickSpacing: onchain.tickSpacing,
|
|
386
|
-
token0Decimals,
|
|
387
|
-
token1Decimals,
|
|
388
|
-
priceBounds,
|
|
389
|
-
});
|
|
390
|
-
const props = {
|
|
391
|
-
chain: { hexId: chain, name: meta.name },
|
|
392
|
-
pool: {
|
|
393
|
-
address: onchain.poolAddress,
|
|
394
|
-
fee: onchain.fee,
|
|
395
|
-
feePercent: onchain.fee / 10_000,
|
|
396
|
-
tickSpacing: onchain.tickSpacing,
|
|
397
|
-
currentTick: onchain.currentTick,
|
|
398
|
-
currentPrice: onchain.currentPrice,
|
|
399
|
-
sqrtPriceX96: onchain.sqrtPriceX96.toString(),
|
|
400
|
-
token0: {
|
|
401
|
-
address: onchain.token0,
|
|
402
|
-
symbol: t0Info?.symbol,
|
|
403
|
-
name: t0Info?.name,
|
|
404
|
-
logo: t0Info?.logo,
|
|
405
|
-
},
|
|
406
|
-
token1: {
|
|
407
|
-
address: onchain.token1,
|
|
408
|
-
symbol: t1Info?.symbol,
|
|
409
|
-
name: t1Info?.name,
|
|
410
|
-
logo: t1Info?.logo,
|
|
411
|
-
},
|
|
412
|
-
},
|
|
413
|
-
inputToken,
|
|
414
|
-
priceBounds,
|
|
415
|
-
prefillRange,
|
|
416
|
-
gatewayAddress: gateway,
|
|
417
|
-
};
|
|
418
|
-
const ui = { component: 'AddLiquidityForm', props };
|
|
419
|
-
return {
|
|
420
|
-
ui,
|
|
421
|
-
summary: this.buildSummary({
|
|
422
|
-
chainName: meta.name,
|
|
423
|
-
pair: `${t0Info?.symbol ?? token0Symbol}/${t1Info?.symbol ?? token1Symbol}`,
|
|
424
|
-
feePercent: onchain.fee / 10_000,
|
|
425
|
-
warning,
|
|
426
|
-
minProvideUsd: this.minProvideUsd,
|
|
427
|
-
nativeSymbol: native.symbol,
|
|
428
|
-
}),
|
|
429
|
-
_instructions: "The add-liquidity action is ready. In the user's language, invite them to enter the amount and price range to add liquidity, " +
|
|
430
|
-
'naming the pool + chain (e.g. "Enter the amount and price range to add liquidity to <pool> on <chain>"). ' +
|
|
431
|
-
'If warning="no_balance" tell them they need to top up. ' +
|
|
432
|
-
'If warning="insufficient_balance" tell them the balance is below the minimum. ' +
|
|
433
|
-
'Do NOT mention balance amounts, deBridge, native coin mechanics, UI, forms, or internal tool names. ' +
|
|
434
|
-
'Wait for the user to fill in amount + price range before proceeding.',
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
matchesPairExact(p, sym0, sym1, fee) {
|
|
438
|
-
if (!fee)
|
|
439
|
-
return false;
|
|
440
|
-
if (fee != null && p.feeTier !== fee)
|
|
441
|
-
return false;
|
|
442
|
-
const a = (p.token0?.symbol ?? '').toLowerCase();
|
|
443
|
-
const b = (p.token1?.symbol ?? '').toLowerCase();
|
|
444
|
-
const x = sym0.toLowerCase();
|
|
445
|
-
const y = sym1.toLowerCase();
|
|
446
|
-
return (a === x && b === y) || (a === y && b === x);
|
|
447
|
-
}
|
|
448
|
-
matchesPair(p, sym0, sym1, fee) {
|
|
449
|
-
if (fee != null && p.feeTier !== fee)
|
|
450
|
-
return false;
|
|
451
|
-
const a = (p.token0?.symbol ?? '').toLowerCase();
|
|
452
|
-
const b = (p.token1?.symbol ?? '').toLowerCase();
|
|
453
|
-
const x = sym0.toLowerCase();
|
|
454
|
-
const y = sym1.toLowerCase();
|
|
455
|
-
const ordered = this.symMatch(a, x) && this.symMatch(b, y);
|
|
456
|
-
const reversed = this.symMatch(a, y) && this.symMatch(b, x);
|
|
457
|
-
return ordered || reversed;
|
|
458
|
-
}
|
|
459
|
-
symMatch(poolSym, userSym) {
|
|
460
|
-
if (!poolSym || !userSym)
|
|
461
|
-
return false;
|
|
462
|
-
return poolSym.includes(userSym) || userSym.includes(poolSym);
|
|
463
|
-
}
|
|
464
|
-
parseRangeStrategy(value) {
|
|
465
|
-
if (typeof value !== 'string')
|
|
466
|
-
return null;
|
|
467
|
-
const v = value.trim().toLowerCase();
|
|
468
|
-
if (v === 'stable' || v === 'wide' || v === 'full')
|
|
469
|
-
return v;
|
|
470
|
-
return null;
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* Decide which (minPrice, maxPrice) to prefill in the form. Order:
|
|
474
|
-
* 1. Explicit minPrice + maxPrice (user-supplied numbers) — clamp to priceBounds.
|
|
475
|
-
* 2. rangeStrategy = "stable" → buildRangePresets() stable preset.
|
|
476
|
-
* 3. rangeStrategy = "wide" → buildRangePresets() wide preset.
|
|
477
|
-
* 4. rangeStrategy = "full" → priceBounds.min / priceBounds.max.
|
|
478
|
-
* 5. nothing → null (FE shows empty inputs + preset chips like before).
|
|
479
|
-
*
|
|
480
|
-
* The FE keeps the inputs editable in all cases — this is just a pre-fill.
|
|
481
|
-
*/
|
|
482
|
-
computePrefillRange(input) {
|
|
483
|
-
const { explicitMinPrice, explicitMaxPrice, rangeStrategy, priceBounds } = input;
|
|
484
|
-
if (explicitMinPrice != null && explicitMaxPrice != null && explicitMaxPrice > explicitMinPrice) {
|
|
485
|
-
return {
|
|
486
|
-
strategy: 'user',
|
|
487
|
-
minPrice: Math.max(explicitMinPrice, priceBounds.min),
|
|
488
|
-
maxPrice: Math.min(explicitMaxPrice, priceBounds.max),
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
if (rangeStrategy === 'full') {
|
|
492
|
-
return { strategy: 'full', minPrice: priceBounds.min, maxPrice: priceBounds.max };
|
|
493
|
-
}
|
|
494
|
-
if (rangeStrategy === 'stable' || rangeStrategy === 'wide') {
|
|
495
|
-
const presets = (0, PoolService_1.buildRangePresets)({
|
|
496
|
-
currentTick: input.currentTick,
|
|
497
|
-
tickSpacing: input.tickSpacing,
|
|
498
|
-
token0Decimals: input.token0Decimals,
|
|
499
|
-
token1Decimals: input.token1Decimals,
|
|
500
|
-
});
|
|
501
|
-
const preset = presets.find((p) => p.id === rangeStrategy);
|
|
502
|
-
if (preset) {
|
|
503
|
-
return { strategy: rangeStrategy, minPrice: preset.minPrice, maxPrice: preset.maxPrice };
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
return null;
|
|
507
|
-
}
|
|
508
|
-
buildSummary(args) {
|
|
509
|
-
const parts = [`Add-liquidity form opened for ${args.pair} ${args.feePercent}% on ${args.chainName}.`];
|
|
510
|
-
if (args.warning === 'no_balance') {
|
|
511
|
-
parts.push(`No ${args.nativeSymbol} balance — top up the wallet to add liquidity.`);
|
|
512
|
-
}
|
|
513
|
-
else if (args.warning === 'insufficient_balance') {
|
|
514
|
-
parts.push(`Balance is below the $${args.minProvideUsd} minimum — top up before submitting.`);
|
|
515
|
-
}
|
|
516
|
-
return parts.join(' ');
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
exports.OpenAddLiquidityFormTool = OpenAddLiquidityFormTool;
|
|
520
|
-
//# sourceMappingURL=OpenAddLiquidityFormTool.js.map
|