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,265 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WalletNftTransfersTool = void 0;
|
|
4
|
-
const BaseTool_1 = require("../../BaseTool");
|
|
5
|
-
const chainResolver_1 = require("../../chainResolver");
|
|
6
|
-
const MoralisService_1 = require("../../../services/MoralisService");
|
|
7
|
-
/**
|
|
8
|
-
* Tool: get-wallet-nft-transfers
|
|
9
|
-
*
|
|
10
|
-
* Queries the dedicated Moralis NFT transfer endpoint
|
|
11
|
-
* `GET /{address}/nft/transfers`, which returns every NFT transfer involving
|
|
12
|
-
* the wallet — optionally scoped to specific NFT contract addresses.
|
|
13
|
-
*
|
|
14
|
-
* Each item is enriched with:
|
|
15
|
-
* - `direction`: "send" or "receive" (from from_address vs wallet)
|
|
16
|
-
* - `counterparty`: the other address with optional label/entity
|
|
17
|
-
* - `last_sale`: purchase price data if `includePrices=true`
|
|
18
|
-
*
|
|
19
|
-
* The response includes a `counterparties` aggregation with token IDs,
|
|
20
|
-
* collections, and timestamps for each unique sender/recipient.
|
|
21
|
-
*/
|
|
22
|
-
class WalletNftTransfersTool extends BaseTool_1.BaseTool {
|
|
23
|
-
name = 'get-wallet-nft-transfers';
|
|
24
|
-
description = 'Get all NFT transfers for a wallet from the dedicated Moralis NFT transfers endpoint. ' +
|
|
25
|
-
'Each transfer includes direction (send/receive), the exact counterparty address, token ID, collection, contract type (ERC721/ERC1155), and optional last sale price. ' +
|
|
26
|
-
"The response includes a 'counterparties' section aggregating unique senders/recipients with token IDs and collections. " +
|
|
27
|
-
'Use this tool for questions like: ' +
|
|
28
|
-
'"Which NFTs did I sell and to whom?" (direction=send), ' +
|
|
29
|
-
'"Who sent me NFTs from collection 0x…?" (contractAddresses=[0x…], direction=receive), ' +
|
|
30
|
-
'"Show all transfers for my NFT collection 0x…" (contractAddresses=[0x…]), ' +
|
|
31
|
-
'"What NFTs did I mint?" (direction=receive), ' +
|
|
32
|
-
'"Show NFT sales with prices" (direction=send, includePrices=true). ' +
|
|
33
|
-
'Supports: Ethereum, Optimism, BSC, Polygon, Base, Arbitrum, Avalanche, Linea. ' +
|
|
34
|
-
'Returns paginated results — pass cursor to get the next page.';
|
|
35
|
-
category = 'blockchain-data';
|
|
36
|
-
parameters = [
|
|
37
|
-
{
|
|
38
|
-
name: 'address',
|
|
39
|
-
type: 'string',
|
|
40
|
-
description: 'EVM wallet address (0x…). If omitted, uses the connected wallet from user context.',
|
|
41
|
-
required: false,
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'chain',
|
|
45
|
-
type: 'string',
|
|
46
|
-
description: 'Hex chain ID: "0x1" Ethereum, "0xa" Optimism, "0x38" BSC, "0x89" Polygon, "0x2105" Base, ' +
|
|
47
|
-
'"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.',
|
|
48
|
-
required: false,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: 'contractAddresses',
|
|
52
|
-
type: 'array',
|
|
53
|
-
description: 'Filter by one or more NFT contract addresses (0x…). ' +
|
|
54
|
-
'Use this to scope queries to a specific collection. Omit to return all NFT transfers.',
|
|
55
|
-
required: false,
|
|
56
|
-
items: { type: 'string' },
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: 'direction',
|
|
60
|
-
type: 'string',
|
|
61
|
-
description: 'Client-side direction filter: "send" (wallet sent the NFT), "receive" (wallet received it), "all" (default).',
|
|
62
|
-
required: false,
|
|
63
|
-
default: 'all',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: 'limit',
|
|
67
|
-
type: 'number',
|
|
68
|
-
description: 'Page size (1-100, default 25).',
|
|
69
|
-
required: false,
|
|
70
|
-
default: 25,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: 'fromDate',
|
|
74
|
-
type: 'string',
|
|
75
|
-
description: 'Inclusive start date (ISO-8601 or "YYYY-MM-DD").',
|
|
76
|
-
required: false,
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: 'toDate',
|
|
80
|
-
type: 'string',
|
|
81
|
-
description: 'Inclusive end date (ISO-8601 or "YYYY-MM-DD").',
|
|
82
|
-
required: false,
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: 'fromBlock',
|
|
86
|
-
type: 'number',
|
|
87
|
-
description: 'Minimum block number.',
|
|
88
|
-
required: false,
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: 'toBlock',
|
|
92
|
-
type: 'number',
|
|
93
|
-
description: 'Maximum block number.',
|
|
94
|
-
required: false,
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: 'cursor',
|
|
98
|
-
type: 'string',
|
|
99
|
-
description: 'Pagination cursor from a previous response.',
|
|
100
|
-
required: false,
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: 'order',
|
|
104
|
-
type: 'string',
|
|
105
|
-
description: '"DESC" newest first (default) or "ASC" oldest first.',
|
|
106
|
-
required: false,
|
|
107
|
-
default: 'DESC',
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: 'includePrices',
|
|
111
|
-
type: 'boolean',
|
|
112
|
-
description: 'If true, include last_sale price data (buyer, seller, price, USD value, payment token) on each transfer. ' +
|
|
113
|
-
'Useful for questions about NFT sale prices.',
|
|
114
|
-
required: false,
|
|
115
|
-
},
|
|
116
|
-
];
|
|
117
|
-
service;
|
|
118
|
-
constructor(config) {
|
|
119
|
-
super();
|
|
120
|
-
this.service = new MoralisService_1.MoralisService(config);
|
|
121
|
-
}
|
|
122
|
-
async run(args, userContext) {
|
|
123
|
-
const address = args.address || userContext?.walletAddress || undefined;
|
|
124
|
-
const chain = (0, chainResolver_1.resolveChain)(args.chain, userContext);
|
|
125
|
-
if (!address) {
|
|
126
|
-
return { error: 'No wallet address available. Please connect a wallet or pass "address".' };
|
|
127
|
-
}
|
|
128
|
-
const rawLimit = typeof args.limit === 'number' ? args.limit : Number(args.limit);
|
|
129
|
-
const limit = Number.isFinite(rawLimit) && rawLimit > 0 ? Math.min(100, Math.floor(rawLimit)) : 25;
|
|
130
|
-
const fromDate = typeof args.fromDate === 'string' && args.fromDate ? args.fromDate : undefined;
|
|
131
|
-
const toDate = typeof args.toDate === 'string' && args.toDate ? args.toDate : undefined;
|
|
132
|
-
const fromBlock = this.parseBlock(args.fromBlock);
|
|
133
|
-
const toBlock = this.parseBlock(args.toBlock);
|
|
134
|
-
const cursor = typeof args.cursor === 'string' && args.cursor ? args.cursor : undefined;
|
|
135
|
-
const rawOrder = typeof args.order === 'string' ? args.order.toUpperCase() : '';
|
|
136
|
-
const order = rawOrder === 'ASC' ? 'ASC' : 'DESC';
|
|
137
|
-
const includePrices = typeof args.includePrices === 'boolean' ? args.includePrices : undefined;
|
|
138
|
-
const rawDir = typeof args.direction === 'string' ? args.direction.trim().toLowerCase() : 'all';
|
|
139
|
-
const direction = rawDir === 'send' ? 'send' : rawDir === 'receive' ? 'receive' : 'all';
|
|
140
|
-
const contractAddresses = Array.isArray(args.contractAddresses)
|
|
141
|
-
? args.contractAddresses
|
|
142
|
-
.filter((c) => typeof c === 'string' && !!c)
|
|
143
|
-
.map((c) => c.trim())
|
|
144
|
-
: undefined;
|
|
145
|
-
const result = await this.service.getWalletNftTransfers({
|
|
146
|
-
address,
|
|
147
|
-
chain,
|
|
148
|
-
contractAddresses,
|
|
149
|
-
limit,
|
|
150
|
-
fromDate,
|
|
151
|
-
toDate,
|
|
152
|
-
fromBlock,
|
|
153
|
-
toBlock,
|
|
154
|
-
cursor,
|
|
155
|
-
order,
|
|
156
|
-
includePrices,
|
|
157
|
-
});
|
|
158
|
-
if (!result.success) {
|
|
159
|
-
return { error: result.error || 'Failed to fetch NFT transfers' };
|
|
160
|
-
}
|
|
161
|
-
const walletLower = address.toLowerCase();
|
|
162
|
-
const rawItems = result.data?.result || [];
|
|
163
|
-
// Enrich with direction and counterparty
|
|
164
|
-
const allEnriched = rawItems.map((nft) => {
|
|
165
|
-
const isSend = nft.from_address.toLowerCase() === walletLower;
|
|
166
|
-
const dir = isSend ? 'send' : 'receive';
|
|
167
|
-
const counterparty = isSend ? nft.to_address : nft.from_address;
|
|
168
|
-
const counterpartyLabel = isSend ? (nft.to_address_label ?? undefined) : (nft.from_address_label ?? undefined);
|
|
169
|
-
const counterpartyEntity = isSend ? (nft.to_address_entity ?? undefined) : (nft.from_address_entity ?? undefined);
|
|
170
|
-
return {
|
|
171
|
-
...nft,
|
|
172
|
-
direction: dir,
|
|
173
|
-
counterparty,
|
|
174
|
-
counterparty_label: counterpartyLabel,
|
|
175
|
-
counterparty_entity: counterpartyEntity,
|
|
176
|
-
};
|
|
177
|
-
});
|
|
178
|
-
// Apply client-side direction filter
|
|
179
|
-
const enriched = direction === 'all' ? allEnriched : allEnriched.filter((t) => t.direction === direction);
|
|
180
|
-
// Build counterparty aggregation
|
|
181
|
-
const counterparties = this.buildCounterparties(enriched);
|
|
182
|
-
return {
|
|
183
|
-
walletAddress: address,
|
|
184
|
-
chain: chain || 'default',
|
|
185
|
-
filters: {
|
|
186
|
-
contractAddresses: contractAddresses || null,
|
|
187
|
-
direction,
|
|
188
|
-
limit,
|
|
189
|
-
order,
|
|
190
|
-
fromDate: fromDate || null,
|
|
191
|
-
toDate: toDate || null,
|
|
192
|
-
fromBlock: fromBlock ?? null,
|
|
193
|
-
toBlock: toBlock ?? null,
|
|
194
|
-
includePrices: includePrices ?? null,
|
|
195
|
-
},
|
|
196
|
-
pagination: {
|
|
197
|
-
cursor: result.data?.cursor ?? null,
|
|
198
|
-
pageSize: result.data?.page_size ?? limit,
|
|
199
|
-
page: result.data?.page ?? null,
|
|
200
|
-
hasMore: !!result.data?.cursor,
|
|
201
|
-
},
|
|
202
|
-
transferCount: enriched.length,
|
|
203
|
-
transfers: enriched,
|
|
204
|
-
counterparties,
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
buildCounterparties(transfers) {
|
|
208
|
-
const sentMap = new Map();
|
|
209
|
-
const receivedMap = new Map();
|
|
210
|
-
for (const t of transfers) {
|
|
211
|
-
const map = t.direction === 'send' ? sentMap : receivedMap;
|
|
212
|
-
const key = t.counterparty.toLowerCase();
|
|
213
|
-
const collection = t.token_name ?? t.token_address;
|
|
214
|
-
const existing = map.get(key);
|
|
215
|
-
if (existing) {
|
|
216
|
-
existing.tokenIds.add(t.token_id);
|
|
217
|
-
existing.collections.add(collection);
|
|
218
|
-
existing.count += 1;
|
|
219
|
-
if (!existing.label && t.counterparty_label)
|
|
220
|
-
existing.label = t.counterparty_label;
|
|
221
|
-
if (!existing.entity && t.counterparty_entity)
|
|
222
|
-
existing.entity = t.counterparty_entity;
|
|
223
|
-
if (t.block_timestamp < existing.first)
|
|
224
|
-
existing.first = t.block_timestamp;
|
|
225
|
-
if (t.block_timestamp > existing.last)
|
|
226
|
-
existing.last = t.block_timestamp;
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
map.set(key, {
|
|
230
|
-
label: t.counterparty_label,
|
|
231
|
-
entity: t.counterparty_entity,
|
|
232
|
-
tokenIds: new Set([t.token_id]),
|
|
233
|
-
collections: new Set([collection]),
|
|
234
|
-
count: 1,
|
|
235
|
-
first: t.block_timestamp,
|
|
236
|
-
last: t.block_timestamp,
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
const toArray = (map) => Array.from(map.entries())
|
|
241
|
-
.sort((a, b) => b[1].count - a[1].count)
|
|
242
|
-
.map(([addr, info]) => ({
|
|
243
|
-
address: addr,
|
|
244
|
-
label: info.label,
|
|
245
|
-
entity: info.entity,
|
|
246
|
-
token_ids: Array.from(info.tokenIds),
|
|
247
|
-
collections: Array.from(info.collections),
|
|
248
|
-
tx_count: info.count,
|
|
249
|
-
first_seen: info.first,
|
|
250
|
-
last_seen: info.last,
|
|
251
|
-
}));
|
|
252
|
-
return { sent: toArray(sentMap), received: toArray(receivedMap) };
|
|
253
|
-
}
|
|
254
|
-
parseBlock(raw) {
|
|
255
|
-
if (typeof raw === 'number')
|
|
256
|
-
return Number.isFinite(raw) ? raw : undefined;
|
|
257
|
-
if (typeof raw === 'string' && raw) {
|
|
258
|
-
const n = Number(raw);
|
|
259
|
-
return Number.isFinite(n) ? n : undefined;
|
|
260
|
-
}
|
|
261
|
-
return undefined;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
exports.WalletNftTransfersTool = WalletNftTransfersTool;
|
|
265
|
-
//# sourceMappingURL=WalletNftTransfersTool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WalletNftTransfersTool.js","sourceRoot":"","sources":["../../../../src/tools/builtin/wallet/WalletNftTransfersTool.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,uDAAmD;AAEnD,qEAI0C;AAwB1C;;;;;;;;;;;;;;GAcG;AACH,MAAa,sBAAuB,SAAQ,mBAAQ;IAClD,IAAI,GAAG,0BAA0B,CAAC;IAClC,WAAW,GACT,wFAAwF;QACxF,uKAAuK;QACvK,yHAAyH;QACzH,oCAAoC;QACpC,yDAAyD;QACzD,wFAAwF;QACxF,4EAA4E;QAC5E,+CAA+C;QAC/C,qEAAqE;QACrE,gFAAgF;QAChF,+DAA+D,CAAC;IAClE,QAAQ,GAAG,iBAAiB,CAAC;IAC7B,UAAU,GAAoB;QAC5B;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,oFAAoF;YACjG,QAAQ,EAAE,KAAK;SAChB;QACD;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,2FAA2F;gBAC3F,wKAAwK;YAC1K,QAAQ,EAAE,KAAK;SAChB;QACD;YACE,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE,OAAO;YACb,WAAW,EACT,sDAAsD;gBACtD,uFAAuF;YACzF,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC1B;QACD;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,8GAA8G;YAChH,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,KAAK;SACf;QACD;YACE,IAAI,EAAE,OAAO;YACb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"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { BaseTool } from '../../BaseTool';
|
|
2
|
-
import type { ToolParameter, UserContext } from '../../../types';
|
|
3
|
-
import { type MoralisServiceConfig, type WalletPnlDaysWindow } from '../../../services/MoralisService';
|
|
4
|
-
export type WalletPnlSummaryToolConfig = MoralisServiceConfig;
|
|
5
|
-
/**
|
|
6
|
-
* Tool: get-wallet-pnl-summary
|
|
7
|
-
*
|
|
8
|
-
* Queries `GET /wallets/{address}/profitability/summary` for an aggregate
|
|
9
|
-
* profit-and-loss view across all tokens the wallet has traded.
|
|
10
|
-
*
|
|
11
|
-
* Mainnet only — supported chains: Ethereum (0x1), Base (0x2105), Polygon (0x89).
|
|
12
|
-
*/
|
|
13
|
-
export declare class WalletPnlSummaryTool extends BaseTool {
|
|
14
|
-
name: string;
|
|
15
|
-
description: string;
|
|
16
|
-
category: string;
|
|
17
|
-
parameters: ToolParameter[];
|
|
18
|
-
private service;
|
|
19
|
-
constructor(config?: WalletPnlSummaryToolConfig);
|
|
20
|
-
protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
|
|
21
|
-
error: string;
|
|
22
|
-
walletAddress?: undefined;
|
|
23
|
-
chain?: undefined;
|
|
24
|
-
days?: undefined;
|
|
25
|
-
summary?: undefined;
|
|
26
|
-
} | {
|
|
27
|
-
walletAddress: string;
|
|
28
|
-
chain: string;
|
|
29
|
-
days: WalletPnlDaysWindow;
|
|
30
|
-
summary: {
|
|
31
|
-
totalCountOfTrades: number;
|
|
32
|
-
totalTradeVolume: string;
|
|
33
|
-
totalRealizedProfitUsd: string;
|
|
34
|
-
totalRealizedProfitPercentage: number;
|
|
35
|
-
totalBuys: number;
|
|
36
|
-
totalSells: number;
|
|
37
|
-
totalBoughtVolumeUsd: string;
|
|
38
|
-
totalSoldVolumeUsd: string;
|
|
39
|
-
};
|
|
40
|
-
error?: undefined;
|
|
41
|
-
}>;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=WalletPnlSummaryTool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WalletPnlSummaryTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/builtin/wallet/WalletPnlSummaryTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAkB,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvH,MAAM,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAI9D;;;;;;;GAOG;AACH,qBAAa,oBAAqB,SAAQ,QAAQ;IAChD,IAAI,SAA4B;IAChC,WAAW,SAWgC;IAC3C,QAAQ,SAAqB;IAC7B,UAAU,EAAE,aAAa,EAAE,CAwBzB;IAEF,OAAO,CAAC,OAAO,CAAiB;gBAEpB,MAAM,CAAC,EAAE,0BAA0B;cAK/B,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;CAmC7E"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WalletPnlSummaryTool = void 0;
|
|
4
|
-
const BaseTool_1 = require("../../BaseTool");
|
|
5
|
-
const chainResolver_1 = require("../../chainResolver");
|
|
6
|
-
const MoralisService_1 = require("../../../services/MoralisService");
|
|
7
|
-
const VALID_DAYS = ['all', '7', '30', '60', '90'];
|
|
8
|
-
/**
|
|
9
|
-
* Tool: get-wallet-pnl-summary
|
|
10
|
-
*
|
|
11
|
-
* Queries `GET /wallets/{address}/profitability/summary` for an aggregate
|
|
12
|
-
* profit-and-loss view across all tokens the wallet has traded.
|
|
13
|
-
*
|
|
14
|
-
* Mainnet only — supported chains: Ethereum (0x1), Base (0x2105), Polygon (0x89).
|
|
15
|
-
*/
|
|
16
|
-
class WalletPnlSummaryTool extends BaseTool_1.BaseTool {
|
|
17
|
-
name = 'get-wallet-pnl-summary';
|
|
18
|
-
description = "Get a wallet's aggregate realized profit-and-loss summary across all tokens it has traded. " +
|
|
19
|
-
'Returns: total_count_of_trades, total_trade_volume (USD), total_realized_profit_usd, ' +
|
|
20
|
-
'total_realized_profit_percentage, total_buys, total_sells, total_sold_volume_usd, total_bought_volume_usd. ' +
|
|
21
|
-
'Use this tool for questions like: ' +
|
|
22
|
-
'"How much profit have I made trading?", "What is my realized PnL?", ' +
|
|
23
|
-
'"How many trades have I done this month?" (days=30), "Am I up or down overall?". ' +
|
|
24
|
-
'IMPORTANT — this endpoint only supports mainnet: Ethereum ("0x1"), Base ("0x2105"), Polygon ("0x89"). ' +
|
|
25
|
-
'Use days="all" (default), "7", "30", "60", or "90" to scope the time window. ' +
|
|
26
|
-
'Do NOT use for: per-token breakdown → get-wallet-pnl; ' +
|
|
27
|
-
'current portfolio value → get-wallet-token-balance; ' +
|
|
28
|
-
'transfer history → get-wallet-history.';
|
|
29
|
-
category = 'blockchain-data';
|
|
30
|
-
parameters = [
|
|
31
|
-
{
|
|
32
|
-
name: 'address',
|
|
33
|
-
type: 'string',
|
|
34
|
-
description: 'EVM wallet address (0x…). If omitted, uses the connected wallet from user context.',
|
|
35
|
-
required: false,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: 'chain',
|
|
39
|
-
type: 'string',
|
|
40
|
-
description: 'Hex chain ID: "0x1" Ethereum, "0xa" Optimism, "0x38" BSC, "0x89" Polygon, "0x2105" Base, ' +
|
|
41
|
-
'"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.',
|
|
42
|
-
required: false,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: 'days',
|
|
46
|
-
type: 'string',
|
|
47
|
-
description: 'Time window for the summary. Values: "all" (default, lifetime), "7", "30", "60", "90". ' +
|
|
48
|
-
'Pass "30" when the user asks about the last month, "7" for the last week, etc.',
|
|
49
|
-
required: false,
|
|
50
|
-
default: 'all',
|
|
51
|
-
},
|
|
52
|
-
];
|
|
53
|
-
service;
|
|
54
|
-
constructor(config) {
|
|
55
|
-
super();
|
|
56
|
-
this.service = new MoralisService_1.MoralisService(config);
|
|
57
|
-
}
|
|
58
|
-
async run(args, userContext) {
|
|
59
|
-
const address = args.address || userContext?.walletAddress || undefined;
|
|
60
|
-
const chain = (0, chainResolver_1.resolveChain)(args.chain, userContext);
|
|
61
|
-
if (!address) {
|
|
62
|
-
return { error: 'No wallet address available. Please connect a wallet or pass "address".' };
|
|
63
|
-
}
|
|
64
|
-
const rawDays = typeof args.days === 'string' ? args.days.trim().toLowerCase() : '';
|
|
65
|
-
const days = VALID_DAYS.includes(rawDays) ? rawDays : undefined;
|
|
66
|
-
const result = await this.service.getWalletPnlSummary({ address, chain, days });
|
|
67
|
-
if (!result.success) {
|
|
68
|
-
return { error: result.error || 'Failed to fetch wallet PnL summary' };
|
|
69
|
-
}
|
|
70
|
-
const data = result.data;
|
|
71
|
-
return {
|
|
72
|
-
walletAddress: address,
|
|
73
|
-
chain: chain || 'default',
|
|
74
|
-
days: days ?? 'all',
|
|
75
|
-
summary: {
|
|
76
|
-
totalCountOfTrades: data.total_count_of_trades,
|
|
77
|
-
totalTradeVolume: data.total_trade_volume,
|
|
78
|
-
totalRealizedProfitUsd: data.total_realized_profit_usd,
|
|
79
|
-
totalRealizedProfitPercentage: data.total_realized_profit_percentage,
|
|
80
|
-
totalBuys: data.total_buys,
|
|
81
|
-
totalSells: data.total_sells,
|
|
82
|
-
totalBoughtVolumeUsd: data.total_bought_volume_usd,
|
|
83
|
-
totalSoldVolumeUsd: data.total_sold_volume_usd,
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
exports.WalletPnlSummaryTool = WalletPnlSummaryTool;
|
|
89
|
-
//# sourceMappingURL=WalletPnlSummaryTool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WalletPnlSummaryTool.js","sourceRoot":"","sources":["../../../../src/tools/builtin/wallet/WalletPnlSummaryTool.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,uDAAmD;AAEnD,qEAAuH;AAIvH,MAAM,UAAU,GAA0B,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEzE;;;;;;;GAOG;AACH,MAAa,oBAAqB,SAAQ,mBAAQ;IAChD,IAAI,GAAG,wBAAwB,CAAC;IAChC,WAAW,GACT,6FAA6F;QAC7F,uFAAuF;QACvF,6GAA6G;QAC7G,oCAAoC;QACpC,sEAAsE;QACtE,mFAAmF;QACnF,wGAAwG;QACxG,+EAA+E;QAC/E,wDAAwD;QACxD,sDAAsD;QACtD,wCAAwC,CAAC;IAC3C,QAAQ,GAAG,iBAAiB,CAAC;IAC7B,UAAU,GAAoB;QAC5B;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,oFAAoF;YACjG,QAAQ,EAAE,KAAK;SAChB;QACD;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,2FAA2F;gBAC3F,wKAAwK;YAC1K,QAAQ,EAAE,KAAK;SAChB;QACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,yFAAyF;gBACzF,gFAAgF;YAClF,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,KAAK;SACf;KACF,CAAC;IAEM,OAAO,CAAiB;IAEhC,YAAY,MAAmC;QAC7C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,IAAI,+BAAc,CAAC,MAAM,CAAC,CAAC;IAC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IAAI,CAAC,UAAU;gBAC1B,UAAU,EAAE,IAAI,CAAC,WAAW;gBAC5B,oBAAoB,EAAE,IAAI,CAAC,uBAAuB;gBAClD,kBAAkB,EAAE,IAAI,CAAC,qBAAqB;aAC/C;SACF,CAAC;IACJ,CAAC;CACF;AAnFD,oDAmFC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { BaseTool } from '../../BaseTool';
|
|
2
|
-
import type { ToolParameter, UserContext } from '../../../types';
|
|
3
|
-
import { type MoralisServiceConfig, type WalletPnlDaysWindow } from '../../../services/MoralisService';
|
|
4
|
-
export type WalletPnlToolConfig = MoralisServiceConfig;
|
|
5
|
-
export declare class WalletPnlTool extends BaseTool {
|
|
6
|
-
name: string;
|
|
7
|
-
description: string;
|
|
8
|
-
category: string;
|
|
9
|
-
parameters: ToolParameter[];
|
|
10
|
-
private service;
|
|
11
|
-
constructor(config?: WalletPnlToolConfig);
|
|
12
|
-
protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
|
|
13
|
-
error: string;
|
|
14
|
-
walletAddress?: undefined;
|
|
15
|
-
chain?: undefined;
|
|
16
|
-
days?: undefined;
|
|
17
|
-
filters?: undefined;
|
|
18
|
-
tokenCount?: undefined;
|
|
19
|
-
tokens?: undefined;
|
|
20
|
-
} | {
|
|
21
|
-
walletAddress: string;
|
|
22
|
-
chain: string;
|
|
23
|
-
days: WalletPnlDaysWindow;
|
|
24
|
-
filters: {
|
|
25
|
-
tokenAddresses: string[] | null;
|
|
26
|
-
resolvedSymbols: {
|
|
27
|
-
symbol: string;
|
|
28
|
-
address: string;
|
|
29
|
-
}[] | null;
|
|
30
|
-
unresolvedSymbols: string[] | null;
|
|
31
|
-
};
|
|
32
|
-
tokenCount: number;
|
|
33
|
-
tokens: import("../../../services/MoralisService").WalletPnlTokenItem[];
|
|
34
|
-
error?: undefined;
|
|
35
|
-
}>;
|
|
36
|
-
/**
|
|
37
|
-
* Resolve a contract address from a token symbol.
|
|
38
|
-
* 1. Wallet balances (if wallet address available — most reliable)
|
|
39
|
-
* 2. Pantograph token search (fallback)
|
|
40
|
-
*/
|
|
41
|
-
private resolveContractAddress;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=WalletPnlTool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WalletPnlTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/builtin/wallet/WalletPnlTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAkB,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvH,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AAevD,qBAAa,aAAc,SAAQ,QAAQ;IACzC,IAAI,SAAoB;IACxB,WAAW,SAgBwC;IACnD,QAAQ,SAAqB;IAC7B,UAAU,EAAE,aAAa,EAAE,CAyCzB;IAEF,OAAO,CAAC,OAAO,CAAiB;gBAEpB,MAAM,CAAC,EAAE,mBAAmB;cAKxB,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,EAAE,WAAW;;;;;;;;;;;;;;;wBAuB/B,MAAM;yBAAW,MAAM;;;;;;;;IA+CpE;;;;OAIG;YACW,sBAAsB;CA4BrC"}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WalletPnlTool = void 0;
|
|
4
|
-
const BaseTool_1 = require("../../BaseTool");
|
|
5
|
-
const chainResolver_1 = require("../../chainResolver");
|
|
6
|
-
const MoralisService_1 = require("../../../services/MoralisService");
|
|
7
|
-
const VALID_DAYS = ['all', '7', '30', '60', '90'];
|
|
8
|
-
/**
|
|
9
|
-
* Tool: get-wallet-pnl
|
|
10
|
-
*
|
|
11
|
-
* Queries `GET /wallets/{address}/profitability` for a per-token realized-PnL
|
|
12
|
-
* breakdown. Each entry covers average buy/sell price, invested amount,
|
|
13
|
-
* quantities traded, realized profit USD + percentage, and counts.
|
|
14
|
-
*
|
|
15
|
-
* Mainnet only — supported chains: Ethereum (0x1), Base (0x2105), Polygon (0x89).
|
|
16
|
-
*/
|
|
17
|
-
const MAX_TOKEN_FILTERS = 25;
|
|
18
|
-
class WalletPnlTool extends BaseTool_1.BaseTool {
|
|
19
|
-
name = 'get-wallet-pnl';
|
|
20
|
-
description = "Get a wallet's realized profit-and-loss broken down per ERC-20 token. " +
|
|
21
|
-
'Each entry includes: token_address, name, symbol, decimals, logo, avg_buy_price_usd, avg_sell_price_usd, ' +
|
|
22
|
-
'total_usd_invested, total_tokens_bought, total_tokens_sold, total_sold_usd, avg_cost_of_quantity_sold, ' +
|
|
23
|
-
'count_of_trades, realized_profit_usd, realized_profit_percentage, total_buys, total_sells, possible_spam. ' +
|
|
24
|
-
'Use this tool for questions like: ' +
|
|
25
|
-
'"Which tokens made me the most money?", "What are my best/worst trades?", ' +
|
|
26
|
-
'"How much profit did I make on USDC?" (tokenSymbols=["USDC"]), ' +
|
|
27
|
-
'"PnL for PEPE and DEGEN this month" (tokenSymbols=["PEPE","DEGEN"], days=30), ' +
|
|
28
|
-
'"PnL breakdown for each token I traded this month" (days=30). ' +
|
|
29
|
-
'IMPORTANT — this endpoint ONLY supports mainnet: Ethereum ("0x1"), Polygon ("0x89"), Base ("0x2105"). ' +
|
|
30
|
-
'Use days="all" (default), "7", "30", "60", or "90" for the time window. ' +
|
|
31
|
-
'Pass tokenSymbols (by ticker, auto-resolved) and/or tokenAddresses (raw 0x…) to restrict to specific tokens ' +
|
|
32
|
-
`— combined total capped at ${MAX_TOKEN_FILTERS}. ` +
|
|
33
|
-
'Do NOT use for: aggregate summary → get-wallet-pnl-summary; ' +
|
|
34
|
-
'current balances → get-wallet-token-balances; ' +
|
|
35
|
-
'transfer history → get-wallet-token-transfers.';
|
|
36
|
-
category = 'blockchain-data';
|
|
37
|
-
parameters = [
|
|
38
|
-
{
|
|
39
|
-
name: 'address',
|
|
40
|
-
type: 'string',
|
|
41
|
-
description: 'EVM wallet address (0x…). If omitted, uses the connected wallet from user context.',
|
|
42
|
-
required: false,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: 'chain',
|
|
46
|
-
type: 'string',
|
|
47
|
-
description: 'Hex chain ID: "0x1" Ethereum, "0xa" Optimism, "0x38" BSC, "0x89" Polygon, "0x2105" Base, ' +
|
|
48
|
-
'"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.',
|
|
49
|
-
required: false,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: 'days',
|
|
53
|
-
type: 'string',
|
|
54
|
-
description: 'Time window for the breakdown. Values: "all" (default, lifetime), "7", "30", "60", "90".',
|
|
55
|
-
required: false,
|
|
56
|
-
default: 'all',
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: 'tokenSymbols',
|
|
60
|
-
type: 'array',
|
|
61
|
-
description: 'Optional list of token symbols (e.g. ["USDC", "PEPE"]). Auto-resolved to contract addresses via ' +
|
|
62
|
-
"the connected wallet's balances first, then Pantograph search. Symbols that can't be resolved are skipped. " +
|
|
63
|
-
`Merged with tokenAddresses; combined total capped at ${MAX_TOKEN_FILTERS}.`,
|
|
64
|
-
required: false,
|
|
65
|
-
items: { type: 'string' },
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
name: 'tokenAddresses',
|
|
69
|
-
type: 'array',
|
|
70
|
-
description: `Optional list of raw ERC-20 contract addresses (0x…). Use when the exact addresses are already known. ` +
|
|
71
|
-
`Merged with tokenSymbols; combined total capped at ${MAX_TOKEN_FILTERS}.`,
|
|
72
|
-
required: false,
|
|
73
|
-
items: { type: 'string' },
|
|
74
|
-
},
|
|
75
|
-
];
|
|
76
|
-
service;
|
|
77
|
-
constructor(config) {
|
|
78
|
-
super();
|
|
79
|
-
this.service = new MoralisService_1.MoralisService(config);
|
|
80
|
-
}
|
|
81
|
-
async run(args, userContext) {
|
|
82
|
-
const address = args.address || userContext?.walletAddress || undefined;
|
|
83
|
-
const chain = (0, chainResolver_1.resolveChain)(args.chain, userContext);
|
|
84
|
-
if (!address) {
|
|
85
|
-
return { error: 'No wallet address available. Please connect a wallet or pass "address".' };
|
|
86
|
-
}
|
|
87
|
-
const rawDays = typeof args.days === 'string' ? args.days.trim().toLowerCase() : '';
|
|
88
|
-
const days = VALID_DAYS.includes(rawDays) ? rawDays : undefined;
|
|
89
|
-
const rawTokenSymbols = Array.isArray(args.tokenSymbols)
|
|
90
|
-
? args.tokenSymbols
|
|
91
|
-
.filter((s) => typeof s === 'string' && !!s.trim())
|
|
92
|
-
.map((s) => s.trim())
|
|
93
|
-
: [];
|
|
94
|
-
const rawTokenAddresses = Array.isArray(args.tokenAddresses)
|
|
95
|
-
? args.tokenAddresses
|
|
96
|
-
.filter((a) => typeof a === 'string' && !!a.trim())
|
|
97
|
-
.map((a) => a.trim())
|
|
98
|
-
: [];
|
|
99
|
-
const resolvedFromSymbols = [];
|
|
100
|
-
const unresolvedSymbols = [];
|
|
101
|
-
if (rawTokenSymbols.length > 0) {
|
|
102
|
-
const resolutions = await Promise.all(rawTokenSymbols.map((sym) => this.resolveContractAddress(sym, chain, address)));
|
|
103
|
-
resolutions.forEach((resolved, i) => {
|
|
104
|
-
if (resolved)
|
|
105
|
-
resolvedFromSymbols.push({ symbol: rawTokenSymbols[i], address: resolved.address });
|
|
106
|
-
else
|
|
107
|
-
unresolvedSymbols.push(rawTokenSymbols[i]);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
const mergedAddresses = dedupe([...resolvedFromSymbols.map((r) => r.address), ...rawTokenAddresses]).slice(0, MAX_TOKEN_FILTERS);
|
|
111
|
-
const tokenAddresses = mergedAddresses.length > 0 ? mergedAddresses : undefined;
|
|
112
|
-
const result = await this.service.getWalletPnl({
|
|
113
|
-
address,
|
|
114
|
-
chain,
|
|
115
|
-
days,
|
|
116
|
-
tokenAddresses,
|
|
117
|
-
});
|
|
118
|
-
if (!result.success) {
|
|
119
|
-
return { error: result.error || 'Failed to fetch wallet PnL' };
|
|
120
|
-
}
|
|
121
|
-
const tokens = result.data?.result ?? [];
|
|
122
|
-
return {
|
|
123
|
-
walletAddress: address,
|
|
124
|
-
chain: chain || 'default',
|
|
125
|
-
days: days ?? 'all',
|
|
126
|
-
filters: {
|
|
127
|
-
tokenAddresses: tokenAddresses ?? null,
|
|
128
|
-
resolvedSymbols: resolvedFromSymbols.length > 0 ? resolvedFromSymbols : null,
|
|
129
|
-
unresolvedSymbols: unresolvedSymbols.length > 0 ? unresolvedSymbols : null,
|
|
130
|
-
},
|
|
131
|
-
tokenCount: tokens.length,
|
|
132
|
-
tokens,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Resolve a contract address from a token symbol.
|
|
137
|
-
* 1. Wallet balances (if wallet address available — most reliable)
|
|
138
|
-
* 2. Pantograph token search (fallback)
|
|
139
|
-
*/
|
|
140
|
-
async resolveContractAddress(symbol, chain, walletAddress) {
|
|
141
|
-
const symLower = symbol.toLowerCase();
|
|
142
|
-
if (walletAddress) {
|
|
143
|
-
const balRes = await this.service.getWalletTokenBalances({ address: walletAddress, chain });
|
|
144
|
-
if (balRes.success && balRes.data?.result?.length) {
|
|
145
|
-
const match = balRes.data.result.find((t) => (t.symbol ?? '').toLowerCase() === symLower);
|
|
146
|
-
if (match) {
|
|
147
|
-
return { address: match.token_address, symbol: match.symbol, name: match.name };
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
const searchRes = await this.service.searchTokensByKey({ key: symbol, chain });
|
|
152
|
-
if (searchRes.success && searchRes.data?.length) {
|
|
153
|
-
const exact = searchRes.data.find((t) => (t.symbol ?? '').toLowerCase() === symLower);
|
|
154
|
-
const candidate = exact ?? searchRes.data[0];
|
|
155
|
-
if (candidate?.token_address) {
|
|
156
|
-
return { address: candidate.token_address, symbol: candidate.symbol, name: candidate.name };
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return undefined;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
exports.WalletPnlTool = WalletPnlTool;
|
|
163
|
-
function dedupe(addresses) {
|
|
164
|
-
const seen = new Set();
|
|
165
|
-
const out = [];
|
|
166
|
-
for (const addr of addresses) {
|
|
167
|
-
const key = addr.toLowerCase();
|
|
168
|
-
if (seen.has(key))
|
|
169
|
-
continue;
|
|
170
|
-
seen.add(key);
|
|
171
|
-
out.push(addr);
|
|
172
|
-
}
|
|
173
|
-
return out;
|
|
174
|
-
}
|
|
175
|
-
//# sourceMappingURL=WalletPnlTool.js.map
|