keyring-agent-core 0.2.0 → 0.2.2

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.
Files changed (417) hide show
  1. package/dist/index.d.ts +6692 -27
  2. package/dist/index.js +877 -70
  3. package/package.json +4 -3
  4. package/dist/agent/AgentCore.d.ts +0 -256
  5. package/dist/agent/AgentCore.d.ts.map +0 -1
  6. package/dist/agent/AgentCore.js +0 -1093
  7. package/dist/agent/AgentCore.js.map +0 -1
  8. package/dist/agent/QueryRewriter.d.ts +0 -84
  9. package/dist/agent/QueryRewriter.d.ts.map +0 -1
  10. package/dist/agent/QueryRewriter.js +0 -306
  11. package/dist/agent/QueryRewriter.js.map +0 -1
  12. package/dist/agent/Router.d.ts +0 -33
  13. package/dist/agent/Router.d.ts.map +0 -1
  14. package/dist/agent/Router.js +0 -229
  15. package/dist/agent/Router.js.map +0 -1
  16. package/dist/agent/Subagent.d.ts +0 -80
  17. package/dist/agent/Subagent.d.ts.map +0 -1
  18. package/dist/agent/Subagent.js +0 -272
  19. package/dist/agent/Subagent.js.map +0 -1
  20. package/dist/agent/Synthesizer.d.ts +0 -11
  21. package/dist/agent/Synthesizer.d.ts.map +0 -1
  22. package/dist/agent/Synthesizer.js +0 -86
  23. package/dist/agent/Synthesizer.js.map +0 -1
  24. package/dist/agent/chatGraph.d.ts +0 -364
  25. package/dist/agent/chatGraph.d.ts.map +0 -1
  26. package/dist/agent/chatGraph.js +0 -184
  27. package/dist/agent/chatGraph.js.map +0 -1
  28. package/dist/agent/index.d.ts +0 -10
  29. package/dist/agent/index.d.ts.map +0 -1
  30. package/dist/agent/index.js +0 -24
  31. package/dist/agent/index.js.map +0 -1
  32. package/dist/agent/subagents/AiAgent.d.ts +0 -6
  33. package/dist/agent/subagents/AiAgent.d.ts.map +0 -1
  34. package/dist/agent/subagents/AiAgent.js +0 -52
  35. package/dist/agent/subagents/AiAgent.js.map +0 -1
  36. package/dist/agent/subagents/NftAgent.d.ts +0 -6
  37. package/dist/agent/subagents/NftAgent.d.ts.map +0 -1
  38. package/dist/agent/subagents/NftAgent.js +0 -79
  39. package/dist/agent/subagents/NftAgent.js.map +0 -1
  40. package/dist/agent/subagents/PoolAgent.d.ts +0 -6
  41. package/dist/agent/subagents/PoolAgent.d.ts.map +0 -1
  42. package/dist/agent/subagents/PoolAgent.js +0 -184
  43. package/dist/agent/subagents/PoolAgent.js.map +0 -1
  44. package/dist/agent/subagents/PoolSubgraphAgent.d.ts +0 -6
  45. package/dist/agent/subagents/PoolSubgraphAgent.d.ts.map +0 -1
  46. package/dist/agent/subagents/PoolSubgraphAgent.js +0 -117
  47. package/dist/agent/subagents/PoolSubgraphAgent.js.map +0 -1
  48. package/dist/agent/subagents/TokenAgent.d.ts +0 -6
  49. package/dist/agent/subagents/TokenAgent.d.ts.map +0 -1
  50. package/dist/agent/subagents/TokenAgent.js +0 -76
  51. package/dist/agent/subagents/TokenAgent.js.map +0 -1
  52. package/dist/agent/subagents/WalletActionAgent.d.ts +0 -6
  53. package/dist/agent/subagents/WalletActionAgent.d.ts.map +0 -1
  54. package/dist/agent/subagents/WalletActionAgent.js +0 -55
  55. package/dist/agent/subagents/WalletActionAgent.js.map +0 -1
  56. package/dist/agent/subagents/WalletAgent.d.ts +0 -6
  57. package/dist/agent/subagents/WalletAgent.d.ts.map +0 -1
  58. package/dist/agent/subagents/WalletAgent.js +0 -93
  59. package/dist/agent/subagents/WalletAgent.js.map +0 -1
  60. package/dist/agent/subagents/index.d.ts +0 -34
  61. package/dist/agent/subagents/index.d.ts.map +0 -1
  62. package/dist/agent/subagents/index.js +0 -69
  63. package/dist/agent/subagents/index.js.map +0 -1
  64. package/dist/constants/abi.d.ts +0 -551
  65. package/dist/constants/abi.d.ts.map +0 -1
  66. package/dist/constants/abi.js +0 -690
  67. package/dist/constants/abi.js.map +0 -1
  68. package/dist/functions/pool.d.ts +0 -25
  69. package/dist/functions/pool.d.ts.map +0 -1
  70. package/dist/functions/pool.js +0 -151
  71. package/dist/functions/pool.js.map +0 -1
  72. package/dist/functions/web3.d.ts +0 -31
  73. package/dist/functions/web3.d.ts.map +0 -1
  74. package/dist/functions/web3.js +0 -232
  75. package/dist/functions/web3.js.map +0 -1
  76. package/dist/index.d.ts.map +0 -1
  77. package/dist/index.js.map +0 -1
  78. package/dist/llm/GeminiProvider.d.ts +0 -16
  79. package/dist/llm/GeminiProvider.d.ts.map +0 -1
  80. package/dist/llm/GeminiProvider.js +0 -329
  81. package/dist/llm/GeminiProvider.js.map +0 -1
  82. package/dist/llm/index.d.ts +0 -2
  83. package/dist/llm/index.d.ts.map +0 -1
  84. package/dist/llm/index.js +0 -6
  85. package/dist/llm/index.js.map +0 -1
  86. package/dist/memory/ChatHistory.d.ts +0 -83
  87. package/dist/memory/ChatHistory.d.ts.map +0 -1
  88. package/dist/memory/ChatHistory.js +0 -143
  89. package/dist/memory/ChatHistory.js.map +0 -1
  90. package/dist/memory/KnowledgeBase.d.ts +0 -38
  91. package/dist/memory/KnowledgeBase.d.ts.map +0 -1
  92. package/dist/memory/KnowledgeBase.js +0 -139
  93. package/dist/memory/KnowledgeBase.js.map +0 -1
  94. package/dist/memory/Summarizer.d.ts +0 -12
  95. package/dist/memory/Summarizer.d.ts.map +0 -1
  96. package/dist/memory/Summarizer.js +0 -39
  97. package/dist/memory/Summarizer.js.map +0 -1
  98. package/dist/memory/UpstashKnowledgeBase.d.ts +0 -124
  99. package/dist/memory/UpstashKnowledgeBase.d.ts.map +0 -1
  100. package/dist/memory/UpstashKnowledgeBase.js +0 -152
  101. package/dist/memory/UpstashKnowledgeBase.js.map +0 -1
  102. package/dist/memory/historyUtils.d.ts +0 -58
  103. package/dist/memory/historyUtils.d.ts.map +0 -1
  104. package/dist/memory/historyUtils.js +0 -190
  105. package/dist/memory/historyUtils.js.map +0 -1
  106. package/dist/memory/index.d.ts +0 -7
  107. package/dist/memory/index.d.ts.map +0 -1
  108. package/dist/memory/index.js +0 -12
  109. package/dist/memory/index.js.map +0 -1
  110. package/dist/memory/ingestKnowledgeBase.d.ts +0 -17
  111. package/dist/memory/ingestKnowledgeBase.d.ts.map +0 -1
  112. package/dist/memory/ingestKnowledgeBase.js +0 -35
  113. package/dist/memory/ingestKnowledgeBase.js.map +0 -1
  114. package/dist/services/MoralisService.d.ts +0 -1328
  115. package/dist/services/MoralisService.d.ts.map +0 -1
  116. package/dist/services/MoralisService.js +0 -1239
  117. package/dist/services/MoralisService.js.map +0 -1
  118. package/dist/services/PantographService.d.ts +0 -98
  119. package/dist/services/PantographService.d.ts.map +0 -1
  120. package/dist/services/PantographService.js +0 -451
  121. package/dist/services/PantographService.js.map +0 -1
  122. package/dist/services/PoolService.d.ts +0 -238
  123. package/dist/services/PoolService.d.ts.map +0 -1
  124. package/dist/services/PoolService.js +0 -485
  125. package/dist/services/PoolService.js.map +0 -1
  126. package/dist/services/UniswapService.d.ts +0 -289
  127. package/dist/services/UniswapService.d.ts.map +0 -1
  128. package/dist/services/UniswapService.js +0 -585
  129. package/dist/services/UniswapService.js.map +0 -1
  130. package/dist/services/UniswapSubgraphService.d.ts +0 -144
  131. package/dist/services/UniswapSubgraphService.d.ts.map +0 -1
  132. package/dist/services/UniswapSubgraphService.js +0 -606
  133. package/dist/services/UniswapSubgraphService.js.map +0 -1
  134. package/dist/services/rpc.d.ts +0 -35
  135. package/dist/services/rpc.d.ts.map +0 -1
  136. package/dist/services/rpc.js +0 -110
  137. package/dist/services/rpc.js.map +0 -1
  138. package/dist/services/swap/BaseSwapService.d.ts +0 -17
  139. package/dist/services/swap/BaseSwapService.d.ts.map +0 -1
  140. package/dist/services/swap/BaseSwapService.js +0 -19
  141. package/dist/services/swap/BaseSwapService.js.map +0 -1
  142. package/dist/services/swap/DebridgeAdapter.d.ts +0 -37
  143. package/dist/services/swap/DebridgeAdapter.d.ts.map +0 -1
  144. package/dist/services/swap/DebridgeAdapter.js +0 -243
  145. package/dist/services/swap/DebridgeAdapter.js.map +0 -1
  146. package/dist/services/swap/RelayAdapter.d.ts +0 -19
  147. package/dist/services/swap/RelayAdapter.d.ts.map +0 -1
  148. package/dist/services/swap/RelayAdapter.js +0 -189
  149. package/dist/services/swap/RelayAdapter.js.map +0 -1
  150. package/dist/services/swap/SwapServiceFactory.d.ts +0 -25
  151. package/dist/services/swap/SwapServiceFactory.d.ts.map +0 -1
  152. package/dist/services/swap/SwapServiceFactory.js +0 -79
  153. package/dist/services/swap/SwapServiceFactory.js.map +0 -1
  154. package/dist/services/swap/addresses.d.ts +0 -3
  155. package/dist/services/swap/addresses.d.ts.map +0 -1
  156. package/dist/services/swap/addresses.js +0 -68
  157. package/dist/services/swap/addresses.js.map +0 -1
  158. package/dist/services/swap/affiliate.d.ts +0 -17
  159. package/dist/services/swap/affiliate.d.ts.map +0 -1
  160. package/dist/services/swap/affiliate.js +0 -126
  161. package/dist/services/swap/affiliate.js.map +0 -1
  162. package/dist/services/swap/config.d.ts +0 -9
  163. package/dist/services/swap/config.d.ts.map +0 -1
  164. package/dist/services/swap/config.js +0 -19
  165. package/dist/services/swap/config.js.map +0 -1
  166. package/dist/services/swap/index.d.ts +0 -10
  167. package/dist/services/swap/index.d.ts.map +0 -1
  168. package/dist/services/swap/index.js +0 -22
  169. package/dist/services/swap/index.js.map +0 -1
  170. package/dist/services/swap/types.d.ts +0 -89
  171. package/dist/services/swap/types.d.ts.map +0 -1
  172. package/dist/services/swap/types.js +0 -6
  173. package/dist/services/swap/types.js.map +0 -1
  174. package/dist/tools/BaseTool.d.ts +0 -15
  175. package/dist/tools/BaseTool.d.ts.map +0 -1
  176. package/dist/tools/BaseTool.js +0 -35
  177. package/dist/tools/BaseTool.js.map +0 -1
  178. package/dist/tools/ToolRegistry.d.ts +0 -27
  179. package/dist/tools/ToolRegistry.d.ts.map +0 -1
  180. package/dist/tools/ToolRegistry.js +0 -80
  181. package/dist/tools/ToolRegistry.js.map +0 -1
  182. package/dist/tools/builtin/ai/GeminiSearchAiTool.d.ts +0 -36
  183. package/dist/tools/builtin/ai/GeminiSearchAiTool.d.ts.map +0 -1
  184. package/dist/tools/builtin/ai/GeminiSearchAiTool.js +0 -91
  185. package/dist/tools/builtin/ai/GeminiSearchAiTool.js.map +0 -1
  186. package/dist/tools/builtin/ai/index.d.ts +0 -3
  187. package/dist/tools/builtin/ai/index.d.ts.map +0 -1
  188. package/dist/tools/builtin/ai/index.js +0 -6
  189. package/dist/tools/builtin/ai/index.js.map +0 -1
  190. package/dist/tools/builtin/index.d.ts +0 -8
  191. package/dist/tools/builtin/index.d.ts.map +0 -1
  192. package/dist/tools/builtin/index.js +0 -24
  193. package/dist/tools/builtin/index.js.map +0 -1
  194. package/dist/tools/builtin/nft/BaseNftMessageTool.d.ts +0 -35
  195. package/dist/tools/builtin/nft/BaseNftMessageTool.d.ts.map +0 -1
  196. package/dist/tools/builtin/nft/BaseNftMessageTool.js +0 -45
  197. package/dist/tools/builtin/nft/BaseNftMessageTool.js.map +0 -1
  198. package/dist/tools/builtin/nft/NFTContractInfoTool.d.ts +0 -15
  199. package/dist/tools/builtin/nft/NFTContractInfoTool.d.ts.map +0 -1
  200. package/dist/tools/builtin/nft/NFTContractInfoTool.js +0 -19
  201. package/dist/tools/builtin/nft/NFTContractInfoTool.js.map +0 -1
  202. package/dist/tools/builtin/nft/NFTMetadataTool.d.ts +0 -15
  203. package/dist/tools/builtin/nft/NFTMetadataTool.d.ts.map +0 -1
  204. package/dist/tools/builtin/nft/NFTMetadataTool.js +0 -20
  205. package/dist/tools/builtin/nft/NFTMetadataTool.js.map +0 -1
  206. package/dist/tools/builtin/nft/SendNftTool.d.ts +0 -14
  207. package/dist/tools/builtin/nft/SendNftTool.d.ts.map +0 -1
  208. package/dist/tools/builtin/nft/SendNftTool.js +0 -20
  209. package/dist/tools/builtin/nft/SendNftTool.js.map +0 -1
  210. package/dist/tools/builtin/nft/WalletNFTsTool.d.ts +0 -15
  211. package/dist/tools/builtin/nft/WalletNFTsTool.d.ts.map +0 -1
  212. package/dist/tools/builtin/nft/WalletNFTsTool.js +0 -20
  213. package/dist/tools/builtin/nft/WalletNFTsTool.js.map +0 -1
  214. package/dist/tools/builtin/nft/index.d.ts +0 -7
  215. package/dist/tools/builtin/nft/index.d.ts.map +0 -1
  216. package/dist/tools/builtin/nft/index.js +0 -10
  217. package/dist/tools/builtin/nft/index.js.map +0 -1
  218. package/dist/tools/builtin/pool/EstimatePoolYieldTool.d.ts +0 -124
  219. package/dist/tools/builtin/pool/EstimatePoolYieldTool.d.ts.map +0 -1
  220. package/dist/tools/builtin/pool/EstimatePoolYieldTool.js +0 -236
  221. package/dist/tools/builtin/pool/EstimatePoolYieldTool.js.map +0 -1
  222. package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.d.ts +0 -128
  223. package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.d.ts.map +0 -1
  224. package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.js +0 -520
  225. package/dist/tools/builtin/pool/OpenAddLiquidityFormTool.js.map +0 -1
  226. package/dist/tools/builtin/pool/PoolByAddressTool.d.ts +0 -127
  227. package/dist/tools/builtin/pool/PoolByAddressTool.d.ts.map +0 -1
  228. package/dist/tools/builtin/pool/PoolByAddressTool.js +0 -238
  229. package/dist/tools/builtin/pool/PoolByAddressTool.js.map +0 -1
  230. package/dist/tools/builtin/pool/PoolDetailTool.d.ts +0 -127
  231. package/dist/tools/builtin/pool/PoolDetailTool.d.ts.map +0 -1
  232. package/dist/tools/builtin/pool/PoolDetailTool.js +0 -273
  233. package/dist/tools/builtin/pool/PoolDetailTool.js.map +0 -1
  234. package/dist/tools/builtin/pool/PoolSearchTool.d.ts +0 -50
  235. package/dist/tools/builtin/pool/PoolSearchTool.d.ts.map +0 -1
  236. package/dist/tools/builtin/pool/PoolSearchTool.js +0 -160
  237. package/dist/tools/builtin/pool/PoolSearchTool.js.map +0 -1
  238. package/dist/tools/builtin/pool/PreviewAddLiquidityTool.d.ts +0 -124
  239. package/dist/tools/builtin/pool/PreviewAddLiquidityTool.d.ts.map +0 -1
  240. package/dist/tools/builtin/pool/PreviewAddLiquidityTool.js +0 -382
  241. package/dist/tools/builtin/pool/PreviewAddLiquidityTool.js.map +0 -1
  242. package/dist/tools/builtin/pool/TopPoolsTool.d.ts +0 -68
  243. package/dist/tools/builtin/pool/TopPoolsTool.d.ts.map +0 -1
  244. package/dist/tools/builtin/pool/TopPoolsTool.js +0 -159
  245. package/dist/tools/builtin/pool/TopPoolsTool.js.map +0 -1
  246. package/dist/tools/builtin/pool/index.d.ts +0 -15
  247. package/dist/tools/builtin/pool/index.d.ts.map +0 -1
  248. package/dist/tools/builtin/pool/index.js +0 -18
  249. package/dist/tools/builtin/pool/index.js.map +0 -1
  250. package/dist/tools/builtin/pool-subgraph/SubgraphCoinPoolPairsTool.d.ts +0 -54
  251. package/dist/tools/builtin/pool-subgraph/SubgraphCoinPoolPairsTool.d.ts.map +0 -1
  252. package/dist/tools/builtin/pool-subgraph/SubgraphCoinPoolPairsTool.js +0 -98
  253. package/dist/tools/builtin/pool-subgraph/SubgraphCoinPoolPairsTool.js.map +0 -1
  254. package/dist/tools/builtin/pool-subgraph/SubgraphPoolByAddressTool.d.ts +0 -63
  255. package/dist/tools/builtin/pool-subgraph/SubgraphPoolByAddressTool.d.ts.map +0 -1
  256. package/dist/tools/builtin/pool-subgraph/SubgraphPoolByAddressTool.js +0 -82
  257. package/dist/tools/builtin/pool-subgraph/SubgraphPoolByAddressTool.js.map +0 -1
  258. package/dist/tools/builtin/pool-subgraph/SubgraphPoolByPositionIdTool.d.ts +0 -79
  259. package/dist/tools/builtin/pool-subgraph/SubgraphPoolByPositionIdTool.d.ts.map +0 -1
  260. package/dist/tools/builtin/pool-subgraph/SubgraphPoolByPositionIdTool.js +0 -97
  261. package/dist/tools/builtin/pool-subgraph/SubgraphPoolByPositionIdTool.js.map +0 -1
  262. package/dist/tools/builtin/pool-subgraph/SubgraphPoolSearchTool.d.ts +0 -77
  263. package/dist/tools/builtin/pool-subgraph/SubgraphPoolSearchTool.d.ts.map +0 -1
  264. package/dist/tools/builtin/pool-subgraph/SubgraphPoolSearchTool.js +0 -190
  265. package/dist/tools/builtin/pool-subgraph/SubgraphPoolSearchTool.js.map +0 -1
  266. package/dist/tools/builtin/pool-subgraph/SubgraphPositionDetailTool.d.ts +0 -107
  267. package/dist/tools/builtin/pool-subgraph/SubgraphPositionDetailTool.d.ts.map +0 -1
  268. package/dist/tools/builtin/pool-subgraph/SubgraphPositionDetailTool.js +0 -92
  269. package/dist/tools/builtin/pool-subgraph/SubgraphPositionDetailTool.js.map +0 -1
  270. package/dist/tools/builtin/pool-subgraph/SubgraphTrendingPoolsTool.d.ts +0 -56
  271. package/dist/tools/builtin/pool-subgraph/SubgraphTrendingPoolsTool.d.ts.map +0 -1
  272. package/dist/tools/builtin/pool-subgraph/SubgraphTrendingPoolsTool.js +0 -94
  273. package/dist/tools/builtin/pool-subgraph/SubgraphTrendingPoolsTool.js.map +0 -1
  274. package/dist/tools/builtin/pool-subgraph/index.d.ts +0 -13
  275. package/dist/tools/builtin/pool-subgraph/index.d.ts.map +0 -1
  276. package/dist/tools/builtin/pool-subgraph/index.js +0 -18
  277. package/dist/tools/builtin/pool-subgraph/index.js.map +0 -1
  278. package/dist/tools/builtin/token/TokenAnalyticsTool.d.ts +0 -71
  279. package/dist/tools/builtin/token/TokenAnalyticsTool.d.ts.map +0 -1
  280. package/dist/tools/builtin/token/TokenAnalyticsTool.js +0 -147
  281. package/dist/tools/builtin/token/TokenAnalyticsTool.js.map +0 -1
  282. package/dist/tools/builtin/token/TokenHoldersTool.d.ts +0 -81
  283. package/dist/tools/builtin/token/TokenHoldersTool.d.ts.map +0 -1
  284. package/dist/tools/builtin/token/TokenHoldersTool.js +0 -139
  285. package/dist/tools/builtin/token/TokenHoldersTool.js.map +0 -1
  286. package/dist/tools/builtin/token/TokenInfoTool.d.ts +0 -40
  287. package/dist/tools/builtin/token/TokenInfoTool.d.ts.map +0 -1
  288. package/dist/tools/builtin/token/TokenInfoTool.js +0 -221
  289. package/dist/tools/builtin/token/TokenInfoTool.js.map +0 -1
  290. package/dist/tools/builtin/token/TokenScoreTool.d.ts +0 -63
  291. package/dist/tools/builtin/token/TokenScoreTool.d.ts.map +0 -1
  292. package/dist/tools/builtin/token/TokenScoreTool.js +0 -148
  293. package/dist/tools/builtin/token/TokenScoreTool.js.map +0 -1
  294. package/dist/tools/builtin/token/TopGainersTool.d.ts +0 -37
  295. package/dist/tools/builtin/token/TopGainersTool.d.ts.map +0 -1
  296. package/dist/tools/builtin/token/TopGainersTool.js +0 -100
  297. package/dist/tools/builtin/token/TopGainersTool.js.map +0 -1
  298. package/dist/tools/builtin/token/TopLosersTool.d.ts +0 -66
  299. package/dist/tools/builtin/token/TopLosersTool.d.ts.map +0 -1
  300. package/dist/tools/builtin/token/TopLosersTool.js +0 -129
  301. package/dist/tools/builtin/token/TopLosersTool.js.map +0 -1
  302. package/dist/tools/builtin/token/TrendingTokensTool.d.ts +0 -39
  303. package/dist/tools/builtin/token/TrendingTokensTool.d.ts.map +0 -1
  304. package/dist/tools/builtin/token/TrendingTokensTool.js +0 -83
  305. package/dist/tools/builtin/token/TrendingTokensTool.js.map +0 -1
  306. package/dist/tools/builtin/token/index.d.ts +0 -13
  307. package/dist/tools/builtin/token/index.d.ts.map +0 -1
  308. package/dist/tools/builtin/token/index.js +0 -16
  309. package/dist/tools/builtin/token/index.js.map +0 -1
  310. package/dist/tools/builtin/wallet/TransactionByHashTool.d.ts +0 -70
  311. package/dist/tools/builtin/wallet/TransactionByHashTool.d.ts.map +0 -1
  312. package/dist/tools/builtin/wallet/TransactionByHashTool.js +0 -111
  313. package/dist/tools/builtin/wallet/TransactionByHashTool.js.map +0 -1
  314. package/dist/tools/builtin/wallet/WalletApprovalsTool.d.ts +0 -107
  315. package/dist/tools/builtin/wallet/WalletApprovalsTool.d.ts.map +0 -1
  316. package/dist/tools/builtin/wallet/WalletApprovalsTool.js +0 -164
  317. package/dist/tools/builtin/wallet/WalletApprovalsTool.js.map +0 -1
  318. package/dist/tools/builtin/wallet/WalletDefiPositionsTool.d.ts +0 -61
  319. package/dist/tools/builtin/wallet/WalletDefiPositionsTool.d.ts.map +0 -1
  320. package/dist/tools/builtin/wallet/WalletDefiPositionsTool.js +0 -100
  321. package/dist/tools/builtin/wallet/WalletDefiPositionsTool.js.map +0 -1
  322. package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.d.ts +0 -68
  323. package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.d.ts.map +0 -1
  324. package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.js +0 -115
  325. package/dist/tools/builtin/wallet/WalletDefiProtocolPositionsTool.js.map +0 -1
  326. package/dist/tools/builtin/wallet/WalletDefiSummaryTool.d.ts +0 -50
  327. package/dist/tools/builtin/wallet/WalletDefiSummaryTool.d.ts.map +0 -1
  328. package/dist/tools/builtin/wallet/WalletDefiSummaryTool.js +0 -80
  329. package/dist/tools/builtin/wallet/WalletDefiSummaryTool.js.map +0 -1
  330. package/dist/tools/builtin/wallet/WalletHistoryTool.d.ts +0 -31
  331. package/dist/tools/builtin/wallet/WalletHistoryTool.d.ts.map +0 -1
  332. package/dist/tools/builtin/wallet/WalletHistoryTool.js +0 -154
  333. package/dist/tools/builtin/wallet/WalletHistoryTool.js.map +0 -1
  334. package/dist/tools/builtin/wallet/WalletNetWorthTool.d.ts +0 -44
  335. package/dist/tools/builtin/wallet/WalletNetWorthTool.d.ts.map +0 -1
  336. package/dist/tools/builtin/wallet/WalletNetWorthTool.js +0 -122
  337. package/dist/tools/builtin/wallet/WalletNetWorthTool.js.map +0 -1
  338. package/dist/tools/builtin/wallet/WalletNftTransfersTool.d.ts +0 -86
  339. package/dist/tools/builtin/wallet/WalletNftTransfersTool.d.ts.map +0 -1
  340. package/dist/tools/builtin/wallet/WalletNftTransfersTool.js +0 -265
  341. package/dist/tools/builtin/wallet/WalletNftTransfersTool.js.map +0 -1
  342. package/dist/tools/builtin/wallet/WalletPnlSummaryTool.d.ts +0 -43
  343. package/dist/tools/builtin/wallet/WalletPnlSummaryTool.d.ts.map +0 -1
  344. package/dist/tools/builtin/wallet/WalletPnlSummaryTool.js +0 -89
  345. package/dist/tools/builtin/wallet/WalletPnlSummaryTool.js.map +0 -1
  346. package/dist/tools/builtin/wallet/WalletPnlTool.d.ts +0 -43
  347. package/dist/tools/builtin/wallet/WalletPnlTool.d.ts.map +0 -1
  348. package/dist/tools/builtin/wallet/WalletPnlTool.js +0 -175
  349. package/dist/tools/builtin/wallet/WalletPnlTool.js.map +0 -1
  350. package/dist/tools/builtin/wallet/WalletTokenBalancesTool.d.ts +0 -35
  351. package/dist/tools/builtin/wallet/WalletTokenBalancesTool.d.ts.map +0 -1
  352. package/dist/tools/builtin/wallet/WalletTokenBalancesTool.js +0 -68
  353. package/dist/tools/builtin/wallet/WalletTokenBalancesTool.js.map +0 -1
  354. package/dist/tools/builtin/wallet/WalletTokenTransfersTool.d.ts +0 -109
  355. package/dist/tools/builtin/wallet/WalletTokenTransfersTool.d.ts.map +0 -1
  356. package/dist/tools/builtin/wallet/WalletTokenTransfersTool.js +0 -354
  357. package/dist/tools/builtin/wallet/WalletTokenTransfersTool.js.map +0 -1
  358. package/dist/tools/builtin/wallet/index.d.ts +0 -28
  359. package/dist/tools/builtin/wallet/index.d.ts.map +0 -1
  360. package/dist/tools/builtin/wallet/index.js +0 -32
  361. package/dist/tools/builtin/wallet/index.js.map +0 -1
  362. package/dist/tools/builtin/wallet-action/ApproveTokenTool.d.ts +0 -25
  363. package/dist/tools/builtin/wallet-action/ApproveTokenTool.d.ts.map +0 -1
  364. package/dist/tools/builtin/wallet-action/ApproveTokenTool.js +0 -98
  365. package/dist/tools/builtin/wallet-action/ApproveTokenTool.js.map +0 -1
  366. package/dist/tools/builtin/wallet-action/BaseWalletActionTool.d.ts +0 -211
  367. package/dist/tools/builtin/wallet-action/BaseWalletActionTool.d.ts.map +0 -1
  368. package/dist/tools/builtin/wallet-action/BaseWalletActionTool.js +0 -499
  369. package/dist/tools/builtin/wallet-action/BaseWalletActionTool.js.map +0 -1
  370. package/dist/tools/builtin/wallet-action/BuyTokenTool.d.ts +0 -240
  371. package/dist/tools/builtin/wallet-action/BuyTokenTool.d.ts.map +0 -1
  372. package/dist/tools/builtin/wallet-action/BuyTokenTool.js +0 -1257
  373. package/dist/tools/builtin/wallet-action/BuyTokenTool.js.map +0 -1
  374. package/dist/tools/builtin/wallet-action/SendNativeTool.d.ts +0 -41
  375. package/dist/tools/builtin/wallet-action/SendNativeTool.d.ts.map +0 -1
  376. package/dist/tools/builtin/wallet-action/SendNativeTool.js +0 -127
  377. package/dist/tools/builtin/wallet-action/SendNativeTool.js.map +0 -1
  378. package/dist/tools/builtin/wallet-action/SendTokenTool.d.ts +0 -63
  379. package/dist/tools/builtin/wallet-action/SendTokenTool.d.ts.map +0 -1
  380. package/dist/tools/builtin/wallet-action/SendTokenTool.js +0 -294
  381. package/dist/tools/builtin/wallet-action/SendTokenTool.js.map +0 -1
  382. package/dist/tools/builtin/wallet-action/SwapTokenTool.d.ts +0 -247
  383. package/dist/tools/builtin/wallet-action/SwapTokenTool.d.ts.map +0 -1
  384. package/dist/tools/builtin/wallet-action/SwapTokenTool.js +0 -1258
  385. package/dist/tools/builtin/wallet-action/SwapTokenTool.js.map +0 -1
  386. package/dist/tools/builtin/wallet-action/UnwrapNativeTool.d.ts +0 -20
  387. package/dist/tools/builtin/wallet-action/UnwrapNativeTool.d.ts.map +0 -1
  388. package/dist/tools/builtin/wallet-action/UnwrapNativeTool.js +0 -36
  389. package/dist/tools/builtin/wallet-action/UnwrapNativeTool.js.map +0 -1
  390. package/dist/tools/builtin/wallet-action/WrapNativeTool.d.ts +0 -23
  391. package/dist/tools/builtin/wallet-action/WrapNativeTool.d.ts.map +0 -1
  392. package/dist/tools/builtin/wallet-action/WrapNativeTool.js +0 -54
  393. package/dist/tools/builtin/wallet-action/WrapNativeTool.js.map +0 -1
  394. package/dist/tools/builtin/wallet-action/amountSpec.d.ts +0 -62
  395. package/dist/tools/builtin/wallet-action/amountSpec.d.ts.map +0 -1
  396. package/dist/tools/builtin/wallet-action/amountSpec.js +0 -93
  397. package/dist/tools/builtin/wallet-action/amountSpec.js.map +0 -1
  398. package/dist/tools/builtin/wallet-action/gasReserve.d.ts +0 -42
  399. package/dist/tools/builtin/wallet-action/gasReserve.d.ts.map +0 -1
  400. package/dist/tools/builtin/wallet-action/gasReserve.js +0 -103
  401. package/dist/tools/builtin/wallet-action/gasReserve.js.map +0 -1
  402. package/dist/tools/builtin/wallet-action/index.d.ts +0 -9
  403. package/dist/tools/builtin/wallet-action/index.d.ts.map +0 -1
  404. package/dist/tools/builtin/wallet-action/index.js +0 -20
  405. package/dist/tools/builtin/wallet-action/index.js.map +0 -1
  406. package/dist/tools/chainResolver.d.ts +0 -98
  407. package/dist/tools/chainResolver.d.ts.map +0 -1
  408. package/dist/tools/chainResolver.js +0 -302
  409. package/dist/tools/chainResolver.js.map +0 -1
  410. package/dist/tools/index.d.ts +0 -4
  411. package/dist/tools/index.d.ts.map +0 -1
  412. package/dist/tools/index.js +0 -23
  413. package/dist/tools/index.js.map +0 -1
  414. package/dist/types/index.d.ts +0 -777
  415. package/dist/types/index.d.ts.map +0 -1
  416. package/dist/types/index.js +0 -6
  417. package/dist/types/index.js.map +0 -1
@@ -1,499 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseWalletAction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