keyring-agent-core 0.1.1 → 0.2.1
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/agent/AgentCore.d.ts +37 -1
- package/dist/agent/AgentCore.d.ts.map +1 -1
- package/dist/agent/AgentCore.js +287 -144
- package/dist/agent/AgentCore.js.map +1 -1
- package/dist/agent/QueryRewriter.d.ts +17 -0
- package/dist/agent/QueryRewriter.d.ts.map +1 -1
- package/dist/agent/QueryRewriter.js +48 -4
- package/dist/agent/QueryRewriter.js.map +1 -1
- package/dist/agent/Router.d.ts.map +1 -1
- package/dist/agent/Router.js +73 -35
- package/dist/agent/Router.js.map +1 -1
- package/dist/agent/Subagent.d.ts +17 -0
- package/dist/agent/Subagent.d.ts.map +1 -1
- package/dist/agent/Subagent.js +32 -0
- package/dist/agent/Subagent.js.map +1 -1
- package/dist/agent/chatGraph.d.ts +364 -0
- package/dist/agent/chatGraph.d.ts.map +1 -0
- package/dist/agent/chatGraph.js +184 -0
- package/dist/agent/chatGraph.js.map +1 -0
- package/dist/agent/subagents/AiAgent.d.ts +1 -1
- package/dist/agent/subagents/AiAgent.d.ts.map +1 -1
- package/dist/agent/subagents/AiAgent.js +24 -20
- package/dist/agent/subagents/AiAgent.js.map +1 -1
- package/dist/agent/subagents/NftAgent.d.ts +1 -1
- package/dist/agent/subagents/NftAgent.d.ts.map +1 -1
- package/dist/agent/subagents/NftAgent.js +36 -26
- package/dist/agent/subagents/NftAgent.js.map +1 -1
- package/dist/agent/subagents/PoolSubgraphAgent.d.ts +6 -0
- package/dist/agent/subagents/PoolSubgraphAgent.d.ts.map +1 -0
- package/dist/agent/subagents/PoolSubgraphAgent.js +117 -0
- package/dist/agent/subagents/PoolSubgraphAgent.js.map +1 -0
- package/dist/agent/subagents/TokenAgent.d.ts +1 -1
- package/dist/agent/subagents/TokenAgent.d.ts.map +1 -1
- package/dist/agent/subagents/TokenAgent.js +23 -22
- package/dist/agent/subagents/TokenAgent.js.map +1 -1
- package/dist/agent/subagents/WalletActionAgent.d.ts +6 -0
- package/dist/agent/subagents/WalletActionAgent.d.ts.map +1 -0
- package/dist/agent/subagents/WalletActionAgent.js +55 -0
- package/dist/agent/subagents/WalletActionAgent.js.map +1 -0
- package/dist/agent/subagents/WalletAgent.d.ts +1 -1
- package/dist/agent/subagents/WalletAgent.d.ts.map +1 -1
- package/dist/agent/subagents/WalletAgent.js +18 -17
- package/dist/agent/subagents/WalletAgent.js.map +1 -1
- package/dist/agent/subagents/index.d.ts +23 -3
- package/dist/agent/subagents/index.d.ts.map +1 -1
- package/dist/agent/subagents/index.js +42 -11
- package/dist/agent/subagents/index.js.map +1 -1
- package/dist/constants/abi.d.ts +31 -0
- package/dist/constants/abi.d.ts.map +1 -1
- package/dist/constants/abi.js +24 -1
- package/dist/constants/abi.js.map +1 -1
- package/dist/functions/web3.d.ts +0 -1
- package/dist/functions/web3.d.ts.map +1 -1
- package/dist/functions/web3.js +0 -45
- package/dist/functions/web3.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/llm/GeminiProvider.d.ts.map +1 -1
- package/dist/llm/GeminiProvider.js +115 -34
- package/dist/llm/GeminiProvider.js.map +1 -1
- package/dist/memory/UpstashKnowledgeBase.d.ts +1 -1
- package/dist/memory/UpstashKnowledgeBase.js +1 -1
- package/dist/services/MoralisService.d.ts +3 -25
- package/dist/services/MoralisService.d.ts.map +1 -1
- package/dist/services/MoralisService.js +7 -132
- package/dist/services/MoralisService.js.map +1 -1
- package/dist/services/PantographService.d.ts +61 -1
- package/dist/services/PantographService.d.ts.map +1 -1
- package/dist/services/PantographService.js +264 -12
- package/dist/services/PantographService.js.map +1 -1
- package/dist/services/PoolService.d.ts +1 -4
- package/dist/services/PoolService.d.ts.map +1 -1
- package/dist/services/PoolService.js +18 -40
- package/dist/services/PoolService.js.map +1 -1
- package/dist/services/UniswapSubgraphService.d.ts +144 -0
- package/dist/services/UniswapSubgraphService.d.ts.map +1 -0
- package/dist/services/UniswapSubgraphService.js +606 -0
- package/dist/services/UniswapSubgraphService.js.map +1 -0
- package/dist/services/rpc.d.ts +35 -0
- package/dist/services/rpc.d.ts.map +1 -0
- package/dist/services/rpc.js +110 -0
- package/dist/services/rpc.js.map +1 -0
- package/dist/services/swap/DebridgeAdapter.d.ts +17 -0
- package/dist/services/swap/DebridgeAdapter.d.ts.map +1 -1
- package/dist/services/swap/DebridgeAdapter.js +74 -6
- package/dist/services/swap/DebridgeAdapter.js.map +1 -1
- package/dist/services/swap/SwapServiceFactory.d.ts +1 -0
- package/dist/services/swap/SwapServiceFactory.d.ts.map +1 -1
- package/dist/services/swap/SwapServiceFactory.js +8 -3
- package/dist/services/swap/SwapServiceFactory.js.map +1 -1
- package/dist/tools/builtin/ai/GeminiSearchAiTool.d.ts +36 -0
- package/dist/tools/builtin/ai/GeminiSearchAiTool.d.ts.map +1 -0
- package/dist/tools/builtin/ai/GeminiSearchAiTool.js +91 -0
- package/dist/tools/builtin/ai/GeminiSearchAiTool.js.map +1 -0
- package/dist/tools/builtin/ai/index.d.ts +2 -4
- package/dist/tools/builtin/ai/index.d.ts.map +1 -1
- package/dist/tools/builtin/ai/index.js +3 -5
- package/dist/tools/builtin/ai/index.js.map +1 -1
- package/dist/tools/builtin/index.d.ts +2 -0
- package/dist/tools/builtin/index.d.ts.map +1 -1
- package/dist/tools/builtin/index.js +2 -0
- package/dist/tools/builtin/index.js.map +1 -1
- package/dist/tools/builtin/nft/BaseNftMessageTool.d.ts +35 -0
- package/dist/tools/builtin/nft/BaseNftMessageTool.d.ts.map +1 -0
- package/dist/tools/builtin/nft/BaseNftMessageTool.js +45 -0
- package/dist/tools/builtin/nft/BaseNftMessageTool.js.map +1 -0
- package/dist/tools/builtin/nft/NFTContractInfoTool.d.ts +7 -13
- package/dist/tools/builtin/nft/NFTContractInfoTool.d.ts.map +1 -1
- package/dist/tools/builtin/nft/NFTContractInfoTool.js +8 -43
- package/dist/tools/builtin/nft/NFTContractInfoTool.js.map +1 -1
- package/dist/tools/builtin/nft/NFTMetadataTool.d.ts +7 -113
- package/dist/tools/builtin/nft/NFTMetadataTool.d.ts.map +1 -1
- package/dist/tools/builtin/nft/NFTMetadataTool.js +9 -148
- package/dist/tools/builtin/nft/NFTMetadataTool.js.map +1 -1
- package/dist/tools/builtin/nft/SendNftTool.d.ts +14 -0
- package/dist/tools/builtin/nft/SendNftTool.d.ts.map +1 -0
- package/dist/tools/builtin/nft/SendNftTool.js +20 -0
- package/dist/tools/builtin/nft/SendNftTool.js.map +1 -0
- package/dist/tools/builtin/nft/WalletNFTsTool.d.ts +7 -74
- package/dist/tools/builtin/nft/WalletNFTsTool.d.ts.map +1 -1
- package/dist/tools/builtin/nft/WalletNFTsTool.js +9 -161
- package/dist/tools/builtin/nft/WalletNFTsTool.js.map +1 -1
- package/dist/tools/builtin/pool/EstimatePoolYieldTool.d.ts.map +1 -1
- package/dist/tools/builtin/pool/EstimatePoolYieldTool.js +4 -3
- package/dist/tools/builtin/pool/EstimatePoolYieldTool.js.map +1 -1
- package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.d.ts +1 -0
- package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.d.ts.map +1 -1
- package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.js +8 -5
- package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.js.map +1 -1
- package/dist/tools/builtin/pool/PoolByAddressTool.d.ts.map +1 -1
- package/dist/tools/builtin/pool/PoolByAddressTool.js +4 -3
- package/dist/tools/builtin/pool/PoolByAddressTool.js.map +1 -1
- package/dist/tools/builtin/pool/PoolDetailTool.d.ts.map +1 -1
- package/dist/tools/builtin/pool/PoolDetailTool.js +4 -3
- package/dist/tools/builtin/pool/PoolDetailTool.js.map +1 -1
- package/dist/tools/builtin/pool/PoolSearchTool.d.ts.map +1 -1
- package/dist/tools/builtin/pool/PoolSearchTool.js +4 -3
- package/dist/tools/builtin/pool/PoolSearchTool.js.map +1 -1
- package/dist/tools/builtin/pool/PreviewAddLiquidityTool.d.ts +1 -0
- package/dist/tools/builtin/pool/PreviewAddLiquidityTool.d.ts.map +1 -1
- package/dist/tools/builtin/pool/PreviewAddLiquidityTool.js +5 -3
- package/dist/tools/builtin/pool/PreviewAddLiquidityTool.js.map +1 -1
- package/dist/tools/builtin/pool/TopPoolsTool.d.ts.map +1 -1
- package/dist/tools/builtin/pool/TopPoolsTool.js +4 -3
- package/dist/tools/builtin/pool/TopPoolsTool.js.map +1 -1
- package/dist/tools/builtin/pool-subgraph/SubgraphCoinPoolPairsTool.d.ts +54 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphCoinPoolPairsTool.d.ts.map +1 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphCoinPoolPairsTool.js +98 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphCoinPoolPairsTool.js.map +1 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolByAddressTool.d.ts +63 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolByAddressTool.d.ts.map +1 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolByAddressTool.js +82 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolByAddressTool.js.map +1 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolByPositionIdTool.d.ts +79 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolByPositionIdTool.d.ts.map +1 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolByPositionIdTool.js +97 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolByPositionIdTool.js.map +1 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolSearchTool.d.ts +77 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolSearchTool.d.ts.map +1 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolSearchTool.js +190 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphPoolSearchTool.js.map +1 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphPositionDetailTool.d.ts +107 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphPositionDetailTool.d.ts.map +1 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphPositionDetailTool.js +92 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphPositionDetailTool.js.map +1 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphTrendingPoolsTool.d.ts +56 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphTrendingPoolsTool.d.ts.map +1 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphTrendingPoolsTool.js +94 -0
- package/dist/tools/builtin/pool-subgraph/SubgraphTrendingPoolsTool.js.map +1 -0
- package/dist/tools/builtin/pool-subgraph/index.d.ts +13 -0
- package/dist/tools/builtin/pool-subgraph/index.d.ts.map +1 -0
- package/dist/tools/builtin/pool-subgraph/index.js +18 -0
- package/dist/tools/builtin/pool-subgraph/index.js.map +1 -0
- package/dist/tools/builtin/token/TokenAnalyticsTool.d.ts.map +1 -1
- package/dist/tools/builtin/token/TokenAnalyticsTool.js +4 -3
- package/dist/tools/builtin/token/TokenAnalyticsTool.js.map +1 -1
- package/dist/tools/builtin/token/TokenHoldersTool.d.ts.map +1 -1
- package/dist/tools/builtin/token/TokenHoldersTool.js +4 -3
- package/dist/tools/builtin/token/TokenHoldersTool.js.map +1 -1
- package/dist/tools/builtin/token/TokenInfoTool.d.ts +6 -2
- package/dist/tools/builtin/token/TokenInfoTool.d.ts.map +1 -1
- package/dist/tools/builtin/token/TokenInfoTool.js +66 -8
- package/dist/tools/builtin/token/TokenInfoTool.js.map +1 -1
- package/dist/tools/builtin/token/TokenScoreTool.d.ts.map +1 -1
- package/dist/tools/builtin/token/TokenScoreTool.js +4 -3
- package/dist/tools/builtin/token/TokenScoreTool.js.map +1 -1
- package/dist/tools/builtin/token/TopGainersTool.d.ts +10 -19
- package/dist/tools/builtin/token/TopGainersTool.d.ts.map +1 -1
- package/dist/tools/builtin/token/TopGainersTool.js +44 -54
- package/dist/tools/builtin/token/TopGainersTool.js.map +1 -1
- package/dist/tools/builtin/token/TopLosersTool.d.ts.map +1 -1
- package/dist/tools/builtin/token/TopLosersTool.js +3 -2
- package/dist/tools/builtin/token/TopLosersTool.js.map +1 -1
- package/dist/tools/builtin/token/TrendingTokensTool.d.ts +1 -1
- package/dist/tools/builtin/token/TrendingTokensTool.d.ts.map +1 -1
- package/dist/tools/builtin/token/TrendingTokensTool.js +20 -12
- package/dist/tools/builtin/token/TrendingTokensTool.js.map +1 -1
- package/dist/tools/builtin/token/index.d.ts +0 -2
- package/dist/tools/builtin/token/index.d.ts.map +1 -1
- package/dist/tools/builtin/token/index.js +1 -3
- package/dist/tools/builtin/token/index.js.map +1 -1
- package/dist/tools/builtin/wallet/TransactionByHashTool.d.ts.map +1 -1
- package/dist/tools/builtin/wallet/TransactionByHashTool.js +4 -3
- package/dist/tools/builtin/wallet/TransactionByHashTool.js.map +1 -1
- package/dist/tools/builtin/wallet/WalletApprovalsTool.d.ts.map +1 -1
- package/dist/tools/builtin/wallet/WalletApprovalsTool.js +4 -3
- package/dist/tools/builtin/wallet/WalletApprovalsTool.js.map +1 -1
- package/dist/tools/builtin/wallet/WalletDefiPositionsTool.d.ts.map +1 -1
- package/dist/tools/builtin/wallet/WalletDefiPositionsTool.js +4 -3
- package/dist/tools/builtin/wallet/WalletDefiPositionsTool.js.map +1 -1
- package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.d.ts.map +1 -1
- package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.js +4 -3
- package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.js.map +1 -1
- package/dist/tools/builtin/wallet/WalletDefiSummaryTool.d.ts.map +1 -1
- package/dist/tools/builtin/wallet/WalletDefiSummaryTool.js +4 -3
- package/dist/tools/builtin/wallet/WalletDefiSummaryTool.js.map +1 -1
- package/dist/tools/builtin/wallet/WalletHistoryTool.d.ts.map +1 -1
- package/dist/tools/builtin/wallet/WalletHistoryTool.js +5 -4
- package/dist/tools/builtin/wallet/WalletHistoryTool.js.map +1 -1
- package/dist/tools/builtin/wallet/WalletNetWorthTool.js +1 -1
- package/dist/tools/builtin/wallet/WalletNetWorthTool.js.map +1 -1
- package/dist/tools/builtin/wallet/WalletNftTransfersTool.d.ts.map +1 -1
- package/dist/tools/builtin/wallet/WalletNftTransfersTool.js +5 -4
- package/dist/tools/builtin/wallet/WalletNftTransfersTool.js.map +1 -1
- package/dist/tools/builtin/wallet/WalletPnlSummaryTool.d.ts.map +1 -1
- package/dist/tools/builtin/wallet/WalletPnlSummaryTool.js +4 -3
- package/dist/tools/builtin/wallet/WalletPnlSummaryTool.js.map +1 -1
- package/dist/tools/builtin/wallet/WalletPnlTool.d.ts.map +1 -1
- package/dist/tools/builtin/wallet/WalletPnlTool.js +4 -3
- package/dist/tools/builtin/wallet/WalletPnlTool.js.map +1 -1
- package/dist/tools/builtin/wallet/WalletTokenBalancesTool.d.ts.map +1 -1
- package/dist/tools/builtin/wallet/WalletTokenBalancesTool.js +4 -3
- package/dist/tools/builtin/wallet/WalletTokenBalancesTool.js.map +1 -1
- package/dist/tools/builtin/wallet/WalletTokenTransfersTool.d.ts.map +1 -1
- package/dist/tools/builtin/wallet/WalletTokenTransfersTool.js +5 -4
- package/dist/tools/builtin/wallet/WalletTokenTransfersTool.js.map +1 -1
- package/dist/tools/builtin/wallet/index.d.ts +3 -0
- package/dist/tools/builtin/wallet/index.d.ts.map +1 -1
- package/dist/tools/builtin/wallet/index.js +5 -1
- package/dist/tools/builtin/wallet/index.js.map +1 -1
- package/dist/tools/builtin/wallet-action/ApproveTokenTool.d.ts +25 -0
- package/dist/tools/builtin/wallet-action/ApproveTokenTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet-action/ApproveTokenTool.js +98 -0
- package/dist/tools/builtin/wallet-action/ApproveTokenTool.js.map +1 -0
- package/dist/tools/builtin/wallet-action/BaseWalletActionTool.d.ts +211 -0
- package/dist/tools/builtin/wallet-action/BaseWalletActionTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet-action/BaseWalletActionTool.js +499 -0
- package/dist/tools/builtin/wallet-action/BaseWalletActionTool.js.map +1 -0
- package/dist/tools/builtin/wallet-action/BuyTokenTool.d.ts +240 -0
- package/dist/tools/builtin/wallet-action/BuyTokenTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet-action/BuyTokenTool.js +1257 -0
- package/dist/tools/builtin/wallet-action/BuyTokenTool.js.map +1 -0
- package/dist/tools/builtin/wallet-action/SendNativeTool.d.ts +41 -0
- package/dist/tools/builtin/wallet-action/SendNativeTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet-action/SendNativeTool.js +127 -0
- package/dist/tools/builtin/wallet-action/SendNativeTool.js.map +1 -0
- package/dist/tools/builtin/wallet-action/SendTokenTool.d.ts +63 -0
- package/dist/tools/builtin/wallet-action/SendTokenTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet-action/SendTokenTool.js +294 -0
- package/dist/tools/builtin/wallet-action/SendTokenTool.js.map +1 -0
- package/dist/tools/builtin/wallet-action/SwapTokenTool.d.ts +247 -0
- package/dist/tools/builtin/wallet-action/SwapTokenTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet-action/SwapTokenTool.js +1258 -0
- package/dist/tools/builtin/wallet-action/SwapTokenTool.js.map +1 -0
- package/dist/tools/builtin/wallet-action/UnwrapNativeTool.d.ts +20 -0
- package/dist/tools/builtin/wallet-action/UnwrapNativeTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet-action/UnwrapNativeTool.js +36 -0
- package/dist/tools/builtin/wallet-action/UnwrapNativeTool.js.map +1 -0
- package/dist/tools/builtin/wallet-action/WrapNativeTool.d.ts +23 -0
- package/dist/tools/builtin/wallet-action/WrapNativeTool.d.ts.map +1 -0
- package/dist/tools/builtin/wallet-action/WrapNativeTool.js +54 -0
- package/dist/tools/builtin/wallet-action/WrapNativeTool.js.map +1 -0
- package/dist/tools/builtin/wallet-action/amountSpec.d.ts +62 -0
- package/dist/tools/builtin/wallet-action/amountSpec.d.ts.map +1 -0
- package/dist/tools/builtin/wallet-action/amountSpec.js +93 -0
- package/dist/tools/builtin/wallet-action/amountSpec.js.map +1 -0
- package/dist/tools/builtin/wallet-action/gasReserve.d.ts +42 -0
- package/dist/tools/builtin/wallet-action/gasReserve.d.ts.map +1 -0
- package/dist/tools/builtin/wallet-action/gasReserve.js +103 -0
- package/dist/tools/builtin/wallet-action/gasReserve.js.map +1 -0
- package/dist/tools/builtin/wallet-action/index.d.ts +9 -0
- package/dist/tools/builtin/wallet-action/index.d.ts.map +1 -0
- package/dist/tools/builtin/wallet-action/index.js +20 -0
- package/dist/tools/builtin/wallet-action/index.js.map +1 -0
- package/dist/tools/chainResolver.d.ts +98 -0
- package/dist/tools/chainResolver.d.ts.map +1 -0
- package/dist/tools/chainResolver.js +302 -0
- package/dist/tools/chainResolver.js.map +1 -0
- package/dist/types/index.d.ts +218 -7
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +5 -2
- package/dist/tools/builtin/ai/MoralisCortexTool.d.ts +0 -33
- package/dist/tools/builtin/ai/MoralisCortexTool.d.ts.map +0 -1
- package/dist/tools/builtin/ai/MoralisCortexTool.js +0 -76
- package/dist/tools/builtin/ai/MoralisCortexTool.js.map +0 -1
- package/dist/tools/builtin/ai/SolanaCortexTool.d.ts +0 -22
- package/dist/tools/builtin/ai/SolanaCortexTool.d.ts.map +0 -1
- package/dist/tools/builtin/ai/SolanaCortexTool.js +0 -80
- package/dist/tools/builtin/ai/SolanaCortexTool.js.map +0 -1
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseWalletActionTool = void 0;
|
|
4
|
+
const BaseTool_1 = require("../../BaseTool");
|
|
5
|
+
const web3_1 = require("../../../functions/web3");
|
|
6
|
+
const MoralisService_1 = require("../../../services/MoralisService");
|
|
7
|
+
const chainResolver_1 = require("../../chainResolver");
|
|
8
|
+
const amountSpec_1 = require("./amountSpec");
|
|
9
|
+
const gasReserve_1 = require("./gasReserve");
|
|
10
|
+
/**
|
|
11
|
+
* Shared base for wallet-action tools.
|
|
12
|
+
*
|
|
13
|
+
* Each concrete tool resolves identifiers + validates inputs, then returns the
|
|
14
|
+
* `WalletActionProps` payload below. The FE owns the form and the on-chain tx;
|
|
15
|
+
* the agent only forwards a structured intent.
|
|
16
|
+
*
|
|
17
|
+
* Subclasses implement `buildAction()` returning the fully-shaped payload (or
|
|
18
|
+
* an `{ error, _instructions }` object that aborts before emitting UI).
|
|
19
|
+
*/
|
|
20
|
+
class BaseWalletActionTool extends BaseTool_1.BaseTool {
|
|
21
|
+
kind = 'action';
|
|
22
|
+
category = 'wallet-action';
|
|
23
|
+
// Wallet-action tools open a concrete form on the FE — the user's next step
|
|
24
|
+
// is to confirm / submit the action, not to be nudged by generic follow-ups.
|
|
25
|
+
noSuggestions = true;
|
|
26
|
+
/**
|
|
27
|
+
* The fields the *user* is expected to fill in the form, with a friendly,
|
|
28
|
+
* user-facing label (in English — the LLM translates to the user's language).
|
|
29
|
+
*
|
|
30
|
+
* Used to build the `_instructions`: any of these whose value the tool could
|
|
31
|
+
* NOT pre-resolve is listed back to the LLM so it can ask the user to enter
|
|
32
|
+
* exactly those. Internal/derived fields (contract_address, decimals, …) must
|
|
33
|
+
* NOT appear here — the user never types them.
|
|
34
|
+
*
|
|
35
|
+
* Order matters: it's the order the LLM should mention missing fields in.
|
|
36
|
+
*
|
|
37
|
+
* `key` may be a single param name or an array — for an array, the field
|
|
38
|
+
* counts as filled when ANY of the listed params has a value (e.g. a buy
|
|
39
|
+
* amount that can be expressed as either `buy_amount` or `pay_with_amount`).
|
|
40
|
+
*/
|
|
41
|
+
userInputFields = [];
|
|
42
|
+
/**
|
|
43
|
+
* Optional Moralis service used to resolve token symbols → contract addresses.
|
|
44
|
+
* Concrete tools that accept a `token_symbol` parameter should accept a
|
|
45
|
+
* `MoralisServiceConfig` in their constructor and forward it to `super()`.
|
|
46
|
+
*/
|
|
47
|
+
moralis;
|
|
48
|
+
constructor(config) {
|
|
49
|
+
super();
|
|
50
|
+
if (config !== undefined) {
|
|
51
|
+
this.moralis = new MoralisService_1.MoralisService(config);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Resolve a token reference — a SYMBOL ("USDC") or a contract ADDRESS
|
|
56
|
+
* ("0x…") — to a full `ResolvedToken` on a given chain. The Pantograph search
|
|
57
|
+
* endpoint and wallet balances both key on either, so a single path handles
|
|
58
|
+
* both: callers no longer need to special-case address vs symbol.
|
|
59
|
+
*
|
|
60
|
+
* 1. Connected wallet's balances (most reliable — the user actually holds it).
|
|
61
|
+
* 2. Pantograph token search (fallback).
|
|
62
|
+
*
|
|
63
|
+
* Matching: when `key` is an address we match on `token_address`; otherwise on
|
|
64
|
+
* `symbol`. Returns undefined when moralis is not configured or nothing
|
|
65
|
+
* matches — callers decide whether to error or leave the field blank.
|
|
66
|
+
*
|
|
67
|
+
* Mirrors the pattern in TokenScoreTool / TokenAnalyticsTool / TokenHoldersTool.
|
|
68
|
+
*/
|
|
69
|
+
async resolveContractAddress(key, chain, walletAddress) {
|
|
70
|
+
if (!this.moralis || !key)
|
|
71
|
+
return undefined;
|
|
72
|
+
const keyLower = key.trim().toLowerCase();
|
|
73
|
+
const keyIsAddress = (0, web3_1.isAddressEVM)(key.trim());
|
|
74
|
+
const matches = (t) => keyIsAddress ? (t.token_address ?? '').toLowerCase() === keyLower : (t.symbol ?? '').toLowerCase() === keyLower;
|
|
75
|
+
if (walletAddress) {
|
|
76
|
+
const balRes = await this.moralis.getWalletTokenBalances({ address: walletAddress, chain });
|
|
77
|
+
if (balRes.success && balRes.data?.result?.length) {
|
|
78
|
+
const match = balRes.data.result.find(matches);
|
|
79
|
+
if (match) {
|
|
80
|
+
return {
|
|
81
|
+
address: match.token_address,
|
|
82
|
+
symbol: match.symbol,
|
|
83
|
+
name: match.name,
|
|
84
|
+
decimals: typeof match.decimals === 'number' ? match.decimals : undefined,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const searchRes = await this.moralis.searchTokensByKey({ key, chain });
|
|
90
|
+
if (searchRes.success && searchRes.data?.length) {
|
|
91
|
+
const exact = searchRes.data.find(matches);
|
|
92
|
+
const candidate = exact ?? searchRes.data[0];
|
|
93
|
+
if (candidate?.token_address) {
|
|
94
|
+
return {
|
|
95
|
+
address: candidate.token_address,
|
|
96
|
+
symbol: candidate.symbol,
|
|
97
|
+
name: candidate.name,
|
|
98
|
+
decimals: typeof candidate.decimals === 'number' ? candidate.decimals : undefined,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
/** Parse a decimals arg (number or numeric string) → integer, or undefined. */
|
|
105
|
+
parseDecimals(value) {
|
|
106
|
+
if (typeof value === 'number' && Number.isInteger(value) && value >= 0)
|
|
107
|
+
return value;
|
|
108
|
+
if (typeof value === 'string' && value.trim()) {
|
|
109
|
+
const n = parseInt(value, 10);
|
|
110
|
+
if (Number.isInteger(n) && n >= 0)
|
|
111
|
+
return n;
|
|
112
|
+
}
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Shared token-resolution for any tool that accepts a `contract_address` +
|
|
117
|
+
* `token_symbol` (+ optional `decimals`) pair. Handles the common flow once:
|
|
118
|
+
*
|
|
119
|
+
* - A valid address in `contractArg` is used directly (and still enriched
|
|
120
|
+
* with symbol/decimals via lookup when possible).
|
|
121
|
+
* - Otherwise the address OR symbol in `contractArg`/`symbolArg` is resolved
|
|
122
|
+
* through {@link resolveContractAddress} (which now matches either).
|
|
123
|
+
* - Returns `{ token: undefined }` when nothing was supplied — the caller
|
|
124
|
+
* decides whether that's a picker, an error, or a blank form field.
|
|
125
|
+
* - Returns `{ error: 'token_not_found' }` when a ref was given but could
|
|
126
|
+
* not be resolved on this chain.
|
|
127
|
+
*
|
|
128
|
+
* `decimalsArg` (if a valid integer) always wins over the looked-up decimals.
|
|
129
|
+
*/
|
|
130
|
+
async resolveTokenRef(input) {
|
|
131
|
+
const { contractArg, symbolArg, decimalsArg, chain, walletAddress } = input;
|
|
132
|
+
const explicitDecimals = this.parseDecimals(decimalsArg);
|
|
133
|
+
const symbolHint = typeof symbolArg === 'string' && symbolArg.trim() ? symbolArg.trim() : undefined;
|
|
134
|
+
const directAddress = this.normaliseAddress(contractArg);
|
|
135
|
+
// The reference the user actually gave: prefer a usable address, else the
|
|
136
|
+
// symbol, else a free-form contract string we'll treat as a search key.
|
|
137
|
+
const contractStr = typeof contractArg === 'string' && contractArg.trim() ? contractArg.trim() : undefined;
|
|
138
|
+
const key = directAddress ?? symbolHint ?? contractStr;
|
|
139
|
+
if (!key)
|
|
140
|
+
return { token: undefined };
|
|
141
|
+
const lookup = await this.resolveContractAddress(key, chain, walletAddress);
|
|
142
|
+
// We had a concrete address — fall back to it even if enrichment failed.
|
|
143
|
+
if (!lookup) {
|
|
144
|
+
if (directAddress) {
|
|
145
|
+
return {
|
|
146
|
+
token: {
|
|
147
|
+
address: directAddress,
|
|
148
|
+
symbol: symbolHint,
|
|
149
|
+
decimals: explicitDecimals,
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
return { error: 'token_not_found', key };
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
token: {
|
|
157
|
+
address: lookup.address,
|
|
158
|
+
symbol: symbolHint ?? lookup.symbol,
|
|
159
|
+
name: lookup.name,
|
|
160
|
+
decimals: explicitDecimals ?? lookup.decimals,
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
requireWallet(userContext) {
|
|
165
|
+
const addr = userContext?.walletAddress;
|
|
166
|
+
if (!addr) {
|
|
167
|
+
return {
|
|
168
|
+
ok: false,
|
|
169
|
+
payload: {
|
|
170
|
+
error: 'wallet_not_connected',
|
|
171
|
+
_instructions: 'The user is not connected. Ask them to connect their wallet before submitting the action. Do NOT render the form.',
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
return { ok: true, address: addr };
|
|
176
|
+
}
|
|
177
|
+
requireChain(args, userContext) {
|
|
178
|
+
// Prefer an explicit arg (set only when the user named a chain), then the
|
|
179
|
+
// connected chain. Both are normalized so "optimism" / "10" / "0xa" all
|
|
180
|
+
// resolve to the canonical hex id. Throws UnsupportedChainError when a chain
|
|
181
|
+
// IS specified but unsupported; returns null only when none is available.
|
|
182
|
+
return (0, chainResolver_1.resolveChainOptional)(args.chain, userContext);
|
|
183
|
+
}
|
|
184
|
+
normaliseAddress(value) {
|
|
185
|
+
if (typeof value !== 'string')
|
|
186
|
+
return null;
|
|
187
|
+
const v = value.trim();
|
|
188
|
+
return (0, web3_1.isAddressEVM)(v) ? v : null;
|
|
189
|
+
}
|
|
190
|
+
normaliseAmount(value) {
|
|
191
|
+
if (typeof value === 'number' && Number.isFinite(value) && value > 0)
|
|
192
|
+
return String(value);
|
|
193
|
+
if (typeof value !== 'string')
|
|
194
|
+
return null;
|
|
195
|
+
const v = value.trim();
|
|
196
|
+
if (!v)
|
|
197
|
+
return null;
|
|
198
|
+
const n = parseFloat(v);
|
|
199
|
+
return Number.isFinite(n) && n > 0 ? v : null;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Resolve a user-supplied amount that may be a plain token amount ("100"), a
|
|
203
|
+
* PERCENT of the held balance ("50%"), or a USD value ("5$"). Plain amounts
|
|
204
|
+
* pass straight through; percent/usd need the token's balance + USD price,
|
|
205
|
+
* read here from the wallet's balances in one call (works for an ERC-20
|
|
206
|
+
* address or the `'native'` sentinel).
|
|
207
|
+
*
|
|
208
|
+
* Returns:
|
|
209
|
+
* - `{ amount }` — concrete token amount string (plain decimal).
|
|
210
|
+
* - `null` — no amount was given (empty/invalid) → caller leaves it blank.
|
|
211
|
+
* - `{ error, _instructions }` — a percent/usd was given but we couldn't get
|
|
212
|
+
* the balance/price needed to convert it; caller surfaces the message.
|
|
213
|
+
*/
|
|
214
|
+
async resolveAmountInput(input) {
|
|
215
|
+
const { rawAmount, tokenAddress, chain, walletAddress, gasKind } = input;
|
|
216
|
+
const spec = (0, amountSpec_1.parseAmountSpec)(rawAmount);
|
|
217
|
+
if (!spec)
|
|
218
|
+
return null;
|
|
219
|
+
const symbol = input.symbol ?? 'the token';
|
|
220
|
+
const isNative = tokenAddress.toLowerCase() === 'native';
|
|
221
|
+
const gasAware = !!gasKind && isNative && !!chain;
|
|
222
|
+
// A plain token amount normally passes straight through. For a gas-aware
|
|
223
|
+
// native spend we still validate it against the spendable balance so we
|
|
224
|
+
// never let the user spend so much they can't cover gas.
|
|
225
|
+
if (spec.kind === 'token' && !gasAware) {
|
|
226
|
+
return { amount: this.toPlainDecimal(spec.value) };
|
|
227
|
+
}
|
|
228
|
+
// Percent/usd (and gas-aware plain) need the held balance and/or price.
|
|
229
|
+
const bal = await this.readTokenBalanceAndPrice(tokenAddress, chain, walletAddress);
|
|
230
|
+
// Compute the spendable native balance once (full balance minus a silent
|
|
231
|
+
// gas reserve). Falls back to the raw balance when gas can't be priced.
|
|
232
|
+
let spendable = bal?.balance;
|
|
233
|
+
if (gasAware && bal?.balance !== undefined) {
|
|
234
|
+
spendable = await this.computeNativeSpendable(chain, gasKind, bal.balance);
|
|
235
|
+
}
|
|
236
|
+
if (spec.kind === 'token') {
|
|
237
|
+
// Gas-aware native: reject an amount that doesn't leave room for gas.
|
|
238
|
+
if (spendable !== undefined && spec.value > spendable) {
|
|
239
|
+
return {
|
|
240
|
+
error: 'amount_exceeds_spendable',
|
|
241
|
+
_instructions: `The user wants to send ${this.toPlainDecimal(spec.value)} ${symbol}, but after leaving enough to cover the network fee they can only send up to ${this.toPlainDecimal(spendable)} ${symbol}. ` +
|
|
242
|
+
`Tell them, in their language, that ${this.toPlainDecimal(spec.value)} ${symbol} is more than they can send and that the most they can send is ${this.toPlainDecimal(spendable)} ${symbol}, and ask them to pick a smaller amount. ` +
|
|
243
|
+
'Do NOT mention gas, fees, tool names, UI, or forms — just refer to the spendable amount.',
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
return { amount: this.toPlainDecimal(spec.value) };
|
|
247
|
+
}
|
|
248
|
+
const resolved = (0, amountSpec_1.resolveAmountSpec)(spec, { balance: spendable, usdPrice: bal?.usdPrice });
|
|
249
|
+
if (!resolved.ok) {
|
|
250
|
+
if (resolved.reason === 'no_balance') {
|
|
251
|
+
return {
|
|
252
|
+
error: 'amount_balance_unavailable',
|
|
253
|
+
_instructions: `Could not read the user's ${symbol} balance to work out ${spec.raw} right now. ` +
|
|
254
|
+
`Tell them, in their language, that the balance couldn't be fetched at the moment and ask them to enter an exact ${symbol} amount instead. ` +
|
|
255
|
+
'Do NOT invent a balance or amount. Do NOT mention tool names, UI, or forms.',
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
return {
|
|
259
|
+
error: 'amount_price_unavailable',
|
|
260
|
+
_instructions: `Could not get a USD price for ${symbol} to work out ${spec.raw} right now. ` +
|
|
261
|
+
`Tell them, in their language, that the price couldn't be fetched at the moment and ask them to enter an exact ${symbol} amount instead. ` +
|
|
262
|
+
'Do NOT invent a price or amount. Do NOT mention tool names, UI, or forms.',
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
return { amount: this.toPlainDecimal(resolved.amount) };
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Spendable native balance (`held − gasReserve`) in human token units, given a
|
|
269
|
+
* balance already read from the wallet. Silently falls back to the full balance
|
|
270
|
+
* when the gas price / chain decimals can't be resolved. See {@link gasReserve}.
|
|
271
|
+
*/
|
|
272
|
+
async computeNativeSpendable(chain, gasKind, balanceNum) {
|
|
273
|
+
const reserve = await (0, gasReserve_1.estimateNativeGasReserveWei)(chain, gasKind);
|
|
274
|
+
return (0, gasReserve_1.spendableNative)(balanceNum, reserve, chain);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Resolve the SPENDABLE native balance for the form card as a plain-decimal
|
|
278
|
+
* STRING (`held − gasReserve`). Returns undefined when the wallet's native
|
|
279
|
+
* balance can't be read — the FE then falls back to the raw balance it already
|
|
280
|
+
* fetches for itself. Best-effort and silent; never throws.
|
|
281
|
+
*/
|
|
282
|
+
async resolveNativeSpendableFormatted(chain, walletAddress, gasKind) {
|
|
283
|
+
if (!chain || !walletAddress)
|
|
284
|
+
return undefined;
|
|
285
|
+
try {
|
|
286
|
+
const bal = await this.readTokenBalanceAndPrice('native', chain, walletAddress);
|
|
287
|
+
if (bal?.balance === undefined)
|
|
288
|
+
return undefined;
|
|
289
|
+
const spendable = await this.computeNativeSpendable(chain, gasKind, bal.balance);
|
|
290
|
+
return this.toPlainDecimal(spendable);
|
|
291
|
+
}
|
|
292
|
+
catch {
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Read a single token's held balance + USD price from the connected wallet's
|
|
298
|
+
* balances (one Moralis call). `tokenAddress` may be an ERC-20 address or the
|
|
299
|
+
* `'native'` sentinel. Returns `undefined` when balances can't be read or the
|
|
300
|
+
* token isn't held; `balance`/`usdPrice` are individually `undefined` when the
|
|
301
|
+
* source omits them.
|
|
302
|
+
*/
|
|
303
|
+
async readTokenBalanceAndPrice(tokenAddress, chain, walletAddress) {
|
|
304
|
+
if (!this.moralis || !walletAddress)
|
|
305
|
+
return undefined;
|
|
306
|
+
const res = await this.moralis.getWalletTokenBalances({
|
|
307
|
+
address: walletAddress,
|
|
308
|
+
chain,
|
|
309
|
+
excludeSpam: true,
|
|
310
|
+
excludeUnverifiedContracts: true,
|
|
311
|
+
});
|
|
312
|
+
const balances = res.success ? (res.data?.result ?? []) : [];
|
|
313
|
+
const wantNative = tokenAddress.toLowerCase() === 'native';
|
|
314
|
+
const addrLower = tokenAddress.toLowerCase();
|
|
315
|
+
const match = balances.find((t) => wantNative ? t.native_token === true : (t.token_address ?? '').toLowerCase() === addrLower);
|
|
316
|
+
if (!match)
|
|
317
|
+
return undefined;
|
|
318
|
+
const balance = match.balance_formatted != null ? Number(match.balance_formatted) : undefined;
|
|
319
|
+
return {
|
|
320
|
+
balance: Number.isFinite(balance) ? balance : undefined,
|
|
321
|
+
usdPrice: typeof match.usd_price === 'number' && match.usd_price > 0 ? match.usd_price : undefined,
|
|
322
|
+
balanceFormatted: match.balance_formatted,
|
|
323
|
+
symbol: match.symbol,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Sanitize an amount STRING from an external source (e.g. Moralis
|
|
328
|
+
* `balance_formatted`): expand e-notation to a plain decimal; otherwise pass
|
|
329
|
+
* the original string through unchanged so we never lose precision by
|
|
330
|
+
* round-tripping a large/precise balance through `Number`.
|
|
331
|
+
*/
|
|
332
|
+
cleanAmountString(s) {
|
|
333
|
+
if (!/e/i.test(s))
|
|
334
|
+
return s;
|
|
335
|
+
const n = Number(s);
|
|
336
|
+
return Number.isFinite(n) ? this.toPlainDecimal(n) : s;
|
|
337
|
+
}
|
|
338
|
+
/** Format a number as a plain decimal string, expanding any e-notation. */
|
|
339
|
+
toPlainDecimal(n) {
|
|
340
|
+
const s = String(n);
|
|
341
|
+
if (!/e/i.test(s))
|
|
342
|
+
return s;
|
|
343
|
+
const neg = n < 0;
|
|
344
|
+
const [mantissa, expPart] = Math.abs(n).toString().split('e');
|
|
345
|
+
const exp = Number(expPart);
|
|
346
|
+
const [intPart, fracPart = ''] = mantissa.split('.');
|
|
347
|
+
const digits = intPart + fracPart;
|
|
348
|
+
let out;
|
|
349
|
+
if (exp >= 0) {
|
|
350
|
+
const pointPos = intPart.length + exp;
|
|
351
|
+
out =
|
|
352
|
+
pointPos >= digits.length
|
|
353
|
+
? digits.padEnd(pointPos, '0')
|
|
354
|
+
: `${digits.slice(0, pointPos)}.${digits.slice(pointPos)}`;
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
out = `0.${'0'.repeat(-exp - intPart.length)}${digits}`;
|
|
358
|
+
}
|
|
359
|
+
if (out.includes('.'))
|
|
360
|
+
out = out.replace(/\.?0+$/, '');
|
|
361
|
+
return neg ? `-${out}` : out;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Override `execute` so the `ui` payload we return from `run()` is lifted
|
|
365
|
+
* onto the ToolResult envelope (BaseTool only copies `data`).
|
|
366
|
+
*/
|
|
367
|
+
async execute(args, userContext) {
|
|
368
|
+
const callId = `call_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
369
|
+
const start = Date.now();
|
|
370
|
+
try {
|
|
371
|
+
const out = (await this.run(args, userContext));
|
|
372
|
+
const result = {
|
|
373
|
+
toolName: this.name,
|
|
374
|
+
callId,
|
|
375
|
+
success: true,
|
|
376
|
+
data: out,
|
|
377
|
+
duration: Date.now() - start,
|
|
378
|
+
};
|
|
379
|
+
if (out && typeof out === 'object' && out.ui) {
|
|
380
|
+
result.ui = out.ui;
|
|
381
|
+
}
|
|
382
|
+
if (out && Array.isArray(out.actionButtons) && out.actionButtons.length > 0) {
|
|
383
|
+
result.actionButtons = out.actionButtons;
|
|
384
|
+
}
|
|
385
|
+
return result;
|
|
386
|
+
}
|
|
387
|
+
catch (err) {
|
|
388
|
+
return {
|
|
389
|
+
toolName: this.name,
|
|
390
|
+
callId,
|
|
391
|
+
success: false,
|
|
392
|
+
error: err instanceof Error ? err.message : String(err),
|
|
393
|
+
duration: Date.now() - start,
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
async run(args, userContext) {
|
|
398
|
+
const wallet = this.requireWallet(userContext);
|
|
399
|
+
if (!wallet.ok)
|
|
400
|
+
return wallet.payload;
|
|
401
|
+
// The wallet can only sign on the chain it's connected to. If the user named
|
|
402
|
+
// a chain that differs from their connected chain, ask them to switch first
|
|
403
|
+
// instead of building an action they can't sign.
|
|
404
|
+
const mismatch = (0, chainResolver_1.detectChainMismatch)(args.chain, userContext);
|
|
405
|
+
if (mismatch) {
|
|
406
|
+
const actionName = this.actionType.replace(/_/g, ' ');
|
|
407
|
+
return {
|
|
408
|
+
error: 'wrong_chain',
|
|
409
|
+
_instructions: `The user asked to ${actionName} on ${mismatch.requestedLabel}, but their wallet is connected to ${mismatch.connectedLabel}. ` +
|
|
410
|
+
`Tell them, in their language, that to ${actionName} on ${mismatch.requestedLabel} they must first switch their wallet's network to ${mismatch.requestedLabel}, ` +
|
|
411
|
+
`or they can ${actionName} on ${mismatch.connectedLabel} (their current network) instead. Do NOT render the form. Do NOT mention tool names, UI, or forms.`,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
const chainId = this.requireChain(args, userContext);
|
|
415
|
+
if (!chainId) {
|
|
416
|
+
return {
|
|
417
|
+
error: 'missing_chain',
|
|
418
|
+
_instructions: 'No chain is set. Pass the hex chain id explicitly (e.g. "0x1") or set userContext.chain before calling.',
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
const built = await this.buildParameters(args, userContext);
|
|
422
|
+
if (built && typeof built === 'object' && 'error' in built && typeof built.error === 'string') {
|
|
423
|
+
return built;
|
|
424
|
+
}
|
|
425
|
+
// Tool wants to ask the user to pick something first — emit buttons,
|
|
426
|
+
// NOT a form. AgentCore aggregates `actionButtons` into the response.
|
|
427
|
+
if (built &&
|
|
428
|
+
typeof built === 'object' &&
|
|
429
|
+
'actionButtons' in built &&
|
|
430
|
+
Array.isArray(built.actionButtons)) {
|
|
431
|
+
return built;
|
|
432
|
+
}
|
|
433
|
+
// Tool emitted a custom UI payload (e.g. a preview component) — forward
|
|
434
|
+
// it as-is. Skip the default WalletActionProps form wrapping.
|
|
435
|
+
if (built &&
|
|
436
|
+
typeof built === 'object' &&
|
|
437
|
+
'ui' in built &&
|
|
438
|
+
built.ui &&
|
|
439
|
+
typeof built.ui === 'object' &&
|
|
440
|
+
typeof built.ui.component === 'string') {
|
|
441
|
+
return built;
|
|
442
|
+
}
|
|
443
|
+
const props = {
|
|
444
|
+
action: this.actionType,
|
|
445
|
+
chainId,
|
|
446
|
+
walletAddress: wallet.address,
|
|
447
|
+
parameters: built,
|
|
448
|
+
};
|
|
449
|
+
const ui = { component: this.component, props };
|
|
450
|
+
// Which user-input fields did we fail to pre-fill? The user has to enter
|
|
451
|
+
// those. The LLM should ask for exactly these (in the user's language),
|
|
452
|
+
// and only fall back to "review & confirm" once everything is filled.
|
|
453
|
+
const params = props.parameters;
|
|
454
|
+
const filled = (key) => {
|
|
455
|
+
const v = params[key];
|
|
456
|
+
return v != null && v !== '';
|
|
457
|
+
};
|
|
458
|
+
const missingLabels = this.userInputFields
|
|
459
|
+
.filter((f) => {
|
|
460
|
+
const keys = Array.isArray(f.key) ? f.key : [f.key];
|
|
461
|
+
// Filled when ANY of the keys has a value (single key = that one key).
|
|
462
|
+
return !keys.some(filled);
|
|
463
|
+
})
|
|
464
|
+
.map((f) => f.label);
|
|
465
|
+
// The user-input values we DID resolve, so the LLM repeats only real data
|
|
466
|
+
// and never invents one. e.g. "the amount to send: 1 ETH".
|
|
467
|
+
const knownDetails = this.userInputFields
|
|
468
|
+
.map((f) => {
|
|
469
|
+
const keys = Array.isArray(f.key) ? f.key : [f.key];
|
|
470
|
+
const key = keys.find(filled);
|
|
471
|
+
return key ? `${f.label}: ${params[key]}` : null;
|
|
472
|
+
})
|
|
473
|
+
.filter((s) => s != null);
|
|
474
|
+
const actionLabel = this.actionType.replace(/_/g, ' ');
|
|
475
|
+
// Shared across both branches: the model must never fabricate a value for a
|
|
476
|
+
// field the user hasn't given (the bug was inventing "[recipient address]").
|
|
477
|
+
const noFabricate = 'NEVER invent, guess, or insert a placeholder (e.g. "[recipient address]") for any detail the user has not ' +
|
|
478
|
+
'actually provided — only state values listed as already provided. Do NOT mention tool names, UI, or forms.';
|
|
479
|
+
const _instructions = missingLabels.length > 0
|
|
480
|
+
? `The ${actionLabel} is in progress but still needs input from the user. ` +
|
|
481
|
+
`Ask the user, in their language, to provide: ${missingLabels.join(', ')}. ` +
|
|
482
|
+
(knownDetails.length > 0 ? `Already provided: ${knownDetails.join('; ')}. ` : '') +
|
|
483
|
+
'Do NOT say "review and confirm" yet — there are still missing details to collect. ' +
|
|
484
|
+
`${noFabricate} Wait for the user to provide the missing details before proceeding.`
|
|
485
|
+
: `The ${actionLabel} has all required details. ` +
|
|
486
|
+
`In the user's language, ask the user to review and confirm to complete the ${actionLabel}. ` +
|
|
487
|
+
(knownDetails.length > 0 ? `Details provided: ${knownDetails.join('; ')}. ` : '') +
|
|
488
|
+
`${noFabricate} Wait for the user to confirm or edit before proceeding.`;
|
|
489
|
+
return {
|
|
490
|
+
ui,
|
|
491
|
+
action: this.actionType,
|
|
492
|
+
chainId,
|
|
493
|
+
parameters: props.parameters,
|
|
494
|
+
_instructions,
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
exports.BaseWalletActionTool = BaseWalletActionTool;
|
|
499
|
+
//# sourceMappingURL=BaseWalletActionTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseWalletActionTool.js","sourceRoot":"","sources":["../../../../src/tools/builtin/wallet-action/BaseWalletActionTool.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,kDAAuD;AACvD,qEAAgH;AAChH,uDAAgF;AAChF,6CAAkE;AAClE,6CAAmG;AAmBnG;;;;;;;;;GASG;AACH,MAAsB,oBAAqB,SAAQ,mBAAQ;IACzD,IAAI,GAAa,QAAQ,CAAC;IAC1B,QAAQ,GAAG,eAAe,CAAC;IAC3B,4EAA4E;IAC5E,6EAA6E;IAC7E,aAAa,GAAG,IAAI,CAAC;IAKrB;;;;;;;;;;;;;;OAcG;IACgB,eAAe,GAAsE,EAAE,CAAC;IAE3G;;;;OAIG;IACgB,OAAO,CAAkB;IAE5C,YAAY,MAA6B;QACvC,KAAK,EAAE,CAAC;QAC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