keyring-agent-core 0.1.0
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/README.md +169 -0
- package/dist/agent/AgentCore.d.ts +220 -0
- package/dist/agent/AgentCore.d.ts.map +1 -0
- package/dist/agent/AgentCore.js +950 -0
- package/dist/agent/AgentCore.js.map +1 -0
- package/dist/agent/QueryRewriter.d.ts +67 -0
- package/dist/agent/QueryRewriter.d.ts.map +1 -0
- package/dist/agent/QueryRewriter.js +262 -0
- package/dist/agent/QueryRewriter.js.map +1 -0
- package/dist/agent/Router.d.ts +33 -0
- package/dist/agent/Router.d.ts.map +1 -0
- package/dist/agent/Router.js +191 -0
- package/dist/agent/Router.js.map +1 -0
- package/dist/agent/Subagent.d.ts +63 -0
- package/dist/agent/Subagent.d.ts.map +1 -0
- package/dist/agent/Subagent.js +240 -0
- package/dist/agent/Subagent.js.map +1 -0
- package/dist/agent/Synthesizer.d.ts +11 -0
- package/dist/agent/Synthesizer.d.ts.map +1 -0
- package/dist/agent/Synthesizer.js +86 -0
- package/dist/agent/Synthesizer.js.map +1 -0
- package/dist/agent/index.d.ts +10 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +24 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/subagents/AiAgent.d.ts +6 -0
- package/dist/agent/subagents/AiAgent.d.ts.map +1 -0
- package/dist/agent/subagents/AiAgent.js +48 -0
- package/dist/agent/subagents/AiAgent.js.map +1 -0
- package/dist/agent/subagents/NftAgent.d.ts +6 -0
- package/dist/agent/subagents/NftAgent.d.ts.map +1 -0
- package/dist/agent/subagents/NftAgent.js +69 -0
- package/dist/agent/subagents/NftAgent.js.map +1 -0
- package/dist/agent/subagents/PoolAgent.d.ts +6 -0
- package/dist/agent/subagents/PoolAgent.d.ts.map +1 -0
- package/dist/agent/subagents/PoolAgent.js +184 -0
- package/dist/agent/subagents/PoolAgent.js.map +1 -0
- package/dist/agent/subagents/TokenAgent.d.ts +6 -0
- package/dist/agent/subagents/TokenAgent.d.ts.map +1 -0
- package/dist/agent/subagents/TokenAgent.js +75 -0
- package/dist/agent/subagents/TokenAgent.js.map +1 -0
- package/dist/agent/subagents/WalletAgent.d.ts +6 -0
- package/dist/agent/subagents/WalletAgent.d.ts.map +1 -0
- package/dist/agent/subagents/WalletAgent.js +92 -0
- package/dist/agent/subagents/WalletAgent.js.map +1 -0
- package/dist/agent/subagents/index.d.ts +14 -0
- package/dist/agent/subagents/index.d.ts.map +1 -0
- package/dist/agent/subagents/index.js +38 -0
- package/dist/agent/subagents/index.js.map +1 -0
- package/dist/constants/abi.d.ts +520 -0
- package/dist/constants/abi.d.ts.map +1 -0
- package/dist/constants/abi.js +667 -0
- package/dist/constants/abi.js.map +1 -0
- package/dist/functions/pool.d.ts +25 -0
- package/dist/functions/pool.d.ts.map +1 -0
- package/dist/functions/pool.js +151 -0
- package/dist/functions/pool.js.map +1 -0
- package/dist/functions/web3.d.ts +32 -0
- package/dist/functions/web3.d.ts.map +1 -0
- package/dist/functions/web3.js +277 -0
- package/dist/functions/web3.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/GeminiProvider.d.ts +16 -0
- package/dist/llm/GeminiProvider.d.ts.map +1 -0
- package/dist/llm/GeminiProvider.js +248 -0
- package/dist/llm/GeminiProvider.js.map +1 -0
- package/dist/llm/index.d.ts +2 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/index.js +6 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/memory/ChatHistory.d.ts +83 -0
- package/dist/memory/ChatHistory.d.ts.map +1 -0
- package/dist/memory/ChatHistory.js +143 -0
- package/dist/memory/ChatHistory.js.map +1 -0
- package/dist/memory/KnowledgeBase.d.ts +38 -0
- package/dist/memory/KnowledgeBase.d.ts.map +1 -0
- package/dist/memory/KnowledgeBase.js +139 -0
- package/dist/memory/KnowledgeBase.js.map +1 -0
- package/dist/memory/Summarizer.d.ts +12 -0
- package/dist/memory/Summarizer.d.ts.map +1 -0
- package/dist/memory/Summarizer.js +39 -0
- package/dist/memory/Summarizer.js.map +1 -0
- package/dist/memory/UpstashKnowledgeBase.d.ts +124 -0
- package/dist/memory/UpstashKnowledgeBase.d.ts.map +1 -0
- package/dist/memory/UpstashKnowledgeBase.js +152 -0
- package/dist/memory/UpstashKnowledgeBase.js.map +1 -0
- package/dist/memory/historyUtils.d.ts +58 -0
- package/dist/memory/historyUtils.d.ts.map +1 -0
- package/dist/memory/historyUtils.js +190 -0
- package/dist/memory/historyUtils.js.map +1 -0
- package/dist/memory/index.d.ts +7 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +12 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/ingestKnowledgeBase.d.ts +17 -0
- package/dist/memory/ingestKnowledgeBase.d.ts.map +1 -0
- package/dist/memory/ingestKnowledgeBase.js +35 -0
- package/dist/memory/ingestKnowledgeBase.js.map +1 -0
- package/dist/services/MoralisService.d.ts +1350 -0
- package/dist/services/MoralisService.d.ts.map +1 -0
- package/dist/services/MoralisService.js +1364 -0
- package/dist/services/MoralisService.js.map +1 -0
- package/dist/services/PantographService.d.ts +38 -0
- package/dist/services/PantographService.d.ts.map +1 -0
- package/dist/services/PantographService.js +199 -0
- package/dist/services/PantographService.js.map +1 -0
- package/dist/services/PoolService.d.ts +241 -0
- package/dist/services/PoolService.d.ts.map +1 -0
- package/dist/services/PoolService.js +507 -0
- package/dist/services/PoolService.js.map +1 -0
- package/dist/services/UniswapService.d.ts +289 -0
- package/dist/services/UniswapService.d.ts.map +1 -0
- package/dist/services/UniswapService.js +585 -0
- package/dist/services/UniswapService.js.map +1 -0
- package/dist/services/swap/BaseSwapService.d.ts +17 -0
- package/dist/services/swap/BaseSwapService.d.ts.map +1 -0
- package/dist/services/swap/BaseSwapService.js +19 -0
- package/dist/services/swap/BaseSwapService.js.map +1 -0
- package/dist/services/swap/DebridgeAdapter.d.ts +20 -0
- package/dist/services/swap/DebridgeAdapter.d.ts.map +1 -0
- package/dist/services/swap/DebridgeAdapter.js +175 -0
- package/dist/services/swap/DebridgeAdapter.js.map +1 -0
- package/dist/services/swap/RelayAdapter.d.ts +19 -0
- package/dist/services/swap/RelayAdapter.d.ts.map +1 -0
- package/dist/services/swap/RelayAdapter.js +189 -0
- package/dist/services/swap/RelayAdapter.js.map +1 -0
- package/dist/services/swap/SwapServiceFactory.d.ts +24 -0
- package/dist/services/swap/SwapServiceFactory.d.ts.map +1 -0
- package/dist/services/swap/SwapServiceFactory.js +74 -0
- package/dist/services/swap/SwapServiceFactory.js.map +1 -0
- package/dist/services/swap/addresses.d.ts +3 -0
- package/dist/services/swap/addresses.d.ts.map +1 -0
- package/dist/services/swap/addresses.js +68 -0
- package/dist/services/swap/addresses.js.map +1 -0
- package/dist/services/swap/affiliate.d.ts +17 -0
- package/dist/services/swap/affiliate.d.ts.map +1 -0
- package/dist/services/swap/affiliate.js +126 -0
- package/dist/services/swap/affiliate.js.map +1 -0
- package/dist/services/swap/config.d.ts +9 -0
- package/dist/services/swap/config.d.ts.map +1 -0
- package/dist/services/swap/config.js +19 -0
- package/dist/services/swap/config.js.map +1 -0
- package/dist/services/swap/index.d.ts +10 -0
- package/dist/services/swap/index.d.ts.map +1 -0
- package/dist/services/swap/index.js +22 -0
- package/dist/services/swap/index.js.map +1 -0
- package/dist/services/swap/types.d.ts +89 -0
- package/dist/services/swap/types.d.ts.map +1 -0
- package/dist/services/swap/types.js +6 -0
- package/dist/services/swap/types.js.map +1 -0
- package/dist/tools/BaseTool.d.ts +15 -0
- package/dist/tools/BaseTool.d.ts.map +1 -0
- package/dist/tools/BaseTool.js +35 -0
- package/dist/tools/BaseTool.js.map +1 -0
- package/dist/tools/ToolRegistry.d.ts +27 -0
- package/dist/tools/ToolRegistry.d.ts.map +1 -0
- package/dist/tools/ToolRegistry.js +80 -0
- package/dist/tools/ToolRegistry.js.map +1 -0
- package/dist/tools/builtin/ai/MoralisCortexTool.d.ts +33 -0
- package/dist/tools/builtin/ai/MoralisCortexTool.d.ts.map +1 -0
- package/dist/tools/builtin/ai/MoralisCortexTool.js +76 -0
- package/dist/tools/builtin/ai/MoralisCortexTool.js.map +1 -0
- package/dist/tools/builtin/ai/SolanaCortexTool.d.ts +22 -0
- package/dist/tools/builtin/ai/SolanaCortexTool.d.ts.map +1 -0
- package/dist/tools/builtin/ai/SolanaCortexTool.js +80 -0
- package/dist/tools/builtin/ai/SolanaCortexTool.js.map +1 -0
- package/dist/tools/builtin/ai/index.d.ts +5 -0
- package/dist/tools/builtin/ai/index.d.ts.map +1 -0
- package/dist/tools/builtin/ai/index.js +8 -0
- package/dist/tools/builtin/ai/index.js.map +1 -0
- package/dist/tools/builtin/index.d.ts +6 -0
- package/dist/tools/builtin/index.d.ts.map +1 -0
- package/dist/tools/builtin/index.js +22 -0
- package/dist/tools/builtin/index.js.map +1 -0
- package/dist/tools/builtin/nft/NFTContractInfoTool.d.ts +21 -0
- package/dist/tools/builtin/nft/NFTContractInfoTool.d.ts.map +1 -0
- package/dist/tools/builtin/nft/NFTContractInfoTool.js +54 -0
- package/dist/tools/builtin/nft/NFTContractInfoTool.js.map +1 -0
- package/dist/tools/builtin/nft/NFTMetadataTool.d.ts +121 -0
- package/dist/tools/builtin/nft/NFTMetadataTool.d.ts.map +1 -0
- package/dist/tools/builtin/nft/NFTMetadataTool.js +159 -0
- package/dist/tools/builtin/nft/NFTMetadataTool.js.map +1 -0
- package/dist/tools/builtin/nft/WalletNFTsTool.d.ts +82 -0
- package/dist/tools/builtin/nft/WalletNFTsTool.d.ts.map +1 -0
- package/dist/tools/builtin/nft/WalletNFTsTool.js +172 -0
- package/dist/tools/builtin/nft/WalletNFTsTool.js.map +1 -0
- package/dist/tools/builtin/nft/index.d.ts +7 -0
- package/dist/tools/builtin/nft/index.d.ts.map +1 -0
- package/dist/tools/builtin/nft/index.js +10 -0
- package/dist/tools/builtin/nft/index.js.map +1 -0
- package/dist/tools/builtin/pool/EstimatePoolYieldTool.d.ts +124 -0
- package/dist/tools/builtin/pool/EstimatePoolYieldTool.d.ts.map +1 -0
- package/dist/tools/builtin/pool/EstimatePoolYieldTool.js +235 -0
- package/dist/tools/builtin/pool/EstimatePoolYieldTool.js.map +1 -0
- package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.d.ts +127 -0
- package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.d.ts.map +1 -0
- package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.js +517 -0
- package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.js.map +1 -0
- package/dist/tools/builtin/pool/PoolByAddressTool.d.ts +127 -0
- package/dist/tools/builtin/pool/PoolByAddressTool.d.ts.map +1 -0
- package/dist/tools/builtin/pool/PoolByAddressTool.js +237 -0
- package/dist/tools/builtin/pool/PoolByAddressTool.js.map +1 -0
- package/dist/tools/builtin/pool/PoolDetailTool.d.ts +127 -0
- package/dist/tools/builtin/pool/PoolDetailTool.d.ts.map +1 -0
- package/dist/tools/builtin/pool/PoolDetailTool.js +272 -0
- package/dist/tools/builtin/pool/PoolDetailTool.js.map +1 -0
- package/dist/tools/builtin/pool/PoolSearchTool.d.ts +50 -0
- package/dist/tools/builtin/pool/PoolSearchTool.d.ts.map +1 -0
- package/dist/tools/builtin/pool/PoolSearchTool.js +159 -0
- package/dist/tools/builtin/pool/PoolSearchTool.js.map +1 -0
- package/dist/tools/builtin/pool/PreviewAddLiquidityTool.d.ts +123 -0
- package/dist/tools/builtin/pool/PreviewAddLiquidityTool.d.ts.map +1 -0
- package/dist/tools/builtin/pool/PreviewAddLiquidityTool.js +380 -0
- package/dist/tools/builtin/pool/PreviewAddLiquidityTool.js.map +1 -0
- package/dist/tools/builtin/pool/TopPoolsTool.d.ts +68 -0
- package/dist/tools/builtin/pool/TopPoolsTool.d.ts.map +1 -0
- package/dist/tools/builtin/pool/TopPoolsTool.js +158 -0
- package/dist/tools/builtin/pool/TopPoolsTool.js.map +1 -0
- package/dist/tools/builtin/pool/index.d.ts +15 -0
- package/dist/tools/builtin/pool/index.d.ts.map +1 -0
- package/dist/tools/builtin/pool/index.js +18 -0
- package/dist/tools/builtin/pool/index.js.map +1 -0
- package/dist/tools/builtin/token/TokenAnalyticsTool.d.ts +71 -0
- package/dist/tools/builtin/token/TokenAnalyticsTool.d.ts.map +1 -0
- package/dist/tools/builtin/token/TokenAnalyticsTool.js +146 -0
- package/dist/tools/builtin/token/TokenAnalyticsTool.js.map +1 -0
- package/dist/tools/builtin/token/TokenHoldersTool.d.ts +81 -0
- package/dist/tools/builtin/token/TokenHoldersTool.d.ts.map +1 -0
- package/dist/tools/builtin/token/TokenHoldersTool.js +138 -0
- package/dist/tools/builtin/token/TokenHoldersTool.js.map +1 -0
- package/dist/tools/builtin/token/TokenInfoTool.d.ts +36 -0
- package/dist/tools/builtin/token/TokenInfoTool.d.ts.map +1 -0
- package/dist/tools/builtin/token/TokenInfoTool.js +163 -0
- package/dist/tools/builtin/token/TokenInfoTool.js.map +1 -0
- package/dist/tools/builtin/token/TokenScoreTool.d.ts +63 -0
- package/dist/tools/builtin/token/TokenScoreTool.d.ts.map +1 -0
- package/dist/tools/builtin/token/TokenScoreTool.js +147 -0
- package/dist/tools/builtin/token/TokenScoreTool.js.map +1 -0
- package/dist/tools/builtin/token/TopGainersTool.d.ts +46 -0
- package/dist/tools/builtin/token/TopGainersTool.d.ts.map +1 -0
- package/dist/tools/builtin/token/TopGainersTool.js +110 -0
- package/dist/tools/builtin/token/TopGainersTool.js.map +1 -0
- package/dist/tools/builtin/token/TopLosersTool.d.ts +66 -0
- package/dist/tools/builtin/token/TopLosersTool.d.ts.map +1 -0
- package/dist/tools/builtin/token/TopLosersTool.js +128 -0
- package/dist/tools/builtin/token/TopLosersTool.js.map +1 -0
- package/dist/tools/builtin/token/TrendingTokensTool.d.ts +39 -0
- package/dist/tools/builtin/token/TrendingTokensTool.d.ts.map +1 -0
- package/dist/tools/builtin/token/TrendingTokensTool.js +75 -0
- package/dist/tools/builtin/token/TrendingTokensTool.js.map +1 -0
- package/dist/tools/builtin/token/index.d.ts +15 -0
- package/dist/tools/builtin/token/index.d.ts.map +1 -0
- package/dist/tools/builtin/token/index.js +18 -0
- package/dist/tools/builtin/token/index.js.map +1 -0
- package/dist/tools/builtin/wallet/TransactionByHashTool.d.ts +70 -0
- package/dist/tools/builtin/wallet/TransactionByHashTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet/TransactionByHashTool.js +110 -0
- package/dist/tools/builtin/wallet/TransactionByHashTool.js.map +1 -0
- package/dist/tools/builtin/wallet/WalletApprovalsTool.d.ts +107 -0
- package/dist/tools/builtin/wallet/WalletApprovalsTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet/WalletApprovalsTool.js +163 -0
- package/dist/tools/builtin/wallet/WalletApprovalsTool.js.map +1 -0
- package/dist/tools/builtin/wallet/WalletDefiPositionsTool.d.ts +61 -0
- package/dist/tools/builtin/wallet/WalletDefiPositionsTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet/WalletDefiPositionsTool.js +99 -0
- package/dist/tools/builtin/wallet/WalletDefiPositionsTool.js.map +1 -0
- package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.d.ts +68 -0
- package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.js +114 -0
- package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.js.map +1 -0
- package/dist/tools/builtin/wallet/WalletDefiSummaryTool.d.ts +50 -0
- package/dist/tools/builtin/wallet/WalletDefiSummaryTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet/WalletDefiSummaryTool.js +79 -0
- package/dist/tools/builtin/wallet/WalletDefiSummaryTool.js.map +1 -0
- package/dist/tools/builtin/wallet/WalletHistoryTool.d.ts +31 -0
- package/dist/tools/builtin/wallet/WalletHistoryTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet/WalletHistoryTool.js +153 -0
- package/dist/tools/builtin/wallet/WalletHistoryTool.js.map +1 -0
- package/dist/tools/builtin/wallet/WalletNetWorthTool.d.ts +44 -0
- package/dist/tools/builtin/wallet/WalletNetWorthTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet/WalletNetWorthTool.js +122 -0
- package/dist/tools/builtin/wallet/WalletNetWorthTool.js.map +1 -0
- package/dist/tools/builtin/wallet/WalletNftTransfersTool.d.ts +86 -0
- package/dist/tools/builtin/wallet/WalletNftTransfersTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet/WalletNftTransfersTool.js +264 -0
- package/dist/tools/builtin/wallet/WalletNftTransfersTool.js.map +1 -0
- package/dist/tools/builtin/wallet/WalletPnlSummaryTool.d.ts +43 -0
- package/dist/tools/builtin/wallet/WalletPnlSummaryTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet/WalletPnlSummaryTool.js +88 -0
- package/dist/tools/builtin/wallet/WalletPnlSummaryTool.js.map +1 -0
- package/dist/tools/builtin/wallet/WalletPnlTool.d.ts +43 -0
- package/dist/tools/builtin/wallet/WalletPnlTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet/WalletPnlTool.js +174 -0
- package/dist/tools/builtin/wallet/WalletPnlTool.js.map +1 -0
- package/dist/tools/builtin/wallet/WalletTokenBalancesTool.d.ts +35 -0
- package/dist/tools/builtin/wallet/WalletTokenBalancesTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet/WalletTokenBalancesTool.js +67 -0
- package/dist/tools/builtin/wallet/WalletTokenBalancesTool.js.map +1 -0
- package/dist/tools/builtin/wallet/WalletTokenTransfersTool.d.ts +109 -0
- package/dist/tools/builtin/wallet/WalletTokenTransfersTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet/WalletTokenTransfersTool.js +353 -0
- package/dist/tools/builtin/wallet/WalletTokenTransfersTool.js.map +1 -0
- package/dist/tools/builtin/wallet/index.d.ts +25 -0
- package/dist/tools/builtin/wallet/index.d.ts.map +1 -0
- package/dist/tools/builtin/wallet/index.js +28 -0
- package/dist/tools/builtin/wallet/index.js.map +1 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +23 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/types/index.d.ts +566 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TopLosersTool = void 0;
|
|
4
|
+
const BaseTool_1 = require("../../BaseTool");
|
|
5
|
+
const MoralisService_1 = require("../../../services/MoralisService");
|
|
6
|
+
const ALLOWED_TIMEFRAMES = ['1h', '1d', '1w', '1M'];
|
|
7
|
+
/**
|
|
8
|
+
* Tool: get-top-losers
|
|
9
|
+
*
|
|
10
|
+
* Queries `GET /discovery/tokens/top-losers` — tokens with the largest USD
|
|
11
|
+
* price decrease over a chosen timeframe. Mirrors the top-gainers endpoint
|
|
12
|
+
* with the same filter set (minimum market cap, minimum security score) and
|
|
13
|
+
* the same response shape; only the ranking direction differs.
|
|
14
|
+
*
|
|
15
|
+
* Each row carries multi-timeframe buckets (1h / 1d / 1w / 1M) for:
|
|
16
|
+
* - price_percent_change_usd
|
|
17
|
+
* - volume_change_usd / net_volume_change_usd
|
|
18
|
+
* - liquidity_change_usd
|
|
19
|
+
* - holders_change
|
|
20
|
+
* - experienced_net_buyers_change
|
|
21
|
+
*/
|
|
22
|
+
class TopLosersTool extends BaseTool_1.BaseTool {
|
|
23
|
+
name = 'get-top-losers';
|
|
24
|
+
description = 'List tokens with the largest USD price DECREASE over a chosen timeframe (1h / 1d / 1w / 1M). ' +
|
|
25
|
+
'Returns price, market cap, fully-diluted valuation, token age, Twitter followers, security score, ' +
|
|
26
|
+
'on-chain strength index, and multi-timeframe change buckets for: price %, volume, net volume, ' +
|
|
27
|
+
'liquidity, holder count, and experienced net buyers. ' +
|
|
28
|
+
'Optionally filter out low-quality tokens via minMarketCap (USD floor) and securityScore (0–100, higher = safer). ' +
|
|
29
|
+
'Use this tool for questions like: ' +
|
|
30
|
+
'"What are today\'s biggest losers?", "Which tokens dumped the most this week?", ' +
|
|
31
|
+
'"Worst performers in the last hour?", ' +
|
|
32
|
+
'"Top losers on BSC with market cap over $10M", ' +
|
|
33
|
+
'"Show me safe tokens that dropped this month (securityScore >= 80)". ' +
|
|
34
|
+
'Supports: Ethereum, Optimism, BSC, Polygon, Base, Arbitrum, Avalanche, Linea, and more.';
|
|
35
|
+
category = 'blockchain-data';
|
|
36
|
+
parameters = [
|
|
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. Defaults to connected chain, ' +
|
|
42
|
+
'or Ethereum (0x1) if no chain is connected.',
|
|
43
|
+
required: true,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'timeFrame',
|
|
47
|
+
type: 'string',
|
|
48
|
+
description: 'Window over which the price change is measured. Allowed values: ' +
|
|
49
|
+
'"1h" (last hour), "1d" (last 24h), "1w" (last 7 days), "1M" (last 30 days). ' +
|
|
50
|
+
'Pick the timeframe that matches the user\'s question — e.g. "today" → "1d", "this week" → "1w".',
|
|
51
|
+
required: false,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'minMarketCap',
|
|
55
|
+
type: 'number',
|
|
56
|
+
description: 'Minimum token market cap in USD. Use to exclude micro-caps and meme dust. ' +
|
|
57
|
+
'Example: 1000000 = $1M floor, 10000000 = $10M floor. Omit for no floor.',
|
|
58
|
+
required: false,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'securityScore',
|
|
62
|
+
type: 'number',
|
|
63
|
+
description: 'Minimum security score threshold on a 0–100 scale (higher = safer). ' +
|
|
64
|
+
'Typical values: 70 (moderate safety), 80 (safe), 90 (very safe). Omit for no filter.',
|
|
65
|
+
required: false,
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
service;
|
|
69
|
+
constructor(config) {
|
|
70
|
+
super();
|
|
71
|
+
this.service = new MoralisService_1.MoralisService(config);
|
|
72
|
+
}
|
|
73
|
+
async run(args, userContext) {
|
|
74
|
+
const chain = args.chain || userContext?.chain || '0x1';
|
|
75
|
+
const rawTimeFrame = typeof args.timeFrame === 'string' ? args.timeFrame.trim() : undefined;
|
|
76
|
+
const timeFrame = rawTimeFrame && ALLOWED_TIMEFRAMES.includes(rawTimeFrame)
|
|
77
|
+
? rawTimeFrame
|
|
78
|
+
: undefined;
|
|
79
|
+
if (rawTimeFrame && !timeFrame) {
|
|
80
|
+
return {
|
|
81
|
+
error: `Invalid timeFrame "${rawTimeFrame}". Allowed values: ${ALLOWED_TIMEFRAMES.join(', ')}.`,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const minMarketCap = typeof args.minMarketCap === 'number' && Number.isFinite(args.minMarketCap) && args.minMarketCap >= 0
|
|
85
|
+
? args.minMarketCap
|
|
86
|
+
: undefined;
|
|
87
|
+
const securityScore = typeof args.securityScore === 'number' && Number.isFinite(args.securityScore) ? args.securityScore : undefined;
|
|
88
|
+
const result = await this.service.getTopLosers({ chain, timeFrame, minMarketCap, securityScore });
|
|
89
|
+
if (!result.success) {
|
|
90
|
+
return { error: result.error || 'Failed to fetch top losers' };
|
|
91
|
+
}
|
|
92
|
+
const tokens = result.data ?? [];
|
|
93
|
+
return {
|
|
94
|
+
chain,
|
|
95
|
+
timeFrame: timeFrame ?? null,
|
|
96
|
+
filters: {
|
|
97
|
+
minMarketCap: minMarketCap ?? null,
|
|
98
|
+
securityScore: securityScore ?? null,
|
|
99
|
+
},
|
|
100
|
+
count: tokens.length,
|
|
101
|
+
tokens: tokens.map((t) => this.projectToken(t)),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
projectToken(t) {
|
|
105
|
+
return {
|
|
106
|
+
chainId: t.chain_id,
|
|
107
|
+
contractAddress: t.token_address,
|
|
108
|
+
symbol: t.token_symbol ?? null,
|
|
109
|
+
name: t.token_name ?? null,
|
|
110
|
+
logo: t.token_logo ?? null,
|
|
111
|
+
usdPrice: t.price_usd ?? null,
|
|
112
|
+
marketCap: t.market_cap ?? null,
|
|
113
|
+
fullyDilutedValuation: t.fully_diluted_valuation ?? null,
|
|
114
|
+
tokenAgeInDays: t.token_age_in_days ?? null,
|
|
115
|
+
securityScore: t.security_score ?? null,
|
|
116
|
+
onChainStrengthIndex: t.on_chain_strength_index ?? null,
|
|
117
|
+
twitterFollowers: t.twitter_followers ?? null,
|
|
118
|
+
pricePercentChangeUsd: t.price_percent_change_usd ?? null,
|
|
119
|
+
volumeChangeUsd: t.volume_change_usd ?? null,
|
|
120
|
+
netVolumeChangeUsd: t.net_volume_change_usd ?? null,
|
|
121
|
+
liquidityChangeUsd: t.liquidity_change_usd ?? null,
|
|
122
|
+
holdersChange: t.holders_change ?? null,
|
|
123
|
+
experiencedNetBuyersChange: t.experienced_net_buyers_change ?? null,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.TopLosersTool = TopLosersTool;
|
|
128
|
+
//# sourceMappingURL=TopLosersTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TopLosersTool.js","sourceRoot":"","sources":["../../../../src/tools/builtin/token/TopLosersTool.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAE1C,qEAK0C;AAI1C,MAAM,kBAAkB,GAA0B,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAE3E;;;;;;;;;;;;;;GAcG;AAC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../../../types';
|
|
3
|
+
import { type MoralisServiceConfig } from '../../../services/MoralisService';
|
|
4
|
+
export type TrendingTokensToolConfig = MoralisServiceConfig;
|
|
5
|
+
/**
|
|
6
|
+
* Tool: get-trending-tokens
|
|
7
|
+
*
|
|
8
|
+
* Queries `GET /tokens/trending` — a ranked list of tokens gaining
|
|
9
|
+
* traction based on trading activity, volume, liquidity and holder growth.
|
|
10
|
+
* Cross-chain by default; pass `chain` to restrict to a single network.
|
|
11
|
+
*
|
|
12
|
+
* Each row carries multi-timeframe buckets (1h / 4h / 12h / 24h) for:
|
|
13
|
+
* - pricePercentChange
|
|
14
|
+
* - totalVolume
|
|
15
|
+
* - transactions / buyTransactions / sellTransactions
|
|
16
|
+
* - buyers / sellers
|
|
17
|
+
*/
|
|
18
|
+
export declare class TrendingTokensTool extends BaseTool {
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
category: string;
|
|
22
|
+
parameters: ToolParameter[];
|
|
23
|
+
private service;
|
|
24
|
+
constructor(config?: TrendingTokensToolConfig);
|
|
25
|
+
protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
|
|
26
|
+
error: string;
|
|
27
|
+
_instructions?: undefined;
|
|
28
|
+
chain?: undefined;
|
|
29
|
+
count?: undefined;
|
|
30
|
+
tokens?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
_instructions: string;
|
|
33
|
+
chain: string;
|
|
34
|
+
count: number;
|
|
35
|
+
tokens: import("../../../services/MoralisService").TrendingToken[];
|
|
36
|
+
error?: undefined;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=TrendingTokensTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TrendingTokensTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/builtin/token/TrendingTokensTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAkB,KAAK,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAE7F,MAAM,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAE5D;;;;;;;;;;;;GAYG;AACH,qBAAa,kBAAmB,SAAQ,QAAQ;IAC9C,IAAI,SAAyB;IAC7B,WAAW,SAQiF;IAC5F,QAAQ,SAAqB;IAC7B,UAAU,EAAE,aAAa,EAAE,CAkBzB;IAEF,OAAO,CAAC,OAAO,CAAiB;gBAEpB,MAAM,CAAC,EAAE,wBAAwB;cAK7B,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,EAAE,WAAW;;;;;;;;;;;;;CA4B7E"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TrendingTokensTool = void 0;
|
|
4
|
+
const BaseTool_1 = require("../../BaseTool");
|
|
5
|
+
const MoralisService_1 = require("../../../services/MoralisService");
|
|
6
|
+
/**
|
|
7
|
+
* Tool: get-trending-tokens
|
|
8
|
+
*
|
|
9
|
+
* Queries `GET /tokens/trending` — a ranked list of tokens gaining
|
|
10
|
+
* traction based on trading activity, volume, liquidity and holder growth.
|
|
11
|
+
* Cross-chain by default; pass `chain` to restrict to a single network.
|
|
12
|
+
*
|
|
13
|
+
* Each row carries multi-timeframe buckets (1h / 4h / 12h / 24h) for:
|
|
14
|
+
* - pricePercentChange
|
|
15
|
+
* - totalVolume
|
|
16
|
+
* - transactions / buyTransactions / sellTransactions
|
|
17
|
+
* - buyers / sellers
|
|
18
|
+
*/
|
|
19
|
+
class TrendingTokensTool extends BaseTool_1.BaseTool {
|
|
20
|
+
name = 'get-trending-tokens';
|
|
21
|
+
description = 'List tokens trending on-chain right now, ranked by trading activity, volume, liquidity and holder growth. ' +
|
|
22
|
+
'Returns price, market cap, liquidity, holder count, and multi-timeframe buckets (1h / 4h / 12h / 24h) of ' +
|
|
23
|
+
'price change, volume, transaction counts, and unique buyers/sellers. ' +
|
|
24
|
+
'Cross-chain by default — omit `chain` for a global ranking, or pass it to filter to one network. ' +
|
|
25
|
+
'Use this tool for questions like: ' +
|
|
26
|
+
'"What tokens are trending right now?", "Show me hot tokens", "What\'s popular on Base today?", ' +
|
|
27
|
+
'"Which tokens have the highest 24h volume?", "Biggest movers in the last hour?". ' +
|
|
28
|
+
'Supports: Ethereum, Optimism, BSC, Polygon, Base, Arbitrum, Avalanche, Linea, and more.';
|
|
29
|
+
category = 'blockchain-data';
|
|
30
|
+
parameters = [
|
|
31
|
+
{
|
|
32
|
+
name: 'chain',
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'Optional hex chain ID to scope results to a single network: ' +
|
|
35
|
+
'"0x1" Ethereum, "0xa" Optimism, "0x38" BSC, "0x89" Polygon, "0x2105" Base, ' +
|
|
36
|
+
'"0xa4b1" Arbitrum, "0xa86a" Avalanche, "0xe708" Linea. ' +
|
|
37
|
+
'Omit to return cross-chain trending results.',
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'limit',
|
|
42
|
+
type: 'number',
|
|
43
|
+
description: 'Maximum number of trending tokens to return. Defaults to upstream API default when omitted.',
|
|
44
|
+
required: true,
|
|
45
|
+
default: 10,
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
service;
|
|
49
|
+
constructor(config) {
|
|
50
|
+
super();
|
|
51
|
+
this.service = new MoralisService_1.MoralisService(config);
|
|
52
|
+
}
|
|
53
|
+
async run(args, userContext) {
|
|
54
|
+
const chain = typeof args.chain === 'string' && args.chain.trim() ? args.chain.trim() : userContext?.chain || undefined;
|
|
55
|
+
const limit = typeof args.limit === 'number' && Number.isFinite(args.limit) && args.limit > 0
|
|
56
|
+
? Math.floor(args.limit)
|
|
57
|
+
: undefined;
|
|
58
|
+
const result = await this.service.getTrendingTokens({ chain, limit });
|
|
59
|
+
if (!result.success) {
|
|
60
|
+
return { error: result.error || 'Failed to fetch trending tokens' };
|
|
61
|
+
}
|
|
62
|
+
const tokens = result.data ?? [];
|
|
63
|
+
return {
|
|
64
|
+
_instructions: 'Present the trending tokens as a ranked list. For each token show: rank number, name & symbol, ' +
|
|
65
|
+
'current USD price, 24h price change % (use ▲ for positive, ▼ for negative), ' +
|
|
66
|
+
'market cap, 24h volume, and liquidity. Format numbers in a human-readable way ' +
|
|
67
|
+
'(e.g. $1.23, +5.67%, $12.5M). If a field is null, omit it.',
|
|
68
|
+
chain: chain ?? 'all',
|
|
69
|
+
count: tokens.length,
|
|
70
|
+
tokens: tokens,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.TrendingTokensTool = TrendingTokensTool;
|
|
75
|
+
//# sourceMappingURL=TrendingTokensTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TrendingTokensTool.js","sourceRoot":"","sources":["../../../../src/tools/builtin/token/TrendingTokensTool.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAE1C,qEAA6F;AAI7F;;;;;;;;;;;;GAYG;AACH,MAAa,kBAAmB,SAAQ,mBAAQ;IAC9C,IAAI,GAAG,qBAAqB,CAAC;IAC7B,WAAW,GACT,4GAA4G;QAC5G,2GAA2G;QAC3G,uEAAuE;QACvE,mGAAmG;QACnG,oCAAoC;QACpC,iGAAiG;QACjG,mFAAmF;QACnF,yFAAyF,CAAC;IAC5F,QAAQ,GAAG,iBAAiB,CAAC;IAC7B,UAAU,GAAoB;QAC5B;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,8DAA8D;gBAC9D,6EAA6E;gBAC7E,yDAAyD;gBACzD,8CAA8C;YAChD,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,QAA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E,MAAM;SACf,CAAC;IACJ,CAAC;CACF;AAnED,gDAmEC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { TokenInfoTool } from './TokenInfoTool';
|
|
2
|
+
export type { TokenInfoToolConfig } from './TokenInfoTool';
|
|
3
|
+
export { TokenHoldersTool } from './TokenHoldersTool';
|
|
4
|
+
export type { TokenHoldersToolConfig } from './TokenHoldersTool';
|
|
5
|
+
export { TokenAnalyticsTool } from './TokenAnalyticsTool';
|
|
6
|
+
export type { TokenAnalyticsToolConfig } from './TokenAnalyticsTool';
|
|
7
|
+
export { TokenScoreTool } from './TokenScoreTool';
|
|
8
|
+
export type { TokenScoreToolConfig } from './TokenScoreTool';
|
|
9
|
+
export { TrendingTokensTool } from './TrendingTokensTool';
|
|
10
|
+
export type { TrendingTokensToolConfig } from './TrendingTokensTool';
|
|
11
|
+
export { TopGainersTool } from './TopGainersTool';
|
|
12
|
+
export type { TopGainersToolConfig } from './TopGainersTool';
|
|
13
|
+
export { TopLosersTool } from './TopLosersTool';
|
|
14
|
+
export type { TopLosersToolConfig } from './TopLosersTool';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/builtin/token/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TopLosersTool = exports.TopGainersTool = exports.TrendingTokensTool = exports.TokenScoreTool = exports.TokenAnalyticsTool = exports.TokenHoldersTool = exports.TokenInfoTool = void 0;
|
|
4
|
+
var TokenInfoTool_1 = require("./TokenInfoTool");
|
|
5
|
+
Object.defineProperty(exports, "TokenInfoTool", { enumerable: true, get: function () { return TokenInfoTool_1.TokenInfoTool; } });
|
|
6
|
+
var TokenHoldersTool_1 = require("./TokenHoldersTool");
|
|
7
|
+
Object.defineProperty(exports, "TokenHoldersTool", { enumerable: true, get: function () { return TokenHoldersTool_1.TokenHoldersTool; } });
|
|
8
|
+
var TokenAnalyticsTool_1 = require("./TokenAnalyticsTool");
|
|
9
|
+
Object.defineProperty(exports, "TokenAnalyticsTool", { enumerable: true, get: function () { return TokenAnalyticsTool_1.TokenAnalyticsTool; } });
|
|
10
|
+
var TokenScoreTool_1 = require("./TokenScoreTool");
|
|
11
|
+
Object.defineProperty(exports, "TokenScoreTool", { enumerable: true, get: function () { return TokenScoreTool_1.TokenScoreTool; } });
|
|
12
|
+
var TrendingTokensTool_1 = require("./TrendingTokensTool");
|
|
13
|
+
Object.defineProperty(exports, "TrendingTokensTool", { enumerable: true, get: function () { return TrendingTokensTool_1.TrendingTokensTool; } });
|
|
14
|
+
var TopGainersTool_1 = require("./TopGainersTool");
|
|
15
|
+
Object.defineProperty(exports, "TopGainersTool", { enumerable: true, get: function () { return TopGainersTool_1.TopGainersTool; } });
|
|
16
|
+
var TopLosersTool_1 = require("./TopLosersTool");
|
|
17
|
+
Object.defineProperty(exports, "TopLosersTool", { enumerable: true, get: function () { return TopLosersTool_1.TopLosersTool; } });
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tools/builtin/token/index.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AAEtB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AAEzB,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAE3B,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AAEvB,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAE3B,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AAEvB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { BaseTool } from '../../BaseTool';
|
|
2
|
+
import type { ToolParameter, UserContext } from '../../../types';
|
|
3
|
+
import { type MoralisServiceConfig } from '../../../services/MoralisService';
|
|
4
|
+
export type TransactionByHashToolConfig = MoralisServiceConfig;
|
|
5
|
+
export declare class TransactionByHashTool extends BaseTool {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
category: string;
|
|
9
|
+
parameters: ToolParameter[];
|
|
10
|
+
private service;
|
|
11
|
+
constructor(config?: TransactionByHashToolConfig);
|
|
12
|
+
protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
|
|
13
|
+
error: string;
|
|
14
|
+
hash?: undefined;
|
|
15
|
+
status?: undefined;
|
|
16
|
+
timestamp?: undefined;
|
|
17
|
+
blockNumber?: undefined;
|
|
18
|
+
from?: undefined;
|
|
19
|
+
to?: undefined;
|
|
20
|
+
valueEth?: undefined;
|
|
21
|
+
fee?: undefined;
|
|
22
|
+
gasUsed?: undefined;
|
|
23
|
+
gasPriceGwei?: undefined;
|
|
24
|
+
decodedCall?: undefined;
|
|
25
|
+
decodedEvents?: undefined;
|
|
26
|
+
contractCreated?: undefined;
|
|
27
|
+
logs?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
hash: string;
|
|
30
|
+
status: string;
|
|
31
|
+
timestamp: string;
|
|
32
|
+
blockNumber: string;
|
|
33
|
+
from: {
|
|
34
|
+
address: string;
|
|
35
|
+
label: string | null;
|
|
36
|
+
entity: string | null;
|
|
37
|
+
};
|
|
38
|
+
to: {
|
|
39
|
+
address: string;
|
|
40
|
+
label: string | null;
|
|
41
|
+
entity: string | null;
|
|
42
|
+
} | null;
|
|
43
|
+
valueEth: string;
|
|
44
|
+
fee: string;
|
|
45
|
+
gasUsed: string;
|
|
46
|
+
gasPriceGwei: string | null;
|
|
47
|
+
decodedCall: {
|
|
48
|
+
signature: string;
|
|
49
|
+
label: string;
|
|
50
|
+
params: import("../../../services/MoralisService").DecodedParam[];
|
|
51
|
+
} | null;
|
|
52
|
+
decodedEvents: {
|
|
53
|
+
contract: string;
|
|
54
|
+
signature: string;
|
|
55
|
+
label: string;
|
|
56
|
+
params: import("../../../services/MoralisService").DecodedParam[];
|
|
57
|
+
}[];
|
|
58
|
+
contractCreated: string | null;
|
|
59
|
+
logs: {
|
|
60
|
+
address: string;
|
|
61
|
+
decodedEvent: {
|
|
62
|
+
signature: string;
|
|
63
|
+
label: string;
|
|
64
|
+
params: import("../../../services/MoralisService").DecodedParam[];
|
|
65
|
+
} | null;
|
|
66
|
+
}[];
|
|
67
|
+
error?: undefined;
|
|
68
|
+
}>;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=TransactionByHashTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransactionByHashTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/builtin/wallet/TransactionByHashTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAkB,KAAK,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAE7F,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,CAAC;AAY/D,qBAAa,qBAAsB,SAAQ,QAAQ;IACjD,IAAI,SAA6B;IACjC,WAAW,SAOuE;IAClF,QAAQ,SAAqB;IAC7B,UAAU,EAAE,aAAa,EAAE,CAezB;IAEF,OAAO,CAAC,OAAO,CAAiB;gBAEpB,MAAM,CAAC,EAAE,2BAA2B;cAKhC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqE7E"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionByHashTool = void 0;
|
|
4
|
+
const BaseTool_1 = require("../../BaseTool");
|
|
5
|
+
const MoralisService_1 = require("../../../services/MoralisService");
|
|
6
|
+
function formatWei(weiStr) {
|
|
7
|
+
try {
|
|
8
|
+
const eth = Number(BigInt(weiStr)) / 1e18;
|
|
9
|
+
const s = eth.toFixed(10).replace(/\.?0+$/, '');
|
|
10
|
+
return s || '0';
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return weiStr;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
class TransactionByHashTool extends BaseTool_1.BaseTool {
|
|
17
|
+
name = 'get-transaction-by-hash';
|
|
18
|
+
description = 'Get full decoded details of a single EVM transaction by its hash. ' +
|
|
19
|
+
'Returns: status (success/failed), timestamp, from/to addresses with labels and entity names, ' +
|
|
20
|
+
'native value transferred (ETH), transaction fee, gas used, decoded function call with params, ' +
|
|
21
|
+
'and decoded event logs (ERC-20 transfers, swaps, approvals, etc.). ' +
|
|
22
|
+
'Use this when the user asks: "what did this transaction do?", "explain tx 0x…", ' +
|
|
23
|
+
'"was this transaction successful?", "who sent/received in this tx?", "what function was called?". ' +
|
|
24
|
+
'Supports: Ethereum, Optimism, BSC, Polygon, Base, Arbitrum, Avalanche, Linea.';
|
|
25
|
+
category = 'blockchain-data';
|
|
26
|
+
parameters = [
|
|
27
|
+
{
|
|
28
|
+
name: 'transactionHash',
|
|
29
|
+
type: 'string',
|
|
30
|
+
description: 'The transaction hash to look up (0x…).',
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'chain',
|
|
35
|
+
type: 'string',
|
|
36
|
+
description: 'Hex chain ID: "0x1" Ethereum, "0xa" Optimism, "0x38" BSC, "0x89" Polygon, "0x2105" Base, ' +
|
|
37
|
+
'"0xa4b1" Arbitrum, "0xa86a" Avalanche, "0xe708" Linea. Defaults to connected chain.',
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
service;
|
|
42
|
+
constructor(config) {
|
|
43
|
+
super();
|
|
44
|
+
this.service = new MoralisService_1.MoralisService(config);
|
|
45
|
+
}
|
|
46
|
+
async run(args, userContext) {
|
|
47
|
+
const transactionHash = args.transactionHash;
|
|
48
|
+
const chain = args.chain || userContext?.chain || undefined;
|
|
49
|
+
if (!transactionHash) {
|
|
50
|
+
return { error: 'Transaction hash is required.' };
|
|
51
|
+
}
|
|
52
|
+
const result = await this.service.getTransactionByHash({ transactionHash, chain });
|
|
53
|
+
if (!result.success || !result.data) {
|
|
54
|
+
return { error: result.error || 'Failed to fetch transaction' };
|
|
55
|
+
}
|
|
56
|
+
const tx = result.data;
|
|
57
|
+
const decodedEvents = (tx.logs ?? [])
|
|
58
|
+
.filter((log) => !!log.decoded_event)
|
|
59
|
+
.map((log) => ({
|
|
60
|
+
contract: log.address,
|
|
61
|
+
signature: log.decoded_event.signature,
|
|
62
|
+
label: log.decoded_event.label,
|
|
63
|
+
params: log.decoded_event.params,
|
|
64
|
+
}));
|
|
65
|
+
const logs = tx.logs.map((log) => ({
|
|
66
|
+
address: log.address,
|
|
67
|
+
decodedEvent: log.decoded_event
|
|
68
|
+
? {
|
|
69
|
+
signature: log.decoded_event.signature,
|
|
70
|
+
label: log.decoded_event.label,
|
|
71
|
+
params: log.decoded_event.params,
|
|
72
|
+
}
|
|
73
|
+
: null,
|
|
74
|
+
}));
|
|
75
|
+
return {
|
|
76
|
+
hash: tx.hash,
|
|
77
|
+
status: tx.receipt_status === '1' ? 'success' : tx.receipt_status === '0' ? 'failed' : 'unknown',
|
|
78
|
+
timestamp: tx.block_timestamp,
|
|
79
|
+
blockNumber: tx.block_number,
|
|
80
|
+
from: {
|
|
81
|
+
address: tx.from_address,
|
|
82
|
+
label: tx.from_address_label || null,
|
|
83
|
+
entity: tx.from_address_entity || null,
|
|
84
|
+
},
|
|
85
|
+
to: tx.to_address
|
|
86
|
+
? {
|
|
87
|
+
address: tx.to_address,
|
|
88
|
+
label: tx.to_address_label || null,
|
|
89
|
+
entity: tx.to_address_entity || null,
|
|
90
|
+
}
|
|
91
|
+
: null,
|
|
92
|
+
valueEth: formatWei(tx.value || '0'),
|
|
93
|
+
fee: tx.transaction_fee,
|
|
94
|
+
gasUsed: tx.receipt_gas_used,
|
|
95
|
+
gasPriceGwei: tx.gas_price ? (Number(tx.gas_price) / 1e9).toFixed(4) : null,
|
|
96
|
+
decodedCall: tx.decoded_call
|
|
97
|
+
? {
|
|
98
|
+
signature: tx.decoded_call.signature,
|
|
99
|
+
label: tx.decoded_call.label,
|
|
100
|
+
params: tx.decoded_call.params,
|
|
101
|
+
}
|
|
102
|
+
: null,
|
|
103
|
+
decodedEvents,
|
|
104
|
+
contractCreated: tx.receipt_contract_address || null,
|
|
105
|
+
logs: logs,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.TransactionByHashTool = TransactionByHashTool;
|
|
110
|
+
//# sourceMappingURL=TransactionByHashTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransactionByHashTool.js","sourceRoot":"","sources":["../../../../src/tools/builtin/wallet/TransactionByHashTool.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAE1C,qEAA6F;AAI7F,SAAS,SAAS,CAAC,MAAc;IAC/B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;QAC1C,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,GAAG,CAAC;IAClB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC;AAED,MAAa,qBAAsB,SAAQ,mBAAQ;IACjD,IAAI,GAAG,yBAAyB,CAAC;IACjC,WAAW,GACT,oEAAoE;QACpE,+FAA+F;QAC/F,gGAAgG;QAChG,qEAAqE;QACrE,kFAAkF;QAClF,oGAAoG;QACpG,+EAA+E,CAAC;IAClF,QAAQ,GAAG,iBAAiB,CAAC;IAC7B,UAAU,GAAoB;QAC5B;YACE,IAAI,EAAE,iBAAiB;YACvB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,2FAA2F;gBAC3F,qFAAqF;YACvF,QAAQ,EAAE,IAAI;SACf;KACF,CAAC;IAEM,OAAO,CAAiB;IAEhC,YAAY,MAAoC;QAC9C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,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AAE,EAAE,CAAC,YAAY;gBAC1B,CAAC,CAAC;oBACE,SAAS,EAAE,EAAE,CAAC,YAAY,CAAC,SAAS;oBACpC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK;oBAC5B,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM;iBAC/B;gBACH,CAAC,CAAC,IAAI;YACR,aAAa;YACb,eAAe,EAAE,EAAE,CAAC,wBAAwB,IAAI,IAAI;YACpD,IAAI,EAAE,IAAI;SACX,CAAC;IACJ,CAAC;CACF;AAxGD,sDAwGC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { BaseTool } from '../../BaseTool';
|
|
2
|
+
import type { ToolParameter, UserContext } from '../../../types';
|
|
3
|
+
import { type MoralisServiceConfig } from '../../../services/MoralisService';
|
|
4
|
+
export type WalletApprovalsToolConfig = MoralisServiceConfig;
|
|
5
|
+
/**
|
|
6
|
+
* Tool: get-wallet-approvals
|
|
7
|
+
*
|
|
8
|
+
* Queries `GET /wallets/{address}/approvals` — every active ERC-20 token
|
|
9
|
+
* approval the wallet currently has outstanding. This is the primary
|
|
10
|
+
* security-surface tool: surfacing unlimited approvals, high USD-at-risk
|
|
11
|
+
* approvals, and approvals to spam / unverified contracts.
|
|
12
|
+
*
|
|
13
|
+
* Moralis docs: https://docs.moralis.com/data-api/evm/wallet/approvals
|
|
14
|
+
*/
|
|
15
|
+
export declare class WalletApprovalsTool extends BaseTool {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
category: string;
|
|
19
|
+
parameters: ToolParameter[];
|
|
20
|
+
private service;
|
|
21
|
+
constructor(config?: WalletApprovalsToolConfig);
|
|
22
|
+
protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
|
|
23
|
+
error: string;
|
|
24
|
+
walletAddress?: undefined;
|
|
25
|
+
chain?: undefined;
|
|
26
|
+
filters?: undefined;
|
|
27
|
+
pagination?: undefined;
|
|
28
|
+
summary?: undefined;
|
|
29
|
+
approvals?: undefined;
|
|
30
|
+
riskyApprovals?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
walletAddress: string;
|
|
33
|
+
chain: string;
|
|
34
|
+
filters: {
|
|
35
|
+
limit: number;
|
|
36
|
+
cursor: string | null;
|
|
37
|
+
};
|
|
38
|
+
pagination: {
|
|
39
|
+
cursor: string | null;
|
|
40
|
+
pageSize: number;
|
|
41
|
+
page: number | null;
|
|
42
|
+
hasMore: boolean;
|
|
43
|
+
};
|
|
44
|
+
summary: {
|
|
45
|
+
totalApprovals: number;
|
|
46
|
+
unlimitedApprovals: number;
|
|
47
|
+
totalUsdAtRisk: number;
|
|
48
|
+
riskyApprovalCount: number;
|
|
49
|
+
};
|
|
50
|
+
approvals: {
|
|
51
|
+
blockNumber: string;
|
|
52
|
+
blockTimestamp: string | null;
|
|
53
|
+
transactionHash: string | null;
|
|
54
|
+
value: string;
|
|
55
|
+
valueFormatted: string | null;
|
|
56
|
+
isUnlimited: boolean;
|
|
57
|
+
token: {
|
|
58
|
+
address: string;
|
|
59
|
+
addressLabel: string | null;
|
|
60
|
+
name: string | null;
|
|
61
|
+
symbol: string | null;
|
|
62
|
+
logo: string | null;
|
|
63
|
+
possibleSpam: boolean;
|
|
64
|
+
verifiedContract: boolean | null;
|
|
65
|
+
currentBalance: string | null;
|
|
66
|
+
currentBalanceFormatted: string | null;
|
|
67
|
+
usdPrice: string | null;
|
|
68
|
+
usdAtRisk: string | null;
|
|
69
|
+
};
|
|
70
|
+
spender: {
|
|
71
|
+
address: string;
|
|
72
|
+
label: string | null;
|
|
73
|
+
entity: string | null;
|
|
74
|
+
entityLogo: string | null;
|
|
75
|
+
};
|
|
76
|
+
}[];
|
|
77
|
+
riskyApprovals: {
|
|
78
|
+
blockNumber: string;
|
|
79
|
+
blockTimestamp: string | null;
|
|
80
|
+
transactionHash: string | null;
|
|
81
|
+
value: string;
|
|
82
|
+
valueFormatted: string | null;
|
|
83
|
+
isUnlimited: boolean;
|
|
84
|
+
token: {
|
|
85
|
+
address: string;
|
|
86
|
+
addressLabel: string | null;
|
|
87
|
+
name: string | null;
|
|
88
|
+
symbol: string | null;
|
|
89
|
+
logo: string | null;
|
|
90
|
+
possibleSpam: boolean;
|
|
91
|
+
verifiedContract: boolean | null;
|
|
92
|
+
currentBalance: string | null;
|
|
93
|
+
currentBalanceFormatted: string | null;
|
|
94
|
+
usdPrice: string | null;
|
|
95
|
+
usdAtRisk: string | null;
|
|
96
|
+
};
|
|
97
|
+
spender: {
|
|
98
|
+
address: string;
|
|
99
|
+
label: string | null;
|
|
100
|
+
entity: string | null;
|
|
101
|
+
entityLogo: string | null;
|
|
102
|
+
};
|
|
103
|
+
}[];
|
|
104
|
+
error?: undefined;
|
|
105
|
+
}>;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=WalletApprovalsTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletApprovalsTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/builtin/wallet/WalletApprovalsTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAkB,KAAK,oBAAoB,EAAsB,MAAM,kCAAkC,CAAC;AAEjH,MAAM,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;AAU7D;;;;;;;;;GASG;AACH,qBAAa,mBAAoB,SAAQ,QAAQ;IAC/C,IAAI,SAA0B;IAC9B,WAAW,SAYyC;IACpD,QAAQ,SAAqB;IAC7B,UAAU,EAAE,aAAa,EAAE,CA4BzB;IAEF,OAAO,CAAC,OAAO,CAAiB;gBAEpB,MAAM,CAAC,EAAE,yBAAyB;cAK9B,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwD7E"}
|